From daaebf919de4e643e1fd7b5645adc5f7b59604a4 Mon Sep 17 00:00:00 2001 From: "pramod.mahajan" Date: Wed, 5 Nov 2025 15:17:07 +0530 Subject: [PATCH] added New Expense after Payment Request done --- src/components/Expenses/ExpenseList.jsx | 2 +- src/components/Expenses/ExpenseStatusLogs.jsx | 7 +- src/components/Expenses/Filelist.jsx | 36 +-- src/components/Expenses/ManageExpense.jsx | 29 -- src/components/Expenses/ViewExpense.jsx | 129 ++++++++- src/components/PaymentRequest/MakeExpense.jsx | 247 ++++++++++++++++++ .../PaymentRequest/PaymentRequestList.jsx | 2 +- .../PaymentRequest/PaymentRequestSchema.js | 37 ++- .../PaymentRequest/PaymentStatusLogs.jsx | 1 + .../PaymentRequest/ViewPaymentRequest.jsx | 20 +- src/hooks/useExpense.js | 26 +- .../PaymentRequest/PaymentRequestPage.jsx | 16 +- src/repositories/ExpsenseRepository.jsx | 1 + 13 files changed, 488 insertions(+), 65 deletions(-) create mode 100644 src/components/PaymentRequest/MakeExpense.jsx diff --git a/src/components/Expenses/ExpenseList.jsx b/src/components/Expenses/ExpenseList.jsx index a56d340b..474fa374 100644 --- a/src/components/Expenses/ExpenseList.jsx +++ b/src/components/Expenses/ExpenseList.jsx @@ -298,7 +298,7 @@ const ExpenseList = ({ filters, groupBy = "transactionDate", searchText }) => { ) )} -
+
diff --git a/src/components/Expenses/ExpenseStatusLogs.jsx b/src/components/Expenses/ExpenseStatusLogs.jsx index 83ee2e3a..82ce8593 100644 --- a/src/components/Expenses/ExpenseStatusLogs.jsx +++ b/src/components/Expenses/ExpenseStatusLogs.jsx @@ -10,7 +10,7 @@ const ExpenseStatusLogs = ({ data }) => { const sortedLogs = useMemo(() => { if (!data?.expenseLogs) return []; return [...data.expenseLogs].sort( - (a, b) => new Date(b.updatedAt) - new Date(a.updatedAt) + (a, b) => new Date(b.updateAt) - new Date(a.updateAt) ); }, [data?.expenseLogs]); @@ -20,11 +20,12 @@ const ExpenseStatusLogs = ({ data }) => { ); const timelineData = useMemo(() => { + return logsToShow.map((log, index) => ({ id: index + 1, title: log.action || "Status Updated", description: log.comment || "", - timeAgo: log.updatedAt, + timeAgo: log.updateAt, color: getColorNameFromHex(log.nextStatus?.color) || "primary", users: log.updatedBy ? [ @@ -44,7 +45,7 @@ const ExpenseStatusLogs = ({ data }) => { }; return ( -
+
diff --git a/src/components/Expenses/Filelist.jsx b/src/components/Expenses/Filelist.jsx index 208a596b..51e2f9f3 100644 --- a/src/components/Expenses/Filelist.jsx +++ b/src/components/Expenses/Filelist.jsx @@ -13,17 +13,19 @@ const Filelist = ({ files, removeFile, expenseToEdit }) => { return true; }) .map((file, idx) => ( -
-
+
+
{/* File icon and info */} -
+
- + {file.fileName} @@ -32,19 +34,17 @@ const Filelist = ({ files, removeFile, expenseToEdit }) => {
-
- - { - e.preventDefault(); - debugger; - removeFile(expenseToEdit ? file.documentId : idx); - }} - > - -
+ {/* Delete icon */} + + { + e.preventDefault(); + removeFile(expenseToEdit ? file.documentId : idx); + }} + > +
))} diff --git a/src/components/Expenses/ManageExpense.jsx b/src/components/Expenses/ManageExpense.jsx index 4ee1679c..539497ca 100644 --- a/src/components/Expenses/ManageExpense.jsx +++ b/src/components/Expenses/ManageExpense.jsx @@ -298,35 +298,6 @@ const ManageExpense = ({ closeModal, expenseToEdit = null }) => { )}
- - {/*
- - - {errors.paidById && ( - {errors.paidById.message} - )} -
*/} -
{ -
{formatCurrency(data.amount,data?.curency?.currencyCode)}
+
{formatFigure(data?.amount,{type:"currency",currency : data?.currency?.currencyCode ?? "INR"} )}
@@ -294,12 +295,134 @@ const ViewExpense = ({ ExpenseId }) => {
- {/* ... your remaining conditional sections */} + {data.expensesReimburse && ( +
+
+ + {data.expensesReimburse.reimburseTransactionId || "N/A"} +
+
+ + {formatUTCToLocalTime(data.expensesReimburse.reimburseDate)} +
+ + {data.expensesReimburse && ( + <> +
+ + + + {`${data?.expensesReimburse?.reimburseBy?.firstName} ${data?.expensesReimburse?.reimburseBy?.lastName}`.trim()} + +
+ + )} +
+ )} +
+ + {Array.isArray(data?.nextStatus) && data.nextStatus.length > 0 && ( + <> + {IsPaymentProcess && nextStatusWithPermission?.length > 0 && ( +
+
+ + + {errors.reimburseTransactionId && ( + + {errors.reimburseTransactionId.message} + + )} +
+
+ + + {errors.reimburseDate && ( + + {errors.reimburseDate.message} + + )} +
+
+ + +
+
+ )} +
+ {((nextStatusWithPermission.length > 0 && !IsRejectedExpense) || + (IsRejectedExpense && isCreatedBy)) && ( + <> + +