aboutsummaryrefslogtreecommitdiffstats
path: root/server/templates/server/data_request.html
blob: 7728cd945c7703a260bb8afc22be1f04d4b3cccc (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
{% extends 'registration/base_admin.html' %}

{% block title %}Admin - Richiesta dati{% endblock %}

{% block breadcrumb %}
  <a href="{% url 'server'%}" class="breadcrumb hide-on-med-and-down">Admin</a>
  <a class="breadcrumb hide-on-med-and-down">Richiesta dati</a>
{% endblock %}

{% block content %}

<div class="row">
  <div class="col l4 offset-l4 m8 offset-m2 s12">
    <div class="card">
      <form id="form" action="{% url 'request'%}" method="post">
        {% csrf_token %}
        <div class="card-content">
          <div class="input-field col s12">
            <select name="request">
              <option value="" disabled selected>Scegli</option>
              <option value="email_all">Email (tutti gli utenti)</option>
              <option value="email_non_staff">Email (solo non capi)</option>
              <option value="data_user">CSV Dati personali</option>
              <option value="data_user_medic">CSV Dati personali + medici</option>
            </select>
            <label>Richiesta dati</label>
          </div>
          <textarea id="data" class="materialize-textarea">{{data}}</textarea>
        </div>
        <div class="card-action">
          <a class="waves-effect waves-light btn {{color}}" href="#" onclick="document.getElementById('form').submit()">Invia</a>
          <a class="waves-effect waves-light btn {{color}}" onclick="copy()" id="copy_btn">Copia risultato</a>
        </div>
      </form>
    </div>
  </div>
</div>
{% endblock %}

{% block script %}
$(document).ready(function(){
    {% if error %}
      M.toast({html: '{{ error }}', classes: 'orange'})
    {% endif %}
});

document.addEventListener('DOMContentLoaded', function() {
  var elems = document.querySelectorAll('select');
  var options = {};
  var instances = M.FormSelect.init(elems, options);
});

function copy() {
  M.toast({html: 'Valore copiato!', classes: 'green'})

  var copyText = document.getElementById("data");
  copyText.select();
  copyText.setSelectionRange(0, 99999); /*For mobile devices*/
  document.execCommand("copy");
}
{% endblock%}