formating
This commit is contained in:
@@ -245,7 +245,7 @@ const DamageInfo = ({ control, setValue, errors }) => {
|
||||
/>
|
||||
</Grid>
|
||||
</Grid>
|
||||
<Stack sx={{ mt: 2 }} spacing={3} alignItems={'center'}>
|
||||
<Stack sx={{ mt: 2 }} spacing={3} alignItems={"center"}>
|
||||
<Divider sx={{ width: "100%" }}>
|
||||
<Chip label="انتخاب محل تصادف" />
|
||||
</Divider>
|
||||
@@ -259,7 +259,7 @@ const DamageInfo = ({ control, setValue, errors }) => {
|
||||
size="small"
|
||||
onChange={(event, newAlignment) => {
|
||||
if (newAlignment !== null) {
|
||||
field.onChange(newAlignment)
|
||||
field.onChange(newAlignment);
|
||||
}
|
||||
}}
|
||||
>
|
||||
|
||||
@@ -4,7 +4,7 @@ import { useWatch } from "react-hook-form";
|
||||
|
||||
const LocationInputs = ({ control, setValue, errors }) => {
|
||||
const StartPoint = useWatch({ control, name: "start_point" });
|
||||
const [coords, setCoords] = useState(StartPoint ? `${StartPoint.lat},${StartPoint.lng}` : '');
|
||||
const [coords, setCoords] = useState(StartPoint ? `${StartPoint.lat},${StartPoint.lng}` : "");
|
||||
const [error, setError] = useState(false);
|
||||
|
||||
return (
|
||||
@@ -17,13 +17,13 @@ const LocationInputs = ({ control, setValue, errors }) => {
|
||||
helperText={
|
||||
error
|
||||
? "فرمت یا محدوده مقادیر معتبر نیست (ابتدا عرض جغرافیایی + , + انتها طول جغرافیایی)"
|
||||
: errors.start_point ?
|
||||
errors.start_point.message
|
||||
: "ابتدا عرض جغرافیایی + , + انتها طول جغرافیایی"
|
||||
: errors.start_point
|
||||
? errors.start_point.message
|
||||
: "ابتدا عرض جغرافیایی + , + انتها طول جغرافیایی"
|
||||
}
|
||||
error={error || errors.start_point}
|
||||
value={coords}
|
||||
onChange={e => {
|
||||
onChange={(e) => {
|
||||
const value = e.target.value.trim();
|
||||
setCoords(value);
|
||||
|
||||
@@ -42,14 +42,7 @@ const LocationInputs = ({ control, setValue, errors }) => {
|
||||
const lat = Number(parts[0]);
|
||||
const lng = Number(parts[1]);
|
||||
|
||||
if (
|
||||
!isNaN(lat) &&
|
||||
!isNaN(lng) &&
|
||||
lat >= 25 &&
|
||||
lat <= 40 &&
|
||||
lng >= 44 &&
|
||||
lng <= 64
|
||||
) {
|
||||
if (!isNaN(lat) && !isNaN(lng) && lat >= 25 && lat <= 40 && lng >= 44 && lng <= 64) {
|
||||
setValue("start_point", { lat: lat, lng: lng });
|
||||
setError(false);
|
||||
} else {
|
||||
@@ -59,6 +52,6 @@ const LocationInputs = ({ control, setValue, errors }) => {
|
||||
}}
|
||||
InputLabelProps={{ shrink: true }}
|
||||
/>
|
||||
)
|
||||
}
|
||||
export default LocationInputs
|
||||
);
|
||||
};
|
||||
export default LocationInputs;
|
||||
|
||||
@@ -55,7 +55,7 @@ const OperatorCreateForm = ({ open, setOpen, mutate }) => {
|
||||
mutate();
|
||||
setOpen(false);
|
||||
})
|
||||
.catch(() => { });
|
||||
.catch(() => {});
|
||||
};
|
||||
const defaultData = {
|
||||
isForeign: "0",
|
||||
|
||||
@@ -106,7 +106,7 @@ const EditController = ({ rowId, mutate, setOpenEditDialog }) => {
|
||||
mutate();
|
||||
setOpenEditDialog(false);
|
||||
})
|
||||
.catch(() => { });
|
||||
.catch(() => {});
|
||||
};
|
||||
return (
|
||||
<>
|
||||
|
||||
Reference in New Issue
Block a user