{% extends 'content/baseImmemory.html.twig' %}
{% block title %}Stacks index{% endblock %}
{% block body %}
{{ app.session.set('test', path(app.request.attributes.get('_route'), app.request.attributes.get('_route_params'))) }}
{% include "content/structure/breadcrumb.html.twig" %}
{% include "content/structure/categorieNavBar.html.twig" %}
{% include "content/structure/titrePage.html.twig" %}
{% if seq is not defined %}
{% if app.user is not null %}
{% include "content/structure/pagination.html.twig" %}
{% else %}
{% include "content/structure/paginationV.html.twig" %}
{% endif %}
{% endif %}
{% include "content/structure/tableauResult.html.twig" %}
{% if seq is not defined %}
{% if app.user is not null %}
{% include "content/structure/pagination.html.twig" %}
{% else %}
{% include "content/structure/paginationV.html.twig" %}
{% endif %}
{% endif %}
<br>
<a class="btn btnImmemoryShowAjout mObile" href="{{ path('admin_stacks_new') }}">Ajouter une card</a>
</div>
<div id="fondForm" class="fondForm" style="
background-color: black;
position: fixed;
display: none;
width: 100%;
height: 100%; color:white;
top:0; left:0; z-index:200; opacity:1; padding:60px 0; overflow:auto;">
<div class="container">
<div class="row justify-content-center">
<div id="contenuForm" class="col-12">
</div>
</div>
</div>
</div>
{% include "content/structure/commentaires/caseModal.html.twig" %}
{% endblock %}
{% block javascripts %}
<script type="text/javascript">
$(function(){
{% include 'content/structure/commentaires/jquery/script.html.twig' %}
// gestion du bouton verif pour le status
$('[id ^= "btnStatus"]').click(function(){
// recup code
monBtn = $(this).attr('id');
macase = $(this).parent().html();
maligne = $(this).parent().parent().parent();
// AJAX change le status de la stack $(this).attr('id').substr(9)
$.ajax({
type: "POST",
url: "{{ path('admin_stacks_changeStatus') }}",
data: {
id: $(this).attr('id').substr(9),
},
success: function(msg){
if(msg == 1)
{
maligne.find('td').css('background-color', 'green');
var btn1 = $("#statusRadioz"+monBtn.substr(9)+"-1");
if(btn1.is(':checked') === false) {
btn1.prop('checked', true);
}
}
else if(msg == 2)
{
maligne.find('td').css('background-color', 'crimson');
var btn1 = $("#statusRadioz"+monBtn.substr(9)+"-2");
if(btn1.is(':checked') === false) {
btn1.prop('checked', true);
}
}
else if(msg == 3)
{
maligne.find('td').css('background-color', 'orange');
var btn1 = $("#statusRadioz"+monBtn.substr(9)+"-3");
if(btn1.is(':checked') === false) {
btn1.prop('checked', true);
}
}
else if(msg == 4)
{
maligne.find('td').css('background-color', 'lightskyblue');
var btn1 = $("#statusRadioz"+monBtn.substr(9)+"-4");
if(btn1.is(':checked') === false) {
btn1.prop('checked', true);
}
}
else if(msg == 5)
{
maligne.find('td').css('background-color', 'yellow');
var btn1 = $("#statusRadioz"+monBtn.substr(9)+"-5");
if(btn1.is(':checked') === false) {
btn1.prop('checked', true);
}
}
else if(msg == 6)
{
maligne.find('td').css('background-color', 'mediumpurple');
var btn1 = $("#statusRadioz"+monBtn.substr(9)+"-6");
if(btn1.is(':checked') === false) {
btn1.prop('checked', true);
}
}
else if(msg == 7)
{
maligne.find('td').css('background-color', 'grey');
var btn1 = $("#statusRadioz"+monBtn.substr(9)+"-7");
if(btn1.is(':checked') === false) {
btn1.prop('checked', true);
}
}
else if(msg == 8)
{
maligne.find('td').css('background-color', 'white');
var btn1 = $("#statusRadioz"+monBtn.substr(9)+"-8");
if(btn1.is(':checked') === false) {
btn1.prop('checked', true);
}
}
else
{
maligne.find('td').css('background-color', '#999');
var btn1 = $("#statusRadioz"+monBtn.substr(9)+"-1");
var btn2 = $("#statusRadioz"+monBtn.substr(9)+"-2");
var btn3 = $("#statusRadioz"+monBtn.substr(9)+"-3");
var btn4 = $("#statusRadioz"+monBtn.substr(9)+"-4");
var btn5 = $("#statusRadioz"+monBtn.substr(9)+"-5");
var btn6 = $("#statusRadioz"+monBtn.substr(9)+"-6");
var btn7 = $("#statusRadioz"+monBtn.substr(9)+"-7");
var btn8 = $("#statusRadioz"+monBtn.substr(9)+"-8");
btn1.prop('checked', false);
btn2.prop('checked', false);
btn3.prop('checked', false);
btn4.prop('checked', false);
btn5.prop('checked', false);
btn6.prop('checked', false);
btn7.prop('checked', false);
btn8.prop('checked', false);
}
//alert(msg + "polop" + $(this).html() );
//alert(maligne + "polop" + msg );
}
});
//alert( $(this).attr('id').substr(9) );
});
// gestion des btnRadio pour le status
$('[name^=statusRadioz]').change(function(){
// recup code
monBtn = $(this).attr('id');
//console.log("monBtn : "+monBtn);
macase = $(this).parent().html();
//console.log("macase : "+macase);
maligne = $(this).parent().parent().parent().parent();
//console.log("maligne : "+maligne);
monoption = $(this).val();
//console.log("monoption : "+monoption);
// AJAX change le status de la stack $(this).attr('id').substr(9)
$.ajax({
type: "POST",
url: "{{ path('admin_stacks_changeStatusRadio') }}",
data: {
id: $(this).attr('name').substr(12),
val: $(this).val(),
},
success: function(msg){
if(msg == 1)
{
maligne.find('td').css('background-color', 'green');
}
else if(msg == 2)
{
maligne.find('td').css('background-color', 'crimson');
}
else if(msg == 3)
{
maligne.find('td').css('background-color', 'orange');
}
else if(msg == 4)
{
maligne.find('td').css('background-color', 'lightskyblue');
}
else if(msg == 5)
{
maligne.find('td').css('background-color', 'yellow');
}
else if(msg == 6)
{
maligne.find('td').css('background-color', 'mediumpurple');
}
else if(msg == 7)
{
maligne.find('td').css('background-color', 'grey');
}
else if(msg == 8)
{
maligne.find('td').css('background-color', 'white');
}
else
{
maligne.find('td').css('background-color', '#999');
}
//alert(msg + "polop" + $(this).html() );
//alert(maligne + "polop" + msg );
}
});
//console.log($(this).attr("name").substr(12));
});
// ---------------------------------------
// gestion du bouton ajouter un commentaire
$('[id ^= "btnAjouteComm_"]').click(function(){
// recup code
monid = $(this).attr('id').substr(14);
console.log( monid );
// affiche le fond du formulaire
$("#fondForm").show(500);
// charge le formulaire d'ajout de commentaire dans le fond du formulaire
$.ajax({
type: "POST",
url: "{{ path('membre_stacks_commentaire_formAjoute') }}",
data: {
cardId: $(this).attr('id').substr(14),
},
success: function(msg)
{
// affiche le code de la stack
$( "#contenuForm" ).html( msg );
// action des btns CloseForm
$("#btnCloseForm").click(function(){
$("#fondForm").hide(145);
});
$("#btnCloseForm2").click(function(){
$("#fondForm").hide(145);
});
// action de soumission du formulaire
$('[name ^= "form"]').submit(function(evt){
evt.preventDefault();
// recup données
texte = CKEDITOR.instances['form_texte'].getData()
$.ajax({
type: "POST",
url: "{{ path('membre_stacks_commentaire_formTraitement') }}",
data: {
texte: texte,
monid: monid,
},
success: function(msg2)
{
console.log("formTraitement " + msg2['ok']);
$("#fondForm").hide(145);
location.reload(true);
}
});
console.log("submit form " + texte);
});
}
});
});
// gestion du bouton ajouter un commentaire
$('[id ^= "btnModifComm_"]').click(function(){
// recup code
monid = $(this).attr('id').substr(13);
console.log( monid );
// affiche le fond du formulaire
$("#fondForm").show(145);
// charge le formulaire d'ajout de commentaire dans le fond du formulaire
$.ajax({
type: "POST",
url: "{{ path('membre_stacks_commentaire_formModif') }}",
data: {
commId: monid,
},
success: function(msg)
{
// affiche le code de la stack
$( "#contenuForm" ).html( msg );
$("#btnCloseForm").click(function(){
$("#fondForm").hide(145);
$( "#contenuForm" ).html( "" );
});
$("#btnCloseForm2").click(function(){
$("#fondForm").hide(145);
$( "#contenuForm" ).html( "" );
});
//
$('[name ^= "form"]').submit(function(evt){
evt.preventDefault();
// recup données
texte = CKEDITOR.instances['form_texte'].getData()
$.ajax({
type: "POST",
url: "{{ path('membre_stacks_commentaire_formModifTraitement') }}",
data: {
texte: texte,
monid: monid,
},
/*
*/
success: function(msg2)
{
console.log("formModifTraitement " + msg2['ok']);
$("#fondForm").hide(145);
$( "#contenuForm" ).html( "" );
location.reload(true);
}
});
console.log("submit form " + texte);
});
}
});
});
// gestion du bouton ajouter un commentaire
$('[id ^= "btnSupprComm_"]').click(function(){
// recup code
monid = $(this).attr('id').substr(13);
console.log( monid );
// affiche le fond du formulaire
$("#fondForm").show(145);
// charge le formulaire d'ajout de commentaire dans le fond du formulaire
$.ajax({
type: "POST",
url: "{{ path('membre_stacks_commentaire_formSuppr') }}",
data: {
commId: monid,
},
success: function(msg)
{
// affiche le code de la stack
$( "#contenuForm" ).html( msg );
$("#btnCloseForm").click(function(){
$("#fondForm").hide(145);
$( "#contenuForm" ).html( "" );
});
$("#btnCloseForm2").click(function(){
$("#fondForm").hide(145);
$( "#contenuForm" ).html( "" );
});
//
$('[id ^= "btnSuppCommOui_"]').click(function(){
console.log("oui");
$.ajax({
type: "POST",
url: "{{ path('membre_stacks_commentaire_formSupprTraitement') }}",
data: {
monid: monid,
},
success: function(msg2)
{
console.log("formSupprTraitement " + msg2['ok']);
$("#fondForm").hide(145);
$( "#contenuForm" ).html( "" );
location.reload(true);
}
/*
*/
});
});
}
});
});
});
</script>
{% endblock %}