summaryrefslogtreecommitdiff
path: root/ishtar_common/templates/ishtar/sheet_area.html
blob: 8c343f9aa363a6a9cb67b1829a3621e791176bd0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
{% extends "ishtar/sheet.html" %}
{% load i18n ishtar_helpers window_tables window_header window_field from_dict link_to_window %}

{% block head_title %}<strong>{% trans "Area" %}</strong> - {{item.name}}{% if item.reference %} ({{item.reference}}){% endif %}{% endblock %}

{% block toolbar %}
{% window_nav item window_id 'show-area' %}
{% endblock %}

{% block content %}

{# 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_change_own_geovectordata=permission_change_own_geovectordata %}
{% with permission_change_geovectordata=permission_change_geovectordata %}

{% with permission_change_geo=permission_change_own_geovectordata|or_:permission_change_geovectordata %}

{% with perm_documents=permission_view_own_document|or_:permission_view_document %}
{% with has_documents=item|safe_or:"documents.count|documents_list" %}
{% with display_documents=perm_documents|and_:has_documents %}

{% 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>
    {% comment %}
    TODO: geo for areas
    {% if not is_external and SHOW_GEO %}
    <li class="nav-item">
        <a class="nav-link" id="{{window_id}}-geodata-tab"
           data-toggle="tab" href="#{{window_id}}-geodata" role="tab"
           aria-controls="{{window_id}}-geodata" aria-selected="false">
            {% trans "Geographic data" %}
        </a>
    </li>
    {% endif %}
    {% endcomment %}
</ul>
{% endif %}

<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 text-center">
                            {% if item.reference %}
                            <strong>{{ item.reference }}</strong>{% endif %}
                        </div>
                    </div>
                    <div class="card-text text-center">
                        <p class='window-refs' title="{% trans 'Name' %}">{{item.name}}</p>
                    </div>
                </div>
            </div>

            <div class="row">
                <dl class="col-12 col-md-9 col-lg-9 flex-wrap">
                    <dt>{% trans "Towns" %}</dt>
                    <dd>{% for town in item.towns.all %}{% if forloop.counter0 %}&nbsp;; {% endif %}<span style="white-space: nowrap;">{{town}}{{town|simple_link_to_window}}</span>{% endfor %}</dd>
                </dl>
                {% with has_image=item.images.count %}
                {% if not has_image %}
            </div>
        </div>
            {% endif %}
            {% if has_image %}
        </div></div> {# <div> #}
            {% endif %}
            {% endwith %}
            <hr class="clearfix">
        {% comment %}
        {% if PROFILE.mapping and geo_item.main_geodata %}
        <h3>{% trans "Geographic localisation" %}</h3>
        <div class="row">
            {% with geo_item=item %}
            {% include "ishtar/blocks/sheet_map.html"%}
            {% endwith %}
        </div>
        {% endif %}
        {% endcomment %}

    {% if display_documents and item.documents.count %}
    {% trans "Documents" as area_docs %}
    {% dynamic_table_document area_docs 'documents' 'areas' item.pk '' output %}
    {% endif %}

    </div>
    {% if not is_external and SHOW_GEO %}
    <div class="tab-pane fade" id="{{window_id}}-geodata"
         role="tabpanel" aria-labelledby="{{window_id}}-geodata-tab">
        {% with geo_item=item %}{% include "ishtar/blocks/sheet_geographic.html" %}{% endwith %}
    </div>
    {% endif %}

</div>


<script type="text/javascript">
$(document).ready( function () {
    datatable_options = {
        "dom": 'ltip',
    };
    $.extend(datatable_options, datatables_static_default);
    if (datatables_i18n) datatable_options['language'] = datatables_i18n;
    $('.datatables').each(
        function(){
            var dt_id = "#" + $(this).attr('id');
            if (! $.fn.DataTable.isDataTable(dt_id) ) {
                $(dt_id).DataTable(datatable_options);
            }
         });
} );
</script>

{% endwith %} {% endwith %} {% endwith %} {% endwith %} {% endwith %} {% endwith %} {% endwith %} {% endwith %}

{% endblock %}