From bd8753789230976f683e97dbd535c296284a4809 Mon Sep 17 00:00:00 2001 From: Patrick Fic <> Date: Fri, 31 Jul 2020 14:02:27 -0700 Subject: [PATCH] Added job line edit modal selects for fields and formatted BOD-203 --- bodyshop_translations.babel | 26 ++++ .../job-lines-upsert-modal.component.jsx | 138 +++++++++++++----- client/src/translations/en_us/common.json | 3 + client/src/translations/es/common.json | 3 + client/src/translations/fr/common.json | 3 + 5 files changed, 139 insertions(+), 34 deletions(-) diff --git a/bodyshop_translations.babel b/bodyshop_translations.babel index 3559357f3..6c686d2fd 100644 --- a/bodyshop_translations.babel +++ b/bodyshop_translations.babel @@ -9316,6 +9316,32 @@ + + validations + + + zeropriceexistingpart + false + + + + + + en-US + false + + + es-MX + false + + + fr-CA + false + + + + + diff --git a/client/src/components/job-lines-upsert-modal/job-lines-upsert-modal.component.jsx b/client/src/components/job-lines-upsert-modal/job-lines-upsert-modal.component.jsx index e0db322dd..f73f18596 100644 --- a/client/src/components/job-lines-upsert-modal/job-lines-upsert-modal.component.jsx +++ b/client/src/components/job-lines-upsert-modal/job-lines-upsert-modal.component.jsx @@ -1,7 +1,8 @@ -import { Form, Input, Modal } from "antd"; +import { Form, Input, Modal, Select, InputNumber } from "antd"; import React, { useEffect } from "react"; import { useTranslation } from "react-i18next"; import InputCurrency from "../form-items-formatted/currency-form-item.component"; +import LayoutFormRow from "../layout-form-row/layout-form-row.component"; export default function JobLinesUpsertModalComponent({ visible, @@ -21,6 +22,7 @@ export default function JobLinesUpsertModalComponent({
@@ -31,44 +33,112 @@ export default function JobLinesUpsertModalComponent({ : t("joblines.labels.new") } visible={visible} + width="60%" okText={t("general.actions.save")} onOk={() => form.submit()} okButtonProps={{ loading: loading }} onCancel={handleCancel} > - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ({ + validator(rule, value) { + if (!value || getFieldValue("part_type") !== "PAE") { + return Promise.resolve(); + } + return Promise.reject( + t("joblines.validations.zeropriceexistingpart") + ); + }, + }), + ]} + > + + +
); diff --git a/client/src/translations/en_us/common.json b/client/src/translations/en_us/common.json index 79f5251e1..3142651c0 100644 --- a/client/src/translations/en_us/common.json +++ b/client/src/translations/en_us/common.json @@ -610,6 +610,9 @@ "created": "Job line created successfully.", "saved": "Job line saved.", "updated": "Job line updated successfully." + }, + "validations": { + "zeropriceexistingpart": "This line cannot have any price since it uses an existing part." } }, "jobs": { diff --git a/client/src/translations/es/common.json b/client/src/translations/es/common.json index cca495fa5..4e788de76 100644 --- a/client/src/translations/es/common.json +++ b/client/src/translations/es/common.json @@ -610,6 +610,9 @@ "created": "", "saved": "", "updated": "" + }, + "validations": { + "zeropriceexistingpart": "" } }, "jobs": { diff --git a/client/src/translations/fr/common.json b/client/src/translations/fr/common.json index a37cc0218..b974656d3 100644 --- a/client/src/translations/fr/common.json +++ b/client/src/translations/fr/common.json @@ -610,6 +610,9 @@ "created": "", "saved": "", "updated": "" + }, + "validations": { + "zeropriceexistingpart": "" } }, "jobs": {