IO-1673 Posting bills to removed lines for credit memos.

This commit is contained in:
Patrick Fic
2022-01-27 08:37:26 -08:00
parent 25fd90f881
commit 9b444a130b
2 changed files with 51 additions and 35 deletions

View File

@@ -59,39 +59,52 @@ export function BillEnterModalLinesComponent({
}; };
}, },
formInput: (record, index) => ( formInput: (record, index) => (
<BillLineSearchSelect <Form.Item
disabled={disabled} noStyle
options={lineData} shouldUpdate={(prev, cur) =>
style={{ width: "100%", minWidth: "10rem" }} prev.is_credit_memo !== cur.is_credit_memo
onSelect={(value, opt) => { }
setFieldsValue({ >
billlines: getFieldsValue(["billlines"]).billlines.map( {() => {
(item, idx) => { return (
if (idx === index) { <BillLineSearchSelect
return { disabled={disabled}
...item, options={lineData}
line_desc: opt.line_desc, style={{ width: "100%", minWidth: "10rem" }}
quantity: opt.part_qty || 1, allowRemoved={form.getFieldValue("is_credit_memo") || false}
actual_price: opt.cost, onSelect={(value, opt) => {
cost_center: opt.part_type setFieldsValue({
? bodyshop.pbs_serialnumber || bodyshop.cdk_dealerid billlines: getFieldsValue(["billlines"]).billlines.map(
? opt.part_type !== "PAE" (item, idx) => {
? opt.part_type if (idx === index) {
: null return {
: responsibilityCenters.defaults && ...item,
(responsibilityCenters.defaults.costs[ line_desc: opt.line_desc,
opt.part_type quantity: opt.part_qty || 1,
] || actual_price: opt.cost,
null) cost_center: opt.part_type
: null, ? bodyshop.pbs_serialnumber ||
}; bodyshop.cdk_dealerid
} ? opt.part_type !== "PAE"
return item; ? opt.part_type
} : null
), : responsibilityCenters.defaults &&
}); (responsibilityCenters.defaults.costs[
opt.part_type
] ||
null)
: null,
};
}
return item;
}
),
});
}}
/>
);
}} }}
/> </Form.Item>
), ),
}, },
{ {

View File

@@ -4,9 +4,12 @@ import { useTranslation } from "react-i18next";
//To be used as a form element only. //To be used as a form element only.
const { Option } = Select; const { Option } = Select;
const BillLineSearchSelect = ({ options, disabled, ...restProps }, ref) => { const BillLineSearchSelect = (
{ options, disabled, allowRemoved, ...restProps },
ref
) => {
const { t } = useTranslation(); const { t } = useTranslation();
console.log(allowRemoved);
return ( return (
<Select <Select
disabled={disabled} disabled={disabled}
@@ -36,7 +39,7 @@ const BillLineSearchSelect = ({ options, disabled, ...restProps }, ref) => {
{options {options
? options.map((item) => ( ? options.map((item) => (
<Option <Option
disabled={item.removed} disabled={allowRemoved ? false : item.removed}
key={item.id} key={item.id}
value={item.id} value={item.id}
cost={item.act_price ? item.act_price : 0} cost={item.act_price ? item.act_price : 0}