02012024
This commit is contained in:
Submodule nearlexpressbuild updated: 0f12f16e5c...11b027379b
@@ -53,6 +53,7 @@ import { MdPersonAddDisabled } from "react-icons/md";
|
|||||||
// import { DatePicker } from "@mui/x-date-pickers/DatePicker";
|
// import { DatePicker } from "@mui/x-date-pickers/DatePicker";
|
||||||
import { ThemeMode } from "config";
|
import { ThemeMode } from "config";
|
||||||
// import { FaUserLarge } from "react-icons/fa6";
|
// import { FaUserLarge } from "react-icons/fa6";
|
||||||
|
import { enqueueSnackbar } from "notistack";
|
||||||
import {
|
import {
|
||||||
RightOutlined,
|
RightOutlined,
|
||||||
LeftOutlined,
|
LeftOutlined,
|
||||||
@@ -79,6 +80,7 @@ import {
|
|||||||
CheckCircleFilled,
|
CheckCircleFilled,
|
||||||
ClockCircleFilled,
|
ClockCircleFilled,
|
||||||
MinusCircleFilled,
|
MinusCircleFilled,
|
||||||
|
DeleteFilled
|
||||||
} from "@ant-design/icons";
|
} from "@ant-design/icons";
|
||||||
// import ChatDrawer from "sections/apps/chat/ChatDrawer";
|
// import ChatDrawer from "sections/apps/chat/ChatDrawer";
|
||||||
// import ChatHistory from "sections/apps/chat/ChatHistory";
|
// import ChatHistory from "sections/apps/chat/ChatHistory";
|
||||||
@@ -102,6 +104,7 @@ var utc = require('dayjs/plugin/utc')
|
|||||||
dayjs.extend(utc)
|
dayjs.extend(utc)
|
||||||
import { DateRangePicker } from "mui-daterange-picker";
|
import { DateRangePicker } from "mui-daterange-picker";
|
||||||
|
|
||||||
|
|
||||||
import {
|
import {
|
||||||
addDays,
|
addDays,
|
||||||
addMonths,
|
addMonths,
|
||||||
@@ -171,6 +174,8 @@ const Clients1 = () => {
|
|||||||
const [contactno, setContactno] = useState("");
|
const [contactno, setContactno] = useState("");
|
||||||
const ref = useRef(null);
|
const ref = useRef(null);
|
||||||
const [open, setOpen] = React.useState(false);
|
const [open, setOpen] = React.useState(false);
|
||||||
|
const [open3, setOpen3] = React.useState(false);
|
||||||
|
|
||||||
const [packDays, setPackDays] = useState(0);
|
const [packDays, setPackDays] = useState(0);
|
||||||
const [startDate, setStartDate] = useState("");
|
const [startDate, setStartDate] = useState("");
|
||||||
const [validDate, setValidDate] = useState("");
|
const [validDate, setValidDate] = useState("");
|
||||||
@@ -196,13 +201,18 @@ const Clients1 = () => {
|
|||||||
|
|
||||||
const [datestatus,setDatestatus]=useState('Today');
|
const [datestatus,setDatestatus]=useState('Today');
|
||||||
const [tenid,setTenid]=useState('');
|
const [tenid,setTenid]=useState('');
|
||||||
const [loading1,setLoading1]=useState(false)
|
const [loading1,setLoading1]=useState(false);
|
||||||
|
const [currentcustomerid,setCurrentcustomerid]=useState('')
|
||||||
|
|
||||||
const handleClickOpen = () => {
|
const handleClickOpen = () => {
|
||||||
setOpen(true);
|
setOpen(true);
|
||||||
};
|
};
|
||||||
const handleClose = () => {
|
const handleClose = () => {
|
||||||
setOpen(false);
|
setOpen3(false);
|
||||||
|
};
|
||||||
|
|
||||||
|
const handleClose3 = () => {
|
||||||
|
setOpen3(false);
|
||||||
};
|
};
|
||||||
// const [anchorEl]=useState(null)
|
// const [anchorEl]=useState(null)
|
||||||
// const tenid = window.localStorage.getItem("tenantid");
|
// 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) => {
|
const fetchtable = async (tid) => {
|
||||||
setLoading1(true)
|
setLoading1(true)
|
||||||
try {
|
try {
|
||||||
@@ -490,9 +539,77 @@ if(tenid){
|
|||||||
setValidDate(formattedDate);
|
setValidDate(formattedDate);
|
||||||
}, [packDays, startDate]);
|
}, [packDays, startDate]);
|
||||||
|
|
||||||
|
|
||||||
|
function AlertCustomerDelete({
|
||||||
|
// title,
|
||||||
|
open, handleClose}) {
|
||||||
|
// const [deletepassword, setDeletepassword] = useState('');
|
||||||
|
|
||||||
|
return (
|
||||||
|
<Dialog
|
||||||
|
open={open}
|
||||||
|
onClose={() => handleClose(false)}
|
||||||
|
maxWidth="xs"
|
||||||
|
|
||||||
|
>
|
||||||
|
<DialogContent sx={{ mt: 2, my: 1 }}>
|
||||||
|
<Stack alignItems="center" spacing={3.5}>
|
||||||
|
<Avatar color="error" sx={{ width: 72, height: 72, fontSize: '1.75rem' }}>
|
||||||
|
<DeleteFilled />
|
||||||
|
</Avatar>
|
||||||
|
{/* <Grid >
|
||||||
|
<Chip label={orderid.slice(4)} variant="combined" color='warning' size='small' />
|
||||||
|
</Grid> */}
|
||||||
|
<Stack spacing={2}>
|
||||||
|
<Typography variant="h4" align="center">
|
||||||
|
Are you sure you want to Remove this Customer?
|
||||||
|
</Typography>
|
||||||
|
|
||||||
|
{/* <Typography variant="h4" align="center">
|
||||||
|
Please type in the order number to confirm.
|
||||||
|
</Typography> */}
|
||||||
|
{/* <TextField
|
||||||
|
type='text'
|
||||||
|
onChange={(e) => {
|
||||||
|
console.log(e.target.value)
|
||||||
|
setDeletepassword(e.target.value)
|
||||||
|
}}
|
||||||
|
error={deletepassword !== orderid.slice(4)}
|
||||||
|
value={deletepassword}
|
||||||
|
/> */}
|
||||||
|
|
||||||
|
</Stack>
|
||||||
|
|
||||||
|
<Stack direction="row" spacing={2} sx={{ width: 1 }}>
|
||||||
|
<Button fullWidth color="error" variant="contained" onClick={() => {
|
||||||
|
// if (deletepassword === orderid.slice(4)) {
|
||||||
|
// cancelorder();
|
||||||
|
removeclient()
|
||||||
|
handleClose(true);
|
||||||
|
// }
|
||||||
|
|
||||||
|
}} autoFocus>
|
||||||
|
Yes, Remove
|
||||||
|
</Button>
|
||||||
|
<Button fullWidth onClick={() => {
|
||||||
|
handleClose(false)
|
||||||
|
setCurrentcustomerid('')
|
||||||
|
}} color="secondary" variant="outlined">
|
||||||
|
No
|
||||||
|
</Button>
|
||||||
|
|
||||||
|
</Stack>
|
||||||
|
</Stack>
|
||||||
|
</DialogContent>
|
||||||
|
</Dialog>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
{(loading || usernameload) && <Loader />}
|
{(loading || usernameload) && <Loader />}
|
||||||
|
<AlertCustomerDelete open={open3} handleClose={handleClose} />
|
||||||
|
|
||||||
<Grid container rowSpacing={2} columnSpacing={2.75}>
|
<Grid container rowSpacing={2} columnSpacing={2.75}>
|
||||||
<Grid
|
<Grid
|
||||||
item
|
item
|
||||||
@@ -821,7 +938,7 @@ if(tenid){
|
|||||||
sx={{ width: "100%", p: 2 }}
|
sx={{ width: "100%", p: 2 }}
|
||||||
>
|
>
|
||||||
<Stack direction={'row'} justifyContent={'flex-end'}>
|
<Stack direction={'row'} justifyContent={'flex-end'}>
|
||||||
<Typography variant='h6'>{users.length} Clients</Typography>
|
<Typography variant='h6'>{users.length} Customers</Typography>
|
||||||
</Stack>
|
</Stack>
|
||||||
</Box>
|
</Box>
|
||||||
</MainCard>
|
</MainCard>
|
||||||
@@ -857,7 +974,7 @@ if(tenid){
|
|||||||
transition: theme.transitions.create("width", {
|
transition: theme.transitions.create("width", {
|
||||||
easing: theme.transitions.easing.easeOut,
|
easing: theme.transitions.easing.easeOut,
|
||||||
duration: theme.transitions.duration.shorter + 200,
|
duration: theme.transitions.duration.shorter + 200,
|
||||||
height: "100%",
|
// height: "100%",
|
||||||
}),
|
}),
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
@@ -1032,7 +1149,7 @@ if(tenid){
|
|||||||
</>
|
</>
|
||||||
)}
|
)}
|
||||||
<IconButton
|
<IconButton
|
||||||
// onClick={handleClickSort}
|
onClick={handleClickSort}
|
||||||
size="large"
|
size="large"
|
||||||
color="primary"
|
color="primary"
|
||||||
>
|
>
|
||||||
@@ -1063,17 +1180,20 @@ if(tenid){
|
|||||||
<MenuItem onClick={handleCloseSort}>
|
<MenuItem onClick={handleCloseSort}>
|
||||||
<Button
|
<Button
|
||||||
variant="text"
|
variant="text"
|
||||||
onClick={handleClickOpen}
|
onClick={()=>{
|
||||||
|
setOpen3(true)
|
||||||
|
setCurrentcustomerid(tenid)
|
||||||
|
}}
|
||||||
>
|
>
|
||||||
{
|
{
|
||||||
<MdPersonAdd
|
<DeleteFilled
|
||||||
style={{
|
style={{
|
||||||
fontSize: "20px",
|
fontSize: "20px",
|
||||||
marginRight: "15px",
|
marginRight: "15px",
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
}{" "}
|
}{" "}
|
||||||
Add Membership
|
Delete
|
||||||
</Button>
|
</Button>
|
||||||
{/* ======================================== || Add Membership dialog|| ======================================== */}
|
{/* ======================================== || Add Membership dialog|| ======================================== */}
|
||||||
|
|
||||||
@@ -1247,7 +1367,7 @@ if(tenid){
|
|||||||
</DialogActions>
|
</DialogActions>
|
||||||
</BootstrapDialog> */}
|
</BootstrapDialog> */}
|
||||||
</MenuItem>
|
</MenuItem>
|
||||||
<MenuItem onClick={handleCloseSort}>
|
{/* <MenuItem onClick={handleCloseSort}>
|
||||||
<Button
|
<Button
|
||||||
variant="text"
|
variant="text"
|
||||||
// onClick={handleClickOpen}
|
// onClick={handleClickOpen}
|
||||||
@@ -1262,7 +1382,7 @@ if(tenid){
|
|||||||
}{" "}
|
}{" "}
|
||||||
Disable
|
Disable
|
||||||
</Button>
|
</Button>
|
||||||
</MenuItem>
|
</MenuItem>*/}
|
||||||
{/* <MenuItem onClick={handleCloseSort}>
|
{/* <MenuItem onClick={handleCloseSort}>
|
||||||
<DeleteOutlined style={{ paddingRight: 8 }} />
|
<DeleteOutlined style={{ paddingRight: 8 }} />
|
||||||
<Typography>Delete</Typography>
|
<Typography>Delete</Typography>
|
||||||
|
|||||||
@@ -295,7 +295,7 @@ const Createclient = () => {
|
|||||||
variant: 'success', anchorOrigin: { vertical: 'top', horizontal: 'right' },
|
variant: 'success', anchorOrigin: { vertical: 'top', horizontal: 'right' },
|
||||||
autoHideDuration: 2000
|
autoHideDuration: 2000
|
||||||
})
|
})
|
||||||
navigate('/clients')
|
navigate('/customers')
|
||||||
// setTimeout(()=>{
|
// setTimeout(()=>{
|
||||||
// fetchprofiledetails(localStorage.getItem('appuserid'));
|
// fetchprofiledetails(localStorage.getItem('appuserid'));
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user