diff --git a/nearlexpressbuild b/nearlexpressbuild index 0f12f16..11b0273 160000 --- a/nearlexpressbuild +++ b/nearlexpressbuild @@ -1 +1 @@ -Subproject commit 0f12f16e5c3c451d673fe3626d379881c982c402 +Subproject commit 11b027379b9bddb034afd8d5d86d3e7c7b2ea2f5 diff --git a/src/pages/nearle/clients/clients1.js b/src/pages/nearle/clients/clients1.js index e51ab57..e121138 100644 --- a/src/pages/nearle/clients/clients1.js +++ b/src/pages/nearle/clients/clients1.js @@ -53,6 +53,7 @@ import { MdPersonAddDisabled } from "react-icons/md"; // import { DatePicker } from "@mui/x-date-pickers/DatePicker"; import { ThemeMode } from "config"; // import { FaUserLarge } from "react-icons/fa6"; +import { enqueueSnackbar } from "notistack"; import { RightOutlined, LeftOutlined, @@ -79,6 +80,7 @@ import { CheckCircleFilled, ClockCircleFilled, MinusCircleFilled, + DeleteFilled } from "@ant-design/icons"; // import ChatDrawer from "sections/apps/chat/ChatDrawer"; // import ChatHistory from "sections/apps/chat/ChatHistory"; @@ -102,6 +104,7 @@ var utc = require('dayjs/plugin/utc') dayjs.extend(utc) import { DateRangePicker } from "mui-daterange-picker"; + import { addDays, addMonths, @@ -171,6 +174,8 @@ const Clients1 = () => { const [contactno, setContactno] = useState(""); const ref = useRef(null); const [open, setOpen] = React.useState(false); + const [open3, setOpen3] = React.useState(false); + const [packDays, setPackDays] = useState(0); const [startDate, setStartDate] = useState(""); const [validDate, setValidDate] = useState(""); @@ -196,13 +201,18 @@ const Clients1 = () => { const [datestatus,setDatestatus]=useState('Today'); const [tenid,setTenid]=useState(''); - const [loading1,setLoading1]=useState(false) + const [loading1,setLoading1]=useState(false); + const [currentcustomerid,setCurrentcustomerid]=useState('') const handleClickOpen = () => { setOpen(true); }; const handleClose = () => { - setOpen(false); + setOpen3(false); + }; + + const handleClose3 = () => { + setOpen3(false); }; // const [anchorEl]=useState(null) // const tenid = window.localStorage.getItem("tenantid"); @@ -351,6 +361,45 @@ if(tenid){ } + + const removeclient = async () => { + setLoading(true) + try { + await axios.delete(`${process.env.REACT_APP_URL}/customers/delete/?customerid=${currentcustomerid}`) + + .then((res) => { + if (res.data.status) { + enqueueSnackbar("Deleted Successfully", { + variant: 'success', anchorOrigin: { vertical: 'top', horizontal: 'right' }, + autoHideDuration: 2000 + }) + setCurrentcustomerid('') + // fetchtable(localStorage.getItem('tenantid')) + }else{ + enqueueSnackbar(res.data.message, { + variant: 'error', anchorOrigin: { vertical: 'top', horizontal: 'right' }, + autoHideDuration: 2000 + }) + } + setLoading(false) + + }).catch((err) => { + console.log(err) + enqueueSnackbar(err.message, { + variant: 'error', anchorOrigin: { vertical: 'top', horizontal: 'right' }, + autoHideDuration: 2000 + }) + setLoading(false) + + }) + + } catch (err) { + console.log(err); + setLoading(false) + + } +} + const fetchtable = async (tid) => { setLoading1(true) try { @@ -490,9 +539,77 @@ if(tenid){ setValidDate(formattedDate); }, [packDays, startDate]); + + function AlertCustomerDelete({ + // title, + open, handleClose}) { + // const [deletepassword, setDeletepassword] = useState(''); + + return ( + handleClose(false)} + maxWidth="xs" + + > + + + + + + {/* + + */} + + + Are you sure you want to Remove this Customer? + + + {/* + Please type in the order number to confirm. + */} + {/* { + console.log(e.target.value) + setDeletepassword(e.target.value) + }} + error={deletepassword !== orderid.slice(4)} + value={deletepassword} + /> */} + + + + + + + + + + + + ); +} + return ( <> {(loading || usernameload) && } + + - {users.length} Clients + {users.length} Customers @@ -857,7 +974,7 @@ if(tenid){ transition: theme.transitions.create("width", { easing: theme.transitions.easing.easeOut, duration: theme.transitions.duration.shorter + 200, - height: "100%", + // height: "100%", }), }} > @@ -1032,7 +1149,7 @@ if(tenid){ )} @@ -1063,17 +1180,20 @@ if(tenid){ {/* ======================================== || Add Membership dialog|| ======================================== */} @@ -1247,7 +1367,7 @@ if(tenid){ */} - + {/* - + + */} {/* Delete diff --git a/src/pages/nearle/clients/createclient.js b/src/pages/nearle/clients/createclient.js index 9a52327..ba0ef69 100644 --- a/src/pages/nearle/clients/createclient.js +++ b/src/pages/nearle/clients/createclient.js @@ -295,7 +295,7 @@ const Createclient = () => { variant: 'success', anchorOrigin: { vertical: 'top', horizontal: 'right' }, autoHideDuration: 2000 }) - navigate('/clients') + navigate('/customers') // setTimeout(()=>{ // fetchprofiledetails(localStorage.getItem('appuserid'));