diff --git a/src/layout/MainLayout/Header/index.js b/src/layout/MainLayout/Header/index.js index c39c03a..a9b80fb 100644 --- a/src/layout/MainLayout/Header/index.js +++ b/src/layout/MainLayout/Header/index.js @@ -43,6 +43,8 @@ import Profile from './HeaderContent/Profile'; import "assets/style/navbarStyles.css"; import { isUserLoggedIn, isGLDLoggedIn, isPrimaryLoggedIn } from "utils/Utils"; import { handleLogoutFunction } from 'auth/index'; +import * as HttpUtils from "utils/HttpUtils"; +import * as UrlUtils from "utils/ApiPathConst" // assets // import { MenuFoldOutlined,MenuOutlined } from '@ant-design/icons'; @@ -70,6 +72,34 @@ function Header(props) { navigate('/login'); }; + const getXML = () => () => { + HttpUtils.get({ + url: UrlUtils.GEN_GFMIS_XML + "/today?online=true", + params:{}, + onSuccess: (responseData) => { + console.log(responseData) + const parser = new DOMParser(); + const xmlDoc = parser.parseFromString(responseData, 'application/xml'); + const filename = xmlDoc.querySelector('FileHeader').getAttribute('H_Filename'); + const blob = new Blob([responseData], { type: 'application/xml' }); + // Create a download link + const link = document.createElement('a'); + link.href = URL.createObjectURL(blob); + link.download = filename+'.xml'; + + // Append the link to the document body + document.body.appendChild(link); + + // Programmatically click the link to trigger the download + link.click(); + + // Clean up the link + document.body.removeChild(link); + } + }); + // open(UrlUtils.GEN_GFMIS_XML + "/today?online=true") + } + const loginContent = ( isGLDLoggedIn() ?
@@ -83,7 +113,15 @@ function Header(props) { Proof
  • - Payment + Payment +
      +
    • + Payment Record +
    • +
    • + Download XML +
    • +
  • Client diff --git a/src/utils/ApiPathConst.js b/src/utils/ApiPathConst.js index fa2aef1..3642576 100644 --- a/src/utils/ApiPathConst.js +++ b/src/utils/ApiPathConst.js @@ -112,4 +112,7 @@ export const GET_SMART_LOGIN = apiPath+'/smart/login'; //POST //gen report -export const GEN_GAZETTE_PROOF = apiPath+'/proof/gazetteProof'; //POST \ No newline at end of file +export const GEN_GAZETTE_PROOF = apiPath+'/proof/gazetteProof'; //POST + +//gen report +export const GEN_GFMIS_XML = apiPath+'/gfmis'; //GET \ No newline at end of file