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 onFileChange = async (e) => {
|
||||
const newFiles = Array.from(e.target.files);
|
||||
if (newFiles.length === 0) return;
|
||||
if (newFiles?.length === 0) return;
|
||||
|
||||
const existingFiles = watch("billAttachments") || [];
|
||||
|
||||
@ -199,7 +199,7 @@ const MakeExpense = ({ onClose }) => {
|
||||
{errors.billAttachments.message}
|
||||
</small>
|
||||
)}
|
||||
{files.length > 0 && (
|
||||
{files?.length > 0 && (
|
||||
<Filelist
|
||||
files={files}
|
||||
removeFile={removeFile}
|
||||
|
||||
@ -75,12 +75,12 @@ function ManagePaymentRequest({ closeModal, requestToEdit = null }) {
|
||||
const files = watch("billAttachments");
|
||||
const onFileChange = async (e) => {
|
||||
const newFiles = Array.from(e.target.files);
|
||||
if (newFiles.length === 0) return;
|
||||
if (newFiles?.length === 0) return;
|
||||
|
||||
const existingFiles = watch("billAttachments") || [];
|
||||
|
||||
const parsedFiles = await Promise.all(
|
||||
newFiles.map(async (file) => {
|
||||
newFiles?.map(async (file) => {
|
||||
const base64Data = await toBase64(file);
|
||||
return {
|
||||
fileName: file.name,
|
||||
@ -175,7 +175,7 @@ function ManagePaymentRequest({ closeModal, requestToEdit = null }) {
|
||||
}, [data, reset]);
|
||||
|
||||
useEffect(() => {
|
||||
if (!requestToEdit && currencyData && currencyData.length > 0) {
|
||||
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 });
|
||||
@ -480,7 +480,7 @@ function ManagePaymentRequest({ closeModal, requestToEdit = null }) {
|
||||
{errors.billAttachments.message}
|
||||
</small>
|
||||
)}
|
||||
{files.length > 0 && (
|
||||
{files?.length > 0 && (
|
||||
<Filelist
|
||||
files={files}
|
||||
removeFile={removeFile}
|
||||
|
||||
@ -79,7 +79,7 @@ const ViewPaymentRequest = ({ requestId }) => {
|
||||
? status.permissionIds
|
||||
: [];
|
||||
|
||||
if (permissionIds.length === 0) return true;
|
||||
if (permissionIds?.length === 0) return true;
|
||||
if (permissionIds.includes(PROCESS_EXPENSE)) {
|
||||
setIsPaymentProcess(true);
|
||||
}
|
||||
@ -393,7 +393,7 @@ const ViewPaymentRequest = ({ requestId }) => {
|
||||
</div>
|
||||
)}
|
||||
|
||||
{Array.isArray(data?.nextStatus) && data?.nextStatus.length > 0 ? (
|
||||
{Array.isArray(data?.nextStatus) && data?.nextStatus?.length > 0 ? (
|
||||
<>
|
||||
{IsPaymentProcess && nextStatusWithPermission?.length > 0 && (
|
||||
<div className="row">
|
||||
@ -478,7 +478,7 @@ const ViewPaymentRequest = ({ requestId }) => {
|
||||
</div>
|
||||
)}
|
||||
<div className="col-12 mb-3 text-start">
|
||||
{((nextStatusWithPermission.length > 0 &&
|
||||
{((nextStatusWithPermission?.length > 0 &&
|
||||
!isRejectedRequest) ||
|
||||
(isRejectedRequest && isCreatedBy)) && (
|
||||
<>
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user