Ajout de `reltype` dans les `mini` et synchronisation avec `fiche` associée
This commit is contained in:
parent
88a8f5720a
commit
711826f4ff
File diff suppressed because one or more lines are too long
|
@ -101,6 +101,19 @@ miniFicheBuilder.setLayout(
|
||||||
"\t\t</select></span>\n"+
|
"\t\t</select></span>\n"+
|
||||||
"\t</h5>\n"+
|
"\t</h5>\n"+
|
||||||
|
|
||||||
|
"\t<h4 data-icon='a'>Type de relation</h4>\n"+
|
||||||
|
"\t<h5 class='nobold color0'>\n"+
|
||||||
|
"\t\t <input type='radio' name='reltype_mini_@uid' data-name='reltype' id='reltype0_mini_@uid'><label for='reltype0_mini_@uid'>Père, mère ou équivalent</label><br>\n"+
|
||||||
|
"\t\t <input type='radio' name='reltype_mini_@uid' data-name='reltype' id='reltype1_mini_@uid'><label for='reltype1_mini_@uid'>Frère ou soeur</label><br>\n"+
|
||||||
|
"\t\t <input type='radio' name='reltype_mini_@uid' data-name='reltype' id='reltype2_mini_@uid'><label for='reltype2_mini_@uid'>Autre membre de la famille</label><br>\n"+
|
||||||
|
"\t\t <input type='radio' name='reltype_mini_@uid' data-name='reltype' id='reltype3_mini_@uid'><label for='reltype3_mini_@uid'>Relation amoureuse</label><br>\n"+
|
||||||
|
"\t\t <input type='radio' name='reltype_mini_@uid' data-name='reltype' id='reltype4_mini_@uid'><label for='reltype4_mini_@uid'>Collègue</label><br>\n"+
|
||||||
|
"\t\t <input type='radio' name='reltype_mini_@uid' data-name='reltype' id='reltype5_mini_@uid'><label for='reltype5_mini_@uid'>Voisin</label><br>\n"+
|
||||||
|
"\t\t <input type='radio' name='reltype_mini_@uid' data-name='reltype' id='reltype6_mini_@uid'><label for='reltype6_mini_@uid'>Ami</label><br>\n"+
|
||||||
|
"\t\t <input type='radio' name='reltype_mini_@uid' data-name='reltype' id='reltype7_mini_@uid'><label for='reltype7_mini_@uid'>Copain</label><br>\n"+
|
||||||
|
"\t\t <input type='radio' name='reltype_mini_@uid' data-name='reltype' id='reltype8_mini_@uid'><label for='reltype8_mini_@uid'>Autre : <input type='text' data-name='reltypeSpecial' placeholder='coéquipier de tennis, ..' value='@reltypespecial'></label><br>\n"+
|
||||||
|
"\t</h5>\n"+
|
||||||
|
|
||||||
|
|
||||||
"\t<h5 class='nobold color0'>\n"+
|
"\t<h5 class='nobold color0'>\n"+
|
||||||
"\t\tOù habite t-elle/il ?<br>\n"+
|
"\t\tOù habite t-elle/il ?<br>\n"+
|
||||||
|
|
|
@ -15,8 +15,9 @@ a.uid+'"] ~ h5>input[type="radio"][data-name="loc"]');for(b=0;b<c.length&&b<a.lo
|
||||||
a.uid+'"] ~ h5>input[type="radio"][data-name="freq'+c+'"]'),b=0;b<e.length&&b<a.freq[c].length;b++)a.freq[c][b].status?e[b].setAttribute("checked","checked"):e[b].removeAttribute("checked");for(c=0;c<a.connect.length;c++)for(e=$$('article.fiche-relation input[data-name="uid"][value="'+a.uid+'"] ~ h5>input[type="radio"][data-name="connect'+c+'"]'),b=0;b<e.length&&b<a.connect[c].length;b++)a.connect[c][b].status?e[b].setAttribute("checked","checked"):e[b].removeAttribute("checked")};
|
a.uid+'"] ~ h5>input[type="radio"][data-name="freq'+c+'"]'),b=0;b<e.length&&b<a.freq[c].length;b++)a.freq[c][b].status?e[b].setAttribute("checked","checked"):e[b].removeAttribute("checked");for(c=0;c<a.connect.length;c++)for(e=$$('article.fiche-relation input[data-name="uid"][value="'+a.uid+'"] ~ h5>input[type="radio"][data-name="connect'+c+'"]'),b=0;b<e.length&&b<a.connect[c].length;b++)a.connect[c][b].status?e[b].setAttribute("checked","checked"):e[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.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 e=a[c].call;b.push(e);var d=lsi.get("fiches",e);null==d&&(d=this.defaultData);d.uid=e;d.contact=c;lsi.set("fiches",e,d)}-1<a[c].sms&&(e=10+a[c].sms,b.push(e),d=lsi.get("fiches",e),null==d&&(d=this.defaultData),d.uid=e,d.contact=c,lsi.set("fiches",e,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);
|
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 e=a[c].call;b.push(e);var d=lsi.get("fiches",e);null==d&&(d=this.defaultData);d.uid=e;d.contact=c;lsi.set("fiches",e,d)}-1<a[c].sms&&(e=10+a[c].sms,b.push(e),d=lsi.get("fiches",e),null==d&&(d=this.defaultData),d.uid=e,d.contact=c,lsi.set("fiches",e,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"),f;for(f in d)miniData=lsi.get("mini-fiches",d[f].contact),d[f].timestamp>=miniData.timestamp?(miniData.sexe=d[f].sexe,miniData.age=d[f].age,miniData.studies=d[f].studies,miniData.loc=d[f].loc):(d[f].sexe=miniData.sexe,d[f].age=miniData.age,d[f].studies=miniData.studies,d[f].loc=miniData.loc),lsi.set("mini-fiches",d[f].contact,miniData),lsi.set("fiches",f,d[f]);for(f in d)b=lsi.get("contacts",d[f].contact),
|
d.uid=a;d.contact=c;lsi.set("fiches",a,d);if(20<=b.length)break}var d=lsi["export"]("fiches"),f;for(f in d)miniData=lsi.get("mini-fiches",d[f].contact),d[f].timestamp>=miniData.timestamp?(miniData.sexe=d[f].sexe,miniData.age=d[f].age,miniData.studies=d[f].studies,miniData.loc=d[f].loc,miniData.reltype=d[f].reltype,miniData.reltypeSpecial=d[f].reltypeSpecial):(d[f].sexe=miniData.sexe,d[f].age=miniData.age,d[f].studies=miniData.studies,d[f].loc=miniData.loc,d[f].reltype=miniData.reltype,d[f].reltypeSpecial=
|
||||||
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("fiches",b.uid,c)))};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"))};
|
miniData.reltypeSpecial),lsi.set("mini-fiches",d[f].contact,miniData),lsi.set("fiches",f,d[f]);for(f in d)b=lsi.get("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("fiches",b.uid,c)))};
|
||||||
|
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=lsi.keys("fiches").length;if($$("#nav-fiche [data-n]").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> ":(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 e in a)b=$('#nav-fiche [data-n="'+
|
inputPhoneFiche.prototype.updateNavBar=function(){var a=lsi["export"]("fiches"),b=lsi.keys("fiches").length;if($$("#nav-fiche [data-n]").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> ":(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 e in a)b=$('#nav-fiche [data-n="'+
|
||||||
a[e].uid+'"]'),!0===a[e].valid?b.addClass("done"):b.remClass("done");this.nav($('#nav-fiche [data-n="'+this.selected+'"]'))};
|
a[e].uid+'"]'),!0===a[e].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.context))return!1;for(var b=0;b<a.freq.length;b++)if(!checkRadioValue(a.freq[b]))return!1;for(b=0;b<
|
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.context))return!1;for(var b=0;b<a.freq.length;b++)if(!checkRadioValue(a.freq[b]))return!1;for(b=0;b<
|
||||||
|
|
|
@ -441,6 +441,8 @@ inputPhoneFiche.prototype.sync = function(){
|
||||||
miniData.age = ficheData[key].age;
|
miniData.age = ficheData[key].age;
|
||||||
miniData.studies = ficheData[key].studies;
|
miniData.studies = ficheData[key].studies;
|
||||||
miniData.loc = ficheData[key].loc;
|
miniData.loc = ficheData[key].loc;
|
||||||
|
miniData.reltype = ficheData[key].reltype;
|
||||||
|
miniData.reltypeSpecial = ficheData[key].reltypeSpecial;
|
||||||
|
|
||||||
/* (4) Sinon, on utilise les données de la MINI */
|
/* (4) Sinon, on utilise les données de la MINI */
|
||||||
}else{
|
}else{
|
||||||
|
@ -448,6 +450,8 @@ inputPhoneFiche.prototype.sync = function(){
|
||||||
ficheData[key].age = miniData.age;
|
ficheData[key].age = miniData.age;
|
||||||
ficheData[key].studies = miniData.studies;
|
ficheData[key].studies = miniData.studies;
|
||||||
ficheData[key].loc = miniData.loc;
|
ficheData[key].loc = miniData.loc;
|
||||||
|
ficheData[key].reltype = miniData.reltype;
|
||||||
|
ficheData[key].reltypeSpecial = miniData.reltypeSpecial;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (5) On enregistre les modifications */
|
/* (5) On enregistre les modifications */
|
||||||
|
|
|
@ -1,9 +1,10 @@
|
||||||
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:"",studies:".",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:"",studies:".",loc:[{status:!0},{status:!1},{status:!1},{status:!1}],reltype:[{status:!0},{status:!1},{status:!1},{status:!1},{status:!1},{status:!1},{status:!1},{status:!1},{status:!1}],reltypeSpecial:"",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(),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,
|
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,
|
||||||
studies:c.studies.value,loc:c.loc,hash:e};c.valid=this.check(c);c.timestamp=Date.now();lsi.set("mini-fiches",c.uid,c)}}};
|
studies:c.studies.value,reltype:c.reltype,reltypeSpecial:c.reltypeSpecial.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.studies=null!=a.studies?a.studies:this.defaultData.studies;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+")",countcall:b.countcall,
|
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;var b=lsi.get("contacts",a.uid);if(!1===b)return!1;
|
||||||
countsms:b.countsms,uid:a.uid,age:a.age,studies:a.studies});b=$('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");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");
|
this.container.innerHTML+=miniFicheBuilder.build({firstname:b.firstname,lastname:b.lastname,username:0==b.username.length?"":"("+b.username+")",countcall:b.countcall,countsms:b.countsms,uid:a.uid,age:a.age,reltypespecial:a.reltypeSpecial,studies:a.studies});b=$('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");for(var c=$$('article.mini-fiche-relation input[data-name="uid"][value="'+
|
||||||
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.get("mini-fiches",this.selected);this.container.innerHTML="";this.add(a);this.updateNavBar()};
|
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="reltype"]');for(b=0;b<c.length&&b<a.reltype.length;b++)a.reltype[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.get("mini-fiches",this.selected);this.container.innerHTML="";this.add(a);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(null==a||!1===a.getData("n")||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.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(null==a||!1===a.getData("n")||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($$("#nav-mini [data-n]").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=$('#nav-mini [data-n="'+a[e].uid+'"]'),!0===a[e].valid?b.addClass("done"):b.remClass("done");this.nav($('#nav-mini [data-n="'+this.selected+'"]'))};
|
inputPhoneMini.prototype.updateNavBar=function(){var a=lsi["export"]("mini-fiches"),b=Object.keys(a).length;if($$("#nav-mini [data-n]").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=$('#nav-mini [data-n="'+a[e].uid+'"]'),!0===a[e].valid?b.addClass("done"):b.remClass("done");this.nav($('#nav-mini [data-n="'+this.selected+'"]'))};
|
||||||
inputPhoneMini.prototype.check=function(a){return!isNaN(parseInt(a.age))&&checkRadioValue(a.sexe)&&"."!=a.studies&&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.studies||!checkRadioValue(a.loc)||!checkRadioValue(a.reltype)||a.reltype[8].status&&2>a.reltypeSpecial.length?!1:!0};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)};
|
||||||
|
|
|
@ -17,6 +17,9 @@ inputPhoneMini.prototype = {
|
||||||
age: '',
|
age: '',
|
||||||
studies: '.',
|
studies: '.',
|
||||||
loc: [{status:true}, {status:false}, {status:false}, {status:false}],
|
loc: [{status:true}, {status:false}, {status:false}, {status:false}],
|
||||||
|
reltype: [ {status:true}, {status:false}, {status:false}, {status:false}, {status:false},
|
||||||
|
{status:false}, {status:false}, {status:false}, {status:false}], // Choix 1 à 9
|
||||||
|
reltypeSpecial: '',
|
||||||
timestamp: 0,
|
timestamp: 0,
|
||||||
valid: false
|
valid: false
|
||||||
}
|
}
|
||||||
|
@ -67,6 +70,8 @@ inputPhoneMini.prototype.fieldsToStorage = function(){
|
||||||
sexe: deflated.sexe, // [0] Homme, [1] Femme
|
sexe: deflated.sexe, // [0] Homme, [1] Femme
|
||||||
age: deflated.age.value,
|
age: deflated.age.value,
|
||||||
studies: deflated.studies.value,
|
studies: deflated.studies.value,
|
||||||
|
reltype: deflated.reltype, // [0] ...
|
||||||
|
reltypeSpecial: deflated.reltypeSpecial.value,
|
||||||
loc: deflated.loc, // [0] Choix 1 -> [3] Choix 4
|
loc: deflated.loc, // [0] Choix 1 -> [3] Choix 4
|
||||||
hash: deflatedHash
|
hash: deflatedHash
|
||||||
};
|
};
|
||||||
|
@ -108,6 +113,8 @@ inputPhoneMini.prototype.add = function(objectData){
|
||||||
objectData.age = (objectData.age != null) ? objectData.age : this.defaultData.age;
|
objectData.age = (objectData.age != null) ? objectData.age : this.defaultData.age;
|
||||||
objectData.sexe = (objectData.sexe != null) ? objectData.sexe : this.defaultData.sexe;
|
objectData.sexe = (objectData.sexe != null) ? objectData.sexe : this.defaultData.sexe;
|
||||||
objectData.studies = (objectData.studies != null) ? objectData.studies : this.defaultData.studies;
|
objectData.studies = (objectData.studies != null) ? objectData.studies : this.defaultData.studies;
|
||||||
|
objectData.reltype = (objectData.reltype != null) ? objectData.reltype : this.defaultData.reltype;
|
||||||
|
objectData.reltypeSpecial = (objectData.reltypeSpecial != null) ? objectData.reltypeSpecial : this.defaultData.reltypeSpecial;
|
||||||
objectData.loc = (objectData.loc != null) ? objectData.loc : this.defaultData.loc;
|
objectData.loc = (objectData.loc != null) ? objectData.loc : this.defaultData.loc;
|
||||||
|
|
||||||
|
|
||||||
|
@ -128,6 +135,7 @@ inputPhoneMini.prototype.add = function(objectData){
|
||||||
countsms: associatedContact.countsms,
|
countsms: associatedContact.countsms,
|
||||||
uid: objectData.uid,
|
uid: objectData.uid,
|
||||||
age: objectData.age,
|
age: objectData.age,
|
||||||
|
reltypespecial: objectData.reltypeSpecial,
|
||||||
studies: objectData.studies
|
studies: objectData.studies
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -143,7 +151,13 @@ inputPhoneMini.prototype.add = function(objectData){
|
||||||
if( objectData.sexe[i].status ) sexeCreated[i].setAttribute('checked', 'checked');
|
if( objectData.sexe[i].status ) sexeCreated[i].setAttribute('checked', 'checked');
|
||||||
else sexeCreated[i].removeAttribute('checked');
|
else sexeCreated[i].removeAttribute('checked');
|
||||||
|
|
||||||
/* {5} On sélectionna la valeur des boutons <radio> pour la LOCATION */
|
/* {5} On sélectionna la valeur des boutons <radio> pour le TYPE DE RELATION */
|
||||||
|
var reltypeCreated = $$('article.mini-fiche-relation input[data-name="uid"][value="'+objectData.uid+'"] ~ h5>input[type="radio"][data-name="reltype"]');
|
||||||
|
for( var i = 0 ; i < reltypeCreated.length && i < objectData.reltype.length ; i++ )
|
||||||
|
if( objectData.reltype[i].status ) reltypeCreated[i].setAttribute('checked', 'checked');
|
||||||
|
else reltypeCreated[i].removeAttribute('checked');
|
||||||
|
|
||||||
|
/* {6} On sélectionna la valeur des boutons <radio> pour la LOCATION */
|
||||||
var locCreated = $$('article.mini-fiche-relation input[data-name="uid"][value="'+objectData.uid+'"] ~ h5>input[type="radio"][data-name="loc"]');
|
var locCreated = $$('article.mini-fiche-relation input[data-name="uid"][value="'+objectData.uid+'"] ~ h5>input[type="radio"][data-name="loc"]');
|
||||||
for( var i = 0 ; i < locCreated.length && i < objectData.loc.length ; i++ )
|
for( var i = 0 ; i < locCreated.length && i < objectData.loc.length ; i++ )
|
||||||
if( objectData.loc[i].status ) locCreated[i].setAttribute('checked', 'checked');
|
if( objectData.loc[i].status ) locCreated[i].setAttribute('checked', 'checked');
|
||||||
|
@ -313,6 +327,12 @@ inputPhoneMini.prototype.check = function(miniData){
|
||||||
// 4. La distance de localisation est définie
|
// 4. La distance de localisation est définie
|
||||||
if( !checkRadioValue(miniData.loc) )
|
if( !checkRadioValue(miniData.loc) )
|
||||||
return false;
|
return false;
|
||||||
|
// 5. Le TYPE DE RELATION a un et un seul choix
|
||||||
|
if( !checkRadioValue(miniData.reltype) )
|
||||||
|
return false;
|
||||||
|
// 6. TYPE DE RELATION si autre est coché (indice 8), reltypeSpecial doit avoir au moins 2 caractère
|
||||||
|
if( miniData.reltype[8].status && miniData.reltypeSpecial.length < 2 )
|
||||||
|
return false;
|
||||||
|
|
||||||
|
|
||||||
// Si aucune erreur, tout est ok
|
// Si aucune erreur, tout est ok
|
||||||
|
|
Loading…
Reference in New Issue