Correction, affichage (màj) après import
This commit is contained in:
parent
d505d50a39
commit
092a09088f
|
@ -5,7 +5,7 @@ inputPhoneMini.prototype.add=function(a){console.log("MINI FICHE: ADD");if(null=
|
||||||
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",
|
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"]');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["export"]("mini-fiches");this.container.innerHTML="";var b=[],c;for(c in a){var d=a[c].uid;d==this.selected&&this.add(a[c]);b.push(d)}this.updateNavBar(b)};
|
inputPhoneMini.prototype.storageToFields=function(){console.log("MINI FICHE: STORAGE TO FIELDS");var a=lsi["export"]("mini-fiches");this.container.innerHTML="";var b=[],c;for(c in a){var d=a[c].uid;d==this.selected&&this.add(a[c]);b.push(d)}this.updateNavBar(b)};
|
||||||
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;c.firstname=a[b].firstname;c.lastname=a[b].lastname;c.username=a[b].username;lsi.set("mini-fiches",b,c)}};
|
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);console.log(a[b]);c.uid=a[b].uid;c.firstname=a[b].firstname;c.lastname=a[b].lastname;c.username=a[b].username;lsi.set("mini-fiches",b,c)}};
|
||||||
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};
|
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};
|
||||||
inputPhoneMini.prototype.updateNavBar=function(a){if(this.nav_container.children.length!=a.length){this.nav_container.innerHTML="";for(var b=0;b<a.length;b++)this.nav_container.innerHTML+="<span>"+(parseInt(a[b])+1)+"</span>"}a=lsi["export"]("mini-fiches");for(var c in a)!0===a[c].valid?this.nav_container.children[a[c].uid].addClass("done"):this.nav_container.children[a[c].uid].remClass("done");this.nav(this.nav_container.children[this.selected])};
|
inputPhoneMini.prototype.updateNavBar=function(a){if(this.nav_container.children.length!=a.length){this.nav_container.innerHTML="";for(var b=0;b<a.length;b++)this.nav_container.innerHTML+="<span>"+(parseInt(a[b])+1)+"</span>"}a=lsi["export"]("mini-fiches");for(var c in a)!0===a[c].valid?this.nav_container.children[a[c].uid].addClass("done"):this.nav_container.children[a[c].uid].remClass("done");this.nav(this.nav_container.children[this.selected])};
|
||||||
inputPhoneMini.prototype.check=function(a){return!isNaN(parseInt(a.age))&&checkRadioValue(a.sexe)&&"."!=a.job&&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,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.job&&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,b=this;this.nav_container.addEventListener("click",function(a){b.nav(a.target);b.handler(a.target)},!1)};
|
||||||
|
|
|
@ -209,6 +209,8 @@ inputPhoneMini.prototype.sync = function(){
|
||||||
miniData.valid = false;
|
miniData.valid = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
console.log(contactData[key]);
|
||||||
|
|
||||||
/* (5) On met à jour la MINI fiche */
|
/* (5) On met à jour la MINI fiche */
|
||||||
miniData.uid = contactData[key].uid;
|
miniData.uid = contactData[key].uid;
|
||||||
miniData.firstname = contactData[key].firstname;
|
miniData.firstname = contactData[key].firstname;
|
||||||
|
|
|
@ -130,10 +130,10 @@
|
||||||
'total' => $tmp[$maxNumber]['sms'] + 5*$tmp[$maxNumber]['calls']
|
'total' => $tmp[$maxNumber]['sms'] + 5*$tmp[$maxNumber]['calls']
|
||||||
));
|
));
|
||||||
|
|
||||||
|
|
||||||
unset($tmp[$maxNumber]);
|
unset($tmp[$maxNumber]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* [6] Gestion du retour
|
/* [6] Gestion du retour
|
||||||
=========================================================*/
|
=========================================================*/
|
||||||
return array(
|
return array(
|
||||||
|
|
|
@ -3,5 +3,5 @@ function dynamicUpdate(a){var c=a instanceof Element,b=c&&"SPAN"==a.tagName&&"sw
|
||||||
b=a.parentNode,d=b.children[1],a=b.children[3],b=b.children[5],d.value=a.value+" "+b.value,a.value="",b.value=""):(console.log("> dynamic update"),miniManager.fieldsToStorage(),ficheManager.fieldsToStorage(),contactManager.fieldsToStorage(),miniManager.sync(),ficheManager.sync(),miniManager.storageToFields(),ficheManager.storageToFields(),contactManager.storageToFields())}function checkRadioValue(a){for(var c=0,b=0;b<a.length;b++)!0===a[b].status&&c++;return 1!=c?!1:!0}
|
b=a.parentNode,d=b.children[1],a=b.children[3],b=b.children[5],d.value=a.value+" "+b.value,a.value="",b.value=""):(console.log("> dynamic update"),miniManager.fieldsToStorage(),ficheManager.fieldsToStorage(),contactManager.fieldsToStorage(),miniManager.sync(),ficheManager.sync(),miniManager.storageToFields(),ficheManager.storageToFields(),contactManager.storageToFields())}function checkRadioValue(a){for(var c=0,b=0;b<a.length;b++)!0===a[b].status&&c++;return 1!=c?!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"]'));
|
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);ficheManager=new inputPhoneFiche($("article.relation-panel"),$("#nav-fiche"));ficheManager.attach(dynamicUpdate);importCallLog.addEventListener("change",function(a){api.send({path:"upload/call_log",file:importCallLog.files[0]},function(a){console.log(a);
|
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(a){api.send({path:"upload/call_log",file:importCallLog.files[0]},function(a){console.log(a);
|
||||||
0==a.ModuleError&&(importCallLog.addClass("active"),a={path:"call_log/unserialize",phone_number:$("#subject_phone_number").value},api.send(a,function(a){console.log(a);if(0==a.ModuleError){for(var d=0;d<a.directory.length&&20>d;d++){var c=a.directory[d].name.split(" ");lsi.set("contacts","form"+d,{uid:d,number:a.directory[d].number,username:1==c.length?c[0]:"",firstname:1<c.length?c[0]:"",lastname:1<c.length?c.splice(1).join(" "):""})}dynamicUpdate(!0)}}))})},!1);clearAllButton.addEventListener("click",
|
0==a.ModuleError&&(importCallLog.addClass("active"),a={path:"call_log/unserialize",phone_number:$("#subject_phone_number").value},api.send(a,function(a){console.log(a);if(0==a.ModuleError){for(var d=0;d<a.directory.length;d++){console.log(a.directory[d]);var c=(null===a.directory[d].name?"":a.directory[d].name).split(" ");lsi.set("contacts","form"+d,{uid:d,number:a.directory[d].number,username:1==c.length?c[0]:"",firstname:1<c.length?c[0]:"",lastname:1<c.length?c.splice(1).join(" "):""})}dynamicUpdate(!0)}}))})},
|
||||||
function(a){localStorage.clear();reload()},!1)})})})});
|
!1);clearAllButton.addEventListener("click",function(a){localStorage.clear();reload()},!1)})})})});
|
||||||
|
|
|
@ -197,23 +197,28 @@ include('/js/includes/input-phone-fiche.js', function(){
|
||||||
importCallLog.addClass('active');
|
importCallLog.addClass('active');
|
||||||
|
|
||||||
/* (3) On rédige la requête pour récupérer les données du fichier */
|
/* (3) On rédige la requête pour récupérer les données du fichier */
|
||||||
var getCallLogRequest = {
|
var callLogRequest = {
|
||||||
path: 'call_log/unserialize',
|
path: 'call_log/unserialize',
|
||||||
phone_number: $('#subject_phone_number').value
|
phone_number: $('#subject_phone_number').value
|
||||||
};
|
};
|
||||||
|
|
||||||
/* (4) On effectue la récupération d'informations */
|
/* (4) On effectue la récupération d'informations */
|
||||||
api.send(getCallLogRequest, function(dataResponse){
|
api.send(callLogRequest, function(dataResponse){
|
||||||
console.log(dataResponse);
|
console.log(dataResponse);
|
||||||
|
|
||||||
// Si erreur, on quitte
|
// Si erreur, on quitte
|
||||||
if( dataResponse.ModuleError != 0 )
|
if( dataResponse.ModuleError != 0 )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/* (5) Pour chaque contact de l'annuaire, on ajoute un contact */
|
/* (5) Pour chaque contact de l'annuaire, on ajoute un contact */
|
||||||
for( var i = 0 ; i < dataResponse.directory.length && i < 20 ; i++ ){
|
for( var i = 0 ; i < dataResponse.directory.length ; i++ ){
|
||||||
|
console.log(dataResponse.directory[i]);
|
||||||
|
|
||||||
// On découpe le nom par espaces
|
// On découpe le nom par espaces
|
||||||
var splitted = dataResponse.directory[i].name.split(' ');
|
var name = dataResponse.directory[i].name===null ? '' : dataResponse.directory[i].name;
|
||||||
|
var splitted = name.split(' ');
|
||||||
|
|
||||||
lsi.set('contacts', 'form'+i, {
|
lsi.set('contacts', 'form'+i, {
|
||||||
uid: i,
|
uid: i,
|
||||||
|
|
Loading…
Reference in New Issue