diff --git a/.env.local.example b/.env.local.example index f1cc040..17a1cef 100644 --- a/.env.local.example +++ b/.env.local.example @@ -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" diff --git a/public/locales/fa/app.json b/public/locales/fa/app.json index 91fa8ce..b5e7acc 100644 --- a/public/locales/fa/app.json +++ b/public/locales/fa/app.json @@ -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": "سابقه ای برای این وام وجود ندارد" } diff --git a/src/components/dashboard/loan-followup/Form/ReferPassengerBoss/ReferPassengerBossContent.jsx b/src/components/dashboard/loan-followup/Form/ReferPassengerBoss/ReferPassengerBossContent.jsx new file mode 100644 index 0000000..0815670 --- /dev/null +++ b/src/components/dashboard/loan-followup/Form/ReferPassengerBoss/ReferPassengerBossContent.jsx @@ -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 ( + <> + + + + + + + + + + + + + ) +} +export default ReferPassengerBossContent \ No newline at end of file diff --git a/src/components/dashboard/loan-followup/Form/ReferPassengerBoss/index.jsx b/src/components/dashboard/loan-followup/Form/ReferPassengerBoss/index.jsx new file mode 100644 index 0000000..54a98e1 --- /dev/null +++ b/src/components/dashboard/loan-followup/Form/ReferPassengerBoss/index.jsx @@ -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 ( + <> + + setOpenReferDialog(true)}> + + + + + {t("ReferDialog.refer-passenger-boss")} + + + + ) +} +export default ReferPassengerBoss \ No newline at end of file diff --git a/src/components/dashboard/loan-followup/TableRowActions.jsx b/src/components/dashboard/loan-followup/TableRowActions.jsx new file mode 100644 index 0000000..cf6355b --- /dev/null +++ b/src/components/dashboard/loan-followup/TableRowActions.jsx @@ -0,0 +1,14 @@ +import {Box} from "@mui/material"; +import ReferPassengerBoss from "@/components/dashboard/loan-followup/Form/ReferPassengerBoss"; + +const TableRow = ({row, mutate}) => { + return ( + + + + ); +}; +export default TableRow; \ No newline at end of file diff --git a/src/components/dashboard/loan-followup/TableToolbar.jsx b/src/components/dashboard/loan-followup/TableToolbar.jsx new file mode 100644 index 0000000..0eea2f8 --- /dev/null +++ b/src/components/dashboard/loan-followup/TableToolbar.jsx @@ -0,0 +1,10 @@ +import {Stack} from "@mui/material"; + +const TableToolbar = ({table}) => { + return ( + + + ) +} + +export default TableToolbar \ No newline at end of file diff --git a/src/components/dashboard/loan-followup/index.jsx b/src/components/dashboard/loan-followup/index.jsx new file mode 100644 index 0000000..7455874 --- /dev/null +++ b/src/components/dashboard/loan-followup/index.jsx @@ -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}) => ( + {renderedCellValue} + ), + }, + { + 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}) => ( + {renderedCellValue} + ), + }, + { + accessorFn: (row) => row.name, + id: "name", + header: t("LoanFollowUp.name"), + enableColumnFilter: true, + datatype: "text", + filterFn: "contains", + columnFilterModeOptions: ["contains", "equals", "notEquals"], + Cell: ({renderedCellValue}) => ( + {renderedCellValue} + ), + }, + { + 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}) => ( + {renderedCellValue} + ), + }, + { + 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}) => ( + {renderedCellValue} + ), + }, + { + 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}) => ( + {renderedCellValue} + ), + }, + { + 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}) => ( + {renderedCellValue} + ), + }, + { + accessorFn: (row) => row.birthday, + id: "birthday", + header: t("LoanFollowUp.birthday"), + enableColumnFilter: true, + datatype: "text", + filterFn: "contains", + columnFilterModeOptions: ["contains", "equals", "notEquals"], + Cell: ({renderedCellValue}) => ( + {moment(renderedCellValue).locale("fa").format("yyyy/MM/DD")} + ), + }, + { + 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}) => ( + {Number(renderedCellValue).toLocaleString()} + ), + }, + { + 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}) => ( + {renderedCellValue} + ), + }, + { + 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}) => ( + {renderedCellValue} + ), + }, + { + 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}) => ( + {renderedCellValue} + ), + }, + { + 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 {renderedCellValue}; + }, + Header: ({column}) => <>{column.columnDef.header}, + Filter: ({column}) => { + return ( + + ); + }, + }, + { + 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}) => ( + {renderedCellValue} + ), + }, + { + accessorFn: (row) => row.state_name, + id: "state_id", + header: t("LoanFollowUp.state_name"), + enableColumnFilter: false, + datatype: "numeric", + Cell: ({renderedCellValue}) => ( + {renderedCellValue} + ), + }, + ], + [] + ); + return ( + + + + ); +} +export default DashboardLoanFollowUpComponent \ No newline at end of file diff --git a/src/components/dashboard/passenger-boss/Form/ConfirmForm/ConfirmContent.jsx b/src/components/dashboard/passenger-boss/Form/ConfirmForm/ConfirmContent.jsx index 50976f5..79ccc03 100644 --- a/src/components/dashboard/passenger-boss/Form/ConfirmForm/ConfirmContent.jsx +++ b/src/components/dashboard/passenger-boss/Form/ConfirmForm/ConfirmContent.jsx @@ -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, diff --git a/src/components/dashboard/passenger-boss/Form/ConfirmForm/index.jsx b/src/components/dashboard/passenger-boss/Form/ConfirmForm/index.jsx index 055ea70..104922c 100644 --- a/src/components/dashboard/passenger-boss/Form/ConfirmForm/index.jsx +++ b/src/components/dashboard/passenger-boss/Form/ConfirmForm/index.jsx @@ -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}> {t("PassengerBoss.confirm")} + vehicle_type={vehicle_type} row={row}/> ) diff --git a/src/components/dashboard/passenger-boss/Form/ReferReason/HistoryContent.jsx b/src/components/dashboard/passenger-boss/Form/ReferReason/HistoryContent.jsx new file mode 100644 index 0000000..4628461 --- /dev/null +++ b/src/components/dashboard/passenger-boss/Form/ReferReason/HistoryContent.jsx @@ -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 ( + <> + + + + + + + + ) +} +export default HistoryContent \ No newline at end of file diff --git a/src/components/dashboard/passenger-boss/Form/ReferReason/TableContent.jsx b/src/components/dashboard/passenger-boss/Form/ReferReason/TableContent.jsx new file mode 100644 index 0000000..9dbcf5d --- /dev/null +++ b/src/components/dashboard/passenger-boss/Form/ReferReason/TableContent.jsx @@ -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 ( + + + + + {t("LoanHistory.Table_head_date")} + {t("LoanHistory.Table_head_state")} + {t("LoanHistory.Table_head_refer_reason")} + + + + + {moment(row.original.latest_history.created_at).locale("fa").format("HH:mm | yyyy/MM/DD")} + {row.original.latest_history.previous_state_name} + {row.original.latest_history.expert_description} + + +
+
+
+ + ) +} +export default TableContent \ No newline at end of file diff --git a/src/components/dashboard/passenger-boss/Form/ReferReason/index.jsx b/src/components/dashboard/passenger-boss/Form/ReferReason/index.jsx new file mode 100644 index 0000000..40f48e1 --- /dev/null +++ b/src/components/dashboard/passenger-boss/Form/ReferReason/index.jsx @@ -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 ( + <> + + setOpenReferReasonDialog(true)}> + + + + + {t("ReferReasonDialog.refer_reason")} + + + + ) +} +export default ReferReason \ No newline at end of file diff --git a/src/components/dashboard/passenger-boss/Form/ReferUser/ReferUserContent.jsx b/src/components/dashboard/passenger-boss/Form/ReferUser/ReferUserContent.jsx new file mode 100644 index 0000000..f55c4b2 --- /dev/null +++ b/src/components/dashboard/passenger-boss/Form/ReferUser/ReferUserContent.jsx @@ -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 ( + <> + + + + + + + + + + + + + ) +} +export default ReferUserContent \ No newline at end of file diff --git a/src/components/dashboard/passenger-boss/Form/ReferUser/index.jsx b/src/components/dashboard/passenger-boss/Form/ReferUser/index.jsx new file mode 100644 index 0000000..243140d --- /dev/null +++ b/src/components/dashboard/passenger-boss/Form/ReferUser/index.jsx @@ -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 ( + <> + + setOpenReferDialog(true)}> + + + + + {t("ReferDialog.refer-user")} + + + + ) +} +export default ReferUser \ No newline at end of file diff --git a/src/components/dashboard/passenger-boss/TableRowActions.jsx b/src/components/dashboard/passenger-boss/TableRowActions.jsx index 6a8b915..cac1ec1 100644 --- a/src/components/dashboard/passenger-boss/TableRowActions.jsx +++ b/src/components/dashboard/passenger-boss/TableRowActions.jsx @@ -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 ( + {row.original.latest_history?.action === "refer" ? : null} + ), }, - { - 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 ( - - {latestHistory && latestHistory.action === 'refer' ? latestHistory.expert_description : null} - - ); - }, - }, { accessorFn: (row) => row.state_name, id: "state_id", diff --git a/src/components/dashboard/transportation-assistance/Form/ReferReason/HistoryContent.jsx b/src/components/dashboard/transportation-assistance/Form/ReferReason/HistoryContent.jsx new file mode 100644 index 0000000..4628461 --- /dev/null +++ b/src/components/dashboard/transportation-assistance/Form/ReferReason/HistoryContent.jsx @@ -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 ( + <> + + + + + + + + ) +} +export default HistoryContent \ No newline at end of file diff --git a/src/components/dashboard/transportation-assistance/Form/ReferReason/TableContent.jsx b/src/components/dashboard/transportation-assistance/Form/ReferReason/TableContent.jsx new file mode 100644 index 0000000..9dbcf5d --- /dev/null +++ b/src/components/dashboard/transportation-assistance/Form/ReferReason/TableContent.jsx @@ -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 ( + + + + + {t("LoanHistory.Table_head_date")} + {t("LoanHistory.Table_head_state")} + {t("LoanHistory.Table_head_refer_reason")} + + + + + {moment(row.original.latest_history.created_at).locale("fa").format("HH:mm | yyyy/MM/DD")} + {row.original.latest_history.previous_state_name} + {row.original.latest_history.expert_description} + + +
+
+
+ + ) +} +export default TableContent \ No newline at end of file diff --git a/src/components/dashboard/transportation-assistance/Form/ReferReason/index.jsx b/src/components/dashboard/transportation-assistance/Form/ReferReason/index.jsx new file mode 100644 index 0000000..40f48e1 --- /dev/null +++ b/src/components/dashboard/transportation-assistance/Form/ReferReason/index.jsx @@ -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 ( + <> + + setOpenReferReasonDialog(true)}> + + + + + {t("ReferReasonDialog.refer_reason")} + + + + ) +} +export default ReferReason \ No newline at end of file diff --git a/src/components/dashboard/transportation-assistance/TableRowActions.jsx b/src/components/dashboard/transportation-assistance/TableRowActions.jsx index 22e3ebd..70cef2c 100644 --- a/src/components/dashboard/transportation-assistance/TableRowActions.jsx +++ b/src/components/dashboard/transportation-assistance/TableRowActions.jsx @@ -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 ( + {row.original.latest_history?.action === "refer" ? : null} {renderedCellValue} ), }, - { - 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 ( - - {latestHistory && latestHistory.action === 'refer' ? latestHistory.expert_description : null} - - ); - }, - }, { accessorFn: (row) => row.state_name, id: "state_id", diff --git a/src/core/data/apiRoutes.js b/src/core/data/apiRoutes.js index 841d6f4..bbd34ed 100644 --- a/src/core/data/apiRoutes.js +++ b/src/core/data/apiRoutes.js @@ -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"; diff --git a/src/core/data/sidebarMenu.jsx b/src/core/data/sidebarMenu.jsx index 646a82e..410393d 100644 --- a/src/core/data/sidebarMenu.jsx +++ b/src/core/data/sidebarMenu.jsx @@ -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: , + selected: false, + permissions: ["manage_vezarat_eghtesad_loans"], //permission should change + }, ], [ { key: "sidebar.reserve-loan", diff --git a/src/pages/dashboard/loan-followup/index.jsx b/src/pages/dashboard/loan-followup/index.jsx new file mode 100644 index 0000000..7494676 --- /dev/null +++ b/src/pages/dashboard/loan-followup/index.jsx @@ -0,0 +1,21 @@ +import {parse} from "next-useragent"; +import DashboardLoanFollowUpComponent from "@/components/dashboard/loan-followup"; + +export default function LoanFollowUp() { + return ( + + ); +} + +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 + }, + }; +}