IO-1018 Warnings for courtesy car fields.

This commit is contained in:
Patrick Fic
2022-07-18 11:56:05 -07:00
parent 90bd70070d
commit 05e236cd9c
5 changed files with 98 additions and 25 deletions

View File

@@ -1,4 +1,4 @@
<babeledit_project be_version="2.7.1" version="1.2"> <babeledit_project version="1.2" be_version="2.7.1">
<!-- <!--
BabelEdit project file BabelEdit project file
@@ -11149,6 +11149,27 @@
</translation> </translation>
</translations> </translations>
</concept_node> </concept_node>
<concept_node>
<name>dateinpast</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> <concept_node>
<name>dlexpirebeforereturn</name> <name>dlexpirebeforereturn</name>
<definition_loaded>false</definition_loaded> <definition_loaded>false</definition_loaded>

View File

@@ -279,31 +279,80 @@ export default function CourtesyCarCreateFormComponent({ form, saveLoading }) {
<Form.Item label={t("courtesycars.fields.notes")} name="notes"> <Form.Item label={t("courtesycars.fields.notes")} name="notes">
<Input.TextArea /> <Input.TextArea />
</Form.Item> </Form.Item>
<div>
<Form.Item
label={t("courtesycars.fields.registrationexpires")}
name="registrationexpires"
rules={[
{
required: true,
//message: t("general.validation.required"),
},
]}
>
<FormDatePicker />
</Form.Item>
<Form.Item
shouldUpdate={(p, c) =>
p.registrationexpires !== c.registrationexpires
}
>
{() => {
const expires = form.getFieldValue("registrationexpires");
<Form.Item const dateover = expires && moment(expires).isBefore(moment());
label={t("courtesycars.fields.registrationexpires")}
name="registrationexpires" if (dateover)
rules={[ return (
{ <Space direction="vertical" style={{ color: "tomato" }}>
required: true, <span>
//message: t("general.validation.required"), <WarningFilled style={{ marginRight: ".3rem" }} />
}, {t("contracts.labels.dateinpast")}
]} </span>
> </Space>
<FormDatePicker /> );
</Form.Item>
<Form.Item return <></>;
label={t("courtesycars.fields.insuranceexpires")} }}
name="insuranceexpires" </Form.Item>
rules={[ </div>
{ <div>
required: true, <Form.Item
//message: t("general.validation.required"), label={t("courtesycars.fields.insuranceexpires")}
}, name="insuranceexpires"
]} rules={[
> {
<FormDatePicker /> required: true,
</Form.Item> //message: t("general.validation.required"),
},
]}
>
<FormDatePicker />
</Form.Item>
<Form.Item
shouldUpdate={(p, c) =>
p.insuranceexpires !== c.insuranceexpires
}
>
{() => {
const expires = form.getFieldValue("insuranceexpires");
const dateover = expires && moment(expires).isBefore(moment());
if (dateover)
return (
<Space direction="vertical" style={{ color: "tomato" }}>
<span>
<WarningFilled style={{ marginRight: ".3rem" }} />
{t("contracts.labels.dateinpast")}
</span>
</Space>
);
return <></>;
}}
</Form.Item>
</div>
<Form.Item label={t("courtesycars.fields.dailycost")} name="dailycost"> <Form.Item label={t("courtesycars.fields.dailycost")} name="dailycost">
<CurrencyInput /> <CurrencyInput />
</Form.Item> </Form.Item>

View File

@@ -678,6 +678,7 @@
"refuelqty": "Refuel qty.?" "refuelqty": "Refuel qty.?"
}, },
"correctdataonform": "Please review the information above. If any of it is not correct, you can fix it later.", "correctdataonform": "Please review the information above. If any of it is not correct, you can fix it later.",
"dateinpast": "Date is in the past.",
"dlexpirebeforereturn": "The driver's license expires before the car is expected to return. ", "dlexpirebeforereturn": "The driver's license expires before the car is expected to return. ",
"driverinformation": "Driver's Information", "driverinformation": "Driver's Information",
"findcontract": "Find Contract", "findcontract": "Find Contract",

View File

@@ -678,6 +678,7 @@
"refuelqty": "" "refuelqty": ""
}, },
"correctdataonform": "", "correctdataonform": "",
"dateinpast": "",
"dlexpirebeforereturn": "", "dlexpirebeforereturn": "",
"driverinformation": "", "driverinformation": "",
"findcontract": "", "findcontract": "",

View File

@@ -678,6 +678,7 @@
"refuelqty": "" "refuelqty": ""
}, },
"correctdataonform": "", "correctdataonform": "",
"dateinpast": "",
"dlexpirebeforereturn": "", "dlexpirebeforereturn": "",
"driverinformation": "", "driverinformation": "",
"findcontract": "", "findcontract": "",