Correction d'erreur dans le html des mini fiches, la `location` était `checked`.

This commit is contained in:
xdrm-brackets 2016-04-27 18:04:54 +02:00
parent ad43715420
commit 0b314b5f23
17 changed files with 93 additions and 41 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

@ -443,7 +443,7 @@
// Animation quand la page est validée
&.done{
font-weight: normal;
font-weight: bold;
color: $timeline-2;
// Animation de hover

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

File diff suppressed because one or more lines are too long

View File

@ -99,10 +99,10 @@ miniFicheBuilder.setLayout(
"\t<h5 class='nobold color0'>\n"+
"\t\tOù habite t-elle/il ?<br>\n"+
"\t\t&nbsp&nbsp&nbsp<input type='radio' checked name='loc_min_@uid' data-name='loc' id='locA_min_@uid' checked='@loca'><label for='locA_min_@uid'>- de 10km</label><br>\n"+
"\t\t&nbsp&nbsp&nbsp<input type='radio' name='loc_min_@uid' data-name='loc' id='locB_min_@uid' checked='@locb'><label for='locB_min_@uid'>de 10km à 30km</label><br>\n"+
"\t\t&nbsp&nbsp&nbsp<input type='radio' name='loc_min_@uid' data-name='loc' id='locC_min_@uid' checked='@locc'><label for='locC_min_@uid'>de 30km à 100km</label><br>\n"+
"\t\t&nbsp&nbsp&nbsp<input type='radio' name='loc_min_@uid' data-name='loc' id='locD_min_@uid' checked='@locd'><label for='locD_min_@uid'>+ de 100km</label>\n"+
"\t\t&nbsp&nbsp&nbsp<input type='radio' name='loc_min_@uid' data-name='loc' id='locA_min_@uid'><label for='locA_min_@uid'>- de 10km</label><br>\n"+
"\t\t&nbsp&nbsp&nbsp<input type='radio' name='loc_min_@uid' data-name='loc' id='locB_min_@uid'><label for='locB_min_@uid'>de 10km à 30km</label><br>\n"+
"\t\t&nbsp&nbsp&nbsp<input type='radio' name='loc_min_@uid' data-name='loc' id='locC_min_@uid'><label for='locC_min_@uid'>de 30km à 100km</label><br>\n"+
"\t\t&nbsp&nbsp&nbsp<input type='radio' name='loc_min_@uid' data-name='loc' id='locD_min_@uid'><label for='locD_min_@uid'>+ de 100km</label>\n"+
"\t</h5>\n"+
"</article>");
@ -361,31 +361,31 @@ ficheBuilder.setLayout(
"\t<h5 class='nobold color0'>\n"+
"\t\tSon numéro de mobile est enregistré sur votre mobile (ou vous-mêmes êtes sur le sien)<br>\n"+
"\t\t&nbsp;&nbsp;&nbsp;<input type='radio' name='connect2_@uid' data-name='connect1' id='connect21_@uid'><label for='connect21_@uid'>Oui</label>\n"+
"\t\t&nbsp;&nbsp;&nbsp;<input type='radio' name='connect2_@uid' data-name='connect1' id='connect22_@uid' checked><label for='connect22_@uid'>Non</label>\n"+
"\t\t&nbsp;&nbsp;&nbsp;<input type='radio' name='connect2_@uid' data-name='connect1' id='connect22_@uid'><label for='connect22_@uid'>Non</label>\n"+
"\t</h5>\n"+
"\t<h5 class='nobold color0'>\n"+
"\t\tElle figure parmi vos amis facebook<br>\n"+
"\t\t&nbsp;&nbsp;&nbsp;<input type='radio' name='connect3_@uid' data-name='connect2' id='connect31_@uid'><label for='connect31_@uid'>Oui</label>\n"+
"\t\t&nbsp;&nbsp;&nbsp;<input type='radio' name='connect3_@uid' data-name='connect2' id='connect32_@uid' checked><label for='connect32_@uid'>Non</label>\n"+
"\t\t&nbsp;&nbsp;&nbsp;<input type='radio' name='connect3_@uid' data-name='connect2' id='connect32_@uid'><label for='connect32_@uid'>Non</label>\n"+
"\t</h5>\n"+
"\t<h5 class='nobold color0'>\n"+
"\t\tElle figure parmi vos amis facebook et vous interagissez avec elle sur ce dispositif régulièrement<br>\n"+
"\t\t&nbsp;&nbsp;&nbsp;<input type='radio' name='connect4_@uid' data-name='connect3' id='connect41_@uid'><label for='connect41_@uid'>Oui</label>\n"+
"\t\t&nbsp;&nbsp;&nbsp;<input type='radio' name='connect4_@uid' data-name='connect3' id='connect42_@uid' checked><label for='connect42_@uid'>Non</label>\n"+
"\t\t&nbsp;&nbsp;&nbsp;<input type='radio' name='connect4_@uid' data-name='connect3' id='connect42_@uid'><label for='connect42_@uid'>Non</label>\n"+
"\t</h5>\n"+
"\t<h5 class='nobold color0'>\n"+
"\t\tVous le suivez sur Twitter<br>\n"+
"\t\t&nbsp;&nbsp;&nbsp;<input type='radio' name='connect5_@uid' data-name='connect4' id='connect51_@uid'><label for='connect51_@uid'>Oui</label>\n"+
"\t\t&nbsp;&nbsp;&nbsp;<input type='radio' name='connect5_@uid' data-name='connect4' id='connect52_@uid' checked><label for='connect52_@uid'>Non</label>\n"+
"\t\t&nbsp;&nbsp;&nbsp;<input type='radio' name='connect5_@uid' data-name='connect4' id='connect52_@uid'><label for='connect52_@uid'>Non</label>\n"+
"\t</h5>\n"+
"\t<h5 class='nobold color0'>\n"+
"\t\tVous communiquez avec cette personne sur Twitter<br>\n"+
"\t\t&nbsp;&nbsp;&nbsp;<input type='radio' name='connect6_@uid' data-name='connect5' id='connect61_@uid'><label for='connect61_@uid'>Oui</label>\n"+
"\t\t&nbsp;&nbsp;&nbsp;<input type='radio' name='connect6_@uid' data-name='connect5' id='connect62_@uid' checked><label for='connect62_@uid'>Non</label>\n"+
"\t\t&nbsp;&nbsp;&nbsp;<input type='radio' name='connect6_@uid' data-name='connect5' id='connect62_@uid'><label for='connect62_@uid'>Non</label>\n"+
"\t</h5>\n"+
"\t<h5 class='nobold color0'>\n"+

View File

@ -15,5 +15,6 @@ b[c].removeAttribute("checked");for(b=0;b<a.freq.length;b++)for(var d=$$('articl
d[c].setAttribute("checked","checked"):d[c].removeAttribute("checked")};inputPhoneFiche.prototype.storageToFields=function(){console.log("FICHE: STORAGE TO FIELDS");var a=lsi.keys("fiches");this.container.innerHTML="";for(var c=[],b=0;b<a.length;b++){var d=lsi.get("fiches",a[b]);this.add(d);c.push(d.uid)}this.updateNavBar(c)};
inputPhoneFiche.prototype.sync=function(){console.log("FICHE: SYNC");for(var a=lsi.keys("contacts"),c=0;c<a.length&&9>c;c++){var b=lsi.get("contacts",a[c]),d=lsi.get("fiches",a[c]);null==d&&(d=this.defaultData);d.uid=b.uid;d.firstname=b.firstname;d.lastname=b.lastname;d.username=b.username;lsi.set("fiches",a[c],d)}};
inputPhoneFiche.prototype.nav=function(a){if("undefined"==typeof a||isNaN(a.innerHTML))return!1;for(var c=$$("#nav-fiche > span.active"),b=0;b<c.length;b++)c[b].remClass("active");a.addClass("active");this.selected=parseInt(a.innerHTML)-1;a=$$("article.relation-panel .fiche-relation.active");for(b=0;b<a.length;b++)a[b].remClass("active");this.container.children[this.selected].addClass("active")};
inputPhoneFiche.prototype.updateNavBar=function(a){this.nav_container.innerHTML="";for(var c=0;c<a.length;c++){var b=parseInt(a[c])+1;this.nav_container.innerHTML+="<span>"+b+"</span>"}this.check();this.nav(this.nav_container.children[this.selected])};inputPhoneFiche.prototype.check=function(){for(var a=lsi.keys("fiches"),c=0;c<a.length;c++){var b=lsi.get("fiches",a[c]),d=!0;(d=(d=d&&!isNaN(parseInt(b.age)))&&"."!=b.job)?this.nav_container.children[b.uid].addClass("done"):this.nav_container.children[b.uid].remClass("done")}};
inputPhoneFiche.prototype.updateNavBar=function(a){this.nav_container.innerHTML="";for(var c=0;c<a.length;c++){var b=parseInt(a[c])+1;this.nav_container.innerHTML+="<span>"+b+"</span>"}this.check();this.nav(this.nav_container.children[this.selected])};
inputPhoneFiche.prototype.check=function(){for(var a=lsi.keys("fiches"),c=0;c<a.length;c++){var b=lsi.get("fiches",a[c]),d=!0;(d=(d=(d=(d=d&&!isNaN(parseInt(miniData.age)))&&checkRadioValue(miniData.sexe[0]))&&"."!=miniData.job)&&checkRadioValue(miniData.loc))?this.nav_container.children[b.uid].addClass("done"):this.nav_container.children[b.uid].remClass("done")}};
inputPhoneFiche.prototype.attach=function(a){console.log("FICHE: ATTACH");lsi.createDataset("fiches");this.storageToFields();this.handler=a;var c=this,c=this;this.nav_container.addEventListener("click",function(a){c.nav(a.target);c.handler()},!1)};

View File

@ -432,11 +432,41 @@ inputPhoneFiche.prototype.check = function(){
var ficheData = lsi.get('fiches', ficheKeys[i]);
/* (2) On vérifie le formulaire complet */
// {1} Vérification des input //
var validForm = true;
// 1. L'age est un nombre
// 2. Le métier est défini
validForm = validForm && !isNaN(parseInt(ficheData.age));
validForm = validForm && ficheData.job != '.';
validForm = validForm && !isNaN(parseInt(miniData.age));
// 2. Le sexe est défini
validForm = validForm && checkRadioValue(miniData.sexe[0]);
// 3. Le métier est défini
validForm = validForm && miniData.job != '.';
// 4. La distance de localisation est définie
validForm = validForm && checkRadioValue(miniData.loc);
// VALUE:
// - age
// - city
// - duration0/duration1
// - contextspecial0/1/2
// - connectspecial0/1
//
// SELECT:
// - job
// - studies
//
//
// RADIO:
// - sexe
// - famsit
// - reltype
// - loc
// - context
// - freq0/1/2/3/4
// - connect0/1/2/3/4/5
/* (3) Si le formulaire est valide, on le met en valeur dans la barre de navigation (pages) */
if( validForm )

View File

@ -1,11 +1,12 @@
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:{firstname:"",lastname:"",username:"",sexe:[{status:!0},{status:!1}],age:"",job:".",loc:[{status:!0},{status:!1},{status:!1},{status:!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=lsi.get("mini-fiches","form"+c.uid.value);!1===d&&(d.username="inconnu",d.firstname="inconnu",d.lastname="inconnu");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};
lsi.set("mini-fiches","form"+c.uid,c)}};
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();console.log(c);var d=lsi.get("mini-fiches","form"+c.uid.value);!1===d&&(d.username="inconnu",d.firstname="inconnu",d.lastname="inconnu");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};lsi.set("mini-fiches","form"+c.uid,c)}};
inputPhoneMini.prototype.add=function(a){console.log("MINI FICHE: ADD");if(null==a.uid)return!1;a.firstname=null!=a.firstname?a.firstname:this.defaultData.firstname;a.lastname=null!=a.lastname?a.lastname:this.defaultData.lastname;a.username=null!=a.username?a.username:this.defaultData.username;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;this.container.innerHTML+=
miniFicheBuilder.build({firstname:a.firstname,lastname:a.lastname,username:a.username,uid:a.uid,age:a.age,job:a.job});var 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"]');console.log(a.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")};
"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.keys("mini-fiches");this.container.innerHTML="";for(var b=[],c=0;c<a.length;c++){var d=lsi.get("mini-fiches",a[c]);this.add({uid:d.uid,firstname:d.firstname,lastname:d.lastname,username:d.username,age:d.age,sexe:d.sexe,job:d.job,loc:d.loc});b.push(d.uid)}this.updateNavBar(b)};
inputPhoneMini.prototype.sync=function(){console.log("MINI FICHE: SYNC");for(var a=lsi.keys("contacts"),b=0;b<a.length;b++){var c=lsi.get("contacts",a[b]),d=lsi.get("mini-fiches",a[b]);null==d&&(d=this.defaultData);d.uid=c.uid;d.firstname=c.firstname;d.lastname=c.lastname;d.username=c.username;lsi.set("mini-fiches",a[b],d)}};
inputPhoneMini.prototype.nav=function(a){if("undefined"==typeof a||isNaN(a.innerHTML))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;a=$$("article.mini-relation-panel .mini-fiche-relation.active");for(c=0;c<a.length;c++)a[c].remClass("active");this.container.children[this.selected].addClass("active")};
inputPhoneMini.prototype.updateNavBar=function(a){this.nav_container.innerHTML="";for(var b=0;b<a.length;b++){var c=parseInt(a[b])+1;this.nav_container.innerHTML+="<span>"+c+"</span>"}this.check();this.nav(this.nav_container.children[this.selected])};inputPhoneMini.prototype.check=function(){for(var a=lsi.keys("mini-fiches"),b=0;b<a.length;b++){var c=lsi.get("mini-fiches",a[b]),d=!0;(d=(d=d&&!isNaN(parseInt(c.age)))&&"."!=c.job)?this.nav_container.children[c.uid].addClass("done"):this.nav_container.children[c.uid].remClass("done")}};
inputPhoneMini.prototype.updateNavBar=function(a){this.nav_container.innerHTML="";for(var b=0;b<a.length;b++){var c=parseInt(a[b])+1;this.nav_container.innerHTML+="<span>"+c+"</span>"}this.check();this.nav(this.nav_container.children[this.selected])};
inputPhoneMini.prototype.check=function(){for(var a=lsi.keys("mini-fiches"),b=0;b<a.length;b++){var c=lsi.get("mini-fiches",a[b]),d=!0;(d=(d=(d=(d=d&&!isNaN(parseInt(c.age)))&&checkRadioValue(c.sexe[0]))&&"."!=c.job)&&checkRadioValue(c.loc))?this.nav_container.children[c.uid].addClass("done"):this.nav_container.children[c.uid].remClass("done")}};
inputPhoneMini.prototype.attach=function(a){console.log("MINI FICHE: ATTACH");lsi.createDataset("mini-fiches");this.storageToFields();this.handler=a;var b=this,b=this;this.nav_container.addEventListener("click",function(a){b.nav(a.target);b.handler()},!1)};

