Commit 48c7b570 authored by Eric Seigne's avatar Eric Seigne
Browse files

amelioration de la recuperation des informations de l'agenda

parent 257625cc
......@@ -52,6 +52,15 @@
</div> -->
</div>
<script>
$('#depart').keyup(function () {
$('#listeDepart').show();
});
function selectDepart(ville) {
$('#listeDepart').hide();
$('#depart').val(ville);
}
// function rSyncDeleteConfirm(id) {
// ons.notification.confirm("Voulez-vous vraiment supprimer ce document ?", {
// title: "Vérification", buttonLabels: ['Non', 'Oui, supprimer'],
......
......@@ -41,13 +41,13 @@ showWait();var title=null;var loc=null;var notes=null;var startDate=new Date(dat
function onSuccessAgendaIK(events){hideWait();var formField='#feedToAgendaIK';var html="";$(formField).empty();if(events.length==0){html+="<h2>Aucun rdv sur cette période</h2>";$(formField).append(html);return;}
for(var i=0;i<events.length;i++){let depart=leform.depart.value;if(events[i].title.includes("#ik")||(typeof events[i].location!='undefined')){let titre=events[i].title.replace('#ik','');let startDate=events[i].startDate;let msg="";let loc="";html+="<h2>"+titre+"</h2>";html+="<ul><li>Date : "+startDate+"</li>";if(events[i].message){msg=events[i].message;html+="<li>Détails: "+msg+"</li>";}
if(events[i].location){loc=events[i].location;html+="<li>Lieu : "+loc+"</li>";}
html+="</ul>";html+="<ons-button modifier='material large' onclick="+'"'+"createIK("
+"'"+titre.replace(/'/g," ")+"',"
html+="</ul>";html+="<ons-button modifier='material large' onclick=\"createIK("
+"'"+encodeHTMLEntities(titre)+"',"
+"'"+startDate+"',"
+"'"+msg.replace(/'/g," ")+"',"
+"'"+loc+"',"
+"'"+depart+"'"
+");"+'"'+" class='menubutton'><i class='zmdi zmdi-car'></i> Créer la fiche d'IK</ons-button>";}}
+"'"+encodeHTMLEntities(msg)+"',"
+"'"+encodeHTMLEntities(loc)+"',"
+"'"+encodeHTMLEntities(depart)+"'"
+");\" class='menubutton'><i class='zmdi zmdi-car'></i> Créer la fiche d'IK</ons-button>";}}
$(formField).append(html);}
function onErrorAgendaIK(msg){hideWait();ons.notification.alert("Erreur d'accès à l'agenda"+JSON.stringify(msg),{title:"Erreur"});}
function createIK(titre,ladate,message,arrivee,depart){myDebug("createIK : "+titre);dataIK={label:encodeURI(titre)+" "+encodeURI(message),ladate:ladate,arrivee:encodeURI(arrivee),depart:encodeURI(depart),};myDebug("createIK : avant le Goto : "+JSON.stringify(dataIK));gotoPage("frais-ik.html",true);}
......@@ -264,6 +264,8 @@ function myUniqueSort(array){return $.grep(array,function(el,index){return index
function dataURItoBlob(dataURI){var byteString=atob(dataURI.split(',')[1]);var mimeString=dataURI.split(",")[0].split(":")[1].split(";")[0];var ab=new ArrayBuffer(byteString.length);var ia=new Uint8Array(ab);for(var i=0;i<byteString.length;i++){ia[i]=byteString.charCodeAt(i);}
return new Blob([ab],{type:mimeString});}
function ProgressBar(ele){this.thisEle=$(ele);this.fileAdded=function(){myDebug("ProgressBar : fileAdded");(this.thisEle).removeClass('hide').find('.progress-bar').css('width','0%');},this.uploading=function(progress){myDebug("ProgressBar : progress..."+progress);$('.progress-bar').attr('style','width:'+progress+'%');},this.finish=function(){myDebug("ProgressBar : finish");gotoPage("messageDone.html",false);}}
function encodeHTMLEntities(text){return $("<textarea/>").text(text).html();}
function decodeHTMLEntities(text){return $("<textarea/>").html(text).text();}
function addLocalStorageEntry(liste,entry){if((typeof liste!='undefined')&&(liste!==null)&&(liste!="")){if((typeof entry!='undefined')&&(entry!==null)&&(entry!="")){var listeContent=JSON.parse(localGetData(liste));if(Array.isArray(listeContent)){listeContent.push(entry);listeContent=myUniqueSort(listeContent);}
else{listeContent=new Array(entry);}
localStoreData(liste,JSON.stringify(listeContent));}}}
......
......@@ -208,13 +208,13 @@ function onSuccessAgendaIK(events) {
}
html += "</ul>";
//html += "<div id='ajouterFrais-" + i + "' onclick='createIK(" + events[i] + ")'>Créer une fiche d'IK</div>";
html += "<ons-button modifier='material large' onclick=" + '"' + "createIK("
+ "'" + titre.replace(/'/g, " ") + "',"
html += "<ons-button modifier='material large' onclick=\"createIK("
+ "'" + encodeHTMLEntities(titre) + "',"
+ "'" + startDate + "',"
+ "'" + msg.replace(/'/g, " ") + "',"
+ "'" + loc + "',"
+ "'" + depart + "'"
+ ");" + '"' + " class='menubutton'><i class='zmdi zmdi-car'></i> Créer la fiche d'IK</ons-button>";
+ "'" + encodeHTMLEntities(msg) + "',"
+ "'" + encodeHTMLEntities(loc) + "',"
+ "'" + encodeHTMLEntities(depart) + "'"
+ ");\" class='menubutton'><i class='zmdi zmdi-car'></i> Créer la fiche d'IK</ons-button>";
}
}
$(formField).append(html);
......
......@@ -267,3 +267,11 @@ function ProgressBar(ele) {
gotoPage("messageDone.html", false);
}
}
function encodeHTMLEntities(text) {
return $("<textarea/>").text(text).html();
}
function decodeHTMLEntities(text) {
return $("<textarea/>").html(text).text();
}
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment