BEINISISNIDSFINSDOvhpbfdslkvmh f,uidafmjkuzvrnhdahgdsxzk.gjSUrabéj

This commit is contained in:
Victor Turgeon
2022-11-08 10:22:15 -05:00
parent 5f4a488274
commit fd8ade08f0
5 changed files with 226 additions and 1 deletions

View File

@@ -0,0 +1,9 @@
const ReviewProdItem = ({ pq, onAddOne, onRemoveOne, onRemoveProduct }) => {
return (
<div className="review-prod-item-container">
</div>
)
}
export default ReviewProdItem

View File

@@ -0,0 +1,20 @@
import ReviewProdItem from "./ReviewProdItem";
const ReviewProdList = ({ products, onAddOne, onRemoveOne, onRemoveProduct }) => {
return (
<div>
{products.map((p) => (
<ReviewProdItem
key={p.product.id}
pq={p}
onAddOne={onAddOne}
onRemoveOne={onRemoveOne}
onRemoveProduct={onRemoveProduct}
/>
))}
</div>
)
}
export default ReviewProdList;

View File

@@ -0,0 +1,40 @@
const TotalProductsPrice = ({ products }) => {
const productTotal = (p) => {
return (p.quantity * (p.product.status == 3 || p.product.status == 4 ? p.product.promoPrice : p.product.price))
}
const getPriceHTML = (prods) => {
const tpsRate = 5;
const tvqRate = 9.975;
var price = 0;
var tps = 0;
var tvq = 0;
prods.map((p) => {
price += productTotal(p);
});
tps = price * (tpsRate / 100);
tvq = price * (tvqRate / 100);
return (
<div className="invoice-item-price">
Sous-total = {price.toFixed(2)} $ CA<br />
+ TPS ({tpsRate}%) = {tps.toFixed(2)} $ CA<br />
+ TVQ ({tvqRate}%) = {tvq.toFixed(2)} $ CA<br />
<b>Total = {(price + tps + tvq).toFixed(2)} $ CA</b>
</div>
);
}
return (
<div>
{getPriceHTML(products)}
</div>
)
}
export default TotalProductsPrice;