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
|
||||||
|
|||||||
@ -5,10 +5,7 @@ import {
|
|||||||
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";
|
||||||
@ -78,10 +75,8 @@ const RecurringExpenseList = ({ search, filterStatuses }) => {
|
|||||||
align: "text-start",
|
align: "text-start",
|
||||||
getValue: (e) => e?.status?.name || "N/A",
|
getValue: (e) => e?.status?.name || "N/A",
|
||||||
},
|
},
|
||||||
|
|
||||||
];
|
];
|
||||||
|
|
||||||
|
|
||||||
const [currentPage, setCurrentPage] = useState(1);
|
const [currentPage, setCurrentPage] = useState(1);
|
||||||
const debouncedSearch = useDebounce(search, 500);
|
const debouncedSearch = useDebounce(search, 500);
|
||||||
|
|
||||||
@ -177,7 +172,11 @@ const RecurringExpenseList = ({ search, filterStatuses }) => {
|
|||||||
<tbody>
|
<tbody>
|
||||||
{filteredData.length > 0 ? (
|
{filteredData.length > 0 ? (
|
||||||
filteredData.map((recurringExpense) => (
|
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) => (
|
{recurringExpenseColumns.map((col) => (
|
||||||
<td
|
<td
|
||||||
key={col.key}
|
key={col.key}
|
||||||
@ -235,7 +234,6 @@ const RecurringExpenseList = ({ search, filterStatuses }) => {
|
|||||||
Delete
|
Delete
|
||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
|
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@ -244,7 +242,10 @@ const RecurringExpenseList = ({ search, filterStatuses }) => {
|
|||||||
))
|
))
|
||||||
) : (
|
) : (
|
||||||
<tr>
|
<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>
|
<p>No Recurring Expense Found</p>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
@ -261,7 +262,9 @@ const RecurringExpenseList = ({ search, filterStatuses }) => {
|
|||||||
{[...Array(totalPages)].map((_, index) => (
|
{[...Array(totalPages)].map((_, index) => (
|
||||||
<li
|
<li
|
||||||
key={index}
|
key={index}
|
||||||
className={`page-item ${currentPage === index + 1 ? "active" : ""}`}
|
className={`page-item ${
|
||||||
|
currentPage === index + 1 ? "active" : ""
|
||||||
|
}`}
|
||||||
>
|
>
|
||||||
<button
|
<button
|
||||||
className="page-link"
|
className="page-link"
|
||||||
|
|||||||
@ -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