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:
@ -121,7 +121,9 @@
|
||||
</div>
|
||||
<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) }}
|
||||
@ -158,11 +160,81 @@
|
||||
|
||||
{% block localscript %}
|
||||
<script>
|
||||
$(document).ready(function() {
|
||||
if(!$("#paneloption").find(".card-body").find("label").length) $("#paneloption").hide();
|
||||
select2niveau02();
|
||||
select2niveau03();
|
||||
select2niveau04();
|
||||
requireniveau();
|
||||
});
|
||||
|
||||
function requireniveau() {
|
||||
roles=["ROLE_USER"];
|
||||
|
||||
{% if "ALL" in appNiveau02mandatory %}
|
||||
$("#registration_niveau02").attr("required","required");
|
||||
$("label[for='registration_niveau02']").text("{{appNiveau02label}} *");
|
||||
{% else %}
|
||||
$("#registration_niveau02").removeAttr("required");
|
||||
$("label[for='registration_niveau02']").text("{{appNiveau02label}}");
|
||||
{% for mandatory in appNiveau02mandatory %}
|
||||
if(roles.includes("{{ mandatory }}")) {
|
||||
$("#registration_niveau02").attr("required","required");
|
||||
$("label[for='registration_niveau02']").text("{{appNiveau02label}} *");
|
||||
}
|
||||
{% endfor %}
|
||||
{% endif %}
|
||||
|
||||
{% if "ALL" in appNiveau03mandatory %}
|
||||
$("#registration_niveau03").attr("required","required");
|
||||
$("label[for='registration_niveau03']").text("{{appNiveau03label}} *");
|
||||
{% else %}
|
||||
$("#registration_niveau03").removeAttr("required");
|
||||
$("label[for='registration_niveau03']").text("{{appNiveau03label}}");
|
||||
{% for mandatory in appNiveau03mandatory %}
|
||||
if(roles.includes("{{ mandatory }}")) {
|
||||
$("#registration_niveau03").attr("required","required");
|
||||
$("label[for='registration_niveau03']").text("{{appNiveau03label}} *");
|
||||
}
|
||||
{% endfor %}
|
||||
{% endif %}
|
||||
|
||||
{% if "ALL" in appNiveau04mandatory %}
|
||||
$("#registration_niveau04").attr("required","required");
|
||||
$("label[for='registration_niveau04']").text("{{appNiveau04label}} *");
|
||||
{% else %}
|
||||
$("#registration_niveau04").removeAttr("required");
|
||||
$("label[for='registration_niveau04']").text("{{appNiveau04label}}");
|
||||
{% for mandatory in appNiveau04mandatory %}
|
||||
if(roles.includes("{{ mandatory }}")) {
|
||||
$("#registration_niveau04").attr("required","required");
|
||||
$("label[for='registration_niveau04']").text("{{appNiveau04label}} *");
|
||||
}
|
||||
{% endfor %}
|
||||
{% endif %}
|
||||
}
|
||||
|
||||
$(document.body).on("change","#registration_niveau01",function(){
|
||||
$("#registration_niveau02").empty();
|
||||
$("#registration_niveau03").empty();
|
||||
$("#registration_niveau04").empty();
|
||||
select2niveau02();
|
||||
select2niveau03();
|
||||
select2niveau04();
|
||||
});
|
||||
|
||||
$(document.body).on("change","#registration_niveau02",function(){
|
||||
$("#registration_niveau03").empty();
|
||||
$("#registration_niveau04").empty();
|
||||
select2niveau03();
|
||||
select2niveau04();
|
||||
});
|
||||
|
||||
$(document.body).on("change","#registration_niveau03",function(){
|
||||
$("#registration_niveau04").empty();
|
||||
select2niveau04();
|
||||
});
|
||||
|
||||
function select2niveau02() {
|
||||
$('#registration_niveau02').select2({
|
||||
theme: 'bootstrap4',
|
||||
@ -178,8 +250,37 @@
|
||||
});
|
||||
}
|
||||
|
||||
function select2niveau03() {
|
||||
$('#registration_niveau03').select2({
|
||||
theme: 'bootstrap4',
|
||||
language: "fr",
|
||||
ajax: {
|
||||
data: function (params) {
|
||||
var query = {
|
||||
niveau02: $("#registration_niveau02").val(),
|
||||
}
|
||||
return query;
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function select2niveau04() {
|
||||
$('#registration_niveau04').select2({
|
||||
theme: 'bootstrap4',
|
||||
language: "fr",
|
||||
ajax: {
|
||||
data: function (params) {
|
||||
var query = {
|
||||
niveau03: $("#registration_niveau03").val(),
|
||||
}
|
||||
return query;
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
$(document.body).on("focusout","#registration_email",function(){
|
||||
console.log("pouet");
|
||||
$.ajax({
|
||||
method: "POST",
|
||||
url: "{{ path('app_whitelist_is') }}",
|
||||
@ -201,26 +302,6 @@
|
||||
});
|
||||
});
|
||||
|
||||
function hideshow() {
|
||||
|
||||
$('#registration_niveau02').select2({
|
||||
theme: 'bootstrap4',
|
||||
language: "fr",
|
||||
ajax: {
|
||||
data: function (params) {
|
||||
var query = {
|
||||
niveau01: $("#registration_niveau01").val(),
|
||||
}
|
||||
return query;
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
$(document).ready(function() {
|
||||
if(!$("#paneloption").find(".card-body").find("label").length) $("#paneloption").hide();
|
||||
hideshow();
|
||||
});
|
||||
|
||||
</script>
|
||||
{% endblock %}
|
||||
|
@ -24,6 +24,9 @@
|
||||
<th width="200px">Login</th>
|
||||
<th>Email</th>
|
||||
<th>{{ appNiveau01label }}</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>Statut</th>
|
||||
<th>Expire le</th>
|
||||
</tr>
|
||||
@ -38,7 +41,7 @@
|
||||
<script>
|
||||
$(document).ready(function() {
|
||||
$('#dataTables').DataTable({
|
||||
columnDefs: [ { "targets": 'no-sort', "orderable": false } ],
|
||||
columnDefs: [ { "targets": 'no-sort', "orderable": false },{ "targets": 'no-visible', "visible": false } ],
|
||||
responsive: true,
|
||||
iDisplayLength: 100,
|
||||
order: [[ 1, "asc" ]],
|
||||
|
Reference in New Issue
Block a user