From d9bd9cc1683d5e48f1544270b72fda5581a236cd Mon Sep 17 00:00:00 2001 From: Étienne Loks Date: Tue, 1 Sep 2020 16:02:10 +0200 Subject: Sheet operation: improve layout (refs #4961) --- archaeological_operations/models.py | 3 +- .../templates/ishtar/sheet_operation.html | 96 ++++++++++++++-------- 2 files changed, 62 insertions(+), 37 deletions(-) (limited to 'archaeological_operations') diff --git a/archaeological_operations/models.py b/archaeological_operations/models.py index ad0604fad..a74ab7d51 100644 --- a/archaeological_operations/models.py +++ b/archaeological_operations/models.py @@ -1800,7 +1800,8 @@ class RecordRelations(GeneralRecordRelations, models.Model): class Meta: verbose_name = _("Operation record relation") verbose_name_plural = _("Operation record relations") - ordering = ('left_record', 'relation_type') + ordering = ('left_record__cached_label', 'relation_type', + 'right_record__cached_label') permissions = [ ("view_operationrelation", "Can view all Operation relations"), ] diff --git a/archaeological_operations/templates/ishtar/sheet_operation.html b/archaeological_operations/templates/ishtar/sheet_operation.html index 9153454fd..ef5de7f59 100644 --- a/archaeological_operations/templates/ishtar/sheet_operation.html +++ b/archaeological_operations/templates/ishtar/sheet_operation.html @@ -123,19 +123,45 @@ {% include "ishtar/blocks/sheet_external_id.html" %} -

-

{{item.common_name|default:''}}

-

{{item.address|default:''}}

-

+
+

+ {% if next %} + {{ item|m2m_listing:'towns'|join:" ; "|default:'' }} + {% else %} + {{ item.towns_codes|join:" ; "|default:'' }} + {% endif %} +

+

{{item.common_name|default:''}}

+
+ {% trans "Excavation dates (start/end)" as date_label %} + {% with start_date=item.start_date|date:"DATE_FORMAT"|default:"-" %} + {% with end_date=item.excavation_end_date|date:"DATE_FORMAT"|default:"-" %} + {% with dates=start_date|add:" / "|add:end_date %} + {% field_flex_2 date_label dates %} + {% endwith %} + {% endwith %} + {% endwith %} +
+
+ {% trans "State" %} +
+
+ {% if item.is_active %} + + {% trans "Active file" %} + {% else %} + + {% trans "Closed operation" %} + {% endif %} +
+
{% field_flex_2 "Code DRASSM" item.drassm_code %} {% field_flex_2 "Old code" item.old_code %} - {% trans "Begining date" as begining_date_label %} - {% field_flex_2 begining_date_label item.start_date|date:"DATE_FORMAT" %} - {% field_flex_2 "Excavation end date" item.excavation_end_date|date:"DATE_FORMAT"|default:"-" %} + {% with has_image=item.images.count %} {% if not has_image %}
@@ -143,56 +169,45 @@
{% endif %} + {% field_flex "Type" item.operation_type %} {% field_flex_detail "Head scientist" item.scientist has_image %} {% field_flex_detail "In charge" item.in_charge has_image %} {% field_flex_multiple "Collaborators" item.collaborators has_image %} {% field_flex_detail "Operator" item.operator has_image %} -
-
{%trans "State"%}
-
- {% if item.is_active %}{%trans "Active file"%} - {% else %}{%trans "Closed operation"%}{% endif %} -
-
{% if item.closing.date %} -
-
{%trans "Closing date"%}
-
+
+
{%trans "Closing date"%}
+
{{ item.closing.date }} {%trans "by" %} {{ item.closing.user }}
-
+ {% endif %} - {% field_flex_2 "Type" item.operation_type %} {% if item.surface %} -
-
{%trans "Surface"%}
-
+
+
{%trans "Surface"%}
+
{{ item.surface }} m2 ({{ item.surface_ha }} ha)
-
+ {% endif %} {% if item.cost %} -
-
{%trans "Cost" %}
-
+
+
{%trans "Cost" %}
+
{{ item.cost }} €{% if item.cost_by_m2 %}, ({{ item.cost_by_m2 }} €/m2){%endif%}
-
+ {% endif %} {% if item.duration %} -
-
{%trans "Duration"%}
-
- {{ item.duration }} {% trans "days" %} -
-
+
+
{%trans "Duration"%}
+
{{ item.duration }} {% trans "days" %}
+
{% endif %} {% if has_image %} -
+ {#
#} {% endif %} {% endwith %} -
-
{% field_flex_multiple_obj "Remains" item 'remains' %} {% field_flex_multiple_obj "Periods" item 'periods' %} {% field_flex "Record quality" item.record_quality_type %} @@ -237,6 +252,7 @@ {% if not item.code_patriarche %} {% endif %} @@ -263,9 +279,12 @@ {% else %} {% field_flex_full "Towns" item.towns_codes|join:" ; " %} {% endif %} + {% field_flex "Address" item.address %} + {% if not item.address %} {% field_flex "Main address" item.associated_file.address %} {% field_flex "Complement" item.associated_file.address_complement %} {% field_flex "Postal code" item.associated_file.postal_code %} + {% endif %}
{% endwith %} @@ -317,6 +336,11 @@ {% if forloop.last %} {% endif %} {% endfor %} + {% else %} + {% endif %} {% endif %} -- cgit v1.2.3