- [x] [view/js/users][view/users][container.scss] Afficher l'indice du resultat pour recherche (pour suppr/modif)

- [x] [view/js/machines][view/machines][container.scss] Afficher l'indice du resultat pour recherche (pour suppr/modif)
This commit is contained in:
xdrm-brackets 2016-02-17 12:09:23 +01:00
parent fce52f918a
commit a5ac2c48d5
7 changed files with 135 additions and 38 deletions

File diff suppressed because one or more lines are too long

View File

@ -261,6 +261,20 @@
border-color: $form-neutral-color; border-color: $form-neutral-color;
} }
// Textes centres
.edit_search_view,
.remove_search_view{
display: inline-block;
width: 100%;
text-align: center;
color: #aaaaaa;
span{
color: #888888;
}
}
/* (1) Champs de texte */ /* (1) Champs de texte */
input[type=text], input[type=text],

View File

@ -7,6 +7,7 @@
############ ############
# EN COURS # # EN COURS #
############ ############
- [ ] [container.scss] Icone dans bouton quand succes sur l'operation - [ ] [container.scss] Icone dans bouton quand succes sur l'operation
- [ ] [view/users][view/js/users.js] Suppression avec recherche comme pour la modification - [ ] [view/users][view/js/users.js] Suppression avec recherche comme pour la modification
@ -16,6 +17,8 @@
######## ########
# FAIT # # FAIT #
######## ########
- [x] [view/js/users][view/users][container.scss] Afficher l'indice du resultat pour recherche (pour suppr/modif)
- [x] [view/js/machines][view/machines][container.scss] Afficher l'indice du resultat pour recherche (pour suppr/modif)
- [x] [view/js/users] Implementer la recherche pour la suppression - [x] [view/js/users] Implementer la recherche pour la suppression
- [x] [view/js/machines] Implementer la recherche pour la suppression - [x] [view/js/machines] Implementer la recherche pour la suppression
- [x] Nettoyage git - [x] Nettoyage git

View File

