overall commit
This commit is contained in:
@@ -32,7 +32,8 @@ import {
|
||||
FormControl,
|
||||
OutlinedInput,
|
||||
InputAdornment,
|
||||
Collapse
|
||||
Collapse,
|
||||
Badge
|
||||
} from '@mui/material';
|
||||
import ClearIcon from '@mui/icons-material/Clear';
|
||||
import KeyboardArrowDownIcon from '@mui/icons-material/KeyboardArrowDown';
|
||||
@@ -64,6 +65,7 @@ import { useTheme } from '@mui/material/styles';
|
||||
import TitleCard from '../titleCard';
|
||||
import { getreportlocationsummary, gettenantlocations } from '../api/api';
|
||||
import CircularLoader from 'components/nearle_components/CircularLoader';
|
||||
import { getValueColor } from 'components/nearle_components/getValueColor';
|
||||
|
||||
function formatNumberToRupees(value) {
|
||||
return new Intl.NumberFormat('en-IN', {
|
||||
@@ -104,12 +106,20 @@ export default function OrdersReport() {
|
||||
const [totalDeliComplete, setTotalDeliComplete] = useState(0);
|
||||
const [totalDeliCancel, setTotalDeliCancel] = useState(0);
|
||||
const [searchword, setSearchword] = useState('');
|
||||
const [debouncedSearch, setDebouncedSearch] = useState('');
|
||||
const textFieldRef = useRef(null);
|
||||
const [ridersdata, setRidersdata] = useState(null);
|
||||
const [selectedLocation, setSelectedLocation] = useState(null);
|
||||
const [locationId, setLocationId] = useState(0);
|
||||
const [searchLocation, setSearchLocation] = useState('');
|
||||
|
||||
useEffect(() => {
|
||||
const handler = setTimeout(() => {
|
||||
setDebouncedSearch(searchword);
|
||||
}, 400);
|
||||
|
||||
return () => clearTimeout(handler);
|
||||
}, [searchword]);
|
||||
useEffect(() => {
|
||||
console.log('openRow', openRow);
|
||||
}, [openRow]);
|
||||
@@ -154,7 +164,7 @@ export default function OrdersReport() {
|
||||
data: rows,
|
||||
error: reportsError
|
||||
} = useQuery({
|
||||
queryKey: [startdate, enddate, locationId],
|
||||
queryKey: [startdate, enddate, locationId, debouncedSearch],
|
||||
queryFn: getreportlocationsummary
|
||||
});
|
||||
// ==============================|| getriderlocationsummary by tenid (orders summary)||============================== //
|
||||
@@ -230,7 +240,9 @@ export default function OrdersReport() {
|
||||
<Stack>
|
||||
{startdate && enddate && (
|
||||
<Stack direction="row" spacing={2} flexWrap={'wrap'} gap={1}>
|
||||
<Chip label={`Orders-${datestatus}`} color="primary" variant="light" size="small" />
|
||||
<Badge badgeContent={rows?.length || 0} color="primary">
|
||||
<Chip label={`Location-${datestatus}`} color="primary" variant="light" size="small" />
|
||||
</Badge>
|
||||
<Chip
|
||||
label={
|
||||
<Typography noWrap color="secondary">
|
||||
@@ -411,22 +423,40 @@ export default function OrdersReport() {
|
||||
{index + 1}
|
||||
</TableCell>
|
||||
<TableCell align="left">
|
||||
<Stack direction="row" sx={{ ml: -2 }}>
|
||||
{row.locationname}
|
||||
<Stack sx={{ ml: -2 }}>
|
||||
<Typography> {row.locationname}</Typography>
|
||||
<Typography variant="body2">Id : {row.locationid}</Typography>
|
||||
</Stack>
|
||||
</TableCell>
|
||||
<TableCell align="center">{row.totalorders}</TableCell>
|
||||
<TableCell align="center">{row.Orderspending}</TableCell>
|
||||
<TableCell align="center">{row.orderscompleted}</TableCell>
|
||||
<TableCell align="center">{row.orderscancelled}</TableCell>
|
||||
<TableCell align="center"> {row.deliveriespending}</TableCell>
|
||||
<TableCell align="center"> {row.deliveriescompleted}</TableCell>
|
||||
<TableCell align="center"> {row.deliveriescancelled}</TableCell>
|
||||
<TableCell align="center" sx={{ color: getValueColor(row.totalorders) }}>
|
||||
{row.totalorders}
|
||||
</TableCell>
|
||||
<TableCell align="center" sx={{ color: getValueColor(row.Orderspending) }}>
|
||||
{row.Orderspending}
|
||||
</TableCell>
|
||||
<TableCell align="center" sx={{ color: getValueColor(row.orderscompleted) }}>
|
||||
{row.orderscompleted}
|
||||
</TableCell>
|
||||
<TableCell align="center" sx={{ color: getValueColor(row.orderscancelled) }}>
|
||||
{row.orderscancelled}
|
||||
</TableCell>
|
||||
<TableCell align="center" sx={{ color: getValueColor(row.deliveriespending) }}>
|
||||
{' '}
|
||||
{row.deliveriespending}
|
||||
</TableCell>
|
||||
<TableCell align="center" sx={{ color: getValueColor(row.deliveriescompleted) }}>
|
||||
{' '}
|
||||
{row.deliveriescompleted}
|
||||
</TableCell>
|
||||
<TableCell align="center" sx={{ color: getValueColor(row.deliveriescancelled) }}>
|
||||
{' '}
|
||||
{row.deliveriescancelled}
|
||||
</TableCell>
|
||||
<TableCell align="left">
|
||||
<Tooltip title="kms" placement="top">
|
||||
<Tooltip title="Cumulative Kms" placement="top">
|
||||
<Chip
|
||||
size="small"
|
||||
label={parseFloat(row.kms).toFixed(2)}
|
||||
label={parseFloat(row.cumulativekms).toFixed(2)}
|
||||
sx={{
|
||||
color: '#f44336',
|
||||
bgcolor: '#ffcdd2',
|
||||
@@ -596,19 +626,35 @@ export default function OrdersReport() {
|
||||
)}
|
||||
</Stack>
|
||||
</TableCell>
|
||||
<TableCell align="center">{rider?.totalorders}</TableCell>
|
||||
<TableCell align="center">{rider?.pending}</TableCell>
|
||||
<TableCell align="center">{rider?.assigned}</TableCell>
|
||||
<TableCell align="center">{rider?.accepted}</TableCell>
|
||||
<TableCell align="center">{rider?.picked}</TableCell>
|
||||
<TableCell align="center">{rider?.arrived}</TableCell>
|
||||
<TableCell align="center">{rider?.skipped}</TableCell>
|
||||
<TableCell align="center">{rider?.delivered}</TableCell>
|
||||
<TableCell align="center" sx={{ color: getValueColor(rider.totalorders) }}>
|
||||
{rider?.totalorders}
|
||||
</TableCell>
|
||||
<TableCell align="center" sx={{ color: getValueColor(rider.pending) }}>
|
||||
{rider?.pending}
|
||||
</TableCell>
|
||||
<TableCell align="center" sx={{ color: getValueColor(rider.assigned) }}>
|
||||
{rider?.assigned}
|
||||
</TableCell>
|
||||
<TableCell align="center" sx={{ color: getValueColor(rider.accepted) }}>
|
||||
{rider?.accepted}
|
||||
</TableCell>
|
||||
<TableCell align="center" sx={{ color: getValueColor(rider.picked) }}>
|
||||
{rider?.picked}
|
||||
</TableCell>
|
||||
<TableCell align="center" sx={{ color: getValueColor(rider.arrived) }}>
|
||||
{rider?.arrived}
|
||||
</TableCell>
|
||||
<TableCell align="center" sx={{ color: getValueColor(rider.skipped) }}>
|
||||
{rider?.skipped}
|
||||
</TableCell>
|
||||
<TableCell align="center" sx={{ color: getValueColor(rider.delivered) }}>
|
||||
{rider?.delivered}
|
||||
</TableCell>
|
||||
<TableCell align="center">
|
||||
{/* <Tooltip title="kms" placement="top"> */}
|
||||
<Chip
|
||||
size="small"
|
||||
label={rider?.kms}
|
||||
label={rider?.cumulativekms}
|
||||
sx={{
|
||||
color: '#1976d2',
|
||||
bgcolor: '#e3f2fd',
|
||||
|
||||
Reference in New Issue
Block a user