Merge branch 'release/v2.4.1'
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
NEXT_PUBLIC_API_NAME = "Loan Facilities Dashboard"
|
||||
NEXT_PUBLIC_API_VERSION = "2.3.0"
|
||||
NEXT_PUBLIC_API_VERSION = "2.4.1"
|
||||
NEXT_PUBLIC_DEFAULT_LANGUAGE = "fa"
|
||||
NEXT_PUBLIC_DEFAULT_DIRECTION = "rtl"
|
||||
|
||||
|
||||
@@ -843,6 +843,7 @@
|
||||
"Table_head_position": "سمت",
|
||||
"Table_head_action": "عملیات",
|
||||
"Table_head_file": "فایل پیوست",
|
||||
"Table_head_state": "وضعیت",
|
||||
"Table_head_expert_description": "توضیحات",
|
||||
"empty_history_detail": "سابقه ای برای این وام وجود ندارد"
|
||||
}
|
||||
|
||||
@@ -17,6 +17,12 @@ import PrintHistory from "@/components/dashboard/loan-history/Form/HistoryForm/P
|
||||
import useRequest from "@/lib/app/hooks/useRequest";
|
||||
import {useEffect, useState} from "react";
|
||||
|
||||
const action_name = {
|
||||
"confirm" : "تایید",
|
||||
"reject":"عدم تایید",
|
||||
"refer":"ارجاع"
|
||||
}
|
||||
|
||||
const TableContent = ({rowId}) => {
|
||||
const t = useTranslations();
|
||||
const requestServer = useRequest({auth: true, notification: false})
|
||||
@@ -55,50 +61,28 @@ const TableContent = ({rowId}) => {
|
||||
<TableCell>{t("LoanHistory.Table_head_name")}</TableCell>
|
||||
<TableCell>{t("LoanHistory.Table_head_date")}</TableCell>
|
||||
<TableCell>{t("LoanHistory.Table_head_position")}</TableCell>
|
||||
<TableCell>{t("LoanHistory.Table_head_state")}</TableCell>
|
||||
<TableCell>{t("LoanHistory.Table_head_action")}</TableCell>
|
||||
<TableCell>{t("LoanHistory.Table_head_expert_description")}</TableCell>
|
||||
<TableCell>{t("LoanHistory.Table_head_file")}</TableCell>
|
||||
</TableRow>
|
||||
</TableHead>
|
||||
<TableBody>
|
||||
<TableRow
|
||||
sx={{
|
||||
'&:last-child td, &:last-child th': {border: 0}
|
||||
}}
|
||||
>
|
||||
<TableCell>
|
||||
{historyDetails.latest_histories[0].expert.name}
|
||||
</TableCell>
|
||||
<TableCell>{moment(historyDetails.latest_histories[0].created_at).locale("fa").format("HH:mm | yyyy/MM/DD")}</TableCell>
|
||||
<TableCell>{historyDetails.latest_histories[0].expert.position}</TableCell>
|
||||
<TableCell>{historyDetails.state_name}</TableCell>
|
||||
<TableCell>{historyDetails.latest_histories[0].expert_description}</TableCell>
|
||||
<TableCell>
|
||||
{historyDetails.latest_histories[0].attachments.map((attachment, index) =>
|
||||
<PrintHistory
|
||||
key={index}
|
||||
attachment={attachment}/>)}
|
||||
</TableCell>
|
||||
</TableRow>
|
||||
{historyDetails.latest_histories.map((latest_history, index) => {
|
||||
const _name = historyDetails.latest_histories.length > (index + 1) ? historyDetails.latest_histories[index + 1].expert.name : '-'
|
||||
const _created_at = historyDetails.latest_histories.length > (index + 1) ? moment(historyDetails.latest_histories[index + 1].created_at).locale("fa").format("HH:mm | yyyy/MM/DD") : '-'
|
||||
const _position = historyDetails.latest_histories.length > (index + 1) ? historyDetails.latest_histories[index + 1].expert.position : '-'
|
||||
const _expert_description = historyDetails.latest_histories.length > (index + 1) ? historyDetails.latest_histories[index + 1].expert_description : '-'
|
||||
const _attachments = historyDetails.latest_histories.length > (index + 1) ? historyDetails.latest_histories[index + 1].attachments : []
|
||||
return (<TableRow
|
||||
key={index}
|
||||
sx={{
|
||||
'&:last-child td, &:last-child th': {border: 0}
|
||||
}}
|
||||
>
|
||||
<TableCell> {_name}</TableCell>
|
||||
<TableCell>{_created_at}</TableCell>
|
||||
<TableCell>{_position}</TableCell>
|
||||
<TableCell> {latest_history.expert.name}</TableCell>
|
||||
<TableCell>{moment(latest_history.created_at).locale("fa").format("HH:mm | yyyy/MM/DD")}</TableCell>
|
||||
<TableCell>{latest_history.expert.position}</TableCell>
|
||||
<TableCell>{latest_history.previous_state_name}</TableCell>
|
||||
<TableCell>{_expert_description}</TableCell>
|
||||
<TableCell>{action_name[latest_history.action]}</TableCell>
|
||||
<TableCell>{latest_history.expert_description}</TableCell>
|
||||
<TableCell>
|
||||
{_attachments.map((attachment, index) => <PrintHistory key={index}
|
||||
{latest_history.attachments.map((attachment, index) => <PrintHistory key={index}
|
||||
attachment={attachment}/>)}
|
||||
</TableCell>
|
||||
</TableRow>)
|
||||
|
||||
@@ -31,25 +31,6 @@ function DashboardLoanHistoryComponent() {
|
||||
<Typography variant="body2">{renderedCellValue}</Typography>
|
||||
),
|
||||
},
|
||||
{
|
||||
accessorFn: (row) => row.score,
|
||||
id: "score",
|
||||
header: t("LoanHistory.score"),
|
||||
enableColumnFilter: true,
|
||||
datatype: "numeric",
|
||||
filterFn: "equals",
|
||||
columnFilterModeOptions: [
|
||||
"equals",
|
||||
"notEquals",
|
||||
"contains",
|
||||
"lessThan",
|
||||
"greaterThan",
|
||||
"between",
|
||||
],
|
||||
Cell: ({renderedCellValue}) => (
|
||||
<Typography variant="body2">{renderedCellValue}</Typography>
|
||||
),
|
||||
},
|
||||
{
|
||||
accessorFn: (row) => row.is_legal_person,
|
||||
id: "is_legal_person",
|
||||
@@ -509,7 +490,7 @@ function DashboardLoanHistoryComponent() {
|
||||
CustomToolbar={TableToolbar}
|
||||
enableLastUpdate={true}
|
||||
sorting={[{
|
||||
id: 'score', desc: false
|
||||
id: 'statement_count', desc: true
|
||||
}]}
|
||||
enablePinning={true}
|
||||
enableDensityToggle={false}
|
||||
|
||||
@@ -32,25 +32,6 @@ function DashboardNavganLoanManagementComponent() {
|
||||
<Typography variant="body2">{renderedCellValue}</Typography>
|
||||
),
|
||||
},
|
||||
{
|
||||
accessorFn: (row) => row.score,
|
||||
id: "score",
|
||||
header: t("NavganLoanManagement.score"),
|
||||
enableColumnFilter: true,
|
||||
datatype: "numeric",
|
||||
filterFn: "equals",
|
||||
columnFilterModeOptions: [
|
||||
"equals",
|
||||
"notEquals",
|
||||
"contains",
|
||||
"lessThan",
|
||||
"greaterThan",
|
||||
"between",
|
||||
],
|
||||
Cell: ({renderedCellValue}) => (
|
||||
<Typography variant="body2">{renderedCellValue}</Typography>
|
||||
),
|
||||
},
|
||||
{
|
||||
accessorFn: (row) => row.is_legal_person,
|
||||
id: "is_legal_person",
|
||||
@@ -495,7 +476,7 @@ function DashboardNavganLoanManagementComponent() {
|
||||
CustomToolbar={TableToolbar}
|
||||
enableLastUpdate={true}
|
||||
sorting={[{
|
||||
id: 'score', desc: false
|
||||
id: 'statement_count', desc: true
|
||||
}]}
|
||||
enablePinning={true}
|
||||
enableDensityToggle={false}
|
||||
|
||||
@@ -53,14 +53,20 @@ const ConfirmContent = ({rowId, mutate, setOpenConfirmDialog, handleSizeChangeCl
|
||||
useEffect(() => {
|
||||
requestServer(`${CONFIRM_PROVINCE_MANAGER_DETAILS}/${rowId}`, 'get')
|
||||
.then((response) => {
|
||||
const allAttachments = [];
|
||||
response.data.data.histories.map((history) => {
|
||||
history.attachments.map((attachment) => {
|
||||
allAttachments.push(attachment);
|
||||
});
|
||||
});
|
||||
setAttachmentsData(allAttachments);
|
||||
setDetailsData(response.data);
|
||||
if (response.data.data.latest_histories.length !== 0) {
|
||||
let latest_attachments = []
|
||||
let attachments = []
|
||||
response.data.data.latest_histories.map((allAttachment) => {
|
||||
if (allAttachment.previous_state_id === 4 || allAttachment.previous_state_id === 5) {
|
||||
if (!latest_attachments.includes(allAttachment.previous_state_id)) {
|
||||
attachments = [...attachments, ...allAttachment.attachments]
|
||||
latest_attachments.push(allAttachment.previous_state_id)
|
||||
}
|
||||
}
|
||||
setDetailsData(response.data);
|
||||
setAttachmentsData(attachments);
|
||||
})
|
||||
}
|
||||
})
|
||||
.catch(() => {
|
||||
}).finally(() => {
|
||||
|
||||
@@ -4,6 +4,7 @@ import {Button, DialogActions, DialogContent, Stack, TextField} from "@mui/mater
|
||||
import {useFormik} from "formik";
|
||||
import {useTranslations} from "next-intl";
|
||||
import * as Yup from "yup";
|
||||
import {REFER_NAVGAN_PROVINCE_MANAGER} from "@/core/data/apiRoutes";
|
||||
|
||||
const RevertContent = ({rowId, mutate, setOpenRevertDialog}) => {
|
||||
const t = useTranslations();
|
||||
@@ -20,7 +21,7 @@ const RevertContent = ({rowId, mutate, setOpenRevertDialog}) => {
|
||||
},
|
||||
validationSchema,
|
||||
onSubmit: (values, {setSubmitting}) => {
|
||||
requestServer(`${REJECT_TRANSPORTATION_ASSISTANCE}/${rowId}`, 'post', {
|
||||
requestServer(`${REFER_NAVGAN_PROVINCE_MANAGER}/${rowId}`, 'post', {
|
||||
data: {
|
||||
expert_description: values.description
|
||||
},
|
||||
@@ -69,7 +70,7 @@ const RevertContent = ({rowId, mutate, setOpenRevertDialog}) => {
|
||||
{t("RevertDialog.button-cancel")}
|
||||
</Button>
|
||||
<Button onClick={formik.handleSubmit} variant="contained" color="primary"
|
||||
disabled={formik.isSubmitting || !formik.dirty || !formik.isValid || true}>
|
||||
disabled={formik.isSubmitting || !formik.dirty || !formik.isValid}>
|
||||
{t("RevertDialog.button-revert")}
|
||||
</Button>
|
||||
</DialogActions>
|
||||
|
||||
@@ -436,7 +436,7 @@ function DashboardNavganProvinceManagerComponent() {
|
||||
CustomToolbar={TableToolbar}
|
||||
enableLastUpdate={true}
|
||||
sorting={[{
|
||||
id: 'id', desc: false
|
||||
id: 'statement_count', desc: true
|
||||
}]}
|
||||
enablePinning={true}
|
||||
enableDensityToggle={false}
|
||||
|
||||
@@ -32,25 +32,6 @@ function DashboardPassengerOfficeComponent() {
|
||||
<Typography variant="body2">{renderedCellValue}</Typography>
|
||||
),
|
||||
},
|
||||
{
|
||||
accessorFn: (row) => row.score,
|
||||
id: "score",
|
||||
header: t("PassengerBoss.score"),
|
||||
enableColumnFilter: true,
|
||||
datatype: "numeric",
|
||||
filterFn: "equals",
|
||||
columnFilterModeOptions: [
|
||||
"equals",
|
||||
"notEquals",
|
||||
"contains",
|
||||
"lessThan",
|
||||
"greaterThan",
|
||||
"between",
|
||||
],
|
||||
Cell: ({renderedCellValue}) => (
|
||||
<Typography variant="body2">{renderedCellValue}</Typography>
|
||||
),
|
||||
},
|
||||
{
|
||||
accessorFn: (row) => row.is_legal_person,
|
||||
id: "is_legal_person",
|
||||
@@ -290,16 +271,16 @@ function DashboardPassengerOfficeComponent() {
|
||||
),
|
||||
},
|
||||
{
|
||||
accessorFn: (row) => row.refer_reason,
|
||||
id: "refer_reason",
|
||||
accessorFn: (row) => row.latest_history.expert_description,
|
||||
id: "latest_history.expert_description",
|
||||
header: t("PassengerBoss.refer_reason"),
|
||||
enableColumnFilter: false,
|
||||
datatype: "text",
|
||||
filterFn: "contains",
|
||||
columnFilterModeOptions: ["contains", "equals", "notEquals"],
|
||||
Cell: ({renderedCellValue, row}) => {
|
||||
Cell: ({row}) => {
|
||||
return (
|
||||
<Typography variant="body2">{renderedCellValue}</Typography>
|
||||
<Typography variant="body2">{row.original.latest_history.action === 'refer'? row.original.latest_history.expert_description : null}</Typography>
|
||||
)
|
||||
},
|
||||
},
|
||||
@@ -326,7 +307,7 @@ function DashboardPassengerOfficeComponent() {
|
||||
CustomToolbar={TableToolbar}
|
||||
enableLastUpdate={true}
|
||||
sorting={[{
|
||||
id: 'score', desc: false
|
||||
id: 'statement_count', desc: true
|
||||
}]}
|
||||
enablePinning={true}
|
||||
enableDensityToggle={false}
|
||||
|
||||
@@ -31,25 +31,6 @@ function DashboardReserveLoan() {
|
||||
<Typography variant="body2">{renderedCellValue}</Typography>
|
||||
),
|
||||
},
|
||||
{
|
||||
accessorFn: (row) => row.score,
|
||||
id: "score",
|
||||
header: t("ReserveLoan.score"),
|
||||
enableColumnFilter: true,
|
||||
datatype: "numeric",
|
||||
filterFn: "equals",
|
||||
columnFilterModeOptions: [
|
||||
"equals",
|
||||
"notEquals",
|
||||
"contains",
|
||||
"lessThan",
|
||||
"greaterThan",
|
||||
"between",
|
||||
],
|
||||
Cell: ({renderedCellValue}) => (
|
||||
<Typography variant="body2">{renderedCellValue}</Typography>
|
||||
),
|
||||
},
|
||||
{
|
||||
accessorFn: (row) => row.is_legal_person,
|
||||
id: "is_legal_person",
|
||||
@@ -491,7 +472,7 @@ function DashboardReserveLoan() {
|
||||
CustomToolbar={TableToolbar}
|
||||
enableLastUpdate={true}
|
||||
sorting={[{
|
||||
id: 'score', desc: false
|
||||
id: 'statement_count', desc: true
|
||||
}]}
|
||||
enablePinning={true}
|
||||
enableDensityToggle={false}
|
||||
|
||||
@@ -44,14 +44,20 @@ const ConfirmContent = ({rowId, mutate, setOpenConfirmDialog, handleSizeChangeCl
|
||||
useEffect(() => {
|
||||
requestServer(`${GET_TRANSPORTATION_ASSISTANCE_DETAILS}/${rowId}`, 'get')
|
||||
.then((response) => {
|
||||
const allAttachments = [];
|
||||
response.data.data.histories.map((history) => {
|
||||
history.attachments.map((attachment) => {
|
||||
allAttachments.push(attachment);
|
||||
});
|
||||
});
|
||||
setDetailsData(response.data);
|
||||
setAttachmentsData(allAttachments);
|
||||
if (response.data.data.latest_histories.length !== 0) {
|
||||
let latest_attachments = []
|
||||
let attachments = []
|
||||
response.data.data.latest_histories.map((allAttachment) => {
|
||||
if (allAttachment.previous_state_id !== 4)
|
||||
return
|
||||
if (!latest_attachments.includes(allAttachment.previous_state_id)) {
|
||||
attachments = [...attachments, ...allAttachment.attachments]
|
||||
latest_attachments.push(allAttachment.previous_state_id)
|
||||
}
|
||||
})
|
||||
setDetailsData(response.data);
|
||||
setAttachmentsData(attachments);
|
||||
}
|
||||
})
|
||||
.catch(() => {
|
||||
}).finally(() => {
|
||||
|
||||
@@ -4,6 +4,7 @@ import {Button, DialogActions, DialogContent, Stack, TextField} from "@mui/mater
|
||||
import {useFormik} from "formik";
|
||||
import {useTranslations} from "next-intl";
|
||||
import * as Yup from "yup";
|
||||
import {REFER_TRANSPORTATION_ASSISTANCE} from "@/core/data/apiRoutes";
|
||||
|
||||
const RevertContent = ({rowId, mutate, setOpenRevertDialog}) => {
|
||||
const t = useTranslations();
|
||||
@@ -20,7 +21,7 @@ const RevertContent = ({rowId, mutate, setOpenRevertDialog}) => {
|
||||
},
|
||||
validationSchema,
|
||||
onSubmit: (values, {setSubmitting}) => {
|
||||
requestServer(`${REJECT_TRANSPORTATION_ASSISTANCE}/${rowId}`, 'post', {
|
||||
requestServer(`${REFER_TRANSPORTATION_ASSISTANCE}/${rowId}`, 'post', {
|
||||
data: {
|
||||
expert_description : values.description
|
||||
},
|
||||
@@ -69,7 +70,7 @@ const RevertContent = ({rowId, mutate, setOpenRevertDialog}) => {
|
||||
{t("RevertDialog.button-cancel")}
|
||||
</Button>
|
||||
<Button onClick={formik.handleSubmit} variant="contained" color="primary"
|
||||
disabled={formik.isSubmitting || !formik.dirty || !formik.isValid || true}>
|
||||
disabled={formik.isSubmitting || !formik.dirty || !formik.isValid}>
|
||||
{t("RevertDialog.button-revert")}
|
||||
</Button>
|
||||
</DialogActions>
|
||||
|
||||
@@ -413,16 +413,16 @@ function DashboardTransportationAssistanceComponent() {
|
||||
),
|
||||
},
|
||||
{
|
||||
accessorFn: (row) => row.refer_reason,
|
||||
id: "refer_reason",
|
||||
accessorFn: (row) => row.latest_history.expert_description,
|
||||
id: "latest_history.expert_description",
|
||||
header: t("TransportationAssistance.refer_reason"),
|
||||
enableColumnFilter: false,
|
||||
datatype: "text",
|
||||
filterFn: "contains",
|
||||
columnFilterModeOptions: ["contains", "equals", "notEquals"],
|
||||
Cell: ({renderedCellValue, row}) => {
|
||||
Cell: ({row}) => {
|
||||
return (
|
||||
<Typography variant="body2">{renderedCellValue}</Typography>
|
||||
<Typography variant="body2">{row.original.latest_history.action === 'refer'? row.original.latest_history.expert_description : null}</Typography>
|
||||
)
|
||||
},
|
||||
},
|
||||
@@ -449,7 +449,7 @@ function DashboardTransportationAssistanceComponent() {
|
||||
CustomToolbar={TableToolbar}
|
||||
enableLastUpdate={true}
|
||||
sorting={[{
|
||||
id: 'id', desc: false
|
||||
id: 'statement_count', desc: true
|
||||
}]}
|
||||
enablePinning={true}
|
||||
enableDensityToggle={false}
|
||||
|
||||
@@ -56,6 +56,8 @@ export const CONFIRM_TRANSPORTATION_ASSISTANCE =
|
||||
|
||||
export const REJECT_TRANSPORTATION_ASSISTANCE =
|
||||
BASE_URL + "/dashboard/transportation_assistant/reject";
|
||||
export const REFER_TRANSPORTATION_ASSISTANCE =
|
||||
BASE_URL + "/dashboard/transportation_assistant/refer";
|
||||
export const EXPORT_TRANSPORTATION_ASSISTANCE =
|
||||
BASE_URL + "/dashboard/transportation_assistant/export";
|
||||
//transportation assistance
|
||||
@@ -103,6 +105,8 @@ export const CONFIRM_NAVGAN_PROVINCE_MANAGER =
|
||||
|
||||
export const REJECT_NAVGAN_PROVINCE_MANAGER =
|
||||
BASE_URL + "/dashboard/province_manager/reject";
|
||||
export const REFER_NAVGAN_PROVINCE_MANAGER =
|
||||
BASE_URL + "/dashboard/province_manager/refer";
|
||||
export const EXPORT_NAVGAN_PROVINCE_MANAGER =
|
||||
BASE_URL + "/dashboard/province_manager/export";
|
||||
|
||||
|
||||
@@ -51,7 +51,20 @@ const isServerError = status => status >= 500 && status <= 599;
|
||||
const isClientError = status => status >= 400 && status <= 499;
|
||||
|
||||
const errorLogic = (pushToastList, response, t, notification) => {
|
||||
if (notification) Notifications(pushToastList, "error", t, response.status, response.data.message);
|
||||
if (notification) {
|
||||
if (Array.isArray(response.data.message)) {
|
||||
response.data.message.map((item) => {
|
||||
Notifications(pushToastList, "error", t, response.status, item);
|
||||
});
|
||||
} else
|
||||
Notifications(
|
||||
pushToastList,
|
||||
"error",
|
||||
t,
|
||||
response.status,
|
||||
response.data.message
|
||||
);
|
||||
}
|
||||
}
|
||||
const errorValidation = (pushToastList, response, t, notification) => {
|
||||
if (notification) {
|
||||
|
||||
Reference in New Issue
Block a user