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