- [x] [view/js/machines] Modification de machine
This commit is contained in:
parent
8abbf00c15
commit
0496fc33f6
2
todo.md
2
todo.md
|
@ -12,12 +12,12 @@
|
|||
- [ ] [view/js/machines] Recherche instantanee
|
||||
- [ ] [view/js/users] Recherche instantanee
|
||||
|
||||
- [ ] [view/js/machines] Modification de machine
|
||||
|
||||
|
||||
########
|
||||
# FAIT #
|
||||
########
|
||||
- [x] [view/js/machines] Modification de machine
|
||||
- [x] [machineDefault] Implementer la modification
|
||||
- [x] [userDefault] Implementer la modification
|
||||
- [x] [userRepo] Gestion des parametres optionnels
|
||||
|
|
|
@ -249,16 +249,27 @@ if( section.edit.element != null ){
|
|||
if( answer.ModuleError == 0 ){ // Aucune erreur
|
||||
machine_data = answer.machine;
|
||||
|
||||
// Auto-remplissage du formulaire
|
||||
section.edit.input.code.value = machine_data.code;
|
||||
section.edit.input.name.value = machine_data.name;
|
||||
}else{ // Si erreuron utilise un jeu de donnees vides
|
||||
machine_data = {
|
||||
id_machine: '',
|
||||
code: '',
|
||||
name: ''
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
// On enregistre l'UID de la machine
|
||||
section.edit.input.search.id.value = machine_data.id_machine;
|
||||
|
||||
// Auto-remplissage du formulaire
|
||||
section.edit.input.code.value = machine_data.code;
|
||||
section.edit.input.name.value = machine_data.name;
|
||||
});
|
||||
}if( pageManager.vars.length >= 2 && !isNaN(pageManager.vars[1]) ) autofill_edit(pageManager.vars[1]);
|
||||
|
||||
|
||||
|
||||
/* (2) Gestion de la recherche de l'utilisateur */
|
||||
/* (2) Gestion de la recherche de la machine */
|
||||
var lastsearch = null;
|
||||
var searchindex = 0;
|
||||
section.edit.input.search.submit.addEventListener('click', function(e){
|
||||
|
@ -269,25 +280,24 @@ if( section.edit.element != null ){
|
|||
if( section.edit.input.search.keyword.value != '' ){
|
||||
// Redaction de la requete
|
||||
var getuid = {
|
||||
path: 'userDefault/search',
|
||||
path: 'machineDefault/search',
|
||||
data: [section.edit.input.search.keyword.value]
|
||||
};
|
||||
|
||||
// On envoie la requete
|
||||
api.send(getuid, function(uidanswer){
|
||||
if( uidanswer.ModuleError == 0 && uidanswer.users.length > 0 ){ // si on a trouve qqch
|
||||
// Si on trouve le meme utilisateur que lors de la derniere recherche
|
||||
if( lastsearch == uidanswer.users[searchindex].id_user )
|
||||
searchindex = (searchindex+1) % uidanswer.users.length; // on affiche le prochain (decalage cyclique)
|
||||
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 == uidanswer.machines[searchindex].id_machine )
|
||||
searchindex = (searchindex+1) % uidanswer.machines.length; // on affiche le prochain (decalage cyclique)
|
||||
|
||||
lastsearch = uidanswer.users[searchindex].id_user;
|
||||
lastsearch = uidanswer.machines[searchindex].id_machine;
|
||||
section.edit.input.search.id.value = lastsearch;
|
||||
// on auto-remplit le formulaire
|
||||
autofill_edit(lastsearch);
|
||||
|
||||
}else{
|
||||
}else
|
||||
autofill_edit(null);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue