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
|
<Form.Item
|
||||||
noStyle
|
noStyle
|
||||||
shouldUpdate={(prev, cur) =>
|
shouldUpdate={(prev, cur) =>
|
||||||
@@ -66,46 +66,46 @@ export function BillEnterModalLinesComponent({
|
|||||||
}
|
}
|
||||||
>
|
>
|
||||||
{() => {
|
{() => {
|
||||||
return (
|
return props.children;
|
||||||
<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;
|
|
||||||
}
|
|
||||||
),
|
|
||||||
});
|
|
||||||
}}
|
|
||||||
/>
|
|
||||||
);
|
|
||||||
}}
|
}}
|
||||||
</Form.Item>
|
</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"),
|
title: t("billlines.fields.line_desc"),
|
||||||
@@ -537,6 +537,7 @@ const EditableCell = ({
|
|||||||
formInput,
|
formInput,
|
||||||
formItemProps,
|
formItemProps,
|
||||||
additional,
|
additional,
|
||||||
|
wrapper,
|
||||||
...restProps
|
...restProps
|
||||||
}) => {
|
}) => {
|
||||||
if (additional)
|
if (additional)
|
||||||
@@ -554,7 +555,20 @@ const EditableCell = ({
|
|||||||
</Space>
|
</Space>
|
||||||
</td>
|
</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 (
|
return (
|
||||||
<td {...restProps}>
|
<td {...restProps}>
|
||||||
<Form.Item
|
<Form.Item
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ const BillLineSearchSelect = (
|
|||||||
ref
|
ref
|
||||||
) => {
|
) => {
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
console.log(allowRemoved);
|
|
||||||
return (
|
return (
|
||||||
<Select
|
<Select
|
||||||
disabled={disabled}
|
disabled={disabled}
|
||||||
@@ -56,7 +56,7 @@ const BillLineSearchSelect = (
|
|||||||
<span>{`${item.removed ? `(REMOVED) ` : ""}${item.line_desc}${
|
<span>{`${item.removed ? `(REMOVED) ` : ""}${item.line_desc}${
|
||||||
item.oem_partno ? ` - ${item.oem_partno}` : ""
|
item.oem_partno ? ` - ${item.oem_partno}` : ""
|
||||||
}`}</span>
|
}`}</span>
|
||||||
<span style={{ float: "right" }}>
|
<span style={{ float: "right", paddingleft: "1rem" }}>
|
||||||
{item.act_price
|
{item.act_price
|
||||||
? `$${item.act_price && item.act_price.toFixed(2)}`
|
? `$${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`
|
export const GET_JOB_LINES_TO_ENTER_BILL = gql`
|
||||||
query GET_JOB_LINES_TO_ENTER_BILL($id: uuid!) {
|
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
|
removed
|
||||||
id
|
id
|
||||||
line_desc
|
line_desc
|
||||||
|
|||||||
Reference in New Issue
Block a user