diff --git a/.env.example b/.env.example
index 7c7adbf..7db04c4 100644
--- a/.env.example
+++ b/.env.example
@@ -1,4 +1,4 @@
HOST="rms.witel.ir"
-NEXT_PUBLIC_VERSION="1.7.4"
+NEXT_PUBLIC_VERSION="1.7.5"
NEXT_PUBLIC_API_URL="https://rms.witel.ir"
NEXT_PUBLIC_MAPTILE_ENDPOINT="https://rmsmap.rmto.ir/141map"
\ No newline at end of file
diff --git a/src/components/dashboard/damages/operator/Actions/create/Forms/CreateFormContent.jsx b/src/components/dashboard/damages/operator/Actions/create/Forms/CreateFormContent.jsx
index a67cac4..104561d 100644
--- a/src/components/dashboard/damages/operator/Actions/create/Forms/CreateFormContent.jsx
+++ b/src/components/dashboard/damages/operator/Actions/create/Forms/CreateFormContent.jsx
@@ -126,6 +126,7 @@ const CreateFormContent = ({ setOpen, SubmitDamage, defaultData }) => {
police_file_date: defaultData.police_file_date,
police_serial: defaultData.police_serial,
start_point: defaultData.start_point,
+ is_map_point: defaultData.is_map_point,
items_damage: defaultData.items_damage,
};
diff --git a/src/components/dashboard/damages/operator/Actions/create/Forms/DamageInfo.jsx b/src/components/dashboard/damages/operator/Actions/create/Forms/DamageInfo.jsx
index 1cec8c1..3a021d0 100644
--- a/src/components/dashboard/damages/operator/Actions/create/Forms/DamageInfo.jsx
+++ b/src/components/dashboard/damages/operator/Actions/create/Forms/DamageInfo.jsx
@@ -1,5 +1,5 @@
import { Controller, useWatch } from "react-hook-form";
-import { Grid, Stack, TextField, ToggleButton, ToggleButtonGroup } from "@mui/material";
+import { Box, Chip, Divider, Grid, Stack, TextField, ToggleButton, ToggleButtonGroup } from "@mui/material";
import MuiDatePicker from "@/core/components/MuiDatePicker";
import MuiTimePicker from "@/core/components/MuiTimePicker";
import SelectBox from "@/core/components/SelectBox";
@@ -8,10 +8,12 @@ import ImageUpload from "./ImageUpload";
import MapInfoOneMarker from "@/core/components/MapInfoOneMarker";
import PersianTextField from "@/core/components/PersianTextField";
import LogesticController from "./LogesticController";
+import LocationInputs from "./LocationInputs";
const DamageInfo = ({ control, setValue, errors }) => {
const StartPoint = useWatch({ control, name: "start_point" });
const IsForeign = useWatch({ control, name: "isForeign" });
+ const is_map_point = useWatch({ control, name: "is_map_point" });
return (
@@ -243,13 +245,41 @@ const DamageInfo = ({ control, setValue, errors }) => {
/>
-
-
+
+
+
+ (
+ {
+ if (newAlignment !== null) {
+ field.onChange(newAlignment);
+ }
+ }}
+ >
+ انتخاب روی نقشه
+ وارد کردن مختصات
+
+ )}
/>
+ {is_map_point == "1" ? (
+
+
+
+ ) : (
+
+ )}
);
diff --git a/src/components/dashboard/damages/operator/Actions/create/Forms/LocationInputs.jsx b/src/components/dashboard/damages/operator/Actions/create/Forms/LocationInputs.jsx
new file mode 100644
index 0000000..056e534
--- /dev/null
+++ b/src/components/dashboard/damages/operator/Actions/create/Forms/LocationInputs.jsx
@@ -0,0 +1,57 @@
+import LtrTextField from "@/core/components/LtrTextField";
+import { useState } from "react";
+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 [error, setError] = useState(false);
+
+ return (
+ {
+ const value = e.target.value.trim();
+ setCoords(value);
+
+ if (value === "") {
+ setValue("start_point", null);
+ setError(false);
+ return;
+ }
+
+ const parts = value.split(",").map((p) => p.trim());
+ if (parts.length !== 2) {
+ setError(true);
+ return;
+ }
+
+ const lat = Number(parts[0]);
+ const lng = Number(parts[1]);
+
+ if (!isNaN(lat) && !isNaN(lng) && lat >= 25 && lat <= 40 && lng >= 44 && lng <= 64) {
+ setValue("start_point", { lat: lat, lng: lng });
+ setError(false);
+ } else {
+ setValue("start_point", null);
+ setError(true);
+ }
+ }}
+ InputLabelProps={{ shrink: true }}
+ />
+ );
+};
+export default LocationInputs;
diff --git a/src/components/dashboard/damages/operator/Actions/create/Forms/index.jsx b/src/components/dashboard/damages/operator/Actions/create/Forms/index.jsx
index 6537566..06197ca 100644
--- a/src/components/dashboard/damages/operator/Actions/create/Forms/index.jsx
+++ b/src/components/dashboard/damages/operator/Actions/create/Forms/index.jsx
@@ -83,6 +83,7 @@ const OperatorCreateForm = ({ open, setOpen, mutate }) => {
police_file_date: "",
police_serial: "",
start_point: "",
+ is_map_point: "1",
items_damage: [],
};
return (
diff --git a/src/components/dashboard/damages/operator/Form/EditForm/EditController.jsx b/src/components/dashboard/damages/operator/Form/EditForm/EditController.jsx
index 2d34b82..4c6fcbd 100644
--- a/src/components/dashboard/damages/operator/Form/EditForm/EditController.jsx
+++ b/src/components/dashboard/damages/operator/Form/EditForm/EditController.jsx
@@ -56,6 +56,7 @@ const EditController = ({ rowId, mutate, setOpenEditDialog }) => {
is_province: !hasCreateProvincePermission,
city_id: damageItemDetails?.city_id || null,
start_point: { lat: damageItemDetails?.lat || "", lng: damageItemDetails?.lng || "" },
+ is_map_point: "1",
};
const HandleSubmit = async (result) => {
const PlateNumber = `${result.plate_part1}-${result.plate_part2}-${result.plate_part3}-${result.plate_part4}`;