diff --git a/src/components/AdvancePayment/AdvancePaymentList.jsx b/src/components/AdvancePayment/AdvancePaymentList.jsx index a1bf31a7..0f975ab5 100644 --- a/src/components/AdvancePayment/AdvancePaymentList.jsx +++ b/src/components/AdvancePayment/AdvancePaymentList.jsx @@ -2,16 +2,53 @@ import React from "react"; import { useExpenseTransactions } from "../../hooks/useExpense"; import Error from "../common/Error"; import { formatUTCToLocalTime } from "../../utils/dateUtils"; +import Loader, { SpinnerLoader } from "../common/Loader"; const AdvancePaymentList = ({ employeeId }) => { - const { data, isError, isLoading, error } = - useExpenseTransactions(employeeId); + const { data, isError, isLoading, error, isFetching } = + useExpenseTransactions(employeeId, { enabled: !!employeeId }); - const records = data?.json || []; + // Handle no employee selected + if (!employeeId) { + return ( +
Please select an employee
+|
{["balance", "credit", "debit"].includes(col.key) ? (
- row[col.key].toLocaleString("en-IN", {
- style: "currency",
- currency: "INR",
- })
+
+ {row[col.key].toLocaleString("en-IN")}
+
) : (
-
+
{formatUTCToLocalTime(row.createdAt)}
@@ -114,12 +153,7 @@ const AdvancePaymentList = ({ employeeId }) => {
|
Please Select Employee
-Loading attendance data...
+Loading data... Please wait