From 8d1988d4ad19b5d77786290c295e838c8f323786 Mon Sep 17 00:00:00 2001 From: Patrick Fic <> Date: Thu, 27 Jan 2022 15:07:00 -0800 Subject: [PATCH] IO-1674 Resolve new bill lines issues. --- .../bill-form/bill-form.lines.component.jsx | 92 +++++++++++-------- .../bill-line-search-select.component.jsx | 4 +- client/src/graphql/jobs-lines.queries.js | 5 +- 3 files changed, 59 insertions(+), 42 deletions(-) diff --git a/client/src/components/bill-form/bill-form.lines.component.jsx b/client/src/components/bill-form/bill-form.lines.component.jsx index 4aa19ac31..dd8866d63 100644 --- a/client/src/components/bill-form/bill-form.lines.component.jsx +++ b/client/src/components/bill-form/bill-form.lines.component.jsx @@ -58,7 +58,7 @@ export function BillEnterModalLinesComponent({ ], }; }, - formInput: (record, index) => ( + wrapper: (props) => ( @@ -66,46 +66,46 @@ export function BillEnterModalLinesComponent({ } > {() => { - return ( - { - setFieldsValue({ - billlines: getFieldsValue(["billlines"]).billlines.map( - (item, idx) => { - if (idx === index) { - return { - ...item, - line_desc: opt.line_desc, - quantity: opt.part_qty || 1, - actual_price: opt.cost, - cost_center: opt.part_type - ? bodyshop.pbs_serialnumber || - bodyshop.cdk_dealerid - ? opt.part_type !== "PAE" - ? opt.part_type - : null - : responsibilityCenters.defaults && - (responsibilityCenters.defaults.costs[ - opt.part_type - ] || - null) - : null, - }; - } - return item; - } - ), - }); - }} - /> - ); + return props.children; }} ), + formInput: (record, index) => ( + { + setFieldsValue({ + billlines: getFieldsValue(["billlines"]).billlines.map( + (item, idx) => { + if (idx === index) { + return { + ...item, + line_desc: opt.line_desc, + quantity: opt.part_qty || 1, + actual_price: opt.cost, + cost_center: opt.part_type + ? bodyshop.pbs_serialnumber || bodyshop.cdk_dealerid + ? opt.part_type !== "PAE" + ? opt.part_type + : null + : responsibilityCenters.defaults && + (responsibilityCenters.defaults.costs[ + opt.part_type + ] || + null) + : null, + }; + } + return item; + } + ), + }); + }} + /> + ), }, { title: t("billlines.fields.line_desc"), @@ -537,6 +537,7 @@ const EditableCell = ({ formInput, formItemProps, additional, + wrapper, ...restProps }) => { if (additional) @@ -554,7 +555,20 @@ const EditableCell = ({ ); - + if (wrapper) + return ( + + + + {(formInput && formInput(record, record.name)) || children} + + + + ); return ( { const { t } = useTranslation(); - console.log(allowRemoved); + return (