- [x] [container.scss] Gestion des boutons "enabled"/"disabled" lorsqu'on doit faire une recherche

This commit is contained in:
xdrm-brackets 2016-02-16 22:59:01 +01:00
parent e78a36dc22
commit d7eabcb548
7 changed files with 69 additions and 39 deletions

File diff suppressed because one or more lines are too long

View File

@ -352,7 +352,8 @@
transform: translateX(-50%); transform: translateX(-50%);
&:hover, &:hover,
&:focus{ &:focus,
&:disabled{
background-color: #fff; background-color: #fff;
color: $form-invalid-color; color: $form-invalid-color;
} }
@ -367,7 +368,8 @@
background-color: $form-valid-color; background-color: $form-valid-color;
&:hover, &:hover,
&:focus{ &:focus,
&:disabled{
background-color: #fff; background-color: #fff;
color: $form-valid-color; color: $form-valid-color;
} }
@ -381,7 +383,8 @@
background-color: $form-neutral-color; background-color: $form-neutral-color;
&:hover, &:hover,
&:focus{ &:focus,
&:disabled{
background-color: #fff; background-color: #fff;
color: $form-neutral-color; color: $form-neutral-color;
} }
@ -395,7 +398,8 @@
background-color: $form-search-color; background-color: $form-search-color;
&:hover, &:hover,
&:focus{ &:focus,
&:disabled{
background-color: #fff; background-color: #fff;
color: $form-search-color; color: $form-search-color;
} }

View File

@ -8,11 +8,14 @@
# EN COURS # # EN COURS #
############ ############
- [ ] [view/users][view/js/users.js] Suppression avec recherche comme pour la modification
- [ ] [view/machines][view/js/machines.js] Suppression avec recherche comme pour la modification
######## ########
# FAIT # # FAIT #
######## ########
- [x] [container.scss] Gestion des boutons "enabled"/"disabled" lorsqu'on doit faire une recherche
- [x] [view/users+machines] Suppression du sous-menu "Recherche" - [x] [view/users+machines] Suppression du sous-menu "Recherche"
- [x] [view/js/machines] Recherche instantanee - [x] [view/js/machines] Recherche instantanee
- [x] [container.scss] Gestion de l'affichage responsive - [x] [container.scss] Gestion de l'affichage responsive

View File

@ -280,18 +280,17 @@ if( section.edit.element != null ){
// 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 = null; var machine_data = machine_data = {
id_machine: '',
code: '',
name: '',
disable_input: true
};
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;
machine_data.disable_input = false;
}else{ // Si erreuron utilise un jeu de donnees vides
machine_data = {
id_machine: '',
code: '',
name: ''
};
} }
@ -301,6 +300,9 @@ if( section.edit.element != null ){
// Auto-remplissage du formulaire // Auto-remplissage du formulaire
section.edit.input.code.value = machine_data.code; section.edit.input.code.value = machine_data.code;
section.edit.input.name.value = machine_data.name; section.edit.input.name.value = machine_data.name;
// On active ou pas le bouton "Modifier"
section.edit.input.submit.disabled = machine_data.disable_input;
}); });
}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]);
@ -367,9 +369,13 @@ if( section.edit.element != null ){
}; };
api.send(request, function(answer){ api.send(request, function(answer){
if( answer.ModuleError == 0 && answer.status == true ) // Tout s'est bien deroule if( answer.ModuleError == 0 && answer.status == true ){ // Tout s'est bien deroule
console.log('Machine modifiee!'); console.log('Machine modifiee!');
else // Erreur
// On met a jour la machine
autofill_edit(null);
}else // Erreur
console.error('ModuleError::'+answer.ModuleError); console.error('ModuleError::'+answer.ModuleError);
}); });

View File

