From 66b4673b4e05275643353026275360001e4a9172 Mon Sep 17 00:00:00 2001 From: MikunoNaka Date: Mon, 26 Apr 2021 16:20:08 +0530 Subject: minor ui changes --- src/components/BillingPage.js | 9 ++++++--- src/components/Display/Display.css | 3 +++ src/components/Display/Display.scss | 4 +++- src/components/Display/SummaryDisplay.js | 21 ++++++++++++++------- 4 files changed, 26 insertions(+), 11 deletions(-) (limited to 'src/components') diff --git a/src/components/BillingPage.js b/src/components/BillingPage.js index a7e4ef0..3f60f44 100644 --- a/src/components/BillingPage.js +++ b/src/components/BillingPage.js @@ -31,11 +31,14 @@ const BillingPage = () => { }; return ( -
+ <> - -
+
+
placeholder for extras menu
+ +
+ ); } diff --git a/src/components/Display/Display.css b/src/components/Display/Display.css index bbec236..528e837 100644 --- a/src/components/Display/Display.css +++ b/src/components/Display/Display.css @@ -42,3 +42,6 @@ $defShadow: 0px 0px 4px #232627; .SummaryDisplayTR td { color: #FF79C6; font-size: 1.7rem; } + +.SummaryDisplay { + border: 1px solid pink; } diff --git a/src/components/Display/Display.scss b/src/components/Display/Display.scss index 34a30f4..7fa37a3 100644 --- a/src/components/Display/Display.scss +++ b/src/components/Display/Display.scss @@ -40,4 +40,6 @@ font-size: 1.7rem; } - +.SummaryDisplay { + border: 1px solid pink; +} diff --git a/src/components/Display/SummaryDisplay.js b/src/components/Display/SummaryDisplay.js index aabd111..97c24b5 100644 --- a/src/components/Display/SummaryDisplay.js +++ b/src/components/Display/SummaryDisplay.js @@ -20,14 +20,16 @@ const getBasicSummary = (items) => { const getFullSummary = (items) => { let totalRawPrice = 0; - let totalDiscountPrice = 0; // to be subtracted from totalRawPrice + let totalDiscount = 0; // to be subtracted from totalRawPrice + let totalTax = 0; for (let i = 0; i < items.length; i++) { const itemTotalPrice = items[i].TotalPrice; const itemDiscount = items[i].Discount; totalRawPrice += itemTotalPrice; - totalDiscountPrice += (itemDiscount / 100) * itemTotalPrice; + totalDiscount += (itemDiscount / 100) * itemTotalPrice; + totalTax += (items[i].GST / 100) * itemTotalPrice; } // TODO: add support for calculating gst from TotalPriceAfterDiscount @@ -35,7 +37,10 @@ const getFullSummary = (items) => { return ( { "TotalRawPrice": totalRawPrice, - "TotalPriceAfterDiscount": totalRawPrice - totalDiscountPrice + "TotalDiscountPrice": totalDiscount, + "TotalPriceAfterDiscount": totalRawPrice - totalDiscount, + "TotalTaxAmount": totalTax, + "TotalPrice": (totalRawPrice - totalDiscount) + totalTax, } ); } @@ -61,10 +66,12 @@ const SummaryDisplay = (props) => { const summary = getFullSummary(props.items); return ( - <> -

Total: {summary.TotalRawPrice}

-

Total after discount: {summary.TotalPriceAfterDiscount}

- +
+

Total raw: {summary.TotalRawPrice}

+

Total after discount: {summary.TotalRawPrice} - {summary.TotalDiscountPrice} = {summary.TotalPriceAfterDiscount}

+

Total tax: {summary.TotalTaxAmount}

+

Total: {summary.TotalPriceAfterDiscount} + {summary.TotalTaxAmount} = {summary.TotalPrice}

+
); } -- cgit v1.2.3