Gestion de après l'upload -> début
This commit is contained in:
parent
83ab5702ec
commit
66f0b26d2f
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
|
@ -197,7 +197,7 @@
|
|||
padding: 0 15px;
|
||||
|
||||
border-radius: 3px;
|
||||
background: $timeline-1;
|
||||
background: $timeline-0;
|
||||
|
||||
color: #222;
|
||||
line-height: 30px;
|
||||
|
@ -225,14 +225,14 @@
|
|||
|
||||
/* Animation de hover*/
|
||||
& input[type='file']:hover + span.file-input{
|
||||
background: darken($timeline-1, 10);
|
||||
background: darken($timeline-0, 10);
|
||||
box-shadow: inset 0 0 5px #888;
|
||||
}
|
||||
|
||||
|
||||
/* Animation de .active*/
|
||||
& input[type='file'].active + span.file-input{
|
||||
background: $timeline-color;
|
||||
background: $timeline-2;
|
||||
color: #fff;
|
||||
// On change l'icône
|
||||
&:before{
|
||||
|
|
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
|
@ -16,7 +16,6 @@ d[c].setAttribute("checked","checked"):d[c].removeAttribute("checked")};inputPho
|
|||
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&&!isNaN(parseInt(b.age));console.log(d);d=d&&2<=b.city.length;console.log(d);d=d&&(!isNaN(parseInt(b.duration[0]))||""==b.duration[0].length);console.log(d);d=d&&(!isNaN(parseInt(b.duration[1]))||""==b.duration[1].length);console.log(d);d=d&&0<b.duration[0].length+b.duration[1].length;console.log(d);d=d&&"."!=b.job;console.log(d);d=d&&"."!=b.studies;console.log(d);d=d&&
|
||||
checkRadioValue(b.sexe);console.log(d);d=d&&checkRadioValue(b.famsit);console.log(d);d=d&&checkRadioValue(b.reltype);console.log(d);d=d&&checkRadioValue(b.loc);console.log(d);d=d&&checkRadioValue(b.context);console.log(d);for(c=0;c<b.freq.length;c++)d=d&&checkRadioValue(b.freq[c]);console.log(d);for(c=0;c<b.connect.length;c++)d=d&&checkRadioValue(b.connect[c]);console.log(d);d=d&&(!b.reltype[8].status||b.reltype[8].status&&2<=b.reltypeSpecial.length);console.log(d);(d=(d=(d=d&&(!b.context[11].status||
|
||||
b.context[11].status&&2<=b.contextSpecial[0].length))&&(!b.context[12].status||b.context[12].status&&2<=b.contextSpecial[1].length))&&(!b.context[13].status||b.context[13].status&&2<=b.contextSpecial[2].length))?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)};
|
||||
inputPhoneFiche.prototype.check=function(){for(var a=lsi.keys("fiches"),c=0;c<a.length;c++){for(var b=lsi.get("fiches",a[c]),d=!0,d=(d=(d=(d=(d=(d=(d=(d=(d=(d=(d=(d=d&&!isNaN(parseInt(b.age)))&&2<=b.city.length)&&(!isNaN(parseInt(b.duration[0]))||""==b.duration[0].length))&&(!isNaN(parseInt(b.duration[1]))||""==b.duration[1].length))&&0<b.duration[0].length+b.duration[1].length)&&"."!=b.job)&&"."!=b.studies)&&checkRadioValue(b.sexe))&&checkRadioValue(b.famsit))&&checkRadioValue(b.reltype))&&checkRadioValue(b.loc))&&
|
||||
checkRadioValue(b.context),c=0;c<b.freq.length;c++)d=d&&checkRadioValue(b.freq[c]);for(c=0;c<b.connect.length;c++)d=d&&checkRadioValue(b.connect[c]);(d=(d=(d=(d=d&&(!b.reltype[8].status||b.reltype[8].status&&2<=b.reltypeSpecial.length))&&(!b.context[11].status||b.context[11].status&&2<=b.contextSpecial[0].length))&&(!b.context[12].status||b.context[12].status&&2<=b.contextSpecial[1].length))&&(!b.context[13].status||b.context[13].status&&2<=b.contextSpecial[2].length))?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)};
|
||||
|
|
|
@ -437,58 +437,43 @@ inputPhoneFiche.prototype.check = function(){
|
|||
// {1} Vérification des <input> //
|
||||
// 1. L'age est un nombre
|
||||
validForm = validForm && !isNaN(parseInt(ficheData.age));
|
||||
console.log(validForm);
|
||||
// 2. La ville a au moins 2 caractères
|
||||
validForm = validForm && ficheData.city.length >= 2;
|
||||
console.log(validForm);
|
||||
// 3. La durée de la relation en mois est vide ou un nombre
|
||||
validForm = validForm && (!isNaN(parseInt(ficheData.duration[0])) || ficheData.duration[0].length == '');
|
||||
console.log(validForm);
|
||||
// 4. La durée de la relation en année est vide ou un nombre
|
||||
validForm = validForm && (!isNaN(parseInt(ficheData.duration[1])) || ficheData.duration[1].length == '');
|
||||
console.log(validForm);
|
||||
// 5. Pour la durée de la relation, au moins un des 2 n'est pas vide
|
||||
validForm = validForm && ficheData.duration[0].length+ficheData.duration[1].length > 0;
|
||||
console.log(validForm);
|
||||
|
||||
// {2} Vérification des <select> //
|
||||
// 6. Le <select> pour la profession n'est pas indéfini
|
||||
validForm = validForm && ficheData.job != '.';
|
||||
console.log(validForm);
|
||||
// 7. Le <select> pour les études n'est pas indéfini
|
||||
validForm = validForm && ficheData.studies != '.';
|
||||
console.log(validForm);
|
||||
|
||||
// {3} Vérification des <input> radio //
|
||||
// 8. Le SEXE a un et un seul choix
|
||||
validForm = validForm && checkRadioValue(ficheData.sexe);
|
||||
console.log(validForm);
|
||||
// 9. La SITUATION FAMILIALE a un et un seul choix
|
||||
validForm = validForm && checkRadioValue(ficheData.famsit);
|
||||
console.log(validForm);
|
||||
// 10. Le TYPE DE RELATION a un et un seul choix
|
||||
validForm = validForm && checkRadioValue(ficheData.reltype);
|
||||
console.log(validForm);
|
||||
// 11. La DISTANCE DE DOMICILE (location) a un et un seul choix
|
||||
validForm = validForm && checkRadioValue(ficheData.loc);
|
||||
console.log(validForm);
|
||||
// 12. Le CONTEXTE DE RENCONTRE a un et un seul choix
|
||||
validForm = validForm && checkRadioValue(ficheData.context);
|
||||
console.log(validForm);
|
||||
// 13. Les FRÉQUENCES ont un et un seul choix (par question de fréquence)
|
||||
for( var i = 0 ; i < ficheData.freq.length ; i++ )
|
||||
validForm = validForm && checkRadioValue( ficheData.freq[i] );
|
||||
console.log(validForm);
|
||||
|
||||
// 14. Les CONNECTION ont un et un seul choix (par question de connection)
|
||||
for( var i = 0 ; i < ficheData.connect.length ; i++ )
|
||||
validForm = validForm && checkRadioValue( ficheData.connect[i] );
|
||||
console.log(validForm);
|
||||
|
||||
// {4} <input> dépendant d'un choix d'un <input> radio //
|
||||
// 15. TYPE DE RELATION si autre est coché (indice 8)
|
||||
validForm = validForm && (!ficheData.reltype[8].status || ficheData.reltype[8].status && ficheData.reltypeSpecial.length >= 2);
|
||||
console.log(validForm);
|
||||
// 16. CONTEXTE DE RELATION si est coché indice 11
|
||||
validForm = validForm && (!ficheData.context[11].status || ficheData.context[11].status && ficheData.contextSpecial[0].length >= 2);
|
||||
|
||||
|
|
|
@ -72,9 +72,21 @@
|
|||
|
||||
/* (2) On enregistre le contact dans l'annuaire s'il y est pas déjà */
|
||||
if( !isset($phone_directory[$number]) )
|
||||
$phone_directory[$number] = strlen($log['Name']) ? (string) $log['Name'] : null;
|
||||
$phone_directory[$number] = array(
|
||||
'name' => strlen($log['Name']) ? (string) $log['Name'] : null,
|
||||
'calls' => 0,
|
||||
'sms' => 0
|
||||
);
|
||||
|
||||
/* (3) On complète le log */
|
||||
|
||||
/* (3) Si c'est un appel, on incrémente le compteur pour ce numéro */
|
||||
if( strtolower($log['Type']) == 'phone' ) $phone_directory[$number]['calls']++;
|
||||
|
||||
/* (4) Si c'est un sms, on incrémente le compteur pour ce numéro */
|
||||
else $phone_directory[$number]['sms']++;
|
||||
|
||||
|
||||
/* (5) On complète le log */
|
||||
$phone_log = array(
|
||||
'source' => ($log['Direction']=='INCOMING') ? $number : Database::formatNumber($phone_number),
|
||||
'target' => ($log['Direction']=='INCOMING') ? Database::formatNumber($phone_number) : $number,
|
||||
|
@ -85,8 +97,14 @@
|
|||
array_push($phone_logs, $phone_log);
|
||||
}
|
||||
|
||||
/* [5] On trie les contacts par nombre d'apparition
|
||||
=========================================================*/
|
||||
// Système de poids -> 5 sms = 1 appel
|
||||
// 0 -> {number, name, calls, sms} (closest contact)
|
||||
// 1 -> {number, name, calls, sms} (2nd closest contact)
|
||||
|
||||
/* [5] Gestion du retour
|
||||
|
||||
/* [6] Gestion du retour
|
||||
=========================================================*/
|
||||
return array(
|
||||
'ModuleError' => ManagerError::Success,
|
||||
|
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
|
@ -40,7 +40,7 @@
|
|||
<h5 data-text="Renseigner au moins un des nominatifs pour chaque contact. (pseudo, prénom et/ou nom)"></h5>
|
||||
<article class='subject-panel'>
|
||||
<h4 class='self color2' data-icon='a'>
|
||||
<input type='text' data-name='number' placeholder='Numéro de téléphone'>
|
||||
<input type='text' data-name='number' id='subject_phone_number' placeholder='Numéro de téléphone'>
|
||||
<input type='text' data-name='username' placeholder='Pseudo'>
|
||||
<input type='text' data-name='firstname' placeholder='Prénom'>
|
||||
<input type='text' data-name='lastname' placeholder='Nom'>
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
var importCallLog=$('input#call_log-import[type="file"]'),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 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);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)})})})});
|
||||
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){0==
|
||||
a.ModuleError&&(importCallLog.addClass("active"),console.log(a),a={path:"call_log/unserialize",phone_number:$("#subject_phone_number").value},api.send(a,function(a){console.log(a)}))})},!1)})})})});
|
||||
|
|
|
@ -146,13 +146,24 @@ include('/js/includes/input-phone-fiche.js', function(){
|
|||
};
|
||||
|
||||
/* (2) On effectue l'upload (import) */
|
||||
api.send(uploadRequest, function(response){
|
||||
console.log( response );
|
||||
api.send(uploadRequest, function(uploadResponse){
|
||||
// Si tout est bon, on met l'input en bleu
|
||||
if( response.ModuleError == 0 ){
|
||||
if( uploadResponse.ModuleError == 0 ){
|
||||
importCallLog.addClass('active');
|
||||
|
||||
// TODO: Gestion de l'ajout des fiches relation
|
||||
|
||||
/* (3) On rédige la requête pour récupérer les données du fichier */
|
||||
console.log(uploadResponse);
|
||||
var getCallLogRequest = {
|
||||
path: 'call_log/unserialize',
|
||||
phone_number: $('#subject_phone_number').value
|
||||
};
|
||||
|
||||
/* (4) On effectue la récupération d'informations */
|
||||
api.send(getCallLogRequest, function(dataResponse){
|
||||
console.log(dataResponse);
|
||||
});
|
||||
}
|
||||
|
||||
});
|
||||
|
|
Loading…
Reference in New Issue