1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
import { Component,ViewChild } from '@angular/core';
import { IonicPage, NavController, NavParams,Content,Slides } from 'ionic-angular';
import { Myservice } from "../../providers/myservice";
import { Storage } from "@ionic/storage";
import { user } from "../../models/mymodel";
@IonicPage()
@Component({
selector: 'page-mytrips',
templateUrl: 'mytrips.html',
})
export class MytripsPage {
showPrev:any;
showNext:any;
currentIndex:any;
slidertab:any;
local:user
allTrips:any;
upTrips:any;
compTrips:any;
trips:any;
@ViewChild(Content) content: Content;
@ViewChild('mySlider') slider: Slides;
constructor(public navCtrl: NavController, public navParams: NavParams, private myservice: Myservice, private storage: Storage) {
let id = 0;
this.slidertab = id;
setTimeout(() => {
this.goToSlide(id);
}, 500)
this.slidertab = 0;
}
ionViewDidEnter() {
this.storage.get('user_data').then(data => {
if (data) {
this.local = data;
this.myservice.load_post({ 'token': this.local.token }, 'myTrips').subscribe(response => {
this.myservice.hide_loader()
if (response.status == 'success') {
this.trips = response.all
console.log(this.trips)
}
else {
this.myservice.show_alert('Failed', 'Please try again')
}
})
}
})
}
goToSlide(id) {
this.slider.slideTo(id, 500);
}
slideChanged() {
let currentIndex = this.slider.getActiveIndex();
this.slidertab = currentIndex;
}
open_page(page,index){
this.navCtrl.push(page,{data:this.trips[index]});
}
}