diff options
author | Étienne Loks <etienne.loks@iggdrasil.net> | 2019-07-11 13:43:47 +0200 |
---|---|---|
committer | Étienne Loks <etienne.loks@iggdrasil.net> | 2019-07-11 13:43:47 +0200 |
commit | 802a2e38c9cfc91653cd445c1213d1ca77a85b99 (patch) | |
tree | d82635c6ae137d6aadd5178b0fd4c12f9744ce7e | |
parent | f9ba4b9a14226aa895a75b63c4d16dfa10102d66 (diff) | |
download | Ishtar-802a2e38c9cfc91653cd445c1213d1ca77a85b99.tar.bz2 Ishtar-802a2e38c9cfc91653cd445c1213d1ca77a85b99.zip |
Sheet operation: refactoring
-rw-r--r-- | archaeological_context_records/templates/ishtar/sheet_contextrecord.html | 6 | ||||
-rw-r--r-- | archaeological_operations/templates/ishtar/sheet_operation.html | 758 |
2 files changed, 447 insertions, 317 deletions
diff --git a/archaeological_context_records/templates/ishtar/sheet_contextrecord.html b/archaeological_context_records/templates/ishtar/sheet_contextrecord.html index 6fcf5e9da..0643a40fc 100644 --- a/archaeological_context_records/templates/ishtar/sheet_contextrecord.html +++ b/archaeological_context_records/templates/ishtar/sheet_contextrecord.html @@ -115,6 +115,12 @@ </div> </div> </div> + {% else %} + <div class='row'> + <p class='window-refs'>{{ item.parcel.short_label }}</p> + <p class="window-refs">{{ item.label|default:"" }}</p> + {% include "ishtar/blocks/sheet_external_id.html" %} + </div> {% endif %} <div class='row'> {% field_flex_2 "Complete ID" item.full_label %} diff --git a/archaeological_operations/templates/ishtar/sheet_operation.html b/archaeological_operations/templates/ishtar/sheet_operation.html index 6ed3c1b4c..cc556a9fd 100644 --- a/archaeological_operations/templates/ishtar/sheet_operation.html +++ b/archaeological_operations/templates/ishtar/sheet_operation.html @@ -1,5 +1,5 @@ {% extends "ishtar/sheet.html" %} -{% load i18n window_tables window_header window_ope_tables window_field from_dict %} +{% load i18n ishtar_helpers window_tables window_header window_ope_tables window_field from_dict %} {% block head_title %}<strong>{% trans "Operation" %}</strong> - {{item.short_label}}{% if item.common_name %} - {{item.common_name}}{% endif %}{% endblock %} @@ -9,359 +9,483 @@ {% block content %} -<h3>{% trans "General"%}</h3> +{# trick to set to null non existing variable #} +{% with permission_view_document=permission_view_document %} +{% with permission_view_own_document=permission_view_own_document %} +{% with permission_view_find=permission_view_find %} +{% with permission_view_own_find=permission_view_own_find %} +{% with permission_view_contextrecord=permission_view_contextrecord %} +{% with permission_view_own_contextrecord=permission_view_own_contextrecord %} +{% with permission_view_container=permission_view_container %} +{% with permission_view_own_container=permission_view_own_container %} + +{% with display_data=item.data %} +{% with display_relations=item.right_relations.count|or_:item.left_relations.count %} +{% with display_sites=item.archaeological_sites.count|or_:item.grouped_parcels|or_:item.administrative_act.count %} +{% with perm_documents=permission_view_own_document|or_:permission_view_document %} +{% with display_documents=perm_documents|and_:item.documents.count %} +{% with perm_context_records=permission_view_own_contextrecord|or_:permission_view_contextrecord %} +{% with display_context_records=perm_context_records|and_:item.context_record.count %} +{% with perm_find=permission_view_own_find|or_:permission_view_find %} +{% with display_finds=perm_find|and_:item.has_finds %} + +{% if output != "ODT" and output != "PDF"%} +<ul class="nav nav-tabs" id="{{window_id}}-tabs" role="tablist"> + <li class="nav-item"> + <a class="nav-link active" id="{{window_id}}-general-tab" + data-toggle="tab" href="#{{window_id}}-general" role="tab" + aria-controls="{{window_id}}-general" aria-selected="false"> + {% trans "General" %} + </a> + </li> + {% if display_sites %} + <li class="nav-item"> + <a class="nav-link" id="{{window_id}}-sites-tab" + data-toggle="tab" href="#{{window_id}}-sites" role="tab" + aria-controls="{{window_id}}-sites" aria-selected="false"> + {% trans "Archaeological sites/parcels/Administrativ acts" %} + </a> + </li> + {% endif %} + {% if display_documents %} + <li class="nav-item"> + <a class="nav-link" id="{{window_id}}-documents-tab" + data-toggle="tab" href="#{{window_id}}-documents" role="tab" + aria-controls="{{window_id}}-documents" aria-selected="false"> + {% trans "Documents" %} + </a> + </li> + {% endif %} + {% if display_relations %} + <li class="nav-item"> + <a class="nav-link" id="{{window_id}}-relations-tab" + data-toggle="tab" href="#{{window_id}}-relations" role="tab" + aria-controls="{{window_id}}-relations" aria-selected="false"> + {% trans "Relations" %} + </a> + </li> + {% endif %} + {% if display_context_records %} + <li class="nav-item"> + <a class="nav-link" id="{{window_id}}-cr-tab" + data-toggle="tab" href="#{{window_id}}-cr" role="tab" + aria-controls="{{window_id}}-cr" aria-selected="false"> + {% trans "Context records" %} + </a> + </li> + {% endif %} + {% if display_finds %} + <li class="nav-item"> + <a class="nav-link" id="{{window_id}}-finds-tab" + data-toggle="tab" href="#{{window_id}}-finds" role="tab" + aria-controls="{{window_id}}-finds" aria-selected="false"> + {% trans "Finds" %} + </a> + </li> + {% endif %} + {% if display_data %} + <li class="nav-item"> + <a class="nav-link" id="{{window_id}}-json-tab" + data-toggle="tab" href="#{{window_id}}-json" role="tab" + aria-controls="{{window_id}}-json" aria-selected="false"> + {% trans "Custom fields" %} + </a> + </li> + {% endif %} + <li class="nav-item"> + <a class="nav-link" id="{{window_id}}-statistics-tab" + data-toggle="tab" href="#{{window_id}}-statistics" role="tab" + aria-controls="{{window_id}}-statistics" aria-selected="false"> + {% trans "Statistics" %} + </a> + </li> + +</ul> +{% endif %} -<div class="clearfix"> - <div class="card float-left col-12 col-md-6 col-lg-4"> - {% include "ishtar/blocks/window_image.html" %} - <div class="card-body"> - <div class="row"> - <div class="col main"> - {% if item.year or item.operation_code %} - {{item.year|default:''}}-{{item.operation_code|default:''}}{% endif %}<br> - {% if item.code_patriarche %}OA{{item.code_patriarche}}{% endif %} - </div> - <div class="col text-muted"> - {% include "ishtar/blocks/sheet_external_id.html" %} +<div class="tab-content" id="{{window_id}}-tab-content"> + <div class="tab-pane fade show active" id="{{window_id}}-general" + role="tabpanel" aria-labelledby="{{window_id}}-general-tab"> + + <div class="clearfix"> + <div class="card float-left col-12 col-md-6 col-lg-4"> + {% include "ishtar/blocks/window_image.html" %} + <div class="card-body"> + <div class="row"> + <div class="col main"> + {% if item.year or item.operation_code %} + {{item.year|default:''}}-{{item.operation_code|default:''}}{% endif %}<br> + {% if item.code_patriarche %}OA{{item.code_patriarche}}{% endif %} + </div> + <div class="col text-muted"> + {% 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> </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> - </div> - <div class="row"> - {% 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> -</div> - <div class="row"> - {% endif %} + <div class="row"> + {% 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> + </div> + <div class="row"> + {% endif %} + + {% 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'> + {{ item.closing.date }} <strong>{%trans "by" %}</strong> {{ item.closing.user }} + </dd> + </div> + {% 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'> + {{ item.surface }} m<sup>2</sup> ({{ item.surface_ha }} ha) + </dd> + </div> + {% 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'> + {{ item.cost }} €{% if item.cost_by_m2 %}, ({{ item.cost_by_m2 }} €/m<sup>2</sup>){%endif%} + </dd> + </div> + {% 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> + {% endif %} + {% if has_image %} + </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 %} + {% field_flex "Report delivery date" item.report_delivery_date %} + {% field_flex "Report processing" item.report_processing %} + {% field_flex "Deadline for submission of the documentation" item.documentation_deadline %} + {% field_flex "Documentation received" item.documentation_received %} + {% field_flex "Deadline for submission of the finds" item.finds_deadline %} + {% field_flex "Finds received" item.finds_received %} + {% field_flex_detail "Associated file" item.associated_file %} + {% field_flex "Responsible for planning service" item.associated_file.responsible_town_planning_service.full_address %} + {% if item.associated_file.town_planning_service %} + {% field_flex "Planning service organization" item.associated_file.town_planning_service.full_address %} + {% else %} + {% field_flex "Planning service organization" item.associated_file.responsible_town_planning_service.attached_to.full_address %} + {% endif %} + {% field_flex "Permit type" item.associated_file.permit_type %} + {% field_flex "Permit reference" item.associated_file.permit_reference %} + {% field_flex "General contractor" item.associated_file.general_contractor.full_address %} + {% if item.associated_file.corporation_general_contractor %} + {% field_flex "General contractor organization" item.associated_file.corporation_general_contractor.full_address %} + {% else%} + {% field_flex "General contractor organization" item.associated_file.general_contractor.attached_to.full_address %} + {% endif %} + </div> + <div class="row"> + {% field_flex_full "Comment" item.comment "<pre>" "</pre>" %} + {% field_flex_full "Abstract" item.abstract "<pre>" "</pre>" %} + {% field_flex_full "Comment about scientific documentation" item.scientific_documentation_comment "<pre>" "</pre>" %} + </div> - {% 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> + <h3>{% trans "Sheet"%}</h3> + <div class="row"> + {% include "ishtar/blocks/sheet_creation_section.html" %} </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'> - {{ item.closing.date }} <strong>{%trans "by" %}</strong> {{ item.closing.user }} - </dd> + + {% if item.virtual_operation %} + <div class="alert alert-warning" role="alert"> + {% trans "This operation is virtual." %} </div> {% 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'> - {{ item.surface }} m<sup>2</sup> ({{ item.surface_ha }} ha) - </dd> + + {% if not item.code_patriarche %} + <div class="alert alert-warning" role="alert"> + {% trans "Patriarche OA code not yet recorded!"%} </div> {% 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'> - {{ item.cost }} €{% if item.cost_by_m2 %}, ({{ item.cost_by_m2 }} €/m<sup>2</sup>){%endif%} - </dd> + + {% if item.seizure_name or item.official_report_number or item.name_of_the_protagonist %} + <h3>{% trans "Court-ordered seizure"%}</h3> + <div class="row"> + {% field_flex "Seizure name" item.seizure_name %} + {% field_flex "Official report number" item.official_report_number %} + {% field_flex "Name of the protagonist" item.name_of_the_protagonist %} </div> {% 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> + + <h3>{% trans "Localisation"%}</h3> + <div class="row"> + {% with geo_item=item %} + {% include "ishtar/blocks/sheet_simple_map.html"%} + <div class="col-12 col-lg-6 flex-wrap"> + {% include "ishtar/blocks/sheet_coordinates.html"%} + {% if next %} + {% field_flex_full "Towns" item|m2m_listing:'towns'|join:" ; " %} + {% else %} + {% field_flex_full "Towns" item.towns_codes|join:" ; " %} + {% endif %} + {% 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 %} + </div> + {% endwith %} </div> - {% endif %} - {% if has_image %} </div> - {% endif %} - {% endwith %} - </div> -</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 %} - {% field_flex "Report delivery date" item.report_delivery_date %} - {% field_flex "Report processing" item.report_processing %} - {% field_flex "Deadline for submission of the documentation" item.documentation_deadline %} - {% field_flex "Documentation received" item.documentation_received %} - {% field_flex "Deadline for submission of the finds" item.finds_deadline %} - {% field_flex "Finds received" item.finds_received %} - {% field_flex_detail "Associated file" item.associated_file %} - {% field_flex "Responsible for planning service" item.associated_file.responsible_town_planning_service.full_address %} - {% if item.associated_file.town_planning_service %} - {% field_flex "Planning service organization" item.associated_file.town_planning_service.full_address %} - {% else %} - {% field_flex "Planning service organization" item.associated_file.responsible_town_planning_service.attached_to.full_address %} - {% endif %} - {% field_flex "Permit type" item.associated_file.permit_type %} - {% field_flex "Permit reference" item.associated_file.permit_reference %} - {% field_flex "General contractor" item.associated_file.general_contractor.full_address %} - {% if item.associated_file.corporation_general_contractor %} - {% field_flex "General contractor organization" item.associated_file.corporation_general_contractor.full_address %} - {% else%} - {% field_flex "General contractor organization" item.associated_file.general_contractor.attached_to.full_address %} - {% endif %} -</div> -<div class="row"> - {% field_flex_full "Comment" item.comment "<pre>" "</pre>" %} - {% field_flex_full "Abstract" item.abstract "<pre>" "</pre>" %} - {% field_flex_full "Comment about scientific documentation" item.scientific_documentation_comment "<pre>" "</pre>" %} -</div> - -<h3>{% trans "Sheet"%}</h3> -<div class="row"> - {% include "ishtar/blocks/sheet_creation_section.html" %} -</div> - -{% include "ishtar/blocks/sheet_json.html" %} - -{% if item.virtual_operation %} -<div class="alert alert-warning" role="alert"> - {% trans "This operation is virtual." %} -</div> -{% endif %} -{% if not item.code_patriarche %} -<div class="alert alert-warning" role="alert"> - {% trans "Patriarche OA code not yet recorded!"%} -</div> -{% endif %} + {% if display_sites %} + <div class="tab-pane fade" id="{{window_id}}-sites" + role="tabpanel" aria-labelledby="{{window_id}}-sites-tab"> + {% if item.archaeological_sites.count %} + {% trans "Archaeological sites" as archaeologicalsites_label %} + {% dynamic_table_document archaeologicalsites_label 'sites' 'operations' item.pk '' output %} + {% endif %} -{% if item.seizure_name or item.official_report_number or item.name_of_the_protagonist %} -<h3>{% trans "Court-ordered seizure"%}</h3> -<div class="row"> - {% field_flex "Seizure name" item.seizure_name %} - {% field_flex "Official report number" item.official_report_number %} - {% field_flex "Name of the protagonist" item.name_of_the_protagonist %} -</div> -{% endif %} + {% if item.grouped_parcels %} + {% trans "Associated parcels" as parcels_label %} + {% include "ishtar/blocks/window_tables/parcels.html" %} + {% endif %} -<h3>{% trans "Localisation"%}</h3> -<div class="row"> - {% with geo_item=item %} - {% include "ishtar/blocks/sheet_simple_map.html"%} - <div class="col-12 col-lg-6 flex-wrap"> - {% include "ishtar/blocks/sheet_coordinates.html"%} - {% if next %} - {% field_flex_full "Towns" item|m2m_listing:'towns'|join:" ; " %} - {% else %} - {% field_flex_full "Towns" item.towns_codes|join:" ; " %} + {% if item.administrative_act.count %} + <h3>{% trans "Administrative acts" %}</h3> + {% table_administrativact "" item.administrative_act.all %} {% endif %} - {% 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 %} </div> - {% endwith %} -</div> + {% endif %} -{% if item.right_relations.count %} -<h3>{% trans "Relations"%}</h3> -{% for rel in item.right_relations.all %} -{% ifchanged rel.relation_type %} -<h4>{{rel.relation_type}}</h4> -<div class="row">{% endifchanged %} - <div class="col-12"> - <a href="#" onclick="load_window('/show-operation/{{rel.right_record.pk}}/');" class="display_details"> - <i class="fa fa-info-circle" aria-hidden="true"></i> - </a> {{rel.right_record}} + {% if display_documents %} + <div class="tab-pane fade" id="{{window_id}}-documents" + role="tabpanel" aria-labelledby="{{window_id}}-documents-tab"> + {% trans "Document from this operation" as operation_docs %} + {% dynamic_table_document operation_docs 'documents' 'operations' item.pk '' output %} </div> -{% if forloop.last %} -</div>{% endif %} -{% endfor %} - -{% if item.relation_image %} -<div id="lightgallery-{{window_id}}-relation-image"> - {% if output != "ODT" %}<a href="{{item.relation_image.url}}">{% endif %} - <img src="{{item.relation_image.url}}" class="img-fluid img-thumbnail"> - {% if output != "ODT" %}</a>{% endif %} -</div> -<hr> -{% endif %} -{% endif %} - -{% if item.archaeological_sites.count %} -{% trans "Archaeological sites" as archaeologicalsites_label %} -{% dynamic_table_document archaeologicalsites_label 'sites' 'operations' item.pk '' output %} -{% endif %} - -{% if item.grouped_parcels %} -{% trans "Associated parcels" as parcels_label %} -{% include "ishtar/blocks/window_tables/parcels.html" %} -{% endif %} - -{% if item.administrative_act.count %} -<h3>{% trans "Administrative acts" %}</h3> -{% table_administrativact "" item.administrative_act.all %} -{% endif %} + {% endif %} -{% trans "Document from this operation" as operation_docs %} -{% if permission_view_own_document or permission_view_document %} -{% if item.documents.count %} -{% dynamic_table_document operation_docs 'documents' 'operations' item.pk '' output %} -{% endif %} -{% endif %} + {% if display_relations %} + <div class="tab-pane fade" id="{{window_id}}-relations" + role="tabpanel" aria-labelledby="{{window_id}}-relations-tab"> + + {% if item.right_relations.count %} + <h3>{% trans "Relations"%}</h3> + {% for rel in item.right_relations.all %} + {% ifchanged rel.relation_type %} + <h4>{{rel.relation_type}}</h4> + <div class="row">{% endifchanged %} + <div class="col-12"> + <a href="#" onclick="load_window('/show-operation/{{rel.right_record.pk}}/');" class="display_details"> + <i class="fa fa-info-circle" aria-hidden="true"></i> + </a> {{rel.right_record}} + </div> + {% if forloop.last %} + </div>{% endif %} + {% endfor %} + {% endif %} + </div> + {% endif %} + + {% if display_context_records %} + <div class="tab-pane fade" id="{{window_id}}-cr" + role="tabpanel" aria-labelledby="{{window_id}}-cr-tab"> + {% trans "Context records" as cr_lab %} + {% dynamic_table_document cr_lab 'context_records_for_ope' 'operation_id' item.pk 'TABLE_COLS_FOR_OPE' output %} + + {% if item.context_record_relations_q.count %} + {% trans "Context record relations" as cr_rels %} + {% dynamic_table_document cr_rels 'context_records_relations_detail' 'left_record__operation' item.pk '' output %} + {% endif %} -{% if permission_view_own_contextrecord or permission_view_contextrecord %} -{% if item.context_record.count %} -{% trans "Context records" as cr_lab %} -{% dynamic_table_document cr_lab 'context_records_for_ope' 'operation_id' item.pk 'TABLE_COLS_FOR_OPE' output %} -{% endif %} + {% if permission_view_own_document or permission_view_document %} + {% if item.context_record_docs_q.count %} + {% trans "Documents from associated context records" as cr_docs %} + {% dynamic_table_document cr_docs 'documents' 'context_records__operation' item.pk '' output %} + {% endif %} + {% if item.context_record_relations_q.count %} -{% if item.context_record_relations_q.count %} -{% trans "Context record relations" as cr_rels %} -{% dynamic_table_document cr_rels 'context_records_relations_detail' 'left_record__operation' item.pk '' output %} -{% endif %} + <h3>{% trans "Diagram of statigraphic relations" %}</h3> + {% with gen_url='generate-relation-image-contextrecord' %} -{% if permission_view_own_document or permission_view_document %} -{% if item.context_record_docs_q.count %} -{% trans "Documents from associated context records" as cr_docs %} -{% dynamic_table_document cr_docs 'documents' 'context_records__operation' item.pk '' output %} -{% endif %} -{% endif %} + {% with relation_type="full" %} + {% with relation_image=item.relation_image %} + {% with relation_png=item.relation_bitmap_image %} + {% with relation_dot=item.relation_dot %} + {% include "ishtar/blocks/sheet_relation_image.html" %} + {% endwith %}{% endwith %}{% endwith %}{% endwith %} -{% endif %} + {% endwith %} + {% endif %} + </div> + {% endif %} -{% if item.finds %} -{% trans "Finds" as finds %} -{% dynamic_table_document finds 'finds_for_ope' 'base_finds__context_record__operation' item.pk 'TABLE_COLS_FOR_OPE' output %} -{% endif %} + {% if display_finds %} + <div class="tab-pane fade" id="{{window_id}}-finds" + role="tabpanel" aria-labelledby="{{window_id}}-finds-tab"> + {% trans "Finds" as finds %} + {% dynamic_table_document finds 'finds_for_ope' 'base_finds__context_record__operation' item.pk 'TABLE_COLS_FOR_OPE' output %} + {% endif %} -{% if permission_view_own_document or permission_view_document %} -{% if item.find_docs_q.count %} -{% trans "Documents from associated finds" as finds_docs %} -{% dynamic_table_document finds_docs 'documents' 'finds__base_finds__context_record__operation' item.pk '' output %} -{% endif %} -{% endif %} + {% if perm_documents and item.find_docs_q.count %} + {% trans "Documents from associated finds" as finds_docs %} + {% dynamic_table_document finds_docs 'documents' 'finds__base_finds__context_record__operation' item.pk '' output %} + {% endif %} -{% if permission_view_own_container or permission_view_container %} -{% if item.containers_q.count %} -{% trans "Associated containers" as containers_lbl %} -{% dynamic_table_document containers_lbl 'containers' 'finds__base_finds__context_record__operation' item.pk '' output %} -{% endif %} -{% endif %} + {% if permission_view_own_container or permission_view_container %} + {% if item.containers_q.count %} + {% trans "Associated containers" as containers_lbl %} + {% dynamic_table_document containers_lbl 'containers' 'finds__base_finds__context_record__operation' item.pk '' output %} + {% endif %} + {% endif %} + </div> + {% endif %} -<h3>{% trans "Statistics" %}</h3> -<small class="centered"><em>{% trans "These numbers are updated hourly" %}</em></small> + {% if display_data %} + <div class="tab-pane fade" id="{{window_id}}-data" + role="tabpanel" aria-labelledby="{{window_id}}-data-tab"> + {% include "ishtar/blocks/sheet_json.html" %} + </div> + {% endif %} + <div class="tab-pane fade" id="{{window_id}}-statistics" + role="tabpanel" aria-labelledby="{{window_id}}-statistics-tab"> + <h3>{% trans "Statistics" %}</h3> + <small class="centered"><em>{% trans "These numbers are updated hourly" %}</em></small> + + <h4>{% trans "Administrative acts" %}</h4> + <div class='row'> + {% field_flex_2 "Number of administrative acts" item.nb_acts %} + {% field_flex_2 "Number of indexed administrative acts" item.nb_indexed_acts %} + </div> -<h4>{% trans "Administrative acts" %}</h4> -<div class='row'> -{% field_flex_2 "Number of administrative acts" item.nb_acts %} -{% field_flex_2 "Number of indexed administrative acts" item.nb_indexed_acts %} -</div> + <h4>{% trans "Parcels" %}</h4> + <div class='row'> + {% field_flex_2 "Number of parcels" item.nb_parcels %} + </div> -<h4>{% trans "Parcels" %}</h4> -<div class='row'> -{% field_flex_2 "Number of parcels" item.nb_parcels %} -</div> + <h4>{% trans "Context records" %}</h4> + <div class='row'> + {% field_flex_2 "Number of context records" item.nb_context_records %} + </div> + <div class='row'> + {% if item.nb_context_records_by_type %} + <div class="col-12 col-md-6 col-lg-4"> + <table class="table table-striped"> + <tr><th>{% trans "Type" %}</th><th>{% trans "Number" %}</th></tr> + {% for label, nb in item.nb_context_records_by_type %} + <tr><td>{{label|default:"-"}}</td><td>{{nb}}</td></tr> + {% endfor %} + </table> + </div> + {% endif %} + {% if item.nb_context_records_by_periods %} + <div class="col-12 col-md-6 col-lg-4"> + <table class="table table-striped"> + <tr><th>{% trans "Period" %}</th><th>{% trans "Number" %}</th></tr> + {% for label, nb in item.nb_context_records_by_periods %} + <tr><td>{{label|default:"-"}}</td><td>{{nb}}</td></tr> + {% endfor %} + </table> + </div> + {% endif %} + </div> -<h4>{% trans "Context records" %}</h4> -<div class='row'> -{% field_flex_2 "Number of context records" item.nb_context_records %} -</div> -<div class='row'> -{% if item.nb_context_records_by_type %} - <div class="col-12 col-md-6 col-lg-4"> - <table class="table table-striped"> - <tr><th>{% trans "Type" %}</th><th>{% trans "Number" %}</th></tr> - {% for label, nb in item.nb_context_records_by_type %} - <tr><td>{{label|default:"-"}}</td><td>{{nb}}</td></tr> - {% endfor %} - </table> - </div> -{% endif %} -{% if item.nb_context_records_by_periods %} - <div class="col-12 col-md-6 col-lg-4"> - <table class="table table-striped"> - <tr><th>{% trans "Period" %}</th><th>{% trans "Number" %}</th></tr> - {% for label, nb in item.nb_context_records_by_periods %} - <tr><td>{{label|default:"-"}}</td><td>{{nb}}</td></tr> - {% endfor %} - </table> - </div> -{% endif %} -</div> + <h4>{% trans "Finds" %}</h4> + <div class='row'> + {% field_flex_2 "Number of finds" item.nb_finds %} + </div> + <div class='row'> + {% if item.nb_finds_by_material_type %} + <div class="col-12 col-md-6 col-lg-4"> + <table class="table table-striped"> + <tr><th>{% trans "Material type" %}</th><th>{% trans "Number" %}</th></tr> + {% for label, nb in item.nb_finds_by_material_type %} + <tr><td>{{label|default:"-"}}</td><td>{{nb}}</td></tr> + {% endfor %} + </table> + </div> + {% endif %} + {% if item.nb_finds_by_types %} + <div class="col-12 col-md-6 col-lg-4"> + <table class="table table-striped"> + <tr><th>{% trans "Object type" %}</th><th>{% trans "Number" %}</th></tr> + {% for label, nb in item.nb_finds_by_types %} + <tr><td>{{label}}</td><td>{{nb}}</td></tr> + {% endfor %} + </table> + </div> + {% endif %} + {% if item.nb_finds_by_periods %} + <div class="col-12 col-md-6 col-lg-4"> + <table class="table table-striped"> + <tr><th>{% trans "Period" %}</th><th>{% trans "Number" %}</th></tr> + {% for label, nb in item.nb_finds_by_periods %} + <tr><td>{{label|default:"-"}}</td><td>{{nb}}</td></tr> + {% endfor %} + </table> + </div> + {% endif %} + </div> -<h4>{% trans "Finds" %}</h4> -<div class='row'> -{% field_flex_2 "Number of finds" item.nb_finds %} -</div> -<div class='row'> -{% if item.nb_finds_by_material_type %} - <div class="col-12 col-md-6 col-lg-4"> - <table class="table table-striped"> - <tr><th>{% trans "Material type" %}</th><th>{% trans "Number" %}</th></tr> - {% for label, nb in item.nb_finds_by_material_type %} - <tr><td>{{label|default:"-"}}</td><td>{{nb}}</td></tr> - {% endfor %} - </table> - </div> -{% endif %} -{% if item.nb_finds_by_types %} - <div class="col-12 col-md-6 col-lg-4"> - <table class="table table-striped"> - <tr><th>{% trans "Object type" %}</th><th>{% trans "Number" %}</th></tr> - {% for label, nb in item.nb_finds_by_types %} - <tr><td>{{label}}</td><td>{{nb}}</td></tr> - {% endfor %} - </table> - </div> -{% endif %} -{% if item.nb_finds_by_periods %} - <div class="col-12 col-md-6 col-lg-4"> - <table class="table table-striped"> - <tr><th>{% trans "Period" %}</th><th>{% trans "Number" %}</th></tr> - {% for label, nb in item.nb_finds_by_periods %} - <tr><td>{{label|default:"-"}}</td><td>{{nb}}</td></tr> - {% endfor %} - </table> - </div> -{% endif %} -</div> + <h4>{% trans "Sources" %}</h4> + <div class='row'> + {% field_flex "Number of sources" item.nb_documents %} + </div> + <div class='row'> + {% if item.nb_documents_by_types %} + <div class="col-12 col-md-6 col-lg-4"> + <table class="table table-striped"> + <tr><th>{% trans "Type" %}</th><th>{% trans "Number" %}</th></tr> + {% for label, nb in item.nb_documents_by_types %} + <tr><td>{{label}}</td><td>{{nb}}</td></tr> + {% endfor %} + </table> + </div> + {% endif %} + </div> -<h4>{% trans "Sources" %}</h4> -<div class='row'> -{% field_flex "Number of sources" item.nb_documents %} -</div> -<div class='row'> -{% if item.nb_documents_by_types %} - <div class="col-12 col-md-6 col-lg-4"> - <table class="table table-striped"> - <tr><th>{% trans "Type" %}</th><th>{% trans "Number" %}</th></tr> - {% for label, nb in item.nb_documents_by_types %} - <tr><td>{{label}}</td><td>{{nb}}</td></tr> - {% endfor %} - </table> + {% if item.nb_stats_finds_by_ue %} + <h4>{% trans "Finds by context records" %}</h4> + <div class='row'> + {% field_flex_2 "Mean" item.nb_stats_finds_by_ue.mean %} + {% field_flex_2 "Min" item.nb_stats_finds_by_ue.min %} + {% field_flex_2 "Max" item.nb_stats_finds_by_ue.max %} + {% field_flex_2 "Mode" item.nb_stats_finds_by_ue.mode %} + </div> + {% endif %} </div> -{% endif %} </div> -{% if item.nb_stats_finds_by_ue %} -<h4>{% trans "Finds by context records" %}</h4> -<div class='row'> -{% field_flex_2 "Mean" item.nb_stats_finds_by_ue.mean %} -{% field_flex_2 "Min" item.nb_stats_finds_by_ue.min %} -{% field_flex_2 "Max" item.nb_stats_finds_by_ue.max %} -{% field_flex_2 "Mode" item.nb_stats_finds_by_ue.mode %} -</div> -{% endif %} +{% endwith %} {% endwith %} {% endwith %} {% endwith %} {% endwith %} {% endwith %} {% endwith %} {% endwith %} {% endwith %} {% endwith %} {% endwith %} {% endwith %} {% endwith %} {% endwith %} {% endwith %} {% endwith %} {% endwith %} {% endblock %}
\ No newline at end of file |