IO-1674 Resolve new bill lines issues.
This commit is contained in:
@@ -58,7 +58,7 @@ export function BillEnterModalLinesComponent({
|
||||
],
|
||||
};
|
||||
},
|
||||
formInput: (record, index) => (
|
||||
wrapper: (props) => (
|
||||
<Form.Item
|
||||
noStyle
|
||||
shouldUpdate={(prev, cur) =>
|
||||
@@ -66,46 +66,46 @@ export function BillEnterModalLinesComponent({
|
||||
}
|
||||
>
|
||||
{() => {
|
||||
return (
|
||||
<BillLineSearchSelect
|
||||
disabled={disabled}
|
||||
options={lineData}
|
||||
style={{ width: "100%", minWidth: "10rem" }}
|
||||
allowRemoved={form.getFieldValue("is_credit_memo") || false}
|
||||
onSelect={(value, opt) => {
|
||||
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;
|
||||
}}
|
||||
</Form.Item>
|
||||
),
|
||||
formInput: (record, index) => (
|
||||
<BillLineSearchSelect
|
||||
disabled={disabled}
|
||||
options={lineData}
|
||||
style={{ width: "100%", minWidth: "10rem" }}
|
||||
allowRemoved={form.getFieldValue("is_credit_memo") || false}
|
||||
onSelect={(value, opt) => {
|
||||
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 = ({
|
||||
</Space>
|
||||
</td>
|
||||
);
|
||||
|
||||
if (wrapper)
|
||||
return (
|
||||
<wrapper>
|
||||
<td {...restProps}>
|
||||
<Form.Item
|
||||
labelCol={{ span: 0 }}
|
||||
name={dataIndex}
|
||||
{...(formItemProps && formItemProps(record))}
|
||||
>
|
||||
{(formInput && formInput(record, record.name)) || children}
|
||||
</Form.Item>
|
||||
</td>
|
||||
</wrapper>
|
||||
);
|
||||
return (
|
||||
<td {...restProps}>
|
||||
<Form.Item
|
||||
|
||||
@@ -9,7 +9,7 @@ const BillLineSearchSelect = (
|
||||
ref
|
||||
) => {
|
||||
const { t } = useTranslation();
|
||||
console.log(allowRemoved);
|
||||
|
||||
return (
|
||||
<Select
|
||||
disabled={disabled}
|
||||
@@ -56,7 +56,7 @@ const BillLineSearchSelect = (
|
||||
<span>{`${item.removed ? `(REMOVED) ` : ""}${item.line_desc}${
|
||||
item.oem_partno ? ` - ${item.oem_partno}` : ""
|
||||
}`}</span>
|
||||
<span style={{ float: "right" }}>
|
||||
<span style={{ float: "right", paddingleft: "1rem" }}>
|
||||
{item.act_price
|
||||
? `$${item.act_price && item.act_price.toFixed(2)}`
|
||||
: ``}
|
||||
|
||||
@@ -181,7 +181,10 @@ export const UPDATE_JOB_LINE = gql`
|
||||
|
||||
export const GET_JOB_LINES_TO_ENTER_BILL = gql`
|
||||
query GET_JOB_LINES_TO_ENTER_BILL($id: uuid!) {
|
||||
joblines(where: { jobid: { _eq: $id } }, order_by: { act_price: desc }) {
|
||||
joblines(
|
||||
where: { jobid: { _eq: $id } }
|
||||
order_by: { act_price: desc_nulls_last }
|
||||
) {
|
||||
removed
|
||||
id
|
||||
line_desc
|
||||
|
||||
Reference in New Issue
Block a user