diff --git a/bodyshop_translations.babel b/bodyshop_translations.babel index 39f7c8a01..dbee40f32 100644 --- a/bodyshop_translations.babel +++ b/bodyshop_translations.babel @@ -8144,6 +8144,27 @@ + + allow_text_message + false + + + + + + en-US + false + + + es-MX + false + + + fr-CA + false + + + checklist false diff --git a/client/src/components/job-checklist/components/job-checklist-form/job-checklist-form.component.jsx b/client/src/components/job-checklist/components/job-checklist-form/job-checklist-form.component.jsx index 8c6db2e4c..cc61d1aa3 100644 --- a/client/src/components/job-checklist/components/job-checklist-form/job-checklist-form.component.jsx +++ b/client/src/components/job-checklist/components/job-checklist-form/job-checklist-form.component.jsx @@ -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({ > + + + { 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")} > (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); +} diff --git a/client/src/components/production-list-table/production-list-table-view-select.component.jsx b/client/src/components/production-list-table/production-list-table-view-select.component.jsx index 3cc78c102..f64d1121a 100644 --- a/client/src/components/production-list-table/production-list-table-view-select.component.jsx +++ b/client/src/components/production-list-table/production-list-table-view-select.component.jsx @@ -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 ( diff --git a/client/src/components/production-list-table/production-list-table.component.jsx b/client/src/components/production-list-table/production-list-table.component.jsx index 59507c593..0834cfa19 100644 --- a/client/src/components/production-list-table/production-list-table.component.jsx +++ b/client/src/components/production-list-table/production-list-table.component.jsx @@ -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
No columns found.
; + if (!!!columns || columns.length === 0) return
No columns found.
; return (
@@ -173,6 +173,7 @@ export function ProductionListTable({ diff --git a/client/src/components/time-ticket-list/time-ticket-list.component.jsx b/client/src/components/time-ticket-list/time-ticket-list.component.jsx index e60e7761c..6a7bf6b11 100644 --- a/client/src/components/time-ticket-list/time-ticket-list.component.jsx +++ b/client/src/components/time-ticket-list/time-ticket-list.component.jsx @@ -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) => diff --git a/client/src/graphql/bodyshop.queries.js b/client/src/graphql/bodyshop.queries.js index 41073abdb..947fe64dc 100644 --- a/client/src/graphql/bodyshop.queries.js +++ b/client/src/graphql/bodyshop.queries.js @@ -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 } }] diff --git a/client/src/translations/en_us/common.json b/client/src/translations/en_us/common.json index c63152b36..3237e9e05 100644 --- a/client/src/translations/en_us/common.json +++ b/client/src/translations/en_us/common.json @@ -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?" diff --git a/client/src/translations/es/common.json b/client/src/translations/es/common.json index fbe1d0b23..f9643a466 100644 --- a/client/src/translations/es/common.json +++ b/client/src/translations/es/common.json @@ -512,6 +512,7 @@ }, "labels": { "addtoproduction": "", + "allow_text_message": "", "checklist": "", "printpack": "", "removefromproduction": "" diff --git a/client/src/translations/fr/common.json b/client/src/translations/fr/common.json index fd657e45a..1dd7c1d32 100644 --- a/client/src/translations/fr/common.json +++ b/client/src/translations/fr/common.json @@ -512,6 +512,7 @@ }, "labels": { "addtoproduction": "", + "allow_text_message": "", "checklist": "", "printpack": "", "removefromproduction": "" diff --git a/client/src/utils/GraphQLClient.js b/client/src/utils/GraphQLClient.js index 269fdffe9..5840587e0 100644 --- a/client/src/utils/GraphQLClient.js +++ b/client/src/utils/GraphQLClient.js @@ -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 = {