diff --git a/calebasse/dossiers/templates/dossiers/index.html b/calebasse/dossiers/templates/dossiers/index.html index 3962584..0ee72a8 100644 --- a/calebasse/dossiers/templates/dossiers/index.html +++ b/calebasse/dossiers/templates/dossiers/index.html @@ -51,7 +51,7 @@
- Page des quotations
+ Quotations et déficiences
Liste d'attente
diff --git a/calebasse/dossiers/templates/dossiers/quotations.html b/calebasse/dossiers/templates/dossiers/quotations.html index b25d345..731846e 100644 --- a/calebasse/dossiers/templates/dossiers/quotations.html +++ b/calebasse/dossiers/templates/dossiers/quotations.html @@ -2,40 +2,47 @@ {% load url from future %} {% block appbar %} -

Dossiers

- Retourner aux dossiers - +

Dossiers

+Retourner aux dossiers + {% endblock %} {% block content %}
@@ -49,6 +56,7 @@ Mises 1 Mises 2 Mises 3 + ANAP papier @@ -59,37 +67,38 @@ {% for patient_record in patient_records %} - {{ patient_record.object.paper_id|default_if_none:"" }} - {{ patient_record.object.id }} - {{ patient_record.object.last_name }} - {{ patient_record.object.first_name }} - {{ patient_record.state }} - {% for mise in patient_record.object.mises_1.all %}{{ mise }}
{% endfor %} - {% for mise in patient_record.object.mises_2.all %}{{ mise }}
{% endfor %} - {% for mise in patient_record.object.mises_3.all %}{{ mise }}
{% endfor %} + {{ patient_record.object.paper_id|default_if_none:"" }} + {{ patient_record.object.id }} + {{ patient_record.object.last_name }} + {{ patient_record.object.first_name }} + {{ patient_record.state }} + {% for mise in patient_record.object.mises_1.all %}{{ mise }}
{% endfor %} + {% for mise in patient_record.object.mises_2.all %}{{ mise }}
{% endfor %} + {% for mise in patient_record.object.mises_3.all %}{{ mise }}
{% endfor %} + {% if patient_record.anap %}{% endif %} {% endfor %} -{% if request.GET %} - + {% endif %} diff --git a/calebasse/dossiers/views.py b/calebasse/dossiers/views.py index f338663..45ba7b4 100644 --- a/calebasse/dossiers/views.py +++ b/calebasse/dossiers/views.py @@ -848,11 +848,15 @@ class PatientRecordsQuotationsView(cbv.ListView): current_state = patient_record.get_current_state() or patient_record.get_state() state = current_state.status.name state_class = current_state.status.type.lower() + deficiencies = [getattr(patient_record, field) \ + for field in self.deficience_fields] + anap = reduce(lambda f1, f2: f1 or f2, deficiencies) patient_records.append( { 'object': patient_record, 'state': state, - 'state_class': state_class + 'state_class': state_class, + 'anap': anap } ) return patient_records @@ -860,9 +864,18 @@ class PatientRecordsQuotationsView(cbv.ListView): def get_queryset(self): form = forms.QuotationsForm(data=self.request.GET or None) qs = super(PatientRecordsQuotationsView, self).get_queryset() + self.deficience_fields = [field for field in self.model._meta.get_all_field_names() if field.startswith('deficiency_')] + without_quotations = self.request.GET.get('without_quotations') + without_anap_quotations = self.request.GET.get('without_anap_quotations') if without_quotations: - qs = qs.filter(mises_1=None).filter(mises_2=None).filter(mises_3=None) + qs = qs.filter(mises_1__isnull=True).filter(mises_2__isnull=True).filter(mises_3__isnull=True) + + if without_anap_quotations: + for field in self.deficience_fields: + anap_field = {field: 0} + qs = qs.filter(**anap_field) + states = self.request.GET.getlist('states') qs = qs.filter(last_state__status__id__in=states)