Commit e4c16730 authored by Eric Seigne's avatar Eric Seigne
Browse files

gestion des etapes

parent c473e2c7
# 1.6.10
- corrige un bug de calcul automatique des distances pour les itinéraires avec étapes
-
# 1.6.9 # 1.6.9
- corrige un bug d'accès en écriture en // à IndexedDB sur certains smartphone - corrige un bug d'accès en écriture en // à IndexedDB sur certains smartphone
......
...@@ -28,8 +28,8 @@ else{popupChoixVille(result,ville,slug);}} ...@@ -28,8 +28,8 @@ else{popupChoixVille(result,ville,slug);}}
else{hideWait();ons.notification.alert("Saisie manuelle nécessaire, cette ville n'est pas connue de nos serveurs",{title:"Erreur #1"});}},error:function(result){myDebug('searchVille ajax erreur'+result);hideWait();ons.notification.alert("Saisie manuelle nécessaire, cette ville n'est pas connue de nos serveurs",{title:"Erreur #2"});}});} else{hideWait();ons.notification.alert("Saisie manuelle nécessaire, cette ville n'est pas connue de nos serveurs",{title:"Erreur #1"});}},error:function(result){myDebug('searchVille ajax erreur'+result);hideWait();ons.notification.alert("Saisie manuelle nécessaire, cette ville n'est pas connue de nos serveurs",{title:"Erreur #2"});}});}
function popupChoixVille(result,ville,villeSlug){myDebug('popupChoixVille pour '+ville+" -- "+villeSlug);return new Promise((resolve,reject)=>{if(result.departsNb!==undefined){let btn=[];let btnNb=0;for(btnNb=0;btnNb<result.departsNb;btnNb++){btn.push({label:encodeHTMLEntities(result.depart[btnNb])+" ("+result.departCP[btnNb]+")",slug:result.departSlug[btnNb],ville:ville,villeSlug:villeSlug});} function popupChoixVille(result,ville,villeSlug){myDebug('popupChoixVille pour '+ville+" -- "+villeSlug);return new Promise((resolve,reject)=>{if(result.departsNb!==undefined){let btn=[];let btnNb=0;for(btnNb=0;btnNb<result.departsNb;btnNb++){btn.push({label:encodeHTMLEntities(result.depart[btnNb])+" ("+result.departCP[btnNb]+")",slug:result.departSlug[btnNb],ville:ville,villeSlug:villeSlug});}
if(globalMyNavigator!==undefined){resolve(globalMyNavigator.pushPage("choix-liste.html",{data:{title:"Précisez la ville",callFunction:'functionChooseVille',btn:btn,btnNb:btnNb},animation:'fade',}));} if(globalMyNavigator!==undefined){resolve(globalMyNavigator.pushPage("choix-liste.html",{data:{title:"Précisez la ville",callFunction:'functionChooseVille',btn:btn,btnNb:btnNb},animation:'fade',}));}
else{myDebug('ERROR myNavigator does not exists !');reject(null);}} else{myDebug('ERROR myNavigator does not exists !');reject("ERROR myNavigator does not exists (1)");}}
else{myDebug('Pas de solution !');}});} else{myDebug('Pas de solution !');reject("Pas de solution (1)");}});}
function functionChooseVille(label,slug,ville,villeSlug,single=false){myDebug("functionChooseVille "+label+" -- "+slug+" ["+ville+"]"+"{"+villeSlug+"}") function functionChooseVille(label,slug,ville,villeSlug,single=false){myDebug("functionChooseVille "+label+" -- "+slug+" ["+ville+"]"+"{"+villeSlug+"}")
if(slug!==undefined){$('#'+ville).val(decodeURIComponent(label));$('#'+villeSlug).val(slug);if(globalMyNavigator!==undefined){if(!single){let opt={animation:'fade'};globalMyNavigator.popPage(opt);}}} if(slug!==undefined){$('#'+ville).val(decodeURIComponent(label));$('#'+villeSlug).val(slug);if(globalMyNavigator!==undefined){if(!single){let opt={animation:'fade'};globalMyNavigator.popPage(opt);}}}
else{myDebug("functionChooseVille: slug is undef !")}} else{myDebug("functionChooseVille: slug is undef !")}}
...@@ -44,14 +44,20 @@ else{hideWait();ons.notification.alert("Saisie manuelle nécessaire, cet itinér ...@@ -44,14 +44,20 @@ else{hideWait();ons.notification.alert("Saisie manuelle nécessaire, cet itinér
function popupChoixDepart(result){myDebug('popupChoixDepart');return new Promise((resolve,reject)=>{if(result.departsNb!==undefined){if(result.departsNb==1){functionChooseDepart2(encodeHTMLEntities(result.depart)+" ("+result.departCP+")",result.departSlug,true);} function popupChoixDepart(result){myDebug('popupChoixDepart');return new Promise((resolve,reject)=>{if(result.departsNb!==undefined){if(result.departsNb==1){functionChooseDepart2(encodeHTMLEntities(result.depart)+" ("+result.departCP+")",result.departSlug,true);}
else{let btn=[];let btnNb=0;for(btnNb=0;btnNb<result.departsNb;btnNb++){btn.push({label:encodeHTMLEntities(result.depart[btnNb])+" ("+result.departCP[btnNb]+")",slug:result.departSlug[btnNb]});} else{let btn=[];let btnNb=0;for(btnNb=0;btnNb<result.departsNb;btnNb++){btn.push({label:encodeHTMLEntities(result.depart[btnNb])+" ("+result.departCP[btnNb]+")",slug:result.departSlug[btnNb]});}
if(globalMyNavigator!==undefined){resolve(globalMyNavigator.pushPage("choix-liste.html",{data:{title:"Précisez la ville de départ",callFunction:'functionChooseDepart2',btn:btn,btnNb:btnNb,},animation:'fade',}));} if(globalMyNavigator!==undefined){resolve(globalMyNavigator.pushPage("choix-liste.html",{data:{title:"Précisez la ville de départ",callFunction:'functionChooseDepart2',btn:btn,btnNb:btnNb,},animation:'fade',}));}
else{myDebug('ERROR myNavigator does not exists !');reject(null);}}} else{myDebug('ERROR myNavigator does not exists !');reject("ERROR myNavigator does not exists (2)");}}}
else{myDebug('Pas de solution !');resolve(popupChoixArrivee(result));}});} else{myDebug('Pas de solution !');reject("Pas de solution (2)");}});}
function popupChoixArrivee(result){return new Promise((resolve,reject)=>{if(result.arriveesNb!==undefined){if(result.arriveesNb==1){functionChooseArrivee2(encodeHTMLEntities(result.arrivee)+" ("+result.arriveeCP+")",result.arriveeSlug,true);} function popupChoixArrivee(result){return new Promise((resolve,reject)=>{if(result.arriveesNb!==undefined){if(result.arriveesNb==1){functionChooseArrivee2(encodeHTMLEntities(result.arrivee)+" ("+result.arriveeCP+")",result.arriveeSlug,true);}
else{let btn=[];let btnNb=0;for(btnNb=0;btnNb<result.arriveesNb;btnNb++){btn.push({label:encodeHTMLEntities(result.arrivee[btnNb])+" ("+result.arriveeCP[btnNb]+")",slug:result.arriveeSlug[btnNb]});} else{let btn=[];let btnNb=0;for(btnNb=0;btnNb<result.arriveesNb;btnNb++){btn.push({label:encodeHTMLEntities(result.arrivee[btnNb])+" ("+result.arriveeCP[btnNb]+")",slug:result.arriveeSlug[btnNb]});}
if(globalMyNavigator!==undefined){resolve(globalMyNavigator.pushPage("choix-liste.html",{data:{title:"Précisez la ville d'arrivée",callFunction:'functionChooseArrivee2',btn:btn,btnNb:btnNb,},animation:'fade',}));} if(globalMyNavigator!==undefined){resolve(globalMyNavigator.pushPage("choix-liste.html",{data:{title:"Précisez la ville d'arrivée",callFunction:'functionChooseArrivee2',btn:btn,btnNb:btnNb,},animation:'fade',}));}
else{myDebug('ERROR myNavigator does not exists !');reject(null);}}}});} else{myDebug('ERROR myNavigator does not exists !');reject("ERROR myNavigator does not exists (3)");}}}});}
function popupChoixEtape(result,etape,nb){myDebug('popupChoixEtape');} function popupChoixEtape(result,etape,nb){myDebug('popupChoixEtape');return new Promise((resolve,reject)=>{if(result.arriveesNb!==undefined){if(result.arriveesNb==1){functionChooseArrivee2(encodeHTMLEntities(result.arrivee)+" ("+result.arriveeCP+")",result.arriveeSlug,true);}
function functionChooseArrivee2(label,slug,single=false){if(slug!==undefined){$('#arrivee').val(decodeURIComponent(label));$('#arriveeSlug').val(slug);$('#btnCalculDistance').attr('style',"border-radius: 5px; border:#00FF00 2px solid;");$('#btnCalculDistanceArrivee').attr('style',"");if(globalMyNavigator!==undefined){if(!single){let opt={animation:'fade'};globalMyNavigator.popPage(opt);}} else{let btn=[];let btnNb=0;for(btnNb=0;btnNb<result.arriveesNb;btnNb++){btn.push({label:encodeHTMLEntities(result.arrivee[btnNb])+" ("+result.arriveeCP[btnNb]+")",slug:result.arriveeSlug[btnNb],ville:etape,villeSlug:etape+"Slug"});}
if(globalMyNavigator===undefined)globalMyNavigator=document.getElementById('myNavigator');if(globalMyNavigator!==undefined){resolve(globalMyNavigator.pushPage("choix-liste.html",{data:{title:"Précisez l'étape",callFunction:'functionChooseEtape',btn:btn,btnNb:btnNb},}));}
else{myDebug('ERROR myNavigator does not exists !');reject("ERROR myNavigator does not exists (4)");}}}
else{myDebug('Pas de solution !');reject("pas de solution (4)");}});}
function functionChooseEtape(label,slug,fieldname,fieldnameSlug,single=false){myDebug("functionChooseEtape: "+label+" : "+slug+" : "+fieldname+":"+fieldnameSlug+":"+single+" start");if(slug!==undefined){$('#'+fieldname).val(decodeURIComponent(label));$('#'+fieldnameSlug).val(slug);if(globalMyNavigator!==undefined){if(!single){let opt={animation:'fade'};globalMyNavigator.popPage(opt);}}}
else{myDebug("functionChooseArrivee2: slug is undef !")}}
function functionChooseArrivee2(label,slug,single=false){myDebug("functionChooseArrivee2: "+label+" : "+slug+" : "+single+" start");if(slug!==undefined){$('#arrivee').val(decodeURIComponent(label));$('#arriveeSlug').val(slug);$('#btnCalculDistance').attr('style',"border-radius: 5px; border:#00FF00 2px solid;");$('#btnCalculDistanceArrivee').attr('style',"");if(globalMyNavigator!==undefined){if(!single){let opt={animation:'fade'};globalMyNavigator.popPage(opt);}}
blinkElement("#btnCalculDistance",3,800);} blinkElement("#btnCalculDistance",3,800);}
else{myDebug("functionChooseArrivee2: slug is undef !")}} else{myDebug("functionChooseArrivee2: slug is undef !")}}
function functionChooseDepart2(label,slug,single=false){if(slug!==undefined){$('#depart').val(decodeURIComponent(label));$('#departSlug').val(slug);$('#btnCalculDistanceArrivee').attr('style',"border-radius: 5px; border:#00FF00 2px solid;");if(globalMyNavigator!==undefined){if(!single){let opt={animation:'fade'};globalMyNavigator.popPage(opt);}} function functionChooseDepart2(label,slug,single=false){if(slug!==undefined){$('#depart').val(decodeURIComponent(label));$('#departSlug').val(slug);$('#btnCalculDistanceArrivee').attr('style',"border-radius: 5px; border:#00FF00 2px solid;");if(globalMyNavigator!==undefined){if(!single){let opt={animation:'fade'};globalMyNavigator.popPage(opt);}}
......
Markdown is supported
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