function CommandeEnCours_ajouterCommandeFromJSON(commande) {
// Suppression au cas où il y aurait un doublon
$('#affichageCommandesEnCours_ul>li[id=commande_'+commande['id']+']').remove();
// Ajout de la ligne
$('#affichageCommandesEnCours_ul').prepend("
#"
+commande['hexModule']+" : "+commande['intitule']
+" "
+" "
);
CommandeEnCours_majAffichageNombreCommandeEnCours();
}
function CommandeEnCours_majCommandeFromJSON(commande) {
var isFin = (commande['type'] == 'COMMANDE_RESULTAT_ARRIVE');
var tick = (isFin ? Date.now() : 0);
$('#affichageCommandesEnCours_ul>li[id=commande_'+commande['id']+']').replaceWith("#"
+commande['hexModule']+" : "+commande['intitule']
+" "
+" ");
CommandeEnCours_majAffichageNombreCommandeEnCours();
}
function CommandeEnCours_supprimerCommandesAgees() {
var maintenantMoinsDelai = Date.now() - 60*1000; // Soit 60 secondes
$('#affichageCommandesEnCours_ul>li').each(function(idx, e) {
var tick = parseInt(e.dataset.tick);
if (tick!=0 && tick > maintenantMoinsDelai) $(this).remove();
});
CommandeEnCours_majAffichageNombreCommandeEnCours();
}
function CommandeEnCours_majAffichageNombreCommandeEnCours() {
var nombreTotal = $('#affichageCommandesEnCours_ul>li').length;
var nombreActif = $('#affichageCommandesEnCours_ul>li[data-tick=0]').length;
var visible = $('#icone_modules_commandes').is(":visible");
$('#icone_modules_commandes>a>span').html(nombreActif);
if ((visible && nombreTotal==0) || (!visible && nombreTotal!=0)) $('#icone_modules_commandes').toggle();
}