Correction de la restitution physique des 'connect' et 'freq' des fiches
This commit is contained in:
parent
f5127af39b
commit
226c0c353f
|
@ -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<a.length;b++){var c=(new FormDeflater(a[b],["input","select"],["data-name"])).deflate(),f=crc32(JSON.stringify(c)),d=lsi.get("fiches",c.uid);if(!1!==d){if(null!=d.hash&&d.hash==f)break;c={contact:parseInt(c.contact),uid:parseInt(c.uid),sexe:c.sexe,age:c.age,job:c.job,famsit:c.famsit,studies:c.studies,reltype:c.reltype,reltypeSpecial:c.reltypeSpecial,
|
inputPhoneFiche.prototype.fieldsToStorage=function(){console.log("FICHE: FIELDS TO STORAGE");for(var a=$$("article.relation-panel .fiche-relation"),b=0;b<a.length;b++){var c=(new FormDeflater(a[b],["input","select"],["data-name"])).deflate(),f=crc32(JSON.stringify(c)),d=lsi.get("fiches",c.uid);if(!1!==d){if(null!=d.hash&&d.hash==f)break;c={contact:parseInt(c.contact),uid:parseInt(c.uid),sexe:c.sexe,age:c.age,job:c.job,famsit:c.famsit,studies:c.studies,reltype:c.reltype,reltypeSpecial:c.reltypeSpecial,
|
||||||
city:c.city,loc:c.loc,duration:c.duration,context:c.context,contextSpecial:c.contextSpecial,freq:c.freq,connect:c.connect,connectSpecial:c.connectSpecial,hash:f};c.valid=this.check(c);0<diff(d,c,["hash","valid","timestamp"]).length&&(console.log(diff(d,c,["hash","valid","timestamp"])),console.warn("> FICHE UPDATE"),c.timestamp=Date.now());lsi.set("fiches",c.uid,c)}}};
|
city:c.city,loc:c.loc,duration:c.duration,context:c.context,contextSpecial:c.contextSpecial,freq:c.freq,connect:c.connect,connectSpecial:c.connectSpecial,hash:f};c.valid=this.check(c);0<diff(d,c,["hash","valid","timestamp"]).length&&(console.log(diff(d,c,["hash","valid","timestamp"])),console.warn("> 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];
|
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>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;b<c.length;b++)c[b].value==a.sexe?c[b].setAttribute("checked","checked"):c[b].removeAttribute("checked");c=$$('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=$$('article.fiche-relation input[data-name="uid"][value="'+a.uid+'"] ~ h5>input[type="radio"][data-name="reltype"]');
|
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=$$('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=$$('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=$$('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=$$('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?
|
for(b=0;b<c.length;b++)c[b].value==a.reltype?c[b].setAttribute("checked","checked"):c[b].removeAttribute("checked");c=$$('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=$$('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=$$('article.fiche-relation input[data-name="uid"][value="'+a.uid+'"] ~ h5>input[type="radio"][data-name="freq"]');for(b=0;b<c.length;b++)c[b].value==a.freq?c[b].setAttribute("checked","checked"):c[b].removeAttribute("checked");c=$$('article.fiche-relation input[data-name="uid"][value="'+a.uid+'"] ~ h5>input[type="radio"][data-name="connect"]');for(b=0;b<c.length;b++)c[b].value==a.connect?c[b].setAttribute("checked","checked"):
|
c[b].setAttribute("checked","checked"):c[b].removeAttribute("checked");c=$$('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=$$('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",
|
||||||
c[b].removeAttribute("checked")};inputPhoneFiche.prototype.storageToFields=function(){console.log("FICHE: STORAGE TO FIELDS");var a=lsi["export"]("fiches");this.container.innerHTML="";for(var b in a)a[b].uid==this.selected&&this.add(a[b]);this.updateNavBar()};
|
"checked"):c[b].removeAttribute("checked")};inputPhoneFiche.prototype.storageToFields=function(){console.log("FICHE: STORAGE TO FIELDS");var a=lsi["export"]("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"]("contacts"),b=[],c;for(c in a){if(-1<a[c].call){var f=a[c].call;b.push(f);var d=lsi.get("fiches",f);null==d&&(d=this.defaultData);d.uid=f;d.contact=parseInt(c);lsi.set("fiches",f,d)}-1<a[c].sms&&(f=10+a[c].sms,b.push(f),d=lsi.get("fiches",f),null==d&&(d=this.defaultData),d.uid=f,d.contact=parseInt(c),lsi.set("fiches",f,d))}if(20>b.length)for(c in a){for(a=0;-1<b.indexOf(a)&&20>a;)a++;b.push(a);d=lsi.get("fiches",
|
inputPhoneFiche.prototype.sync=function(){console.log("FICHE: SYNC");var a=lsi["export"]("contacts"),b=[],c;for(c in a){if(-1<a[c].call){var f=a[c].call;b.push(f);var d=lsi.get("fiches",f);null==d&&(d=this.defaultData);d.uid=f;d.contact=parseInt(c);lsi.set("fiches",f,d)}-1<a[c].sms&&(f=10+a[c].sms,b.push(f),d=lsi.get("fiches",f),null==d&&(d=this.defaultData),d.uid=f,d.contact=parseInt(c),lsi.set("fiches",f,d))}if(20>b.length)for(c in a){for(a=0;-1<b.indexOf(a)&&20>a;)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=
|
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)))};
|
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)))};
|
||||||
|
|
|
@ -25,8 +25,8 @@ inputPhoneFiche.prototype = {
|
||||||
duration: ['', ''],
|
duration: ['', ''],
|
||||||
context: '0', // Choix 1 à 14
|
context: '0', // Choix 1 à 14
|
||||||
contextSpecial: ['', '', ''],
|
contextSpecial: ['', '', ''],
|
||||||
freq: ['0', '0', '0', '0', '0'],
|
freq: ['0', '4', '8', '12', '16'],
|
||||||
connect: ['0', '0', '0', '0', '0', '0'],
|
connect: ['1', '3', '5', '7', '9', '11'],
|
||||||
connectSpecial: ['', ''],
|
connectSpecial: ['', ''],
|
||||||
timestamp: 0,
|
timestamp: 0,
|
||||||
valid: false
|
valid: false
|
||||||
|
@ -239,14 +239,14 @@ inputPhoneFiche.prototype.add = function(objectData){
|
||||||
/* {14} On sélectionna la valeur des boutons <radio> pour les FREQUENCES */
|
/* {14} On sélectionna la valeur des boutons <radio> pour les FREQUENCES */
|
||||||
var freqCreated = $$('article.fiche-relation input[data-name="uid"][value="'+objectData.uid+'"] ~ h5>input[type="radio"][data-name="freq"]');
|
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++ )
|
for( var i = 0 ; i < freqCreated.length ; i++ )
|
||||||
if( freqCreated[i].value == objectData.freq ) freqCreated[i].setAttribute('checked', 'checked');
|
if( objectData.freq.indexOf(freqCreated[i].value) > -1 ) freqCreated[i].setAttribute('checked', 'checked');
|
||||||
else freqCreated[i].removeAttribute('checked');
|
else freqCreated[i].removeAttribute('checked');
|
||||||
|
|
||||||
/* {15} On sélectionna la valeur des boutons <radio> pour les CONNECTIONS */
|
/* {15} On sélectionna la valeur des boutons <radio> pour les CONNECTIONS */
|
||||||
var connectCreated = $$('article.fiche-relation input[data-name="uid"][value="'+objectData.uid+'"] ~ h5>input[type="radio"][data-name="connect"]');
|
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++ )
|
for( var i = 0 ; i < connectCreated.length ; i++ )
|
||||||
if( connectCreated[i].value == objectData.connect ) connectCreated[i].setAttribute('checked', 'checked');
|
if( objectData.connect.indexOf(connectCreated[i].value) > -1 ) connectCreated[i].setAttribute('checked', 'checked');
|
||||||
else connectCreated[i].removeAttribute('checked');
|
else connectCreated[i].removeAttribute('checked');
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue