templates/content/structure/index.html.twig line 1

Open in your IDE?
  1. {% extends 'content/baseImmemory.html.twig' %}
  2. {% block title %}Stacks index{% endblock %}
  3. {% block body %}
  4.   {{ app.session.set('test', path(app.request.attributes.get('_route'), app.request.attributes.get('_route_params'))) }}
  5.     {% include "content/structure/breadcrumb.html.twig" %}
  6.     {% include "content/structure/categorieNavBar.html.twig" %}
  7.     {% include "content/structure/titrePage.html.twig" %}
  8.     {% if seq is not defined %}
  9.       {% if app.user is not null %}
  10.         {% include "content/structure/pagination.html.twig" %}
  11.       {% else %}
  12.         {% include "content/structure/paginationV.html.twig" %}
  13.       {% endif %}
  14.     {% endif %}
  15.     {% include "content/structure/tableauResult.html.twig" %}
  16.     {% if seq is not defined %}
  17.       {% if app.user is not null %}
  18.         {% include "content/structure/pagination.html.twig" %}
  19.       {% else %}
  20.         {% include "content/structure/paginationV.html.twig" %}
  21.       {% endif %}
  22.     {% endif %}
  23.     <br>
  24.     <a class="btn btnImmemoryShowAjout mObile" href="{{ path('admin_stacks_new') }}">Ajouter une card</a>
  25.     </div>
  26.     <div id="fondForm" class="fondForm" style="
  27.     background-color: black;
  28.     position: fixed;
  29.     display: none;
  30.     width: 100%;
  31.     height: 100%; color:white;
  32.     top:0; left:0; z-index:200; opacity:1; padding:60px 0; overflow:auto;">
  33.       <div class="container">
  34.         <div class="row justify-content-center">
  35.           <div id="contenuForm" class="col-12">
  36.           </div>
  37.         </div>
  38.       </div>
  39.     </div>
  40.     {% include "content/structure/commentaires/caseModal.html.twig" %}
  41. {% endblock %}
  42. {% block javascripts %}
  43. <script type="text/javascript">
  44.   $(function(){
  45.     {% include 'content/structure/commentaires/jquery/script.html.twig' %}
  46.     // gestion du bouton verif pour le status
  47.     $('[id ^= "btnStatus"]').click(function(){
  48.       // recup code
  49.       monBtn = $(this).attr('id');
  50.       macase = $(this).parent().html();
  51.       maligne = $(this).parent().parent().parent();
  52.       // AJAX change le status de la stack $(this).attr('id').substr(9)
  53.       $.ajax({
  54.         type: "POST",
  55.         url: "{{ path('admin_stacks_changeStatus') }}",
  56.         data: {
  57.           id: $(this).attr('id').substr(9),
  58.         },
  59.         success: function(msg){
  60.           if(msg == 1)
  61.           {
  62.             maligne.find('td').css('background-color', 'green');
  63.             var btn1 = $("#statusRadioz"+monBtn.substr(9)+"-1");
  64.             if(btn1.is(':checked') === false) {
  65.               btn1.prop('checked', true);
  66.             }
  67.           }
  68.           else if(msg == 2)
  69.           {
  70.             maligne.find('td').css('background-color', 'crimson');
  71.             var btn1 = $("#statusRadioz"+monBtn.substr(9)+"-2");
  72.             if(btn1.is(':checked') === false) {
  73.               btn1.prop('checked', true);
  74.             }
  75.           }
  76.           else if(msg == 3)
  77.           {
  78.             maligne.find('td').css('background-color', 'orange');
  79.             var btn1 = $("#statusRadioz"+monBtn.substr(9)+"-3");
  80.             if(btn1.is(':checked') === false) {
  81.               btn1.prop('checked', true);
  82.             }
  83.           }
  84.           else if(msg == 4)
  85.           {
  86.             maligne.find('td').css('background-color', 'lightskyblue');
  87.             var btn1 = $("#statusRadioz"+monBtn.substr(9)+"-4");
  88.             if(btn1.is(':checked') === false) {
  89.               btn1.prop('checked', true);
  90.             }
  91.           }
  92.           else if(msg == 5)
  93.           {
  94.             maligne.find('td').css('background-color', 'yellow');
  95.             var btn1 = $("#statusRadioz"+monBtn.substr(9)+"-5");
  96.             if(btn1.is(':checked') === false) {
  97.               btn1.prop('checked', true);
  98.             }
  99.           }
  100.           else if(msg == 6)
  101.           {
  102.             maligne.find('td').css('background-color', 'mediumpurple');
  103.             var btn1 = $("#statusRadioz"+monBtn.substr(9)+"-6");
  104.             if(btn1.is(':checked') === false) {
  105.               btn1.prop('checked', true);
  106.             }
  107.           }
  108.           else if(msg == 7)
  109.           {
  110.             maligne.find('td').css('background-color', 'grey');
  111.             var btn1 = $("#statusRadioz"+monBtn.substr(9)+"-7");
  112.             if(btn1.is(':checked') === false) {
  113.               btn1.prop('checked', true);
  114.             }
  115.           }
  116.           else if(msg == 8)
  117.           {
  118.             maligne.find('td').css('background-color', 'white');
  119.             var btn1 = $("#statusRadioz"+monBtn.substr(9)+"-8");
  120.             if(btn1.is(':checked') === false) {
  121.               btn1.prop('checked', true);
  122.             }
  123.           }
  124.           else
  125.           {
  126.             maligne.find('td').css('background-color', '#999');
  127.             var btn1 = $("#statusRadioz"+monBtn.substr(9)+"-1");
  128.             var btn2 = $("#statusRadioz"+monBtn.substr(9)+"-2");
  129.             var btn3 = $("#statusRadioz"+monBtn.substr(9)+"-3");
  130.             var btn4 = $("#statusRadioz"+monBtn.substr(9)+"-4");
  131.             var btn5 = $("#statusRadioz"+monBtn.substr(9)+"-5");
  132.             var btn6 = $("#statusRadioz"+monBtn.substr(9)+"-6");
  133.             var btn7 = $("#statusRadioz"+monBtn.substr(9)+"-7");
  134.             var btn8 = $("#statusRadioz"+monBtn.substr(9)+"-8");
  135.             btn1.prop('checked', false);
  136.             btn2.prop('checked', false);
  137.             btn3.prop('checked', false);
  138.             btn4.prop('checked', false);
  139.             btn5.prop('checked', false);
  140.             btn6.prop('checked', false);
  141.             btn7.prop('checked', false);
  142.             btn8.prop('checked', false);
  143.           }
  144.           //alert(msg + "polop" + $(this).html() );
  145.           //alert(maligne + "polop" + msg );
  146.         }
  147.       });
  148.       //alert( $(this).attr('id').substr(9) );
  149.     });
  150.     // gestion des btnRadio pour le status
  151.     $('[name^=statusRadioz]').change(function(){
  152.       // recup code
  153.       monBtn = $(this).attr('id');
  154.       //console.log("monBtn : "+monBtn);
  155.       macase = $(this).parent().html();
  156.       //console.log("macase : "+macase);
  157.       maligne = $(this).parent().parent().parent().parent();
  158.       //console.log("maligne : "+maligne);
  159.       monoption = $(this).val();
  160.       //console.log("monoption : "+monoption);
  161.       // AJAX change le status de la stack $(this).attr('id').substr(9)
  162.       $.ajax({
  163.         type: "POST",
  164.         url: "{{ path('admin_stacks_changeStatusRadio') }}",
  165.         data: {
  166.           id: $(this).attr('name').substr(12),
  167.           val: $(this).val(),
  168.         },
  169.         success: function(msg){
  170.           if(msg == 1)
  171.           {
  172.             maligne.find('td').css('background-color', 'green');
  173.           }
  174.           else if(msg == 2)
  175.           {
  176.             maligne.find('td').css('background-color', 'crimson');
  177.           }
  178.           else if(msg == 3)
  179.           {
  180.             maligne.find('td').css('background-color', 'orange');
  181.           }
  182.           else if(msg == 4)
  183.           {
  184.             maligne.find('td').css('background-color', 'lightskyblue');
  185.           }
  186.           else if(msg == 5)
  187.           {
  188.             maligne.find('td').css('background-color', 'yellow');
  189.           }
  190.           else if(msg == 6)
  191.           {
  192.             maligne.find('td').css('background-color', 'mediumpurple');
  193.           }
  194.           else if(msg == 7)
  195.           {
  196.             maligne.find('td').css('background-color', 'grey');
  197.           }
  198.           else if(msg == 8)
  199.           {
  200.             maligne.find('td').css('background-color', 'white');
  201.           }
  202.           else
  203.           {
  204.             maligne.find('td').css('background-color', '#999');
  205.           }
  206.           //alert(msg + "polop" + $(this).html() );
  207.           //alert(maligne + "polop" + msg );
  208.         }
  209.       });
  210.       //console.log($(this).attr("name").substr(12));
  211.     });
  212.     // ---------------------------------------
  213.     // gestion du bouton ajouter un commentaire
  214.     $('[id ^= "btnAjouteComm_"]').click(function(){
  215.       // recup code
  216.       monid = $(this).attr('id').substr(14);
  217.       console.log( monid );
  218.       // affiche le fond du formulaire
  219.       $("#fondForm").show(500);
  220.       // charge le formulaire d'ajout de commentaire dans le fond du formulaire
  221.       $.ajax({
  222.         type: "POST",
  223.         url: "{{ path('membre_stacks_commentaire_formAjoute') }}",
  224.         data: {
  225.           cardId: $(this).attr('id').substr(14),
  226.         },
  227.         success: function(msg)
  228.         {
  229.           // affiche le code de la stack
  230.           $( "#contenuForm" ).html( msg );
  231.           // action des btns CloseForm
  232.           $("#btnCloseForm").click(function(){
  233.             $("#fondForm").hide(145);
  234.           });
  235.           $("#btnCloseForm2").click(function(){
  236.             $("#fondForm").hide(145);
  237.           });
  238.           // action de soumission du formulaire
  239.           $('[name ^= "form"]').submit(function(evt){
  240.             evt.preventDefault();
  241.             // recup donnĂ©es
  242.             texte = CKEDITOR.instances['form_texte'].getData()
  243.             $.ajax({
  244.               type: "POST",
  245.               url: "{{ path('membre_stacks_commentaire_formTraitement') }}",
  246.               data: {
  247.                 texte: texte,
  248.                 monid: monid,
  249.               },
  250.               success: function(msg2)
  251.               {
  252.                 console.log("formTraitement " + msg2['ok']);
  253.                 $("#fondForm").hide(145);
  254.                 location.reload(true);
  255.               }
  256.             });
  257.             console.log("submit form " + texte);
  258.           });
  259.         }
  260.       });
  261.     });
  262.     // gestion du bouton ajouter un commentaire
  263.     $('[id ^= "btnModifComm_"]').click(function(){
  264.       // recup code
  265.       monid = $(this).attr('id').substr(13);
  266.       console.log( monid );
  267.       // affiche le fond du formulaire
  268.       $("#fondForm").show(145);
  269.       // charge le formulaire d'ajout de commentaire dans le fond du formulaire
  270.       $.ajax({
  271.         type: "POST",
  272.         url: "{{ path('membre_stacks_commentaire_formModif') }}",
  273.         data: {
  274.           commId: monid,
  275.         },
  276.         success: function(msg)
  277.         {
  278.           // affiche le code de la stack
  279.           $( "#contenuForm" ).html( msg );
  280.           $("#btnCloseForm").click(function(){
  281.             $("#fondForm").hide(145);
  282.             $( "#contenuForm" ).html( "" );
  283.           });
  284.           $("#btnCloseForm2").click(function(){
  285.             $("#fondForm").hide(145);
  286.             $( "#contenuForm" ).html( "" );
  287.           });
  288.           //
  289.           $('[name ^= "form"]').submit(function(evt){
  290.             evt.preventDefault();
  291.             // recup donnĂ©es
  292.             texte = CKEDITOR.instances['form_texte'].getData()
  293.             $.ajax({
  294.               type: "POST",
  295.               url: "{{ path('membre_stacks_commentaire_formModifTraitement') }}",
  296.               data: {
  297.                 texte: texte,
  298.                 monid: monid,
  299.               },
  300.             /*
  301.             */
  302.               success: function(msg2)
  303.               {
  304.                 console.log("formModifTraitement " + msg2['ok']);
  305.                 $("#fondForm").hide(145);
  306.                 $( "#contenuForm" ).html( "" );
  307.                 location.reload(true);
  308.               }
  309.             });
  310.             console.log("submit form " + texte);
  311.           });
  312.         }
  313.       });
  314.     });
  315.     // gestion du bouton ajouter un commentaire
  316.     $('[id ^= "btnSupprComm_"]').click(function(){
  317.       // recup code
  318.       monid = $(this).attr('id').substr(13);
  319.       console.log( monid );
  320.       // affiche le fond du formulaire
  321.       $("#fondForm").show(145);
  322.       // charge le formulaire d'ajout de commentaire dans le fond du formulaire
  323.       $.ajax({
  324.         type: "POST",
  325.         url: "{{ path('membre_stacks_commentaire_formSuppr') }}",
  326.         data: {
  327.           commId: monid,
  328.         },
  329.         success: function(msg)
  330.         {
  331.           // affiche le code de la stack
  332.           $( "#contenuForm" ).html( msg );
  333.           $("#btnCloseForm").click(function(){
  334.             $("#fondForm").hide(145);
  335.             $( "#contenuForm" ).html( "" );
  336.           });
  337.           $("#btnCloseForm2").click(function(){
  338.             $("#fondForm").hide(145);
  339.             $( "#contenuForm" ).html( "" );
  340.           });
  341.           //
  342.           $('[id ^= "btnSuppCommOui_"]').click(function(){
  343.             console.log("oui");
  344.             $.ajax({
  345.               type: "POST",
  346.               url: "{{ path('membre_stacks_commentaire_formSupprTraitement') }}",
  347.               data: {
  348.                 monid: monid,
  349.               },
  350.               success: function(msg2)
  351.               {
  352.                 console.log("formSupprTraitement " + msg2['ok']);
  353.                 $("#fondForm").hide(145);
  354.                 $( "#contenuForm" ).html( "" );
  355.                 location.reload(true);
  356.               }
  357.               /*
  358.               */
  359.             });
  360.           });
  361.         }
  362.       });
  363.     });
  364.   });
  365. </script>
  366. {% endblock %}