Merged in feature/IO-3560-Part-Number-on-Return-Item-Modal (pull request #3035)
IO-3560 Part # on Return Item Modal Approved-by: Dave Richer
This commit is contained in:
@@ -28,6 +28,20 @@ export function BillDetailEditReturn({ setPartsOrderContext, data, disabled }) {
|
|||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
const [form] = Form.useForm();
|
const [form] = Form.useForm();
|
||||||
const [open, setOpen] = useState(false);
|
const [open, setOpen] = useState(false);
|
||||||
|
const initialValues =
|
||||||
|
data && data.bills_by_pk
|
||||||
|
? {
|
||||||
|
...data.bills_by_pk,
|
||||||
|
billlines: (data.bills_by_pk.billlines || []).map((bl) => {
|
||||||
|
const oem = bl.oem_partno || (bl.jobline && bl.jobline.oem_partno) || "";
|
||||||
|
const alt = bl.alt_partno || (bl.jobline && bl.jobline.alt_partno) || "";
|
||||||
|
return {
|
||||||
|
...bl,
|
||||||
|
oem_partno: `${oem || ""} ${alt ? `(${alt})` : ""}`.trim()
|
||||||
|
};
|
||||||
|
})
|
||||||
|
}
|
||||||
|
: undefined;
|
||||||
|
|
||||||
const handleFinish = ({ billlines }) => {
|
const handleFinish = ({ billlines }) => {
|
||||||
const selectedLines = billlines.filter((l) => l.selected).map((l) => l.id);
|
const selectedLines = billlines.filter((l) => l.selected).map((l) => l.id);
|
||||||
@@ -74,8 +88,9 @@ export function BillDetailEditReturn({ setPartsOrderContext, data, disabled }) {
|
|||||||
destroyOnHidden
|
destroyOnHidden
|
||||||
title={t("bills.actions.return")}
|
title={t("bills.actions.return")}
|
||||||
onOk={() => form.submit()}
|
onOk={() => form.submit()}
|
||||||
|
width={700}
|
||||||
>
|
>
|
||||||
<Form initialValues={data?.bills_by_pk} onFinish={handleFinish} form={form}>
|
<Form initialValues={initialValues} onFinish={handleFinish} form={form}>
|
||||||
<Form.List name={["billlines"]}>
|
<Form.List name={["billlines"]}>
|
||||||
{(fields) => {
|
{(fields) => {
|
||||||
return (
|
return (
|
||||||
@@ -95,9 +110,10 @@ export function BillDetailEditReturn({ setPartsOrderContext, data, disabled }) {
|
|||||||
/>
|
/>
|
||||||
</td>
|
</td>
|
||||||
<td>{t("billlines.fields.line_desc")}</td>
|
<td>{t("billlines.fields.line_desc")}</td>
|
||||||
<td>{t("billlines.fields.quantity")}</td>
|
<td>{t("billlines.fields.oem_partno")}</td>
|
||||||
<td>{t("billlines.fields.actual_price")}</td>
|
<td style={{ textAlign: "right" }}>{t("billlines.fields.quantity")}</td>
|
||||||
<td>{t("billlines.fields.actual_cost")}</td>
|
<td style={{ textAlign: "right" }}>{t("billlines.fields.actual_price")}</td>
|
||||||
|
<td style={{ textAlign: "right" }}>{t("billlines.fields.actual_cost")}</td>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
@@ -127,6 +143,15 @@ export function BillDetailEditReturn({ setPartsOrderContext, data, disabled }) {
|
|||||||
</Form.Item>
|
</Form.Item>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
|
<Form.Item
|
||||||
|
// label={t("joblines.fields.oem_partno")}
|
||||||
|
key={`${index}jobline.oem_partno`}
|
||||||
|
name={[field.name, "oem_partno"]}
|
||||||
|
>
|
||||||
|
<ReadOnlyFormItemComponent />
|
||||||
|
</Form.Item>
|
||||||
|
</td>
|
||||||
|
<td style={{ textAlign: "right" }}>
|
||||||
<Form.Item
|
<Form.Item
|
||||||
// label={t("joblines.fields.quantity")}
|
// label={t("joblines.fields.quantity")}
|
||||||
key={`${index}quantity`}
|
key={`${index}quantity`}
|
||||||
@@ -135,7 +160,7 @@ export function BillDetailEditReturn({ setPartsOrderContext, data, disabled }) {
|
|||||||
<ReadOnlyFormItemComponent />
|
<ReadOnlyFormItemComponent />
|
||||||
</Form.Item>
|
</Form.Item>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td style={{ textAlign: "right" }}>
|
||||||
<Form.Item
|
<Form.Item
|
||||||
// label={t("joblines.fields.actual_price")}
|
// label={t("joblines.fields.actual_price")}
|
||||||
key={`${index}actual_price`}
|
key={`${index}actual_price`}
|
||||||
@@ -144,7 +169,7 @@ export function BillDetailEditReturn({ setPartsOrderContext, data, disabled }) {
|
|||||||
<ReadOnlyFormItemComponent type="currency" />
|
<ReadOnlyFormItemComponent type="currency" />
|
||||||
</Form.Item>
|
</Form.Item>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td style={{ textAlign: "right" }}>
|
||||||
<Form.Item
|
<Form.Item
|
||||||
// label={t("joblines.fields.actual_cost")}
|
// label={t("joblines.fields.actual_cost")}
|
||||||
key={`${index}actual_cost`}
|
key={`${index}actual_cost`}
|
||||||
|
|||||||
@@ -185,6 +185,7 @@ export const QUERY_BILL_BY_PK = gql`
|
|||||||
id
|
id
|
||||||
}
|
}
|
||||||
jobline {
|
jobline {
|
||||||
|
alt_partno
|
||||||
oem_partno
|
oem_partno
|
||||||
part_type
|
part_type
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -168,6 +168,7 @@
|
|||||||
"line_desc": "Line Description",
|
"line_desc": "Line Description",
|
||||||
"local_tax_applicable": "Loc. Tax?",
|
"local_tax_applicable": "Loc. Tax?",
|
||||||
"location": "Location",
|
"location": "Location",
|
||||||
|
"oem_partno": "Part #",
|
||||||
"quantity": "Quantity",
|
"quantity": "Quantity",
|
||||||
"state_tax_applicable": "St. Tax?"
|
"state_tax_applicable": "St. Tax?"
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -168,6 +168,7 @@
|
|||||||
"line_desc": "",
|
"line_desc": "",
|
||||||
"local_tax_applicable": "",
|
"local_tax_applicable": "",
|
||||||
"location": "",
|
"location": "",
|
||||||
|
"oem_partno": "",
|
||||||
"quantity": "",
|
"quantity": "",
|
||||||
"state_tax_applicable": ""
|
"state_tax_applicable": ""
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -168,6 +168,7 @@
|
|||||||
"line_desc": "",
|
"line_desc": "",
|
||||||
"local_tax_applicable": "",
|
"local_tax_applicable": "",
|
||||||
"location": "",
|
"location": "",
|
||||||
|
"oem_partno": "",
|
||||||
"quantity": "",
|
"quantity": "",
|
||||||
"state_tax_applicable": ""
|
"state_tax_applicable": ""
|
||||||
},
|
},
|
||||||
|
|||||||
Reference in New Issue
Block a user