diff --git a/src/components/AdvancePayment/AdvancePaymentList.jsx b/src/components/AdvancePayment/AdvancePaymentList.jsx index e9113b48..c6e9d004 100644 --- a/src/components/AdvancePayment/AdvancePaymentList.jsx +++ b/src/components/AdvancePayment/AdvancePaymentList.jsx @@ -1,6 +1,6 @@ import React, { useEffect, useMemo } from "react"; -import { useExpenseTransactions } from "../../hooks/useExpense"; +import { useExpenseAllTransactionsList, useExpenseTransactions } from "../../hooks/useExpense"; import Error from "../common/Error"; import { formatUTCToLocalTime } from "../../utils/dateUtils"; import Loader, { SpinnerLoader } from "../common/Loader"; @@ -11,11 +11,10 @@ import { employee } from "../../data/masters"; import { useAdvancePaymentContext } from "../../pages/AdvancePayment/AdvancePaymentPage"; import { formatFigure } from "../../utils/appUtils"; -const AdvancePaymentList = ({ employeeId }) => { - const { setBalance } = useAdvancePaymentContext(); +const AdvancePaymentList = ({ employeeId, searchString }) => { + const { setBalance } = useAdvancePaymentContext(); const { data, isError, isLoading, error, isFetching } = useExpenseTransactions(employeeId, { enabled: !!employeeId }); - const records = Array.isArray(data) ? data : []; let currentBalance = 0; @@ -85,7 +84,7 @@ const AdvancePaymentList = ({ employeeId }) => { key: "date", label: ( <> - Date + Date ), align: "text-start", diff --git a/src/components/AdvancePayment/AdvancePaymentList1.jsx b/src/components/AdvancePayment/AdvancePaymentList1.jsx new file mode 100644 index 00000000..e17cd1b1 --- /dev/null +++ b/src/components/AdvancePayment/AdvancePaymentList1.jsx @@ -0,0 +1,100 @@ +import React from 'react' +import Avatar from "../../components/common/Avatar"; // <-- ADD THIS +import { useExpenseAllTransactionsList } from '../../hooks/useExpense'; +import { useNavigate } from 'react-router-dom'; +import { formatFigure } from '../../utils/appUtils'; + +const AdvancePaymentList1 = ({ searchString }) => { + + const { data, isError, isLoading, error } = + useExpenseAllTransactionsList(searchString); + + const rows = data || []; + const navigate = useNavigate(); + + const columns = [ + { + key: "employee", + label: "Employee Name", + align: "text-start", + customRender: (r) => ( +
navigate(`/advance-payment/${r.id}`)} + style={{ cursor: "pointer" }}> + + + + {r.firstName} {r.lastName} + +
+ ), + }, + { + key: "jobRoleName", + label: "Job Role", + align: "text-start", + customRender: (r) => ( + + {r.jobRoleName} + + ), + }, + { + key: "balanceAmount", + label: "Balance (₹)", + align: "text-end", + customRender: (r) => ( + + {formatFigure(r.balanceAmount, { + // type: "currency", + currency: "INR", + })} + + ), + }, + ]; + + if (isLoading) return

Loading...

; + if (isError) return

{error.message}

; + + return ( +
+
+ + + + {columns.map((col) => ( + + ))} + + + + + {rows.length > 0 ? ( + rows.map((row) => ( + + {columns.map((col) => ( + + ))} + + )) + ) : ( + + + + )} + +
+ {col.label} +
+ {col.customRender + ? col.customRender(row) + : col.getValue(row)} +
+ No Employees Found +
+
+
+ ) +} + +export default AdvancePaymentList1; diff --git a/src/components/Layout/Header.jsx b/src/components/Layout/Header.jsx index 0437539e..0dca90e5 100644 --- a/src/components/Layout/Header.jsx +++ b/src/components/Layout/Header.jsx @@ -50,8 +50,11 @@ const Header = () => { const isRecurringExpense = /^\/recurring-payment$/.test(pathname); const isAdvancePayment = /^\/advance-payment$/.test(pathname); const isServiceProjectPage = /^\/service-projects\/[0-9a-fA-F-]{36}$/.test(pathname); + const isAdvancePayment1 = + /^\/advance-payment(\/[0-9a-fA-F-]{36})?$/.test(pathname); - return !(isDirectoryPath || isProfilePage || isExpensePage || isPaymentRequest || isRecurringExpense || isAdvancePayment ||isServiceProjectPage); + + return !(isDirectoryPath || isProfilePage || isExpensePage || isPaymentRequest || isRecurringExpense || isAdvancePayment ||isServiceProjectPage || isAdvancePayment1); }; const allowedProjectStatusIds = [ "603e994b-a27f-4e5d-a251-f3d69b0498ba", diff --git a/src/components/RecurringExpense/RecurringExpenseList.jsx b/src/components/RecurringExpense/RecurringExpenseList.jsx index 338a3f38..a4c45fba 100644 --- a/src/components/RecurringExpense/RecurringExpenseList.jsx +++ b/src/components/RecurringExpense/RecurringExpenseList.jsx @@ -166,7 +166,7 @@ const RecurringExpenseList = ({ search, filterStatuses }) => { } ); }; - +console.log("Tanish",filteredData) return ( <> {IsDeleteModalOpen && ( diff --git a/src/components/collections/CollectionList.jsx b/src/components/collections/CollectionList.jsx index bb94130e..ad1ff5c0 100644 --- a/src/components/collections/CollectionList.jsx +++ b/src/components/collections/CollectionList.jsx @@ -27,7 +27,7 @@ const CollectionList = ({ fromDate, toDate, isPending, searchString }) => { const selectedProject = useSelectedProject(); const searchDebounce = useDebounce(searchString, 500); - + const { data, isLoading, isError, error } = useCollections( selectedProject, searchDebounce, @@ -40,7 +40,6 @@ const CollectionList = ({ fromDate, toDate, isPending, searchString }) => { ); const { setProcessedPayment, setAddPayment, setViewCollection } = useCollectionContext(); - const paginate = (page) => { if (page >= 1 && page <= (data?.totalPages ?? 1)) { setCurrentPage(page); @@ -113,6 +112,16 @@ const CollectionList = ({ fromDate, toDate, isPending, searchString }) => { ), align: "text-center", }, + { + key: "status", + label: "Status", + getValue: (col) => ( + + {col?.isActive ? "Active" : "Inactive"} + + ), + align: "text-center", + }, { key: "amount", label: "Total Amount", @@ -129,6 +138,7 @@ const CollectionList = ({ fromDate, toDate, isPending, searchString }) => { ), align: "text-end", }, + { key: "balance", label: "Balance", diff --git a/src/components/collections/ViewCollection.jsx b/src/components/collections/ViewCollection.jsx index 77bc78fe..fdf563b9 100644 --- a/src/components/collections/ViewCollection.jsx +++ b/src/components/collections/ViewCollection.jsx @@ -25,7 +25,6 @@ const ViewCollection = ({ onClose }) => { if (isLoading) return ; if (isError) return
{error.message}
; - return (

Collection Details

@@ -43,9 +42,8 @@ const ViewCollection = ({ onClose }) => {
{" "} {data?.isActive ? "Active" : "Inactive"} @@ -214,9 +212,8 @@ const ViewCollection = ({ onClose }) => {
  • +
{/* Right side: Search + Add Button */}
+ + + api.get("delete here come"), CreatePaymentRequestExpense: (data) => api.post("/api/Expense/payment-request/expense/create", data), - GetPayee:()=>api.get('/api/Expense/payment-request/payee'), + GetPayee: () => api.get('/api/Expense/payment-request/payee'), //#endregion //#region Recurring Expense - GetRecurringExpenseList:(pageSize, pageNumber, filter,isActive, searchString) => { + GetRecurringExpenseList: (pageSize, pageNumber, filter, isActive, searchString) => { const payloadJsonString = JSON.stringify(filter); return api.get( `/api/expense/get/recurring-payment/list?pageSize=${pageSize}&pageNumber=${pageNumber}&filter=${payloadJsonString}&isActive=${isActive}&searchString=${searchString}` @@ -70,9 +70,11 @@ const ExpenseRepository = { //#region Advance Payment GetTranctionList: (employeeId) => api.get(`/api/Expense/get/transactions/${employeeId}`), + getAllTranctionList: (searchString) => + api.get(`/api/Expense/get/advance-payment/employee/list?searchString=${searchString}`), //#endregion - + }; export default ExpenseRepository; diff --git a/src/router/AppRoutes.jsx b/src/router/AppRoutes.jsx index 3ef8131b..dc556a6e 100644 --- a/src/router/AppRoutes.jsx +++ b/src/router/AppRoutes.jsx @@ -61,6 +61,7 @@ import RecurringExpensePage from "../pages/RecurringExpense/RecurringExpensePage import AdvancePaymentPage from "../pages/AdvancePayment/AdvancePaymentPage"; import ServiceProjectDetail from "../pages/ServiceProject/ServiceProjectDetail"; import ManageJob from "../components/ServiceProject/ServiceProjectJob/ManageJob"; +import AdvancePaymentPage1 from "../pages/AdvancePayment/AdvancePaymentPage1"; const router = createBrowserRouter( [ { @@ -116,7 +117,8 @@ const router = createBrowserRouter( { path: "/expenses", element: }, { path: "/payment-request", element: }, { path: "/recurring-payment", element: }, - { path: "/advance-payment", element: }, + { path: "/advance-payment", element: }, + { path: "/advance-payment/:employeeId", element: }, { path: "/collection", element: }, { path: "/masters", element: }, { path: "/tenants", element: },