fixed updated recurring
This commit is contained in:
parent
a253eea33c
commit
deda915e74
@ -55,7 +55,6 @@ const Filelist = ({ files, removeFile, expenseToEdit }) => {
|
|||||||
|
|
||||||
export default Filelist;
|
export default Filelist;
|
||||||
export const FilelistView = ({ files, viewFile }) => {
|
export const FilelistView = ({ files, viewFile }) => {
|
||||||
console.log( files)
|
|
||||||
return (
|
return (
|
||||||
<div className="d-flex flex-wrap gap-2 mt-2">
|
<div className="d-flex flex-wrap gap-2 mt-2">
|
||||||
{files?.map((file, idx) => (
|
{files?.map((file, idx) => (
|
||||||
|
|||||||
@ -224,7 +224,7 @@ const PaymentRequestList = ({ filters, groupBy = "submittedBy", search }) => {
|
|||||||
isOpen={IsDeleteModalOpen}
|
isOpen={IsDeleteModalOpen}
|
||||||
type="delete"
|
type="delete"
|
||||||
header="Delete Expense"
|
header="Delete Expense"
|
||||||
message="Are you sure you want delete?"
|
message="Under the woring?"
|
||||||
onSubmit={handleDelete}
|
onSubmit={handleDelete}
|
||||||
onClose={() => setIsDeleteModalOpen(false)}
|
onClose={() => setIsDeleteModalOpen(false)}
|
||||||
// loading={isPending}
|
// loading={isPending}
|
||||||
|
|||||||
@ -521,7 +521,7 @@ const ViewPaymentRequest = ({ requestId }) => {
|
|||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
</>
|
</>
|
||||||
) : !data?.isExpenseCreated ? (
|
) : (!data?.isExpenseCreated && ! data?.isAdvancePayment) ? (
|
||||||
<div className="text-end flex-wrap gap-2 my-2 mt-3">
|
<div className="text-end flex-wrap gap-2 my-2 mt-3">
|
||||||
<button
|
<button
|
||||||
className="btn btn-sm btn-primary"
|
className="btn btn-sm btn-primary"
|
||||||
|
|||||||
@ -1,29 +1,15 @@
|
|||||||
import React, { useEffect, useState } from "react";
|
import React, { useEffect, useState } from 'react'
|
||||||
import Label from "../common/Label";
|
import Label from '../common/Label';
|
||||||
import { Controller, useForm } from "react-hook-form";
|
import { Controller, useForm } from 'react-hook-form';
|
||||||
import {
|
import { useExpenseCategory, useRecurringStatus } from '../../hooks/masterHook/useMaster';
|
||||||
useExpenseCategory,
|
import DatePicker from '../common/DatePicker';
|
||||||
useRecurringStatus,
|
import { zodResolver } from '@hookform/resolvers/zod';
|
||||||
} from "../../hooks/masterHook/useMaster";
|
import { defaultRecurringExpense, PaymentRecurringExpense } from './RecurringExpenseSchema';
|
||||||
import DatePicker from "../common/DatePicker";
|
import { FREQUENCY_FOR_RECURRING, INR_CURRENCY_CODE } from '../../utils/constants';
|
||||||
import { zodResolver } from "@hookform/resolvers/zod";
|
import { useCurrencies, useProjectName } from '../../hooks/useProjects';
|
||||||
import {
|
import { useCreateRecurringExpense, usePayee, useRecurringExpenseDetail, useUpdateRecurringExpense } from '../../hooks/useExpense';
|
||||||
defaultRecurringExpense,
|
import InputSuggestions from '../common/InputSuggestion';
|
||||||
PaymentRecurringExpense,
|
import MultiEmployeeSearchInput from '../common/MultiEmployeeSearchInput';
|
||||||
} from "./RecurringExpenseSchema";
|
|
||||||
import {
|
|
||||||
FREQUENCY_FOR_RECURRING,
|
|
||||||
INR_CURRENCY_CODE,
|
|
||||||
} from "../../utils/constants";
|
|
||||||
import { useCurrencies, useProjectName } from "../../hooks/useProjects";
|
|
||||||
import {
|
|
||||||
useCreateRecurringExpense,
|
|
||||||
usePayee,
|
|
||||||
useRecurringExpenseDetail,
|
|
||||||
useUpdateRecurringExpense,
|
|
||||||
} from "../../hooks/useExpense";
|
|
||||||
import InputSuggestions from "../common/InputSuggestion";
|
|
||||||
import MultiEmployeeSearchInput from "../common/MultiEmployeeSearchInput";
|
|
||||||
|
|
||||||
function ManageRecurringExpense({ closeModal, requestToEdit = null }) {
|
function ManageRecurringExpense({ closeModal, requestToEdit = null }) {
|
||||||
const {
|
const {
|
||||||
@ -32,46 +18,15 @@ function ManageRecurringExpense({ closeModal, requestToEdit = null }) {
|
|||||||
isError,
|
isError,
|
||||||
error: requestError,
|
error: requestError,
|
||||||
} = useRecurringExpenseDetail(requestToEdit);
|
} = useRecurringExpenseDetail(requestToEdit);
|
||||||
|
|
||||||
//APIs
|
//APIs
|
||||||
const {
|
const { projectNames, loading: projectLoading, error, isError: isProjectError, } = useProjectName();
|
||||||
projectNames,
|
const { data: currencyData, isLoading: currencyLoading, isError: currencyError } = useCurrencies();
|
||||||
loading: projectLoading,
|
const { data: statusData, isLoading: statusLoading, isError: statusError } = useRecurringStatus();
|
||||||
error,
|
const { data: Payees, isLoading: isPayeeLoaing, isError: isPayeeError, error: payeeError } = usePayee()
|
||||||
isError: isProjectError,
|
const { ExpenseCategories, loading: ExpenseLoading, error: ExpenseError } = useExpenseCategory();
|
||||||
} = useProjectName();
|
|
||||||
const {
|
|
||||||
data: currencyData,
|
|
||||||
isLoading: currencyLoading,
|
|
||||||
isError: currencyError,
|
|
||||||
} = useCurrencies();
|
|
||||||
const {
|
|
||||||
data: statusData,
|
|
||||||
isLoading: statusLoading,
|
|
||||||
isError: statusError,
|
|
||||||
} = useRecurringStatus();
|
|
||||||
const {
|
|
||||||
data: Payees,
|
|
||||||
isLoading: isPayeeLoaing,
|
|
||||||
isError: isPayeeError,
|
|
||||||
error: payeeError,
|
|
||||||
} = usePayee();
|
|
||||||
const {
|
|
||||||
ExpenseCategories,
|
|
||||||
loading: ExpenseLoading,
|
|
||||||
error: ExpenseError,
|
|
||||||
} = useExpenseCategory();
|
|
||||||
|
|
||||||
const schema = PaymentRecurringExpense();
|
const schema = PaymentRecurringExpense();
|
||||||
const {
|
const { register, control, watch, handleSubmit, setValue, reset, formState: { errors }, } = useForm({
|
||||||
register,
|
|
||||||
control,
|
|
||||||
watch,
|
|
||||||
handleSubmit,
|
|
||||||
setValue,
|
|
||||||
reset,
|
|
||||||
formState: { errors },
|
|
||||||
} = useForm({
|
|
||||||
resolver: zodResolver(schema),
|
resolver: zodResolver(schema),
|
||||||
defaultValues: defaultRecurringExpense,
|
defaultValues: defaultRecurringExpense,
|
||||||
});
|
});
|
||||||
@ -80,13 +35,14 @@ function ManageRecurringExpense({ closeModal, requestToEdit = null }) {
|
|||||||
closeModal();
|
closeModal();
|
||||||
};
|
};
|
||||||
|
|
||||||
const { mutate: CreateRecurringExpense, isPending: createPending } =
|
const { mutate: CreateRecurringExpense, isPending: createPending } = useCreateRecurringExpense(
|
||||||
useCreateRecurringExpense(() => {
|
() => {
|
||||||
handleClose();
|
handleClose();
|
||||||
});
|
}
|
||||||
// const { mutate: PaymentRequestUpdate, isPending } = useUpdatePaymentRequest(() =>
|
);
|
||||||
// handleClose()
|
const { mutate: RecurringExpenseUpdate, isPending } = useUpdateRecurringExpense(() =>
|
||||||
// );
|
handleClose()
|
||||||
|
);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (requestToEdit && data) {
|
if (requestToEdit && data) {
|
||||||
@ -105,35 +61,40 @@ function ManageRecurringExpense({ closeModal, requestToEdit = null }) {
|
|||||||
statusId: data.statusId || "",
|
statusId: data.statusId || "",
|
||||||
frequency: data.frequency || "",
|
frequency: data.frequency || "",
|
||||||
isVariable: data.isVariable || false,
|
isVariable: data.isVariable || false,
|
||||||
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}, [data, reset]);
|
}, [data, reset]);
|
||||||
|
|
||||||
// console.log("Veer",data)
|
|
||||||
|
useEffect(() => {
|
||||||
|
if (!requestToEdit && currencyData && currencyData.length > 0) {
|
||||||
|
const inrCurrency = currencyData.find(
|
||||||
|
(c) => c.id === INR_CURRENCY_CODE
|
||||||
|
);
|
||||||
|
if (inrCurrency) {
|
||||||
|
setValue("currencyId", INR_CURRENCY_CODE, { shouldValidate: true });
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}, [currencyData, requestToEdit, setValue]);
|
||||||
|
|
||||||
const onSubmit = (fromdata) => {
|
const onSubmit = (fromdata) => {
|
||||||
let payload = {
|
let payload = {
|
||||||
...fromdata,
|
...fromdata,
|
||||||
// strikeDate: localToUtc(fromdata.strikeDate),
|
strikeDate: fromdata.strikeDate ? new Date(fromdata.strikeDate).toISOString() : null,
|
||||||
strikeDate: fromdata.strikeDate
|
|
||||||
? new Date(fromdata.strikeDate).toISOString()
|
|
||||||
: null,
|
|
||||||
};
|
};
|
||||||
if (requestToEdit) {
|
if (requestToEdit) {
|
||||||
const editPayload = { ...payload, id: data.id };
|
const editPayload = { ...payload, id: data.id };
|
||||||
PaymentRequestUpdate({ id: data.id, payload: editPayload });
|
RecurringExpenseUpdate({ id: data.id, payload: editPayload });
|
||||||
} else {
|
} else {
|
||||||
CreateRecurringExpense(payload);
|
CreateRecurringExpense(payload);
|
||||||
}
|
}
|
||||||
console.log("Kartik", payload);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="container p-3">
|
<div className="container p-3">
|
||||||
<h5 className="m-0">
|
<h5 className="m-0">
|
||||||
{requestToEdit
|
{requestToEdit ? "Update Expense Recurring " : "Create Expense Recurring"}
|
||||||
? "Update Expense Recurring "
|
|
||||||
: "Create Expense Recurring"}
|
|
||||||
</h5>
|
</h5>
|
||||||
<form id="expenseForm" onSubmit={handleSubmit(onSubmit)}>
|
<form id="expenseForm" onSubmit={handleSubmit(onSubmit)}>
|
||||||
{/* Project and Category */}
|
{/* Project and Category */}
|
||||||
@ -206,10 +167,31 @@ function ManageRecurringExpense({ closeModal, requestToEdit = null }) {
|
|||||||
placeholder="Enter title"
|
placeholder="Enter title"
|
||||||
/>
|
/>
|
||||||
{errors.title && (
|
{errors.title && (
|
||||||
<small className="danger-text">{errors.title.message}</small>
|
<small className="danger-text">
|
||||||
|
{errors.title.message}
|
||||||
|
</small>
|
||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
{/* <div className="col-md-6">
|
||||||
|
<Label htmlFor="isVariable" className="form-label" required>
|
||||||
|
Is Variable
|
||||||
|
</Label>
|
||||||
|
<select
|
||||||
|
id="isVariable"
|
||||||
|
className="form-select form-select-sm"
|
||||||
|
{...register("isVariable", {
|
||||||
|
setValueAs: (v) => v === "true" ? true : v === "false" ? false : false,
|
||||||
|
})}
|
||||||
|
>
|
||||||
|
<option value="false">False</option>
|
||||||
|
<option value="true">True</option>
|
||||||
|
</select>
|
||||||
|
{errors.isVariable && (
|
||||||
|
<small className="danger-text">{errors.isVariable.message}</small>
|
||||||
|
)}
|
||||||
|
</div> */}
|
||||||
|
|
||||||
<div className="col-md-6 mt-2">
|
<div className="col-md-6 mt-2">
|
||||||
<Label htmlFor="isVariable" className="form-label" required>
|
<Label htmlFor="isVariable" className="form-label" required>
|
||||||
Payment Type
|
Payment Type
|
||||||
@ -229,10 +211,7 @@ function ManageRecurringExpense({ closeModal, requestToEdit = null }) {
|
|||||||
checked={field.value === true}
|
checked={field.value === true}
|
||||||
onChange={() => field.onChange(true)}
|
onChange={() => field.onChange(true)}
|
||||||
/>
|
/>
|
||||||
<Label
|
<Label htmlFor="isVariableTrue" className="form-check-label">
|
||||||
htmlFor="isVariableTrue"
|
|
||||||
className="form-check-label"
|
|
||||||
>
|
|
||||||
Is Variable
|
Is Variable
|
||||||
</Label>
|
</Label>
|
||||||
</div>
|
</div>
|
||||||
@ -245,10 +224,7 @@ function ManageRecurringExpense({ closeModal, requestToEdit = null }) {
|
|||||||
checked={field.value === false}
|
checked={field.value === false}
|
||||||
onChange={() => field.onChange(false)}
|
onChange={() => field.onChange(false)}
|
||||||
/>
|
/>
|
||||||
<Label
|
<Label htmlFor="isVariableFalse" className="form-check-label">
|
||||||
htmlFor="isVariableFalse"
|
|
||||||
className="form-check-label"
|
|
||||||
>
|
|
||||||
Fixed
|
Fixed
|
||||||
</Label>
|
</Label>
|
||||||
</div>
|
</div>
|
||||||
@ -271,10 +247,12 @@ function ManageRecurringExpense({ closeModal, requestToEdit = null }) {
|
|||||||
name="strikeDate"
|
name="strikeDate"
|
||||||
control={control}
|
control={control}
|
||||||
minDate={new Date()}
|
minDate={new Date()}
|
||||||
className="w-100"
|
className='w-100'
|
||||||
/>
|
/>
|
||||||
{errors.strikeDate && (
|
{errors.strikeDate && (
|
||||||
<small className="danger-text">{errors.strikeDate.message}</small>
|
<small className="danger-text">
|
||||||
|
{errors.strikeDate.message}
|
||||||
|
</small>
|
||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@ -364,7 +342,6 @@ function ManageRecurringExpense({ closeModal, requestToEdit = null }) {
|
|||||||
<small className="danger-text">{errors.frequency.message}</small>
|
<small className="danger-text">{errors.frequency.message}</small>
|
||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div className="col-md-6">
|
<div className="col-md-6">
|
||||||
<Label htmlFor="statusId" className="form-label" required>
|
<Label htmlFor="statusId" className="form-label" required>
|
||||||
Status
|
Status
|
||||||
@ -375,14 +352,10 @@ function ManageRecurringExpense({ closeModal, requestToEdit = null }) {
|
|||||||
{...register("statusId")}
|
{...register("statusId")}
|
||||||
>
|
>
|
||||||
<option value="">Select Status</option>
|
<option value="">Select Status</option>
|
||||||
|
|
||||||
{statusLoading && <option>Loading...</option>}
|
{statusLoading && <option>Loading...</option>}
|
||||||
|
{!statusLoading && !statusError && statusData?.map((status) => (
|
||||||
{!currencyLoading &&
|
|
||||||
!currencyError &&
|
|
||||||
statusData?.map((status) => (
|
|
||||||
<option key={status.id} value={status.id}>
|
<option key={status.id} value={status.id}>
|
||||||
{`${status.name} `}
|
{status.name}
|
||||||
</option>
|
</option>
|
||||||
))}
|
))}
|
||||||
</select>
|
</select>
|
||||||
@ -408,9 +381,7 @@ function ManageRecurringExpense({ closeModal, requestToEdit = null }) {
|
|||||||
placeholder="Enter payment buffer days"
|
placeholder="Enter payment buffer days"
|
||||||
/>
|
/>
|
||||||
{errors.paymentBufferDays && (
|
{errors.paymentBufferDays && (
|
||||||
<small className="danger-text">
|
<small className="danger-text">{errors.paymentBufferDays.message}</small>
|
||||||
{errors.paymentBufferDays.message}
|
|
||||||
</small>
|
|
||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
<div className="col-md-6">
|
<div className="col-md-6">
|
||||||
@ -427,13 +398,32 @@ function ManageRecurringExpense({ closeModal, requestToEdit = null }) {
|
|||||||
placeholder="Enter number of iterations"
|
placeholder="Enter number of iterations"
|
||||||
/>
|
/>
|
||||||
{errors.numberOfIteration && (
|
{errors.numberOfIteration && (
|
||||||
<small className="danger-text">
|
<small className="danger-text">{errors.numberOfIteration.message}</small>
|
||||||
{errors.numberOfIteration.message}
|
|
||||||
</small>
|
|
||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
{/* Notify */}
|
||||||
|
{/* <div className="row my-2 text-start">
|
||||||
|
<div className="col-md-6">
|
||||||
|
<Label htmlFor="notifyTo" className="form-label" required>
|
||||||
|
Notify Employees
|
||||||
|
</Label>
|
||||||
|
<input
|
||||||
|
type="text"
|
||||||
|
id="notifyTo"
|
||||||
|
className="form-control form-control-sm"
|
||||||
|
{...register("notifyTo")}
|
||||||
|
|
||||||
|
/>
|
||||||
|
{errors.notifyTo && (
|
||||||
|
<small className="danger-text">
|
||||||
|
{errors.notifyTo.message}
|
||||||
|
</small>
|
||||||
|
)}
|
||||||
|
</div>
|
||||||
|
</div> */}
|
||||||
|
|
||||||
<div className="row my-2 text-start">
|
<div className="row my-2 text-start">
|
||||||
<div className="col-md-6">
|
<div className="col-md-6">
|
||||||
<Label htmlFor="notifyTo" className="form-label" required>
|
<Label htmlFor="notifyTo" className="form-label" required>
|
||||||
@ -478,13 +468,17 @@ function ManageRecurringExpense({ closeModal, requestToEdit = null }) {
|
|||||||
>
|
>
|
||||||
Cancel
|
Cancel
|
||||||
</button>
|
</button>
|
||||||
<button type="submit" className="btn btn-primary btn-sm mt-3">
|
<button
|
||||||
Submit
|
type="submit"
|
||||||
|
className="btn btn-primary btn-sm mt-3"
|
||||||
|
>
|
||||||
|
{createPending || isPending ? "Please wait...." : requestToEdit ? "Update":"Submit"}
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
);
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
export default ManageRecurringExpense;
|
export default ManageRecurringExpense
|
||||||
|
|
||||||
|
|||||||
@ -148,7 +148,7 @@ const RecurringExpenseList = ({ search, filterStatuses }) => {
|
|||||||
isOpen={IsDeleteModalOpen}
|
isOpen={IsDeleteModalOpen}
|
||||||
type="delete"
|
type="delete"
|
||||||
header="Delete Recurring Expense"
|
header="Delete Recurring Expense"
|
||||||
message="Are you sure you want to delete?"
|
message="Under the working"
|
||||||
onSubmit={handleDelete}
|
onSubmit={handleDelete}
|
||||||
onClose={() => setIsDeleteModalOpen(false)}
|
onClose={() => setIsDeleteModalOpen(false)}
|
||||||
paramData={deletingId}
|
paramData={deletingId}
|
||||||
@ -188,7 +188,7 @@ const RecurringExpenseList = ({ search, filterStatuses }) => {
|
|||||||
</td>
|
</td>
|
||||||
))}
|
))}
|
||||||
<td className="sticky-action-column bg-white">
|
<td className="sticky-action-column bg-white">
|
||||||
<div className="d-flex justify-content-center gap-0">
|
<div className="d-flex flex-row gap-2 gap-0">
|
||||||
<i
|
<i
|
||||||
className="bx bx-show text-primary cursor-pointer"
|
className="bx bx-show text-primary cursor-pointer"
|
||||||
// onClick={() =>
|
// onClick={() =>
|
||||||
@ -198,7 +198,6 @@ const RecurringExpenseList = ({ search, filterStatuses }) => {
|
|||||||
// })
|
// })
|
||||||
// }
|
// }
|
||||||
></i>
|
></i>
|
||||||
{/* Uncomment for edit/delete actions */}
|
|
||||||
|
|
||||||
<div className="dropdown z-2">
|
<div className="dropdown z-2">
|
||||||
<button
|
<button
|
||||||
@ -213,7 +212,7 @@ const RecurringExpenseList = ({ search, filterStatuses }) => {
|
|||||||
onClick={() =>
|
onClick={() =>
|
||||||
setManageRequest({
|
setManageRequest({
|
||||||
IsOpen: true,
|
IsOpen: true,
|
||||||
RecurringId: recurringExpense.id,
|
RecurringId: recurringExpense?.id,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
>
|
>
|
||||||
|
|||||||
@ -27,7 +27,7 @@ const Timeline = ({ items = [], transparent = true }) => {
|
|||||||
<div className="timeline-event">
|
<div className="timeline-event">
|
||||||
<div className="timeline-header mb-3 d-flex justify-content-between">
|
<div className="timeline-header mb-3 d-flex justify-content-between">
|
||||||
<h6 className="mb-0 text-body">{item.title}</h6>
|
<h6 className="mb-0 text-body">{item.title}</h6>
|
||||||
<small className="text-body-secondary"><Tooltip text={formatUTCToLocalTime(item.timeAgo,true)}>{moment(item.timeAgo).fromNow()}</Tooltip></small>
|
<small className="text-body-secondary"><Tooltip text={formatUTCToLocalTime(item.timeAgo,true)}>{moment.utc(item.timeAgo).local().fromNow()}</Tooltip></small>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{item.description && <p className="mb-2">{item.description}</p>}
|
{item.description && <p className="mb-2">{item.description}</p>}
|
||||||
|
|||||||
@ -492,7 +492,6 @@ export const useRecurringExpenseList = (
|
|||||||
return useQuery({
|
return useQuery({
|
||||||
queryKey: ["recurringExpenseList",pageSize,pageNumber,filter,isActive,searchString],
|
queryKey: ["recurringExpenseList",pageSize,pageNumber,filter,isActive,searchString],
|
||||||
queryFn: async()=>{
|
queryFn: async()=>{
|
||||||
debugger
|
|
||||||
const resp = await ExpenseRepository.GetRecurringExpenseList(pageSize,pageNumber,filter,isActive,searchString);
|
const resp = await ExpenseRepository.GetRecurringExpenseList(pageSize,pageNumber,filter,isActive,searchString);
|
||||||
return resp.data;
|
return resp.data;
|
||||||
},
|
},
|
||||||
@ -504,7 +503,6 @@ export const useRecurringExpenseDetail =(RequestId)=>{
|
|||||||
return useQuery({
|
return useQuery({
|
||||||
queryKey:['recurringExpense',RequestId],
|
queryKey:['recurringExpense',RequestId],
|
||||||
queryFn:async()=>{
|
queryFn:async()=>{
|
||||||
RequestId
|
|
||||||
const resp = await ExpenseRepository.GetRecurringExpense(RequestId);
|
const resp = await ExpenseRepository.GetRecurringExpense(RequestId);
|
||||||
return resp.data;
|
return resp.data;
|
||||||
},
|
},
|
||||||
|
|||||||
@ -19,7 +19,7 @@ export const useRecurringExpenseContext = () => {
|
|||||||
const RecurringExpensePage = () => {
|
const RecurringExpensePage = () => {
|
||||||
const [ManageRequest, setManageRequest] = useState({
|
const [ManageRequest, setManageRequest] = useState({
|
||||||
IsOpen: null,
|
IsOpen: null,
|
||||||
RequestId: null,
|
RecurringId: null,
|
||||||
});
|
});
|
||||||
const [ViewRequest, setVieRequest] = useState({ view: false, requestId: null })
|
const [ViewRequest, setVieRequest] = useState({ view: false, requestId: null })
|
||||||
|
|
||||||
@ -41,7 +41,6 @@ const RecurringExpensePage = () => {
|
|||||||
: [...prev, id]
|
: [...prev, id]
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<RecurringExpenseContext.Provider value={contextValue}>
|
<RecurringExpenseContext.Provider value={contextValue}>
|
||||||
<div className="container-fluid">
|
<div className="container-fluid">
|
||||||
@ -102,7 +101,7 @@ const RecurringExpensePage = () => {
|
|||||||
onClick={() =>
|
onClick={() =>
|
||||||
setManageRequest({
|
setManageRequest({
|
||||||
IsOpen: true,
|
IsOpen: true,
|
||||||
expenseId: null,
|
RecurringId: null,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
>
|
>
|
||||||
@ -118,7 +117,6 @@ const RecurringExpensePage = () => {
|
|||||||
|
|
||||||
<RecurringExpenseList filterStatuses={selectedStatuses} search={search} />
|
<RecurringExpenseList filterStatuses={selectedStatuses} search={search} />
|
||||||
|
|
||||||
{/* Add/Edit Modal */}
|
|
||||||
{ManageRequest.IsOpen && (
|
{ManageRequest.IsOpen && (
|
||||||
<GlobalModel
|
<GlobalModel
|
||||||
isOpen
|
isOpen
|
||||||
@ -128,11 +126,11 @@ const RecurringExpensePage = () => {
|
|||||||
}
|
}
|
||||||
>
|
>
|
||||||
<ManageRecurringExpense
|
<ManageRecurringExpense
|
||||||
key={ManageRequest.RequestId ?? "new"}
|
key={ManageRequest.RecurringId ?? "new"}
|
||||||
requestToEdit={ManageRequest.RequestId}
|
|
||||||
closeModal={() =>
|
closeModal={() =>
|
||||||
setManageRequest({ IsOpen: null, RequestId: null })
|
setManageRequest({ IsOpen: null, RecurringId: null })
|
||||||
}
|
}
|
||||||
|
requestToEdit={ManageRequest.RecurringId}
|
||||||
/>
|
/>
|
||||||
</GlobalModel>
|
</GlobalModel>
|
||||||
)}
|
)}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user