diff --git a/.env.local.example b/.env.local.example
index 7a6ec4e..4cb90a7 100644
--- a/.env.local.example
+++ b/.env.local.example
@@ -1,3 +1,3 @@
-NEXT_PUBLIC_VERSION="0.9.0"
+NEXT_PUBLIC_VERSION="0.9.2"
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/.gitignore b/.gitignore
index 2d494a9..ca544f8 100644
--- a/.gitignore
+++ b/.gitignore
@@ -33,4 +33,4 @@ cypress/screenshots
package-lock.json
ecosystem.config.js
-packages*.tar.gz
+/versions
diff --git a/docker-compose.yml b/docker-compose.yml
index 84ea064..30c35dc 100644
--- a/docker-compose.yml
+++ b/docker-compose.yml
@@ -1,7 +1,7 @@
services:
- app:
- build: .
- volumes:
- - .:/var/www/app
- - /var/www/app/node_modules
- command: sh -c "cd /var/www/app && tar -czvf packages_$(date +%Y_%m_%d).tar.gz node_modules"
+ app:
+ build: .
+ volumes:
+ - .:/var/www/app
+ - /var/www/app/node_modules
+ command: sh -c "cd /var/www/app && tar -czvf rms_v3_$(date +%Y_%m_%d).tar.gz node_modules"
diff --git a/src/app/(withAuth)/dashboard/azmayesh/page.js b/src/app/(withAuth)/dashboard/azmayesh/page.js
index 27f1bd7..d27371a 100644
--- a/src/app/(withAuth)/dashboard/azmayesh/page.js
+++ b/src/app/(withAuth)/dashboard/azmayesh/page.js
@@ -1,7 +1,12 @@
-import TestPage from "@/components/dashboard/azmayesh";
+import AzmayeshPage from "@/components/dashboard/azmayesh";
+import WithPermission from "@/core/middlewares/withPermission";
const Page = () => {
- return ;
+ return (
+
+
+
+ );
};
export default Page;
diff --git a/src/app/(withAuth)/dashboard/azmayesh_type/page.js b/src/app/(withAuth)/dashboard/azmayesh_type/page.js
new file mode 100644
index 0000000..4032594
--- /dev/null
+++ b/src/app/(withAuth)/dashboard/azmayesh_type/page.js
@@ -0,0 +1,12 @@
+import AzmayeshTypePage from "@/components/dashboard/azmayeshType";
+import WithPermission from "@/core/middlewares/withPermission";
+
+const Page = () => {
+ return (
+
+
+
+ );
+};
+
+export default Page;
diff --git a/src/app/(withAuth)/dashboard/inquiry-privacy/_fencing/page.js b/src/app/(withAuth)/dashboard/inquiry-privacy/_fencing/page.js
deleted file mode 100644
index b7aecdd..0000000
--- a/src/app/(withAuth)/dashboard/inquiry-privacy/_fencing/page.js
+++ /dev/null
@@ -1,7 +0,0 @@
-import InquiryPrivacyFencingPage from "@/components/dashboard/inquiryPrivacyFencing";
-
-const Page = () => {
- return ;
-};
-
-export default Page;
diff --git a/src/app/(withAuth)/dashboard/inquiry-privacy/assistant/zamin-gov/page.js b/src/app/(withAuth)/dashboard/inquiry-privacy/assistant/zamin-gov/page.js
index 0581720..6679ae5 100644
--- a/src/app/(withAuth)/dashboard/inquiry-privacy/assistant/zamin-gov/page.js
+++ b/src/app/(withAuth)/dashboard/inquiry-privacy/assistant/zamin-gov/page.js
@@ -1,7 +1,12 @@
import AssistantZaminGovComponent from "@/components/dashboard/inquiryPrivacy/assistant/zaminGov";
+import WithPermission from "@/core/middlewares/withPermission";
const Page = () => {
- return ;
+ return (
+
+
+
+ );
};
export default Page;
diff --git a/src/app/(withAuth)/dashboard/inquiry-privacy/city-admin/zamin-gov/page.js b/src/app/(withAuth)/dashboard/inquiry-privacy/city-admin/zamin-gov/page.js
index 2a45828..7293246 100644
--- a/src/app/(withAuth)/dashboard/inquiry-privacy/city-admin/zamin-gov/page.js
+++ b/src/app/(withAuth)/dashboard/inquiry-privacy/city-admin/zamin-gov/page.js
@@ -1,7 +1,12 @@
import CityAdminZaminGovComponent from "@/components/dashboard/inquiryPrivacy/cityAdmin/zaminGov";
+import WithPermission from "@/core/middlewares/withPermission";
const Page = () => {
- return ;
+ return (
+
+
+
+ );
};
export default Page;
diff --git a/src/app/(withAuth)/dashboard/inquiry-privacy/general-manager/zamin-gov/page.js b/src/app/(withAuth)/dashboard/inquiry-privacy/general-manager/zamin-gov/page.js
index 6c02a17..9cb8045 100644
--- a/src/app/(withAuth)/dashboard/inquiry-privacy/general-manager/zamin-gov/page.js
+++ b/src/app/(withAuth)/dashboard/inquiry-privacy/general-manager/zamin-gov/page.js
@@ -1,7 +1,12 @@
import GeneralManagerZaminGovComponent from "@/components/dashboard/inquiryPrivacy/generalManager/zaminGov";
+import WithPermission from "@/core/middlewares/withPermission";
const Page = () => {
- return ;
+ return (
+
+
+
+ );
};
export default Page;
diff --git a/src/app/(withAuth)/dashboard/inquiry-privacy/province-admin/zamin-gov/page.js b/src/app/(withAuth)/dashboard/inquiry-privacy/province-admin/zamin-gov/page.js
index 735cd2c..e327c74 100644
--- a/src/app/(withAuth)/dashboard/inquiry-privacy/province-admin/zamin-gov/page.js
+++ b/src/app/(withAuth)/dashboard/inquiry-privacy/province-admin/zamin-gov/page.js
@@ -1,7 +1,12 @@
import ProvinceAdminZaminGovComponent from "@/components/dashboard/inquiryPrivacy/provinceAdmin/zaminGov";
+import WithPermission from "@/core/middlewares/withPermission";
const Page = () => {
- return ;
+ return (
+
+
+
+ );
};
export default Page;
diff --git a/src/assets/images/empty_list.svg b/src/assets/images/empty_list.svg
new file mode 100644
index 0000000..2c5b6bd
--- /dev/null
+++ b/src/assets/images/empty_list.svg
@@ -0,0 +1 @@
+
\ No newline at end of file
diff --git a/src/components/dashboard/azmayesh/Actions/Create/index.jsx b/src/components/dashboard/azmayesh/Actions/Create/index.jsx
index 54e65db..414dca1 100644
--- a/src/components/dashboard/azmayesh/Actions/Create/index.jsx
+++ b/src/components/dashboard/azmayesh/Actions/Create/index.jsx
@@ -18,7 +18,7 @@ const AzmayeshCreate = ({ mutate }) => {
return (
<>
{isMobile ? (
-
+
) : (
diff --git a/src/components/dashboard/azmayesh/AzmayeshList.jsx b/src/components/dashboard/azmayesh/AzmayeshList.jsx
index d411e4e..89e220f 100644
--- a/src/components/dashboard/azmayesh/AzmayeshList.jsx
+++ b/src/components/dashboard/azmayesh/AzmayeshList.jsx
@@ -127,7 +127,7 @@ const AzmayeshList = () => {
<>
{
+const AzmayeshPage = () => {
return (
@@ -12,4 +12,4 @@ const TestPage = () => {
);
};
-export default TestPage;
+export default AzmayeshPage;
diff --git a/src/components/dashboard/azmayeshType/Actions/Create/index.jsx b/src/components/dashboard/azmayeshType/Actions/Create/index.jsx
new file mode 100644
index 0000000..3605ffc
--- /dev/null
+++ b/src/components/dashboard/azmayeshType/Actions/Create/index.jsx
@@ -0,0 +1,33 @@
+"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 CandUAzmayeshType from "@/components/dashboard/azmayeshType/Forms/CandUAzmayeshType";
+
+const AzmayeshTypeCreate = ({ mutate }) => {
+ const theme = useTheme();
+ const isMobile = useMediaQuery(theme.breakpoints.down("sm"));
+ const [open, setOpen] = useState(false);
+
+ const handleOpen = () => {
+ setOpen(true);
+ };
+
+ return (
+ <>
+ {isMobile ? (
+
+
+
+ ) : (
+ } onClick={handleOpen}>
+ ثبت نوع آزمایش
+
+ )}
+ {open && }
+ >
+ );
+};
+export default AzmayeshTypeCreate;
diff --git a/src/components/dashboard/azmayeshType/AzmayeshTypeList.jsx b/src/components/dashboard/azmayeshType/AzmayeshTypeList.jsx
new file mode 100644
index 0000000..c86cd83
--- /dev/null
+++ b/src/components/dashboard/azmayeshType/AzmayeshTypeList.jsx
@@ -0,0 +1,65 @@
+"use client";
+
+import { useMemo } from "react";
+import { Box, Typography } from "@mui/material";
+import DataTableWithAuth from "@/core/components/DataTableWithAuth";
+import Toolbar from "./Toolbar";
+import { GET_AZMAYESH_TYPE_LIST_TABLE } from "@/core/utils/routes";
+import moment from "jalali-moment";
+import RowActions from "./RowActions";
+
+const AzmayeshTypeList = () => {
+ const columns = useMemo(
+ () => [
+ {
+ accessorKey: "id",
+ header: "کد یکتا",
+ id: "id",
+ enableColumnFilter: false,
+ datatype: "text",
+ filterFn: "notEquals",
+ },
+ {
+ accessorKey: "name",
+ header: "عنوان",
+ id: "name",
+ enableColumnFilter: false,
+ datatype: "text",
+ filterFn: "notEquals",
+ },
+ {
+ accessorKey: "created_at",
+ header: "تاریخ ثبت",
+ id: "created_at",
+ enableColumnFilter: false,
+ datatype: "date",
+ filterFn: "equals",
+ Cell: ({ renderedCellValue }) => (
+
+ {renderedCellValue ? moment(renderedCellValue).locale("fa").format("HH:mm | YYYY/MM/DD") : "-"}
+
+ ),
+ },
+ ],
+ []
+ );
+
+ return (
+
+
+
+ );
+};
+export default AzmayeshTypeList;
diff --git a/src/components/dashboard/azmayeshType/Forms/CandUAzmayeshType/AzmayeshFields.jsx b/src/components/dashboard/azmayeshType/Forms/CandUAzmayeshType/AzmayeshFields.jsx
new file mode 100644
index 0000000..4cd365f
--- /dev/null
+++ b/src/components/dashboard/azmayeshType/Forms/CandUAzmayeshType/AzmayeshFields.jsx
@@ -0,0 +1,181 @@
+"use client";
+
+import React, { useEffect, useState } from "react";
+import {
+ Button,
+ Chip,
+ FormControl,
+ FormHelperText,
+ Grid,
+ InputAdornment,
+ InputLabel,
+ MenuItem,
+ OutlinedInput,
+ Select,
+ Typography,
+} from "@mui/material";
+import ExtensionIcon from "@mui/icons-material/Extension";
+import SelectItemBox from "@/components/dashboard/azmayeshType/Forms/CandUAzmayeshType/SelectItemBox";
+import KeyboardIcon from "@mui/icons-material/Keyboard";
+import TextFieldsIcon from "@mui/icons-material/TextFields";
+import ViewListIcon from "@mui/icons-material/ViewList";
+import CalendarMonthIcon from "@mui/icons-material/CalendarMonth";
+
+const fieldTypeList = [
+ { value: "input", label: "متن", icon: },
+ { value: "select", label: "انتخابی", icon: },
+ { value: "date", label: "تاریخ", icon: },
+];
+
+const AzmayeshFields = ({ errors, selectedListItem, register, setValue, fields, watch }) => {
+ const watchedFields = watch("fields");
+ const [isSelectType, setIsSelectType] = useState(false);
+ const [openSelectItem, setOpenSelectItem] = useState(false);
+ const [typeIcon, setTypeIcon] = useState();
+
+ useEffect(() => {
+ const selectedIcon = fieldTypeList.find((option) => option.value === watchedFields?.[selectedListItem]?.type)
+ ?.icon || ;
+ setTypeIcon(selectedIcon);
+ setIsSelectType(watchedFields[selectedListItem]?.type === "select");
+ }, [watchedFields, selectedListItem]);
+
+ return (
+
+
+
+ نوع
+
+ {errors.fields?.[selectedListItem]?.type?.message}
+
+
+ {isSelectType && (
+
+
+ }
+ onClick={() => setOpenSelectItem(true)}
+ >
+ افزودن آیتم نوع انتخابی
+
+
+ {errors.fields?.[selectedListItem]?.options?.message}
+
+ {openSelectItem && (
+
+ )}
+
+ )}
+
+
+ نام فیلد
+ setValue(`fields.${selectedListItem}.name`, event.target.value)}
+ size="small"
+ fullWidth
+ type="text"
+ />
+
+ {errors.fields?.[selectedListItem]?.name ? errors.fields[selectedListItem].name.message : null}
+
+
+
+
+
+ واحد اندازه گیری
+ setValue(`fields.${selectedListItem}.unit`, event.target.value)}
+ size="small"
+ fullWidth
+ type="text"
+ />
+
+ {errors.fields?.[selectedListItem]?.unit ? errors.fields[selectedListItem].unit.message : null}
+
+
+
+
+ );
+};
+export default AzmayeshFields;
diff --git a/src/components/dashboard/azmayeshType/Forms/CandUAzmayeshType/ListItems.jsx b/src/components/dashboard/azmayeshType/Forms/CandUAzmayeshType/ListItems.jsx
new file mode 100644
index 0000000..4a6005e
--- /dev/null
+++ b/src/components/dashboard/azmayeshType/Forms/CandUAzmayeshType/ListItems.jsx
@@ -0,0 +1,77 @@
+"use client";
+
+import { Box, IconButton, ListItem, Stack, Typography } from "@mui/material";
+import React from "react";
+import DeleteIcon from "@mui/icons-material/Delete";
+import SettingsIcon from "@mui/icons-material/Settings";
+import TextFieldsIcon from "@mui/icons-material/TextFields";
+import ViewListIcon from "@mui/icons-material/ViewList";
+import CalendarMonthIcon from "@mui/icons-material/CalendarMonth";
+
+const fieldsType = {
+ input: "متن",
+ date: "تاریخ",
+ select: "انتخابی",
+};
+const fieldsTypeIcon = {
+ input: ,
+ date: ,
+ select: ,
+};
+
+const ListItems = ({ index, handleRemove, selectedListItem, setSelectedListItem, watch }) => {
+ const watchedFields = watch("fields");
+ return (
+
+ setSelectedListItem(index)}
+ >
+
+
+ handleRemove(index)}>
+
+
+
+ }
+ >
+
+
+ {watchedFields[index].name !== "" ? watchedFields[index].name : "نام تعیین نشده"}
+
+
+ {fieldsTypeIcon[watchedFields[index].type] || null}
+
+ {watchedFields[index].type !== "" ? fieldsType[watchedFields[index].type] : "واحد تعیین نشده"}
+
+
+
+
+ );
+};
+export default ListItems;
diff --git a/src/components/dashboard/azmayeshType/Forms/CandUAzmayeshType/SelectItemBox.jsx b/src/components/dashboard/azmayeshType/Forms/CandUAzmayeshType/SelectItemBox.jsx
new file mode 100644
index 0000000..888be19
--- /dev/null
+++ b/src/components/dashboard/azmayeshType/Forms/CandUAzmayeshType/SelectItemBox.jsx
@@ -0,0 +1,108 @@
+import {
+ Box,
+ Button,
+ Chip,
+ Dialog,
+ DialogActions,
+ DialogContent,
+ Divider,
+ IconButton,
+ List,
+ ListItem,
+ ListItemText,
+ TextField,
+ Typography,
+} from "@mui/material";
+import DeleteIcon from "@mui/icons-material/Delete";
+import React, { useState } from "react";
+
+const SelectItemBox = ({ open, setOpen, setValue, index, watch }) => {
+ const watchedFields = watch("fields");
+ const [itemValue, setItemValue] = useState("");
+ const [listArr, setListArr] = useState(watchedFields?.[index]?.options);
+
+ const addToList = () => {
+ if (itemValue) {
+ setListArr([...listArr, itemValue]);
+ setItemValue("");
+ }
+ };
+
+ const removeFromList = (index) => {
+ setListArr(listArr.filter((_, i) => i !== index));
+ };
+
+ const saveAndCloseList = () => {
+ setValue(`fields.${index}.options`, listArr);
+ closeModal();
+ };
+
+ const closeModal = () => {
+ setOpen(false);
+ };
+
+ return (
+
+ }
+ >
+
+
+ ))
+ ) : (
+
+ هنوز آیتمی ثبت نشده است
+
+ )}
+
+
+
+
+
+
+
+ );
+};
+
+export default SelectItemBox;
diff --git a/src/components/dashboard/azmayeshType/Forms/CandUAzmayeshType/index.jsx b/src/components/dashboard/azmayeshType/Forms/CandUAzmayeshType/index.jsx
new file mode 100644
index 0000000..43eeb1a
--- /dev/null
+++ b/src/components/dashboard/azmayeshType/Forms/CandUAzmayeshType/index.jsx
@@ -0,0 +1,224 @@
+import {
+ Box,
+ Button,
+ Chip,
+ Dialog,
+ DialogActions,
+ DialogContent,
+ Divider,
+ FormControl,
+ FormHelperText,
+ Grid,
+ InputLabel,
+ List,
+ OutlinedInput,
+ Typography,
+} from "@mui/material";
+import StyledForm from "@/core/components/StyledForm";
+import useRequest from "@/lib/hooks/useRequest";
+import { useState } from "react";
+import { useFieldArray, useForm } from "react-hook-form";
+import { array, object, string } from "yup";
+import { yupResolver } from "@hookform/resolvers/yup";
+import DataSaverOnIcon from "@mui/icons-material/DataSaverOn";
+import ListItems from "./ListItems";
+import AzmayeshFields from "./AzmayeshFields";
+import { ADD_AZMAYESH_TYPE, UPDATE_AZMAYESH_TYPE } from "@/core/utils/routes";
+
+const validationSchema = object({
+ name: string().required("عنوان نوع آزمایش را مشخص کنید!"),
+ fields: array()
+ .of(
+ object({
+ name: string().required("نام فیلد الزامی است"),
+ type: string().required("نوع فیلد الزامی است"),
+ options: array().when("type", {
+ is: "select",
+ then: (schema) => schema.min(1, "حداقل باید یک آیتم برای نوع انتخابی ایجاد کنید."),
+ otherwise: (schema) => schema.notRequired(),
+ }),
+ })
+ )
+ .min(1, "حداقل باید یک فیلد ایجاد نمایید."),
+});
+
+const CandUAzmayeshType = ({ open, setOpen, mutate, rowId, updateInfo }) => {
+ const requestServer = useRequest({ auth: true });
+ const [selectedListItem, setSelectedListItem] = useState(null);
+ const [isSubmitting, setIsSubmitting] = useState(false);
+
+ const handleClose = () => {
+ setOpen(false);
+ };
+ const defaultValues = {
+ name: updateInfo?.name || "",
+ fields: Array.isArray(updateInfo?.azmayesh_fields)
+ ? updateInfo.azmayesh_fields.map((field) => ({
+ name: field.name || "",
+ type: field.type || "",
+ unit: field.unit || "",
+ options: field.option ? field.option : [],
+ }))
+ : [],
+ };
+
+ const {
+ control,
+ register,
+ handleSubmit,
+ setValue,
+ watch,
+ formState: { errors },
+ } = useForm({ defaultValues, resolver: yupResolver(validationSchema), mode: "onBlur" });
+
+ const { fields, append, remove } = useFieldArray({
+ control,
+ name: "fields",
+ });
+
+ const handleRemove = (index) => {
+ remove(index);
+ if (selectedListItem === index) {
+ setSelectedListItem(null);
+ } else if (selectedListItem > index) {
+ setSelectedListItem((prev) => prev - 1);
+ }
+ };
+
+ const handleAddField = () => {
+ append({ name: "", type: "", unit: "", options: [] });
+ };
+
+ const onSubmit = async (data) => {
+ setIsSubmitting(true);
+ const formData = new FormData();
+ formData.append("name", data.name);
+ data.fields.map((field, index) => {
+ formData.append(`fields[${index}][name]`, field.name);
+ formData.append(`fields[${index}][unit]`, field.unit);
+ formData.append(`fields[${index}][type]`, field.type);
+ if (field.options.length !== 0) formData.append(`fields[${index}][option]`, JSON.stringify(field.options));
+ });
+
+ requestServer(updateInfo ? `${UPDATE_AZMAYESH_TYPE}/${rowId}` : ADD_AZMAYESH_TYPE, "post", {
+ data: formData,
+ })
+ .then(() => {
+ mutate();
+ handleClose();
+ })
+ .catch(() => {})
+ .finally(() => setIsSubmitting(false));
+ };
+
+ return (
+
+ );
+};
+
+export default CandUAzmayeshType;
diff --git a/src/components/dashboard/azmayeshType/RowActions/DeleteAzmayeshType/index.jsx b/src/components/dashboard/azmayeshType/RowActions/DeleteAzmayeshType/index.jsx
new file mode 100644
index 0000000..888ab6d
--- /dev/null
+++ b/src/components/dashboard/azmayeshType/RowActions/DeleteAzmayeshType/index.jsx
@@ -0,0 +1,78 @@
+import {
+ Button,
+ Dialog,
+ DialogActions,
+ DialogContent,
+ DialogTitle,
+ IconButton,
+ Tooltip,
+ Typography,
+} from "@mui/material";
+import DeleteIcon from "@mui/icons-material/Delete";
+import useRequest from "@/lib/hooks/useRequest";
+import { useState } from "react";
+import { DELETE_AZMAYESH_TYPE_LIST } from "@/core/utils/routes";
+
+const DeleteAzmayeshType = ({ rowId, mutate }) => {
+ const requestServer = useRequest({ auth: true });
+ const [openDeleteDialog, setOpenDeleteDialog] = useState(false);
+ const [isSubmitting, setIsSubmitting] = useState(false);
+
+ const handleSubmit = () => {
+ setIsSubmitting(true);
+ requestServer(`${DELETE_AZMAYESH_TYPE_LIST}/${rowId}`, "post")
+ .then(() => {
+ setOpenDeleteDialog(false);
+ mutate();
+ })
+ .catch(() => {})
+ .finally(() => {
+ setIsSubmitting(false);
+ });
+ };
+
+ return (
+ <>
+
+ {
+ setOpenDeleteDialog(true);
+ }}
+ >
+
+
+
+
+ >
+ );
+};
+export default DeleteAzmayeshType;
diff --git a/src/components/dashboard/azmayeshType/RowActions/UpdateAzmayeshType/index.jsx b/src/components/dashboard/azmayeshType/RowActions/UpdateAzmayeshType/index.jsx
new file mode 100644
index 0000000..e9f1bde
--- /dev/null
+++ b/src/components/dashboard/azmayeshType/RowActions/UpdateAzmayeshType/index.jsx
@@ -0,0 +1,48 @@
+import { IconButton, Tooltip } from "@mui/material";
+import EditIcon from "@mui/icons-material/Edit";
+import { GET_AZMAYESH_TYPE_LIST_TABLE } from "@/core/utils/routes";
+import { useState } from "react";
+import useRequest from "@/lib/hooks/useRequest";
+import CandUAzmayeshType from "@/components/dashboard/azmayeshType/Forms/CandUAzmayeshType";
+
+const UpdateAzmayeshType = ({ rowId, mutate }) => {
+ const requestServer = useRequest({ auth: true });
+ const [openUpdateDialog, setOpenUpdateDialog] = useState(false);
+ const [updateInfo, setUpdateInfo] = useState(null);
+
+ const handleGetInfo = () => {
+ requestServer(`${GET_AZMAYESH_TYPE_LIST_TABLE}/${rowId}`, "get")
+ .then((response) => {
+ setUpdateInfo(response.data.data);
+ })
+ .catch(() => {})
+ .finally(() => {
+ setOpenUpdateDialog(true);
+ });
+ };
+
+ return (
+ <>
+
+
+
+
+
+ {openUpdateDialog && (
+
+ )}
+ >
+ );
+};
+
+export default UpdateAzmayeshType;
diff --git a/src/components/dashboard/azmayeshType/RowActions/index.jsx b/src/components/dashboard/azmayeshType/RowActions/index.jsx
new file mode 100644
index 0000000..43adc1b
--- /dev/null
+++ b/src/components/dashboard/azmayeshType/RowActions/index.jsx
@@ -0,0 +1,13 @@
+import { Box } from "@mui/material";
+import UpdateAzmayeshType from "./UpdateAzmayeshType";
+import DeleteAzmayeshType from "./DeleteAzmayeshType";
+
+const RowActions = ({ row, mutate }) => {
+ return (
+
+
+
+
+ );
+};
+export default RowActions;
diff --git a/src/components/dashboard/azmayeshType/Toolbar.jsx b/src/components/dashboard/azmayeshType/Toolbar.jsx
new file mode 100644
index 0000000..b08bc4b
--- /dev/null
+++ b/src/components/dashboard/azmayeshType/Toolbar.jsx
@@ -0,0 +1,10 @@
+import AzmayeshTypeCreate from "./Actions/Create";
+
+const Toolbar = ({ mutate }) => {
+ return (
+ <>
+
+ >
+ );
+};
+export default Toolbar;
diff --git a/src/components/dashboard/azmayeshType/index.jsx b/src/components/dashboard/azmayeshType/index.jsx
new file mode 100644
index 0000000..b7ec580
--- /dev/null
+++ b/src/components/dashboard/azmayeshType/index.jsx
@@ -0,0 +1,15 @@
+"use client";
+
+import PageTitle from "@/core/components/PageTitle";
+import { Stack } from "@mui/material";
+import AzmayeshTypeList from "./AzmayeshTypeList";
+
+const AzmayeshTypePage = () => {
+ return (
+
+
+
+
+ );
+};
+export default AzmayeshTypePage;
diff --git a/src/components/dashboard/inquiryPrivacyFencing/Actions/Create/index.jsx b/src/components/dashboard/inquiryPrivacyFencing/Actions/Create/index.jsx
deleted file mode 100644
index a564394..0000000
--- a/src/components/dashboard/inquiryPrivacyFencing/Actions/Create/index.jsx
+++ /dev/null
@@ -1,55 +0,0 @@
-"use client";
-import DialogTransition from "@/core/components/DialogTransition";
-import { AddCircle, Close } from "@mui/icons-material";
-import { Button, Dialog, DialogTitle, IconButton, useMediaQuery } from "@mui/material";
-import CreateOrUpdateForm from "../../Forms/CreateOrUpdate";
-import { SET_INQUIRE_PRIVACY_FENCING } from "@/core/utils/routes";
-import { useState } from "react";
-import { useTheme } from "@emotion/react";
-
-const InquiryPrivacyFencingCreate = ({ mutate }) => {
- const theme = useTheme();
- const isMobile = useMediaQuery(theme.breakpoints.down("sm"));
- const [open, setOpen] = useState(false);
-
- const handleOpen = () => {
- setOpen(true);
- };
-
- const handleClose = () => {
- setOpen(false);
- };
-
- return (
- <>
- {isMobile ? (
-
-
-
- ) : (
- } onClick={handleOpen}>
- ایجاد پاسخ به استعلام
-
- )}
-
- >
- );
-};
-export default InquiryPrivacyFencingCreate;
diff --git a/src/components/dashboard/inquiryPrivacyFencing/Forms/CreateOrUpdate.jsx b/src/components/dashboard/inquiryPrivacyFencing/Forms/CreateOrUpdate.jsx
deleted file mode 100644
index f3483ae..0000000
--- a/src/components/dashboard/inquiryPrivacyFencing/Forms/CreateOrUpdate.jsx
+++ /dev/null
@@ -1,869 +0,0 @@
-import LtrTextField from "@/core/components/LtrTextField";
-import StyledForm from "@/core/components/StyledForm";
-import useRequest from "@/lib/hooks/useRequest";
-import {
- Autocomplete,
- Box,
- Button,
- Chip,
- Container,
- DialogActions,
- DialogContent,
- Fade,
- Grid,
- InputAdornment,
- Stack,
- TextField,
- Typography,
-} from "@mui/material";
-import { DatePicker, LocalizationProvider, faIR } from "@mui/x-date-pickers";
-import { AdapterDateFnsJalali } from "@mui/x-date-pickers/AdapterDateFnsJalali";
-import moment from "jalali-moment";
-import { Controller, useForm } from "react-hook-form";
-import LocationOnMap from "./LocationOnMap";
-
-const initValues = {
- dabirkhaneh_number: "",
- nameh_date: moment(),
- nameh_date_fa: "",
- marjae_pasokh: "",
- motaghazi_is_legal_id: null,
- motaghazi_is_legal: "",
- motaghazi_type_id: "",
- motaghazi_type: null,
- motaghazi_firstname: "",
- motaghazi_lastname: "",
- national_id: "",
- shenase_melli: "",
- tel_number: "",
- mobile_number: "",
- address: "",
- edare_kol_id: null,
- edare_kol: "",
- edare_shahri_id: null,
- edare_shahri: "",
- rah_type_id: null,
- rah_type: "",
- name_mehvar_id: "",
- name_mehvar_fa: null,
- mizan_harim: null,
- arze_navar: null,
- samt_id: null,
- samt: "",
- kilometr: "",
- lat: "",
- lon: "",
- zone: null,
- karbari_type_id: null,
- karbari_type: "",
- tarh_title: "",
- masahat_zirbana: "",
- ehdasat_type_id: [],
- ehdasat_type: "",
- divarkeshi_distance: "",
- mostahadesat_distance: "",
- mahale_ejra_id: null,
- mahale_ejra: "",
- traffic_id: null,
- traffic: "",
- vaziat_eghtesadi_id: null,
- vaziat_eghtesadi: "",
- has_access_id: null,
- has_access: "",
- shomare_estelam_harim: "",
- max_month: "",
- max_day: "",
- shomare_tahaodname: "",
- shomare_daftarkhaneh: "",
- description: "",
- ronevesht: "",
-};
-
-const CreateOrUpdateForm = ({ handleClose, mutate, defaultValues, url }) => {
- const request = useRequest();
- const {
- control,
- watch,
- register,
- handleSubmit,
- setValue,
- formState: { isSubmitting },
- } = useForm({ defaultValues: defaultValues || initValues });
-
- const onSubmit = async (data) => {
- const formData = new FormData();
- formData.append("dabirkhaneh_number", data.dabirkhaneh_number);
- formData.append("nameh_date", data.nameh_date.format("YYYY-MM-DD"));
- formData.append("nameh_date_fa", data.nameh_date);
- formData.append("marjae_pasokh", data.marjae_pasokh);
- formData.append("motaghazi_is_legal_id", data.motaghazi_is_legal_id);
- formData.append("motaghazi_is_legal", data.motaghazi_is_legal_id);
- formData.append("motaghazi_type_id", 1);
- formData.append("motaghazi_type", data.motaghazi_type);
- formData.append("motaghazi_firstname", data.motaghazi_firstname);
- formData.append("motaghazi_lastname", data.motaghazi_lastname);
- formData.append("national_id", data.national_id);
- formData.append("shenase_melli", data.national_id);
- formData.append("tel_number", data.tel_number);
- formData.append("mobile_number", data.mobile_number);
- formData.append("address", data.address);
- formData.append("edare_kol_id", data.edare_kol_id);
- formData.append("edare_kol", data.edare_kol_id);
- formData.append("edare_shahri_id", data.edare_shahri_id);
- formData.append("edare_shahri", data.edare_shahri_id);
- formData.append("rah_type_id", data.rah_type_id);
- formData.append("rah_type", data.rah_type_id);
- formData.append("name_mehvar_id", 1);
- formData.append("name_mehvar_fa", data.name_mehvar_fa);
- formData.append("mizan_harim", data.mizan_harim);
- formData.append("arze_navar", data.arze_navar);
- formData.append("samt_id", data.samt_id);
- formData.append("samt", data.samt_id);
- formData.append("kilometr", data.kilometr);
- formData.append("lat", data.lat);
- formData.append("lon", data.lon);
- formData.append("zone", data.zone);
- formData.append("karbari_type_id", data.karbari_type_id);
- formData.append("karbari_type", data.karbari_type_id);
- formData.append("tarh_title", data.tarh_title);
- formData.append("masahat_zirbana", data.masahat_zirbana);
- formData.append("ehdasat_type_id", data.ehdasat_type_id.join("|"));
- formData.append("ehdasat_type", data.ehdasat_type_id.join("|"));
- formData.append("divarkeshi_distance", data.divarkeshi_distance);
- formData.append("mostahadesat_distance", data.mostahadesat_distance);
- formData.append("mahale_ejra_id", data.mahale_ejra_id);
- formData.append("mahale_ejra", data.mahale_ejra);
- formData.append("traffic_id", data.traffic_id);
- formData.append("traffic", data.traffic_id);
- formData.append("vaziat_eghtesadi_id", data.vaziat_eghtesadi_id);
- formData.append("vaziat_eghtesadi", data.vaziat_eghtesadi);
- formData.append("has_access_id", data.has_access_id);
- formData.append("has_access", data.has_access_id);
- formData.append("shomare_estelam_harim", data.shomare_estelam_harim);
- formData.append("max_month", data.max_month);
- formData.append("max_day", data.max_day);
- formData.append("shomare_tahaodname", data.shomare_tahaodname);
- formData.append("shomare_daftarkhaneh", data.shomare_daftarkhaneh);
- formData.append("description", data.description);
- formData.append("ronevesht", data.ronevesht);
-
- try {
- await request(url, "post", { data: formData });
- handleClose();
- mutate();
- } catch (error) {}
- };
-
- return (
-
-
-
-
-
-
-
-
-
- (
- onChange(moment(newValue))}
- label="تاریخ نامه درخواست *"
- slotProps={{
- textField: { fullWidth: true, size: "small", autoComplete: "off" },
- }}
- />
- )}
- />
-
-
-
-
-
- (
- {
- onChange(newValue);
- }}
- options={["حقوقی", "حقیقی"]}
- renderInput={(params) => (
-
- )}
- />
- )}
- />
-
-
-
-
- (
- {
- onChange(newValue);
- }}
- options={["دولتی", "خصوصی"]}
- renderInput={(params) => (
-
- )}
- />
- )}
- />
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- (
- {
- onChange(newValue);
- }}
- options={["تهران"]}
- renderInput={(params) => (
-
- )}
- />
- )}
- />
-
-
- (
- {
- onChange(newValue);
- }}
- options={["تهران"]}
- renderInput={(params) => (
-
- )}
- />
- )}
- />
-
-
- (
- {
- onChange(newValue);
- }}
- options={["آزاد راه", "بزرگراه", "راه فرعی درجه 3"]}
- renderInput={(params) => (
-
- )}
- />
- )}
- />
-
-
- (
- {
- onChange(newValue);
- }}
- options={["سایر"]}
- renderInput={(params) => (
-
- )}
- />
- )}
- />
-
-
-
-
-
-
-
- (
- {
- onChange(newValue);
- }}
- options={["چپ", "راست"]}
- renderInput={(params) => (
-
- )}
- />
- )}
- />
-
-
- (
- {
- onChange(newValue);
- }}
- options={["12.5", "17.5"]}
- renderInput={(params) => (
-
- )}
- />
- )}
- />
-
-
-
-
- (
- {
- onChange(newValue);
- }}
- options={["15", "30"]}
- renderInput={(params) => (
-
- )}
- />
- )}
- />
-
-
-
-
-
-
-
-
-
-
-
-
-
- (
- {
- onChange(newValue);
- }}
- options={["38", "39"]}
- renderInput={(params) => (
-
- )}
- />
- )}
- />
-
-
-
- (
- {
- onChange(newValue);
- }}
- options={["اتاقک نگهبانی", "دولتی"]}
- renderInput={(params) => (
-
- )}
- />
- )}
- />
-
-
-
-
-
- مترمربع,
- }}
- />
-
-
- (
- {
- onChange(newValue);
- }}
- renderTags={(value, getTagProps) =>
- value.map((option, index) => {
- const { key, ...tagProps } = getTagProps({ index });
- return (
-
- );
- })
- }
- options={["تعمیرات", "احداث بنا"]}
- renderInput={(params) => (
-
- )}
- />
- )}
- />
-
-
- متر,
- }}
- />
-
-
- متر,
- }}
- />
-
-
- (
- {
- onChange(newValue);
- }}
- options={["داخل حریم"]}
- renderInput={(params) => (
-
- )}
- />
- )}
- />
-
-
- (
- {
- onChange(newValue);
- }}
- options={["سبک (ضریب ۱)"]}
- renderInput={(params) => (
-
- )}
- />
- )}
- />
-
-
- (
- {
- onChange(newValue);
- }}
- options={["تست"]}
- renderInput={(params) => (
-
- )}
- />
- )}
- />
-
-
- (
- {
- onChange(newValue);
- }}
- options={["بله", "خیر"]}
- renderInput={(params) => (
-
- )}
- />
- )}
- />
-
-
-
-
-
-
-
- حداکثر مدت زمان شروع عملیات: *
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- );
-};
-export default CreateOrUpdateForm;
diff --git a/src/components/dashboard/inquiryPrivacyFencing/Forms/LocationOnMap/MarkerLocation/index.jsx b/src/components/dashboard/inquiryPrivacyFencing/Forms/LocationOnMap/MarkerLocation/index.jsx
deleted file mode 100644
index c79c266..0000000
--- a/src/components/dashboard/inquiryPrivacyFencing/Forms/LocationOnMap/MarkerLocation/index.jsx
+++ /dev/null
@@ -1,37 +0,0 @@
-import { useRef } from "react";
-import { Marker, useMapEvents } from "react-leaflet";
-import LocationMarker from "@/assets/images/locationMarker.png";
-
-const locationMarker = L.icon({
- iconUrl: LocationMarker.src,
- iconSize: [50, 50],
- iconAnchor: [25, 50],
-});
-
-const MarkerLocation = ({ setValue, defaultLatLon }) => {
- const location = useRef();
- const map = useMapEvents({
- move: (e) => {
- const latlon = e.target.getCenter();
- location.current?.setLatLng(latlon);
- setValue("lat", latlon.lat);
- setValue("lon", latlon.lng);
- },
- zoom: (e) => {
- const latlon = e.target.getCenter();
- location.current?.setLatLng(latlon);
- setValue("lat", latlon.lat);
- setValue("lon", latlon.lng);
- },
- });
-
- return (
-
- );
-};
-export default MarkerLocation;
diff --git a/src/components/dashboard/inquiryPrivacyFencing/Forms/LocationOnMap/index.jsx b/src/components/dashboard/inquiryPrivacyFencing/Forms/LocationOnMap/index.jsx
deleted file mode 100644
index dfd8854..0000000
--- a/src/components/dashboard/inquiryPrivacyFencing/Forms/LocationOnMap/index.jsx
+++ /dev/null
@@ -1,22 +0,0 @@
-import MapLoading from "@/core/components/MapLayer/Loading";
-import { Paper, Stack } from "@mui/material";
-import dynamic from "next/dynamic";
-import MarkerLocation from "./MarkerLocation";
-
-const MapLayer = dynamic(() => import("@/core/components/MapLayer"), {
- loading: () => ,
- ssr: false,
-});
-
-const LocationOnMap = ({ setValue, defaultLatLon }) => {
- return (
-
-
-
-
-
-
-
- );
-};
-export default LocationOnMap;
diff --git a/src/components/dashboard/inquiryPrivacyFencing/Toolbar.jsx b/src/components/dashboard/inquiryPrivacyFencing/Toolbar.jsx
deleted file mode 100644
index 843492b..0000000
--- a/src/components/dashboard/inquiryPrivacyFencing/Toolbar.jsx
+++ /dev/null
@@ -1,10 +0,0 @@
-import InquiryPrivacyFencingCreate from "./Actions/Create";
-
-const Toolbar = ({ mutate }) => {
- return (
- <>
-
- >
- );
-};
-export default Toolbar;
diff --git a/src/components/dashboard/inquiryPrivacyFencing/index.jsx b/src/components/dashboard/inquiryPrivacyFencing/index.jsx
deleted file mode 100644
index 794be55..0000000
--- a/src/components/dashboard/inquiryPrivacyFencing/index.jsx
+++ /dev/null
@@ -1,15 +0,0 @@
-"use client";
-
-import PageTitle from "@/core/components/PageTitle";
-import InquiryPrivacyFencingList from "./inquiryPrivacyFencingList";
-import { Stack } from "@mui/material";
-
-const InquiryPrivacyFencingPage = () => {
- return (
-
-
-
-
- );
-};
-export default InquiryPrivacyFencingPage;
diff --git a/src/components/dashboard/inquiryPrivacyFencing/inquiryPrivacyFencingList/index.jsx b/src/components/dashboard/inquiryPrivacyFencing/inquiryPrivacyFencingList/index.jsx
deleted file mode 100644
index 24871ed..0000000
--- a/src/components/dashboard/inquiryPrivacyFencing/inquiryPrivacyFencingList/index.jsx
+++ /dev/null
@@ -1,254 +0,0 @@
-"use client";
-
-import { useMemo } from "react";
-import Toolbar from "@/components/dashboard/inquiryPrivacyFencing/Toolbar";
-import DataTable from "@/core/components/DataTable";
-import { GET_INQUIRY_PRIVACY_FENCING_ROUTE } from "@/core/utils/routes";
-import { Box } from "@mui/material";
-import PageTitle from "@/core/components/PageTitle";
-
-const InquiryPrivacyFencingList = () => {
- const columns = useMemo(
- () => [
- {
- accessorKey: "dabirkhaneh_number",
- header: "شماره دبیرخانه درخواست",
- id: "dabirkhaneh_number",
- enableColumnFilter: false,
- datatype: "text",
- filterFn: "notEquals",
- },
- {
- accessorKey: "marjae_pasokh",
- header: "مرجع درخواست کننده پاسخ به استعلام",
- id: "marjae_pasokh",
- enableColumnFilter: false,
- datatype: "text",
- filterFn: "equals",
- },
- {
- accessorKey: "motaghazi_is_legal",
- header: "متقاضی",
- id: "motaghazi_is_legal",
- enableColumnFilter: false,
- },
- {
- accessorKey: "nameh_date",
- header: "تاریخ نامه درخواست",
- id: "nameh_date",
- enableColumnFilter: false,
- },
- {
- accessorKey: "motaghazi_type",
- header: "نوع متقاضی",
- id: "motaghazi_type",
- enableColumnFilter: false,
- },
- {
- accessorKey: "motaghazi_firstname",
- header: "نام متقاضی",
- id: "motaghazi_firstname",
- enableColumnFilter: false,
- },
- {
- accessorKey: "motaghazi_lastname",
- header: "نام خانوادگی متقاضی",
- id: "motaghazi_lastname",
- enableColumnFilter: false,
- },
- {
- accessorKey: "national_id",
- header: "کد ملی/شناسه ملی",
- id: "national_id",
- enableColumnFilter: false,
- },
- {
- accessorKey: "tel_number",
- header: "تلفن",
- id: "tel_number",
- enableColumnFilter: false,
- },
- {
- accessorKey: "mobile_number",
- header: "تلفن همراه",
- id: "mobile_number",
- enableColumnFilter: false,
- },
- {
- accessorKey: "address",
- header: "آدرس",
- id: "address",
- enableColumnFilter: false,
- },
- {
- accessorKey: "edare_kol",
- header: "اداره كل راهداری",
- id: "edare_kol",
- enableColumnFilter: false,
- },
- {
- accessorKey: "edare_shahri",
- header: "اداره شهرستان",
- id: "edare_shahri",
- enableColumnFilter: false,
- },
- {
- accessorKey: "rah_type",
- header: "نوع راه",
- id: "rah_type",
- enableColumnFilter: false,
- },
- {
- accessorKey: "name_mehvar_fa",
- header: "نام محور",
- id: "name_mehvar_fa",
- enableColumnFilter: false,
- },
- {
- accessorKey: "mizan_harim",
- header: "میزان حریم",
- id: "mizan_harim",
- enableColumnFilter: false,
- },
- {
- accessorKey: "arze_navar",
- header: "عرض نوار تاسیساتی زیربنایی",
- id: "arze_navar",
- enableColumnFilter: false,
- },
- {
- accessorKey: "samt",
- header: "سمت",
- id: "samt",
- enableColumnFilter: false,
- },
- {
- accessorKey: "kilometr",
- header: "كيلومتر",
- id: "kilometr",
- enableColumnFilter: false,
- },
- {
- accessorKey: "zone",
- header: "zone",
- id: "zone",
- enableColumnFilter: false,
- },
- {
- accessorKey: "karbari_type",
- header: "نوع کاربری",
- id: "karbari_type",
- enableColumnFilter: false,
- },
- {
- accessorKey: "tarh_title",
- header: "عنوان طرح",
- id: "tarh_title",
- enableColumnFilter: false,
- },
- {
- accessorKey: "masahat_zirbana",
- header: "مساحت زیربنا",
- id: "masahat_zirbana",
- enableColumnFilter: false,
- },
- {
- accessorKey: "ehdasat_type",
- header: "نوع احداثات",
- id: "ehdasat_type",
- enableColumnFilter: false,
- },
- {
- accessorKey: "divarkeshi_distance",
- header: "فاصله دیوارکشی از آکس محور",
- id: "divarkeshi_distance",
- enableColumnFilter: false,
- },
- {
- accessorKey: "mahale_ejra",
- header: "محل اجرا",
- id: "mahale_ejra",
- enableColumnFilter: false,
- },
- {
- accessorKey: "traffic",
- header: "میزان ترافیک",
- id: "traffic",
- enableColumnFilter: false,
- },
- {
- accessorKey: "vaziat_eghtesadi",
- header: "وضعیت اقتصادی",
- id: "vaziat_eghtesadi",
- enableColumnFilter: false,
- },
- {
- accessorKey: "has_access",
- header: "آیا راه دسترسی از قبل وجود دارد؟",
- id: "has_access",
- enableColumnFilter: false,
- },
- {
- accessorKey: "shomare_estelam_harim",
- header: "شماره استعلام دفتر ایمنی و حریم",
- id: "shomare_estelam_harim",
- enableColumnFilter: false,
- },
- {
- accessorKey: "max_month",
- header: "ماه",
- id: "max_month",
- enableColumnFilter: false,
- },
- {
- accessorKey: "max_day",
- header: "روز",
- id: "max_day",
- enableColumnFilter: false,
- },
- {
- accessorKey: "shomare_tahaodname",
- header: "شماره تعهدنامه",
- id: "shomare_tahaodname",
- enableColumnFilter: false,
- },
- {
- accessorKey: "shomare_daftarkhaneh",
- header: "شماره دفترخانه",
- id: "shomare_daftarkhaneh",
- enableColumnFilter: false,
- },
- {
- accessorKey: "description",
- header: "توضیحات",
- id: "description",
- enableColumnFilter: false,
- },
- {
- accessorKey: "ronevesht",
- header: "رونوشت",
- id: "ronevesht",
- enableColumnFilter: false,
- },
- ],
- []
- );
-
- return (
- <>
-
-
-
- >
- );
-};
-export default InquiryPrivacyFencingList;
diff --git a/src/core/components/DataTable/Main.js b/src/core/components/DataTable/Main.js
index b94655e..26318ff 100644
--- a/src/core/components/DataTable/Main.js
+++ b/src/core/components/DataTable/Main.js
@@ -26,6 +26,7 @@ const DataTable_Main = (props) => {
} = props;
const flatColumns = flattenArrayOfObjects(columns, "columns");
const [pagination, setPagination] = useState({ pageIndex: 0, pageSize: 10 });
+ const [totalRowCount, setTotalRowCount] = useState(0);
const flattenHideData = flattenObjectOfObjects(hideData);
const onSortingChange = (event) => {
setSortData(event);
@@ -51,6 +52,7 @@ const DataTable_Main = (props) => {
const fetcher = async (url) => {
try {
const response = await request(url);
+ setTotalRowCount(response.data?.meta?.totalRowCount);
if (specific_data) {
return specific_data(response.data);
} else {
@@ -112,6 +114,7 @@ const DataTable_Main = (props) => {
manualSorting: true,
onPaginationChange: setPagination,
onSortingChange: onSortingChange,
+ rowCount: totalRowCount,
renderTopToolbarCustomActions: ({ table }) => <>{TableToolbar && }>,
renderRowActions: ({ row }) => ,
...props,
diff --git a/src/core/components/DataTable/index.js b/src/core/components/DataTable/index.js
index f5bbdfd..1e881f9 100644
--- a/src/core/components/DataTable/index.js
+++ b/src/core/components/DataTable/index.js
@@ -8,6 +8,7 @@ const DataTable = (props) => {
page_name={props.page_name}
table_name={props.table_name}
columns={props.columns}
+ initialSort={props.sorting}
>
diff --git a/src/core/components/Profile/Update/Form.jsx b/src/core/components/Profile/Update/Form.jsx
index 69b1466..c34561d 100644
--- a/src/core/components/Profile/Update/Form.jsx
+++ b/src/core/components/Profile/Update/Form.jsx
@@ -52,6 +52,7 @@ const Form = ({ handleCloseForm, setLoading }) => {
const request = useRequest();
const { user, getUser } = useAuth();
const [uploadBackDrop, setUploadBackDrop] = useState(false);
+ const [avatarUrl, setAvatarUrl] = useState(user?.avatar || "");
const defaultValues = {
first_name: user.first_name,
last_name: user.last_name,
@@ -70,6 +71,15 @@ const Form = ({ handleCloseForm, setLoading }) => {
formState: { isSubmitting, errors },
} = useForm({ defaultValues, resolver: yupResolver(validationSchema) });
+ const handleFileChange = (event) => {
+ const file = event.target.files[0];
+ if (file) {
+ const objectUrl = URL.createObjectURL(file);
+ setAvatarUrl(objectUrl);
+ setValue("avatar", file);
+ }
+ };
+
useEffect(() => {
setLoading(isSubmitting);
}, [isSubmitting]);
@@ -124,7 +134,7 @@ const Form = ({ handleCloseForm, setLoading }) => {
onMouseEnter={() => setUploadBackDrop(true)}
onMouseLeave={() => setUploadBackDrop(false)}
>
-
+
{
- setValue("avatar", event.target.files[0])}
- />
+
diff --git a/src/core/middlewares/withPermission.js b/src/core/middlewares/withPermission.js
new file mode 100644
index 0000000..c6e3661
--- /dev/null
+++ b/src/core/middlewares/withPermission.js
@@ -0,0 +1,29 @@
+"use client";
+
+import { Box, Typography } from "@mui/material";
+import { usePermissions } from "@/lib/hooks/usePermissions";
+
+function WithPermission({ children, permission_name }) {
+ const { data, error, isLoading } = usePermissions();
+
+ if (error || isLoading || !data || !permission_name) {
+ return null;
+ }
+
+ const hasPermission =
+ permission_name.includes("all") || permission_name.some((permission) => data.includes(permission));
+
+ if (!hasPermission) {
+ return (
+
+
+ شما دسترسی لازم به این صفحه را ندارید
+
+
+ );
+ }
+
+ return <>{children}>;
+}
+
+export default WithPermission;
diff --git a/src/core/utils/pageMenu.js b/src/core/utils/pageMenu.js
index 1a7fb1f..ccc70d3 100644
--- a/src/core/utils/pageMenu.js
+++ b/src/core/utils/pageMenu.js
@@ -19,6 +19,7 @@ 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 BiotechIcon from "@mui/icons-material/Biotech";
export const pageMenu = [
{
@@ -254,28 +255,28 @@ export const pageMenu = [
label: "استعلام حرائم پنجره واحد",
type: "page",
route: "/dashboard/inquiry-privacy/city-admin/zamin-gov",
- permissions: ["all"],
+ permissions: [],
},
{
id: "provinceAdminZaminGov",
label: "استعلام حرائم پنجره واحد",
type: "page",
route: "/dashboard/inquiry-privacy/province-admin/zamin-gov",
- permissions: ["all"],
+ permissions: [],
},
{
id: "assistantZaminGov",
label: "استعلام حرائم پنجره واحد",
type: "page",
route: "/dashboard/inquiry-privacy/assistant/zamin-gov",
- permissions: ["all"],
+ permissions: [],
},
{
id: "generalManagerZaminGov",
label: "استعلام حرائم پنجره واحد",
type: "page",
route: "/dashboard/inquiry-privacy/general-manager/zamin-gov",
- permissions: ["all"],
+ permissions: [],
},
],
},
@@ -482,6 +483,14 @@ export const pageMenu = [
type: "page",
route: "/dashboard/azmayesh",
icon: ,
- permissions: ["all"],
+ permissions: ["azmayesh-management"],
+ },
+ {
+ id: "azmayeshType",
+ label: "نوع آزمایشات",
+ type: "page",
+ route: "/dashboard/azmayesh_type",
+ icon: ,
+ permissions: ["azmayesh-type-management"],
},
];
diff --git a/src/core/utils/routes.js b/src/core/utils/routes.js
index c507026..2fa0137 100644
--- a/src/core/utils/routes.js
+++ b/src/core/utils/routes.js
@@ -14,7 +14,8 @@ export const GET_PREV_STATE_OPINION = "/v3/api/fake-prev-state-opinion";
export const SUBMIT_ROAD_SAFETY_FORM = "/v3/api/fake-submit";
export const CREATE_AZMAYESH = api + "/api/v3/azmayeshes/store";
export const UPDATE_AZMAYESH = api + "/api/v3/azmayeshes/update";
-export const GET_AZMAYESH_TYPE_LIST = api + "/api/v3/azmayesh_types";
+export const GET_AZMAYESH_TYPE_LIST = api + "/api/v3/azmayesh_types/list";
+export const GET_AZMAYESH_TYPE_LIST_TABLE = api + "/api/v3/azmayesh_types";
export const GET_AZMAYESH_LIST = api + "/api/v3/azmayeshes";
export const DELETE_AZMAYESH = api + "/api/v3/azmayeshes/delete";
export const GET_AZMAYESH_SAMPLE_FIELDS = api + "/api/v3/azmayesh_types/fields";
@@ -22,3 +23,6 @@ export const ADD_SAMPLE_TO_AZMAYESH = api + "/api/v3/azmayesh_samples/store";
export const UPDATE_SAMPLE_OF_AZMAYESH = api + "/api/v3/azmayesh_samples/update";
export const GET_SAMPLE_LIST = api + "/api/v3/azmayesh_samples";
export const DELETE_SAMPLE_LIST = api + "/api/v3/azmayesh_samples/delete";
+export const DELETE_AZMAYESH_TYPE_LIST = api + "/api/v3/azmayesh_types/delete";
+export const ADD_AZMAYESH_TYPE = api + "/api/v3/azmayesh_types/store";
+export const UPDATE_AZMAYESH_TYPE = api + "/api/v3/azmayesh_types/update";
diff --git a/src/lib/contexts/DataTable.js b/src/lib/contexts/DataTable.js
index ff3439c..3d69afc 100644
--- a/src/lib/contexts/DataTable.js
+++ b/src/lib/contexts/DataTable.js
@@ -7,14 +7,14 @@ import { LinearProgress } from "@mui/material";
export const DataTableContext = createContext();
-const DataTableProvider = ({ children, user_id, page_name, table_name, columns }) => {
+const DataTableProvider = ({ children, user_id, page_name, table_name, columns, initialSort = [] }) => {
const { settingStore } = useTableSetting();
const [isInitStates, setInitStates] = useState(false);
const flatColumns = flattenArrayOfObjects(columns, "columns");
const [initFilter, setInitFilter] = useState({});
const [filterData, setFilterData] = useState({});
- const [initSort, setInitSort] = useState([]);
- const [sortData, setSortData] = useState([]);
+ const [initSort, setInitSort] = useState(initialSort || []);
+ const [sortData, setSortData] = useState(initialSort || []);
const [initHide, setInitHide] = useState({});
const [hideData, setHideData] = useState({});
@@ -51,8 +51,8 @@ const DataTableProvider = ({ children, user_id, page_name, table_name, columns }
}, {});
setFilterData(filterValues);
setInitFilter(filterValues);
- setSortData(settingStore?.[user_id]?.[page_name]?.[table_name]?.["sorts"] || []);
- setInitSort(settingStore?.[user_id]?.[page_name]?.[table_name]?.["sorts"] || []);
+ setSortData(settingStore?.[user_id]?.[page_name]?.[table_name]?.["sorts"] || initialSort);
+ setInitSort(settingStore?.[user_id]?.[page_name]?.[table_name]?.["sorts"] || initialSort);
setInitStates(true);
}, [settingStore, isInitStates]);