Added validation on jobline upsert modal. BOD-399
This commit is contained in:
@@ -11440,6 +11440,27 @@
|
|||||||
<folder_node>
|
<folder_node>
|
||||||
<name>validations</name>
|
<name>validations</name>
|
||||||
<children>
|
<children>
|
||||||
|
<concept_node>
|
||||||
|
<name>hrsrequirediflbrtyp</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>zeropriceexistingpart</name>
|
<name>zeropriceexistingpart</name>
|
||||||
<definition_loaded>false</definition_loaded>
|
<definition_loaded>false</definition_loaded>
|
||||||
|
|||||||
@@ -137,12 +137,50 @@ export default function JobLinesUpsertModalComponent({
|
|||||||
>
|
>
|
||||||
<Input />
|
<Input />
|
||||||
</Form.Item>
|
</Form.Item>
|
||||||
<Form.Item label={t("joblines.fields.mod_lb_hrs")} name="mod_lb_hrs">
|
<Form.Item
|
||||||
|
label={t("joblines.fields.mod_lb_hrs")}
|
||||||
|
name="mod_lb_hrs"
|
||||||
|
rules={[
|
||||||
|
// {
|
||||||
|
// required: !!form.getFieldValue("mod_lbr_ty"),
|
||||||
|
// message: t("general.validation.required"),
|
||||||
|
// },
|
||||||
|
({ getFieldValue }) => ({
|
||||||
|
validator(rule, value) {
|
||||||
|
if (!!getFieldValue("mod_lbr_ty") === !!value) {
|
||||||
|
return Promise.resolve();
|
||||||
|
}
|
||||||
|
return Promise.reject(
|
||||||
|
t("joblines.validation.hrsrequirediflbrtyp")
|
||||||
|
);
|
||||||
|
},
|
||||||
|
}),
|
||||||
|
]}
|
||||||
|
>
|
||||||
<InputCurrency />
|
<InputCurrency />
|
||||||
</Form.Item>
|
</Form.Item>
|
||||||
</LayoutFormRow>
|
</LayoutFormRow>
|
||||||
<LayoutFormRow grow>
|
<LayoutFormRow grow>
|
||||||
<Form.Item label={t("joblines.fields.part_qty")} name="part_qty">
|
<Form.Item
|
||||||
|
label={t("joblines.fields.part_qty")}
|
||||||
|
name="part_qty"
|
||||||
|
rules={[
|
||||||
|
// {
|
||||||
|
// required: !!form.getFieldValue("mod_lbr_ty"),
|
||||||
|
// message: t("general.validation.required"),
|
||||||
|
// },
|
||||||
|
({ getFieldValue }) => ({
|
||||||
|
validator(rule, value) {
|
||||||
|
if (!!getFieldValue("part_type") === !!value) {
|
||||||
|
return Promise.resolve();
|
||||||
|
}
|
||||||
|
return Promise.reject(
|
||||||
|
t("joblines.validation.requiredifparttype")
|
||||||
|
);
|
||||||
|
},
|
||||||
|
}),
|
||||||
|
]}
|
||||||
|
>
|
||||||
<InputNumber precision={0} min={0} />
|
<InputNumber precision={0} min={0} />
|
||||||
</Form.Item>
|
</Form.Item>
|
||||||
<Form.Item label={t("joblines.fields.db_price")} name="db_price">
|
<Form.Item label={t("joblines.fields.db_price")} name="db_price">
|
||||||
@@ -162,6 +200,16 @@ export default function JobLinesUpsertModalComponent({
|
|||||||
);
|
);
|
||||||
},
|
},
|
||||||
}),
|
}),
|
||||||
|
({ getFieldValue }) => ({
|
||||||
|
validator(rule, value) {
|
||||||
|
if (!!getFieldValue("part_type") === !!value) {
|
||||||
|
return Promise.resolve();
|
||||||
|
}
|
||||||
|
return Promise.reject(
|
||||||
|
t("joblines.validation.requiredifparttype")
|
||||||
|
);
|
||||||
|
},
|
||||||
|
}),
|
||||||
]}
|
]}
|
||||||
>
|
>
|
||||||
<InputCurrency precision={2} min={0} />
|
<InputCurrency precision={2} min={0} />
|
||||||
|
|||||||
@@ -750,6 +750,7 @@
|
|||||||
"updated": "Job line updated successfully."
|
"updated": "Job line updated successfully."
|
||||||
},
|
},
|
||||||
"validations": {
|
"validations": {
|
||||||
|
"hrsrequirediflbrtyp": "Labor hours are required if a labor type is selected. Clear the labor type if there are no labor hours.",
|
||||||
"zeropriceexistingpart": "This line cannot have any price since it uses an existing part."
|
"zeropriceexistingpart": "This line cannot have any price since it uses an existing part."
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -750,6 +750,7 @@
|
|||||||
"updated": ""
|
"updated": ""
|
||||||
},
|
},
|
||||||
"validations": {
|
"validations": {
|
||||||
|
"hrsrequirediflbrtyp": "",
|
||||||
"zeropriceexistingpart": ""
|
"zeropriceexistingpart": ""
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -750,6 +750,7 @@
|
|||||||
"updated": ""
|
"updated": ""
|
||||||
},
|
},
|
||||||
"validations": {
|
"validations": {
|
||||||
|
"hrsrequirediflbrtyp": "",
|
||||||
"zeropriceexistingpart": ""
|
"zeropriceexistingpart": ""
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|||||||
Reference in New Issue
Block a user