diff --git a/src/app/hirebike/hirebike.page.html b/src/app/hirebike/hirebike.page.html index c3923a0687dcfec8831c2454f831bdb646d18642..972dc2f2580e5f6eae655ae729b93f53833e86c8 100644 --- a/src/app/hirebike/hirebike.page.html +++ b/src/app/hirebike/hirebike.page.html @@ -21,7 +21,7 @@
-
+
@@ -33,31 +33,20 @@ Bike Location {{bikeDetails.address}} - + Start Trip - -
-
-
-
-
-
- - - Any Problems? - - - - + + - Cancel Trip + End Trip
+ \ No newline at end of file diff --git a/src/app/hirebike/hirebike.page.ts b/src/app/hirebike/hirebike.page.ts index b17b5c1dad7fbee8e245f74b03d700ca32499716..f92752c3bac8ae2fd38cc38b0bd2ce896f9a9997 100644 --- a/src/app/hirebike/hirebike.page.ts +++ b/src/app/hirebike/hirebike.page.ts @@ -102,6 +102,7 @@ export class HirebikePage implements OnInit { bikeApi.subscribe((resp) => { console.log('my data: ', resp); this.toastService.showToast("Trip Started"); + this.isBikeHired=true; }, (error) => { console.log(error) this.toastService.showToast("This is ongoing Trip") @@ -110,7 +111,23 @@ export class HirebikePage implements OnInit { } - + CancelTrip(){ + + this.storage.get('token').then((token) => { + let url = 'http://193.196.52.237:8081/rent' + '?bikeId=' + this.bikeDetails.id; + const headers = new HttpHeaders().set("Authorization", "Bearer " + token); + let bikeApi = this.httpClient.delete(url, { headers }); + bikeApi.subscribe((resp) => { + console.log('my data: ', resp); + this.toastService.showToast("Trip Ended!"); + }, (error) => { + console.log(error) + this.toastService.showToast("No Ongong Trip to End") + }); + }); + + } + loadmap() { var defaultLayers = this.platform.createDefaultLayers();