@@ -8144,6 +8144,27 @@
|
||||
</translation>
|
||||
</translations>
|
||||
</concept_node>
|
||||
<concept_node>
|
||||
<name>allow_text_message</name>
|
||||
<definition_loaded>false</definition_loaded>
|
||||
<description></description>
|
||||
<comment></comment>
|
||||
<default_text></default_text>
|
||||
<translations>
|
||||
<translation>
|
||||
<language>en-US</language>
|
||||
<approved>false</approved>
|
||||
</translation>
|
||||
<translation>
|
||||
<language>es-MX</language>
|
||||
<approved>false</approved>
|
||||
</translation>
|
||||
<translation>
|
||||
<language>fr-CA</language>
|
||||
<approved>false</approved>
|
||||
</translation>
|
||||
</translations>
|
||||
</concept_node>
|
||||
<concept_node>
|
||||
<name>checklist</name>
|
||||
<definition_loaded>false</definition_loaded>
|
||||
|
||||
@@ -18,6 +18,7 @@ import DateTimePicker from "../../../form-date-time-picker/form-date-time-picker
|
||||
import moment from "moment-business-days";
|
||||
import { insertAuditTrail } from "../../../../redux/application/application.actions";
|
||||
import AuditTrailMapping from "../../../../utils/AuditTrailMappings";
|
||||
import { UPDATE_OWNER } from "../../../../graphql/owners.queries";
|
||||
|
||||
const mapStateToProps = createStructuredSelector({
|
||||
bodyshop: selectBodyshop,
|
||||
@@ -41,6 +42,8 @@ export function JobChecklistForm({
|
||||
const [intakeJob] = useMutation(UPDATE_JOB);
|
||||
const [loading, setLoading] = useState(false);
|
||||
const [markAptArrived] = useMutation(MARK_LATEST_APPOINTMENT_AS_ARRIVED);
|
||||
const [updateOwner] = useMutation(UPDATE_OWNER);
|
||||
|
||||
const { jobId } = useParams();
|
||||
const history = useHistory();
|
||||
const search = queryString.parse(useLocation().search);
|
||||
@@ -114,6 +117,23 @@ export function JobChecklistForm({
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
//Updae Owner Allow to Text
|
||||
const updateOwnerResult = await updateOwner({
|
||||
variables: {
|
||||
ownerId: job.owner.id,
|
||||
owner: { allow_text_message: values.allow_text_message },
|
||||
},
|
||||
});
|
||||
|
||||
if (!!updateOwnerResult.errors) {
|
||||
notification["error"]({
|
||||
message: t("checklist.errors.complete", {
|
||||
error: JSON.stringify(result.errors),
|
||||
}),
|
||||
});
|
||||
}
|
||||
|
||||
setLoading(false);
|
||||
|
||||
if (!!!result.errors) {
|
||||
@@ -156,6 +176,7 @@ export function JobChecklistForm({
|
||||
initialValues={{
|
||||
...(type === "intake" && {
|
||||
addToProduction: true,
|
||||
allow_text_message: job.owner.allow_text_message,
|
||||
scheduled_completion:
|
||||
(job && job.scheduled_completion) ||
|
||||
moment().businessAdd(
|
||||
@@ -191,6 +212,14 @@ export function JobChecklistForm({
|
||||
>
|
||||
<Switch disabled={readOnly} />
|
||||
</Form.Item>
|
||||
<Form.Item
|
||||
name="allow_text_message"
|
||||
valuePropName="checked"
|
||||
label={t("checklist.labels.allow_text_message")}
|
||||
disabled={readOnly}
|
||||
>
|
||||
<Switch disabled={readOnly} />
|
||||
</Form.Item>
|
||||
<Form.Item
|
||||
name="scheduled_completion"
|
||||
label={t("jobs.fields.scheduled_completion")}
|
||||
|
||||
@@ -75,7 +75,7 @@ export function JobsAvailableContainer({
|
||||
const client = useApolloClient();
|
||||
|
||||
const estDataLazyLoad = useLazyQuery(QUERY_AVAILABLE_NEW_JOBS_EST_DATA_BY_PK);
|
||||
const [loadEstData, estData] = estDataLazyLoad;
|
||||
const [loadEstData, estDataRaw] = estDataLazyLoad;
|
||||
|
||||
const importOptionsState = useState({ overrideHeaders: false });
|
||||
const importOptions = importOptionsState[0];
|
||||
@@ -88,11 +88,13 @@ export function JobsAvailableContainer({
|
||||
setOwnerModalVisible(false);
|
||||
setInsertLoading(true);
|
||||
|
||||
const estData = replaceEmpty(estDataRaw.data.available_jobs_by_pk);
|
||||
|
||||
if (
|
||||
!(
|
||||
estData.data &&
|
||||
estData.data.available_jobs_by_pk &&
|
||||
estData.data.available_jobs_by_pk.est_data
|
||||
|
||||
estData &&
|
||||
estData.est_data
|
||||
)
|
||||
) {
|
||||
//We don't have the right data. Error!
|
||||
@@ -106,28 +108,28 @@ export function JobsAvailableContainer({
|
||||
const newTotals = (
|
||||
await Axios.post("/job/totals", {
|
||||
job: {
|
||||
...estData.data.available_jobs_by_pk.est_data,
|
||||
joblines: estData.data.available_jobs_by_pk.est_data.joblines.data,
|
||||
...estData.est_data,
|
||||
joblines: estData.est_data.joblines.data,
|
||||
},
|
||||
})
|
||||
).data;
|
||||
|
||||
let existingVehicles;
|
||||
if (
|
||||
estData.data.available_jobs_by_pk.est_data.vehicle &&
|
||||
estData.data.available_jobs_by_pk.est_data.vin
|
||||
estData.est_data.vehicle &&
|
||||
estData.est_data.vin
|
||||
) {
|
||||
//There's vehicle data, need to double check the VIN.
|
||||
existingVehicles = await client.query({
|
||||
query: SEARCH_VEHICLE_BY_VIN,
|
||||
variables: {
|
||||
vin: estData.data.available_jobs_by_pk.est_data.vehicle.data.v_vin,
|
||||
vin: estData.est_data.vehicle.data.v_vin,
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
const newJob = {
|
||||
...estData.data.available_jobs_by_pk.est_data,
|
||||
...estData.est_data,
|
||||
clm_total: Dinero(newTotals.totals.total_repairs).toFormat("0.00"),
|
||||
owner_owing: Dinero(newTotals.totals.custPayable.total).toFormat("0.00"),
|
||||
job_totals: newTotals,
|
||||
@@ -172,7 +174,7 @@ export function JobsAvailableContainer({
|
||||
});
|
||||
|
||||
deleteJob({
|
||||
variables: { id: estData.data.available_jobs_by_pk.id },
|
||||
variables: { id: estData.id },
|
||||
}).then((r) => {
|
||||
refetch();
|
||||
setInsertLoading(false);
|
||||
@@ -194,12 +196,12 @@ export function JobsAvailableContainer({
|
||||
|
||||
setJobModalVisible(false);
|
||||
setInsertLoading(true);
|
||||
|
||||
const estData = replaceEmpty(estDataRaw.data.available_jobs_by_pk);
|
||||
if (
|
||||
!(
|
||||
estData.data &&
|
||||
estData.data.available_jobs_by_pk &&
|
||||
estData.data.available_jobs_by_pk.est_data
|
||||
|
||||
estData &&
|
||||
estData.est_data
|
||||
)
|
||||
) {
|
||||
//We don't have the right data. Error!
|
||||
@@ -209,7 +211,7 @@ export function JobsAvailableContainer({
|
||||
});
|
||||
} else {
|
||||
//create upsert job
|
||||
let supp = _.cloneDeep(estData.data.available_jobs_by_pk.est_data);
|
||||
let supp = _.cloneDeep(estData.est_data);
|
||||
|
||||
delete supp.owner;
|
||||
delete supp.vehicle;
|
||||
@@ -220,7 +222,7 @@ export function JobsAvailableContainer({
|
||||
let suppDelta = await GetSupplementDelta(
|
||||
client,
|
||||
selectedJob,
|
||||
estData.data.available_jobs_by_pk.est_data.joblines.data
|
||||
estData.est_data.joblines.data
|
||||
);
|
||||
|
||||
delete supp.joblines;
|
||||
@@ -279,7 +281,7 @@ export function JobsAvailableContainer({
|
||||
//Job has been inserted. Clean up the available jobs record.
|
||||
|
||||
deleteJob({
|
||||
variables: { id: estData.data.available_jobs_by_pk.id },
|
||||
variables: { id: estData.id },
|
||||
}).then((r) => {
|
||||
refetch();
|
||||
setInsertLoading(false);
|
||||
@@ -305,13 +307,13 @@ export function JobsAvailableContainer({
|
||||
};
|
||||
|
||||
const owner =
|
||||
estData.data &&
|
||||
estData.data.available_jobs_by_pk &&
|
||||
estData.data.available_jobs_by_pk.est_data &&
|
||||
estData.data.available_jobs_by_pk.est_data.owner &&
|
||||
estData.data.available_jobs_by_pk.est_data.owner.data &&
|
||||
!estData.data.available_jobs_by_pk.issupplement
|
||||
? estData.data.available_jobs_by_pk.est_data.owner.data
|
||||
estDataRaw.data &&
|
||||
estDataRaw.data.available_jobs_by_pk &&
|
||||
estDataRaw.data.available_jobs_by_pk.est_data &&
|
||||
estDataRaw.data.available_jobs_by_pk.est_data.owner &&
|
||||
estDataRaw.data.available_jobs_by_pk.est_data.owner.data &&
|
||||
!estDataRaw.data.available_jobs_by_pk.issupplement
|
||||
? estDataRaw.data.available_jobs_by_pk.est_data.owner.data
|
||||
: null;
|
||||
|
||||
const onOwnerModalCancel = () => {
|
||||
@@ -349,8 +351,8 @@ export function JobsAvailableContainer({
|
||||
message={t("jobs.labels.creating_new_job")}
|
||||
>
|
||||
<OwnerFindModalContainer
|
||||
loading={estData.loading}
|
||||
error={estData.error}
|
||||
loading={estDataRaw.loading}
|
||||
error={estDataRaw.error}
|
||||
owner={owner}
|
||||
selectedOwner={selectedOwner}
|
||||
setSelectedOwner={setSelectedOwner}
|
||||
@@ -359,8 +361,8 @@ export function JobsAvailableContainer({
|
||||
onCancel={onOwnerModalCancel}
|
||||
/>
|
||||
<JobsFindModalContainer
|
||||
loading={estData.loading}
|
||||
error={estData.error}
|
||||
loading={estDataRaw.loading}
|
||||
error={estDataRaw.error}
|
||||
selectedJob={selectedJob}
|
||||
setSelectedJob={setSelectedJob}
|
||||
importOptionsState={importOptionsState}
|
||||
@@ -390,3 +392,12 @@ export default connect(
|
||||
mapStateToProps,
|
||||
mapDispatchToProps
|
||||
)(JobsAvailableContainer);
|
||||
|
||||
function replaceEmpty(someObj, replaceValue = null) {
|
||||
const replacer = (key, value) => (value === "" ? replaceValue : value);
|
||||
//^ because you seem to want to replace (strings) "null" or "undefined" too
|
||||
console.log(someObj)
|
||||
const temp = JSON.stringify(someObj, replacer);
|
||||
console.log(`temp`, temp);
|
||||
return JSON.parse(temp);
|
||||
}
|
||||
|
||||
@@ -25,6 +25,7 @@ export function ProductionListTable({
|
||||
currentUser,
|
||||
state,
|
||||
setColumns,
|
||||
setState,
|
||||
}) {
|
||||
const { t } = useTranslation();
|
||||
const [updateDefaultProdView] = useMutation(UPDATE_ACTIVE_PROD_LIST_VIEW);
|
||||
@@ -43,6 +44,10 @@ export function ProductionListTable({
|
||||
};
|
||||
})
|
||||
);
|
||||
setState(
|
||||
bodyshop.production_config.filter((pc) => pc.name === value)[0].columns
|
||||
.tableState
|
||||
);
|
||||
|
||||
const assoc = bodyshop.associations.find(
|
||||
(a) => a.useremail === currentUser.email
|
||||
@@ -77,6 +82,8 @@ export function ProductionListTable({
|
||||
};
|
||||
})
|
||||
);
|
||||
|
||||
setState(bodyshop.production_config[0].columns.tableState);
|
||||
};
|
||||
|
||||
return (
|
||||
|
||||
@@ -41,9 +41,9 @@ export function ProductionListTable({
|
||||
|
||||
const [state, setState] = useState(
|
||||
(bodyshop.production_config &&
|
||||
bodyshop.production_config.find((p) => p.name === defaultView)
|
||||
?.tableState) ||
|
||||
bodyshop.production_config[0]?.tableState || {
|
||||
bodyshop.production_config.find((p) => p.name === defaultView)?.columns
|
||||
.tableState) ||
|
||||
bodyshop.production_config[0]?.columns.tableState || {
|
||||
sortedInfo: {},
|
||||
filteredInfo: { text: "" },
|
||||
}
|
||||
@@ -155,7 +155,7 @@ export function ProductionListTable({
|
||||
// }
|
||||
// };
|
||||
|
||||
if (!!!columns) return <div>No columns found.</div>;
|
||||
if (!!!columns || columns.length === 0) return <div>No columns found.</div>;
|
||||
|
||||
return (
|
||||
<div>
|
||||
@@ -173,6 +173,7 @@ export function ProductionListTable({
|
||||
|
||||
<ProductionListTableViewSelect
|
||||
state={state}
|
||||
setState={setState}
|
||||
setColumns={setColumns}
|
||||
/>
|
||||
|
||||
|
||||
@@ -105,7 +105,8 @@ export function TimeTicketList({
|
||||
title: t("jobs.fields.ro_number"),
|
||||
dataIndex: "ro_number",
|
||||
key: "ro_number",
|
||||
sorter: (a, b) => alphaSort(a.job.ro_number, b.job.ro_number),
|
||||
sorter: (a, b) =>
|
||||
alphaSort(a.job && a.job.ro_number, b.job && b.job.ro_number),
|
||||
sortOrder:
|
||||
state.sortedInfo.columnKey === "ro_number" && state.sortedInfo.order,
|
||||
render: (text, record) =>
|
||||
|
||||
@@ -208,6 +208,10 @@ export const QUERY_INTAKE_CHECKLIST = gql`
|
||||
scheduled_delivery
|
||||
intakechecklist
|
||||
status
|
||||
owner {
|
||||
allow_text_message
|
||||
id
|
||||
}
|
||||
labhrs: joblines_aggregate(
|
||||
where: {
|
||||
_and: [{ mod_lbr_ty: { _neq: "LAR" } }, { removed: { _eq: false } }]
|
||||
|
||||
@@ -512,6 +512,7 @@
|
||||
},
|
||||
"labels": {
|
||||
"addtoproduction": "Add Job to Production?",
|
||||
"allow_text_message": "Permission to Text?",
|
||||
"checklist": "Checklist",
|
||||
"printpack": "Job Intake Print Pack",
|
||||
"removefromproduction": "Remove job from production?"
|
||||
|
||||
@@ -512,6 +512,7 @@
|
||||
},
|
||||
"labels": {
|
||||
"addtoproduction": "",
|
||||
"allow_text_message": "",
|
||||
"checklist": "",
|
||||
"printpack": "",
|
||||
"removefromproduction": ""
|
||||
|
||||
@@ -512,6 +512,7 @@
|
||||
},
|
||||
"labels": {
|
||||
"addtoproduction": "",
|
||||
"allow_text_message": "",
|
||||
"checklist": "",
|
||||
"printpack": "",
|
||||
"removefromproduction": ""
|
||||
|
||||
@@ -48,7 +48,7 @@ const roundTripLink = new ApolloLink((operation, forward) => {
|
||||
});
|
||||
|
||||
const TrackExecutionTime = async (operationName, time) => {
|
||||
await axios.post("/ioevent", { operationName, time, dbevent: true });
|
||||
//await axios.post("/ioevent", { operationName, time, dbevent: true });
|
||||
};
|
||||
|
||||
const subscriptionMiddleware = {
|
||||
|
||||
Reference in New Issue
Block a user