From f64072b2fce28b8bd43a1e5b18a2ea7b1585806c Mon Sep 17 00:00:00 2001 From: AminGhasempoor Date: Mon, 27 May 2024 11:18:02 +0330 Subject: [PATCH] change loan history --- public/locales/fa/app.json | 1 + .../Form/HistoryForm/TableContent.jsx | 42 ++++++------------- 2 files changed, 14 insertions(+), 29 deletions(-) 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) => )} )