diff --git a/src/index.js b/src/index.js index 3e4516a..755519b 100644 --- a/src/index.js +++ b/src/index.js @@ -14,8 +14,8 @@ import { cibGmail } from "@coreui/icons"; import { createRoot } from "react-dom/client"; const setupAxios = () => { - // axios.defaults.baseURL = "http://localhost:5000"; - axios.defaults.baseURL = "https://api.smellika.com"; + axios.defaults.baseURL = "http://localhost:5000"; + // axios.defaults.baseURL = "https://api.smellika.com"; axios.defaults.headers = { "Cache-Control": "no-cache,no-store", diff --git a/src/routes.js b/src/routes.js index c8f5c9c..a050282 100644 --- a/src/routes.js +++ b/src/routes.js @@ -91,7 +91,6 @@ import EditTermsConditions from "./views/Content/editTermsConditions"; import EditShippingPolicy from "./views/Content/editShippingPolicy"; import EditRefundpolicy from "./views/Content/editRefundPolicy"; -import UserTable from "./views/customerDetails/userTable"; // import EditUserAddress from "./views/customerDetails/editUserAddress"; // import AddUserAddress from "./views/customerDetails/addUserAddress"; import viewDetails from "./views/customerDetails/viewDetails"; @@ -121,6 +120,8 @@ import CreateBlog from "./views/Blog/CreateBlog"; import users from "./views/Users/users"; import UpdateBlog from "./views/Blog/EditBlog"; import ViewBlog from "./views/Blog/ViewBlog"; +import CustomerTable from "./views/customerDetails/customerTable"; +import SingleUserAllDetails from "./views/customerDetails/singleUserAllDetails"; const routes = [ { path: "/", exact: true, name: "Home" }, { @@ -163,7 +164,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", 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 */} - + + */} +
+
+
+
+ Single Customer All Details +
+
+

+
+ +
+ + + +
+
+
+
+
+
• Customer Profile
+
+ + Customer Name: {user?.name} + + + Customer ID: {user?._id} + + + Date Registered : + + {" "} + {new Date(user?.createdAt).toLocaleString("en-IN", { + weekday: "short", + month: "short", + day: "numeric", + year: "numeric", + hour: "numeric", + minute: "numeric", + hour12: true, + })} + + + + Last Purchase: + + {userOrder?.length > 0 + ? new Date(userOrder[0]?.createdAt).toLocaleString("en-IN", { + weekday: "short", + month: "short", + day: "numeric", + year: "numeric", + hour: "numeric", + minute: "numeric", + hour12: true, + }) + : userOrder + ? "No Purchase" + : "Loading"} + + +
+
+
+ • Addresses{" "} +
+
+ • Total Addresses : {userAllAddress?.length}{" "} +
+ {userAllAddress?.length > 0 && ( +
+ + + + + + {/* */} + + + + {userAllAddress?.length === 0 && ( + + + + )} + {userAllAddress?.map((address, i) => { + return ( + + + + + ); + })} + +
SL No.Address Profile Image
+
No Data Available
+
{i + 1} + + {address?.first_Name} {address?.last_name}, + {address?.phone_Number},{address?.street}, + {address?.city},{address?.state},{address?.country}, + {address?.postalCode} + +
+
+ )} +
+
+
+ • Orders{" "} +
+
+ • Total Orders : {userOrder?.length}{" "} +
+
+ • Total Spent : ₹ {totalSpent}{" "} +
+ {userOrder?.length > 0 && ( +
+ + + + + + + + + {/* */} + + + + {userAllAddress?.length === 0 && ( + + + + )} + {userOrder?.map((order, i) => { + return ( + + + + + + + + ); + })} + +
SL No.Order Date Order Id Items Order Amount Profile Image
+
No Data Available
+
{i + 1} + {" "} + {new Date(order?.createdAt).toLocaleString("en-IN", { + weekday: "short", + month: "short", + day: "numeric", + year: "numeric", + hour: "numeric", + minute: "numeric", + hour12: true, + })} + {order?.orderID} + {order?.orderItems?.map((item, i) => ( +
+

{item?.name}

+
+ {item?.image?.map((img, i) => ( + img not available + ))} +
+
+ ))} +
₹ {order?.total_amount}
+
+ )} +
+
+ + ); +}; + +export default SingleUserAllDetails;