Skip to content

Commit cce0807

Browse files
committed
Now refreshing correctly
1 parent 9db215a commit cce0807

2 files changed

Lines changed: 11 additions & 6 deletions

File tree

patient-home-controler.js

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,8 @@ async function refresh() {
2525
const formApiEndpoint = getRequestFrormApiEndPoint();
2626
console.log('## formApiEndpoint:', formApiEndpoint);
2727
const formsInfo = await patientHomeLib.getForms(formApiEndpoint);
28-
showFormList(formsInfo)
28+
showFormList(formsInfo);
29+
showFormDetails(null);
2930
}
3031

3132
// ------- Get Dr's info -------- //
@@ -50,7 +51,7 @@ async function showFormList(formsInfo) {
5051

5152
for (const formInfo of formsInfo) {
5253
// fill the table row
53-
const row = table.insertRow(-1);
54+
const row = tbody.insertRow(-1);
5455
const cellQuestionnary = row.insertCell(-1);
5556
cellQuestionnary.innerHTML = `<button type="button" class="btn btn-secondary mb-sm">${formInfo.questionaryId}</button>`;
5657
cellQuestionnary.onclick = function () {
@@ -61,7 +62,7 @@ async function showFormList(formsInfo) {
6162
cellDr.innerHTML = formInfo.drUserId;
6263

6364
const cellStatus = row.insertCell(-1);
64-
cellStatus.innerHTML = formInfo.status;
65+
cellStatus.innerHTML = formInfo.statusLabel;
6566
}
6667
}
6768

patient-home-lib.js

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,11 @@ const AppBaseStreams = {
1515
rejected: {id: 'demo-dr-forms-rejected', name: 'Demo Dr Forms - Rejected', parentId: 'demo-dr-forms'},
1616
};
1717

18+
const StatusForStreamId = {
19+
[AppBaseStreams.inbox.id]: 'Incoming request',
20+
[AppBaseStreams.accepted.id]: 'Accepted',
21+
[AppBaseStreams.rejected.id]: 'Rejected',
22+
}
1823

1924
/**
2025
* Load app & get the forms
@@ -57,7 +62,6 @@ async function getForms (formApiEndpoint) {
5762
formsInfo.push(formInfo);
5863
}
5964

60-
6165
return formsInfo;
6266
}
6367

@@ -213,10 +217,10 @@ async function getQuestionnaryInfo (formEvent) {
213217
const questionaryId = drAccessInfo.clientData?.['demo-dr-form']?.questionaryId;
214218
const drUserId = drAccessInfo.user.username;
215219

216-
const status = formEvent.streamIds[0];
220+
const statusLabel = StatusForStreamId[formEvent.streamIds[0]];;
217221

218222
return {
219-
status,
223+
statusLabel,
220224
formApiEndpoint,
221225
questionaryId,
222226
drUserId,

0 commit comments

Comments
 (0)