11import { drPatientLib } from "./dr-patient-view-lib.js" ;
2- import { exportCSVFile } from "./exportToCSV .js" ;
2+ import { exportXLSFile } from './exporToXLS .js' ;
33import { patientLib } from "./patient-lib.js" ;
44/**
55 * Based on
@@ -12,6 +12,8 @@ import { patientLib } from "./patient-lib.js";
1212
1313
1414let infos ;
15+ let username ;
16+ let qId ;
1517window . onload = async ( event ) => {
1618 const { patientApiEndpoint, questionaryId } = getRequestFrormApiEndPoint ( ) ;
1719 infos = await drPatientLib . setRefresh ( patientApiEndpoint , questionaryId , refresh )
@@ -22,8 +24,10 @@ window.onload = async (event) => {
2224 const formTitle = document . getElementById ( 'card-questionnary-details-title' ) ;
2325 formTitle . innerHTML = patientLib . getFormTitle ( questionaryId ) ;
2426
27+ qId = questionaryId ;
28+
2529 // -- set patient Id
26- const username = infos . user . username ;
30+ username = infos . user . username ;
2731 document . getElementById ( 'patient-label' ) . innerHTML = username ;
2832}
2933
@@ -43,8 +47,8 @@ const downloadHeaders = Object.assign({
4347
4448async function refresh ( lines ) {
4549 // -- set download button
46- document . getElementById ( 'button-download' ) . onclick = ( ) => {
47- exportCSVFile ( downloadHeaders , lines , username + '-' + questionaryId ) ;
50+ document . getElementById ( 'button-download' ) . onclick = async ( ) => {
51+ await exportXLSFile ( downloadHeaders , lines , username + '-' + qId ) ;
4852 } ;
4953
5054 // -- update table
0 commit comments