IO-3560 Part # on Return Item Modal
Signed-off-by: Allan Carr <allan@imexsystems.ca>
This commit is contained in:
@@ -28,6 +28,20 @@ export function BillDetailEditReturn({ setPartsOrderContext, data, disabled }) {
|
||||
const { t } = useTranslation();
|
||||
const [form] = Form.useForm();
|
||||
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 selectedLines = billlines.filter((l) => l.selected).map((l) => l.id);
|
||||
@@ -74,8 +88,9 @@ export function BillDetailEditReturn({ setPartsOrderContext, data, disabled }) {
|
||||
destroyOnHidden
|
||||
title={t("bills.actions.return")}
|
||||
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"]}>
|
||||
{(fields) => {
|
||||
return (
|
||||
@@ -95,9 +110,10 @@ export function BillDetailEditReturn({ setPartsOrderContext, data, disabled }) {
|
||||
/>
|
||||
</td>
|
||||
<td>{t("billlines.fields.line_desc")}</td>
|
||||
<td>{t("billlines.fields.quantity")}</td>
|
||||
<td>{t("billlines.fields.actual_price")}</td>
|
||||
<td>{t("billlines.fields.actual_cost")}</td>
|
||||
<td>{t("billlines.fields.oem_partno")}</td>
|
||||
<td style={{ textAlign: "right" }}>{t("billlines.fields.quantity")}</td>
|
||||
<td style={{ textAlign: "right" }}>{t("billlines.fields.actual_price")}</td>
|
||||
<td style={{ textAlign: "right" }}>{t("billlines.fields.actual_cost")}</td>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@@ -127,6 +143,15 @@ export function BillDetailEditReturn({ setPartsOrderContext, data, disabled }) {
|
||||
</Form.Item>
|
||||
</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
|
||||
// label={t("joblines.fields.quantity")}
|
||||
key={`${index}quantity`}
|
||||
@@ -135,7 +160,7 @@ export function BillDetailEditReturn({ setPartsOrderContext, data, disabled }) {
|
||||
<ReadOnlyFormItemComponent />
|
||||
</Form.Item>
|
||||
</td>
|
||||
<td>
|
||||
<td style={{ textAlign: "right" }}>
|
||||
<Form.Item
|
||||
// label={t("joblines.fields.actual_price")}
|
||||
key={`${index}actual_price`}
|
||||
@@ -144,7 +169,7 @@ export function BillDetailEditReturn({ setPartsOrderContext, data, disabled }) {
|
||||
<ReadOnlyFormItemComponent type="currency" />
|
||||
</Form.Item>
|
||||
</td>
|
||||
<td>
|
||||
<td style={{ textAlign: "right" }}>
|
||||
<Form.Item
|
||||
// label={t("joblines.fields.actual_cost")}
|
||||
key={`${index}actual_cost`}
|
||||
|
||||
@@ -185,6 +185,7 @@ export const QUERY_BILL_BY_PK = gql`
|
||||
id
|
||||
}
|
||||
jobline {
|
||||
alt_partno
|
||||
oem_partno
|
||||
part_type
|
||||
}
|
||||
|
||||
@@ -167,6 +167,7 @@
|
||||
"line_desc": "Line Description",
|
||||
"local_tax_applicable": "Loc. Tax?",
|
||||
"location": "Location",
|
||||
"oem_partno": "Part #",
|
||||
"quantity": "Quantity",
|
||||
"state_tax_applicable": "St. Tax?"
|
||||
},
|
||||
|
||||
@@ -167,6 +167,7 @@
|
||||
"line_desc": "",
|
||||
"local_tax_applicable": "",
|
||||
"location": "",
|
||||
"oem_partno": "",
|
||||
"quantity": "",
|
||||
"state_tax_applicable": ""
|
||||
},
|
||||
|
||||
@@ -167,6 +167,7 @@
|
||||
"line_desc": "",
|
||||
"local_tax_applicable": "",
|
||||
"location": "",
|
||||
"oem_partno": "",
|
||||
"quantity": "",
|
||||
"state_tax_applicable": ""
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user