From aa61aa67029267fdc9aa51e1df5e5a09e2df5f8f Mon Sep 17 00:00:00 2001 From: Patrick Fic <> Date: Wed, 26 Jan 2022 14:03:28 -0800 Subject: [PATCH] IO-1672 Updated bill line discount display. --- .../bill-enter-modal.container.jsx | 2 +- .../bill-form/bill-form.lines.component.jsx | 66 ++++++++++++++----- 2 files changed, 51 insertions(+), 17 deletions(-) diff --git a/client/src/components/bill-enter-modal/bill-enter-modal.container.jsx b/client/src/components/bill-enter-modal/bill-enter-modal.container.jsx index d7adeb4fe..0ef98325a 100644 --- a/client/src/components/bill-enter-modal/bill-enter-modal.container.jsx +++ b/client/src/components/bill-enter-modal/bill-enter-modal.container.jsx @@ -245,7 +245,7 @@ function BillEnterModalContainer({ return ( ( - - ), - additional: (record, index) => ( - - {() => { - const line = getFieldsValue(["billlines"]).billlines[index]; - if (!!!line) return null; - const lineDiscount = ( - 1 - - Math.round((line.actual_cost / line.actual_price) * 100) / 100 - ).toPrecision(2); + + {() => { + const line = getFieldsValue(["billlines"]).billlines[index]; + if (!!!line) return null; + const lineDiscount = 1 - line.actual_cost / line.actual_price; - if (lineDiscount - discount === 0) return
; - return ; - }} - + return ( + + 0.005 + ? "red" + : "green", + }} + /> + + ); + }} + + } + /> ), + // additional: (record, index) => ( + // + // {() => { + // const line = getFieldsValue(["billlines"]).billlines[index]; + // if (!!!line) return null; + // const lineDiscount = ( + // 1 - + // Math.round((line.actual_cost / line.actual_price) * 100) / 100 + // ).toPrecision(2); + + // return ( + // + // + // + // ); + // }} + // + // ), }, { title: t("billlines.fields.cost_center"),