diff options
| -rw-r--r-- | archaeological_context_records/templates/ishtar/sheet_contextrecord.html | 437 | ||||
| -rw-r--r-- | ishtar_common/templates/ishtar/blocks/sheet_relation_image.html | 33 | 
2 files changed, 309 insertions, 161 deletions
| diff --git a/archaeological_context_records/templates/ishtar/sheet_contextrecord.html b/archaeological_context_records/templates/ishtar/sheet_contextrecord.html index 0e3138583..284ea7f32 100644 --- a/archaeological_context_records/templates/ishtar/sheet_contextrecord.html +++ b/archaeological_context_records/templates/ishtar/sheet_contextrecord.html @@ -1,5 +1,5 @@  {% extends "ishtar/sheet.html" %} -{% load i18n window_field window_header window_tables window_field %} +{% load i18n ishtar_helpers window_field window_header window_tables window_field %}  {% block head_title %}<strong>{% trans "Context Record" %}</strong> - {{item.full_label}}{% endblock %} @@ -9,189 +9,304 @@  {% block content %} -<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"> -            <p class="card-text"> -            <p class='window-refs'>{{ item.parcel.short_label }}</p> -            <p class="window-refs">{{ item.label|default:"" }}</p> -            {% include "ishtar/blocks/sheet_external_id.html" %} -            </p> -        </div> -    </div> +{% with permission_view_document=permission_view_document %} +{% with permission_view_own_document=permission_view_own_document %} +{% with can_view_documents=permission_view_own_document|or_:permission_view_document %} +{% with display_documents=can_view_documents|and_:item.documents.count %} +{% with display_relations=item.right_relations.count|or_:item.left_relations.count %} +{% with has_image=item.images.count %} +{% with display_interpretation=item.activity|or_:item.identification|or_:item.interpretation|or_:item.filling %} +{% with display_datations=item.taq|or_:item.taq_estimated|or_:item.tpq|or_:item.tpq_estimated %} +{% with can_view_finds=permission_view_own_find|or_:permission_view_find %} +{% with display_finds=item.base_finds.count|and_:can_view_finds %} +{% with display_data=item.data %} -    <div class='row'> -        {% field_flex_2 "Complete ID" item.full_label %} -        {% field_flex_2 "Type" item.unit %} -        {% with has_image=item.images.count %} +{% 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}}-identification-tab" +           data-toggle="tab" href="#{{window_id}}-identification" role="tab" +           aria-controls="{{window_id}}-identification" aria-selected="false"> +            {% trans "Identification / Description" %} +        </a> +    </li> +    {% if display_interpretation %} +    <li class="nav-item"> +        <a class="nav-link" id="{{window_id}}-intrepretation-tab" +           data-toggle="tab" href="#{{window_id}}-interpretation" role="tab" +           aria-controls="{{window_id}}-interpretation" aria-selected="false"> +            {% trans "Interpretation" %} +        </a> +    </li> +    {% endif %} +    {% if display_datations %} +    <li class="nav-item"> +        <a class="nav-link" id="{{window_id}}-datations-tab" +           data-toggle="tab" href="#{{window_id}}-datations" role="tab" +           aria-controls="{{window_id}}-datations" aria-selected="false"> +            {% trans "Datations" %} +        </a> +    </li> +    {% endif %} +    <li class="nav-item"> +        <a class="nav-link" id="{{window_id}}-operation-tab" +           data-toggle="tab" href="#{{window_id}}-operation" role="tab" +           aria-controls="{{window_id}}-operation" aria-selected="false"> +            {% trans "Operation / Archaelogical site" %} +        </a> +    </li> +    {% 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_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_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}}-treatments" aria-selected="false"> +            {% trans "Documents" %} +        </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 %} +</ul> +{% endif %} -        {% if not has_image %} -    </div> -</div> -<div class="row"> +<div class="tab-content" id="{{window_id}}-tab-content"> + +  <div class="tab-pane fade show active" id="{{window_id}}-identification" +       role="tabpanel" aria-labelledby="{{window_id}}-identification-tab"> +        {% if has_image %} +        <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"> +                    <p class="card-text"> +                    <p class='window-refs'>{{ item.parcel.short_label }}</p> +                    <p class="window-refs">{{ item.label|default:"" }}</p> +                    {% include "ishtar/blocks/sheet_external_id.html" %} +                    </p> +                </div> +            </div> +        </div>          {% endif %} +        <div class='row'> +            {% field_flex_2 "Complete ID" item.full_label %} +            {% field_flex_2 "Type" item.unit %} +        </div> +        <h3>{% trans "Description"%}</h3> +        <div class="row"> +            {% field_flex "Excavation technic" item.excavation_technic '' '' has_image %} +            {% field_flex_multiple_obj "Chronology" item 'datings' has_image %} +            {% field_flex "Town" item.town.label_with_areas '' '' has_image %} +            {% field_flex_multiple_obj "Documentation" item 'documentations' has_image %} +            {% field_flex "Opening date" item.opening_date '' '' has_image %} +            {% field_flex "Closing date" item.closing_date '' '' has_image %} +            {% field_flex_full "Comment on datings" item.datings_comment "<pre>" "</pre>" has_image %} +            {% field_flex_full "Description" item.description "<pre>" "</pre>" has_image %} +            {% field_flex_full "Comment" item.comment "<pre>" "</pre>" has_image %} +            {% field_flex "Length (m)" item.lenght '' '' has_image %} +            {% field_flex "Width (m)" item.width '' '' has_image %} +            {% field_flex "Diameter (m)" item.diameter '' '' has_image %} +            {% field_flex "Depth (m)" item.depth '' '' has_image %} +            {% field_flex "Thickness (m)" item.thickness '' '' has_image %} +            {% field_flex "Depth of appearance (m)" item.depth_of_appearance '' '' has_image %} +        </div> -        {% field_flex "Excavation technic" item.excavation_technic '' '' has_image %} -        {% field_flex_multiple_obj "Chronology" item 'datings' has_image %} -        {% field_flex "Town" item.town.label_with_areas '' '' has_image %} -        {% field_flex_multiple_obj "Documentation" item 'documentations' has_image %} -        {% field_flex "Opening date" item.opening_date '' '' has_image %} -        {% field_flex "Closing date" item.closing_date '' '' has_image %} -        {% field_flex_full "Comment on datings" item.datings_comment "<pre>" "</pre>" has_image %} +        <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"> +                {% field_flex_multiple_full "Towns" item.operation.towns %} +                {% include "ishtar/blocks/sheet_coordinates.html"%} +            </div> +            {% endwith %} +        </div> + +        <h3>{% trans "Sheet" %}</h3> +        <div class="row"> +            {% include "ishtar/blocks/sheet_creation_section.html" %} +        </div> +    </div> +    {% if display_interpretation %} +    <div class="tab-pane fade" id="{{window_id}}-intrepretation" +       role="tabpanel" aria-labelledby="{{window_id}}-intrepretation-tab"> +        <h3>{% trans "Interpretation"%}</h3> +        <div class='row'> +            {% field_flex_multiple "Documentation" item.documentations %} +            {% field_flex "Activity" item.activity %} +            {% field_flex "Identification" item.identification %} +            {% field_flex_full "Filling" item.filling "<pre>" "</pre>" %} +            {% field_flex_full "Interpretation" item.interpretation "<pre>" "</pre>" %} +        </div>      </div> +    {% endif %} -    {% if item.diameter or item.depth_of_appearance or item.documentations.count or item.description or item.lenght or item.width or item.depth or item.thickness or item.comment %} -    <h3>{% trans "Description"%}</h3> -    <div class='row'> -        {% field_flex_full "Description" item.description "<pre>" "</pre>" has_image %} -        {% field_flex_full "Comment" item.comment "<pre>" "</pre>" has_image %} -        {% field_flex "Length (m)" item.lenght '' '' has_image %} -        {% field_flex "Width (m)" item.width '' '' has_image %} -        {% field_flex "Diameter (m)" item.diameter '' '' has_image %} -        {% field_flex "Depth (m)" item.depth '' '' has_image %} -        {% field_flex "Thickness (m)" item.thickness '' '' has_image %} -        {% field_flex "Depth of appearance (m)" item.depth_of_appearance '' '' has_image %} +    {% if display_datations %} +    <div class="tab-pane fade" id="{{window_id}}-datations" +       role="tabpanel" aria-labelledby="{{window_id}}-datations-tab"> +        <h3>{% trans "Datations"%}</h3> +        <div class='row'> +            {% field_flex "TAQ" item.taq %} +            {% field_flex "Estimated TAQ" item.taq_estimated %} +            {% field_flex "TPQ" item.tpq %} +            {% field_flex "Estimated TPQ" item.tpq_estimated %} +        </div>      </div>      {% endif %} -{% if has_image %} -</div> -{% endif %} -{% endwith %} - -{% if item.activity or item.identification or item.interpretation %} -<h3>{% trans "Interpretation"%}</h3> -<div class='row'> -    {% field_flex_multiple "Documentation" item.documentations %} -    {% field_flex "Activity" item.activity %} -    {% field_flex "Identification" item.identification %} -    {% field_flex_full "Filling" item.filling "<pre>" "</pre>" %} -    {% field_flex_full "Interpretation" item.interpretation "<pre>" "</pre>" %} -</div> -{% endif %} +    <div class="tab-pane fade" id="{{window_id}}-operation" +       role="tabpanel" aria-labelledby="{{window_id}}-operation-tab"> -{% if item.taq or item.taq_estimated or item.tpq or item.tpq_estimated %} -<h3>{% trans "Datations"%}</h3> -<div class='row'> -    {% field_flex "TAQ" item.taq %} -    {% field_flex "Estimated TAQ" item.taq_estimated %} -    {% field_flex "TPQ" item.tpq %} -    {% field_flex "Estimated TPQ" item.tpq_estimated %} -</div> -{% endif %} +        {% if item.operation %} +        <h3>{% trans "Operation summary"%}</h3> +        {% if not item.operation.code_patriarche %} +        <div class="alert alert-warning" role="alert"> +            {%trans "Patriarche OA code not yet recorded!"%} +        </div> +        {% endif %} +        <div class='row'> +                {% field_flex_detail_full "Operation" item.operation %} +            {% field_flex "Year" item.operation.year %} +            {% trans "Numerical reference" as num_ref_label %} +            {% field_flex num_ref_label item.operation.operation_code %} +            {% field_flex "Patriarche OA code" item.operation.code_patriarche %} +            {% field_flex_detail "Head scientist" item.operation.scientist %} -<h3>{% trans "Sheet"%}</h3> -<div class="row"> -    {% include "ishtar/blocks/sheet_creation_section.html" %} -</div> +            <dl class="col-12 col-md-6 col-lg-4 d-flex flex-wrap row"> +                <dt class="col-5">{% trans "State" %}</dt> +                <dd class="col-7">{% if item.operation.is_active %}{% trans "Active file" %}{% else %}{%trans "Closed operation" %}{% endif %}</dd> +            </dl> -{% include "ishtar/blocks/sheet_json.html" %} +            {% if not item.operation.is_active %} +            <dl class="col-12 col-md-6 col-lg-4 d-flex flex-wrap row"> +                <dt class="col-5">{%trans "Closing date"%}</dt> +                <dd class="col-7"> +                    {{ item.operation.closing.date }} <strong>{%trans "by" %}</strong> {{ item.operation.closing.user }} +                </dd> +            </dl> +            {% endif %} +            {% field_flex "Type" item.operation.operation_type %} +            {% field_flex_multiple "Remains" item.operation.remains %} +            {% field_flex_multiple "Periods" item.operation.periods %} +            {% field_flex_full "Comment" item.operation.comment "<pre>" "</pre>" %} +        </div> -{% trans "Context record relations" as cr_rels %} -{% if item.right_relations.count %} -{% dynamic_table_document cr_rels 'context_records_relations' 'left_record_id' item.pk '' output %} +        {% else %} +        <div class="alert alert-warning" role="alert"> +            {% trans "No operation linked to this context record!" %} +        </div> +        {% endif %} -{% 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> -{% endif %} +        {% if item.archaeological_site %} +        <h3>{% trans SITE_LABEL %}</h3> +        <div class='row'> +            {% field_flex_detail SITE_LABEL item.archaeological_site %} +            {% field_flex_full "Towns" item.archaeological_site.towns_codes|join:" ; "  %} +        </div> +        {% endif %} +    </div> -{% if DOT_GENERATION %} -<p class="text-center mt-1"> -    <a class="btn btn-secondary" -       onclick="long_wait();return true;" -       href="{% url 'generate-relation-image-contextrecord' item.pk %}"> -        {% if item.relation_image %} -        {% trans "Re-generate image" %} -        {% else %} -        {% trans "Generate image" %} +    {% if display_finds %} +    <div class="tab-pane fade" id="{{window_id}}-finds" +       role="tabpanel" aria-labelledby="{{window_id}}-finds-tab"> + +        {% trans "Finds" as finds %} +        {% if item.base_finds.count %} +        {% dynamic_table_document finds 'finds_for_ope' 'base_finds__context_record' item.pk 'TABLE_COLS_FOR_OPE' output %}          {% endif %} -    </a> -</p> -{% endif %} -<hr> -{% endif %} -{% if item.operation %} -<h3>{% trans "Operation summary"%}</h3> -{% if not item.operation.code_patriarche %} -<div class="alert alert-warning" role="alert"> -    {%trans "Patriarche OA code not yet recorded!"%} -</div> -{% endif %} -<div class='row'> -    {% field_flex "Year" item.operation.year %} -    {% trans "Numerical reference" as num_ref_label %} -    {% field_flex num_ref_label item.operation.operation_code %} -    {% field_flex "Patriarche OA code" item.operation.code_patriarche %} -    {% field_flex_detail "Head scientist" item.operation.scientist %} - -    <dl class="col-12 col-md-6 col-lg-4 d-flex flex-wrap row"> -        <dt class="col-5">{% trans "State" %}</dt> -        <dd class="col-7">{% if item.operation.is_active %}{% trans "Active file" %}{% else %}{%trans "Closed operation" %}{% endif %}</dd> -    </dl> - -    {% if not item.operation.is_active %} -    <dl class="col-12 col-md-6 col-lg-4 d-flex flex-wrap row"> -        <dt class="col-5">{%trans "Closing date"%}</dt> -        <dd class="col-7"> -            {{ item.operation.closing.date }} <strong>{%trans "by" %}</strong> {{ item.operation.closing.user }} -        </dd> -    </dl> +        {% trans "Documents from associated finds" as finds_docs %} +        {% if permission_view_own_document or permission_view_document %} +        {% if item.find_docs_q.count %} +        {% dynamic_table_document finds_docs 'documents' 'finds__base_finds__context_record' item.pk '' output %} +        {% endif %} +        {% endif %} +    </div>      {% endif %} -    {% field_flex "Type" item.operation.operation_type %} -    {% field_flex_multiple "Remains" item.operation.remains %} -    {% field_flex_multiple "Periods" item.operation.periods %} -    {% field_flex_full "Comment" item.operation.comment "<pre>" "</pre>" %} -</div> -<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"> -        {% field_flex_multiple_full "Towns" item.operation.towns %} -        {% field_flex_detail_full "Operation" item.operation %} -        {% include "ishtar/blocks/sheet_coordinates.html"%} -    </div> -    {% endwith %} -</div> +    {% if display_relations %} +    <div class="tab-pane fade" id="{{window_id}}-relations" +       role="tabpanel" aria-labelledby="{{window_id}}-relations-tab"> -{% else %} -<div class="alert alert-warning" role="alert"> -    {% trans "No operation linked to this context record!" %} -</div> -{% endif %} +        {% trans "Context record relations" as cr_rels %} +        {% dynamic_table_document cr_rels 'context_records_relations' 'left_record_id' item.pk '' output %} -{% if item.archaeological_site %} -<h3>{% trans SITE_LABEL %}</h3> -<div class='row'> -    {% field_flex_detail SITE_LABEL item.archaeological_site %} -    {% field_flex_full "Towns" item.archaeological_site.towns_codes|join:" ; "  %} -</div> -{% endif %} +        {% if item.relation_image or DOT_GENERATION %} +        {% with gen_url='generate-relation-image-contextrecord' %} -{% trans "Document from this context record" as cr_docs %} -{% if permission_view_own_document or permission_view_document %} -{% if item.documents.count %} -{% dynamic_table_document cr_docs 'documents' 'context_records' item.pk '' output %} -{% endif %} -{% endif %} +        <h3>{% trans "Diagram of statigraphic relations - full" %}</h3> +        {% with relation_type="" %} +        {% 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 %} -{% trans "Finds" as finds %} -{% if item.base_finds.count %} -{% dynamic_table_document finds 'finds_for_ope' 'base_finds__context_record' item.pk 'TABLE_COLS_FOR_OPE' output %} -{% endif %} +        <h3>{% trans "Diagram of statigraphic relations - bellow" %}</h3> +        {% with relation_type="bellow" %} +        {% with relation_image=item.relation_image_bellow %} +        {% with relation_png=item.relation_bitmap_image_bellow %} +        {% with relation_dot=item.relation_dot_bellow %} +        {% include "ishtar/blocks/sheet_relation_image.html" %} +        {% endwith %}{% endwith %}{% endwith %}{% endwith %} -{% trans "Documents from associated finds" as finds_docs %} -{% if permission_view_own_document or permission_view_document %} -{% if item.find_docs_q.count %} -{% dynamic_table_document finds_docs 'documents' 'finds__base_finds__context_record' item.pk '' output %} -{% endif %} -{% endif %} +        <h3>{% trans "Diagram of statigraphic relations - above" %}</h3> +        {% with relation_type="above" %} +        {% with relation_image=item.relation_image_above %} +        {% with relation_png=item.relation_bitmap_image_above %} +        {% with relation_dot=item.relation_dot_above %} +        {% include "ishtar/blocks/sheet_relation_image.html" %} +        {% endwith %}{% endwith %}{% endwith %}{% endwith %} + +        {% endwith %} +        {% endif %} +    </div> +    {% endif %} + +    {% if display_documents %} +    <div class="tab-pane fade" id="{{window_id}}-relations" +       role="tabpanel" aria-labelledby="{{window_id}}-relations-tab"> +        {% trans "Document from this context record" as cr_docs %} +        {% if permission_view_own_document or permission_view_document %} +        {% if item.documents.count %} +        {% dynamic_table_document cr_docs 'documents' 'context_records' item.pk '' output %} +        {% endif %} +        {% endif %} +    </div> +    {% endif %} + +    {% 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> + +{% endwith %} {% endwith %} {% endwith %} {% endwith %} {% endwith %} {% endwith %} {% endwith %} {% endwith %} {% endwith %} {% endwith %} {% endwith %}  {% endblock %} diff --git a/ishtar_common/templates/ishtar/blocks/sheet_relation_image.html b/ishtar_common/templates/ishtar/blocks/sheet_relation_image.html new file mode 100644 index 000000000..971fcda06 --- /dev/null +++ b/ishtar_common/templates/ishtar/blocks/sheet_relation_image.html @@ -0,0 +1,33 @@ +{% load i18n %}{% if relation_image %} +<div id="lightgallery-{{window_id}}-relation-image{{type}} text-center"> +    {% if output != "ODT" %}<a href="{{relation_image.url}}">{% endif %} +    <img src="{{relation_image.url}}" class="img-fluid img-thumbnail"> +    {% if output != "ODT" %}</a>{% endif %} +</div> +{% endif %} + +{% if DOT_GENERATION and output != "ODT" and output != "PDF" %} +<div class='row mt-2 mb-2'> +    <div class="col"> +        <div class="btn-group btn-group-sm" role="group" aria-label="Exporter"> +            {% if relation_image %}<a class="btn btn-secondary" target="_blank" href="{{relation_image.url}}"> +                <i class="fa fa-file-image-o" aria-hidden="true"></i> SVG +            </a>{% endif %} +            {% if relation_png %}<a class="btn btn-secondary" target="_blank" href="{{relation_png.url}}"> +                <i class="fa fa-file-image-o" aria-hidden="true"></i> PNG +            </a>{% endif %} +            {% if relation_dot %}<a class="btn btn-secondary" target="_blank" href="{{relation_dot.url}}"> +                <i class="fa fa-file-o" aria-hidden="true"></i> DOT +            </a>{% endif %} +            <a class="btn btn-success" onclick="long_wait();return true;" +                href="{% url gen_url item.pk relation_type %}"> +                {% if relation_image %} +                {% trans "Re-generate image" %} +                {% else %} +                {% trans "Generate image" %} +                {% endif %} +            </a> +        </div> +    </div> +</div> +{% endif %} | 
