createOrder
This commit is contained in:
@@ -40,7 +40,7 @@ import { useNavigate } from 'react-router';
|
||||
// }
|
||||
// };
|
||||
|
||||
const Createclient = () => {
|
||||
const CreateCustomer = () => {
|
||||
const theme = useTheme();
|
||||
const [selectedImage, setSelectedImage] = useState(undefined);
|
||||
const [avatar, setAvatar] = useState();
|
||||
@@ -657,4 +657,4 @@ const Createclient = () => {
|
||||
);
|
||||
};
|
||||
|
||||
export default Createclient;
|
||||
export default CreateCustomer;
|
||||
@@ -148,7 +148,7 @@ const BootstrapDialog = styled(Dialog)(({ theme }) => ({
|
||||
}
|
||||
}));
|
||||
|
||||
const Clients1 = () => {
|
||||
const Customers = () => {
|
||||
const theme = useTheme();
|
||||
const [search, setSearch] = useState('');
|
||||
const [loading, setLoading] = useState(false);
|
||||
@@ -2211,4 +2211,4 @@ const Clients1 = () => {
|
||||
);
|
||||
};
|
||||
|
||||
export default Clients1;
|
||||
export default Customers;
|
||||
@@ -114,6 +114,30 @@ const Createorder1 = () => {
|
||||
const autocompleteService = useRef(null);
|
||||
const [tenanatLocoId, setTenanatLocoId] = useState(localStorage.getItem('locationid'));
|
||||
const [isLocation, setIsLocation] = useState(false);
|
||||
const textFieldRef1 = useRef(null);
|
||||
const textFieldRef2 = useRef(null);
|
||||
|
||||
const handleOkClick1 = () => {
|
||||
// Set focus back to the text field after clicking the "OK" chip
|
||||
if (textFieldRef1.current) {
|
||||
textFieldRef1.current.focus();
|
||||
}
|
||||
};
|
||||
|
||||
const handleOkClick2 = () => {
|
||||
// Set focus back to the text field after clicking the "OK" chip
|
||||
if (textFieldRef2.current) {
|
||||
textFieldRef2.current.focus();
|
||||
}
|
||||
};
|
||||
|
||||
const top100Films = [
|
||||
{ label: 'The Shawshank Redemption', year: 1994 },
|
||||
{ label: 'The Godfather', year: 1972 },
|
||||
{ label: 'The Godfather: Part II', year: 1974 },
|
||||
{ label: 'The Dark Knight', year: 2008 },
|
||||
{ label: '12 Angry Men', year: 1957 }
|
||||
];
|
||||
|
||||
// // // ====================================================== || address (pick)|| ======================================================
|
||||
// useEffect(() => {
|
||||
@@ -467,11 +491,6 @@ const Createorder1 = () => {
|
||||
}
|
||||
};
|
||||
|
||||
useEffect(() => {
|
||||
clientdetails();
|
||||
// clientdetailsbusiness();
|
||||
}, [searchCustList.length > 3, searchCustList == '']);
|
||||
|
||||
useEffect(() => {
|
||||
if (timeslotarr[0]) {
|
||||
let arr = [];
|
||||
@@ -912,6 +931,7 @@ const Createorder1 = () => {
|
||||
} else {
|
||||
try {
|
||||
const createRes = await axios.post(`${process.env.REACT_APP_URL2}/orders/createorder`, arr);
|
||||
// const createRes = await axios.post(`${process.env.REACT_APP_URL}/orders/createorder`, arr);
|
||||
if (createRes.data.status) {
|
||||
console.log('createRes', createRes);
|
||||
enqueueSnackbar('Order Created Successfully', {
|
||||
@@ -958,7 +978,7 @@ const Createorder1 = () => {
|
||||
try {
|
||||
let url =
|
||||
searchCustList == ''
|
||||
? `${process.env.REACT_APP_URL}/customers/getbytid/?tenantid=${tid}&pageno=1&pagesize=10`
|
||||
? `${process.env.REACT_APP_URL}/customers/getbytid/?tenantid=${tid}&pageno=1&pagesize=1`
|
||||
: `${process.env.REACT_APP_URL}/customers/search/?tenantid=${tid}&keyword=${searchCustList}`;
|
||||
|
||||
await axios
|
||||
@@ -989,6 +1009,11 @@ const Createorder1 = () => {
|
||||
setLoading2(false);
|
||||
}
|
||||
};
|
||||
useEffect(() => {
|
||||
console.log('clientdetails, by search');
|
||||
clientdetails();
|
||||
// clientdetailsbusiness();
|
||||
}, [searchCustList.length > 3, searchCustList == '']);
|
||||
// ========================================================= || clientdetailsbusiness || =========================================================
|
||||
const clientdetailsbusiness = async () => {
|
||||
setLoading2(true);
|
||||
@@ -1325,7 +1350,9 @@ const Createorder1 = () => {
|
||||
<Grid container spacing={2}>
|
||||
<Grid item xs={12}>
|
||||
<Stack direction={'row'} justifyContent={'space-between'}>
|
||||
<Typography variant="h5">Pickup</Typography>
|
||||
<Typography variant="h5" sx={{ mb: 0 }}>
|
||||
Pickup Details
|
||||
</Typography>
|
||||
<Stack direction={'row'} spacing={1} alignItems={'center'}>
|
||||
{/* <Typography>Customer</Typography>
|
||||
<Switch
|
||||
@@ -1344,7 +1371,7 @@ const Createorder1 = () => {
|
||||
}}
|
||||
/>
|
||||
<Typography>Business</Typography> */}
|
||||
<Button
|
||||
{/* <Button
|
||||
variant="outlined"
|
||||
sx={{
|
||||
'&:hover': {
|
||||
@@ -1366,207 +1393,71 @@ const Createorder1 = () => {
|
||||
}}
|
||||
>
|
||||
Saved Locations
|
||||
</Button>
|
||||
</Button> */}
|
||||
</Stack>
|
||||
</Stack>
|
||||
|
||||
{/* <Autocomplete
|
||||
id="free-solo-demo"
|
||||
sx={{ mt: 2 }}
|
||||
// options={tenantlocationlist}
|
||||
options={pickupswitch ? clientdetailbusinessarr : clientdetailarr}
|
||||
renderInput={(params) => <TextField {...params} label="Choose Location" />}
|
||||
onChange={(e, val) => {
|
||||
console.log(pickupswitch ? 'clientdetailbusinessarr value' : 'clientdetailarr value', val);
|
||||
if (val) {
|
||||
// clientdetails(val.tenantid)
|
||||
if (clientinfo.customerid == val.customerid) {
|
||||
opentoast('choose different Location', 'warning');
|
||||
setTenantinfo({});
|
||||
} else {
|
||||
setTenantinfo(val);
|
||||
}
|
||||
} else {
|
||||
setTenantinfo({});
|
||||
}
|
||||
|
||||
console.log(val);
|
||||
setStartPoint({ latitude: val.latitude, longitude: val.longitude });
|
||||
}}
|
||||
noOptionsText={
|
||||
// <Button>ok</Button>
|
||||
<Stack direction={'row'} justifyContent={'space-between'} alignItems={'center'}>
|
||||
<Typography>No options</Typography>
|
||||
{!pickupswitch && (
|
||||
<Button
|
||||
variant="outlined"
|
||||
onClick={() => {
|
||||
setOpen4(true);
|
||||
}}
|
||||
color="success"
|
||||
startIcon={<PlusOutlined />}
|
||||
>
|
||||
Create Customer
|
||||
</Button>
|
||||
)}
|
||||
</Stack>
|
||||
}
|
||||
/> */}
|
||||
<Stack spacing={1.25} sx={{ mt: 2 }}>
|
||||
{addId1 == 0 ? (
|
||||
// <Autocomplete
|
||||
// id="google-map-demo"
|
||||
// fullWidth
|
||||
// getOptionLabel={(option) => (typeof option === 'string' ? option : option.description)}
|
||||
// filterOptions={(x) => x}
|
||||
// options={options}
|
||||
// // options={pickCust}
|
||||
// autoComplete
|
||||
// includeInputInList
|
||||
// filterSelectedOptions
|
||||
// value={value}
|
||||
// // value={pickCust.address}
|
||||
// noOptionsText="No locations"
|
||||
// onChange={(event, newValue, reason) => {
|
||||
// if (reason == 'clear') {
|
||||
// setValue(null);
|
||||
// }
|
||||
// console.log('pick location', newValue);
|
||||
// // setOptions(newValue ? [newValue, ...options] : options);
|
||||
// setValue(newValue);
|
||||
// setAddress(newValue.description);
|
||||
// setPickCust({ ...pickCust, address: newValue.description });
|
||||
// }}
|
||||
// onInputChange={(event, newInputValue) => {
|
||||
// setInputValue(newInputValue);
|
||||
// }}
|
||||
// renderInput={(params) => <TextField {...params} placeholder="Address" fullWidth />}
|
||||
// renderOption={(props, option) => {
|
||||
// const matches = option.structured_formatting.main_text_matched_substrings || [];
|
||||
// const parts = parse(
|
||||
// option.structured_formatting.main_text,
|
||||
// matches.map((match) => [match.offset, match.offset + match.length])
|
||||
// );
|
||||
|
||||
// return (
|
||||
// <li {...props}>
|
||||
// <Grid container alignItems="center">
|
||||
// <Grid item sx={{ display: 'flex', width: 44 }}>
|
||||
// <LocationOnIcon sx={{ color: 'text.secondary' }} />
|
||||
// </Grid>
|
||||
// <Grid item sx={{ width: 'calc(100% - 44px)', wordWrap: 'break-word' }}>
|
||||
// {parts.map((part, index) => (
|
||||
// <Box key={index} component="span" sx={{ fontWeight: part.highlight ? 'bold' : 'regular' }}>
|
||||
// {part.text}
|
||||
// </Box>
|
||||
// ))}
|
||||
// <Typography variant="body2" color="text.secondary">
|
||||
// {option.structured_formatting.secondary_text}
|
||||
// </Typography>
|
||||
// </Grid>
|
||||
// </Grid>
|
||||
// </li>
|
||||
// );
|
||||
// }}
|
||||
// />
|
||||
<div>
|
||||
<TextField
|
||||
disabled={!isLocation}
|
||||
id="addressAuto1"
|
||||
placeholder="Search"
|
||||
fullWidth
|
||||
value={inputValue2}
|
||||
onChange={(e) => setInputValue2(e.target.value)}
|
||||
InputProps={{
|
||||
endAdornment: (
|
||||
<IconButton
|
||||
onClick={() => {
|
||||
setInputValue2('');
|
||||
setPickCust({
|
||||
...pickCust,
|
||||
doorno: '',
|
||||
suburb: '',
|
||||
city: '',
|
||||
postcode: '',
|
||||
landmark: ''
|
||||
});
|
||||
setShowDistance(false);
|
||||
setStartPoint({ latitude: 0, longitude: 0 });
|
||||
}}
|
||||
size="small"
|
||||
>
|
||||
<CloseIcon />
|
||||
</IconButton>
|
||||
)
|
||||
}}
|
||||
/>
|
||||
</div>
|
||||
) : (
|
||||
{/* new1 */}
|
||||
<Autocomplete
|
||||
disabled={!isLocation}
|
||||
fullWidth
|
||||
disablePortal
|
||||
id="combo-box-demo"
|
||||
// options={customerlist}
|
||||
options={clientdetailarr}
|
||||
getOptionLabel={(option) => `${option.firstname} (${option.contactno})`}
|
||||
sx={{ mt: 2, mb: 1 }}
|
||||
renderInput={(params) => (
|
||||
<TextField
|
||||
InputProps={{
|
||||
endAdornment: (
|
||||
<IconButton
|
||||
onClick={() => {
|
||||
setAddId1(0);
|
||||
setPickCust({
|
||||
...pickCust,
|
||||
firstname: '',
|
||||
contactno: '',
|
||||
doorno: '',
|
||||
suburb: '',
|
||||
city: '',
|
||||
postcode: '',
|
||||
landmark: ''
|
||||
});
|
||||
setShowDistance(false);
|
||||
setStartPoint({ latitude: 0, longitude: 0 });
|
||||
}}
|
||||
>
|
||||
<ClearIcon />
|
||||
</IconButton>
|
||||
)
|
||||
}}
|
||||
variant="outlined"
|
||||
placeholder="Select"
|
||||
value={pickCust.address}
|
||||
{...params}
|
||||
label="Search"
|
||||
onChange={(e) => {
|
||||
setPickCust({ ...pickCust, address: e.target.value });
|
||||
if (e.target.value == '') {
|
||||
setAddId1(0);
|
||||
setShowDistance(false);
|
||||
setStartPoint({ latitude: 0, longitude: 0 });
|
||||
setSearchCustList(e.target.value);
|
||||
}}
|
||||
InputProps={{
|
||||
...params.InputProps,
|
||||
inputProps: {
|
||||
...params.inputProps,
|
||||
maxLength: 10
|
||||
}
|
||||
}}
|
||||
/>
|
||||
)}
|
||||
</Stack>
|
||||
onChange={(e, val, reason) => {
|
||||
if (val) {
|
||||
console.log('pickcustNew', val);
|
||||
setStartPoint({ latitude: val.latitude, longitude: val.longitude });
|
||||
setPickCust(val);
|
||||
setAddId1(1);
|
||||
setSearchCustList('');
|
||||
}
|
||||
if (reason == 'clear') {
|
||||
setSearchCustList('');
|
||||
}
|
||||
}}
|
||||
noOptionsText={
|
||||
/^[0-9]{10}$/.test(searchCustList) ? (
|
||||
<Stack sx={{ width: '100%', display: 'flex', alignItems: 'end', justifyContent: 'end' }}>
|
||||
<Chip
|
||||
label={'OK'}
|
||||
sx={{
|
||||
width: 50,
|
||||
cursor: 'pointer',
|
||||
'&:hover': { background: theme.palette.primary.main, color: 'white' }
|
||||
}}
|
||||
onClick={() => {
|
||||
setPickCust({ ...pickCust, contactno: searchCustList });
|
||||
handleOkClick1();
|
||||
setSearchCustList('');
|
||||
}}
|
||||
/>
|
||||
</Stack>
|
||||
) : null
|
||||
}
|
||||
/>
|
||||
</Grid>
|
||||
|
||||
<Grid item xs={12} sx={{}}>
|
||||
<Typography variant="h5" sx={{ my: 2 }}>
|
||||
Pickup Details
|
||||
</Typography>
|
||||
<Grid container spacing={4}>
|
||||
{/* ====================================== ||Contact Name (pick) || ====================================== */}
|
||||
<Grid item xs={6}>
|
||||
<TextField
|
||||
disabled={!isLocation}
|
||||
fullWidth
|
||||
InputProps={{
|
||||
startAdornment: (
|
||||
<IconButton>
|
||||
<FaUser />
|
||||
</IconButton>
|
||||
)
|
||||
}}
|
||||
variant="outlined"
|
||||
label="Contact Name"
|
||||
value={pickCust.firstname}
|
||||
onChange={(e) => {
|
||||
setPickCust({ ...pickCust, firstname: e.target.value });
|
||||
}}
|
||||
/>
|
||||
</Grid>
|
||||
{/* ====================================== ||Contact Number(pick) || ====================================== */}
|
||||
<Grid item xs={6}>
|
||||
<TextField
|
||||
@@ -1593,6 +1484,108 @@ const Createorder1 = () => {
|
||||
}}
|
||||
/>
|
||||
</Grid>
|
||||
{/* ====================================== ||Contact Name (pick) || ====================================== */}
|
||||
<Grid item xs={6}>
|
||||
<TextField
|
||||
inputRef={textFieldRef1}
|
||||
disabled={!isLocation}
|
||||
fullWidth
|
||||
InputProps={{
|
||||
startAdornment: (
|
||||
<IconButton>
|
||||
<FaUser />
|
||||
</IconButton>
|
||||
)
|
||||
}}
|
||||
variant="outlined"
|
||||
label="Contact Name"
|
||||
value={pickCust.firstname}
|
||||
onChange={(e) => {
|
||||
setPickCust({ ...pickCust, firstname: e.target.value });
|
||||
}}
|
||||
/>
|
||||
</Grid>
|
||||
|
||||
{/* ====================================== || Address (pick) || ====================================== */}
|
||||
|
||||
<Grid item xs={12}>
|
||||
<Stack spacing={1.25} sx={{ mt: 0 }}>
|
||||
{addId1 == 0 ? (
|
||||
<div>
|
||||
<TextField
|
||||
variant="outlined"
|
||||
label="Address"
|
||||
disabled={!isLocation}
|
||||
id="addressAuto1"
|
||||
placeholder="Search"
|
||||
fullWidth
|
||||
value={inputValue2}
|
||||
onChange={(e) => setInputValue2(e.target.value)}
|
||||
InputProps={{
|
||||
endAdornment: (
|
||||
<IconButton
|
||||
onClick={() => {
|
||||
setInputValue2('');
|
||||
setPickCust({
|
||||
...pickCust,
|
||||
doorno: '',
|
||||
suburb: '',
|
||||
city: '',
|
||||
postcode: '',
|
||||
landmark: ''
|
||||
});
|
||||
setShowDistance(false);
|
||||
setStartPoint({ latitude: 0, longitude: 0 });
|
||||
}}
|
||||
size="small"
|
||||
>
|
||||
<CloseIcon />
|
||||
</IconButton>
|
||||
)
|
||||
}}
|
||||
/>
|
||||
</div>
|
||||
) : (
|
||||
<TextField
|
||||
InputProps={{
|
||||
endAdornment: (
|
||||
<IconButton
|
||||
onClick={() => {
|
||||
setAddId1(0);
|
||||
setPickCust({
|
||||
...pickCust,
|
||||
// firstname: '',
|
||||
// contactno: '',
|
||||
doorno: '',
|
||||
suburb: '',
|
||||
city: '',
|
||||
postcode: '',
|
||||
landmark: ''
|
||||
});
|
||||
setShowDistance(false);
|
||||
setStartPoint({ latitude: 0, longitude: 0 });
|
||||
}}
|
||||
>
|
||||
<ClearIcon />
|
||||
</IconButton>
|
||||
)
|
||||
}}
|
||||
variant="outlined"
|
||||
placeholder="Select"
|
||||
value={pickCust.address}
|
||||
onChange={(e) => {
|
||||
setPickCust({ ...pickCust, address: e.target.value });
|
||||
if (e.target.value == '') {
|
||||
setAddId1(0);
|
||||
setShowDistance(false);
|
||||
setStartPoint({ latitude: 0, longitude: 0 });
|
||||
}
|
||||
}}
|
||||
/>
|
||||
)}
|
||||
</Stack>
|
||||
</Grid>
|
||||
|
||||
{/* ====================================== ||Door No (pick) || ====================================== */}
|
||||
<Grid item xs={6}>
|
||||
<TextField
|
||||
@@ -1724,7 +1717,9 @@ const Createorder1 = () => {
|
||||
<Grid container spacing={2} sx={{ height: '100%' }}>
|
||||
<Grid item xs={12} sx={{ height: '100%' }}>
|
||||
<Stack direction={'row'} justifyContent={'space-between'}>
|
||||
<Typography variant="h5">Drop</Typography>
|
||||
<Typography variant="h5" sx={{ mb: 2 }}>
|
||||
Drop Details
|
||||
</Typography>
|
||||
<Stack direction={'row'} alignItems={'center'}>
|
||||
{/* <Typography>Customer</Typography> */}
|
||||
{/* <Switch
|
||||
@@ -1741,7 +1736,7 @@ const Createorder1 = () => {
|
||||
size="small"
|
||||
/>
|
||||
<Typography>Business</Typography> */}
|
||||
<Button
|
||||
{/* <Button
|
||||
variant="outlined"
|
||||
sx={{
|
||||
'&:hover': {
|
||||
@@ -1762,201 +1757,75 @@ const Createorder1 = () => {
|
||||
}}
|
||||
>
|
||||
Saved Locations
|
||||
</Button>
|
||||
</Button> */}
|
||||
</Stack>
|
||||
</Stack>
|
||||
{/* <Autocomplete
|
||||
id="free-solo-demo"
|
||||
sx={{ mt: 2 }}
|
||||
// options={clientdetailarr}
|
||||
options={dropswitch ? clientdetailbusinessarr : clientdetailarr}
|
||||
renderInput={(params) => <TextField {...params} label="Choose Location" />}
|
||||
onChange={(e, val) => {
|
||||
if (val) {
|
||||
if (tenantinfo.customerid == val.customerid) {
|
||||
opentoast('choose different Location', 'warning');
|
||||
setClientinfo({});
|
||||
} else {
|
||||
setClientinfo(val);
|
||||
}
|
||||
} else {
|
||||
setClientinfo({});
|
||||
}
|
||||
|
||||
console.log(val);
|
||||
setEndPoint({ latitude: val.latitude, longitude: val.longitude });
|
||||
}}
|
||||
noOptionsText={
|
||||
// <Button>ok</Button>
|
||||
<Stack direction={'row'} justifyContent={'space-between'} alignItems={'center'}>
|
||||
<Typography>No options</Typography>
|
||||
{!dropswitch && (
|
||||
<Button
|
||||
variant="outlined"
|
||||
onClick={() => {
|
||||
setOpen4(true);
|
||||
}}
|
||||
color="success"
|
||||
startIcon={<PlusOutlined />}
|
||||
>
|
||||
Create Customer
|
||||
</Button>
|
||||
)}
|
||||
</Stack>
|
||||
}
|
||||
/> */}
|
||||
<Stack spacing={1.25} sx={{ mt: 2 }}>
|
||||
{addId2 == 0 ? (
|
||||
// <Autocomplete
|
||||
// id="google-map-demo"
|
||||
// fullWidth
|
||||
// getOptionLabel={(option) => (typeof option === 'string' ? option : option.description)}
|
||||
// filterOptions={(x) => x}
|
||||
// options={options1}
|
||||
// autoComplete
|
||||
// includeInputInList
|
||||
// filterSelectedOptions
|
||||
// value={value1}
|
||||
// // value={dropCust.address}
|
||||
// noOptionsText="No locations"
|
||||
// onChange={(event, newValue) => {
|
||||
// setOptions1(newValue ? [newValue, ...options1] : options1);
|
||||
// setValue1(newValue);
|
||||
// console.log(newValue);
|
||||
// setAddress1(newValue.description);
|
||||
// setDropCust({ ...dropCust, address: newValue.description });
|
||||
// }}
|
||||
// onInputChange={(event, newInputValue) => {
|
||||
// setInputValue1(newInputValue);
|
||||
// }}
|
||||
// renderInput={(params) => <TextField {...params} label="Address" fullWidth />}
|
||||
// renderOption={(props, option) => {
|
||||
// const matches = option.structured_formatting.main_text_matched_substrings || [];
|
||||
// const parts = parse(
|
||||
// option.structured_formatting.main_text,
|
||||
// matches.map((match) => [match.offset, match.offset + match.length])
|
||||
// );
|
||||
|
||||
// return (
|
||||
// <li {...props}>
|
||||
// <Grid container alignItems="center">
|
||||
// <Grid item sx={{ display: 'flex', width: 44 }}>
|
||||
// <LocationOnIcon sx={{ color: 'text.secondary' }} />
|
||||
// </Grid>
|
||||
// <Grid item sx={{ width: 'calc(100% - 44px)', wordWrap: 'break-word' }}>
|
||||
// {parts.map((part, index) => (
|
||||
// <Box key={index} component="span" sx={{ fontWeight: part.highlight ? 'bold' : 'regular' }}>
|
||||
// {part.text}
|
||||
// </Box>
|
||||
// ))}
|
||||
// <Typography variant="body2" color="text.secondary">
|
||||
// {option.structured_formatting.secondary_text}
|
||||
// </Typography>
|
||||
// </Grid>
|
||||
// </Grid>
|
||||
// </li>
|
||||
// );
|
||||
// }}
|
||||
// />
|
||||
<div>
|
||||
<TextField
|
||||
id="addressAuto2"
|
||||
disabled={!isLocation}
|
||||
placeholder="Search"
|
||||
fullWidth
|
||||
value={inputValue3}
|
||||
onChange={(e) => setInputValue3(e.target.value)}
|
||||
InputProps={{
|
||||
endAdornment: (
|
||||
<IconButton
|
||||
onClick={() => {
|
||||
setInputValue3('');
|
||||
setDropCust({
|
||||
...dropCust,
|
||||
doorno: '',
|
||||
suburb: '',
|
||||
city: '',
|
||||
postcode: '',
|
||||
landmark: ''
|
||||
});
|
||||
setShowDistance(false);
|
||||
setEndPoint({ latitude: 0, longitude: 0 });
|
||||
}}
|
||||
size="small"
|
||||
>
|
||||
<CloseIcon />
|
||||
</IconButton>
|
||||
)
|
||||
}}
|
||||
/>
|
||||
</div>
|
||||
) : (
|
||||
{/* new2 */}
|
||||
<Autocomplete
|
||||
disabled={!isLocation}
|
||||
fullWidth
|
||||
disablePortal
|
||||
id="combo-box-demo"
|
||||
// options={customerlist}
|
||||
options={clientdetailarr}
|
||||
getOptionLabel={(option) => `${option.firstname} (${option.contactno})`}
|
||||
sx={{ mt: 0, mb: 1 }}
|
||||
renderInput={(params) => (
|
||||
<TextField
|
||||
disabled={!isLocation}
|
||||
InputProps={{
|
||||
endAdornment: (
|
||||
<IconButton
|
||||
onClick={() => {
|
||||
setAddId2(0);
|
||||
setDropCust({
|
||||
...dropCust,
|
||||
firstname: '',
|
||||
contactno: '',
|
||||
doorno: '',
|
||||
suburb: '',
|
||||
city: '',
|
||||
postcode: '',
|
||||
landmark: ''
|
||||
});
|
||||
setShowDistance(false);
|
||||
setEndPoint({ latitude: 0, longitude: 0 });
|
||||
}}
|
||||
>
|
||||
<ClearIcon />
|
||||
</IconButton>
|
||||
)
|
||||
}}
|
||||
variant="outlined"
|
||||
placeholder="Select"
|
||||
value={dropCust.address}
|
||||
{...params}
|
||||
label="Search"
|
||||
onChange={(e) => {
|
||||
setPickCust({ ...dropCust, address: e.target.value });
|
||||
if (e.target.value == '') {
|
||||
setAddId2(0);
|
||||
setShowDistance(false);
|
||||
setEndPoint({ latitude: 0, longitude: 0 });
|
||||
setSearchCustList(e.target.value);
|
||||
}}
|
||||
InputProps={{
|
||||
...params.InputProps,
|
||||
inputProps: {
|
||||
...params.inputProps,
|
||||
maxLength: 10
|
||||
}
|
||||
}}
|
||||
/>
|
||||
)}
|
||||
</Stack>
|
||||
onChange={(e, val, reason) => {
|
||||
if (val) {
|
||||
if (pickCust.customerid === val.customerid) {
|
||||
opentoast('Select Another Customer', 'error');
|
||||
setSearchCustList('');
|
||||
} else {
|
||||
console.log('DropClient', val);
|
||||
setDropCust(val);
|
||||
setEndPoint({ latitude: val.latitude, longitude: val.longitude });
|
||||
setAddId2(1);
|
||||
}
|
||||
}
|
||||
if (reason == 'clear') {
|
||||
setSearchCustList('');
|
||||
}
|
||||
}}
|
||||
noOptionsText={
|
||||
/^[0-9]{10}$/.test(searchCustList) ? (
|
||||
<Stack sx={{ width: '100%', display: 'flex', alignItems: 'end', justifyContent: 'end' }}>
|
||||
<Chip
|
||||
label={'OK'}
|
||||
sx={{
|
||||
width: 50,
|
||||
cursor: 'pointer',
|
||||
'&:hover': { background: theme.palette.primary.main, color: 'white' }
|
||||
}}
|
||||
onClick={() => {
|
||||
setDropCust({ ...dropCust, contactno: searchCustList });
|
||||
handleOkClick2();
|
||||
setSearchCustList('');
|
||||
}}
|
||||
/>
|
||||
</Stack>
|
||||
) : null
|
||||
}
|
||||
/>
|
||||
</Grid>
|
||||
|
||||
<Grid item xs={12}>
|
||||
<Typography variant="h5" sx={{ my: 2 }}>
|
||||
Drop Details
|
||||
</Typography>
|
||||
<Grid container spacing={4}>
|
||||
{/* ====================================== ||Contact Name (drop) || ====================================== */}
|
||||
<Grid item xs={6}>
|
||||
<TextField
|
||||
disabled={!isLocation}
|
||||
fullWidth
|
||||
variant="outlined"
|
||||
label="Contact Name"
|
||||
InputProps={{
|
||||
startAdornment: (
|
||||
<IconButton>
|
||||
<FaUser />
|
||||
</IconButton>
|
||||
)
|
||||
}}
|
||||
value={dropCust.firstname}
|
||||
onChange={(e) => {
|
||||
setDropCust({ ...dropCust, firstname: e.target.value });
|
||||
}}
|
||||
/>
|
||||
</Grid>
|
||||
{/* ====================================== ||Contact Number (drop) || ====================================== */}
|
||||
<Grid item xs={6}>
|
||||
<TextField
|
||||
@@ -1980,6 +1849,105 @@ const Createorder1 = () => {
|
||||
}}
|
||||
/>
|
||||
</Grid>
|
||||
{/* ====================================== ||Contact Name (drop) || ====================================== */}
|
||||
<Grid item xs={6}>
|
||||
<TextField
|
||||
inputRef={textFieldRef2}
|
||||
disabled={!isLocation}
|
||||
fullWidth
|
||||
variant="outlined"
|
||||
label="Contact Name"
|
||||
InputProps={{
|
||||
startAdornment: (
|
||||
<IconButton>
|
||||
<FaUser />
|
||||
</IconButton>
|
||||
)
|
||||
}}
|
||||
value={dropCust.firstname}
|
||||
onChange={(e) => {
|
||||
setDropCust({ ...dropCust, firstname: e.target.value });
|
||||
}}
|
||||
/>
|
||||
</Grid>
|
||||
|
||||
<Grid item xs={12}>
|
||||
<Stack spacing={1.25} sx={{ mt: 0 }}>
|
||||
{addId2 == 0 ? (
|
||||
<div>
|
||||
<TextField
|
||||
id="addressAuto2"
|
||||
disabled={!isLocation}
|
||||
placeholder="Search"
|
||||
fullWidth
|
||||
value={inputValue3}
|
||||
onChange={(e) => setInputValue3(e.target.value)}
|
||||
InputProps={{
|
||||
endAdornment: (
|
||||
<IconButton
|
||||
onClick={() => {
|
||||
setInputValue3('');
|
||||
setDropCust({
|
||||
...dropCust,
|
||||
doorno: '',
|
||||
suburb: '',
|
||||
city: '',
|
||||
postcode: '',
|
||||
landmark: ''
|
||||
});
|
||||
setShowDistance(false);
|
||||
setEndPoint({ latitude: 0, longitude: 0 });
|
||||
}}
|
||||
size="small"
|
||||
>
|
||||
<CloseIcon />
|
||||
</IconButton>
|
||||
)
|
||||
}}
|
||||
/>
|
||||
</div>
|
||||
) : (
|
||||
<TextField
|
||||
disabled={!isLocation}
|
||||
InputProps={{
|
||||
endAdornment: (
|
||||
<IconButton
|
||||
onClick={() => {
|
||||
setAddId2(0);
|
||||
setDropCust({
|
||||
...dropCust,
|
||||
firstname: '',
|
||||
contactno: '',
|
||||
doorno: '',
|
||||
suburb: '',
|
||||
city: '',
|
||||
postcode: '',
|
||||
landmark: ''
|
||||
});
|
||||
setShowDistance(false);
|
||||
setEndPoint({ latitude: 0, longitude: 0 });
|
||||
}}
|
||||
>
|
||||
<ClearIcon />
|
||||
</IconButton>
|
||||
)
|
||||
}}
|
||||
variant="outlined"
|
||||
placeholder="Select"
|
||||
value={dropCust.address}
|
||||
onChange={(e) => {
|
||||
setPickCust({ ...dropCust, address: e.target.value });
|
||||
if (e.target.value == '') {
|
||||
setAddId2(0);
|
||||
setShowDistance(false);
|
||||
setEndPoint({ latitude: 0, longitude: 0 });
|
||||
}
|
||||
}}
|
||||
/>
|
||||
)}
|
||||
</Stack>
|
||||
</Grid>
|
||||
|
||||
{/* ====================================== ||Door No (drop) || ====================================== */}
|
||||
<Grid item xs={6}>
|
||||
<TextField
|
||||
@@ -2286,10 +2254,13 @@ const Createorder1 = () => {
|
||||
<Grid container>
|
||||
<Grid item xs={12}>
|
||||
<TextField
|
||||
focused
|
||||
variant="outlined"
|
||||
id="outlined-multiline-static"
|
||||
sx={{ width: '100%', height: '100%', mb: 2 }}
|
||||
multiline
|
||||
rows={1}
|
||||
label="Notes"
|
||||
placeholder="Notes"
|
||||
value={otherinstructions}
|
||||
onChange={(e) => setOtherinstructions(e.target.value)}
|
||||
|
||||
2559
src/pages/nearle/orders/rough.js
Normal file
2559
src/pages/nearle/orders/rough.js
Normal file
File diff suppressed because it is too large
Load Diff
@@ -17,7 +17,7 @@ const SamplePage = Loadable(lazy(() => import('pages/extra-pages/sample-page')))
|
||||
const Login = Loadable(lazy(() => import('pages/nearle/login')));
|
||||
const Dashboard = Loadable(lazy(() => import('pages/nearle/dashboard')));
|
||||
|
||||
const Client1 = Loadable(lazy(() => import('pages/nearle/clients/clients1')));
|
||||
const Customers = Loadable(lazy(() => import('pages/nearle/clients/customers')));
|
||||
|
||||
const Orders = Loadable(lazy(() => import('pages/nearle/orders/orders')));
|
||||
const Details = Loadable(lazy(() => import('pages/nearle/orders/details')));
|
||||
@@ -25,7 +25,7 @@ const Details = Loadable(lazy(() => import('pages/nearle/orders/details')));
|
||||
const Accountsettings = Loadable(lazy(() => import('pages/nearle/accountsettings')));
|
||||
|
||||
// const Createorder = Loadable(lazy(() => import('pages/nearle/orders/createorder')));
|
||||
const Createclient = Loadable(lazy(() => import('pages/nearle/clients/createclient')));
|
||||
const Createclient = Loadable(lazy(() => import('pages/nearle/clients/createCustomer')));
|
||||
|
||||
const Createorder1 = Loadable(lazy(() => import('pages/nearle/orders/createorder1')));
|
||||
|
||||
@@ -57,11 +57,11 @@ const MainRoutes = {
|
||||
},
|
||||
{
|
||||
path: 'customers',
|
||||
element: <Client1 />
|
||||
element: <Customers />
|
||||
},
|
||||
// {
|
||||
// path: 'clients1',
|
||||
// element: <Client1 />
|
||||
// element: <Customers />
|
||||
// },
|
||||
{
|
||||
path: 'orders',
|
||||
|
||||
Reference in New Issue
Block a user