Skip to content

Commit

Permalink
fix html id
Browse files Browse the repository at this point in the history
  • Loading branch information
erikvw committed Jan 22, 2019
1 parent d0df3fc commit 177f479
Show file tree
Hide file tree
Showing 5 changed files with 37 additions and 16 deletions.
@@ -0,0 +1,11 @@
<!-- BEGIN appointment status -->
{% if appt_status == NEW_APPT %}
<i class="far fa-star fa-fw" aria-hidden="true" data-toggle="tooltip" title="New"></i>
{% elif appt_status == IN_PROGRESS_APPT%}
<i class="fas fa-spinner fa-fw" aria-hidden="true" data-toggle="tooltip" title="In progress"></i>
{% elif appt_status == INCOMPLETE_APPT %}
<i class="fas fa-star-half fa-fw" aria-hidden="true" data-toggle="tooltip" title="Incomplete"></i>
{% elif appt_status == COMPLETE_APPT %}
<i class="fas fa-star fa-fw" aria-hidden="true" data-toggle="tooltip" title="Complete"></i>
{% endif %}
<!-- END appointment status -->
Expand Up @@ -9,15 +9,7 @@
<tr>
<td><i class="far fa-calendar fa-sm fa-fw"></i> {{wrapped.visit_code}}{% if wrapped.visit_code_sequence %}.{{wrapped.visit_code_sequence}}{% endif %}</td>
<td>
{% if wrapped.appt_status == NEW_APPT %}
<i class="far fa-star fa-fw" aria-hidden="true" data-toggle="tooltip" title="New"></i>
{% elif wrapped.appt_status == IN_PROGRESS_APPT%}
<i class="fas fa-spinner fa-fw" aria-hidden="true" data-toggle="tooltip" title="In progress"></i>
{% elif wrapped.appt_status == INCOMPLETE_APPT %}
<i class="fas fa-star-half fa-fw" aria-hidden="true" data-toggle="tooltip" title="Incomplete"></i>
{% elif wrapped.appt_status == COMPLETE_APPT %}
<i class="fas fa-star fa-fw" aria-hidden="true" data-toggle="tooltip" title="Complete"></i>
{% endif %}
{% appointment_status_icon appt_status=wrapped.appt_status %}
{% if wrapped.appt_status != COMPLETE_APPT %}
<a id="appointment_btn_{{ wrapped.visit_code }}_{{ wrapped.visit_code_sequence }}" role="button" class="btn btn-sm btn-default {% if wrapped.appt_status != IN_PROGRESS_APPT %}disabled{% endif %}"
href="{% if perms.edc_appointment.view_appointment %}{{ wrapped.href }}{% else %}#{% endif %}"
Expand Down
Expand Up @@ -60,13 +60,16 @@

<span class="btn-group pull-right">
{% if requisition.entry_status != NOT_REQUIRED %}
<a id="{{ requisition.object.html_id }}" name="{{ requisition.object.html_id }}" role="button" class="btn btn-sm {% if requisition.entry_status == KEYED %}btn-success{% else %}{% if requisition.entry_status == NOT_REQUIRED %} disabled btn-default{% else %}btn-warning{% endif %}{% endif %}"
<a role="button" class="btn btn-sm {% if requisition.entry_status == KEYED %}btn-success{% else %}{% if requisition.entry_status == NOT_REQUIRED %} disabled btn-default{% else %}btn-warning{% endif %}{% endif %}"
{% if requisition.entry_status == KEYED and requisition.object.has_change_permission %}
id="change-{{ requisition.object.panel.name }}" href="{{ requisition.object.href }}"><span class="fas fa-pencil-alt fa-fw"></span> Change
id="{{ requisition.object.html_id }}" name="{{ requisition.object.html_id }}"
href="{{ requisition.object.href }}"><span class="fas fa-pencil-alt fa-fw"></span> Change
{% elif requisition.entry_status != KEYED and requisition.object.has_add_permission %}
id="add-{{ requisition.object.panel.name }}" href="{{ requisition.object.href }}"><span class="fas fa-plus fa-fw"></span> Add
id="add-{{requisition.panel_name}}"
href="{{ requisition.object.href }}"><span class="fas fa-plus fa-fw"></span> Add
{% elif requisition.entry_status == KEYED and requisition.object.has_view_permission %}
id="view-{{ requisition.object.panel.name }}" href="{{ requisition.object.href }}"><span class="fas fa-eye fa-fw"></span> View
id="{{ requisition.object.html_id }}" name="{{ requisition.object.html_id }}"
href="{{ requisition.object.href }}"><span class="fas fa-eye fa-fw"></span> View
{% else %}
disabled >{% if requisition.entry_status == KEYED %}<span class="fas fa-pen"></span> Change{% else %}<span class="fas fa-plus"></span> Add{% endif %}
{% endif %}
Expand Down
Expand Up @@ -2,6 +2,7 @@

