Enhance case display with modal functionality for findings and display sets

This commit is contained in:
Ross
2026-02-09 10:33:06 +00:00
parent f316dc9bcb
commit 5761117e68
2 changed files with 116 additions and 106 deletions
+100 -104
View File
@@ -316,120 +316,116 @@
<!-- Series Findings --> <!-- Series Findings -->
<h5>Series Findings</h5> <h5>Series Findings</h5>
{% if case.ordered_series %} {% for series in case.ordered_series %}
{% for series in case.ordered_series %} {% for finding in series.findings.all %}
{% for finding in series.findings.all %} <div class="finding-box" id="finding-box-{{ finding.pk }}" data-series="{{ series.pk }}">
<div class="finding-box" id="finding-box-{{ finding.pk }}" data-series="{{ series.pk }}"> <span>
<a href="{{series.get_absolute_url}}?show_finding={{finding.pk}}">
<button class="btn btn-primary btn-sm">View</button>
</a>
<button class="btn btn-secondary btn-sm view-finding-modal" data-finding-id="{{ finding.pk }}" data-series-id="{{ series.pk }}">
View in Modal
</button>
</span>
{% if finding.findings %}
<span> <span>
<a href="{{series.get_absolute_url}}?show_finding={{finding.pk}}"> Findings: {% for f in finding.findings.all %}
<button class="btn btn-primary btn-sm">View</button> {{f.get_link}},&nbsp;
</a> {% endfor %}
<button class="btn btn-secondary btn-sm view-finding-modal" data-finding-id="{{ finding.pk }}" data-series-id="{{ series.pk }}">
View in Modal
</button>
</span> </span>
{% if finding.findings %} {% endif %}
<span> {% if finding.conditions %}
Findings: {% for f in finding.findings.all %} <span>
{{f.get_link}},&nbsp; Conditions: {% for c in finding.conditions.all %}
{% endfor %} {{c.get_link}},&nbsp;
</span> {% endfor %}
{% endif %} </span>
{% if finding.conditions %} {% endif %}
<span> {% if finding.structures %}
Conditions: {% for c in finding.conditions.all %} <span>
{{c.get_link}},&nbsp; Structure: {% for s in finding.structures.all %}
{% endfor %} {{s.get_link}},&nbsp;
</span> {% endfor %}
{% endif %} </span>
{% if finding.structures %} {% endif %}
<span> {% if finding.description %}
Structure: {% for s in finding.structures.all %} <span>
{{s.get_link}},&nbsp; Description: {{finding.description}}
{% endfor %} </span>
</span> {% endif %}
{% endif %} </div>
{% if finding.description %}
<span>
Description: {{finding.description}}
</span>
{% endif %}
</div>
{% endfor %}
{% endfor %} {% endfor %}
{% else %} {% empty%}
No series associated with case. No series associated with case.
{% endif %} {% endfor %}
<!-- Case Display Sets --> <!-- Case Display Sets -->
<h5 class="mt-3">Case Display Sets</h5> <h5 class="mt-3">Case Display Sets</h5>
{% if case.display_sets %} <ul class="list-group">
<ul class="list-group"> {% for ds in case.display_sets.all %}
{% for ds in case.display_sets.all %} <li class="list-group-item">
<li class="list-group-item"> <b>Name: {{ ds.name }}</b>
<b>Name: {{ ds.name }}</b> {% if ds.description %}
{% if ds.description %} <span class="text-muted">({{ ds.description }})</span>
<span class="text-muted">({{ ds.description }})</span> {% endif %}
<span>
<a href="{% url 'atlas:case_displaysets_detail' ds.pk %}">View Display Set</a>
<button type="button" class="btn btn-secondary btn-sm view-displayset-modal ms-2" data-ds-id="{{ ds.pk }}" data-url="{% url 'atlas:case_displaysets_modal' ds.pk %}">View in Modal</button>
</span>
<div>
<strong>Findings:</strong>
{% if ds.findings.all %}
<ul>
{% for finding in ds.findings.all %}
<li>{{ finding }}</li>
{% endfor %}
</ul>
{% else %}
<span class="text-muted">None</span>
{% endif %} {% endif %}
<span> </div>
<a href="{% url 'atlas:case_displaysets_detail' ds.pk %}">View Display Set</a> <div>
<button type="button" class="btn btn-secondary btn-sm view-displayset-modal ms-2" data-ds-id="{{ ds.pk }}" data-url="{% url 'atlas:case_displaysets_modal' ds.pk %}">View in Modal</button> <strong>Structures:</strong>
</span> {% if ds.structures.all %}
<div> <ul>
<strong>Findings:</strong> {% for structure in ds.structures.all %}
{% if ds.findings.all %} <li>{{ structure }}</li>
<ul> {% endfor %}
{% for finding in ds.findings.all %} </ul>
<li>{{ finding }}</li> {% else %}
{% endfor %} <span class="text-muted">None</span>
</ul> {% endif %}
{% else %} </div>
<span class="text-muted">None</span> <div>
{% endif %} <strong>Conditions:</strong>
</div> {% if ds.conditions.all %}
<div> <ul>
<strong>Structures:</strong> {% for condition in ds.conditions.all %}
{% if ds.structures.all %} <li>{{ condition }}</li>
<ul> {% endfor %}
{% for structure in ds.structures.all %} </ul>
<li>{{ structure }}</li> {% else %}
{% endfor %} <span class="text-muted">None</span>
</ul> {% endif %}
{% else %} </div>
<span class="text-muted">None</span> <div>
{% endif %} <details>
</div> <summary class="small text-muted" style="cursor:pointer;">Show advanced (viewer state & annotations)</summary>
<div> <div>
<strong>Conditions:</strong> <strong>Viewer State:</strong>
{% if ds.conditions.all %}
<ul>
{% for condition in ds.conditions.all %}
<li>{{ condition }}</li>
{% endfor %}
</ul>
{% else %}
<span class="text-muted">None</span>
{% endif %}
</div>
<div>
<details>
<summary class="small text-muted" style="cursor:pointer;">Show advanced (viewer state & annotations)</summary>
<div>
<strong>Viewer State:</strong>
<pre class="small">{{ ds.viewerstate|default:"{}" }}</pre> <pre class="small">{{ ds.viewerstate|default:"{}" }}</pre>
</div> </div>
<div> <div>
<strong>Annotations:</strong> <strong>Annotations:</strong>
<pre class="small">{{ ds.annotations|default:"{}" }}</pre> <pre class="small">{{ ds.annotations|default:"{}" }}</pre>
</div> </div>
</details> </details>
</div> </div>
</li> </li>
{% endfor %} {% empty %}
</ul> <span class="text-muted">No display sets for this case.</span>
{% else %} {% endfor %}
<span class="text-muted">No display sets for this case.</span> </ul>
{% endif %}
</details> </details>
</div> </div>
<div> <div>
@@ -6,14 +6,28 @@
{% endif %} {% endif %}
</div> </div>
{# Viewer area for the modal - mounted by rad/static/dv3d bundle #}
<div class="mb-3">
<div id="modal_viewer_{{ ds.pk }}" class="dicom-viewer-root" style="height:420px;" data-auto-cache-stack="false" data-annotationjson="{{ ds.annotations|escapejs }}" data-viewerstate="{{ ds.viewerstate|escapejs }}"></div>
</div>
{% if ds.viewerstate and ds.annotations %} {% if ds.viewerstate and ds.annotations %}
<div class="mb-3"> <div class="mb-3">
<button <button
type="button" type="button"
class="btn btn-primary" class="btn btn-primary"
onclick='importAnnotations_main_viewer({{ ds.annotations|safe }}); importViewerState_main_viewer({{ ds.viewerstate|safe }});' onclick='(window.importAnnotations_modal_viewer_{{ ds.pk }}||window.importAnnotations_modal_viewer||window.importAnnotations)({{ ds.annotations|safe }}); (window.importViewerState_modal_viewer_{{ ds.pk }}||window.importViewerState_modal_viewer||window.importViewerState)({{ ds.viewerstate|safe }});'
>Load into viewer</button> >Reload display set</button>
</div> </div>
<script>
(function(){
try{
if(typeof window.mountDicomViewers === 'function'){
window.mountDicomViewers();
}
}catch(e){console.warn('Failed to schedule modal viewer auto-load:', e)}
})();
</script>
{% endif %} {% endif %}
<div class="mt-2"> <div class="mt-2">