2016-02-14 20:58:49 +00:00
|
|
|
// On referencie toutes les sections
|
|
|
|
var section = {
|
|
|
|
view: {
|
|
|
|
text: '#CONTAINER > section[data-sublink="view"] ',
|
2016-02-16 21:10:36 +00:00
|
|
|
element: document.querySelector('#CONTAINER > section[data-sublink="view"]'),
|
|
|
|
searchbar: document.querySelector('#CONTAINER > section[data-sublink="view"] > .searchbar')
|
2016-02-14 20:58:49 +00:00
|
|
|
},
|
|
|
|
|
|
|
|
create: {
|
|
|
|
text: '#CONTAINER > section[data-sublink="create"] ',
|
|
|
|
element: document.querySelector('#CONTAINER > section[data-sublink="create"]')
|
2016-02-15 21:08:49 +00:00
|
|
|
},
|
|
|
|
|
|
|
|
remove: {
|
|
|
|
text: '#CONTAINER > section[data-sublink="remove"] ',
|
|
|
|
element: document.querySelector('#CONTAINER > section[data-sublink="remove"]')
|
|
|
|
},
|
|
|
|
|
|
|
|
edit: {
|
|
|
|
text: '#CONTAINER > section[data-sublink="edit"] ',
|
|
|
|
element: document.querySelector('#CONTAINER > section[data-sublink="edit"]')
|
2016-02-14 20:58:49 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
2016-02-14 21:50:07 +00:00
|
|
|
/* GESTION DE L'AFFICHAGE DES MACHINES
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
if( section.view.element != null ){
|
|
|
|
|
2016-02-16 21:10:36 +00:00
|
|
|
/* (1) On recupere tous les liens */
|
2016-02-14 21:50:07 +00:00
|
|
|
section.view.link = {
|
|
|
|
edit: document.querySelectorAll(section.view.text + '.link_edit[data-machine]'),
|
|
|
|
remove: document.querySelectorAll(section.view.text + '.link_remove[data-machine]')
|
|
|
|
};
|
|
|
|
|
2016-02-16 21:10:36 +00:00
|
|
|
|
|
|
|
/* (2) Gestion de la recherche instantannee */
|
|
|
|
section.view.searchbar.addEventListener('keyup', function(e){
|
|
|
|
|
|
|
|
var search = {
|
|
|
|
path: 'machineDefault/search',
|
|
|
|
data: [section.view.searchbar.value]
|
|
|
|
};
|
|
|
|
|
|
|
|
// On envoie la requete
|
|
|
|
api.send(search, function(result){
|
|
|
|
if( result.ModuleError == 0 ){ // si aucune erreur
|
|
|
|
|
|
|
|
// On enregistre tous les UID dans un tableau
|
|
|
|
var uid_list = [];
|
|
|
|
for( var i = 0 ; i < result.machines.length ; i++ )
|
|
|
|
uid_list.push( result.machines[i].id_machine);
|
|
|
|
|
|
|
|
// On recupere la liste des elements correspondants aux utilisateurs
|
|
|
|
var machine_list = document.querySelectorAll(section.view.text + '> article.inline-box[id]');
|
|
|
|
|
|
|
|
// Pour chaque machine
|
|
|
|
for( var i = 0 ; i < machine_list.length ; i++ ){
|
|
|
|
// Si doit etre visible
|
|
|
|
if( uid_list.indexOf(machine_list[i].id) > -1 )
|
|
|
|
machine_list[i].remClass('hidden');
|
|
|
|
// Si ne doit pas etre visible
|
|
|
|
else
|
|
|
|
machine_list[i].addClass('hidden');
|
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
|
|
|
}, false);
|
|
|
|
|
|
|
|
|
|
|
|
/* (3) On gere la "redirection" vers la modification */
|
2016-02-14 21:50:07 +00:00
|
|
|
for( var i = 0 ; i < section.view.link.edit.length ; i++ ){
|
|
|
|
|
|
|
|
section.view.link.edit[i].addEventListener('click', function(e){
|
|
|
|
pageManager.vars[1] = e.target.getData('machine');
|
2016-02-16 13:36:23 +00:00
|
|
|
autofill_edit(pageManager.vars[1]);
|
2016-02-14 21:50:07 +00:00
|
|
|
navSubMenu('edit');
|
|
|
|
}, false);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2016-02-16 21:10:36 +00:00
|
|
|
/* (4) On gere la "redirection" vers la suppression */
|
2016-02-14 21:50:07 +00:00
|
|
|
for( var i = 0 ; i < section.view.link.remove.length ; i++ ){
|
|
|
|
|
|
|
|
section.view.link.remove[i].addEventListener('click', function(e){
|
|
|
|
pageManager.vars[1] = e.target.getData('machine');
|
2016-02-16 13:36:23 +00:00
|
|
|
autofill_remove(pageManager.vars[1]);
|
2016-02-14 21:50:07 +00:00
|
|
|
navSubMenu('remove');
|
|
|
|
}, false);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2016-02-14 20:58:49 +00:00
|
|
|
|
|
|
|
/* GESTION DE LA CREATION D'UNE MACHINE
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
if( section.create.element != null ){
|
|
|
|
|
|
|
|
// On recupere tous les champs
|
|
|
|
section.create.input = {
|
|
|
|
code: document.querySelector(section.create.text + '#create_code'),
|
|
|
|
name: document.querySelector(section.create.text + '#create_name'),
|
|
|
|
|
|
|
|
submit: document.querySelector(section.create.text + '#create_submit')
|
|
|
|
}
|
|
|
|
|
|
|
|
// On initialise le gestionnaire des saisies
|
|
|
|
var createChecker = new inputChecker();
|
|
|
|
|
|
|
|
|
|
|
|
/* (1) Gestion du code RFID */
|
|
|
|
createChecker.append( section.create.input.code, format_code, '01-AB-CD-23');
|
|
|
|
section.create.input.code.addEventListener('keyup', function(e){
|
|
|
|
e.target.value = e.target.value.toUpperCase();
|
|
|
|
if( !createChecker.check(e.target) )
|
|
|
|
createChecker.correct(e.target, false);
|
|
|
|
|
|
|
|
}, false);
|
|
|
|
|
|
|
|
|
|
|
|
/* (n) Gestion de l'envoi du formulaire */
|
|
|
|
section.create.input.submit.addEventListener('click', function(e){
|
|
|
|
// On annule l'envoi de base (PHP)
|
|
|
|
e.preventDefault();
|
|
|
|
|
|
|
|
var request = {
|
|
|
|
path: 'machineDefault/create', // On veut creer un utilisateur
|
|
|
|
data: [
|
|
|
|
section.create.input.code.value,
|
|
|
|
section.create.input.name.value
|
|
|
|
]
|
|
|
|
};
|
|
|
|
|
|
|
|
api.send(request, function(answer){
|
2016-02-18 09:57:53 +00:00
|
|
|
if( answer.ModuleError == 0 ){ // Tout s'est bien deroule
|
2016-02-14 20:58:49 +00:00
|
|
|
console.log('Machine cree!');
|
2016-02-18 09:57:53 +00:00
|
|
|
|
|
|
|
section.create.input.submit.anim('active', 1500);
|
|
|
|
}else // Erreur
|
2016-02-14 20:58:49 +00:00
|
|
|
console.error('ModuleError::'+answer.ModuleError);
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}, false);
|
|
|
|
|
2016-02-15 21:08:49 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* [3] remove -> Suppression de machine
|
|
|
|
=========================================================*/
|
|
|
|
if( section.remove.element != null ){
|
|
|
|
|
2016-02-17 10:24:26 +00:00
|
|
|
/* (1) Definition des champs */
|
2016-02-15 21:08:49 +00:00
|
|
|
section.remove.input = {
|
2016-02-17 10:24:26 +00:00
|
|
|
search: {
|
2016-02-17 11:09:23 +00:00
|
|
|
view: document.querySelector(section.remove.text + '.remove_search_view'),
|
|
|
|
num: document.querySelector(section.remove.text + '.remove_search_num'),
|
|
|
|
sum: document.querySelector(section.remove.text + '.remove_search_sum'),
|
|
|
|
|
2016-02-17 10:24:26 +00:00
|
|
|
keyword: document.querySelector(section.remove.text + '#remove_search_keyword'),
|
|
|
|
id: document.querySelector(section.remove.text + '#remove_search_id'),
|
|
|
|
submit: document.querySelector(section.remove.text + '#remove_search_submit')
|
|
|
|
},
|
|
|
|
|
2016-02-15 21:08:49 +00:00
|
|
|
code: document.querySelector(section.remove.text + '#remove_code'),
|
|
|
|
name: document.querySelector(section.remove.text + '#remove_name'),
|
|
|
|
|
|
|
|
submit: document.querySelector(section.remove.text + '#remove_submit')
|
|
|
|
};
|
|
|
|
|
2016-02-17 11:09:23 +00:00
|
|
|
var lastsearch_remove = null;
|
|
|
|
var searchindex_remove = 0;
|
|
|
|
|
2016-02-15 21:08:49 +00:00
|
|
|
|
2016-02-17 10:24:26 +00:00
|
|
|
/* (2) Gestion de l'auto-remplissage par lien */
|
2016-02-16 13:36:23 +00:00
|
|
|
function autofill_remove(id_machine){
|
2016-02-15 21:08:49 +00:00
|
|
|
// On recupere le code + name de la machine selectionnee
|
2016-02-17 10:24:26 +00:00
|
|
|
var machine_data = machine_data = {
|
|
|
|
id_machine: '',
|
|
|
|
code: '',
|
|
|
|
name: '',
|
|
|
|
disable_input: true
|
|
|
|
};
|
2016-02-15 21:08:49 +00:00
|
|
|
|
2016-02-16 13:36:23 +00:00
|
|
|
api.send({path:'machineDefault/getById', data: [id_machine]}, function(answer){
|
2016-02-15 21:08:49 +00:00
|
|
|
if( answer.ModuleError == 0 ){ // Aucune erreur
|
|
|
|
machine_data = answer.machine;
|
2016-02-17 10:24:26 +00:00
|
|
|
machine_data.diable_input = false;
|
2016-02-15 21:08:49 +00:00
|
|
|
}
|
2016-02-18 10:13:45 +00:00
|
|
|
|
|
|
|
|
|
|
|
// On enregistre l'UID de la machine
|
|
|
|
section.remove.input.search.id.value = machine_data.id_machine;
|
2016-02-17 10:24:26 +00:00
|
|
|
|
|
|
|
// Auto-remplissage du formulaire
|
|
|
|
section.remove.input.code.value = machine_data.code;
|
|
|
|
section.remove.input.name.value = machine_data.name;
|
|
|
|
|
|
|
|
// On gere le caractere "inactif" du submit
|
|
|
|
section.remove.input.submit.disabled = machine_data.disable_input;
|
2016-02-17 11:09:23 +00:00
|
|
|
|
|
|
|
// Muse a jour des indices des resultats
|
|
|
|
section.remove.input.search.num.innerHTML = searchindex_remove+1;
|
2016-02-15 21:08:49 +00:00
|
|
|
});
|
2016-02-16 13:36:23 +00:00
|
|
|
}if( pageManager.vars.length >= 2 && !isNaN(pageManager.vars[1]) ) autofill_remove(pageManager.vars[1]);
|
2016-02-15 22:07:20 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
2016-02-17 10:24:26 +00:00
|
|
|
/* (3) Gestion de la recherche */
|
|
|
|
section.remove.input.search.submit.addEventListener('click', function(e){
|
2016-02-15 22:07:20 +00:00
|
|
|
// On annule l'envoi de base (PHP)
|
|
|
|
e.preventDefault();
|
|
|
|
|
2016-02-17 10:24:26 +00:00
|
|
|
// Si le champ n'est pas vide, on lance la recherche
|
|
|
|
if( section.remove.input.search.keyword.value != '' ){
|
|
|
|
// Redaction de la requete
|
|
|
|
var getuid = {
|
|
|
|
path: 'machineDefault/search',
|
|
|
|
data: [section.remove.input.search.keyword.value]
|
|
|
|
};
|
2016-02-15 22:07:20 +00:00
|
|
|
|
2016-02-17 10:24:26 +00:00
|
|
|
// On envoie la requete
|
|
|
|
api.send(getuid, function(uidanswer){
|
|
|
|
if( uidanswer.ModuleError == 0 && uidanswer.machines.length > 0){ // si on a trouve qqch
|
|
|
|
// Si on trouve la meme machine que lors de la derniere recherche
|
|
|
|
if( lastsearch_remove == uidanswer.machines[searchindex_remove].id_machine )
|
|
|
|
searchindex_remove = (searchindex_remove+1) % uidanswer.machines.length; // on affiche le prochain (decalage cyclique)
|
2016-02-15 22:07:20 +00:00
|
|
|
|
2016-02-17 10:24:26 +00:00
|
|
|
lastsearch_remove = uidanswer.machines[searchindex_remove].id_machine;
|
|
|
|
section.remove.input.search.id.value = lastsearch_remove;
|
2016-02-17 11:09:23 +00:00
|
|
|
|
|
|
|
// Mise a jour des indices des resultats
|
|
|
|
section.remove.input.search.sum.innerHTML = uidanswer.machines.length;
|
|
|
|
|
2016-02-17 10:24:26 +00:00
|
|
|
// on auto-remplit le formulaire
|
|
|
|
autofill_remove(lastsearch_remove);
|
2016-02-15 22:07:20 +00:00
|
|
|
|
2016-02-17 11:09:23 +00:00
|
|
|
}else{
|
|
|
|
section.remove.input.search.sum.innerHTML = 0;
|
2016-02-17 10:24:26 +00:00
|
|
|
autofill_remove(null);
|
2016-02-17 11:09:23 +00:00
|
|
|
}
|
2016-02-17 10:24:26 +00:00
|
|
|
});
|
|
|
|
}
|
2016-02-15 22:07:20 +00:00
|
|
|
|
2016-02-17 10:24:26 +00:00
|
|
|
}, false);
|
|
|
|
|
2016-02-15 22:07:20 +00:00
|
|
|
|
|
|
|
|
2016-02-17 10:24:26 +00:00
|
|
|
/* (n) Gestion de l'envoi du formulaire */
|
|
|
|
section.remove.input.submit.addEventListener('click', function(e){
|
|
|
|
// On annule l'envoi de base (PHP)
|
|
|
|
e.preventDefault();
|
|
|
|
|
|
|
|
// Si l'id est defini
|
|
|
|
if( section.remove.input.search.id.value != '' ){
|
2016-02-15 22:07:20 +00:00
|
|
|
|
2016-02-17 10:24:26 +00:00
|
|
|
/* (2) On supprime la machine */
|
|
|
|
var request = {
|
|
|
|
path: 'machineDefault/delete', // On veut supprimer cet utilisateur
|
|
|
|
data: [section.remove.input.search.id.value]
|
|
|
|
};
|
2016-02-15 22:07:20 +00:00
|
|
|
|
2016-02-17 10:24:26 +00:00
|
|
|
api.send(request, function(answer){
|
|
|
|
if( answer.ModuleError == 0 && answer.status == true ){ // Tout s'est bien deroule
|
|
|
|
console.log('Machine supprimee!');
|
2016-02-15 22:07:20 +00:00
|
|
|
|
2016-02-18 09:57:53 +00:00
|
|
|
section.remove.input.submit.anim('active', 1500);
|
2016-02-17 10:24:26 +00:00
|
|
|
// On vide le formulaire
|
|
|
|
autofill_remove(null);
|
|
|
|
}else // Erreur
|
|
|
|
console.error('ModuleError::'+answer.ModuleError);
|
|
|
|
});
|
|
|
|
|
|
|
|
}
|
2016-02-15 22:07:20 +00:00
|
|
|
|
|
|
|
}, false);
|
|
|
|
|
2016-02-15 21:08:49 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* [4] edit -> Modification de machine
|
|
|
|
=========================================================*/
|
|
|
|
if( section.edit.element != null ){
|
|
|
|
|
|
|
|
// Definition des champs
|
|
|
|
section.edit.input = {
|
2016-02-16 13:36:23 +00:00
|
|
|
search: {
|
2016-02-17 11:09:23 +00:00
|
|
|
view: document.querySelector(section.edit.text + '.edit_search_view'),
|
|
|
|
num: document.querySelector(section.edit.text + '.edit_search_num'),
|
|
|
|
sum: document.querySelector(section.edit.text + '.edit_search_sum'),
|
|
|
|
|
2016-02-16 13:36:23 +00:00
|
|
|
keyword: document.querySelector(section.edit.text + '#edit_search_keyword'),
|
|
|
|
id: document.querySelector(section.edit.text + '#edit_search_id'),
|
|
|
|
submit: document.querySelector(section.edit.text + '#edit_search_submit')
|
|
|
|
},
|
2016-02-16 13:42:48 +00:00
|
|
|
|
2016-02-15 21:08:49 +00:00
|
|
|
code: document.querySelector(section.edit.text + '#edit_code'),
|
|
|
|
name: document.querySelector(section.edit.text + '#edit_name'),
|
|
|
|
|
|
|
|
submit: document.querySelector(section.edit.text + '#edit_submit')
|
|
|
|
};
|
|
|
|
|
2016-02-17 11:09:23 +00:00
|
|
|
var lastsearch_edit = null;
|
|
|
|
var searchindex_edit = 0;
|
|
|
|
|
2016-02-15 21:08:49 +00:00
|
|
|
|
|
|
|
// Gestion de l'auto-remplissage par lien
|
2016-02-16 13:36:23 +00:00
|
|
|
function autofill_edit(id_machine){
|
2016-02-15 21:08:49 +00:00
|
|
|
// On recupere le code + name de la machine selectionnee
|
2016-02-17 11:09:23 +00:00
|
|
|
var machine_data = {
|
2016-02-16 21:59:01 +00:00
|
|
|
id_machine: '',
|
|
|
|
code: '',
|
|
|
|
name: '',
|
|
|
|
disable_input: true
|
|
|
|
};
|
2016-02-15 21:08:49 +00:00
|
|
|
|
2016-02-17 11:09:23 +00:00
|
|
|
// Si @id_machine est un entier
|
|
|
|
if( !isNaN(id_machine) ){
|
2016-02-16 13:42:48 +00:00
|
|
|
|
2016-02-17 11:09:23 +00:00
|
|
|
api.send({path:'machineDefault/getById', data: [id_machine]}, function(answer){
|
|
|
|
if( answer.ModuleError == 0 ){ // Aucune erreur
|
|
|
|
machine_data = answer.machine;
|
|
|
|
machine_data.disable_input = false;
|
|
|
|
}
|
2016-02-16 13:42:48 +00:00
|
|
|
|
2016-02-17 11:09:23 +00:00
|
|
|
|
|
|
|
// On enregistre l'UID de la machine
|
2016-02-18 10:13:45 +00:00
|
|
|
section.edit.input.search.id.value = machine_data.id_machine;
|
2016-02-17 11:09:23 +00:00
|
|
|
|
|
|
|
// Auto-remplissage du formulaire
|
|
|
|
section.edit.input.code.value = machine_data.code;
|
|
|
|
section.edit.input.name.value = machine_data.name;
|
|
|
|
|
|
|
|
// On active ou pas le bouton "Modifier"
|
|
|
|
section.edit.input.submit.disabled = machine_data.disable_input;
|
|
|
|
|
|
|
|
// Mise a jour des indices des resultats
|
|
|
|
section.edit.input.search.num.innerHTML = searchindex_edit+1;
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
}else
|
|
|
|
section.edit.input.search.num.innerHTML = 0;
|
2016-02-16 21:59:01 +00:00
|
|
|
|
2016-02-16 13:36:23 +00:00
|
|
|
}if( pageManager.vars.length >= 2 && !isNaN(pageManager.vars[1]) ) autofill_edit(pageManager.vars[1]);
|
|
|
|
|
|
|
|
|
|
|
|
|
2016-02-16 14:04:48 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2016-02-16 13:42:48 +00:00
|
|
|
/* (2) Gestion de la recherche de la machine */
|
2016-02-16 13:36:23 +00:00
|
|
|
section.edit.input.search.submit.addEventListener('click', function(e){
|
|
|
|
// On annule l'envoi de base (PHP)
|
|
|
|
e.preventDefault();
|
|
|
|
|
|
|
|
// Si le champ n'est pas vide, on lance la recherche
|
|
|
|
if( section.edit.input.search.keyword.value != '' ){
|
|
|
|
// Redaction de la requete
|
|
|
|
var getuid = {
|
2016-02-16 13:42:48 +00:00
|
|
|
path: 'machineDefault/search',
|
2016-02-16 13:36:23 +00:00
|
|
|
data: [section.edit.input.search.keyword.value]
|
|
|
|
};
|
|
|
|
|
|
|
|
// On envoie la requete
|
|
|
|
api.send(getuid, function(uidanswer){
|
2016-02-16 13:42:48 +00:00
|
|
|
if( uidanswer.ModuleError == 0 && uidanswer.machines.length > 0 ){ // si on a trouve qqch
|
|
|
|
// Si on trouve la meme machine que lors de la derniere recherche
|
2016-02-17 10:24:26 +00:00
|
|
|
if( lastsearch_edit == uidanswer.machines[searchindex_edit].id_machine )
|
|
|
|
searchindex_edit = (searchindex_edit+1) % uidanswer.machines.length; // on affiche le prochain (decalage cyclique)
|
2016-02-17 11:09:23 +00:00
|
|
|
else // si nouveau resultat, on remet l'indice a 0
|
|
|
|
searchindex_edit = 0;
|
2016-02-16 13:36:23 +00:00
|
|
|
|
2016-02-17 10:24:26 +00:00
|
|
|
lastsearch_edit = uidanswer.machines[searchindex_edit].id_machine;
|
|
|
|
section.edit.input.search.id.value = lastsearch_edit;
|
2016-02-17 11:09:23 +00:00
|
|
|
|
|
|
|
// Mise a jour des indices des resultats
|
|
|
|
section.edit.input.search.sum.innerHTML = uidanswer.machines.length;
|
|
|
|
|
2016-02-16 13:36:23 +00:00
|
|
|
// on auto-remplit le formulaire
|
2016-02-17 10:24:26 +00:00
|
|
|
autofill_edit(lastsearch_edit);
|
2016-02-16 13:36:23 +00:00
|
|
|
|
2016-02-17 11:09:23 +00:00
|
|
|
}else{
|
|
|
|
section.edit.input.search.sum.innerHTML = 0;
|
2016-02-16 13:36:23 +00:00
|
|
|
autofill_edit(null);
|
2016-02-17 11:09:23 +00:00
|
|
|
}
|
2016-02-16 13:36:23 +00:00
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
}, false);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2016-02-16 14:04:48 +00:00
|
|
|
|
|
|
|
|
|
|
|
/* (n) Gestion de l'envoi du formulaire */
|
|
|
|
section.edit.input.submit.addEventListener('click', function(e){
|
|
|
|
// On annule l'envoi de base (PHP)
|
|
|
|
e.preventDefault();
|
|
|
|
|
|
|
|
// Si l'id est defini
|
|
|
|
if( section.edit.input.search.id.value != '' ){
|
|
|
|
|
|
|
|
var request = {
|
|
|
|
path: 'machineDefault/edit', // On veut creer une machine
|
|
|
|
data: [
|
|
|
|
section.edit.input.search.id.value,
|
|
|
|
section.edit.input.code.value,
|
|
|
|
section.edit.input.name.value
|
|
|
|
]
|
|
|
|
};
|
|
|
|
|
|
|
|
api.send(request, function(answer){
|
2016-02-16 21:59:01 +00:00
|
|
|
if( answer.ModuleError == 0 && answer.status == true ){ // Tout s'est bien deroule
|
2016-02-16 14:04:48 +00:00
|
|
|
console.log('Machine modifiee!');
|
2016-02-16 21:59:01 +00:00
|
|
|
|
2016-02-18 09:57:53 +00:00
|
|
|
section.edit.input.submit.anim('active', 1500);
|
2016-02-16 21:59:01 +00:00
|
|
|
// On met a jour la machine
|
2016-02-18 10:13:45 +00:00
|
|
|
autofill_edit(section.edit.input.search.id.value);
|
2016-02-16 21:59:01 +00:00
|
|
|
|
|
|
|
}else // Erreur
|
2016-02-16 14:04:48 +00:00
|
|
|
console.error('ModuleError::'+answer.ModuleError);
|
|
|
|
});
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}, false);
|
|
|
|
|
|
|
|
|
|
|
|
|
2016-02-14 20:58:49 +00:00
|
|
|
}
|