fix(morelevel): ajout de niveau03 et niveau04
All checks were successful
Cadoles/nineskeletor/pipeline/head This commit looks good
All checks were successful
Cadoles/nineskeletor/pipeline/head This commit looks good
This commit is contained in:
@ -180,7 +180,9 @@
|
||||
|
||||
<div class="card-body">
|
||||
{{ form_row(form.niveau01) }}
|
||||
{{ form_row(form.niveau02) }}
|
||||
{%if form.niveau02 is defined %}{{ form_row(form.niveau02) }}{%endif%}
|
||||
{%if form.niveau03 is defined %}{{ form_row(form.niveau03) }}{%endif%}
|
||||
{%if form.niveau04 is defined %}{{ form_row(form.niveau04) }}{%endif%}
|
||||
{{ form_row(form.firstname) }}
|
||||
{{ form_row(form.lastname) }}
|
||||
{{ form_row(form.email) }}
|
||||
@ -188,6 +190,7 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{% if appGroupuse %}
|
||||
<div class="card mt-3">
|
||||
<div class="card-header">
|
||||
<i class="fa fa-users fa-fw"></i> Groupes
|
||||
@ -234,7 +237,8 @@
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{% endif %}
|
||||
|
||||
<div class="card mt-3">
|
||||
<div class="card-header">
|
||||
<i class="fa fa-sitemap fa-fw"></i> Organisation
|
||||
@ -351,17 +355,100 @@
|
||||
$(document).ready(function() {
|
||||
$("#user_password_first").val("");
|
||||
select2niveau02();
|
||||
select2niveau03();
|
||||
select2niveau04();
|
||||
|
||||
{% if access=="modo" %}
|
||||
$("label[for='user_roles_0']").hide();
|
||||
$("label[for='user_roles_1']").hide();
|
||||
{% endif %}
|
||||
|
||||
requireniveau();
|
||||
});
|
||||
|
||||
$(document.body).on("change","#user_roles",function(){
|
||||
|
||||
requireniveau();
|
||||
|
||||
});
|
||||
|
||||
function requireniveau() {
|
||||
roles=[];
|
||||
if($("#user_roles_0").is(":checked")) roles.push("ROLE_ADMIN");
|
||||
if($("#user_roles_1").is(":checked")) roles.push("ROLE_MODO");
|
||||
if($("#user_roles_2").is(":checked")) roles.push("ROLE_MASTER");
|
||||
if($("#user_roles_3").is(":checked")) roles.push("ROLE_MANAGER");
|
||||
if($("#user_roles_4").is(":checked")) roles.push("ROLE_USER");
|
||||
|
||||
{% if "ALL" in appNiveau02mandatory %}
|
||||
$("#user_niveau02").attr("required","required");
|
||||
$("label[for='user_niveau02']").text("{{appNiveau02label}} *");
|
||||
{% else %}
|
||||
$("#user_niveau02").removeAttr("required");
|
||||
$("label[for='user_niveau02']").text("{{appNiveau02label}}");
|
||||
{% for mandatory in appNiveau02mandatory %}
|
||||
if(roles.includes("{{ mandatory }}")) {
|
||||
$("#user_niveau02").attr("required","required");
|
||||
$("label[for='user_niveau02']").text("{{appNiveau02label}} *");
|
||||
}
|
||||
{% endfor %}
|
||||
{% endif %}
|
||||
|
||||
{% if "ALL" in appNiveau03mandatory %}
|
||||
$("#user_niveau03").attr("required","required");
|
||||
$("label[for='user_niveau03']").text("{{appNiveau03label}} *");
|
||||
{% else %}
|
||||
$("#user_niveau03").removeAttr("required");
|
||||
$("label[for='user_niveau03']").text("{{appNiveau03label}}");
|
||||
{% for mandatory in appNiveau03mandatory %}
|
||||
if(roles.includes("{{ mandatory }}")) {
|
||||
$("#user_niveau03").attr("required","required");
|
||||
$("label[for='user_niveau03']").text("{{appNiveau03label}} *");
|
||||
}
|
||||
{% endfor %}
|
||||
{% endif %}
|
||||
|
||||
{% if "ALL" in appNiveau04mandatory %}
|
||||
$("#user_niveau04").attr("required","required");
|
||||
$("label[for='user_niveau04']").text("{{appNiveau04label}} *");
|
||||
{% else %}
|
||||
$("#user_niveau04").removeAttr("required");
|
||||
$("label[for='user_niveau04']").text("{{appNiveau04label}}");
|
||||
{% for mandatory in appNiveau04mandatory %}
|
||||
if(roles.includes("{{ mandatory }}")) {
|
||||
$("#user_niveau04").attr("required","required");
|
||||
$("label[for='user_niveau04']").text("{{appNiveau04label}} *");
|
||||
}
|
||||
{% endfor %}
|
||||
{% endif %}
|
||||
|
||||
if(roles.includes("ROLE_MODO")) {
|
||||
$("#cardmodos").show();
|
||||
}
|
||||
else {
|
||||
$("#cardmodos").hide();
|
||||
}
|
||||
}
|
||||
|
||||
$(document.body).on("change","#user_niveau01",function(){
|
||||
$("#user_niveau02").empty();
|
||||
$("#user_niveau03").empty();
|
||||
$("#user_niveau04").empty();
|
||||
select2niveau02();
|
||||
select2niveau03();
|
||||
select2niveau04();
|
||||
});
|
||||
|
||||
$(document.body).on("change","#user_niveau02",function(){
|
||||
$("#user_niveau03").empty();
|
||||
$("#user_niveau04").empty();
|
||||
select2niveau03();
|
||||
select2niveau04();
|
||||
});
|
||||
|
||||
$(document.body).on("change","#user_niveau03",function(){
|
||||
$("#user_niveau04").empty();
|
||||
select2niveau04();
|
||||
});
|
||||
|
||||
function select2niveau02() {
|
||||
@ -379,6 +466,36 @@
|
||||
});
|
||||
}
|
||||
|
||||
function select2niveau03() {
|
||||
$('#user_niveau03').select2({
|
||||
theme: 'bootstrap4',
|
||||
language: "fr",
|
||||
ajax: {
|
||||
data: function (params) {
|
||||
var query = {
|
||||
niveau02: $("#user_niveau02").val(),
|
||||
}
|
||||
return query;
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function select2niveau04() {
|
||||
$('#user_niveau04').select2({
|
||||
theme: 'bootstrap4',
|
||||
language: "fr",
|
||||
ajax: {
|
||||
data: function (params) {
|
||||
var query = {
|
||||
niveau03: $("#user_niveau03").val(),
|
||||
}
|
||||
return query;
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
$(document).ready(function() {
|
||||
// Init Group
|
||||
var linkgroups="";
|
||||
|
@ -32,10 +32,12 @@
|
||||
<th>Email</th>
|
||||
<th>Téléphone</th>
|
||||
<th>{{ appNiveau01label }}</th>
|
||||
<th class="no-sort">{{ appNiveau02label }}</th>
|
||||
<th class="no-sort {% if not appNiveau02use%}no-visible{%endif%}">{{ appNiveau02label }}</th>
|
||||
<th class="no-sort {% if not appNiveau03use%}no-visible{%endif%}">{{ appNiveau03label }}</th>
|
||||
<th class="no-sort {% if not appNiveau04use%}no-visible{%endif%}">{{ appNiveau04label }}</th>
|
||||
<th>Visite</th>
|
||||
<th>Rôle</th>
|
||||
<th class="no-sort">Groupes</th>
|
||||
<th class="no-sort {% if not appGroupuse%}no-visible{%endif%}">Groupes</th>
|
||||
</tr>
|
||||
</thead>
|
||||
</table>
|
||||
|
Reference in New Issue
Block a user