diff --git a/src/_nav.js b/src/_nav.js
index f5a8186..2e8ec6a 100644
--- a/src/_nav.js
+++ b/src/_nav.js
@@ -46,6 +46,49 @@ const _nav = [
// icon: ,
// to: "/design",
// },
+ {
+ component: CNavGroup,
+ name: "Charts",
+ icon: ,
+ items: [
+ {
+ component: CNavItem,
+ name: "new user day wise",
+ icon: ,
+ to: "/new-user-day-wise",
+ },
+ {
+ component: CNavItem,
+ name: "Revenue By Product",
+ icon: ,
+ to: "/revenue-by-product",
+ },
+ {
+ component: CNavItem,
+ name: "Revenue By State",
+ icon: ,
+ to: "/revenue-by-state",
+ },
+ {
+ component: CNavItem,
+ name: "Revenue By City",
+ icon: ,
+ to: "/revenue-by-city",
+ },
+ {
+ component: CNavItem,
+ name: "Orders (Day Wise)",
+ icon: ,
+ to: "/orders-day-wise",
+ },
+ {
+ component: CNavItem,
+ name: "Revenue (Day Wise)",
+ icon: ,
+ to: "/revenue-day-wise",
+ },
+ ],
+ },
{
component: CNavGroup,
diff --git a/src/index.js b/src/index.js
index 3e4516a..466639c 100644
--- a/src/index.js
+++ b/src/index.js
@@ -14,7 +14,7 @@ import { cibGmail } from "@coreui/icons";
import { createRoot } from "react-dom/client";
const setupAxios = () => {
- // axios.defaults.baseURL = "http://localhost:5000";
+ //axios.defaults.baseURL = "http://localhost:5000";
axios.defaults.baseURL = "https://api.smellika.com";
axios.defaults.headers = {
diff --git a/src/routes.js b/src/routes.js
index b097012..b972177 100644
--- a/src/routes.js
+++ b/src/routes.js
@@ -92,7 +92,6 @@ import EditShippingPolicy from "./views/Content/editShippingPolicy";
import EditRefundpolicy from "./views/Content/editRefundPolicy";
import EditAboutUs from "./views/Content/editAboutUs";
-import UserTable from "./views/customerDetails/userTable";
// import EditUserAddress from "./views/customerDetails/editUserAddress";
// import AddUserAddress from "./views/customerDetails/addUserAddress";
import viewDetails from "./views/customerDetails/viewDetails";
@@ -127,6 +126,16 @@ import EditPanel1 from "./views/Home/editPanel1";
import EditPanel2 from "./views/Home/editPanel2";
import EditPanel3 from "./views/Home/editPanel3";
import Editpanel4 from "./views/Home/editPanel4";
+import CustomerTable from "./views/customerDetails/customerTable";
+import SingleUserAllDetails from "./views/customerDetails/singleUserAllDetails";
+import Charts from "./views/Charts/RevenueCharts";
+import UserCharts from "./views/Charts/UserChart";
+import ProductrevenueCharts from "./views/Charts/ProductRevenue";
+import StateRevenueCharts from "./views/Charts/Staterevenue";
+import CityRevenueCharts from "./views/Charts/CityRevenue";
+import { element } from "prop-types";
+import OrderdayChart from "./views/Charts/OrderDaywise";
+import RevenueCharts from "./views/Charts/RevenueCharts";
const routes = [
{ path: "/", exact: true, name: "Home" },
{
@@ -169,7 +178,12 @@ const routes = [
{
path: "/customers-details",
name: "User Table",
- element: UserTable,
+ element: CustomerTable,
+ },
+ {
+ path: "/customers-details/:_id",
+ name: "User Table",
+ element: SingleUserAllDetails,
},
// {
// path: "/users-address/add",
@@ -548,6 +562,37 @@ const routes = [
name: "Blogs",
element: ViewBlog,
},
+ //Charts
+ {
+ path: "/new-user-day-wise",
+ name: "new user day wise",
+ element: UserCharts,
+ },
+ {
+ path: "/revenue-by-product",
+ name: "Revenue By Product",
+ element: ProductrevenueCharts,
+ },
+ {
+ path: "/revenue-by-state",
+ name: "Revenue By State",
+ element: StateRevenueCharts,
+ },
+ {
+ path: "/revenue-by-city",
+ name: "Revenue By City",
+ element: CityRevenueCharts,
+ },
+ {
+ path: "/orders-day-wise",
+ name: "Orders (Day Wise)",
+ element: OrderdayChart,
+ },
+ {
+ path: "/revenue-day-wise",
+ name: "Revenue (Day Wise)",
+ element: RevenueCharts,
+ },
];
export default routes;
diff --git a/src/views/Charts/CityRevenue.js b/src/views/Charts/CityRevenue.js
new file mode 100644
index 0000000..6cf4db2
--- /dev/null
+++ b/src/views/Charts/CityRevenue.js
@@ -0,0 +1,27 @@
+import { isAutheticated } from "../../auth.js";
+
+const CityRevenueCharts = () => {
+ const token = isAutheticated();
+
+ return (
+
+ {token ? (
+
+ ) : (
+
No charts available
+ )}
+
+ );
+};
+
+export default CityRevenueCharts;
\ No newline at end of file
diff --git a/src/views/Charts/OrderDaywise.js b/src/views/Charts/OrderDaywise.js
new file mode 100644
index 0000000..08f4373
--- /dev/null
+++ b/src/views/Charts/OrderDaywise.js
@@ -0,0 +1,27 @@
+import { isAutheticated } from "../../auth.js";
+
+const OrderdayChart = () => {
+ const token = isAutheticated();
+
+ return (
+
+ {token ? (
+
+ ) : (
+
No charts available
+ )}
+
+ );
+};
+
+export default OrderdayChart;
diff --git a/src/views/Charts/ProductRevenue.js b/src/views/Charts/ProductRevenue.js
new file mode 100644
index 0000000..d6bb0c5
--- /dev/null
+++ b/src/views/Charts/ProductRevenue.js
@@ -0,0 +1,27 @@
+import { isAutheticated } from "../../auth.js";
+
+const ProductrevenueCharts = () => {
+ const token = isAutheticated();
+
+ return (
+
+ {token ? (
+
+ ) : (
+
No charts available
+ )}
+
+ );
+};
+
+export default ProductrevenueCharts;
diff --git a/src/views/Charts/RevenueCharts.js b/src/views/Charts/RevenueCharts.js
new file mode 100644
index 0000000..40a9cf6
--- /dev/null
+++ b/src/views/Charts/RevenueCharts.js
@@ -0,0 +1,27 @@
+import { isAutheticated } from "../../auth.js";
+
+const RevenueCharts = () => {
+ const token = isAutheticated();
+
+ return (
+
+ {token ? (
+
+ ) : (
+
No charts available
+ )}
+
+ );
+};
+
+export default RevenueCharts;
diff --git a/src/views/Charts/Staterevenue.js b/src/views/Charts/Staterevenue.js
new file mode 100644
index 0000000..c584d5b
--- /dev/null
+++ b/src/views/Charts/Staterevenue.js
@@ -0,0 +1,27 @@
+import { isAutheticated } from "../../auth.js";
+
+const StateRevenueCharts = () => {
+ const token = isAutheticated();
+
+ return (
+
+ {token ? (
+
+ ) : (
+
No charts available
+ )}
+
+ );
+};
+
+export default StateRevenueCharts;
\ No newline at end of file
diff --git a/src/views/Charts/UserChart.js b/src/views/Charts/UserChart.js
new file mode 100644
index 0000000..e99dcfc
--- /dev/null
+++ b/src/views/Charts/UserChart.js
@@ -0,0 +1,27 @@
+import { isAutheticated } from "../../auth.js";
+
+const UserCharts = () => {
+ const token = isAutheticated();
+
+ return (
+
+ {token ? (
+
+ ) : (
+
No charts available
+ )}
+
+ );
+};
+
+export default UserCharts;
diff --git a/src/views/Products/AddProduct.js b/src/views/Products/AddProduct.js
index 96270c5..aac06b3 100644
--- a/src/views/Products/AddProduct.js
+++ b/src/views/Products/AddProduct.js
@@ -33,6 +33,7 @@ const AddProduct = () => {
const [category, setCategoryName] = useState("");
const [error, setError] = useState("");
const [selectedTax, setselectedTax] = useState();
+ const [product_Status, setproduct_Status] = useState("");
const [totalAmt, setTotalAmt] = useState(0);
const [gst_amount, setGst_amount] = useState(0);
@@ -127,6 +128,7 @@ const AddProduct = () => {
category === "" ||
selectedTax === "" ||
gst_amount === "" ||
+ product_Status === "" ||
price === ""
) {
swal({
@@ -147,6 +149,7 @@ const AddProduct = () => {
formData.append("category", category);
formData.append("total_amount", totalAmt);
formData.append("gst_amount", gst_amount);
+ formData.append("product_Status", product_Status);
formData.append("gst", selectedTax);
@@ -525,6 +528,23 @@ const AddProduct = () => {
// onChange={(e) => setPrice(e.target.value)}
/>
+
+
+ {" "}
+
+
diff --git a/src/views/Products/EditProduct.js b/src/views/Products/EditProduct.js
index f40f626..a407fb7 100644
--- a/src/views/Products/EditProduct.js
+++ b/src/views/Products/EditProduct.js
@@ -35,6 +35,8 @@ const EditProduct = () => {
const [error, setError] = useState("");
const [initTax, setInitTax] = useState();
const [selectedTax, setselectedTax] = useState();
+ const [product_Status, setproduct_Status] = useState("");
+
const [totalAmt, setTotalAmt] = useState(0);
const [gst_amount, setGst_amount] = useState(0);
const [newUpdatedImages, setNewUpdatedImages] = useState([]);
@@ -49,7 +51,6 @@ const EditProduct = () => {
},
})
.then((res) => {
- // console.log(res?.data?.product?.gst?._id);
setName(res?.data?.product.name);
setDescription(res.data.product.description);
setProductImages(res.data.product.image);
@@ -59,6 +60,7 @@ const EditProduct = () => {
setInitTax(res.data.product?.gst?._id);
setTotalAmt(res.data.product?.total_amount);
setGst_amount(res.data.product?.gst_amount);
+ setproduct_Status(res.data.product?.product_Status);
})
.catch((err) => {
swal({
@@ -153,6 +155,7 @@ const EditProduct = () => {
selectedTax === "" ||
gst_amount === "" ||
price === "" ||
+ product_Status === "" ||
totalAmt === "" ||
gst_amount === "" ||
(productImages.length == 0 && newUpdatedImages.length == 0)
@@ -175,6 +178,7 @@ const EditProduct = () => {
formData.append("category", category);
formData.append("total_amount", totalAmt);
formData.append("gst_amount", gst_amount);
+ formData.append("product_Status", product_Status);
formData.append("gst", initTax === "" ? selectedTax : initTax);
@@ -583,6 +587,22 @@ const EditProduct = () => {
// onChange={(e) => setPrice(e.target.value)}
/>
+
+ {" "}
+
+
diff --git a/src/views/Products/ViewProduct.js b/src/views/Products/ViewProduct.js
index caabefe..de5ad60 100644
--- a/src/views/Products/ViewProduct.js
+++ b/src/views/Products/ViewProduct.js
@@ -135,6 +135,10 @@ function ViewProduct() {
{/* Product Time | {product?.time} |
Location | {product?.location} |
*/}
+
+ Product Status |
+ {product?.product_Status} |
+
Created On |
diff --git a/src/views/customerDetails/userTable.js b/src/views/customerDetails/customerTable.js
similarity index 99%
rename from src/views/customerDetails/userTable.js
rename to src/views/customerDetails/customerTable.js
index 9d44431..448770e 100644
--- a/src/views/customerDetails/userTable.js
+++ b/src/views/customerDetails/customerTable.js
@@ -18,7 +18,7 @@ import SearchIcon from "@mui/icons-material/Search";
import Fuse from "fuse.js";
import { Typography } from "@material-ui/core";
import OrderDetails from "./orderDetails";
-const UserTable = () => {
+const CustomerTable = () => {
const token = isAutheticated();
const [query, setQuery] = useState("");
const navigate = useNavigate();
@@ -313,7 +313,7 @@ const UserTable = () => {
Delete
*/}
-
+
|
-
+
{order?.orderStatus}
|
diff --git a/src/views/orders/DispatchedOrders.js b/src/views/orders/DispatchedOrders.js
index be8f26d..c158e73 100644
--- a/src/views/orders/DispatchedOrders.js
+++ b/src/views/orders/DispatchedOrders.js
@@ -158,7 +158,7 @@ function DispatchedOrders() {
)}
-
+
{order?.orderStatus}
|
diff --git a/src/views/orders/NewOrders.js b/src/views/orders/NewOrders.js
index 11a4ae1..43c2621 100644
--- a/src/views/orders/NewOrders.js
+++ b/src/views/orders/NewOrders.js
@@ -210,7 +210,7 @@ function NewOrders() {
)}
-
+
{order?.orderStatus}
|
diff --git a/src/views/orders/ProcessingOrders.js b/src/views/orders/ProcessingOrders.js
index 19d9aeb..4c10d21 100644
--- a/src/views/orders/ProcessingOrders.js
+++ b/src/views/orders/ProcessingOrders.js
@@ -159,7 +159,7 @@ function ProcessingOrders() {
)}
-
+
{order?.orderStatus}
|
diff --git a/src/views/orders/ViewOrders.js b/src/views/orders/ViewOrders.js
index d7cbf6c..81a6f8a 100644
--- a/src/views/orders/ViewOrders.js
+++ b/src/views/orders/ViewOrders.js
@@ -171,6 +171,77 @@ function ViewOrders() {
// swal.close(); // Close the popup if canceled
// }
});
+ } else if (orderStatus === "cancelled") {
+ swal({
+ title: `Are you sure for ${orderStatus}?`,
+ icon: "warning",
+ content: {
+ element: "div",
+ attributes: {
+ innerHTML:
+ 'Reson for cancellation.?
',
+ },
+ },
+ buttons: {
+ Yes: { text: "Submit", value: true },
+
+ Cancel: { text: "Cancel", value: "cancel" },
+ },
+ }).then((result) => {
+ if (result === true) {
+ // You have the input values, you can use them in your API call
+ const ReasonforCancellation = document
+ .getElementById("input1")
+ .value.trim();
+
+ // Check if values are entered
+ if (ReasonforCancellation === "") {
+ swal({
+ title: "Warning",
+ text: "Please enter Reason for Cancellation",
+ icon: "warning",
+ button: "Ok",
+ dangerMode: true,
+ });
+ } else {
+ axios
+ .patch(
+ `/api/order/change/status/${id}`,
+ {
+ status: orderStatus,
+ ReasonforCancellation,
+ },
+ {
+ headers: {
+ "Access-Control-Allow-Origin": "*",
+ Authorization: `Bearer ${token}`,
+ },
+ }
+ )
+ .then((res) => {
+ console.log("status");
+ toast.success(
+ `Order status change ${status} to ${orderStatus}`
+ );
+ // setSuccess((prev) => !prev);
+ })
+ .catch((err) => {
+ swal({
+ title: "Warning",
+ text: err.response.data.message
+ ? err.response.data.message
+ : "Something went wrong!",
+ icon: "error",
+ button: "Retry",
+ dangerMode: true,
+ });
+ });
+ }
+ }
+ // else {
+ // swal.close(); // Close the popup if canceled
+ // }
+ });
} else if (orderStatus === "delivered") {
swal({
title: `Are you sure for ${orderStatus}?`,
@@ -451,9 +522,9 @@ function ViewOrders() {
- Total Price: ₹
+ Subtotal: ₹
{productDetails?.quantity *
- productDetails?.price}
+ productDetails?.total_Amount}
@@ -461,6 +532,10 @@ function ViewOrders() {
Price: ₹
{productDetails?.price}
+
+ GST: ₹
+ {productDetails?.gst_amount}
+
@@ -629,9 +704,22 @@ function ViewOrders() {
-
- Order Status: {orderDetails?.orderStatus}
-
+ {orderDetails?.orderStatus !== "cancelled" ? (
+
+ Order Status: {orderDetails?.orderStatus}
+
+ ) : (
+ <>
+
+ Order Status: {orderDetails?.orderStatus}
+
+
+ {" "}
+ Order Cancelled Reason:{" "}
+ {orderDetails?.order_Cancelled_Reason}
+
+ >
+ )}
{/* order status change */}{" "}
{" "}
@@ -712,7 +800,6 @@ function ViewOrders() {
handleGetSingleFrenchisee(e)} >Add
*/}
-
{orderDetails?.shipingInfo !== null && (
@@ -775,7 +862,39 @@ function ViewOrders() {
)}
-
+
+
+
+
+
+
+
+
-
-
+