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() ?