From 3728e116916d97fd31069ab13bc75f0d16b3acfa Mon Sep 17 00:00:00 2001 From: AmirHossein Mahmoodi Date: Mon, 15 Jan 2024 10:22:03 +0330 Subject: [PATCH] change dialog history in loan history page --- .../Form/HistoryForm/PrintHistory.jsx | 26 ++-- .../Form/HistoryForm/TableContent.jsx | 142 +++++++++--------- .../loan-history/Form/HistoryForm/index.jsx | 2 +- 3 files changed, 82 insertions(+), 88 deletions(-) diff --git a/src/components/dashboard/loan-history/Form/HistoryForm/PrintHistory.jsx b/src/components/dashboard/loan-history/Form/HistoryForm/PrintHistory.jsx index 79af47c..438bff5 100644 --- a/src/components/dashboard/loan-history/Form/HistoryForm/PrintHistory.jsx +++ b/src/components/dashboard/loan-history/Form/HistoryForm/PrintHistory.jsx @@ -19,21 +19,17 @@ const PrintHistory = ({attachment}) => { } - return ( - - ) + return () } export default PrintHistory \ No newline at end of file diff --git a/src/components/dashboard/loan-history/Form/HistoryForm/TableContent.jsx b/src/components/dashboard/loan-history/Form/HistoryForm/TableContent.jsx index e71c6c5..d9382a1 100644 --- a/src/components/dashboard/loan-history/Form/HistoryForm/TableContent.jsx +++ b/src/components/dashboard/loan-history/Form/HistoryForm/TableContent.jsx @@ -33,79 +33,77 @@ const TableContent = ({rowId}) => { }) }, []); - return ( - + return ( {error ? ({t("LoanHistory.Table_history_error")}) : - (isLoading ? () : ( - historyDetails.latest_histories.length === 0 ? ( - {t("LoanHistory.empty_history_detail")} - ) : ( - - - - - - {t("LoanHistory.Table_head_name")} - {t("LoanHistory.Table_head_date")} - {t("LoanHistory.Table_head_position")} - {t("LoanHistory.Table_head_action")} - {t("LoanHistory.Table_head_expert_description")} - {t("LoanHistory.Table_head_file")} - - - - { - historyDetails.latest_histories.map((latest_history, index) => { - return ( - - - {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} - {latest_history.expert_description} - - {latest_history.attachment ? ( - - ) : null} - - - ) - }) - } - -
-
-
- ) - )) - } + padding: 2, display: "flex", alignItems: "center", justifyContent: "center" + }}>{t("LoanHistory.Table_history_error")}) : (isLoading ? ( + ) : (historyDetails.latest_histories.length === 0 ? ({t("LoanHistory.empty_history_detail")}) : ( + + + + + {t("LoanHistory.Table_head_name")} + {t("LoanHistory.Table_head_date")} + {t("LoanHistory.Table_head_position")} + {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 => )} + + + {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.previous_state_name} + {_expert_description} + + {_attachments.map(attachment => )} + + ) + })} + +
+
+
)))}
) diff --git a/src/components/dashboard/loan-history/Form/HistoryForm/index.jsx b/src/components/dashboard/loan-history/Form/HistoryForm/index.jsx index de20f60..a7f8eef 100644 --- a/src/components/dashboard/loan-history/Form/HistoryForm/index.jsx +++ b/src/components/dashboard/loan-history/Form/HistoryForm/index.jsx @@ -19,7 +19,7 @@ const History = ({rowId, mutate}) => { - {t("LoanHistory.history")}