@ -177,6 +177,10 @@ if( section.remove.element != null ){
/* (1) Definition des champs */ /* (1) Definition des champs */
section.remove.input = { section.remove.input = {
search: { search: {
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'),
keyword: document.querySelector(section.remove.text + '#remove_search_keyword'), keyword: document.querySelector(section.remove.text + '#remove_search_keyword'),
id: document.querySelector(section.remove.text + '#remove_search_id'), id: document.querySelector(section.remove.text + '#remove_search_id'),
submit: document.querySelector(section.remove.text + '#remove_search_submit') submit: document.querySelector(section.remove.text + '#remove_search_submit')
@ -188,6 +192,9 @@ if( section.remove.element != null ){
submit: document.querySelector(section.remove.text + '#remove_submit') submit: document.querySelector(section.remove.text + '#remove_submit')
}; };
var lastsearch_remove = null;
var searchindex_remove = 0;
/* (2) Gestion de l'auto-remplissage par lien */ /* (2) Gestion de l'auto-remplissage par lien */
function autofill_remove(id_machine){ function autofill_remove(id_machine){
@ -211,14 +218,15 @@ if( section.remove.element != null ){
// On gere le caractere "inactif" du submit // On gere le caractere "inactif" du submit
section.remove.input.submit.disabled = machine_data.disable_input; section.remove.input.submit.disabled = machine_data.disable_input;
// Muse a jour des indices des resultats
section.remove.input.search.num.innerHTML = searchindex_remove+1;
}); });
}if( pageManager.vars.length >= 2 && !isNaN(pageManager.vars[1]) ) autofill_remove(pageManager.vars[1]); }if( pageManager.vars.length >= 2 && !isNaN(pageManager.vars[1]) ) autofill_remove(pageManager.vars[1]);
/* (3) Gestion de la recherche */ /* (3) Gestion de la recherche */
var lastsearch_remove = null;
var searchindex_remove = 0;
section.remove.input.search.submit.addEventListener('click', function(e){ section.remove.input.search.submit.addEventListener('click', function(e){
// On annule l'envoi de base (PHP) // On annule l'envoi de base (PHP)
e.preventDefault(); e.preventDefault();
@ -240,11 +248,17 @@ if( section.remove.element != null ){
lastsearch_remove = uidanswer.machines[searchindex_remove].id_machine; lastsearch_remove = uidanswer.machines[searchindex_remove].id_machine;
section.remove.input.search.id.value = lastsearch_remove; section.remove.input.search.id.value = lastsearch_remove;
// Mise a jour des indices des resultats
section.remove.input.search.sum.innerHTML = uidanswer.machines.length;
// on auto-remplit le formulaire // on auto-remplit le formulaire
autofill_remove(lastsearch_remove); autofill_remove(lastsearch_remove);
}else }else{
section.remove.input.search.sum.innerHTML = 0;
autofill_remove(null); autofill_remove(null);
}
}); });
} }
@ -298,6 +312,10 @@ if( section.edit.element != null ){
// Definition des champs // Definition des champs
section.edit.input = { section.edit.input = {
search: { search: {
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'),
keyword: document.querySelector(section.edit.text + '#edit_search_keyword'), keyword: document.querySelector(section.edit.text + '#edit_search_keyword'),
id: document.querySelector(section.edit.text + '#edit_search_id'), id: document.querySelector(section.edit.text + '#edit_search_id'),
submit: document.querySelector(section.edit.text + '#edit_search_submit') submit: document.querySelector(section.edit.text + '#edit_search_submit')
@ -309,17 +327,23 @@ if( section.edit.element != null ){
submit: document.querySelector(section.edit.text + '#edit_submit') submit: document.querySelector(section.edit.text + '#edit_submit')
}; };
var lastsearch_edit = null;
var searchindex_edit = 0;
// Gestion de l'auto-remplissage par lien // Gestion de l'auto-remplissage par lien
function autofill_edit(id_machine){ function autofill_edit(id_machine){
// On recupere le code + name de la machine selectionnee // On recupere le code + name de la machine selectionnee
var machine_data = machine_data = { var machine_data = {
id_machine: '', id_machine: '',
code: '', code: '',
name: '', name: '',
disable_input: true disable_input: true
}; };
// Si @id_machine est un entier
if( !isNaN(id_machine) ){
api.send({path:'machineDefault/getById', data: [id_machine]}, function(answer){ api.send({path:'machineDefault/getById', data: [id_machine]}, function(answer){
if( answer.ModuleError == 0 ){ // Aucune erreur if( answer.ModuleError == 0 ){ // Aucune erreur
machine_data = answer.machine; machine_data = answer.machine;
@ -336,7 +360,15 @@ if( section.edit.element != null ){
// On active ou pas le bouton "Modifier" // On active ou pas le bouton "Modifier"
section.edit.input.submit.disabled = machine_data.disable_input; 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;
}if( pageManager.vars.length >= 2 && !isNaN(pageManager.vars[1]) ) autofill_edit(pageManager.vars[1]); }if( pageManager.vars.length >= 2 && !isNaN(pageManager.vars[1]) ) autofill_edit(pageManager.vars[1]);
@ -346,8 +378,6 @@ if( section.edit.element != null ){
/* (2) Gestion de la recherche de la machine */ /* (2) Gestion de la recherche de la machine */
var lastsearch_edit = null;
var searchindex_edit = 0;
section.edit.input.search.submit.addEventListener('click', function(e){ section.edit.input.search.submit.addEventListener('click', function(e){
// On annule l'envoi de base (PHP) // On annule l'envoi de base (PHP)
e.preventDefault(); e.preventDefault();
@ -366,14 +396,22 @@ if( section.edit.element != null ){
// Si on trouve la meme machine que lors de la derniere recherche // Si on trouve la meme machine que lors de la derniere recherche
if( lastsearch_edit == uidanswer.machines[searchindex_edit].id_machine ) if( lastsearch_edit == uidanswer.machines[searchindex_edit].id_machine )
searchindex_edit = (searchindex_edit+1) % uidanswer.machines.length; // on affiche le prochain (decalage cyclique) searchindex_edit = (searchindex_edit+1) % uidanswer.machines.length; // on affiche le prochain (decalage cyclique)
else // si nouveau resultat, on remet l'indice a 0
searchindex_edit = 0;
lastsearch_edit = uidanswer.machines[searchindex_edit].id_machine; lastsearch_edit = uidanswer.machines[searchindex_edit].id_machine;
section.edit.input.search.id.value = lastsearch_edit; section.edit.input.search.id.value = lastsearch_edit;
// Mise a jour des indices des resultats
section.edit.input.search.sum.innerHTML = uidanswer.machines.length;
// on auto-remplit le formulaire // on auto-remplit le formulaire
autofill_edit(lastsearch_edit); autofill_edit(lastsearch_edit);
}else }else{
section.edit.input.search.sum.innerHTML = 0;
autofill_edit(null); autofill_edit(null);
}
}); });
} }

View File

@ -188,6 +188,10 @@ if( section.remove.element != null ){
/* (1) Definition des champs */ /* (1) Definition des champs */
section.remove.input = { section.remove.input = {
search: { search: {
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'),
keyword: document.querySelector(section.remove.text + '#remove_search_keyword'), keyword: document.querySelector(section.remove.text + '#remove_search_keyword'),
id: document.querySelector(section.remove.text + '#remove_search_id'), id: document.querySelector(section.remove.text + '#remove_search_id'),
submit: document.querySelector(section.remove.text + '#remove_search_submit') submit: document.querySelector(section.remove.text + '#remove_search_submit')
@ -199,6 +203,9 @@ if( section.remove.element != null ){
submit: document.querySelector(section.remove.text + '#remove_submit') submit: document.querySelector(section.remove.text + '#remove_submit')
}; };
var lastsearch_remove = null;
var searchindex_remove = 0;
/* (2) Gestion de l'auto-remplissage par url */ /* (2) Gestion de l'auto-remplissage par url */
function autofill_remove(id_user){ function autofill_remove(id_user){
@ -227,14 +234,15 @@ if( section.remove.element != null ){
// On affiche le bouton de suppression // On affiche le bouton de suppression
section.remove.input.submit.disabled = user_data.disable_input; section.remove.input.submit.disabled = user_data.disable_input;
// Muse a jour des indices des resultats
section.remove.input.search.num.innerHTML = searchindex_remove+1;
}); });
}if( pageManager.vars.length >= 2 && !isNaN(pageManager.vars[1]) ) autofill_remove(pageManager.vars[1]); }if( pageManager.vars.length >= 2 && !isNaN(pageManager.vars[1]) ) autofill_remove(pageManager.vars[1]);
/* (3) Gestion de la recherche */ /* (3) Gestion de la recherche */
var lastsearch_remove = null;
var searchindex_remove = 0;
section.remove.input.search.submit.addEventListener('click', function(e){ section.remove.input.search.submit.addEventListener('click', function(e){
// On annule l'envoi de base (PHP) // On annule l'envoi de base (PHP)
e.preventDefault(); e.preventDefault();
@ -253,14 +261,22 @@ if( section.remove.element != null ){
// Si on trouve la meme machine que lors de la derniere recherche // Si on trouve la meme machine que lors de la derniere recherche
if( lastsearch_remove == uidanswer.users[searchindex_remove].id_user ) if( lastsearch_remove == uidanswer.users[searchindex_remove].id_user )
searchindex_remove = (searchindex_remove+1) % uidanswer.users.length; // on affiche le prochain (decalage cyclique) searchindex_remove = (searchindex_remove+1) % uidanswer.users.length; // on affiche le prochain (decalage cyclique)
else // si nouveau resultat, on remet l'indice a 0
searchindex_remove = 0;
lastsearch_remove = uidanswer.users[searchindex_remove].id_user; lastsearch_remove = uidanswer.users[searchindex_remove].id_user;
section.remove.input.search.id.value = lastsearch_remove; section.remove.input.search.id.value = lastsearch_remove;
// Mise a jour des indices des resultats
section.remove.input.search.sum.innerHTML = uidanswer.users.length;
// on auto-remplit le formulaire // on auto-remplit le formulaire
autofill_remove(lastsearch_remove); autofill_remove(lastsearch_remove);
}else }else{
section.remove.input.search.sum.innerHTML = 0;
autofill_remove(null); autofill_remove(null);
}
}); });
} }
@ -317,6 +333,10 @@ if( section.edit.element != null ){
// Definition des champs // Definition des champs
section.edit.input = { section.edit.input = {
search: { search: {
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'),
keyword: document.querySelector(section.edit.text + '#edit_search_keyword'), keyword: document.querySelector(section.edit.text + '#edit_search_keyword'),
id: document.querySelector(section.edit.text + '#edit_search_id'), id: document.querySelector(section.edit.text + '#edit_search_id'),
submit: document.querySelector(section.edit.text + '#edit_search_submit') submit: document.querySelector(section.edit.text + '#edit_search_submit')
@ -333,6 +353,8 @@ if( section.edit.element != null ){
submit: document.querySelector(section.edit.text + '#edit_submit') submit: document.querySelector(section.edit.text + '#edit_submit')
}; };
var lastsearch_edit = null;
var searchindex_edit = 0;
/* (1) Gestion de l'auto-remplissage par url */ /* (1) Gestion de l'auto-remplissage par url */
function autofill_edit(id_user){ function autofill_edit(id_user){
@ -375,17 +397,18 @@ if( section.edit.element != null ){
// On active ou pas le bouton "Modifier" // On active ou pas le bouton "Modifier"
section.edit.input.submit.disabled = user_data.disable_input; section.edit.input.submit.disabled = user_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;
}if( pageManager.vars.length >= 2 && !isNaN(pageManager.vars[1]) ) autofill_edit(pageManager.vars[1]); }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 l'utilisateur */
var lastsearch_edit = null;
var searchindex_edit = 0;
section.edit.input.search.submit.addEventListener('click', function(e){ section.edit.input.search.submit.addEventListener('click', function(e){
// On annule l'envoi de base (PHP) // On annule l'envoi de base (PHP)
e.preventDefault(); e.preventDefault();
@ -404,14 +427,22 @@ if( section.edit.element != null ){
// Si on trouve le meme utilisateur que lors de la derniere recherche // Si on trouve le meme utilisateur que lors de la derniere recherche
if( lastsearch_edit == uidanswer.users[searchindex_edit].id_user ) if( lastsearch_edit == uidanswer.users[searchindex_edit].id_user )
searchindex_edit = (searchindex_edit+1) % uidanswer.users.length; // on affiche le prochain (decalage cyclique) searchindex_edit = (searchindex_edit+1) % uidanswer.users.length; // on affiche le prochain (decalage cyclique)
else // si nouveau resultat, on remet l'indice a 0
searchindex_edit = 0;
lastsearch_edit = uidanswer.users[searchindex_edit].id_user; lastsearch_edit = uidanswer.users[searchindex_edit].id_user;
section.edit.input.search.id.value = lastsearch_edit; section.edit.input.search.id.value = lastsearch_edit;
// Mise a jour des indices des resultats
section.edit.input.search.sum.innerHTML = uidanswer.users.length;
// on auto-remplit le formulaire // on auto-remplit le formulaire
autofill_edit(lastsearch_edit); autofill_edit(lastsearch_edit);
}else }else{
section.edit.input.search.sum.innerHTML = 0;
autofill_edit(null); autofill_edit(null);
}
}); });
} }

View File

@ -159,7 +159,9 @@
echo "<form class='invalid'>"; echo "<form class='invalid'>";
echo "<input id='remove_search_keyword' type='text' class='search' placeholder='Recherche...'><br>"; echo "<input id='remove_search_keyword' type='text' class='search' placeholder='Recherche...'><br>";
echo "<input id='remove_search_id' type='hidden' value=''><br>"; echo "<input id='remove_search_id' type='hidden' value=''>";
// Indice du resultat
echo "<span class='remove_search_view'>machine <span class='remove_search_num'>0</span> sur <span class='remove_search_sum'>0</span></span><br><br>";
echo "<button id='remove_search_submit' class='search'>Trouver</button><br>"; echo "<button id='remove_search_submit' class='search'>Trouver</button><br>";
echo "<br><br><hr class='OR' data-label='PUIS' /><br><br>"; echo "<br><br><hr class='OR' data-label='PUIS' /><br><br>";
@ -188,7 +190,9 @@
echo "<form class='neutral'>"; echo "<form class='neutral'>";
echo "<input id='edit_search_keyword' type='text' class='search' placeholder='Recherche...'><br>"; echo "<input id='edit_search_keyword' type='text' class='search' placeholder='Recherche...'><br>";
echo "<input id='edit_search_id' type='hidden' value=''><br>"; echo "<input id='edit_search_id' type='hidden' value=''>";
// Indice du resultat
echo "<span class='edit_search_view'>machine <span class='edit_search_num'>0</span> sur <span class='edit_search_sum'>0</span></span><br><br>";
echo "<button id='edit_search_submit' class='search'>Trouver</button><br>"; echo "<button id='edit_search_submit' class='search'>Trouver</button><br>";
echo "<br><br><hr class='OR' data-label='PUIS' /><br><br>"; echo "<br><br><hr class='OR' data-label='PUIS' /><br><br>";

View File

@ -173,12 +173,17 @@
echo "<section data-sublink='remove'>"; echo "<section data-sublink='remove'>";
echo "<form class='invalid'>"; echo "<form class='invalid'>";
// Recherche d'utilisateur
echo "<input id='remove_search_keyword' type='text' class='search' placeholder='Recherche...'><br>"; echo "<input id='remove_search_keyword' type='text' class='search' placeholder='Recherche...'><br>";
echo "<input id='remove_search_id' type='hidden' value=''><br>"; echo "<input id='remove_search_id' type='hidden' value=''>";
// Indice du resultat
echo "<span class='remove_search_view'>utilisateur <span class='remove_search_num'>0</span> sur <span class='remove_search_sum'>0</span></span><br><br>";
echo "<button id='remove_search_submit' class='search'>Trouver</button><br>"; echo "<button id='remove_search_submit' class='search'>Trouver</button><br>";
echo "<br><br><hr class='OR' data-label='PUIS' /><br><br>"; echo "<br><br><hr class='OR' data-label='PUIS' /><br><br>";
// Suppression d'utilisateur
echo "<input id='remove_code' type='text' placeholder='Code'><br>"; echo "<input id='remove_code' type='text' placeholder='Code'><br>";
echo "<input id='remove_username' type='text' placeholder='Username'><br>"; echo "<input id='remove_username' type='text' placeholder='Username'><br>";
echo "<button id='remove_submit' disabled>Supprimer</button>"; echo "<button id='remove_submit' disabled>Supprimer</button>";
@ -203,7 +208,9 @@
echo "<form class='neutral'>"; echo "<form class='neutral'>";
echo "<input id='edit_search_keyword' type='text' class='search' placeholder='Recherche...'><br>"; echo "<input id='edit_search_keyword' type='text' class='search' placeholder='Recherche...'><br>";
echo "<input id='edit_search_id' type='hidden' value=''><br>"; echo "<input id='edit_search_id' type='hidden' value=''>";
// Indice du resultat
echo "<span class='edit_search_view'>utilisateur <span class='edit_search_num'>0</span> sur <span class='edit_search_sum'>0</span></span><br><br>";
echo "<button id='edit_search_submit' class='search'>Trouver</button><br>"; echo "<button id='edit_search_submit' class='search'>Trouver</button><br>";
echo "<br><br><hr class='OR' data-label='PUIS' /><br><br>"; echo "<br><br><hr class='OR' data-label='PUIS' /><br><br>";