From 24da0207e51b9318ec1b8edd04d0e587574d2a8e Mon Sep 17 00:00:00 2001 From: Allan Carr Date: Tue, 14 Feb 2023 11:30:09 -0800 Subject: [PATCH] IO-2173 Client Fusion - Job Line Discount not allowed Adjust client job-line-upsert-modal to allow for discounts as markups were only allowed before. Convert prt_dsmk_p over to prt_dsmk_m on save of modal for both markup/discount for handling and viewing --- .../job-lines-upsert-modal.component.jsx | 2 +- .../job-lines-upsert-modal.container.jsx | 21 +++++++++++++++++-- 2 files changed, 20 insertions(+), 3 deletions(-) diff --git a/client/src/components/job-lines-upsert-modal/job-lines-upsert-modal.component.jsx b/client/src/components/job-lines-upsert-modal/job-lines-upsert-modal.component.jsx index 4fed7188b..fdf5207db 100644 --- a/client/src/components/job-lines-upsert-modal/job-lines-upsert-modal.component.jsx +++ b/client/src/components/job-lines-upsert-modal/job-lines-upsert-modal.component.jsx @@ -289,7 +289,7 @@ export function JobLinesUpsertModalComponent({ name="prt_dsmk_p" initialValue={0} > - + = 0 ? 1 : -1) + .toFormat(0.0), + }), }, ], }, @@ -68,7 +77,15 @@ function JobLinesUpsertModalContainer({ const r = await updateJobLine({ variables: { lineId: jobLineEditModal.context.id, - line: values, + line: { + ...values, + prt_dsmk_m: Dinero({ + amount: Math.round(values.act_price * 100), + }) + .percentage(Math.abs(values.prt_dsmk_p || 0)) + .multiply(values.prt_dsmk_p >= 0 ? 1 : -1) + .toFormat(0.0), + }, }, refetchQueries: ["GET_LINE_TICKET_BY_PK"], });