Skip to content

Commit f9680d7

Browse files
place booking problem resolved, readme updates
1 parent a5ae2ce commit f9680d7

File tree

6 files changed

+23
-13
lines changed

6 files changed

+23
-13
lines changed

README.md

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ An [observable](https://rxjs-dev.firebaseapp.com/guide/observable) is created us
4747

4848
![page](./img/discover-places-page.png)
4949
![page](./img/offers-page.png)
50+
![page](./img/firebase-database.png)
5051

5152
## Technologies
5253

@@ -99,6 +100,21 @@ private getGoogleMaps(): Promise<any> {
99100
}
100101
```
101102

103+
* Firebase database setup: `".indexOn": ["userId"]` added to allow ordering by userId in `booking.service.ts`
104+
105+
```json
106+
{
107+
"rules": {
108+
".read": true,
109+
".write": true,
110+
"bookings": {
111+
".indexOn": ["userId"]
112+
}
113+
}
114+
}
115+
116+
```
117+
102118
## Features
103119

104120
* Authorization module using Angular Routing with the Angular [canLoad auth guard interface](https://angular.io/api/router/CanLoad) to prevent access to pages if user is not logged in.
@@ -120,7 +136,7 @@ private getGoogleMaps(): Promise<any> {
120136
## Status & To-do list
121137

122138
* Status: working. Bookings can be made and new places added to offers page. If a different user is logged in they cannot book their own places (the booking button does not show) - which is correct. Camera images now show.
123-
* To-do: Bookable place list is the same as the 'All Places' list - bookable places should not include the logged in users' places. 'My Offers' includes everyones places. 'Your Bookings' does not work - check path - fix error with create-booking component. Fix error with svg calender icon - appears every time but the icon is displayed.
139+
* To-do: Bookable place list is the same as the 'All Places' list - bookable places should not include the logged in users' places. 'My Offers' includes everyones places. Booking a place works but fix error with template ion-datetime and datesValid() function - "TypeError: Cannot read property 'value' of undefined".
124140

125141
## Inspiration
126142

functions/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ const storage = new Storage({
1414
});
1515

1616
fbAdmin.initializeApp({
17-
credential: fbAdmin.credential.cert(require('firebase-key-here'))
17+
credential: fbAdmin.credential.cert(require(''))
1818
});
1919

2020
exports.storeImage = functions.https.onRequest((req, res) => {

img/firebase-database.png

154 KB
Loading

src/app/bookings/booking.service.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,6 @@ export class BookingService {
118118
`https://ionic-maps-api-1565705298126.firebaseio.com/bookings.json?orderBy="userId"&equalTo="${fetchedUserId}"&auth=${token}`
119119
);
120120
}),
121-
122121
map(bookingData => {
123122
const bookings = [];
124123
for (const key in bookingData) {

src/app/bookings/create-booking/create-booking.component.html

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -63,8 +63,8 @@
6363
<ion-item>
6464
<ion-label position="floating">From</ion-label>
6565
<ion-datetime
66-
display-format="MMM DD YYYY"
67-
picker-format="YY MMM DD"
66+
displayFormat="MMM DD YYYY"
67+
pickerFormat="YYYY MMM DD"
6868
[min]="selectedPlace.availableFrom.toISOString()"
6969
[max]="selectedPlace.availableTo.toISOString()"
7070
[ngModel]="startDate"
@@ -82,8 +82,8 @@
8282
<ion-item>
8383
<ion-label position="floating">To</ion-label>
8484
<ion-datetime
85-
display-format="MMM DD YYYY"
86-
picker-format="YY MMM DD"
85+
displayFormat="MMM DD YYYY"
86+
pickerFormat="YYYY MMM DD"
8787
[min]="startDateCtrl.value"
8888
[max]="selectedPlace.availableTo.toISOString()"
8989
[ngModel]="endDate"

src/app/bookings/create-booking/create-booking.component.ts

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -65,12 +65,7 @@ export class CreateBookingComponent implements OnInit {
6565

6666
datesValid() {
6767
const startDate = new Date(this.form.value['date-from']);
68-
console.log(startDate);
6968
const endDate = new Date(this.form.value['date-to']);
70-
console.log(endDate);
71-
// const checked = (endDate > startDate) ? true : false;
72-
const checked = endDate > startDate;
73-
console.log(checked);
74-
return checked;
69+
return endDate > startDate;
7570
}
7671
}

0 commit comments

Comments
 (0)