diff --git a/bodyshop_translations.babel b/bodyshop_translations.babel index 98c98dd1c..c6cc0770c 100644 --- a/bodyshop_translations.babel +++ b/bodyshop_translations.babel @@ -15444,6 +15444,27 @@ + + checklists + false + + + + + + en-US + false + + + es-MX + false + + + fr-CA + false + + + cost 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 5b668cccc..94a04584f 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 @@ -8,19 +8,23 @@ import { useHistory, useLocation, useParams } from "react-router-dom"; import { createStructuredSelector } from "reselect"; import { MARK_LATEST_APPOINTMENT_AS_ARRIVED } from "../../../../graphql/appointments.queries"; import { UPDATE_JOB } from "../../../../graphql/jobs.queries"; -import { selectBodyshop } from "../../../../redux/user/user.selectors"; +import { + selectBodyshop, + selectCurrentUser, +} from "../../../../redux/user/user.selectors"; import DateTimePicker from "../../../form-date-time-picker/form-date-time-picker.component"; import ConfigFormComponents from "../../../config-form-components/config-form-components.component"; import { logImEXEvent } from "../../../../firebase/firebase.utils"; const mapStateToProps = createStructuredSelector({ bodyshop: selectBodyshop, + currentUser: selectCurrentUser, }); const mapDispatchToProps = (dispatch) => ({ //setUserLanguage: language => dispatch(setUserLanguage(language)) }); -export function JobChecklistForm({ formItems, bodyshop, type }) { +export function JobChecklistForm({ formItems, bodyshop, currentUser, type }) { const { t } = useTranslation(); const [intakeJob] = useMutation(UPDATE_JOB); const [loading, setLoading] = useState(false); @@ -48,7 +52,11 @@ export function JobChecklistForm({ formItems, bodyshop, type }) { }), [(type === "intake" && "intakechecklist") || - (type === "deliver" && "deliverchecklist")]: values, + (type === "deliver" && "deliverchecklist")]: { + ...values, + completed_by: currentUser.email, + completed_at: new Date(), + }, ...(type === "deliver" && { scheduled_delivery: values.scheduledDelivery, diff --git a/client/src/components/job-checklist/job-checklist-display.component.jsx b/client/src/components/job-checklist/job-checklist-display.component.jsx new file mode 100644 index 000000000..fec0640b8 --- /dev/null +++ b/client/src/components/job-checklist/job-checklist-display.component.jsx @@ -0,0 +1,12 @@ +import React from "react"; +import ConfigFormComponents from "../config-form-components/config-form-components.component"; + +export default function JobChecklistDisplay({ checklist }) { + console.log("JobChecklistDisplay -> checklist", checklist); + if (!checklist) return
; + return ( +
+ +
+ ); +} diff --git a/client/src/components/jobs-detail-checklists/jobs-detail-checklists.component.jsx b/client/src/components/jobs-detail-checklists/jobs-detail-checklists.component.jsx new file mode 100644 index 000000000..9147037fb --- /dev/null +++ b/client/src/components/jobs-detail-checklists/jobs-detail-checklists.component.jsx @@ -0,0 +1,20 @@ +import React from "react"; +import { Row, Col } from "antd"; +import JobChecklistDisplay from "../job-checklist/job-checklist-display.component"; + +const colSpan = { sm: { span: 24 }, md: { span: 12 } }; +export default function JobsDetailChecklists({ job }) { + return ( +
+ + + + + + {" "} + + + +
+ ); +} diff --git a/client/src/index.js b/client/src/index.js index 34ca11d3a..4584a4b5a 100644 --- a/client/src/index.js +++ b/client/src/index.js @@ -10,9 +10,13 @@ import AppContainer from "./App/App.container"; import "./index.css"; import LoadingSpinner from "./components/loading-spinner/loading-spinner.component"; import "./App/registerServiceWorker.component"; +import Dinero from "dinero.js"; require("dotenv").config(); +Dinero.defaultCurrency = "CAD"; +Dinero.globalLocale = "en-CA"; + ReactDOM.render( diff --git a/client/src/pages/jobs-detail/jobs-detail.page.component.jsx b/client/src/pages/jobs-detail/jobs-detail.page.component.jsx index 46d3295eb..6cb82e558 100644 --- a/client/src/pages/jobs-detail/jobs-detail.page.component.jsx +++ b/client/src/pages/jobs-detail/jobs-detail.page.component.jsx @@ -4,6 +4,7 @@ import Icon, { DollarCircleOutlined, FileImageFilled, ToolFilled, + CheckSquareFilled, } from "@ant-design/icons"; import { Form, notification, Tabs } from "antd"; import Axios from "axios"; @@ -24,6 +25,7 @@ import { createStructuredSelector } from "reselect"; import FormFieldsChanged from "../../components/form-fields-changed-alert/form-fields-changed-alert.component"; import LoadingSpinner from "../../components/loading-spinner/loading-spinner.component"; import { selectBodyshop } from "../../redux/user/user.selectors"; +import JobsDetailChecklists from "../../components/jobs-detail-checklists/jobs-detail-checklists.component"; const JobsLinesContainer = lazy(() => import("../../components/job-detail-lines/job-lines.container") @@ -275,6 +277,17 @@ export function JobsDetailPage({ > + + + {t("jobs.labels.checklists")} + + } + key="checklists" + > + + diff --git a/client/src/translations/en_us/common.json b/client/src/translations/en_us/common.json index 81fd5bf61..565c7d541 100644 --- a/client/src/translations/en_us/common.json +++ b/client/src/translations/en_us/common.json @@ -953,6 +953,7 @@ "totals": "Totals", "vehicle": "Vehicle" }, + "checklists": "Checklists", "cost": "Cost", "cost_labor": "Cost - Labor", "cost_parts": "Cost - Parts", diff --git a/client/src/translations/es/common.json b/client/src/translations/es/common.json index fab6b1612..185e93abd 100644 --- a/client/src/translations/es/common.json +++ b/client/src/translations/es/common.json @@ -953,6 +953,7 @@ "totals": "Totales", "vehicle": "Vehículo" }, + "checklists": "", "cost": "", "cost_labor": "", "cost_parts": "", diff --git a/client/src/translations/fr/common.json b/client/src/translations/fr/common.json index 5aaf6d46d..f29712754 100644 --- a/client/src/translations/fr/common.json +++ b/client/src/translations/fr/common.json @@ -953,6 +953,7 @@ "totals": "Totaux", "vehicle": "Véhicule" }, + "checklists": "", "cost": "", "cost_labor": "", "cost_parts": "", diff --git a/server/job/job-totals.js b/server/job/job-totals.js index 543ef77e0..c9744a634 100644 --- a/server/job/job-totals.js +++ b/server/job/job-totals.js @@ -1,5 +1,8 @@ const Dinero = require("dinero.js"); +Dinero.defaultCurrency = "CAD"; +Dinero.globalLocale = "en-CA"; + exports.default = async function (req, res) { const { job, shoprates } = req.body; console.log(`Calculating Job Totals for ${job.id} - ${job.ro_number}`);