From 15728d67ba13448c92faa5d364b4b9a611210ef0 Mon Sep 17 00:00:00 2001 From: Joff Tiquez Date: Wed, 16 Aug 2023 18:57:27 +0800 Subject: [PATCH] =?UTF-8?q?=F0=9F=94=A7=20chore(ApeReportViewer.vue):=20re?= =?UTF-8?q?move=20unused=20code=20and=20improve=20data=20source=20handling?= =?UTF-8?q?=20in=20input=20element=20generation=20=F0=9F=94=A5=20chore(Ape?= =?UTF-8?q?ReportViewer.vue):=20remove=20commented=20out=20code=20for=20ad?= =?UTF-8?q?ding=20external=20stylesheet=20The=20unused=20code=20for=20addi?= =?UTF-8?q?ng=20an=20external=20stylesheet=20has=20been=20removed.=20The?= =?UTF-8?q?=20input=20element=20generation=20has=20been=20improved=20to=20?= =?UTF-8?q?handle=20the=20data=20source.=20If=20the=20data=20source=20is?= =?UTF-8?q?=20"medical-records",=20the=20answer=20value=20is=20formatted?= =?UTF-8?q?=20using=20the=20matched=20token's=20format=20function.=20This?= =?UTF-8?q?=20ensures=20that=20the=20value=20displayed=20in=20the=20input?= =?UTF-8?q?=20element=20is=20consistent=20with=20the=20data=20source.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/pme/ApeReportViewer.vue | 22 +++++++++------------- 1 file changed, 9 insertions(+), 13 deletions(-) diff --git a/src/components/pme/ApeReportViewer.vue b/src/components/pme/ApeReportViewer.vue index 9381d8c..97ab881 100644 --- a/src/components/pme/ApeReportViewer.vue +++ b/src/components/pme/ApeReportViewer.vue @@ -405,10 +405,17 @@ export default { */ if (!matchedToken?.readonly) { const label = generateLabelFromId(value.id); - let element = ``; + + // 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 = ``; switch (matchedToken?.inputType) { case 'textarea': { - element = ``; + element = ``; } } report = report.replace(`{${value.id}}`, element); @@ -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,