FirstPart

This commit is contained in:
DavidBelisle 2022-12-12 12:27:26 -05:00
parent 23284fc514
commit 595b6d980c
4 changed files with 18 additions and 7 deletions

View File

@ -1,7 +1,8 @@
import { faTimes } from "@fortawesome/free-solid-svg-icons";
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
import { weight } from "fontawesome";
const InvoiceItem = ({ invoice, onCancel }) => {
const InvoiceItem = ({ invoice, onCancel, paymentInfos }) => {
const productTotal = (p) => {
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 (
<div className="invoice-item-container">
<div className="invoice-item-info">
{invoice.status != null ?
@ -94,12 +94,21 @@ const InvoiceItem = ({ invoice, onCancel }) => {
null
}
<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.shippingAddress.civicNumber} {invoice.shippingAddress.street} <br />
{invoice.shippingAddress.appartment != null ? <>App: {invoice.shippingAddress.appartment} <br /></> : null}
{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 className="invoice-item-products">

View File

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

View File

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

View File

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