- [x] [container.scss] Gestion des boutons "enabled"/"disabled" lorsqu'on doit faire une recherche
This commit is contained in:
parent
73a0b5578e
commit
76a73b5a41
File diff suppressed because one or more lines are too long
|
@ -352,7 +352,8 @@
|
|||
transform: translateX(-50%);
|
||||
|
||||
&:hover,
|
||||
&:focus{
|
||||
&:focus,
|
||||
&:disabled{
|
||||
background-color: #fff;
|
||||
color: $form-invalid-color;
|
||||
}
|
||||
|
@ -367,7 +368,8 @@
|
|||
background-color: $form-valid-color;
|
||||
|
||||
&:hover,
|
||||
&:focus{
|
||||
&:focus,
|
||||
&:disabled{
|
||||
background-color: #fff;
|
||||
color: $form-valid-color;
|
||||
}
|
||||
|
@ -381,7 +383,8 @@
|
|||
background-color: $form-neutral-color;
|
||||
|
||||
&:hover,
|
||||
&:focus{
|
||||
&:focus,
|
||||
&:disabled{
|
||||
background-color: #fff;
|
||||
color: $form-neutral-color;
|
||||
}
|
||||
|
@ -395,7 +398,8 @@
|
|||
background-color: $form-search-color;
|
||||
|
||||
&:hover,
|
||||
&:focus{
|
||||
&:focus,
|
||||
&:disabled{
|
||||
background-color: #fff;
|
||||
color: $form-search-color;
|
||||
}
|
||||
|
|
3
todo.md
3
todo.md
|
@ -8,11 +8,14 @@
|
|||
# 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 #
|
||||
########
|
||||
- [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/js/machines] Recherche instantanee
|
||||
- [x] [container.scss] Gestion de l'affichage responsive
|
||||
|
|
|
@ -280,18 +280,17 @@ if( section.edit.element != null ){
|
|||
// Gestion de l'auto-remplissage par lien
|
||||
function autofill_edit(id_machine){
|
||||
// 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){
|
||||
if( answer.ModuleError == 0 ){ // Aucune erreur
|
||||
machine_data = answer.machine;
|
||||
|
||||
}else{ // Si erreuron utilise un jeu de donnees vides
|
||||
machine_data = {
|
||||
id_machine: '',
|
||||
code: '',
|
||||
name: ''
|
||||
};
|
||||
machine_data.disable_input = false;
|
||||
}
|
||||
|
||||
|
||||
|
@ -301,6 +300,9 @@ if( section.edit.element != null ){
|
|||
// 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;
|
||||
});
|
||||
}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){
|
||||
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!');
|
||||
else // Erreur
|
||||
|
||||
// On met a jour la machine
|
||||
autofill_edit(null);
|
||||
|
||||
}else // Erreur
|
||||
console.error('ModuleError::'+answer.ModuleError);
|
||||
});
|
||||
|
||||
|
|
|
@ -200,13 +200,18 @@ if( section.remove.element != null ){
|
|||
var user_data = null;
|
||||
|
||||
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;
|
||||
|
||||
// Auto-remplissage du formulaire
|
||||
section.remove.input.code.value = user_data.code;
|
||||
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]);
|
||||
|
||||
|
@ -294,25 +299,27 @@ if( section.edit.element != null ){
|
|||
|
||||
/* (1) Gestion de l'auto-remplissage par url */
|
||||
function autofill_edit(id_user){
|
||||
// On recupere le code + username de l'utilisateur selectionne
|
||||
var user_data = null;
|
||||
|
||||
// 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 = {
|
||||
// On definit les valeurs par defaut
|
||||
var user_data = {
|
||||
id_user: '',
|
||||
code: '',
|
||||
username: '',
|
||||
firstname: '',
|
||||
lastname: '',
|
||||
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.password.value = '';
|
||||
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]);
|
||||
|
||||
|
@ -398,9 +408,13 @@ if( section.edit.element != null ){
|
|||
|
||||
api.send(request, function(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!');
|
||||
else // Erreur
|
||||
|
||||
// On met a jour l'utilisateur
|
||||
autofill_edit(null);
|
||||
|
||||
}else // Erreur
|
||||
console.error('ModuleError::'+answer.ModuleError);
|
||||
});
|
||||
|
||||
|
|
|
@ -189,7 +189,7 @@
|
|||
|
||||
echo "<input id='edit_code' type='text' placeholder='Code'><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 '</section>';
|
||||
|
|
|
@ -173,10 +173,13 @@
|
|||
echo "<section data-sublink='remove'>";
|
||||
|
||||
echo "<form class='invalid'>";
|
||||
echo "<input id='remove_id' type='hidden' value=''><br>";
|
||||
echo "<input id='remove_code' type='text' placeholder='Code'><br>";
|
||||
echo "<hr class='OR' />";
|
||||
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 '</section>';
|
||||
|
@ -208,7 +211,7 @@
|
|||
echo "<input id='edit_mail' type='text' placeholder='Mail'><br>";
|
||||
echo "<input id='edit_password' type='password' placeholder='Password'><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 '</section>';
|
Loading…
Reference in New Issue