diff --git a/bodyshop_translations.babel b/bodyshop_translations.babel index 3858948d7..9f9abea4e 100644 --- a/bodyshop_translations.babel +++ b/bodyshop_translations.babel @@ -20793,6 +20793,69 @@ labels + + actual_completion_inferred + false + + + + + + en-US + false + + + es-MX + false + + + fr-CA + false + + + + + actual_delivery_inferred + false + + + + + + en-US + false + + + es-MX + false + + + fr-CA + false + + + + + actual_in_inferred + false + + + + + + en-US + false + + + es-MX + false + + + fr-CA + false + + + additionaltotal false @@ -21454,6 +21517,27 @@ + + closejob + false + + + + + + en-US + false + + + es-MX + false + + + fr-CA + false + + + contracts false diff --git a/client/src/graphql/jobs.queries.js b/client/src/graphql/jobs.queries.js index 62ba766cb..8bb3f5faa 100644 --- a/client/src/graphql/jobs.queries.js +++ b/client/src/graphql/jobs.queries.js @@ -1696,6 +1696,12 @@ export const QUERY_JOB_CLOSE_DETAILS = gql` date_exported date_invoiced voided + scheduled_completion + actual_completion + scheduled_delivery + actual_delivery + scheduled_in + actual_in joblines(where: { removed: { _eq: false } }) { id removed diff --git a/client/src/pages/jobs-close/jobs-close.component.jsx b/client/src/pages/jobs-close/jobs-close.component.jsx index 8ca5aa331..e4a47f869 100644 --- a/client/src/pages/jobs-close/jobs-close.component.jsx +++ b/client/src/pages/jobs-close/jobs-close.component.jsx @@ -1,5 +1,14 @@ import { useApolloClient, useMutation } from "@apollo/client"; -import { Button, Form, notification, Popconfirm, Space } from "antd"; +import { + Button, + Form, + notification, + Popconfirm, + Space, + Alert, + Divider, + PageHeader, +} from "antd"; import React, { useState } from "react"; import { useTranslation } from "react-i18next"; import { connect } from "react-redux"; @@ -13,6 +22,9 @@ import { generateJobLinesUpdatesForInvoicing } from "../../graphql/jobs-lines.qu import { UPDATE_JOB } from "../../graphql/jobs.queries"; import { selectJobReadOnly } from "../../redux/application/application.selectors"; import { selectBodyshop } from "../../redux/user/user.selectors"; +import LayoutFormRow from "../../components/layout-form-row/layout-form-row.component"; +import DateTimePicker from "../../components/form-date-time-picker/form-date-time-picker.component"; +import moment from "moment"; const mapStateToProps = createStructuredSelector({ bodyshop: selectBodyshop, jobRO: selectJobReadOnly, @@ -82,31 +94,110 @@ export function JobsCloseComponent({ job, bodyshop, jobRO }) { layout="vertical" form={form} onFinish={handleFinish} - initialValues={{ joblines: job.joblines }} + initialValues={{ + joblines: job.joblines, + actual_in: job.actual_in + ? moment(job.actual_in) + : job.scheduled_in && moment(job.scheduled_in), + actual_completion: job.actual_completion + ? moment(job.actual_completion) + : job.scheduled_completion && moment(job.scheduled_completion), + actual_delivery: job.actual_delivery + ? moment(job.actual_delivery) + : job.scheduled_delivery && moment(job.scheduled_delivery), + }} scrollToFirstError > - - + + - form.submit()} - disabled={jobRO} - okText={t("general.labels.yes")} - cancelText={t("general.labels.no")} - title={t("jobs.labels.closeconfirm")} - > - - + form.submit()} + disabled={jobRO} + okText={t("general.labels.yes")} + cancelText={t("general.labels.no")} + title={t("jobs.labels.closeconfirm")} + > + + - + + + } + /> + + + + {!job.actual_in && job.scheduled_in && ( + + )} + {!job.actual_completion && job.scheduled_completion && ( + + )} + {!job.actual_delivery && job.scheduled_delivery && ( + + )} - + + + + + + {() => { + return ( + + + + ); + }} + + + + + + diff --git a/client/src/translations/en_us/common.json b/client/src/translations/en_us/common.json index e18d5c4de..b96c433a6 100644 --- a/client/src/translations/en_us/common.json +++ b/client/src/translations/en_us/common.json @@ -1250,6 +1250,9 @@ "scheddates": "Schedule Dates" }, "labels": { + "actual_completion_inferred": "$t(jobs.fields.actual_completion) inferred using $t(jobs.fields.scheduled_completion).", + "actual_delivery_inferred": "$t(jobs.fields.actual_delivery) inferred using $t(jobs.fields.scheduled_delivery).", + "actual_in_inferred": "$t(jobs.fields.actual_in) inferred using $t(jobs.fields.scheduled_in).", "additionaltotal": "Additional Total", "adjustmentrate": "Adjustment Rate", "adjustments": "Adjustments", @@ -1285,6 +1288,7 @@ "checklistdocuments": "Checklist Documents", "checklists": "Checklists", "closeconfirm": "Are you sure you want to close this job? This cannot be easily undone.", + "closejob": "Close Job {{ro_number}}", "contracts": "CC Contracts", "cost": "Cost", "cost_labor": "Cost - Labor", diff --git a/client/src/translations/es/common.json b/client/src/translations/es/common.json index f5e275ccb..eae5783f5 100644 --- a/client/src/translations/es/common.json +++ b/client/src/translations/es/common.json @@ -1250,6 +1250,9 @@ "scheddates": "" }, "labels": { + "actual_completion_inferred": "", + "actual_delivery_inferred": "", + "actual_in_inferred": "", "additionaltotal": "", "adjustmentrate": "", "adjustments": "", @@ -1285,6 +1288,7 @@ "checklistdocuments": "", "checklists": "", "closeconfirm": "", + "closejob": "", "contracts": "", "cost": "", "cost_labor": "", diff --git a/client/src/translations/fr/common.json b/client/src/translations/fr/common.json index a0806f97c..8f4784000 100644 --- a/client/src/translations/fr/common.json +++ b/client/src/translations/fr/common.json @@ -1250,6 +1250,9 @@ "scheddates": "" }, "labels": { + "actual_completion_inferred": "", + "actual_delivery_inferred": "", + "actual_in_inferred": "", "additionaltotal": "", "adjustmentrate": "", "adjustments": "", @@ -1285,6 +1288,7 @@ "checklistdocuments": "", "checklists": "", "closeconfirm": "", + "closejob": "", "contracts": "", "cost": "", "cost_labor": "",