Rétablissement des données (non modifiables) pour les 'mini' à partir des 'contacts déja utilisés
This commit is contained in:
parent
e137976dca
commit
48099c7910
|
@ -1,5 +1,5 @@
|
||||||
function inputPhoneContact(a,c){this.container=a;this.nav_container=c}inputPhoneContact.prototype={container:this.container,nav_container:this.nav_container,selected:0,handler:null};inputPhoneContact.prototype.check=function(a){return"."!=a.existing||0<a.username.length};
|
function inputPhoneContact(a,c){this.container=a;this.nav_container=c}inputPhoneContact.prototype={container:this.container,nav_container:this.nav_container,selected:0,handler:null};inputPhoneContact.prototype.check=function(a){return"."!=a.existing||0<a.username.length};
|
||||||
inputPhoneContact.prototype.fieldsToStorage=function(){console.log("CONTACTS: FIELDS TO STORAGE");for(var a=$$('[data-sublink="phone"] article.contact-panel .new-contact'),c=0;c<a.length;c++){var b=(new FormDeflater(a[c],["input","select"],["data-name"])).deflate();console.warn(b);if(this.check(b)){var d={uid:parseInt(b.uid),number:b.number,username:b.username,call:parseInt(b.call),sms:parseInt(b.sms),countcall:parseInt(b.countcall),countsms:parseInt(b.countsms),existing:isNaN(b.existing)?".":parseInt(b.existing)};
|
inputPhoneContact.prototype.fieldsToStorage=function(){console.log("CONTACTS: FIELDS TO STORAGE");for(var a=$$('[data-sublink="phone"] article.contact-panel .new-contact'),c=0;c<a.length;c++){var b=(new FormDeflater(a[c],["input","select"],["data-name"])).deflate();if(this.check(b)){var d={uid:parseInt(b.uid),number:b.number,username:b.username,call:parseInt(b.call),sms:parseInt(b.sms),countcall:parseInt(b.countcall),countsms:parseInt(b.countsms),existing:isNaN(b.existing)?".":parseInt(b.existing)};
|
||||||
d.hash=crc32(JSON.stringify(d));lsi.set("p_contacts",parseInt(b.uid),d)}}};
|
d.hash=crc32(JSON.stringify(d));lsi.set("p_contacts",parseInt(b.uid),d)}}};
|
||||||
inputPhoneContact.prototype.add=function(a){console.log("CONTACTS: ADD");if(null==a||null==a.uid||isNaN(a.uid))return!1;a.number=null!=a.number?a.number:"";a.username=null!=a.username?a.username:"";a.call=null!=a.call?a.call:-1;a.sms=null!=a.sms?a.sms:-1;a.countcall=null!=a.countcall?a.countcall:0;a.countsms=null!=a.countsms?a.countsms:0;a.existing=null!=a.existing?a.existing:".";var c=lsi["export"]("p_friends");a.contacts="";for(var b in c)a.contacts+="\t\t<option value='"+b+"'>"+c[b].name+"</option>\n";
|
inputPhoneContact.prototype.add=function(a){console.log("CONTACTS: ADD");if(null==a||null==a.uid||isNaN(a.uid))return!1;a.number=null!=a.number?a.number:"";a.username=null!=a.username?a.username:"";a.call=null!=a.call?a.call:-1;a.sms=null!=a.sms?a.sms:-1;a.countcall=null!=a.countcall?a.countcall:0;a.countsms=null!=a.countsms?a.countsms:0;a.existing=null!=a.existing?a.existing:".";var c=lsi["export"]("p_friends");a.contacts="";for(var b in c)a.contacts+="\t\t<option value='"+b+"'>"+c[b].name+"</option>\n";
|
||||||
this.container.innerHTML+=pContactBuilder.build(a);b=$('[data-sublink="phone"] article.contact-panel .new-contact input[data-name="uid"][value="'+a.uid+'"] ~ span select[data-name="existing"]>option[value="'+a.existing+'"]');null!=b&&b.setAttribute("selected","selected");a=$$('[data-sublink="phone"] article.contact-panel .new-contact');var d=this;for(b=0;b<a.length;b++)a[b].removeEventListener("click",function(a){d.nav(a.target);d.handler(a.target)},!1),a[b].addEventListener("click",function(a){d.nav(a.target);
|
this.container.innerHTML+=pContactBuilder.build(a);b=$('[data-sublink="phone"] article.contact-panel .new-contact input[data-name="uid"][value="'+a.uid+'"] ~ span select[data-name="existing"]>option[value="'+a.existing+'"]');null!=b&&b.setAttribute("selected","selected");a=$$('[data-sublink="phone"] article.contact-panel .new-contact');var d=this;for(b=0;b<a.length;b++)a[b].removeEventListener("click",function(a){d.nav(a.target);d.handler(a.target)},!1),a[b].addEventListener("click",function(a){d.nav(a.target);
|
||||||
|
|
|
@ -39,7 +39,6 @@ inputPhoneContact.prototype.fieldsToStorage = function(){
|
||||||
|
|
||||||
// {3} On enregistre ce contact si le numéro n'est pas vide et soit pseudo/prénom/nom //
|
// {3} On enregistre ce contact si le numéro n'est pas vide et soit pseudo/prénom/nom //
|
||||||
var deflated = deflater.deflate();
|
var deflated = deflater.deflate();
|
||||||
console.warn(deflated);
|
|
||||||
|
|
||||||
// Si le formulaire n'est pas valide, on ne l'enregistre pas
|
// Si le formulaire n'est pas valide, on ne l'enregistre pas
|
||||||
if( !this.check(deflated) ) continue;
|
if( !this.check(deflated) ) continue;
|
||||||
|
|
|
@ -2,10 +2,11 @@ function inputPhoneMini(a,b){this.container=a;this.nav_container=b}inputPhoneMin
|
||||||
inputPhoneMini.prototype.fieldsToStorage=function(){console.log("MINI FICHE: FIELDS TO STORAGE");for(var a=$$('[data-sublink="phone"] article.mini-relation-panel .mini-fiche-relation'),b=0;b<a.length;b++){var c=(new FormDeflater(a[b],["input","select"],["data-name"])).deflate(),d=crc32(JSON.stringify(c)),e=lsi.get("p_mini-fiches",c.uid);if(!1!==e){if(null!=e&&null!=e.hash&&e.hash==d)break;console.warn("> MINI UPDATE");c={uid:parseInt(c.uid),sexe:c.sexe,age:c.age,studies:c.studies,reltype:c.reltype,
|
inputPhoneMini.prototype.fieldsToStorage=function(){console.log("MINI FICHE: FIELDS TO STORAGE");for(var a=$$('[data-sublink="phone"] article.mini-relation-panel .mini-fiche-relation'),b=0;b<a.length;b++){var c=(new FormDeflater(a[b],["input","select"],["data-name"])).deflate(),d=crc32(JSON.stringify(c)),e=lsi.get("p_mini-fiches",c.uid);if(!1!==e){if(null!=e&&null!=e.hash&&e.hash==d)break;console.warn("> MINI UPDATE");c={uid:parseInt(c.uid),sexe:c.sexe,age:c.age,studies:c.studies,reltype:c.reltype,
|
||||||
reltypeSpecial:c.reltypeSpecial,loc:c.loc,unknown:null!=c.unknown,hash:d};c.valid=this.check(c);0<diff(e,c,["hash","valid","timestamp"]).length&&(console.log(diff(e,c,["hash","valid","timestamp"])),console.warn("> FICHE UPDATE"),c.timestamp=Date.now());lsi.set("p_mini-fiches",c.uid,c)}}};
|
reltypeSpecial:c.reltypeSpecial,loc:c.loc,unknown:null!=c.unknown,hash:d};c.valid=this.check(c);0<diff(e,c,["hash","valid","timestamp"]).length&&(console.log(diff(e,c,["hash","valid","timestamp"])),console.warn("> FICHE UPDATE"),c.timestamp=Date.now());lsi.set("p_mini-fiches",c.uid,c)}}};
|
||||||
inputPhoneMini.prototype.add=function(a){console.log("MINI FICHE: ADD");if(null==a||null==a.uid)return!1;a.age=null!=a.age?a.age:this.defaultData.age;a.sexe=null!=a.sexe?a.sexe:this.defaultData.sexe;a.studies=null!=a.studies?a.studies:this.defaultData.studies;a.reltype=null!=a.reltype?a.reltype:this.defaultData.reltype;a.reltypeSpecial=null!=a.reltypeSpecial?a.reltypeSpecial:this.defaultData.reltypeSpecial;a.loc=null!=a.loc?a.loc:this.defaultData.loc;a.unknown=null!=a.unknown?a.unknown:this.defaultData.unknown;
|
inputPhoneMini.prototype.add=function(a){console.log("MINI FICHE: ADD");if(null==a||null==a.uid)return!1;a.age=null!=a.age?a.age:this.defaultData.age;a.sexe=null!=a.sexe?a.sexe:this.defaultData.sexe;a.studies=null!=a.studies?a.studies:this.defaultData.studies;a.reltype=null!=a.reltype?a.reltype:this.defaultData.reltype;a.reltypeSpecial=null!=a.reltypeSpecial?a.reltypeSpecial:this.defaultData.reltypeSpecial;a.loc=null!=a.loc?a.loc:this.defaultData.loc;a.unknown=null!=a.unknown?a.unknown:this.defaultData.unknown;
|
||||||
var b=lsi.get("p_contacts",a.uid);if(!1===b)return!1;this.container.innerHTML+=pMiniFicheBuilder.build({name:b.username,countcall:b.countcall,countsms:b.countsms,uid:a.uid,reltypespecial:a.reltypeSpecial});b=$('[data-sublink="phone"] article.mini-fiche-relation input[data-name="uid"][value="'+a.uid+'"] ~ h5>span>select[data-name="studies"]>option[value="'+a.studies+'"]');null!=b&&b.setAttribute("selected","selected");b=$('[data-sublink="phone"] article.mini-fiche-relation input[data-name="uid"][value="'+
|
var b=lsi.get("p_contacts",a.uid);if(!1===b)return!1;if(!isNaN(b.existing)){var c=lsi.get("p_friends",b.existing);b.username=c.name;a.age=c.age;a.sexe=c.sexe;a.loc=c.dist;isNaN(c.reltype)?(a.reltype=10,a.reltypeSpecial=c.reltype):(a.reltype=c.reltype,a.reltypeSpecial="");null!=c.studies1&&(a.studies=c.studies1)}this.container.innerHTML+=pMiniFicheBuilder.build({name:b.username,countcall:b.countcall,countsms:b.countsms,uid:a.uid,reltypespecial:a.reltypeSpecial});b=$('[data-sublink="phone"] article.mini-fiche-relation input[data-name="uid"][value="'+
|
||||||
a.uid+'"] ~ h5>span>select[data-name="age"]>option[value="'+a.age+'"]');null!=b&&b.setAttribute("selected","selected");for(var c=$$('[data-sublink="phone"] article.mini-fiche-relation input[data-name="uid"][value="'+a.uid+'"] ~ h5>input[type="radio"][data-name="sexe"]'),b=0;b<c.length;b++)c[b].value==a.sexe?c[b].setAttribute("checked","checked"):c[b].removeAttribute("checked");c=$$('[data-sublink="phone"] article.mini-fiche-relation input[data-name="uid"][value="'+a.uid+'"] ~ h5>input[type="radio"][data-name="reltype"]');
|
a.uid+'"] ~ h5>span>select[data-name="studies"]>option[value="'+a.studies+'"]');null!=b&&b.setAttribute("selected","selected");b=$('[data-sublink="phone"] article.mini-fiche-relation input[data-name="uid"][value="'+a.uid+'"] ~ h5>span>select[data-name="age"]>option[value="'+a.age+'"]');null!=b&&b.setAttribute("selected","selected");c=$$('[data-sublink="phone"] article.mini-fiche-relation input[data-name="uid"][value="'+a.uid+'"] ~ h5>input[type="radio"][data-name="sexe"]');for(b=0;b<c.length;b++)c[b].value==
|
||||||
for(b=0;b<c.length;b++)c[b].value==a.reltype?c[b].setAttribute("checked","checked"):c[b].removeAttribute("checked");c=$$('[data-sublink="phone"] article.mini-fiche-relation input[data-name="uid"][value="'+a.uid+'"] ~ h5>input[type="radio"][data-name="loc"]');for(b=0;b<c.length;b++)c[b].value==a.loc?c[b].setAttribute("checked","checked"):c[b].removeAttribute("checked");b=$('[data-sublink="phone"] article.mini-fiche-relation input[data-name="uid"][value="'+a.uid+'"] ~ h5>input[type="checkbox"][data-name="unknown"]');
|
a.sexe?c[b].setAttribute("checked","checked"):c[b].removeAttribute("checked");c=$$('[data-sublink="phone"] article.mini-fiche-relation input[data-name="uid"][value="'+a.uid+'"] ~ h5>input[type="radio"][data-name="reltype"]');for(b=0;b<c.length;b++)c[b].value==a.reltype?c[b].setAttribute("checked","checked"):c[b].removeAttribute("checked");c=$$('[data-sublink="phone"] article.mini-fiche-relation input[data-name="uid"][value="'+a.uid+'"] ~ h5>input[type="radio"][data-name="loc"]');for(b=0;b<c.length;b++)c[b].value==
|
||||||
null!=b&&a.unknown&&b.setAttribute("checked","checked")};inputPhoneMini.prototype.storageToFields=function(){console.log("MINI FICHE: STORAGE TO FIELDS");var a=lsi.get("p_mini-fiches",this.selected);if(null==a)return this.updateNavBar(),!1;this.container.innerHTML="";this.add(a);this.updateNavBar()};
|
a.loc?c[b].setAttribute("checked","checked"):c[b].removeAttribute("checked");b=$('[data-sublink="phone"] article.mini-fiche-relation input[data-name="uid"][value="'+a.uid+'"] ~ h5>input[type="checkbox"][data-name="unknown"]');null!=b&&a.unknown&&b.setAttribute("checked","checked")};
|
||||||
|
inputPhoneMini.prototype.storageToFields=function(){console.log("MINI FICHE: STORAGE TO FIELDS");var a=lsi.get("p_mini-fiches",this.selected);if(null==a)return this.updateNavBar(),!1;this.container.innerHTML="";this.add(a);this.updateNavBar()};
|
||||||
inputPhoneMini.prototype.sync=function(){console.log("MINI FICHE: SYNC");var a=lsi["export"]("p_contacts"),b=lsi["export"]("p_fiches"),c=[],d;for(d in b)-1==c.indexOf(b[d].contact)&&c.push(b[d].contact);for(var e in a)-1<c.indexOf(parseInt(e))?lsi.del("p_mini-fiches",e):(b=0==a[e].username.length?e.toString()+"-":e,d=lsi.get("p_mini-fiches",b),null==d&&(d=this.defaultData,d.valid=!1,isNaN(b)&&(d.reltype="9")),d.uid=parseInt(e),lsi.set("p_mini-fiches",b,d));d=lsi["export"]("p_mini-fiches");if(null==
|
inputPhoneMini.prototype.sync=function(){console.log("MINI FICHE: SYNC");var a=lsi["export"]("p_contacts"),b=lsi["export"]("p_fiches"),c=[],d;for(d in b)-1==c.indexOf(b[d].contact)&&c.push(b[d].contact);for(var e in a)-1<c.indexOf(parseInt(e))?lsi.del("p_mini-fiches",e):(b=0==a[e].username.length?e.toString()+"-":e,d=lsi.get("p_mini-fiches",b),null==d&&(d=this.defaultData,d.valid=!1,isNaN(b)&&(d.reltype="9")),d.uid=parseInt(e),lsi.set("p_mini-fiches",b,d));d=lsi["export"]("p_mini-fiches");if(null==
|
||||||
d[this.selected])for(e in d)if(!isNaN(e)){this.selected=parseInt(e);break}};inputPhoneMini.prototype.nav=function(a){if(null==a||!1===a.getData("n")||isNaN(a.getData("n"))||"p_nav-mini"!=a.parentNode.id)return!1;for(var b=$$('[data-sublink="phone"] #p_nav-mini > span.active'),c=0;c<b.length;c++)b[c].remClass("active");a.addClass("active");this.selected=parseInt(a.getData("n"))};
|
d[this.selected])for(e in d)if(!isNaN(e)){this.selected=parseInt(e);break}};inputPhoneMini.prototype.nav=function(a){if(null==a||!1===a.getData("n")||isNaN(a.getData("n"))||"p_nav-mini"!=a.parentNode.id)return!1;for(var b=$$('[data-sublink="phone"] #p_nav-mini > span.active'),c=0;c<b.length;c++)b[c].remClass("active");a.addClass("active");this.selected=parseInt(a.getData("n"))};
|
||||||
inputPhoneMini.prototype.updateNavBar=function(){var a=lsi["export"]("p_mini-fiches");this.nav_container.innerHTML="";var b=0,c;for(c in a)isNaN(c)||(this.nav_container.innerHTML+='<span data-n="'+c+'">'+ ++b+"</span>");for(c in a)isNaN(c)||(b=$('[data-sublink="phone"] #p_nav-mini [data-n="'+a[c].uid+'"]'),null!=b&&(!0===a[c].valid?b.addClass("done"):b.remClass("done")));this.nav($('[data-sublink="phone"] #p_nav-mini [data-n="'+this.selected+'"]'))};
|
inputPhoneMini.prototype.updateNavBar=function(){var a=lsi["export"]("p_mini-fiches");this.nav_container.innerHTML="";var b=0,c;for(c in a)isNaN(c)||(this.nav_container.innerHTML+='<span data-n="'+c+'">'+ ++b+"</span>");for(c in a)isNaN(c)||(b=$('[data-sublink="phone"] #p_nav-mini [data-n="'+a[c].uid+'"]'),null!=b&&(!0===a[c].valid?b.addClass("done"):b.remClass("done")));this.nav($('[data-sublink="phone"] #p_nav-mini [data-n="'+this.selected+'"]'))};
|
||||||
|
|
|
@ -130,6 +130,34 @@ inputPhoneMini.prototype.add = function(objectData){
|
||||||
if( associatedContact === false )
|
if( associatedContact === false )
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
// {2} Si lié à un contact d'une autre étude, on utilise ses informations //
|
||||||
|
if( !isNaN(associatedContact.existing) ){
|
||||||
|
var existingData = lsi.get('p_friends', associatedContact.existing);
|
||||||
|
|
||||||
|
// On récupère les données communes
|
||||||
|
associatedContact.username = existingData.name;
|
||||||
|
objectData.age = existingData.age;
|
||||||
|
objectData.sexe = existingData.sexe;
|
||||||
|
objectData.loc = existingData.dist;
|
||||||
|
|
||||||
|
// Si valeur
|
||||||
|
if( !isNaN(existingData.reltype) ){
|
||||||
|
objectData.reltype = existingData.reltype;
|
||||||
|
objectData.reltypeSpecial = '';
|
||||||
|
|
||||||
|
// Si extra
|
||||||
|
}else{
|
||||||
|
objectData.reltype = 10;
|
||||||
|
objectData.reltypeSpecial = existingData.reltype;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Si données de mini //
|
||||||
|
if( existingData.studies1 != null )
|
||||||
|
objectData.studies = existingData.studies1;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// {2} Création physique //
|
// {2} Création physique //
|
||||||
this.container.innerHTML += pMiniFicheBuilder.build({
|
this.container.innerHTML += pMiniFicheBuilder.build({
|
||||||
|
|
|
@ -2,8 +2,9 @@ var sField=$("#search-field"),sSubmit=$("#search-subject"),sList=$('section[data
|
||||||
sSubmit.addEventListener("click",function(b){api.send({path:"subject/search",name:sField.value},function(a){if(0!=a.ModuleError)return Notification.error("Erreur","La recherche a \u00e9chou\u00e9."),!1;console.log(a);var e="",b;for(b in a.results)e+="<li data-element data-id='"+b+"'>",e+="<div data-user><span>SUJET</span></div>",e+="<div> <span><input type='text' readonly style='text-align: center' onclick='this.select()' class='flag' value='"+b+"'></span> </div>",e+="<div> <span data-prefix='Nom'>"+
|
sSubmit.addEventListener("click",function(b){api.send({path:"subject/search",name:sField.value},function(a){if(0!=a.ModuleError)return Notification.error("Erreur","La recherche a \u00e9chou\u00e9."),!1;console.log(a);var e="",b;for(b in a.results)e+="<li data-element data-id='"+b+"'>",e+="<div data-user><span>SUJET</span></div>",e+="<div> <span><input type='text' readonly style='text-align: center' onclick='this.select()' class='flag' value='"+b+"'></span> </div>",e+="<div> <span data-prefix='Nom'>"+
|
||||||
a.results[b].name+"</span> </div>",e+="<div> <span data-prefix='Cr\u00e9ation'>"+a.results[b].creation+"</span> </div>",e+="<div> <span><input type='checkbox' id='s_"+b+"' "+(null!=a.results[b].phone?"checked":"")+" disabled><label for='s_"+b+"'>Cellulaire</label>",e+="</span> </div>",e+="<div> <span><input type='checkbox' id='s_"+b+"' "+(null!=a.results[b].facebook?"checked":"")+" disabled><label for='s_"+b+"'>Facebook</label>",e+="</span> </div>",e+="</li>";sList.innerHTML=e})},!1);
|
a.results[b].name+"</span> </div>",e+="<div> <span data-prefix='Cr\u00e9ation'>"+a.results[b].creation+"</span> </div>",e+="<div> <span><input type='checkbox' id='s_"+b+"' "+(null!=a.results[b].phone?"checked":"")+" disabled><label for='s_"+b+"'>Cellulaire</label>",e+="</span> </div>",e+="<div> <span><input type='checkbox' id='s_"+b+"' "+(null!=a.results[b].facebook?"checked":"")+" disabled><label for='s_"+b+"'>Facebook</label>",e+="</span> </div>",e+="</li>";sList.innerHTML=e})},!1);
|
||||||
var pSubjectManager,pContactManager,pMiniManager,pFicheManager,pMatriceManager;
|
var pSubjectManager,pContactManager,pMiniManager,pFicheManager,pMatriceManager;
|
||||||
function pDynamicUpdate(b){var a=b instanceof Element,e=a&&"INPUT"==b.tagName&&"submit"==b.type,g=a&&"SPAN"==b.tagName&&("p_nav-mini"==b.parentNode.id||"p_nav-fiche"==b.parentNode.id),c=a&&"SPAN"==b.tagName&&"p_nav-contact"==b.parentNode.id;if(!e&&!g&&!c&&!0!==b)return!1;console.log("> dynamic update");pMiniManager.fieldsToStorage();pFicheManager.fieldsToStorage();pContactManager.fieldsToStorage();pMatriceManager.fieldsToStorage();pFicheManager.sync();pMiniManager.sync();api.send({path:"subject/getFriends",
|
function pDynamicUpdate(b){var a=b instanceof Element,e=a&&"INPUT"==b.tagName&&"submit"==b.type,g=a&&"SPAN"==b.tagName&&("p_nav-mini"==b.parentNode.id||"p_nav-fiche"==b.parentNode.id),c=a&&"SPAN"==b.tagName&&"p_nav-contact"==b.parentNode.id;if(!e&&!g&&!c&&!0!==b)return!1;console.log("> dynamic update");pMiniManager.fieldsToStorage();pFicheManager.fieldsToStorage();pContactManager.fieldsToStorage();pMatriceManager.fieldsToStorage();pFicheManager.sync();pMiniManager.sync();!0===b?api.send({path:"subject/getFriends",
|
||||||
subject_id:pSubjectManager.subject_id.value},function(a){if(0!=a.ModuleError)return!1;console.warn("> existing contacts loaded");lsi["import"]("p_friends",a.subjects);pMiniManager.storageToFields();pFicheManager.storageToFields();pMatriceManager.storageToFields();(e||c)&&pContactManager.storageToFields()})}var fSubjectManager,fContactManager,fMiniManager,fFicheManager,fMatriceManager;
|
subject_id:pSubjectManager.subject_id.value},function(a){if(0!=a.ModuleError)return!1;console.warn("> existing contacts loaded");lsi["import"]("p_friends",a.subjects);pMiniManager.storageToFields();pFicheManager.storageToFields();pMatriceManager.storageToFields();(e||c)&&pContactManager.storageToFields()}):(pMiniManager.storageToFields(),pFicheManager.storageToFields(),pMatriceManager.storageToFields(),(e||c)&&pContactManager.storageToFields())}
|
||||||
|
var fSubjectManager,fContactManager,fMiniManager,fFicheManager,fMatriceManager;
|
||||||
function fDynamicUpdate(b){var a=b instanceof Element,e=a&&"INPUT"==b.tagName&&"submit"==b.type,g=a&&"SPAN"==b.tagName&&("f_nav-mini"==b.parentNode.id||"f_nav-fiche"==b.parentNode.id),a=a&&"SPAN"==b.tagName&&"f_nav-contact"==b.parentNode.id;if(!e&&!g&&!a&&!0!==b)return!1;console.log("> dynamic update");fMiniManager.fieldsToStorage();fFicheManager.fieldsToStorage();fContactManager.fieldsToStorage();fMatriceManager.fieldsToStorage();fFicheManager.sync();fMiniManager.sync();fMiniManager.storageToFields();
|
function fDynamicUpdate(b){var a=b instanceof Element,e=a&&"INPUT"==b.tagName&&"submit"==b.type,g=a&&"SPAN"==b.tagName&&("f_nav-mini"==b.parentNode.id||"f_nav-fiche"==b.parentNode.id),a=a&&"SPAN"==b.tagName&&"f_nav-contact"==b.parentNode.id;if(!e&&!g&&!a&&!0!==b)return!1;console.log("> dynamic update");fMiniManager.fieldsToStorage();fFicheManager.fieldsToStorage();fContactManager.fieldsToStorage();fMatriceManager.fieldsToStorage();fFicheManager.sync();fMiniManager.sync();fMiniManager.storageToFields();
|
||||||
fFicheManager.storageToFields();fMatriceManager.storageToFields();(e||a)&&fContactManager.storageToFields()}
|
fFicheManager.storageToFields();fMatriceManager.storageToFields();(e||a)&&fContactManager.storageToFields()}
|
||||||
include("/js/includes/input-phone-subject-min.js",function(){include("/js/includes/input-phone-contact.js",function(){include("/js/includes/input-phone-mini.js",function(){include("/js/includes/input-phone-fiche-min.js",function(){include("/js/includes/input-phone-matrice-min.js",function(){pSubjectManager=new inputPhoneSubject($('[data-sublink="phone"] article.subject-panel [data-name="tmp_id"]'),$('[data-sublink="phone"] article.subject-panel [data-name="subject_id"]'),$('[data-sublink="phone"] article.subject-panel [data-name="submit"]'));
|
include("/js/includes/input-phone-subject-min.js",function(){include("/js/includes/input-phone-contact.js",function(){include("/js/includes/input-phone-mini.js",function(){include("/js/includes/input-phone-fiche-min.js",function(){include("/js/includes/input-phone-matrice-min.js",function(){pSubjectManager=new inputPhoneSubject($('[data-sublink="phone"] article.subject-panel [data-name="tmp_id"]'),$('[data-sublink="phone"] article.subject-panel [data-name="subject_id"]'),$('[data-sublink="phone"] article.subject-panel [data-name="submit"]'));
|
||||||
|
|
|
@ -114,15 +114,29 @@ function pDynamicUpdate(target){
|
||||||
pMiniManager.sync();
|
pMiniManager.sync();
|
||||||
|
|
||||||
/* (7) On récupère tous les amis du sujet */
|
/* (7) On récupère tous les amis du sujet */
|
||||||
api.send({ path: 'subject/getFriends', subject_id: pSubjectManager.subject_id.value }, function(response){
|
if( target === true ){
|
||||||
// Si erreur, on quitte
|
api.send({ path: 'subject/getFriends', subject_id: pSubjectManager.subject_id.value }, function(response){
|
||||||
if( response.ModuleError != 0 )
|
// Si erreur, on quitte
|
||||||
return false;
|
if( response.ModuleError != 0 )
|
||||||
|
return false;
|
||||||
|
|
||||||
// On enregistre les contacts existants
|
// On enregistre les contacts existants
|
||||||
console.warn('> existing contacts loaded');
|
console.warn('> existing contacts loaded');
|
||||||
lsi.import('p_friends', response.subjects);
|
lsi.import('p_friends', response.subjects);
|
||||||
|
|
||||||
|
/* (8) On affiche le tout */
|
||||||
|
pMiniManager.storageToFields();
|
||||||
|
pFicheManager.storageToFields();
|
||||||
|
pMatriceManager.storageToFields();
|
||||||
|
|
||||||
|
/* (8) On met à jour les contacts si on les a modifié on si on navigue dans les contacts */
|
||||||
|
if( isSaveButton || isNavContact )
|
||||||
|
pContactManager.storageToFields();
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
}else{
|
||||||
/* (8) On affiche le tout */
|
/* (8) On affiche le tout */
|
||||||
pMiniManager.storageToFields();
|
pMiniManager.storageToFields();
|
||||||
pFicheManager.storageToFields();
|
pFicheManager.storageToFields();
|
||||||
|
@ -131,8 +145,7 @@ function pDynamicUpdate(target){
|
||||||
/* (8) On met à jour les contacts si on les a modifié on si on navigue dans les contacts */
|
/* (8) On met à jour les contacts si on les a modifié on si on navigue dans les contacts */
|
||||||
if( isSaveButton || isNavContact )
|
if( isSaveButton || isNavContact )
|
||||||
pContactManager.storageToFields();
|
pContactManager.storageToFields();
|
||||||
|
}
|
||||||
});
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue