mirror of
https://gitlab2.federez.net/re2o/re2o
synced 2024-11-26 14:42:25 +00:00
233 lines
7.5 KiB
HTML
233 lines
7.5 KiB
HTML
{% extends "users/sidebar.html" %}
|
|
{% comment %}
|
|
Re2o est un logiciel d'administration développé initiallement au rezometz. Il
|
|
se veut agnostique au réseau considéré, de manière à être installable en
|
|
quelques clics.
|
|
|
|
Copyright © 2017 Gabriel Détraz
|
|
Copyright © 2017 Goulven Kermarec
|
|
Copyright © 2017 Augustin Lemesle
|
|
|
|
This program is free software; you can redistribute it and/or modify
|
|
it under the terms of the GNU General Public License as published by
|
|
the Free Software Foundation; either version 2 of the License, or
|
|
(at your option) any later version.
|
|
|
|
This program is distributed in the hope that it will be useful,
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
GNU General Public License for more details.
|
|
|
|
You should have received a copy of the GNU General Public License along
|
|
with this program; if not, write to the Free Software Foundation, Inc.,
|
|
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
|
{% endcomment %}
|
|
|
|
{% load bootstrap3 %}
|
|
{% load widget_tweaks %}
|
|
{% load massive_bootstrap_form %}
|
|
{% load static %}
|
|
{% load acl %}
|
|
{% load i18n %}
|
|
{% block title %}{% trans "Users" %}{% endblock %}
|
|
|
|
{% block content %}
|
|
{% bootstrap_form_errors userform %}
|
|
|
|
<script type="text/javascript" src="//ajax.googleapis.com/ajax/libs/jqueryui/1.11.1/jquery-ui.min.js"></script>
|
|
<link rel="stylesheet" href="//code.jquery.com/ui/1.11.1/themes/smoothness/jquery-ui.css" type="text/css">
|
|
|
|
<script type='text/javascript'>
|
|
function submitBday() {
|
|
var field = document.getElementById("file");
|
|
var Bdate = document.getElementById('bday').value;
|
|
var Bday = +new Date(Bdate);
|
|
var age = ((Date.now() - Bday) / (31557600000));
|
|
|
|
if (age < 18){
|
|
field.style.display = "block";
|
|
}
|
|
else{
|
|
field.style.display = "none";
|
|
}
|
|
|
|
}
|
|
</script>
|
|
|
|
<form class="form" method="post">
|
|
{% csrf_token %}
|
|
|
|
{% if action_name == 'Change the password' %}
|
|
<div class="form-group">
|
|
{{ userform.selfpasswd.label_tag }}
|
|
{% render_field userform.selfpasswd class="form-control" requiered=True %}
|
|
</div>
|
|
<div class="form-group">
|
|
{{ userform.passwd1.label_tag }}
|
|
{% render_field userform.passwd1 class="form-control" requiered=True %}
|
|
</div>
|
|
<div class="form-group">
|
|
{{ userform.passwd2.label_tag }}
|
|
{% render_field userform.passwd2 class="form-control" requiered=True %}
|
|
</div>
|
|
|
|
|
|
{% else %}
|
|
|
|
<h3>Informations générales</h3>
|
|
|
|
{% if action_name == 'Create a user' %}
|
|
<div class="form-row">
|
|
<div class="form-group col-md-4">
|
|
{{ userform.name.label_tag }}
|
|
{% render_field userform.name class="form-control" requiered=True %}
|
|
</div>
|
|
<div class="form-group col-md-4">
|
|
{{ userform.surname.label_tag }}
|
|
{% render_field userform.surname class="form-control" requiered=True %}
|
|
</div>
|
|
<div class="form-group col-md-4">
|
|
{{ userform.pseudo.label_tag }}
|
|
{% render_field userform.pseudo class="form-control" requiered=True %}
|
|
</div>
|
|
</div>
|
|
{% elif action_name == 'Create a club' %}
|
|
<div class="form-row">
|
|
<div class="form-group col-md-6">
|
|
{{ userform.surname.label_tag }}
|
|
{% render_field userform.surname class="form-control" requiered=True %}
|
|
</div>
|
|
<div class="form-group col-md-6">
|
|
{{ userform.pseudo.label_tag }}
|
|
{% render_field userform.pseudo class="form-control" requiered=True %}
|
|
</div>
|
|
</div>
|
|
{% endif %}
|
|
|
|
{% if action_name == 'Create a user' %}
|
|
<div class="form-row">
|
|
<div class="form-group col-md-4">
|
|
{{ userform.email.label_tag }}
|
|
{% render_field userform.email class="form-control" requiered=True %}
|
|
</div>
|
|
<div class="form-group col-md-4">
|
|
{{ userform.telephone.label_tag }}
|
|
{% render_field userform.telephone class="form-control" requiered=True %}
|
|
</div>
|
|
<div class="form-group col-md-4">
|
|
<label>Date de naissance</label>
|
|
<input class="form-control" id="bday" name="bday" date-date-format="dd-mm-yy" requiered=True placeholder="Date de naissance" type="date" onchange="submitBday()">
|
|
</div>
|
|
</div>
|
|
|
|
<div class="form-group">
|
|
{% if user.is_authenticated %}
|
|
{% can_edit user %}
|
|
<div class="disclaimer" style="display:none;" id="div_disclaimer">
|
|
<input type="checkbox" id="{{userform.disclaimer.auto_id}}" name="box_disclaimer" requiered=True />
|
|
<label for="scales">Décharge parentale reçue</label>
|
|
</div>
|
|
{% acl_end %}
|
|
{% else %}
|
|
<div class="disclaimer" style="display:none;" id="div_disclaimer">
|
|
{{ userform.disclaimer.label_tag }}
|
|
{% render_field userform.disclaimer class="form-control" requiered=True %}
|
|
</div>
|
|
{% endif %}
|
|
</div>
|
|
|
|
<script type='text/javascript'>
|
|
function submitBday() {
|
|
var div = document.getElementById("div_disclaimer");
|
|
var input = document.getElementById("{{userform.disclaimer.auto_id}}");
|
|
|
|
var Bdate = document.getElementById('bday').value;
|
|
var Bday = +new Date(Bdate);
|
|
var age = ((Date.now() - Bday) / (31557600000));
|
|
|
|
console.log("{{userform.disclaimer.auto_id}}");
|
|
|
|
if (age < 18){
|
|
div.style.display = "block";
|
|
input.setAttribute("requiered", "True");
|
|
console.log(input);
|
|
}
|
|
else{
|
|
div.style.display = "none";
|
|
input.removeAttribute("requiered");
|
|
console.log(input);
|
|
}
|
|
|
|
}
|
|
</script>
|
|
{% elif action_name == 'Create a club' %}
|
|
<div class="form-group">
|
|
{{ userform.email.label_tag }}
|
|
{% render_field userform.email class="form-control" requiered=True %}
|
|
</div>
|
|
{% endif %}
|
|
|
|
<div class="form-group">
|
|
{{ userform.school.label_tag }}
|
|
{% render_field userform.school class="form-control" requiered=True %}
|
|
</div>
|
|
<div class="form-group">
|
|
{{ userform.room.label_tag }}
|
|
{% render_field userform.room class="form-control" requiered=True %}
|
|
</div>
|
|
<div class="form-group">
|
|
{{ userform.comment.label_tag }}
|
|
{% render_field userform.comment class="form-control" %}
|
|
</div>
|
|
{% if action_name == 'Create a club' %}
|
|
<div class="form-group">
|
|
{{ userform.mailing.label_tag }}
|
|
<input type="checkbox" id="{{userform.mailing.auto_id}}" name="box_mailing" />
|
|
</div>
|
|
{% endif %}
|
|
|
|
|
|
<h3>Informations avancées (facultatif)</h3>
|
|
<div class="table-responsive">
|
|
<table class="table table-borderless">
|
|
<tr>
|
|
<th>
|
|
{{ userform.shell.label_tag }}
|
|
{% render_field field class="form-control is-valid" %}
|
|
</th>
|
|
<td>
|
|
{% render_field userform.shell class="form-control" placeholder=userform.shell.label %}
|
|
</td>
|
|
</tr>
|
|
{% if action_name == 'Create a user' %}
|
|
<tr>
|
|
<th>
|
|
{{ userform.gpg_fingerprint.label_tag }}
|
|
</th>
|
|
<td>
|
|
{% render_field userform.gpg_fingerprint class="form-control" placeholder=userform.gpg_fingerprint.label %}
|
|
</td>
|
|
</tr>
|
|
{% endif %}
|
|
</table>
|
|
</div>
|
|
|
|
{% endif %}
|
|
|
|
<button class="btn btn-success" type="submit">{{ action_name }}</button>
|
|
|
|
</form>
|
|
{% if load_js_file %}
|
|
<script src="{{ load_js_file }}"></script>
|
|
{% endif %}
|
|
<br>
|
|
{% if showCGU %}
|
|
<p>{% trans "By clicking 'Create or edit', the user commits to respect the " %}<a href="/media/{{ GTU }}" download="CGU" >{% trans "General Terms of Use" %}</a>.</p>
|
|
<h3>{% trans "Summary of the General Terms of Use" %}</h3>
|
|
<p>{{ GTU_sum_up }}</p>
|
|
{% endif %}
|
|
<br/>
|
|
<br/>
|
|
<br/>
|
|
{% endblock %}
|
|
|