react-version #1

Merged
memartel_loc merged 290 commits from react-version into main 2023-11-04 09:48:15 -04:00
3 changed files with 53 additions and 8 deletions
Showing only changes of commit 28fff14d96 - Show all commits

View File

@ -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 (
<>
<div>
<div className="invoice-item-container">
<div className="invoice-item-info">
<div>
#{invoice.id}
</div>
<div className="invoice-item-expedition">
<b>Adresse d'expédition:</b><br />
{invoice.firstName} {invoice.lastName}<br />
{invoice.shippingAddress.civicNumber} {invoice.shippingAddress.street}<br />
{invoice.shippingAddress.city}, {invoice.shippingAddress.province} {invoice.shippingAddress.postalCode}<br />
{invoice.shippingAddress.country}<br />
</div>
</div>
</>
<div className="invoice-item-products">
<ul className="invoice-item-product-list">
{invoice.products.map((p) => (
<li>{p.quantity} x {p.product.title} -{'>'} {productTotal(p)}</li>
))}
</ul>
<div>
{totals()}
</div>
</div>
</div>
);
}

View File

@ -2,13 +2,14 @@ import InvoiceItem from "./InvoiceItem";
const InvoiceList = ({ invoices }) => {
return (
<>
{invoices.map((invoice) => {
<div className="invoice-list-container">
{invoices.map((invoice) => (
<InvoiceItem
key={invoice.id}
invoice={invoice}
/>
})}
</>
))}
</div>
);
}

View File

@ -726,6 +726,15 @@ a {
}
.invoice-list-container{
border: beige 2px double;
}
.invoice-item-container{
border: black 1px solid;
}
/* -------------------------------------------------------- */
/* specification pour les moyennes écrans
/* -------------------------------------------------------- */