Refactor condition detail view for improved layout and styling
This commit is contained in:
@@ -1,96 +1,157 @@
|
||||
{% extends 'atlas/base.html' %}
|
||||
|
||||
{% block content %}
|
||||
|
||||
|
||||
|
||||
<div class="floating-header">
|
||||
<a href="{% url 'atlas:condition_update' pk=condition.pk %}" title="Edit the Condition">Edit</a>
|
||||
<a href="{% url 'atlas:condition_delete' pk=condition.pk %}" title="Delete the Condition">Delete</a>
|
||||
<div class="d-flex justify-content-between align-items-start mb-3">
|
||||
<h3 class="mb-0">{{ condition.name }}</h3>
|
||||
<div class="btn-group" role="group" aria-label="Condition actions">
|
||||
<a class="btn btn-sm btn-outline-primary" href="{% url 'atlas:condition_update' pk=condition.pk %}">Edit</a>
|
||||
<a class="btn btn-sm btn-outline-danger" href="{% url 'atlas:condition_delete' pk=condition.pk %}">Delete</a>
|
||||
{% if request.user.is_superuser %}
|
||||
<a href="{% url 'admin:atlas_condition_change' condition.id %}"
|
||||
title="Edit the Condition using the admin interface">Admin Edit</a>
|
||||
<a class="btn btn-sm btn-outline-secondary" href="{% url 'admin:atlas_condition_change' condition.id %}">Admin</a>
|
||||
{% endif %}
|
||||
</div>
|
||||
<div>
|
||||
<h3>Name: {{condition.name}}</h3>
|
||||
Primary name: {{condition.primary}}<br />
|
||||
Subspecialty: {% for sub in condition.subspecialty.all %}
|
||||
<a href="{{sub.get_absolute_url}}">{{sub}}</a>
|
||||
{% endfor %}<br />
|
||||
Synonyms:
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-lg-8">
|
||||
<section class="mb-3">
|
||||
<h5 class="mb-2">Details</h5>
|
||||
<dl class="row">
|
||||
<dt class="col-sm-4">Primary name</dt>
|
||||
<dd class="col-sm-8">{{ condition.primary }}</dd>
|
||||
|
||||
<dt class="col-sm-4">Subspecialty</dt>
|
||||
<dd class="col-sm-8">
|
||||
{% for sub in condition.subspecialty.all %}
|
||||
<a class="badge bg-dark text-white me-1 text-decoration-none" href="{{ sub.get_absolute_url }}">{{ sub }}</a>
|
||||
{% empty %}
|
||||
—
|
||||
{% endfor %}
|
||||
</dd>
|
||||
|
||||
<dt class="col-sm-4">Synonyms</dt>
|
||||
<dd class="col-sm-8">
|
||||
{% for syn in condition.synonym.all %}
|
||||
<a href="{{syn.get_absolute_url}}">{{syn}}</a>
|
||||
{% endfor %}<br />
|
||||
Parent:
|
||||
<a class="badge bg-secondary text-decoration-none text-white me-1" href="{{ syn.get_absolute_url }}">{{ syn }}</a>
|
||||
{% empty %}
|
||||
—
|
||||
{% endfor %}
|
||||
</dd>
|
||||
|
||||
<dt class="col-sm-4">Parent</dt>
|
||||
<dd class="col-sm-8">
|
||||
{% for parent in condition.parent.all %}
|
||||
<a href="{{parent.get_absolute_url}}">{{parent}}</a>
|
||||
{% endfor %}<br />
|
||||
Children:
|
||||
<a class="badge bg-primary text-white text-decoration-none me-1" href="{{ parent.get_absolute_url }}">{{ parent }}</a>
|
||||
{% empty %}
|
||||
—
|
||||
{% endfor %}
|
||||
</dd>
|
||||
|
||||
<dt class="col-sm-4">Children</dt>
|
||||
<dd class="col-sm-8">
|
||||
{% for child in condition.child.all %}
|
||||
<a href="{{child.get_absolute_url}}">{{child}}</a>
|
||||
{% endfor %}<br />
|
||||
RCR condition: {{condition.rcr_curriculum}}<br/>
|
||||
<a class="badge bg-info text-dark text-decoration-none me-1" href="{{ child.get_absolute_url }}">{{ child }}</a>
|
||||
{% empty %}
|
||||
—
|
||||
{% endfor %}
|
||||
</dd>
|
||||
|
||||
<dt class="col-sm-4">RCR condition</dt>
|
||||
<dd class="col-sm-8">{% if condition.rcr_curriculum %}Yes{% else %}No{% endif %}</dd>
|
||||
|
||||
{% if not condition.rcr_curriculum %}
|
||||
|
||||
RCR condition map:
|
||||
<dt class="col-sm-4">RCR condition map</dt>
|
||||
<dd class="col-sm-8">
|
||||
{% for map in condition.rcr_curriculum_map.all %}
|
||||
<a href="{{map.get_absolute_url}}">{{map}}</a>
|
||||
{% endfor %}<br />
|
||||
<a class="badge bg-success text-white text-decoration-none me-1" href="{{ map.get_absolute_url }}">{{ map }}</a>
|
||||
{% empty %}
|
||||
—
|
||||
{% endfor %}
|
||||
</dd>
|
||||
{% endif %}
|
||||
</dl>
|
||||
</section>
|
||||
|
||||
</div>
|
||||
{% if condition.case_set.all %}
|
||||
<h4>Associated Cases</h4>
|
||||
<ul>
|
||||
|
||||
{% if condition.case_set.exists %}
|
||||
<div class="card mb-3">
|
||||
<div class="card-body">
|
||||
<h5 class="card-title">Associated Cases</h5>
|
||||
<ul class="list-unstyled mb-0">
|
||||
{% for case in condition.case_set.all %}
|
||||
<li>{{case.get_link}}</li>
|
||||
<li class="mb-1">{{ case.get_link }}</li>
|
||||
{% endfor %}
|
||||
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
{% endif %}
|
||||
{% if condition.differential_set.all %}
|
||||
<h4>Associated Case Differentials</h4>
|
||||
<ul>
|
||||
|
||||
{% if condition.differential_set.exists %}
|
||||
<div class="card mb-3">
|
||||
<div class="card-body">
|
||||
<h5 class="card-title">Associated Case Differentials</h5>
|
||||
<ul class="list-unstyled mb-0">
|
||||
{% for diff in condition.differential_set.all %}
|
||||
<li>{{diff.case.get_link}} [{{diff.text}}]</li>
|
||||
<li class="mb-1">{{ diff.case.get_link }} <small class="text-muted">[{{ diff.text }}]</small></li>
|
||||
{% endfor %}
|
||||
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
{% if condition.sbas_questions.all %}
|
||||
<h4>Related SBA Questions</h4>
|
||||
<ul>
|
||||
{% if condition.sbas_questions.exists %}
|
||||
<div class="card mb-3">
|
||||
<div class="card-body">
|
||||
<h5 class="card-title">Related SBA Questions</h5>
|
||||
<ul class="list-unstyled mb-0">
|
||||
{% for q in condition.sbas_questions.all %}
|
||||
<li><a href="{{ q.get_absolute_url }}">{% if q.title %}{{ q.title }}{% else %}{{ q.get_stem_stripped|truncatechars:140 }}{% endif %}</a></li>
|
||||
<li class="mb-1"><a href="{{ q.get_absolute_url }}">{% if q.title %}{{ q.title }}{% else %}{{ q.get_stem_stripped|truncatechars:140 }}{% endif %}</a></li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
|
||||
{% if not condition.rcr_curriculum and can_merge %}
|
||||
<div class="card mb-3">
|
||||
<div class="card-body">
|
||||
<h5 class="card-title">Merge</h5>
|
||||
<p class="small text-muted">Merge this condition into another. This will transfer associated cases and differentials but will not transfer synonyms, parents or children.</p>
|
||||
|
||||
<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">
|
||||
<p>
|
||||
<a class="btn btn-sm btn-outline-primary" data-bs-toggle="collapse" href="#mergeCollapse" role="button" aria-expanded="false" aria-controls="mergeCollapse">Show merge form</a>
|
||||
</p>
|
||||
|
||||
<div class="collapse" id="mergeCollapse">
|
||||
<div class="card card-body">
|
||||
<form method="POST" id="condition-merge-form">
|
||||
{% csrf_token %}
|
||||
<table>
|
||||
{{ form.as_table }}
|
||||
</table>
|
||||
<button hx-post='{% url "atlas:condition_merge" condition.pk %}'
|
||||
<div class="mb-3">
|
||||
{{ form.as_p }}
|
||||
</div>
|
||||
<button class="btn btn-danger"
|
||||
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?"
|
||||
>
|
||||
hx-confirm="This will merge {{condition.name}} into the selected condition, this cannot be undone. Continue?">
|
||||
Merge
|
||||
</button>
|
||||
</form>
|
||||
<div id="merge-options"></div>
|
||||
</details>
|
||||
<div id="merge-options" class="mt-3"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{% endif %}
|
||||
</div>
|
||||
|
||||
<aside class="col-lg-4">
|
||||
<div class="card mb-3">
|
||||
<div class="card-body">
|
||||
<h6 class="card-subtitle mb-2 text-muted">Quick facts</h6>
|
||||
<p class="mb-0"><strong>Case count:</strong> {{ condition.case_set.count }}</p>
|
||||
</div>
|
||||
</div>
|
||||
</aside>
|
||||
</div>
|
||||
|
||||
{% endblock %}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user