Ajout de 'jamais' par défaut dans 'fiche.freq'

This commit is contained in:
xdrm-brackets 2016-05-13 11:14:41 +02:00
parent 6a8c024255
commit 66e9027db8
14 changed files with 17499 additions and 3139 deletions

View File

@ -48,8 +48,14 @@
{ "id":"20", "number":"0502033369", "name":"", "sexe":"1", "age":"20", "studies":"20", "reltype":"20", "dist":"19" }, { "id":"20", "number":"0502033369", "name":"", "sexe":"1", "age":"20", "studies":"20", "reltype":"20", "dist":"19" },
{ "id":"21", "number":"0502033525", "name":"", "sexe":"1", "age":"21", "studies":"21", "reltype":"21", "dist":"20" }, { "id":"21", "number":"0502033525", "name":"", "sexe":"1", "age":"21", "studies":"21", "reltype":"21", "dist":"20" },
{ "id":"22", "number":"0502033681", "name":"", "sexe":"1", "age":"22", "studies":"22", "reltype":"22", "dist":"21" } { "id":"22", "number":"0502033681", "name":"", "sexe":"1", "age":"22", "studies":"22", "reltype":"22", "dist":"21" }
],
"relations": {
"0": ["1", "4", "6", "8"],
"5": ["4", "5", "6"]
}
]
} }

View File

