Merge branch 'upgrade_Expense' of https://git.marcoaiot.com/admin/marco.pms.web into upgrade_Expense

This commit is contained in:
pramod.mahajan 2025-11-06 10:07:46 +05:30
commit c3e030754f

View File

@ -7,7 +7,7 @@ import Loader, { SpinnerLoader } from "../common/Loader";
const AdvancePaymentList = ({ employeeId }) => {
const { data, isError, isLoading, error, isFetching } =
useExpenseTransactions(employeeId, { enabled: !!employeeId });
console.log(data)
// Handle no employee selected
if (!employeeId) {
return (
@ -104,7 +104,7 @@ const AdvancePaymentList = ({ employeeId }) => {
</div>
);
}
console.log("Kartik", rowsWithBalance)
return (
<div className="table-responsive">
<table className="table align-middle">
@ -118,30 +118,49 @@ const AdvancePaymentList = ({ employeeId }) => {
</tr>
</thead>
<tbody>
{rowsWithBalance.map((row) => (
{Array.isArray(data) && data.length > 0 ? (
data.map((row) => (
<tr key={row.id}>
{columns.map((col) => (
<td key={col.key} className={`${col.align} p-2`}>
{["balance", "credit", "debit"].includes(col.key) ? (
<span>
{row[col.key].toLocaleString("en-IN")}
</span>
{col.key === "credit" ? (
row.amount > 0 ? (
<span>{row.amount.toLocaleString("en-IN")}</span>
) : (
"-"
)
) : col.key === "debit" ? (
row.amount < 0 ? (
<span>{Math.abs(row.amount).toLocaleString("en-IN")}</span>
) : (
"-"
)
) : col.key === "balance" ? (
<span>{row.currentBalance?.toLocaleString("en-IN")}</span>
) : (
<div className="d-flex flex-column text-start">
<small className="text-muted">
{formatUTCToLocalTime(row.createdAt)}
{formatUTCToLocalTime(row.paidAt)}
</small>
<small className="fw-semibold text-dark">
{row.projectName}
{row.project?.name || "-"}
</small>
<small>{row.description}</small>
<small>{row.title || "-"}</small>
</div>
)}
</td>
))}
</tr>
))}
))
) : (
<tr>
<td colSpan={columns.length} className="text-center text-muted py-3">
No advance payment records found.
</td>
</tr>
)}
</tbody>
<tfoot className="table-secondary fw-bold">
<tr>
<td className="text-start p-3">Final Balance</td>