{% extends 'base.html.twig' %} {% block body %}

Récupération Commande Client Dolibarr

Annuler

Informations
{% endblock %} {% block localjavascript %} $("#search").click(function() { console.log("search propositions = "+$("#ref").val()); $.ajax({ type: "POST", data: { ref: $("#ref").val(), }, url: "{{ path('app_offer_getdolibarr') }}", success: function (datas) { console.log(datas); console.log("-----------"); if(datas.error||Object.keys(datas).length === 0) { $("#propal").html(""); $("#card-propal").hide(); $("#card-offer").hide(); } else { html ="

"+$("#ref").val()+"

"; if(datas.note_public) html+="Note public
"+datas.note_public.replace(/(\r\n|\r|\n)/g, '
')+"


"; if(datas.note_private) html+="Note privée
"+datas.note_private.replace(/(\r\n|\r|\n)/g, '
')+"


"; tbtask={}; datas.lines.forEach(function(line){ console.log(line); if(!tbtask[line.product_ref]) tbtask[line.product_ref]={idoffer:"", idline: "", ref: "", label: "", qty: 0, price:0 }; tbtask[line.product_ref]["idoffer"]=$("#ref").val(); tbtask[line.product_ref]["idline"]=line.id; tbtask[line.product_ref]["ref"]=line.product_ref; tbtask[line.product_ref]["label"]=line.product_label; tbtask[line.product_ref]["qty"]=parseInt(line.qty)+tbtask[line.product_ref]["qty"]; tbtask[line.product_ref]["price"]=parseInt(line.price); }); html+=""; html+=""; html+=""; html+=""; html+=""; html+=""; html+=""; html+=""; Object.values(tbtask).forEach(task => { html+=""; html+=""; html+=""; html+=""; html+=""; html+=""; html+=""; }); html+="
RefDesignationQtePUTotal
"+task.ref+""+task.label+""+task.qty+""+task.price+""+(task.qty*task.price)+"
"; $("#propal").html(html); $("#card-propal").show(); $("#card-offer").show(); $("#offerdolibarr_tasks").val(JSON.stringify(tbtask)); } } }); }); {% endblock %}