diff --git a/smash/web/models.py b/smash/web/models.py index e4233cfb7d2b8eb8c11b2f04327af64969a4d17a..2de5fe18f0332705220e344e9e625f62e3e65a6b 100644 --- a/smash/web/models.py +++ b/smash/web/models.py @@ -297,6 +297,7 @@ class AppointmentType (models.Model): DEFAULT_COLOR = '#cfc600' + DEFAULT_FONT_COLOR = '#00000' required_equipment = models.ManyToManyField(Item, verbose_name='Required equipment', @@ -319,6 +320,10 @@ class AppointmentType (models.Model): verbose_name='Calendar color', default=DEFAULT_COLOR ) + calendar_font_color = models.CharField(max_length=2000, + verbose_name='Calendar color', + default=DEFAULT_FONT_COLOR + ) rest_time = models.IntegerField( verbose_name='Suggested rest time' ) @@ -531,6 +536,15 @@ class Appointment(models.Model): result = type.calendar_color return result + def font_color(self): + result = AppointmentType.DEFAULT_FONT_COLOR + priority = 1000000 + for type in self.appointment_types.all(): + if type.calendar_color_priority<priority: + priority=type.calendar_color_priority + result = type.calendar_font_color + return result + def title(self): if self.visit.subject.screening_number=="---": return self.comment diff --git a/smash/web/templates/subjects/visitdetails.html b/smash/web/templates/subjects/visitdetails.html index 87e2c6a122568a8cecda4ff48a5f418fa0e1e3e3..c3432d99fe5f918a15f0e8327ec11ecb9afba38c 100644 --- a/smash/web/templates/subjects/visitdetails.html +++ b/smash/web/templates/subjects/visitdetails.html @@ -31,9 +31,9 @@ {% for element in display %} <div class="box box-widget widget-user-2"> <div class="widget-user-header bg-green"> - <h3 class="widget-user-username">Visit {{ forloop.counter }}</h3> + <h3 class="widget-user-username">{{ element.4 }}</h3> <h5 class="widget-user-desc"> - {% if element.2 %}(Finished) element.2 + {% if element.2 %}(Finished) {% else %}(Not finished) {% endif %} <a href="{% url 'web.views.visit_details' element.3 %}"><font color="#D3D3D3">Details >>></font></a> @@ -78,7 +78,13 @@ {% for app in element.1 %} <tr> <td>{{ forloop.counter }}</td> - <td>{{ app.appointment_type }}</td> + <td style="background-color:{{app.color}} !important"> + <font COLOR="{{app.font_color}}"> + {% for type in app.appointment_types.all %} + {{ type.code }}, + {% endfor %} + </font> + </td> <td>{{ app.datetime_when | date:"d-M-Y" }}</td> <td>{{ app.datetime_when | time:"H:i" }}</td> <td>{{ app.length }}</td> @@ -88,7 +94,11 @@ {% endif %} </td> <td> - <a href="{% url 'web.views.appointment_edit' app.id %}" type="button" class="btn btn-block btn-default">Edit</a> + {% if app.is_finished %} + FINISHED + {% else %} + <a href="{% url 'web.views.appointment_edit' app.id %}" type="button" class="btn btn-block btn-default">Edit</a> + {% endif %} </td> </tr> {% endfor %} diff --git a/smash/web/templates/visits/details.html b/smash/web/templates/visits/details.html index d04881385749c8d575439be4cf4c2c1480e81ba0..7385a5102267d52079bd736eb289a1a6cbeaa865 100644 --- a/smash/web/templates/visits/details.html +++ b/smash/web/templates/visits/details.html @@ -103,7 +103,13 @@ {% for app in loApp %} <tr> <td>{{ forloop.counter }}</td> - <td>{{ app.appointment_type }}</td> + <td style="background-color:{{app.color}} !important"> + <font COLOR="{{app.font_color}}"> + {% for type in app.appointment_types.all %} + {{ type.code }}, + {% endfor %} + </font> + </td> <td>{{ app.datetime_when | date:"d-M-Y" }}</td> <td>{{ app.datetime_when | time:"H:i" }}</td> <td>{{ app.length }}</td> diff --git a/smash/web/views.py b/smash/web/views.py index 3a970a29bded6175953f13c789d776e4ecd8bc00..f79723e7d4c42b27a23a56ec3c7b7419b52128c6 100644 --- a/smash/web/views.py +++ b/smash/web/views.py @@ -201,8 +201,9 @@ def subject_visit_details(request, id): print assign finished = vis.is_finished visid = vis.id + visit_title = vis.follow_up_title() visform = VisitDetailForm(instance=vis) - endlist.append((visform,assign,finished,visid)) + endlist.append((visform,assign,finished,visid,visit_title)) #print len(endlist) #print endlist[0]