customers

This commit is contained in:
joshikannan
2024-04-09 13:08:33 +05:30
parent b8868122c6
commit 77f5295720
4 changed files with 71 additions and 22 deletions

View File

@@ -496,7 +496,7 @@ SortingSelect.propTypes = {
export const CSVExport = ({ data, filename, headers }) => { export const CSVExport = ({ data, filename, headers }) => {
return ( return (
<CSVLink data={data} filename={filename} headers={headers}> <CSVLink data={data} filename={filename} headers={headers}>
<Tooltip title="CSV Export"> <Tooltip title="Download CSV">
<DownloadOutlined style={{ fontSize: '24px', color: 'gray', marginTop: 4, marginRight: 4, marginLeft: 4 }} /> <DownloadOutlined style={{ fontSize: '24px', color: 'gray', marginTop: 4, marginRight: 4, marginLeft: 4 }} />
</Tooltip> </Tooltip>
</CSVLink> </CSVLink>

View File

@@ -525,7 +525,8 @@ const Customers = () => {
try { try {
// await axios.get(`${process.env.REACT_APP_URL}/tenants/gettenants/?partnerid=${tid}&status=active`) // await axios.get(`${process.env.REACT_APP_URL}/tenants/gettenants/?partnerid=${tid}&status=active`)
await axios await axios
.get(`${process.env.REACT_APP_URL}/customers/getbytid/?tenantid=${tid}`) // .get(`${process.env.REACT_APP_URL}/customers/gettenantcustomers/?tenantid=${tid}`)
.get(`${process.env.REACT_APP_URL}/customers/gettenantcustomers/?tenantid=${tid}&pageno=1&pagesize=20`)
.then((res) => { .then((res) => {
if (res.data.message === 'Success') { if (res.data.message === 'Success') {

View File

@@ -433,6 +433,11 @@ const Createorder1 = () => {
const [appLocaLat, setAppLocaLat] = useState(); const [appLocaLat, setAppLocaLat] = useState();
const [appLocaLng, setAppLocaLng] = useState(); const [appLocaLng, setAppLocaLng] = useState();
const [appLocaRadius, setAppLocaRadius] = useState(); const [appLocaRadius, setAppLocaRadius] = useState();
const [isSms, setIsSms] = useState(0);
useEffect(() => {
console.log(isSms);
}, [isSms]);
const handleChipClick = (chipLabel) => { const handleChipClick = (chipLabel) => {
setSelectedCatChip(chipLabel); setSelectedCatChip(chipLabel);
@@ -840,7 +845,7 @@ const Createorder1 = () => {
processing: '', processing: '',
ready: '', ready: '',
remarks: '', remarks: '',
smsdelivery: 1, smsdelivery: isSms,
subcategoryid: +subCatId, subcategoryid: +subCatId,
taxamount: 0.0, taxamount: 0.0,
tenantid: tenant.tenantid, tenantid: tenant.tenantid,
@@ -978,7 +983,8 @@ const Createorder1 = () => {
try { try {
let url = let url =
searchCustList == '' searchCustList == ''
? `${process.env.REACT_APP_URL}/customers/getbytid/?tenantid=${tid}&pageno=1&pagesize=1` ? // ? `${process.env.REACT_APP_URL}/customers/getbytid/?tenantid=${tid}&pageno=1&pagesize=1`
`${process.env.REACT_APP_URL}/customers/gettenantcustomers/?tenantid=${tid}&pageno=1&pagesize=20`
: `${process.env.REACT_APP_URL}/customers/search/?tenantid=${tid}&keyword=${searchCustList}`; : `${process.env.REACT_APP_URL}/customers/search/?tenantid=${tid}&keyword=${searchCustList}`;
await axios await axios
@@ -1517,7 +1523,6 @@ const Createorder1 = () => {
label="Address" label="Address"
disabled={!isLocation} disabled={!isLocation}
id="addressAuto1" id="addressAuto1"
placeholder="Search"
fullWidth fullWidth
value={inputValue2} value={inputValue2}
onChange={(e) => setInputValue2(e.target.value)} onChange={(e) => setInputValue2(e.target.value)}
@@ -1878,7 +1883,7 @@ const Createorder1 = () => {
<TextField <TextField
id="addressAuto2" id="addressAuto2"
disabled={!isLocation} disabled={!isLocation}
placeholder="Search" label="Address"
fullWidth fullWidth
value={inputValue3} value={inputValue3}
onChange={(e) => setInputValue3(e.target.value)} onChange={(e) => setInputValue3(e.target.value)}
@@ -2194,6 +2199,15 @@ const Createorder1 = () => {
</Stack> </Stack>
</Stack> </Stack>
)} )}
<Stack direction={'row'} justifyContent={'space-between'}>
<Typography variant="h5">SMS Delivery</Typography>
<Switch
checked={isSms === 1}
onChange={(e) => {
setIsSms(e.target.checked ? 1 : 0);
}}
/>
</Stack>
<Typography variant="h5">Category</Typography> <Typography variant="h5">Category</Typography>
<Autocomplete <Autocomplete
disablePortal disablePortal

View File

@@ -329,6 +329,47 @@ export default function ordersDetails() {
row.deliverylocation.toLowerCase().includes(searchword.toLowerCase()) || row.deliverylocation.toLowerCase().includes(searchword.toLowerCase()) ||
row.ridername.toLowerCase().includes(searchword.toLowerCase()) row.ridername.toLowerCase().includes(searchword.toLowerCase())
); );
// to download ex format filtered data
const csvData = filteredOrders.map((order) => ({
tenantname: order.tenantname,
tenantcity: order.tenantcity,
tenantcontactno: order.tenantcontactno,
rider: order.rider,
orderid: order.orderid,
orderdate: order.orderdate,
deliverydate: order.deliverydate,
orderstatus: order.orderstatus,
deliverystatus: order.deliverystatus,
ordernotes: order.ordernotes,
kms: order.kms,
actualkms: order.actualkms,
assigntime: order.assigntime,
starttime: order.starttime,
arrivaltime: order.arrivaltime,
pickuptime: order.pickuptime,
deliverytime: order.deliverytime,
canceltime: order.canceltime,
deliverycharge: order.deliverycharge,
deliveryamt: order.deliveryamt,
pickupcustomer: order.pickupcustomer,
pickupcontactno: order.pickupcontactno,
pickupaddress: order.pickupaddress,
pickupsuburb: order.pickupsuburb,
pickupcity: order.pickupcity,
pickuplat: order.pickuplat,
pickuplong: order.pickuplong,
deliverycustomer: order.deliverycustomer,
deliverycontactno: order.deliverycontactno,
deliveryaddress: order.deliveryaddress,
deliverysuburb: order.deliverysuburb,
deliverylat: order.deliverylat,
deliverylong: order.deliverylong,
locationname: order.locationname,
locationsuburb: order.locationsuburb,
locationcity: order.locationcity,
locationcontactno: order.locationcontactno
}));
const handleSelectAllClick = (event) => { const handleSelectAllClick = (event) => {
if (event.target.checked) { if (event.target.checked) {
const newSelectedId = rows.map((n) => n.name); const newSelectedId = rows.map((n) => n.name);
@@ -426,17 +467,16 @@ export default function ordersDetails() {
</Stack> </Stack>
</Grid> </Grid>
<Grid item xs={8}> <Grid item xs={8}>
{' '} <Stack
<div sx={{
style={{
display: 'flex', display: 'flex',
flexDirection: 'row', flexDirection: { md: 'row', xs: 'column' },
justifyContent: 'end', justifyContent: 'end',
alignItems: 'center',
marginRight: '25px' marginRight: '25px'
}} }}
> >
<FormControl sx={{ width: 250, display: { xs: 'none', md: 'flex' } }}> <FormControl sx={{ width: 250 }}>
<OutlinedInput <OutlinedInput
inputRef={textFieldRef} inputRef={textFieldRef}
aria-describedby="header-search-text" aria-describedby="header-search-text"
@@ -476,28 +516,22 @@ export default function ordersDetails() {
<Tooltip title="Order Filter"> <Tooltip title="Order Filter">
<IconButton <IconButton
// size='large'
color="secondary" color="secondary"
variant="light" variant="light"
sx={{ sx={{
color: 'text.primary', color: 'text.primary',
bgcolor: 'grey.200', bgcolor: 'grey.200',
display: { xs: 'none', md: 'flex' }, mx: 2
ml: 2
}} }}
// aria-label="open profile"
// ref={anchorRef}
// aria-controls={open ? 'profile-grow' : undefined}
aria-haspopup="true" aria-haspopup="true"
// onClick={handleToggle}
onClick={() => setOpen(true)} onClick={() => setOpen(true)}
> >
<FilterList /> <FilterList />
</IconButton> </IconButton>
</Tooltip> </Tooltip>
</div>
<CSVExport data={csvData} filename={`Orders_Detail_${dayjs().format('YYYY-MM-DD_HHmmss')}.csv`} />
</Stack>
</Grid> </Grid>
</Grid> </Grid>
{/* <Box sx={{ bgcolor: "#eeeeee" }}> {/* <Box sx={{ bgcolor: "#eeeeee" }}>