Feature/refer modal
This commit is contained in:
@@ -0,0 +1,19 @@
|
||||
import {Button, DialogActions, DialogContent,} from "@mui/material"
|
||||
import {useTranslations} from "next-intl";
|
||||
import TableContent from "./TableContent";
|
||||
const HistoryContent = ({setOpenReferReasonDialog, row}) => {
|
||||
const t = useTranslations();
|
||||
return (
|
||||
<>
|
||||
<DialogContent>
|
||||
<TableContent row={row}/>
|
||||
</DialogContent>
|
||||
<DialogActions>
|
||||
<Button onClick={() => setOpenReferReasonDialog(false)} variant="outlined" color="secondary" autoFocus>
|
||||
{t("ReferReasonDialog.button-cancel")}
|
||||
</Button>
|
||||
</DialogActions>
|
||||
</>
|
||||
)
|
||||
}
|
||||
export default HistoryContent
|
||||
@@ -0,0 +1,38 @@
|
||||
import {
|
||||
Box,
|
||||
Table,
|
||||
TableBody,
|
||||
TableCell,
|
||||
TableContainer,
|
||||
TableHead,
|
||||
TableRow,
|
||||
} from "@mui/material";
|
||||
import {useTranslations} from "next-intl";
|
||||
import moment from "jalali-moment";
|
||||
|
||||
const TableContent = ({row}) => {
|
||||
const t = useTranslations();
|
||||
return (<Box>
|
||||
<TableContainer sx={{maxHeight: 600}}>
|
||||
<Table stickyHeader sx={{minWidth: 800}}>
|
||||
<TableHead>
|
||||
<TableRow>
|
||||
<TableCell>{t("LoanHistory.Table_head_date")}</TableCell>
|
||||
<TableCell>{t("LoanHistory.Table_head_state")}</TableCell>
|
||||
<TableCell>{t("LoanHistory.Table_head_refer_reason")}</TableCell>
|
||||
</TableRow>
|
||||
</TableHead>
|
||||
<TableBody>
|
||||
<TableRow sx={{'&:last-child td, &:last-child th': {border: 0}}}>
|
||||
<TableCell>{moment(row.original.latest_history.created_at).locale("fa").format("HH:mm | yyyy/MM/DD")}</TableCell>
|
||||
<TableCell>{row.original.latest_history.previous_state_name}</TableCell>
|
||||
<TableCell>{row.original.latest_history.expert_description}</TableCell>
|
||||
</TableRow>
|
||||
</TableBody>
|
||||
</Table>
|
||||
</TableContainer>
|
||||
</Box>
|
||||
|
||||
)
|
||||
}
|
||||
export default TableContent
|
||||
@@ -0,0 +1,30 @@
|
||||
import {
|
||||
Dialog,
|
||||
DialogTitle,
|
||||
IconButton,
|
||||
Tooltip,
|
||||
} from "@mui/material"
|
||||
import {useTranslations} from "next-intl";
|
||||
import {useState} from "react";
|
||||
import RestorePageIcon from '@mui/icons-material/RestorePage';
|
||||
import HistoryContent from "./HistoryContent";
|
||||
|
||||
const ReferReason = ({row}) => {
|
||||
const t = useTranslations();
|
||||
const [openReferReasonDialog, setOpenReferReasonDialog] = useState(false);
|
||||
return (
|
||||
<>
|
||||
<Tooltip title={t("ReferReasonDialog.refer_reason")}>
|
||||
<IconButton color="warning" onClick={() => setOpenReferReasonDialog(true)}>
|
||||
<RestorePageIcon/>
|
||||
</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>{t("ReferReasonDialog.refer_reason")}</DialogTitle>
|
||||
<HistoryContent row={row} setOpenReferReasonDialog={setOpenReferReasonDialog}/>
|
||||
</Dialog>
|
||||
</>
|
||||
)
|
||||
}
|
||||
export default ReferReason
|
||||
@@ -2,11 +2,12 @@ import {Box} from "@mui/material";
|
||||
import Reject from "./Form/RejectForm"
|
||||
import Confirm from "./Form/ConfirmForm";
|
||||
import ReserveForm from "@/components/dashboard/passenger-boss/Form/ReserveForm";
|
||||
import ReferReason from "@/components/dashboard/passenger-boss/Form/ReferReason";
|
||||
|
||||
const TableRow = ({row, mutate}) => {
|
||||
|
||||
return (
|
||||
<Box sx={{display: "flex", flexWrap: "nowrap", gap: "8px"}}>
|
||||
{row.original.latest_history?.action === "refer" ? <ReferReason row={row}/> : null}
|
||||
<Confirm
|
||||
rowId={row.getValue("id")}
|
||||
vehicle_type={row.original.vehicle_type}
|
||||
|
||||
@@ -270,23 +270,6 @@ function DashboardPassengerOfficeComponent() {
|
||||
</Stack>
|
||||
),
|
||||
},
|
||||
{
|
||||
accessorFn: (row) => row.latest_history ? row.latest_history.expert_description : null,
|
||||
id: "latest_history.expert_description",
|
||||
header: t("PassengerBoss.refer_reason"),
|
||||
enableColumnFilter: false,
|
||||
datatype: "text",
|
||||
filterFn: "contains",
|
||||
columnFilterModeOptions: ["contains", "equals", "notEquals"],
|
||||
Cell: ({ row }) => {
|
||||
const latestHistory = row.original.latest_history;
|
||||
return (
|
||||
<Typography variant="body2">
|
||||
{latestHistory && latestHistory.action === 'refer' ? latestHistory.expert_description : null}
|
||||
</Typography>
|
||||
);
|
||||
},
|
||||
},
|
||||
{
|
||||
accessorFn: (row) => row.state_name,
|
||||
id: "state_id",
|
||||
|
||||
@@ -0,0 +1,19 @@
|
||||
import {Button, DialogActions, DialogContent,} from "@mui/material"
|
||||
import {useTranslations} from "next-intl";
|
||||
import TableContent from "./TableContent";
|
||||
const HistoryContent = ({setOpenReferReasonDialog, row}) => {
|
||||
const t = useTranslations();
|
||||
return (
|
||||
<>
|
||||
<DialogContent>
|
||||
<TableContent row={row}/>
|
||||
</DialogContent>
|
||||
<DialogActions>
|
||||
<Button onClick={() => setOpenReferReasonDialog(false)} variant="outlined" color="secondary" autoFocus>
|
||||
{t("ReferReasonDialog.button-cancel")}
|
||||
</Button>
|
||||
</DialogActions>
|
||||
</>
|
||||
)
|
||||
}
|
||||
export default HistoryContent
|
||||
@@ -0,0 +1,38 @@
|
||||
import {
|
||||
Box,
|
||||
Table,
|
||||
TableBody,
|
||||
TableCell,
|
||||
TableContainer,
|
||||
TableHead,
|
||||
TableRow,
|
||||
} from "@mui/material";
|
||||
import {useTranslations} from "next-intl";
|
||||
import moment from "jalali-moment";
|
||||
|
||||
const TableContent = ({row}) => {
|
||||
const t = useTranslations();
|
||||
return (<Box>
|
||||
<TableContainer sx={{maxHeight: 600}}>
|
||||
<Table stickyHeader sx={{minWidth: 800}}>
|
||||
<TableHead>
|
||||
<TableRow>
|
||||
<TableCell>{t("LoanHistory.Table_head_date")}</TableCell>
|
||||
<TableCell>{t("LoanHistory.Table_head_state")}</TableCell>
|
||||
<TableCell>{t("LoanHistory.Table_head_refer_reason")}</TableCell>
|
||||
</TableRow>
|
||||
</TableHead>
|
||||
<TableBody>
|
||||
<TableRow sx={{'&:last-child td, &:last-child th': {border: 0}}}>
|
||||
<TableCell>{moment(row.original.latest_history.created_at).locale("fa").format("HH:mm | yyyy/MM/DD")}</TableCell>
|
||||
<TableCell>{row.original.latest_history.previous_state_name}</TableCell>
|
||||
<TableCell>{row.original.latest_history.expert_description}</TableCell>
|
||||
</TableRow>
|
||||
</TableBody>
|
||||
</Table>
|
||||
</TableContainer>
|
||||
</Box>
|
||||
|
||||
)
|
||||
}
|
||||
export default TableContent
|
||||
@@ -0,0 +1,30 @@
|
||||
import {
|
||||
Dialog,
|
||||
DialogTitle,
|
||||
IconButton,
|
||||
Tooltip,
|
||||
} from "@mui/material"
|
||||
import {useTranslations} from "next-intl";
|
||||
import {useState} from "react";
|
||||
import RestorePageIcon from '@mui/icons-material/RestorePage';
|
||||
import HistoryContent from "./HistoryContent";
|
||||
|
||||
const ReferReason = ({row}) => {
|
||||
const t = useTranslations();
|
||||
const [openReferReasonDialog, setOpenReferReasonDialog] = useState(false);
|
||||
return (
|
||||
<>
|
||||
<Tooltip title={t("ReferReasonDialog.refer_reason")}>
|
||||
<IconButton color="warning" onClick={() => setOpenReferReasonDialog(true)}>
|
||||
<RestorePageIcon/>
|
||||
</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>{t("ReferReasonDialog.refer_reason")}</DialogTitle>
|
||||
<HistoryContent row={row} setOpenReferReasonDialog={setOpenReferReasonDialog}/>
|
||||
</Dialog>
|
||||
</>
|
||||
)
|
||||
}
|
||||
export default ReferReason
|
||||
@@ -2,11 +2,13 @@ import {Box} from "@mui/material";
|
||||
import Confirm from "./Form/ConfirmForm";
|
||||
import Reject from "./Form/RejectForm";
|
||||
import Revert from "@/components/dashboard/transportation-assistance/Form/RevertForm";
|
||||
import ReferReason from "@/components/dashboard/transportation-assistance/Form/ReferReason";
|
||||
|
||||
const TableRow = ({row, mutate}) => {
|
||||
|
||||
return (
|
||||
<Box sx={{display: "flex", flexWrap: "nowrap", gap: "8px"}}>
|
||||
{row.original.latest_history?.action === "refer" ? <ReferReason row={row}/> : null}
|
||||
<Confirm
|
||||
rowId={row.getValue("id")}
|
||||
mutate={mutate}
|
||||
|
||||
@@ -412,23 +412,6 @@ function DashboardTransportationAssistanceComponent() {
|
||||
<Typography variant="body2">{renderedCellValue}</Typography>
|
||||
),
|
||||
},
|
||||
{
|
||||
accessorFn: (row) => row.latest_history ? row.latest_history.expert_description : null,
|
||||
id: "latest_history.expert_description",
|
||||
header: t("TransportationAssistance.refer_reason"),
|
||||
enableColumnFilter: false,
|
||||
datatype: "text",
|
||||
filterFn: "contains",
|
||||
columnFilterModeOptions: ["contains", "equals", "notEquals"],
|
||||
Cell: ({ row }) => {
|
||||
const latestHistory = row.original.latest_history;
|
||||
return (
|
||||
<Typography variant="body2">
|
||||
{latestHistory && latestHistory.action === 'refer' ? latestHistory.expert_description : null}
|
||||
</Typography>
|
||||
);
|
||||
},
|
||||
},
|
||||
{
|
||||
accessorFn: (row) => row.state_name,
|
||||
id: "state_id",
|
||||
|
||||
Reference in New Issue
Block a user