This commit is contained in:
@ -78,14 +78,14 @@ const app = new Vue({
|
||||
el: '#app',
|
||||
data: {
|
||||
journey_id : window.location.pathname.split('/').pop() || gen_id(16),
|
||||
journey_step: window.location.hash.slice(1)==""?((window.location.pathname.split('/')[1]=='view')?0:-1):parseInt(window.location.hash.slice(1)),
|
||||
journey_step: window.location.hash.slice(1)==""?((['view','short'].indexOf(window.location.pathname.split('/')[1])!=-1)?0:-1):parseInt(window.location.hash.slice(1)),
|
||||
journey_step_data: {day:-1, section:-1},
|
||||
journey_data : {
|
||||
name: "New Journey",
|
||||
main:[],
|
||||
step_title:[],
|
||||
},
|
||||
view: window.location.pathname.split('/')[1]=='view',
|
||||
vtp: ['view','short'].indexOf(window.location.pathname.split('/')[1]),
|
||||
query:{hotel:[],flight:[],nominatim:[]},
|
||||
querying:{hotel:false,flight:false,place:false,food:false},
|
||||
impexp:"",
|
||||
@ -113,6 +113,40 @@ const app = new Vue({
|
||||
window.location.hash = '#' + this.journey_step;
|
||||
|
||||
},
|
||||
nextnext_step: function(){
|
||||
let nd = this.journey_step_data;
|
||||
let ns = this.journey_step;
|
||||
while((nd.section==this.journey_step_data.section || nd.day>1)
|
||||
&& ns>=0){
|
||||
ns+=1;
|
||||
nd = this.step_convert(ns)
|
||||
if(nd.section==-1){
|
||||
ns-=1;
|
||||
nd = this.step_convert(ns)
|
||||
break;
|
||||
}
|
||||
}
|
||||
this.journey_step = ns;
|
||||
this.journey_step_data = nd;
|
||||
window.location.hash = '#' + this.journey_step;
|
||||
},
|
||||
prevprev_step: function(){
|
||||
let nd = this.journey_step_data;
|
||||
let ns = this.journey_step;
|
||||
while((nd.section==this.journey_step_data.section || nd.day>1)
|
||||
&& ns>=0){
|
||||
ns-=1;
|
||||
nd = this.step_convert(ns)
|
||||
if(ns==-1){
|
||||
ns+=1;
|
||||
nd = this.step_convert(ns)
|
||||
break;
|
||||
}
|
||||
}
|
||||
this.journey_step = ns;
|
||||
this.journey_step_data = nd;
|
||||
window.location.hash = '#' + this.journey_step;
|
||||
},
|
||||
first_step: function(){
|
||||
this.journey_step=-1;
|
||||
this.journey_step_data = {day:-1, section:-1};
|
||||
@ -137,6 +171,22 @@ const app = new Vue({
|
||||
}
|
||||
return {day:-1, section:-1};
|
||||
},
|
||||
active_date: function(){
|
||||
if(this.journey_step_data.day < 0) return "?";
|
||||
if(!this.journey_data.main[this.journey_step_data.section].dateRange) return "?";
|
||||
var date = new Date(this.journey_data.main[this.journey_step_data.section].dateRange[0]);
|
||||
date.setDate(date.getDate() + this.journey_step_data.day-1);
|
||||
return this.format_date(date)
|
||||
},
|
||||
format_date: function(d){
|
||||
var dt = d.toJSON().slice(0, 10);
|
||||
return dt.slice(8, 10) + '/'
|
||||
+ dt.slice(5, 7) + '/'
|
||||
+ dt.slice(0, 4) + ' ('
|
||||
+ ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'][d.getDay()]
|
||||
+')';
|
||||
},
|
||||
|
||||
rm_section: function(idx){
|
||||
this.journey_data.main.splice(idx,1);
|
||||
},
|
||||
|
Reference in New Issue
Block a user