Merge branch 'react-version' of https://github.com/MarcEricMartel/420-5DW-HY-TP into react-version

This commit is contained in:
MarcEricMartel 2022-12-12 12:31:56 -08:00
commit 7a07fea68c
4 changed files with 18 additions and 7 deletions

View File

@ -1,7 +1,8 @@
import { faTimes } from "@fortawesome/free-solid-svg-icons"; import { faTimes } from "@fortawesome/free-solid-svg-icons";
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome"; import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
import { weight } from "fontawesome";
const InvoiceItem = ({ invoice, onCancel }) => { const InvoiceItem = ({ invoice, onCancel, paymentInfos }) => {
const productTotal = (p) => { const productTotal = (p) => {
return (p.quantity * (p.product.status == 3 || p.product.status == 4 ? p.product.promoPrice : p.product.price)) return (p.quantity * (p.product.status == 3 || p.product.status == 4 ? p.product.promoPrice : p.product.price))
@ -81,9 +82,8 @@ const InvoiceItem = ({ invoice, onCancel }) => {
) )
} }
} }
console.log(invoice);
return ( return (
<div className="invoice-item-container"> <div className="invoice-item-container">
<div className="invoice-item-info"> <div className="invoice-item-info">
{invoice.status != null ? {invoice.status != null ?
@ -94,12 +94,21 @@ const InvoiceItem = ({ invoice, onCancel }) => {
null null
} }
<div className="invoice-item-expedition"> <div className="invoice-item-expedition">
<b>Adresse d'expédition:</b><br /> <b>Adresse d'expédition :</b><br />
{invoice.firstName} {invoice.lastName}<br /> {invoice.firstName} {invoice.lastName}<br />
{invoice.shippingAddress.civicNumber} {invoice.shippingAddress.street} <br /> {invoice.shippingAddress.civicNumber} {invoice.shippingAddress.street} <br />
{invoice.shippingAddress.appartment != null ? <>App: {invoice.shippingAddress.appartment} <br /></> : null} {invoice.shippingAddress.appartment != null ? <>App: {invoice.shippingAddress.appartment} <br /></> : null}
{invoice.shippingAddress.city}, {invoice.shippingAddress.province} {invoice.shippingAddress.postalCode}<br /> {invoice.shippingAddress.city}, {invoice.shippingAddress.province} {invoice.shippingAddress.postalCode}<br />
{invoice.shippingAddress.country}<br /> {invoice.shippingAddress.country}<br /><br/>
{paymentInfos == true && invoice.payment != null ? <>
<label style={{"fontWeight": "bold"}}>Informations de paiement :</label><br/>
Nom : {invoice.payment.name}<br/>
Email : {invoice.payment.email}<br/>
Téléphone : {invoice.payment.phone}<br/>
Numéro de carte : **** **** **** {invoice.payment.lastFourDigits}<br/>
</>
: null }
</div> </div>
</div> </div>
<div className="invoice-item-products"> <div className="invoice-item-products">

View File

@ -1,6 +1,6 @@
import InvoiceItem from "./InvoiceItem"; import InvoiceItem from "./InvoiceItem";
const InvoiceList = ({ invoices, onCancel }) => { const InvoiceList = ({ invoices, onCancel, paymentInfos }) => {
return ( return (
<div className="invoice-list-container"> <div className="invoice-list-container">
{invoices.map((invoice) => ( {invoices.map((invoice) => (
@ -8,6 +8,7 @@ const InvoiceList = ({ invoices, onCancel }) => {
key={invoice.id} key={invoice.id}
invoice={invoice} invoice={invoice}
onCancel={onCancel} onCancel={onCancel}
paymentInfos={paymentInfos}
/> />
))} ))}
</div> </div>

View File

@ -86,6 +86,7 @@ const Invoices = () => {
<InvoiceList <InvoiceList
invoices={invoices} invoices={invoices}
onCancel={handleCancelInvoice} onCancel={handleCancelInvoice}
paymentInfos={false}
/> />
</> </>
); );

View File

@ -69,12 +69,12 @@ const MyInvoices = () => {
}; };
return ( return (
<> <>
<InvoiceList <InvoiceList
invoices={invoices} invoices={invoices}
onCancel={handleCancelInvoice} onCancel={handleCancelInvoice}
paymentInfos={true}
/> />
</> </>
); );