IO-1492 Add estimator Presets

This commit is contained in:
Patrick Fic
2021-10-18 20:26:57 -07:00
parent 99196a77ed
commit e700095551
13 changed files with 218 additions and 5 deletions

View File

@@ -17,6 +17,8 @@ import PhoneFormItem, {
import FormListMoveArrows from "../form-list-move-arrows/form-list-move-arrows.component";
import LayoutFormRow from "../layout-form-row/layout-form-row.component";
import CurrencyInput from "../form-items-formatted/currency-form-item.component";
import FormItemEmail from "../form-items-formatted/email-form-item.component";
export default function ShopInfoGeneral({ form }) {
const { t } = useTranslation();
return (
@@ -706,7 +708,7 @@ export default function ShopInfoGeneral({ form }) {
>
<Input />
</Form.Item>
<Space wrap>
<Space>
<Form.Item
label={t("bodyshop.fields.md_ins_co.zip")}
key={`${index}zip`}
@@ -744,6 +746,95 @@ export default function ShopInfoGeneral({ form }) {
}}
</Form.List>
</LayoutFormRow>
<LayoutFormRow grow header={t("bodyshop.labels.estimators")}>
<Form.List name={["md_estimators"]}>
{(fields, { add, remove, move }) => {
return (
<div>
{fields.map((field, index) => (
<Form.Item key={field.key}>
<LayoutFormRow noDivider>
<Form.Item
label={t("jobs.fields.est_co_nm")}
key={`${index}est_co_nm`}
name={[field.name, "est_co_nm"]}
>
<Input />
</Form.Item>
<Form.Item
label={t("jobs.fields.est_ct_fn")}
key={`${index}est_ct_fn`}
name={[field.name, "est_ct_fn"]}
>
<Input />
</Form.Item>
<Form.Item
label={t("jobs.fields.est_ct_ln")}
key={`${index}est_ct_ln`}
name={[field.name, "est_ct_ln"]}
>
<Input />
</Form.Item>
<Form.Item
label={t("jobs.fields.est_ph1")}
key={`${index}est_ph1`}
name={[field.name, "est_ph1"]}
rules={[
({ getFieldValue }) =>
PhoneItemFormatterValidation(getFieldValue, [
field.name,
"est_ph",
]),
]}
>
<Input />
</Form.Item>
<Form.Item
label={t("jobs.fields.est_ea")}
key={`${index}est_ea`}
name={[field.name, "est_ea"]}
rules={[
{
type: "email",
message: "This is not a valid email address.",
},
]}
>
<FormItemEmail
email={form.getFieldValue([field.name, "est_ea"])}
/>
</Form.Item>
<Space>
<DeleteFilled
onClick={() => {
remove(field.name);
}}
/>
<FormListMoveArrows
move={move}
index={index}
total={fields.length}
/>
</Space>
</LayoutFormRow>
</Form.Item>
))}
<Form.Item>
<Button
type="dashed"
onClick={() => {
add();
}}
style={{ width: "100%" }}
>
{t("general.actions.add")}
</Button>
</Form.Item>
</div>
);
}}
</Form.List>
</LayoutFormRow>
<LayoutFormRow grow header={t("bodyshop.fields.md_ccc_rates")}>
<Form.List name={["md_ccc_rates"]}>
{(fields, { add, remove, move }) => {