Project 'ulrike.pado/asyst-moodle-plugin' was moved to 'knight/asyst-moodle-plugin'. Please update any links and bookmarks that may still have the old path.
Commit e4ee9426 authored by Priyanka Vivekanand Upadhye's avatar Priyanka Vivekanand Upadhye
Browse files

Merge branch '22-hire-reserved-bike' into 'master'

integrated with hire API

Closes #22

See merge request 92khra1mst/hft_awado_app!18
parents 05c25374 145c011f
master 15-find-the-street-name-by-geo-location-data 16-create-search-location-functionality 18-design-feedback-page-2 20-ride-history 20-ride-history-2 36-cancel-hired-bike 37-display-username-on-homepage 38-display-calculated-name-of-the-street-on-reservation-and-hire-page 39-validation-on-login-page 40-map-performance-improvement-map-angle-doesn-t-change-when-selected-3d 41-display-live-location-of-user-on-map 42-add-log-in-button-on-registration-page-add-extra-messages-for-email-and-password-validation 42-add-log-in-button-on-registration-page-add-extra-messages-for-email-and-password-validation-2 45-show-stepwise-navigation-instructions-on-my-ride-page 46-show-bicycle-route-between-bike-and-user-s-destination 47-show-alternate-routes-for-bike-to-destination 48-create-a-common-service-for-getting-user-s-current-location-and-live-location 49-show-loading-page 50-add-dependencies-locally-to-improve-app-performance 51-while-navigating-between-pages-map-doesn-t-load-properly 52-page-loader-is-getting-displayed-everywhere 53-scrollining-in-ride-history 53-scrollining-in-ride-history-2 55-change-password 56-create-dummy-page-or-menu-for-hotline-contact 57-registration-not-working-from-app 58-add-flow-on-navigate-button-to-route-from-user-to-bike 60-create-common-theming-styles-and-colors 61-chnage-styles-for-bike-list-and-bug-fixes 62-change-in-feedback-workflow 63-password-reset-api-integration 64-close-button-on-home-page-to-redirect-to-bike-list 66-highlight-selected-route-from-list-of-different-routes 67-deactivate-user-api-integration 68-display-no-go-areas-on-map 69-add-launcher-icon-for-application-on-android 70-add-validation-for-feedback-should-not-be-empty 71-prediction-ui-implementation-send-location-of-bike-to-backend 72-feedback-toast-message 73-removal-here-maps-api-key Show-Bike-details-when-bike-icon-is-clicked search_functionality
1 merge request!18integrated with hire API
Showing with 34 additions and 11 deletions
+34 -11
...@@ -18,7 +18,7 @@ ...@@ -18,7 +18,7 @@
<div #mapElement style="width: 100%; height: 100%" id="mapContainer"></div> <div #mapElement style="width: 100%; height: 100%" id="mapContainer"></div>
</ion-content> </ion-content>
<ion-footer> <ion-footer>
<div class="bike-details-container"> <div class="bike-details-container" *ngIf="!isBikeHired">
<div class="inner"> <div class="inner">
<div class="button-container"> <div class="button-container">
<ion-grid> <ion-grid>
...@@ -39,4 +39,22 @@ ...@@ -39,4 +39,22 @@
</div> </div>
</div> </div>
</div> </div>
<div class="problem-container" *ngIf="isBikeHired">
<div class="inner">
<div class="button-container">
<ion-grid>
<ion-row>
<ion-col>Any Problems?</ion-col>
</ion-row>
<ion-row>
<ion-col>
<ion-button size="medium" expand="block" (click)="CancelTrip()">Cancel Trip</ion-button>
</ion-col>
</ion-row>
</ion-grid>
</div>
</div>
</div>
</ion-footer> </ion-footer>
\ No newline at end of file
...@@ -22,6 +22,7 @@ export class HirebikePage implements OnInit { ...@@ -22,6 +22,7 @@ export class HirebikePage implements OnInit {
reservedBike: any = {}; reservedBike: any = {};
bikeDetails: any = {}; bikeDetails: any = {};
isBikeHired=false;
noReservation = true; noReservation = true;
...@@ -91,20 +92,26 @@ export class HirebikePage implements OnInit { ...@@ -91,20 +92,26 @@ export class HirebikePage implements OnInit {
}, (bikeDetailsError) => console.log(bikeDetailsError)); }, (bikeDetailsError) => console.log(bikeDetailsError));
}); });
} }
startTrip(){
cancelReservation() {
this.storage.get('token').then((token) => { this.storage.get('token').then((token) => {
let url = 'http://193.196.52.237:8081/reservation' + '?bikeId=' + this.bikeDetails.id; let url = 'http://193.196.52.237:8081/rent' + '?bikeId=' + this.bikeDetails.id;
const headers = new HttpHeaders().set("Authorization", "Bearer " + token); const headers = new HttpHeaders().set("Authorization", "Bearer " + token);
let bikeApi = this.httpClient.delete(url, { headers }); let bikeApi = this.httpClient.get(url, { headers });
bikeApi.subscribe((resp) => { bikeApi.subscribe((resp) => {
console.log('Reservation Cancelled: ', resp); console.log('my data: ', resp);
this.toastService.showToast("Bike Reservation successfully cancelled."); this.toastService.showToast("Trip Started");
this.router.navigateByUrl('/home'); this.isBikeHired=true;
}, (error) => console.log(error)); }, (error) => {
console.log(error)
this.toastService.showToast("Unable to Hire Bike")
});
}); });
} }
loadmap() { loadmap() {
var defaultLayers = this.platform.createDefaultLayers(); var defaultLayers = this.platform.createDefaultLayers();
this.map = new H.Map( this.map = new H.Map(
...@@ -259,8 +266,6 @@ export class HirebikePage implements OnInit { ...@@ -259,8 +266,6 @@ export class HirebikePage implements OnInit {
//this.map.setZoom(this.map.getZoom() - 4.3, true); //this.map.setZoom(this.map.getZoom() - 4.3, true);
} }
}; };
hireBike() {
this.router.navigateByUrl('/hirebike');
}
} }
Supports Markdown
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