Add htmx autocomplete and allow merging of conditions

This commit is contained in:
Ross
2023-11-13 13:23:33 +00:00
parent 366d36ba24
commit 15915ef5c0
8 changed files with 119 additions and 3 deletions
+23 -1
View File
@@ -56,12 +56,34 @@
<ul>
{% for diff in condition.differential_set.all %}
<li>{{diff.case.get_link}}</li>
<li>{{diff.case.get_link}} [{{diff.text}}]</li>
{% endfor %}
</ul>
{% endif %}
{% if not condition.rcr_curriculum %}
<details><summary>Merge</summary>
Merge this condition into another. This will transfer all associated cases (and differential) but will not transfer synonymns / parents or children.
<form method="POST">
{% csrf_token %}
<table>
{{ form.as_table }}
</table>
<button hx-post='{% url "atlas:condition_merge" condition.pk %}'
hx-target="#merge-options" hx-swap="innerHTML"
hx-confirm="This will merge {{condition.name}} into the selecetd condition, this cannot be undone. Continue?"
>
Merge
</button>
</form>
<div id="merge-options"></div>
</details>
{% endif %}
{% endblock %}
{% block js %}
@@ -0,0 +1,6 @@
{% for condition in conditions %}
<button id={{condition.pk}} class="option-button">{{condition.name}}</button>
{% endfor %}