diff --git a/src/app/(withAuth)/(dashboardLayout)/dashboard/inquiry-privacy/general-manager/page.js b/src/app/(withAuth)/(dashboardLayout)/dashboard/inquiry-privacy/general-manager/page.js
index e24a103..763114c 100644
--- a/src/app/(withAuth)/(dashboardLayout)/dashboard/inquiry-privacy/general-manager/page.js
+++ b/src/app/(withAuth)/(dashboardLayout)/dashboard/inquiry-privacy/general-manager/page.js
@@ -1,11 +1,12 @@
import WithPermission from "@/core/middlewares/withPermission";
+import GeneralManagerPage from "@/components/dashboard/inquiryPrivacy/general-manager";
export const metadata = {
title: "کارتابل مدیر",
};
const Page = () => {
return (
- کارتابل مدیر
+
);
};
diff --git a/src/components/dashboard/inquiryPrivacy/city-admin/RowActions/History/HistoryContent.jsx b/src/components/dashboard/inquiryPrivacy/city-admin/RowActions/History/HistoryContent.jsx
new file mode 100644
index 0000000..71f59c1
--- /dev/null
+++ b/src/components/dashboard/inquiryPrivacy/city-admin/RowActions/History/HistoryContent.jsx
@@ -0,0 +1,17 @@
+import { Button, DialogActions, DialogContent } from "@mui/material";
+import TableContent from "./TableContent";
+const HistoryContent = ({ setOpenReferReasonDialog, rowId }) => {
+ return (
+ <>
+
+
+
+
+
+
+ >
+ );
+};
+export default HistoryContent;
diff --git a/src/components/dashboard/inquiryPrivacy/city-admin/RowActions/History/TableContent.jsx b/src/components/dashboard/inquiryPrivacy/city-admin/RowActions/History/TableContent.jsx
new file mode 100644
index 0000000..b405a41
--- /dev/null
+++ b/src/components/dashboard/inquiryPrivacy/city-admin/RowActions/History/TableContent.jsx
@@ -0,0 +1,66 @@
+import {
+ Box,
+ Table,
+ TableBody,
+ TableCell,
+ TableContainer,
+ TableHead,
+ TableRow,
+ CircularProgress,
+ Typography,
+} from "@mui/material";
+import "moment/locale/fa";
+import { useHistory } from "@/lib/hooks/useHistory";
+
+const TableContent = ({ rowId }) => {
+ const { historyData, loading, error } = useHistory(rowId);
+
+ if (loading) {
+ return (
+
+
+
+ );
+ }
+
+ if (error) {
+ return (
+
+ {error}
+
+ );
+ }
+
+ if (!historyData.length) {
+ return (
+
+ اطلاعاتی وجود ندارد
+
+ );
+ }
+
+ return (
+
+
+
+
+
+ وضعیت
+ توضیحات کارشناس
+
+
+
+ {historyData.map((row) => (
+
+ {row.previous_state_name}
+ {row.expert_description}
+
+ ))}
+
+
+
+
+ );
+};
+
+export default TableContent;
diff --git a/src/components/dashboard/inquiryPrivacy/city-admin/RowActions/History/index.jsx b/src/components/dashboard/inquiryPrivacy/city-admin/RowActions/History/index.jsx
new file mode 100644
index 0000000..234ac15
--- /dev/null
+++ b/src/components/dashboard/inquiryPrivacy/city-admin/RowActions/History/index.jsx
@@ -0,0 +1,33 @@
+import { Dialog, DialogTitle, IconButton, Tooltip } from "@mui/material";
+import { RestorePage } from "@mui/icons-material";
+import HistoryContent from "./HistoryContent";
+import { useState } from "react";
+
+const History = ({ rowId }) => {
+ const [openReferReasonDialog, setOpenReferReasonDialog] = useState(false);
+
+ return (
+ <>
+
+ setOpenReferReasonDialog(true)}>
+
+
+
+
+ >
+ );
+};
+
+export default History;
diff --git a/src/components/dashboard/inquiryPrivacy/city-admin/RowActions/index.jsx b/src/components/dashboard/inquiryPrivacy/city-admin/RowActions/index.jsx
index cb1517b..a432d18 100644
--- a/src/components/dashboard/inquiryPrivacy/city-admin/RowActions/index.jsx
+++ b/src/components/dashboard/inquiryPrivacy/city-admin/RowActions/index.jsx
@@ -1,5 +1,6 @@
import { Box } from "@mui/material";
import FeedbackAction from "./FeedbackAction";
+import History from "./History";
const RowActions = ({ row, mutate }) => {
return (
@@ -9,6 +10,7 @@ const RowActions = ({ row, mutate }) => {
) : (
"-"
)}
+
);
};
diff --git a/src/components/dashboard/inquiryPrivacy/general-manager/GeneralManagerList.jsx b/src/components/dashboard/inquiryPrivacy/general-manager/GeneralManagerList.jsx
new file mode 100644
index 0000000..4abd643
--- /dev/null
+++ b/src/components/dashboard/inquiryPrivacy/general-manager/GeneralManagerList.jsx
@@ -0,0 +1,243 @@
+import CustomSelectByDependency from "@/core/components/DataTable/filter/fieldsType/CustomSelectByDependency";
+import DataTableWithAuth from "@/core/components/DataTableWithAuth";
+import useInquiryPrivacyState from "@/lib/hooks/useInquiryPrivacyState";
+import AutorenewIcon from "@mui/icons-material/Autorenew";
+import DangerousIcon from "@mui/icons-material/Dangerous";
+import ManageAccountsIcon from "@mui/icons-material/ManageAccounts";
+import MapsHomeWorkIcon from "@mui/icons-material/MapsHomeWork";
+import PsychologyAltIcon from "@mui/icons-material/PsychologyAlt";
+import ReceiptLongIcon from "@mui/icons-material/ReceiptLong";
+import SecurityIcon from "@mui/icons-material/Security";
+import WindowIcon from "@mui/icons-material/Window";
+import { Box, Stack } from "@mui/material";
+import moment from "jalali-moment";
+import { useMemo } from "react";
+import RowActions from "./RowActions";
+import { GET_GENERAL_MANAGER_LIST } from "@/core/utils/routes";
+import ShowPrimaryArea from "./ShowPrimaryArea";
+
+const GeneralManagerList = () => {
+ const stateIcon = (state_id) => {
+ if (state_id === 1) return ;
+ if (state_id === 2 || state_id === 5 || state_id === 13) return ;
+ if (state_id === 3 || state_id === 6 || state_id === 14)
+ return ;
+ if (state_id === 4 || state_id === 7 || state_id === 15) return ;
+ if (state_id === 8) return ;
+ if (state_id === 9 || state_id === 11) return ;
+ if (state_id === 10) return ;
+ if (state_id === 12) return ;
+ };
+ const columns = useMemo(() => {
+ return [
+ {
+ accessorKey: "panjare_vahed_id",
+ header: "کدرهگیری درخواست",
+ id: "panjare_vahed_id",
+ enableColumnFilter: true,
+ datatype: "text",
+ filterMode: "equals",
+ sortDescFirst: false,
+ columnFilterModeOptions: ["equals", "contains"],
+ grow: false,
+ size: 100,
+ Cell: ({ row }) => <>{row.original.panjare_vahed_id}>,
+ },
+ {
+ accessorKey: "national_id",
+ header: "کد ملی",
+ id: "national_id",
+ enableColumnFilter: true,
+ datatype: "text",
+ filterMode: "equals",
+ sortDescFirst: false,
+ columnFilterModeOptions: ["equals", "contains"],
+ grow: false,
+ size: 100,
+ Cell: ({ row }) => <>{row.original.national_id}>,
+ },
+ {
+ accessorKey: "state_id",
+ header: "وضعیت",
+ id: "state_id",
+ enableColumnFilter: true,
+ datatype: "numeric",
+ filterMode: "equals",
+ sortDescFirst: false,
+ grow: false,
+ size: 100,
+ ColumnSelectComponent: (props) => {
+ const { itemsList, loadingItemsList, errorItemsList } = useInquiryPrivacyState();
+
+ const getColumnSelectOptions = useMemo(() => {
+ if (loadingItemsList) {
+ return [{ value: "loading", label: "در حال بارگذاری..." }];
+ }
+ if (errorItemsList) {
+ return [{ value: "error", label: "خطا در بارگذاری" }];
+ }
+ return [
+ { value: "", label: "همه موارد" },
+ ...itemsList.map((item) => ({
+ value: item.id,
+ label: item.name,
+ })),
+ ];
+ }, [itemsList, loadingItemsList, errorItemsList]);
+
+ return (
+
+ );
+ },
+ Cell: ({ row }) => (
+
+ {stateIcon(row.original.state_id)}
+
+ {row.original.state_name}
+
+
+ ),
+ },
+ {
+ accessorKey: "plan_title",
+ header: "عنوان طرح",
+ id: "plan_title",
+ enableColumnFilter: true,
+ datatype: "text",
+ filterMode: "equals",
+ sortDescFirst: false,
+ columnFilterModeOptions: ["equals", "contains"],
+ grow: false,
+ size: 100,
+ Cell: ({ row }) => <>{row.original.plan_title}>,
+ },
+ {
+ accessorKey: "plan_group",
+ header: "گروه طرح",
+ id: "plan_group",
+ enableColumnFilter: true,
+ datatype: "text",
+ filterMode: "equals",
+ sortDescFirst: false,
+ columnFilterModeOptions: ["equals", "contains"],
+ grow: false,
+ size: 100,
+ Cell: ({ row }) => <>{row.original.plan_group}>,
+ },
+ {
+ accessorKey: "requested_organization",
+ header: "دستگاه صادر کننده",
+ id: "requested_organization",
+ enableColumnFilter: true,
+ datatype: "text",
+ filterMode: "equals",
+ sortDescFirst: false,
+ columnFilterModeOptions: ["equals", "contains"],
+ grow: false,
+ size: 100,
+ Cell: ({ row }) => <>{row.original.requested_organization}>,
+ },
+ {
+ accessorKey: "worksheet_id",
+ header: "شناسه کاربرگ",
+ id: "worksheet_id",
+ enableColumnFilter: true,
+ datatype: "text",
+ filterMode: "equals",
+ sortDescFirst: false,
+ columnFilterModeOptions: ["equals", "contains"],
+ grow: false,
+ size: 100,
+ Cell: ({ row }) => <>{row.original.worksheet_id}>,
+ },
+ {
+ accessorKey: "primary_area",
+ header: "نمایش محدوده طرح",
+ id: "primary_area",
+ enableColumnFilter: true,
+ datatype: "text",
+ filterMode: "equals",
+ sortDescFirst: false,
+ columnFilterModeOptions: ["equals", "contains"],
+ grow: false,
+ size: 100,
+ Cell: ({ row }) =>
+ row.original.primary_area ? (
+
+
+
+ ) : (
+ "-"
+ ),
+ },
+ {
+ accessorKey: "province_id",
+ header: "استان",
+ id: "province_id",
+ enableColumnFilter: false,
+ datatype: "numeric",
+ sortDescFirst: false,
+ grow: false,
+ size: 100,
+ Cell: ({ row }) => <>{row.original.province_name}>,
+ },
+ {
+ accessorKey: "city_id",
+ header: "شهر",
+ id: "city_id",
+ enableColumnFilter: false,
+ datatype: "numeric",
+ sortDescFirst: false,
+ grow: false,
+ size: 100,
+ Cell: ({ row }) => <>{row.original.city_name}>,
+ },
+ {
+ accessorKey: "isic",
+ header: "کد آیسیک",
+ id: "isic",
+ enableColumnFilter: true,
+ datatype: "text",
+ filterMode: "equals",
+ sortDescFirst: false,
+ columnFilterModeOptions: ["equals", "contains"],
+ grow: false,
+ size: 100,
+ Cell: ({ row }) => <>{row.original.isic}>,
+ },
+ {
+ accessorFn: (row) => moment(row.request_date).locale("fa").format("YYYY/MM/DD"),
+ header: "تاریخ درخواست",
+ id: "request_date",
+ enableColumnFilter: true,
+ datatype: "date",
+ filterMode: "between",
+ grow: false,
+ size: 100,
+ },
+ ];
+ }, []);
+
+ return (
+ <>
+
+
+
+ >
+ );
+};
+
+export default GeneralManagerList;
diff --git a/src/components/dashboard/inquiryPrivacy/general-manager/RowActions/ConfirmAction/index.jsx b/src/components/dashboard/inquiryPrivacy/general-manager/RowActions/ConfirmAction/index.jsx
new file mode 100644
index 0000000..c2a0cfc
--- /dev/null
+++ b/src/components/dashboard/inquiryPrivacy/general-manager/RowActions/ConfirmAction/index.jsx
@@ -0,0 +1,17 @@
+import ThumbUpIcon from "@mui/icons-material/ThumbUp";
+import { IconButton, Tooltip } from "@mui/material";
+import { useState } from "react";
+
+const ConfirmAction = ({ rowId, mutate }) => {
+ const [openConfirmDialog, setOpenConfirmDialog] = useState(false);
+ return (
+ <>
+
+ setOpenConfirmDialog(true)}>
+
+
+
+ >
+ );
+};
+export default ConfirmAction;
diff --git a/src/components/dashboard/inquiryPrivacy/general-manager/RowActions/History/HistoryContent.jsx b/src/components/dashboard/inquiryPrivacy/general-manager/RowActions/History/HistoryContent.jsx
new file mode 100644
index 0000000..71f59c1
--- /dev/null
+++ b/src/components/dashboard/inquiryPrivacy/general-manager/RowActions/History/HistoryContent.jsx
@@ -0,0 +1,17 @@
+import { Button, DialogActions, DialogContent } from "@mui/material";
+import TableContent from "./TableContent";
+const HistoryContent = ({ setOpenReferReasonDialog, rowId }) => {
+ return (
+ <>
+
+
+
+
+
+
+ >
+ );
+};
+export default HistoryContent;
diff --git a/src/components/dashboard/inquiryPrivacy/general-manager/RowActions/History/TableContent.jsx b/src/components/dashboard/inquiryPrivacy/general-manager/RowActions/History/TableContent.jsx
new file mode 100644
index 0000000..b405a41
--- /dev/null
+++ b/src/components/dashboard/inquiryPrivacy/general-manager/RowActions/History/TableContent.jsx
@@ -0,0 +1,66 @@
+import {
+ Box,
+ Table,
+ TableBody,
+ TableCell,
+ TableContainer,
+ TableHead,
+ TableRow,
+ CircularProgress,
+ Typography,
+} from "@mui/material";
+import "moment/locale/fa";
+import { useHistory } from "@/lib/hooks/useHistory";
+
+const TableContent = ({ rowId }) => {
+ const { historyData, loading, error } = useHistory(rowId);
+
+ if (loading) {
+ return (
+
+
+
+ );
+ }
+
+ if (error) {
+ return (
+
+ {error}
+
+ );
+ }
+
+ if (!historyData.length) {
+ return (
+
+ اطلاعاتی وجود ندارد
+
+ );
+ }
+
+ return (
+
+
+
+
+
+ وضعیت
+ توضیحات کارشناس
+
+
+
+ {historyData.map((row) => (
+
+ {row.previous_state_name}
+ {row.expert_description}
+
+ ))}
+
+
+
+
+ );
+};
+
+export default TableContent;
diff --git a/src/components/dashboard/inquiryPrivacy/general-manager/RowActions/History/index.jsx b/src/components/dashboard/inquiryPrivacy/general-manager/RowActions/History/index.jsx
new file mode 100644
index 0000000..234ac15
--- /dev/null
+++ b/src/components/dashboard/inquiryPrivacy/general-manager/RowActions/History/index.jsx
@@ -0,0 +1,33 @@
+import { Dialog, DialogTitle, IconButton, Tooltip } from "@mui/material";
+import { RestorePage } from "@mui/icons-material";
+import HistoryContent from "./HistoryContent";
+import { useState } from "react";
+
+const History = ({ rowId }) => {
+ const [openReferReasonDialog, setOpenReferReasonDialog] = useState(false);
+
+ return (
+ <>
+
+ setOpenReferReasonDialog(true)}>
+
+
+
+
+ >
+ );
+};
+
+export default History;
diff --git a/src/components/dashboard/inquiryPrivacy/general-manager/RowActions/RejectAction/index.jsx b/src/components/dashboard/inquiryPrivacy/general-manager/RowActions/RejectAction/index.jsx
new file mode 100644
index 0000000..c16a405
--- /dev/null
+++ b/src/components/dashboard/inquiryPrivacy/general-manager/RowActions/RejectAction/index.jsx
@@ -0,0 +1,17 @@
+import ThumbDownIcon from "@mui/icons-material/ThumbDown";
+import { IconButton, Tooltip } from "@mui/material";
+import { useState } from "react";
+
+const RejectAction = ({ rowId, mutate }) => {
+ const [openRejectDialog, setOpenRejectDialog] = useState(false);
+ return (
+ <>
+
+ setOpenRejectDialog(true)}>
+
+
+
+ >
+ );
+};
+export default RejectAction;
diff --git a/src/components/dashboard/inquiryPrivacy/general-manager/RowActions/index.jsx b/src/components/dashboard/inquiryPrivacy/general-manager/RowActions/index.jsx
new file mode 100644
index 0000000..1251678
--- /dev/null
+++ b/src/components/dashboard/inquiryPrivacy/general-manager/RowActions/index.jsx
@@ -0,0 +1,22 @@
+import { Box } from "@mui/material";
+import ConfirmAction from "./ConfirmAction";
+import RejectAction from "./RejectAction";
+import History from "./History";
+
+const RowActions = ({ row, mutate }) => {
+ // const stateId = row.original.state_id;
+ //
+ // const disabled = {
+ // referral: stateId !== 2,
+ // reject: stateId !== 2 && stateId !== 5,
+ // confirm: stateId !== 2 && stateId !== 5 && stateId !== 13,
+ // };
+ return (
+
+
+
+
+
+ );
+};
+export default RowActions;
diff --git a/src/components/dashboard/inquiryPrivacy/general-manager/ShowPrimaryArea/ShowBound.jsx b/src/components/dashboard/inquiryPrivacy/general-manager/ShowPrimaryArea/ShowBound.jsx
new file mode 100644
index 0000000..24db476
--- /dev/null
+++ b/src/components/dashboard/inquiryPrivacy/general-manager/ShowPrimaryArea/ShowBound.jsx
@@ -0,0 +1,29 @@
+import { useEffect, useRef } from "react";
+import { FeatureGroup, useMap } from "react-leaflet";
+
+const ShowBound = ({ bound }) => {
+ const map = useMap();
+ const featureRef = useRef(null);
+
+ const safeFitBounds = (layer) => {
+ if (!layer || !map) return;
+ try {
+ const latLngs = layer.getLatLngs();
+ map.fitBounds(latLngs, {
+ paddingTopLeft: [20, 20],
+ paddingBottomRight: [20, 20],
+ });
+ } catch (e) {
+ console.warn("fitBounds failed:", e);
+ }
+ };
+
+ useEffect(() => {
+ bound?.editing?.disable();
+ featureRef.current.addLayer(bound);
+ safeFitBounds(bound);
+ }, []);
+
+ return ;
+};
+export default ShowBound;
diff --git a/src/components/dashboard/inquiryPrivacy/general-manager/ShowPrimaryArea/index.jsx b/src/components/dashboard/inquiryPrivacy/general-manager/ShowPrimaryArea/index.jsx
new file mode 100644
index 0000000..98e24d0
--- /dev/null
+++ b/src/components/dashboard/inquiryPrivacy/general-manager/ShowPrimaryArea/index.jsx
@@ -0,0 +1,69 @@
+const {
+ Button,
+ IconButton,
+ Tooltip,
+ Box,
+ Dialog,
+ DialogTitle,
+ Typography,
+ DialogContent,
+ DialogActions,
+} = require("@mui/material");
+import LayersIcon from "@mui/icons-material/Layers";
+import CloseIcon from "@mui/icons-material/Close";
+import { useMemo, useState } from "react";
+import MapLayer from "@/core/components/MapLayer";
+import ShowBound from "./ShowBound";
+
+const ShowPrimaryArea = ({ primaryArea }) => {
+ const [openShowAreaDialog, setOpenShowAreaDialog] = useState(false);
+ const bound = useMemo(() => {
+ const latLngCoords = primaryArea.coordinates.map((coord) => [coord[1], coord[0]]);
+ return primaryArea.type === "polygon" ? L.polygon(latLngCoords) : L.polyline(latLngCoords);
+ }, [primaryArea]);
+
+ return (
+
+
+ setOpenShowAreaDialog(true)}>
+
+
+
+
+
+ );
+};
+
+export default ShowPrimaryArea;
diff --git a/src/components/dashboard/inquiryPrivacy/general-manager/index.jsx b/src/components/dashboard/inquiryPrivacy/general-manager/index.jsx
new file mode 100644
index 0000000..3e166e3
--- /dev/null
+++ b/src/components/dashboard/inquiryPrivacy/general-manager/index.jsx
@@ -0,0 +1,14 @@
+"use client";
+import PageTitle from "@/core/components/PageTitle";
+import { Stack } from "@mui/material";
+import GeneralManagerList from "./GeneralManagerList";
+
+const GeneralManagerPage = () => {
+ return (
+
+
+
+
+ );
+};
+export default GeneralManagerPage;
diff --git a/src/components/dashboard/inquiryPrivacy/privacy-office/RowActions/ConfirmAction/index.jsx b/src/components/dashboard/inquiryPrivacy/privacy-office/RowActions/ConfirmAction/index.jsx
index 7820320..230e4c7 100644
--- a/src/components/dashboard/inquiryPrivacy/privacy-office/RowActions/ConfirmAction/index.jsx
+++ b/src/components/dashboard/inquiryPrivacy/privacy-office/RowActions/ConfirmAction/index.jsx
@@ -2,6 +2,7 @@ import ThumbUpIcon from "@mui/icons-material/ThumbUp";
import { IconButton, Tooltip } from "@mui/material";
const ConfirmAction = ({ onClick, disabled }) => {
+ if (disabled) return;
return (
<>
diff --git a/src/components/dashboard/inquiryPrivacy/privacy-office/RowActions/History/HistoryContent.jsx b/src/components/dashboard/inquiryPrivacy/privacy-office/RowActions/History/HistoryContent.jsx
new file mode 100644
index 0000000..71f59c1
--- /dev/null
+++ b/src/components/dashboard/inquiryPrivacy/privacy-office/RowActions/History/HistoryContent.jsx
@@ -0,0 +1,17 @@
+import { Button, DialogActions, DialogContent } from "@mui/material";
+import TableContent from "./TableContent";
+const HistoryContent = ({ setOpenReferReasonDialog, rowId }) => {
+ return (
+ <>
+
+
+
+
+
+
+ >
+ );
+};
+export default HistoryContent;
diff --git a/src/components/dashboard/inquiryPrivacy/privacy-office/RowActions/History/TableContent.jsx b/src/components/dashboard/inquiryPrivacy/privacy-office/RowActions/History/TableContent.jsx
new file mode 100644
index 0000000..b405a41
--- /dev/null
+++ b/src/components/dashboard/inquiryPrivacy/privacy-office/RowActions/History/TableContent.jsx
@@ -0,0 +1,66 @@
+import {
+ Box,
+ Table,
+ TableBody,
+ TableCell,
+ TableContainer,
+ TableHead,
+ TableRow,
+ CircularProgress,
+ Typography,
+} from "@mui/material";
+import "moment/locale/fa";
+import { useHistory } from "@/lib/hooks/useHistory";
+
+const TableContent = ({ rowId }) => {
+ const { historyData, loading, error } = useHistory(rowId);
+
+ if (loading) {
+ return (
+
+
+
+ );
+ }
+
+ if (error) {
+ return (
+
+ {error}
+
+ );
+ }
+
+ if (!historyData.length) {
+ return (
+
+ اطلاعاتی وجود ندارد
+
+ );
+ }
+
+ return (
+
+
+
+
+
+ وضعیت
+ توضیحات کارشناس
+
+
+
+ {historyData.map((row) => (
+
+ {row.previous_state_name}
+ {row.expert_description}
+
+ ))}
+
+
+
+
+ );
+};
+
+export default TableContent;
diff --git a/src/components/dashboard/inquiryPrivacy/privacy-office/RowActions/History/index.jsx b/src/components/dashboard/inquiryPrivacy/privacy-office/RowActions/History/index.jsx
new file mode 100644
index 0000000..234ac15
--- /dev/null
+++ b/src/components/dashboard/inquiryPrivacy/privacy-office/RowActions/History/index.jsx
@@ -0,0 +1,33 @@
+import { Dialog, DialogTitle, IconButton, Tooltip } from "@mui/material";
+import { RestorePage } from "@mui/icons-material";
+import HistoryContent from "./HistoryContent";
+import { useState } from "react";
+
+const History = ({ rowId }) => {
+ const [openReferReasonDialog, setOpenReferReasonDialog] = useState(false);
+
+ return (
+ <>
+
+ setOpenReferReasonDialog(true)}>
+
+
+
+
+ >
+ );
+};
+
+export default History;
diff --git a/src/components/dashboard/inquiryPrivacy/privacy-office/RowActions/ReferralAction/index.jsx b/src/components/dashboard/inquiryPrivacy/privacy-office/RowActions/ReferralAction/index.jsx
index 85a693f..46d36c3 100644
--- a/src/components/dashboard/inquiryPrivacy/privacy-office/RowActions/ReferralAction/index.jsx
+++ b/src/components/dashboard/inquiryPrivacy/privacy-office/RowActions/ReferralAction/index.jsx
@@ -2,6 +2,7 @@ import { Reply } from "@mui/icons-material";
import { IconButton, Tooltip } from "@mui/material";
const ReferralAction = ({ onClick, disabled }) => {
+ if (disabled) return;
return (
<>
diff --git a/src/components/dashboard/inquiryPrivacy/privacy-office/RowActions/RejectAction/index.jsx b/src/components/dashboard/inquiryPrivacy/privacy-office/RowActions/RejectAction/index.jsx
index e467e87..47b3382 100644
--- a/src/components/dashboard/inquiryPrivacy/privacy-office/RowActions/RejectAction/index.jsx
+++ b/src/components/dashboard/inquiryPrivacy/privacy-office/RowActions/RejectAction/index.jsx
@@ -2,6 +2,7 @@ import ThumbDownIcon from "@mui/icons-material/ThumbDown";
import { IconButton, Tooltip } from "@mui/material";
const RejectAction = ({ onClick, disabled }) => {
+ if (disabled) return;
return (
<>
diff --git a/src/components/dashboard/inquiryPrivacy/privacy-office/RowActions/index.jsx b/src/components/dashboard/inquiryPrivacy/privacy-office/RowActions/index.jsx
index 6cc004d..ed3df15 100644
--- a/src/components/dashboard/inquiryPrivacy/privacy-office/RowActions/index.jsx
+++ b/src/components/dashboard/inquiryPrivacy/privacy-office/RowActions/index.jsx
@@ -4,6 +4,7 @@ import ActionDialog from "./ActionsDialog";
import ConfirmAction from "./ConfirmAction";
import ReferralAction from "./ReferralAction";
import RejectAction from "./RejectAction";
+import History from "./History";
const RowActions = ({ row: { original }, mutate }) => {
const [modal, setModal] = useState({
@@ -31,6 +32,7 @@ const RowActions = ({ row: { original }, mutate }) => {
return (
<>
+
handleOpenModal("refer_request", original)}
disabled={disabled.referral}
diff --git a/src/components/dashboard/inquiryPrivacy/technical-deputy/RowActions/ConfirmRoadSafetyForm/PrevCartableOpinion.jsx b/src/components/dashboard/inquiryPrivacy/technical-deputy/RowActions/ConfirmRoadSafetyForm/PrevCartableOpinion.jsx
index 37fe672..f6ca361 100644
--- a/src/components/dashboard/inquiryPrivacy/technical-deputy/RowActions/ConfirmRoadSafetyForm/PrevCartableOpinion.jsx
+++ b/src/components/dashboard/inquiryPrivacy/technical-deputy/RowActions/ConfirmRoadSafetyForm/PrevCartableOpinion.jsx
@@ -1,12 +1,13 @@
import { Card, CardContent, CircularProgress, Stack, Typography } from "@mui/material";
const PrevCartableOpinion = ({ item }) => {
-
return (
- {item.previous_state_name}: {item.action_name}
+
+ {item.previous_state_name}: {item.action_name}
+
توضیحات: {item.expert_description}
diff --git a/src/components/dashboard/inquiryPrivacy/technical-deputy/RowActions/ConfirmRoadSafetyForm/Questions/QuestionVerifyNeedRoadForm.jsx b/src/components/dashboard/inquiryPrivacy/technical-deputy/RowActions/ConfirmRoadSafetyForm/Questions/QuestionVerifyNeedRoadForm.jsx
index 0a9a724..747d178 100644
--- a/src/components/dashboard/inquiryPrivacy/technical-deputy/RowActions/ConfirmRoadSafetyForm/Questions/QuestionVerifyNeedRoadForm.jsx
+++ b/src/components/dashboard/inquiryPrivacy/technical-deputy/RowActions/ConfirmRoadSafetyForm/Questions/QuestionVerifyNeedRoadForm.jsx
@@ -1,9 +1,4 @@
-import {
- Card,
- CardContent,
- Stack,
- Typography
-} from "@mui/material";
+import { Card, CardContent, Stack, Typography } from "@mui/material";
const QuestionVerifyNeedRoadForm = ({ row }) => {
return (
diff --git a/src/components/dashboard/inquiryPrivacy/technical-deputy/RowActions/ConfirmRoadSafetyForm/Questions/QuestionVerifyRoadSafetyForm.jsx b/src/components/dashboard/inquiryPrivacy/technical-deputy/RowActions/ConfirmRoadSafetyForm/Questions/QuestionVerifyRoadSafetyForm.jsx
index 1775856..3da9f78 100644
--- a/src/components/dashboard/inquiryPrivacy/technical-deputy/RowActions/ConfirmRoadSafetyForm/Questions/QuestionVerifyRoadSafetyForm.jsx
+++ b/src/components/dashboard/inquiryPrivacy/technical-deputy/RowActions/ConfirmRoadSafetyForm/Questions/QuestionVerifyRoadSafetyForm.jsx
@@ -1,9 +1,4 @@
-import {
- Card,
- CardContent,
- Stack,
- Typography
-} from "@mui/material";
+import { Card, CardContent, Stack, Typography } from "@mui/material";
const QuestionVerifyRoadSafetyForm = ({ row }) => {
return (
diff --git a/src/components/dashboard/inquiryPrivacy/technical-deputy/RowActions/ConfirmRoadSafetyForm/Questions/Refer/index.jsx b/src/components/dashboard/inquiryPrivacy/technical-deputy/RowActions/ConfirmRoadSafetyForm/Questions/Refer/index.jsx
index 1fc664c..e18024f 100644
--- a/src/components/dashboard/inquiryPrivacy/technical-deputy/RowActions/ConfirmRoadSafetyForm/Questions/Refer/index.jsx
+++ b/src/components/dashboard/inquiryPrivacy/technical-deputy/RowActions/ConfirmRoadSafetyForm/Questions/Refer/index.jsx
@@ -1,5 +1,5 @@
import { Close } from "@mui/icons-material";
-import { Button, Dialog, DialogTitle, IconButton } from "@mui/material"
+import { Button, Dialog, DialogTitle, IconButton } from "@mui/material";
import { useState } from "react";
import ReferForm from "./Form";
@@ -8,10 +8,23 @@ const Refer = ({ rowId, mutate, handleClose, isSubmitting }) => {
return (
<>
-
- setTabState(s => s + 1)}>
+ setTabState((s) => s + 1)}>
مرحله بعد
@@ -70,15 +68,10 @@ const ConfirmRoadSafetyFormContext = ({ row, data, rowId, mutate, handleClose })
-
+
مرحله قبل
- setTabState(s => s + 1)}>
+ setTabState((s) => s + 1)}>
مرحله بعد
diff --git a/src/components/dashboard/inquiryPrivacy/technical-deputy/RowActions/ConfirmVerifyLicenseForm/PrevCartableOpinion.jsx b/src/components/dashboard/inquiryPrivacy/technical-deputy/RowActions/ConfirmVerifyLicenseForm/PrevCartableOpinion.jsx
index 37fe672..f6ca361 100644
--- a/src/components/dashboard/inquiryPrivacy/technical-deputy/RowActions/ConfirmVerifyLicenseForm/PrevCartableOpinion.jsx
+++ b/src/components/dashboard/inquiryPrivacy/technical-deputy/RowActions/ConfirmVerifyLicenseForm/PrevCartableOpinion.jsx
@@ -1,12 +1,13 @@
import { Card, CardContent, CircularProgress, Stack, Typography } from "@mui/material";
const PrevCartableOpinion = ({ item }) => {
-
return (
- {item.previous_state_name}: {item.action_name}
+
+ {item.previous_state_name}: {item.action_name}
+
توضیحات: {item.expert_description}
diff --git a/src/components/dashboard/inquiryPrivacy/technical-deputy/RowActions/ConfirmVerifyLicenseForm/Questions/QuestionVerifyNeedRoadForm.jsx b/src/components/dashboard/inquiryPrivacy/technical-deputy/RowActions/ConfirmVerifyLicenseForm/Questions/QuestionVerifyNeedRoadForm.jsx
index a39fdec..927ef9e 100644
--- a/src/components/dashboard/inquiryPrivacy/technical-deputy/RowActions/ConfirmVerifyLicenseForm/Questions/QuestionVerifyNeedRoadForm.jsx
+++ b/src/components/dashboard/inquiryPrivacy/technical-deputy/RowActions/ConfirmVerifyLicenseForm/Questions/QuestionVerifyNeedRoadForm.jsx
@@ -1,9 +1,4 @@
-import {
- Card,
- CardContent,
- Stack,
- Typography
-} from "@mui/material";
+import { Card, CardContent, Stack, Typography } from "@mui/material";
const QuestionVerifyNeedRoadForm = () => {
return (
diff --git a/src/components/dashboard/inquiryPrivacy/technical-deputy/RowActions/ConfirmVerifyLicenseForm/Questions/QuestionVerifyRoadSafetyForm.jsx b/src/components/dashboard/inquiryPrivacy/technical-deputy/RowActions/ConfirmVerifyLicenseForm/Questions/QuestionVerifyRoadSafetyForm.jsx
index edd3232..8c1e4e3 100644
--- a/src/components/dashboard/inquiryPrivacy/technical-deputy/RowActions/ConfirmVerifyLicenseForm/Questions/QuestionVerifyRoadSafetyForm.jsx
+++ b/src/components/dashboard/inquiryPrivacy/technical-deputy/RowActions/ConfirmVerifyLicenseForm/Questions/QuestionVerifyRoadSafetyForm.jsx
@@ -1,9 +1,4 @@
-import {
- Card,
- CardContent,
- Stack,
- Typography
-} from "@mui/material";
+import { Card, CardContent, Stack, Typography } from "@mui/material";
const QuestionVerifyRoadSafetyForm = ({ row }) => {
return (
diff --git a/src/components/dashboard/inquiryPrivacy/technical-deputy/RowActions/ConfirmVerifyLicenseForm/Questions/Refer/Form.jsx b/src/components/dashboard/inquiryPrivacy/technical-deputy/RowActions/ConfirmVerifyLicenseForm/Questions/Refer/Form.jsx
index cf2095e..c3a58b1 100644
--- a/src/components/dashboard/inquiryPrivacy/technical-deputy/RowActions/ConfirmVerifyLicenseForm/Questions/Refer/Form.jsx
+++ b/src/components/dashboard/inquiryPrivacy/technical-deputy/RowActions/ConfirmVerifyLicenseForm/Questions/Refer/Form.jsx
@@ -23,15 +23,15 @@ const ReferForm = ({ rowId, mutate, handleClose, setOpenReferDialog }) => {
const onSubmit = async (data) => {
await requestServer(`${REFER_VERIFY_NEADROAD_ROAD_INQUIRY_PRIVACY_ZAMIN_GOV_ASSISTANT}/${rowId}`, "post", {
data: {
- expert_description: data.description
+ expert_description: data.description,
},
})
.then(() => {
handleClose();
- setOpenReferDialog(false)
+ setOpenReferDialog(false);
mutate();
})
- .catch(() => { });
+ .catch(() => {});
};
return (
@@ -60,11 +60,17 @@ const ReferForm = ({ rowId, mutate, handleClose, setOpenReferDialog }) => {
-
+
ثبت
>
- )
-}
-export default ReferForm
\ No newline at end of file
+ );
+};
+export default ReferForm;
diff --git a/src/components/dashboard/inquiryPrivacy/technical-deputy/RowActions/ConfirmVerifyLicenseForm/Questions/Refer/index.jsx b/src/components/dashboard/inquiryPrivacy/technical-deputy/RowActions/ConfirmVerifyLicenseForm/Questions/Refer/index.jsx
index 1fc664c..e18024f 100644
--- a/src/components/dashboard/inquiryPrivacy/technical-deputy/RowActions/ConfirmVerifyLicenseForm/Questions/Refer/index.jsx
+++ b/src/components/dashboard/inquiryPrivacy/technical-deputy/RowActions/ConfirmVerifyLicenseForm/Questions/Refer/index.jsx
@@ -1,5 +1,5 @@
import { Close } from "@mui/icons-material";
-import { Button, Dialog, DialogTitle, IconButton } from "@mui/material"
+import { Button, Dialog, DialogTitle, IconButton } from "@mui/material";
import { useState } from "react";
import ReferForm from "./Form";
@@ -8,10 +8,23 @@ const Refer = ({ rowId, mutate, handleClose, isSubmitting }) => {
return (
<>
- setOpenReferDialog(true)} variant="contained" color="error" disabled={isSubmitting} size="large">
+ setOpenReferDialog(true)}
+ variant="contained"
+ color="error"
+ disabled={isSubmitting}
+ size="large"
+ >
مخالفت
-
- setTabState(s => s + 1)}>
+ setTabState((s) => s + 1)}>
مرحله بعد
@@ -70,15 +68,10 @@ const ConfirmRoadSafetyFormContext = ({ row, data, rowId, mutate, handleClose })
-
+
مرحله قبل
- setTabState(s => s + 1)}>
+ setTabState((s) => s + 1)}>
مرحله بعد
diff --git a/src/components/dashboard/inquiryPrivacy/technical-deputy/RowActions/ConfirmVerifyRoadSafetyForm/PrevCartableOpinion.jsx b/src/components/dashboard/inquiryPrivacy/technical-deputy/RowActions/ConfirmVerifyRoadSafetyForm/PrevCartableOpinion.jsx
index 37fe672..f6ca361 100644
--- a/src/components/dashboard/inquiryPrivacy/technical-deputy/RowActions/ConfirmVerifyRoadSafetyForm/PrevCartableOpinion.jsx
+++ b/src/components/dashboard/inquiryPrivacy/technical-deputy/RowActions/ConfirmVerifyRoadSafetyForm/PrevCartableOpinion.jsx
@@ -1,12 +1,13 @@
import { Card, CardContent, CircularProgress, Stack, Typography } from "@mui/material";
const PrevCartableOpinion = ({ item }) => {
-
return (
- {item.previous_state_name}: {item.action_name}
+
+ {item.previous_state_name}: {item.action_name}
+
توضیحات: {item.expert_description}
diff --git a/src/components/dashboard/inquiryPrivacy/technical-deputy/RowActions/ConfirmVerifyRoadSafetyForm/Questions/QuestionVerifyNeedRoadForm.jsx b/src/components/dashboard/inquiryPrivacy/technical-deputy/RowActions/ConfirmVerifyRoadSafetyForm/Questions/QuestionVerifyNeedRoadForm.jsx
index 558d200..18fb601 100644
--- a/src/components/dashboard/inquiryPrivacy/technical-deputy/RowActions/ConfirmVerifyRoadSafetyForm/Questions/QuestionVerifyNeedRoadForm.jsx
+++ b/src/components/dashboard/inquiryPrivacy/technical-deputy/RowActions/ConfirmVerifyRoadSafetyForm/Questions/QuestionVerifyNeedRoadForm.jsx
@@ -1,9 +1,4 @@
-import {
- Card,
- CardContent,
- Stack,
- Typography
-} from "@mui/material";
+import { Card, CardContent, Stack, Typography } from "@mui/material";
const QuestionVerifyNeedRoadForm = ({ row }) => {
return (
diff --git a/src/components/dashboard/inquiryPrivacy/technical-deputy/RowActions/ConfirmVerifyRoadSafetyForm/Questions/Refer/Form.jsx b/src/components/dashboard/inquiryPrivacy/technical-deputy/RowActions/ConfirmVerifyRoadSafetyForm/Questions/Refer/Form.jsx
index cf2095e..c3a58b1 100644
--- a/src/components/dashboard/inquiryPrivacy/technical-deputy/RowActions/ConfirmVerifyRoadSafetyForm/Questions/Refer/Form.jsx
+++ b/src/components/dashboard/inquiryPrivacy/technical-deputy/RowActions/ConfirmVerifyRoadSafetyForm/Questions/Refer/Form.jsx
@@ -23,15 +23,15 @@ const ReferForm = ({ rowId, mutate, handleClose, setOpenReferDialog }) => {
const onSubmit = async (data) => {
await requestServer(`${REFER_VERIFY_NEADROAD_ROAD_INQUIRY_PRIVACY_ZAMIN_GOV_ASSISTANT}/${rowId}`, "post", {
data: {
- expert_description: data.description
+ expert_description: data.description,
},
})
.then(() => {
handleClose();
- setOpenReferDialog(false)
+ setOpenReferDialog(false);
mutate();
})
- .catch(() => { });
+ .catch(() => {});
};
return (
@@ -60,11 +60,17 @@ const ReferForm = ({ rowId, mutate, handleClose, setOpenReferDialog }) => {
-
+
ثبت
>
- )
-}
-export default ReferForm
\ No newline at end of file
+ );
+};
+export default ReferForm;
diff --git a/src/components/dashboard/inquiryPrivacy/technical-deputy/RowActions/ConfirmVerifyRoadSafetyForm/Questions/Refer/index.jsx b/src/components/dashboard/inquiryPrivacy/technical-deputy/RowActions/ConfirmVerifyRoadSafetyForm/Questions/Refer/index.jsx
index 1fc664c..e18024f 100644
--- a/src/components/dashboard/inquiryPrivacy/technical-deputy/RowActions/ConfirmVerifyRoadSafetyForm/Questions/Refer/index.jsx
+++ b/src/components/dashboard/inquiryPrivacy/technical-deputy/RowActions/ConfirmVerifyRoadSafetyForm/Questions/Refer/index.jsx
@@ -1,5 +1,5 @@
import { Close } from "@mui/icons-material";
-import { Button, Dialog, DialogTitle, IconButton } from "@mui/material"
+import { Button, Dialog, DialogTitle, IconButton } from "@mui/material";
import { useState } from "react";
import ReferForm from "./Form";
@@ -8,10 +8,23 @@ const Refer = ({ rowId, mutate, handleClose, isSubmitting }) => {
return (
<>
- setOpenReferDialog(true)} variant="contained" color="error" disabled={isSubmitting} size="large">
+ setOpenReferDialog(true)}
+ variant="contained"
+ color="error"
+ disabled={isSubmitting}
+ size="large"
+ >
مخالفت
- { setOpenReferDialog(false) }} maxWidth="xs" fullWidth>
+ {
+ setOpenReferDialog(false);
+ }}
+ maxWidth="xs"
+ fullWidth
+ >
setOpenReferDialog(false)}
@@ -26,9 +39,16 @@ const Refer = ({ rowId, mutate, handleClose, isSubmitting }) => {
مخالفت و ارجاع به دفتر حریم
- {openReferDialog && }
+ {openReferDialog && (
+
+ )}
>
- )
-}
-export default Refer
\ No newline at end of file
+ );
+};
+export default Refer;
diff --git a/src/components/dashboard/inquiryPrivacy/technical-deputy/RowActions/ConfirmVerifyRoadSafetyForm/Questions/index.jsx b/src/components/dashboard/inquiryPrivacy/technical-deputy/RowActions/ConfirmVerifyRoadSafetyForm/Questions/index.jsx
index a52b00c..d020ad8 100644
--- a/src/components/dashboard/inquiryPrivacy/technical-deputy/RowActions/ConfirmVerifyRoadSafetyForm/Questions/index.jsx
+++ b/src/components/dashboard/inquiryPrivacy/technical-deputy/RowActions/ConfirmVerifyRoadSafetyForm/Questions/index.jsx
@@ -29,27 +29,33 @@ const Questions = ({ row, rowId, mutate, handleClose, handlePrev }) => {
const onSubmit = async (data) => {
await requestServer(`${CONFIRM_VERIFY_NEADROAD_ROAD_INQUIRY_PRIVACY_ZAMIN_GOV_ASSISTANT}/${rowId}`, "post", {
data: {
- expert_description: data.description
+ expert_description: data.description,
},
})
.then(() => {
handleClose();
mutate();
})
- .catch(() => { });
+ .catch(() => {});
};
return (
-
+
-
-
+
+
{"مرحله قبلی"}
@@ -59,6 +65,6 @@ const Questions = ({ row, rowId, mutate, handleClose, handlePrev }) => {
- )
-}
-export default Questions
\ No newline at end of file
+ );
+};
+export default Questions;
diff --git a/src/components/dashboard/inquiryPrivacy/technical-deputy/RowActions/History/HistoryContent.jsx b/src/components/dashboard/inquiryPrivacy/technical-deputy/RowActions/History/HistoryContent.jsx
new file mode 100644
index 0000000..71f59c1
--- /dev/null
+++ b/src/components/dashboard/inquiryPrivacy/technical-deputy/RowActions/History/HistoryContent.jsx
@@ -0,0 +1,17 @@
+import { Button, DialogActions, DialogContent } from "@mui/material";
+import TableContent from "./TableContent";
+const HistoryContent = ({ setOpenReferReasonDialog, rowId }) => {
+ return (
+ <>
+
+
+
+
+ setOpenReferReasonDialog(false)} variant="outlined" color="secondary" autoFocus>
+ بستن
+
+
+ >
+ );
+};
+export default HistoryContent;
diff --git a/src/components/dashboard/inquiryPrivacy/technical-deputy/RowActions/History/TableContent.jsx b/src/components/dashboard/inquiryPrivacy/technical-deputy/RowActions/History/TableContent.jsx
new file mode 100644
index 0000000..b405a41
--- /dev/null
+++ b/src/components/dashboard/inquiryPrivacy/technical-deputy/RowActions/History/TableContent.jsx
@@ -0,0 +1,66 @@
+import {
+ Box,
+ Table,
+ TableBody,
+ TableCell,
+ TableContainer,
+ TableHead,
+ TableRow,
+ CircularProgress,
+ Typography,
+} from "@mui/material";
+import "moment/locale/fa";
+import { useHistory } from "@/lib/hooks/useHistory";
+
+const TableContent = ({ rowId }) => {
+ const { historyData, loading, error } = useHistory(rowId);
+
+ if (loading) {
+ return (
+
+
+
+ );
+ }
+
+ if (error) {
+ return (
+
+ {error}
+
+ );
+ }
+
+ if (!historyData.length) {
+ return (
+
+ اطلاعاتی وجود ندارد
+
+ );
+ }
+
+ return (
+
+
+
+
+
+ وضعیت
+ توضیحات کارشناس
+
+
+
+ {historyData.map((row) => (
+
+ {row.previous_state_name}
+ {row.expert_description}
+
+ ))}
+
+
+
+
+ );
+};
+
+export default TableContent;
diff --git a/src/components/dashboard/inquiryPrivacy/technical-deputy/RowActions/History/index.jsx b/src/components/dashboard/inquiryPrivacy/technical-deputy/RowActions/History/index.jsx
new file mode 100644
index 0000000..234ac15
--- /dev/null
+++ b/src/components/dashboard/inquiryPrivacy/technical-deputy/RowActions/History/index.jsx
@@ -0,0 +1,33 @@
+import { Dialog, DialogTitle, IconButton, Tooltip } from "@mui/material";
+import { RestorePage } from "@mui/icons-material";
+import HistoryContent from "./HistoryContent";
+import { useState } from "react";
+
+const History = ({ rowId }) => {
+ const [openReferReasonDialog, setOpenReferReasonDialog] = useState(false);
+
+ return (
+ <>
+
+ setOpenReferReasonDialog(true)}>
+
+
+
+
+ تاریخچه
+
+
+ >
+ );
+};
+
+export default History;
diff --git a/src/core/utils/routes.js b/src/core/utils/routes.js
index 070a222..a42b84c 100644
--- a/src/core/utils/routes.js
+++ b/src/core/utils/routes.js
@@ -242,4 +242,8 @@ export const CITY_ADMIN_FEEDBACK = api + "/api/v3/harim/province_office/feedback
export const GET_PRIVACY_ADMIN_LIST = api + "/api/v3/harim/harim_office";
export const PRIVACY_ADMIN_ACTION_API = api + "/api/v3/harim/harim_office";
export const GET_INQUIRY_PRIVACY_TABLE_LIST = api + "/api/v3/harim/technical_deputy";
+export const GET_GENERAL_MANAGER_LIST = api + "/api/v3/harim/general_manager";
+
+// History
+export const GET_HISTORY_LIST = api + "/api/v3/harim/detail/histories";
export const GET_REQUEST_INQUIRY_PRIVACY = api + "/api/v3/harim/technical_deputy";
diff --git a/src/lib/hooks/useHistory.js b/src/lib/hooks/useHistory.js
new file mode 100644
index 0000000..df1836c
--- /dev/null
+++ b/src/lib/hooks/useHistory.js
@@ -0,0 +1,30 @@
+import { useState, useEffect } from "react";
+import useRequest from "@/lib/hooks/useRequest";
+import { GET_HISTORY_LIST } from "@/core/utils/routes";
+
+export const useHistory = (rowId) => {
+ const requestServer = useRequest();
+ const [historyData, setHistoryData] = useState([]);
+ const [loading, setLoading] = useState(true);
+ const [error, setError] = useState(null);
+
+ useEffect(() => {
+ if (!rowId) return;
+
+ const fetchHistory = async () => {
+ try {
+ setLoading(true);
+ const response = await requestServer(`${GET_HISTORY_LIST}/${rowId}`);
+ setHistoryData(response.data.data);
+ } catch (err) {
+ setError(err.message);
+ } finally {
+ setLoading(false);
+ }
+ };
+
+ fetchHistory();
+ }, [rowId]);
+
+ return { historyData, loading, error };
+};