Skip to content

Commit

Permalink
Re-implementation of response table.
Browse files Browse the repository at this point in the history
  • Loading branch information
mcjustin committed Jan 16, 2025
1 parent fa645ad commit 282e72e
Showing 1 changed file with 41 additions and 15 deletions.
56 changes: 41 additions & 15 deletions src/lib/components/resource-templates/QuestionnaireResponse.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -31,18 +31,44 @@ Authored: {resource.authored}
{/if}
{/if}

<table class="table table-bordered table-sm">
<thead>
<tr><th colspan="3">Responses</th></tr>
</thead>
{#each resource.item as item}
<tr>
<td>{item.text ?? ""}</td>
<td>
{#each item.item as subitem}
{subitem.text ?? ""}<br/>
{/each}
</td>
</tr>
{/each}
</table>
<table class="table table-bordered table-sm">
<thead>
<tr><th colspan="3">Responses</th></tr>
</thead>
<tbody>
{#each resource.item as item}
<tr>
<td>{item.text ?? "No text provided"}</td>
<td>
<!-- Render answers if present -->
{#if item.answer}
{#each item.answer as ans}
{ans.valueString ?? ans.valueCoding?.display ?? "No answer text"}<br/>
{/each}
{/if}
</td>
<td>
<!-- Nested subitems -->
{#if item.item}
<table class="table table-bordered table-sm">
<tbody>
{#each item.item as subitem}
<tr>
<td>{subitem.text ?? "No subitem text provided"}</td>
<td>
{#if subitem.answer}
{#each subitem.answer as subAns}
{subAns.valueString ?? subAns.valueCoding?.display ?? "No sub-answer text"}<br/>
{/each}
{/if}
</td>
</tr>
{/each}
</tbody>
</table>
{/if}
</td>
</tr>
{/each}
</tbody>
</table>

0 comments on commit 282e72e

Please sign in to comment.