allow merging of examinations

This commit is contained in:
Ross
2023-07-03 11:10:50 +01:00
parent 1ade42d7ba
commit 6b5c3f8914
14 changed files with 178 additions and 39 deletions
@@ -16,27 +16,48 @@
<h3>Name: {{examination.examination}}</h3>
Modality: {{examination.modality}}
</div>
{% if examination.atlas_series_examination_set.all %}
<h4>Associated Atlas Cases</h4>
{% if examination.atlas_series_examination.all %}
<h4>Associated Atlas Series</h4>
<ul>
{% for case in examination.atlas_series_examination_set.all %}
<li>{{case}}</li>
{% for series in examination.atlas_series_examination.all %}
<li>{{series.get_link}}</li>
{% endfor %}
</ul>
{% endif %}
{% if examination.longs_series_examination_set.all %}
<h4>Associated Longs Cases</h4>
{% if examination.series_examination.all %}
<h4>Associated Longs Series</h4>
<ul>
{% for case in examination.longs_series_examination_set.all %}
<li>{{case}}</li>
{% for series in examination.series_examination.all %}
<li>{{series.get_link}}</li>
{% endfor %}
</ul>
{% endif %}
<details><summary>Merge</summary>
<form hx-post="{% url 'generic:examination_merge' examination.pk %}"
hx-headers='{"X-CSRFToken": "{{ csrf_token }}"}'
hx-confirm="Are you sure?"
hx-target="#result">
{{merge_form}}
<p>This will replace all occurances of the "{{examination}}" and with the selected examination and delete it.</p>
<p>It cannot be undone</p>
<button type="submit">
Merge
</button>
</form>
<section>
<p id="result"><em></em></p>
</section>
</details>
{% endblock %}
{% block js %}
@@ -0,0 +1,14 @@
{% if not form.is_valid %}
Please enter a number
{% elif examination_to_merge_into %}
{% if success %}
Merged into {{examination_to_merge_into}} successfully
{% else %}
There was an error merging into {{examination_to_merge_into}}
{% endif %}
{% else %}
Examination to merge into is invalid: {{examination_to_merge_into}}
{% endif %}