diff --git a/example.env.local b/example.env.local
index 72c18d1..d51b0fa 100644
--- a/example.env.local
+++ b/example.env.local
@@ -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"
diff --git a/public/locales/fa/app.json b/public/locales/fa/app.json
index c13b5d1..91fa8ce 100644
--- a/public/locales/fa/app.json
+++ b/public/locales/fa/app.json
@@ -843,6 +843,7 @@
"Table_head_position": "سمت",
"Table_head_action": "عملیات",
"Table_head_file": "فایل پیوست",
+ "Table_head_state": "وضعیت",
"Table_head_expert_description": "توضیحات",
"empty_history_detail": "سابقه ای برای این وام وجود ندارد"
}
diff --git a/src/components/dashboard/loan-history/Form/HistoryForm/TableContent.jsx b/src/components/dashboard/loan-history/Form/HistoryForm/TableContent.jsx
index 0bc4e00..c12fa2c 100644
--- a/src/components/dashboard/loan-history/Form/HistoryForm/TableContent.jsx
+++ b/src/components/dashboard/loan-history/Form/HistoryForm/TableContent.jsx
@@ -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}) => {
{t("LoanHistory.Table_head_name")}
{t("LoanHistory.Table_head_date")}
{t("LoanHistory.Table_head_position")}
+ {t("LoanHistory.Table_head_state")}
{t("LoanHistory.Table_head_action")}
{t("LoanHistory.Table_head_expert_description")}
{t("LoanHistory.Table_head_file")}
-
-
- {historyDetails.latest_histories[0].expert.name}
-
- {moment(historyDetails.latest_histories[0].created_at).locale("fa").format("HH:mm | yyyy/MM/DD")}
- {historyDetails.latest_histories[0].expert.position}
- {historyDetails.state_name}
- {historyDetails.latest_histories[0].expert_description}
-
- {historyDetails.latest_histories[0].attachments.map((attachment, index) =>
- )}
-
-
{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 (
- {_name}
- {_created_at}
- {_position}
+ {latest_history.expert.name}
+ {moment(latest_history.created_at).locale("fa").format("HH:mm | yyyy/MM/DD")}
+ {latest_history.expert.position}
{latest_history.previous_state_name}
- {_expert_description}
+ {action_name[latest_history.action]}
+ {latest_history.expert_description}
- {_attachments.map((attachment, index) => )}
)
diff --git a/src/components/dashboard/loan-history/index.jsx b/src/components/dashboard/loan-history/index.jsx
index 2a75e5f..a7767b5 100644
--- a/src/components/dashboard/loan-history/index.jsx
+++ b/src/components/dashboard/loan-history/index.jsx
@@ -31,25 +31,6 @@ function DashboardLoanHistoryComponent() {
{renderedCellValue}
),
},
- {
- 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}) => (
- {renderedCellValue}
- ),
- },
{
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}
diff --git a/src/components/dashboard/navgan-loan-management/index.jsx b/src/components/dashboard/navgan-loan-management/index.jsx
index 9777746..cd38fad 100644
--- a/src/components/dashboard/navgan-loan-management/index.jsx
+++ b/src/components/dashboard/navgan-loan-management/index.jsx
@@ -32,25 +32,6 @@ function DashboardNavganLoanManagementComponent() {
{renderedCellValue}
),
},
- {
- 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}) => (
- {renderedCellValue}
- ),
- },
{
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}
diff --git a/src/components/dashboard/navgan-province-manager/Form/ConfirmForm/ConfirmContent.jsx b/src/components/dashboard/navgan-province-manager/Form/ConfirmForm/ConfirmContent.jsx
index 0423bd0..312bbf2 100644
--- a/src/components/dashboard/navgan-province-manager/Form/ConfirmForm/ConfirmContent.jsx
+++ b/src/components/dashboard/navgan-province-manager/Form/ConfirmForm/ConfirmContent.jsx
@@ -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(() => {
diff --git a/src/components/dashboard/navgan-province-manager/Form/RevertForm/RevertContent.jsx b/src/components/dashboard/navgan-province-manager/Form/RevertForm/RevertContent.jsx
index 23f4268..64d1dec 100644
--- a/src/components/dashboard/navgan-province-manager/Form/RevertForm/RevertContent.jsx
+++ b/src/components/dashboard/navgan-province-manager/Form/RevertForm/RevertContent.jsx
@@ -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")}
diff --git a/src/components/dashboard/navgan-province-manager/index.jsx b/src/components/dashboard/navgan-province-manager/index.jsx
index b39cf90..744ed31 100644
--- a/src/components/dashboard/navgan-province-manager/index.jsx
+++ b/src/components/dashboard/navgan-province-manager/index.jsx
@@ -436,7 +436,7 @@ function DashboardNavganProvinceManagerComponent() {
CustomToolbar={TableToolbar}
enableLastUpdate={true}
sorting={[{
- id: 'id', desc: false
+ id: 'statement_count', desc: true
}]}
enablePinning={true}
enableDensityToggle={false}
diff --git a/src/components/dashboard/passenger-boss/index.jsx b/src/components/dashboard/passenger-boss/index.jsx
index 5ee5635..a8205ff 100644
--- a/src/components/dashboard/passenger-boss/index.jsx
+++ b/src/components/dashboard/passenger-boss/index.jsx
@@ -32,25 +32,6 @@ function DashboardPassengerOfficeComponent() {
{renderedCellValue}
),
},
- {
- 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}) => (
- {renderedCellValue}
- ),
- },
{
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 (
- {renderedCellValue}
+ {row.original.latest_history.action === 'refer'? row.original.latest_history.expert_description : null}
)
},
},
@@ -326,7 +307,7 @@ function DashboardPassengerOfficeComponent() {
CustomToolbar={TableToolbar}
enableLastUpdate={true}
sorting={[{
- id: 'score', desc: false
+ id: 'statement_count', desc: true
}]}
enablePinning={true}
enableDensityToggle={false}
diff --git a/src/components/dashboard/reserve-loan/index.jsx b/src/components/dashboard/reserve-loan/index.jsx
index 36e6a32..5fcf3b5 100644
--- a/src/components/dashboard/reserve-loan/index.jsx
+++ b/src/components/dashboard/reserve-loan/index.jsx
@@ -31,25 +31,6 @@ function DashboardReserveLoan() {
{renderedCellValue}
),
},
- {
- 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}) => (
- {renderedCellValue}
- ),
- },
{
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}
diff --git a/src/components/dashboard/transportation-assistance/Form/ConfirmForm/ConfirmContent.jsx b/src/components/dashboard/transportation-assistance/Form/ConfirmForm/ConfirmContent.jsx
index c3b04b4..22f9f1f 100644
--- a/src/components/dashboard/transportation-assistance/Form/ConfirmForm/ConfirmContent.jsx
+++ b/src/components/dashboard/transportation-assistance/Form/ConfirmForm/ConfirmContent.jsx
@@ -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(() => {
diff --git a/src/components/dashboard/transportation-assistance/Form/RevertForm/RevertContent.jsx b/src/components/dashboard/transportation-assistance/Form/RevertForm/RevertContent.jsx
index 1a2e524..0528e80 100644
--- a/src/components/dashboard/transportation-assistance/Form/RevertForm/RevertContent.jsx
+++ b/src/components/dashboard/transportation-assistance/Form/RevertForm/RevertContent.jsx
@@ -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")}
diff --git a/src/components/dashboard/transportation-assistance/index.jsx b/src/components/dashboard/transportation-assistance/index.jsx
index 1c652e0..62efc0a 100644
--- a/src/components/dashboard/transportation-assistance/index.jsx
+++ b/src/components/dashboard/transportation-assistance/index.jsx
@@ -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 (
- {renderedCellValue}
+ {row.original.latest_history.action === 'refer'? row.original.latest_history.expert_description : null}
)
},
},
@@ -449,7 +449,7 @@ function DashboardTransportationAssistanceComponent() {
CustomToolbar={TableToolbar}
enableLastUpdate={true}
sorting={[{
- id: 'id', desc: false
+ id: 'statement_count', desc: true
}]}
enablePinning={true}
enableDensityToggle={false}
diff --git a/src/core/data/apiRoutes.js b/src/core/data/apiRoutes.js
index f0d4774..841d6f4 100644
--- a/src/core/data/apiRoutes.js
+++ b/src/core/data/apiRoutes.js
@@ -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";
diff --git a/src/core/utils/errorHandler.js b/src/core/utils/errorHandler.js
index e380e84..10ff105 100644
--- a/src/core/utils/errorHandler.js
+++ b/src/core/utils/errorHandler.js
@@ -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) {