Feature/change any file
This commit is contained in:
@@ -10,36 +10,37 @@ const CarCode = ({ carCode, setCarCode, inputValueDefault = "", error, multiple
|
||||
const [loading, setLoading] = useState(false);
|
||||
const requestServer = useRequest();
|
||||
|
||||
const fetchCarCodes = (inputValue, controller) => {
|
||||
const debouncer = debounce((query) => {
|
||||
if (!query || query?.length < 3) {
|
||||
setOptions([]);
|
||||
return;
|
||||
}
|
||||
setLoading(true);
|
||||
requestServer(`${GET_CAR_LIST_SEARCH}?machine_code=${query}`, "get", {
|
||||
requestOptions: { signal: controller.signal },
|
||||
})
|
||||
.then((response) => {
|
||||
const combinedArray = carCode ? [...carCode, ...response.data.data] : [...response.data.data];
|
||||
const uniqueArray = Array.from(new Map(combinedArray.map((item) => [item.id, item])).values());
|
||||
setOptions(uniqueArray || []);
|
||||
})
|
||||
.catch(() => {
|
||||
setOptions([]);
|
||||
})
|
||||
.finally(() => {
|
||||
setLoading(false);
|
||||
});
|
||||
}, 500);
|
||||
debouncer(inputValue);
|
||||
};
|
||||
|
||||
useEffect(() => {
|
||||
const fetchCarCodes = (inputValue, controller) => {
|
||||
const debouncer = debounce((query) => {
|
||||
if (!query || query?.length < 3) {
|
||||
setOptions([]);
|
||||
return;
|
||||
}
|
||||
setLoading(true);
|
||||
requestServer(`${GET_CAR_LIST_SEARCH}?machine_code=${query}`, "get", {
|
||||
requestOptions: { signal: controller.signal },
|
||||
})
|
||||
.then((response) => {
|
||||
const combinedArray = carCode ? [...carCode, ...response.data.data] : [...response.data.data];
|
||||
const uniqueArray = Array.from(new Map(combinedArray.map((item) => [item.id, item])).values());
|
||||
setOptions(uniqueArray || []);
|
||||
})
|
||||
.catch(() => {
|
||||
setOptions([]);
|
||||
})
|
||||
.finally(() => {
|
||||
setLoading(false);
|
||||
});
|
||||
}, 500);
|
||||
debouncer(inputValue);
|
||||
};
|
||||
|
||||
const controller = new AbortController();
|
||||
fetchCarCodes(inputValue, controller);
|
||||
return () => controller.abort();
|
||||
}, [inputValue]);
|
||||
|
||||
return (
|
||||
<Autocomplete
|
||||
multiple={multiple}
|
||||
@@ -50,7 +51,7 @@ const CarCode = ({ carCode, setCarCode, inputValueDefault = "", error, multiple
|
||||
}}
|
||||
inputValue={inputValue}
|
||||
onInputChange={(event, newInputValue) => {
|
||||
setInputValue(newInputValue || ""); // Prevent inputValue from being null or undefined
|
||||
setInputValue(newInputValue || "");
|
||||
}}
|
||||
options={options}
|
||||
getOptionLabel={(option) => {
|
||||
|
||||
@@ -61,7 +61,8 @@ const DataTable_Main = (props) => {
|
||||
}
|
||||
params.set("sorting", JSON.stringify(sortData));
|
||||
return `${table_url}?${params}`;
|
||||
}, [table_url, filterData, pagination, columns, sortData, specialFilter]);
|
||||
}, [table_url, filterData, pagination, sortData, specialFilter]);
|
||||
|
||||
const fetcher = async (url) => {
|
||||
try {
|
||||
const response = await request(url);
|
||||
|
||||
@@ -122,8 +122,8 @@ const MapInteraction = ({ setValue, startLat, startLng }) => {
|
||||
zIndex: 1000,
|
||||
}}
|
||||
>
|
||||
<Button variant="contained" onClick={handleUnlockMarker}>
|
||||
ویرایش
|
||||
<Button variant="contained" color="warning" onClick={handleUnlockMarker}>
|
||||
تغییر مکان
|
||||
</Button>
|
||||
</Box>
|
||||
)}
|
||||
|
||||
@@ -73,7 +73,7 @@ const MapInteraction = ({ setValue, startLat, startLng, endLat, endLng }) => {
|
||||
{ lat: startLat, lng: startLng },
|
||||
{ lat: endLat, lng: endLng },
|
||||
],
|
||||
{ paddingTopLeft: [16, 16], paddingBottomRight: [16, 130] }
|
||||
{ paddingTopLeft: [64, 64], paddingBottomRight: [64, 64] }
|
||||
);
|
||||
}
|
||||
}, [startLat, map, endLng]);
|
||||
@@ -142,7 +142,7 @@ const MapInteraction = ({ setValue, startLat, startLng, endLat, endLng }) => {
|
||||
zIndex: 1000,
|
||||
}}
|
||||
>
|
||||
<Button variant={"contained"} onClick={handleUnlockStart}>
|
||||
<Button variant={"contained"} color="warning" onClick={handleUnlockStart}>
|
||||
ویرایش نقطه شروع
|
||||
</Button>
|
||||
</Box>
|
||||
@@ -184,8 +184,8 @@ const MapInteraction = ({ setValue, startLat, startLng, endLat, endLng }) => {
|
||||
setIsEndLocked(true);
|
||||
setEndIconColor("#D13131");
|
||||
map.fitBounds([startPosition, map.getCenter()], {
|
||||
paddingTopLeft: [16, 16],
|
||||
paddingBottomRight: [16, 16],
|
||||
paddingTopLeft: [64, 64],
|
||||
paddingBottomRight: [64, 64],
|
||||
});
|
||||
}
|
||||
},
|
||||
@@ -202,7 +202,7 @@ const MapInteraction = ({ setValue, startLat, startLng, endLat, endLng }) => {
|
||||
zIndex: 1000,
|
||||
}}
|
||||
>
|
||||
<Button variant={"contained"} onClick={handleUnlockEnd}>
|
||||
<Button variant={"contained"} color="warning" onClick={handleUnlockEnd}>
|
||||
ویرایش نقاط
|
||||
</Button>
|
||||
</Box>
|
||||
|
||||
@@ -22,7 +22,7 @@ const ChangePass = ({ open, setOpen }) => {
|
||||
<LoadingButton
|
||||
loading={loading}
|
||||
variant="outlined"
|
||||
color="error"
|
||||
color="secondary"
|
||||
size="large"
|
||||
onClick={handleCloseForm}
|
||||
>
|
||||
@@ -38,7 +38,7 @@ const ChangePass = ({ open, setOpen }) => {
|
||||
loadingPosition="end"
|
||||
endIcon={<SaveIcon />}
|
||||
>
|
||||
ثبت
|
||||
تغییر
|
||||
</LoadingButton>
|
||||
</DialogActions>
|
||||
</Dialog>
|
||||
|
||||
@@ -22,7 +22,7 @@ const Update = ({ open, setOpen }) => {
|
||||
<Form handleCloseForm={handleCloseForm} setLoading={setLoading} />
|
||||
</DialogContent>
|
||||
<DialogActions>
|
||||
<Button autoFocus variant="outlined" color="error" size="large" onClick={handleCloseForm}>
|
||||
<Button variant="outlined" color="secondary" size="large" onClick={handleCloseForm}>
|
||||
بستن
|
||||
</Button>
|
||||
<LoadingButton
|
||||
@@ -35,7 +35,7 @@ const Update = ({ open, setOpen }) => {
|
||||
loadingPosition="end"
|
||||
endIcon={<SaveIcon />}
|
||||
>
|
||||
ثبت
|
||||
ویرایش
|
||||
</LoadingButton>
|
||||
</DialogActions>
|
||||
</Dialog>
|
||||
|
||||
@@ -11,34 +11,34 @@ const RahdarCode = ({ rahdarsCode, setRahdarsCode, error, multiple = true }) =>
|
||||
const [loading, setLoading] = useState(false);
|
||||
const requestServer = useRequest();
|
||||
|
||||
const fetchRahdarCodes = (inputValue, controller) => {
|
||||
const debouncer = debounce((query) => {
|
||||
if ((query || "").length < 3) {
|
||||
setOptions([]);
|
||||
return;
|
||||
}
|
||||
setLoading(true);
|
||||
requestServer(`${GET_RAHDARANS_LIST_SEARCH}?code=${query}`, "get", {
|
||||
requestOptions: { signal: controller.signal },
|
||||
})
|
||||
.then((response) => {
|
||||
const combinedArray = rahdarsCode
|
||||
? [...rahdarsCode, ...response.data.data]
|
||||
: [...response.data.data];
|
||||
const uniqueArray = Array.from(new Map(combinedArray.map((item) => [item.id, item])).values());
|
||||
setOptions(uniqueArray || []);
|
||||
})
|
||||
.catch(() => {
|
||||
setOptions([]);
|
||||
})
|
||||
.finally(() => {
|
||||
setLoading(false);
|
||||
});
|
||||
}, 500);
|
||||
debouncer(inputValue);
|
||||
};
|
||||
|
||||
useEffect(() => {
|
||||
const fetchRahdarCodes = (inputValue, controller) => {
|
||||
const debouncer = debounce((query) => {
|
||||
if ((query || "").length < 3) {
|
||||
setOptions([]);
|
||||
return;
|
||||
}
|
||||
setLoading(true);
|
||||
requestServer(`${GET_RAHDARANS_LIST_SEARCH}?code=${query}`, "get", {
|
||||
requestOptions: { signal: controller.signal },
|
||||
})
|
||||
.then((response) => {
|
||||
const combinedArray = rahdarsCode
|
||||
? [...rahdarsCode, ...response.data.data]
|
||||
: [...response.data.data];
|
||||
const uniqueArray = Array.from(new Map(combinedArray.map((item) => [item.id, item])).values());
|
||||
setOptions(uniqueArray || []);
|
||||
})
|
||||
.catch(() => {
|
||||
setOptions([]);
|
||||
})
|
||||
.finally(() => {
|
||||
setLoading(false);
|
||||
});
|
||||
}, 500);
|
||||
debouncer(inputValue);
|
||||
};
|
||||
|
||||
const controller = new AbortController();
|
||||
fetchRahdarCodes(inputValue, controller);
|
||||
return () => controller.abort();
|
||||
|
||||
Reference in New Issue
Block a user