Correction de l'utilisation de l'api niveau JAVASCRIPT pour les pages 'machine' et 'user'
This commit is contained in:
parent
4b0c282ae4
commit
32c44516de
|
@ -4,14 +4,14 @@ if(null!=section.view.element){section.view.link={edit:document.querySelectorAll
|
|||
for(c=0;c<a.length;c++)-1<b.indexOf(a[c].id)?a[c].remClass("hidden"):a[c].addClass("hidden")}})},!1);for(var i=0;i<section.view.link.edit.length;i++)section.view.link.edit[i].addEventListener("click",function(b){pageManager.vars[1]=b.target.getData("machine");autofill_edit(pageManager.vars[1]);navSubMenu("edit")},!1);for(i=0;i<section.view.link.remove.length;i++)section.view.link.remove[i].addEventListener("click",function(b){pageManager.vars[1]=b.target.getData("machine");autofill_remove(pageManager.vars[1]);
|
||||
navSubMenu("remove")},!1)}
|
||||
if(null!=section.create.element){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")};var createChecker=new inputChecker;createChecker.append(section.create.input.code,format_code,"01-AB-CD-23");section.create.input.code.addEventListener("keyup",function(b){b.target.value=b.target.value.toUpperCase();createChecker.check(b.target)||createChecker.correct(b.target,
|
||||
!1)},!1);section.create.input.submit.addEventListener("click",function(b){b.preventDefault();api.send({path:"machineDefault/create",data:[section.create.input.code.value,section.create.input.name.value]},function(a){0==a.ModuleError?(console.log("Machine cree!"),section.create.input.submit.anim("active",1500)):console.error("ModuleError::"+a.ModuleError)})},!1)}
|
||||
if(null!=section.remove.element){var autofill_remove=function(b){var a=a={id_machine:"",code:"",name:"",disable_input:!0};api.send({path:"machineDefault/getById",data:[b]},function(b){0==b.ModuleError&&(a=b.machine,a.diable_input=!1);section.remove.input.search.id.value=a.id_machine;section.remove.input.code.value=a.code;section.remove.input.name.value=a.name;section.remove.input.submit.disabled=a.disable_input;section.remove.input.search.num.innerHTML=searchindex_remove+1})};section.remove.input=
|
||||
!1)},!1);section.create.input.submit.addEventListener("click",function(b){b.preventDefault();api.send({path:"machineDefault/create",code:section.create.input.code.value,name:section.create.input.name.value},function(a){0==a.ModuleError?(console.log("Machine cree!"),section.create.input.submit.anim("active",1500)):console.error("ModuleError::"+a.ModuleError)})},!1)}
|
||||
if(null!=section.remove.element){var autofill_remove=function(b){var a=a={id_machine:"",code:"",name:"",disable_input:!0};api.send({path:"machineDefault/getById",id_machine:b},function(b){0==b.ModuleError&&(a=b.machine,a.diable_input=!1);section.remove.input.search.id.value=a.id_machine;section.remove.input.code.value=a.code;section.remove.input.name.value=a.name;section.remove.input.submit.disabled=a.disable_input;section.remove.input.search.num.innerHTML=searchindex_remove+1})};section.remove.input=
|
||||
{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"),id:document.querySelector(section.remove.text+"#remove_search_id"),submit:document.querySelector(section.remove.text+"#remove_search_submit")},code:document.querySelector(section.remove.text+"#remove_code"),
|
||||
name:document.querySelector(section.remove.text+"#remove_name"),submit:document.querySelector(section.remove.text+"#remove_submit")};var lastsearch_remove=null,searchindex_remove=0;2<=pageManager.vars.length&&!isNaN(pageManager.vars[1])&&autofill_remove(pageManager.vars[1]);section.remove.input.search.submit.addEventListener("click",function(b){b.preventDefault();""!=section.remove.input.search.keyword.value&&api.send({path:"machineDefault/search",data:[section.remove.input.search.keyword.value]},
|
||||
name:document.querySelector(section.remove.text+"#remove_name"),submit:document.querySelector(section.remove.text+"#remove_submit")};var lastsearch_remove=null,searchindex_remove=0;2<=pageManager.vars.length&&!isNaN(pageManager.vars[1])&&autofill_remove(pageManager.vars[1]);section.remove.input.search.submit.addEventListener("click",function(b){b.preventDefault();""!=section.remove.input.search.keyword.value&&api.send({path:"machineDefault/search",keywords:section.remove.input.search.keyword.value},
|
||||
function(a){0==a.ModuleError&&0<a.machines.length?(section.remove.input.search.submit.anim("active",1E3),lastsearch_remove==a.machines[searchindex_remove].id_machine&&(searchindex_remove=(searchindex_remove+1)%a.machines.length),lastsearch_remove=a.machines[searchindex_remove].id_machine,section.remove.input.search.id.value=lastsearch_remove,section.remove.input.search.sum.innerHTML=a.machines.length,autofill_remove(lastsearch_remove)):(section.remove.input.search.sum.innerHTML=0,autofill_remove(null))})},
|
||||
!1);section.remove.input.submit.addEventListener("click",function(b){b.preventDefault();""!=section.remove.input.search.id.value&&api.send({path:"machineDefault/delete",data:[section.remove.input.search.id.value]},function(a){0==a.ModuleError&&1==a.status?(console.log("Machine supprimee!"),section.remove.input.submit.anim("active",1500),autofill_remove(null)):console.error("ModuleError::"+a.ModuleError)})},!1)}
|
||||
if(null!=section.edit.element){var autofill_edit=function(b){var a={id_machine:"",code:"",name:"",disable_input:!0};isNaN(b)?section.edit.input.search.num.innerHTML=0:api.send({path:"machineDefault/getById",data:[b]},function(b){0==b.ModuleError&&(a=b.machine,a.disable_input=!1);section.edit.input.search.id.value=a.id_machine;section.edit.input.code.value=a.code;section.edit.input.name.value=a.name;section.edit.input.submit.disabled=a.disable_input;section.edit.input.search.num.innerHTML=searchindex_edit+
|
||||
!1);section.remove.input.submit.addEventListener("click",function(b){b.preventDefault();""!=section.remove.input.search.id.value&&api.send({path:"machineDefault/delete",id_machine:section.remove.input.search.id.value},function(a){0==a.ModuleError&&1==a.status?(console.log("Machine supprimee!"),section.remove.input.submit.anim("active",1500),autofill_remove(null)):console.error("ModuleError::"+a.ModuleError)})},!1)}
|
||||
if(null!=section.edit.element){var autofill_edit=function(b){var a={id_machine:"",code:"",name:"",disable_input:!0};isNaN(b)?section.edit.input.search.num.innerHTML=0:api.send({path:"machineDefault/getById",id_machine:b},function(b){0==b.ModuleError&&(a=b.machine,a.disable_input=!1);section.edit.input.search.id.value=a.id_machine;section.edit.input.code.value=a.code;section.edit.input.name.value=a.name;section.edit.input.submit.disabled=a.disable_input;section.edit.input.search.num.innerHTML=searchindex_edit+
|
||||
1})};section.edit.input={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"),id:document.querySelector(section.edit.text+"#edit_search_id"),submit:document.querySelector(section.edit.text+"#edit_search_submit")},code:document.querySelector(section.edit.text+"#edit_code"),name:document.querySelector(section.edit.text+
|
||||
"#edit_name"),submit:document.querySelector(section.edit.text+"#edit_submit")};var lastsearch_edit=null,searchindex_edit=0;2<=pageManager.vars.length&&!isNaN(pageManager.vars[1])&&autofill_edit(pageManager.vars[1]);section.edit.input.search.submit.addEventListener("click",function(b){b.preventDefault();""!=section.edit.input.search.keyword.value&&api.send({path:"machineDefault/search",data:[section.edit.input.search.keyword.value]},function(a){0==a.ModuleError&&0<a.machines.length?(section.edit.input.search.submit.anim("active",
|
||||
"#edit_name"),submit:document.querySelector(section.edit.text+"#edit_submit")};var lastsearch_edit=null,searchindex_edit=0;2<=pageManager.vars.length&&!isNaN(pageManager.vars[1])&&autofill_edit(pageManager.vars[1]);section.edit.input.search.submit.addEventListener("click",function(b){b.preventDefault();""!=section.edit.input.search.keyword.value&&api.send({path:"machineDefault/search",keywords:section.edit.input.search.keyword.value},function(a){0==a.ModuleError&&0<a.machines.length?(section.edit.input.search.submit.anim("active",
|
||||
1E3),searchindex_edit=lastsearch_edit==a.machines[searchindex_edit].id_machine?(searchindex_edit+1)%a.machines.length:0,lastsearch_edit=a.machines[searchindex_edit].id_machine,section.edit.input.search.id.value=lastsearch_edit,section.edit.input.search.sum.innerHTML=a.machines.length,autofill_edit(lastsearch_edit)):(section.edit.input.search.sum.innerHTML=0,autofill_edit(null))})},!1);section.edit.input.submit.addEventListener("click",function(b){b.preventDefault();""!=section.edit.input.search.id.value&&
|
||||
api.send({path:"machineDefault/edit",data:[section.edit.input.search.id.value,section.edit.input.code.value,section.edit.input.name.value]},function(a){0==a.ModuleError&&1==a.status?(console.log("Machine modifiee!"),section.edit.input.submit.anim("active",1500),autofill_edit(section.edit.input.search.id.value)):console.error("ModuleError::"+a.ModuleError)})},!1)};
|
||||
api.send({path:"machineDefault/edit",id_machine:section.edit.input.search.id.value,code:section.edit.input.code.value,name:section.edit.input.name.value},function(a){0==a.ModuleError&&1==a.status?(console.log("Machine modifiee!"),section.edit.input.submit.anim("active",1500),autofill_edit(section.edit.input.search.id.value)):console.error("ModuleError::"+a.ModuleError)})},!1)};
|
||||
|
|
|
@ -143,10 +143,8 @@ if( section.create.element != null ){
|
|||
|
||||
var request = {
|
||||
path: 'machineDefault/create', // On veut creer un utilisateur
|
||||
data: [
|
||||
section.create.input.code.value,
|
||||
section.create.input.name.value
|
||||
]
|
||||
code: section.create.input.code.value,
|
||||
name: section.create.input.name.value
|
||||
};
|
||||
|
||||
api.send(request, function(answer){
|
||||
|
@ -208,7 +206,7 @@ if( section.remove.element != null ){
|
|||
disable_input: true
|
||||
};
|
||||
|
||||
api.send({path:'machineDefault/getById', data: [id_machine]}, function(answer){
|
||||
api.send({path:'machineDefault/getById', id_machine: id_machine}, function(answer){
|
||||
if( answer.ModuleError == 0 ){ // Aucune erreur
|
||||
machine_data = answer.machine;
|
||||
machine_data.diable_input = false;
|
||||
|
@ -242,7 +240,7 @@ if( section.remove.element != null ){
|
|||
// Redaction de la requete
|
||||
var getuid = {
|
||||
path: 'machineDefault/search',
|
||||
data: [section.remove.input.search.keyword.value]
|
||||
keywords: section.remove.input.search.keyword.value
|
||||
};
|
||||
|
||||
// On envoie la requete
|
||||
|
@ -285,7 +283,7 @@ if( section.remove.element != null ){
|
|||
/* (2) On supprime la machine */
|
||||
var request = {
|
||||
path: 'machineDefault/delete', // On veut supprimer cet utilisateur
|
||||
data: [section.remove.input.search.id.value]
|
||||
id_machine: section.remove.input.search.id.value
|
||||
};
|
||||
|
||||
api.send(request, function(answer){
|
||||
|
@ -353,7 +351,7 @@ if( section.edit.element != null ){
|
|||
// 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', id_machine: id_machine}, function(answer){
|
||||
if( answer.ModuleError == 0 ){ // Aucune erreur
|
||||
machine_data = answer.machine;
|
||||
machine_data.disable_input = false;
|
||||
|
@ -396,7 +394,7 @@ if( section.edit.element != null ){
|
|||
// Redaction de la requete
|
||||
var getuid = {
|
||||
path: 'machineDefault/search',
|
||||
data: [section.edit.input.search.keyword.value]
|
||||
keywords: section.edit.input.search.keyword.value
|
||||
};
|
||||
|
||||
// On envoie la requete
|
||||
|
@ -443,11 +441,9 @@ if( section.edit.element != null ){
|
|||
|
||||
var request = {
|
||||
path: 'machineDefault/edit', // On veut creer une machine
|
||||
data: [
|
||||
section.edit.input.search.id.value,
|
||||
section.edit.input.code.value,
|
||||
section.edit.input.name.value
|
||||
]
|
||||
id_machine: section.edit.input.search.id.value,
|
||||
code: section.edit.input.code.value,
|
||||
name: section.edit.input.name.value
|
||||
};
|
||||
|
||||
api.send(request, function(answer){
|
||||
|
|
|
@ -4,17 +4,17 @@ if(null!=section.view.element){section.view.link={edit:document.querySelectorAll
|
|||
"> article.inline-box[id]");for(c=0;c<a.length;c++)-1<b.indexOf(a[c].id)?a[c].remClass("hidden"):a[c].addClass("hidden")}})},!1);for(var i=0;i<section.view.link.edit.length;i++)section.view.link.edit[i].addEventListener("click",function(b){pageManager.vars[1]=b.target.getData("user");autofill_edit(pageManager.vars[1]);navSubMenu("edit")},!1);for(i=0;i<section.view.link.remove.length;i++)section.view.link.remove[i].addEventListener("click",function(b){pageManager.vars[1]=b.target.getData("user");autofill_remove(pageManager.vars[1]);
|
||||
navSubMenu("remove")},!1)}
|
||||
if(null!=section.create.element){section.create.input={code:document.querySelector(section.create.text+"#create_code"),username:document.querySelector(section.create.text+"#create_username"),firstname:document.querySelector(section.create.text+"#create_firstname"),lastname:document.querySelector(section.create.text+"#create_lastname"),mail:document.querySelector(section.create.text+"#create_mail"),password:document.querySelector(section.create.text+"#create_password"),status:document.querySelector(section.create.text+"#create_status"),
|
||||
submit:document.querySelector(section.create.text+"#create_submit")};var createChecker=new inputChecker;createChecker.append(section.create.input.code,format_code,"01-AB-CD-23");section.create.input.code.addEventListener("keyup",function(b){b.target.value=b.target.value.toUpperCase();createChecker.check(b.target)||createChecker.correct(b.target,!1)},!1);section.create.input.submit.addEventListener("click",function(b){b.preventDefault();api.send({path:"userDefault/create",data:[section.create.input.code.value,
|
||||
section.create.input.username.value,section.create.input.firstname.value,section.create.input.lastname.value,section.create.input.mail.value,section.create.input.password.value,section.create.input.status.value]},function(a){0==a.ModuleError?(console.log("Utilisateur cree!"),section.create.input.submit.anim("active",1500)):console.error("ModuleError::"+a.ModuleError)})},!1)}
|
||||
if(null!=section.remove.element){var autofill_remove=function(b){var a={id_user:"",code:"",username:"",firstname:"",lastname:"",mail:"",status:"",disable_input:!0};api.send({path:"userDefault/getById",data:[b]},function(b){0==b.ModuleError&&(a=b.user,a.disable_input=!1);section.remove.input.search.id.value=a.id_user;section.remove.input.code.value=a.code;section.remove.input.username.value=a.username;section.remove.input.submit.disabled=a.disable_input;section.remove.input.search.num.innerHTML=searchindex_remove+
|
||||
submit:document.querySelector(section.create.text+"#create_submit")};var createChecker=new inputChecker;createChecker.append(section.create.input.code,format_code,"01-AB-CD-23");section.create.input.code.addEventListener("keyup",function(b){b.target.value=b.target.value.toUpperCase();createChecker.check(b.target)||createChecker.correct(b.target,!1)},!1);section.create.input.submit.addEventListener("click",function(b){b.preventDefault();api.send({path:"userDefault/create",code:section.create.input.code.value,
|
||||
username:section.create.input.username.value,firstname:section.create.input.firstname.value,lastname:section.create.input.lastname.value,mail:section.create.input.mail.value,password:section.create.input.password.value,status:section.create.input.status.value},function(a){0==a.ModuleError?(console.log("Utilisateur cree!"),section.create.input.submit.anim("active",1500)):console.error("ModuleError::"+a.ModuleError)})},!1)}
|
||||
if(null!=section.remove.element){var autofill_remove=function(b){var a={id_user:"",code:"",username:"",firstname:"",lastname:"",mail:"",status:"",disable_input:!0};api.send({path:"userDefault/getById",id_user:b},function(b){0==b.ModuleError&&(a=b.user,a.disable_input=!1);section.remove.input.search.id.value=a.id_user;section.remove.input.code.value=a.code;section.remove.input.username.value=a.username;section.remove.input.submit.disabled=a.disable_input;section.remove.input.search.num.innerHTML=searchindex_remove+
|
||||
1})};section.remove.input={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"),id:document.querySelector(section.remove.text+"#remove_search_id"),submit:document.querySelector(section.remove.text+"#remove_search_submit")},code:document.querySelector(section.remove.text+
|
||||
"#remove_code"),username:document.querySelector(section.remove.text+"#remove_username"),submit:document.querySelector(section.remove.text+"#remove_submit")};var lastsearch_remove=null,searchindex_remove=0;2<=pageManager.vars.length&&!isNaN(pageManager.vars[1])&&autofill_remove(pageManager.vars[1]);section.remove.input.search.submit.addEventListener("click",function(b){b.preventDefault();""!=section.remove.input.search.keyword.value&&api.send({path:"userDefault/search",data:[section.remove.input.search.keyword.value]},
|
||||
"#remove_code"),username:document.querySelector(section.remove.text+"#remove_username"),submit:document.querySelector(section.remove.text+"#remove_submit")};var lastsearch_remove=null,searchindex_remove=0;2<=pageManager.vars.length&&!isNaN(pageManager.vars[1])&&autofill_remove(pageManager.vars[1]);section.remove.input.search.submit.addEventListener("click",function(b){b.preventDefault();""!=section.remove.input.search.keyword.value&&api.send({path:"userDefault/search",keywords:section.remove.input.search.keyword.value},
|
||||
function(a){0==a.ModuleError&&0<a.users.length?(section.remove.input.search.submit.anim("active",1E3),searchindex_remove=lastsearch_remove==a.users[searchindex_remove].id_user?(searchindex_remove+1)%a.users.length:0,lastsearch_remove=a.users[searchindex_remove].id_user,section.remove.input.search.id.value=lastsearch_remove,section.remove.input.search.sum.innerHTML=a.users.length,autofill_remove(lastsearch_remove)):(section.remove.input.search.sum.innerHTML=0,autofill_remove(null))})},!1);section.remove.input.submit.addEventListener("click",
|
||||
function(b){b.preventDefault();""!=section.remove.input.search.id.value&&api.send({path:"userDefault/delete",data:[section.remove.input.search.id.value]},function(a){0==a.ModuleError&&1==a.status?(console.log("Utilisateur supprime!"),section.remove.input.submit.anim("active",1500),autofill_remove(null)):console.error("ModuleError::"+a.ModuleError)})},!1)}
|
||||
if(null!=section.edit.element){var autofill_edit=function(b){var a={id_user:"",code:"",username:"",firstname:"",lastname:"",mail:"",status:"",disable_input:!0};isNaN(b)?section.edit.input.search.num.innerHTML=0:api.send({path:"userDefault/getById",data:[b]},function(b){0==b.ModuleError&&(a=b.user,a.disable_input=!1);section.edit.input.search.id.value=a.id_user;section.edit.input.code.value=a.code;section.edit.input.username.value=a.username;section.edit.input.firstname.value=a.firstname;section.edit.input.lastname.value=
|
||||
function(b){b.preventDefault();""!=section.remove.input.search.id.value&&api.send({path:"userDefault/delete",id_user:section.remove.input.search.id.value},function(a){0==a.ModuleError&&1==a.status?(console.log("Utilisateur supprime!"),section.remove.input.submit.anim("active",1500),autofill_remove(null)):console.error("ModuleError::"+a.ModuleError)})},!1)}
|
||||
if(null!=section.edit.element){var autofill_edit=function(b){var a={id_user:"",code:"",username:"",firstname:"",lastname:"",mail:"",status:"",disable_input:!0};isNaN(b)?section.edit.input.search.num.innerHTML=0:api.send({path:"userDefault/getById",id_user:b},function(b){0==b.ModuleError&&(a=b.user,a.disable_input=!1);section.edit.input.search.id.value=a.id_user;section.edit.input.code.value=a.code;section.edit.input.username.value=a.username;section.edit.input.firstname.value=a.firstname;section.edit.input.lastname.value=
|
||||
a.lastname;section.edit.input.mail.value=a.mail;section.edit.input.password.value="";section.edit.input.status.value=a.status;section.edit.input.submit.disabled=a.disable_input;section.edit.input.search.num.innerHTML=searchindex_edit+1})};section.edit.input={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"),id:document.querySelector(section.edit.text+"#edit_search_id"),submit:document.querySelector(section.edit.text+"#edit_search_submit")},code:document.querySelector(section.edit.text+"#edit_code"),username:document.querySelector(section.edit.text+"#edit_username"),firstname:document.querySelector(section.edit.text+"#edit_firstname"),lastname:document.querySelector(section.edit.text+"#edit_lastname"),mail:document.querySelector(section.edit.text+"#edit_mail"),password:document.querySelector(section.edit.text+
|
||||
"#edit_password"),status:document.querySelector(section.edit.text+"#edit_status"),submit:document.querySelector(section.edit.text+"#edit_submit")};var lastsearch_edit=null,searchindex_edit=0;2<=pageManager.vars.length&&!isNaN(pageManager.vars[1])&&autofill_edit(pageManager.vars[1]);section.edit.input.search.submit.addEventListener("click",function(b){b.preventDefault();""!=section.edit.input.search.keyword.value&&api.send({path:"userDefault/search",data:[section.edit.input.search.keyword.value]},
|
||||
"#edit_password"),status:document.querySelector(section.edit.text+"#edit_status"),submit:document.querySelector(section.edit.text+"#edit_submit")};var lastsearch_edit=null,searchindex_edit=0;2<=pageManager.vars.length&&!isNaN(pageManager.vars[1])&&autofill_edit(pageManager.vars[1]);section.edit.input.search.submit.addEventListener("click",function(b){b.preventDefault();""!=section.edit.input.search.keyword.value&&api.send({path:"userDefault/search",keywords:section.edit.input.search.keyword.value},
|
||||
function(a){0==a.ModuleError&&0<a.users.length?(section.edit.input.search.submit.anim("active",1E3),searchindex_edit=lastsearch_edit==a.users[searchindex_edit].id_user?(searchindex_edit+1)%a.users.length:0,lastsearch_edit=a.users[searchindex_edit].id_user,section.edit.input.search.id.value=lastsearch_edit,section.edit.input.search.sum.innerHTML=a.users.length,autofill_edit(lastsearch_edit)):(section.edit.input.search.sum.innerHTML=0,autofill_edit(null))})},!1);section.edit.input.submit.addEventListener("click",
|
||||
function(b){b.preventDefault();""!=section.edit.input.search.id.value&&api.send({path:"userDefault/edit",data:[section.edit.input.search.id.value,section.edit.input.code.value,section.edit.input.username.value,section.edit.input.firstname.value,section.edit.input.lastname.value,section.edit.input.mail.value,section.edit.input.password.value,section.edit.input.status.value]},function(a){console.log(a);0==a.ModuleError&&1==a.status?(console.log("Utilisateur modifie!"),section.edit.input.submit.anim("active",
|
||||
1500),autofill_edit(section.edit.input.search.id.value)):console.error("ModuleError::"+a.ModuleError)})},!1)};
|
||||
function(b){b.preventDefault();""!=section.edit.input.search.id.value&&api.send({path:"userDefault/edit",id_user:section.edit.input.search.id.value,code:section.edit.input.code.value,username:section.edit.input.username.value,firstname:section.edit.input.firstname.value,lastname:section.edit.input.lastname.value,mail:section.edit.input.mail.value,password:section.edit.input.password.value,status:section.edit.input.status.value},function(a){console.log(a);0==a.ModuleError&&1==a.status?(console.log("Utilisateur modifie!"),
|
||||
section.edit.input.submit.anim("active",1500),autofill_edit(section.edit.input.search.id.value)):console.error("ModuleError::"+a.ModuleError)})},!1)};
|
||||
|
|
|
@ -148,15 +148,13 @@ if( section.create.element != null ){
|
|||
|
||||
var request = {
|
||||
path: 'userDefault/create', // On veut creer un utilisateur
|
||||
data: [
|
||||
section.create.input.code.value,
|
||||
section.create.input.username.value,
|
||||
section.create.input.firstname.value,
|
||||
section.create.input.lastname.value,
|
||||
section.create.input.mail.value,
|
||||
section.create.input.password.value,
|
||||
section.create.input.status.value
|
||||
]
|
||||
code: section.create.input.code.value,
|
||||
username: section.create.input.username.value,
|
||||
firstname: section.create.input.firstname.value,
|
||||
lastname: section.create.input.lastname.value,
|
||||
mail: section.create.input.mail.value,
|
||||
password: section.create.input.password.value,
|
||||
status: section.create.input.status.value
|
||||
};
|
||||
|
||||
api.send(request, function(answer){
|
||||
|
@ -224,7 +222,7 @@ if( section.remove.element != null ){
|
|||
disable_input: true
|
||||
};
|
||||
|
||||
api.send({path:'userDefault/getById', data: [id_user]}, function(answer){
|
||||
api.send({path:'userDefault/getById', id_user: id_user}, function(answer){
|
||||
if( answer.ModuleError == 0 ){ // Si un resultat
|
||||
user_data = answer.user;
|
||||
user_data.disable_input = false;
|
||||
|
@ -259,7 +257,7 @@ if( section.remove.element != null ){
|
|||
// Redaction de la requete
|
||||
var getuid = {
|
||||
path: 'userDefault/search',
|
||||
data: [section.remove.input.search.keyword.value]
|
||||
keywords: section.remove.input.search.keyword.value
|
||||
};
|
||||
|
||||
// On envoie la requete
|
||||
|
@ -308,7 +306,7 @@ if( section.remove.element != null ){
|
|||
/* (2) On supprime l'utilisateur */
|
||||
var request = {
|
||||
path: 'userDefault/delete', // On veut supprimer cet utilisateur
|
||||
data: [section.remove.input.search.id.value]
|
||||
id_user: section.remove.input.search.id.value
|
||||
};
|
||||
|
||||
api.send(request, function(answer){
|
||||
|
@ -385,7 +383,7 @@ if( section.edit.element != null ){
|
|||
if( !isNaN(id_user) ){
|
||||
|
||||
// On recupere le code + username de l'utilisateur selectionne
|
||||
api.send({path:'userDefault/getById', data: [id_user]}, function(answer){
|
||||
api.send({path:'userDefault/getById', id_user: id_user}, function(answer){
|
||||
if( answer.ModuleError == 0 ){ // Si aucune erreur
|
||||
user_data = answer.user;
|
||||
user_data.disable_input = false;
|
||||
|
@ -428,7 +426,7 @@ if( section.edit.element != null ){
|
|||
// Redaction de la requete
|
||||
var getuid = {
|
||||
path: 'userDefault/search',
|
||||
data: [section.edit.input.search.keyword.value]
|
||||
keywords: section.edit.input.search.keyword.value
|
||||
};
|
||||
|
||||
// On envoie la requete
|
||||
|
@ -473,16 +471,14 @@ if( section.edit.element != null ){
|
|||
|
||||
var request = {
|
||||
path: 'userDefault/edit', // On veut creer un utilisateur
|
||||
data: [
|
||||
section.edit.input.search.id.value,
|
||||
section.edit.input.code.value,
|
||||
section.edit.input.username.value,
|
||||
section.edit.input.firstname.value,
|
||||
section.edit.input.lastname.value,
|
||||
section.edit.input.mail.value,
|
||||
section.edit.input.password.value,
|
||||
section.edit.input.status.value
|
||||
]
|
||||
id_user: section.edit.input.search.id.value,
|
||||
code: section.edit.input.code.value,
|
||||
username: section.edit.input.username.value,
|
||||
firstname: section.edit.input.firstname.value,
|
||||
lastname: section.edit.input.lastname.value,
|
||||
mail: section.edit.input.mail.value,
|
||||
password: section.edit.input.password.value,
|
||||
status: section.edit.input.status.value
|
||||
};
|
||||
|
||||
api.send(request, function(answer){
|
||||
|
|
Loading…
Reference in New Issue