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
|
||||
.object({
|
||||
projectId: z.string().min(1, { message: "Project is required" }),
|
||||
expensesCategoryId: z
|
||||
expenseCategoryId: z
|
||||
.string()
|
||||
.min(1, { message: "Expense type is required" }),
|
||||
paymentModeId: z.string().min(1, { message: "Payment mode is required" }),
|
||||
@ -88,7 +88,7 @@ export const ExpenseSchema = (expenseTypes) => {
|
||||
|
||||
export const defaultExpense = {
|
||||
projectId: "",
|
||||
expensesCategoryId: "",
|
||||
expenseCategoryId: "",
|
||||
paymentModeId: "",
|
||||
paidById: "",
|
||||
transactionDate: "",
|
||||
|
||||
@ -153,7 +153,7 @@ const ManageExpense = ({ closeModal, expenseToEdit = null }) => {
|
||||
if (expenseToEdit && data) {
|
||||
reset({
|
||||
projectId: data.project.id || "",
|
||||
expensesCategoryId: data.expensesType.id || "",
|
||||
expenseCategoryId: data.expenseType.id || "",
|
||||
paymentModeId: data.paymentMode.id || "",
|
||||
paidById: data.paidBy.id || "",
|
||||
transactionDate: data.transactionDate?.slice(0, 10) || "",
|
||||
@ -247,13 +247,13 @@ const ManageExpense = ({ closeModal, expenseToEdit = null }) => {
|
||||
</div>
|
||||
|
||||
<div className="col-md-6">
|
||||
<Label htmlFor="expensesCategoryId" className="form-label" required>
|
||||
<Label htmlFor="expenseCategoryId" className="form-label" required>
|
||||
Expense Category
|
||||
</Label>
|
||||
<select
|
||||
className="form-select form-select-sm"
|
||||
id="expensesCategoryId"
|
||||
{...register("expensesCategoryId")}
|
||||
id="expenseCategoryId"
|
||||
{...register("expenseCategoryId")}
|
||||
>
|
||||
<option value="" disabled>
|
||||
Select Type
|
||||
|
||||
@ -5,10 +5,7 @@ import {
|
||||
FREQUENCY_FOR_RECURRING,
|
||||
ITEMS_PER_PAGE,
|
||||
} from "../../utils/constants";
|
||||
import {
|
||||
formatCurrency,
|
||||
useDebounce,
|
||||
} from "../../utils/appUtils";
|
||||
import { formatCurrency, useDebounce } from "../../utils/appUtils";
|
||||
import { formatUTCToLocalTime } from "../../utils/dateUtils";
|
||||
import { ExpenseTableSkeleton } from "../Expenses/ExpenseSkeleton";
|
||||
import ConfirmModal from "../common/ConfirmModal";
|
||||
@ -78,10 +75,8 @@ const RecurringExpenseList = ({ search, filterStatuses }) => {
|
||||
align: "text-start",
|
||||
getValue: (e) => e?.status?.name || "N/A",
|
||||
},
|
||||
|
||||
];
|
||||
|
||||
|
||||
const [currentPage, setCurrentPage] = useState(1);
|
||||
const debouncedSearch = useDebounce(search, 500);
|
||||
|
||||
@ -177,7 +172,11 @@ const RecurringExpenseList = ({ search, filterStatuses }) => {
|
||||
<tbody>
|
||||
{filteredData.length > 0 ? (
|
||||
filteredData.map((recurringExpense) => (
|
||||
<tr key={recurringExpense.id} className="align-middle" style={{ height: "50px" }}>
|
||||
<tr
|
||||
key={recurringExpense.id}
|
||||
className="align-middle"
|
||||
style={{ height: "50px" }}
|
||||
>
|
||||
{recurringExpenseColumns.map((col) => (
|
||||
<td
|
||||
key={col.key}
|
||||
@ -235,7 +234,6 @@ const RecurringExpenseList = ({ search, filterStatuses }) => {
|
||||
Delete
|
||||
</a>
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
@ -244,7 +242,10 @@ const RecurringExpenseList = ({ search, filterStatuses }) => {
|
||||
))
|
||||
) : (
|
||||
<tr>
|
||||
<td colSpan={recurringExpenseColumns.length + 1} className="text-center border-0 py-8">
|
||||
<td
|
||||
colSpan={recurringExpenseColumns.length + 1}
|
||||
className="text-center border-0 py-8"
|
||||
>
|
||||
<p>No Recurring Expense Found</p>
|
||||
</td>
|
||||
</tr>
|
||||
@ -261,7 +262,9 @@ const RecurringExpenseList = ({ search, filterStatuses }) => {
|
||||
{[...Array(totalPages)].map((_, index) => (
|
||||
<li
|
||||
key={index}
|
||||
className={`page-item ${currentPage === index + 1 ? "active" : ""}`}
|
||||
className={`page-item ${
|
||||
currentPage === index + 1 ? "active" : ""
|
||||
}`}
|
||||
>
|
||||
<button
|
||||
className="page-link"
|
||||
|
||||
@ -46,10 +46,10 @@ const ExpenseRepository = {
|
||||
//#endregion
|
||||
|
||||
//#region Recurring Expense
|
||||
GetRecurringExpenseList:(pageSize, pageNumber, filter, 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}&searchString=${searchString}`
|
||||
`/api/expense/get/recurring-payment/list?pageSize=${pageSize}&pageNumber=${pageNumber}&filter=${payloadJsonString}&isActive=${isActive}&searchString=${searchString}`
|
||||
);
|
||||
},
|
||||
CreateRecurringExpense: (data) =>
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user