{% extends 'baseTemplate_2.html.twig' %}
{% import 'macro.html.twig' as traiteinfo %}
{% import 'macroEntete.html.twig' as traiteinfoEntete %}
{% import 'macroAbout.html.twig' as traiteinfoAbout %}
{% import 'macroShop.html.twig' as traiteinfoShop %}
{% import 'presentation/macroHead.html.twig' as traiteinfoHead %}
{% block body %}
{% set inc = 0 %}
<body class="home-style">
<div class="full-width-header header-style1 home1-modifiy">
<!--Header Start-->
{{ traiteinfoHead.infoHead(typeSite,objetAbonne,listeMenu) }}
<!--Header End-->
</div>
<!--Full width header End-->
<div class="main-content">
<div class="col-lg-12">
{% for contenu in app.session.getflashbag.get('fournisseur.ajout.success')%}
{% if loop.index == 0%}
<div class="row">
<div class="col-lg-12 ">
{% endif%}
<div class="text-center alert alert-success">{{contenu}}</div>
{% if loop.index == 0%}
</div>
</div>
{% endif%}
{% endfor%}
{% for contenu in app.session.getflashbag.get('caisse.non.configure')%}
{% if loop.index == 0%}
<div class="row">
<div class="col-lg-12 ">
{% endif%}
<div class="text-center alert alert-error">{{contenu}}</div>
{% if loop.index == 0%}
</div>
</div>
{% endif %}
{% endfor%}
{% for contenu in app.session.getflashbag.get('fournisseur.ajout.error')%}
{% if loop.index == 0%}
<div class="row">
<div class="col-lg-12 ">
{% endif%}
<div class="text-center alert alert-error">{{contenu}}</div>
{% if loop.index == 0%}
</div>
</div>
{% endif%}
{% endfor%}
{% for contenu in app.session.getflashbag.get('fournisseur.ajout.already.exist')%}
{% if loop.index == 0%}
<div class="row">
<div class="col-lg-12 ">
{% endif%}
<div class="text-center alert alert-error">{{contenu}}</div>
{% if loop.index == 0%}
</div>
</div>
{% endif%}
{% endfor%}
<div class="row">
<div class="col-lg-12" id="iderror" hidden="true">
<div class="text-center alert alert-error">Ce produit a été déjà ajouté dans la liste ci-dessous!</div>
</div>
<div class="col-lg-12" id="idsuppr" hidden="true">
<div class="text-center alert alert-error">Suppression effectuée avec succès.</div>
</div>
</div>
</div>
<div style="background: #f3f3f3;width:100%;height:100px;">
</div>
<br/><br/><br/>
<div class="container">
<div class="row">
<div class="col-lg-8">
<div class="col-lg-12"> {# zone des categorie #}
<input type="hidden" name="commandeId" class="commandeId" value="{{uneCommande.id}}"/>
<input type="hidden" class="msgWhatsApp" />
<div id="rs-popular-courses" class="rs-popular-courses style1 orange-color modify1 pb-100 md-pt-70 md-pb-70">
<div class="container">
<div class="sec-title6 text-center mb-40">
<div class="img-part mb-10">
<img src="assets/images/line.png" alt="">
</div>
</div>
<div class="gridFilter style2 text-center mb-30">
<button class="active" data-filter="*">Tout</button>
{% for uneCategorie in listeCategorie %}
<button data-filter=".{{uneCategorie['codeGenere']}}">{{uneCategorie['nom']}}</button>
{% endfor %}
{#<button data-filter=".filter2">Computer Engineering</button>
<button data-filter=".filter3">General Education</button>
<button data-filter=".filter4">High School</button>#}
</div>
<div class="row grid">
{% for unProduit in listeProduit %}
<div class="col-lg-4 col-md-6 grid-item {{unProduit["prodCodeGenere"]}}" >
<div class="courses-item mb-30 add_produit " idp="{{unProduit['prixAchat']}}" ids="{{unProduit['id']}}" infoetat="{% if unProduit["enStockProduit"] > 0 %}1{% else %}0{% endif %}">
<div class="img-part">
<img src="{{asset('upload/'~unProduit["urlImage"])}}" alt="">
</div>
<div class="content-part">
<ul class="meta-part">
<li><span class="price">{{unProduit["prixAchat"]}} F CFA</span></li>
</ul>
<h3 class="title"><a href="#">{{unProduit["nom"]}}</a></h3>
{% if unProduit["enStockProduit"] > 0 %}
<span class="price" style ="color : #3A9D23;font-weight: bold;" > En stock </span>
{% else %}
<span class="price" style ="color : #F00020;font-weight: bold;"> Rupture de stock </span>
{% endif %}
</div>
</div>
</div>
{% endfor %}
</div>
</div>
</div>{#
<div style="align-items: center;
display: flex;
flex-grow: 1;
flex-shrink: 0;
justify-content: flex-start;">
{% for uneCategorie in listeCategorie %}
<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;">
<h5 class="card-title">{{uneCategorie['nom']}}</h5>
</span>
{% endfor %}
<input type="hidden" name="commandeId" class="commandeId" value="{{uneCommande.id}}"/>
<input type="hidden" class="msgWhatsApp" />
</div>
</div>
<div class="col-lg-12" style="overflow-y: scroll;height:auto;"> {# zone des produits
{% for uneCategorie in listeCategorie %}
<div class=" zone-categorie {{'zone-categorie'~uneCategorie['id']}}" style="display: none;" ids="{{uneCategorie['id']}}" >
<div class="row">
{% for t in listeProduit[uneCategorie.id] %}
<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">
<div class="card" style="border-top:2px solid #22b14c;">
<div class="card-body">
<h5 class="card-title">{{t['nom']}}</h5>
<p class="card-text">-</p>
<div class="{{'produit'~t['id']}}" style="width:100%;text-align:right; font-size: 20px;font-weight: bold;">{{t['prixAchat']}}</div>
</div>
</div>
</div>
{% endfor %}
</div>
</div>
{% endfor %}
</div>#}
</div>
</div>
<div class="col-lg-4">
<div class="col-lg-12" style="overflow-y: scroll; border-left: 1px solid #F1F1F1;"> {# zone adresse #}
<div class="listeOperationEvoluee">
{% for uneLIngeCommande in uneCommande.lignecommandeclients %}
<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}}">
<div class="row">
<div class="col-lg-12">{{uneLIngeCommande.produit.nomProduit}}</div>
<div class="col-lg-6">{{uneLIngeCommande.quantite~"x"~uneLIngeCommande.prixrigueur.infoPrixRigueur}}</div>
<div class="col-lg-6" style="text-align: right; font-weight: bold;">{% set montantTotal = uneLIngeCommande.quantite * uneLIngeCommande.prixrigueur.infoPrixRigueur %}{{montantTotal}}</div>
<div class="col-lg-8">
<div class="text-right">
</div>
</div>
<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>
</div>
</div>
{% endfor %}
</div>
</div>
<div class="col-lg-12"> {# zone valider #}
<hr style="border:#FFF;"/>
<br/><br/><br/>
<form action="{{path('app_admin_user_pointer',{type:1})}}" method="POST">
<div class="form-group clearfix margin-top-15px center">
<label class="control-label">Nom </label>
<div class="control"> <input class="form-control nomPrenoms" type="text" name="id" value ="{#{objetUtilisateur.id}#}"class="id form-control; border:1px solid #CCC"> </div>
</div>
<div class="form-group clearfix margin-top-15px center">
<label class="control-label">Téléphone </label>
<div class="control"> <input class="form-control tel" type="text" name="id" value ="{#{objetUtilisateur.id}#}"class="id form-control; border:1px solid #CCC"> </div>
</div>
<div class="form-group clearfix margin-top-15px center">
<label class="control-label">Adresse </label>
<div class="control"> <input class="form-control adresse" type="text" name="id" value ="{#{objetUtilisateur.id}#}"class="id form-control; border:1px solid #CCC"> </div>
</div>
<div class="form-group clearfix pull-right">
{#<button type="submit" class="btn btn-info " id="submit" >
<i class="icon icon-white icon-ok"></i> Valider
</button>#}
<a href="#" class="bt-whatsapp">
<i class="icon icon-white icon-arrow-left "></i> Whatsapp
</a>
</div>
</form>
</div>
</div>
</div>
</div>
<div class="modal-quantite-produit modal" style="width: 100%;margin: auto;" >
<div class="panel panel-white" style="background : #fff;">
<div class="panel-body">
<div class="row">
<div class="col-lg-4">
</div>
<div class="col-lg-4">
<div class="form-group clearfix margin-top-15px center">
<label class="control-label">Quantité </label>
<div class="control">
<input type="text" maxlength="10" size="10" name="prix" class="quantite-produit form-control">
<input type="hidden" class="form-control siQuantite" value="0" >
<input type="hidden" class="form-control produitId" value="0" >
<input type="hidden" class="form-control prixId" value="0" >
</div>
<input type="hidden" maxlength="10" size="10" class="produitPrixId form-control">
</div>
<div class="form-group clearfix pull-right">
{# <a href="{{path('admin_caisses')}}">
<i class="icon icon-white icon-arrow-left"></i> Annuler
</a>#}
<button type="button" class="readon orange-btn main-home valider-quantite" >
<i class="icon icon-white icon-ok"></i> Valider
</button>
</div>
<div class="col-lg-12" style="height: 10px"></div>
</div>
<div class="col-lg-4">
</div>
</div>
</div>
</div>
{% endblock %}
{% block javascripts %}
{{parent()}}
<script src="{{asset('js/jquery-2.1.1.js')}}"></script>
<script src="{{asset('js/bootstrap.min.js')}}"></script>
<script src="{{asset('js/plugins/jquery-ui/jquery-ui.min.js')}}"></script>
<script src="{{asset('pincode/jquery-pincode-autotab.js')}}"></script>
<script type="text/javascript">
$(document).on( "dblclick", ".ligne-click", function() {
// alert(".select-pourcentage"+$(this).attr("ids"));
$(".select-pourcentage"+$(this).attr("ids")).show();
$(".l-bt-delete"+$(this).attr("ids")).show();
});
$(document).on( "click", ".info-categorie", function() {
$(".zone-categorie").hide();
$(".zone-categorie"+$(this).attr("ids")).show();
});
$(document).on( "click", ".commandeBt", function() {
//closeOnLoadGobi(onLoadGobi());
afficherOperationCommandeVente($(this).attr("ids"), 8);
$(".commandeId").val($(this).attr("ids"));
$(".si-click").val(1);
//closeOnLoadGobi(onLoadGobi());
});
$(document).on( "click", ".type-traitement", function() {
$(".oeuvre-type-traitement").modal();
$(".typeTraitement").val($(this).attr("btnActionVal"));
$("#zone-traitement"+$(this).attr("btnActionVal")).show();
//alert($(this).attr("btnActionVal"));
});
$(document).on( "click", ".pro-format", function() {
var href = "{{path('admin_imprimer_recu_standard_ESCPOS')}}";
document.location.href = href + '/' + $(".commandeId").val()+'/1' ;
});
$(document).on( "click", ".bt-annuler", function() {
var href = "{{path('admin_commande_annuler')}}";
document.location.href = href + '/' + $(".commandeId").val() ;
});
// $(document).on( "dblclick", ".add_produit", function() {
$(document).on( "click", ".add_produit", function() {
var infoetat = $(this).attr("infoetat");
var produitPrix = $(this).attr("idp");
// alert(produitPrix=="-");
if(infoetat == 1){
$(".modal-quantite-produit").modal();
$(".quantite-produit").focus();
// $(".quantite-produit").val(0);
$(".siQuantite").val(1);
$(".produitId").val($(this).attr("ids"));
$(".prixId").val($(this).attr("idp"));
}else{
alert("Produit en rupture de stock !");
}
});
$(".valider-quantite").click(function() {
var infoetat = $(this).attr("infoetat");
var produitPrix = $(this).attr("idp");
// alert(produitPrix=="-");
/*if(infoetat == 1){
if( produitPrix == "-"){
//alert(1);
$(".modal-prix-produit").modal();
$(".produitPrixId").val($(this).attr("ids"));
}else{*/
addProduit($(".commandeId").val(), $(".produitId").val(), $(".prixId").val(), $(".quantite-produit").val());
$(".modal-quantite-produit").modal("hide");
/* }
}else{
alert("Produit en rupture de stock !");
}*/
});
$(document).on( "click", ".bt-whatsapp", function() {
//alert(1);
sendWhatsapp();
});
$(document).on( "click", ".add-prix", function() {
addProduit($(".commandeId").val(), $(".produitPrixId").val(), $(".prix-produit").val());
$(".modal-prix-produit").modal("hide");
});
function addProduit(commandeId, produitId, prixId, quantite){
$.ajax({
dataType: 'json',
type: 'POST',
url: "{{ path('app_admin_incrementer_ligne_commande_client') }}",
data: 'commandeId=' + commandeId + '&produitId=' + produitId + '&prix=' + prixId+ '&quantite='+quantite,
beforeSend: function () {
// onLoadGobi();
},
success: function (data) {
var resultat = data.reponse;
// alert(resultat);
var listeLigneCommande = data.lignecommande;
$('.listeOperation').html("");
$(".montantRecu").val("");
$(".montant-total").html("");
$('.montant-recu').html("");
// $('.form-ligne-commande').modal();
if (listeLigneCommande.length == 0) {
var html = " <td colspan=\"6\" style=\"text-align: center;\" >Pas de livraison réalisée </td>";
$('.listeOperation').append(html);
$('.load-image').hide();
} else {
var infoGeneral = data.infoGenerale;
var montantTotal =0;
var msg ="";
$('.listeOperationEvoluee').html("");
for (var j = 0; j < data.lignecommande.length; j++) {
// .replace(/(\d)(?=(\d{3})+$)/g, "$1 ") for (var i = 0; i < resultat[listeLigneCommande[j]].length; i++) { +{# " <td> " + data.lignecommande[j].dateLivraison +"</td> " + #}
// var laDate = resultat[listeLigneCommande[j]][i].dateLivraison;//Traiter l'objet Date
//<button class=\"btn btn-info bt-pourcentage\" ids=\"" + data.lignecommande[j].id + "\" type=\"button\">%</button>
var priTotal = parseInt(data.lignecommande[j].prix) * parseInt(data.lignecommande[j].quantite);
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 + "\">"+
// " <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> " +
"<div class=\"row\"> " +
" <div class=\"col-lg-12\">"+ data.lignecommande[j].produit +"</div> " +
"</div> "+
"<div class=\"row\"> " +
"<div class=\"col-lg-6\">"+data.lignecommande[j].quantite+"x"+data.lignecommande[j].prix+"</div>"+
"<div class=\"col-lg-6\" style=\"text-align: right; font-weight: bold;\">"+priTotal+"</div>"+
"</div> "
+ "</div> ";
$('.listeOperationEvoluee').append(html);
msg += "*"+data.lignecommande[j].produit+"* %0A"+data.lignecommande[j].quantite+"x"+data.lignecommande[j].prix+" .............. "+priTotal+"%0A";
// }
montantTotal = parseInt(montantTotal) + parseInt(priTotal);
}
msg += "%0A *Total ="+montantTotal+" F CFA*";
$(".msgWhatsApp").val(msg);
/*
"<div class=\"row\"> " +
"<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>" +
"<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>" +
"</div> "+*/
$(".montantTotal").val("");
$(".montant-total").html(montantTotal);
//$('.load-image').hide();
}
},
complete: function () {
//closeOnLoadGobi(onLoadGobi());
}
});
}
$(document).on( "change", ".change-pourcentage", function() {
// alert($(this).attr("ids"));
$.ajax({
dataType: 'json',
type: 'POST',
url: "{{ path('admin_set_pourcentage_commande') }}",
data: 'idLigneCmde=' + $(this).attr("ids") + '&pourcentage=' + $(this).val(),
beforeSend: function () {
// onLoadGobi();
},
success: function (data) {
var resultat = data.reponse;
// alert(resultat);
var listeLigneCommande = data.lignecommande;
//alert(data.lignecommande);
// console.log(resultat);return;
$('.listeOperation').html("");
$(".montantRecu").val("");
$(".montant-total").html("");
$('.montant-recu').html("");
// $('.form-ligne-commande').modal();
if (listeLigneCommande.length == 0) {
var html = " <td colspan=\"6\" style=\"text-align: center;\" >Pas de livraison réalisée </td>";
$('.listeOperation').append(html);
$('.load-image').hide();
} else {
$('.zone-date').html("");
$('.zone-date').append("Date : "+data.infoGenerale.dateCommande);
$('.zone-code-commande').html("");
$('.zone-code-commande').append("Numéro : "+data.infoGenerale.codeCommande);
$('.zone-fournisseur').html("");
$('.zone-fournisseur').append("Serveur : "+data.infoGenerale.fournisseur);
var infoGeneral = data.infoGenerale;
var montantTotal =0;
$('.listeOperationEvoluee').html("");
for (var j = 0; j < data.lignecommande.length; j++) {
// .replace(/(\d)(?=(\d{3})+$)/g, "$1 ") for (var i = 0; i < resultat[listeLigneCommande[j]].length; i++) { +{# " <td> " + data.lignecommande[j].dateLivraison +"</td> " + #}
// var laDate = resultat[listeLigneCommande[j]][i].dateLivraison;//Traiter l'objet Date
//<button class=\"btn btn-info bt-pourcentage\" ids=\"" + data.lignecommande[j].id + "\" type=\"button\">%</button>
var priTotal = parseInt(data.lignecommande[j].prix) * parseInt(data.lignecommande[j].quantite);
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 + "\">"+
// " <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> " +
"<div> " +
" <div class=\"col-lg-12\">"+ data.lignecommande[j].produit +"</div> " +
"<div class=\"col-lg-6\">"+data.lignecommande[j].quantite+"x"+data.lignecommande[j].prix+"</div>"+
"<div class=\"col-lg-6\" style=\"text-align: right; font-weight: bold;\">"+priTotal+"</div>"+
" <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>" +
" <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>" +
"</div> "
+ "</div> ";
$('.listeOperationEvoluee').append(html);
// }
montantTotal = parseInt(montantTotal) + parseInt(priTotal)
// }
// montantTotal = parseInt(montantTotal) + parseInt(priTotal)
}
$(".montantTotal").val("");
$(".montant-total").html(montantTotal);
$('.load-image').hide();
}
},
complete: function () {
//closeOnLoadGobi(onLoadGobi());
}
});
});
function afficherOperationCommandeVente(idcommande, idabonne) {
$.ajax({
dataType: 'json',
type: 'POST',
url: "{{ path('admin_liste_operation_vente_commande') }}",
data: 'idcommande=' + idcommande + '&idabonne=' + idabonne,
beforeSend: function () {
if($(".si-click").val() == 1){
onLoadGobi();
}
},
success: function (data) {
var resultat = data.reponse;
// alert(resultat);
var listeLigneCommande = data.lignecommande;
//alert(data.lignecommande);
// console.log(resultat);return;
$('.listeOperation').html("");
$(".montantRecu").val("");
$(".montant-total").html("");
$('.montant-recu').html("");
$('.form-ligne-commande').modal();
if (listeLigneCommande.length == 0) {
var html = " <td colspan=\"6\" style=\"text-align: center;\" >Pas de livraison réalisée </td>";
$('.listeOperation').append(html);
$('.load-image').hide();
} else {
$('.zone-date').html("");
$('.zone-date').append("Date : "+data.infoGenerale.dateCommande);
$('.zone-code-commande').html("");
$('.zone-code-commande').append("Numéro : "+data.infoGenerale.codeCommande);
$('.zone-fournisseur').html("");
$('.zone-fournisseur').append("Serveur : "+data.infoGenerale.fournisseur);
var infoGeneral = data.infoGenerale;
var montantTotal =0;
for (var j = 0; j < data.lignecommande.length; j++) {
// .replace(/(\d)(?=(\d{3})+$)/g, "$1 ") for (var i = 0; i < resultat[listeLigneCommande[j]].length; i++) { +{# " <td> " + data.lignecommande[j].dateLivraison +"</td> " + #}
// var laDate = resultat[listeLigneCommande[j]][i].dateLivraison;//Traiter l'objet Date
//<button class=\"btn btn-info bt-pourcentage\" ids=\"" + data.lignecommande[j].id + "\" type=\"button\">%</button>
var prixTotal = parseInt(data.lignecommande[j].prix) * parseInt(data.lignecommande[j].quantite);
var html = "<tr class=\"ligne-click\" ids=\"" + data.lignecommande[j].id + "\">" +
" <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> " +
" <td class=\"text-right\"> <input type=\"hidden\" name=\"commandeId\" value=\""+idcommande+"\" />" + data.lignecommande[j].produit + "</td> " +
" <td class=\"text-right\"> " + data.lignecommande[j].quantite + "</td> " +
" <td class=\"text-right\"> " + data.lignecommande[j].prix + "</td> " +
" <td class=\"text-right\"> "+prixTotal+" </td> " +
" <td class=\"text-right\"> </td> " +
" ";
+ "</tr>";
$('.listeOperation').append(html);
//<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>
// }
montantTotal = parseInt(montantTotal) + parseInt(prixTotal)
}
$(".montantTotal").val("");
$(".montant-total").html(montantTotal);
//montant-total
$('.load-image').hide();
}
},
complete: function () {
closeOnLoadGobi(onLoadGobi());
}
});
}
$(document).ready(function() {
$(".myPinCode input").jqueryPincodeAutotab();
});
$('.agent').click(function () {
$('.oeuvre-agent').modal();
});
$(document).on( "click", ".bt-delete", function() {
var id = $(this).attr("ids") ;
//$(".form-ligne-commande" ).modal('toggle');
msg ="Supprimer la ligne de commande ";
deleteConfirmationSetEtat(msg, id);
})
function deleteConfirmationSetEtat(msg, id) {
$('<div id="msg" title="Confirm."><p> ' + msg + '</p></div>').dialog({
hide: {
// effect: "explode"isEmetteur,
duration: 500
},
modal: true,
autoOpen: false,
buttons: {
" Annuler ": function () {
$(this).dialog('close');
},
" Confirmer ": function () {
deleteLigneCommande(id);
$(this).dialog('close');
}
}
}).dialog('open');
}
function deleteLigneCommande(id){
// alert($(this).attr("ids"));
$.ajax({
dataType: 'json',
type: 'POST',
url: "{{ path('admin_set_delete_commande') }}",
data: 'idLigneCmde=' + id,
beforeSend: function () {
// onLoadGobi();
},
success: function (data) {
var resultat = data.reponse;
// alert(resultat);
var listeLigneCommande = data.lignecommande;
//alert(data.lignecommande);
// console.log(resultat);return;
$('.listeOperation').html("");
$(".montantRecu").val("");
$(".montant-total").html("");
$('.montant-recu').html("");
//$('.form-ligne-commande').modal();
if (listeLigneCommande.length == 0) {
var html = " <td colspan=\"6\" style=\"text-align: center;\" >Pas de livraison réalisée </td>";
$('.listeOperation').append(html);
$('.load-image').hide();
} else {
$('.zone-date').html("");
$('.zone-date').append("Date : "+data.infoGenerale.dateCommande);
$('.zone-code-commande').html("");
$('.zone-code-commande').append("Numéro : "+data.infoGenerale.codeCommande);
$('.zone-fournisseur').html("");
$('.zone-fournisseur').append("Serveur : "+data.infoGenerale.fournisseur);
var infoGeneral = data.infoGenerale;
var montantTotal =0;
$('.listeOperationEvoluee').html("");
for (var j = 0; j < data.lignecommande.length; j++) {
// .replace(/(\d)(?=(\d{3})+$)/g, "$1 ") for (var i = 0; i < resultat[listeLigneCommande[j]].length; i++) { +{# " <td> " + data.lignecommande[j].dateLivraison +"</td> " + #}
// var laDate = resultat[listeLigneCommande[j]][i].dateLivraison;//Traiter l'objet Date
//<button class=\"btn btn-info bt-pourcentage\" ids=\"" + data.lignecommande[j].id + "\" type=\"button\">%</button>
var priTotal = parseInt(data.lignecommande[j].prix) * parseInt(data.lignecommande[j].quantite);
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 + "\">"+
// " <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> " +
"<div> " +
" <div class=\"col-lg-12\">"+ data.lignecommande[j].produit +"</div> " +
"<div class=\"col-lg-6\">"+data.lignecommande[j].quantite+"x"+data.lignecommande[j].prix+"</div>"+
"<div class=\"col-lg-6\" style=\"text-align: right; font-weight: bold;\">"+priTotal+"</div>"+
" <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>" +
" <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>" +
"</div> "
+ "</div> ";
$('.listeOperationEvoluee').append(html);
// }
montantTotal = parseInt(montantTotal) + parseInt(priTotal)
}
$(".montantTotal").val("");
$(".montant-total").html(montantTotal);
$('.load-image').hide();
}
},
complete: function () {
//location.reload();
//closeOnLoadGobi(onLoadGobi());
}
});
}
</script>
{% endblock %}