forgot pass sign image footer api content etc
This commit is contained in:
parent
ad6545d897
commit
8d79ce8cb0
@ -23,7 +23,7 @@
|
||||
name="keyword"
|
||||
content="Bootstrap,Admin,Template,Open,Source,CSS,SCSS,HTML,RWD,Dashboard,React"
|
||||
/>
|
||||
<title>Admin Get Sygnal</title>
|
||||
<title>Smellika Admin</title>
|
||||
<!--
|
||||
manifest.json provides metadata used when your web app is added to the
|
||||
homescreen on Android. See https://developers.google.com/web/fundamentals/engage-and-retain/web-app-manifest/
|
||||
|
@ -8,6 +8,7 @@ import ForgotPassword from "./views/pages/register/ForgotPassword";
|
||||
import NewRegister from "./views/pages/register/NewRegister";
|
||||
// import ProtectedRoute from './components/ProtectedRoute';
|
||||
import { isAutheticated } from "./auth";
|
||||
import InternetConnectionPopUp from "./views/InternetConnectionPopUp";
|
||||
|
||||
const loading = (
|
||||
<div className="pt-3 text-center">
|
||||
@ -100,6 +101,7 @@ const App = () => {
|
||||
</Routes>
|
||||
<Toaster />
|
||||
</Suspense>
|
||||
<InternetConnectionPopUp />
|
||||
</HashRouter>
|
||||
);
|
||||
};
|
||||
|
27
src/_nav.js
27
src/_nav.js
@ -18,11 +18,12 @@ import {
|
||||
cilNotes,
|
||||
cilSpeedometer,
|
||||
cilSwapHorizontal,
|
||||
cilTablet,
|
||||
cilTennisBall,
|
||||
cilText,
|
||||
cilUser,
|
||||
} from "@coreui/icons";
|
||||
import { CNavGroup, CNavItem, CNavTitle } from "@coreui/react";
|
||||
import { CNavGroup, CNavItem, CNavTitle, CTabContent } from "@coreui/react";
|
||||
|
||||
const _nav = [
|
||||
{
|
||||
@ -37,12 +38,18 @@ const _nav = [
|
||||
icon: <CIcon icon={cilTennisBall} customClassName="nav-icon" />,
|
||||
to: "/users-address",
|
||||
},
|
||||
// {
|
||||
// component: CNavItem,
|
||||
// name: "Design",
|
||||
// icon: <CIcon icon={cibMaterialDesign} customClassName="nav-icon" />,
|
||||
// to: "/design",
|
||||
// },
|
||||
|
||||
{
|
||||
component: CNavItem,
|
||||
name: "Design",
|
||||
icon: <CIcon icon={cibMaterialDesign} customClassName="nav-icon" />,
|
||||
to: "/design",
|
||||
},
|
||||
component: CNavGroup,
|
||||
name: "Product Management",
|
||||
icon: <CIcon icon={cilClipboard} customClassName="nav-icon" />,
|
||||
items: [
|
||||
{
|
||||
component: CNavItem,
|
||||
name: "Categories",
|
||||
@ -55,6 +62,14 @@ const _nav = [
|
||||
icon: <CIcon icon={cilClipboard} customClassName="nav-icon" />,
|
||||
to: "/products",
|
||||
},
|
||||
{
|
||||
component: CNavItem,
|
||||
name: "Gst Rate",
|
||||
icon: <CIcon icon={cilTablet} customClassName="nav-icon" />,
|
||||
to: "/tax",
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
component: CNavGroup,
|
||||
name: "Orders",
|
||||
|
@ -78,7 +78,7 @@ const AppSidebar = () => {
|
||||
<img src={AdminlogoUrl} alt="" width="100%" />
|
||||
</Link>
|
||||
) : { AppName } ? (
|
||||
<h3>Admin Get Sygnal </h3>
|
||||
<h3>Smellika Admin </h3>
|
||||
) : (
|
||||
""
|
||||
)}
|
||||
|
@ -13,10 +13,7 @@ import { cibGmail } from "@coreui/icons";
|
||||
import { createRoot } from "react-dom/client";
|
||||
|
||||
const setupAxios = () => {
|
||||
axios.defaults.baseURL = "http://localhost:8000";
|
||||
|
||||
// axios.defaults.baseURL = "https://printsigns.onrender.com/"; //->latest deployed
|
||||
// axios.defaults.baseURL = "https://api.thesolarsign.com/"; //->latest deployed
|
||||
axios.defaults.baseURL = "http://localhost:5000";
|
||||
|
||||
axios.defaults.headers = {
|
||||
"Cache-Control": "no-cache,no-store",
|
||||
|
@ -86,6 +86,7 @@ import Content from "./views/Content/content";
|
||||
import EditPrivacyPolicy from "./views/Content/editPrivacyPolicy";
|
||||
import EditTermsConditions from "./views/Content/editTermsConditions";
|
||||
import EditShippingPolicy from "./views/Content/editShippingPolicy";
|
||||
import EditRefundpolicy from "./views/Content/editRefundPolicy";
|
||||
|
||||
import UserTable from "./views/UserAddress/userTable";
|
||||
import EditUserAddress from "./views/UserAddress/editUserAddress";
|
||||
@ -247,6 +248,11 @@ const routes = [
|
||||
name: "Content",
|
||||
element: EditShippingPolicy,
|
||||
},
|
||||
{
|
||||
path: "/content/refund-policy",
|
||||
name: "Content",
|
||||
element: EditRefundpolicy,
|
||||
},
|
||||
|
||||
// { path: '/complaint/view/:id', name: 'view Complain', element: ViewComplaint },
|
||||
//Complaints
|
||||
|
@ -311,7 +311,7 @@ const Banners = () => {
|
||||
</div>
|
||||
|
||||
<div className="page-title-right">
|
||||
{/* <Button
|
||||
<Button
|
||||
variant="contained"
|
||||
color="primary"
|
||||
style={{
|
||||
@ -325,7 +325,7 @@ const Banners = () => {
|
||||
// }}
|
||||
>
|
||||
Add New Banner
|
||||
</Button> */}
|
||||
</Button>
|
||||
<Modal
|
||||
open={open}
|
||||
onClose={handleClose}
|
||||
|
@ -29,6 +29,11 @@ export default function Content() {
|
||||
action: "Edit",
|
||||
path: "/content/shipping-policy",
|
||||
},
|
||||
{
|
||||
name: "Refund policy",
|
||||
action: "Edit",
|
||||
path: "/content/refund-policy",
|
||||
},
|
||||
];
|
||||
|
||||
return (
|
||||
|
165
src/views/Content/editRefundPolicy.js
Normal file
165
src/views/Content/editRefundPolicy.js
Normal file
@ -0,0 +1,165 @@
|
||||
import { Typography } from "@material-ui/core";
|
||||
import { Box, Button, TextField } from "@mui/material";
|
||||
import React, { useEffect, useState } from "react";
|
||||
import ReactrichTextEditor from "./reactrichTextEditor";
|
||||
import ReactQuill from "react-quill";
|
||||
import "react-quill/dist/quill.snow.css";
|
||||
import axios from "axios";
|
||||
import { isAutheticated } from "src/auth";
|
||||
import { useNavigate, useNavigation } from "react-router-dom";
|
||||
|
||||
const TOOLBAR_OPTIONS = [
|
||||
[{ header: [1, 2, 3, 4, 5, 6, false] }],
|
||||
[{ font: [] }],
|
||||
[{ list: "ordered" }, { list: "bullet" }],
|
||||
["bold", "italic", "underline"],
|
||||
[{ color: [] }, { background: [] }],
|
||||
[{ align: [] }],
|
||||
];
|
||||
export default function editRefundPolicy() {
|
||||
const [title, setTitle] = useState("Refund policy");
|
||||
const [content, setContent] = useState("");
|
||||
const [added, setAdded] = useState(false);
|
||||
const [olderContent, setOlderContent] = useState("");
|
||||
const navigation = useNavigate();
|
||||
|
||||
const token = isAutheticated();
|
||||
const handleContentChange = (content, delta, source, editor) => {
|
||||
setContent(editor.getHTML());
|
||||
};
|
||||
const getTermsAndConditions = async () => {
|
||||
const response = await axios.get("/api/content/refund-policy", {
|
||||
headers: {
|
||||
Authorization: `Bearer ${token}`,
|
||||
},
|
||||
});
|
||||
if (response.status === 200) {
|
||||
// console.log(response);
|
||||
setContent(response?.data?.Refundpolicys[0]?.Refundpolicy);
|
||||
setOlderContent(response?.data?.Refundpolicys[0]?.Refundpolicy);
|
||||
}
|
||||
};
|
||||
|
||||
const addTermsandConditions = async () => {
|
||||
const response = await axios.patch(
|
||||
"/api/content/refund-policy",
|
||||
{ content },
|
||||
{
|
||||
headers: {
|
||||
Authorization: `Bearer ${token}`,
|
||||
},
|
||||
}
|
||||
);
|
||||
if (response.status == 201) {
|
||||
swal({
|
||||
title: "Congratulations!!",
|
||||
text: "Refund policy added successfully!",
|
||||
icon: "success",
|
||||
button: "OK",
|
||||
});
|
||||
}
|
||||
};
|
||||
const handleCancelClick = () => {
|
||||
setContent(olderContent);
|
||||
};
|
||||
const updateContent = async () => {
|
||||
const response = await axios.patch(
|
||||
"/api/content//refund-policy",
|
||||
{ content },
|
||||
{
|
||||
headers: {
|
||||
Authorization: `Bearer ${token}`,
|
||||
},
|
||||
}
|
||||
);
|
||||
if (response.status === 200) {
|
||||
swal({
|
||||
title: "Congratulations!!",
|
||||
text: "Refund policy updated successfully!",
|
||||
icon: "success",
|
||||
button: "OK",
|
||||
});
|
||||
} else {
|
||||
swal({
|
||||
title: "Sorry, please try again",
|
||||
text: "Something went wrong!",
|
||||
icon: "error",
|
||||
button: "Retry",
|
||||
dangerMode: true,
|
||||
});
|
||||
}
|
||||
};
|
||||
const handleSaveClick = async () => {
|
||||
if (olderContent === undefined) {
|
||||
await addTermsandConditions();
|
||||
setAdded(true);
|
||||
} else {
|
||||
await updateContent();
|
||||
setAdded(false);
|
||||
}
|
||||
|
||||
// Reload terms and conditions
|
||||
await getTermsAndConditions();
|
||||
};
|
||||
useEffect(() => {
|
||||
// addTermsandConditions();
|
||||
getTermsAndConditions();
|
||||
}, [added]);
|
||||
return (
|
||||
<div>
|
||||
<div style={{ display: "flex" }}>
|
||||
<Button
|
||||
variant="contained"
|
||||
color="primary"
|
||||
onClick={handleSaveClick}
|
||||
style={{
|
||||
fontWeight: "bold",
|
||||
marginBottom: "1rem",
|
||||
textTransform: "capitalize",
|
||||
marginRight: "5px",
|
||||
}}
|
||||
>
|
||||
Save
|
||||
</Button>
|
||||
<Button
|
||||
variant="contained"
|
||||
color="primary"
|
||||
onClick={handleCancelClick}
|
||||
style={{
|
||||
fontWeight: "bold",
|
||||
marginBottom: "1rem",
|
||||
textTransform: "capitalize",
|
||||
marginRight: "5px",
|
||||
}}
|
||||
>
|
||||
Cancel
|
||||
</Button>
|
||||
</div>
|
||||
|
||||
<Box style={{ background: "#FFFFFF", color: "black", padding: "1rem" }}>
|
||||
{/* <TextField
|
||||
type="text"
|
||||
value={title}
|
||||
onChange={(e) => setTitle(e.target.value)}
|
||||
variant="outlined"
|
||||
size="small"
|
||||
fullWidth
|
||||
/> */}
|
||||
<Typography
|
||||
style={{ margin: "0.5rem 0rem", fontWeight: "bold" }}
|
||||
variant="h6"
|
||||
>
|
||||
{" "}
|
||||
Refund policy:{" "}
|
||||
</Typography>
|
||||
<Typography style={{ margin: "0.5rem 0rem" }}>Body</Typography>
|
||||
<ReactQuill
|
||||
theme="snow"
|
||||
value={content}
|
||||
onChange={handleContentChange}
|
||||
modules={{ toolbar: TOOLBAR_OPTIONS }}
|
||||
/>
|
||||
</Box>
|
||||
</div>
|
||||
);
|
||||
}
|
@ -123,7 +123,7 @@ const Banners = () => {
|
||||
// return;
|
||||
// }
|
||||
|
||||
if ((!bannerImage && !olderImage)) {
|
||||
if (!bannerImage && !olderImage) {
|
||||
swal({
|
||||
title: "Warning",
|
||||
text: "Please fill all the required fields!",
|
||||
@ -216,17 +216,17 @@ const Banners = () => {
|
||||
};
|
||||
|
||||
const handleSaveBanner = async () => {
|
||||
const bannerExits = bannerNamesArray.includes(bannerName.toLowerCase());
|
||||
if (bannerExits) {
|
||||
swal({
|
||||
title: "Warning",
|
||||
text: "Banner Already exits.",
|
||||
icon: "error",
|
||||
button: "Retry",
|
||||
dangerMode: true,
|
||||
});
|
||||
return;
|
||||
}
|
||||
// const bannerExits = bannerNamesArray?.includes(bannerName.toLowerCase());
|
||||
// if (bannerExits) {
|
||||
// swal({
|
||||
// title: "Warning",
|
||||
// text: "Banner Already exits.",
|
||||
// icon: "error",
|
||||
// button: "Retry",
|
||||
// dangerMode: true,
|
||||
// });
|
||||
// return;
|
||||
// }
|
||||
if (!bannerImage) {
|
||||
swal({
|
||||
title: "Warning",
|
||||
@ -313,21 +313,6 @@ const Banners = () => {
|
||||
</div>
|
||||
|
||||
<div className="page-title-right">
|
||||
{/* <Button
|
||||
variant="contained"
|
||||
color="primary"
|
||||
style={{
|
||||
fontWeight: "bold",
|
||||
marginBottom: "1rem",
|
||||
textTransform: "capitalize",
|
||||
}}
|
||||
onClick={handleOpen}
|
||||
// onClick={() => {
|
||||
// navigate("/testimonial/new", { replace: true });
|
||||
// }}
|
||||
>
|
||||
Add New Banner
|
||||
</Button> */}
|
||||
<Modal
|
||||
open={open}
|
||||
onClose={handleClose}
|
||||
@ -335,47 +320,6 @@ const Banners = () => {
|
||||
aria-describedby="modal-modal-description"
|
||||
>
|
||||
<Box sx={style}>
|
||||
{/* <Box p={2} display={"flex"}>
|
||||
<Typography
|
||||
id="modal-modal-title"
|
||||
variant="body"
|
||||
component="h2"
|
||||
flex={1}
|
||||
>
|
||||
Banner Name
|
||||
</Typography>
|
||||
<IconButton onClick={() => handleClose()}>
|
||||
<CloseIcon />
|
||||
</IconButton>
|
||||
</Box> */}
|
||||
{/* <hr /> */}
|
||||
{/* <TextField
|
||||
placeholder="Banner name"
|
||||
value={bannerName}
|
||||
fullWidth
|
||||
inputProps={{
|
||||
maxLength: 25,
|
||||
}}
|
||||
style={{
|
||||
padding: "1rem",
|
||||
}}
|
||||
onChange={(e) =>
|
||||
setBannerName(
|
||||
e.target.value.charAt(0).toUpperCase() +
|
||||
e.target.value.slice(1)
|
||||
)
|
||||
}
|
||||
/> */}
|
||||
{/* {bannerName ? (
|
||||
<>
|
||||
<small className="charLeft mt-2 ml-3 fst-italic">
|
||||
{25 - bannerName.length} characters left
|
||||
</small>
|
||||
</>
|
||||
) : (
|
||||
<></>
|
||||
)} */}
|
||||
|
||||
<Box
|
||||
style={{
|
||||
padding: "1rem",
|
||||
@ -558,28 +502,7 @@ const Banners = () => {
|
||||
<div className="card">
|
||||
<div className="card-body">
|
||||
<div className="row ml-0 mr-0 mb-10">
|
||||
<div className="col-sm-12 col-md-12">
|
||||
{/* <div className="dataTables_length">
|
||||
<label className="w-100">
|
||||
Show
|
||||
<select
|
||||
style={{ width: "10%" }}
|
||||
onChange={(e) => setItemPerPage(e.target.value)}
|
||||
className="
|
||||
select-w
|
||||
custom-select custom-select-sm
|
||||
form-control form-control-sm
|
||||
"
|
||||
>
|
||||
<option value="10">10</option>
|
||||
<option value="25">25</option>
|
||||
<option value="50">50</option>
|
||||
<option value="100">100</option>
|
||||
</select>
|
||||
entries
|
||||
</label>
|
||||
</div> */}
|
||||
</div>
|
||||
<div className="col-sm-12 col-md-12"></div>
|
||||
</div>
|
||||
|
||||
<div className="table-responsive table-shoot mt-3">
|
||||
@ -594,7 +517,6 @@ const Banners = () => {
|
||||
<tr>
|
||||
<th> Image</th>
|
||||
|
||||
|
||||
<th>Action</th>
|
||||
</tr>
|
||||
</thead>
|
||||
@ -611,9 +533,6 @@ const Banners = () => {
|
||||
textTransform: "capitalize",
|
||||
}}
|
||||
onClick={handleOpen}
|
||||
// onClick={() => {
|
||||
// navigate("/testimonial/new", { replace: true });
|
||||
// }}
|
||||
>
|
||||
Add New Image
|
||||
</Button>
|
||||
@ -628,8 +547,7 @@ const Banners = () => {
|
||||
</tr>
|
||||
) : (
|
||||
banner &&
|
||||
banner
|
||||
.map((item, i) => (
|
||||
banner.map((item, i) => (
|
||||
<tr key={i}>
|
||||
<td>
|
||||
<img
|
||||
@ -653,31 +571,11 @@ const Banners = () => {
|
||||
type="button"
|
||||
className=" btn btn-primary btn-sm waves-effect waves-light btn-table mx-1 mt-1 "
|
||||
onClick={() =>
|
||||
handleEditClick(
|
||||
item._id,
|
||||
item.image
|
||||
)
|
||||
handleEditClick(item._id, item.image)
|
||||
}
|
||||
>
|
||||
Edit
|
||||
</button>
|
||||
{/* <button
|
||||
style={{
|
||||
color: "white",
|
||||
marginRight: "1rem",
|
||||
}}
|
||||
type="button"
|
||||
className="
|
||||
btn btn-sm btn-primary
|
||||
waves-effect waves-light
|
||||
btn-table
|
||||
mx-1
|
||||
mt-1
|
||||
"
|
||||
onClick={() => handleDelete(item._id)}
|
||||
>
|
||||
view
|
||||
</button> */}
|
||||
</td>
|
||||
</tr>
|
||||
))
|
||||
@ -685,17 +583,6 @@ const Banners = () => {
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
{/* <div style={{ display: "flex", justifyContent: "right" }}>
|
||||
<Pagination
|
||||
style={{ margin: "2rem" }}
|
||||
variant="outlined"
|
||||
size="large"
|
||||
count={getPageCount()}
|
||||
color="primary"
|
||||
onChange={(event, value) => setPage(value)}
|
||||
/>
|
||||
</div> */}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
42
src/views/InternetConnectionPopUp.js
Normal file
42
src/views/InternetConnectionPopUp.js
Normal file
@ -0,0 +1,42 @@
|
||||
import React, { useState, useEffect } from "react";
|
||||
import Swal from "sweetalert2";
|
||||
|
||||
const InternetConnectionPopUp = () => {
|
||||
const [isOnline, setIsOnline] = useState(window.navigator.onLine);
|
||||
|
||||
useEffect(() => {
|
||||
const handleOnlineStatusChange = () => {
|
||||
setIsOnline(window.navigator.onLine);
|
||||
|
||||
// If the internet connection is reestablished, reload the page
|
||||
if (window.navigator.onLine) {
|
||||
window.location.reload();
|
||||
}
|
||||
};
|
||||
|
||||
// Add event listeners to detect online/offline status changes
|
||||
window.addEventListener("online", handleOnlineStatusChange);
|
||||
window.addEventListener("offline", handleOnlineStatusChange);
|
||||
|
||||
// Cleanup: remove event listeners when the component is unmounted
|
||||
return () => {
|
||||
window.removeEventListener("online", handleOnlineStatusChange);
|
||||
window.removeEventListener("offline", handleOnlineStatusChange);
|
||||
};
|
||||
}, []);
|
||||
|
||||
return (
|
||||
<div>
|
||||
{!isOnline &&
|
||||
swal({
|
||||
title: "Warning",
|
||||
text: "Internet connection is lost. Please check your connection.",
|
||||
icon: "warning",
|
||||
button: "Retry",
|
||||
dangerMode: true,
|
||||
})}
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
||||
export default InternetConnectionPopUp;
|
@ -29,9 +29,12 @@ const AddProduct = () => {
|
||||
const [name, setName] = useState("");
|
||||
const [description, setDescription] = useState("");
|
||||
const [productImages, setProductImages] = useState([]);
|
||||
const [price, setPrice] = useState("");
|
||||
const [categoryName, setCategoryName] = useState("");
|
||||
const [price, setPrice] = useState(0);
|
||||
const [category, setCategoryName] = useState("");
|
||||
const [error, setError] = useState("");
|
||||
const [selectedTax, setselectedTax] = useState();
|
||||
const [totalAmt, setTotalAmt] = useState(0);
|
||||
const [gst_amount, setGst_amount] = useState(0);
|
||||
|
||||
const handleFileChange = (e) => {
|
||||
const files = e.target.files;
|
||||
@ -106,102 +109,25 @@ const AddProduct = () => {
|
||||
getAllTax();
|
||||
getCategories();
|
||||
}, [token]);
|
||||
const TaxRatechange = async (e) => {
|
||||
let m = JSON.parse(e.target.value);
|
||||
if (m?.tax) {
|
||||
let totalprice = Number(price) + Number((price * m?.tax) / 100);
|
||||
setGst_amount(Number((price * m?.tax) / 100)?.toFixed(2));
|
||||
setTotalAmt(totalprice?.toFixed(2));
|
||||
setselectedTax(m?._id);
|
||||
}
|
||||
};
|
||||
|
||||
// const handleChange = (e) => {
|
||||
// if (e.target.id === "image") {
|
||||
// if (
|
||||
// e.target.files[0]?.type === "image/jpeg" ||
|
||||
// e.target.files[0]?.type === "image/png" ||
|
||||
// e.target.files[0]?.type === "image/jpg"
|
||||
// ) {
|
||||
// if (imagesPreview.length > 3) {
|
||||
// swal({
|
||||
// title: "Warning",
|
||||
// text: "maximum Four image Upload ",
|
||||
// icon: "error",
|
||||
// button: "Close",
|
||||
// dangerMode: true,
|
||||
// });
|
||||
// return;
|
||||
// }
|
||||
// // only for file preview------------------------------------
|
||||
// const files = Array.from(e.target.files);
|
||||
// files.forEach((file) => {
|
||||
// const reader = new FileReader();
|
||||
|
||||
// reader.onload = () => {
|
||||
// if (reader.readyState === 2) {
|
||||
// setImagesPreview((old) => [...old, reader.result]);
|
||||
// }
|
||||
// };
|
||||
|
||||
// reader.readAsDataURL(file);
|
||||
// });
|
||||
// // -----------------------------------------------------------------------------
|
||||
|
||||
// setData((prev) => ({
|
||||
// ...prev,
|
||||
|
||||
// image: [...data.image, ...e.target.files],
|
||||
// }));
|
||||
// return;
|
||||
// } else {
|
||||
// swal({
|
||||
// title: "Warning",
|
||||
// text: "Upload jpg, jpeg, png only.",
|
||||
// icon: "error",
|
||||
// button: "Close",
|
||||
// dangerMode: true,
|
||||
// });
|
||||
// setData((prev) => ({
|
||||
// ...prev,
|
||||
// imageURL: "",
|
||||
// image: "",
|
||||
// }));
|
||||
// e.target.value = null;
|
||||
// return;
|
||||
// }
|
||||
// }
|
||||
// setData((prev) => ({ ...prev, [e.target.id]: e.target.value }));
|
||||
// };
|
||||
|
||||
// const TaxRatechange = async (e) => {
|
||||
// let taxDetails = {
|
||||
// name: e.target.value.slice(12, 16),
|
||||
// rate: Number(e.target.value.slice(4, 6)),
|
||||
|
||||
// taxId: e.target.value.slice(24),
|
||||
// };
|
||||
|
||||
// let trRate = taxDetails.rate / 100;
|
||||
// let PriceWithT = Number(data.price);
|
||||
// PriceWithT += +(PriceWithT * trRate).toFixed();
|
||||
|
||||
// //price_Level_2_With_Tax
|
||||
// let price_Level_2_With_Tax = Number(data.price_Level_2);
|
||||
// price_Level_2_With_Tax += +(price_Level_2_With_Tax * trRate).toFixed();
|
||||
// //
|
||||
// //price_Level_3_With_Tax
|
||||
// let price_Level_3_With_Tax = Number(data.price_Level_3);
|
||||
// price_Level_3_With_Tax += +(price_Level_3_With_Tax * trRate).toFixed();
|
||||
// setData((prev) => ({
|
||||
// ...prev,
|
||||
// price_With_Tax: PriceWithT,
|
||||
|
||||
// price_Level_2_With_Tax: price_Level_2_With_Tax,
|
||||
|
||||
// price_Level_3_With_Tax: price_Level_3_With_Tax,
|
||||
// taxId: taxDetails.taxId,
|
||||
// }));
|
||||
// };
|
||||
|
||||
// console.log(data.image.length)
|
||||
const handleSubmit = () => {
|
||||
if (
|
||||
name == "" ||
|
||||
description == "" ||
|
||||
name === "" ||
|
||||
description === "" ||
|
||||
productImages.length == 0 ||
|
||||
price == ""
|
||||
category === "" ||
|
||||
selectedTax === "" ||
|
||||
gst_amount === "" ||
|
||||
price === ""
|
||||
) {
|
||||
swal({
|
||||
title: "Warning",
|
||||
@ -218,7 +144,11 @@ const AddProduct = () => {
|
||||
|
||||
formData.append("description", description);
|
||||
formData.append("price", price);
|
||||
formData.append("category", categoryName);
|
||||
formData.append("category", category);
|
||||
formData.append("total_amount", totalAmt);
|
||||
formData.append("gst_amount", gst_amount);
|
||||
|
||||
formData.append("gst", selectedTax);
|
||||
|
||||
productImages.forEach((Singleimage) => {
|
||||
// console.log(Singleimage)
|
||||
@ -427,17 +357,6 @@ const AddProduct = () => {
|
||||
marginBottom: "1rem",
|
||||
}}
|
||||
/>
|
||||
{/* <IconButton
|
||||
onClick={() => handelDelete(image)}
|
||||
sx={{
|
||||
position: "absolute",
|
||||
fontSize: "small",
|
||||
"&:hover": {
|
||||
background: "black",
|
||||
},
|
||||
background: "black",
|
||||
}}
|
||||
> */}
|
||||
<DeleteSharpIcon
|
||||
onClick={() => handelDelete(image)}
|
||||
fontSize="small"
|
||||
@ -479,7 +398,7 @@ const AddProduct = () => {
|
||||
<div className="card-body px-5">
|
||||
<div className="mb-3 me-3">
|
||||
<label htmlFor="title" className="form-label">
|
||||
Price*
|
||||
Price(Rs)*
|
||||
</label>
|
||||
<input
|
||||
type="number"
|
||||
@ -489,26 +408,26 @@ const AddProduct = () => {
|
||||
onChange={(e) => setPrice(e.target.value)}
|
||||
/>
|
||||
</div>
|
||||
<div>
|
||||
<label htmlFor="categorySelect">Select a Category:</label>
|
||||
{/* <select
|
||||
<div className="">
|
||||
<label htmlFor="categorySelect">Select a Category *:</label>
|
||||
<select
|
||||
id="category"
|
||||
className="form-control"
|
||||
style={{ width: "100%" }}
|
||||
value={categoryName}
|
||||
value={category}
|
||||
onChange={(e) => setCategoryName(e.target.value)}
|
||||
>
|
||||
<option value={""}>None</option>
|
||||
{categories.map((category, index) => (
|
||||
<option key={index} value={category.categoryName}>
|
||||
<option key={index} value={category?._id}>
|
||||
{category.categoryName}
|
||||
</option>
|
||||
))}
|
||||
</select> */}
|
||||
<FormControl fullWidth>
|
||||
</select>
|
||||
{/* <FormControl fullWidth>
|
||||
<Select
|
||||
labelId="demo-simple-select-label"
|
||||
id="demo-simple-select"
|
||||
fullWidth
|
||||
value={categoryName}
|
||||
onChange={(e) => setCategoryName(e.target.value)}
|
||||
>
|
||||
@ -540,35 +459,58 @@ const AddProduct = () => {
|
||||
</MenuItem>
|
||||
))}
|
||||
</Select>
|
||||
</FormControl>
|
||||
</FormControl> */}
|
||||
</div>
|
||||
|
||||
{allTax.length > 0 && (
|
||||
<div className=" mb-3">
|
||||
<label htmlFor="title" className="form-label">
|
||||
Tax*
|
||||
Gst*
|
||||
</label>{" "}
|
||||
<select
|
||||
className="form-control"
|
||||
name=""
|
||||
id=""
|
||||
name="gst"
|
||||
id="gst"
|
||||
onChange={(e) => TaxRatechange(e)}
|
||||
>
|
||||
<option value="" disabled>
|
||||
-----
|
||||
</option>
|
||||
<option value="">--Select--</option>
|
||||
|
||||
{allTax.map((t, i) => (
|
||||
<option
|
||||
key={i}
|
||||
value={`tax:${t.tax},name:${t.name} ,taxId:${t._id}`}
|
||||
>
|
||||
<option key={i} value={JSON.stringify(t)}>
|
||||
{t.tax}% {t.name}
|
||||
</option>
|
||||
))}
|
||||
</select>
|
||||
</div>
|
||||
)}
|
||||
|
||||
<div className="mb-3 me-3">
|
||||
<label htmlFor="title" className="form-label">
|
||||
Gst Amount (Rs) *
|
||||
</label>
|
||||
<input
|
||||
disabled
|
||||
type="number"
|
||||
name="gst_amount"
|
||||
className="form-control"
|
||||
id="gst_amount"
|
||||
value={gst_amount}
|
||||
// onChange={(e) => setPrice(e.target.value)}
|
||||
/>
|
||||
</div>
|
||||
<div className="mb-3 me-3">
|
||||
<label htmlFor="title" className="form-label">
|
||||
Total Amount(Rs)*
|
||||
</label>
|
||||
<input
|
||||
disabled
|
||||
type="number"
|
||||
name="total_amount"
|
||||
className="form-control"
|
||||
id="total_amount"
|
||||
value={totalAmt}
|
||||
// onChange={(e) => setPrice(e.target.value)}
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -31,8 +31,11 @@ const EditProduct = () => {
|
||||
const [description, setDescription] = useState("");
|
||||
const [productImages, setProductImages] = useState([]);
|
||||
const [price, setPrice] = useState("");
|
||||
const [categoryName, setCategoryName] = useState("");
|
||||
const [category, setCategoryName] = useState("");
|
||||
const [error, setError] = useState("");
|
||||
const [selectedTax, setselectedTax] = useState();
|
||||
const [totalAmt, setTotalAmt] = useState(0);
|
||||
const [gst_amount, setGst_amount] = useState(0);
|
||||
const [newUpdatedImages, setNewUpdatedImages] = useState([]);
|
||||
|
||||
//get Productdata
|
||||
@ -45,11 +48,15 @@ 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);
|
||||
setPrice(res.data.product.price);
|
||||
setCategoryName(res.data.product.category);
|
||||
setCategoryName(res.data.product?.category?._id);
|
||||
setselectedTax(res.data.product?.gst?.name);
|
||||
setTotalAmt(res.data.product?.total_amount);
|
||||
setGst_amount(res.data.product?.gst_amount);
|
||||
})
|
||||
.catch((err) => {
|
||||
swal({
|
||||
@ -102,19 +109,25 @@ const EditProduct = () => {
|
||||
};
|
||||
getAllTax();
|
||||
}, [token]);
|
||||
|
||||
const TaxRatechange = async (e) => {
|
||||
let m = JSON.parse(e.target.value);
|
||||
if (m?.tax) {
|
||||
let totalprice = Number(price) + Number((price * m?.tax) / 100);
|
||||
setGst_amount(Number((price * m?.tax) / 100)?.toFixed(2));
|
||||
setTotalAmt(totalprice?.toFixed(2));
|
||||
setselectedTax(m?._id);
|
||||
}
|
||||
};
|
||||
const handleSubmit = () => {
|
||||
if (
|
||||
name == "" ||
|
||||
description == "" ||
|
||||
price == "" ||
|
||||
name === "" ||
|
||||
description === "" ||
|
||||
productImages.length == 0 ||
|
||||
category === "" ||
|
||||
selectedTax === "" ||
|
||||
gst_amount === "" ||
|
||||
price === "" ||
|
||||
(productImages.length == 0 && newUpdatedImages.length == 0)
|
||||
// data.price_With_Tax === '' ||
|
||||
// data.price_Level_2 === '' ||
|
||||
// data.price_Level_2_With_Tax === '' ||
|
||||
// data.price_Level_3 === '' ||
|
||||
// data.price_Level_3_With_Tax === '' ||
|
||||
// data.imageURL.trim() === ''
|
||||
) {
|
||||
swal({
|
||||
title: "Warning",
|
||||
@ -131,7 +144,11 @@ const EditProduct = () => {
|
||||
|
||||
formData.append("description", description);
|
||||
formData.append("price", price);
|
||||
formData.append("category", categoryName);
|
||||
formData.append("category", category);
|
||||
formData.append("total_amount", totalAmt);
|
||||
formData.append("gst_amount", gst_amount);
|
||||
|
||||
formData.append("gst", selectedTax);
|
||||
|
||||
newUpdatedImages.length > 0 &&
|
||||
newUpdatedImages.forEach((Singleimage) => {
|
||||
@ -453,7 +470,7 @@ const EditProduct = () => {
|
||||
<div className="card-body px-5">
|
||||
<div className="mb-3 me-3">
|
||||
<label htmlFor="title" className="form-label">
|
||||
Price (optional)
|
||||
Price(Rs)*
|
||||
</label>
|
||||
<input
|
||||
type="number"
|
||||
@ -464,63 +481,27 @@ const EditProduct = () => {
|
||||
/>
|
||||
</div>
|
||||
<div>
|
||||
<label htmlFor="categorySelect">Select a Category:</label>
|
||||
{/* <select
|
||||
<label htmlFor="categorySelect">Select a Category *:</label>
|
||||
<select
|
||||
id="category"
|
||||
className="form-control"
|
||||
style={{ width: "100%" }}
|
||||
value={categoryName}
|
||||
value={category}
|
||||
onChange={(e) => setCategoryName(e.target.value)}
|
||||
>
|
||||
<option value={""}>None</option>
|
||||
{categories.map((category, index) => (
|
||||
<option key={index} value={category.categoryName}>
|
||||
<option key={index} value={category?._id}>
|
||||
{category.categoryName}
|
||||
</option>
|
||||
))}
|
||||
</select> */}
|
||||
<FormControl fullWidth>
|
||||
<Select
|
||||
labelId="demo-simple-select-label"
|
||||
id="demo-simple-select"
|
||||
fullWidth
|
||||
value={categoryName}
|
||||
onChange={(e) => setCategoryName(e.target.value)}
|
||||
>
|
||||
<MenuItem
|
||||
style={{
|
||||
width: "100%",
|
||||
display: "flex",
|
||||
justifyContent: "left",
|
||||
textAlign: "left",
|
||||
padding: "0.5rem",
|
||||
}}
|
||||
value={""}
|
||||
>
|
||||
None
|
||||
</MenuItem>
|
||||
{categories.map((category, i) => (
|
||||
<MenuItem
|
||||
style={{
|
||||
width: "100%",
|
||||
display: "flex",
|
||||
justifyContent: "left",
|
||||
textAlign: "left",
|
||||
padding: "0.5rem",
|
||||
}}
|
||||
key={i}
|
||||
value={category.categoryName}
|
||||
>
|
||||
{category.categoryName}
|
||||
</MenuItem>
|
||||
))}
|
||||
</Select>
|
||||
</FormControl>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
{allTax.length > 0 && (
|
||||
<div className=" mb-3">
|
||||
<label htmlFor="title" className="form-label">
|
||||
Tax*
|
||||
Gst*
|
||||
</label>{" "}
|
||||
<select
|
||||
className=" form-control"
|
||||
@ -528,21 +509,45 @@ const EditProduct = () => {
|
||||
id=""
|
||||
onChange={(e) => TaxRatechange(e)}
|
||||
>
|
||||
<option value="" disabled>
|
||||
-----
|
||||
</option>
|
||||
<option value="">--Select--</option>
|
||||
|
||||
{allTax.map((t, i) => (
|
||||
<option
|
||||
key={i}
|
||||
value={`tax:${t.tax},name:${t.name} ,taxId:${t._id}`}
|
||||
>
|
||||
<option key={i} value={JSON.stringify(t)}>
|
||||
{t.tax}% {t.name}
|
||||
</option>
|
||||
))}
|
||||
</select>
|
||||
</div>
|
||||
)}
|
||||
|
||||
<div className="mb-3 me-3">
|
||||
<label htmlFor="title" className="form-label">
|
||||
Gst Amount (Rs) *
|
||||
</label>
|
||||
<input
|
||||
disabled
|
||||
type="number"
|
||||
name="gst_amount"
|
||||
className="form-control"
|
||||
id="gst_amount"
|
||||
value={gst_amount}
|
||||
// onChange={(e) => setPrice(e.target.value)}
|
||||
/>
|
||||
</div>
|
||||
<div className="mb-3 me-3">
|
||||
<label htmlFor="title" className="form-label">
|
||||
Total Amount(Rs)*
|
||||
</label>
|
||||
<input
|
||||
disabled
|
||||
type="number"
|
||||
name="total_amount"
|
||||
className="form-control"
|
||||
id="total_amount"
|
||||
value={totalAmt}
|
||||
// onChange={(e) => setPrice(e.target.value)}
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -44,6 +44,7 @@ const Products = () => {
|
||||
},
|
||||
})
|
||||
.then((res) => {
|
||||
console.log(res.data?.product);
|
||||
setProductsData(res.data?.product);
|
||||
setLoading(false);
|
||||
})
|
||||
@ -310,9 +311,9 @@ const Products = () => {
|
||||
textAlign: "left",
|
||||
padding: "0.5rem",
|
||||
}}
|
||||
value={product.category}
|
||||
value={product.category?.categoryName}
|
||||
>
|
||||
{product.category}
|
||||
{product.category?.categoryName}
|
||||
</MenuItem>
|
||||
))}
|
||||
</Select>
|
||||
@ -334,8 +335,8 @@ const Products = () => {
|
||||
>
|
||||
<tr>
|
||||
<th className="text-start">Image</th>
|
||||
<th className="text-start">Product Name</th>
|
||||
<th className="text-start">Category Name</th>
|
||||
<th className="text-start">Product</th>
|
||||
<th className="text-start">Category</th>
|
||||
|
||||
<th className="text-start">Price</th>
|
||||
<th className="text-start">Added On</th>
|
||||
@ -374,11 +375,13 @@ const Products = () => {
|
||||
</th>
|
||||
<td className="text-start">{product.name}</td>
|
||||
<td className="text-start">
|
||||
{product.category !== ""
|
||||
? product.category
|
||||
{product.category?.categoryName !== ""
|
||||
? product.category?.categoryName
|
||||
: "Category Not selected "}
|
||||
</td>
|
||||
<th className="text-start">${product.price}</th>
|
||||
<th className="text-start">
|
||||
₹{product?.total_amount}
|
||||
</th>
|
||||
<td className="text-start">
|
||||
{new Date(product.createdAt).toLocaleString(
|
||||
"en-IN",
|
||||
|
@ -85,7 +85,6 @@ function ViewProduct() {
|
||||
<tr>
|
||||
<th>Name</th> <td>{product?.name}</td>
|
||||
</tr>
|
||||
|
||||
{product.image && (
|
||||
<tr>
|
||||
<th>image</th>
|
||||
@ -101,15 +100,39 @@ function ViewProduct() {
|
||||
</td>
|
||||
</tr>
|
||||
)}
|
||||
<tr>
|
||||
<th>Category </th>
|
||||
<td>
|
||||
{product.category?.categoryName !== ""
|
||||
? product.category?.categoryName
|
||||
: "Category not selected "}
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Description</th>
|
||||
<td>{product?.description}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Base Price</th>
|
||||
<td>${product?.price}</td>
|
||||
<th>Price</th>
|
||||
<td>₹{product?.price}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Gst</th>
|
||||
<td>
|
||||
{product?.gst?.tax}% {product?.gst?.name}
|
||||
</td>
|
||||
</tr>
|
||||
{product?.gst_amount && (
|
||||
<tr>
|
||||
<th>Gst Amount</th>
|
||||
<td>₹{product?.gst_amount}</td>
|
||||
</tr>
|
||||
)}
|
||||
|
||||
<tr>
|
||||
<th>Total Amount(with Gst)</th>
|
||||
<td>₹{product?.total_amount}</td>
|
||||
</tr>
|
||||
{/* <tr><th>Product Time</th><td>{product?.time}</td></tr>
|
||||
<tr><th>Location</th><td>{product?.location}</td></tr> */}
|
||||
<tr>
|
||||
@ -132,15 +155,6 @@ function ViewProduct() {
|
||||
</span>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<th>Category </th>
|
||||
<td>
|
||||
{product.category !== ""
|
||||
? product.category
|
||||
: "Category not selected "}
|
||||
</td>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody></tbody>
|
||||
</table>
|
||||
|
@ -139,7 +139,7 @@ function CancelledOrders() {
|
||||
{order?.user?.name}
|
||||
</td>
|
||||
<td className="text-start">
|
||||
${order?.total_amount}
|
||||
₹{order?.total_amount}
|
||||
</td>
|
||||
<td className="text-start">
|
||||
{new Date(order?.paidAt).toLocaleString(
|
||||
|
@ -139,7 +139,7 @@ function DeliveredOrders() {
|
||||
{order?.user?.name}
|
||||
</td>
|
||||
<td className="text-start">
|
||||
${order?.total_amount}
|
||||
₹{order?.total_amount}
|
||||
</td>
|
||||
<td className="text-start">
|
||||
{new Date(order?.paidAt).toLocaleString(
|
||||
|
@ -142,7 +142,7 @@ function DispatchedOrders() {
|
||||
{order?.user?.name}
|
||||
</td>
|
||||
<td className="text-start">
|
||||
${order?.total_amount}
|
||||
₹{order?.total_amount}
|
||||
</td>
|
||||
<td className="text-start">
|
||||
{new Date(order?.paidAt).toLocaleString(
|
||||
|
@ -193,7 +193,7 @@ function NewOrders() {
|
||||
{order?.user?.name}
|
||||
</td>
|
||||
<td className="text-start">
|
||||
${order?.total_amount}
|
||||
₹{order?.total_amount}
|
||||
</td>
|
||||
<td className="text-start">
|
||||
{new Date(order?.paidAt).toLocaleString(
|
||||
|
@ -143,7 +143,7 @@ function ProcessingOrders() {
|
||||
{order?.user?.name}
|
||||
</td>
|
||||
<td className="text-start">
|
||||
${order?.total_amount}
|
||||
₹{order?.total_amount}
|
||||
</td>
|
||||
<td className="text-start">
|
||||
{new Date(order?.paidAt).toLocaleString(
|
||||
|
@ -1,50 +1,52 @@
|
||||
import React, { useState, useEffect } from 'react'
|
||||
import { Link } from 'react-router-dom'
|
||||
import axios from 'axios'
|
||||
import { isAutheticated } from 'src/auth'
|
||||
|
||||
import React, { useState, useEffect } from "react";
|
||||
import { Link } from "react-router-dom";
|
||||
import axios from "axios";
|
||||
import { isAutheticated } from "src/auth";
|
||||
|
||||
function ReturnedOrders() {
|
||||
const token = isAutheticated()
|
||||
const [loading, setLoading] = useState(true)
|
||||
const [success, setSuccess] = useState(true)
|
||||
const [returnedOrdersData, setReturnedOrdersData] = useState([])
|
||||
const token = isAutheticated();
|
||||
const [loading, setLoading] = useState(true);
|
||||
const [success, setSuccess] = useState(true);
|
||||
const [returnedOrdersData, setReturnedOrdersData] = useState([]);
|
||||
|
||||
const [currentPage, setCurrentPage] = useState(1)
|
||||
const [itemPerPage, setItemPerPage] = useState(10)
|
||||
const [showData, setShowData] = useState(returnedOrdersData)
|
||||
const [currentPage, setCurrentPage] = useState(1);
|
||||
const [itemPerPage, setItemPerPage] = useState(10);
|
||||
const [showData, setShowData] = useState(returnedOrdersData);
|
||||
|
||||
const handleShowEntries = (e) => {
|
||||
setCurrentPage(1)
|
||||
setItemPerPage(e.target.value)
|
||||
}
|
||||
setCurrentPage(1);
|
||||
setItemPerPage(e.target.value);
|
||||
};
|
||||
|
||||
useEffect(() => {
|
||||
function getProcessingOrder() {
|
||||
axios
|
||||
.get(`/api/order/list/returned`, {
|
||||
headers: { 'Access-Control-Allow-Origin': '*', Authorization: `Bearer ${token}` },
|
||||
headers: {
|
||||
"Access-Control-Allow-Origin": "*",
|
||||
Authorization: `Bearer ${token}`,
|
||||
},
|
||||
})
|
||||
.then((res) => {
|
||||
setReturnedOrdersData(res.data.data)
|
||||
setLoading(false)
|
||||
setReturnedOrdersData(res.data.data);
|
||||
setLoading(false);
|
||||
})
|
||||
.catch((err) => {
|
||||
console.log(err)
|
||||
setLoading(false)
|
||||
})
|
||||
console.log(err);
|
||||
setLoading(false);
|
||||
});
|
||||
}
|
||||
getProcessingOrder()
|
||||
}, [])
|
||||
getProcessingOrder();
|
||||
}, []);
|
||||
|
||||
useEffect(() => {
|
||||
const loadData = () => {
|
||||
const indexOfLastPost = currentPage * itemPerPage
|
||||
const indexOfFirstPost = indexOfLastPost - itemPerPage
|
||||
setShowData(returnedOrdersData.slice(indexOfFirstPost, indexOfLastPost))
|
||||
}
|
||||
loadData()
|
||||
}, [currentPage, itemPerPage, returnedOrdersData])
|
||||
const indexOfLastPost = currentPage * itemPerPage;
|
||||
const indexOfFirstPost = indexOfLastPost - itemPerPage;
|
||||
setShowData(returnedOrdersData.slice(indexOfFirstPost, indexOfLastPost));
|
||||
};
|
||||
loadData();
|
||||
}, [currentPage, itemPerPage, returnedOrdersData]);
|
||||
|
||||
return (
|
||||
<div className="main-content">
|
||||
@ -60,7 +62,7 @@ function ReturnedOrders() {
|
||||
justify-content-between
|
||||
"
|
||||
>
|
||||
<div style={{ fontSize: '22px' }} className="fw-bold">
|
||||
<div style={{ fontSize: "22px" }} className="fw-bold">
|
||||
Returned Orders
|
||||
</div>
|
||||
</div>
|
||||
@ -76,7 +78,7 @@ function ReturnedOrders() {
|
||||
<label className="w-100">
|
||||
Show
|
||||
<select
|
||||
style={{ width: '10%' }}
|
||||
style={{ width: "10%" }}
|
||||
name=""
|
||||
onChange={(e) => handleShowEntries(e)}
|
||||
className="
|
||||
@ -99,9 +101,12 @@ function ReturnedOrders() {
|
||||
<div className="table-responsive table-shoot mt-3">
|
||||
<table
|
||||
className="table table-centered table-nowrap"
|
||||
style={{ border: '1px solid' }}
|
||||
style={{ border: "1px solid" }}
|
||||
>
|
||||
<thead
|
||||
className="thead-light"
|
||||
style={{ background: "#ecdddd" }}
|
||||
>
|
||||
<thead className="thead-light" style={{ background: '#ecdddd' }}>
|
||||
<tr>
|
||||
<th className="text-start">Order ID</th>
|
||||
<th className="text-start">Parent Name</th>
|
||||
@ -130,17 +135,24 @@ function ReturnedOrders() {
|
||||
return (
|
||||
<tr key={i}>
|
||||
<td className="text-start">{order.order_id}</td>
|
||||
<td className="text-start">{order.parent.name}</td>
|
||||
<td className="text-start">{order?.total_amount}</td>
|
||||
<td className="text-start">
|
||||
{new Date(order?.placed_on).toLocaleString('en-IN', {
|
||||
month: 'short',
|
||||
day: 'numeric',
|
||||
year: 'numeric',
|
||||
hour: '2-digit',
|
||||
minute: 'numeric',
|
||||
{order.parent.name}
|
||||
</td>
|
||||
<td className="text-start">
|
||||
₹{order?.total_amount}
|
||||
</td>
|
||||
<td className="text-start">
|
||||
{new Date(order?.placed_on).toLocaleString(
|
||||
"en-IN",
|
||||
{
|
||||
month: "short",
|
||||
day: "numeric",
|
||||
year: "numeric",
|
||||
hour: "2-digit",
|
||||
minute: "numeric",
|
||||
hour12: true,
|
||||
})}
|
||||
}
|
||||
)}
|
||||
</td>
|
||||
<td className="text-start">
|
||||
<span className="badge text-bg-success text-white">
|
||||
@ -148,9 +160,11 @@ function ReturnedOrders() {
|
||||
</span>
|
||||
</td>
|
||||
<td className="text-start">
|
||||
<Link to={`/orders/${order.status}/${order._id}`}>
|
||||
<Link
|
||||
to={`/orders/${order.status}/${order._id}`}
|
||||
>
|
||||
<button
|
||||
style={{ color: 'white' }}
|
||||
style={{ color: "white" }}
|
||||
type="button"
|
||||
className="
|
||||
btn btn-primary btn-sm
|
||||
@ -164,7 +178,7 @@ function ReturnedOrders() {
|
||||
</Link>
|
||||
</td>
|
||||
</tr>
|
||||
)
|
||||
);
|
||||
})
|
||||
)}
|
||||
</tbody>
|
||||
@ -179,9 +193,12 @@ function ReturnedOrders() {
|
||||
role="status"
|
||||
aria-live="polite"
|
||||
>
|
||||
Showing {currentPage * itemPerPage - itemPerPage + 1} to{' '}
|
||||
{Math.min(currentPage * itemPerPage, returnedOrdersData.length)} of{' '}
|
||||
{returnedOrdersData.length} entries
|
||||
Showing {currentPage * itemPerPage - itemPerPage + 1} to{" "}
|
||||
{Math.min(
|
||||
currentPage * itemPerPage,
|
||||
returnedOrdersData.length
|
||||
)}{" "}
|
||||
of {returnedOrdersData.length} entries
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@ -191,13 +208,13 @@ function ReturnedOrders() {
|
||||
<li
|
||||
className={
|
||||
currentPage === 1
|
||||
? 'paginate_button page-item previous disabled'
|
||||
: 'paginate_button page-item previous'
|
||||
? "paginate_button page-item previous disabled"
|
||||
: "paginate_button page-item previous"
|
||||
}
|
||||
>
|
||||
<span
|
||||
className="page-link"
|
||||
style={{ cursor: 'pointer' }}
|
||||
style={{ cursor: "pointer" }}
|
||||
onClick={() => setCurrentPage((prev) => prev - 1)}
|
||||
>
|
||||
Previous
|
||||
@ -208,8 +225,10 @@ function ReturnedOrders() {
|
||||
<li className="paginate_button page-item">
|
||||
<span
|
||||
className="page-link"
|
||||
style={{ cursor: 'pointer' }}
|
||||
onClick={(e) => setCurrentPage((prev) => prev - 1)}
|
||||
style={{ cursor: "pointer" }}
|
||||
onClick={(e) =>
|
||||
setCurrentPage((prev) => prev - 1)
|
||||
}
|
||||
>
|
||||
{currentPage - 1}
|
||||
</span>
|
||||
@ -217,7 +236,10 @@ function ReturnedOrders() {
|
||||
)}
|
||||
|
||||
<li className="paginate_button page-item active">
|
||||
<span className="page-link" style={{ cursor: 'pointer' }}>
|
||||
<span
|
||||
className="page-link"
|
||||
style={{ cursor: "pointer" }}
|
||||
>
|
||||
{currentPage}
|
||||
</span>
|
||||
</li>
|
||||
@ -229,9 +251,9 @@ function ReturnedOrders() {
|
||||
<li className="paginate_button page-item ">
|
||||
<span
|
||||
className="page-link"
|
||||
style={{ cursor: 'pointer' }}
|
||||
style={{ cursor: "pointer" }}
|
||||
onClick={() => {
|
||||
setCurrentPage((prev) => prev + 1)
|
||||
setCurrentPage((prev) => prev + 1);
|
||||
}}
|
||||
>
|
||||
{currentPage + 1}
|
||||
@ -245,13 +267,13 @@ function ReturnedOrders() {
|
||||
(currentPage + 1) * itemPerPage - itemPerPage >
|
||||
returnedOrdersData.length - 1
|
||||
)
|
||||
? 'paginate_button page-item next'
|
||||
: 'paginate_button page-item next disabled'
|
||||
? "paginate_button page-item next"
|
||||
: "paginate_button page-item next disabled"
|
||||
}
|
||||
>
|
||||
<span
|
||||
className="page-link"
|
||||
style={{ cursor: 'pointer' }}
|
||||
style={{ cursor: "pointer" }}
|
||||
onClick={() => setCurrentPage((prev) => prev + 1)}
|
||||
>
|
||||
Next
|
||||
@ -268,7 +290,7 @@ function ReturnedOrders() {
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
export default ReturnedOrders
|
||||
export default ReturnedOrders;
|
||||
|
@ -449,14 +449,14 @@ function ViewOrders() {
|
||||
</div>
|
||||
|
||||
<p className="m-0 mt-3 ms-3">
|
||||
<stong> Total Price:</stong> $
|
||||
<stong> Total Price:</stong> ₹
|
||||
{productDetails?.quantity *
|
||||
productDetails?.price}
|
||||
</p>
|
||||
</div>
|
||||
<div className="col-sm-6">
|
||||
<p className="m-0 mt-3">
|
||||
<stong> Price:</stong> $
|
||||
<stong> Price:</stong> ₹
|
||||
{productDetails?.price}
|
||||
</p>
|
||||
</div>
|
||||
@ -468,10 +468,10 @@ function ViewOrders() {
|
||||
)
|
||||
)}
|
||||
<div className="m-0 contents-center mt-3 mb-2">
|
||||
<small className="mb-4">Shipping Charge: </small> $
|
||||
<small className="mb-4">Shipping Charge: </small> ₹
|
||||
{orderDetails?.shipping_charge}
|
||||
<br />
|
||||
<span className="mt-2"> Total Order Value: </span> $
|
||||
<span className="mt-2"> Total Order Value: </span> ₹
|
||||
{orderDetails?.total_amount}
|
||||
</div>
|
||||
</div>
|
||||
|
@ -138,9 +138,9 @@ const Login = () => {
|
||||
<CCard className="p-4">
|
||||
<CCardBody>
|
||||
<CForm>
|
||||
<h1>Get Sygnal</h1>
|
||||
<h1>Smellika</h1>
|
||||
<p className="text-medium-emphasis">
|
||||
Sign In to Your Get Sygnal Admin Dashboard Account.
|
||||
Sign In to Your Smellika Admin Dashboard Account.
|
||||
</p>
|
||||
<CInputGroup className="mb-3">
|
||||
<CInputGroupText>
|
||||
|
Loading…
Reference in New Issue
Block a user