@ -1,7 +1,7 @@
{ {
"call_log": { "logs": {
"direction": { "0": "INCOMING", "1": "OUTGOING", "2": "MISSED" }, "direction": { "0": "INCOMING", "1": "OUTGOING", "2": "MISSED" },
"type": { "0": "PHONE", "1": "SMS" } "type": { "0": "PHONE", "1": "SMS" }

File diff suppressed because one or more lines are too long

View File

@ -98,7 +98,8 @@ miniFicheBuilder.setLayout(
"\t\t\t<option value='2'>BAC</option>\n"+ "\t\t\t<option value='2'>BAC</option>\n"+
"\t\t\t<option value='3'>BAC+2</option>\n"+ "\t\t\t<option value='3'>BAC+2</option>\n"+
"\t\t\t<option value='4'>BAC+3</option>\n"+ "\t\t\t<option value='4'>BAC+3</option>\n"+
"\t\t\t<option value='5'>BAC+4 et plus</option>\n"+ "\t\t\t<option value='5'>BAC+5 et plus</option>\n"+
"\t\t\t<option value='6'>Diplôme d'ingénieur, d'une grande école, etc.</option>\n"+
"\t\t</select></span>\n"+ "\t\t</select></span>\n"+
"\t</h5>\n"+ "\t</h5>\n"+
@ -367,38 +368,43 @@ ficheBuilder.setLayout(
"\t\t&nbsp;&nbsp;&nbsp;<input type='radio' name='freq0_@uid' data-name='freq' id='freq02_@uid' value='1'><label for='freq02_@uid'>1 fois par semaine</label>\n"+ "\t\t&nbsp;&nbsp;&nbsp;<input type='radio' name='freq0_@uid' data-name='freq' id='freq02_@uid' value='1'><label for='freq02_@uid'>1 fois par semaine</label>\n"+
"\t\t&nbsp;&nbsp;&nbsp;<input type='radio' name='freq0_@uid' data-name='freq' id='freq03_@uid' value='2'><label for='freq03_@uid'>1 fois par mois</label>\n"+ "\t\t&nbsp;&nbsp;&nbsp;<input type='radio' name='freq0_@uid' data-name='freq' id='freq03_@uid' value='2'><label for='freq03_@uid'>1 fois par mois</label>\n"+
"\t\t&nbsp;&nbsp;&nbsp;<input type='radio' name='freq0_@uid' data-name='freq' id='freq04_@uid' value='3'><label for='freq04_@uid'>1 fois par an ou moins</label>\n"+ "\t\t&nbsp;&nbsp;&nbsp;<input type='radio' name='freq0_@uid' data-name='freq' id='freq04_@uid' value='3'><label for='freq04_@uid'>1 fois par an ou moins</label>\n"+
"\t\t&nbsp;&nbsp;&nbsp;<input type='radio' name='freq0_@uid' data-name='freq' id='freq05_@uid' value='4'><label for='freq05_@uid'>Jamais</label>\n"+
"\t</h5>\n"+ "\t</h5>\n"+
"\t<h5 class='nobold color0'>\n"+ "\t<h5 class='nobold color0'>\n"+
"\t\tTéléphone ou skype et équivalent<br>\n"+ "\t\tTéléphone ou skype et équivalent<br>\n"+
"\t\t&nbsp;&nbsp;&nbsp;<input type='radio' name='freq1_@uid' data-name='freq' id='freq11_@uid' value='4'><label for='freq11_@uid'>plusieurs fois par semaine</label>\n"+ "\t\t&nbsp;&nbsp;&nbsp;<input type='radio' name='freq1_@uid' data-name='freq' id='freq06_@uid' value='5'><label for='freq06_@uid'>plusieurs fois par semaine</label>\n"+
"\t\t&nbsp;&nbsp;&nbsp;<input type='radio' name='freq1_@uid' data-name='freq' id='freq12_@uid' value='5'><label for='freq12_@uid'>1 fois par semaine</label>\n"+ "\t\t&nbsp;&nbsp;&nbsp;<input type='radio' name='freq1_@uid' data-name='freq' id='freq07_@uid' value='6'><label for='freq07_@uid'>1 fois par semaine</label>\n"+
"\t\t&nbsp;&nbsp;&nbsp;<input type='radio' name='freq1_@uid' data-name='freq' id='freq13_@uid' value='6'><label for='freq13_@uid'>1 fois par mois</label>\n"+ "\t\t&nbsp;&nbsp;&nbsp;<input type='radio' name='freq1_@uid' data-name='freq' id='freq08_@uid' value='7'><label for='freq08_@uid'>1 fois par mois</label>\n"+
"\t\t&nbsp;&nbsp;&nbsp;<input type='radio' name='freq1_@uid' data-name='freq' id='freq14_@uid' value='7'><label for='freq14_@uid'>1 fois par an ou moins</label>\n"+ "\t\t&nbsp;&nbsp;&nbsp;<input type='radio' name='freq1_@uid' data-name='freq' id='freq09_@uid' value='8'><label for='freq09_@uid'>1 fois par an ou moins</label>\n"+
"\t\t&nbsp;&nbsp;&nbsp;<input type='radio' name='freq1_@uid' data-name='freq' id='freq10_@uid' value='9'><label for='freq10_@uid'>Jamais</label>\n"+
"\t</h5>\n"+ "\t</h5>\n"+
"\t<h5 class='nobold color0'>\n"+ "\t<h5 class='nobold color0'>\n"+
"\t\tSMS, et équivalents<br>\n"+ "\t\tSMS, et équivalents<br>\n"+
"\t\t&nbsp;&nbsp;&nbsp;<input type='radio' name='freq2_@uid' data-name='freq' id='freq21_@uid' value='8'><label for='freq21_@uid'>plusieurs fois par semaine</label>\n"+ "\t\t&nbsp;&nbsp;&nbsp;<input type='radio' name='freq2_@uid' data-name='freq' id='freq11_@uid' value='10'><label for='freq11_@uid'>plusieurs fois par semaine</label>\n"+
"\t\t&nbsp;&nbsp;&nbsp;<input type='radio' name='freq2_@uid' data-name='freq' id='freq22_@uid' value='9'><label for='freq22_@uid'>1 fois par semaine</label>\n"+ "\t\t&nbsp;&nbsp;&nbsp;<input type='radio' name='freq2_@uid' data-name='freq' id='freq12_@uid' value='11'><label for='freq12_@uid'>1 fois par semaine</label>\n"+
"\t\t&nbsp;&nbsp;&nbsp;<input type='radio' name='freq2_@uid' data-name='freq' id='freq23_@uid' value='10'><label for='freq23_@uid'>1 fois par mois</label>\n"+ "\t\t&nbsp;&nbsp;&nbsp;<input type='radio' name='freq2_@uid' data-name='freq' id='freq13_@uid' value='12'><label for='freq13_@uid'>1 fois par mois</label>\n"+
"\t\t&nbsp;&nbsp;&nbsp;<input type='radio' name='freq2_@uid' data-name='freq' id='freq24_@uid' value='11'><label for='freq24_@uid'>1 fois par an ou moins</label>\n"+ "\t\t&nbsp;&nbsp;&nbsp;<input type='radio' name='freq2_@uid' data-name='freq' id='freq14_@uid' value='13'><label for='freq14_@uid'>1 fois par an ou moins</label>\n"+
"\t\t&nbsp;&nbsp;&nbsp;<input type='radio' name='freq2_@uid' data-name='freq' id='freq15_@uid' value='14'><label for='freq15_@uid'>Jamais</label>\n"+
"\t</h5>\n"+ "\t</h5>\n"+
"\t<h5 class='nobold color0'>\n"+ "\t<h5 class='nobold color0'>\n"+
"\t\tCourrier électronique<br>\n"+ "\t\tCourrier électronique<br>\n"+
"\t\t&nbsp;&nbsp;&nbsp;<input type='radio' name='freq3_@uid' data-name='freq' id='freq31_@uid' value='12'><label for='freq31_@uid'>plusieurs fois par semaine</label>\n"+ "\t\t&nbsp;&nbsp;&nbsp;<input type='radio' name='freq3_@uid' data-name='freq' id='freq16_@uid' value='15'><label for='freq16_@uid'>plusieurs fois par semaine</label>\n"+
"\t\t&nbsp;&nbsp;&nbsp;<input type='radio' name='freq3_@uid' data-name='freq' id='freq32_@uid' value='13'><label for='freq32_@uid'>1 fois par semaine</label>\n"+ "\t\t&nbsp;&nbsp;&nbsp;<input type='radio' name='freq3_@uid' data-name='freq' id='freq17_@uid' value='16'><label for='freq17_@uid'>1 fois par semaine</label>\n"+
"\t\t&nbsp;&nbsp;&nbsp;<input type='radio' name='freq3_@uid' data-name='freq' id='freq33_@uid' value='14'><label for='freq33_@uid'>1 fois par mois</label>\n"+ "\t\t&nbsp;&nbsp;&nbsp;<input type='radio' name='freq3_@uid' data-name='freq' id='freq18_@uid' value='17'><label for='freq18_@uid'>1 fois par mois</label>\n"+
"\t\t&nbsp;&nbsp;&nbsp;<input type='radio' name='freq3_@uid' data-name='freq' id='freq34_@uid' value='15'><label for='freq34_@uid'>1 fois par an ou moins</label>\n"+ "\t\t&nbsp;&nbsp;&nbsp;<input type='radio' name='freq3_@uid' data-name='freq' id='freq19_@uid' value='18'><label for='freq19_@uid'>1 fois par an ou moins</label>\n"+
"\t\t&nbsp;&nbsp;&nbsp;<input type='radio' name='freq3_@uid' data-name='freq' id='freq20_@uid' value='19'><label for='freq20_@uid'>Jamais</label>\n"+
"\t</h5>\n"+ "\t</h5>\n"+
"\t<h5 class='nobold color0'>\n"+ "\t<h5 class='nobold color0'>\n"+
"\t\tFacebook ou autre réseau social<br>\n"+ "\t\tFacebook ou autre réseau social<br>\n"+
"\t\t&nbsp;&nbsp;&nbsp;<input type='radio' name='freq4_@uid' data-name='freq' id='freq41_@uid' value='16'><label for='freq41_@uid'>plusieurs fois par semaine</label>\n"+ "\t\t&nbsp;&nbsp;&nbsp;<input type='radio' name='freq4_@uid' data-name='freq' id='freq21_@uid' value='20'><label for='freq21_@uid'>plusieurs fois par semaine</label>\n"+
"\t\t&nbsp;&nbsp;&nbsp;<input type='radio' name='freq4_@uid' data-name='freq' id='freq42_@uid' value='17'><label for='freq42_@uid'>1 fois par semaine</label>\n"+ "\t\t&nbsp;&nbsp;&nbsp;<input type='radio' name='freq4_@uid' data-name='freq' id='freq22_@uid' value='21'><label for='freq22_@uid'>1 fois par semaine</label>\n"+
"\t\t&nbsp;&nbsp;&nbsp;<input type='radio' name='freq4_@uid' data-name='freq' id='freq43_@uid' value='18'><label for='freq43_@uid'>1 fois par mois</label>\n"+ "\t\t&nbsp;&nbsp;&nbsp;<input type='radio' name='freq4_@uid' data-name='freq' id='freq23_@uid' value='22'><label for='freq23_@uid'>1 fois par mois</label>\n"+
"\t\t&nbsp;&nbsp;&nbsp;<input type='radio' name='freq4_@uid' data-name='freq' id='freq44_@uid' value='19'><label for='freq44_@uid'>1 fois par an ou moins</label>\n"+ "\t\t&nbsp;&nbsp;&nbsp;<input type='radio' name='freq4_@uid' data-name='freq' id='freq24_@uid' value='23'><label for='freq24_@uid'>1 fois par an ou moins</label>\n"+
"\t\t&nbsp;&nbsp;&nbsp;<input type='radio' name='freq4_@uid' data-name='freq' id='freq25_@uid' value='24'><label for='freq25_@uid'>Jamais</label>\n"+
"\t</h5>\n"+ "\t</h5>\n"+

View File

@ -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:"0",age:".",job:".",famsit:"0",studies:".",reltype:"0",reltypeSpecial:"",city:"",cp:"",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}}; 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:"0",age:".",job:".",famsit:"0",studies:".",reltype:"0",reltypeSpecial:"",city:"",cp:"",loc:"0",duration:["",""],context:"0",contextSpecial:["","",""],freq:["4","9","14","19","24"],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(),e=crc32(JSON.stringify(c)),d=lsi.get("fiches",c.uid);if(!1!==d){if(null!=d.hash&&d.hash==e)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(),e=crc32(JSON.stringify(c)),d=lsi.get("fiches",c.uid);if(!1!==d){if(null!=d.hash&&d.hash==e)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,cp:c.cp,loc:c.loc,duration:c.duration,context:c.context,contextSpecial:c.contextSpecial,freq:c.freq,connect:c.connect,connectSpecial:c.connectSpecial,hash:e};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,cp:c.cp,loc:c.loc,duration:c.duration,context:c.context,contextSpecial:c.contextSpecial,freq:c.freq,connect:c.connect,connectSpecial:c.connectSpecial,hash:e};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||isNaN(a.uid)||null==a.contact||isNaN(a.contact))return!1;a.city=null!=a.city?a.city:this.defaultData.city;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]? 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.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]?
@ -15,5 +15,5 @@ inputPhoneFiche.prototype.sync=function(){console.log("FICHE: SYNC");var a=lsi["
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.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");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= inputPhoneFiche.prototype.updateNavBar=function(){var a=lsi["export"]("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=
$('#nav-fiche [data-n="'+a[d].uid+'"]'),null!=b&&(!0===a[d].valid?b.addClass("done"):b.remClass("done"));this.nav($('#nav-fiche [data-n="'+this.selected+'"]'))}; $('#nav-fiche [data-n="'+a[d].uid+'"]'),null!=b&&(!0===a[d].valid?b.addClass("done"):b.remClass("done"));this.nav($('#nav-fiche [data-n="'+this.selected+'"]'))};
inputPhoneFiche.prototype.check=function(a){if(2>a.city.length||isNaN(a.cp)||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||"."==a.age||""==a.sexe||""==a.famsit||""==a.reltype||""==a.loc||""==a.context)return!1;for(var b=0;b<a.freq.length;b++)if(""==a.freq[b])return!1;for(b=0;b<a.connect.length;b++)if(""==a.connect[b])return!1;return"8"==a.reltype&&2>a.reltypeSpecial.length|| inputPhoneFiche.prototype.check=function(a){if(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||"."==a.age||""==a.sexe||""==a.famsit||""==a.reltype||""==a.loc||""==a.context)return!1;for(var b=0;b<a.freq.length;b++)if(""==a.freq[b])return!1;for(b=0;b<a.connect.length;b++)if(""==a.connect[b])return!1;return"8"==a.reltype&&2>a.reltypeSpecial.length||
"11"==a.context&&2>a.contextSpecial[0].length||"12"==a.context&&2>a.contextSpecial[1].length||"13"==a.context&&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)}; "11"==a.context&&2>a.contextSpecial[0].length||"12"==a.context&&2>a.contextSpecial[1].length||"13"==a.context&&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)};

