Просмотр исходного кода

prepared 3 forms for demo

master
[email protected] 1 месяц назад
Родитель
Сommit
e920c45586
3 измененных файлов: 19 добавлений и 12 удалений
  1. +3
    -3
      src/pages/pdf/PdfSearchPage/PdfSearchForm.js
  2. +6
    -2
      src/pages/pdf/PdfViewer/index.js
  3. +10
    -7
      src/routes/ClientRoutes.js

+ 3
- 3
src/pages/pdf/PdfSearchPage/PdfSearchForm.js Просмотреть файл

@@ -86,15 +86,15 @@ const PdfSearchForm = ({applySearch, setExpanded,expanded, clientId}) => {
};

const createFormIDA = () => {
navigate(`/pdf/newIDA/-${clientId}T${1}`);
navigate(`/pdf/newIDA/${clientId}`);
};

const createFormFNA = () => {
navigate(`/pdf/newFNA/-${clientId}T${1}`);
navigate(`/pdf/newFNA/${clientId}`);
};

const createFormHSBCFIN = () => {
navigate(`/pdf/newHSBCFIN/-${clientId}T${1}`);
navigate(`/pdf/newHSBCFIN/${clientId}`);
};

const onSubmit = (data) => {


+ 6
- 2
src/pages/pdf/PdfViewer/index.js Просмотреть файл

@@ -1,7 +1,11 @@
import React, { useEffect, useRef, useState } from 'react';
import { useParams } from 'react-router-dom'; // Import useParams
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 [error, setError] = useState(null);

@@ -69,7 +73,7 @@ const PdfViewer = ({ pdfUrl, clientId, formCode }) => {
window.AdobeDC.View.Enum.CallbackType.SAVE_API,
async (metaData, content, options) => {
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('Authorization header:', `Bearer ${token}`);
const response = await fetch(saveUrl, {


+ 10
- 7
src/routes/ClientRoutes.js Просмотреть файл

@@ -6,7 +6,7 @@ import MainLayout from "../layout/MainLayout";
import {handleRouteAbility} from "../utils/CommonFunction";
import {Navigate} from "react-router";
import AbilityContext from "../components/AbilityProvider";
import { appURL, GET_PDF_PATH } from "../auth/utils";
import { apiPath, appURL, GET_PDF_PATH } from "../auth/utils";

// render - login
const ClientSearchPage = Loadable(lazy( () => import('pages/client/ClientSearchPage')));
@@ -80,7 +80,9 @@ const ClientRoutes =() => {
element: (
handleRouteAbility(
ability.can('VIEW', 'DASHBOARD'),
<PdfViewer pdfUrl={`${appURL}/pdf/IDA.pdf`} />,
<PdfViewer pdfUrl={`${apiPath}/pdf2/get?id=1`}
formCode='IDA'
/>,
<Navigate to="/" />
)
),
@@ -90,7 +92,9 @@ const ClientRoutes =() => {
element: (
handleRouteAbility(
ability.can('VIEW', 'DASHBOARD'),
<PdfViewer pdfUrl={`${appURL}/pdf/FNA.pdf`} />,
<PdfViewer pdfUrl={`${apiPath}/pdf2/get?id=2`}
formCode='FNA'
/>,
<Navigate to="/" />
)
),
@@ -101,12 +105,11 @@ const ClientRoutes =() => {
element: (
handleRouteAbility(
ability.can('VIEW', 'DASHBOARD'),
<PdfViewer
pdfUrl={`${appURL}/pdf/HSBCFIN.pdf`}
clientId='1'
<PdfViewer pdfUrl={`${apiPath}/pdf2/get?id=3`}
formCode='HSBCFIN'
/>,
/>,
<Navigate to="/" />
)
),
},


Загрузка…
Отмена
Сохранить