diff --git a/config/environment.dev.ts b/config/environment.dev.ts
index 5b296ed..02880a0 100644
--- a/config/environment.dev.ts
+++ b/config/environment.dev.ts
@@ -1,4 +1,5 @@
export const environment = {
production: false,
- devHost:"http://localhost:3000"
+ baseApiUrl: "http://localhost:8080",
+ jwtEnabled: true
};
diff --git a/src/app/+hotels/hotels.component.html b/src/app/+hotels/hotels.component.html
index 0c213d3..b5f0ce5 100644
--- a/src/app/+hotels/hotels.component.html
+++ b/src/app/+hotels/hotels.component.html
@@ -1,3 +1,74 @@
-
- hotels works!
-
+
+
+
+
+
Matching POIs
+
+
+
+ No matching POI
+
+
0" class="table table-striped">
+
+
+ | Name |
+ Address |
+ Description |
+
+
+
+
+
+ | {{line.address}} |
+ {{line.description}} |
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/app/+hotels/hotels.component.ts b/src/app/+hotels/hotels.component.ts
index 85c12d4..d7e88d1 100644
--- a/src/app/+hotels/hotels.component.ts
+++ b/src/app/+hotels/hotels.component.ts
@@ -1,15 +1,72 @@
-import { Component, OnInit } from '@angular/core';
+import { Component, OnInit, Injectable, Inject } from '@angular/core';
+import {
+ CORE_DIRECTIVES,
+ FORM_DIRECTIVES,
+ FormBuilder,
+ ControlGroup,
+ Validators
+} from '@angular/common';
+import { Response } from "@angular/http";
+
+import { UtilityService } from "../shared/utility.service";
+import { environment } from "../";
+import { Observable } from 'rxjs/Rx';
@Component({
moduleId: module.id,
selector: 'app-hotels',
+ directives: [CORE_DIRECTIVES, FORM_DIRECTIVES],
templateUrl: 'hotels.component.html'
})
+
+@Injectable()
+
export class HotelsComponent implements OnInit {
- constructor() {}
+ hotelForm: ControlGroup;
+ utility: UtilityService;
+ data;
+ error;
+
+ constructor(fb: FormBuilder, utility: UtilityService) {
+ this.hotelForm = fb.group({
+ 'description': [''],
+ 'location': ['']
+ });
+ this.utility = utility;
+ }
ngOnInit() {
}
-}
+ findHotels(value: any): void {
+ console.log('you searched for hotel:', value);
+ var location = value.location;
+ var description = value.description;
+
+ var url = environment.baseApiUrl + "/api/hotel/";
+ var hasDescription = (description != null && description != "");
+ var hasLocation = (location != null && location != "");
+ if (hasDescription && hasLocation) {
+ url = url + description + "/" + location + "/";
+ } else if (hasLocation) {
+ url = url + "*/" + location + "/";
+ } else if (hasDescription) {
+ url = url + description + "/"
+ }
+
+ this.utility.makeGetRequestObs(url, [])
+ .map((response: Response) => response.json())
+ .subscribe(
+ (success) => {
+ console.log("DEBUG: found " + success.length + " matching hotels");
+ this.data = success;
+ this.error = null;
+ },
+ (error: Response) => {
+ this.data = null;
+ this.error = error.json();
+ }
+ );
+ }
+}
\ No newline at end of file
diff --git a/src/app/+login/login.component.html b/src/app/+login/login.component.html
index d79ff36..1c0fe69 100644
--- a/src/app/+login/login.component.html
+++ b/src/app/+login/login.component.html
@@ -7,7 +7,7 @@