changed veriable name expensesCategoryId to expenseCategoryId and passes properly param. for list api
This commit is contained in:
parent
1f784f330d
commit
82f173c0ed
@ -14,7 +14,7 @@ export const ExpenseSchema = (expenseTypes) => {
|
|||||||
return z
|
return z
|
||||||
.object({
|
.object({
|
||||||
projectId: z.string().min(1, { message: "Project is required" }),
|
projectId: z.string().min(1, { message: "Project is required" }),
|
||||||
expensesCategoryId: z
|
expenseCategoryId: z
|
||||||
.string()
|
.string()
|
||||||
.min(1, { message: "Expense type is required" }),
|
.min(1, { message: "Expense type is required" }),
|
||||||
paymentModeId: z.string().min(1, { message: "Payment mode is required" }),
|
paymentModeId: z.string().min(1, { message: "Payment mode is required" }),
|
||||||
@ -88,7 +88,7 @@ export const ExpenseSchema = (expenseTypes) => {
|
|||||||
|
|
||||||
export const defaultExpense = {
|
export const defaultExpense = {
|
||||||
projectId: "",
|
projectId: "",
|
||||||
expensesCategoryId: "",
|
expenseCategoryId: "",
|
||||||
paymentModeId: "",
|
paymentModeId: "",
|
||||||
paidById: "",
|
paidById: "",
|
||||||
transactionDate: "",
|
transactionDate: "",
|
||||||
|
|||||||
@ -153,7 +153,7 @@ const ManageExpense = ({ closeModal, expenseToEdit = null }) => {
|
|||||||
if (expenseToEdit && data) {
|
if (expenseToEdit && data) {
|
||||||
reset({
|
reset({
|
||||||
projectId: data.project.id || "",
|
projectId: data.project.id || "",
|
||||||
expensesCategoryId: data.expensesType.id || "",
|
expenseCategoryId: data.expenseType.id || "",
|
||||||
paymentModeId: data.paymentMode.id || "",
|
paymentModeId: data.paymentMode.id || "",
|
||||||
paidById: data.paidBy.id || "",
|
paidById: data.paidBy.id || "",
|
||||||
transactionDate: data.transactionDate?.slice(0, 10) || "",
|
transactionDate: data.transactionDate?.slice(0, 10) || "",
|
||||||
@ -247,13 +247,13 @@ const ManageExpense = ({ closeModal, expenseToEdit = null }) => {
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div className="col-md-6">
|
<div className="col-md-6">
|
||||||
<Label htmlFor="expensesCategoryId" className="form-label" required>
|
<Label htmlFor="expenseCategoryId" className="form-label" required>
|
||||||
Expense Category
|
Expense Category
|
||||||
</Label>
|
</Label>
|
||||||
<select
|
<select
|
||||||
className="form-select form-select-sm"
|
className="form-select form-select-sm"
|
||||||
id="expensesCategoryId"
|
id="expenseCategoryId"
|
||||||
{...register("expensesCategoryId")}
|
{...register("expenseCategoryId")}
|
||||||
>
|
>
|
||||||
<option value="" disabled>
|
<option value="" disabled>
|
||||||
Select Type
|
Select Type
|
||||||
|
|||||||
@ -1,14 +1,11 @@
|
|||||||
import React, { useState } from "react";
|
import React, { useState } from "react";
|
||||||
import {
|
import {
|
||||||
EXPENSE_DRAFT,
|
EXPENSE_DRAFT,
|
||||||
EXPENSE_REJECTEDBY,
|
EXPENSE_REJECTEDBY,
|
||||||
FREQUENCY_FOR_RECURRING,
|
FREQUENCY_FOR_RECURRING,
|
||||||
ITEMS_PER_PAGE,
|
ITEMS_PER_PAGE,
|
||||||
} from "../../utils/constants";
|
} from "../../utils/constants";
|
||||||
import {
|
import { formatCurrency, useDebounce } from "../../utils/appUtils";
|
||||||
formatCurrency,
|
|
||||||
useDebounce,
|
|
||||||
} from "../../utils/appUtils";
|
|
||||||
import { formatUTCToLocalTime } from "../../utils/dateUtils";
|
import { formatUTCToLocalTime } from "../../utils/dateUtils";
|
||||||
import { ExpenseTableSkeleton } from "../Expenses/ExpenseSkeleton";
|
import { ExpenseTableSkeleton } from "../Expenses/ExpenseSkeleton";
|
||||||
import ConfirmModal from "../common/ConfirmModal";
|
import ConfirmModal from "../common/ConfirmModal";
|
||||||
@ -19,265 +16,271 @@ import { useRecurringExpenseContext } from "../../pages/RecurringExpense/Recurri
|
|||||||
import { useRecurringExpenseList } from "../../hooks/useExpense";
|
import { useRecurringExpenseList } from "../../hooks/useExpense";
|
||||||
|
|
||||||
const RecurringExpenseList = ({ search, filterStatuses }) => {
|
const RecurringExpenseList = ({ search, filterStatuses }) => {
|
||||||
const { setManageRequest, setVieRequest } = useRecurringExpenseContext();
|
const { setManageRequest, setVieRequest } = useRecurringExpenseContext();
|
||||||
const navigate = useNavigate();
|
const navigate = useNavigate();
|
||||||
const [IsDeleteModalOpen, setIsDeleteModalOpen] = useState(false);
|
const [IsDeleteModalOpen, setIsDeleteModalOpen] = useState(false);
|
||||||
const [deletingId, setDeletingId] = useState(null);
|
const [deletingId, setDeletingId] = useState(null);
|
||||||
|
|
||||||
const SelfId = useSelector(
|
const SelfId = useSelector(
|
||||||
(store) => store?.globalVariables?.loginUser?.employeeInfo?.id
|
(store) => store?.globalVariables?.loginUser?.employeeInfo?.id
|
||||||
|
);
|
||||||
|
|
||||||
|
const recurringExpenseColumns = [
|
||||||
|
{
|
||||||
|
key: "expenseCategory",
|
||||||
|
label: "Category",
|
||||||
|
align: "text-start",
|
||||||
|
getValue: (e) => e?.expenseCategory?.name || "N/A",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
key: "title",
|
||||||
|
label: "Title",
|
||||||
|
align: "text-start",
|
||||||
|
getValue: (e) => e?.title || "N/A",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
key: "payee",
|
||||||
|
label: "Payee",
|
||||||
|
align: "text-start",
|
||||||
|
getValue: (e) => e?.payee || "N/A",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
key: "frequency",
|
||||||
|
label: "Frequency",
|
||||||
|
align: "text-start",
|
||||||
|
getValue: (e) =>
|
||||||
|
e?.frequency !== undefined && e?.frequency !== null
|
||||||
|
? FREQUENCY_FOR_RECURRING[e.frequency] || "N/A"
|
||||||
|
: "N/A",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
key: "amount",
|
||||||
|
label: "Amount",
|
||||||
|
align: "text-end",
|
||||||
|
getValue: (e) =>
|
||||||
|
e?.amount
|
||||||
|
? `${e?.currency?.symbol || ""}${e.amount.toLocaleString()}`
|
||||||
|
: "N/A",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
key: "createdAt",
|
||||||
|
label: "Next Generation Date",
|
||||||
|
align: "text-center",
|
||||||
|
getValue: (e) =>
|
||||||
|
e?.createdAt ? formatUTCToLocalTime(e.createdAt) : "N/A",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
key: "status",
|
||||||
|
label: "Status",
|
||||||
|
align: "text-start",
|
||||||
|
getValue: (e) => e?.status?.name || "N/A",
|
||||||
|
},
|
||||||
|
];
|
||||||
|
|
||||||
|
const [currentPage, setCurrentPage] = useState(1);
|
||||||
|
const debouncedSearch = useDebounce(search, 500);
|
||||||
|
|
||||||
|
const { data, isLoading, isError, error, isRefetching, refetch } =
|
||||||
|
useRecurringExpenseList(
|
||||||
|
ITEMS_PER_PAGE,
|
||||||
|
currentPage,
|
||||||
|
{},
|
||||||
|
true,
|
||||||
|
debouncedSearch
|
||||||
);
|
);
|
||||||
|
|
||||||
const recurringExpenseColumns = [
|
const recurringExpenseData = data?.data || [];
|
||||||
{
|
const totalPages = data?.totalPages || 1;
|
||||||
key: "expenseCategory",
|
|
||||||
label: "Category",
|
|
||||||
align: "text-start",
|
|
||||||
getValue: (e) => e?.expenseCategory?.name || "N/A",
|
|
||||||
},
|
|
||||||
{
|
|
||||||
key: "title",
|
|
||||||
label: "Title",
|
|
||||||
align: "text-start",
|
|
||||||
getValue: (e) => e?.title || "N/A",
|
|
||||||
},
|
|
||||||
{
|
|
||||||
key: "payee",
|
|
||||||
label: "Payee",
|
|
||||||
align: "text-start",
|
|
||||||
getValue: (e) => e?.payee || "N/A",
|
|
||||||
},
|
|
||||||
{
|
|
||||||
key: "frequency",
|
|
||||||
label: "Frequency",
|
|
||||||
align: "text-start",
|
|
||||||
getValue: (e) =>
|
|
||||||
e?.frequency !== undefined && e?.frequency !== null
|
|
||||||
? FREQUENCY_FOR_RECURRING[e.frequency] || "N/A"
|
|
||||||
: "N/A",
|
|
||||||
},
|
|
||||||
{
|
|
||||||
key: "amount",
|
|
||||||
label: "Amount",
|
|
||||||
align: "text-end",
|
|
||||||
getValue: (e) =>
|
|
||||||
e?.amount
|
|
||||||
? `${e?.currency?.symbol || ""}${e.amount.toLocaleString()}`
|
|
||||||
: "N/A",
|
|
||||||
},
|
|
||||||
{
|
|
||||||
key: "createdAt",
|
|
||||||
label: "Next Generation Date",
|
|
||||||
align: "text-center",
|
|
||||||
getValue: (e) =>
|
|
||||||
e?.createdAt ? formatUTCToLocalTime(e.createdAt) : "N/A",
|
|
||||||
},
|
|
||||||
{
|
|
||||||
key: "status",
|
|
||||||
label: "Status",
|
|
||||||
align: "text-start",
|
|
||||||
getValue: (e) => e?.status?.name || "N/A",
|
|
||||||
},
|
|
||||||
|
|
||||||
];
|
if (isError) {
|
||||||
|
return <Error error={error} isFeteching={isRefetching} refetch={refetch} />;
|
||||||
|
}
|
||||||
|
|
||||||
|
const header = [
|
||||||
|
"Category",
|
||||||
|
"Title",
|
||||||
|
"Amount",
|
||||||
|
"Payee",
|
||||||
|
"Frequency",
|
||||||
|
"Next Generation",
|
||||||
|
"Status",
|
||||||
|
"Action",
|
||||||
|
];
|
||||||
|
|
||||||
const [currentPage, setCurrentPage] = useState(1);
|
if (isLoading) return <ExpenseTableSkeleton headers={header} />;
|
||||||
const debouncedSearch = useDebounce(search, 500);
|
|
||||||
|
|
||||||
const { data, isLoading, isError, error, isRefetching, refetch } =
|
const canEditExpense = (recurringExpense) => {
|
||||||
useRecurringExpenseList(
|
// return (
|
||||||
ITEMS_PER_PAGE,
|
// (recurringExpense?.expenseStatus?.id === EXPENSE_DRAFT ||
|
||||||
currentPage,
|
// EXPENSE_REJECTEDBY.includes(recurringExpense?.expenseStatus.id)) &&
|
||||||
{},
|
// recurringExpense?.createdBy?.id === SelfId
|
||||||
true,
|
// );
|
||||||
debouncedSearch
|
};
|
||||||
);
|
|
||||||
|
|
||||||
const recurringExpenseData = data?.data || [];
|
|
||||||
const totalPages = data?.totalPages || 1;
|
|
||||||
|
|
||||||
if (isError) {
|
|
||||||
return <Error error={error} isFeteching={isRefetching} refetch={refetch} />;
|
|
||||||
}
|
|
||||||
|
|
||||||
const header = [
|
|
||||||
"Category",
|
|
||||||
"Title",
|
|
||||||
"Amount",
|
|
||||||
"Payee",
|
|
||||||
"Frequency",
|
|
||||||
"Next Generation",
|
|
||||||
"Status",
|
|
||||||
"Action",
|
|
||||||
];
|
|
||||||
|
|
||||||
if (isLoading) return <ExpenseTableSkeleton headers={header} />;
|
|
||||||
|
|
||||||
const canEditExpense = (recurringExpense) => {
|
|
||||||
// return (
|
|
||||||
// (recurringExpense?.expenseStatus?.id === EXPENSE_DRAFT ||
|
|
||||||
// EXPENSE_REJECTEDBY.includes(recurringExpense?.expenseStatus.id)) &&
|
|
||||||
// recurringExpense?.createdBy?.id === SelfId
|
|
||||||
// );
|
|
||||||
};
|
|
||||||
|
|
||||||
const canDeleteExpense = (request) => {
|
|
||||||
return (
|
|
||||||
request?.expenseStatus?.id === EXPENSE_DRAFT &&
|
|
||||||
request?.createdBy?.id === SelfId
|
|
||||||
);
|
|
||||||
};
|
|
||||||
|
|
||||||
const filteredData = recurringExpenseData.filter((item) =>
|
|
||||||
filterStatuses.includes(item?.status?.id)
|
|
||||||
);
|
|
||||||
|
|
||||||
const handleDelete = (id) => {
|
|
||||||
setDeletingId(id);
|
|
||||||
DeleteExpense(
|
|
||||||
{ id },
|
|
||||||
{
|
|
||||||
onSettled: () => {
|
|
||||||
setDeletingId(null);
|
|
||||||
setIsDeleteModalOpen(false);
|
|
||||||
},
|
|
||||||
}
|
|
||||||
);
|
|
||||||
};
|
|
||||||
|
|
||||||
|
const canDeleteExpense = (request) => {
|
||||||
return (
|
return (
|
||||||
<>
|
request?.expenseStatus?.id === EXPENSE_DRAFT &&
|
||||||
{IsDeleteModalOpen && (
|
request?.createdBy?.id === SelfId
|
||||||
<ConfirmModal
|
|
||||||
isOpen={IsDeleteModalOpen}
|
|
||||||
type="delete"
|
|
||||||
header="Delete Recurring Expense"
|
|
||||||
message="Are you sure you want to delete?"
|
|
||||||
onSubmit={handleDelete}
|
|
||||||
onClose={() => setIsDeleteModalOpen(false)}
|
|
||||||
paramData={deletingId}
|
|
||||||
/>
|
|
||||||
)}
|
|
||||||
|
|
||||||
<div className="card page-min-h table-responsive px-sm-4">
|
|
||||||
<div className="card-datatable" id="payment-request-table">
|
|
||||||
<table className="table border-top dataTable text-nowrap align-middle">
|
|
||||||
<thead>
|
|
||||||
<tr>
|
|
||||||
{recurringExpenseColumns.map((col) => (
|
|
||||||
<th key={col.key} className={`sorting ${col.align}`}>
|
|
||||||
{col.label}
|
|
||||||
</th>
|
|
||||||
))}
|
|
||||||
<th className="text-center">Action</th>
|
|
||||||
</tr>
|
|
||||||
</thead>
|
|
||||||
|
|
||||||
<tbody>
|
|
||||||
{filteredData.length > 0 ? (
|
|
||||||
filteredData.map((recurringExpense) => (
|
|
||||||
<tr key={recurringExpense.id} className="align-middle" style={{ height: "50px" }}>
|
|
||||||
{recurringExpenseColumns.map((col) => (
|
|
||||||
<td
|
|
||||||
key={col.key}
|
|
||||||
className={`d-table-cell ${col.align ?? ""} py-3`}
|
|
||||||
>
|
|
||||||
{col?.customRender
|
|
||||||
? col?.customRender(recurringExpense)
|
|
||||||
: col?.getValue(recurringExpense)}
|
|
||||||
</td>
|
|
||||||
))}
|
|
||||||
<td className="sticky-action-column bg-white">
|
|
||||||
<div className="d-flex justify-content-center gap-0">
|
|
||||||
<i
|
|
||||||
className="bx bx-show text-primary cursor-pointer"
|
|
||||||
// onClick={() =>
|
|
||||||
// setVieRequest({
|
|
||||||
// requestId: recurringExpense.id,
|
|
||||||
// view: true,
|
|
||||||
// })
|
|
||||||
// }
|
|
||||||
></i>
|
|
||||||
{/* Uncomment for edit/delete actions */}
|
|
||||||
|
|
||||||
<div className="dropdown z-2">
|
|
||||||
<button
|
|
||||||
type="button"
|
|
||||||
className="btn btn-xs btn-icon btn-text-secondary rounded-pill dropdown-toggle hide-arrow p-0 m-0"
|
|
||||||
data-bs-toggle="dropdown"
|
|
||||||
>
|
|
||||||
<i className="bx bx-dots-vertical-rounded text-muted p-0"></i>
|
|
||||||
</button>
|
|
||||||
<ul className="dropdown-menu dropdown-menu-end w-auto">
|
|
||||||
<li
|
|
||||||
onClick={() =>
|
|
||||||
setManageRequest({
|
|
||||||
IsOpen: true,
|
|
||||||
RecurringId: recurringExpense.id,
|
|
||||||
})
|
|
||||||
}
|
|
||||||
>
|
|
||||||
<a className="dropdown-item px-2 cursor-pointer py-1">
|
|
||||||
<i className="bx bx-edit text-primary bx-xs me-2"></i>
|
|
||||||
Modify
|
|
||||||
</a>
|
|
||||||
</li>
|
|
||||||
|
|
||||||
<li
|
|
||||||
onClick={() => {
|
|
||||||
setIsDeleteModalOpen(true);
|
|
||||||
setDeletingId(recurringExpense.id);
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
<a className="dropdown-item px-2 cursor-pointer py-1">
|
|
||||||
<i className="bx bx-trash text-danger bx-xs me-2"></i>
|
|
||||||
Delete
|
|
||||||
</a>
|
|
||||||
</li>
|
|
||||||
|
|
||||||
</ul>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
))
|
|
||||||
) : (
|
|
||||||
<tr>
|
|
||||||
<td colSpan={recurringExpenseColumns.length + 1} className="text-center border-0 py-8">
|
|
||||||
<p>No Recurring Expense Found</p>
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
)}
|
|
||||||
</tbody>
|
|
||||||
</table>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
{/* Pagination */}
|
|
||||||
{totalPages > 1 && (
|
|
||||||
<div className="d-flex justify-content-end py-3 pe-3">
|
|
||||||
<nav>
|
|
||||||
<ul className="pagination mb-0">
|
|
||||||
{[...Array(totalPages)].map((_, index) => (
|
|
||||||
<li
|
|
||||||
key={index}
|
|
||||||
className={`page-item ${currentPage === index + 1 ? "active" : ""}`}
|
|
||||||
>
|
|
||||||
<button
|
|
||||||
className="page-link"
|
|
||||||
onClick={() => setCurrentPage(index + 1)}
|
|
||||||
>
|
|
||||||
{index + 1}
|
|
||||||
</button>
|
|
||||||
</li>
|
|
||||||
))}
|
|
||||||
</ul>
|
|
||||||
</nav>
|
|
||||||
</div>
|
|
||||||
)}
|
|
||||||
</div>
|
|
||||||
</>
|
|
||||||
);
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
const filteredData = recurringExpenseData.filter((item) =>
|
||||||
|
filterStatuses.includes(item?.status?.id)
|
||||||
|
);
|
||||||
|
|
||||||
|
const handleDelete = (id) => {
|
||||||
|
setDeletingId(id);
|
||||||
|
DeleteExpense(
|
||||||
|
{ id },
|
||||||
|
{
|
||||||
|
onSettled: () => {
|
||||||
|
setDeletingId(null);
|
||||||
|
setIsDeleteModalOpen(false);
|
||||||
|
},
|
||||||
|
}
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
return (
|
||||||
|
<>
|
||||||
|
{IsDeleteModalOpen && (
|
||||||
|
<ConfirmModal
|
||||||
|
isOpen={IsDeleteModalOpen}
|
||||||
|
type="delete"
|
||||||
|
header="Delete Recurring Expense"
|
||||||
|
message="Are you sure you want to delete?"
|
||||||
|
onSubmit={handleDelete}
|
||||||
|
onClose={() => setIsDeleteModalOpen(false)}
|
||||||
|
paramData={deletingId}
|
||||||
|
/>
|
||||||
|
)}
|
||||||
|
|
||||||
|
<div className="card page-min-h table-responsive px-sm-4">
|
||||||
|
<div className="card-datatable" id="payment-request-table">
|
||||||
|
<table className="table border-top dataTable text-nowrap align-middle">
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
{recurringExpenseColumns.map((col) => (
|
||||||
|
<th key={col.key} className={`sorting ${col.align}`}>
|
||||||
|
{col.label}
|
||||||
|
</th>
|
||||||
|
))}
|
||||||
|
<th className="text-center">Action</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
|
||||||
|
<tbody>
|
||||||
|
{filteredData.length > 0 ? (
|
||||||
|
filteredData.map((recurringExpense) => (
|
||||||
|
<tr
|
||||||
|
key={recurringExpense.id}
|
||||||
|
className="align-middle"
|
||||||
|
style={{ height: "50px" }}
|
||||||
|
>
|
||||||
|
{recurringExpenseColumns.map((col) => (
|
||||||
|
<td
|
||||||
|
key={col.key}
|
||||||
|
className={`d-table-cell ${col.align ?? ""} py-3`}
|
||||||
|
>
|
||||||
|
{col?.customRender
|
||||||
|
? col?.customRender(recurringExpense)
|
||||||
|
: col?.getValue(recurringExpense)}
|
||||||
|
</td>
|
||||||
|
))}
|
||||||
|
<td className="sticky-action-column bg-white">
|
||||||
|
<div className="d-flex justify-content-center gap-0">
|
||||||
|
<i
|
||||||
|
className="bx bx-show text-primary cursor-pointer"
|
||||||
|
// onClick={() =>
|
||||||
|
// setVieRequest({
|
||||||
|
// requestId: recurringExpense.id,
|
||||||
|
// view: true,
|
||||||
|
// })
|
||||||
|
// }
|
||||||
|
></i>
|
||||||
|
{/* Uncomment for edit/delete actions */}
|
||||||
|
|
||||||
|
<div className="dropdown z-2">
|
||||||
|
<button
|
||||||
|
type="button"
|
||||||
|
className="btn btn-xs btn-icon btn-text-secondary rounded-pill dropdown-toggle hide-arrow p-0 m-0"
|
||||||
|
data-bs-toggle="dropdown"
|
||||||
|
>
|
||||||
|
<i className="bx bx-dots-vertical-rounded text-muted p-0"></i>
|
||||||
|
</button>
|
||||||
|
<ul className="dropdown-menu dropdown-menu-end w-auto">
|
||||||
|
<li
|
||||||
|
onClick={() =>
|
||||||
|
setManageRequest({
|
||||||
|
IsOpen: true,
|
||||||
|
RecurringId: recurringExpense.id,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
>
|
||||||
|
<a className="dropdown-item px-2 cursor-pointer py-1">
|
||||||
|
<i className="bx bx-edit text-primary bx-xs me-2"></i>
|
||||||
|
Modify
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li
|
||||||
|
onClick={() => {
|
||||||
|
setIsDeleteModalOpen(true);
|
||||||
|
setDeletingId(recurringExpense.id);
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<a className="dropdown-item px-2 cursor-pointer py-1">
|
||||||
|
<i className="bx bx-trash text-danger bx-xs me-2"></i>
|
||||||
|
Delete
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
))
|
||||||
|
) : (
|
||||||
|
<tr>
|
||||||
|
<td
|
||||||
|
colSpan={recurringExpenseColumns.length + 1}
|
||||||
|
className="text-center border-0 py-8"
|
||||||
|
>
|
||||||
|
<p>No Recurring Expense Found</p>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
)}
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{/* Pagination */}
|
||||||
|
{totalPages > 1 && (
|
||||||
|
<div className="d-flex justify-content-end py-3 pe-3">
|
||||||
|
<nav>
|
||||||
|
<ul className="pagination mb-0">
|
||||||
|
{[...Array(totalPages)].map((_, index) => (
|
||||||
|
<li
|
||||||
|
key={index}
|
||||||
|
className={`page-item ${
|
||||||
|
currentPage === index + 1 ? "active" : ""
|
||||||
|
}`}
|
||||||
|
>
|
||||||
|
<button
|
||||||
|
className="page-link"
|
||||||
|
onClick={() => setCurrentPage(index + 1)}
|
||||||
|
>
|
||||||
|
{index + 1}
|
||||||
|
</button>
|
||||||
|
</li>
|
||||||
|
))}
|
||||||
|
</ul>
|
||||||
|
</nav>
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
|
</div>
|
||||||
|
</>
|
||||||
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
export default RecurringExpenseList;
|
export default RecurringExpenseList;
|
||||||
|
|||||||
@ -46,10 +46,10 @@ const ExpenseRepository = {
|
|||||||
//#endregion
|
//#endregion
|
||||||
|
|
||||||
//#region Recurring Expense
|
//#region Recurring Expense
|
||||||
GetRecurringExpenseList:(pageSize, pageNumber, filter, searchString) => {
|
GetRecurringExpenseList:(pageSize, pageNumber, filter,isActive, searchString) => {
|
||||||
const payloadJsonString = JSON.stringify(filter);
|
const payloadJsonString = JSON.stringify(filter);
|
||||||
return api.get(
|
return api.get(
|
||||||
`/api/expense/get/recurring-payment/list?pageSize=${pageSize}&pageNumber=${pageNumber}&filter=${payloadJsonString}&searchString=${searchString}`
|
`/api/expense/get/recurring-payment/list?pageSize=${pageSize}&pageNumber=${pageNumber}&filter=${payloadJsonString}&isActive=${isActive}&searchString=${searchString}`
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
CreateRecurringExpense: (data) =>
|
CreateRecurringExpense: (data) =>
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user