Gestion de la réutilisation des données de contacts existants avec les 'fiches':

This commit is contained in:
xdrm-brackets 2016-05-29 17:51:06 +02:00
parent 678d7d0408
commit f7ada6418c
7 changed files with 7618 additions and 890 deletions

View File

@ -4,15 +4,16 @@ city:c.city,quartier:c.quartier,cp:c.cp,loc:c.loc,duration:c.duration,context:c.
inputPhoneFiche.prototype.add=function(a){console.log("FICHE: ADD");if(null==a.uid||isNaN(a.uid)||null==a.contact||isNaN(a.contact))return!1;a.city=null!=a.city?a.city:this.defaultData.city;a.quartier=null!=a.quartier?a.quartier:this.defaultData.quartier;a.cp=null!=a.cp?a.cp:this.defaultData.cp;a.duration[0]=null!=a.duration[0]?a.duration[0]:this.defaultData.duration[0];a.duration[1]=null!=a.duration[1]?a.duration[1]:this.defaultData.duration[1];a.reltypeSpecial=null!=a.reltypeSpecial?a.reltypeSpecial:
this.defaultData.reltypeSpecial;a.contextSpecial[0]=null!=a.contextSpecial[0]?a.contextSpecial[0]:this.defaultData.contextSpecial[0];a.contextSpecial[1]=null!=a.contextSpecial[1]?a.contextSpecial[1]:this.defaultData.contextSpecial[1];a.contextSpecial[2]=null!=a.contextSpecial[2]?a.contextSpecial[2]:this.defaultData.contextSpecial[2];a.connectSpecial[0]=null!=a.connectSpecial[0]?a.connectSpecial[0]:this.defaultData.connectSpecial[0];a.connectSpecial[1]=null!=a.connectSpecial[1]?a.connectSpecial[1]:
this.defaultData.connectSpecial[1];a.job=null!=a.job?a.job:this.defaultData.job;a.studies=null!=a.studies?a.studies:this.defaultData.studies;a.age=null!=a.age?a.age:this.defaultData.age;a.sexe=null!=a.sexe?a.sexe:this.defaultData.sexe;a.famsit=null!=a.famsit?a.famsit:this.defaultData.famsit;a.reltype=null!=a.reltype?a.reltype:this.defaultData.reltype;a.loc=null!=a.loc?a.loc:this.defaultData.loc;a.context=null!=a.context?a.context:this.defaultData.context;a.freq=null!=a.freq?a.freq:this.defaultData.freq;
a.connect=null!=a.connect?a.connect:this.defaultData.connect;var b=lsi.get("p_contacts",a.contact);if(!1===b)return!1;this.container.innerHTML+=pFicheBuilder.build({name:b.username,countcall:b.countcall,countsms:b.countsms,uid:a.uid,contact:a.contact,city:a.city,quartier:a.quartier,cp:a.cp,duration0:a.duration[0],duration1:a.duration[1],reltypespecial:a.reltypeSpecial,contextspecial0:a.contextSpecial[0],contextspecial1:a.contextSpecial[1],contextspecial2:a.contextSpecial[2],connectspecial0:a.connectSpecial[0],
a.connect=null!=a.connect?a.connect:this.defaultData.connect;var b=lsi.get("p_contacts",a.contact);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.studies2&&(a.job=c.job,a.famsit=c.famsit,a.city=c.city,a.cp=c.cp,a.quartier=c.quartier,a.duration[0]=c.duration[0],a.duration[1]=c.duration[1],a.context=c.context,
a.contextSpecial=c.contextExtra,a.connect=c.connect,a.connectSpecial=c.connectExtra,a.freq=c.freq,a.studies=c.studies2)}this.container.innerHTML+=pFicheBuilder.build({name:b.username,countcall:b.countcall,countsms:b.countsms,uid:a.uid,contact:a.contact,city:a.city,quartier:a.quartier,cp:a.cp,duration0:a.duration[0],duration1:a.duration[1],reltypespecial:a.reltypeSpecial,contextspecial0:a.contextSpecial[0],contextspecial1:a.contextSpecial[1],contextspecial2:a.contextSpecial[2],connectspecial0:a.connectSpecial[0],
connectspecial1:a.connectSpecial[1]});b=$('[data-sublink="phone"] article.fiche-relation input[data-name="uid"][value="'+a.uid+'"] ~ h5>span>select[data-name="job"]>option[value="'+a.job+'"]');null!=b&&b.setAttribute("selected","selected");b=$('[data-sublink="phone"] article.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.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.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.fiche-relation input[data-name="uid"][value="'+a.uid+'"] ~ h5>input[type="radio"][data-name="famsit"]');
a.uid+'"] ~ h5>span>select[data-name="age"]>option[value="'+a.age+'"]');null!=b&&b.setAttribute("selected","selected");c=$$('[data-sublink="phone"] article.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==a.sexe?c[b].setAttribute("checked","checked"):c[b].removeAttribute("checked");c=$$('[data-sublink="phone"] article.fiche-relation input[data-name="uid"][value="'+a.uid+'"] ~ h5>input[type="radio"][data-name="famsit"]');
for(b=0;b<c.length;b++)c[b].value==a.famsit?c[b].setAttribute("checked","checked"):c[b].removeAttribute("checked");c=$$('[data-sublink="phone"] article.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.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");c=$$('[data-sublink="phone"] article.fiche-relation input[data-name="uid"][value="'+a.uid+'"] ~ h5>input[type="radio"][data-name="context"]');for(b=0;b<c.length;b++)c[b].value==a.context?c[b].setAttribute("checked","checked"):c[b].removeAttribute("checked");c=$$('[data-sublink="phone"] article.fiche-relation input[data-name="uid"][value="'+a.uid+'"] ~ h5>input[type="radio"][data-name="freq"]');
for(b=0;b<c.length;b++)-1<a.freq.indexOf(c[b].value)?c[b].setAttribute("checked","checked"):c[b].removeAttribute("checked");c=$$('[data-sublink="phone"] article.fiche-relation input[data-name="uid"][value="'+a.uid+'"] ~ h5>input[type="radio"][data-name="connect"]');for(b=0;b<c.length;b++)-1<a.connect.indexOf(c[b].value)?c[b].setAttribute("checked","checked"):c[b].removeAttribute("checked")};
inputPhoneFiche.prototype.storageToFields=function(){console.log("FICHE: STORAGE TO FIELDS");var a=lsi["export"]("p_fiches");this.container.innerHTML="";for(var b in a)a[b].uid==this.selected&&this.add(a[b]);this.updateNavBar()};
inputPhoneFiche.prototype.sync=function(){console.log("FICHE: SYNC");var a=lsi["export"]("p_contacts"),b=[],c;for(c in a){if(-1<a[c].call){var e=a[c].call;b.push(e);var d=lsi.get("p_fiches",e);null==d&&(d=this.defaultData);d.uid=e;d.contact=parseInt(c);lsi.set("p_fiches",e,d)}-1<a[c].sms&&(e=10+a[c].sms,b.push(e),d=lsi.get("p_fiches",e),null==d&&(d=this.defaultData),d.uid=e,d.contact=parseInt(c),lsi.set("p_fiches",e,d))}e=20>lsi.keys("p_contacts").length?lsi.keys("p_contacts").length:20;if(b.length<
e)for(c in a){for(a=0;-1<b.indexOf(a)&&a<e;)a++;b.push(a);d=lsi.get("p_fiches",a);null==d&&(d=this.defaultData);d.uid=a;d.contact=parseInt(c);lsi.set("p_fiches",a,d);if(b.length>=e)break}var d=lsi["export"]("p_fiches"),f;for(f in d)b=lsi.get("p_contacts",d[f].contact),null!=b&&-1!=b.sms&&-1!=b.call&&(b=10>parseInt(f)?10+b.sms:b.call,b=d[b],b.timestamp>=d[f].timestamp||(c=d[f],c.uid=b.uid,lsi.set("p_fiches",b.uid,c)))};
e)for(c in a){for(a=0;-1<b.indexOf(a)&&a<e;)a++;b.push(a);d=lsi.get("p_fiches",a);null==d&&(d=this.defaultData);d.uid=a;d.contact=parseInt(c);lsi.set("p_fiches",a,d);if(b.length>=e)break}var d=lsi["export"]("p_fiches"),f;for(f in d)b=lsi.get("p_contacts",d[f].contact),null!=b&&-1!=b.sms&&-1!=b.call&&(b=10>parseInt(f)?10+b.sms:b.call,b=d[b],null==b||b.timestamp>=d[f].timestamp||(c=d[f],c.uid=b.uid,lsi.set("p_fiches",b.uid,c)))};
inputPhoneFiche.prototype.nav=function(a){if(null==a||!1===a.getData("n")||isNaN(a.getData("n"))||"p_nav-fiche"!=a.parentNode.id)return!1;for(var b=$$('[data-sublink="phone"] #p_nav-fiche > span.active'),c=0;c<b.length;c++)b[c].remClass("active");a.addClass("active");this.selected=parseInt(a.getData("n"))};
inputPhoneFiche.prototype.updateNavBar=function(){var a=lsi["export"]("p_fiches");this.nav_container.innerHTML="";for(var b=Object.keys(a),c=0;c<b.length;c++){var e=parseInt(b[c]);0==e&&(this.nav_container.innerHTML+="<span>APPELS</span>");10>e&&c<b.length-1&&10<=b[c+1]?this.nav_container.innerHTML+='<span data-n="'+e+'" class="lc">'+(e%10+1)+"</span>&nbsp;&nbsp;":(10==e&&(this.nav_container.innerHTML+='<span class="fc">SMS</span>'),this.nav_container.innerHTML+='<span data-n="'+e+'">'+(e%10+1)+"</span>")}for(var d in a)b=
$('[data-sublink="phone"] #p_nav-fiche [data-n="'+a[d].uid+'"]'),null!=b&&(!0===a[d].valid?b.addClass("done"):b.remClass("done"));this.nav($('[data-sublink="phone"] #p_nav-fiche [data-n="'+this.selected+'"]'))};

