formating

This commit is contained in:
AmirHossein Mahmoodi
2025-09-08 11:41:05 +03:30
parent 4680547d26
commit 4d1cee0889
4 changed files with 13 additions and 20 deletions

View File

@@ -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);
}
}}
>

View File

@@ -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;

View File

@@ -55,7 +55,7 @@ const OperatorCreateForm = ({ open, setOpen, mutate }) => {
mutate();
setOpen(false);
})
.catch(() => { });
.catch(() => {});
};
const defaultData = {
isForeign: "0",

View File

@@ -106,7 +106,7 @@ const EditController = ({ rowId, mutate, setOpenEditDialog }) => {
mutate();
setOpenEditDialog(false);
})
.catch(() => { });
.catch(() => {});
};
return (
<>