Merge pull request 'Hide “Advance Payment” Mode When Creating Expense After Payment Processed (Mobile & Web)' (#509) from Kartik_Bug#1735 into Service_Project_Managment

Reviewed-on: #509
This commit is contained in:
Vikas Nale 2025-11-17 13:06:01 +00:00
commit 36be17daa7

View File

@ -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({});
@ -175,6 +177,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 && (
@ -219,7 +231,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>