fixed bug and formatting

This commit is contained in:
Amirhossein Mahmoodi
2024-10-26 13:47:36 +03:30
parent db23c52ee2
commit 05385a8d2b
25 changed files with 483 additions and 462 deletions

View File

@@ -15,10 +15,10 @@
"@emotion/react": "^11.11.3",
"@emotion/styled": "^11.11.0",
"@hookform/resolvers": "^3.9.0",
"@mui/icons-material": "^5.15.6",
"@mui/icons-material": "^5.16.7",
"@mui/lab": "^5.0.0-alpha.173",
"@mui/material": "^5.15.6",
"@mui/material-nextjs": "^5.15.6",
"@mui/material": "^5.16.7",
"@mui/material-nextjs": "^5.16.6",
"@mui/x-date-pickers": "^6.19.5",
"@mui/x-tree-view": "^7.11.0",
"axios": "^1.7.2",
@@ -49,4 +49,4 @@
"eslint-config-prettier": "^9.1.0",
"prettier": "^3.3.2"
}
}
}

View File

@@ -1,7 +1,7 @@
import TestPage from "@/components/dashboard/azmayesh";
const Page = () => {
return <TestPage/>;
return <TestPage />;
};
export default Page;

View File

@@ -14,5 +14,5 @@ const data = [
];
export async function GET() {
return Response.json({data});
return Response.json({ data });
}

View File