{% load edc_base_extras %}
{% load edc_dashboard_extras %}
{% load edc_subject_dashboard_extras %}
{% load tz %}
{% load static %}

Expand Down Expand Up @@ -31,9 +32,9 @@

{% if search_term %}

<a href="{{ result.dashboard_direct_href }}" class="list-group-item list-group-item-info" title="click to go to subject dashboard for visit">{{ forloop.counter|add:page_obj.start_index|add:-1 }}. <b>{{ result.object.visit_code }}.{{ result.object.visit_code_sequence }}</b> on {{ result.object.report_datetime|date:"SHORT_DATE_FORMAT" }} {{ result.metadata_summary }}</a>
<a href="{{ result.dashboard_direct_href }}" class="list-group-item list-group-item-info" title="click to go to subject dashboard for visit">{% appointment_status_icon appt_status=result.object.appointment.appt_status %} {{ forloop.counter|add:page_obj.start_index|add:-1 }}. <b>{{ result.object.visit_code }}.{{ result.object.visit_code_sequence }}</b> on {{ result.object.report_datetime|date:"SHORT_DATE_FORMAT" }} {{ result.metadata_summary }}</a>
{% for crf in result.crf_metadata %}
<li class="list-group-item">{% if crf.entry_status == KEYED %}<span class="text text-muted text-success">{% else %}<span class="text text-danger">{% endif %}<i class="fas fa-list-alt fa-fw"></i> {{ crf.verbose_name }}</span></li>
<a href="{{ result.dashboard_direct_href }}" class="list-group-item">{% if crf.entry_status == KEYED %}<span class="text text-muted text-success">{% else %}<span class="text text-danger">{% endif %}<i class="fas fa-list-alt fa-fw"></i> {{ crf.verbose_name }} {% if result.object.appointment %}APPT{%endif %}</span></a>
{% endfor %}
{% for requisition in result.requisition_metadata %}
<li class="list-group-item">{% if requisition.entry_status == KEYED %}<span class="text text-muted text-success">{% else %}<span class="text text-danger">{% endif %}<i class="fas fa-flask fa-fw"></i> {{ requisition.verbose_name }}</span></li>
Expand Down
Expand Up @@ -2,7 +2,8 @@
from django import template
from django.conf import settings
from django.core.exceptions import ObjectDoesNotExist, MultipleObjectsReturned
from edc_appointment.constants import IN_PROGRESS_APPT
from edc_appointment.constants import IN_PROGRESS_APPT, INCOMPLETE_APPT
from edc_appointment.constants import NEW_APPT, COMPLETE_APPT
from edc_appointment.models.appointment import Appointment
from edc_lab.models.manifest.consignee import Consignee

Expand Down Expand Up @@ -104,3 +105,16 @@ def print_requisition_popover(context):
consignees.append(C(str(consignee.pk), consignee.name))
context['consignees'] = consignees
return context


@register.inclusion_tag(
f'edc_subject_dashboard/bootstrap{settings.EDC_BOOTSTRAP}/'
f'appointment_status.html')
def appointment_status_icon(appt_status=None):
return dict(
appt_status=appt_status,
NEW_APPT=NEW_APPT,
IN_PROGRESS_APPT=IN_PROGRESS_APPT,
INCOMPLETE_APPT=INCOMPLETE_APPT,
COMPLETE_APPT=COMPLETE_APPT,
)

0 comments on commit 177f479

Please sign in to comment.