Skip to content
GitLab
Explore
Projects
Groups
Snippets
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
hdastageeri
hft_awado_app
Commits
2241fc38
Commit
2241fc38
authored
5 years ago
by
Priyanka Upadhye
Browse files
Options
Download
Email Patches
Plain Diff
Bike Reservation functionality with Bike cancellation
parent
922bced7
master
15-find-the-street-name-by-geo-location-data
16-create-search-location-functionality
18-design-feedback-page-2
19-registration-page-validation
20-ride-history
20-ride-history-2
21-reservation-history
22-hire-reserved-bike
24-routing-from-users-current-position-to-the-bike
25-current-bike-reservation-workflow
28-routing-from-bike-location-to-user-s-destination
34-navigation-menu-is-getting-displayed-on-login-page
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
4-reserve-a-bike
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
!5
Resolve "Reserve a bike"
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
src/app/app-routing.module.ts
+32
-30
src/app/app-routing.module.ts
src/app/home/home.page.html
+23
-15
src/app/home/home.page.html
src/app/home/home.page.ts
+23
-5
src/app/home/home.page.ts
with
78 additions
and
50 deletions
+78
-50
src/app/app-routing.module.ts
+
32
-
30
View file @
2241fc38
import
{
NgModule
}
from
'
@angular/core
'
;
import
{
PreloadAllModules
,
RouterModule
,
Routes
}
from
'
@angular/router
'
;
const
routes
:
Routes
=
[
{
path
:
''
,
redirectTo
:
'
login
'
,
pathMatch
:
'
full
'
},
{
path
:
'
home
'
,
loadChildren
:
()
=>
import
(
'
./home/home.module
'
).
then
(
m
=>
m
.
HomePageModule
)
},
{
path
:
'
list
'
,
loadChildren
:
()
=>
import
(
'
./list/list.module
'
).
then
(
m
=>
m
.
ListPageModule
)
},
{
path
:
'
login
'
,
loadChildren
:
()
=>
import
(
'
./auth/login/login.module
'
).
then
(
m
=>
m
.
LoginPageModule
)
},
{
import
{
NgModule
}
from
'
@angular/core
'
;
import
{
PreloadAllModules
,
RouterModule
,
Routes
}
from
'
@angular/router
'
;
const
routes
:
Routes
=
[
{
path
:
''
,
redirectTo
:
'
login
'
,
pathMatch
:
'
full
'
},
{
path
:
'
home
'
,
loadChildren
:
()
=>
import
(
'
./home/home.module
'
).
then
(
m
=>
m
.
HomePageModule
)
},
{
path
:
'
list
'
,
loadChildren
:
()
=>
import
(
'
./list/list.module
'
).
then
(
m
=>
m
.
ListPageModule
)
},
{
path
:
'
login
'
,
loadChildren
:
()
=>
import
(
'
./auth/login/login.module
'
).
then
(
m
=>
m
.
LoginPageModule
)
},
{
path
:
'
register
'
,
loadChildren
:
()
=>
import
(
'
./auth/register/register.module
'
).
then
(
m
=>
m
.
RegisterPageModule
)
}
];
];
@
NgModule
({
imports
:
[
RouterModule
.
forRoot
(
routes
,
{
preloadingStrategy
:
PreloadAllModules
})
],
exports
:
[
RouterModule
]
})
export
class
AppRoutingModule
{}
@
NgModule
({
imports
:
[
RouterModule
.
forRoot
(
routes
,
{
preloadingStrategy
:
PreloadAllModules
})
],
exports
:
[
RouterModule
]
})
export
class
AppRoutingModule
{}
This diff is collapsed.
Click to expand it.
src/app/home/home.page.html
+
23
-
15
View file @
2241fc38
...
...
@@ -80,22 +80,22 @@
</ion-col>
</ion-row>
<ion-row>
<ion-col>
Bike Location
</ion-col>
<ion-col>
{{selectedBike.address}}
</ion-col>
</ion-row>
<ion-row>
<ion-col>
Bike Distance
</ion-col>
<ion-col>
{{selectedBike.distance + "m"}}
</ion-col>
</ion-row>
<ion-col>
Bike Location
</ion-col>
<ion-col>
{{selectedBike.address}}
</ion-col>
</ion-row>
<ion-row>
<ion-col>
Bike Distance
</ion-col>
<ion-col>
{{selectedBike.distance + "m"}}
</ion-col>
</ion-row>
<ion-row
*ngIf=
"!isBikeReserved"
>
<ion-col>
<ion-button
size=
"medium"
expand=
"block"
(click)=
"reserveBike()"
>
Reserve
</ion-button>
</ion-col>
...
...
@@ -103,6 +103,14 @@
<ion-button
size=
"medium"
expand=
"block"
(click)=
"navigatetoBike()"
>
Navigate
</ion-button>
</ion-col>
</ion-row>
<ion-row
*ngIf=
"isBikeReserved"
>
<ion-col>
<ion-button
size=
"medium"
expand=
"block"
(click)=
"hireBike()"
>
Hire
</ion-button>
</ion-col>
<ion-col>
<ion-button
size=
"medium"
expand=
"block"
(click)=
"cancelReservation()"
>
Cancel Reservation
</ion-button>
</ion-col>
</ion-row>
</ion-grid>
</div>
</div>
...
...
This diff is collapsed.
Click to expand it.
src/app/home/home.page.ts
+
23
-
5
View file @
2241fc38
...
...
@@ -4,6 +4,7 @@ import { RestService } from '../rest.service';
import
{
Observable
}
from
'
rxjs
'
;
import
{
HttpClient
,
HttpHeaders
}
from
'
@angular/common/http
'
;
import
{
Storage
}
from
'
@ionic/storage
'
;
import
{
ToastService
}
from
'
../services/toast.service
'
;
declare
var
H
:
any
;
...
...
@@ -25,6 +26,7 @@ export class HomePage {
public
is3DChecked
=
false
;
public
isDetailsVisible
=
false
;
public
selectedBike
=
{
id
:
0
};
public
isBikeReserved
=
false
;
public
tempArr
=
[
1
,
2
];
public
locationArr
=
[{
lat
:
48.778409
,
lng
:
9.179252
},
...
...
@@ -45,7 +47,8 @@ export class HomePage {
constructor
(
private
geolocation
:
Geolocation
,
public
restService
:
RestService
,
public
httpClient
:
HttpClient
,
private
storage
:
Storage
)
{
private
storage
:
Storage
,
private
toastService
:
ToastService
)
{
this
.
platform
=
new
H
.
service
.
Platform
({
'
apikey
'
:
'
tiVTgBnPbgV1spie5U2MSy-obhD9r2sGiOCbBzFY2_k
'
...
...
@@ -232,8 +235,7 @@ export class HomePage {
this
.
selectedBike
.
id
=
bike
.
id
;
this
.
isDetailsVisible
=
true
;
}
reserveBike
()
{
reserveBike
()
{
//this.selectedBike=bikeS;
this
.
storage
.
get
(
'
token
'
).
then
((
token
)
=>
{
let
url
=
'
http://193.196.52.237:8081/reservation
'
+
'
?bikeId=
'
+
this
.
selectedBike
.
id
;
...
...
@@ -241,11 +243,27 @@ export class HomePage {
this
.
bikeApi
=
this
.
httpClient
.
get
(
url
,
{
headers
});
this
.
bikeApi
.
subscribe
((
resp
)
=>
{
console
.
log
(
'
my data:
'
,
resp
);
this
.
bikes
=
resp
;
},
(
error
)
=>
console
.
log
(
error
));
this
.
isBikeReserved
=
true
;
this
.
toastService
.
showToast
(
"
Reservation Successful!
"
);
},
(
error
)
=>
{
console
.
log
(
error
)
this
.
toastService
.
showToast
(
"
Only one bike may be reserved or rented at a time
"
)
});
});
}
cancelReservation
()
{
this
.
storage
.
get
(
'
token
'
).
then
((
token
)
=>
{
let
url
=
'
http://193.196.52.237:8081/reservation
'
+
'
?bikeId=
'
+
this
.
selectedBike
.
id
;
const
headers
=
new
HttpHeaders
().
set
(
"
Authorization
"
,
"
Bearer
"
+
token
);
this
.
bikeApi
=
this
.
httpClient
.
delete
(
url
,
{
headers
});
this
.
bikeApi
.
subscribe
((
resp
)
=>
{
console
.
log
(
'
my data:
'
,
resp
);
this
.
isBikeReserved
=
false
;
},
(
error
)
=>
console
.
log
(
error
));
});
}
}
This diff is collapsed.
Click to expand it.
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment
Menu
Explore
Projects
Groups
Snippets