diff --git a/js/includes/input-phone-fiche-min.js b/js/includes/input-phone-fiche-min.js index 8858e0a..8c6ef24 100644 --- a/js/includes/input-phone-fiche-min.js +++ b/js/includes/input-phone-fiche-min.js @@ -1,4 +1,4 @@ -function inputPhoneFiche(a,b){this.container=a;this.nav_container=b}inputPhoneFiche.prototype={container:this.container,nav_container:this.nav_container,selected:0,handler:null,defaultData:{sexe:"H",age:".",job:".",famsit:"0",studies:".",reltype:"0",reltypeSpecial:"",city:"",loc:"0",duration:["",""],context:"0",contextSpecial:["","",""],freq:["0","0","0","0","0"],connect:"000000".split(""),connectSpecial:["",""],timestamp:0,valid:!1}}; +function inputPhoneFiche(a,b){this.container=a;this.nav_container=b}inputPhoneFiche.prototype={container:this.container,nav_container:this.nav_container,selected:0,handler:null,defaultData:{sexe:"H",age:".",job:".",famsit:"0",studies:".",reltype:"0",reltypeSpecial:"",city:"",loc:"0",duration:["",""],context:"0",contextSpecial:["","",""],freq:["0","4","8","12","16"],connect:"1 3 5 7 9 11".split(" "),connectSpecial:["",""],timestamp:0,valid:!1}}; inputPhoneFiche.prototype.fieldsToStorage=function(){console.log("FICHE: FIELDS TO STORAGE");for(var a=$$("article.relation-panel .fiche-relation"),b=0;b FICHE UPDATE"),c.timestamp=Date.now());lsi.set("fiches",c.uid,c)}}}; inputPhoneFiche.prototype.add=function(a){console.log("FICHE: ADD");if(null==a.uid||null==a.contact)return!1;a.city=null!=a.city?a.city:this.defaultData.city;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]; @@ -8,8 +8,8 @@ ficheBuilder.build({firstname:b.firstname,lastname:b.lastname,username:0==b.user a.uid+'"] ~ h5>span>select[data-name="job"]>option[value="'+a.job+'"]');null!=b&&b.setAttribute("selected","selected");b=$('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=$('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=$$('article.fiche-relation input[data-name="uid"][value="'+ a.uid+'"] ~ h5>input[type="radio"][data-name="sexe"]'),b=0;binput[type="radio"][data-name="famsit"]');for(b=0;binput[type="radio"][data-name="reltype"]'); for(b=0;binput[type="radio"][data-name="loc"]');for(b=0;binput[type="radio"][data-name="context"]');for(b=0;binput[type="radio"][data-name="freq"]');for(b=0;binput[type="radio"][data-name="connect"]');for(b=0;binput[type="radio"][data-name="freq"]');for(b=0;binput[type="radio"][data-name="connect"]');for(b=0;bb.length)for(c in a){for(a=0;-1a;)a++;b.push(a);d=lsi.get("fiches", a);null==d&&(d=this.defaultData);d.uid=a;d.contact=c;lsi.set("fiches",a,d);if(20<=b.length)break}var d=lsi["export"]("fiches"),e;for(e in d)miniData=lsi.get("mini-fiches",d[e].contact),d[e].timestamp>miniData.timestamp?(miniData.sexe=d[e].sexe,miniData.age=d[e].age,miniData.studies=d[e].studies,miniData.loc=d[e].loc,miniData.reltype=d[e].reltype,miniData.reltypeSpecial=d[e].reltypeSpecial):(d[e].sexe=miniData.sexe,d[e].age=miniData.age,d[e].studies=miniData.studies,d[e].loc=miniData.loc,d[e].reltype= miniData.reltype,d[e].reltypeSpecial=miniData.reltypeSpecial),lsi.set("mini-fiches",d[e].contact,miniData),lsi.set("fiches",e,d[e]);for(e in d)b=lsi.get("contacts",d[e].contact),null!=b&&-1!=b.sms&&-1!=b.call&&(b=10>parseInt(e)?10+b.sms:b.call,b=d[b],b.timestamp>=d[e].timestamp||(c=d[e],c.uid=b.uid,lsi.set("fiches",b.uid,c)))}; diff --git a/js/includes/input-phone-fiche.js b/js/includes/input-phone-fiche.js index 9410f0b..6854cb0 100644 --- a/js/includes/input-phone-fiche.js +++ b/js/includes/input-phone-fiche.js @@ -25,8 +25,8 @@ inputPhoneFiche.prototype = { duration: ['', ''], context: '0', // Choix 1 à 14 contextSpecial: ['', '', ''], - freq: ['0', '0', '0', '0', '0'], - connect: ['0', '0', '0', '0', '0', '0'], + freq: ['0', '4', '8', '12', '16'], + connect: ['1', '3', '5', '7', '9', '11'], connectSpecial: ['', ''], timestamp: 0, valid: false @@ -239,14 +239,14 @@ inputPhoneFiche.prototype.add = function(objectData){ /* {14} On sélectionna la valeur des boutons pour les FREQUENCES */ var freqCreated = $$('article.fiche-relation input[data-name="uid"][value="'+objectData.uid+'"] ~ h5>input[type="radio"][data-name="freq"]'); for( var i = 0 ; i < freqCreated.length ; i++ ) - if( freqCreated[i].value == objectData.freq ) freqCreated[i].setAttribute('checked', 'checked'); - else freqCreated[i].removeAttribute('checked'); + if( objectData.freq.indexOf(freqCreated[i].value) > -1 ) freqCreated[i].setAttribute('checked', 'checked'); + else freqCreated[i].removeAttribute('checked'); /* {15} On sélectionna la valeur des boutons pour les CONNECTIONS */ var connectCreated = $$('article.fiche-relation input[data-name="uid"][value="'+objectData.uid+'"] ~ h5>input[type="radio"][data-name="connect"]'); for( var i = 0 ; i < connectCreated.length ; i++ ) - if( connectCreated[i].value == objectData.connect ) connectCreated[i].setAttribute('checked', 'checked'); - else connectCreated[i].removeAttribute('checked'); + if( objectData.connect.indexOf(connectCreated[i].value) > -1 ) connectCreated[i].setAttribute('checked', 'checked'); + else connectCreated[i].removeAttribute('checked');