Merge branch 'release/v2.6.0'
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
NEXT_PUBLIC_API_NAME = "Loan Facilities Dashboard"
|
||||
NEXT_PUBLIC_API_VERSION = "2.5.8"
|
||||
NEXT_PUBLIC_API_VERSION = "2.6.0"
|
||||
NEXT_PUBLIC_DEFAULT_LANGUAGE = "fa"
|
||||
NEXT_PUBLIC_DEFAULT_DIRECTION = "rtl"
|
||||
|
||||
|
||||
@@ -62,6 +62,7 @@
|
||||
"role-management": "مدیریت نقش ها",
|
||||
"edit-profile": "ویرایش پروفایل",
|
||||
"loan-history": "کارتابل نظارت",
|
||||
"loan-followup": "پیگیری وام",
|
||||
"loan-history-province": "کارتابل نظارت استانی",
|
||||
"reserve-loan": "وام های رزرو"
|
||||
},
|
||||
@@ -124,6 +125,7 @@
|
||||
"user_management_page": "مدیریت کاربر",
|
||||
"admin_setting": "تنظیمات",
|
||||
"loan_history": "کارتابل نظارت",
|
||||
"loan_followup": "کارتابل پیگیری وام",
|
||||
"total_number_loan_offers": "تعداد کل وام های پیشنهادی",
|
||||
"total_amount_proposed_loan": "مبلغ کل وام های پیشنهادی",
|
||||
"total_number_requests": "تعداد کل درخواست ها",
|
||||
@@ -269,6 +271,56 @@
|
||||
"first_form": "فرم الف را بارگذاری کنید",
|
||||
"second_form": "فرم ب را بارگذاری کنید"
|
||||
},
|
||||
"LoanFollowUp": {
|
||||
"name": "نام",
|
||||
"birthday": "تاریخ تولد",
|
||||
"approved_amount": "مبلغ مصوب",
|
||||
"branch_name": "نام شعبه",
|
||||
"bank_state": "وضعیت پیگیری بانک",
|
||||
"button-reserve-confirm": "رزرو",
|
||||
"reserve-loan-title": "رزرو وام",
|
||||
"description-reserve-loan-first": "آیا از رزرو وام به کد یکتا",
|
||||
"description-reserve-loan-second": "اطمینان دارید؟",
|
||||
"button-reserve-cancel": "بستن",
|
||||
"national_serial_number": "سریال پشت کارت ملی",
|
||||
"national_tracking_code": "کد رهگیری کارت ملی",
|
||||
"city_name": "شهرستان",
|
||||
"plate_number": "پلاک",
|
||||
"refer_reason": "علت ارجاع",
|
||||
"statement_count": "تعداد صورت وضعیت",
|
||||
"id": "کد یکتا",
|
||||
"score": "اولویت",
|
||||
"navgan_capacity": "ظرفیت",
|
||||
"manufacture_date": "سال ساخت",
|
||||
"shenase_meli": "شناسه ملی",
|
||||
"is_legal_person": "نوع شخص",
|
||||
"haghighi": "حقیقی",
|
||||
"hoghoghi": "حقوقی",
|
||||
"province_name": "استان",
|
||||
"sakht_period": "دوره ساخت",
|
||||
"tanafos_period": "دوره تنفس",
|
||||
"national_id": "کد ملی",
|
||||
"phone_number": "موبایل",
|
||||
"proposed_amount": "مبلغ پیشنهادی",
|
||||
"created_at": "تاریخ درخواست",
|
||||
"updated_at": "تاریخ بروزرسانی",
|
||||
"navgan_id": "کد ناوگان",
|
||||
"vehicle_type": "نوع ماشین",
|
||||
"state_name": "وضعیت درخواست",
|
||||
"confirm": "تایید و ارجاع به معاون حمل و نقل",
|
||||
"upload_file": "فایل خود را بارگذاری کنید(اختیاری)",
|
||||
"upload_expert_img": "فایل گزارش کارشناسی را بارگذاری کنید",
|
||||
"upload_file_required": "وارد کردن گزارش کارشناسی الزامیست",
|
||||
"upload_file_unit": "فایل بارگذاری شده باید حداکثر 5Mb باشد",
|
||||
"upload_file_format": "فرمت قابل قبول : png,jpg,pdf",
|
||||
"upload_expert_file_required": "وارد کردن گزارش کارشناسی الزامیست",
|
||||
"upload_expert_file_unit": "فایل بارگذاری شده باید حداکثر 5Mb باشد",
|
||||
"upload_expert_file_format": "فرمت قابل قبول : png,jpg,pdf",
|
||||
"max_amount": "حداکثر مبلغ تصویب شده {value} میلیون ریال می باشد",
|
||||
"excel_report": "گزارش اکسل",
|
||||
"first_form": "فرم الف را بارگذاری کنید",
|
||||
"second_form": "فرم ب را بارگذاری کنید"
|
||||
},
|
||||
"RefahiProvinceManager": {
|
||||
"name": "نام",
|
||||
"id": "کد یکتا",
|
||||
@@ -571,6 +623,11 @@
|
||||
"button-revise": "ارسال",
|
||||
"description": "توضیحات خود را وارد نمائید"
|
||||
},
|
||||
"ReferReasonDialog": {
|
||||
"refer_reason": "علت ارجاع",
|
||||
"button-cancel" : "بازگشت",
|
||||
"expert_description" : "توضیحات کارشناس :"
|
||||
},
|
||||
"RejectDialog": {
|
||||
"bank_management_reject": "رد درخواست",
|
||||
"typography": "آیا میخواهید این درخواست را رد کنید ؟",
|
||||
@@ -722,6 +779,16 @@
|
||||
"typography": "آیا از حدف این مورد اطمینان دارید ؟",
|
||||
"button-delete": "حذف کردن"
|
||||
},
|
||||
"ReferDialog": {
|
||||
"refer-passenger-boss": "ارجاع به کارگروه",
|
||||
"refer-user": "ارجاع به کاربر",
|
||||
"refer-confirmation": "آیا از ارجاع این مورد اطمینان دارید ؟",
|
||||
"button-cancel": "انصراف",
|
||||
"typography": "آیا از ارجاع این مورد اطمینان دارید ؟",
|
||||
"button-refer": "ارجاع",
|
||||
"description_error" : "وارد کردن توضیحات الزامیست!!!",
|
||||
"description": "توضیحات"
|
||||
},
|
||||
"AddDialog": {
|
||||
"add": "افزودن",
|
||||
"setting_name": "نام انگلیسی",
|
||||
@@ -839,11 +906,13 @@
|
||||
"Table_history_error": "خطا در دریافت اطلاعات",
|
||||
"history_report": "فایل ضمیمه",
|
||||
"Table_head_name": "نام",
|
||||
"Table_head_id": "کد یکتا",
|
||||
"Table_head_date": "تاریخ",
|
||||
"Table_head_position": "سمت",
|
||||
"Table_head_action": "عملیات",
|
||||
"Table_head_file": "فایل پیوست",
|
||||
"Table_head_state": "وضعیت",
|
||||
"Table_head_refer_reason": "علت ارجاع",
|
||||
"Table_head_expert_description": "توضیحات",
|
||||
"empty_history_detail": "سابقه ای برای این وام وجود ندارد"
|
||||
}
|
||||
|
||||
@@ -0,0 +1,80 @@
|
||||
import useNotification from "@/lib/app/hooks/useNotification";
|
||||
import useRequest from "@/lib/app/hooks/useRequest";
|
||||
import {Button, DialogActions, DialogContent, Stack, TextField} from "@mui/material"
|
||||
import {useFormik} from "formik";
|
||||
import {useTranslations} from "next-intl";
|
||||
import * as Yup from "yup";
|
||||
import {REFER_LOAN_FOLLOWUP_PASSENGERBOSS} from "@/core/data/apiRoutes";
|
||||
|
||||
const ReferPassengerBossContent = ({rowId, mutate, setOpenReferDialog}) => {
|
||||
const t = useTranslations();
|
||||
const requestServer = useRequest({auth: true})
|
||||
const {update_notification} = useNotification()
|
||||
|
||||
const validationSchema = Yup.object().shape({
|
||||
description: Yup.string().required(t("ReferDialog.description_error")),
|
||||
});
|
||||
|
||||
const formik = useFormik({
|
||||
initialValues: {
|
||||
description: "",
|
||||
},
|
||||
validationSchema,
|
||||
onSubmit: (values, {setSubmitting}) => {
|
||||
const formData = new FormData();
|
||||
formData.append("expert_description", values.description);
|
||||
requestServer(`${REFER_LOAN_FOLLOWUP_PASSENGERBOSS}/${rowId}`, 'post', {
|
||||
data: formData,
|
||||
}).then((response) => {
|
||||
setOpenReferDialog(false)
|
||||
mutate()
|
||||
update_notification()
|
||||
}).catch(() => {
|
||||
}).finally(() => {
|
||||
setSubmitting(false);
|
||||
});
|
||||
},
|
||||
});
|
||||
|
||||
const handleDescriptionChange = (event) => {
|
||||
formik.setFieldValue("description", event.target.value);
|
||||
formik.handleChange(event);
|
||||
};
|
||||
return (
|
||||
<>
|
||||
<DialogContent>
|
||||
<Stack spacing={2}>
|
||||
<Stack>
|
||||
<TextField
|
||||
name="description"
|
||||
multiline
|
||||
rows={8}
|
||||
label={t("ReferDialog.description")}
|
||||
value={formik.values.description}
|
||||
onChange={handleDescriptionChange}
|
||||
onBlur={formik.handleBlur("description")}
|
||||
error={
|
||||
formik.touched.description && Boolean(formik.errors.description)
|
||||
}
|
||||
helperText={formik.touched.description && formik.errors.description}
|
||||
fullWidth
|
||||
variant="outlined"
|
||||
sx={{mt: 1}}
|
||||
/>
|
||||
</Stack>
|
||||
</Stack>
|
||||
</DialogContent>
|
||||
<DialogActions>
|
||||
<Button onClick={() => setOpenReferDialog(false)} variant="outlined" color="secondary"
|
||||
disabled={formik.isSubmitting} autoFocus>
|
||||
{t("ReferDialog.button-cancel")}
|
||||
</Button>
|
||||
<Button onClick={formik.handleSubmit} variant="contained" color="primary"
|
||||
disabled={formik.isSubmitting || !formik.dirty || !formik.isValid}>
|
||||
{t("ReferDialog.button-refer")}
|
||||
</Button>
|
||||
</DialogActions>
|
||||
</>
|
||||
)
|
||||
}
|
||||
export default ReferPassengerBossContent
|
||||
@@ -0,0 +1,25 @@
|
||||
import {Dialog, DialogTitle, IconButton, Tooltip} from "@mui/material"
|
||||
import {useTranslations} from "next-intl";
|
||||
import {useState} from "react";
|
||||
import UTurnRightIcon from '@mui/icons-material/UTurnRight';
|
||||
import ReferPassengerBossContent from "./ReferPassengerBossContent";
|
||||
|
||||
const ReferPassengerBoss = ({rowId, mutate}) => {
|
||||
const t = useTranslations();
|
||||
const [openReferDialog, setOpenReferDialog] = useState(false);
|
||||
return (
|
||||
<>
|
||||
<Tooltip title={t("ReferDialog.refer-passenger-boss")}>
|
||||
<IconButton color="primary" onClick={() => setOpenReferDialog(true)}>
|
||||
<UTurnRightIcon/>
|
||||
</IconButton>
|
||||
</Tooltip>
|
||||
<Dialog fullWidth open={openReferDialog}
|
||||
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("ReferDialog.refer-passenger-boss")}</DialogTitle>
|
||||
<ReferPassengerBossContent mutate={mutate} rowId={rowId} setOpenReferDialog={setOpenReferDialog}/>
|
||||
</Dialog>
|
||||
</>
|
||||
)
|
||||
}
|
||||
export default ReferPassengerBoss
|
||||
14
src/components/dashboard/loan-followup/TableRowActions.jsx
Normal file
14
src/components/dashboard/loan-followup/TableRowActions.jsx
Normal file
@@ -0,0 +1,14 @@
|
||||
import {Box} from "@mui/material";
|
||||
import ReferPassengerBoss from "@/components/dashboard/loan-followup/Form/ReferPassengerBoss";
|
||||
|
||||
const TableRow = ({row, mutate}) => {
|
||||
return (
|
||||
<Box sx={{display: "flex", flexWrap: "nowrap", gap: "8px"}}>
|
||||
<ReferPassengerBoss
|
||||
rowId={row.getValue("id")}
|
||||
mutate={mutate}
|
||||
/>
|
||||
</Box>
|
||||
);
|
||||
};
|
||||
export default TableRow;
|
||||
10
src/components/dashboard/loan-followup/TableToolbar.jsx
Normal file
10
src/components/dashboard/loan-followup/TableToolbar.jsx
Normal file
@@ -0,0 +1,10 @@
|
||||
import {Stack} from "@mui/material";
|
||||
|
||||
const TableToolbar = ({table}) => {
|
||||
return (
|
||||
<Stack direction={"row"} spacing={2}>
|
||||
</Stack>
|
||||
)
|
||||
}
|
||||
|
||||
export default TableToolbar
|
||||
277
src/components/dashboard/loan-followup/index.jsx
Normal file
277
src/components/dashboard/loan-followup/index.jsx
Normal file
@@ -0,0 +1,277 @@
|
||||
import {useTranslations} from "next-intl";
|
||||
import {useMemo} from "react";
|
||||
import {Box, Typography} from "@mui/material";
|
||||
import moment from "jalali-moment";
|
||||
import MuiDatePicker from "@/core/components/MuiDatePicker";
|
||||
import DataTable from "@/core/components/DataTable";
|
||||
import {GET_LOAN_FOLLOWUP} from "@/core/data/apiRoutes";
|
||||
import TableToolbar from "./TableToolbar";
|
||||
import TableRowActions from "./TableRowActions";
|
||||
|
||||
function DashboardLoanFollowUpComponent () {
|
||||
const t = useTranslations();
|
||||
const columns = useMemo(
|
||||
() => [
|
||||
{
|
||||
accessorFn: (row) => row.id,
|
||||
id: "id",
|
||||
header: t("LoanFollowUp.id"),
|
||||
enableColumnFilter: true,
|
||||
datatype: "numeric",
|
||||
filterFn: "equals",
|
||||
columnFilterModeOptions: [
|
||||
"equals",
|
||||
"notEquals",
|
||||
"contains",
|
||||
"lessThan",
|
||||
"greaterThan",
|
||||
"between",
|
||||
],
|
||||
Cell: ({renderedCellValue}) => (
|
||||
<Typography variant="body2">{renderedCellValue}</Typography>
|
||||
),
|
||||
},
|
||||
{
|
||||
accessorFn: (row) => row.navgan_id,
|
||||
id: "navgan_id",
|
||||
header: t("LoanFollowUp.navgan_id"),
|
||||
enableColumnFilter: true,
|
||||
datatype: "numeric",
|
||||
filterFn: "equals",
|
||||
columnFilterModeOptions: [
|
||||
"equals",
|
||||
"notEquals",
|
||||
"contains",
|
||||
"lessThan",
|
||||
"greaterThan",
|
||||
"between",
|
||||
],
|
||||
Cell: ({renderedCellValue}) => (
|
||||
<Typography variant="body2">{renderedCellValue}</Typography>
|
||||
),
|
||||
},
|
||||
{
|
||||
accessorFn: (row) => row.name,
|
||||
id: "name",
|
||||
header: t("LoanFollowUp.name"),
|
||||
enableColumnFilter: true,
|
||||
datatype: "text",
|
||||
filterFn: "contains",
|
||||
columnFilterModeOptions: ["contains", "equals", "notEquals"],
|
||||
Cell: ({renderedCellValue}) => (
|
||||
<Typography variant="body2">{renderedCellValue}</Typography>
|
||||
),
|
||||
},
|
||||
{
|
||||
accessorFn: (row) => row.national_id,
|
||||
id: "national_id",
|
||||
header: t("LoanFollowUp.national_id"),
|
||||
enableColumnFilter: true,
|
||||
datatype: "numeric",
|
||||
filterFn: "equals",
|
||||
columnFilterModeOptions: [
|
||||
"equals",
|
||||
"notEquals",
|
||||
"contains",
|
||||
"lessThan",
|
||||
"greaterThan",
|
||||
"between",
|
||||
],
|
||||
Cell: ({renderedCellValue}) => (
|
||||
<Typography variant="body2">{renderedCellValue}</Typography>
|
||||
),
|
||||
},
|
||||
{
|
||||
accessorFn: (row) => row.shenase_meli,
|
||||
id: "shenase_meli",
|
||||
header: t("LoanFollowUp.shenase_meli"),
|
||||
enableColumnFilter: true,
|
||||
datatype: "numeric",
|
||||
filterFn: "equals",
|
||||
columnFilterModeOptions: [
|
||||
"equals",
|
||||
"notEquals",
|
||||
"contains",
|
||||
"lessThan",
|
||||
"greaterThan",
|
||||
"between",
|
||||
],
|
||||
Cell: ({renderedCellValue}) => (
|
||||
<Typography variant="body2">{renderedCellValue}</Typography>
|
||||
),
|
||||
},
|
||||
{
|
||||
accessorFn: (row) => row.national_serial_number,
|
||||
id: "national_serial_number",
|
||||
header: t("LoanFollowUp.national_serial_number"),
|
||||
enableColumnFilter: true,
|
||||
datatype: "numeric",
|
||||
filterFn: "equals",
|
||||
columnFilterModeOptions: [
|
||||
"equals",
|
||||
"notEquals",
|
||||
"contains",
|
||||
"lessThan",
|
||||
"greaterThan",
|
||||
"between",
|
||||
],
|
||||
Cell: ({renderedCellValue}) => (
|
||||
<Typography variant="body2">{renderedCellValue}</Typography>
|
||||
),
|
||||
},
|
||||
{
|
||||
accessorFn: (row) => row.national_tracking_code,
|
||||
id: "national_tracking_code",
|
||||
header: t("LoanFollowUp.national_tracking_code"),
|
||||
enableColumnFilter: true,
|
||||
datatype: "text",
|
||||
filterFn: "equals",
|
||||
columnFilterModeOptions: [
|
||||
"equals",
|
||||
"notEquals",
|
||||
"contains",
|
||||
],
|
||||
Cell: ({renderedCellValue}) => (
|
||||
<Typography variant="body2">{renderedCellValue}</Typography>
|
||||
),
|
||||
},
|
||||
{
|
||||
accessorFn: (row) => row.birthday,
|
||||
id: "birthday",
|
||||
header: t("LoanFollowUp.birthday"),
|
||||
enableColumnFilter: true,
|
||||
datatype: "text",
|
||||
filterFn: "contains",
|
||||
columnFilterModeOptions: ["contains", "equals", "notEquals"],
|
||||
Cell: ({renderedCellValue}) => (
|
||||
<Typography
|
||||
variant="body2">{moment(renderedCellValue).locale("fa").format("yyyy/MM/DD")}</Typography>
|
||||
),
|
||||
},
|
||||
{
|
||||
accessorFn: (row) => row.approved_amount,
|
||||
id: "approved_amount",
|
||||
header: t("LoanFollowUp.approved_amount"),
|
||||
enableColumnFilter: true,
|
||||
datatype: "text",
|
||||
filterFn: "equals",
|
||||
columnFilterModeOptions: [
|
||||
"equals",
|
||||
"notEquals",
|
||||
"contains",
|
||||
],
|
||||
Cell: ({renderedCellValue}) => (
|
||||
<Typography variant="body2">{Number(renderedCellValue).toLocaleString()}</Typography>
|
||||
),
|
||||
},
|
||||
{
|
||||
accessorFn: (row) => row.branch_name,
|
||||
id: "branch_name",
|
||||
header: t("LoanFollowUp.branch_name"),
|
||||
enableColumnFilter: true,
|
||||
datatype: "text",
|
||||
filterFn: "contains",
|
||||
columnFilterModeOptions: ["contains", "equals", "notEquals"],
|
||||
Cell: ({renderedCellValue}) => (
|
||||
<Typography variant="body2">{renderedCellValue}</Typography>
|
||||
),
|
||||
},
|
||||
{
|
||||
accessorFn: (row) => row.province_name,
|
||||
id: "province_name",
|
||||
header: t("LoanFollowUp.province_name"),
|
||||
enableColumnFilter: true,
|
||||
datatype: "text",
|
||||
filterFn: "contains",
|
||||
columnFilterModeOptions: ["contains", "equals", "notEquals"],
|
||||
Cell: ({renderedCellValue}) => (
|
||||
<Typography variant="body2">{renderedCellValue}</Typography>
|
||||
),
|
||||
},
|
||||
{
|
||||
accessorFn: (row) => row.city_name,
|
||||
id: "city_name",
|
||||
header: t("LoanFollowUp.city_name"),
|
||||
enableColumnFilter: true,
|
||||
datatype: "text",
|
||||
filterFn: "contains",
|
||||
columnFilterModeOptions: ["contains", "equals", "notEquals"],
|
||||
Cell: ({renderedCellValue}) => (
|
||||
<Typography variant="body2">{renderedCellValue}</Typography>
|
||||
),
|
||||
},
|
||||
{
|
||||
accessorFn: (row) =>
|
||||
moment(row.created_at).locale("fa").format("HH:mm | yyyy/MM/DD"),
|
||||
id: "created_at",
|
||||
header: t("LoanFollowUp.created_at"),
|
||||
enableColumnFilter: true,
|
||||
datatype: "date",
|
||||
filterFn: "lessThan",
|
||||
columnFilterModeOptions: ["lessThan", "greaterThan"],
|
||||
Cell: ({renderedCellValue}) => {
|
||||
return <Typography variant="body2">{renderedCellValue}</Typography>;
|
||||
},
|
||||
Header: ({column}) => <>{column.columnDef.header}</>,
|
||||
Filter: ({column}) => {
|
||||
return (
|
||||
<MuiDatePicker column={column}/>
|
||||
);
|
||||
},
|
||||
},
|
||||
{
|
||||
accessorFn: (row) => row.phone_number,
|
||||
id: "phone_number",
|
||||
header: t("LoanFollowUp.phone_number"),
|
||||
enableColumnFilter: true,
|
||||
datatype: "numeric",
|
||||
filterFn: "equals",
|
||||
columnFilterModeOptions: [
|
||||
"equals",
|
||||
"notEquals",
|
||||
"contains",
|
||||
"lessThan",
|
||||
"greaterThan",
|
||||
"between",
|
||||
],
|
||||
Cell: ({renderedCellValue}) => (
|
||||
<Typography variant="body2">{renderedCellValue}</Typography>
|
||||
),
|
||||
},
|
||||
{
|
||||
accessorFn: (row) => row.state_name,
|
||||
id: "state_id",
|
||||
header: t("LoanFollowUp.state_name"),
|
||||
enableColumnFilter: false,
|
||||
datatype: "numeric",
|
||||
Cell: ({renderedCellValue}) => (
|
||||
<Typography variant="body2">{renderedCellValue}</Typography>
|
||||
),
|
||||
},
|
||||
],
|
||||
[]
|
||||
);
|
||||
return (
|
||||
<Box sx={{px: 3}}>
|
||||
<DataTable
|
||||
tableUrl={GET_LOAN_FOLLOWUP}
|
||||
columns={columns}
|
||||
selectableRow={false}
|
||||
enableCustomToolbar={true}
|
||||
CustomToolbar={TableToolbar}
|
||||
enableLastUpdate={true}
|
||||
enablePinning={true}
|
||||
enableDensityToggle={false}
|
||||
initialState={{density: 'compact'}} //compact (small) //comfortable (medium) //spacious (large)
|
||||
enableColumnFilters={true}
|
||||
enableHiding={true}
|
||||
enableFullScreenToggle={false}
|
||||
enableGlobalFilter={false}
|
||||
enableColumnResizing={false} // if you want true this you shold change renderRowActions props ** see https://www.material-react-table.com/docs/guides/row-actions
|
||||
enableRowActions={true}
|
||||
TableRowAction={TableRowActions}
|
||||
/>
|
||||
</Box>
|
||||
);
|
||||
}
|
||||
export default DashboardLoanFollowUpComponent
|
||||
@@ -15,7 +15,7 @@ const vehicle_amount = {
|
||||
"مینی بوس": 2000,
|
||||
};
|
||||
|
||||
const ConfirmContent = ({ rowId, mutate, setOpenConfirmDialog, vehicle_type }) => {
|
||||
const ConfirmContent = ({ rowId, mutate, setOpenConfirmDialog, vehicle_type, row }) => {
|
||||
const t = useTranslations();
|
||||
const [expertImg, setExpertImg] = useState("");
|
||||
const [expertFileType, setExpertFileType] = useState(null);
|
||||
@@ -69,17 +69,17 @@ const ConfirmContent = ({ rowId, mutate, setOpenConfirmDialog, vehicle_type }) =
|
||||
|
||||
const formik = useFormik({
|
||||
initialValues: {
|
||||
description: "",
|
||||
approved_amount: "",
|
||||
facility_bank: "",
|
||||
facility_gov: "",
|
||||
facility_person: "",
|
||||
physical_progress: "",
|
||||
repayment_period: "",
|
||||
committed_employment: "",
|
||||
sakht_period: "",
|
||||
tanafos_period: "",
|
||||
existing_employment: "",
|
||||
description: row.original.description || "",
|
||||
approved_amount: row.original.approved_amount / 1000000 || "",
|
||||
facility_bank: row.original.facility_bank / 1000000 || "",
|
||||
facility_gov: row.original.facility_gov / 1000000 || "",
|
||||
facility_person: row.original.facility_person / 1000000 || "",
|
||||
physical_progress: row.original.physical_progress || "",
|
||||
repayment_period: row.original.repayment_period || "",
|
||||
committed_employment: row.original.committed_employment || "",
|
||||
sakht_period: row.original.sakht_period || "",
|
||||
tanafos_period: row.original.tanafos_period || "",
|
||||
existing_employment: row.original.existing_employment || "",
|
||||
expert_img: null,
|
||||
},
|
||||
validationSchema,
|
||||
|
||||
@@ -4,7 +4,7 @@ import {useEffect, useState} from "react";
|
||||
import ConfirmContent from "./ConfirmContent";
|
||||
import CallMadeIcon from '@mui/icons-material/CallMade';
|
||||
|
||||
const Confirm = ({rowId, mutate, vehicle_type}) => {
|
||||
const Confirm = ({rowId, mutate, vehicle_type, row}) => {
|
||||
const t = useTranslations();
|
||||
const [openConfirmDialog, setOpenConfirmDialog] = useState(false);
|
||||
const [dialogSize, setDialogSize] = useState('sm');
|
||||
@@ -35,7 +35,7 @@ const Confirm = ({rowId, mutate, vehicle_type}) => {
|
||||
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'}}} maxWidth={dialogSize}>
|
||||
<DialogTitle>{t("PassengerBoss.confirm")}</DialogTitle>
|
||||
<ConfirmContent mutate={mutate} rowId={rowId} setOpenConfirmDialog={setOpenConfirmDialog} handleSizeChangeClick={handleSizeChangeClick}
|
||||
vehicle_type={vehicle_type}/>
|
||||
vehicle_type={vehicle_type} row={row}/>
|
||||
</Dialog>
|
||||
</>
|
||||
)
|
||||
|
||||
@@ -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
|
||||
@@ -0,0 +1,80 @@
|
||||
import useNotification from "@/lib/app/hooks/useNotification";
|
||||
import useRequest from "@/lib/app/hooks/useRequest";
|
||||
import {Button, DialogActions, DialogContent, Stack, TextField} from "@mui/material"
|
||||
import {useFormik} from "formik";
|
||||
import {useTranslations} from "next-intl";
|
||||
import * as Yup from "yup";
|
||||
import {REFER_LOAN_FOLLOWUP_USER} from "@/core/data/apiRoutes";
|
||||
|
||||
const ReferUserContent = ({rowId, mutate, setOpenReferDialog}) => {
|
||||
const t = useTranslations();
|
||||
const requestServer = useRequest({auth: true})
|
||||
const {update_notification} = useNotification()
|
||||
|
||||
const validationSchema = Yup.object().shape({
|
||||
description: Yup.string().required(t("ReferDialog.description_error")),
|
||||
});
|
||||
|
||||
const formik = useFormik({
|
||||
initialValues: {
|
||||
description: "",
|
||||
},
|
||||
validationSchema,
|
||||
onSubmit: (values, {setSubmitting}) => {
|
||||
const formData = new FormData();
|
||||
formData.append("expert_description", values.description);
|
||||
requestServer(`${REFER_LOAN_FOLLOWUP_USER}/${rowId}`, 'post', {
|
||||
data: formData,
|
||||
}).then((response) => {
|
||||
setOpenReferDialog(false)
|
||||
mutate()
|
||||
update_notification()
|
||||
}).catch(() => {
|
||||
}).finally(() => {
|
||||
setSubmitting(false);
|
||||
});
|
||||
},
|
||||
});
|
||||
|
||||
// const handleDescriptionChange = (event) => {
|
||||
// formik.setFieldValue("description", event.target.value);
|
||||
// formik.handleChange(event);
|
||||
// };
|
||||
return (
|
||||
<>
|
||||
<DialogContent>
|
||||
<Stack spacing={2}>
|
||||
<Stack>
|
||||
<TextField
|
||||
name="description"
|
||||
multiline
|
||||
rows={8}
|
||||
label={t("ReferDialog.description")}
|
||||
value={formik.values.description}
|
||||
onChange={formik.handleChange}
|
||||
onBlur={formik.handleBlur("description")}
|
||||
error={
|
||||
formik.touched.description && Boolean(formik.errors.description)
|
||||
}
|
||||
helperText={formik.touched.description && formik.errors.description}
|
||||
fullWidth
|
||||
variant="outlined"
|
||||
sx={{mt: 1}}
|
||||
/>
|
||||
</Stack>
|
||||
</Stack>
|
||||
</DialogContent>
|
||||
<DialogActions>
|
||||
<Button onClick={() => setOpenReferDialog(false)} variant="outlined" color="secondary"
|
||||
disabled={formik.isSubmitting} autoFocus>
|
||||
{t("ReferDialog.button-cancel")}
|
||||
</Button>
|
||||
<Button onClick={formik.handleSubmit} variant="contained" color="primary"
|
||||
disabled={formik.isSubmitting || !formik.dirty || !formik.isValid}>
|
||||
{t("ReferDialog.button-refer")}
|
||||
</Button>
|
||||
</DialogActions>
|
||||
</>
|
||||
)
|
||||
}
|
||||
export default ReferUserContent
|
||||
@@ -0,0 +1,24 @@
|
||||
import {Dialog,DialogTitle, IconButton, Tooltip} from "@mui/material"
|
||||
import {useTranslations} from "next-intl";
|
||||
import {useState} from "react";
|
||||
import ContactMailIcon from '@mui/icons-material/ContactMail';
|
||||
import ReferUserContent from "@/components/dashboard/passenger-boss/Form/ReferUser/ReferUserContent";
|
||||
const ReferUser = ({rowId, mutate}) => {
|
||||
const t = useTranslations();
|
||||
const [openReferDialog, setOpenReferDialog] = useState(false);
|
||||
return (
|
||||
<>
|
||||
<Tooltip title={t("ReferDialog.refer-user")}>
|
||||
<IconButton color="primary" onClick={() => setOpenReferDialog(true)}>
|
||||
<ContactMailIcon/>
|
||||
</IconButton>
|
||||
</Tooltip>
|
||||
<Dialog fullWidth open={openReferDialog}
|
||||
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("ReferDialog.refer-user")}</DialogTitle>
|
||||
<ReferUserContent mutate={mutate} rowId={rowId} setOpenReferDialog={setOpenReferDialog} />
|
||||
</Dialog>
|
||||
</>
|
||||
)
|
||||
}
|
||||
export default ReferUser
|
||||
@@ -2,15 +2,22 @@ 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";
|
||||
import ReferUser from "@/components/dashboard/passenger-boss/Form/ReferUser";
|
||||
|
||||
const TableRow = ({row, mutate}) => {
|
||||
|
||||
return (
|
||||
<Box sx={{display: "flex", flexWrap: "nowrap", gap: "8px"}}>
|
||||
{row.original.latest_history?.action === "refer" ? <ReferReason row={row}/> : null}
|
||||
<ReferUser
|
||||
rowId={row.getValue("id")}
|
||||
mutate={mutate}
|
||||
/>
|
||||
<Confirm
|
||||
rowId={row.getValue("id")}
|
||||
vehicle_type={row.original.vehicle_type}
|
||||
mutate={mutate}
|
||||
row={row}
|
||||
/>
|
||||
<ReserveForm
|
||||
rowId={row.getValue("id")}
|
||||
|
||||
@@ -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",
|
||||
|
||||
@@ -31,7 +31,8 @@ export const EXPORT_PASSENGER_OFFICE =
|
||||
//passenger boss
|
||||
export const GET_PASSENGER_BOSS =
|
||||
BASE_URL + "/dashboard/province_working_group/show";
|
||||
|
||||
export const REFER_LOAN_FOLLOWUP_USER =
|
||||
BASE_URL + "/dashboard/province_working_group/refer_to_user";
|
||||
export const CONFIRM_PASSENGER_BOSS =
|
||||
BASE_URL + "/dashboard/province_working_group/confirm";
|
||||
|
||||
@@ -45,6 +46,12 @@ export const EXPORT_PASSENGER_BOSS_DETAILS =
|
||||
BASE_URL + "/dashboard/province_working_group";
|
||||
//passenger boss
|
||||
|
||||
//loan follow up
|
||||
export const GET_LOAN_FOLLOWUP =
|
||||
BASE_URL + "/dashboard/vezarat_loan_tracking/";
|
||||
export const REFER_LOAN_FOLLOWUP_PASSENGERBOSS =
|
||||
BASE_URL + "/dashboard/vezarat_loan_tracking/refer";
|
||||
|
||||
//transportation assistance
|
||||
export const GET_TRANSPORTATION_ASSISTANCE =
|
||||
BASE_URL + "/dashboard/transportation_assistant/show";
|
||||
|
||||
@@ -16,6 +16,7 @@ import SecurityIcon from '@mui/icons-material/Security';
|
||||
import SettingsIcon from '@mui/icons-material/Settings';
|
||||
import RepartitionIcon from '@mui/icons-material/Repartition';
|
||||
import AccountBalanceIcon from '@mui/icons-material/AccountBalance';
|
||||
import RepeatIcon from '@mui/icons-material/Repeat';
|
||||
|
||||
const sidebarMenu = [
|
||||
[
|
||||
@@ -45,6 +46,15 @@ const sidebarMenu = [
|
||||
selected: false,
|
||||
permissions: ["view_navgan_loans", "view_navgan_loans_province"],
|
||||
},
|
||||
{
|
||||
key: "sidebar.loan-followup",
|
||||
name: "loan-followup",
|
||||
type: "page",
|
||||
route: "/dashboard/loan-followup",
|
||||
icon: <RepeatIcon sx={{width: 'inherit', height: 'inherit'}}/>,
|
||||
selected: false,
|
||||
permissions: ["manage_vezarat_eghtesad_loans"], //permission should change
|
||||
},
|
||||
], [
|
||||
{
|
||||
key: "sidebar.reserve-loan",
|
||||
|
||||
21
src/pages/dashboard/loan-followup/index.jsx
Normal file
21
src/pages/dashboard/loan-followup/index.jsx
Normal file
@@ -0,0 +1,21 @@
|
||||
import {parse} from "next-useragent";
|
||||
import DashboardLoanFollowUpComponent from "@/components/dashboard/loan-followup";
|
||||
|
||||
export default function LoanFollowUp() {
|
||||
return (
|
||||
<DashboardLoanFollowUpComponent/>
|
||||
);
|
||||
}
|
||||
|
||||
export async function getServerSideProps({req, locale}) {
|
||||
const {isBot} = parse(req.headers["user-agent"]);
|
||||
return {
|
||||
props: {
|
||||
messages: (await import(`&/locales/${locale}/app.json`)).default,
|
||||
title: "Dashboard.loan_followup",
|
||||
isBot,
|
||||
locale,
|
||||
layout: {name: 'DashboardLayout', props: {permissions: ["manage_vezarat_eghtesad_loans"]}} //permission should change
|
||||
},
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user