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 5491109c6..b5ef60cd8 100644 --- a/client/src/components/job-detail-lines/job-lines.component.jsx +++ b/client/src/components/job-detail-lines/job-lines.component.jsx @@ -300,40 +300,43 @@ export function JobLinesComponent({ dataIndex: "actions", key: "actions", render: (text, record) => ( - - +
{record.manual_line && ( - + + }); + }, + }) + } + > + + + )} { // } - +
), }, ]; diff --git a/client/src/components/job-lines-upsert-modal/job-lines-upsert-modal.container.jsx b/client/src/components/job-lines-upsert-modal/job-lines-upsert-modal.container.jsx index c83ed1764..3e2ac88ef 100644 --- a/client/src/components/job-lines-upsert-modal/job-lines-upsert-modal.container.jsx +++ b/client/src/components/job-lines-upsert-modal/job-lines-upsert-modal.container.jsx @@ -10,6 +10,7 @@ import { } from "../../graphql/jobs-lines.queries"; import { toggleModalVisible } from "../../redux/modals/modals.actions"; import { selectJobLineEditModal } from "../../redux/modals/modals.selectors"; +import UndefinedToNull from "../../utils/undefinedtonull"; import JobLinesUpdsertModal from "./job-lines-upsert-modal.component"; const mapStateToProps = createStructuredSelector({ @@ -39,7 +40,7 @@ function JobLinesUpsertModalContainer({ manual_line: !( jobLineEditModal.context && jobLineEditModal.context.id ), - ...values, + ...UndefinedToNull(values), }, ], }, diff --git a/client/src/components/jobs-detail-general/jobs-detail-general.component.jsx b/client/src/components/jobs-detail-general/jobs-detail-general.component.jsx index 326a3e8b8..385fd21bd 100644 --- a/client/src/components/jobs-detail-general/jobs-detail-general.component.jsx +++ b/client/src/components/jobs-detail-general/jobs-detail-general.component.jsx @@ -97,7 +97,7 @@ export function JobsDetailGeneral({ bodyshop, jobRO, job, form }) { label={t("jobs.fields.referralsource")} name="referral_source" > - {bodyshop.md_referral_sources.map((s) => ( {s} @@ -106,7 +106,7 @@ export function JobsDetailGeneral({ bodyshop, jobRO, job, form }) { - {bodyshop.appt_alt_transport.map((s) => ( {s} diff --git a/client/src/utils/undefinedtonull.js b/client/src/utils/undefinedtonull.js new file mode 100644 index 000000000..841701c8c --- /dev/null +++ b/client/src/utils/undefinedtonull.js @@ -0,0 +1,6 @@ +export default function UndefinedToNull(obj) { + Object.keys(obj).forEach((key) => { + if (obj[key] === undefined) obj[key] = null; + }); + return obj; +} diff --git a/server/job/job-totals.js b/server/job/job-totals.js index 51dc9be01..9ab41acf9 100644 --- a/server/job/job-totals.js +++ b/server/job/job-totals.js @@ -325,7 +325,7 @@ function CalculateTaxesTotals(job, otherTotals) { job.joblines .filter((jl) => !jl.removed) .forEach((val) => { - if (!val.tax_part || !val.part_type || IsAdditionalCost(val)) { + if (!val.tax_part || (!val.part_type && IsAdditionalCost(val))) { additionalItemsTax = additionalItemsTax.add( Dinero({ amount: Math.round((val.act_price || 0) * 100) }) .multiply(val.part_qty || 1)