summaryrefslogtreecommitdiff
path: root/ishtar_common/templates/ishtar/sheet.html
blob: 6dbe7aff01d072cfa541317e17f1caf4d24a6b80 (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
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
{% load i18n l10n ishtar_helpers %}{% block main_head %}<html lang="en">
<head>
    <title>{% block title %}Ishtar{% if APP_NAME %} - {{APP_NAME}}{%endif%}{% endblock %}
    </title>
    {% block header %}
    <link rel="stylesheet" href="{{STATIC_URL}}/media/style.css?ver={{VERSION}}" />
    {% endblock %}
</head>
<body>
{% endblock %}
  <div class="card sheet" id="{{window_id}}">

    {% if output != "ODT" and output != "PDF" %}
    <div class="card-header" data-sheet-id="{{sheet_id}}" role="tab" id='head-{{window_id}}'>
      <div class="row">
          <div class="col-9">
              <h5 class="mb-0">
                <a class="card-label" data-toggle="collapse"
                    href="#collapse-{{window_id}}" aria-expanded="true"
                   aria-controls="collapse-{{window_id}}">
                    <span class="sheet-caret caret-{{window_id}}"><i class="fa fa-caret-down" aria-hidden="true"></i></span>
    {% else %}
      {% if item.qrcode.name %}
      <table class="window-table-head">
        <tr>
          <td> <img class="qrcode" src="{{BASE_URL}}{{item.qrcode.url}}"> </td>
          <td>
      {% endif %}
            <h2>
    {% endif %}
                    {% block head_title %}{% endblock %}
    {% if output == "ODT" or output == "PDF" %}
            </h2>
      {% if item.qrcode.name %}
          </td>
        </tr>
      </table>
      {% endif %}
    {% else %}
                </a>
              </h5>
          </div>
          <div class='col-2 text-center'>
              <a href='#' class='previous_page' title="{% trans 'Previous page [Ctrl+🡄]' %}">
                <span class="fa-stack">
                  <i class="fa fa-circle fa-stack-2x"></i>
                  <i class="fa fa-arrow-left fa-stack-1x fa-inverse"></i>
                </span>
              </a>
              <a href='#' class='next_page' title="{% trans 'Next page [Ctrl+🡆]' %}">
                <span class="fa-stack">
                  <i class="fa fa-circle fa-stack-2x"></i>
                  <i class="fa fa-arrow-right fa-stack-1x fa-inverse"></i>
                </span>
              </a>
          </div>
          <div class='col-1 text-right'>
            <a href='#' onclick='hide_window("{{window_id}}")'
               title="{% trans 'Close [Esc]' %}">
              <span class="fa-stack">
                <i class="fa fa-circle fa-stack-2x"></i>
                <i class="fa fa-times fa-stack-1x fa-inverse"></i>
              </span>
            </a>
          </div>
      </div>
      {% endif %}
      {% block header_title %}{% endblock %}
    </div>

    <div id="collapse-{{window_id}}" class="collapse show" role="tabpanel"
         aria-labelledby="heading-{{window_id}}" data-parent="#window">
      {% if output != "ODT" and output != "PDF"%}
      {% block toolbar %}{% endblock %}
      {% endif %}
      <div class="card-body">
        {% if output != "ODT" and output != "PDF" %}
        {% block head_sheet %}
        <script type="text/javascript">{% localize off %}
        var last_window = '{{window_id}}';
        var current_url_{{window_id_underscore}} = "{{current_window_url}}{{item.pk}}/";
        jQuery(document).ready(function(){
            if (! get_next_table_id("{{item.pk}}")){
                jQuery('.next_page').hide();
            }
            if (! get_previous_table_id("{{item.pk}}")){
                jQuery('.previous_page').hide();
            }
            jQuery(".next_page").click(function() {
                load_window("{{current_window_url}}" + get_next_table_id("{{item.pk}}") + "/",
                            '', function(){hide_window("{{window_id}}");},
                            true);
            });
            jQuery(".previous_page").click(function() {
                load_window("{{current_window_url}}" + get_previous_table_id("{{item.pk}}") + "/",
                            '', function(){hide_window("{{window_id}}");},
                            true);
            });
            {% if item.images.count %}
            var lg = document.getElementById('lightgallery-{{window_id}}');
            lg.addEventListener('onAfterAppendSubHtml', function(e){
                $(".lg-sub-html").show();
                $(".lg-sub-html .close").click(function(){
                    $(".lg-sub-html").hide();
                });
            }, false);
            lightGallery(lg);
            {% endif%}
            {% if item.relation_image %}
            lightGallery(document.getElementById('lightgallery-{{window_id}}-relation-image'));
            {% endif%}

            var hash = window.location.hash.substr(1);
            if (hash){
              $('#{{window_id}}-tabs a[href="#{{window_id}}-' + hash + '"]').tab('show');
            }

            $("#collapse-{{window_id}}").on("hidden.bs.collapse", function () {
                $(".card-label .caret-{{window_id}}").html('<i class="fa fa-caret-right" aria-hidden="true"></i>');
            });
            $("#collapse-{{window_id}}").on("shown.bs.collapse", function () {
                $(".card-label .caret-{{window_id}}").html('<i class="fa fa-caret-down" aria-hidden="true"></i>');
            });
            $('a[data-toggle="tab"]').on('shown.bs.tab', function (e) {
                $(e.target).resize();  // fix table header refresh for datatable
                let target = $(e.target).attr("aria-controls");
                if ($("#" + target + " .ol-viewport").length){
                    update_all_map_display();
                }
            })
        });
        {% endlocalize %}</script>
        {% endblock %}
        {% endif %}
        <div class="body">
            {% if item.locked %}
            <div class="alert alert-warning" role="alert">
                {% if item|is_locked:request.user %}
                <i class="fa fa-lock text-danger" aria-hidden="true"></i>&nbsp;
                {% if item.lock_user %}{% blocktrans with locker=item.lock_user.ishtaruser %}
                This item has been locked by {{locker}}. Edition is disabled.
                {% endblocktrans %}{% else %}
                {% trans "This item has been locked. Edition is disabled." %}
                {% endif %}
                {% else %}
                <i class="fa fa-lock text-success" aria-hidden="true"></i>&nbsp;
                {% trans "You have locked this item." %}
                {% endif %}
            </div>
            {% endif %}
        {% block content %}
        {% endblock %}
        </div>
      </div>
    </div>
  </div>
</div>
{%block main_foot%}
</body>
</html>
{%endblock%}