summaryrefslogtreecommitdiffstats
path: root/src/authentic2_cut/templates/authentic2/cut_manager_user_validation.html
blob: 7f69a9c76ceaa9a089c4898dff30ed85e986df1b (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
{% extends "authentic2/manager/form.html" %}
{% load i18n %}

{% block appbar %}
  <h2>
    <a href="{% url 'a2-manager-user-detail' pk=object.pk %}">{{ object.get_full_name }}</a>
  </h2>
{% endblock %}

{% block breadcrumb %}
  {{ block.super }}
  <a href="{% url 'cut-manager-user-validation' %}">Validation d'identité</a>
  <a href="{% url 'a2-manager-user-detail' pk=object.pk %}">{{ object.get_full_name }}</a>
{% endblock %}


{% block content %}
<p>Validation demandée par {{ validation_request.origin }} le {{ validation_request.created }}, identifiant externe de la demande <em>{{ validation_request.external_id }}</em>.</p>

{% if validation_request.validated %}
 {% with agent=validation_request.validated_by %}
 <p>Demande {{ validation_request.get_status_display }} le {{ validation_request.validated }} par <a href="{% url "a2-manager-user-detail" pk=agent.pk %}">{{ agent.get_full_name }}</a></p>
  {% endwith %}
{% else %}
  {% if validation_request.taken_by != user and validation_request.is_taken %}
    <p>Demande en cours de traitement par {{ validation_request.taken_by }} depuis le {{ validation_request.taken }}</p>
  {% endif %}
{% endif %}

<script>
$('body').on('click', 'a.popup-image', function (event) {
	var target = event.target;
	var src = $(target).parent('a')[0].href;
	var vw = Math.max(document.documentElement.clientWidth, window.innerWidth || 0);
	var vh = Math.max(document.documentElement.clientHeight, window.innerHeight || 0);
	var ratio_width = target.width / (vw - 100);
	var ratio_height = target.height / (vh - 100);
	var ratio = Math.max(ratio_width, ratio_height);
	var new_width = target.width / ratio;
	var new_height = target.height / ratio;
	var $overlay = $('<img src="' + src +'"/>');
	$overlay.css({
		'position': 'fixed',
		'height': '' + new_height + 'px',
		'width': '' + new_width + 'px',
		'top': 0,
		'left': 0,
		'padding-left': ((vw - new_width) / 2) + 'px',
		'padding-right': ((vw - new_width) / 2) + 'px',
		'padding-top': ((vh - new_height) / 2) + 'px',
		'padding-bottom': ((vh - new_height) / 2) + 'px',
		'z-index': 999,
	})

	$overlay.appendTo($('body'));
	$overlay.on('click', function () {
		$overlay.remove();
	});
	event.preventDefault();
})
</script>
<div id="attachments">
    <h4>Pièces jointes</h4>
    <p>
        {% for attachment in attachments %}
                <a
                    {% if attachment.extension != 'pdf' %}
                        class="popup-image"
                    {% endif %}
                    target="_blank"
                    href="{{ attachment.url }}">
                    <img
                        src="{{ attachment.thumbnail_image.src }}"
                        title="Pièce jointe {{ forloop.counter }}"
                        style="border: 1px solid black; padding: 1ex"/>
                </a>
        {% endfor %}
    </p>
</div>
<h4>Identité</h4>
<div>
{{ block.super }}
</div>
{% endblock %}

{% block beforeform %}
  {% if validation_request.validated %}
    <fieldset disabled style="border: none">
  {% endif %}
{% endblock %}

{% block afterform %}
  {% if validation_request.validated %}
    </fieldset>
  {% endif %}
{% endblock %}

{% block buttons %}
    {% if not validation_request.validated %}
      <div class="buttons">
          <button name="validate">Valider</button>
      </div>
      <h4>Refus</h4>
      {{ validation_form.as_p }}

      <div class="buttons">
          <button name="refuse">Refuser</button>
          <button style="float: right; margin-right: 30px" name="next">Suivant</button>
      </div>
    {% endif %}
{% endblock %}