feature/IO-3479-Customer-Phone-Numbers - Implementation

This commit is contained in:
Dave
2025-12-30 19:14:57 -05:00
parent 79a3b58a86
commit 63ce7b5c79
31 changed files with 247 additions and 77 deletions

View File

@@ -1,4 +1,4 @@
import { Form, Input } from "antd";
import { Form, Input, Select } from "antd";
import { useContext } from "react";
import { useTranslation } from "react-i18next";
import JobCreateContext from "../../pages/jobs-create/jobs-create.context";
@@ -7,6 +7,11 @@ import FormItemPhone, { PhoneItemFormatterValidation } from "../form-items-forma
import LayoutFormRow from "../layout-form-row/layout-form-row.component";
export default function JobsCreateOwnerInfoNewComponent() {
const PHONE_TYPE_OPTIONS = [
{ label: t("owners.labels.home"), value: "Home" },
{ label: t("owners.labels.work"), value: "Work" },
{ label: t("owners.labels.cell"), value: "Cell" }
];
const [state] = useContext(JobCreateContext);
const { t } = useTranslation();
@@ -105,26 +110,56 @@ export default function JobsCreateOwnerInfoNewComponent() {
]}
name={["owner", "data", "ownr_ea"]}
>
<FormItemEmail
//email={form.getFieldValue("ownr_ea")}
disabled={!state.owner.new}
/>
<FormItemEmail disabled={!state.owner.new} />
</Form.Item>
<Form.Item
label={t("owners.fields.ownr_ph1")}
name={["owner", "data", "ownr_ph1"]}
rules={[({ getFieldValue }) => PhoneItemFormatterValidation(getFieldValue, "owner.data.ownr_ph1")]}
>
<FormItemPhone disabled={!state.owner.new} />
{/* Phone 1 + Type */}
<Form.Item label={t("owners.fields.ownr_ph1")} style={{ marginBottom: 0 }}>
<div style={{ display: "flex", alignItems: "center", gap: 8 }}>
<Form.Item
name={["owner", "data", "ownr_ph1"]}
noStyle
rules={[({ getFieldValue }) => PhoneItemFormatterValidation(getFieldValue, "owner.data.ownr_ph1")]}
>
<FormItemPhone disabled={!state.owner.new} style={{ flex: 1, minWidth: 150 }} />
</Form.Item>
<Form.Item name={["owner", "data", "ownr_ph1_ty"]} noStyle>
<Select
disabled={!state.owner.new}
allowClear
placeholder="Type"
options={PHONE_TYPE_OPTIONS}
style={{ width: 110 }}
/>
</Form.Item>
</div>
</Form.Item>
<Form.Item
label={t("owners.fields.ownr_ph2")}
name={["owner", "data", "ownr_ph2"]}
rules={[({ getFieldValue }) => PhoneItemFormatterValidation(getFieldValue, "owner.data.ownr_ph2")]}
>
<FormItemPhone disabled={!state.owner.new} />
{/* Phone 2 + Type */}
<Form.Item label={t("owners.fields.ownr_ph2")} style={{ marginBottom: 0 }}>
<div style={{ display: "flex", alignItems: "center", gap: 8 }}>
<Form.Item
name={["owner", "data", "ownr_ph2"]}
noStyle
rules={[({ getFieldValue }) => PhoneItemFormatterValidation(getFieldValue, "owner.data.ownr_ph2")]}
>
<FormItemPhone disabled={!state.owner.new} style={{ flex: 1, minWidth: 150 }} />
</Form.Item>
<Form.Item name={["owner", "data", "ownr_ph2_ty"]} noStyle>
<Select
disabled={!state.owner.new}
allowClear
placeholder="Type"
options={PHONE_TYPE_OPTIONS}
style={{ width: 110 }}
/>
</Form.Item>
</div>
</Form.Item>
</LayoutFormRow>
<LayoutFormRow grow>
<Form.Item label={t("owners.fields.preferred_contact")} name={["owner", "data", "preferred_contact"]}>
<Input disabled={!state.owner.new} />