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",

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,7 +62,7 @@ const data = [
work_number: "شماره کار",
request_number: "شماره درخواست",
request_date: "تاریخ درخواست",
report_date: "تاریخ گزارش"
report_date: "تاریخ گزارش",
},
];

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,
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

@@ -12,7 +12,7 @@ import {
InputLabel,
OutlinedInput,
TextField,
Typography
Typography,
} from "@mui/material";
import useAzmayesh from "@/lib/hooks/useAzmayesh";
import useProvinces from "@/lib/hooks/useProvince";
@@ -28,18 +28,15 @@ const AzmayeshGeneralInfo = ({control, register, setValue, errors}) => {
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">
<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 ? (
@@ -78,18 +75,15 @@ 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">
<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 ? (
@@ -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={"شماره درخواست"}
@@ -269,12 +243,7 @@ const AzmayeshGeneralInfo = ({control, register, setValue, errors}) => {
control={control}
defaultValue={new Date()}
render={({ field: { onChange, value }, fieldState: { error } }) => (
<FormControl
error={!!errors.request_date}
fullWidth
size="small"
variant="outlined"
>
<FormControl error={!!errors.request_date} fullWidth size="small" variant="outlined">
<LocalizationProvider
dateAdapter={AdapterDateFnsJalali}
localeText={faIR.components.MuiLocalizationProvider.defaultProps.localeText}
@@ -328,12 +297,7 @@ const AzmayeshGeneralInfo = ({control, register, setValue, errors}) => {
control={control}
defaultValue={new Date()}
render={({ field: { onChange, value }, fieldState: { error } }) => (
<FormControl
error={!!errors.report_date}
fullWidth
size="small"
variant="outlined"
>
<FormControl error={!!errors.report_date} fullWidth size="small" variant="outlined">
<LocalizationProvider
dateAdapter={AdapterDateFnsJalali}
localeText={faIR.components.MuiLocalizationProvider.defaultProps.localeText}

View File

@@ -14,11 +14,11 @@ 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 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 }) => {
@@ -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,14 +71,14 @@ 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 (
<>
@@ -88,7 +88,8 @@ const ChooseLocation = ({mapBoxData, setMapBoxData}) => {
eventHandlers={{ click: handleMarkerClick }}
icon={createCustomIcon(defaultIconSize, AzmayeshIcon.src)}
/>
<Box sx={{
<Box
sx={{
zIndex: "400",
position: "absolute",
background: "#ffffff94",
@@ -98,7 +99,8 @@ const ChooseLocation = ({mapBoxData, setMapBoxData}) => {
bottom: "5px",
left: "10px",
right: isMobile ? "10px" : "",
}}>
}}
>
<Stack sx={{ gap: 2 }}>
<Tooltip title="با کلیک بر روی مارکر، محل آزمایش را انتخاب کنید" arrow>
<FormControl size="small" variant="outlined">
@@ -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="طول جغرافیایی"
@@ -138,24 +143,34 @@ 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>
</>

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 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 }) => {
return (
<Box sx={{ display: "flex", alignItems: "center" }}>
<Timeline position="right" sx={{
[`& .${timelineItemClasses.root}:before`]: {flex: 0, padding: 0}
}}>
<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"}}/>
<TravelExploreIcon
color={tabState === 0 ? "primary" : "error"}
sx={{ width: "1.5rem", height: "1.5rem" }}
/>
</TimelineDot>
<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"}}/>
<TextSnippetIcon
color={tabState === 1 ? "primary" : "error"}
sx={{ width: "1.5rem", height: "1.5rem" }}
/>
</TimelineDot>
<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

@@ -13,13 +13,15 @@ const MapLayer = dynamic(() => import("@/core/components/MapLayer"), {
const MapBox = ({ mapBoxData, setMapBoxData }) => {
return (
<Stack spacing={1} sx={{ height: "500px" }}>
<Box sx={{
<Box
sx={{
p: 1,
border: "1px dashed",
borderColor: "divider",
borderRadius: 1,
height: "100%"
}}>
height: "100%",
}}
>
<Box
sx={{
height: "100%",

View File

@@ -4,12 +4,12 @@ import {Box, Button, Dialog, DialogActions, DialogContent, Tab, Tabs, useMediaQu
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 StyledForm from "@/core/components/StyledForm";
@@ -24,15 +24,8 @@ function TabPanel(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>
);
}
@@ -55,7 +48,7 @@ const CreateDialog = ({open, setOpen, mutate}) => {
if (tabState === 0) {
handleClose();
} else {
setTabState(tabState - 1)
setTabState(tabState - 1);
}
};
@@ -123,21 +116,24 @@ 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}
<Tabs
allowScrollButtonsMobile
value={tabState}
onChange={handleChangeTab}
variant={`${isMobile ? "scrollable" : "fullWidth"}`}
sx={{
display: "flex",
justifyContent: "space-around",
width: "100%",
backgroundColor: "#efefef"
}}>
backgroundColor: "#efefef",
}}
>
<Tab icon={<TravelExploreIcon />} label="انتخاب محل آزمایش"></Tab>
<Tab disabled={!mapBoxData} icon={<TextSnippetIcon />} label="مشخصات آزمایش"></Tab>
</Tabs>
@@ -147,8 +143,12 @@ const CreateDialog = ({open, setOpen, mutate}) => {
<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 && (
@@ -158,24 +158,36 @@ const CreateDialog = ({open, setOpen, mutate}) => {
)}
</DialogContent>
<DialogActions sx={{ alignItems: "center", justifyContent: "center" }}>
<Button onClick={handlePrev} variant="outlined" color="error" size="large"
startIcon={tabState === 0 ? <ExitToAppIcon/> : <KeyboardDoubleArrowRightIcon/>}>
<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"
{tabState === 0 ? (
<Button
onClick={() => setTabState(tabState + 1)}
variant="contained"
size="large"
disabled={!mapBoxData}
endIcon={<KeyboardDoubleArrowLeftIcon/>}>
endIcon={<KeyboardDoubleArrowLeftIcon />}
>
مرحله بعد
</Button> : <Button variant="contained"
</Button>
) : (
<Button
variant="contained"
size="large"
disabled={isSubmitting}
type={"submit"}
endIcon={<BeenhereIcon/>}>
endIcon={<BeenhereIcon />}
>
{isSubmitting ? "در حال ثبت آزمایش" : "ثبت آزمایش"}
</Button>
}
)}
</DialogActions>
</StyledForm>
</Dialog>

View File

@@ -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>
),
},
],
[]

View File

@@ -5,7 +5,7 @@ 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 VerifiedIcon from "@mui/icons-material/Verified";
import { useTheme } from "@emotion/react";
const ShowLocationMarker = ({ lat, lng }) => {
@@ -19,7 +19,7 @@ const ShowLocationMarker = ({lat, lng}) => {
iconUrl: iconUrl,
iconSize: size,
iconAnchor: [size[0] / 2, size[1]],
popupAnchor: [0, -size[1]]
popupAnchor: [0, -size[1]],
});
};
@@ -27,14 +27,14 @@ const ShowLocationMarker = ({lat, lng}) => {
map.flyTo({ lat: lat, lng: lng }, 14);
}, []);
return (
<>
<Marker
position={{ lat: lat, lng: lng }}
icon={createCustomIcon(defaultIconSize, AzmayeshActiveIcon.src)}
/>
<Box sx={{
<Box
sx={{
zIndex: "400",
position: "absolute",
background: "#ffffff94",
@@ -44,7 +44,8 @@ const ShowLocationMarker = ({lat, lng}) => {
bottom: "5px",
left: "10px",
right: isMobile ? "10px" : "",
}}>
}}
>
<Stack sx={{ gap: 2 }}>
<FormControl size="small" variant="outlined">
<InputLabel sx={{ color: "success.main" }} htmlFor="lat">
@@ -56,10 +57,10 @@ const ShowLocationMarker = ({lat, lng}) => {
size="small"
readOnly
sx={{
'& .MuiOutlinedInput-notchedOutline': {
"& .MuiOutlinedInput-notchedOutline": {
borderColor: "success.main",
},
color: "success.main"
color: "success.main",
}}
value={lat}
endAdornment={
@@ -80,10 +81,10 @@ const ShowLocationMarker = ({lat, lng}) => {
size="small"
readOnly
sx={{
'& .MuiOutlinedInput-notchedOutline': {
"& .MuiOutlinedInput-notchedOutline": {
borderColor: "success.main",
},
color: "success.main"
color: "success.main",
}}
value={lng}
endAdornment={

View File

@@ -25,7 +25,9 @@ const ShowLocation = ({lat, lng}) => {
return (
<Box sx={{ display: "flex", justifyContent: "center" }}>
<IconButton onClick={handleOpenShowLocationModal} size="small" color="primary"><ExploreIcon/></IconButton>
<IconButton onClick={handleOpenShowLocationModal} size="small" color="primary">
<ExploreIcon />
</IconButton>
<Dialog
open={openShowLocationModal}
onClose={handleCloseShowLocationModal}

View File

@@ -16,7 +16,8 @@ const MapActionButtons = ({
onCancel,
}) => (
<>
<Box sx={{
<Box
sx={{
background: "#ffffff",
position: "absolute",
zIndex: "1999",
@@ -26,7 +27,8 @@ const MapActionButtons = ({
pl: 0.5,
pb: 0.5,
borderTopRightRadius: 8,
}}>
}}
>
<ButtonGroup variant="contained" orientation="vertical" aria-label="map action group button">
<Button
sx={{ justifyContent: "space-between" }}
@@ -58,7 +60,8 @@ const MapActionButtons = ({
</ButtonGroup>
</Box>
<Box sx={{
<Box
sx={{
position: "absolute",
zIndex: "1999",
right: 10,
@@ -66,7 +69,8 @@ const MapActionButtons = ({
background: "#fff",
borderRadius: 1,
padding: 0.5,
}}>
}}
>
<Button
sx={{ justifyContent: "space-between", mr: 1 }}
startIcon={<SaveIcon />}

View File

@@ -35,16 +35,21 @@ const MapModifyDialog = ({mapModifyModal, setMapModifyModal}) => {
<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="بررسی پلیگان طرح متقاضی"/>
<Chip
color="primary"
sx={{ mx: 1, fontSize: "13px", fontWeight: 500 }}
label="بررسی پلیگان طرح متقاضی"
/>
</Divider>
<Box sx={{
<Box
sx={{
width: "100%",
height: "400px",
borderRadius: 3,
borderBottomLeftRadius: 0,
overflow: "hidden",
}}>
}}
>
<MapLayer>
<PolygonForDesign />
</MapLayer>
@@ -55,25 +60,21 @@ const MapModifyDialog = ({mapModifyModal, setMapModifyModal}) => {
نکته: اصلاح ننمودن طرح به منزله تایید طرح میباشد.
</Typography>
</Box>
<Box sx={{
<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"
}}
>
<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>
@@ -81,8 +82,12 @@ const MapModifyDialog = ({mapModifyModal, setMapModifyModal}) => {
</Box>
</DialogContent>
<DialogActions sx={{ justifyContent: "center", py: 2 }}>
<Button size="large" variant="outlined">بستن</Button>
<Button size="large" variant="contained">ثبت</Button>
<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 "@/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);

View File

@@ -17,8 +17,12 @@ const MapModify = ({rowId, mutate}) => {
<MapIcon />
</IconButton>
</Tooltip>
<MapModifyDialog mapModifyModal={mapModifyModal} setMapModifyModal={setMapModifyModal} rowId={rowId}
mutate={mutate}/>
<MapModifyDialog
mapModifyModal={mapModifyModal}
setMapModifyModal={setMapModifyModal}
rowId={rowId}
mutate={mutate}
/>
</>
);
};

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 = [
{
@@ -477,10 +477,10 @@ export const pageMenu = [
],
},
{
id: "test",
id: "azmayesh",
label: "آزمایشات",
type: "page",
route: "/dashboard/test",
route: "/dashboard/azmayesh",
icon: <ScienceIcon sx={{ width: "inherit", height: "inherit" }} />,
permissions: ["all"],
},