From bba3881e7f11a27ff9d2f08f92542a2d24cac7c6 Mon Sep 17 00:00:00 2001 From: Étienne Loks Date: Mon, 26 Nov 2018 20:52:00 +0100 Subject: Sheet treatment: fix document list - improve display with tabs --- .../templates/ishtar/sheet_treatment.html | 176 +++++++++++++-------- .../0076_migrate_treatmentfile_permissions.py | 1 - 2 files changed, 113 insertions(+), 64 deletions(-) diff --git a/archaeological_finds/templates/ishtar/sheet_treatment.html b/archaeological_finds/templates/ishtar/sheet_treatment.html index 94569b5f6..ced305798 100644 --- a/archaeological_finds/templates/ishtar/sheet_treatment.html +++ b/archaeological_finds/templates/ishtar/sheet_treatment.html @@ -9,78 +9,128 @@ {% block content %} -
-
-
- {% include "ishtar/blocks/window_image.html" %} -
-

-

{{ item.label|default:"" }}

- {% if item.other_reference %} -

{{ item.other_reference }}

{% endif %} -

{{ item.year }} - {{ item.index }}

- {% if item.external_id %} -

{{ item.external_id }}

{% endif %} - {% if item.end_date %} -

{% trans "Closed" context "Treatment" %} ({{item.end_date}})

- {% else %} -

{% trans "Active" context "Treatment" %}

- {% endif %} -

+ + +
+
+
+
+
+ {% include "ishtar/blocks/window_image.html" %} +
+

+

{{ item.label|default:"" }}

+ {% if item.other_reference %} +

{{ item.other_reference }}

{% endif %} +

{{ item.year }} - {{ item.index }}

+ {% if item.external_id %} +

{{ item.external_id }}

{% endif %} + {% if item.end_date %} +

{% trans "Closed" context "Treatment" %} ({{item.end_date}})

+ {% else %} +

{% trans "Active" context "Treatment" %}

+ {% endif %} +

+
+
+ +
+ {% field_flex_multiple "Treatment type" item.treatment_types %} + {% field_flex "State" item.treatment_state %} + {% field_flex_detail "Associated request" item.file %} + {% field_flex "Location" item.location %} + {% field_flex "Container" item.container %} + {% field_flex "Responsible" item.person %} + {% field_flex "Organization" item.organization %} + {% field_flex "Start date" item.start_date %} + {% field_flex "Closing date" item.end_date %} + {% field_flex "Estimated cost" item.estimated_cost|intcomma '' " "|add:CURRENCY %} + {% field_flex "Quoted cost" item.quoted_cost|intcomma '' " "|add:CURRENCY %} + {% field_flex "Realized cost" item.realized_cost|intcomma '' " "|add:CURRENCY %} + {% field_flex "Insurance cost" item.insurance_cost|intcomma '' " "|add:CURRENCY %} + {% field_flex_full "Comment" item.comment "
" "
" %} + {% field_flex_full "Description" item.description "
" "
" %} + {% field_flex_full "Goal" item.goal "
" "
" %} + + {% include "ishtar/blocks/sheet_json.html" %} +
-
-
- {% field_flex_multiple "Treatment type" item.treatment_types %} - {% field_flex "State" item.treatment_state %} - {% field_flex_detail "Associated request" item.file %} - {% field_flex "Location" item.location %} - {% field_flex "Container" item.container %} - {% field_flex "Responsible" item.person %} - {% field_flex "Organization" item.organization %} - {% field_flex "Start date" item.start_date %} - {% field_flex "Closing date" item.end_date %} - {% field_flex "Estimated cost" item.estimated_cost|intcomma '' " "|add:CURRENCY %} - {% field_flex "Quoted cost" item.quoted_cost|intcomma '' " "|add:CURRENCY %} - {% field_flex "Realized cost" item.realized_cost|intcomma '' " "|add:CURRENCY %} - {% field_flex "Insurance cost" item.insurance_cost|intcomma '' " "|add:CURRENCY %} - {% field_flex_full "Comment" item.comment "
" "
" %} - {% field_flex_full "Description" item.description "
" "
" %} - {% field_flex_full "Goal" item.goal "
" "
" %} - - {% include "ishtar/blocks/sheet_json.html" %} -
+
+ {% trans "Related finds" as finds %} + {% if item.finds.count %} + {% dynamic_table_document finds 'finds_for_treatment' 'treatments' item.pk 'TABLE_COLS_FOR_OPE' output %} + {% endif %} -{% trans "Related finds" as finds %} -{% if item.finds.count %} -{% dynamic_table_document finds 'finds_for_treatment' 'treatments' item.pk 'TABLE_COLS_FOR_OPE' output %} -{% endif %} + {% trans "Upstream finds" as finds %} + {% if item.upstream.count %} + {% dynamic_table_document finds 'finds_for_treatment' 'downstream_treatment' item.pk 'TABLE_COLS_FOR_OPE' output %} + {% endif %} -{% trans "Upstream finds" as finds %} -{% if item.upstream.count %} -{% dynamic_table_document finds 'finds_for_treatment' 'downstream_treatment' item.pk 'TABLE_COLS_FOR_OPE' output %} -{% endif %} + {% trans "Downstream finds" as finds %} + {% if item.downstream.count %} + {% dynamic_table_document finds 'finds_for_treatment' 'upstream_treatment' item.pk 'TABLE_COLS_FOR_OPE' output %} + {% endif %} -{% trans "Downstream finds" as finds %} -{% if item.downstream.count %} -{% dynamic_table_document finds 'finds_for_treatment' 'upstream_treatment' item.pk 'TABLE_COLS_FOR_OPE' output %} -{% endif %} + {% trans "Related operations" as related_operations %} + {% dynamic_table_document related_operations 'operations' 'related_treatment' item.pk 'TABLE_COLS' output %} -{% trans "Related operations" as related_operations %} -{% dynamic_table_document related_operations 'operations' 'related_treatment' item.pk 'TABLE_COLS' output %} -{% comment %} -{% if item.source.count %} -{% trans "Associated documents" as associated_docs %} -{% dynamic_table_document associated_docs 'treatments_docs' 'treatment' item.pk '' output %} -{% endif %} -{% endcomment %} +
+ + {% if item.documents.count %} +
+ {% trans "Associated documents" as treat_docs %} + {% dynamic_table_document treat_docs 'documents' 'treatments' item.pk '' output %} +
+ {% endif %} + + {% if item.administrative_act.count %} +
+ {% trans "Administrative acts" as admact_lbl %} + {% table_administrativact admact_lbl item.administrative_act.all %} +
+ {% endif %} -{% if item.administrative_act.count %} -{% trans "Administrative acts" as admact_lbl %} -{% table_administrativact admact_lbl item.administrative_act.all %} -{% endif %} +
{% endblock %} diff --git a/ishtar_common/migrations/0076_migrate_treatmentfile_permissions.py b/ishtar_common/migrations/0076_migrate_treatmentfile_permissions.py index 0defa4efe..4edef4a44 100644 --- a/ishtar_common/migrations/0076_migrate_treatmentfile_permissions.py +++ b/ishtar_common/migrations/0076_migrate_treatmentfile_permissions.py @@ -18,7 +18,6 @@ def migrate_perm(apps, schema_editor): for gp in Group.objects.filter(permissions=q.all()[0]): gp.permissions.add(perm) q.all()[0].delete() - print(new_codename) perm.codename = new_codename perm.save() -- cgit v1.2.3