View File

@ -168,6 +168,47 @@ inputPhoneFiche.prototype.add = function(objectData){
if( associatedContact === 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;
// DISTANCE (LOC) : Si valeur
if( !isNaN(existingData.reltype) ){
objectData.reltype = existingData.reltype;
objectData.reltypeSpecial = '';
// DISTANCE (LOC) : Si extra
}else{
objectData.reltype = 10;
objectData.reltypeSpecial = existingData.reltype;
}
// On met à jour les études uniquement si 'studies2' est défini //
if( existingData.studies2 != null ){
objectData.job = existingData.job;
objectData.famsit = existingData.famsit;
objectData.city = existingData.city;
objectData.cp = existingData.cp;
objectData.quartier = existingData.quartier;
objectData.duration[0] = existingData.duration[0];
objectData.duration[1] = existingData.duration[1];
objectData.context = existingData.context;
objectData.contextSpecial = existingData.contextExtra;
objectData.connect = existingData.connect;
objectData.connectSpecial = existingData.connectExtra;
objectData.freq = existingData.freq;
objectData.studies = existingData.studies2;
}
}
// {5} Création physique //
this.container.innerHTML += pFicheBuilder.build({
@ -424,7 +465,7 @@ inputPhoneFiche.prototype.sync = function(){
/* (4) Si le clone a été modifié en dernier, on ne fait rien */
if( clone.timestamp >= ficheData[key].timestamp )
if( clone == null || clone.timestamp >= ficheData[key].timestamp )
continue;
/* (5) On copie les données de la FICHE dans le clone (cas ou la fiche est modifiée en dernier) */

View File

@ -130,6 +130,7 @@
'famsit' => $ficheData['famsit'],
'city' => $ficheData['city'],
'cp' => $ficheData['cp'],
'quartier' => $ficheData['quartier'],
'duration' => $ficheData['duration'],
'context' => $ficheData['context'],
'contextExtra' => $ficheData['contextSpecial'],

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

38
view/js/input-min.js vendored
View File

@ -2,18 +2,18 @@ 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'>"+
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;
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()}):(pMiniManager.storageToFields(),pFicheManager.storageToFields(),pMatriceManager.storageToFields(),(e||c)&&pContactManager.storageToFields())}
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),a=a&&"SPAN"==b.tagName&&"p_nav-contact"==b.parentNode.id;if(!e&&!g&&!a&&!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();pContactManager.storageToFields()}):(pMiniManager.storageToFields(),pFicheManager.storageToFields(),pMatriceManager.storageToFields(),(e||a)&&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();
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.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"]'));
pSubjectManager.attach(pDynamicUpdate);pContactManager=new inputPhoneContact($('[data-sublink="phone"] article.contact-panel'),$('[data-sublink="phone"] #p_nav-contact'));pContactManager.attach(pDynamicUpdate);pMiniManager=new inputPhoneMini($('[data-sublink="phone"] article.mini-relation-panel'),$('[data-sublink="phone"] #p_nav-mini'));pMiniManager.attach(pDynamicUpdate);pFicheManager=new inputPhoneFiche($('[data-sublink="phone"] article.relation-panel'),$('[data-sublink="phone"] #p_nav-fiche'));
pFicheManager.attach(pDynamicUpdate);pMatriceManager=new inputPhoneMatrice($('[data-sublink="phone"] article.matrice-panel'));pMatriceManager.attach(pDynamicUpdate);var b=new ShortcutManager;b.append("s+n+a+k+e",function(){pMatriceManager.snake()});b.listen();$('[data-sublink="phone"] input#p_call_log-import[type="file"]').addEventListener("click",function(a){a.target.value=null},!1);$('[data-sublink="phone"] input#p_call_log-import[type="file"]').addEventListener("change",function(a){api.send({path:"upload/call_log",
file:a.target.files[0]},function(a){console.log(a);var b=null;if(0!=a.ModuleError)9==a.ModuleError?Notification.error("Erreur","Il est n\u00e9cessaire de saisir les informations du <b>sujet</b> avant d'exporter son journal d'appel"):Notification.error("Erreur",a.ModuleError);else{b=Notification.info("Info","Chargement du journal d'appel");pSubjectManager.tmp_id.value=a.tmp_id;pSubjectManager.fieldsToStorage();pSubjectManager.storageToFields();for(var c=0;c<a.call.length;c++){var d=a.directory[a.call[c]];
lsi.set("p_contacts",d.id,{uid:d.id,number:d.number,username:d.name,countsms:d.sms,countcall:d.call,call:c,sms:-1})}for(c=0;c<a.sms.length;c++)if(d=a.directory[a.sms[c]],-1<a.call.indexOf(a.sms[c])){var f=lsi.get("p_contacts",d.id);f.sms=c;lsi.set("p_contacts",d.id,f)}else lsi.set("p_contacts",d.id,{uid:d.id,number:d.number,username:d.name,countsms:d.sms,countcall:d.call,call:-1,sms:c});for(var h in a.directory)h=parseInt(h),-1<a.call.indexOf(h)||-1<a.sms.indexOf(h)||(d=a.directory[h],lsi.set("p_contacts",
d.id,{uid:d.id,number:d.number,username:d.name,countsms:d.sms,countcall:d.call,call:-1,sms:-1}));pContactManager.storageToFields();pDynamicUpdate(!0);null!=b&&b.click();Notification.success("OK","Chargement termin\u00e9")}})},!1);$('[data-sublink="phone"] #p_clear-all').addEventListener("click",function(a){lsi.clear("p_subject");lsi.clear("p_contacts");lsi.clear("p_mini-fiches");lsi.clear("p_fiches");lsi.clear("p_matrice");pSubjectManager.storageToFields();pContactManager.storageToFields();pMiniManager.storageToFields();
pFicheManager.storageToFields();pMatriceManager.storageToFields();Notification.success("OK","Les donn\u00e9es ont \u00e9t\u00e9 supprim\u00e9es")},!1);$('[data-sublink="phone"] #p_export-all').addEventListener("click",function(a){Notification.info("INFORMATION","Lancement du t\u00e9l\u00e9chargement de la sauvegarde");a={subject:lsi["export"]("p_subject")[0],contacts:lsi["export"]("p_contacts"),mini:lsi["export"]("p_mini-fiches"),fiches:lsi["export"]("p_fiches"),matrice:lsi["export"]("p_matrice")[0]};
file:a.target.files[0]},function(a){console.log(a);var b=null;if(0!=a.ModuleError)9==a.ModuleError?Notification.error("Erreur","Il est n\u00e9cessaire de saisir les informations du <b>sujet</b> avant d'exporter son journal d'appel"):Notification.error("Erreur",a.ModuleError);else{b=Notification.info("Info","Chargement du journal d'appel");pSubjectManager.tmp_id.value=a.tmp_id;pSubjectManager.fieldsToStorage();pSubjectManager.storageToFields();for(var d=0;d<a.call.length;d++){var c=a.directory[a.call[d]];
lsi.set("p_contacts",c.id,{uid:c.id,number:c.number,username:c.name,countsms:c.sms,countcall:c.call,call:d,sms:-1})}for(d=0;d<a.sms.length;d++)if(c=a.directory[a.sms[d]],-1<a.call.indexOf(a.sms[d])){var f=lsi.get("p_contacts",c.id);f.sms=d;lsi.set("p_contacts",c.id,f)}else lsi.set("p_contacts",c.id,{uid:c.id,number:c.number,username:c.name,countsms:c.sms,countcall:c.call,call:-1,sms:d});for(var h in a.directory)h=parseInt(h),-1<a.call.indexOf(h)||-1<a.sms.indexOf(h)||(c=a.directory[h],lsi.set("p_contacts",
c.id,{uid:c.id,number:c.number,username:c.name,countsms:c.sms,countcall:c.call,call:-1,sms:-1}));pContactManager.storageToFields();pDynamicUpdate(!0);null!=b&&b.click();Notification.success("OK","Chargement termin\u00e9")}})},!1);$('[data-sublink="phone"] #p_clear-all').addEventListener("click",function(a){lsi.clear("p_subject");lsi.clear("p_contacts");lsi.clear("p_mini-fiches");lsi.clear("p_fiches");lsi.clear("p_matrice");lsi.clear("p_friends");pSubjectManager.storageToFields();pContactManager.storageToFields();
pMiniManager.storageToFields();pFicheManager.storageToFields();pMatriceManager.storageToFields();Notification.success("OK","Les donn\u00e9es ont \u00e9t\u00e9 supprim\u00e9es")},!1);$('[data-sublink="phone"] #p_export-all').addEventListener("click",function(a){Notification.info("INFORMATION","Lancement du t\u00e9l\u00e9chargement de la sauvegarde");a={subject:lsi["export"]("p_subject")[0],contacts:lsi["export"]("p_contacts"),mini:lsi["export"]("p_mini-fiches"),fiches:lsi["export"]("p_fiches"),matrice:lsi["export"]("p_matrice")[0]};
var b=$('[data-sublink="phone"] #p_download-target');b.download="local-phone-data.json";b.href="data:application/octet-stream,"+encodeURIComponent(JSON.stringify(a));b.click()},!1);$('[data-sublink="phone"] #p_import-all').addEventListener("click",function(a){$('[data-sublink="phone"] #p_local-upload').click()},!1);$('[data-sublink="phone"] #p_local-upload').addEventListener("click",function(a){a.target.value=null},!1);$('[data-sublink="phone"] #p_local-upload').addEventListener("change",function(a){a=
{path:"upload/local_data",file:$('[data-sublink="phone"] #p_local-upload').files[0]};api.send(a,function(a){console.log(a);if(0!=a.ModuleError)return Notification.error("Erreur",a.ModuleError),!1;lsi.set("p_subject",0,a.local_data.subject);lsi["import"]("p_contacts",a.local_data.contacts);lsi["import"]("p_mini-fiches",a.local_data.mini);lsi["import"]("p_fiches",a.local_data.fiches);lsi.set("p_matrice",0,a.local_data.matrice);pSubjectManager.storageToFields();pContactManager.storageToFields();pMatriceManager.storageToFields();
pDynamicUpdate(!0)})},!1);$('[data-sublink="phone"] #p_submit-all').addEventListener("click",function(a){console.log("> GATHERING ALL DATA");pSubjectManager.fieldsToStorage();pContactManager.fieldsToStorage();pMiniManager.fieldsToStorage();pFicheManager.fieldsToStorage();if(!pSubjectManager.check())return Notification.warning("Attention","Vous devez saisir les informations du <i>sujet</i>"),!1;a=lsi["export"]("p_mini-fiches");var b=0,g;for(g in a)if(!isNaN(g)&&(b++,!a[g].valid))return Notification.warning("Attention",
@ -28,15 +28,15 @@ api.send(b,function(a){console.log(a);if(0!=a.ModuleError)return Notification.er
function(b){console.log("> GATHERING ALL DATA");fSubjectManager.fieldsToStorage();fContactManager.fieldsToStorage();fMiniManager.fieldsToStorage();fFicheManager.fieldsToStorage();if(!fSubjectManager.check())return Notification.warning("Attention","Vous devez saisir les informations du <i>sujet</i>"),!1;b=lsi["export"]("f_mini-fiches");var a=0,e;for(e in b)if(!isNaN(e)&&(a++,!b[e].valid))return Notification.warning("Attention","La <i>fiche rapide</i> <b>"+a+"</b> est incompl\u00e8te et/ou incorrecte"),
!1;b=lsi["export"]("f_fiches");for(e in b)if(!b[e].valid)return Notification.warning("Attention","La <i>fiche compl\u00e8te</i> <b>"+(parseInt(e)+1)+"</b> est incompl\u00e8te et/ou incorrecte"),!1;e={path:"input/facebook",subject:lsi["export"]("f_subject")[0],contacts:lsi["export"]("f_contacts"),mini:lsi["export"]("f_mini-fiches"),fiches:lsi["export"]("f_fiches"),matrice:lsi["export"]("f_matrice")[0]};api.send(e,function(a){console.log(a);if(0!=a.ModuleError)return Notification.error("ERREUR",a.ModuleError),
!1;console.log(a)},!1)},!1)})})})})});
function testRoutinePhone(b){var a=lsi["export"]("p_contacts"),e=lsi["export"]("p_mini-fiches"),g=lsi["export"]("p_fiches"),c=0;if(null!=b&&b)for(var d in e)isNaN(d)||(b="",null!=a[d]&&(b=a[d].username),e=$('#p_nav-mini [data-n="'+d+'"]'),e.click(),$("#unknown_min_p_"+d).checked=0==b.length,0==b.length?($("#sexeI_mini_p_"+d).checked=!0,$('input[data-name="uid"][value="'+d+'"] ~ h5 select[data-name="age"]').value=c%19,$('input[data-name="uid"][value="'+d+'"] ~ h5 select[data-name="studies"]').value=0,
$("#reltype9_mini_p_"+d).checked=!0):(b=["H","F"][Math.floor(c%2)],$("#sexe"+b+"_mini_p_"+d).checked=!0,$('input[data-name="uid"][value="'+d+'"] ~ h5 select[data-name="age"]').value=c%19,$('input[data-name="uid"][value="'+d+'"] ~ h5 select[data-name="studies"]').value=1+c%6,b=c%10,9==b?($("#reltype10_mini_p_"+d).checked=!0,$('input[data-name="uid"][value="'+d+'"] ~ h5 input[data-name="reltypeSpecial"]').value="autre"):$("#reltype"+b+"_mini_p_"+d).checked=!0,c++));for(var f in g)isNaN(f)||(e=$('#p_nav-fiche [data-n="'+
f+'"]'),e.click(),b=["H","F","I"][Math.floor(c%3)],$("#sexe"+b+"_p_"+f).checked=!0,$('article.fiche-relation > input[data-name="uid"][value="'+f+'"] ~ h5 select[data-name="age"]').value=c%19,a="10 21 22 23 31 32 36 41 46 47 48 51 54 55 56 61 66 69 71 72 73 74 75 76 81 82".split(" "),a=a[c%a.length],$('article.fiche-relation > input[data-name="uid"][value="'+f+'"] ~ h5 select[data-name="job"]').value=a,a=(c%12).toString(),1==a.length&&(a="0"+a),$('article.fiche-relation > input[data-name="uid"][value="'+
f+'"] ~ h5 select[data-name="studies"]').value=a,b=c%9,8==b?($("#reltype10_p_"+f).checked=!0,$('article.fiche-relation > input[data-name="uid"][value="'+f+'"] ~ h5 input[data-name="reltypeSpecial"]').value="autre"):$("#reltype"+b+"_p_"+f).checked=!0,$('article.fiche-relation > input[data-name="uid"][value="'+f+'"] ~ h5 input[data-name="city"]').value=(10+c).toString(),$('article.fiche-relation > input[data-name="uid"][value="'+f+'"] ~ h5 input[data-name="cp"]').value=(1E4+c).toString(),$('article.fiche-relation > input[data-name="uid"][value="'+
f+'"] ~ h5 input[data-name="quartier"]').value=c,$("#loc"+["A","B","C","D"][Math.floor(c%4)]+"_p_"+f).checked=!0,a=$$('article.fiche-relation > input[data-name="uid"][value="'+f+'"] ~ h5 input[data-name="duration"]'),a[0].value=c.toString(),a[1].value=1+c.toString(),a=c%14,$("article.fiche-relation #contexte"+a+"_p_"+f).checked=!0,g=$$('article.fiche-relation > input[data-name="uid"][value="'+f+'"] ~ h5 input[data-name="contextSpecial"]'),11==a&&(g[0].value="internet"),12==a&&(g[1].value="association"),
13==a&&(g[2].value="autre"),c++)}
function testRoutineFacebook(b){var a=lsi["export"]("f_contacts"),e=lsi["export"]("f_mini-fiches"),g=lsi["export"]("f_fiches"),c=0;if(null!=b&&b)for(var d in e)isNaN(d)||(b="",null!=a[d]&&(b=a[d].username),e=$('#f_nav-mini [data-n="'+d+'"]'),e.click(),$("#unknown_min_f_"+d).checked=0==b.length,0==b.length?($("#sexeI_mini_f_"+d).checked=!0,$('input[data-name="uid"][value="'+d+'"] ~ h5 select[data-name="age"]').value=c%19,$('input[data-name="uid"][value="'+d+'"] ~ h5 select[data-name="studies"]').value=0,
$("#reltype9_mini_f_"+d).checked=!0):(b=["H","F"][Math.floor(c%2)],$("#sexe"+b+"_mini_f_"+d).checked=!0,$('input[data-name="uid"][value="'+d+'"] ~ h5 select[data-name="age"]').value=c%19,$('input[data-name="uid"][value="'+d+'"] ~ h5 select[data-name="studies"]').value=1+c%6,b=c%10,9==b?($("#reltype10_mini_f_"+d).checked=!0,$('input[data-name="uid"][value="'+d+'"] ~ h5 input[data-name="reltypeSpecial"]').value="autre"):$("#reltype"+b+"_mini_f_"+d).checked=!0,c++));for(var f in g)isNaN(f)||(e=$('#f_nav-fiche [data-n="'+
f+'"]'),e.click(),b=["H","F","I"][Math.floor(c%3)],$("#sexe"+b+"_f_"+f).checked=!0,$('section[data-sublink="facebook"] article.fiche-relation > input[data-name="uid"][value="'+f+'"] ~ h5 select[data-name="age"]').value=c%19,a="10 21 22 23 31 32 36 41 46 47 48 51 54 55 56 61 66 69 71 72 73 74 75 76 81 82".split(" "),a=a[c%a.length],$('section[data-sublink="facebook"] article.fiche-relation > input[data-name="uid"][value="'+f+'"] ~ h5 select[data-name="job"]').value=a,a=(c%12).toString(),1==a.length&&
(a="0"+a),$('section[data-sublink="facebook"] article.fiche-relation > input[data-name="uid"][value="'+f+'"] ~ h5 select[data-name="studies"]').value=a,b=c%9,8==b?($("#reltype10_f_"+f).checked=!0,$('section[data-sublink="facebook"] article.fiche-relation > input[data-name="uid"][value="'+f+'"] ~ h5 input[data-name="reltypeSpecial"]').value="autre"):$("#reltype"+b+"_f_"+f).checked=!0,$('section[data-sublink="facebook"] article.fiche-relation > input[data-name="uid"][value="'+f+'"] ~ h5 input[data-name="city"]').value=
(10+c).toString(),$('section[data-sublink="facebook"] article.fiche-relation > input[data-name="uid"][value="'+f+'"] ~ h5 input[data-name="cp"]').value=(1E4+c).toString(),$('section[data-sublink="facebook"] article.fiche-relation > input[data-name="uid"][value="'+f+'"] ~ h5 input[data-name="quartier"]').value=c,$("#loc"+["A","B","C","D"][Math.floor(c%4)]+"_f_"+f).checked=!0,a=$$('section[data-sublink="facebook"] article.fiche-relation > input[data-name="uid"][value="'+f+'"] ~ h5 input[data-name="duration"]'),
a[0].value=c.toString(),a[1].value=1+c.toString(),a=c%14,$('section[data-sublink="facebook"] article.fiche-relation #contexte'+a+"_f_"+f).checked=!0,g=$$('section[data-sublink="facebook"] article.fiche-relation > input[data-name="uid"][value="'+f+'"] ~ h5 input[data-name="contextSpecial"]'),11==a&&(g[0].value="internet"),12==a&&(g[1].value="association"),13==a&&(g[2].value="autre"),c++)};
function testRoutinePhone(b){var a=lsi["export"]("p_contacts"),e=lsi["export"]("p_mini-fiches"),g=lsi["export"]("p_fiches"),d=0;if(null!=b&&b)for(var c in e)isNaN(c)||(b="",null!=a[c]&&(b=a[c].username),e=$('#p_nav-mini [data-n="'+c+'"]'),e.click(),$("#unknown_min_p_"+c).checked=0==b.length,0==b.length?($("#sexeI_mini_p_"+c).checked=!0,$('input[data-name="uid"][value="'+c+'"] ~ h5 select[data-name="age"]').value=d%19,$('input[data-name="uid"][value="'+c+'"] ~ h5 select[data-name="studies"]').value=0,
$("#reltype9_mini_p_"+c).checked=!0):(b=["H","F"][Math.floor(d%2)],$("#sexe"+b+"_mini_p_"+c).checked=!0,$('input[data-name="uid"][value="'+c+'"] ~ h5 select[data-name="age"]').value=d%19,$('input[data-name="uid"][value="'+c+'"] ~ h5 select[data-name="studies"]').value=1+d%6,b=d%10,9==b?($("#reltype10_mini_p_"+c).checked=!0,$('input[data-name="uid"][value="'+c+'"] ~ h5 input[data-name="reltypeSpecial"]').value="autre"):$("#reltype"+b+"_mini_p_"+c).checked=!0,d++));for(var f in g)isNaN(f)||(e=$('#p_nav-fiche [data-n="'+
f+'"]'),e.click(),b=["H","F","I"][Math.floor(d%3)],$("#sexe"+b+"_p_"+f).checked=!0,$('article.fiche-relation > input[data-name="uid"][value="'+f+'"] ~ h5 select[data-name="age"]').value=d%19,a="10 21 22 23 31 32 36 41 46 47 48 51 54 55 56 61 66 69 71 72 73 74 75 76 81 82".split(" "),a=a[d%a.length],$('article.fiche-relation > input[data-name="uid"][value="'+f+'"] ~ h5 select[data-name="job"]').value=a,a=(d%12).toString(),1==a.length&&(a="0"+a),$('article.fiche-relation > input[data-name="uid"][value="'+
f+'"] ~ h5 select[data-name="studies"]').value=a,b=d%9,8==b?($("#reltype10_p_"+f).checked=!0,$('article.fiche-relation > input[data-name="uid"][value="'+f+'"] ~ h5 input[data-name="reltypeSpecial"]').value="autre"):$("#reltype"+b+"_p_"+f).checked=!0,$('article.fiche-relation > input[data-name="uid"][value="'+f+'"] ~ h5 input[data-name="city"]').value=(10+d).toString(),$('article.fiche-relation > input[data-name="uid"][value="'+f+'"] ~ h5 input[data-name="cp"]').value=(1E4+d).toString(),$('article.fiche-relation > input[data-name="uid"][value="'+
f+'"] ~ h5 input[data-name="quartier"]').value=d,$("#loc"+["A","B","C","D"][Math.floor(d%4)]+"_p_"+f).checked=!0,a=$$('article.fiche-relation > input[data-name="uid"][value="'+f+'"] ~ h5 input[data-name="duration"]'),a[0].value=d.toString(),a[1].value=1+d.toString(),a=d%14,$("article.fiche-relation #contexte"+a+"_p_"+f).checked=!0,g=$$('article.fiche-relation > input[data-name="uid"][value="'+f+'"] ~ h5 input[data-name="contextSpecial"]'),11==a&&(g[0].value="internet"),12==a&&(g[1].value="association"),
13==a&&(g[2].value="autre"),d++)}
function testRoutineFacebook(b){var a=lsi["export"]("f_contacts"),e=lsi["export"]("f_mini-fiches"),g=lsi["export"]("f_fiches"),d=0;if(null!=b&&b)for(var c in e)isNaN(c)||(b="",null!=a[c]&&(b=a[c].username),e=$('#f_nav-mini [data-n="'+c+'"]'),e.click(),$("#unknown_min_f_"+c).checked=0==b.length,0==b.length?($("#sexeI_mini_f_"+c).checked=!0,$('input[data-name="uid"][value="'+c+'"] ~ h5 select[data-name="age"]').value=d%19,$('input[data-name="uid"][value="'+c+'"] ~ h5 select[data-name="studies"]').value=0,
$("#reltype9_mini_f_"+c).checked=!0):(b=["H","F"][Math.floor(d%2)],$("#sexe"+b+"_mini_f_"+c).checked=!0,$('input[data-name="uid"][value="'+c+'"] ~ h5 select[data-name="age"]').value=d%19,$('input[data-name="uid"][value="'+c+'"] ~ h5 select[data-name="studies"]').value=1+d%6,b=d%10,9==b?($("#reltype10_mini_f_"+c).checked=!0,$('input[data-name="uid"][value="'+c+'"] ~ h5 input[data-name="reltypeSpecial"]').value="autre"):$("#reltype"+b+"_mini_f_"+c).checked=!0,d++));for(var f in g)isNaN(f)||(e=$('#f_nav-fiche [data-n="'+
f+'"]'),e.click(),b=["H","F","I"][Math.floor(d%3)],$("#sexe"+b+"_f_"+f).checked=!0,$('section[data-sublink="facebook"] article.fiche-relation > input[data-name="uid"][value="'+f+'"] ~ h5 select[data-name="age"]').value=d%19,a="10 21 22 23 31 32 36 41 46 47 48 51 54 55 56 61 66 69 71 72 73 74 75 76 81 82".split(" "),a=a[d%a.length],$('section[data-sublink="facebook"] article.fiche-relation > input[data-name="uid"][value="'+f+'"] ~ h5 select[data-name="job"]').value=a,a=(d%12).toString(),1==a.length&&
(a="0"+a),$('section[data-sublink="facebook"] article.fiche-relation > input[data-name="uid"][value="'+f+'"] ~ h5 select[data-name="studies"]').value=a,b=d%9,8==b?($("#reltype10_f_"+f).checked=!0,$('section[data-sublink="facebook"] article.fiche-relation > input[data-name="uid"][value="'+f+'"] ~ h5 input[data-name="reltypeSpecial"]').value="autre"):$("#reltype"+b+"_f_"+f).checked=!0,$('section[data-sublink="facebook"] article.fiche-relation > input[data-name="uid"][value="'+f+'"] ~ h5 input[data-name="city"]').value=
(10+d).toString(),$('section[data-sublink="facebook"] article.fiche-relation > input[data-name="uid"][value="'+f+'"] ~ h5 input[data-name="cp"]').value=(1E4+d).toString(),$('section[data-sublink="facebook"] article.fiche-relation > input[data-name="uid"][value="'+f+'"] ~ h5 input[data-name="quartier"]').value=d,$("#loc"+["A","B","C","D"][Math.floor(d%4)]+"_f_"+f).checked=!0,a=$$('section[data-sublink="facebook"] article.fiche-relation > input[data-name="uid"][value="'+f+'"] ~ h5 input[data-name="duration"]'),
a[0].value=d.toString(),a[1].value=1+d.toString(),a=d%14,$('section[data-sublink="facebook"] article.fiche-relation #contexte'+a+"_f_"+f).checked=!0,g=$$('section[data-sublink="facebook"] article.fiche-relation > input[data-name="uid"][value="'+f+'"] ~ h5 input[data-name="contextSpecial"]'),11==a&&(g[0].value="internet"),12==a&&(g[1].value="association"),13==a&&(g[2].value="autre"),d++)};

View File

@ -130,7 +130,6 @@ function pDynamicUpdate(target){
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();
});
@ -226,7 +225,7 @@ include('/js/includes/input-phone-subject-min.js', function(){
include('/js/includes/input-phone-contact.js', function(){
//TODO: Remettre version min
include('/js/includes/input-phone-mini.js', function(){
include('/js/includes/input-phone-fiche-min.js', function(){
include('/js/includes/input-phone-fiche.js', function(){
include('/js/includes/input-phone-matrice-min.js', function(){
@ -453,6 +452,7 @@ include('/js/includes/input-phone-matrice-min.js', function(){
lsi.clear('p_mini-fiches');
lsi.clear('p_fiches');
lsi.clear('p_matrice');
lsi.clear('p_friends');
/* (2) On met à jour l'affichage */