+
@@ -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();