View File

@ -26,7 +26,7 @@ inputPhoneFiche.prototype = {
duration: ['', ''], duration: ['', ''],
context: '0', // Choix 1 à 14 context: '0', // Choix 1 à 14
contextSpecial: ['', '', ''], contextSpecial: ['', '', ''],
freq: ['0', '4', '8', '12', '16'], // 1er choix des 4 pour chaque question freq: ['4', '9', '14', '19', '24'], // 1er choix des 4 pour chaque question
connect: ['1', '3', '5', '7', '9', '11'], // Le deuxième choix (Oui/Non) donc 'Non' par défaut pour chaque question connect: ['1', '3', '5', '7', '9', '11'], // Le deuxième choix (Oui/Non) donc 'Non' par défaut pour chaque question
connectSpecial: ['', ''], connectSpecial: ['', ''],
timestamp: 0, timestamp: 0,
@ -529,9 +529,6 @@ inputPhoneFiche.prototype.check = function(ficheData){
// 1. La ville a au moins 2 caractères // 1. La ville a au moins 2 caractères
if( ficheData.city.length < 2 ) if( ficheData.city.length < 2 )
return false; return false;
// 2. Le code postal est un nombre
if( isNaN(ficheData.cp) )
return false;
// 3. La durée de la relation en mois est vide ou un nombre // 3. La durée de la relation en mois est vide ou un nombre
if( isNaN(parseInt(ficheData.duration[0])) && ficheData.duration[0].length > 0 ) if( isNaN(parseInt(ficheData.duration[0])) && ficheData.duration[0].length > 0 )
return false; return false;

View File

@ -8,4 +8,4 @@ c[b].removeAttribute("checked");c=$$('article.mini-fiche-relation input[data-nam
inputPhoneMini.prototype.sync=function(){console.log("MINI FICHE: SYNC");var a=lsi["export"]("contacts"),b=lsi["export"]("fiches"),c=[],e;for(e in b)-1==c.indexOf(b[e].contact)&&c.push(b[e].contact);for(var d in a)-1<c.indexOf(parseInt(d))?lsi.del("mini-fiches",d):(b=0==a[d].username.length+a[d].firstname.length+a[d].lastname.length?d.toString()+"-":d,e=lsi.get("mini-fiches",b),null==e&&(e=this.defaultData,e.valid=!1,isNaN(b)&&(e.reltype="9")),e.uid=parseInt(d),lsi.set("mini-fiches",b,e));e=lsi["export"]("mini-fiches"); inputPhoneMini.prototype.sync=function(){console.log("MINI FICHE: SYNC");var a=lsi["export"]("contacts"),b=lsi["export"]("fiches"),c=[],e;for(e in b)-1==c.indexOf(b[e].contact)&&c.push(b[e].contact);for(var d in a)-1<c.indexOf(parseInt(d))?lsi.del("mini-fiches",d):(b=0==a[d].username.length+a[d].firstname.length+a[d].lastname.length?d.toString()+"-":d,e=lsi.get("mini-fiches",b),null==e&&(e=this.defaultData,e.valid=!1,isNaN(b)&&(e.reltype="9")),e.uid=parseInt(d),lsi.set("mini-fiches",b,e));e=lsi["export"]("mini-fiches");
if(null==e[this.selected])for(d in e)if(!isNaN(d)){this.selected=parseInt(d);break}};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"))}; if(null==e[this.selected])for(d in e)if(!isNaN(d)){this.selected=parseInt(d);break}};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");this.nav_container.innerHTML="";var b=0,c;for(c in a)isNaN(c)||(this.nav_container.innerHTML+='<span data-n="'+c+'">'+ ++b+"</span>");for(c in a)isNaN(c)||(b=$('#nav-mini [data-n="'+a[c].uid+'"]'),null!=b&&(!0===a[c].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");this.nav_container.innerHTML="";var b=0,c;for(c in a)isNaN(c)||(this.nav_container.innerHTML+='<span data-n="'+c+'">'+ ++b+"</span>");for(c in a)isNaN(c)||(b=$('#nav-mini [data-n="'+a[c].uid+'"]'),null!=b&&(!0===a[c].valid?b.addClass("done"):b.remClass("done")));this.nav($('#nav-mini [data-n="'+this.selected+'"]'))};
inputPhoneMini.prototype.check=function(a){return""==a.sexe||"."==a.studies||"."==a.age||""==a.loc||""==a.reltype||"8"==a.reltype&&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)}; inputPhoneMini.prototype.check=function(a){return""==a.sexe||"."==a.studies||"."==a.age||""==a.loc||""==a.reltype||"10"==a.reltype&&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)};

View File

@ -383,8 +383,8 @@ inputPhoneMini.prototype.check = function(miniData){
// 5. Le TYPE DE RELATION a un et un seul choix // 5. Le TYPE DE RELATION a un et un seul choix
if( miniData.reltype == '' ) if( miniData.reltype == '' )
return false; return false;
// 6. TYPE DE RELATION si autre est coché (indice 8), reltypeSpecial doit avoir au moins 2 caractère // 6. TYPE DE RELATION si autre est coché (indice 10), reltypeSpecial doit avoir au moins 2 caractère
if( miniData.reltype == '8' && miniData.reltypeSpecial.length < 2 ) if( miniData.reltype == '10' && miniData.reltypeSpecial.length < 2 )
return false; return false;

View File

@ -18,9 +18,19 @@
$file_name = sessionManager::sha1($subjects[0]); $file_name = sessionManager::sha1($subjects[0]);
$phone_log = json_decode( file_get_contents(__ROOT__.'/src/upload/phone_storage/'.$file_name.'.json'), true ); $phone_log = json_decode( file_get_contents(__ROOT__.'/src/upload/phone_storage/'.$file_name.'.json'), true );
// Si erreur
if( $phone_log == null )
return array( 'ModuleError' => ManagerError::ParsingFailed );
$dict = json_decode( file_get_contents(__ROOT__.'/src/upload/phone_storage/dictionary.json'), true ); $dict = json_decode( file_get_contents(__ROOT__.'/src/upload/phone_storage/dictionary.json'), true );
// $output = $phone_log; // Si erreur
if( $dict == null )
return array( 'ModuleError' => ManagerError::ParsingFailed );
// Contiendra le résultat // Contiendra le résultat

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

File diff suppressed because it is too large Load Diff

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

@ -1,15 +1,15 @@
var subjectManager,contactManager,miniManager,ficheManager,matriceManager; var subjectManager,contactManager,miniManager,ficheManager,matriceManager;
function dynamicUpdate(a){var b=a instanceof Element,f=b&&"SPAN"==a.tagName&&"switch-left"==a.className,e=b&&"SPAN"==a.tagName&&"switch-both"==a.className,c=b&&"INPUT"==a.tagName&&"submit"==a.type,d=b&&"SPAN"==a.tagName&&("nav-mini"==a.parentNode.id||"nav-fiche"==a.parentNode.id),b=b&&"SPAN"==a.tagName&&"nav-contact"==a.parentNode.id;if(!(e||f||c||d||b)&&!0!==a)return!1;if(e)console.log("> switch firstname <-> lastname"),f=a.parentNode,a=f.children[8],f=f.children[10],e=a.value,a.value=f.value,f.value= function dynamicUpdate(a){var f=a instanceof Element,b=f&&"SPAN"==a.tagName&&"switch-left"==a.className,e=f&&"SPAN"==a.tagName&&"switch-both"==a.className,c=f&&"INPUT"==a.tagName&&"submit"==a.type,d=f&&"SPAN"==a.tagName&&("nav-mini"==a.parentNode.id||"nav-fiche"==a.parentNode.id),f=f&&"SPAN"==a.tagName&&"nav-contact"==a.parentNode.id;if(!(e||b||c||d||f)&&!0!==a)return!1;if(e)console.log("> switch firstname <-> lastname"),b=a.parentNode,a=b.children[8],b=b.children[10],e=a.value,a.value=b.value,b.value=
e;else if(f){console.log("> switch firstname+lastname -> username");f=a.parentNode;e=f.children[6];a=f.children[8];f=f.children[10];if(0<e.value.length||0==a.value.length&&0==f.value.length)return!1;e.value=a.value+" "+f.value;a.value="";f.value=""}else console.log("> dynamic update"),miniManager.fieldsToStorage(),ficheManager.fieldsToStorage(),contactManager.fieldsToStorage(),matriceManager.fieldsToStorage(),ficheManager.sync(),miniManager.sync(),miniManager.storageToFields(),ficheManager.storageToFields(), e;else if(b){console.log("> switch firstname+lastname -> username");b=a.parentNode;e=b.children[6];a=b.children[8];b=b.children[10];if(0<e.value.length||0==a.value.length&&0==b.value.length)return!1;e.value=a.value+" "+b.value;a.value="";b.value=""}else console.log("> dynamic update"),miniManager.fieldsToStorage(),ficheManager.fieldsToStorage(),contactManager.fieldsToStorage(),matriceManager.fieldsToStorage(),ficheManager.sync(),miniManager.sync(),miniManager.storageToFields(),ficheManager.storageToFields(),
matriceManager.storageToFields(),(c||b)&&contactManager.storageToFields()}function readableName(a,b,f){var e=b.length,c=f.length;return 0<a.length?0<e+c?a+" ("+(b+" "+f).trim()+")":a:0<e+c?(b+" "+f).trim():"Inconnu"} matriceManager.storageToFields(),(c||f)&&contactManager.storageToFields()}function readableName(a,f,b){var e=f.length,c=b.length;return 0<a.length?0<e+c?a+" ("+(f+" "+b).trim()+")":a:0<e+c?(f+" "+b).trim():"Inconnu"}
include("/js/includes/input-phone-subject.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.js",function(){subjectManager=new inputPhoneSubject($('article.subject-panel [data-name="tmp_id"]'),$('article.subject-panel [data-name="number"]'),$('article.subject-panel [data-name="username"]'),$('article.subject-panel [data-name="firstname"]'), include("/js/includes/input-phone-subject.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.js",function(){subjectManager=new inputPhoneSubject($('article.subject-panel [data-name="tmp_id"]'),$('article.subject-panel [data-name="number"]'),$('article.subject-panel [data-name="username"]'),$('article.subject-panel [data-name="firstname"]'),
$('article.subject-panel [data-name="lastname"]'),$('article.subject-panel [data-name="submit"]'));subjectManager.attach();contactManager=new inputPhoneContact($("article.contact-panel"),$("#nav-contact"));contactManager.attach(dynamicUpdate);miniManager=new inputPhoneMini($("article.mini-relation-panel"),$("#nav-mini"));miniManager.attach(dynamicUpdate);ficheManager=new inputPhoneFiche($("article.relation-panel"),$("#nav-fiche"));ficheManager.attach(dynamicUpdate);matriceManager=new inputPhoneMatrice($("article.matrice-panel")); $('article.subject-panel [data-name="lastname"]'),$('article.subject-panel [data-name="submit"]'));subjectManager.attach();contactManager=new inputPhoneContact($("article.contact-panel"),$("#nav-contact"));contactManager.attach(dynamicUpdate);miniManager=new inputPhoneMini($("article.mini-relation-panel"),$("#nav-mini"));miniManager.attach(dynamicUpdate);ficheManager=new inputPhoneFiche($("article.relation-panel"),$("#nav-fiche"));ficheManager.attach(dynamicUpdate);matriceManager=new inputPhoneMatrice($("article.matrice-panel"));
matriceManager.attach(dynamicUpdate);$('input#call_log-import[type="file"]').addEventListener("click",function(a){a.target.value=null},!1);$('input#call_log-import[type="file"]').addEventListener("change",function(a){a={path:"upload/call_log",phone_number:$("#subject_phone_number").value,file:a.target.files[0]};api.send(a,function(b){console.log(b);var a=null;if(0!=b.ModuleError)9==b.ModuleError?Notification.error("Erreur","Il est n\u00e9cessaire de saisir les informations du <b>sujet</b> avant d'exporter son journal d'appel"): matriceManager.attach(dynamicUpdate);$('input#call_log-import[type="file"]').addEventListener("click",function(a){a.target.value=null},!1);$('input#call_log-import[type="file"]').addEventListener("change",function(a){a={path:"upload/call_log",phone_number:$("#subject_phone_number").value,file:a.target.files[0]};api.send(a,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",b.ModuleError);else{a=Notification.info("Info","Chargement du journal d'appel");subjectManager.tmp_id.value=b.tmp_id;for(var e=0;e<b.call.length;e++){var c=b.directory[b.call[e]],d=c.name.split(" ");lsi.set("contacts",c.id,{uid:c.id,number:c.number,username:1==d.length?d[0]:"",firstname:1<d.length?d[0]:"",lastname:1<d.length?d.splice(1).join(" "):"",countsms:c.sms,countcall:c.call,call:e,sms:-1})}for(e=0;e<b.sms.length;e++)c=b.directory[b.sms[e]],-1<b.call.indexOf(b.sms[e])? Notification.error("Erreur",a.ModuleError);else{b=Notification.info("Info","Chargement du journal d'appel");subjectManager.tmp_id.value=a.tmp_id;for(var e=0;e<a.call.length;e++){var c=a.directory[a.call[e]],d=c.name.split(" ");lsi.set("contacts",c.id,{uid:c.id,number:c.number,username:1==d.length?d[0]:"",firstname:1<d.length?d[0]:"",lastname:1<d.length?d.splice(1).join(" "):"",countsms:c.sms,countcall:c.call,call:e,sms:-1})}for(e=0;e<a.sms.length;e++)c=a.directory[a.sms[e]],-1<a.call.indexOf(a.sms[e])?
(d=lsi.get("contacts",c.id),d.sms=e,lsi.set("contacts",c.id,d)):(d=c.name.split(" "),lsi.set("contacts",c.id,{uid:c.id,number:c.number,username:1==d.length?d[0]:"",firstname:1<d.length?d[0]:"",lastname:1<d.length?d.splice(1).join(" "):"",countsms:c.sms,countcall:c.call,call:-1,sms:e}));for(var g in b.directory)g=parseInt(g),-1<b.call.indexOf(g)||-1<b.sms.indexOf(g)||(c=b.directory[g],d=c.name.split(" "),lsi.set("contacts",c.id,{uid:c.id,number:c.number,username:1==d.length?d[0]:"",firstname:1<d.length? (d=lsi.get("contacts",c.id),d.sms=e,lsi.set("contacts",c.id,d)):(d=c.name.split(" "),lsi.set("contacts",c.id,{uid:c.id,number:c.number,username:1==d.length?d[0]:"",firstname:1<d.length?d[0]:"",lastname:1<d.length?d.splice(1).join(" "):"",countsms:c.sms,countcall:c.call,call:-1,sms:e}));for(var g in a.directory)g=parseInt(g),-1<a.call.indexOf(g)||-1<a.sms.indexOf(g)||(c=a.directory[g],d=c.name.split(" "),lsi.set("contacts",c.id,{uid:c.id,number:c.number,username:1==d.length?d[0]:"",firstname:1<d.length?
d[0]:"",lastname:1<d.length?d.splice(1).join(" "):"",countsms:c.sms,countcall:c.call,call:-1,sms:-1}));contactManager.storageToFields();dynamicUpdate(!0);null!=a&&a.click();Notification.success("OK","Chargement termin\u00e9")}})},!1);$("#clear-all").addEventListener("click",function(a){lsi.clear("subject");lsi.clear("contacts");lsi.clear("mini-fiches");lsi.clear("fiches");lsi.clear("matrice");subjectManager.storageToFields();contactManager.storageToFields();miniManager.storageToFields();ficheManager.storageToFields(); d[0]:"",lastname:1<d.length?d.splice(1).join(" "):"",countsms:c.sms,countcall:c.call,call:-1,sms:-1}));contactManager.storageToFields();dynamicUpdate(!0);null!=b&&b.click();Notification.success("OK","Chargement termin\u00e9")}})},!1);$("#clear-all").addEventListener("click",function(a){lsi.clear("subject");lsi.clear("contacts");lsi.clear("mini-fiches");lsi.clear("fiches");lsi.clear("matrice");subjectManager.storageToFields();contactManager.storageToFields();miniManager.storageToFields();ficheManager.storageToFields();
matriceManager.storageToFields();Notification.success("OK","Les donn\u00e9es ont \u00e9t\u00e9 supprim\u00e9es")},!1);$("#export-all").addEventListener("click",function(a){Notification.info("INFORMATION","Lancement du t\u00e9l\u00e9chargement de la sauvegarde");a={subject:lsi["export"]("subject")[0],contacts:lsi["export"]("contacts"),mini:lsi["export"]("mini-fiches"),fiches:lsi["export"]("fiches"),matrice:lsi["export"]("matrice")[0]};var b=$("#download-target");b.download="local-data.json";b.href= matriceManager.storageToFields();Notification.success("OK","Les donn\u00e9es ont \u00e9t\u00e9 supprim\u00e9es")},!1);$("#export-all").addEventListener("click",function(a){Notification.info("INFORMATION","Lancement du t\u00e9l\u00e9chargement de la sauvegarde");a={subject:lsi["export"]("subject")[0],contacts:lsi["export"]("contacts"),mini:lsi["export"]("mini-fiches"),fiches:lsi["export"]("fiches"),matrice:lsi["export"]("matrice")[0]};var f=$("#download-target");f.download="local-data.json";f.href=
"data:application/octet-stream,"+encodeURIComponent(JSON.stringify(a));b.click()},!1);$("#import-all").addEventListener("click",function(a){$("#local-upload").click()},!1);$("#local-upload").addEventListener("click",function(a){a.target.value=null},!1);$("#local-upload").addEventListener("change",function(a){a={path:"upload/local_data",file:$("#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("subject", "data:application/octet-stream,"+encodeURIComponent(JSON.stringify(a));f.click()},!1);$("#import-all").addEventListener("click",function(a){$("#local-upload").click()},!1);$("#local-upload").addEventListener("click",function(a){a.target.value=null},!1);$("#local-upload").addEventListener("change",function(a){a={path:"upload/local_data",file:$("#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("subject",
0,a.local_data.subject);lsi["import"]("contacts",a.local_data.contacts);lsi["import"]("mini-fiches",a.local_data.mini);lsi["import"]("fiches",a.local_data.fiches);lsi.set("matrice",0,a.local_data.matrice);subjectManager.storageToFields();contactManager.storageToFields();matriceManager.storageToFields();dynamicUpdate(!0)})},!1);$("#submit-all").addEventListener("click",function(a){console.log("> GATHERING ALL DATA");subjectManager.fieldsToStorage();contactManager.fieldsToStorage();miniManager.fieldsToStorage(); 0,a.local_data.subject);lsi["import"]("contacts",a.local_data.contacts);lsi["import"]("mini-fiches",a.local_data.mini);lsi["import"]("fiches",a.local_data.fiches);lsi.set("matrice",0,a.local_data.matrice);subjectManager.storageToFields();contactManager.storageToFields();matriceManager.storageToFields();dynamicUpdate(!0)})},!1);$("#submit-all").addEventListener("click",function(a){console.log("> GATHERING ALL DATA");subjectManager.fieldsToStorage();contactManager.fieldsToStorage();miniManager.fieldsToStorage();
ficheManager.fieldsToStorage();if(!subjectManager.check())return Notification.warning("Attention","Vous devez saisir les informations du <i>sujet</i>"),!1;a=lsi["export"]("mini-fiches");for(var b in a)if(!a[b].valid)return Notification.warning("Attention","La <i>fiche rapide</i> <b>"+(parseInt(b)+1)+"</b> est incompl\u00e8te et/ou incorrecte"),!1;a=lsi["export"]("fiches");for(b in a)if(!a[b].valid)return Notification.warning("Attention","La <i>fiche compl\u00e8te</i> <b>"+(parseInt(b)+1)+"</b> est incompl\u00e8te et/ou incorrecte"), ficheManager.fieldsToStorage();if(!subjectManager.check())return Notification.warning("Attention","Vous devez saisir les informations du <i>sujet</i>"),!1;a=lsi["export"]("mini-fiches");var f=0,b;for(b in a)if(!isNaN(b)&&(f++,!a[b].valid))return Notification.warning("Attention","La <i>fiche rapide</i> <b>"+f+"</b> est incompl\u00e8te et/ou incorrecte"),!1;b={path:"input/phone",subject:lsi["export"]("subject")[0],contacts:lsi["export"]("contacts"),mini:lsi["export"]("mini-fiches"),fiches:lsi["export"]("fiches"),
!1;b={path:"input/phone",subject:lsi["export"]("subject")[0],contacts:lsi["export"]("contacts"),mini:lsi["export"]("mini-fiches"),fiches:lsi["export"]("fiches"),matrice:lsi["export"]("matrice")[0]};api.send(b,function(a){if(0!=a.ModuleError)return Notification.error("ERREUR",a.ModuleError),!1;console.log(a)},!1)},!1)})})})})}); matrice:lsi["export"]("matrice")[0]};api.send(b,function(a){console.log(a);if(0!=a.ModuleError)return Notification.error("ERREUR",a.ModuleError),!1;console.log(a)},!1)},!1)})})})})});

