Skip to content

Commit

Permalink
#93 frontend
Browse files Browse the repository at this point in the history
  • Loading branch information
fdhhhdjd committed Nov 4, 2022
1 parent be9bd9c commit b03b8d6
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 7 deletions.
Binary file modified dump.rdb
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -1,10 +1,19 @@
import React, { Fragment, memo, useEffect, useState } from 'react'
import React, { Fragment, memo, useCallback, useEffect, useState } from 'react'
import { Link } from 'react-router-dom'

const Order_Item_Four = ({ order_detail, quantity }) => {
order_detail.cart.map((item) => {

})
const Order_Item_Four = ({ order_detail, routeId }) => {
const [sumQuantity, setSumQuantity] = useState(0)
const ShowTotalQuantity = () => {
let arr = []
order_detail.cart.map((item) => {
arr.push(Number(item.quantity))
})
const sum = arr.reduce((partialSum, a) => partialSum + a, 0);
setSumQuantity(sum)
}
useEffect(() => {
ShowTotalQuantity()
}, [routeId])
return (
<React.Fragment>
<div className="row order-products justify-content-between">
Expand Down Expand Up @@ -79,7 +88,7 @@ const Order_Item_Four = ({ order_detail, quantity }) => {
<td>
<strong>Quantity</strong>
</td>
<td>{quantity}</td>
<td>{sumQuantity}</td>
</tr>
<tr>
<td>
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/v1/user_ui/pages/Order_Screen/Order_Screen.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ const Order_Screen = () => {
<Order_Item_Two order_detail={order_detail} />
<Order_Item_Three order_detail={order_detail} />
</div>
<Order_Item_Four order_detail={order_detail} quantity={quantity} />
<Order_Item_Four order_detail={order_detail} routeId={id} />
</React.Fragment>
}
</div >
Expand Down

0 comments on commit b03b8d6

Please sign in to comment.