Hide “Advance Payment” Mode When Creating Expense After Payment Processed (Mobile & Web)
This commit is contained in:
parent
74e645a41e
commit
0b38196847
@ -40,6 +40,8 @@ const ActionPaymentRequest = ({ requestId }) => {
|
|||||||
error: PaymentModeError,
|
error: PaymentModeError,
|
||||||
} = usePaymentMode();
|
} = usePaymentMode();
|
||||||
|
|
||||||
|
console.log("Kartik", data)
|
||||||
|
|
||||||
const IsReview = useHasUserPermission(REVIEW_EXPENSE);
|
const IsReview = useHasUserPermission(REVIEW_EXPENSE);
|
||||||
const [imageLoaded, setImageLoaded] = useState({});
|
const [imageLoaded, setImageLoaded] = useState({});
|
||||||
|
|
||||||
@ -180,6 +182,16 @@ const ActionPaymentRequest = ({ requestId }) => {
|
|||||||
const newFiles = files.filter((_, i) => i !== index);
|
const newFiles = files.filter((_, i) => i !== index);
|
||||||
setValue("billAttachments", newFiles, { shouldValidate: true });
|
setValue("billAttachments", newFiles, { shouldValidate: true });
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const filteredPaymentModes = useMemo(() => {
|
||||||
|
return PaymentModes?.filter((mode) => {
|
||||||
|
if (mode.name === "Advance Payment" && data?.isAdvancePayment === false) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}) || [];
|
||||||
|
}, [PaymentModes, data]);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<form onSubmit={handleSubmit(onSubmit)}>
|
<form onSubmit={handleSubmit(onSubmit)}>
|
||||||
{IsPaymentProcess && nextStatusWithPermission?.length > 0 && (
|
{IsPaymentProcess && nextStatusWithPermission?.length > 0 && (
|
||||||
@ -224,7 +236,7 @@ const ActionPaymentRequest = ({ requestId }) => {
|
|||||||
{PaymentModeLoading ? (
|
{PaymentModeLoading ? (
|
||||||
<option disabled>Loading...</option>
|
<option disabled>Loading...</option>
|
||||||
) : (
|
) : (
|
||||||
PaymentModes?.map((payment) => (
|
filteredPaymentModes?.map((payment) => (
|
||||||
<option key={payment.id} value={payment.id}>
|
<option key={payment.id} value={payment.id}>
|
||||||
{payment.name}
|
{payment.name}
|
||||||
</option>
|
</option>
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user