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