diff --git a/src/app/(withAuth)/layout.js b/src/app/(withAuth)/layout.js index 63d25a7..60ac863 100644 --- a/src/app/(withAuth)/layout.js +++ b/src/app/(withAuth)/layout.js @@ -1,6 +1,22 @@ +"use client"; import WithAuthMiddleware from "@/core/middlewares/withAuth"; +import LoadingHardPage from "@/core/components/LoadingHardPage"; +import { useAuth } from "@/lib/contexts/auth"; const Layout = ({ children }) => { + const { isAuth, initAuthState, errorState } = useAuth(); + + if (!initAuthState && !isAuth) + return ( + + ); + return {children}; }; diff --git a/src/app/layout.js b/src/app/layout.js index 237d222..66d8c25 100644 --- a/src/app/layout.js +++ b/src/app/layout.js @@ -1,5 +1,6 @@ import { AuthProvider } from "@/lib/contexts/auth"; import { TableSettingProvider } from "@/lib/contexts/tableSetting"; +import favicon from "@/assets/images/favicon.svg"; export const metadata = { title: "سامانه جامع راهداری", @@ -8,6 +9,9 @@ export const metadata = { export default function RootLayout({ children }) { return ( + + + {children} diff --git a/src/app/not-found.js b/src/app/not-found.js new file mode 100644 index 0000000..5d38652 --- /dev/null +++ b/src/app/not-found.js @@ -0,0 +1,16 @@ +"use client"; +import { Box, Stack, Typography } from "@mui/material"; +import SvgNotFound from "@/core/components/svgs/SvgNotFound"; + +export default function NotFound() { + return ( + + + + + + صفحه موردنظر یافت نشد ... + + + ); +} diff --git a/src/assets/images/favicon.svg b/src/assets/images/favicon.svg new file mode 100644 index 0000000..f5943ad --- /dev/null +++ b/src/assets/images/favicon.svg @@ -0,0 +1,25 @@ + + + + + + + + + + + + + + diff --git a/src/components/dashboard/azmayesh/AzmayeshList.jsx b/src/components/dashboard/azmayesh/AzmayeshList.jsx index c3dcb83..4bfd193 100644 --- a/src/components/dashboard/azmayesh/AzmayeshList.jsx +++ b/src/components/dashboard/azmayesh/AzmayeshList.jsx @@ -42,6 +42,7 @@ const AzmayeshList = () => { id: "lat", enableColumnFilter: false, datatype: "text", + enableSorting: false, filterFn: "equals", Cell: ({ row }) => , }, diff --git a/src/components/dashboard/carDetails/CarDetailsContent.jsx b/src/components/dashboard/carDetails/CarDetailsContent.jsx index bce967d..8c709cf 100644 --- a/src/components/dashboard/carDetails/CarDetailsContent.jsx +++ b/src/components/dashboard/carDetails/CarDetailsContent.jsx @@ -1,18 +1,13 @@ -import { - Button, Collapse, - DialogActions, - DialogContent, Grid, - Stack, TextField -} from "@mui/material"; +import { Button, Collapse, DialogActions, DialogContent, Grid, Stack, TextField } from "@mui/material"; import MuiDatePicker from "@/core/components/MuiDatePicker"; -import {useFormik} from "formik"; +import { useFormik } from "formik"; import moment from "jalali-moment"; import * as Yup from "yup"; -import {useState} from "react"; +import { useState } from "react"; import ApplicantRequestDetail from "@/core/components/ApplicantRequestDetail"; import DetailMap from "@/core/components/ApplicantRequestDetail/DetailMap"; import FlyToPolyline from "@/core/components/ApplicantRequestDetail/FlyToPolyline"; -import {MapContainer} from "react-leaflet"; +import { MapContainer } from "react-leaflet"; import dynamic from "next/dynamic"; import MapLoading from "@/core/components/MapLayer/Loading"; const MapLayer = dynamic(() => import("@/core/components/MapLayer"), { @@ -37,55 +32,51 @@ const fakeData = { address: "کرج - فلان جا - جنب پاساژ - نزدیک اونجا - اونور خیابون - زیر رو گذر - روی زیر گذر", file_mosavab: "file", polyline: [ - [35.6892, 51.3890], + [35.6892, 51.389], [35.7074, 51.3929], ], }; -const CarDetailsContent = ({setOpenCarDialog}) => { - const [openCarDetailContent, setOpenCarDetailContent] = useState(false) +const CarDetailsContent = ({ setOpenCarDialog }) => { + const [openCarDetailContent, setOpenCarDetailContent] = useState(false); const initialValues = { start_date: "", end_date: "", vehicle_code: "", - } + }; const validationSchema = Yup.object().shape({ start_date: Yup.string().required("تاریخ شروع الزامیست!!!"), - end_date: Yup.string().test( - "is-greater", - "تاریخ اتمام نمی‌تواند کمتر از تاریخ شروع باشد", - function (value) { - const {start_date} = this.parent; // Access other field values + end_date: Yup.string() + .test("is-greater", "تاریخ اتمام نمی‌تواند کمتر از تاریخ شروع باشد", function (value) { + const { start_date } = this.parent; // Access other field values if (!value || !start_date) return true; // Skip validation if either field is empty - return moment(value, "YYYY/MM/DD").isSameOrAfter( - moment(start_date, "YYYY/MM/DD") - ); - } - ).required("تاریخ اتمام الزامیست!!!"), + return moment(value, "YYYY/MM/DD").isSameOrAfter(moment(start_date, "YYYY/MM/DD")); + }) + .required("تاریخ اتمام الزامیست!!!"), vehicle_code: Yup.mixed() .test("is-number", "کد خودرو باید عدد باشد!!!", (value) => !isNaN(value)) .test("positive", "کد خودرو باید مثبت باشد!!!", (value) => value >= 0) .required("کد خودرو الزامیست!!!"), - }) + }); const handleSubmit = async (values, props) => { props.setSubmitting(true); - setOpenCarDetailContent(true) - console.log(values) - } + setOpenCarDetailContent(true); + console.log(values); + }; const formik = useFormik({ initialValues, validationSchema, onSubmit: handleSubmit, }); - console.log(formik.errors) + console.log(formik.errors); return ( <> - - + + { /> - - + { - const [openCarDialog, setOpenCarDialog] = useState(false) + const [openCarDialog, setOpenCarDialog] = useState(false); return ( @@ -22,20 +22,19 @@ const TestPage = () => { setOpenCarDialog(false)} + onClose={() => setOpenCarDialog(false)} fullWidth open={openCarDialog} PaperProps={{ sx: { transition: "all .3s", - boxShadow: "rgba(60, 64, 67, 0.3) 0px 1px 16px 0px, rgba(60, 64, 67, 0.15) 0px 1px 10px 0px", + boxShadow: + "rgba(60, 64, 67, 0.3) 0px 1px 16px 0px, rgba(60, 64, 67, 0.15) 0px 1px 10px 0px", }, }} maxWidth={"lg"} > - - نمایش اطلاعات خودرو - + نمایش اطلاعات خودرو diff --git a/src/components/layouts/dashboard/headerWithSidebar/HeaderMenu/index.jsx b/src/components/layouts/dashboard/headerWithSidebar/HeaderMenu/index.jsx index 47decdf..92c9553 100644 --- a/src/components/layouts/dashboard/headerWithSidebar/HeaderMenu/index.jsx +++ b/src/components/layouts/dashboard/headerWithSidebar/HeaderMenu/index.jsx @@ -1,5 +1,5 @@ import { ExpandLess, ExpandMore, Link } from "@mui/icons-material"; -import { Button, Divider, ListItemIcon, ListItemText, Menu, MenuItem } from "@mui/material"; +import { Button, Divider, ListItemIcon, ListItemText, Menu, MenuItem, Stack } from "@mui/material"; import NextLink from "next/link"; import { useState } from "react"; @@ -15,7 +15,7 @@ const HeaderMenu = ({ menu }) => { }; return ( - <> +