updated addrees

This commit is contained in:
ROSHAN GARG 2024-09-09 09:51:09 +05:30
parent 237861d6a8
commit 9da2c6b538

View File

@ -1123,55 +1123,52 @@ const ViewOrders = () => {
`Order got cancelled due to${cancellationReason}`,
"success"
);
navigate(`/orders/${orderStatus}/${id}`);
navigate(`/orders/${orderStatus}`);
}
} else if (orderStatus === "dispatched") {
const cancellationRes = await axios.patch(
`/api/change/status/${id}`,
{
status: orderStatus,
courierName,
TrackingID: courierId,
},
{
headers: {
"Access-Control-Allow-Origin": "*",
Authorization: `Bearer ${token}`,
},
}
// else if (orderStatus === "dispatched") {
// const cancellationRes = await axios.patch(
// `/api/change/status/${id}`,
// {
// status: orderStatus,
// courierName,
// TrackingID: courierId,
// },
// {
// headers: {
// "Access-Control-Allow-Origin": "*",
// Authorization: `Bearer ${token}`,
// },
// }
// );
// if (cancellationRes.status === 200) {
// Swal.fire("Order Status updated", `Order Dispatched`, "success");
);
if (cancellationRes.status === 200) {
Swal.fire("Order Status updated", `Order Dispatched`, "success");
// navigate(`/orders/${orderStatus}/${id}`);
// }
// }
// else if (orderStatus === "delivered") {
// if (!deliveryDate) {
// Swal.fire("Please enter the Delivery Date");
// setOpenDeliveredDialog(false);
// return;
// }
// const cancellationRes = await axios.patch(
// `/api/change/status/${id}`,
// {
// status: orderStatus,
// DDate: deliveryDate,
// },
// {
// headers: {
// "Access-Control-Allow-Origin": "*",
// Authorization: `Bearer ${token}`,
// },
// }
// );
// if (cancellationRes.status === 200) {
// Swal.fire("Order Status updated", `Order in processing`, "success");
// navigate(`/orders/${orderStatus}/${id}`);
// }
// }
else if (orderStatus === "processing") {
navigate(`/orders/${orderStatus}`);
}
} else if (orderStatus === "delivered") {
if (!deliveryDate) {
Swal.fire("Please enter the Delivery Date");
setOpenDeliveredDialog(false);
return;
}
const cancellationRes = await axios.patch(
`/api/change/status/${id}`,
{
status: orderStatus,
DDate: deliveryDate,
},
{
headers: {
"Access-Control-Allow-Origin": "*",
Authorization: `Bearer ${token}`,
},
}
);
if (cancellationRes.status === 200) {
Swal.fire("Order Status updated", `Order in processing`, "success");
navigate(`/orders/${orderStatus}`);
}
} else if (orderStatus === "processing") {
const cancellationRes = await axios.patch(
`/api/change/status/${id}`,
{
@ -1186,7 +1183,7 @@ const ViewOrders = () => {
);
if (cancellationRes.status === 200) {
Swal.fire("Order Status updated", `Order in processing`, "success");
navigate(`/orders/${orderStatus}/${id}`);
navigate(`/orders/${orderStatus}`);
}
}
} catch (error) {
@ -1280,11 +1277,11 @@ const ViewOrders = () => {
Subtotal: {item.price * item.quantity}
</Typography>
<Typography color="textSecondary">
Tax ({item.GST}%):
GST ({item.GST}%):
{((item.GST * item.price) / 100) * item.quantity}
</Typography>
<Typography color="textSecondary">
Total with Tax: {" "}
<Typography color="">
Total with GST: {" "}
{((item.GST * item.price) / 100) * item.quantity +
item.price * item.quantity}
</Typography>
@ -1312,8 +1309,8 @@ const ViewOrders = () => {
</Typography>
<Typography>Total Subtotal: {order?.subtotal}</Typography>
<Typography>Total Tax: {order?.gstTotal}</Typography>
<Typography variant="h6" sx={{ marginTop: 2 }}>
<Typography>Total GST: {order?.gstTotal}</Typography>
<Typography variant="h5" sx={{ marginTop: 2 }}>
Grand Total: {order?.grandTotal}
</Typography>
</Box>