diff --git a/src/views/orders/ViewOrders.js b/src/views/orders/ViewOrders.js
index bb19801..72784f4 100644
--- a/src/views/orders/ViewOrders.js
+++ b/src/views/orders/ViewOrders.js
@@ -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}`,
- // },
- // }
- // );
- // if (cancellationRes.status === 200) {
- // Swal.fire("Order Status updated", `Order Dispatched`, "success");
+ } 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");
- // 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}
- Tax ({item.GST}%): ₹
+ GST ({item.GST}%): ₹
{((item.GST * item.price) / 100) * item.quantity}
-
- Total with Tax: ₹{" "}
+
+ Total with GST: ₹{" "}
{((item.GST * item.price) / 100) * item.quantity +
item.price * item.quantity}
@@ -1312,8 +1309,8 @@ const ViewOrders = () => {
Total Subtotal: ₹{order?.subtotal}
- Total Tax: ₹{order?.gstTotal}
-
+ Total GST: ₹{order?.gstTotal}
+
Grand Total: ₹{order?.grandTotal}