diff --git a/bodyshop_translations.babel b/bodyshop_translations.babel index 81ac10113..74c41de5e 100644 --- a/bodyshop_translations.babel +++ b/bodyshop_translations.babel @@ -2076,6 +2076,27 @@ + + deleteconfirm + false + + + + + + en-US + false + + + es-MX + false + + + fr-CA + false + + + discrepancy false diff --git a/client/src/components/bill-delete-button/bill-delete-button.component.jsx b/client/src/components/bill-delete-button/bill-delete-button.component.jsx index 4629c29c3..723f6e4ca 100644 --- a/client/src/components/bill-delete-button/bill-delete-button.component.jsx +++ b/client/src/components/bill-delete-button/bill-delete-button.component.jsx @@ -1,5 +1,5 @@ import { useMutation } from "@apollo/client"; -import { Button, notification } from "antd"; +import { Button, notification, Popconfirm } from "antd"; import React, { useState } from "react"; import { useTranslation } from "react-i18next"; import { DELETE_BILL } from "../../graphql/bills.queries"; @@ -47,9 +47,19 @@ export default function BillDeleteButton({ bill }) { return ( }> - + + + ); } diff --git a/client/src/components/bill-detail-edit/bill-detail-edit.container.jsx b/client/src/components/bill-detail-edit/bill-detail-edit.container.jsx index bf4467758..8d764bb5e 100644 --- a/client/src/components/bill-detail-edit/bill-detail-edit.container.jsx +++ b/client/src/components/bill-detail-edit/bill-detail-edit.container.jsx @@ -31,6 +31,8 @@ export default function BillDetailEditcontainer() { const handleFinish = async (values) => { setUpdateLoading(true); + //let adjustmentsToInsert = {}; + const { billlines, upload, ...bill } = values; const updates = []; updates.push( @@ -39,8 +41,22 @@ export default function BillDetailEditcontainer() { }) ); - billlines.forEach((il) => { + billlines.forEach((billline) => { + const { deductfromlabor, ...il } = billline; delete il.__typename; + + //Need to compare this line to the previous version of the line to see if there is a change in the adjustments. + const theOldBillLine = data.bills_by_pk.billlines.find( + (bl) => bl.id === billline.id + ); + + if (theOldBillLine) { + //It was there! Need to change the diff. + if (theOldBillLine.deductfromlabor !== deductfromlabor) { + //There's a different + } + } + if (il.id) { updates.push( updateBillLine({ @@ -48,6 +64,7 @@ export default function BillDetailEditcontainer() { billLineId: il.id, billLine: { ...il, + deductedfromlbr: deductfromlabor, joblineid: il.joblineid === "noline" ? null : il.joblineid, }, }, @@ -61,6 +78,7 @@ export default function BillDetailEditcontainer() { billLines: [ { ...il, + deductedfromlbr: deductfromlabor, billid: search.billid, joblineid: il.joblineid === "noline" ? null : il.joblineid, }, diff --git a/client/src/components/job-detail-lines/job-lines.component.jsx b/client/src/components/job-detail-lines/job-lines.component.jsx index b5ef60cd8..211ebb909 100644 --- a/client/src/components/job-detail-lines/job-lines.component.jsx +++ b/client/src/components/job-detail-lines/job-lines.component.jsx @@ -1,11 +1,10 @@ import { DeleteFilled, FilterFilled, SyncOutlined } from "@ant-design/icons"; -import { useMutation, useQuery } from "@apollo/client"; +import { useMutation } from "@apollo/client"; import { Button, Dropdown, Input, Menu, Space, Table } from "antd"; -import React, { useMemo, useState } from "react"; +import React, { useState } from "react"; import { useTranslation } from "react-i18next"; import { connect } from "react-redux"; import { createStructuredSelector } from "reselect"; -import { QUERY_BILLS_BY_JOB_REF } from "../../graphql/bill-lines.queries"; import { DELETE_JOB_LINE_BY_PK } from "../../graphql/jobs-lines.queries"; import { selectJobReadOnly } from "../../redux/application/application.selectors"; import { setModalContext } from "../../redux/modals/modals.actions"; @@ -48,26 +47,26 @@ export function JobLinesComponent({ }) { const [deleteJobLine] = useMutation(DELETE_JOB_LINE_BY_PK); - const { - loading: billLinesLoading, - error: billLinesError, - data: billLinesData, - } = useQuery(QUERY_BILLS_BY_JOB_REF, { - variables: { jobId: job && job.id }, - skip: loading || !job, - }); + // const { + // loading: billLinesLoading, + // error: billLinesError, + // data: billLinesData, + // } = useQuery(QUERY_BILLS_BY_JOB_REF, { + // variables: { jobId: job && job.id }, + // skip: loading || !job, + // }); - const billLinesDataObj = useMemo(() => { - if (!billLinesData) return {}; - const ret = {}; - billLinesData.billlines.map((b) => { - if (b.joblineid) { - ret[b.joblineid] = { ...b, total: b.actual_price * b.quantity }; - } - return null; - }); - return ret; - }, [billLinesData]); + // const billLinesDataObj = useMemo(() => { + // if (!billLinesData) return {}; + // const ret = {}; + // billLinesData.billlines.map((b) => { + // if (b.joblineid) { + // ret[b.joblineid] = { ...b, total: b.actual_price * b.quantity }; + // } + // return null; + // }); + // return ret; + // }, [billLinesData]); const [state, setState] = useState({ sortedInfo: {}, @@ -231,14 +230,7 @@ export function JobLinesComponent({ title: t("joblines.labels.billref"), dataIndex: "billref", key: "billref", - render: (text, record) => ( - - ), + render: (text, record) => , }, { title: t("joblines.fields.status"), @@ -302,7 +294,7 @@ export function JobLinesComponent({ render: (text, record) => (
{record.manual_line && ( - +