aboutsummaryrefslogtreecommitdiffstats
path: root/templates/registration/base_admin.html
blob: 9643e350cab1318b3fdb166ab528ccf9cd7022b6 (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
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
{% load app_filter %}
{% with color=request.session.superuser|su_color %}
{% with hexcolor="#ef5350" %}
{% with hexlightcolor="#ef9a9a" %}
<!DOCTYPE html>
<html>
<head>
  {% load static %}
  <link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
  <link rel="stylesheet" type="text/css" href="{% static 'materialize.min.css' %}">
  <link rel="stylesheet" type="text/css" href="{% static 'tabulator/css/tabulator.min.css' %}">
  <style>
    input[type=text]:focus + label, .materialize-textarea:focus:not([readonly]) + label {
      color: {{hexcolor}} !important;
    }

    input[type=text]:focus, .materialize-textarea:focus:not([readonly]) {
      border-bottom: 1px solid {{hexcolor}} !important;
      box-shadow: 0 1px 0 0 {{hexcolor}} !important;
    }

    input[type=password]:focus, .materialize-textarea:focus:not([readonly]) {
      border-bottom: 1px solid {{hexcolor}} !important;
      box-shadow: 0 1px 0 0 {{hexcolor}} !important;
    }

    [type="checkbox"].filled-in:checked + span:not(.lever)::after {
     border: 2px solid {{hexcolor}} !important;
     background-color: {{hexcolor}} !important;
    }

    .switch label input[type="checkbox"]:checked + .lever {
      background-color: {{hexlightcolor}};
    }

    .switch label input[type="checkbox"]:checked + .lever::after {
      background-color: {{hexcolor}};
    }

    .progress .indeterminate {
      background-color: {{hexcolor}};
    }

    .progress .determinate {
      background-color: {{hexcolor}};
    }

    .progress {
      background-color: {{hexlightcolor}};
    }

    .dropdown-content li > a, .dropdown-content li > span {
      color: {{hexcolor}};
    }

    .datepicker-date-display {
      background-color: {{hexcolor}};
    }

    .datepicker-table td.is-selected {
      background-color: {{hexcolor}};
    }

    .datepicker-table td.is-today {
      color: {{hexcolor}};
    }

    .datepicker-cancel, .datepicker-today, .datepicker-done {
      color: black;
    }

    blockquote {
      border-left: 5px solid {{hexcolor}};
    }

  @media only screen and (max-width: 992px) {
   .modal {
     width: 95% !important;
     max-height: 90% !important;
   }
  }

  .embedded-row:hover{ background-color: #e5e5e5 !important;}
  </style>
  <meta name="viewport" content="width=device-width, initial-scale=1.0"/>
  <meta charset="utf-8">
  <title>{% block title %}Scout Brega{% endblock %}</title>
</head>
<body>
  {% if request.user.is_impersonate %}
    <div class="navbar-fixed" style="height: 32px; line-height: 32px;">
      <nav style="height: 32px; line-height: 32px;">
        <div class="nav-wrapper">
          <p style="margin-top: 0px; margin-bottom: 0px; margin-left: 10px; margin-right: 10px;">
            Stai impersonando l'utente {{request.user}}
            <a href="{% url 'impersonate-stop' %}" style="text-decoration: underline;">Chiudi impersonazione</a>
          </p>
        </div>
      </nav>
    </div>
  {% endif %}
  <nav class="nav-extended">
    <form id="su_change" method="post" action="{% url 'server'%}">
      {% csrf_token %}
      <input type="hidden" name="su_status" id="su_status">
    </form>
    <form id="user_form" method="post" action="{% url 'user_switcher'%}">
    {% csrf_token %}
    <input type="hidden" name="metadata" id="metadata">
    <div class="nav-wrapper {{color}}">
      <ul class="left">
      <li><a id="home_btn" href="{% url 'index' %}"><i class="material-icons">home</i></a></li>
      </ul>
      {% block breadcrumb %}
      {% endblock %}
      <ul class="right">
        {% if user.is_staff or perms.client.staff %}
          <li class="userswitcher" data-target='userswitcher'><a href="#">{{ user.username }}<i class="right material-icons">admin_panel_settings</i></a></li>
        {% elif "capi" in user|user_groups%}
          <li class="userswitcher" data-target='userswitcher'><a href="#">{{ user.username }}<i class="right material-icons">supervisor_account</i></a></li>
        {% else %}
          <li class="userswitcher" data-target='userswitcher'><a href="#">{{ user.username }}</a></li>
        {% endif %}
        <ul id='userswitcher' class='dropdown-content'>
          <li><a href="{% url 'personal' %}"><i class="material-icons">person</i>Impostazioni</a></li>
          {% if user.is_staff or perms.client.staff %}
            <li><a href="{% url 'server' %}"><i class="material-icons">build</i>Pannello Admin</a></li>
          {% endif %}
          {% if user|user_list %}
            <li><a class="modal-trigger" href="#modal_capi"><i class="material-icons">list</i>Lista documenti</a></li>
          {% endif %}

          <li><a onclick="switcher_submit('logout')"><i class="material-icons">exit_to_app</i>Logout</a></li>
          <!--
          <li class="divider" tabindex="-1"></li>
          <li class="divider" tabindex="-1"></li>
          <li class="divider" tabindex="-1"></li>
          <li class="divider" tabindex="-1"></li>
          {% for username in request.COOKIES.user_switcher|parse_userswitcher%}
            {% if username != user.username %}
              <li><a onclick="switcher_submit('s{{username}}')">{{username}}</a></li>
            {% endif %}
          {% endfor %}
          <li><a onclick="switcher_submit('new')"><i class="material-icons">person_add</i>Aggiungi un altro utente</a></li>
          <li class="divider" tabindex="-1"></li>
          <li class="divider" tabindex="-1"></li>
          <li class="divider" tabindex="-1"></li>
          <li class="divider" tabindex="-1"></li>
          -->
          <li><a href="{% url 'about' %}">Informazioni sul prodotto</a></li>
        </ul>
      </ul>
      {% if user.is_superuser %}
      <ul class="right">
        {% if request.session.superuser %}
          <li class="dropdown-trigger" data-target='su_opts'><a href="#">{{request.session.superuser_group}}<i class="material-icons right">security</i></a></li>
          <ul id="su_opts" class='dropdown-content'>
            <li><a href="#!" onclick="su_change('diga')">diga</a></li>
            <li><a href="#!" onclick="su_change('muta')">muta</a></li>
            <li><a href="#!" onclick="su_change('reparto')">reparto</a></li>
            <li><a href="#!" onclick="su_change('posto')">posto</a></li>
            <li><a href="#!" onclick="su_change('clan')">clan</a></li>
            <li><a id="su_btn" href="#!" onclick="su_change('change')">Esci superuser<i class="material-icons">security</i></a></li>
          </ul>
        {% else %}
          <li><a id="su_btn" href="#!" onclick="su_change('change')"><i class="material-icons">security</i></a></li>
        {% endif %}
      </ul>
      {% endif %}
    </div>
    {% block toolbar %}
    {% endblock %}
    </form>
  </nav>

  <main id="main" style="margin-left: 10px;margin-right: 10px;margin-top: 10px;">
    {% block content %}
    {% endblock %}
  </main>
  <script type="text/javascript" src="{% static 'jquery-3.5.1.min.js' %}"></script>
  <script type="text/javascript" src="{% static 'materialize.min.js' %}"></script>
  <script type="text/javascript" src="{% static 'lazyload.js' %}"></script>
  <script type="text/javascript" src="{% static 'tabulator/js/tabulator.min.js' %}"></script>
  {% block script_import %}
  {% endblock %}
  <script>
  $(document).ready(function(){
    $('.tooltipped').tooltip();
  });

  document.addEventListener('DOMContentLoaded', function() {
    var elems = document.querySelectorAll('.userswitcher');
    var instances = M.Dropdown.init(elems, {"coverTrigger": false, "constrainWidth": false});
    var elems = document.querySelectorAll('.dropdown-trigger');
    var instances = M.Dropdown.init(elems, {"coverTrigger": false, "constrainWidth": false});
  });
  function switcher_submit(id) {
    var form = document.getElementById('user_form')
    var action = document.getElementById('metadata')
    action.setAttribute('value', id);
    form.submit()
  }

  function su_change(parm) {
    var form = document.getElementById('su_change')
    var action = document.getElementById('su_status')
    action.setAttribute('value', parm);
    form.submit()
  }
  {% block script %}
  {% endblock%}
  </script>
  <script type="text/javascript" src="{% static 'utils.js' %}"></script>
</body>
</html>
{% endwith %}
{% endwith %}
{% endwith %}