Merge branch 'develop'into feature/privacy_inquiry_technical_deputy
This commit is contained in:
@@ -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 (
|
||||
<WithPermission permission_name={["all"]}>
|
||||
<h1>کارتابل مدیر</h1>
|
||||
<GeneralManagerPage />
|
||||
</WithPermission>
|
||||
);
|
||||
};
|
||||
|
||||
@@ -0,0 +1,17 @@
|
||||
import { Button, DialogActions, DialogContent } from "@mui/material";
|
||||
import TableContent from "./TableContent";
|
||||
const HistoryContent = ({ setOpenReferReasonDialog, rowId }) => {
|
||||
return (
|
||||
<>
|
||||
<DialogContent>
|
||||
<TableContent rowId={rowId} />
|
||||
</DialogContent>
|
||||
<DialogActions>
|
||||
<Button onClick={() => setOpenReferReasonDialog(false)} variant="outlined" color="secondary" autoFocus>
|
||||
بستن
|
||||
</Button>
|
||||
</DialogActions>
|
||||
</>
|
||||
);
|
||||
};
|
||||
export default HistoryContent;
|
||||
@@ -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 (
|
||||
<Box display="flex" justifyContent="center" alignItems="center" height={200}>
|
||||
<CircularProgress />
|
||||
</Box>
|
||||
);
|
||||
}
|
||||
|
||||
if (error) {
|
||||
return (
|
||||
<Box display="flex" justifyContent="center" alignItems="center" height={200}>
|
||||
<Typography color="error">{error}</Typography>
|
||||
</Box>
|
||||
);
|
||||
}
|
||||
|
||||
if (!historyData.length) {
|
||||
return (
|
||||
<Box display="flex" justifyContent="center" alignItems="center" height={200}>
|
||||
<Typography>اطلاعاتی وجود ندارد</Typography>
|
||||
</Box>
|
||||
);
|
||||
}
|
||||
|
||||
return (
|
||||
<Box>
|
||||
<TableContainer sx={{ maxHeight: 600 }}>
|
||||
<Table stickyHeader sx={{ minWidth: 800 }}>
|
||||
<TableHead>
|
||||
<TableRow>
|
||||
<TableCell>وضعیت</TableCell>
|
||||
<TableCell>توضیحات کارشناس</TableCell>
|
||||
</TableRow>
|
||||
</TableHead>
|
||||
<TableBody>
|
||||
{historyData.map((row) => (
|
||||
<TableRow key={row.id} sx={{ "&:last-child td, &:last-child th": { border: 0 } }}>
|
||||
<TableCell>{row.previous_state_name}</TableCell>
|
||||
<TableCell>{row.expert_description}</TableCell>
|
||||
</TableRow>
|
||||
))}
|
||||
</TableBody>
|
||||
</Table>
|
||||
</TableContainer>
|
||||
</Box>
|
||||
);
|
||||
};
|
||||
|
||||
export default TableContent;
|
||||
@@ -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 (
|
||||
<>
|
||||
<Tooltip title="تاریخچه">
|
||||
<IconButton color="warning" onClick={() => setOpenReferReasonDialog(true)}>
|
||||
<RestorePage />
|
||||
</IconButton>
|
||||
</Tooltip>
|
||||
<Dialog
|
||||
fullWidth
|
||||
maxWidth={"md"}
|
||||
open={openReferReasonDialog}
|
||||
PaperProps={{
|
||||
sx: {
|
||||
boxShadow: "rgba(60, 64, 67, 0.3) 0px 1px 16px 0px, rgba(60, 64, 67, 0.15) 0px 1px 10px 0px",
|
||||
},
|
||||
}}
|
||||
>
|
||||
<DialogTitle>تاریخچه</DialogTitle>
|
||||
<HistoryContent rowId={rowId} setOpenReferReasonDialog={setOpenReferReasonDialog} />
|
||||
</Dialog>
|
||||
</>
|
||||
);
|
||||
};
|
||||
|
||||
export default History;
|
||||
@@ -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 }) => {
|
||||
) : (
|
||||
"-"
|
||||
)}
|
||||
<History rowId={row.original.id} />
|
||||
</Box>
|
||||
);
|
||||
};
|
||||
|
||||
@@ -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 <MapsHomeWorkIcon sx={{ color: "#A0B9C6" }} />;
|
||||
if (state_id === 2 || state_id === 5 || state_id === 13) return <SecurityIcon sx={{ color: "#995FA3" }} />;
|
||||
if (state_id === 3 || state_id === 6 || state_id === 14)
|
||||
return <ManageAccountsIcon sx={{ color: "#9A98B5" }} />;
|
||||
if (state_id === 4 || state_id === 7 || state_id === 15) return <PsychologyAltIcon sx={{ color: "#1B9AAA" }} />;
|
||||
if (state_id === 8) return <ReceiptLongIcon sx={{ color: "#9A98B5" }} />;
|
||||
if (state_id === 9 || state_id === 11) return <WindowIcon sx={{ color: "#DDDBCB" }} />;
|
||||
if (state_id === 10) return <DangerousIcon sx={{ color: "error.main" }} />;
|
||||
if (state_id === 12) return <AutorenewIcon sx={{ color: "#899878" }} />;
|
||||
};
|
||||
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 (
|
||||
<CustomSelectByDependency
|
||||
{...props}
|
||||
value={loadingItemsList ? "loading" : props.filterParameters.value}
|
||||
columnSelectOption={getColumnSelectOptions}
|
||||
/>
|
||||
);
|
||||
},
|
||||
Cell: ({ row }) => (
|
||||
<Box sx={{ display: "flex", alignItems: "center" }}>
|
||||
{stateIcon(row.original.state_id)}
|
||||
<Box component="span" ml={1}>
|
||||
{row.original.state_name}
|
||||
</Box>
|
||||
</Box>
|
||||
),
|
||||
},
|
||||
{
|
||||
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 ? (
|
||||
<Stack alignItems={"center"} justifyContent={"center"}>
|
||||
<ShowPrimaryArea primaryArea={row.original.primary_area} />
|
||||
</Stack>
|
||||
) : (
|
||||
"-"
|
||||
),
|
||||
},
|
||||
{
|
||||
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 (
|
||||
<>
|
||||
<Box sx={{ p: 1, border: 1, borderColor: "divider", borderRadius: 1 }}>
|
||||
<DataTableWithAuth
|
||||
need_filter={true}
|
||||
columns={columns}
|
||||
table_url={GET_GENERAL_MANAGER_LIST}
|
||||
page_name={"PrivacyOffice"}
|
||||
table_name={"GeneralManagerList"}
|
||||
enableRowActions
|
||||
positionActionsColumn={"first"}
|
||||
RowActions={RowActions}
|
||||
/>
|
||||
</Box>
|
||||
</>
|
||||
);
|
||||
};
|
||||
|
||||
export default GeneralManagerList;
|
||||
@@ -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 (
|
||||
<>
|
||||
<Tooltip title="تایید اقدام">
|
||||
<IconButton color="success" onClick={() => setOpenConfirmDialog(true)}>
|
||||
<ThumbUpIcon />
|
||||
</IconButton>
|
||||
</Tooltip>
|
||||
</>
|
||||
);
|
||||
};
|
||||
export default ConfirmAction;
|
||||
@@ -0,0 +1,17 @@
|
||||
import { Button, DialogActions, DialogContent } from "@mui/material";
|
||||
import TableContent from "./TableContent";
|
||||
const HistoryContent = ({ setOpenReferReasonDialog, rowId }) => {
|
||||
return (
|
||||
<>
|
||||
<DialogContent>
|
||||
<TableContent rowId={rowId} />
|
||||
</DialogContent>
|
||||
<DialogActions>
|
||||
<Button onClick={() => setOpenReferReasonDialog(false)} variant="outlined" color="secondary" autoFocus>
|
||||
بستن
|
||||
</Button>
|
||||
</DialogActions>
|
||||
</>
|
||||
);
|
||||
};
|
||||
export default HistoryContent;
|
||||
@@ -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 (
|
||||
<Box display="flex" justifyContent="center" alignItems="center" height={200}>
|
||||
<CircularProgress />
|
||||
</Box>
|
||||
);
|
||||
}
|
||||
|
||||
if (error) {
|
||||
return (
|
||||
<Box display="flex" justifyContent="center" alignItems="center" height={200}>
|
||||
<Typography color="error">{error}</Typography>
|
||||
</Box>
|
||||
);
|
||||
}
|
||||
|
||||
if (!historyData.length) {
|
||||
return (
|
||||
<Box display="flex" justifyContent="center" alignItems="center" height={200}>
|
||||
<Typography>اطلاعاتی وجود ندارد</Typography>
|
||||
</Box>
|
||||
);
|
||||
}
|
||||
|
||||
return (
|
||||
<Box>
|
||||
<TableContainer sx={{ maxHeight: 600 }}>
|
||||
<Table stickyHeader sx={{ minWidth: 800 }}>
|
||||
<TableHead>
|
||||
<TableRow>
|
||||
<TableCell>وضعیت</TableCell>
|
||||
<TableCell>توضیحات کارشناس</TableCell>
|
||||
</TableRow>
|
||||
</TableHead>
|
||||
<TableBody>
|
||||
{historyData.map((row) => (
|
||||
<TableRow key={row.id} sx={{ "&:last-child td, &:last-child th": { border: 0 } }}>
|
||||
<TableCell>{row.previous_state_name}</TableCell>
|
||||
<TableCell>{row.expert_description}</TableCell>
|
||||
</TableRow>
|
||||
))}
|
||||
</TableBody>
|
||||
</Table>
|
||||
</TableContainer>
|
||||
</Box>
|
||||
);
|
||||
};
|
||||
|
||||
export default TableContent;
|
||||
@@ -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 (
|
||||
<>
|
||||
<Tooltip title="تاریخچه">
|
||||
<IconButton color="warning" onClick={() => setOpenReferReasonDialog(true)}>
|
||||
<RestorePage />
|
||||
</IconButton>
|
||||
</Tooltip>
|
||||
<Dialog
|
||||
fullWidth
|
||||
maxWidth={"md"}
|
||||
open={openReferReasonDialog}
|
||||
PaperProps={{
|
||||
sx: {
|
||||
boxShadow: "rgba(60, 64, 67, 0.3) 0px 1px 16px 0px, rgba(60, 64, 67, 0.15) 0px 1px 10px 0px",
|
||||
},
|
||||
}}
|
||||
>
|
||||
<DialogTitle>تاریخچه</DialogTitle>
|
||||
<HistoryContent rowId={rowId} setOpenReferReasonDialog={setOpenReferReasonDialog} />
|
||||
</Dialog>
|
||||
</>
|
||||
);
|
||||
};
|
||||
|
||||
export default History;
|
||||
@@ -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 (
|
||||
<>
|
||||
<Tooltip title="عدم تایید اقدام">
|
||||
<IconButton color="error" onClick={() => setOpenRejectDialog(true)}>
|
||||
<ThumbDownIcon />
|
||||
</IconButton>
|
||||
</Tooltip>
|
||||
</>
|
||||
);
|
||||
};
|
||||
export default RejectAction;
|
||||
@@ -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 (
|
||||
<Box sx={{ display: "flex", gap: 1, justifyContent: "Center" }}>
|
||||
<RejectAction />
|
||||
<ConfirmAction />
|
||||
<History rowId={row.original.id} />
|
||||
</Box>
|
||||
);
|
||||
};
|
||||
export default RowActions;
|
||||
@@ -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 <FeatureGroup ref={featureRef} />;
|
||||
};
|
||||
export default ShowBound;
|
||||
@@ -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 (
|
||||
<Box>
|
||||
<Tooltip title="نمایش پلیگان" placement="right" arrow>
|
||||
<IconButton size="small" color="primary" onClick={() => setOpenShowAreaDialog(true)}>
|
||||
<LayersIcon />
|
||||
</IconButton>
|
||||
</Tooltip>
|
||||
<Dialog
|
||||
open={openShowAreaDialog}
|
||||
onClose={() => setOpenShowAreaDialog(false)}
|
||||
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",
|
||||
borderRadius: 2,
|
||||
padding: 1,
|
||||
},
|
||||
}}
|
||||
maxWidth="sm"
|
||||
fullWidth
|
||||
dir="rtl"
|
||||
>
|
||||
<DialogTitle sx={{ display: "flex", justifyContent: "space-between", padding: "16px 24px" }}>
|
||||
<Typography variant="body1" sx={{ fontWeight: "bold", fontSize: "large" }}>
|
||||
محدوده طرح
|
||||
</Typography>
|
||||
<IconButton onClick={() => setOpenShowAreaDialog(false)} size="small">
|
||||
<CloseIcon />
|
||||
</IconButton>
|
||||
</DialogTitle>
|
||||
<DialogContent>
|
||||
<Box sx={{ flex: 1 }}>
|
||||
<Box sx={{ width: "100%", height: "400px" }}>
|
||||
<MapLayer style={{ borderRadius: "4px" }}>
|
||||
<ShowBound bound={bound} />
|
||||
</MapLayer>
|
||||
</Box>
|
||||
</Box>
|
||||
</DialogContent>
|
||||
</Dialog>
|
||||
</Box>
|
||||
);
|
||||
};
|
||||
|
||||
export default ShowPrimaryArea;
|
||||
@@ -0,0 +1,14 @@
|
||||
"use client";
|
||||
import PageTitle from "@/core/components/PageTitle";
|
||||
import { Stack } from "@mui/material";
|
||||
import GeneralManagerList from "./GeneralManagerList";
|
||||
|
||||
const GeneralManagerPage = () => {
|
||||
return (
|
||||
<Stack spacing={1}>
|
||||
<PageTitle title={"کارتابل اداره حریم استعلام حریم"} />
|
||||
<GeneralManagerList />
|
||||
</Stack>
|
||||
);
|
||||
};
|
||||
export default GeneralManagerPage;
|
||||
@@ -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 (
|
||||
<>
|
||||
<Tooltip title="تایید اقدام">
|
||||
|
||||
@@ -0,0 +1,17 @@
|
||||
import { Button, DialogActions, DialogContent } from "@mui/material";
|
||||
import TableContent from "./TableContent";
|
||||
const HistoryContent = ({ setOpenReferReasonDialog, rowId }) => {
|
||||
return (
|
||||
<>
|
||||
<DialogContent>
|
||||
<TableContent rowId={rowId} />
|
||||
</DialogContent>
|
||||
<DialogActions>
|
||||
<Button onClick={() => setOpenReferReasonDialog(false)} variant="outlined" color="secondary" autoFocus>
|
||||
بستن
|
||||
</Button>
|
||||
</DialogActions>
|
||||
</>
|
||||
);
|
||||
};
|
||||
export default HistoryContent;
|
||||
@@ -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 (
|
||||
<Box display="flex" justifyContent="center" alignItems="center" height={200}>
|
||||
<CircularProgress />
|
||||
</Box>
|
||||
);
|
||||
}
|
||||
|
||||
if (error) {
|
||||
return (
|
||||
<Box display="flex" justifyContent="center" alignItems="center" height={200}>
|
||||
<Typography color="error">{error}</Typography>
|
||||
</Box>
|
||||
);
|
||||
}
|
||||
|
||||
if (!historyData.length) {
|
||||
return (
|
||||
<Box display="flex" justifyContent="center" alignItems="center" height={200}>
|
||||
<Typography>اطلاعاتی وجود ندارد</Typography>
|
||||
</Box>
|
||||
);
|
||||
}
|
||||
|
||||
return (
|
||||
<Box>
|
||||
<TableContainer sx={{ maxHeight: 600 }}>
|
||||
<Table stickyHeader sx={{ minWidth: 800 }}>
|
||||
<TableHead>
|
||||
<TableRow>
|
||||
<TableCell>وضعیت</TableCell>
|
||||
<TableCell>توضیحات کارشناس</TableCell>
|
||||
</TableRow>
|
||||
</TableHead>
|
||||
<TableBody>
|
||||
{historyData.map((row) => (
|
||||
<TableRow key={row.id} sx={{ "&:last-child td, &:last-child th": { border: 0 } }}>
|
||||
<TableCell>{row.previous_state_name}</TableCell>
|
||||
<TableCell>{row.expert_description}</TableCell>
|
||||
</TableRow>
|
||||
))}
|
||||
</TableBody>
|
||||
</Table>
|
||||
</TableContainer>
|
||||
</Box>
|
||||
);
|
||||
};
|
||||
|
||||
export default TableContent;
|
||||
@@ -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 (
|
||||
<>
|
||||
<Tooltip title="تاریخچه">
|
||||
<IconButton color="warning" onClick={() => setOpenReferReasonDialog(true)}>
|
||||
<RestorePage />
|
||||
</IconButton>
|
||||
</Tooltip>
|
||||
<Dialog
|
||||
fullWidth
|
||||
maxWidth={"md"}
|
||||
open={openReferReasonDialog}
|
||||
PaperProps={{
|
||||
sx: {
|
||||
boxShadow: "rgba(60, 64, 67, 0.3) 0px 1px 16px 0px, rgba(60, 64, 67, 0.15) 0px 1px 10px 0px",
|
||||
},
|
||||
}}
|
||||
>
|
||||
<DialogTitle>تاریخچه</DialogTitle>
|
||||
<HistoryContent rowId={rowId} setOpenReferReasonDialog={setOpenReferReasonDialog} />
|
||||
</Dialog>
|
||||
</>
|
||||
);
|
||||
};
|
||||
|
||||
export default History;
|
||||
@@ -2,6 +2,7 @@ import { Reply } from "@mui/icons-material";
|
||||
import { IconButton, Tooltip } from "@mui/material";
|
||||
|
||||
const ReferralAction = ({ onClick, disabled }) => {
|
||||
if (disabled) return;
|
||||
return (
|
||||
<>
|
||||
<Tooltip title="ارجاع درخواست">
|
||||
|
||||
@@ -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 (
|
||||
<>
|
||||
<Tooltip title="عدم تایید اقدام">
|
||||
|
||||
@@ -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 (
|
||||
<>
|
||||
<Box sx={{ display: "flex", gap: 1, justifyContent: "center" }}>
|
||||
<History rowId={original.id} />
|
||||
<ReferralAction
|
||||
onClick={() => handleOpenModal("refer_request", original)}
|
||||
disabled={disabled.referral}
|
||||
|
||||
@@ -1,12 +1,13 @@
|
||||
import { Card, CardContent, CircularProgress, Stack, Typography } from "@mui/material";
|
||||
|
||||
const PrevCartableOpinion = ({ item }) => {
|
||||
|
||||
return (
|
||||
<Stack>
|
||||
<Card variant="outlined">
|
||||
<CardContent>
|
||||
<Typography variant="body2">{item.previous_state_name}: {item.action_name}</Typography>
|
||||
<Typography variant="body2">
|
||||
{item.previous_state_name}: {item.action_name}
|
||||
</Typography>
|
||||
<Typography variant="body2">توضیحات: {item.expert_description}</Typography>
|
||||
</CardContent>
|
||||
</Card>
|
||||
|
||||
@@ -1,9 +1,4 @@
|
||||
import {
|
||||
Card,
|
||||
CardContent,
|
||||
Stack,
|
||||
Typography
|
||||
} from "@mui/material";
|
||||
import { Card, CardContent, Stack, Typography } from "@mui/material";
|
||||
|
||||
const QuestionVerifyNeedRoadForm = ({ row }) => {
|
||||
return (
|
||||
|
||||
@@ -1,9 +1,4 @@
|
||||
import {
|
||||
Card,
|
||||
CardContent,
|
||||
Stack,
|
||||
Typography
|
||||
} from "@mui/material";
|
||||
import { Card, CardContent, Stack, Typography } from "@mui/material";
|
||||
|
||||
const QuestionVerifyRoadSafetyForm = ({ row }) => {
|
||||
return (
|
||||
|
||||
@@ -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 (
|
||||
<>
|
||||
<Button onClick={() => setOpenReferDialog(true)} variant="contained" color="error" disabled={isSubmitting} size="large">
|
||||
<Button
|
||||
onClick={() => setOpenReferDialog(true)}
|
||||
variant="contained"
|
||||
color="error"
|
||||
disabled={isSubmitting}
|
||||
size="large"
|
||||
>
|
||||
مخالفت
|
||||
</Button>
|
||||
<Dialog open={openReferDialog} onClose={() => { setOpenReferDialog(false) }} maxWidth="xs" fullWidth>
|
||||
<Dialog
|
||||
open={openReferDialog}
|
||||
onClose={() => {
|
||||
setOpenReferDialog(false);
|
||||
}}
|
||||
maxWidth="xs"
|
||||
fullWidth
|
||||
>
|
||||
<IconButton
|
||||
aria-label="close"
|
||||
onClick={() => setOpenReferDialog(false)}
|
||||
@@ -26,9 +39,16 @@ const Refer = ({ rowId, mutate, handleClose, isSubmitting }) => {
|
||||
<Close />
|
||||
</IconButton>
|
||||
<DialogTitle>مخالفت و ارجاع به دفتر حریم</DialogTitle>
|
||||
{openReferDialog && <ReferForm handleClose={handleClose} setOpenReferDialog={setOpenReferDialog} rowId={rowId} mutate={mutate} />}
|
||||
{openReferDialog && (
|
||||
<ReferForm
|
||||
handleClose={handleClose}
|
||||
setOpenReferDialog={setOpenReferDialog}
|
||||
rowId={rowId}
|
||||
mutate={mutate}
|
||||
/>
|
||||
)}
|
||||
</Dialog>
|
||||
</>
|
||||
)
|
||||
}
|
||||
export default Refer
|
||||
);
|
||||
};
|
||||
export default Refer;
|
||||
|
||||
@@ -6,8 +6,6 @@ import { useState } from "react";
|
||||
import PrevCartableOpinion from "./PrevCartableOpinion";
|
||||
import Questions from "./Questions";
|
||||
|
||||
|
||||
|
||||
const ConfirmRoadSafetyFormContext = ({ row, data, rowId, mutate, handleClose }) => {
|
||||
const [tabState, setTabState] = useState(0);
|
||||
|
||||
@@ -56,7 +54,7 @@ const ConfirmRoadSafetyFormContext = ({ row, data, rowId, mutate, handleClose })
|
||||
>
|
||||
{"بستن"}
|
||||
</Button>
|
||||
<Button variant="contained" size="large" onClick={() => setTabState(s => s + 1)}>
|
||||
<Button variant="contained" size="large" onClick={() => setTabState((s) => s + 1)}>
|
||||
مرحله بعد
|
||||
</Button>
|
||||
</DialogActions>
|
||||
@@ -70,15 +68,10 @@ const ConfirmRoadSafetyFormContext = ({ row, data, rowId, mutate, handleClose })
|
||||
</Stack>
|
||||
</DialogContent>
|
||||
<DialogActions sx={{ alignItems: "center", justifyContent: "center" }}>
|
||||
<Button
|
||||
onClick={handlePrev}
|
||||
variant="outlined"
|
||||
color="secondary"
|
||||
size="large"
|
||||
>
|
||||
<Button onClick={handlePrev} variant="outlined" color="secondary" size="large">
|
||||
مرحله قبل
|
||||
</Button>
|
||||
<Button variant="contained" size="large" onClick={() => setTabState(s => s + 1)}>
|
||||
<Button variant="contained" size="large" onClick={() => setTabState((s) => s + 1)}>
|
||||
مرحله بعد
|
||||
</Button>
|
||||
</DialogActions>
|
||||
|
||||
@@ -1,12 +1,13 @@
|
||||
import { Card, CardContent, CircularProgress, Stack, Typography } from "@mui/material";
|
||||
|
||||
const PrevCartableOpinion = ({ item }) => {
|
||||
|
||||
return (
|
||||
<Stack>
|
||||
<Card variant="outlined">
|
||||
<CardContent>
|
||||
<Typography variant="body2">{item.previous_state_name}: {item.action_name}</Typography>
|
||||
<Typography variant="body2">
|
||||
{item.previous_state_name}: {item.action_name}
|
||||
</Typography>
|
||||
<Typography variant="body2">توضیحات: {item.expert_description}</Typography>
|
||||
</CardContent>
|
||||
</Card>
|
||||
|
||||
@@ -1,9 +1,4 @@
|
||||
import {
|
||||
Card,
|
||||
CardContent,
|
||||
Stack,
|
||||
Typography
|
||||
} from "@mui/material";
|
||||
import { Card, CardContent, Stack, Typography } from "@mui/material";
|
||||
|
||||
const QuestionVerifyNeedRoadForm = () => {
|
||||
return (
|
||||
|
||||
@@ -1,9 +1,4 @@
|
||||
import {
|
||||
Card,
|
||||
CardContent,
|
||||
Stack,
|
||||
Typography
|
||||
} from "@mui/material";
|
||||
import { Card, CardContent, Stack, Typography } from "@mui/material";
|
||||
|
||||
const QuestionVerifyRoadSafetyForm = ({ row }) => {
|
||||
return (
|
||||
|
||||
@@ -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 }) => {
|
||||
</Stack>
|
||||
</DialogContent>
|
||||
<DialogActions sx={{ alignItems: "center", justifyContent: "center" }}>
|
||||
<Button variant="contained" size="large" disabled={isSubmitting} type="button" onClick={handleSubmit(onSubmit)}>
|
||||
<Button
|
||||
variant="contained"
|
||||
size="large"
|
||||
disabled={isSubmitting}
|
||||
type="button"
|
||||
onClick={handleSubmit(onSubmit)}
|
||||
>
|
||||
ثبت
|
||||
</Button>
|
||||
</DialogActions>
|
||||
</>
|
||||
)
|
||||
}
|
||||
export default ReferForm
|
||||
);
|
||||
};
|
||||
export default ReferForm;
|
||||
|
||||
@@ -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 (
|
||||
<>
|
||||
<Button onClick={() => setOpenReferDialog(true)} variant="contained" color="error" disabled={isSubmitting} size="large">
|
||||
<Button
|
||||
onClick={() => setOpenReferDialog(true)}
|
||||
variant="contained"
|
||||
color="error"
|
||||
disabled={isSubmitting}
|
||||
size="large"
|
||||
>
|
||||
مخالفت
|
||||
</Button>
|
||||
<Dialog open={openReferDialog} onClose={() => { setOpenReferDialog(false) }} maxWidth="xs" fullWidth>
|
||||
<Dialog
|
||||
open={openReferDialog}
|
||||
onClose={() => {
|
||||
setOpenReferDialog(false);
|
||||
}}
|
||||
maxWidth="xs"
|
||||
fullWidth
|
||||
>
|
||||
<IconButton
|
||||
aria-label="close"
|
||||
onClick={() => setOpenReferDialog(false)}
|
||||
@@ -26,9 +39,16 @@ const Refer = ({ rowId, mutate, handleClose, isSubmitting }) => {
|
||||
<Close />
|
||||
</IconButton>
|
||||
<DialogTitle>مخالفت و ارجاع به دفتر حریم</DialogTitle>
|
||||
{openReferDialog && <ReferForm handleClose={handleClose} setOpenReferDialog={setOpenReferDialog} rowId={rowId} mutate={mutate} />}
|
||||
{openReferDialog && (
|
||||
<ReferForm
|
||||
handleClose={handleClose}
|
||||
setOpenReferDialog={setOpenReferDialog}
|
||||
rowId={rowId}
|
||||
mutate={mutate}
|
||||
/>
|
||||
)}
|
||||
</Dialog>
|
||||
</>
|
||||
)
|
||||
}
|
||||
export default Refer
|
||||
);
|
||||
};
|
||||
export default Refer;
|
||||
|
||||
@@ -1,5 +1,8 @@
|
||||
import StyledForm from "@/core/components/StyledForm";
|
||||
import { CONFIRM_INQUIRY_PRIVACY_ZAMIN_GOV_ASSISTANT, CONFIRM_VERIFY_NEADROAD_ROAD_INQUIRY_PRIVACY_ZAMIN_GOV_ASSISTANT } from "@/core/utils/routes";
|
||||
import {
|
||||
CONFIRM_INQUIRY_PRIVACY_ZAMIN_GOV_ASSISTANT,
|
||||
CONFIRM_VERIFY_NEADROAD_ROAD_INQUIRY_PRIVACY_ZAMIN_GOV_ASSISTANT,
|
||||
} from "@/core/utils/routes";
|
||||
import useRequest from "@/lib/hooks/useRequest";
|
||||
import { yupResolver } from "@hookform/resolvers/yup";
|
||||
import { Button, DialogActions, DialogContent, Stack } from "@mui/material";
|
||||
@@ -30,27 +33,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 (
|
||||
<StyledForm onSubmit={handleSubmit(onSubmit)}>
|
||||
<DialogContent dividers>
|
||||
<Stack >
|
||||
<Stack>
|
||||
<QuestionVerifyNeedRoadForm row={row} />
|
||||
<DescriptionForm control={control} />
|
||||
</Stack>
|
||||
</DialogContent>
|
||||
<DialogActions sx={{ alignItems: "center", justifyContent: "space-between" }}>
|
||||
<Stack spacing={1} direction={'row'}>
|
||||
<Button onClick={handlePrev} variant="outlined" color="secondary" disabled={isSubmitting} size="large">
|
||||
<Stack spacing={1} direction={"row"}>
|
||||
<Button
|
||||
onClick={handlePrev}
|
||||
variant="outlined"
|
||||
color="secondary"
|
||||
disabled={isSubmitting}
|
||||
size="large"
|
||||
>
|
||||
{"مرحله قبلی"}
|
||||
</Button>
|
||||
<Refer rowId={rowId} mutate={mutate} handleClose={handleClose} isSubmitting={isSubmitting} />
|
||||
@@ -60,6 +69,6 @@ const Questions = ({ row, rowId, mutate, handleClose, handlePrev }) => {
|
||||
</Button>
|
||||
</DialogActions>
|
||||
</StyledForm>
|
||||
)
|
||||
}
|
||||
export default Questions
|
||||
);
|
||||
};
|
||||
export default Questions;
|
||||
|
||||
@@ -6,8 +6,6 @@ import { useState } from "react";
|
||||
import PrevCartableOpinion from "./PrevCartableOpinion";
|
||||
import Questions from "./Questions";
|
||||
|
||||
|
||||
|
||||
const ConfirmRoadSafetyFormContext = ({ row, data, rowId, mutate, handleClose }) => {
|
||||
const [tabState, setTabState] = useState(0);
|
||||
|
||||
@@ -56,7 +54,7 @@ const ConfirmRoadSafetyFormContext = ({ row, data, rowId, mutate, handleClose })
|
||||
>
|
||||
{"بستن"}
|
||||
</Button>
|
||||
<Button variant="contained" size="large" onClick={() => setTabState(s => s + 1)}>
|
||||
<Button variant="contained" size="large" onClick={() => setTabState((s) => s + 1)}>
|
||||
مرحله بعد
|
||||
</Button>
|
||||
</DialogActions>
|
||||
@@ -70,15 +68,10 @@ const ConfirmRoadSafetyFormContext = ({ row, data, rowId, mutate, handleClose })
|
||||
</Stack>
|
||||
</DialogContent>
|
||||
<DialogActions sx={{ alignItems: "center", justifyContent: "center" }}>
|
||||
<Button
|
||||
onClick={handlePrev}
|
||||
variant="outlined"
|
||||
color="secondary"
|
||||
size="large"
|
||||
>
|
||||
<Button onClick={handlePrev} variant="outlined" color="secondary" size="large">
|
||||
مرحله قبل
|
||||
</Button>
|
||||
<Button variant="contained" size="large" onClick={() => setTabState(s => s + 1)}>
|
||||
<Button variant="contained" size="large" onClick={() => setTabState((s) => s + 1)}>
|
||||
مرحله بعد
|
||||
</Button>
|
||||
</DialogActions>
|
||||
|
||||
@@ -1,12 +1,13 @@
|
||||
import { Card, CardContent, CircularProgress, Stack, Typography } from "@mui/material";
|
||||
|
||||
const PrevCartableOpinion = ({ item }) => {
|
||||
|
||||
return (
|
||||
<Stack>
|
||||
<Card variant="outlined">
|
||||
<CardContent>
|
||||
<Typography variant="body2">{item.previous_state_name}: {item.action_name}</Typography>
|
||||
<Typography variant="body2">
|
||||
{item.previous_state_name}: {item.action_name}
|
||||
</Typography>
|
||||
<Typography variant="body2">توضیحات: {item.expert_description}</Typography>
|
||||
</CardContent>
|
||||
</Card>
|
||||
|
||||
@@ -1,9 +1,4 @@
|
||||
import {
|
||||
Card,
|
||||
CardContent,
|
||||
Stack,
|
||||
Typography
|
||||
} from "@mui/material";
|
||||
import { Card, CardContent, Stack, Typography } from "@mui/material";
|
||||
|
||||
const QuestionVerifyNeedRoadForm = ({ row }) => {
|
||||
return (
|
||||
|
||||
@@ -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 }) => {
|
||||
</Stack>
|
||||
</DialogContent>
|
||||
<DialogActions sx={{ alignItems: "center", justifyContent: "center" }}>
|
||||
<Button variant="contained" size="large" disabled={isSubmitting} type="button" onClick={handleSubmit(onSubmit)}>
|
||||
<Button
|
||||
variant="contained"
|
||||
size="large"
|
||||
disabled={isSubmitting}
|
||||
type="button"
|
||||
onClick={handleSubmit(onSubmit)}
|
||||
>
|
||||
ثبت
|
||||
</Button>
|
||||
</DialogActions>
|
||||
</>
|
||||
)
|
||||
}
|
||||
export default ReferForm
|
||||
);
|
||||
};
|
||||
export default ReferForm;
|
||||
|
||||
@@ -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 (
|
||||
<>
|
||||
<Button onClick={() => setOpenReferDialog(true)} variant="contained" color="error" disabled={isSubmitting} size="large">
|
||||
<Button
|
||||
onClick={() => setOpenReferDialog(true)}
|
||||
variant="contained"
|
||||
color="error"
|
||||
disabled={isSubmitting}
|
||||
size="large"
|
||||
>
|
||||
مخالفت
|
||||
</Button>
|
||||
<Dialog open={openReferDialog} onClose={() => { setOpenReferDialog(false) }} maxWidth="xs" fullWidth>
|
||||
<Dialog
|
||||
open={openReferDialog}
|
||||
onClose={() => {
|
||||
setOpenReferDialog(false);
|
||||
}}
|
||||
maxWidth="xs"
|
||||
fullWidth
|
||||
>
|
||||
<IconButton
|
||||
aria-label="close"
|
||||
onClick={() => setOpenReferDialog(false)}
|
||||
@@ -26,9 +39,16 @@ const Refer = ({ rowId, mutate, handleClose, isSubmitting }) => {
|
||||
<Close />
|
||||
</IconButton>
|
||||
<DialogTitle>مخالفت و ارجاع به دفتر حریم</DialogTitle>
|
||||
{openReferDialog && <ReferForm handleClose={handleClose} setOpenReferDialog={setOpenReferDialog} rowId={rowId} mutate={mutate} />}
|
||||
{openReferDialog && (
|
||||
<ReferForm
|
||||
handleClose={handleClose}
|
||||
setOpenReferDialog={setOpenReferDialog}
|
||||
rowId={rowId}
|
||||
mutate={mutate}
|
||||
/>
|
||||
)}
|
||||
</Dialog>
|
||||
</>
|
||||
)
|
||||
}
|
||||
export default Refer
|
||||
);
|
||||
};
|
||||
export default Refer;
|
||||
|
||||
@@ -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 (
|
||||
<StyledForm onSubmit={handleSubmit(onSubmit)}>
|
||||
<DialogContent dividers>
|
||||
<Stack >
|
||||
<Stack>
|
||||
<QuestionVerifyNeedRoadForm row={row} />
|
||||
<DescriptionForm control={control} />
|
||||
</Stack>
|
||||
</DialogContent>
|
||||
<DialogActions sx={{ alignItems: "center", justifyContent: "space-between" }}>
|
||||
<Stack spacing={1} direction={'row'}>
|
||||
<Button onClick={handlePrev} variant="outlined" color="secondary" disabled={isSubmitting} size="large">
|
||||
<Stack spacing={1} direction={"row"}>
|
||||
<Button
|
||||
onClick={handlePrev}
|
||||
variant="outlined"
|
||||
color="secondary"
|
||||
disabled={isSubmitting}
|
||||
size="large"
|
||||
>
|
||||
{"مرحله قبلی"}
|
||||
</Button>
|
||||
<Refer rowId={rowId} mutate={mutate} handleClose={handleClose} isSubmitting={isSubmitting} />
|
||||
@@ -59,6 +65,6 @@ const Questions = ({ row, rowId, mutate, handleClose, handlePrev }) => {
|
||||
</Button>
|
||||
</DialogActions>
|
||||
</StyledForm>
|
||||
)
|
||||
}
|
||||
export default Questions
|
||||
);
|
||||
};
|
||||
export default Questions;
|
||||
|
||||
@@ -0,0 +1,17 @@
|
||||
import { Button, DialogActions, DialogContent } from "@mui/material";
|
||||
import TableContent from "./TableContent";
|
||||
const HistoryContent = ({ setOpenReferReasonDialog, rowId }) => {
|
||||
return (
|
||||
<>
|
||||
<DialogContent>
|
||||
<TableContent rowId={rowId} />
|
||||
</DialogContent>
|
||||
<DialogActions>
|
||||
<Button onClick={() => setOpenReferReasonDialog(false)} variant="outlined" color="secondary" autoFocus>
|
||||
بستن
|
||||
</Button>
|
||||
</DialogActions>
|
||||
</>
|
||||
);
|
||||
};
|
||||
export default HistoryContent;
|
||||
@@ -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 (
|
||||
<Box display="flex" justifyContent="center" alignItems="center" height={200}>
|
||||
<CircularProgress />
|
||||
</Box>
|
||||
);
|
||||
}
|
||||
|
||||
if (error) {
|
||||
return (
|
||||
<Box display="flex" justifyContent="center" alignItems="center" height={200}>
|
||||
<Typography color="error">{error}</Typography>
|
||||
</Box>
|
||||
);
|
||||
}
|
||||
|
||||
if (!historyData.length) {
|
||||
return (
|
||||
<Box display="flex" justifyContent="center" alignItems="center" height={200}>
|
||||
<Typography>اطلاعاتی وجود ندارد</Typography>
|
||||
</Box>
|
||||
);
|
||||
}
|
||||
|
||||
return (
|
||||
<Box>
|
||||
<TableContainer sx={{ maxHeight: 600 }}>
|
||||
<Table stickyHeader sx={{ minWidth: 800 }}>
|
||||
<TableHead>
|
||||
<TableRow>
|
||||
<TableCell>وضعیت</TableCell>
|
||||
<TableCell>توضیحات کارشناس</TableCell>
|
||||
</TableRow>
|
||||
</TableHead>
|
||||
<TableBody>
|
||||
{historyData.map((row) => (
|
||||
<TableRow key={row.id} sx={{ "&:last-child td, &:last-child th": { border: 0 } }}>
|
||||
<TableCell>{row.previous_state_name}</TableCell>
|
||||
<TableCell>{row.expert_description}</TableCell>
|
||||
</TableRow>
|
||||
))}
|
||||
</TableBody>
|
||||
</Table>
|
||||
</TableContainer>
|
||||
</Box>
|
||||
);
|
||||
};
|
||||
|
||||
export default TableContent;
|
||||
@@ -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 (
|
||||
<>
|
||||
<Tooltip title="تاریخچه">
|
||||
<IconButton color="warning" onClick={() => setOpenReferReasonDialog(true)}>
|
||||
<RestorePage />
|
||||
</IconButton>
|
||||
</Tooltip>
|
||||
<Dialog
|
||||
fullWidth
|
||||
maxWidth={"md"}
|
||||
open={openReferReasonDialog}
|
||||
PaperProps={{
|
||||
sx: {
|
||||
boxShadow: "rgba(60, 64, 67, 0.3) 0px 1px 16px 0px, rgba(60, 64, 67, 0.15) 0px 1px 10px 0px",
|
||||
},
|
||||
}}
|
||||
>
|
||||
<DialogTitle>تاریخچه</DialogTitle>
|
||||
<HistoryContent rowId={rowId} setOpenReferReasonDialog={setOpenReferReasonDialog} />
|
||||
</Dialog>
|
||||
</>
|
||||
);
|
||||
};
|
||||
|
||||
export default History;
|
||||
@@ -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";
|
||||
|
||||
30
src/lib/hooks/useHistory.js
Normal file
30
src/lib/hooks/useHistory.js
Normal file
@@ -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 };
|
||||
};
|
||||
Reference in New Issue
Block a user