parent
9c3505584e
commit
3c70acd4ea
2
todo.md
2
todo.md
|
@ -22,6 +22,8 @@
|
|||
########
|
||||
# FAIT #
|
||||
########
|
||||
- [x] Creation de machine
|
||||
- [x] Creation d'utilisateur
|
||||
- [x] Developpement de l'api cote client
|
||||
- [x] Dev des managers et de l'API et liste des acces
|
||||
- [x] [repo/cluster] getMembers
|
||||
|
|
|
@ -0,0 +1,69 @@
|
|||
// On referencie toutes les sections
|
||||
var section = {
|
||||
view: {
|
||||
text: '#CONTAINER > section[data-sublink="view"] ',
|
||||
element: document.querySelector('#CONTAINER > section[data-sublink="view"]')
|
||||
},
|
||||
|
||||
create: {
|
||||
text: '#CONTAINER > section[data-sublink="create"] ',
|
||||
element: document.querySelector('#CONTAINER > section[data-sublink="create"]')
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
/* 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){
|
||||
if( answer.ModuleError == 0 ) // Tout s'est bien deroule
|
||||
console.log('Machine cree!');
|
||||
else // Erreur
|
||||
console.error('ModuleError::'+answer.ModuleError);
|
||||
|
||||
});
|
||||
|
||||
|
||||
|
||||
}, false);
|
||||
|
||||
}
|
|
@ -65,7 +65,11 @@ if( section.create.element != null ){
|
|||
};
|
||||
|
||||
api.send(request, function(answer){
|
||||
console.log(answer);
|
||||
if( answer.ModuleError == 0 ) // Tout s'est bien deroule
|
||||
console.log('Utilisateur cree!');
|
||||
else // Erreur
|
||||
console.error('ModuleError::'+answer.ModuleError);
|
||||
|
||||
});
|
||||
|
||||
|
||||
|
|
|
@ -74,7 +74,7 @@
|
|||
|
||||
echo "<article class='inline-box'>";
|
||||
// Prenom Nom
|
||||
echo "<span class='title'>".$machine['name']."</span>";
|
||||
echo "<span class='title'>#".$machine['name']."</span>";
|
||||
|
||||
// Code RFID
|
||||
echo "<span class='code'>";
|
||||
|
@ -102,3 +102,26 @@
|
|||
}
|
||||
|
||||
echo '</section>';
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/* [2] Creation de machine
|
||||
=========================================================*/
|
||||
echo "<section data-sublink='create'>";
|
||||
|
||||
echo "<form>";
|
||||
echo "<input id='create_code' type='text' placeholder='Code'><br>";
|
||||
echo "<input id='create_name' type='text' placeholder='Name'><br>";
|
||||
echo "<button id='create_submit'>Créer</button>";
|
||||
echo "</form>";
|
||||
|
||||
echo '</section>';
|
||||
|
|
|
@ -74,7 +74,7 @@
|
|||
|
||||
echo "<article class='inline-box'>";
|
||||
// Prenom Nom
|
||||
echo "<span class='title'>".$user['username']." <span>(".$user['firstname']." ".$user['lastname'].")</span></span>";
|
||||
echo "<span class='title'>".$user['firstname']." ".$user['lastname']." <span>#".$user['username']."</span></span>";
|
||||
|
||||
// Code RFID
|
||||
echo "<span class='code'>";
|
||||
|
@ -126,9 +126,6 @@
|
|||
|
||||
/* [2] Creation d'utilisateur
|
||||
=========================================================*/
|
||||
$request = new ModuleRequest('userDefault/getAll'); // On utilise la methode 'getAll' du module 'userDefault'
|
||||
$answer = $request->dispatch(); // On recupere la reponse
|
||||
|
||||
echo "<section data-sublink='create'>";
|
||||
|
||||
echo "<form>";
|
||||
|
|
Loading…
Reference in New Issue