Funky Monke
This commit is contained in:
parent
53551ea846
commit
91d2d3ff84
@ -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>
|
||||
);
|
||||
|
||||
}
|
||||
|
@ -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>
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -726,6 +726,15 @@ a {
|
||||
}
|
||||
|
||||
|
||||
.invoice-list-container{
|
||||
border: beige 2px double;
|
||||
}
|
||||
|
||||
.invoice-item-container{
|
||||
border: black 1px solid;
|
||||
}
|
||||
|
||||
|
||||
/* -------------------------------------------------------- */
|
||||
/* specification pour les moyennes écrans
|
||||
/* -------------------------------------------------------- */
|
||||
|
Loading…
Reference in New Issue
Block a user