place order for pd done
Some checks failed
NPM Installation / build (16.x, ubuntu-latest) (push) Has been cancelled
NPM Installation / build (16.x, windows-latest) (push) Has been cancelled
NPM Installation / build (17.x, ubuntu-latest) (push) Has been cancelled
NPM Installation / build (17.x, windows-latest) (push) Has been cancelled
NPM Installation / build (18.x, ubuntu-latest) (push) Has been cancelled
NPM Installation / build (18.x, windows-latest) (push) Has been cancelled
Some checks failed
NPM Installation / build (16.x, ubuntu-latest) (push) Has been cancelled
NPM Installation / build (16.x, windows-latest) (push) Has been cancelled
NPM Installation / build (17.x, ubuntu-latest) (push) Has been cancelled
NPM Installation / build (17.x, windows-latest) (push) Has been cancelled
NPM Installation / build (18.x, ubuntu-latest) (push) Has been cancelled
NPM Installation / build (18.x, windows-latest) (push) Has been cancelled
This commit is contained in:
parent
f324d4debf
commit
3a12416007
24
src/_nav.js
24
src/_nav.js
@ -32,18 +32,18 @@ const _nav = [
|
||||
to: '/shop',
|
||||
icon: <CIcon icon={cilShare} customClassName="nav-icon" />,
|
||||
},
|
||||
// {
|
||||
// component: CNavItem,
|
||||
// name: 'Cart',
|
||||
// to: '/cart',
|
||||
// icon: <CIcon icon={cilShare} customClassName="nav-icon" />,
|
||||
// },
|
||||
// {
|
||||
// component: CNavItem,
|
||||
// name: 'Orders Placed',
|
||||
// to: '/orders-placed',
|
||||
// icon: <CIcon icon={cilPaperPlane} customClassName="nav-icon" />,
|
||||
// },
|
||||
{
|
||||
component: CNavItem,
|
||||
name: 'Cart',
|
||||
to: '/cart',
|
||||
icon: <CIcon icon={cilShare} customClassName="nav-icon" />,
|
||||
},
|
||||
{
|
||||
component: CNavItem,
|
||||
name: 'Orders Placed',
|
||||
to: '/orders-placed',
|
||||
icon: <CIcon icon={cilPaperPlane} customClassName="nav-icon" />,
|
||||
},
|
||||
// {
|
||||
// component: CNavItem,
|
||||
// name: 'Product manual',
|
||||
|
@ -19,6 +19,7 @@ import { useNavigate } from 'react-router-dom'
|
||||
|
||||
const Order = () => {
|
||||
const [orders, setOrders] = useState([])
|
||||
|
||||
const [loading, setLoading] = useState(true)
|
||||
const [page, setPage] = useState(0)
|
||||
const [rowsPerPage, setRowsPerPage] = useState(5)
|
||||
@ -46,7 +47,7 @@ const Order = () => {
|
||||
// Fetch orders from the API with pagination
|
||||
const fetchOrders = async () => {
|
||||
try {
|
||||
const response = await Axios.get('/api/get-placed-order-pd', {
|
||||
const response = await Axios.get('/api/rd-place-order', {
|
||||
headers: {
|
||||
'Access-Control-Allow-Origin': '*',
|
||||
Authorization: `Bearer ${token}`,
|
||||
@ -57,7 +58,8 @@ const Order = () => {
|
||||
limit: rowsPerPage, // number of rows per page
|
||||
},
|
||||
})
|
||||
setOrders(response.data.plcaedOrders)
|
||||
console.log('resp', response)
|
||||
setOrders(response.data?.placedOrders ? response.data?.placedOrders : [])
|
||||
setTotalOrders(response.data.totalOrders) // Ensure the API returns the total count of orders
|
||||
} catch (error) {
|
||||
console.error('Error fetching orders:', error)
|
||||
|
@ -27,7 +27,7 @@ const OrderDetails = () => {
|
||||
const [ownerDetails, setOwnerDetails] = useState()
|
||||
|
||||
const getData = async () => {
|
||||
let res = await Axios.get(`/api/v1/user/details`, {
|
||||
let res = await Axios.get(`/apird-get-me`, {
|
||||
headers: {
|
||||
Authorization: `Bearer ${token}`,
|
||||
},
|
||||
@ -36,11 +36,11 @@ const OrderDetails = () => {
|
||||
setOwnerDetails({ ...res.data.user })
|
||||
}
|
||||
}
|
||||
console.log('order', order)
|
||||
|
||||
useEffect(() => {
|
||||
const fetchOrderDetails = async () => {
|
||||
try {
|
||||
const response = await Axios.get(`/api/get-single-placed-order-pd/${id}`, {
|
||||
const response = await Axios.get(`/api/rd-place-order/${id}`, {
|
||||
headers: {
|
||||
Authorization: `Bearer ${token}`,
|
||||
},
|
||||
@ -53,7 +53,7 @@ const OrderDetails = () => {
|
||||
setLoading(false)
|
||||
}
|
||||
}
|
||||
getData()
|
||||
// getData()
|
||||
fetchOrderDetails()
|
||||
}, [id])
|
||||
|
||||
@ -114,11 +114,11 @@ const OrderDetails = () => {
|
||||
Payment Mode: <strong>{paymentMode}</strong>
|
||||
</Typography>
|
||||
</Grid>
|
||||
<Grid item sm={12} md={12} lg={12}>
|
||||
{/* <Grid item sm={12} md={12} lg={12}>
|
||||
<Typography variant="h5" sx={{ mb: '0.5rem' }}>
|
||||
SBU: <strong>{ownerDetails?.SBU}</strong>
|
||||
</Typography>
|
||||
</Grid>
|
||||
</Grid> */}
|
||||
</Grid>
|
||||
</Box>
|
||||
|
||||
|
@ -21,19 +21,17 @@ const OrderConfirmation = ({ orderId, billTo, shipTo, paymentMode, cartItem }) =
|
||||
const subtotal = useSelector(selectCartSubtotal)
|
||||
const [ownerDetails, setOwnerDetails] = useState()
|
||||
const token = isAutheticated()
|
||||
const getData = async () => {
|
||||
let res = await Axios.get(`/api/v1/user/details`, {
|
||||
headers: {
|
||||
Authorization: `Bearer ${token}`,
|
||||
},
|
||||
})
|
||||
if (res.data.success) {
|
||||
setOwnerDetails({ ...res.data.user })
|
||||
}
|
||||
}
|
||||
useEffect(() => {
|
||||
getData()
|
||||
}, [])
|
||||
// const getData = async () => {
|
||||
// let res = await Axios.get(`/api/rd-get-me`, {
|
||||
// headers: {
|
||||
// Authorization: `Bearer ${token}`,
|
||||
// },
|
||||
// })
|
||||
// if (res.data.success) {
|
||||
// setOwnerDetails({ ...res.data.user })
|
||||
// }
|
||||
// }
|
||||
|
||||
// Calculate total GST for the entire cart
|
||||
const totalGST = cartItem.reduce((acc, item) => {
|
||||
// console.log(item)
|
||||
|
@ -47,7 +47,7 @@ const ReviewOrder = ({
|
||||
}
|
||||
try {
|
||||
const res = await Axios.post(
|
||||
'/api/order-place',
|
||||
'/api/rd-place-order',
|
||||
{
|
||||
billTo,
|
||||
shipTo,
|
||||
@ -65,9 +65,9 @@ const ReviewOrder = ({
|
||||
},
|
||||
},
|
||||
)
|
||||
console.log(res)
|
||||
console.log(' res of place order ', res)
|
||||
if (res.status === 201) {
|
||||
setOrderId(res?.data?.placedOrder?.uniqueId)
|
||||
setOrderId(res?.data?.order?.uniqueId)
|
||||
|
||||
console.log(res)
|
||||
Swal.fire('Success!', 'Your order has been placed successfully.', 'success')
|
||||
|
@ -32,7 +32,7 @@ const ShopCard = ({ item }) => {
|
||||
color="primary"
|
||||
fullWidth
|
||||
disabled={isProductInCart}
|
||||
// onClick={handleAddToCart}
|
||||
onClick={handleAddToCart}
|
||||
sx={{ marginTop: '10px' }}
|
||||
>
|
||||
{isProductInCart ? 'Already in Cart' : 'Add to Cart'}
|
||||
|
Loading…
Reference in New Issue
Block a user