diff --git a/src/components/PaymentRequest/ManagePaymentRequest.jsx b/src/components/PaymentRequest/ManagePaymentRequest.jsx index a1bf67c4..cdad5742 100644 --- a/src/components/PaymentRequest/ManagePaymentRequest.jsx +++ b/src/components/PaymentRequest/ManagePaymentRequest.jsx @@ -9,10 +9,11 @@ import { useCreatePaymentRequest, usePaymentRequestDetail, useUpdatePaymentReque import { zodResolver } from '@hookform/resolvers/zod'; import { formatFileSize, localToUtc } from '../../utils/appUtils'; import { defaultPaymentRequest, PaymentRequestSchema } from './PaymentRequestSchema'; +import { INR_CURRENCY_CODE } from '../../utils/constants'; function ManagePaymentRequest({ closeModal, requestToEdit = null }) { - const {data,isLoading,isError,error:requestError}= usePaymentRequestDetail(requestToEdit) -// const data = {} + const { data, isLoading, isError, error: requestError } = usePaymentRequestDetail(requestToEdit) + // const data = {} const { projectNames, loading: projectLoading, error, isError: isProjectError, } = useProjectName(); @@ -138,6 +139,17 @@ function ManagePaymentRequest({ closeModal, requestToEdit = null }) { } }, [data, reset]); + 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) => { let payload = { ...fromdata, @@ -158,6 +170,7 @@ function ManagePaymentRequest({ closeModal, requestToEdit = null }) { {requestToEdit ? "Update Payment Request " : "Create Payment Request"}
+ {/* Project and Category */}
+ {/* Title and Advance Payment */} +
+
+ + + {errors.title && ( + + {errors.title.message} + + )} +
+ +
+ + + {errors.isAdvancePayment && ( + {errors.isAdvancePayment.message} + )} +
+ + +
+ + + {/* Date and Amount */}
+ {/* Payee and Currency */}
-
-
- - - {errors.title && ( - - {errors.title.message} - - )} -
- -
- - - {errors.isAdvancePayment && ( - {errors.isAdvancePayment.message} - )} -
- - -
- + {/* Description */}
+ {/* Upload Document */}
diff --git a/src/components/PaymentRequest/PaymentRequestSchema.js b/src/components/PaymentRequest/PaymentRequestSchema.js index 927baa3b..07b21d0e 100644 --- a/src/components/PaymentRequest/PaymentRequestSchema.js +++ b/src/components/PaymentRequest/PaymentRequestSchema.js @@ -1,4 +1,5 @@ import { boolean, z } from "zod"; +import { INR_CURRENCY_CODE } from "../../utils/constants"; const MAX_FILE_SIZE = 5 * 1024 * 1024; // 5MB const ALLOWED_TYPES = [ "application/pdf", diff --git a/src/utils/constants.jsx b/src/utils/constants.jsx index 5a1f816d..0739e894 100644 --- a/src/utils/constants.jsx +++ b/src/utils/constants.jsx @@ -100,6 +100,7 @@ export const VERIFY_DOCUMENT = "13a1f30f-38d1-41bf-8e7a-b75189aab8e0"; // 1 - Expense Manage export const EXPENSE_MANAGEMENT = "a4e25142-449b-4334-a6e5-22f70e4732d7"; +export const INR_CURRENCY_CODE = "78e96e4a-7ce0-4164-ae3a-c833ad45ec2c"; export const TENANT_STATUS = [ { id: "62b05792-5115-4f99-8ff5-e8374859b191", name: "Active" },