added optionalchail inside paymentRequest for prevent run time error
This commit is contained in:
parent
f5318c0a8d
commit
a161f87b82
@ -32,7 +32,7 @@ const MakeExpense = ({ onClose }) => {
|
|||||||
const files = watch("billAttachments");
|
const files = watch("billAttachments");
|
||||||
const onFileChange = async (e) => {
|
const onFileChange = async (e) => {
|
||||||
const newFiles = Array.from(e.target.files);
|
const newFiles = Array.from(e.target.files);
|
||||||
if (newFiles.length === 0) return;
|
if (newFiles?.length === 0) return;
|
||||||
|
|
||||||
const existingFiles = watch("billAttachments") || [];
|
const existingFiles = watch("billAttachments") || [];
|
||||||
|
|
||||||
@ -199,7 +199,7 @@ const MakeExpense = ({ onClose }) => {
|
|||||||
{errors.billAttachments.message}
|
{errors.billAttachments.message}
|
||||||
</small>
|
</small>
|
||||||
)}
|
)}
|
||||||
{files.length > 0 && (
|
{files?.length > 0 && (
|
||||||
<Filelist
|
<Filelist
|
||||||
files={files}
|
files={files}
|
||||||
removeFile={removeFile}
|
removeFile={removeFile}
|
||||||
|
|||||||
@ -75,12 +75,12 @@ function ManagePaymentRequest({ closeModal, requestToEdit = null }) {
|
|||||||
const files = watch("billAttachments");
|
const files = watch("billAttachments");
|
||||||
const onFileChange = async (e) => {
|
const onFileChange = async (e) => {
|
||||||
const newFiles = Array.from(e.target.files);
|
const newFiles = Array.from(e.target.files);
|
||||||
if (newFiles.length === 0) return;
|
if (newFiles?.length === 0) return;
|
||||||
|
|
||||||
const existingFiles = watch("billAttachments") || [];
|
const existingFiles = watch("billAttachments") || [];
|
||||||
|
|
||||||
const parsedFiles = await Promise.all(
|
const parsedFiles = await Promise.all(
|
||||||
newFiles.map(async (file) => {
|
newFiles?.map(async (file) => {
|
||||||
const base64Data = await toBase64(file);
|
const base64Data = await toBase64(file);
|
||||||
return {
|
return {
|
||||||
fileName: file.name,
|
fileName: file.name,
|
||||||
@ -175,7 +175,7 @@ function ManagePaymentRequest({ closeModal, requestToEdit = null }) {
|
|||||||
}, [data, reset]);
|
}, [data, reset]);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (!requestToEdit && currencyData && currencyData.length > 0) {
|
if (!requestToEdit && currencyData && currencyData?.length > 0) {
|
||||||
const inrCurrency = currencyData.find((c) => c.id === INR_CURRENCY_CODE);
|
const inrCurrency = currencyData.find((c) => c.id === INR_CURRENCY_CODE);
|
||||||
if (inrCurrency) {
|
if (inrCurrency) {
|
||||||
setValue("currencyId", INR_CURRENCY_CODE, { shouldValidate: true });
|
setValue("currencyId", INR_CURRENCY_CODE, { shouldValidate: true });
|
||||||
@ -480,7 +480,7 @@ function ManagePaymentRequest({ closeModal, requestToEdit = null }) {
|
|||||||
{errors.billAttachments.message}
|
{errors.billAttachments.message}
|
||||||
</small>
|
</small>
|
||||||
)}
|
)}
|
||||||
{files.length > 0 && (
|
{files?.length > 0 && (
|
||||||
<Filelist
|
<Filelist
|
||||||
files={files}
|
files={files}
|
||||||
removeFile={removeFile}
|
removeFile={removeFile}
|
||||||
|
|||||||
@ -79,7 +79,7 @@ const ViewPaymentRequest = ({ requestId }) => {
|
|||||||
? status.permissionIds
|
? status.permissionIds
|
||||||
: [];
|
: [];
|
||||||
|
|
||||||
if (permissionIds.length === 0) return true;
|
if (permissionIds?.length === 0) return true;
|
||||||
if (permissionIds.includes(PROCESS_EXPENSE)) {
|
if (permissionIds.includes(PROCESS_EXPENSE)) {
|
||||||
setIsPaymentProcess(true);
|
setIsPaymentProcess(true);
|
||||||
}
|
}
|
||||||
@ -393,7 +393,7 @@ const ViewPaymentRequest = ({ requestId }) => {
|
|||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
|
|
||||||
{Array.isArray(data?.nextStatus) && data?.nextStatus.length > 0 ? (
|
{Array.isArray(data?.nextStatus) && data?.nextStatus?.length > 0 ? (
|
||||||
<>
|
<>
|
||||||
{IsPaymentProcess && nextStatusWithPermission?.length > 0 && (
|
{IsPaymentProcess && nextStatusWithPermission?.length > 0 && (
|
||||||
<div className="row">
|
<div className="row">
|
||||||
@ -478,7 +478,7 @@ const ViewPaymentRequest = ({ requestId }) => {
|
|||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
<div className="col-12 mb-3 text-start">
|
<div className="col-12 mb-3 text-start">
|
||||||
{((nextStatusWithPermission.length > 0 &&
|
{((nextStatusWithPermission?.length > 0 &&
|
||||||
!isRejectedRequest) ||
|
!isRejectedRequest) ||
|
||||||
(isRejectedRequest && isCreatedBy)) && (
|
(isRejectedRequest && isCreatedBy)) && (
|
||||||
<>
|
<>
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user