fixed itself - payeee issue ( not submitting form after checkin-uncheck check-box)
This commit is contained in:
parent
25a599e614
commit
492f483f5e
@ -18,9 +18,9 @@ import {
|
||||
PaymentRequestSchema,
|
||||
} from "./PaymentRequestSchema";
|
||||
import { INR_CURRENCY_CODE } from "../../utils/constants";
|
||||
import { useProfile } from "../../hooks/useProfile";
|
||||
import Filelist from "../Expenses/Filelist";
|
||||
import InputSuggestions from "../common/InputSuggestion";
|
||||
import { useProfile } from "../../hooks/useProfile";
|
||||
|
||||
function ManagePaymentRequest({ closeModal, requestToEdit = null }) {
|
||||
const {
|
||||
@ -30,6 +30,7 @@ function ManagePaymentRequest({ closeModal, requestToEdit = null }) {
|
||||
error: requestError,
|
||||
} = usePaymentRequestDetail(requestToEdit);
|
||||
|
||||
const { profile } = useProfile();
|
||||
const {
|
||||
projectNames,
|
||||
loading: projectLoading,
|
||||
@ -49,7 +50,6 @@ function ManagePaymentRequest({ closeModal, requestToEdit = null }) {
|
||||
error: ExpenseError,
|
||||
} = useExpenseCategory();
|
||||
|
||||
|
||||
const {
|
||||
data: Payees,
|
||||
isLoading: isPayeeLoaing,
|
||||
@ -187,13 +187,17 @@ function ManagePaymentRequest({ closeModal, requestToEdit = null }) {
|
||||
let payload = {
|
||||
...fromdata,
|
||||
dueDate: localToUtc(fromdata.dueDate),
|
||||
payee: isItself ? `${profile?.employeeInfo?.firstName} ${profile?.employeeInfo?.lastName}` : fromdata.payee,
|
||||
payee: isItself
|
||||
? `${profile?.employeeInfo?.firstName} ${profile?.employeeInfo?.lastName}`
|
||||
: fromdata.payee,
|
||||
};
|
||||
if (requestToEdit) {
|
||||
const editPayload = {
|
||||
...payload,
|
||||
id: data.id,
|
||||
payee: isItself ? `${profile?.employeeInfo?.firstName} ${profile?.employeeInfo?.lastName}` : fromdata.payee,
|
||||
payee: isItself
|
||||
? `${profile?.employeeInfo?.firstName} ${profile?.employeeInfo?.lastName}`
|
||||
: fromdata.payee,
|
||||
};
|
||||
PaymentRequestUpdate({ id: data.id, payload: editPayload });
|
||||
} else {
|
||||
@ -202,14 +206,10 @@ function ManagePaymentRequest({ closeModal, requestToEdit = null }) {
|
||||
};
|
||||
const handleSetItSelf = (e) => {
|
||||
setisItself(e.target.value);
|
||||
let name = `${profile?.employeeInfo.firstName} ${profile?.employeeInfo.lastName}`
|
||||
let name = `${profile?.employeeInfo.firstName} ${profile?.employeeInfo.lastName}`;
|
||||
|
||||
setValue(
|
||||
"payee",
|
||||
name
|
||||
);
|
||||
setValue("payee", name);
|
||||
};
|
||||
|
||||
return (
|
||||
<div className="container p-3">
|
||||
<h5 className="m-0">
|
||||
@ -309,11 +309,7 @@ function ManagePaymentRequest({ closeModal, requestToEdit = null }) {
|
||||
checked={field.value === true}
|
||||
onChange={() => field.onChange(true)} // send boolean true
|
||||
/>
|
||||
<Label
|
||||
className="form-check-label"
|
||||
>
|
||||
Yes
|
||||
</Label>
|
||||
<Label className="form-check-label">Yes</Label>
|
||||
</div>
|
||||
|
||||
<div className="form-check d-flex flex-row m-0 gap-2">
|
||||
@ -324,11 +320,7 @@ function ManagePaymentRequest({ closeModal, requestToEdit = null }) {
|
||||
checked={field.value === false}
|
||||
onChange={() => field.onChange(false)} // send boolean false
|
||||
/>
|
||||
<Label
|
||||
className="form-check-label"
|
||||
>
|
||||
No
|
||||
</Label>
|
||||
<Label className="form-check-label">No</Label>
|
||||
</div>
|
||||
</div>
|
||||
)}
|
||||
@ -392,7 +384,6 @@ function ManagePaymentRequest({ closeModal, requestToEdit = null }) {
|
||||
error={errors.payee?.message}
|
||||
/>
|
||||
|
||||
|
||||
{/* Checkbox below input */}
|
||||
<div className="form-check mt-2">
|
||||
<input
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user