summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMikaël Ates <mates@entrouvert.com>2016-01-22 15:01:38 (GMT)
committerMikaël Ates <mates@entrouvert.com>2016-01-22 15:01:38 (GMT)
commit3b221efbeb6b619260460a8bc5bbe17f5806824c (patch)
tree152a38b334fd60a64608c09fa769ee2c297a326b
parent66562bf9b7151fc6b17b437e6b1071c20b027906 (diff)
downloadbiomon-3b221efbeb6b619260460a8bc5bbe17f5806824c.zip
biomon-3b221efbeb6b619260460a8bc5bbe17f5806824c.tar.gz
biomon-3b221efbeb6b619260460a8bc5bbe17f5806824c.tar.bz2
Add url and template for managing Reader model.
-rw-r--r--src/biomon/templates/biomon/base.html1
-rw-r--r--src/biomon/templates/biomon/reader_confirm_delete.html12
-rw-r--r--src/biomon/templates/biomon/reader_form.html14
-rw-r--r--src/biomon/templates/biomon/reader_list.html42
-rw-r--r--src/biomon/urls.py7
5 files changed, 76 insertions, 0 deletions
diff --git a/src/biomon/templates/biomon/base.html b/src/biomon/templates/biomon/base.html
index 8a5bfcc..2cb3d49 100644
--- a/src/biomon/templates/biomon/base.html
+++ b/src/biomon/templates/biomon/base.html
@@ -68,6 +68,7 @@
<li><a href={% url 'all_alerts' %}><i class="fa fa-bell"></i> {% trans "Alerts" %}</a></li>
<li><a href={% url 'patient_add' %}><i class="fa fa-user-plus"></i> {% trans "Add patient" %}</a></li>
<li><a href={% url 'room_list' %}><i class="fa fa-bed"></i> {% trans "Rooms" %}</a></li>
+ <li><a href={% url 'reader_list' %}><i class="fa fa-wifi"></i> {% trans "Readers" %}</a></li>
{% if lastpatient %}<li><a href={% url 'patient_detail' pk=lastpatient.pk %}>
<i class="fa fa-arrow-left"></i> {{ lastpatient.lastname|upper }} {{ lastpatient.firstname|title }}</a></li>{% endif %}
</ul>
diff --git a/src/biomon/templates/biomon/reader_confirm_delete.html b/src/biomon/templates/biomon/reader_confirm_delete.html
new file mode 100644
index 0000000..386a26c
--- /dev/null
+++ b/src/biomon/templates/biomon/reader_confirm_delete.html
@@ -0,0 +1,12 @@
+{% extends "biomon/base.html" %}
+{% load i18n %}
+
+{% block content-1-right %}
+<form action="" method="post" class="default-form">{% csrf_token %}
+{% trans "Are you sure you want to delete the reader" %} {{ reader }} ?
+<input type="submit" value="{% trans 'Yes' %}"/>
+</form>
+<div id="buttons">
+<a href="{% url 'room_list' %}" class="button">{% trans "Back" %}</a>
+</div>
+{% endblock %}
diff --git a/src/biomon/templates/biomon/reader_form.html b/src/biomon/templates/biomon/reader_form.html
new file mode 100644
index 0000000..0123466
--- /dev/null
+++ b/src/biomon/templates/biomon/reader_form.html
@@ -0,0 +1,14 @@
+{% extends "biomon/base.html" %}
+{% load i18n %}
+
+{% block content-1-right %}
+<form action="" method="post" class="default-form">{% csrf_token %}
+{% trans "Add or edit a reader" %}
+{{ form.as_p }}
+<input type="submit" value="{% trans 'Validate' %}" />
+</form>
+<div id="buttons">
+{% if room %}<a href="{% url 'reader_delete' pk=room.pk %}" class="button">{% trans "Delete" %}</a>{% endif %}
+<a href="{% url 'reader_list' %}" class="button">{% trans "Back" %}</a>
+</div>
+{% endblock %}
diff --git a/src/biomon/templates/biomon/reader_list.html b/src/biomon/templates/biomon/reader_list.html
new file mode 100644
index 0000000..2caafd0
--- /dev/null
+++ b/src/biomon/templates/biomon/reader_list.html
@@ -0,0 +1,42 @@
+{% extends "biomon/base.html" %}
+{% load i18n %}
+
+{% block extra_scripts %}
+<script type="text/javascript" src="{{ STATIC_URL }}biomon/js/biomon.patientlist.js"></script>
+{% endblock %}
+
+{% block content-1-right %}
+<div id="buttons">
+ <a href="{% url 'reader_add' %}" class="button">{% trans "Add a reader" %}</a>
+</div>
+<div id="search">
+ <input id="search" type="text" placeholder="{% trans 'Filter readers by their room number.' %}"></input>
+ <i class="fa fa-remove disabled" id="filter-patient-eraser"></i>
+</div>
+<div id="room-list">
+{% regroup object_list by first_letter as letter_list %}
+{% for letter in letter_list %}
+ <div class="letter">
+ <div class="value">{{ letter.grouper }}</div>
+ <div class="list">
+ {% for item in letter.list %}
+ <div class="patient-block enabled hvr-float-shadow" display-name="{{ item.room }}" action="{% url 'reader_update' pk=item.pk %}">
+ <span class="display_name">{% trans "Reader" %} {{ item.id }}</span>
+ <pre><span>{{ item.ip_address }}:{{ item.management_port }}</span></pre>
+ {% if item.room %}
+ <pre><span>{% trans "Room" %} : {{ item.room }}</span></pre>
+ {% if item.room.patient %}
+ <pre><span>{% trans "Patient" %} : {{ item.room.patient }}</span></pre>
+ {% else %}
+ <pre><span>{% trans "No patient associated" %}</span></pre>
+ {% endif %}
+ {% else %}
+ <pre><span>{% trans "No room associated" %}</span></pre>
+ {% endif %}
+ </div>
+ {% endfor %}
+ </div>
+ </div>
+{% endfor %}
+</div>
+{% endblock %}
diff --git a/src/biomon/urls.py b/src/biomon/urls.py
index 001c59d..25955ae 100644
--- a/src/biomon/urls.py
+++ b/src/biomon/urls.py
@@ -52,6 +52,13 @@ urlpatterns += (
)
urlpatterns += (
+ url(r'^readers/$', login_required(views.ReaderList.as_view()), name='reader_list'),
+ url(r'^reader/add/$', login_required(views.ReaderCreate.as_view()), name='reader_add'),
+ url(r'^reader/(?P<pk>\d+)/$', login_required(views.ReaderUpdate.as_view()), name='reader_update'),
+ url(r'^reader/(?P<pk>\d+)/delete/$', login_required(views.ReaderDelete.as_view()), name='reader_delete'),
+)
+
+urlpatterns += (
url(r'^alert/(?P<pk>\d+)/update_checked_field$', login_required(views.AlertCheckView.as_view()), name='alert_checked_field'),
url(r'^alerts/$', login_required(views.AllAlertsView.as_view()), name='all_alerts'),
url(r'^alerts/check_all_alerts$', login_required(views.AllAlertsCheckView.as_view()), name='check_all_alerts'),