Bonjour à tous,
je développe un erp pour mon usage professionnel et j'ai une page où j'affiche une liste de devis.
Pour chacun d'eux il y a 3 possibilité et l'une d'elle est de convertir le devis en commande.
Le problème que je rencontre est que la liste disparait lors de l'événement onclick et je ne peux pas la modifier.
J'aimerai bien savoir pourquoi cet effet.
le bouton :
<td><button id="Devis2Commande-129" class="form-control btn btn-primary" onclick="Devis2Commande('129'); return false;">commander</button>
Le js :
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117
| /*************************************************************
17/08/2022
Convert devis to a Commande
ERP mobile version
file: Devis2Commande.js
lib by roger girardin
*************************************************************/
function Devis2Commande(DevisId) {
///////////////////////////////////////////////////////////////////
///// SHOWS ELEMENTS BY ID
///////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////
//// Tmp Div
document.getElementById('ContTmpDiv').style.visibility = 'visible';
///////////////////////////////////////////////////////////////
//// Msg Main
//document.getElementById('ContMsgMain').style.display = 'inline';
///////////////////////////////////////////////////////////////
//// Calendar Rappel
//document.getElementById('ContCalendarRappel').style.display = 'inline';
///////////////////////////////////////////////////////////////
//// Calendar Rv
//document.getElementById('ContCalendarRv').style.display = 'inline';
///////////////////////////////////////////////////////////////
//// Add Prospect
//document.getElementById('ContAddProspect').style.display = 'inline';
///////////////////////////////////////////////////////////////
//// List Add Prospect
//document.getElementById('ContListAddProspect').style.display = 'inline';
///////////////////////////////////////////////////////////////
//// Rappel
//document.getElementById('ContDisplayRappel').style.display = 'inline';
///////////////////////////////////////////////////////////////
//// List DisplayArticle
//document.getElementById('ContListArticle').style.display = 'inline';
///////////////////////////////////////////////////////////////
//// Display DisplayArticle
//document.getElementById('ContDisplayArticle').style.display = 'inline';
///////////////////////////////////////////////////////////////
//// Bon de Co0mmande
//document.getElementById('ContBonDeCommande').style.display = 'inline';
///////////////////////////////////////////////////////////////////
///// HIDE ELEMENTS BY ID
///////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////
//// Tmp Div
//document.getElementById('ContTmpDiv').style.visibility = 'hidden';
///////////////////////////////////////////////////////////////
//// Msg Main
//document.getElementById('ContMsgMain').style.display = 'none';
///////////////////////////////////////////////////////////////
//// Calendar Rappel
//document.getElementById('ContCalendarRappel').style.display = 'none';
///////////////////////////////////////////////////////////////
//// Calendar Rv
//document.getElementById('ContCalendarRv').style.display = 'none';
///////////////////////////////////////////////////////////////
//// Add Prospect
//document.getElementById('ContAddProspect').style.display = 'none';
///////////////////////////////////////////////////////////////
//// List Add Prospect
//document.getElementById('ContListAddProspect').style.display = 'none';
///////////////////////////////////////////////////////////////
//// Rappel
//document.getElementById('ContDisplayRappel').style.display = 'none';
///////////////////////////////////////////////////////////////
//// List DisplayArticle
//document.getElementById('ContListArticle').style.display = 'none';
///////////////////////////////////////////////////////////////
//// Display DisplayArticle
//document.getElementById('ContDisplayArticle').style.display = 'none';
///////////////////////////////////////////////////////////////
//// Bon de Commande
//document.getElementById('ContBonDeCommande').style.display = 'none';
$( document ).ajaxStart(function(){
});
$( document ).ajaxStop(function() {
document.getElementById('ContTmpDiv').style.visibility = 'hidden';
//document.getElementById('TmpDiv').style.visibility = 'hidden';
});
$.ajax({
beforeSend : function(xhr, opts){
//
if(!confirm('Valider le devis ?')){
alert('Validation annul\351e');
//document.getElementById('MsgBonDeCommandeClientdata').innerHTML = ('Commande annul\351e');
//window.location.hash = '#MsgBonDeCommandeClientdata';
return false;
}
},
type : 'GET', // define the type of HTTP verb we want to use (POST for our form)
url : 'ajax/Devis2Commande.php', // the url where we want to POST
data : 'devis_id=' + DevisId,
dataType : 'json',
success : function(json){
if(json.error == false){
//
var cell2update = 'Devis2Commande-' + DevisId;
document.getElementById(cell2update).innerHTML = 'Devis ' + DevisId + ' valid\351 : ' + json.cde_id;
console.log('js.Devis2Commande: ' + json.msg);
}else{
//
var cell2update = 'Devis2Commande-' + DevisId;
document.getElementById(cell2update).innerHTML = 'Devis ' + DevisId + ' non valid\351 : ' + json.cde_id;
console.log('js.Devis2Commande: error' + JSON.stringify(json));
}
//alert(PASSWORD + 'id : ' + Id);
},
error : function(json){
console.log('js.Devis2Commande: error' + JSON.stringify(json));
}
});
} |
Partager