Merge branch 'react-version' of https://github.com/MarcEricMartel/420-5DW-HY-TP into react-version
This commit is contained in:
commit
28fff14d96
@ -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 (
|
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>
|
||||||
</>
|
<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 }) => {
|
const InvoiceList = ({ invoices }) => {
|
||||||
return (
|
return (
|
||||||
<>
|
<div className="invoice-list-container">
|
||||||
{invoices.map((invoice) => {
|
{invoices.map((invoice) => (
|
||||||
<InvoiceItem
|
<InvoiceItem
|
||||||
|
key={invoice.id}
|
||||||
invoice={invoice}
|
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
|
/* specification pour les moyennes écrans
|
||||||
/* -------------------------------------------------------- */
|
/* -------------------------------------------------------- */
|
||||||
|
Loading…
Reference in New Issue
Block a user