From 91d2d3ff84a7642bd1f0b5df8288e70bd95dad68 Mon Sep 17 00:00:00 2001 From: Victor Turgeon <76506447+Medenos@users.noreply.github.com> Date: Mon, 7 Nov 2022 23:34:42 -0500 Subject: [PATCH] Funky Monke --- .../src/components/InvoiceItem.js | 43 +++++++++++++++++-- .../src/components/InvoiceList.js | 9 ++-- .../src/stylesheets/site.css | 9 ++++ 3 files changed, 53 insertions(+), 8 deletions(-) diff --git a/GrossesMitaines/grosses-mitaines-ui/src/components/InvoiceItem.js b/GrossesMitaines/grosses-mitaines-ui/src/components/InvoiceItem.js index 3b940da..fed4e44 100644 --- a/GrossesMitaines/grosses-mitaines-ui/src/components/InvoiceItem.js +++ b/GrossesMitaines/grosses-mitaines-ui/src/components/InvoiceItem.js @@ -1,10 +1,45 @@ -const InvoiceItem = (invoice) => { +const InvoiceItem = ({ invoice }) => { + + const productTotal = (p) => { + return (p.quantity * (p.product.status == 3 || p.product.status == 4 ? p.product.promoPrice : p.product.price)).toFixed(2) + } + + const totals = () => { + var price = 0; + var tax = 0; + + invoice.products.map((p)=>{ + price += productTotal(p) + }) + } + return ( - <> -
+ +
+
+
+ #{invoice.id} +
+
+ Adresse d'expédition:
+ {invoice.firstName} {invoice.lastName}
+ {invoice.shippingAddress.civicNumber} {invoice.shippingAddress.street}
+ {invoice.shippingAddress.city}, {invoice.shippingAddress.province} {invoice.shippingAddress.postalCode}
+ {invoice.shippingAddress.country}
+
- +
+
    + {invoice.products.map((p) => ( +
  • {p.quantity} x {p.product.title} -{'>'} {productTotal(p)}
  • + ))} +
+
+ {totals()} +
+
+
); } diff --git a/GrossesMitaines/grosses-mitaines-ui/src/components/InvoiceList.js b/GrossesMitaines/grosses-mitaines-ui/src/components/InvoiceList.js index f4e2ec8..636d947 100644 --- a/GrossesMitaines/grosses-mitaines-ui/src/components/InvoiceList.js +++ b/GrossesMitaines/grosses-mitaines-ui/src/components/InvoiceList.js @@ -2,13 +2,14 @@ import InvoiceItem from "./InvoiceItem"; const InvoiceList = ({ invoices }) => { return ( - <> - {invoices.map((invoice) => { +
+ {invoices.map((invoice) => ( - })} - + ))} +
); } diff --git a/GrossesMitaines/grosses-mitaines-ui/src/stylesheets/site.css b/GrossesMitaines/grosses-mitaines-ui/src/stylesheets/site.css index 551e596..0e96b11 100644 --- a/GrossesMitaines/grosses-mitaines-ui/src/stylesheets/site.css +++ b/GrossesMitaines/grosses-mitaines-ui/src/stylesheets/site.css @@ -726,6 +726,15 @@ a { } +.invoice-list-container{ + border: beige 2px double; +} + +.invoice-item-container{ + border: black 1px solid; +} + + /* -------------------------------------------------------- */ /* specification pour les moyennes écrans /* -------------------------------------------------------- */