Skip to content
Snippets Groups Projects
Commit 77f3ad80 authored by meskio's avatar meskio :tent:
Browse files

Alphabetic products on order purchase

parent 2da6dfaf
Branches
Tags
No related merge requests found
......@@ -12,18 +12,28 @@ class PurchaseOrder extends React.Component {
constructor(props) {
super(props);
const order = props.order.products.map((p) => {
p.amount = 0;
if (props.purchase) {
const my_purchase = props.purchase.find(
(e) => e.product_code === p.code
);
if (my_purchase) {
p.amount = my_purchase.amount;
const order = props.order.products
.map((p) => {
p.amount = 0;
if (props.purchase) {
const my_purchase = props.purchase.find(
(e) => e.product_code === p.code
);
if (my_purchase) {
p.amount = my_purchase.amount;
}
}
}
return p;
});
return p;
})
.sort((p1, p2) => {
if (p1.name > p2.name) {
return 1;
}
if (p1.name < p2.name) {
return -1;
}
return 0;
});
this.state = {
order: order,
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment