diff --git a/.env.local.example b/.env.local.example index 99ed3dd..97a28ac 100644 --- a/.env.local.example +++ b/.env.local.example @@ -1,3 +1,3 @@ -NEXT_PUBLIC_VERSION="0.7.0" +NEXT_PUBLIC_VERSION="0.7.1" NEXT_PUBLIC_API_URL="https://rms.witel.ir" NEXT_PUBLIC_MAPTILE_ENDPOINT="https://rmsmap.rmto.ir/141map" \ No newline at end of file diff --git a/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 new file mode 100644 index 0000000..27f1bd7 --- /dev/null +++ b/src/app/(withAuth)/dashboard/azmayesh/page.js @@ -0,0 +1,7 @@ +import TestPage from "@/components/dashboard/azmayesh"; + +const Page = () => { + return ; +}; + +export default Page; diff --git a/src/app/(withAuth)/dashboard/test/page.js b/src/app/(withAuth)/dashboard/test/page.js deleted file mode 100644 index 7baafa7..0000000 --- a/src/app/(withAuth)/dashboard/test/page.js +++ /dev/null @@ -1,7 +0,0 @@ -import TestPage from "@/components/dashboard/test"; - -const Page = () => { - 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/test/Actions/create/CreateDialog/TestGeneralInfo.jsx b/src/components/dashboard/azmayesh/Actions/Create/CreateDialog/AzmayeshGeneralInfo.jsx similarity index 78% rename from src/components/dashboard/test/Actions/create/CreateDialog/TestGeneralInfo.jsx rename to src/components/dashboard/azmayesh/Actions/Create/CreateDialog/AzmayeshGeneralInfo.jsx index d424a1a..e5b160a 100644 --- a/src/components/dashboard/test/Actions/create/CreateDialog/TestGeneralInfo.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,49 +12,46 @@ import { InputLabel, OutlinedInput, TextField, - Typography + Typography, } from "@mui/material"; -import useTest from "@/lib/hooks/useTest"; +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 TestGeneralInfo = ({control, register, setValue, errors}) => { - const {tests, errorTests, loadingTests} = useTest(); - const {provinces, errorProvinces, loadingProvinces} = useProvinces(); +const AzmayeshGeneralInfo = ({ control, register, setValue, errors }) => { + const { azmayeshes, errorAzmayeshes, loadingAzmayeshes } = useAzmayesh(); + const { provinces, errorProvinces, loadingProvinces } = useProvinces(); return ( - + ( - - - {errorTests ? ( - + render={({ field: { onChange, value }, fieldState: { error } }) => ( + + + {errorAzmayeshes ? ( + خطایی در دریافت لیست آزمایش ها رخ داده است! - ) : loadingTests ? ( - - + ) : loadingAzmayeshes ? ( + + درحال دریافت لیست آزمایش ها ) : ( test.id === value) || null} + value={azmayeshes.find((azmayesh) => azmayesh.id === value) || null} disablePortal - options={tests} - getOptionLabel={(test) => test.name} + options={azmayeshes} + getOptionLabel={(azmayesh) => azmayesh.name} isOptionEqualToValue={(option, value) => option.id === value?.id} onChange={(event, newValue) => { onChange(newValue ? newValue.id : ""); @@ -78,23 +75,20 @@ const TestGeneralInfo = ({control, register, setValue, errors}) => { )} /> - + ( - - + render={({ field: { onChange, value }, fieldState: { error } }) => ( + + {errorProvinces ? ( - + خطایی در دریافت لیست استان ها رخ داده است! ) : loadingProvinces ? ( - - + + درحال دریافت لیست استان ها ) : ( @@ -129,11 +123,8 @@ const TestGeneralInfo = ({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 TestGeneralInfo = ({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 TestGeneralInfo = ({control, register, setValue, errors}) => { ); }; -export default TestGeneralInfo; \ No newline at end of file +export default AzmayeshGeneralInfo; diff --git a/src/components/dashboard/test/Actions/create/CreateDialog/ChooseLocation.jsx b/src/components/dashboard/azmayesh/Actions/Create/CreateDialog/ChooseLocation.jsx similarity index 53% rename from src/components/dashboard/test/Actions/create/CreateDialog/ChooseLocation.jsx rename to src/components/dashboard/azmayesh/Actions/Create/CreateDialog/ChooseLocation.jsx index 433543e..4986e19 100644 --- a/src/components/dashboard/test/Actions/create/CreateDialog/ChooseLocation.jsx +++ b/src/components/dashboard/azmayesh/Actions/Create/CreateDialog/ChooseLocation.jsx @@ -1,10 +1,10 @@ "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 TestIcon from "@/assets/images/examine_marker.png"; -import TestActiveIcon from "@/assets/images/examine_marker_active.png"; +import AzmayeshIcon from "@/assets/images/examine_marker.png"; +import AzmayeshActiveIcon from "@/assets/images/examine_marker_active.png"; import { Box, Button, @@ -14,92 +14,97 @@ 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")); - const mapTestMarker = useRef(); + const mapAzmayeshMarker = useRef(); const defaultIconSize = [35, 35]; const createCustomIcon = (size, iconUrl) => { return L.icon({ iconUrl: iconUrl, iconSize: size, iconAnchor: [size[0] / 2, size[1]], - popupAnchor: [0, -size[1]] + popupAnchor: [0, -size[1]], }); }; const map = useMapEvents({ move(e) { if (!mapBoxData) { - mapTestMarker.current.setLatLng(e.target.getCenter()); + mapAzmayeshMarker.current.setLatLng(e.target.getCenter()); } }, movestart() { if (!mapBoxData) { - mapTestMarker.current.setIcon(createCustomIcon([45, 45], TestIcon.src)); + mapAzmayeshMarker.current.setIcon(createCustomIcon([45, 45], AzmayeshIcon.src)); } }, moveend() { if (!mapBoxData) { - mapTestMarker.current.setIcon(createCustomIcon(defaultIconSize, TestIcon.src)); + mapAzmayeshMarker.current.setIcon(createCustomIcon(defaultIconSize, AzmayeshIcon.src)); } - } + }, }); useEffect(() => { - if (mapTestMarker.current) { + if (mapAzmayeshMarker.current) { const newIcon = mapBoxData - ? createCustomIcon([45, 45], TestActiveIcon.src) - : createCustomIcon(defaultIconSize, TestIcon.src); - mapTestMarker.current.setIcon(newIcon); + ? createCustomIcon([45, 45], AzmayeshActiveIcon.src) + : createCustomIcon(defaultIconSize, AzmayeshIcon.src); + mapAzmayeshMarker.current.setIcon(newIcon); } if (mapBoxData) { - mapTestMarker.current.setLatLng(mapBoxData); + mapAzmayeshMarker.current.setLatLng(mapBoxData); map.flyTo(mapBoxData, 14); } }, [mapBoxData]); const handleMarkerClick = () => { if (!mapBoxData) { - setMapBoxData({lat: mapTestMarker.current.getLatLng().lat, lng: mapTestMarker.current.getLatLng().lng}); + setMapBoxData({ + lat: mapAzmayeshMarker.current.getLatLng().lat, + 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="طول جغرافیایی" @@ -126,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 new file mode 100644 index 0000000..61ab92c --- /dev/null +++ b/src/components/dashboard/azmayesh/Actions/Create/CreateDialog/CreateTimeLine.jsx @@ -0,0 +1,65 @@ +"use client"; + +import { Box, Typography } from "@mui/material"; +import TextSnippetIcon from "@mui/icons-material/TextSnippet"; +import TravelExploreIcon from "@mui/icons-material/TravelExplore"; +import { + Timeline, + TimelineConnector, + TimelineContent, + TimelineDot, + TimelineItem, + timelineItemClasses, + TimelineSeparator, +} from "@mui/lab"; + +const CreateTimeLine = ({ tabState }) => { + return ( + + + + + + + + + + + + نقشه + + ثبت مختصات محل آزمایش + + + + + + + + + + + + + مشخصات آزمایش + + ثبت مشخصات اولیه + + + + + + ); +}; +export default CreateTimeLine; diff --git a/src/components/dashboard/test/Actions/create/CreateDialog/MapBox.jsx b/src/components/dashboard/azmayesh/Actions/Create/CreateDialog/MapBox.jsx similarity index 61% rename from src/components/dashboard/test/Actions/create/CreateDialog/MapBox.jsx rename to src/components/dashboard/azmayesh/Actions/Create/CreateDialog/MapBox.jsx index 8b1611c..a09e986 100644 --- a/src/components/dashboard/test/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/test/Actions/create/CreateDialog/index.jsx b/src/components/dashboard/azmayesh/Actions/Create/CreateDialog/index.jsx similarity index 53% rename from src/components/dashboard/test/Actions/create/CreateDialog/index.jsx rename to src/components/dashboard/azmayesh/Actions/Create/CreateDialog/index.jsx index f52c42a..425725d 100644 --- a/src/components/dashboard/test/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_TEST} from "@/core/utils/routes"; -import TestGeneralInfo from "@/components/dashboard/test/Actions/create/CreateDialog/TestGeneralInfo"; +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 ( -