@@ -34,13 +34,18 @@ function getRequestFrormApiEndPoint() {
3434// --------- Update form list --------- //
3535async function showFormList ( formsInfo ) {
3636 console . log ( '## showFormList' , formsInfo ) ;
37+
38+
39+ // -- table
3740 const table = document . getElementById ( 'questionnary-table' ) ;
41+
42+
3843 for ( const formInfo of formsInfo ) {
3944
4045 // fill the table row
4146 const row = table . insertRow ( - 1 ) ;
4247 const cellQuestionnary = row . insertCell ( - 1 ) ;
43- cellQuestionnary . innerHTML = formInfo . questionaryId ;
48+ cellQuestionnary . innerHTML = `<button type="button" class="btn btn-secondary mb-sm"> ${ formInfo . questionaryId } </button>` ;
4449 cellQuestionnary . onclick = function ( ) {
4550 showFormDetails ( formInfo ) ;
4651 } ;
@@ -61,10 +66,21 @@ async function showFormDetails(formInfo) {
6166 if ( ! show ) return ;
6267 const formDetails = await patientHomeLib . getQuestionnaryDetails ( formInfo ) ;
6368 console . log ( '## showFormDetails' , formDetails ) ;
69+
70+ // - form title
71+ const formTitle = document . getElementById ( 'card-questionnary-details-title' ) ;
72+ formTitle . innerHTML = formInfo . questionaryId ;
73+
6474 // - permissions
65- const table = document . getElementById ( 'access-request' ) ;
75+ const tbody = document . getElementById ( 'access-request' ) . getElementsByTagName ( 'tbody' ) [ 0 ] ; ;
76+
77+ // clear previous content
78+ while ( tbody . firstChild ) {
79+ tbody . removeChild ( tbody . firstChild ) ;
80+ }
81+
6682 for ( const permission of formDetails . permissions ) {
67- const row = table . insertRow ( - 1 ) ;
83+ const row = tbody . insertRow ( - 1 ) ;
6884 const cellStream = row . insertCell ( - 1 ) ;
6985 cellStream . innerHTML = permission . name ;
7086 const cellLevel = row . insertCell ( - 1 ) ;
@@ -92,6 +108,6 @@ async function showFormDetails(formInfo) {
92108 }
93109
94110 // - json
95- const jsonContent = document . getElementById ( 'card-questionnary-details-content' ) ;
96- jsonContent . innerHTML = '<pre>' + JSON . stringify ( formInfo . formEvent , null , 2 ) + '<pre>' ;
111+ // const jsonContent = document.getElementById('card-questionnary-details-content');
112+ // jsonContent.innerHTML = '<pre>' + JSON.stringify(formInfo.formEvent, null, 2) + '<pre>';
97113}
0 commit comments