templates/site/Site/commandeClient.html.twig line 1

Open in your IDE?
  1. {% extends 'baseTemplate_2.html.twig' %}
  2. {% import 'macro.html.twig' as traiteinfo %}
  3. {% import 'macroEntete.html.twig' as traiteinfoEntete %}
  4. {% import 'macroAbout.html.twig' as traiteinfoAbout %}
  5. {% import 'macroShop.html.twig' as traiteinfoShop %}
  6. {% import 'presentation/macroHead.html.twig' as traiteinfoHead %}
  7. {% block body %}
  8.   {% set inc = 0 %}
  9. <body class="home-style">
  10.   <div class="full-width-header header-style1 home1-modifiy">
  11.                 <!--Header Start-->
  12.                  {{ traiteinfoHead.infoHead(typeSite,objetAbonne,listeMenu) }}
  13.                 <!--Header End-->
  14.             </div>
  15.             <!--Full width header End-->
  16.      <div class="main-content">   
  17.       
  18. <div class="col-lg-12">
  19.     {% for contenu in app.session.getflashbag.get('fournisseur.ajout.success')%}
  20.         {% if loop.index == 0%}
  21.             <div class="row">
  22.                 <div class="col-lg-12 ">
  23.                 {% endif%}
  24.                 <div class="text-center alert alert-success">{{contenu}}</div>
  25.                 {% if loop.index == 0%} 
  26.                 </div>
  27.             </div>
  28.         {% endif%}
  29.     {% endfor%}
  30.     {% for contenu in app.session.getflashbag.get('caisse.non.configure')%}
  31.                         {% if loop.index == 0%}
  32.                             <div class="row">
  33.                                 <div class="col-lg-12 ">
  34.                                 {% endif%}
  35.                                 <div class="text-center alert alert-error">{{contenu}}</div>
  36.                                 {% if loop.index == 0%} 
  37.                                 </div>
  38.                             </div>
  39.                         {% endif %}
  40.                     {% endfor%}
  41.     {% for contenu in app.session.getflashbag.get('fournisseur.ajout.error')%}
  42.         {% if loop.index == 0%}
  43.             <div class="row">
  44.                 <div class="col-lg-12 ">
  45.                 {% endif%}
  46.                 <div class="text-center alert alert-error">{{contenu}}</div>
  47.                 {% if loop.index == 0%} 
  48.                 </div>
  49.             </div>
  50.         {% endif%}
  51.     {% endfor%}
  52.     {% for contenu in app.session.getflashbag.get('fournisseur.ajout.already.exist')%}
  53.         {% if loop.index == 0%}
  54.             <div class="row">
  55.                 <div class="col-lg-12 ">
  56.                 {% endif%}
  57.                 <div class="text-center alert alert-error">{{contenu}}</div>
  58.                 {% if loop.index == 0%} 
  59.                 </div>
  60.             </div>
  61.         {% endif%}
  62.     {% endfor%}
  63.     <div class="row">
  64.         <div class="col-lg-12" id="iderror" hidden="true">                                                
  65.             <div class="text-center alert alert-error">Ce produit a été déjà ajouté dans la liste ci-dessous!</div>
  66.         </div>
  67.         <div class="col-lg-12" id="idsuppr" hidden="true">                                                
  68.             <div class="text-center alert alert-error">Suppression effectuée avec succès.</div>
  69.         </div>
  70.     </div>
  71. </div>
  72. <div  style="background: #f3f3f3;width:100%;height:100px;">
  73. </div>
  74. <br/><br/><br/>
  75.     <div class="container">
  76.     <div class="row">
  77.         <div class="col-lg-8">
  78.             <div class="col-lg-12"> {# zone des categorie #}
  79.                 <input type="hidden" name="commandeId"  class="commandeId" value="{{uneCommande.id}}"/>
  80.                 <input type="hidden"   class="msgWhatsApp" />
  81.                 <div id="rs-popular-courses" class="rs-popular-courses style1 orange-color modify1  pb-100 md-pt-70 md-pb-70">
  82.                 <div class="container">
  83.                     <div class="sec-title6 text-center mb-40">
  84.                         <div class="img-part mb-10">
  85.                             <img src="assets/images/line.png" alt="">
  86.                         </div>
  87.                      
  88.                     </div>
  89.                     <div class="gridFilter style2 text-center mb-30">
  90.                         <button class="active" data-filter="*">Tout</button>
  91.                          {% for uneCategorie in listeCategorie %}
  92.                             <button data-filter=".{{uneCategorie['codeGenere']}}">{{uneCategorie['nom']}}</button>
  93.                         {% endfor %}
  94.                         {#<button data-filter=".filter2">Computer Engineering</button>
  95.                         <button data-filter=".filter3">General Education</button>
  96.                         <button data-filter=".filter4">High School</button>#}
  97.                     </div>
  98.                     <div class="row grid">
  99.                     {% for unProduit in listeProduit %}
  100.                         <div class="col-lg-4 col-md-6 grid-item {{unProduit["prodCodeGenere"]}}" >
  101.                             <div class="courses-item mb-30 add_produit " idp="{{unProduit['prixAchat']}}" ids="{{unProduit['id']}}" infoetat="{% if unProduit["enStockProduit"] > 0 %}1{% else %}0{% endif %}">
  102.                                 <div class="img-part">
  103.                                     <img src="{{asset('upload/'~unProduit["urlImage"])}}" alt="">
  104.                                 </div>
  105.                                 <div class="content-part">
  106.                                     <ul class="meta-part">
  107.                                         <li><span class="price">{{unProduit["prixAchat"]}} F CFA</span></li>
  108.                                     </ul>
  109.                                     <h3 class="title"><a href="#">{{unProduit["nom"]}}</a></h3>
  110.                                         {% if unProduit["enStockProduit"] > 0 %}
  111.                                             <span class="price" style ="color : #3A9D23;font-weight: bold;" > En stock </span>
  112.                                         {% else %}
  113.                                             <span class="price" style ="color : #F00020;font-weight: bold;"> Rupture de stock </span>
  114.                                         {% endif %}
  115.                                         
  116.                                 </div>
  117.                             </div>
  118.                         </div>
  119.                     {% endfor %}    
  120.                     </div>
  121.                     
  122.                 </div>
  123.             </div>{#
  124.             <div style="align-items: center;
  125.     display: flex;
  126.     flex-grow: 1;
  127.     flex-shrink: 0;
  128.     justify-content: flex-start;">
  129.                 {% for uneCategorie in listeCategorie %}
  130.                     <span class="info-categorie"   ids="{{uneCategorie['id']}}" style=" white-space: nowrap;width: auto; padding: 10px 30px;border-top:2px solid #22b14c;border-bottom:2px solid #22b14c;">
  131.                         
  132.                              <h5 class="card-title">{{uneCategorie['nom']}}</h5>
  133.                          
  134.                         
  135.                     </span>
  136.                 {% endfor %}
  137.                 
  138.                 <input type="hidden" name="commandeId"  class="commandeId" value="{{uneCommande.id}}"/>
  139.                 <input type="hidden"   class="msgWhatsApp" />
  140.             </div>
  141.             </div>
  142.             <div class="col-lg-12" style="overflow-y: scroll;height:auto;"> {# zone des produits 
  143.                     {% for uneCategorie in listeCategorie %}
  144.                         <div class=" zone-categorie {{'zone-categorie'~uneCategorie['id']}}" style="display: none;"  ids="{{uneCategorie['id']}}" >
  145.                             <div class="row">
  146.                             {% for t in listeProduit[uneCategorie.id]  %}
  147.                                 <div class="col-sm-4 add_produit" ids="{{t['id']}}" idp="{{t['prixAchat']}}{#% if t.prixrigueurs|length != 0 %}{{t.prixrigueurs[0].infoPrixRigueur }}{% else %}-{% endif %" style="margin-top:12px"> 
  148.                                     <div class="card" style="border-top:2px solid #22b14c;">
  149.                                         <div class="card-body">
  150.                                             <h5 class="card-title">{{t['nom']}}</h5>
  151.                                             <p class="card-text">-</p>
  152.                                             <div class="{{'produit'~t['id']}}" style="width:100%;text-align:right; font-size: 20px;font-weight: bold;">{{t['prixAchat']}}</div>
  153.                                         </div>
  154.                                     </div>
  155.                                 </div>
  156.                             {% endfor %}
  157.                             </div>
  158.                         
  159.                         </div>
  160.                     {% endfor %}
  161.             </div>#}
  162.         </div>
  163.         </div>
  164.         <div class="col-lg-4">
  165.             <div class="col-lg-12" style="overflow-y: scroll; border-left: 1px solid #F1F1F1;"> {# zone adresse #}
  166.                 
  167.                     <div class="listeOperationEvoluee">
  168.                         {% for uneLIngeCommande in uneCommande.lignecommandeclients %}
  169.                                 <div class="col-lg-12 ligne-click" style="border-left: 2px #F11 solid;margin-top:10px;padding:10px;font-size: 20px; background : #F1F1F1;" ids="{{uneLIngeCommande.id}}">
  170.                                     <div class="row">
  171.                                         <div class="col-lg-12">{{uneLIngeCommande.produit.nomProduit}}</div>
  172.                                         <div class="col-lg-6">{{uneLIngeCommande.quantite~"x"~uneLIngeCommande.prixrigueur.infoPrixRigueur}}</div>
  173.                                         <div class="col-lg-6" style="text-align: right; font-weight: bold;">{% set montantTotal = uneLIngeCommande.quantite * uneLIngeCommande.prixrigueur.infoPrixRigueur %}{{montantTotal}}</div>
  174.                                         <div class="col-lg-8">
  175.                                             <div class="text-right"> 
  176.                                                 
  177.                                             </div>
  178.                                         </div>
  179.                                         <div class="col-lg-4"><a href="#" style="display:none"  class="btn btn-circle mini btn-danger btnEdit tooltipGobi bt-delete {{'l-bt-delete'~uneLIngeCommande.id}}" title="Supprimer  " ids="{{uneLIngeCommande.id}}"><i class="glyphicon glyphicon-remove"></i> </a></div>
  180.                                     </div>    
  181.                                 </div>
  182.                         {% endfor %}
  183.                     </div>
  184.                 
  185.             </div>
  186.             <div class="col-lg-12"> {# zone valider #}
  187.             <hr style="border:#FFF;"/>
  188.             <br/><br/><br/>
  189.                 <form action="{{path('app_admin_user_pointer',{type:1})}}" method="POST">
  190.                     <div class="form-group clearfix margin-top-15px center">
  191.                         <label class="control-label">Nom </label>
  192.                         
  193.                         <div class="control"> <input class="form-control nomPrenoms" type="text"  name="id"  value ="{#{objetUtilisateur.id}#}"class="id form-control; border:1px solid #CCC"> </div>
  194.                     </div>
  195.                     <div class="form-group clearfix margin-top-15px center">
  196.                         <label class="control-label">Téléphone </label>
  197.                         
  198.                         <div class="control"> <input class="form-control tel" type="text"   name="id"  value ="{#{objetUtilisateur.id}#}"class="id form-control; border:1px solid #CCC"> </div>
  199.                     </div>
  200.                     <div class="form-group clearfix margin-top-15px center">
  201.                         <label class="control-label">Adresse </label>
  202.                         
  203.                         <div class="control"> <input  class="form-control adresse" type="text"   name="id"  value ="{#{objetUtilisateur.id}#}"class="id form-control; border:1px solid #CCC"> </div>
  204.                     </div>
  205.                                     
  206.                     <div class="form-group clearfix pull-right">
  207.                         {#<button type="submit" class="btn  btn-info " id="submit" > 
  208.                             <i class="icon icon-white icon-ok"></i> Valider 
  209.                         </button>#}
  210.                         <a href="#" class="bt-whatsapp"> 
  211.                             <i class="icon icon-white icon-arrow-left "></i> Whatsapp
  212.                         </a>
  213.                         
  214.                     </div>
  215.                 </form>
  216.             </div>
  217.         </div>
  218.     </div>
  219.  </div>
  220.  <div class="modal-quantite-produit  modal" style="width: 100%;margin: auto;" >
  221.     <div class="panel panel-white" style="background : #fff;">
  222.         <div class="panel-body"> 
  223.         <div class="row">
  224.         <div class="col-lg-4">
  225.         </div>
  226.         <div class="col-lg-4">
  227.         
  228.                     
  229.             <div class="form-group clearfix margin-top-15px center">
  230.                 <label class="control-label">Quantité </label>
  231.                 
  232.                 <div class="control"> 
  233.                     <input type="text"  maxlength="10" size="10" name="prix"  class="quantite-produit form-control"> 
  234.                     <input type="hidden"  class="form-control siQuantite" value="0" >
  235.                     <input type="hidden"  class="form-control produitId" value="0" >
  236.                     <input type="hidden"  class="form-control prixId" value="0" >
  237.                 </div>
  238.                 <input type="hidden"  maxlength="10" size="10"   class="produitPrixId form-control">
  239.             </div>
  240.                             
  241.             <div class="form-group clearfix pull-right">
  242.                {# <a   href="{{path('admin_caisses')}}"> 
  243.                     <i class="icon icon-white icon-arrow-left"></i> Annuler
  244.                 </a>#}
  245.                 <button type="button" class="readon orange-btn main-home valider-quantite" > 
  246.                     <i class="icon icon-white icon-ok"></i> Valider 
  247.                 </button>
  248.             </div>
  249.             <div class="col-lg-12" style="height: 10px"></div>
  250.         </div>
  251.         <div class="col-lg-4">
  252.         </div>
  253.     </div>
  254. </div>
  255. </div>
  256. {% endblock %}
  257. {% block javascripts %}
  258.     {{parent()}}
  259.     
  260.     <script src="{{asset('js/jquery-2.1.1.js')}}"></script>
  261.     <script src="{{asset('js/bootstrap.min.js')}}"></script>
  262.      <script src="{{asset('js/plugins/jquery-ui/jquery-ui.min.js')}}"></script>
  263.      <script src="{{asset('pincode/jquery-pincode-autotab.js')}}"></script>
  264.     <script type="text/javascript">
  265.      $(document).on( "dblclick", ".ligne-click", function() {
  266.                 // alert(".select-pourcentage"+$(this).attr("ids"));
  267.                  $(".select-pourcentage"+$(this).attr("ids")).show();
  268.                  $(".l-bt-delete"+$(this).attr("ids")).show();   
  269.         });
  270.         $(document).on( "click", ".info-categorie", function() {
  271.                 
  272.                     $(".zone-categorie").hide();
  273.                     $(".zone-categorie"+$(this).attr("ids")).show();
  274.                     
  275.             });
  276.         $(document).on( "click", ".commandeBt", function() {
  277.             //closeOnLoadGobi(onLoadGobi());
  278.                 afficherOperationCommandeVente($(this).attr("ids"), 8);
  279.                 $(".commandeId").val($(this).attr("ids"));
  280.                 $(".si-click").val(1);
  281.                 //closeOnLoadGobi(onLoadGobi());
  282.         });
  283.         $(document).on( "click", ".type-traitement", function() {
  284.                 $(".oeuvre-type-traitement").modal();
  285.                 $(".typeTraitement").val($(this).attr("btnActionVal"));
  286.                 $("#zone-traitement"+$(this).attr("btnActionVal")).show();
  287.                 //alert($(this).attr("btnActionVal"));
  288.                 
  289.         });
  290.         
  291.          $(document).on( "click", ".pro-format", function() {
  292.                  var href = "{{path('admin_imprimer_recu_standard_ESCPOS')}}";
  293.                 document.location.href = href + '/' + $(".commandeId").val()+'/1' ;
  294.                
  295.         });
  296.          $(document).on( "click", ".bt-annuler", function() {
  297.                  var href = "{{path('admin_commande_annuler')}}";
  298.                 document.location.href = href + '/' + $(".commandeId").val() ;
  299.                
  300.         });
  301.        // $(document).on( "dblclick", ".add_produit", function() {
  302.         $(document).on( "click", ".add_produit", function() {
  303.             var  infoetat  = $(this).attr("infoetat");
  304.             var produitPrix = $(this).attr("idp");
  305.             // alert(produitPrix=="-");
  306.             if(infoetat == 1){
  307.                $(".modal-quantite-produit").modal();
  308.                $(".quantite-produit").focus();
  309.               // $(".quantite-produit").val(0); 
  310.                $(".siQuantite").val(1); 
  311.                $(".produitId").val($(this).attr("ids")); 
  312.                $(".prixId").val($(this).attr("idp")); 
  313.             }else{
  314.                 alert("Produit en rupture de stock !");
  315.             }
  316.                
  317.         });
  318.         $(".valider-quantite").click(function() {
  319.             var  infoetat  = $(this).attr("infoetat");
  320.             var produitPrix = $(this).attr("idp");
  321.            // alert(produitPrix=="-");
  322.            /*if(infoetat == 1){
  323.                 if( produitPrix == "-"){
  324.                     //alert(1);
  325.                     $(".modal-prix-produit").modal();
  326.                     $(".produitPrixId").val($(this).attr("ids"));
  327.                 }else{*/
  328.                     addProduit($(".commandeId").val(), $(".produitId").val(), $(".prixId").val(), $(".quantite-produit").val());
  329.                     $(".modal-quantite-produit").modal("hide"); 
  330.          /*       }
  331.             }else{
  332.                 alert("Produit en rupture de stock !");
  333.             }*/
  334.                 
  335.         });
  336.         $(document).on( "click", ".bt-whatsapp", function() {
  337.            //alert(1);
  338.            sendWhatsapp();
  339.               
  340.         });
  341.         
  342.         $(document).on( "click", ".add-prix", function() {
  343.                 addProduit($(".commandeId").val(), $(".produitPrixId").val(), $(".prix-produit").val());  
  344.                 $(".modal-prix-produit").modal("hide");
  345.         });
  346.         function addProduit(commandeId, produitId, prixId, quantite){
  347.             $.ajax({
  348.                 dataType: 'json',
  349.                 type: 'POST',
  350.                 url: "{{ path('app_admin_incrementer_ligne_commande_client') }}",
  351.                 data: 'commandeId=' + commandeId + '&produitId=' + produitId + '&prix=' + prixId+ '&quantite='+quantite,
  352.                 beforeSend: function () {
  353.                    // onLoadGobi();
  354.                 },
  355.                 success: function (data) {
  356.                     var resultat = data.reponse;
  357.                     // alert(resultat);
  358.                     var listeLigneCommande = data.lignecommande;
  359.                     
  360.                     $('.listeOperation').html("");
  361.                     $(".montantRecu").val("");
  362.                     $(".montant-total").html("");
  363.                     $('.montant-recu').html("");
  364.                    // $('.form-ligne-commande').modal();
  365.                     if (listeLigneCommande.length == 0) {
  366.                         var html = " <td colspan=\"6\"  style=\"text-align: center;\" >Pas de livraison réalisée </td>";
  367.                         $('.listeOperation').append(html);
  368.                         $('.load-image').hide();
  369.                     } else {
  370.                         
  371.                         
  372.                         var infoGeneral = data.infoGenerale;
  373.                         var montantTotal =0;
  374.                         var msg ="";
  375.                         $('.listeOperationEvoluee').html("");
  376.                         for (var j = 0; j < data.lignecommande.length; j++) {
  377.                            
  378.                                
  379.                            // .replace(/(\d)(?=(\d{3})+$)/g, "$1 ") for (var i = 0; i < resultat[listeLigneCommande[j]].length; i++) { +{#                                 "  <td> " + data.lignecommande[j].dateLivraison +"</td> " +                                                #}
  380.                                 // var laDate = resultat[listeLigneCommande[j]][i].dateLivraison;//Traiter l'objet Date
  381.                                     //<button class=\"btn btn-info bt-pourcentage\" ids=\"" + data.lignecommande[j].id + "\" type=\"button\">%</button> 
  382.                                 var priTotal = parseInt(data.lignecommande[j].prix) * parseInt(data.lignecommande[j].quantite);
  383.                                 var html = "<div class=\"col-lg-12 ligne-click\" style=\"border-left: 2px #F11 solid;margin-top:10px;padding:10px;font-size: 20px; background : #F1F1F1;\"  ids=\"" + data.lignecommande[j].id + "\">"+
  384.                                              // " <div >   <div class=\"text-right\"> <select style=\"display:none\"  class=\"  change-pourcentage form form-control select-pourcentage" + data.lignecommande[j].id + "\" ids=\"" + data.lignecommande[j].id + "\" ><option  value=\"\"></option><option  value=\"10\">10%</option><option  value=\"15\">15%</option><option  value=\"25\">25%</option><option value=\"30\">30%</option> <option value=\"50\">50%</option></button> </div> " +
  385.                                                 "<div class=\"row\"> " +
  386.                                                     " <div class=\"col-lg-12\">"+ data.lignecommande[j].produit +"</div> " +
  387.                                                 "</div> "+
  388.                                                 "<div class=\"row\"> " +
  389.                                                     "<div class=\"col-lg-6\">"+data.lignecommande[j].quantite+"x"+data.lignecommande[j].prix+"</div>"+
  390.                                                     "<div class=\"col-lg-6\" style=\"text-align: right; font-weight: bold;\">"+priTotal+"</div>"+
  391.                                                 "</div> "
  392.                                                
  393.                                         +  "</div> ";
  394.                                 $('.listeOperationEvoluee').append(html);
  395.                             msg += "*"+data.lignecommande[j].produit+"* %0A"+data.lignecommande[j].quantite+"x"+data.lignecommande[j].prix+" .............. "+priTotal+"%0A";
  396.                           //  }
  397.                           montantTotal =  parseInt(montantTotal) + parseInt(priTotal);
  398.                         }
  399.                          msg += "%0A *Total ="+montantTotal+" F CFA*";
  400.                         $(".msgWhatsApp").val(msg);
  401.                         /*
  402.                          "<div class=\"row\"> " +
  403.                                                     "<div class=\"col-lg-8\"><div class=\"text-right\"> <select style=\"display:none\"  class=\"  change-pourcentage form form-control select-pourcentage" + data.lignecommande[j].id + "\" ids=\"" + data.lignecommande[j].id + "\" ><option  value=\"\"></option><option  value=\"10\">10%</option><option  value=\"15\">15%</option><option  value=\"25\">25%</option><option value=\"30\">30%</option> <option value=\"50\">50%</option></select> </div> </div>" +
  404.                                                     "<div class=\"col-lg-4\"><a href=\"#\" style=\"display:none\" class=\"btn btn-circle mini btn-danger btnEdit tooltipGobi bt-delete  l-bt-delete" + data.lignecommande[j].id + "\" title=\"Supprimer  \" ids=\""+ data.lignecommande[j].id + "\"><i class=\"glyphicon glyphicon-remove\"></i> </a> </div>" +
  405.                                                 "</div> "+*/
  406.                        $(".montantTotal").val("");
  407.                        $(".montant-total").html(montantTotal);
  408.                        //$('.load-image').hide();
  409.                     }
  410.                 },
  411.                 complete: function () {
  412.                     //closeOnLoadGobi(onLoadGobi());
  413.                 }
  414.             });
  415.         }
  416.          $(document).on( "change", ".change-pourcentage", function() {
  417.            // alert($(this).attr("ids"));
  418.            
  419.             $.ajax({
  420.                 dataType: 'json',
  421.                 type: 'POST',
  422.                 url: "{{ path('admin_set_pourcentage_commande') }}",
  423.                 data: 'idLigneCmde=' + $(this).attr("ids") + '&pourcentage=' + $(this).val(),
  424.                 beforeSend: function () {
  425.                    // onLoadGobi();
  426.                 },
  427.                 success: function (data) {
  428.                     var resultat = data.reponse;
  429.                     // alert(resultat);
  430.                     var listeLigneCommande = data.lignecommande;
  431.                     //alert(data.lignecommande);
  432.                     // console.log(resultat);return;
  433.                     $('.listeOperation').html("");
  434.                     $(".montantRecu").val("");
  435.                     $(".montant-total").html("");
  436.                     $('.montant-recu').html("");
  437.                    // $('.form-ligne-commande').modal();
  438.                     if (listeLigneCommande.length == 0) {
  439.                         var html = " <td colspan=\"6\"  style=\"text-align: center;\" >Pas de livraison réalisée </td>";
  440.                         $('.listeOperation').append(html);
  441.                         $('.load-image').hide();
  442.                     } else {
  443.                         $('.zone-date').html("");
  444.                         $('.zone-date').append("Date : "+data.infoGenerale.dateCommande);
  445.                         $('.zone-code-commande').html("");
  446.                         $('.zone-code-commande').append("Numéro : "+data.infoGenerale.codeCommande);
  447.                         $('.zone-fournisseur').html("");
  448.                         $('.zone-fournisseur').append("Serveur : "+data.infoGenerale.fournisseur);
  449.                         
  450.                         var infoGeneral = data.infoGenerale;
  451.                         var montantTotal =0;
  452.                          $('.listeOperationEvoluee').html("");
  453.                         for (var j = 0; j < data.lignecommande.length; j++) {
  454.                            // .replace(/(\d)(?=(\d{3})+$)/g, "$1 ") for (var i = 0; i < resultat[listeLigneCommande[j]].length; i++) { +{#                                 "  <td> " + data.lignecommande[j].dateLivraison +"</td> " +                                                #}
  455.                                 // var laDate = resultat[listeLigneCommande[j]][i].dateLivraison;//Traiter l'objet Date
  456.                                     //<button class=\"btn btn-info bt-pourcentage\" ids=\"" + data.lignecommande[j].id + "\" type=\"button\">%</button> 
  457.                                 var priTotal = parseInt(data.lignecommande[j].prix) * parseInt(data.lignecommande[j].quantite);
  458.                                 var html = "<div class=\"col-lg-12 ligne-click\" style=\"border-left: 2px #F11 solid;margin-top:10px;padding:10px;font-size: 20px; background : #F1F1F1;\"  ids=\"" + data.lignecommande[j].id + "\">"+
  459.                                              // " <div >   <div class=\"text-right\"> <select style=\"display:none\"  class=\"  change-pourcentage form form-control select-pourcentage" + data.lignecommande[j].id + "\" ids=\"" + data.lignecommande[j].id + "\" ><option  value=\"\"></option><option  value=\"10\">10%</option><option  value=\"15\">15%</option><option  value=\"25\">25%</option><option value=\"30\">30%</option> <option value=\"50\">50%</option></button> </div> " +
  460.                                                   "<div> " +
  461.                                                 " <div class=\"col-lg-12\">"+ data.lignecommande[j].produit +"</div> " +
  462.                                                 "<div class=\"col-lg-6\">"+data.lignecommande[j].quantite+"x"+data.lignecommande[j].prix+"</div>"+
  463.                                                 "<div class=\"col-lg-6\" style=\"text-align: right; font-weight: bold;\">"+priTotal+"</div>"+
  464.                                
  465.                                                 "  <div class=\"col-lg-8\"><div class=\"text-right\"> <select style=\"display:none\"  class=\"  change-pourcentage form form-control select-pourcentage" + data.lignecommande[j].id + "\" ids=\"" + data.lignecommande[j].id + "\" ><option  value=\"\"></option><option  value=\"10\">10%</option><option  value=\"15\">15%</option><option  value=\"25\">25%</option><option value=\"30\">30%</option> <option value=\"50\">50%</option></select> </div> </div>" +
  466.                                                 "  <div class=\"col-lg-4\"><a href=\"#\" style=\"display:none\" class=\"btn btn-circle mini btn-danger btnEdit tooltipGobi bt-delete l-bt-delete" + data.lignecommande[j].id + "\" title=\"Supprimer  \" ids=\""+ data.lignecommande[j].id + "\"><i class=\"glyphicon glyphicon-remove\"></i> </a> </div>" +
  467.                                                  "</div> "
  468.                                             +  "</div> ";
  469.                                 $('.listeOperationEvoluee').append(html);
  470.                           //  }
  471.                           montantTotal =  parseInt(montantTotal) + parseInt(priTotal)
  472.                           //  }
  473.                          // montantTotal =  parseInt(montantTotal) + parseInt(priTotal)
  474.                         }
  475.                        $(".montantTotal").val("");
  476.                        $(".montant-total").html(montantTotal);
  477.                        
  478.                        $('.load-image').hide();
  479.                     }
  480.                 },
  481.                 complete: function () {
  482.                 //closeOnLoadGobi(onLoadGobi());
  483.                 }
  484.             });    
  485.         });
  486.         function afficherOperationCommandeVente(idcommande, idabonne) {
  487.            
  488.             $.ajax({
  489.                 dataType: 'json',
  490.                 type: 'POST',
  491.                 url: "{{ path('admin_liste_operation_vente_commande') }}",
  492.                 data: 'idcommande=' + idcommande + '&idabonne=' + idabonne,
  493.                 beforeSend: function () {
  494.                     if($(".si-click").val() == 1){
  495.                         onLoadGobi();
  496.                     }
  497.                         
  498.                 },
  499.                 success: function (data) {
  500.                     var resultat = data.reponse;
  501.                     // alert(resultat);
  502.                     var listeLigneCommande = data.lignecommande;
  503.                     //alert(data.lignecommande);
  504.                     // console.log(resultat);return;
  505.                     $('.listeOperation').html("");
  506.                     $(".montantRecu").val("");
  507.                     $(".montant-total").html("");
  508.                     $('.montant-recu').html("");
  509.                     $('.form-ligne-commande').modal();
  510.                     if (listeLigneCommande.length == 0) {
  511.                         var html = " <td colspan=\"6\"  style=\"text-align: center;\" >Pas de livraison réalisée </td>";
  512.                         $('.listeOperation').append(html);
  513.                         $('.load-image').hide();
  514.                          
  515.                     } else {
  516.                         $('.zone-date').html("");
  517.                         $('.zone-date').append("Date : "+data.infoGenerale.dateCommande);
  518.                         $('.zone-code-commande').html("");
  519.                         $('.zone-code-commande').append("Numéro : "+data.infoGenerale.codeCommande);
  520.                         $('.zone-fournisseur').html("");
  521.                         $('.zone-fournisseur').append("Serveur : "+data.infoGenerale.fournisseur);
  522.                         
  523.                         var infoGeneral = data.infoGenerale;
  524.                         var montantTotal =0;
  525.                         for (var j = 0; j < data.lignecommande.length; j++) {
  526.                            // .replace(/(\d)(?=(\d{3})+$)/g, "$1 ") for (var i = 0; i < resultat[listeLigneCommande[j]].length; i++) { +{#                                 "  <td> " + data.lignecommande[j].dateLivraison +"</td> " +                                                #}
  527.                                 // var laDate = resultat[listeLigneCommande[j]][i].dateLivraison;//Traiter l'objet Date
  528.                                 //<button class=\"btn btn-info bt-pourcentage\" ids=\"" + data.lignecommande[j].id + "\" type=\"button\">%</button> 
  529.                                 var prixTotal = parseInt(data.lignecommande[j].prix) * parseInt(data.lignecommande[j].quantite);
  530.                                 var html = "<tr class=\"ligne-click\" ids=\"" + data.lignecommande[j].id + "\">" +
  531.                                                 "  <td class=\"text-right\"> <select style=\"display:none\"  class=\"  change-pourcentage form form-control select-pourcentage" + data.lignecommande[j].id + "\" ids=\"" + data.lignecommande[j].id + "\" ><option  value=\"\"></option><option  value=\"10\">10%</option><option  value=\"15\">15%</option><option  value=\"25\">25%</option><option value=\"30\">30%</option> <option value=\"50\">50%</option></button> </td> " +
  532.                                                 
  533.                                                 "  <td class=\"text-right\"> <input type=\"hidden\"  name=\"commandeId\" value=\""+idcommande+"\" />" + data.lignecommande[j].produit + "</td> " +
  534.                                                
  535.                                                 "  <td class=\"text-right\"> " + data.lignecommande[j].quantite + "</td> " +
  536.                                                 "  <td class=\"text-right\"> " + data.lignecommande[j].prix + "</td> " +
  537.                                                 "  <td class=\"text-right\"> "+prixTotal+" </td> " +
  538.                                                     " <td class=\"text-right\">  </td> " +
  539.                                              
  540.                                                 "  ";
  541.                                         +  "</tr>";
  542.                                 $('.listeOperation').append(html);
  543.                                 //<a href=\"#\" class=\"btn btn-circle mini btn-danger btnEdit tooltipGobi bt-delete\" title=\"Supprimer  \" ids=\""+ data.lignecommande[j].id + "\"><i class=\"glyphicon glyphicon-remove\"></i> </a>
  544.                           //  }
  545.                           montantTotal =  parseInt(montantTotal) + parseInt(prixTotal)
  546.                         }
  547.                        $(".montantTotal").val("");
  548.                        $(".montant-total").html(montantTotal);
  549.                        //montant-total
  550.                        $('.load-image').hide();
  551.                     }
  552.                 },
  553.                 complete: function () {
  554.                 closeOnLoadGobi(onLoadGobi());
  555.                 }
  556.             });
  557.         }
  558.         $(document).ready(function() {
  559.             $(".myPinCode input").jqueryPincodeAutotab();
  560.         });
  561.         $('.agent').click(function () {
  562.                 $('.oeuvre-agent').modal();
  563.         });
  564.          $(document).on( "click", ".bt-delete", function() {
  565.             var id = $(this).attr("ids") ;  
  566.             //$(".form-ligne-commande" ).modal('toggle');
  567.             msg ="Supprimer la ligne de commande ";    
  568.             deleteConfirmationSetEtat(msg, id);
  569.          })
  570.          function deleteConfirmationSetEtat(msg, id) {
  571.             $('<div id="msg" title="Confirm."><p> ' + msg + '</p></div>').dialog({
  572.                 hide: {
  573.                     // effect: "explode"isEmetteur,
  574.                     duration: 500
  575.                 },
  576.                 modal: true,
  577.                 autoOpen: false,
  578.                 buttons: {
  579.                     " Annuler ": function () {
  580.                         $(this).dialog('close');
  581.                     },
  582.                     " Confirmer ": function () {
  583.                         deleteLigneCommande(id);
  584.                         $(this).dialog('close');
  585.                     }
  586.                 }
  587.             }).dialog('open');
  588.         }
  589.           function deleteLigneCommande(id){
  590.            // alert($(this).attr("ids"));
  591.            
  592.             $.ajax({
  593.                 dataType: 'json',
  594.                 type: 'POST',
  595.                 url: "{{ path('admin_set_delete_commande') }}",
  596.                 data: 'idLigneCmde=' + id,
  597.                 beforeSend: function () {
  598.                    // onLoadGobi();
  599.                 },
  600.                 success: function (data) {
  601.                     var resultat = data.reponse;
  602.                     // alert(resultat);
  603.                     var listeLigneCommande = data.lignecommande;
  604.                     //alert(data.lignecommande);
  605.                     // console.log(resultat);return;
  606.                     $('.listeOperation').html("");
  607.                     $(".montantRecu").val("");
  608.                     $(".montant-total").html("");
  609.                     $('.montant-recu').html("");
  610.                     //$('.form-ligne-commande').modal();
  611.                     if (listeLigneCommande.length == 0) {
  612.                         var html = " <td colspan=\"6\"  style=\"text-align: center;\" >Pas de livraison réalisée </td>";
  613.                         $('.listeOperation').append(html);
  614.                         $('.load-image').hide();
  615.                     } else {
  616.                         $('.zone-date').html("");
  617.                         $('.zone-date').append("Date : "+data.infoGenerale.dateCommande);
  618.                         $('.zone-code-commande').html("");
  619.                         $('.zone-code-commande').append("Numéro : "+data.infoGenerale.codeCommande);
  620.                         $('.zone-fournisseur').html("");
  621.                         $('.zone-fournisseur').append("Serveur : "+data.infoGenerale.fournisseur);
  622.                         
  623.                         var infoGeneral = data.infoGenerale;
  624.                         var montantTotal =0;
  625.                          $('.listeOperationEvoluee').html("");
  626.                         for (var j = 0; j < data.lignecommande.length; j++) {
  627.                            // .replace(/(\d)(?=(\d{3})+$)/g, "$1 ") for (var i = 0; i < resultat[listeLigneCommande[j]].length; i++) { +{#                                 "  <td> " + data.lignecommande[j].dateLivraison +"</td> " +                                                #}
  628.                                 // var laDate = resultat[listeLigneCommande[j]][i].dateLivraison;//Traiter l'objet Date
  629.                                     //<button class=\"btn btn-info bt-pourcentage\" ids=\"" + data.lignecommande[j].id + "\" type=\"button\">%</button> 
  630.                                 var priTotal = parseInt(data.lignecommande[j].prix) * parseInt(data.lignecommande[j].quantite);
  631.                                 var html = "<div class=\"col-lg-12 ligne-click\" style=\"border-left: 2px #F11 solid;margin-top:10px;padding:10px;font-size: 20px; background : #F1F1F1;\"  ids=\"" + data.lignecommande[j].id + "\">"+
  632.                                              // " <div >   <div class=\"text-right\"> <select style=\"display:none\"  class=\"  change-pourcentage form form-control select-pourcentage" + data.lignecommande[j].id + "\" ids=\"" + data.lignecommande[j].id + "\" ><option  value=\"\"></option><option  value=\"10\">10%</option><option  value=\"15\">15%</option><option  value=\"25\">25%</option><option value=\"30\">30%</option> <option value=\"50\">50%</option></button> </div> " +
  633.                                                   "<div> " +
  634.                                                 " <div class=\"col-lg-12\">"+ data.lignecommande[j].produit +"</div> " +
  635.                                                 "<div class=\"col-lg-6\">"+data.lignecommande[j].quantite+"x"+data.lignecommande[j].prix+"</div>"+
  636.                                                 "<div class=\"col-lg-6\" style=\"text-align: right; font-weight: bold;\">"+priTotal+"</div>"+
  637.                                
  638.                                                 "  <div class=\"col-lg-8\"><div class=\"text-right\"> <select style=\"display:none\"  class=\"  change-pourcentage form form-control select-pourcentage" + data.lignecommande[j].id + "\" ids=\"" + data.lignecommande[j].id + "\" ><option  value=\"\"></option><option  value=\"10\">10%</option><option  value=\"15\">15%</option><option  value=\"25\">25%</option><option value=\"30\">30%</option> <option value=\"50\">50%</option></select> </div> </div>" +
  639.                                                 "  <div class=\"col-lg-4\"><a href=\"#\" style=\"display:none\" class=\"btn btn-circle mini btn-danger btnEdit tooltipGobi bt-delete l-bt-delete" + data.lignecommande[j].id + "\" title=\"Supprimer  \" ids=\""+ data.lignecommande[j].id + "\"><i class=\"glyphicon glyphicon-remove\"></i> </a> </div>" +
  640.                                                  "</div> "
  641.                                             +  "</div> ";
  642.                                 $('.listeOperationEvoluee').append(html);
  643.                           //  }
  644.                           montantTotal =  parseInt(montantTotal) + parseInt(priTotal)
  645.                         }
  646.                        $(".montantTotal").val("");
  647.                        $(".montant-total").html(montantTotal);
  648.                        $('.load-image').hide();
  649.                     }
  650.                 },
  651.                 complete: function () {
  652.                     //location.reload();
  653.                 //closeOnLoadGobi(onLoadGobi());
  654.                 }
  655.             });    
  656.         }
  657.     </script>
  658. {% endblock %}
  659.