Gestion de la navigation séparée entre le top 10 des `appels` et le top 10 des `sms`

This commit is contained in:
xdrm-brackets 2016-05-03 17:19:54 +02:00
parent 0b70913b26
commit 7fffb72bea
16 changed files with 71 additions and 56 deletions

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -1,5 +1,5 @@
@import 'constants';
@import 'constants';
/* [1] Formulaire de type timeline /* [1] Formulaire de type timeline
=========================================================*/ =========================================================*/
#WRAPPER > #CONTAINER section[data-timeline]{ #WRAPPER > #CONTAINER section[data-timeline]{
@ -424,7 +424,7 @@
border: 1px solid darken(#d8e0e9, 10); border: 1px solid darken(#d8e0e9, 10);
// Pas de rebord droite sauf si dernier // Pas de rebord droite sauf si dernier
&:not(:last-child){ &:not(:last-child):not(.lc){
border-right: 0; border-right: 0;
} }
@ -435,8 +435,13 @@
@include transition( .2s ease-in-out ); @include transition( .2s ease-in-out );
&:first-child{ border-top-left-radius: 5px; border-bottom-left-radius: 5px; } // Arrondi pour premier
&:last-child{ border-top-right-radius: 5px; border-bottom-right-radius: 5px; } &:first-child,
&.fc{ border-top-left-radius: 5px; border-bottom-left-radius: 5px; }
// Arrondi pour dernier
&:last-child,
&.lc{ border-top-right-radius: 5px; border-bottom-right-radius: 5px; }
// Animation quand la page est validée // Animation quand la page est validée
&.done{ &.done{

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -2,8 +2,7 @@ function inputPhoneContact(a,c){this.container=a;this.nav_container=c}inputPhone
inputPhoneContact.prototype.fieldsToStorage=function(){console.log("CONTACTS: FIELDS TO STORAGE");for(var a=$$("article.contact-panel .new-contact"),c=0;c<a.length;c++){var b=(new FormDeflater(a[c],["input"],["data-name"])).deflate(),d=0<b.number.value.length;if(d=d&&0<b.username.value.length+b.firstname.value.length+b.lastname.value.length)d={uid:parseInt(b.uid.value),number:b.number.value,username:b.username.value,firstname:b.firstname.value,lastname:b.lastname.value,call:parseInt(b.call.value), inputPhoneContact.prototype.fieldsToStorage=function(){console.log("CONTACTS: FIELDS TO STORAGE");for(var a=$$("article.contact-panel .new-contact"),c=0;c<a.length;c++){var b=(new FormDeflater(a[c],["input"],["data-name"])).deflate(),d=0<b.number.value.length;if(d=d&&0<b.username.value.length+b.firstname.value.length+b.lastname.value.length)d={uid:parseInt(b.uid.value),number:b.number.value,username:b.username.value,firstname:b.firstname.value,lastname:b.lastname.value,call:parseInt(b.call.value),
sms:parseInt(b.sms.value)},d.hash=crc32(JSON.stringify(d)),lsi.set("contacts",parseInt(b.uid.value),d)}}; sms:parseInt(b.sms.value)},d.hash=crc32(JSON.stringify(d)),lsi.set("contacts",parseInt(b.uid.value),d)}};
inputPhoneContact.prototype.add=function(a){console.log("CONTACTS: ADD");if(null==a.uid||"number"!=typeof a.uid)return!1;a.number=null!=a.number?a.number:"";a.username=null!=a.username?a.username:"";a.firstname=null!=a.firstname?a.firstname:"";a.lastname=null!=a.lastname?a.lastname:"";a.call=null!=a.call?a.call:-1;a.sms=null!=a.sms?a.sms:-1;this.container.innerHTML+=contactBuilder.build(a);a=$$("article.contact-panel .new-contact");for(var c=this,b=0;b<a.length;b++)a[b].removeEventListener("click", inputPhoneContact.prototype.add=function(a){console.log("CONTACTS: ADD");if(null==a.uid||"number"!=typeof a.uid)return!1;a.number=null!=a.number?a.number:"";a.username=null!=a.username?a.username:"";a.firstname=null!=a.firstname?a.firstname:"";a.lastname=null!=a.lastname?a.lastname:"";a.call=null!=a.call?a.call:-1;a.sms=null!=a.sms?a.sms:-1;this.container.innerHTML+=contactBuilder.build(a);a=$$("article.contact-panel .new-contact");for(var c=this,b=0;b<a.length;b++)a[b].removeEventListener("click",
function(a){c.nav(a.target);c.handler(a.target)},!1),a[b].addEventListener("click",function(a){c.nav(a.target);c.handler(a.target)},!1)}; function(a){c.nav(a.target);c.handler(a.target)},!1),a[b].addEventListener("click",function(a){c.nav(a.target);c.handler(a.target)},!1)};inputPhoneContact.prototype.storageToFields=function(){console.log("CONTACTS: STORAGE TO FIELDS");var a=lsi.keys("contacts");this.container.innerHTML="";for(var c=this.selected+10,b=this.selected;b<c&&b<a.length;b++)this.add(lsi.get("contacts",a[b]));c>=a.length&&this.add({uid:a.length,number:"",firstname:"",lastname:"",username:"",call:-1,sms:-1});this.updateNavBar()};
inputPhoneContact.prototype.storageToFields=function(){console.log("CONTACTS: STORAGE TO FIELDS");var a=lsi.keys("contacts");this.container.innerHTML="";for(var c=10*(this.selected-1)+10,b=10*(this.selected-1);b<c&&b<a.length;b++)this.add(lsi.get("contacts",a[b]));c>=a.length&&this.add({uid:a.length,number:"",firstname:"",lastname:"",username:"",call:-1,sms:-1});this.updateNavBar()}; inputPhoneContact.prototype.nav=function(a){if("undefined"==typeof a||isNaN(a.getData("n"))||"nav-contact"!=a.parentNode.id)return!1;for(var c=$$("#nav-contact > span.active"),b=0;b<c.length;b++)c[b].remClass("active");a.addClass("active");this.selected=parseInt(a.getData("n"))};
inputPhoneContact.prototype.nav=function(a){if("undefined"==typeof a||isNaN(a.innerHTML)||"nav-contact"!=a.parentNode.id)return!1;for(var c=$$("#nav-contact > span.active"),b=0;b<c.length;b++)c[b].remClass("active");a.addClass("active");this.selected=parseInt(a.innerHTML)}; inputPhoneContact.prototype.updateNavBar=function(){var a=lsi.keys("contacts").length;if(this.nav_container.children.length!=a){this.nav_container.innerHTML="";for(var c=0;c<a;c+=10)this.nav_container.innerHTML+='<span data-n="'+c+'">'+(1+c/10)+"</span>"}this.nav(this.nav_container.children[this.selected-1])};
inputPhoneContact.prototype.updateNavBar=function(){var a=lsi.keys("contacts").length;if(this.nav_container.children.length!=a){this.nav_container.innerHTML="";for(var c=0;c<a;c+=10)this.nav_container.innerHTML+="<span>"+(1+c/10)+"</span>"}this.nav(this.nav_container.children[this.selected-1])};
inputPhoneContact.prototype.attach=function(a){console.log("CONTACTS: ATTACH");lsi.createDataset("contacts");this.storageToFields();this.handler=a;var c=this;this.nav_container.addEventListener("click",function(a){c.nav(a.target);c.handler(a.target)},!1)}; inputPhoneContact.prototype.attach=function(a){console.log("CONTACTS: ATTACH");lsi.createDataset("contacts");this.storageToFields();this.handler=a;var c=this;this.nav_container.addEventListener("click",function(a){c.nav(a.target);c.handler(a.target)},!1)};

View File

@ -127,8 +127,8 @@ inputPhoneContact.prototype.storageToFields = function(){
this.container.innerHTML = ''; this.container.innerHTML = '';
// {2} On ajoute chaque contact (parmi les séléctionnés) à la liste // // {2} On ajoute chaque contact (parmi les séléctionnés) à la liste //
var min = 10*(this.selected-1); // On affiche du contact sélectionné var min = this.selected; // On affiche du contact sélectionné
var max = 10*(this.selected-1)+10; // On s'arrête à 10 contacs var max = this.selected+10; // On s'arrête à 10 contacs
for( var i = min ; i < max && i < contactKeys.length ; i++ ) for( var i = min ; i < max && i < contactKeys.length ; i++ )
this.add( lsi.get('contacts', contactKeys[i]) ); this.add( lsi.get('contacts', contactKeys[i]) );
@ -155,7 +155,7 @@ inputPhoneContact.prototype.nav = function(element){
if( typeof element == 'undefined' ) if( typeof element == 'undefined' )
return false; return false;
if( isNaN(element.innerHTML) || element.parentNode.id != 'nav-contact' ) if( isNaN(element.getData('n')) || element.parentNode.id != 'nav-contact' )
return false; return false;
/* (2) On désactive tous les éléments actifs */ /* (2) On désactive tous les éléments actifs */
@ -165,7 +165,7 @@ inputPhoneContact.prototype.nav = function(element){
/* (3) On active l'élément courant */ /* (3) On active l'élément courant */
element.addClass('active'); element.addClass('active');
this.selected = parseInt(element.innerHTML); this.selected = parseInt(element.getData('n'));
}; };
@ -190,7 +190,7 @@ inputPhoneContact.prototype.updateNavBar = function(){
this.nav_container.innerHTML = ''; this.nav_container.innerHTML = '';
for( var i = 0 ; i < len ; i+=10 ) for( var i = 0 ; i < len ; i+=10 )
this.nav_container.innerHTML += '<span>'+ (1+i/10) +'</span>'; this.nav_container.innerHTML += '<span data-n="'+i+'">'+ (1+i/10) +'</span>';
} }

View File

@ -16,8 +16,9 @@ c=$$('article.fiche-relation input[data-name="uid"][value="'+a.uid+'"] ~ h5>inpu
d[b].removeAttribute("checked");for(c=0;c<a.connect.length;c++)for(d=$$('article.fiche-relation input[data-name="uid"][value="'+a.uid+'"] ~ h5>input[type="radio"][data-name="connect'+c+'"]'),b=0;b<d.length&&b<a.connect[c].length;b++)a.connect[c][b].status?d[b].setAttribute("checked","checked"):d[b].removeAttribute("checked")}; d[b].removeAttribute("checked");for(c=0;c<a.connect.length;c++)for(d=$$('article.fiche-relation input[data-name="uid"][value="'+a.uid+'"] ~ h5>input[type="radio"][data-name="connect'+c+'"]'),b=0;b<d.length&&b<a.connect[c].length;b++)a.connect[c][b].status?d[b].setAttribute("checked","checked"):d[b].removeAttribute("checked")};
inputPhoneFiche.prototype.storageToFields=function(){console.log("FICHE: STORAGE TO FIELDS");var a=lsi["export"]("fiches");this.container.innerHTML="";var b=[],c;for(c in a){var d=a[c].uid;d==this.selected&&this.add(a[c]);b.push(d)}this.updateNavBar(b)}; inputPhoneFiche.prototype.storageToFields=function(){console.log("FICHE: STORAGE TO FIELDS");var a=lsi["export"]("fiches");this.container.innerHTML="";var b=[],c;for(c in a){var d=a[c].uid;d==this.selected&&this.add(a[c]);b.push(d)}this.updateNavBar(b)};
inputPhoneFiche.prototype.sync=function(){console.log("FICHE: SYNC");var a=lsi["export"]("contacts"),b;for(b in a){if(-1<a[b].call){var c=a[b].call,d=lsi.get("fiches",c);null==d&&(d=this.defaultData);d.uid=c;d.contact=b;lsi.set("fiches",c,d)}-1<a[b].sms&&(c=10+a[b].sms,d=lsi.get("fiches",c),null==d&&(d=this.defaultData),d.uid=c,d.contact=b,lsi.set("fiches",c,d))}var a=lsi["export"]("mini-fiches"),d=lsi["export"]("fiches"),e;for(e in d)d[e].timestamp>a[e].timestamp?(a[e].sexe=d[e].sexe,a[e].age=d[e].age, inputPhoneFiche.prototype.sync=function(){console.log("FICHE: SYNC");var a=lsi["export"]("contacts"),b;for(b in a){if(-1<a[b].call){var c=a[b].call,d=lsi.get("fiches",c);null==d&&(d=this.defaultData);d.uid=c;d.contact=b;lsi.set("fiches",c,d)}-1<a[b].sms&&(c=10+a[b].sms,d=lsi.get("fiches",c),null==d&&(d=this.defaultData),d.uid=c,d.contact=b,lsi.set("fiches",c,d))}var a=lsi["export"]("mini-fiches"),d=lsi["export"]("fiches"),e;for(e in d)d[e].timestamp>a[e].timestamp?(a[e].sexe=d[e].sexe,a[e].age=d[e].age,
a[e].job=d[e].job,a[e].loc=d[e].loc):(d[e].sexe=a[e].sexe,d[e].age=a[e].age,d[e].job=a[e].job,d[e].loc=a[e].loc),lsi.set("mini-fiches",e,a[e]),lsi.set("fiches",e,d[e])};inputPhoneFiche.prototype.nav=function(a){if("undefined"==typeof a||isNaN(a.innerHTML)||"nav-fiche"!=a.parentNode.id)return!1;for(var b=$$("#nav-fiche > span.active"),c=0;c<b.length;c++)b[c].remClass("active");a.addClass("active");this.selected=parseInt(a.innerHTML)-1}; a[e].job=d[e].job,a[e].loc=d[e].loc):(d[e].sexe=a[e].sexe,d[e].age=a[e].age,d[e].job=a[e].job,d[e].loc=a[e].loc),lsi.set("mini-fiches",e,a[e]),lsi.set("fiches",e,d[e])};inputPhoneFiche.prototype.nav=function(a){if(null==a||!1===a.getData("n")||isNaN(a.getData("n"))||"nav-fiche"!=a.parentNode.id)return!1;for(var b=$$("#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"]("fiches"),b=Object.keys(a).length;if(this.nav_container.children.length!=b){this.nav_container.innerHTML="";for(var c=0;c<b;c++)this.nav_container.innerHTML+="<span></span>"}for(var d in a)b=this.nav_container.children[a[d].uid],b.innerHTML=a[d].uid+1,!0===a[d].valid?b.addClass("done"):b.remClass("done");this.nav(this.nav_container.children[this.selected])}; inputPhoneFiche.prototype.updateNavBar=function(){var a=lsi["export"]("fiches"),b=Object.keys(a).length;if(this.nav_container.children.length!=b){this.nav_container.innerHTML="<span>APPELS</span>";for(var c=0;c<b;c++)9==c?this.nav_container.innerHTML+='<span data-n="'+c+'" class="lc">'+(c%10+1)+"</span>&nbsp;&nbsp;":(10==c&&(this.nav_container.innerHTML+='<span class="fc">SMS</span>'),this.nav_container.innerHTML+='<span data-n="'+c+'">'+(c%10+1)+"</span>")}for(var d in a)b=this.nav_container.children[a[d].uid],
!0===a[d].valid?b.addClass("done"):b.remClass("done");this.nav($('#nav-fiche [data-n="'+this.selected+'"]'))};
inputPhoneFiche.prototype.check=function(a){if(isNaN(parseInt(a.age))||2>a.city.length||isNaN(parseInt(a.duration[0]))&&0<a.duration[0].length||isNaN(parseInt(a.duration[1]))&&0<a.duration[1].length||0==a.duration[0].length+a.duration[1].length||"."==a.job||"."==a.studies||!checkRadioValue(a.sexe)||!checkRadioValue(a.famsit)||!checkRadioValue(a.reltype)||!checkRadioValue(a.loc)||!checkRadioValue(a.loc2)||!checkRadioValue(a.context))return!1;for(var b=0;b<a.freq.length;b++)if(!checkRadioValue(a.freq[b]))return!1; inputPhoneFiche.prototype.check=function(a){if(isNaN(parseInt(a.age))||2>a.city.length||isNaN(parseInt(a.duration[0]))&&0<a.duration[0].length||isNaN(parseInt(a.duration[1]))&&0<a.duration[1].length||0==a.duration[0].length+a.duration[1].length||"."==a.job||"."==a.studies||!checkRadioValue(a.sexe)||!checkRadioValue(a.famsit)||!checkRadioValue(a.reltype)||!checkRadioValue(a.loc)||!checkRadioValue(a.loc2)||!checkRadioValue(a.context))return!1;for(var b=0;b<a.freq.length;b++)if(!checkRadioValue(a.freq[b]))return!1;
for(b=0;b<a.connect.length;b++)if(!checkRadioValue(a.connect[b]))return!1;return a.reltype[8].status&&2>a.reltypeSpecial.length||a.context[11].status&&2>a.contextSpecial[0].length||a.context[12].status&&2>a.contextSpecial[1].length||a.context[13].status&&2>a.contextSpecial[2].length?!1:!0}; for(b=0;b<a.connect.length;b++)if(!checkRadioValue(a.connect[b]))return!1;return a.reltype[8].status&&2>a.reltypeSpecial.length||a.context[11].status&&2>a.contextSpecial[0].length||a.context[12].status&&2>a.contextSpecial[1].length||a.context[13].status&&2>a.contextSpecial[2].length?!1:!0};
inputPhoneFiche.prototype.attach=function(a){console.log("FICHE: ATTACH");lsi.createDataset("fiches");this.storageToFields();this.handler=a;var b=this,b=this;this.nav_container.addEventListener("click",function(a){b.nav(a.target);b.handler(a.target)},!1)}; inputPhoneFiche.prototype.attach=function(a){console.log("FICHE: ATTACH");lsi.createDataset("fiches");this.storageToFields();this.handler=a;var b=this,b=this;this.nav_container.addEventListener("click",function(a){b.nav(a.target);b.handler(a.target)},!1)};

View File

@ -438,10 +438,10 @@ inputPhoneFiche.prototype.sync = function(){
=========================================================*/ =========================================================*/
inputPhoneFiche.prototype.nav = function(element){ inputPhoneFiche.prototype.nav = function(element){
/* (1) On vérifie que l'élément contient un nombre et existe */ /* (1) On vérifie que l'élément contient un nombre et existe */
if( typeof element == 'undefined' ) if( element == null )
return false; return false;
if( isNaN(element.innerHTML) || element.parentNode.id != 'nav-fiche' ) if( element.getData('n') === false || isNaN(element.getData('n')) || element.parentNode.id != 'nav-fiche' )
return false; return false;
/* (2) On désactive tous les éléments actifs */ /* (2) On désactive tous les éléments actifs */
@ -451,7 +451,7 @@ inputPhoneFiche.prototype.nav = function(element){
/* (3) On active l'élément courant */ /* (3) On active l'élément courant */
element.addClass('active'); element.addClass('active');
this.selected = parseInt(element.innerHTML) - 1; this.selected = parseInt(element.getData('n'));
}; };
@ -474,10 +474,21 @@ inputPhoneFiche.prototype.updateNavBar = function(){
/* (2) On vide et remplit la barre de nav, si elle n'est pas à jour */ /* (2) On vide et remplit la barre de nav, si elle n'est pas à jour */
if( !navBarUpToDate ){ if( !navBarUpToDate ){
this.nav_container.innerHTML = ''; this.nav_container.innerHTML = '<span>APPELS</span>';
for( var i = 0 ; i < len ; i++ ) for( var i = 0 ; i < len ; i++ )
this.nav_container.innerHTML += '<span></span>'; // Si fin du top 10 des APPELS, on met un espace et un border-right
if( i == 9 )
this.nav_container.innerHTML += '<span data-n="'+i+'" class="lc">'+(i%10 + 1)+'</span>&nbsp;&nbsp;';
// Si début du top 10 des SMS, on met le label 'SMS' et un border-left
else if( i == 10 ){
this.nav_container.innerHTML += '<span class="fc">SMS</span>';
this.nav_container.innerHTML += '<span data-n="'+i+'">'+(i%10 + 1)+'</span>';
// Sinon, on ajoute juste le bouton
}else
this.nav_container.innerHTML += '<span data-n="'+i+'">'+(i%10 + 1)+'</span>';
} }
/* (3) On montre les FICHES qui sont correctes */ /* (3) On montre les FICHES qui sont correctes */
@ -485,9 +496,6 @@ inputPhoneFiche.prototype.updateNavBar = function(){
var currentElement = this.nav_container.children[ ficheData[key].uid ]; var currentElement = this.nav_container.children[ ficheData[key].uid ];
// On remplit avec le numéro de la fiche
currentElement.innerHTML = ficheData[key].uid+1;
// Si la MINI fiche est valide // Si la MINI fiche est valide
if( ficheData[key].valid === true ) currentElement.addClass('done'); if( ficheData[key].valid === true ) currentElement.addClass('done');
// Si elle est invalide // Si elle est invalide
@ -496,7 +504,7 @@ inputPhoneFiche.prototype.updateNavBar = function(){
} }
/* (4) On séléctionne par défaut le dernier sélectionné */ /* (4) On séléctionne par défaut le dernier sélectionné */
this.nav( this.nav_container.children[this.selected] ); this.nav( $('#nav-fiche [data-n="'+this.selected+'"]') );
}; };

View File

@ -1,9 +1,9 @@
function inputPhoneMini(a,b){this.container=a;this.nav_container=b}inputPhoneMini.prototype={container:this.container,nav_container:this.nav_container,selected:0,handler:null,defaultData:{sexe:[{status:!0},{status:!1}],age:"",job:".",loc:[{status:!0},{status:!1},{status:!1},{status:!1}],timestamp:0,valid:!1}}; function inputPhoneMini(a,b){this.container=a;this.nav_container=b}inputPhoneMini.prototype={container:this.container,nav_container:this.nav_container,selected:0,handler:null,defaultData:{sexe:[{status:!0},{status:!1}],age:"",job:".",loc:[{status:!0},{status:!1},{status:!1},{status:!1}],timestamp:0,valid:!1}};
inputPhoneMini.prototype.fieldsToStorage=function(){console.log("MINI FICHE: FIELDS TO STORAGE");for(var a=$$("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("mini-fiches",c.uid.value);if(!1!==e){if(null!=e.hash&&e.hash==d)break;console.warn("> MINI UPDATE");c={uid:c.uid.value,firstname:e.firstname,lastname:e.lastname,username:e.username,sexe:c.sexe,age:c.age.value, inputPhoneMini.prototype.fieldsToStorage=function(){console.log("MINI FICHE: FIELDS TO STORAGE");for(var a=$$("article.mini-relation-panel .mini-fiche-relation"),b=0;b<a.length;b++){var c=(new FormDeflater(a[b],["input","select"],["data-name"])).deflate(),e=crc32(JSON.stringify(c)),d=lsi.get("mini-fiches",c.uid.value);if(!1!==d){if(null!=d.hash&&d.hash==e)break;console.warn("> MINI UPDATE");c={uid:c.uid.value,firstname:d.firstname,lastname:d.lastname,username:d.username,sexe:c.sexe,age:c.age.value,
job:c.job.value,loc:c.loc,hash:d};c.valid=this.check(c);c.timestamp=Date.now();lsi.set("mini-fiches",c.uid,c)}}}; job:c.job.value,loc:c.loc,hash:e};c.valid=this.check(c);c.timestamp=Date.now();lsi.set("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.job=null!=a.job?a.job:this.defaultData.job;a.loc=null!=a.loc?a.loc:this.defaultData.loc;var b=lsi.get("contacts",a.uid);if(!1===b)return!1;this.container.innerHTML+=miniFicheBuilder.build({firstname:b.firstname,lastname:b.lastname,username:0==b.username.length?"":"("+b.username+")",uid:a.uid,age:a.age, 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.job=null!=a.job?a.job:this.defaultData.job;a.loc=null!=a.loc?a.loc:this.defaultData.loc;var b=lsi.get("contacts",a.uid);if(!1===b)return!1;this.container.innerHTML+=miniFicheBuilder.build({firstname:b.firstname,lastname:b.lastname,username:0==b.username.length?"":"("+b.username+")",uid:a.uid,age:a.age,
job:a.job});b=$('article.mini-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");for(var c=$$('article.mini-fiche-relation input[data-name="uid"][value="'+a.uid+'"] ~ h5>input[type="radio"][data-name="sexe"]'),b=0;b<c.length&&b<a.sexe.length;b++)a.sexe[b].status?c[b].setAttribute("checked","checked"):c[b].removeAttribute("checked");c=$$('article.mini-fiche-relation input[data-name="uid"][value="'+ job:a.job});b=$('article.mini-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");for(var c=$$('article.mini-fiche-relation input[data-name="uid"][value="'+a.uid+'"] ~ h5>input[type="radio"][data-name="sexe"]'),b=0;b<c.length&&b<a.sexe.length;b++)a.sexe[b].status?c[b].setAttribute("checked","checked"):c[b].removeAttribute("checked");c=$$('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<a.loc.length;b++)a.loc[b].status?c[b].setAttribute("checked","checked"):c[b].removeAttribute("checked")};inputPhoneMini.prototype.storageToFields=function(){console.log("MINI FICHE: STORAGE TO FIELDS");var a=lsi["export"]("mini-fiches");this.container.innerHTML="";this.add(a[this.selected]);this.updateNavBar()}; a.uid+'"] ~ h5>input[type="radio"][data-name="loc"]');for(b=0;b<c.length&&b<a.loc.length;b++)a.loc[b].status?c[b].setAttribute("checked","checked"):c[b].removeAttribute("checked")};inputPhoneMini.prototype.storageToFields=function(){console.log("MINI FICHE: STORAGE TO FIELDS");var a=lsi["export"]("mini-fiches");this.container.innerHTML="";this.add(a[this.selected]);this.updateNavBar()};
inputPhoneMini.prototype.sync=function(){console.log("MINI FICHE: SYNC");var a=lsi["export"]("contacts"),b;for(b in a){var c=lsi.get("mini-fiches",b);null==c&&(c=this.defaultData,c.valid=!1);c.uid=a[b].uid;lsi.set("mini-fiches",b,c)}};inputPhoneMini.prototype.nav=function(a){if("undefined"==typeof a||isNaN(a.innerHTML)||"nav-mini"!=a.parentNode.id)return!1;for(var b=$$("#nav-mini > span.active"),c=0;c<b.length;c++)b[c].remClass("active");a.addClass("active");this.selected=parseInt(a.innerHTML)-1}; inputPhoneMini.prototype.sync=function(){console.log("MINI FICHE: SYNC");var a=lsi["export"]("contacts"),b;for(b in a){var c=lsi.get("mini-fiches",b);null==c&&(c=this.defaultData,c.valid=!1);c.uid=a[b].uid;lsi.set("mini-fiches",b,c)}};inputPhoneMini.prototype.nav=function(a){if("undefined"==typeof a||isNaN(a.getData("n"))||"nav-mini"!=a.parentNode.id)return!1;for(var b=$$("#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"]("mini-fiches"),b=Object.keys(a).length;if(this.nav_container.children.length!=b){this.nav_container.innerHTML="";for(var c=0;c<b;c++)this.nav_container.innerHTML+="<span></span>"}for(var d in a)b=this.nav_container.children[a[d].uid],b.innerHTML=a[d].uid+1,!0===a[d].valid?b.addClass("done"):b.remClass("done");this.nav(this.nav_container.children[this.selected])}; inputPhoneMini.prototype.updateNavBar=function(){var a=lsi["export"]("mini-fiches"),b=Object.keys(a).length;if(this.nav_container.children.length!=b){this.nav_container.innerHTML="";for(var c=0;c<b;c++)this.nav_container.innerHTML+='<span data-n="'+c+'">'+(c+1)+"</span>"}for(var e in a)b=this.nav_container.children[a[e].uid],!0===a[e].valid?b.addClass("done"):b.remClass("done");this.nav(this.nav_container.children[this.selected])};
inputPhoneMini.prototype.check=function(a){return!isNaN(parseInt(a.age))&&checkRadioValue(a.sexe)&&"."!=a.job&&checkRadioValue(a.loc)?!0:!1};inputPhoneMini.prototype.attach=function(a){console.log("MINI FICHE: ATTACH");lsi.createDataset("mini-fiches");this.storageToFields();this.handler=a;var b=this;this.nav_container.addEventListener("click",function(a){b.nav(a.target);b.handler(a.target)},!1)}; inputPhoneMini.prototype.check=function(a){return!isNaN(parseInt(a.age))&&checkRadioValue(a.sexe)&&"."!=a.job&&checkRadioValue(a.loc)?!0:!1};inputPhoneMini.prototype.attach=function(a){console.log("MINI FICHE: ATTACH");lsi.createDataset("mini-fiches");this.storageToFields();this.handler=a;var b=this;this.nav_container.addEventListener("click",function(a){b.nav(a.target);b.handler(a.target)},!1)};

View File

@ -232,7 +232,7 @@ inputPhoneMini.prototype.nav = function(element){
if( typeof element == 'undefined' ) if( typeof element == 'undefined' )
return false; return false;
if( isNaN(element.innerHTML) || element.parentNode.id != 'nav-mini' ) if( isNaN(element.getData('n')) || element.parentNode.id != 'nav-mini' )
return false; return false;
/* (2) On désactive tous les éléments actifs */ /* (2) On désactive tous les éléments actifs */
@ -242,7 +242,7 @@ inputPhoneMini.prototype.nav = function(element){
/* (3) On active l'élément courant */ /* (3) On active l'élément courant */
element.addClass('active'); element.addClass('active');
this.selected = parseInt(element.innerHTML) - 1; this.selected = parseInt(element.getData('n'));
}; };
@ -267,7 +267,7 @@ inputPhoneMini.prototype.updateNavBar = function(){
this.nav_container.innerHTML = ''; this.nav_container.innerHTML = '';
for( var i = 0 ; i < len ; i++ ) for( var i = 0 ; i < len ; i++ )
this.nav_container.innerHTML += '<span></span>'; this.nav_container.innerHTML += '<span data-n="'+i+'">'+(i+1)+'</span>';
} }
/* (3) On montre les MINI fiches qui sont correctes dans la navbar */ /* (3) On montre les MINI fiches qui sont correctes dans la navbar */
@ -276,7 +276,8 @@ inputPhoneMini.prototype.updateNavBar = function(){
var currentElement = this.nav_container.children[ miniData[key].uid ]; var currentElement = this.nav_container.children[ miniData[key].uid ];
// On remplit avec le numéro de la MINI fiche // On remplit avec le numéro de la MINI fiche
currentElement.innerHTML = miniData[key].uid+1; // currentElement.setAttribute('data-n', miniData[key].uid);
// currentElement.innerHTML = miniData[key].uid + 1;
// Si la MINI fiche est valide // Si la MINI fiche est valide
if( miniData[key].valid === true ) currentElement.addClass('done'); if( miniData[key].valid === true ) currentElement.addClass('done');

View File

@ -255,6 +255,9 @@ include('/js/includes/input-phone-fiche.js', function(){
username: splittedName.length == 1 ? splittedName[0] : '', // Si un seul mot -> pseudo username: splittedName.length == 1 ? splittedName[0] : '', // Si un seul mot -> pseudo
firstname: splittedName.length > 1 ? splittedName[0] : '', // Si plusieurs mots -> le 1er est le prénom firstname: splittedName.length > 1 ? splittedName[0] : '', // Si plusieurs mots -> le 1er est le prénom
lastname: splittedName.length > 1 ? splittedName.splice(1).join(' ') : '', // et les autres sont le nom lastname: splittedName.length > 1 ? splittedName.splice(1).join(' ') : '', // et les autres sont le nom
// smscount: response.directory[most_called[i]].sms, // Nombre de sms
// callcount: response.directory[most_called[i]].calls, // Nombre d'appels
call: i // classement dans le top 10 des APPELS call: i // classement dans le top 10 des APPELS
}); });
@ -295,7 +298,7 @@ include('/js/includes/input-phone-fiche.js', function(){
} }
/* (6) Pour chaque contact qui n'est pas dans le top 10, on l'ajoute */ /* (7) Pour chaque contact qui n'est pas dans le top 10, on l'ajoute */
for( var number in response.directory ){ for( var number in response.directory ){
// Si dans top 10 des APPELS, on ne l'ajoute pas // Si dans top 10 des APPELS, on ne l'ajoute pas
@ -326,7 +329,7 @@ include('/js/includes/input-phone-fiche.js', function(){
} }
/* (6) On met à jour l'affichage */ /* (8) On met à jour l'affichage */
contactManager.storageToFields(); contactManager.storageToFields();
dynamicUpdate(true); dynamicUpdate(true);