View File

@ -39,6 +39,10 @@ inputPhoneMini.prototype.fieldsToStorage = function(){
// {3} On enregistre ce contact si le numéro n'est pas vide et soit pseudo/prénom/nom //
var deflated = deflater.deflate();
console.log(deflated);
// {4} On récupère les données du LSI si elles existent //
var existingData = lsi.get('mini-fiches', 'form'+deflated.uid.value);
@ -127,7 +131,6 @@ inputPhoneMini.prototype.add = function(objectData){
/* (4) 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"]');
console.log(objectData.loc);
for( var i = 0 ; i < locCreated.length && i < objectData.loc.length ; i++ )
if( objectData.loc[i].status ) locCreated[i].setAttribute('checked', 'checked');
else locCreated[i].removeAttribute('checked');
@ -306,9 +309,16 @@ inputPhoneMini.prototype.check = function(){
/* (2) On vérifie le formulaire complet */
var validForm = true;
// 1. L'age est un nombre
// 2. Le métier est défini
validForm = validForm && !isNaN(parseInt(miniData.age));
// 2. Le sexe est défini
validForm = validForm && checkRadioValue(miniData.sexe[0]);
// 3. Le métier est défini
validForm = validForm && miniData.job != '.';
// 4. La distance de localisation est définie
validForm = validForm && checkRadioValue(miniData.loc);
/* (3) Si le formulaire est valide, on le met en valeur dans la barre de navigation (pages) */
if( validForm )

View File

@ -1,4 +1,5 @@
function updateListener(b,a,c){b.removeEventListener(a,c);b.addEventListener(a,c)}var importCallLog=$('input#call_log-import[type="file"]'),ficheContainer=$("article.relation-panel"),subjectManager,contactManager,miniManager,ficheManager;
function dynamicUpdate(){console.log("DYNAMIC UPDATE: UPDATING");miniManager.fieldsToStorage();ficheManager.fieldsToStorage();contactManager.fieldsToStorage();miniManager.sync();ficheManager.sync();miniManager.storageToFields();ficheManager.storageToFields();contactManager.storageToFields()}
function dynamicUpdate(){console.log("DYNAMIC UPDATE: UPDATING");miniManager.fieldsToStorage();ficheManager.fieldsToStorage();contactManager.fieldsToStorage();miniManager.sync();ficheManager.sync();miniManager.storageToFields();ficheManager.storageToFields();contactManager.storageToFields()}function checkRadioValue(b){for(var a=0,c=0;c<b.length;c++)!0===b[c].status&&a++;return 1!=a?!1:!0}
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(){subjectManager=new inputPhoneSubject($('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"),$("h4.add-contact"));contactManager.attach(dynamicUpdate);miniManager=new inputPhoneMini($("article.mini-relation-panel"),$("#nav-mini"));miniManager.attach(dynamicUpdate)})})})});importCallLog.addEventListener("change",function(b){api.send({path:"upload/call_log",file:importCallLog.files[0]},function(a){console.log(a);0==a.ModuleError&&importCallLog.addClass("active")})},!1);
subjectManager.attach();contactManager=new inputPhoneContact($("article.contact-panel"),$("h4.add-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)})})})});
importCallLog.addEventListener("change",function(b){api.send({path:"upload/call_log",file:importCallLog.files[0]},function(a){console.log(a);0==a.ModuleError&&importCallLog.addClass("active")})},!1);

View File

@ -70,7 +70,16 @@ function dynamicUpdate(){
contactManager.storageToFields();
}
// Vérifie qu'une seule valeur vaut TRUE et les autres false
function checkRadioValue(selectData){
var nbTrue = 0;
for( var i = 0 ; i < selectData.length ; i++ )
if( selectData[i].status === true )
nbTrue++;
if( nbTrue != 1 ) return false;
else return true;
}