I'm a newbie, struggling in this new world.
I have this array of objects:
[
{
"orderid": "12696",
"id": 5180,
"name": "Crema Chantilly 250 Ml",
"price": 377.2,
**"quantity": 1,**
"order": 0,
"category": 167
},
{
"orderid": "12696",
"id": 3929,
"name": "Close Up",
"price": 111.15,
**"quantity": 2,**
"order": 1,
"category": 156
},
{
"orderid": "12696",
"id": 2739,
"name": "Hellmanns 232 Ml",
"price": 92.68,
**"quantity": 2,**
"order": 31,
"category": 131
}
]
These are product cards which will get scanned by a barcode scanner, for a warehouse picking app. I'm doing it as a sort of multi-step form for this. I need the objects to be multiplied by its quantity so, I can get to pick each item. I'm using sequelize to get everything from the database, and then a .map() to make a new array of objects of what i need from the product card.
This is an example of what i'm seeking:
[
{
"orderid": "12696",
"id": 5180,
"name": "Crema Chantilly 250 Ml",
"price": 377.2,
**"quantity": 1,**
"order": 0,
"category": 167
},
{
"orderid": "12696",
"id": 3929,
"name": "Close Up",
"price": 111.15,
**"quantity": 2,**
"order": 1,
"category": 156
},
{
"orderid": "12696",
"id": 3929,
"name": "Close Up",
"price": 111.15,
**"quantity": 2,**
"order": 1,
"category": 156
},
{
"orderid": "12696",
"id": 2739,
"name": "Hellmanns 232 Ml",
"price": 92.68,
**"quantity": 2,**
"order": 31,
"category": 131
},
{
"orderid": "12696",
"id": 2739,
"name": "Hellmanns 232 Ml",
"price": 92.68,
**"quantity": 2,**
"order": 31,
"category": 131
}
]
I also thought of doing it all on the DOM, using a number input which will decrement as i scan the bar-code of the product, but I can't figure it out how to do it.
Thanks in advance, i would really appreciate your help !
orderQty
. Repeating items in an array is an unusual approach for something like this IMO. Then to fill that item in the order you have everything in one object – charlietfl