change loan history
This commit is contained in:
@@ -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>)
|
||||
|
||||
Reference in New Issue
Block a user