diff options
author | Étienne Loks <etienne.loks@iggdrasil.net> | 2020-09-01 16:02:10 +0200 |
---|---|---|
committer | Étienne Loks <etienne.loks@iggdrasil.net> | 2020-09-01 16:02:10 +0200 |
commit | 95cf5f240a41f3ee6ce9ebb4ae2af890ba22c6c4 (patch) | |
tree | 7906edbdee46cf5c4b00f97906f3c66316186d49 | |
parent | bf770b27667eb56fcee2e54e6df8773cd7f22e3f (diff) | |
download | Ishtar-95cf5f240a41f3ee6ce9ebb4ae2af890ba22c6c4.tar.bz2 Ishtar-95cf5f240a41f3ee6ce9ebb4ae2af890ba22c6c4.zip |
Sheet operation: improve layout (refs #4961)
-rw-r--r-- | archaeological_operations/models.py | 3 | ||||
-rw-r--r-- | archaeological_operations/templates/ishtar/sheet_operation.html | 96 |
2 files changed, 62 insertions, 37 deletions
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" %} </div> </div> - <p class="card-text"> - <p class='window-refs' title="{% trans 'Name' %}">{{item.common_name|default:''}}</p> - <p class='window-refs' title="{% trans 'Address' %}">{{item.address|default:''}}</p> - </p> + <div class="card-text"> + <p class='window-refs' title="{% trans 'Towns' %}"> + {% if next %} + {{ item|m2m_listing:'towns'|join:" ; "|default:'' }} + {% else %} + {{ item.towns_codes|join:" ; "|default:'' }} + {% endif %} + </p> + <p class='window-refs' title="{% trans 'Name' %}">{{item.common_name|default:''}}</p> + </div> </div> </div> <div class="row"> + {% 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 %} + <dl class="col-12 col-md-6 col-lg-3 flex-wrap"> + <dt> + {% trans "State" %} + </dt> + <dd> + {% if item.is_active %} + <i class="fa fa-check-circle text-success" aria-hidden="true"></i> + {% trans "Active file" %} + {% else %} + <i class="fa fa-stop-circle text-warning" aria-hidden="true"></i> + {% trans "Closed operation" %} + {% endif %} + </dd> + </dl> {% 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 %} </div> @@ -143,56 +169,45 @@ <div class="row"> {% 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 %} - <div class="col-12 {% if has_image %}col-lg-6{% else %}col-md-6 col-lg-4{% endif %} d-flex flex-wrap row"> - <dt class="col-5">{%trans "State"%}</dt> - <dd class='col-7'> - {% if item.is_active %}{%trans "Active file"%} - {% else %}{%trans "Closed operation"%}{% endif %} - </dd> - </div> {% if item.closing.date %} - <div class="col-12 {% if has_image %}col-lg-6{% else %}col-md-6 col-lg-4{% endif %} d-flex flex-wrap row"> - <dt class="col-5">{%trans "Closing date"%}</dt> - <dd class='col-7'> + <dl class="col-12 col-md-6 col-lg-3 flex-wrap"> + <dt>{%trans "Closing date"%}</dt> + <dd> {{ item.closing.date }} <strong>{%trans "by" %}</strong> {{ item.closing.user }} </dd> - </div> + </dl> {% endif %} - {% field_flex_2 "Type" item.operation_type %} {% if item.surface %} - <div class="col-12 {% if has_image %}col-lg-6{% else %}col-md-6 col-lg-4{% endif %} d-flex flex-wrap row"> - <dt class="col-5">{%trans "Surface"%}</dt> - <dd class='col-7'> + <dl class="col-12 col-md-6 col-lg-3 flex-wrap"> + <dt>{%trans "Surface"%}</dt> + <dd> {{ item.surface }} m<sup>2</sup> ({{ item.surface_ha }} ha) </dd> - </div> + </dl> {% endif %} {% if item.cost %} - <div class="col-12 {% if has_image %}col-lg-6{% else %}col-md-6 col-lg-4{% endif %} d-flex flex-wrap row"> - <dt class="col-5">{%trans "Cost" %}</dt> - <dd class='col-7'> + <dl class="col-12 col-md-6 col-lg-3 flex-wrap"> + <dt>{%trans "Cost" %}</dt> + <dd> {{ item.cost }} €{% if item.cost_by_m2 %}, ({{ item.cost_by_m2 }} €/m<sup>2</sup>){%endif%} </dd> - </div> + </dl> {% endif %} {% if item.duration %} - <div class="col-12 {% if has_image %}col-lg-6{% else %}col-md-6 col-lg-4{% endif %} d-flex flex-wrap row"> - <dt class="col-5">{%trans "Duration"%}</dt> - <dd class='col-7'> - {{ item.duration }} {% trans "days" %} - </dd> - </div> + <dl class="col-12 col-md-6 col-lg-3 flex-wrap"> + <dt>{%trans "Duration"%}</dt> + <dd>{{ item.duration }} {% trans "days" %}</dd> + </dl> {% endif %} {% if has_image %} - </div> + </div> {# <div> #} {% endif %} {% endwith %} - </div> - <div class="row"> {% 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 %} <div class="alert alert-warning" role="alert"> + <i class="fa fa-exclamation-triangle" aria-hidden="true"></i> {% trans "Patriarche OA code not yet recorded!"%} </div> {% 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 %} </div> {% endwith %} </div> @@ -317,6 +336,11 @@ {% if forloop.last %} </div>{% endif %} {% endfor %} + {% else %} + <div class="alert alert-info" role="alert"> + <i class="fa fa-info-circle" aria-hidden="true"></i> + {% trans "No relations" %} + </div> {% endif %} </div> {% endif %} |