$('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);vara=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"):Notification.error("Erreur",
b.ModuleError);else{for(vara=Notification.info("Info","Chargement du journal d'appel"),e=0;e<b.call.length;e++){varc=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.calls,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])?(d=lsi.get("contacts",c.id),d.sms=e,lsi.set("contacts",c.id,
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],logs:lsi["export"]("logs")};varb=$("#download-target");b.download=
!1;lsi.set("subject",0,a.local_data.subject);lsi["import"]("contacts",a.local_data.contacts);lsi["import"]("logs",a.local_data.logs);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())returnNotification.warning("Attention","Vous devez saisir les informations du <i>sujet</i>"),!1;a=lsi["export"]("mini-fiches");for(varbina)if(!a[b].valid)returnNotification.warning("Attention","La <i>fiche rapide</i> <b>"+(parseInt(b)+1)+"</b> est incompl\u00e8te et/ou incorrecte"),!1;a=lsi["export"]("fiches");for(bina)if(!a[b].valid)returnNotification.warning("Attention",
"La <i>fiche compl\u00e8te</i> <b>"+(parseInt(b)+1)+"</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"),matrice:lsi["export"]("matrice")[0]};api.send(b,function(a){if(0!=a.ModuleError)returnNotification.error("ERREUR",a.ModuleError),!1;console.log(a)},!1)},!1)})})})})});