@@ -10,7 +10,7 @@ const data = [
work_number: "شماره کار",
request_number: "شماره درخواست",
request_date: "تاریخ درخواست",
report_date: "تاریخ گزارش"
report_date: "تاریخ گزارش",
},
{
id: 2,
@@ -23,7 +23,7 @@ const data = [
work_number: "شماره کار",
request_number: "شماره درخواست",
request_date: "تاریخ درخواست",
report_date: "تاریخ گزارش"
report_date: "تاریخ گزارش",
},
{
id: 3,
@@ -36,7 +36,7 @@ const data = [
work_number: "شماره کار",
request_number: "شماره درخواست",
request_date: "تاریخ درخواست",
report_date: "تاریخ گزارش"
report_date: "تاریخ گزارش",
},
{
id: 4,
@@ -49,7 +49,7 @@ const data = [
work_number: "شماره کار",
request_number: "شماره درخواست",
request_date: "تاریخ درخواست",
report_date: "تاریخ گزارش"
report_date: "تاریخ گزارش",
},
{
id: 5,
@@ -62,10 +62,10 @@ const data = [
work_number: "شماره کار",
request_number: "شماره درخواست",
request_date: "تاریخ درخواست",
report_date: "تاریخ گزارش"
report_date: "تاریخ گزارش",
},
];
export async function GET() {
return Response.json({data});
return Response.json({ data });
}

View File

@@ -3,7 +3,8 @@
@import "react-toastify/dist/ReactToastify.css";
.filter-toast {
box-shadow: rgba(50, 50, 93, 0.25) 0px 13px 27px -5px,
rgba(0, 0, 0, 0.3) 0px 8px 16px -8px;
background-color: #d0dfe8;
}
box-shadow:
rgba(50, 50, 93, 0.25) 0px 13px 27px -5px,
rgba(0, 0, 0, 0.3) 0px 8px 16px -8px;
background-color: #d0dfe8;
}

View File

@@ -1,27 +1,27 @@
.leaflet-draw-tooltip {
background-color: #4f4f4f;
font-family: IRANSans;
color: #fff;
font-size: 10px;
padding: 2px 8px;
margin-right: 15px;
border-radius: 4px;
box-shadow: 0px 4px 8px rgba(0, 0, 0, 0.1);
background-color: #4f4f4f;
font-family: IRANSans;
color: #fff;
font-size: 10px;
padding: 2px 8px;
margin-right: 15px;
border-radius: 4px;
box-shadow: 0px 4px 8px rgba(0, 0, 0, 0.1);
}
.leaflet-draw-tooltip:before {
content: "";
position: absolute;
bottom: 100%;
left: 103%;
transform: rotate(90deg);
margin-left: -6px;
border-width: 6px;
border-style: solid;
border-color: transparent transparent #333 transparent;
content: "";
position: absolute;
bottom: 100%;
left: 103%;
transform: rotate(90deg);
margin-left: -6px;
border-width: 6px;
border-style: solid;
border-color: transparent transparent #333 transparent;
}
.leaflet-draw-tooltip-subtext {
font-size: 12px;
color: #ffeb3b;
font-size: 12px;
color: #ffeb3b;
}

View File

@@ -1,6 +1,6 @@
"use client";
import {Controller} from "react-hook-form";
import { Controller } from "react-hook-form";
import {
Autocomplete,
CircularProgress,
@@ -12,39 +12,36 @@ import {
InputLabel,
OutlinedInput,
TextField,
Typography
Typography,
} from "@mui/material";
import useAzmayesh from "@/lib/hooks/useAzmayesh";
import useProvinces from "@/lib/hooks/useProvince";
import {LocalizationProvider, MobileDatePicker} from "@mui/x-date-pickers";
import {AdapterDateFnsJalali} from "@mui/x-date-pickers/AdapterDateFnsJalali";
import {faIR} from "@mui/x-date-pickers/locales";
import { LocalizationProvider, MobileDatePicker } from "@mui/x-date-pickers";
import { AdapterDateFnsJalali } from "@mui/x-date-pickers/AdapterDateFnsJalali";
import { faIR } from "@mui/x-date-pickers/locales";
import ClearIcon from "@mui/icons-material/Clear";
import React from "react";
const AzmayeshGeneralInfo = ({control, register, setValue, errors}) => {
const {azmayeshes, errorAzmayeshes, loadingAzmayeshes} = useAzmayesh();
const {provinces, errorProvinces, loadingProvinces} = useProvinces();
const AzmayeshGeneralInfo = ({ control, register, setValue, errors }) => {
const { azmayeshes, errorAzmayeshes, loadingAzmayeshes } = useAzmayesh();
const { provinces, errorProvinces, loadingProvinces } = useProvinces();
return (
<Grid container spacing={2}>
<Grid item xs={12} md={6}
sx={{display: "flex", alignItems: "center", justifyContent: "center"}}>
<Grid item xs={12} md={6} sx={{ display: "flex", alignItems: "center", justifyContent: "center" }}>
<Controller
name="azmayesh_type_id"
control={control}
render={({field: {onChange, value}, fieldState: {error}}) => (
<FormControl error={!!errors.azmayesh_type_id} size="small" fullWidth
variant="outlined">
<InputLabel htmlFor="azmayesh_type_id"/>
render={({ field: { onChange, value }, fieldState: { error } }) => (
<FormControl error={!!errors.azmayesh_type_id} size="small" fullWidth variant="outlined">
<InputLabel htmlFor="azmayesh_type_id" />
{errorAzmayeshes ? (
<Typography color={"red"}
sx={{display: "flex", alignItems: "center", gap: 2}}>
<Typography color={"red"} sx={{ display: "flex", alignItems: "center", gap: 2 }}>
خطایی در دریافت لیست آزمایش ها رخ داده است!
</Typography>
) : loadingAzmayeshes ? (
<Typography sx={{display: "flex", alignItems: "center", gap: 2}}>
<CircularProgress size={20}/>
<Typography sx={{ display: "flex", alignItems: "center", gap: 2 }}>
<CircularProgress size={20} />
درحال دریافت لیست آزمایش ها
</Typography>
) : (
@@ -78,23 +75,20 @@ const AzmayeshGeneralInfo = ({control, register, setValue, errors}) => {
)}
/>
</Grid>
<Grid item xs={12} md={6}
sx={{display: "flex", alignItems: "center", justifyContent: "center"}}>
<Grid item xs={12} md={6} sx={{ display: "flex", alignItems: "center", justifyContent: "center" }}>
<Controller
name="province_id"
control={control}
render={({field: {onChange, value}, fieldState: {error}}) => (
<FormControl error={!!errors.province_id} size="small" fullWidth
variant="outlined">
<InputLabel htmlFor="province_id"/>
render={({ field: { onChange, value }, fieldState: { error } }) => (
<FormControl error={!!errors.province_id} size="small" fullWidth variant="outlined">
<InputLabel htmlFor="province_id" />
{errorProvinces ? (
<Typography color={"red"}
sx={{display: "flex", alignItems: "center", gap: 2}}>
<Typography color={"red"} sx={{ display: "flex", alignItems: "center", gap: 2 }}>
خطایی در دریافت لیست استان ها رخ داده است!
</Typography>
) : loadingProvinces ? (
<Typography sx={{display: "flex", alignItems: "center", gap: 2}}>
<CircularProgress size={20}/>
<Typography sx={{ display: "flex", alignItems: "center", gap: 2 }}>
<CircularProgress size={20} />
درحال دریافت لیست استان ها
</Typography>
) : (
@@ -129,11 +123,8 @@ const AzmayeshGeneralInfo = ({control, register, setValue, errors}) => {
/>
</Grid>
<Grid item xs={12} md={6}>
<FormControl error={!!errors.project_name} size="small" fullWidth
variant="outlined">
<InputLabel htmlFor="project_name">
پروژه
</InputLabel>
<FormControl error={!!errors.project_name} size="small" fullWidth variant="outlined">
<InputLabel htmlFor="project_name">پروژه</InputLabel>
<OutlinedInput
id="project_name"
label={"پروژه"}
@@ -150,9 +141,7 @@ const AzmayeshGeneralInfo = ({control, register, setValue, errors}) => {
</Grid>
<Grid item xs={12} md={6}>
<FormControl error={!!errors.employer} size="small" fullWidth variant="outlined">
<InputLabel htmlFor="employer">
کارفرما
</InputLabel>
<InputLabel htmlFor="employer">کارفرما</InputLabel>
<OutlinedInput
id="employer"
label={"کارفرما"}
@@ -162,16 +151,12 @@ const AzmayeshGeneralInfo = ({control, register, setValue, errors}) => {
fullWidth
type="text"
/>
<FormHelperText id="employer">
{errors.employer ? errors.employer.message : null}
</FormHelperText>
<FormHelperText id="employer">{errors.employer ? errors.employer.message : null}</FormHelperText>
</FormControl>
</Grid>
<Grid item xs={12} md={6}>
<FormControl error={!!errors.consultant} size="small" fullWidth variant="outlined">
<InputLabel htmlFor="consultant">
مشاور
</InputLabel>
<InputLabel htmlFor="consultant">مشاور</InputLabel>
<OutlinedInput
id="consultant"
label={"مشاور"}
@@ -188,9 +173,7 @@ const AzmayeshGeneralInfo = ({control, register, setValue, errors}) => {
</Grid>
<Grid item xs={12} md={6}>
<FormControl error={!!errors.contractor} size="small" fullWidth variant="outlined">
<InputLabel htmlFor="contractor">
پیمانکار
</InputLabel>
<InputLabel htmlFor="contractor">پیمانکار</InputLabel>
<OutlinedInput
id="contractor"
label={"پیمانکار"}
@@ -207,9 +190,7 @@ const AzmayeshGeneralInfo = ({control, register, setValue, errors}) => {
</Grid>
<Grid item xs={12} md={6}>
<FormControl error={!!errors.applicant} size="small" fullWidth variant="outlined">
<InputLabel htmlFor="applicant">
متقاضی
</InputLabel>
<InputLabel htmlFor="applicant">متقاضی</InputLabel>
<OutlinedInput
id="applicant"
label={"متقاضی"}
@@ -219,16 +200,12 @@ const AzmayeshGeneralInfo = ({control, register, setValue, errors}) => {
fullWidth
type="text"
/>
<FormHelperText id="applicant">
{errors.applicant ? errors.applicant.message : null}
</FormHelperText>
<FormHelperText id="applicant">{errors.applicant ? errors.applicant.message : null}</FormHelperText>
</FormControl>
</Grid>
<Grid item xs={12} md={6}>
<FormControl error={!!errors.work_number} size="small" fullWidth variant="outlined">
<InputLabel htmlFor="work_number">
شماره کار
</InputLabel>
<InputLabel htmlFor="work_number">شماره کار</InputLabel>
<OutlinedInput
id="work_number"
label={"شماره کار"}
@@ -244,11 +221,8 @@ const AzmayeshGeneralInfo = ({control, register, setValue, errors}) => {
</FormControl>
</Grid>
<Grid item xs={12} md={6}>
<FormControl error={!!errors.request_number} size="small" fullWidth
variant="outlined">
<InputLabel htmlFor="request_number">
شماره درخواست
</InputLabel>
<FormControl error={!!errors.request_number} size="small" fullWidth variant="outlined">
<InputLabel htmlFor="request_number">شماره درخواست</InputLabel>
<OutlinedInput
id="request_number"
label={"شماره درخواست"}
@@ -268,13 +242,8 @@ const AzmayeshGeneralInfo = ({control, register, setValue, errors}) => {
name="request_date"
control={control}
defaultValue={new Date()}
render={({field: {onChange, value}, fieldState: {error}}) => (
<FormControl
error={!!errors.request_date}
fullWidth
size="small"
variant="outlined"
>
render={({ field: { onChange, value }, fieldState: { error } }) => (
<FormControl error={!!errors.request_date} fullWidth size="small" variant="outlined">
<LocalizationProvider
dateAdapter={AdapterDateFnsJalali}
localeText={faIR.components.MuiLocalizationProvider.defaultProps.localeText}
@@ -306,7 +275,7 @@ const AzmayeshGeneralInfo = ({control, register, setValue, errors}) => {
},
}}
>
<ClearIcon/>
<ClearIcon />
</IconButton>
</InputAdornment>
),
@@ -327,13 +296,8 @@ const AzmayeshGeneralInfo = ({control, register, setValue, errors}) => {
name="report_date"
control={control}
defaultValue={new Date()}
render={({field: {onChange, value}, fieldState: {error}}) => (
<FormControl
error={!!errors.report_date}
fullWidth
size="small"
variant="outlined"
>
render={({ field: { onChange, value }, fieldState: { error } }) => (
<FormControl error={!!errors.report_date} fullWidth size="small" variant="outlined">
<LocalizationProvider
dateAdapter={AdapterDateFnsJalali}
localeText={faIR.components.MuiLocalizationProvider.defaultProps.localeText}
@@ -365,7 +329,7 @@ const AzmayeshGeneralInfo = ({control, register, setValue, errors}) => {
},
}}
>
<ClearIcon/>
<ClearIcon />
</IconButton>
</InputAdornment>
),
@@ -384,4 +348,4 @@ const AzmayeshGeneralInfo = ({control, register, setValue, errors}) => {
</Grid>
);
};
export default AzmayeshGeneralInfo;
export default AzmayeshGeneralInfo;

View File

@@ -1,7 +1,7 @@
"use client";
import {Marker, useMapEvents} from "react-leaflet";
import {useEffect, useRef} from "react";
import { Marker, useMapEvents } from "react-leaflet";
import { useEffect, useRef } from "react";
import L from "leaflet";
import AzmayeshIcon from "@/assets/images/examine_marker.png";
import AzmayeshActiveIcon from "@/assets/images/examine_marker_active.png";
@@ -14,14 +14,14 @@ import {
OutlinedInput,
Stack,
Tooltip,
useMediaQuery
useMediaQuery,
} from "@mui/material";
import NewReleasesIcon from '@mui/icons-material/NewReleases';
import VerifiedIcon from '@mui/icons-material/Verified';
import EditIcon from '@mui/icons-material/Edit';
import {useTheme} from "@emotion/react";
import NewReleasesIcon from "@mui/icons-material/NewReleases";
import VerifiedIcon from "@mui/icons-material/Verified";
import EditIcon from "@mui/icons-material/Edit";
import { useTheme } from "@emotion/react";
const ChooseLocation = ({mapBoxData, setMapBoxData}) => {
const ChooseLocation = ({ mapBoxData, setMapBoxData }) => {
const theme = useTheme();
const isMobile = useMediaQuery(theme.breakpoints.down("sm"));
@@ -32,7 +32,7 @@ const ChooseLocation = ({mapBoxData, setMapBoxData}) => {
iconUrl: iconUrl,
iconSize: size,
iconAnchor: [size[0] / 2, size[1]],
popupAnchor: [0, -size[1]]
popupAnchor: [0, -size[1]],
});
};
@@ -51,7 +51,7 @@ const ChooseLocation = ({mapBoxData, setMapBoxData}) => {
if (!mapBoxData) {
mapAzmayeshMarker.current.setIcon(createCustomIcon(defaultIconSize, AzmayeshIcon.src));
}
}
},
});
useEffect(() => {
@@ -71,38 +71,40 @@ const ChooseLocation = ({mapBoxData, setMapBoxData}) => {
if (!mapBoxData) {
setMapBoxData({
lat: mapAzmayeshMarker.current.getLatLng().lat,
lng: mapAzmayeshMarker.current.getLatLng().lng
lng: mapAzmayeshMarker.current.getLatLng().lng,
});
}
};
const handleEditLocation = () => {
setMapBoxData(null);
}
};
return (
<>
<Marker
position={map.getCenter()}
ref={mapAzmayeshMarker}
eventHandlers={{click: handleMarkerClick}}
eventHandlers={{ click: handleMarkerClick }}
icon={createCustomIcon(defaultIconSize, AzmayeshIcon.src)}
/>
<Box sx={{
zIndex: "400",
position: "absolute",
background: "#ffffff94",
p: 2,
borderRadius: "10px",
boxShadow: "rgba(0, 0, 0, 0.24) 0px 3px 8px",
bottom: "5px",
left: "10px",
right: isMobile ? "10px" : "",
}}>
<Stack sx={{gap: 2}}>
<Box
sx={{
zIndex: "400",
position: "absolute",
background: "#ffffff94",
p: 2,
borderRadius: "10px",
boxShadow: "rgba(0, 0, 0, 0.24) 0px 3px 8px",
bottom: "5px",
left: "10px",
right: isMobile ? "10px" : "",
}}
>
<Stack sx={{ gap: 2 }}>
<Tooltip title="با کلیک بر روی مارکر، محل آزمایش را انتخاب کنید" arrow>
<FormControl size="small" variant="outlined">
<InputLabel sx={{color: mapBoxData ? "success.main" : ""}} htmlFor="lat">
<InputLabel sx={{ color: mapBoxData ? "success.main" : "" }} htmlFor="lat">
طول جغرافیایی
</InputLabel>
<OutlinedInput
@@ -111,16 +113,19 @@ const ChooseLocation = ({mapBoxData, setMapBoxData}) => {
size="small"
readOnly
sx={{
'& .MuiOutlinedInput-notchedOutline': {
"& .MuiOutlinedInput-notchedOutline": {
borderColor: mapBoxData ? "success.main" : "",
},
color: mapBoxData ? "success.main" : ""
color: mapBoxData ? "success.main" : "",
}}
value={mapBoxData ? `${mapBoxData.lat}` : ""}
endAdornment={
<InputAdornment position="end">
{mapBoxData ? <VerifiedIcon color="success"/> :
<NewReleasesIcon color="error"/>}
{mapBoxData ? (
<VerifiedIcon color="success" />
) : (
<NewReleasesIcon color="error" />
)}
</InputAdornment>
}
label="طول جغرافیایی"
@@ -129,7 +134,7 @@ const ChooseLocation = ({mapBoxData, setMapBoxData}) => {
</Tooltip>
<Tooltip title="با کلیک بر روی مارکر، محل آزمایش را انتخاب کنید" arrow>
<FormControl size="small" variant="outlined">
<InputLabel sx={{color: mapBoxData ? "success.main" : ""}} htmlFor="lng">
<InputLabel sx={{ color: mapBoxData ? "success.main" : "" }} htmlFor="lng">
عرض جغرافیایی
</InputLabel>
<OutlinedInput
@@ -138,28 +143,38 @@ const ChooseLocation = ({mapBoxData, setMapBoxData}) => {
size="small"
readOnly
sx={{
'& .MuiOutlinedInput-notchedOutline': {
"& .MuiOutlinedInput-notchedOutline": {
borderColor: mapBoxData ? "success.main" : "",
},
color: mapBoxData ? "success.main" : ""
color: mapBoxData ? "success.main" : "",
}}
value={mapBoxData ? `${mapBoxData.lng}` : ""}
endAdornment={
<InputAdornment position="end">
{mapBoxData ? <VerifiedIcon color="success"/> :
<NewReleasesIcon color="error"/>}
{mapBoxData ? (
<VerifiedIcon color="success" />
) : (
<NewReleasesIcon color="error" />
)}
</InputAdornment>
}
label="عرض جغرافیایی"
/>
</FormControl>
</Tooltip>
<Button variant="contained" color="primary" disabled={!mapBoxData} startIcon={<EditIcon/>}
onClick={handleEditLocation}>ویرایش مختصات</Button>
<Button
variant="contained"
color="primary"
disabled={!mapBoxData}
startIcon={<EditIcon />}
onClick={handleEditLocation}
>
ویرایش مختصات
</Button>
</Stack>
</Box>
</>
);
};
export default ChooseLocation;
export default ChooseLocation;

View File

@@ -1,8 +1,8 @@
"use client";
import {Box, Typography} from "@mui/material";
import TextSnippetIcon from '@mui/icons-material/TextSnippet';
import TravelExploreIcon from '@mui/icons-material/TravelExplore';
import { Box, Typography } from "@mui/material";
import TextSnippetIcon from "@mui/icons-material/TextSnippet";
import TravelExploreIcon from "@mui/icons-material/TravelExplore";
import {
Timeline,
TimelineConnector,
@@ -10,46 +10,52 @@ import {
TimelineDot,
TimelineItem,
timelineItemClasses,
TimelineSeparator
TimelineSeparator,
} from "@mui/lab";
const CreateTimeLine = ({tabState}) => {
const CreateTimeLine = ({ tabState }) => {
return (
<Box sx={{display: "flex", alignItems: "center"}}>
<Timeline position="right" sx={{
[`& .${timelineItemClasses.root}:before`]: {flex: 0, padding: 0}
}}>
<Box sx={{ display: "flex", alignItems: "center" }}>
<Timeline
position="right"
sx={{
[`& .${timelineItemClasses.root}:before`]: { flex: 0, padding: 0 },
}}
>
<TimelineItem>
<TimelineSeparator>
<TimelineConnector/>
<TimelineDot sx={{backgroundColor: "#fff"}}>
<TravelExploreIcon color={tabState === 0 ? "primary" : "error"}
sx={{width: "1.5rem", height: "1.5rem"}}/>
<TimelineConnector />
<TimelineDot sx={{ backgroundColor: "#fff" }}>
<TravelExploreIcon
color={tabState === 0 ? "primary" : "error"}
sx={{ width: "1.5rem", height: "1.5rem" }}
/>
</TimelineDot>
<TimelineConnector/>
<TimelineConnector />
</TimelineSeparator>
<TimelineContent sx={{py: '12px', px: 2}}>
<Typography variant="h6">
نقشه
<TimelineContent sx={{ py: "12px", px: 2 }}>
<Typography variant="h6">نقشه</Typography>
<Typography variant="caption" sx={{ color: "#606060" }}>
ثبت مختصات محل آزمایش
</Typography>
<Typography variant="caption" sx={{color: "#606060"}}>ثبت مختصات محل
آزمایش</Typography>
</TimelineContent>
</TimelineItem>
<TimelineItem>
<TimelineSeparator>
<TimelineConnector/>
<TimelineDot sx={{backgroundColor: "#fff"}}>
<TextSnippetIcon color={tabState === 1 ? "primary" : "error"}
sx={{width: "1.5rem", height: "1.5rem"}}/>
<TimelineConnector />
<TimelineDot sx={{ backgroundColor: "#fff" }}>
<TextSnippetIcon
color={tabState === 1 ? "primary" : "error"}
sx={{ width: "1.5rem", height: "1.5rem" }}
/>
</TimelineDot>
<TimelineConnector/>
<TimelineConnector />
</TimelineSeparator>
<TimelineContent sx={{py: '12px', px: 2}}>
<Typography variant="h6">
مشخصات آزمایش
<TimelineContent sx={{ py: "12px", px: 2 }}>
<Typography variant="h6">مشخصات آزمایش</Typography>
<Typography variant="caption" sx={{ color: "#606060" }}>
ثبت مشخصات اولیه
</Typography>
<Typography variant="caption" sx={{color: "#606060"}}>ثبت مشخصات اولیه</Typography>
</TimelineContent>
</TimelineItem>
</Timeline>

View File

@@ -1,25 +1,27 @@
"use client";
import {Box, Stack} from "@mui/material";
import { Box, Stack } from "@mui/material";
import dynamic from "next/dynamic";
import MapLoading from "@/core/components/MapLayer/Loading";
import ChooseLocation from "./ChooseLocation";
const MapLayer = dynamic(() => import("@/core/components/MapLayer"), {
loading: () => <MapLoading/>,
loading: () => <MapLoading />,
ssr: false,
});
const MapBox = ({mapBoxData, setMapBoxData}) => {
const MapBox = ({ mapBoxData, setMapBoxData }) => {
return (
<Stack spacing={1} sx={{height: "500px"}}>
<Box sx={{
p: 1,
border: "1px dashed",
borderColor: "divider",
borderRadius: 1,
height: "100%"
}}>
<Stack spacing={1} sx={{ height: "500px" }}>
<Box
sx={{
p: 1,
border: "1px dashed",
borderColor: "divider",
borderRadius: 1,
height: "100%",
}}
>
<Box
sx={{
height: "100%",
@@ -29,7 +31,7 @@ const MapBox = ({mapBoxData, setMapBoxData}) => {
}}
>
<MapLayer>
<ChooseLocation mapBoxData={mapBoxData} setMapBoxData={setMapBoxData}/>
<ChooseLocation mapBoxData={mapBoxData} setMapBoxData={setMapBoxData} />
</MapLayer>
</Box>
</Box>

View File

@@ -1,43 +1,36 @@
"use client";
import {Box, Button, Dialog, DialogActions, DialogContent, Tab, Tabs, useMediaQuery} from "@mui/material";
import {useTheme} from "@emotion/react";
import React, {useState} from "react";
import { Box, Button, Dialog, DialogActions, DialogContent, Tab, Tabs, useMediaQuery } from "@mui/material";
import { useTheme } from "@emotion/react";
import React, { useState } from "react";
import MapBox from "./MapBox";
import TravelExploreIcon from '@mui/icons-material/TravelExplore';
import TextSnippetIcon from '@mui/icons-material/TextSnippet';
import KeyboardDoubleArrowRightIcon from '@mui/icons-material/KeyboardDoubleArrowRight';
import KeyboardDoubleArrowLeftIcon from '@mui/icons-material/KeyboardDoubleArrowLeft';
import ExitToAppIcon from '@mui/icons-material/ExitToApp';
import BeenhereIcon from '@mui/icons-material/Beenhere';
import TravelExploreIcon from "@mui/icons-material/TravelExplore";
import TextSnippetIcon from "@mui/icons-material/TextSnippet";
import KeyboardDoubleArrowRightIcon from "@mui/icons-material/KeyboardDoubleArrowRight";
import KeyboardDoubleArrowLeftIcon from "@mui/icons-material/KeyboardDoubleArrowLeft";
import ExitToAppIcon from "@mui/icons-material/ExitToApp";
import BeenhereIcon from "@mui/icons-material/Beenhere";
import CreateTimeLine from "./CreateTimeLine";
import {useForm} from "react-hook-form";
import { useForm } from "react-hook-form";
import StyledForm from "@/core/components/StyledForm";
import {object, string} from "yup";
import { object, string } from "yup";
import useRequest from "@/lib/hooks/useRequest";
import {yupResolver} from "@hookform/resolvers/yup";
import { yupResolver } from "@hookform/resolvers/yup";
import moment from "jalali-moment";
import {POST_AZMAYESH} from "@/core/utils/routes";
import { POST_AZMAYESH } from "@/core/utils/routes";
import AzmayeshGeneralInfo from "./AzmayeshGeneralInfo";
function TabPanel(props) {
const {children, value, index} = props;
const { children, value, index } = props;
return (
<div
role="tabpanel"
hidden={value !== index}
>
{value === index && (
<Box>
{children}
</Box>
)}
<div role="tabpanel" hidden={value !== index}>
{value === index && <Box>{children}</Box>}
</div>
);
}
const CreateDialog = ({open, setOpen, mutate}) => {
const CreateDialog = ({ open, setOpen, mutate }) => {
const theme = useTheme();
const isMobile = useMediaQuery(theme.breakpoints.down("sm"));
const [tabState, setTabState] = useState(0);
@@ -55,7 +48,7 @@ const CreateDialog = ({open, setOpen, mutate}) => {
if (tabState === 0) {
handleClose();
} else {
setTabState(tabState - 1)
setTabState(tabState - 1);
}
};
@@ -72,7 +65,7 @@ const CreateDialog = ({open, setOpen, mutate}) => {
request_date: string().required("تاریخ درخواست را وارد کنید!"),
report_date: string().required("تاریخ گزارش را وارد کنید!"),
});
const requestServer = useRequest({auth: true});
const requestServer = useRequest({ auth: true });
const defaultValues = {
azmayesh_type_id: "",
@@ -95,8 +88,8 @@ const CreateDialog = ({open, setOpen, mutate}) => {
register,
handleSubmit,
setValue,
formState: {isSubmitting, errors, touchedFields},
} = useForm({defaultValues, resolver: yupResolver(validationSchema), mode: "onBlur"});
formState: { isSubmitting, errors, touchedFields },
} = useForm({ defaultValues, resolver: yupResolver(validationSchema), mode: "onBlur" });
const onSubmit = async (data) => {
const formData = new FormData();
@@ -123,59 +116,78 @@ const CreateDialog = ({open, setOpen, mutate}) => {
mutate();
handleClose();
})
.catch(() => {
});
.catch(() => {});
};
return (
<Dialog open={open} fullWidth={true} maxWidth={"lg"}>
<StyledForm onSubmit={handleSubmit(onSubmit)}>
<Tabs allowScrollButtonsMobile value={tabState} onChange={handleChangeTab}
variant={`${isMobile ? "scrollable" : "fullWidth"}`}
sx={{
display: "flex",
justifyContent: "space-around",
width: "100%",
backgroundColor: "#efefef"
}}>
<Tab icon={<TravelExploreIcon/>} label="انتخاب محل آزمایش"></Tab>
<Tab disabled={!mapBoxData} icon={<TextSnippetIcon/>} label="مشخصات آزمایش"></Tab>
<Tabs
allowScrollButtonsMobile
value={tabState}
onChange={handleChangeTab}
variant={`${isMobile ? "scrollable" : "fullWidth"}`}
sx={{
display: "flex",
justifyContent: "space-around",
width: "100%",
backgroundColor: "#efefef",
}}
>
<Tab icon={<TravelExploreIcon />} label="انتخاب محل آزمایش"></Tab>
<Tab disabled={!mapBoxData} icon={<TextSnippetIcon />} label="مشخصات آزمایش"></Tab>
</Tabs>
<DialogContent dividers sx={{display: "flex"}}>
<Box sx={{flex: 1}}>
<DialogContent dividers sx={{ display: "flex" }}>
<Box sx={{ flex: 1 }}>
<TabPanel value={tabState} index={0}>
<MapBox mapBoxData={mapBoxData} setMapBoxData={setMapBoxData}/>
<MapBox mapBoxData={mapBoxData} setMapBoxData={setMapBoxData} />
</TabPanel>
<TabPanel value={tabState} index={1}>
<AzmayeshGeneralInfo control={control} register={register} setValue={setValue}
errors={errors}/>
<AzmayeshGeneralInfo
control={control}
register={register}
setValue={setValue}
errors={errors}
/>
</TabPanel>
</Box>
{!isMobile && (
<Box sx={{display: "flex", alignItems: "center"}}>
<CreateTimeLine tabState={tabState}/>
<Box sx={{ display: "flex", alignItems: "center" }}>
<CreateTimeLine tabState={tabState} />
</Box>
)}
</DialogContent>
<DialogActions sx={{alignItems: "center", justifyContent: "center"}}>
<Button onClick={handlePrev} variant="outlined" color="error" size="large"
startIcon={tabState === 0 ? <ExitToAppIcon/> : <KeyboardDoubleArrowRightIcon/>}>
<DialogActions sx={{ alignItems: "center", justifyContent: "center" }}>
<Button
onClick={handlePrev}
variant="outlined"
color="error"
size="large"
startIcon={tabState === 0 ? <ExitToAppIcon /> : <KeyboardDoubleArrowRightIcon />}
>
{tabState === 0 ? "بستن" : "مرحله قبل"}
</Button>
{
tabState === 0 ? <Button onClick={() => setTabState(tabState + 1)} variant="contained"
size="large"
disabled={!mapBoxData}
endIcon={<KeyboardDoubleArrowLeftIcon/>}>
{tabState === 0 ? (
<Button
onClick={() => setTabState(tabState + 1)}
variant="contained"
size="large"
disabled={!mapBoxData}
endIcon={<KeyboardDoubleArrowLeftIcon />}
>
مرحله بعد
</Button> : <Button variant="contained"
size="large"
disabled={isSubmitting}
type={"submit"}
endIcon={<BeenhereIcon/>}>
</Button>
) : (
<Button
variant="contained"
size="large"
disabled={isSubmitting}
type={"submit"}
endIcon={<BeenhereIcon />}
>
{isSubmitting ? "در حال ثبت آزمایش" : "ثبت آزمایش"}
</Button>
}
)}
</DialogActions>
</StyledForm>
</Dialog>

View File

@@ -1,12 +1,12 @@
"use client";
import {Button, IconButton, useMediaQuery} from "@mui/material";
import {useTheme} from "@emotion/react";
import {useState} from "react";
import {AddCircle} from "@mui/icons-material";
import { Button, IconButton, useMediaQuery } from "@mui/material";
import { useTheme } from "@emotion/react";
import { useState } from "react";
import { AddCircle } from "@mui/icons-material";
import CreateDialog from "./CreateDialog";
const AzmayeshCreate = ({mutate}) => {
const AzmayeshCreate = ({ mutate }) => {
const theme = useTheme();
const isMobile = useMediaQuery(theme.breakpoints.down("sm"));
const [open, setOpen] = useState(false);
@@ -19,14 +19,14 @@ const AzmayeshCreate = ({mutate}) => {
<>
{isMobile ? (
<IconButton aria-label="ایجاد آزمایش جدید" color="primary" onClick={handleOpen}>
<AddCircle sx={{fontSize: "25px"}}/>
<AddCircle sx={{ fontSize: "25px" }} />
</IconButton>
) : (
<Button variant="contained" color="primary" startIcon={<AddCircle/>} onClick={handleOpen}>
<Button variant="contained" color="primary" startIcon={<AddCircle />} onClick={handleOpen}>
ثبت آزمایش
</Button>
)}
{open && <CreateDialog open={open} setOpen={setOpen} mutate={mutate}/>}
{open && <CreateDialog open={open} setOpen={setOpen} mutate={mutate} />}
</>
);
};

View File

@@ -1,10 +1,10 @@
"use client";
import {useMemo} from "react";
import {Box, Typography} from "@mui/material";
import { useMemo } from "react";
import { Box, Typography } from "@mui/material";
import DataTableWithAuth from "@/core/components/DataTableWithAuth";
import Toolbar from "./Toolbar";
import {GET_AZMAYESH_LIST} from "@/core/utils/routes";
import { GET_AZMAYESH_LIST } from "@/core/utils/routes";
import moment from "jalali-moment";
import ShowLocation from "./ShowLocation";
@@ -42,7 +42,7 @@ const AzmayeshList = () => {
enableColumnFilter: false,
datatype: "text",
filterFn: "equals",
Cell: ({row}) => (<ShowLocation lat={row.original.lat} lng={row.original.lng}/>),
Cell: ({ row }) => <ShowLocation lat={row.original.lat} lng={row.original.lng} />,
},
{
accessorKey: "employer",
@@ -99,8 +99,11 @@ const AzmayeshList = () => {
enableColumnFilter: false,
datatype: "date",
filterFn: "equals",
Cell: ({renderedCellValue}) => (<Typography
variant="body2">{moment(renderedCellValue).locale("fa").format("YYYY/MM/DD")}</Typography>),
Cell: ({ renderedCellValue }) => (
<Typography variant="body2">
{moment(renderedCellValue).locale("fa").format("YYYY/MM/DD")}
</Typography>
),
},
{
accessorKey: "report_date",
@@ -109,8 +112,11 @@ const AzmayeshList = () => {
enableColumnFilter: false,
datatype: "date",
filterFn: "equals",
Cell: ({renderedCellValue}) => (<Typography
variant="body2">{moment(renderedCellValue).locale("fa").format("YYYY/MM/DD")}</Typography>),
Cell: ({ renderedCellValue }) => (
<Typography variant="body2">
{moment(renderedCellValue).locale("fa").format("YYYY/MM/DD")}
</Typography>
),
},
],
[]
@@ -118,7 +124,7 @@ const AzmayeshList = () => {
return (
<>
<Box sx={{p: 1, border: 1, borderColor: "divider", borderRadius: 1}}>
<Box sx={{ p: 1, border: 1, borderColor: "divider", borderRadius: 1 }}>
<DataTableWithAuth
table_title={"لیست آزمایش ها"}
need_filter={false}

View File

@@ -1,14 +1,14 @@
"use client";
import {Marker, useMap} from "react-leaflet";
import {useEffect} from "react";
import { Marker, useMap } from "react-leaflet";
import { useEffect } from "react";
import L from "leaflet";
import AzmayeshActiveIcon from "@/assets/images/examine_marker_active.png";
import {Box, FormControl, InputAdornment, InputLabel, OutlinedInput, Stack, useMediaQuery} from "@mui/material";
import VerifiedIcon from '@mui/icons-material/Verified';
import {useTheme} from "@emotion/react";
import { Box, FormControl, InputAdornment, InputLabel, OutlinedInput, Stack, useMediaQuery } from "@mui/material";
import VerifiedIcon from "@mui/icons-material/Verified";
import { useTheme } from "@emotion/react";
const ShowLocationMarker = ({lat, lng}) => {
const ShowLocationMarker = ({ lat, lng }) => {
const map = useMap();
const theme = useTheme();
const isMobile = useMediaQuery(theme.breakpoints.down("sm"));
@@ -19,35 +19,36 @@ const ShowLocationMarker = ({lat, lng}) => {
iconUrl: iconUrl,
iconSize: size,
iconAnchor: [size[0] / 2, size[1]],
popupAnchor: [0, -size[1]]
popupAnchor: [0, -size[1]],
});
};
useEffect(() => {
map.flyTo({lat: lat, lng: lng}, 14);
map.flyTo({ lat: lat, lng: lng }, 14);
}, []);
return (
<>
<Marker
position={{lat: lat, lng: lng}}
position={{ lat: lat, lng: lng }}
icon={createCustomIcon(defaultIconSize, AzmayeshActiveIcon.src)}
/>
<Box sx={{
zIndex: "400",
position: "absolute",
background: "#ffffff94",
p: 2,
borderRadius: "10px",
boxShadow: "rgba(0, 0, 0, 0.24) 0px 3px 8px",
bottom: "5px",
left: "10px",
right: isMobile ? "10px" : "",
}}>
<Stack sx={{gap: 2}}>
<Box
sx={{
zIndex: "400",
position: "absolute",
background: "#ffffff94",
p: 2,
borderRadius: "10px",
boxShadow: "rgba(0, 0, 0, 0.24) 0px 3px 8px",
bottom: "5px",
left: "10px",
right: isMobile ? "10px" : "",
}}
>
<Stack sx={{ gap: 2 }}>
<FormControl size="small" variant="outlined">
<InputLabel sx={{color: "success.main"}} htmlFor="lat">
<InputLabel sx={{ color: "success.main" }} htmlFor="lat">
طول جغرافیایی
</InputLabel>
<OutlinedInput
@@ -56,22 +57,22 @@ const ShowLocationMarker = ({lat, lng}) => {
size="small"
readOnly
sx={{
'& .MuiOutlinedInput-notchedOutline': {
"& .MuiOutlinedInput-notchedOutline": {
borderColor: "success.main",
},
color: "success.main"
color: "success.main",
}}
value={lat}
endAdornment={
<InputAdornment position="end">
<VerifiedIcon color="success"/>
<VerifiedIcon color="success" />
</InputAdornment>
}
label="طول جغرافیایی"
/>
</FormControl>
<FormControl size="small" variant="outlined">
<InputLabel sx={{color: "success.main"}} htmlFor="lng">
<InputLabel sx={{ color: "success.main" }} htmlFor="lng">
عرض جغرافیایی
</InputLabel>
<OutlinedInput
@@ -80,15 +81,15 @@ const ShowLocationMarker = ({lat, lng}) => {
size="small"
readOnly
sx={{
'& .MuiOutlinedInput-notchedOutline': {
"& .MuiOutlinedInput-notchedOutline": {
borderColor: "success.main",
},
color: "success.main"
color: "success.main",
}}
value={lng}
endAdornment={
<InputAdornment position="end">
<VerifiedIcon color="success"/>
<VerifiedIcon color="success" />
</InputAdornment>
}
label="عرض جغرافیایی"
@@ -100,4 +101,4 @@ const ShowLocationMarker = ({lat, lng}) => {
);
};
export default ShowLocationMarker;
export default ShowLocationMarker;

View File

@@ -1,18 +1,18 @@
"use client";
import ExploreIcon from "@mui/icons-material/Explore";
import {Box, Button, Dialog, DialogActions, DialogContent, IconButton} from "@mui/material";
import {useState} from "react";
import { Box, Button, Dialog, DialogActions, DialogContent, IconButton } from "@mui/material";
import { useState } from "react";
import dynamic from "next/dynamic";
import MapLoading from "@/core/components/MapLayer/Loading";
import ShowLocationMarker from "./ShowLocationMarker";
const MapLayer = dynamic(() => import("@/core/components/MapLayer"), {
loading: () => <MapLoading/>,
loading: () => <MapLoading />,
ssr: false,
});
const ShowLocation = ({lat, lng}) => {
const ShowLocation = ({ lat, lng }) => {
const [openShowLocationModal, setOpenShowLocationModal] = useState(false);
const handleOpenShowLocationModal = () => {
@@ -24,17 +24,19 @@ const ShowLocation = ({lat, lng}) => {
};
return (
<Box sx={{display: "flex", justifyContent: "center"}}>
<IconButton onClick={handleOpenShowLocationModal} size="small" color="primary"><ExploreIcon/></IconButton>
<Box sx={{ display: "flex", justifyContent: "center" }}>
<IconButton onClick={handleOpenShowLocationModal} size="small" color="primary">
<ExploreIcon />
</IconButton>
<Dialog
open={openShowLocationModal}
onClose={handleCloseShowLocationModal}
aria-labelledby="responsive-dialog-title"
>
<DialogContent>
<Box sx={{width: "400px", height: "400px"}}>
<Box sx={{ width: "400px", height: "400px" }}>
<MapLayer>
<ShowLocationMarker lat={lat} lng={lng}/>
<ShowLocationMarker lat={lat} lng={lng} />
</MapLayer>
</Box>
</DialogContent>

View File

@@ -1,9 +1,9 @@
import AzmayeshCreate from "./Actions/Create";
const Toolbar = ({mutate}) => {
const Toolbar = ({ mutate }) => {
return (
<>
<AzmayeshCreate mutate={mutate}/>
<AzmayeshCreate mutate={mutate} />
</>
);
};

View File

@@ -1,14 +1,14 @@
"use client";
import PageTitle from "@/core/components/PageTitle";
import {Stack} from "@mui/material";
import { Stack } from "@mui/material";
import AzmayeshList from "./AzmayeshList";
const TestPage = () => {
return (
<Stack spacing={1}>
<PageTitle title={"آزمایشات"}/>
<AzmayeshList/>
<PageTitle title={"آزمایشات"} />
<AzmayeshList />
</Stack>
);
};

View File

@@ -1,4 +1,4 @@
import {Box, Button, ButtonGroup} from "@mui/material";
import { Box, Button, ButtonGroup } from "@mui/material";
import AutoModeIcon from "@mui/icons-material/AutoMode";
import DeleteIcon from "@mui/icons-material/Delete";
import EditLocationAltIcon from "@mui/icons-material/EditLocationAlt";
@@ -6,31 +6,33 @@ import SaveIcon from "@mui/icons-material/Save";
import CancelIcon from "@mui/icons-material/Cancel";
const MapActionButtons = ({
disableToCreate,
disableToEditAndDelete,
disableToSaveAndCancel,
onDraw,
onEdit,
onRemove,
onSave,
onCancel,
}) => (
disableToCreate,
disableToEditAndDelete,
disableToSaveAndCancel,
onDraw,
onEdit,
onRemove,
onSave,
onCancel,
}) => (
<>
<Box sx={{
background: "#ffffff",
position: "absolute",
zIndex: "1999",
bottom: 0,
left: 0,
p: 2,
pl: 0.5,
pb: 0.5,
borderTopRightRadius: 8,
}}>
<Box
sx={{
background: "#ffffff",
position: "absolute",
zIndex: "1999",
bottom: 0,
left: 0,
p: 2,
pl: 0.5,
pb: 0.5,
borderTopRightRadius: 8,
}}
>
<ButtonGroup variant="contained" orientation="vertical" aria-label="map action group button">
<Button
sx={{justifyContent: "space-between"}}
startIcon={<AutoModeIcon/>}
sx={{ justifyContent: "space-between" }}
startIcon={<AutoModeIcon />}
color="primary"
disabled={disableToCreate}
onClick={onDraw}
@@ -38,8 +40,8 @@ const MapActionButtons = ({
اصلاح
</Button>
<Button
sx={{justifyContent: "space-between"}}
startIcon={<EditLocationAltIcon/>}
sx={{ justifyContent: "space-between" }}
startIcon={<EditLocationAltIcon />}
color="warning"
disabled={disableToEditAndDelete}
onClick={onEdit}
@@ -47,8 +49,8 @@ const MapActionButtons = ({
ویرایش
</Button>
<Button
sx={{justifyContent: "space-between"}}
startIcon={<DeleteIcon/>}
sx={{ justifyContent: "space-between" }}
startIcon={<DeleteIcon />}
color="error"
disabled={disableToEditAndDelete}
onClick={onRemove}
@@ -58,18 +60,20 @@ const MapActionButtons = ({
</ButtonGroup>
</Box>
<Box sx={{
position: "absolute",
zIndex: "1999",
right: 10,
top: 10,
background: "#fff",
borderRadius: 1,
padding: 0.5,
}}>
<Box
sx={{
position: "absolute",
zIndex: "1999",
right: 10,
top: 10,
background: "#fff",
borderRadius: 1,
padding: 0.5,
}}
>
<Button
sx={{justifyContent: "space-between", mr: 1}}
startIcon={<SaveIcon/>}
sx={{ justifyContent: "space-between", mr: 1 }}
startIcon={<SaveIcon />}
variant="outlined"
size="small"
color="success"
@@ -79,8 +83,8 @@ const MapActionButtons = ({
ذخیره
</Button>
<Button
sx={{justifyContent: "space-between"}}
startIcon={<CancelIcon/>}
sx={{ justifyContent: "space-between" }}
startIcon={<CancelIcon />}
variant="outlined"
size="small"
color="error"
@@ -93,4 +97,4 @@ const MapActionButtons = ({
</>
);
export default MapActionButtons;
export default MapActionButtons;

View File

@@ -22,67 +22,72 @@ import GppMaybeIcon from "@mui/icons-material/GppMaybe";
import PolygonForDesign from "./PolygonForDesign";
const MapLayer = dynamic(() => import("@/core/components/MapLayer"), {
loading: () => <MapLoading/>,
loading: () => <MapLoading />,
ssr: false,
});
const MapModifyDialog = ({mapModifyModal, setMapModifyModal}) => {
const MapModifyDialog = ({ mapModifyModal, setMapModifyModal }) => {
const handleClose = () => {
setMapModifyModal(false);
};
return (
<Dialog open={mapModifyModal} onClose={handleClose} maxWidth="lg" fullWidth>
<DialogContent sx={{p: 2}} dividers>
<Divider sx={{my: 3}}>
<Chip color="primary" sx={{mx: 1, fontSize: "13px", fontWeight: 500}}
label="بررسی پلیگان طرح متقاضی"/>
<DialogContent sx={{ p: 2 }} dividers>
<Divider sx={{ my: 3 }}>
<Chip
color="primary"
sx={{ mx: 1, fontSize: "13px", fontWeight: 500 }}
label="بررسی پلیگان طرح متقاضی"
/>
</Divider>
<Box sx={{
width: "100%",
height: "400px",
borderRadius: 3,
borderBottomLeftRadius: 0,
overflow: "hidden",
}}>
<Box
sx={{
width: "100%",
height: "400px",
borderRadius: 3,
borderBottomLeftRadius: 0,
overflow: "hidden",
}}
>
<MapLayer>
<PolygonForDesign/>
<PolygonForDesign />
</MapLayer>
</Box>
<Box sx={{display: "flex", my: 2, alignItems: "center"}}>
<GppMaybeIcon color="warning"/>
<Typography variant="button" sx={{color: "warning.main", ml: 1}}>
<Box sx={{ display: "flex", my: 2, alignItems: "center" }}>
<GppMaybeIcon color="warning" />
<Typography variant="button" sx={{ color: "warning.main", ml: 1 }}>
نکته: اصلاح ننمودن طرح به منزله تایید طرح میباشد.
</Typography>
</Box>
<Box sx={{
display: "flex",
alignItems: "center",
justifyContent: "center",
border: "1px solid #e1e1e1",
p: 2,
borderRadius: 1,
}}>
<FormControl sx={{flexDirection: "row", alignItems: "center", gap: 2}}>
<FormLabel id="way-status" sx={{fontWeight: 500, fontSize: "16px", color: "warning.main"}}>آیا
طرح نیاز به ایجاد راه
دسترسی
دارد؟</FormLabel>
<RadioGroup
row
aria-labelledby="way-status"
defaultValue={0}
name="radio-buttons-group"
>
<FormControlLabel value={1} control={<Radio color="warning"/>} label="بله"/>
<FormControlLabel value={0} control={<Radio color="warning"/>} label="خیر"/>
<Box
sx={{
display: "flex",
alignItems: "center",
justifyContent: "center",
border: "1px solid #e1e1e1",
p: 2,
borderRadius: 1,
}}
>
<FormControl sx={{ flexDirection: "row", alignItems: "center", gap: 2 }}>
<FormLabel id="way-status" sx={{ fontWeight: 500, fontSize: "16px", color: "warning.main" }}>
آیا طرح نیاز به ایجاد راه دسترسی دارد؟
</FormLabel>
<RadioGroup row aria-labelledby="way-status" defaultValue={0} name="radio-buttons-group">
<FormControlLabel value={1} control={<Radio color="warning" />} label="بله" />
<FormControlLabel value={0} control={<Radio color="warning" />} label="خیر" />
</RadioGroup>
</FormControl>
</Box>
</DialogContent>
<DialogActions sx={{justifyContent: "center", py: 2}}>
<Button size="large" variant="outlined">بستن</Button>
<Button size="large" variant="contained">ثبت</Button>
<DialogActions sx={{ justifyContent: "center", py: 2 }}>
<Button size="large" variant="outlined">
بستن
</Button>
<Button size="large" variant="contained">
ثبت
</Button>
</DialogActions>
</Dialog>
);

View File

@@ -1,13 +1,12 @@
"use client";
import "leaflet-draw/dist/leaflet.draw.css";
import "@/assets/scss/map-styles.scss"
import {FeatureGroup, useMap} from "react-leaflet";
import {EditControl} from "react-leaflet-draw";
import {useEffect, useRef, useState} from "react";
import "@/assets/scss/map-styles.scss";
import { FeatureGroup, useMap } from "react-leaflet";
import { EditControl } from "react-leaflet-draw";
import { useEffect, useRef, useState } from "react";
import MapActionButtons from "./MapActionButtons";
const PolygonForDesign = () => {
const map = useMap();
const editableFG = useRef(null);
@@ -18,7 +17,7 @@ const PolygonForDesign = () => {
const [editToolbar, setEditToolbar] = useState(null);
useEffect(() => {
const {L} = window;
const { L } = window;
L.drawLocal.draw.handlers.polygon.tooltip = {
start: "برای شروع کشیدن پلیگان، کلیک کنید.",
cont: "گوشه های دیگر پلیگان را نیز انتخاب کنید.",
@@ -31,14 +30,14 @@ const PolygonForDesign = () => {
}, []);
const handleDrawPolygon = () => {
const {L} = window;
const { L } = window;
const drawControl = new L.Draw.Polygon(map);
drawControl.enable();
setDisableToCreate(true);
};
const handleEditPolygon = () => {
const {L} = window;
const { L } = window;
if (editableFG.current && polygonLayer) {
const editControlInstance = new L.EditToolbar.Edit(map, {
featureGroup: editableFG.current,
@@ -98,7 +97,7 @@ const PolygonForDesign = () => {
rectangle: false,
polyline: false,
}}
edit={{edit: false, remove: false}}
edit={{ edit: false, remove: false }}
/>
</FeatureGroup>
<MapActionButtons
@@ -115,4 +114,4 @@ const PolygonForDesign = () => {
);
};
export default PolygonForDesign;
export default PolygonForDesign;

View File

@@ -1,9 +1,9 @@
import {IconButton, Tooltip} from "@mui/material";
import { IconButton, Tooltip } from "@mui/material";
import MapIcon from "@mui/icons-material/Map";
import {useState} from "react";
import { useState } from "react";
import MapModifyDialog from "./MapModifyDialog";
const MapModify = ({rowId, mutate}) => {
const MapModify = ({ rowId, mutate }) => {
const [mapModifyModal, setMapModifyModal] = useState(false);
const openMapModifyDialog = () => {
@@ -14,11 +14,15 @@ const MapModify = ({rowId, mutate}) => {
<>
<Tooltip title="بررسی پلیگان طرح" arrow placement="right">
<IconButton color="primary" onClick={openMapModifyDialog}>
<MapIcon/>
<MapIcon />
</IconButton>
</Tooltip>
<MapModifyDialog mapModifyModal={mapModifyModal} setMapModifyModal={setMapModifyModal} rowId={rowId}
mutate={mutate}/>
<MapModifyDialog
mapModifyModal={mapModifyModal}
setMapModifyModal={setMapModifyModal}
rowId={rowId}
mutate={mutate}
/>
</>
);
};

View File

@@ -1,16 +1,16 @@
import ReferForm from "./Refer";
import TaskDetail from "./TaskDetail";
import {Box} from "@mui/material";
import { Box } from "@mui/material";
import RoadSafetyForm from "./RoadSafetyForm";
import MapModify from "./MapModify";
const RowActions = ({row, mutate}) => {
const RowActions = ({ row, mutate }) => {
return (
<Box sx={{display: "flex", gap: 1}}>
<MapModify mutate={mutate} rowId={row.getValue("id")}/>
<ReferForm mutate={mutate} rowId={row.getValue("id")}/>
<TaskDetail mutate={mutate} rowId={row.getValue("id")}/>
<RoadSafetyForm rowId={row.getValue("id")} mutate={mutate}/>
<Box sx={{ display: "flex", gap: 1 }}>
<MapModify mutate={mutate} rowId={row.getValue("id")} />
<ReferForm mutate={mutate} rowId={row.getValue("id")} />
<TaskDetail mutate={mutate} rowId={row.getValue("id")} />
<RoadSafetyForm rowId={row.getValue("id")} mutate={mutate} />
</Box>
);
};

View File

@@ -18,7 +18,7 @@ import EngineeringIcon from "@mui/icons-material/Engineering";
import ReportIcon from "@mui/icons-material/Report";
import AssignmentLateIcon from "@mui/icons-material/AssignmentLate";
import LineAxisIcon from "@mui/icons-material/LineAxis";
import ScienceIcon from '@mui/icons-material/Science';
import ScienceIcon from "@mui/icons-material/Science";
export const pageMenu = [
{
@@ -26,7 +26,7 @@ export const pageMenu = [
label: "پیشخوان",
type: "page",
route: "/dashboard",
icon: <SpaceDashboardIcon sx={{width: "inherit", height: "inherit"}}/>,
icon: <SpaceDashboardIcon sx={{ width: "inherit", height: "inherit" }} />,
permissions: ["all"],
},
{
@@ -34,14 +34,14 @@ export const pageMenu = [
label: "مدیریت کاربران",
type: "page",
route: process.env.NEXT_PUBLIC_API_URL + "/v2/user_management",
icon: <GroupsIcon sx={{width: "inherit", height: "inherit"}}/>,
icon: <GroupsIcon sx={{ width: "inherit", height: "inherit" }} />,
permissions: ["full-user-management", "limited-user-management"],
},
{
id: "projectsManagment",
label: "پروژه های راهداری",
type: "menu",
icon: <AccountTreeIcon sx={{width: "inherit", height: "inherit"}}/>,
icon: <AccountTreeIcon sx={{ width: "inherit", height: "inherit" }} />,
hasSubitems: true,
Subitems: [
{
@@ -49,7 +49,7 @@ export const pageMenu = [
label: "ثبت قرارداد و پروژه",
type: "page",
route: process.env.NEXT_PUBLIC_API_URL + "/v2/rahdari_projects/finance",
icon: <GavelIcon sx={{width: "inherit", height: "inherit"}}/>,
icon: <GavelIcon sx={{ width: "inherit", height: "inherit" }} />,
permissions: ["show-contract", "show-contract-province"],
},
{
@@ -57,7 +57,7 @@ export const pageMenu = [
label: "لیست پروژه ها",
type: "page",
route: process.env.NEXT_PUBLIC_API_URL + "/v2/rahdari_projects/projects_list",
icon: <BallotIcon sx={{width: "inherit", height: "inherit"}}/>,
icon: <BallotIcon sx={{ width: "inherit", height: "inherit" }} />,
permissions: ["all"],
},
{
@@ -65,7 +65,7 @@ export const pageMenu = [
label: "پروژه های پیشنهادی",
type: "page",
route: process.env.NEXT_PUBLIC_API_URL + "/v2/rahdari_projects/proposal",
icon: <AssistantIcon sx={{width: "inherit", height: "inherit"}}/>,
icon: <AssistantIcon sx={{ width: "inherit", height: "inherit" }} />,
permissions: ["show-proposal", "show-proposal-province"],
},
{
@@ -73,7 +73,7 @@ export const pageMenu = [
label: "درخواست نمایندگان",
type: "page",
route: process.env.NEXT_PUBLIC_API_URL + "/v2/rahdari_projects/lawmakers",
icon: <AdminPanelSettingsIcon sx={{width: "inherit", height: "inherit"}}/>,
icon: <AdminPanelSettingsIcon sx={{ width: "inherit", height: "inherit" }} />,
permissions: ["show-lawmaker", "show-lawmaker-province"],
},
{
@@ -81,7 +81,7 @@ export const pageMenu = [
label: "پراکندگی بر روی نقشه",
type: "page",
route: process.env.NEXT_PUBLIC_API_URL + "/v2/map?type=rahdari_projects",
icon: <MapIcon sx={{width: "inherit", height: "inherit"}}/>,
icon: <MapIcon sx={{ width: "inherit", height: "inherit" }} />,
permissions: ["all"],
},
],
@@ -90,7 +90,7 @@ export const pageMenu = [
id: "roadItemManagment",
label: "فعالیت های روزانه",
type: "menu",
icon: <FactCheckIcon sx={{width: "inherit", height: "inherit"}}/>,
icon: <FactCheckIcon sx={{ width: "inherit", height: "inherit" }} />,
hasSubitems: true,
badges: ["road_items.total"],
Subitems: [
@@ -98,7 +98,7 @@ export const pageMenu = [
id: "roadItemManagmentSupervisor",
label: "ارزیابی",
type: "menu",
icon: <SpeedIcon sx={{width: "inherit", height: "inherit"}}/>,
icon: <SpeedIcon sx={{ width: "inherit", height: "inherit" }} />,
hasSubitems: true,
badges: ["road_items.supervise_cnt"],
Subitems: [
@@ -118,7 +118,7 @@ export const pageMenu = [
id: "roadItemManagmentOparation",
label: "عملیات",
type: "menu",
icon: <EngineeringIcon sx={{width: "inherit", height: "inherit"}}/>,
icon: <EngineeringIcon sx={{ width: "inherit", height: "inherit" }} />,
hasSubitems: true,
badges: ["road_items.operation_cnt"],
Subitems: [
@@ -143,7 +143,7 @@ export const pageMenu = [
label: "پراکندگی بر روی نقشه",
type: "page",
route: process.env.NEXT_PUBLIC_API_URL + "/v2/map?type=road_items",
icon: <MapIcon sx={{width: "inherit", height: "inherit"}}/>,
icon: <MapIcon sx={{ width: "inherit", height: "inherit" }} />,
permissions: [
"show-road-item-supervise-cartable",
"show-road-item-supervise-cartable-province",
@@ -155,7 +155,7 @@ export const pageMenu = [
label: "گزارش ها",
type: "page",
route: process.env.NEXT_PUBLIC_API_URL + "/v2/road_items/report",
icon: <ReportIcon sx={{width: "inherit", height: "inherit"}}/>,
icon: <ReportIcon sx={{ width: "inherit", height: "inherit" }} />,
permissions: [
"show-road-item-supervise-cartable",
"show-road-item-supervise-cartable-province",
@@ -168,7 +168,7 @@ export const pageMenu = [
id: "roadPatrolManagment",
label: "گشت راهداری و ترابری",
type: "menu",
icon: <FireTruckIcon sx={{width: "inherit", height: "inherit"}}/>,
icon: <FireTruckIcon sx={{ width: "inherit", height: "inherit" }} />,
hasSubitems: true,
badges: ["road_patrols.total"],
Subitems: [
@@ -176,7 +176,7 @@ export const pageMenu = [
id: "roadPatrolManagmentSupervisor",
label: "ارزیابی",
type: "menu",
icon: <SpeedIcon sx={{width: "inherit", height: "inherit"}}/>,
icon: <SpeedIcon sx={{ width: "inherit", height: "inherit" }} />,
hasSubitems: true,
badges: ["road_patrols.supervise_cnt"],
Subitems: [
@@ -196,7 +196,7 @@ export const pageMenu = [
id: "roadPatrolManagmentOparation",
label: "عملیات",
type: "menu",
icon: <EngineeringIcon sx={{width: "inherit", height: "inherit"}}/>,
icon: <EngineeringIcon sx={{ width: "inherit", height: "inherit" }} />,
hasSubitems: true,
badges: ["road_patrols.operation_cnt"],
Subitems: [
@@ -221,7 +221,7 @@ export const pageMenu = [
label: "پراکندگی بر روی نقشه",
type: "page",
route: process.env.NEXT_PUBLIC_API_URL + "/v2/map?type=road_patrols",
icon: <MapIcon sx={{width: "inherit", height: "inherit"}}/>,
icon: <MapIcon sx={{ width: "inherit", height: "inherit" }} />,
permissions: [
"add-road-patrol",
"show-road-patrol-supervise-cartable",
@@ -233,7 +233,7 @@ export const pageMenu = [
label: "گزارش ها",
type: "page",
route: process.env.NEXT_PUBLIC_API_URL + "/v2/road_patrols/report",
icon: <ReportIcon sx={{width: "inherit", height: "inherit"}}/>,
icon: <ReportIcon sx={{ width: "inherit", height: "inherit" }} />,
permissions: [
"add-road-patrol",
"show-road-patrol-supervise-cartable",
@@ -246,7 +246,7 @@ export const pageMenu = [
id: "inquiryPrivacyManagment",
label: "استعلام حریم راه",
type: "menu",
icon: <DoorbellIcon sx={{width: "inherit", height: "inherit"}}/>,
icon: <DoorbellIcon sx={{ width: "inherit", height: "inherit" }} />,
hasSubitems: true,
Subitems: [
{
@@ -283,7 +283,7 @@ export const pageMenu = [
id: "safetyAndPrivacyManagment",
label: "نگهداری حریم راه",
type: "menu",
icon: <RouteIcon sx={{width: "inherit", height: "inherit"}}/>,
icon: <RouteIcon sx={{ width: "inherit", height: "inherit" }} />,
hasSubitems: true,
badges: ["safety_and_privacy.step_one", "safety_and_privacy.step_two"],
Subitems: [
@@ -291,7 +291,7 @@ export const pageMenu = [
id: "safetyAndPrivacyManagmentOparation",
label: "عملیات",
type: "menu",
icon: <EngineeringIcon sx={{width: "inherit", height: "inherit"}}/>,
icon: <EngineeringIcon sx={{ width: "inherit", height: "inherit" }} />,
hasSubitems: true,
Subitems: [
{
@@ -319,7 +319,7 @@ export const pageMenu = [
label: "پراکندگی بر روی نقشه",
type: "page",
route: process.env.NEXT_PUBLIC_API_URL + "/v2/map?type=safety_and_privacy",
icon: <MapIcon sx={{width: "inherit", height: "inherit"}}/>,
icon: <MapIcon sx={{ width: "inherit", height: "inherit" }} />,
permissions: [
"show-safety-and-privacy-operator-cartable",
"show-safety-and-privacy-operator-cartable-province",
@@ -332,7 +332,7 @@ export const pageMenu = [
label: "گزارش ها",
type: "page",
route: process.env.NEXT_PUBLIC_API_URL + "/v2/safety_and_privacy/report",
icon: <ReportIcon sx={{width: "inherit", height: "inherit"}}/>,
icon: <ReportIcon sx={{ width: "inherit", height: "inherit" }} />,
permissions: [
"show-safety-and-privacy-operator-cartable",
"show-safety-and-privacy-operator-cartable-province",
@@ -346,7 +346,7 @@ export const pageMenu = [
id: "roadObservationsManagment",
label: "واکنش سریع",
type: "menu",
icon: <ElectricBoltIcon sx={{width: "inherit", height: "inherit"}}/>,
icon: <ElectricBoltIcon sx={{ width: "inherit", height: "inherit" }} />,
hasSubitems: true,
badges: ["road_observations.total"],
Subitems: [
@@ -354,7 +354,7 @@ export const pageMenu = [
id: "roadObservationsManagmentSupervisor",
label: "ارزیابی",
type: "menu",
icon: <SpeedIcon sx={{width: "inherit", height: "inherit"}}/>,
icon: <SpeedIcon sx={{ width: "inherit", height: "inherit" }} />,
hasSubitems: true,
badges: ["road_observations.supervise_cnt"],
Subitems: [
@@ -372,14 +372,14 @@ export const pageMenu = [
label: "رسیدگی به شکایات",
type: "page",
route: process.env.NEXT_PUBLIC_API_URL + "/v2/road_observations",
icon: <AssignmentLateIcon sx={{width: "inherit", height: "inherit"}}/>,
icon: <AssignmentLateIcon sx={{ width: "inherit", height: "inherit" }} />,
permissions: ["show-fast-react", "show-fast-react-province", "show-fast-react-edarate-shahri"],
},
{
id: "roadObservationsManagmentOparation",
label: "عملیات",
type: "menu",
icon: <EngineeringIcon sx={{width: "inherit", height: "inherit"}}/>,
icon: <EngineeringIcon sx={{ width: "inherit", height: "inherit" }} />,
hasSubitems: true,
badges: ["road_observations.operation_cnt"],
Subitems: [
@@ -397,7 +397,7 @@ export const pageMenu = [
label: "پراکندگی بر روی نقشه",
type: "page",
route: process.env.NEXT_PUBLIC_API_URL + "/v2/map?type=road_observations",
icon: <MapIcon sx={{width: "inherit", height: "inherit"}}/>,
icon: <MapIcon sx={{ width: "inherit", height: "inherit" }} />,
permissions: ["all"],
},
{
@@ -405,7 +405,7 @@ export const pageMenu = [
label: "گزارش ها",
type: "page",
route: process.env.NEXT_PUBLIC_API_URL + "/v2/road_observations/report/index",
icon: <ReportIcon sx={{width: "inherit", height: "inherit"}}/>,
icon: <ReportIcon sx={{ width: "inherit", height: "inherit" }} />,
permissions: ["all"],
},
],
@@ -414,7 +414,7 @@ export const pageMenu = [
id: "winterCampManagment",
label: "قرارگاه زمستانی",
type: "menu",
icon: <CottageIcon sx={{width: "inherit", height: "inherit"}}/>,
icon: <CottageIcon sx={{ width: "inherit", height: "inherit" }} />,
hasSubitems: true,
Subitems: [
{
@@ -422,7 +422,7 @@ export const pageMenu = [
label: "محور های انسدادی",
type: "page",
route: process.env.NEXT_PUBLIC_API_URL + "/v2/winter_camp",
icon: <LineAxisIcon sx={{width: "inherit", height: "inherit"}}/>,
icon: <LineAxisIcon sx={{ width: "inherit", height: "inherit" }} />,
permissions: ["show-camp", "show-camp-province"],
},
{
@@ -430,7 +430,7 @@ export const pageMenu = [
label: "محور های حلقه اول",
type: "page",
route: process.env.NEXT_PUBLIC_API_URL + "/v2/map?type=camp",
icon: <LineAxisIcon sx={{width: "inherit", height: "inherit"}}/>,
icon: <LineAxisIcon sx={{ width: "inherit", height: "inherit" }} />,
permissions: ["show-camp", "show-camp-province"],
},
{
@@ -438,7 +438,7 @@ export const pageMenu = [
label: "گزارش ها",
type: "page",
route: process.env.NEXT_PUBLIC_API_URL + "/v2/map?type=campNew",
icon: <ReportIcon sx={{width: "inherit", height: "inherit"}}/>,
icon: <ReportIcon sx={{ width: "inherit", height: "inherit" }} />,
permissions: ["show-camp", "show-camp-province"],
},
],
@@ -447,14 +447,14 @@ export const pageMenu = [
id: "receiptManagment",
label: "خسارات وارده بر ابنیه فنی و تاسیسات راه",
type: "menu",
icon: <GppMaybeIcon sx={{width: "inherit", height: "inherit"}}/>,
icon: <GppMaybeIcon sx={{ width: "inherit", height: "inherit" }} />,
hasSubitems: true,
Subitems: [
{
id: "receiptManagmentOparation",
label: "عملیات",
type: "menu",
icon: <EngineeringIcon sx={{width: "inherit", height: "inherit"}}/>,
icon: <EngineeringIcon sx={{ width: "inherit", height: "inherit" }} />,
hasSubitems: true,
Subitems: [
{
@@ -471,17 +471,17 @@ export const pageMenu = [
label: "گزارش ها",
type: "page",
route: process.env.NEXT_PUBLIC_API_URL + "/v2/receipt/report",
icon: <ReportIcon sx={{width: "inherit", height: "inherit"}}/>,
icon: <ReportIcon sx={{ width: "inherit", height: "inherit" }} />,
permissions: ["all"],
},
],
},
{
id: "test",
id: "azmayesh",
label: "آزمایشات",
type: "page",
route: "/dashboard/test",
icon: <ScienceIcon sx={{width: "inherit", height: "inherit"}}/>,
route: "/dashboard/azmayesh",
icon: <ScienceIcon sx={{ width: "inherit", height: "inherit" }} />,
permissions: ["all"],
},
];

View File

@@ -1,5 +1,5 @@
import {useEffect, useState} from "react";
import {GET_AZMAYESH_TYPE_LIST} from "@/core/utils/routes";
import { useEffect, useState } from "react";
import { GET_AZMAYESH_TYPE_LIST } from "@/core/utils/routes";
import useRequest from "@/lib/hooks/useRequest";
const useAzmayesh = () => {
@@ -24,7 +24,7 @@ const useAzmayesh = () => {
fetchTests();
}, []);
return {azmayeshes, loadingAzmayeshes, errorAzmayeshes};
return { azmayeshes, loadingAzmayeshes, errorAzmayeshes };
};
export default useAzmayesh;

View File

@@ -1,5 +1,5 @@
import {useEffect, useState} from "react";
import {GET_PROVINCE_LISTS} from "@/core/utils/routes";
import { useEffect, useState } from "react";
import { GET_PROVINCE_LISTS } from "@/core/utils/routes";
import useRequest from "@/lib/hooks/useRequest";
const useProvinces = () => {
@@ -24,7 +24,7 @@ const useProvinces = () => {
fetchCities(); // Call the fetch function
}, []); // Empty dependency array to ensure it only runs once
return {provinces, loadingProvinces, errorProvinces};
return { provinces, loadingProvinces, errorProvinces };
};
export default useProvinces;