multiple orders solved

This commit is contained in:
joshikannan
2026-05-10 12:44:44 +05:30
parent fe80659ccf
commit c882dbdcdd
2 changed files with 1727 additions and 77 deletions

File diff suppressed because it is too large Load Diff

View File

@@ -71,7 +71,7 @@ const MultipleOrders = () => {
const [appId, setAppId] = useState(0);
const [tenantLocations, setTenantlocations] = useState([]);
// const [tenantid, setTenantid] = useState(0);
const tenantid = localStorage.getItem('tenantid') || 0;
const tenantid = localStorage.getItem('tenantid');
const [locationid, setLocationid] = useState(0);
const [basePrice, setBasePrice] = useState(0);
const [pricePerKm, setPricePerKm] = useState(0);
@@ -193,6 +193,9 @@ const MultipleOrders = () => {
console.log('fetchTenantPricing error', error);
}
};
useEffect(() => {
fetchTenantPricing(tenantid);
}, [tenantid]);
// ============================================= || gettenantlocations (branches) || =============================================
const gettenantlocations = async (id) => {
try {
@@ -989,32 +992,27 @@ const MultipleOrders = () => {
spacing: 5
}}
>
{/* ===================================================== ||Business Location || ===================================================== */}
<Grid item xs={12} sx={{ width: '100%', mt: -1 }}>
<Stack
direction={{ xs: 'column', sm: 'row' }}
spacing={2}
sx={{
width: '100%',
alignItems: { xs: 'stretch', sm: 'center' },
justifyContent: 'space-between',
mb: 2
}}
>
<Stack>
<Typography variant="h3"> Create Multiple Order</Typography>
</Stack>
</Grid>
<Grid item xs={12} sx={{ width: '100%', mt: -2 }}>
<MainCard sx={{ height: '100%' }}>
<Grid container spacing={3} sx={{}}>
{/* ===================================================== || Choose App location || ===================================================== */}
<Stack sx={{ width: { xs: '100%', sm: 400 } }}>
{tenantLocations?.length === 1 ? (
{/* ===================================================== ||Business Location || ===================================================== */}
<Grid item xs={12} sm={4}>
{tenantLocations?.length == 1 ? (
<TextField
variant="outlined"
fullWidth
label="Business Location"
label={'Business Location'}
value={tenantLocations[0]?.locationname || ''}
focused
InputProps={{
style: {
color: theme.palette.primary.main
},
style: { color: theme.palette.primary.main },
startAdornment: (
<InputAdornment position="start">
<MyLocationIcon color="primary" />
@@ -1026,22 +1024,18 @@ const MultipleOrders = () => {
<Autocomplete
fullWidth
options={tenantLocations || []}
getOptionLabel={(option) => `${option.locationname} (${option.suburb})`}
getOptionLabel={(option) => `${option.locationname} (${option.suburb})` || ''}
value={locationValue}
onOpen={(event) => {
if (!appId && !tenantid) {
event.preventDefault();
OpenToast('Please select Location and Tenant first!', 'warning', 3000);
setTimeout(() => {
locationRef.current?.focus();
}, 0);
} else if (!tenantid) {
event.preventDefault();
OpenToast('Please select Tenant first!', 'warning', 3000);
setTimeout(() => {
tenantRef.current?.focus();
}, 0);
@@ -1053,19 +1047,19 @@ const MultipleOrders = () => {
setLocationValue(null);
setPickCust(null);
} else {
setLocationid(value?.locationid || 0);
setLocationid(value.locationid || 0);
setLocationValue(value);
setPickCust(value);
setPickupSlotsList(value?.slots);
}
}}
renderInput={(params) => <TextField {...params} label="Select Business Location" color="primary" />}
renderInput={(params) => <TextField {...params} label="Select Business Locations" color="primary" />}
/>
)}
</Stack>
</Stack>
</Grid>
</Grid>
</MainCard>
</Grid>
{/* ===================================================== || Pickup || ===================================================== */}
<Grid item xs={12} sx={{ width: '100%', mt: 0 }}>
<Grid container xs={12} spacing={3}>
@@ -1521,8 +1515,7 @@ const MultipleOrders = () => {
</Grid>
<Stack direction="row" justifyContent={'end'} sx={{ mt: 2, width: '100%' }}>
<Button
// disabled={dropCust.length == 0 || !pickupSlot}
disabled={dropCust.length == 0}
disabled={dropCust.length == 0 || !pickupSlot}
size="medium"
variant="outlined"
onClick={() => {