Skip to content

Commit

Permalink
🔧 chore(ApeReportViewer.vue): remove unused code and improve data sou…
Browse files Browse the repository at this point in the history
…rce handling in input element generation

🔥 chore(ApeReportViewer.vue): remove commented out code for adding external stylesheet
The unused code for adding an external stylesheet has been removed. The input element generation has been improved to handle the data source. If the data source is "medical-records", the answer value is formatted using the matched token's format function. This ensures that the value displayed in the input element is consistent with the data source.
  • Loading branch information
jofftiquez committed Aug 16, 2023
1 parent 4074a20 commit 15728d6
Showing 1 changed file with 9 additions and 13 deletions.
22 changes: 9 additions & 13 deletions src/components/pme/ApeReportViewer.vue
Original file line number Diff line number Diff line change
Expand Up @@ -405,10 +405,17 @@ export default {
*/
if (!matchedToken?.readonly) {
const label = generateLabelFromId(value.id);
let element = `<input id="${value.id}" value="${value.answer}" placeholder="${label}" style="border-radius: 3px; border: 1px solid ${primaryColor}; margin-bottom: -3px; width: 120px; max-width: 200px;" />`;
// NOTE: What's the priority? The value from the encounter or the value from the data source?
let answer = value.answer;
if (matchedToken.dataSource === 'medical-records') {
answer = matchedToken.format(dataSource?.value);
}
let element = `<input id="${value.id}" value="${answer}" placeholder="${label}" style="border-radius: 3px; border: 1px solid ${primaryColor}; margin-bottom: -3px; width: 120px; max-width: 200px;" />`;
switch (matchedToken?.inputType) {
case 'textarea': {
element = `<textarea id="${value.id}" placeholder="${label}" rows="1" style="border-radius: 3px; border: 1px solid ${primaryColor}; height: 20px; margin-bottom: -3px; height: 35px; max-height: 35px; width: 120px; max-width: 300px;">${value.answer}</textarea>`;
element = `<textarea id="${value.id}" placeholder="${label}" rows="1" style="border-radius: 3px; border: 1px solid ${primaryColor}; height: 20px; margin-bottom: -3px; height: 35px; max-height: 35px; width: 120px; max-width: 300px;">${answer}</textarea>`;
}
}
report = report.replace(`{${value.id}}`, element);
Expand Down Expand Up @@ -470,17 +477,6 @@ export default {
return item || { choices: [] };
}
onMounted(() => {
// const link = document.createElement('link');
// link.setAttribute('rel', 'stylesheet');
// link.setAttribute('href', 'https://necolas.github.io/normalize.css/8.0.1/normalize.css');
// const paperView = document.getElementById('paper-view');
// console.warn('paperView', paperView);
// console.warn('link', link);
// paperView.appendChild(link);
// document.head.appendChild(link);
});
return {
apeEncounter,
apeReportCreatedAt,
Expand Down

0 comments on commit 15728d6

Please sign in to comment.