| @@ -86,15 +86,15 @@ const PdfSearchForm = ({applySearch, setExpanded,expanded, clientId}) => { | |||||
| }; | }; | ||||
| const createFormIDA = () => { | const createFormIDA = () => { | ||||
| navigate(`/pdf/newIDA/-${clientId}T${1}`); | |||||
| navigate(`/pdf/newIDA/${clientId}`); | |||||
| }; | }; | ||||
| const createFormFNA = () => { | const createFormFNA = () => { | ||||
| navigate(`/pdf/newFNA/-${clientId}T${1}`); | |||||
| navigate(`/pdf/newFNA/${clientId}`); | |||||
| }; | }; | ||||
| const createFormHSBCFIN = () => { | const createFormHSBCFIN = () => { | ||||
| navigate(`/pdf/newHSBCFIN/-${clientId}T${1}`); | |||||
| navigate(`/pdf/newHSBCFIN/${clientId}`); | |||||
| }; | }; | ||||
| const onSubmit = (data) => { | const onSubmit = (data) => { | ||||
| @@ -1,7 +1,11 @@ | |||||
| import React, { useEffect, useRef, useState } from 'react'; | import React, { useEffect, useRef, useState } from 'react'; | ||||
| import { useParams } from 'react-router-dom'; // Import useParams | |||||
| import { apiPath, GET_PDF_PATH } from "../../../auth/utils"; | import { apiPath, GET_PDF_PATH } from "../../../auth/utils"; | ||||
| const PdfViewer = ({ pdfUrl, clientId, formCode }) => { | |||||
| const PdfViewer = ({ pdfUrl, formCode }) => { | |||||
| const { id } = useParams(); | |||||
| pdfUrl = pdfUrl + "&clientId=" + id; | |||||
| const viewerRef = useRef(null); | const viewerRef = useRef(null); | ||||
| const [error, setError] = useState(null); | const [error, setError] = useState(null); | ||||
| @@ -69,7 +73,7 @@ const PdfViewer = ({ pdfUrl, clientId, formCode }) => { | |||||
| window.AdobeDC.View.Enum.CallbackType.SAVE_API, | window.AdobeDC.View.Enum.CallbackType.SAVE_API, | ||||
| async (metaData, content, options) => { | async (metaData, content, options) => { | ||||
| try { | try { | ||||
| const saveUrl = `http://localhost:8090/api/pdf2/save-pdf?clientId=${encodeURIComponent(clientId)}&formCode=${encodeURIComponent(formCode)}`; | |||||
| const saveUrl = `http://localhost:8090/api/pdf2/save-pdf?clientId=${encodeURIComponent(id)}&formCode=${encodeURIComponent(formCode)}`; | |||||
| console.log('Saving to:', saveUrl); | console.log('Saving to:', saveUrl); | ||||
| console.log('Authorization header:', `Bearer ${token}`); | console.log('Authorization header:', `Bearer ${token}`); | ||||
| const response = await fetch(saveUrl, { | const response = await fetch(saveUrl, { | ||||
| @@ -6,7 +6,7 @@ import MainLayout from "../layout/MainLayout"; | |||||
| import {handleRouteAbility} from "../utils/CommonFunction"; | import {handleRouteAbility} from "../utils/CommonFunction"; | ||||
| import {Navigate} from "react-router"; | import {Navigate} from "react-router"; | ||||
| import AbilityContext from "../components/AbilityProvider"; | import AbilityContext from "../components/AbilityProvider"; | ||||
| import { appURL, GET_PDF_PATH } from "../auth/utils"; | |||||
| import { apiPath, appURL, GET_PDF_PATH } from "../auth/utils"; | |||||
| // render - login | // render - login | ||||
| const ClientSearchPage = Loadable(lazy( () => import('pages/client/ClientSearchPage'))); | const ClientSearchPage = Loadable(lazy( () => import('pages/client/ClientSearchPage'))); | ||||
| @@ -80,7 +80,9 @@ const ClientRoutes =() => { | |||||
| element: ( | element: ( | ||||
| handleRouteAbility( | handleRouteAbility( | ||||
| ability.can('VIEW', 'DASHBOARD'), | ability.can('VIEW', 'DASHBOARD'), | ||||
| <PdfViewer pdfUrl={`${appURL}/pdf/IDA.pdf`} />, | |||||
| <PdfViewer pdfUrl={`${apiPath}/pdf2/get?id=1`} | |||||
| formCode='IDA' | |||||
| />, | |||||
| <Navigate to="/" /> | <Navigate to="/" /> | ||||
| ) | ) | ||||
| ), | ), | ||||
| @@ -90,7 +92,9 @@ const ClientRoutes =() => { | |||||
| element: ( | element: ( | ||||
| handleRouteAbility( | handleRouteAbility( | ||||
| ability.can('VIEW', 'DASHBOARD'), | ability.can('VIEW', 'DASHBOARD'), | ||||
| <PdfViewer pdfUrl={`${appURL}/pdf/FNA.pdf`} />, | |||||
| <PdfViewer pdfUrl={`${apiPath}/pdf2/get?id=2`} | |||||
| formCode='FNA' | |||||
| />, | |||||
| <Navigate to="/" /> | <Navigate to="/" /> | ||||
| ) | ) | ||||
| ), | ), | ||||
| @@ -101,12 +105,11 @@ const ClientRoutes =() => { | |||||
| element: ( | element: ( | ||||
| handleRouteAbility( | handleRouteAbility( | ||||
| ability.can('VIEW', 'DASHBOARD'), | ability.can('VIEW', 'DASHBOARD'), | ||||
| <PdfViewer | |||||
| pdfUrl={`${appURL}/pdf/HSBCFIN.pdf`} | |||||
| clientId='1' | |||||
| <PdfViewer pdfUrl={`${apiPath}/pdf2/get?id=3`} | |||||
| formCode='HSBCFIN' | formCode='HSBCFIN' | ||||
| />, | |||||
| />, | |||||
| <Navigate to="/" /> | <Navigate to="/" /> | ||||
| ) | ) | ||||
| ), | ), | ||||
| }, | }, | ||||