authentic2-cut/src/authentic2_cut/templates/authentic2/cut_manager_user_validation...

112 lines
3.6 KiB
HTML

{% 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 %}