diff --git a/package.json b/package.json index 9641fc0..b59745d 100644 --- a/package.json +++ b/package.json @@ -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" } -} +} \ No newline at end of file diff --git a/src/app/(withAuth)/dashboard/azmayesh/page.js b/src/app/(withAuth)/dashboard/azmayesh/page.js index eca1b9d..27f1bd7 100644 --- a/src/app/(withAuth)/dashboard/azmayesh/page.js +++ b/src/app/(withAuth)/dashboard/azmayesh/page.js @@ -1,7 +1,7 @@ import TestPage from "@/components/dashboard/azmayesh"; const Page = () => { - return ; + return ; }; export default Page; diff --git a/src/app/api/fake-tests-type/route.js b/src/app/api/fake-tests-type/route.js index 943b759..7d41c3e 100644 --- a/src/app/api/fake-tests-type/route.js +++ b/src/app/api/fake-tests-type/route.js @@ -14,5 +14,5 @@ const data = [ ]; export async function GET() { - return Response.json({data}); + return Response.json({ data }); } diff --git a/src/app/api/fake-tests/route.js b/src/app/api/fake-tests/route.js index 7d9c077..3918bf0 100644 --- a/src/app/api/fake-tests/route.js +++ b/src/app/api/fake-tests/route.js @@ -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 }); } diff --git a/src/assets/scss/global.scss b/src/assets/scss/global.scss index 5db6087..7b73e7e 100644 --- a/src/assets/scss/global.scss +++ b/src/assets/scss/global.scss @@ -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; -} \ No newline at end of file + 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; +} diff --git a/src/assets/scss/map-styles.scss b/src/assets/scss/map-styles.scss index 2dd81bb..44e6651 100644 --- a/src/assets/scss/map-styles.scss +++ b/src/assets/scss/map-styles.scss @@ -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; } diff --git a/src/components/dashboard/azmayesh/Actions/Create/CreateDialog/AzmayeshGeneralInfo.jsx b/src/components/dashboard/azmayesh/Actions/Create/CreateDialog/AzmayeshGeneralInfo.jsx index f8e9345..e5b160a 100644 --- a/src/components/dashboard/azmayesh/Actions/Create/CreateDialog/AzmayeshGeneralInfo.jsx +++ b/src/components/dashboard/azmayesh/Actions/Create/CreateDialog/AzmayeshGeneralInfo.jsx @@ -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 ( - + ( - - + render={({ field: { onChange, value }, fieldState: { error } }) => ( + + {errorAzmayeshes ? ( - + خطایی در دریافت لیست آزمایش ها رخ داده است! ) : loadingAzmayeshes ? ( - - + + درحال دریافت لیست آزمایش ها ) : ( @@ -78,23 +75,20 @@ const AzmayeshGeneralInfo = ({control, register, setValue, errors}) => { )} /> - + ( - - + render={({ field: { onChange, value }, fieldState: { error } }) => ( + + {errorProvinces ? ( - + خطایی در دریافت لیست استان ها رخ داده است! ) : loadingProvinces ? ( - - + + درحال دریافت لیست استان ها ) : ( @@ -129,11 +123,8 @@ const AzmayeshGeneralInfo = ({control, register, setValue, errors}) => { /> - - - پروژه - + + پروژه { - - کارفرما - + کارفرما { fullWidth type="text" /> - - {errors.employer ? errors.employer.message : null} - + {errors.employer ? errors.employer.message : null} - - مشاور - + مشاور { - - پیمانکار - + پیمانکار { - - متقاضی - + متقاضی { fullWidth type="text" /> - - {errors.applicant ? errors.applicant.message : null} - + {errors.applicant ? errors.applicant.message : null} - - شماره کار - + شماره کار { - - - شماره درخواست - + + شماره درخواست { name="request_date" control={control} defaultValue={new Date()} - render={({field: {onChange, value}, fieldState: {error}}) => ( - + render={({ field: { onChange, value }, fieldState: { error } }) => ( + { }, }} > - + ), @@ -327,13 +296,8 @@ const AzmayeshGeneralInfo = ({control, register, setValue, errors}) => { name="report_date" control={control} defaultValue={new Date()} - render={({field: {onChange, value}, fieldState: {error}}) => ( - + render={({ field: { onChange, value }, fieldState: { error } }) => ( + { }, }} > - + ), @@ -384,4 +348,4 @@ const AzmayeshGeneralInfo = ({control, register, setValue, errors}) => { ); }; -export default AzmayeshGeneralInfo; \ No newline at end of file +export default AzmayeshGeneralInfo; diff --git a/src/components/dashboard/azmayesh/Actions/Create/CreateDialog/ChooseLocation.jsx b/src/components/dashboard/azmayesh/Actions/Create/CreateDialog/ChooseLocation.jsx index 724de0f..4986e19 100644 --- a/src/components/dashboard/azmayesh/Actions/Create/CreateDialog/ChooseLocation.jsx +++ b/src/components/dashboard/azmayesh/Actions/Create/CreateDialog/ChooseLocation.jsx @@ -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 ( <> - - + + - + طول جغرافیایی { 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={ - {mapBoxData ? : - } + {mapBoxData ? ( + + ) : ( + + )} } label="طول جغرافیایی" @@ -129,7 +134,7 @@ 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={ - {mapBoxData ? : - } + {mapBoxData ? ( + + ) : ( + + )} } label="عرض جغرافیایی" /> - + ); }; -export default ChooseLocation; \ No newline at end of file +export default ChooseLocation; diff --git a/src/components/dashboard/azmayesh/Actions/Create/CreateDialog/CreateTimeLine.jsx b/src/components/dashboard/azmayesh/Actions/Create/CreateDialog/CreateTimeLine.jsx index 49a7d90..61ab92c 100644 --- a/src/components/dashboard/azmayesh/Actions/Create/CreateDialog/CreateTimeLine.jsx +++ b/src/components/dashboard/azmayesh/Actions/Create/CreateDialog/CreateTimeLine.jsx @@ -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 ( - - + + - - - + + + - + - - - نقشه + + نقشه + + ثبت مختصات محل آزمایش - ثبت مختصات محل - آزمایش - - - + + + - + - - - مشخصات آزمایش + + مشخصات آزمایش + + ثبت مشخصات اولیه - ثبت مشخصات اولیه diff --git a/src/components/dashboard/azmayesh/Actions/Create/CreateDialog/MapBox.jsx b/src/components/dashboard/azmayesh/Actions/Create/CreateDialog/MapBox.jsx index 8b1611c..a09e986 100644 --- a/src/components/dashboard/azmayesh/Actions/Create/CreateDialog/MapBox.jsx +++ b/src/components/dashboard/azmayesh/Actions/Create/CreateDialog/MapBox.jsx @@ -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: () => , + loading: () => , ssr: false, }); -const MapBox = ({mapBoxData, setMapBoxData}) => { +const MapBox = ({ mapBoxData, setMapBoxData }) => { return ( - - + + { }} > - + diff --git a/src/components/dashboard/azmayesh/Actions/Create/CreateDialog/index.jsx b/src/components/dashboard/azmayesh/Actions/Create/CreateDialog/index.jsx index 2ed5836..425725d 100644 --- a/src/components/dashboard/azmayesh/Actions/Create/CreateDialog/index.jsx +++ b/src/components/dashboard/azmayesh/Actions/Create/CreateDialog/index.jsx @@ -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 ( -