harim manager
This commit is contained in:
@@ -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,56 @@
|
||||
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,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,56 @@
|
||||
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,12 +1,21 @@
|
||||
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>
|
||||
);
|
||||
};
|
||||
|
||||
@@ -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,56 @@
|
||||
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}
|
||||
|
||||
@@ -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,56 @@
|
||||
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;
|
||||
@@ -243,3 +243,6 @@ 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";
|
||||
|
||||
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