fixed bug and formatting
This commit is contained in:
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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>
|
||||
|
||||
@@ -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>
|
||||
|
||||
@@ -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>
|
||||
|
||||
@@ -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} />}
|
||||
</>
|
||||
);
|
||||
};
|
||||
|
||||
@@ -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}
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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>
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
import AzmayeshCreate from "./Actions/Create";
|
||||
|
||||
const Toolbar = ({mutate}) => {
|
||||
const Toolbar = ({ mutate }) => {
|
||||
return (
|
||||
<>
|
||||
<AzmayeshCreate mutate={mutate}/>
|
||||
<AzmayeshCreate mutate={mutate} />
|
||||
</>
|
||||
);
|
||||
};
|
||||
|
||||
@@ -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>
|
||||
);
|
||||
};
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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>
|
||||
);
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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}
|
||||
/>
|
||||
</>
|
||||
);
|
||||
};
|
||||
|
||||
@@ -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>
|
||||
);
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user