@ -200,13 +200,18 @@ if( section.remove.element != null ){
var user_data = null; var user_data = null;
api.send({path:'userDefault/getById', data: [id_user]}, function(answer){ api.send({path:'userDefault/getById', data: [id_user]}, function(answer){
if( answer.ModuleError == 0 ){ // Aucune erreur if( answer.ModuleError == 0 ){ // Si un resultat
user_data = answer.user; user_data = answer.user;
// Auto-remplissage du formulaire // Auto-remplissage du formulaire
section.remove.input.code.value = user_data.code; section.remove.input.code.value = user_data.code;
section.remove.input.username.value = user_data.username; section.remove.input.username.value = user_data.username;
}
// On affiche le bouton de suppression
section.remove.input.submit.disabled = false;
}else // Si aucun resultat -> on desactive le bouton de suppression
section.remove.input.submit.disabled = true;
}); });
}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]);
@ -294,25 +299,27 @@ if( section.edit.element != null ){
/* (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){
// On recupere le code + username de l'utilisateur selectionne // On definit les valeurs par defaut
var user_data = null; var user_data = {
// SI @id_user est un entier
if( !isNaN(id_user) ){
api.send({path:'userDefault/getById', data: [id_user]}, function(answer){
if( answer.ModuleError == 0 ){ // Si aucune erreur
user_data = answer.user;
}else{ // Si erreuron utilise un jeu de donnees vides
user_data = {
id_user: '', id_user: '',
code: '', code: '',
username: '', username: '',
firstname: '', firstname: '',
lastname: '', lastname: '',
mail: '', mail: '',
status: '' status: '',
disable_input: true
}; };
// Si @id_user est un entier
if( !isNaN(id_user) ){
// On recupere le code + username de l'utilisateur selectionne
api.send({path:'userDefault/getById', data: [id_user]}, function(answer){
if( answer.ModuleError == 0 ){ // Si aucune erreur
user_data = answer.user;
user_data.disable_input = false;
} }
@ -327,10 +334,13 @@ if( section.edit.element != null ){
section.edit.input.mail.value = user_data.mail; section.edit.input.mail.value = user_data.mail;
section.edit.input.password.value = ''; section.edit.input.password.value = '';
section.edit.input.status.value = user_data.status; section.edit.input.status.value = user_data.status;
});
// Si @id_user est incoherent
}
// On active ou pas le bouton "Modifier"
section.edit.input.submit.disabled = user_data.disable_input;
});
}
}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]);
@ -398,9 +408,13 @@ if( section.edit.element != null ){
api.send(request, function(answer){ api.send(request, function(answer){
console.log( answer ); console.log( answer );
if( answer.ModuleError == 0 && answer.status == true ) // Tout s'est bien deroule if( answer.ModuleError == 0 && answer.status == true ){ // Tout s'est bien deroule
console.log('Utilisateur modifie!'); console.log('Utilisateur modifie!');
else // Erreur
// On met a jour l'utilisateur
autofill_edit(null);
}else // Erreur
console.error('ModuleError::'+answer.ModuleError); console.error('ModuleError::'+answer.ModuleError);
}); });

View File

@ -189,7 +189,7 @@
echo "<input id='edit_code' type='text' placeholder='Code'><br>"; echo "<input id='edit_code' type='text' placeholder='Code'><br>";
echo "<input id='edit_name' type='text' placeholder='Name'><br>"; echo "<input id='edit_name' type='text' placeholder='Name'><br>";
echo "<button id='edit_submit'>Modifier</button>"; echo "<button id='edit_submit' disabled>Modifier</button>";
echo "</form>"; echo "</form>";
echo '</section>'; echo '</section>';

View File

@ -173,10 +173,13 @@
echo "<section data-sublink='remove'>"; echo "<section data-sublink='remove'>";
echo "<form class='invalid'>"; echo "<form class='invalid'>";
echo "<input id='remove_id' type='hidden' value=''><br>";
echo "<input id='remove_code' type='text' placeholder='Code'><br>"; echo "<input id='remove_code' type='text' placeholder='Code'><br>";
echo "<hr class='OR' />"; echo "<hr class='OR' />";
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'>Supprimer</button>";
echo "<button id='remove_search' class='search'>Rechercher</button><br><br>";
echo "<button id='remove_submit' disabled>Supprimer</button>";
echo "</form>"; echo "</form>";
echo '</section>'; echo '</section>';
@ -208,7 +211,7 @@
echo "<input id='edit_mail' type='text' placeholder='Mail'><br>"; echo "<input id='edit_mail' type='text' placeholder='Mail'><br>";
echo "<input id='edit_password' type='password' placeholder='Password'><br>"; echo "<input id='edit_password' type='password' placeholder='Password'><br>";
echo "<input id='edit_status' type='text' placeholder='Status'><br>"; echo "<input id='edit_status' type='text' placeholder='Status'><br>";
echo "<button id='edit_submit'>Modifier</button>"; echo "<button id='edit_submit' disabled>Modifier</button>";
echo "</form>"; echo "</form>";
echo '</section>'; echo '</section>';