View File

@ -511,18 +511,25 @@ include('/js/includes/input-phone-matrice.js', function(){
} }
// {2} Vérification des mini-fiches // // {2} Vérification des mini-fiches //
var mini = lsi.export('mini-fiches'); var mini = lsi.export('mini-fiches');
for( var id in mini ) var i = 0;
for( var id in mini ){ if( !isNaN(id) ){
i++
if( !mini[id].valid ){ if( !mini[id].valid ){
Notification.warning('Attention', 'La <i>fiche rapide</i> <b>'+(parseInt(id)+1)+'</b> est incomplète et/ou incorrecte'); Notification.warning('Attention', 'La <i>fiche rapide</i> <b>'+i+'</b> est incomplète et/ou incorrecte');
return false; return false;
} }
}}
// {3} Vérification des fiches // // {3} Vérification des fiches //
var fiches = lsi.export('fiches'); //TODO: Remettre la vérification des fiches
for( var id in fiches ) // var fiches = lsi.export('fiches');
if( !fiches[id].valid ){ // for( var id in fiches )
Notification.warning('Attention', 'La <i>fiche complète</i> <b>'+(parseInt(id)+1)+'</b> est incomplète et/ou incorrecte'); // if( !fiches[id].valid ){
return false; // Notification.warning('Attention', 'La <i>fiche complète</i> <b>'+(parseInt(id)+1)+'</b> est incomplète et/ou incorrecte');
} // return false;
// }
@ -539,6 +546,8 @@ include('/js/includes/input-phone-matrice.js', function(){
/* (4) On envoie la requête et traite la réponse */ /* (4) On envoie la requête et traite la réponse */
api.send(request, function(response){ api.send(request, function(response){
console.log(response);
// Si erreur, on la notifie // Si erreur, on la notifie
if( response.ModuleError != 0 ){ if( response.ModuleError != 0 ){
Notification.error('ERREUR', response.ModuleError); Notification.error('ERREUR', response.ModuleError);