diff --git a/admin-portal/package.json b/admin-portal/package.json
index c16e1ba..d38bdbc 100644
--- a/admin-portal/package.json
+++ b/admin-portal/package.json
@@ -22,6 +22,7 @@
"@angular/platform-browser-dynamic": "^2.3.1",
"@angular/router": "^3.3.1",
"core-js": "^2.4.1",
+ "hammerjs": "^2.0.8",
"rxjs": "^5.0.1",
"ts-helpers": "^1.1.1",
"zone.js": "^0.7.2"
diff --git a/admin-portal/src/app/app.component.html b/admin-portal/src/app/app.component.html
index b6931b5..435cdfd 100644
--- a/admin-portal/src/app/app.component.html
+++ b/admin-portal/src/app/app.component.html
@@ -1,3 +1,2 @@
-
- {{title}}
-
+
+
diff --git a/admin-portal/src/app/app.module.ts b/admin-portal/src/app/app.module.ts
index a1606b5..7990031 100644
--- a/admin-portal/src/app/app.module.ts
+++ b/admin-portal/src/app/app.module.ts
@@ -1,12 +1,17 @@
+import {platformBrowserDynamic} from '@angular/platform-browser-dynamic';
import { BrowserModule } from '@angular/platform-browser';
import { NgModule } from '@angular/core';
-import { FormsModule } from '@angular/forms';
+import { FormsModule, ReactiveFormsModule } from '@angular/forms';
import { HttpModule } from '@angular/http';
+import { routing } from './app.routing';
import { MaterialModule } from '@angular/material';
+import 'hammerjs';
import { AppComponent } from './app.component';
import { NavBarComponent } from './components/nav-bar/nav-bar.component';
+import {LoginService} from './services/login.service';
+
@NgModule({
declarations: [
AppComponent,
@@ -15,10 +20,14 @@ import { NavBarComponent } from './components/nav-bar/nav-bar.component';
imports: [
BrowserModule,
FormsModule,
+ ReactiveFormsModule,
HttpModule,
+ routing,
MaterialModule
],
- providers: [],
+ providers: [
+ LoginService
+ ],
bootstrap: [AppComponent]
})
export class AppModule { }
diff --git a/admin-portal/src/app/app.routing.ts b/admin-portal/src/app/app.routing.ts
new file mode 100644
index 0000000..5c566f2
--- /dev/null
+++ b/admin-portal/src/app/app.routing.ts
@@ -0,0 +1,11 @@
+/**
+ * Created by z00382545 on 1/16/17.
+ */
+import {ModuleWithProviders} from '@angular/core';
+import {Routes, RouterModule} from '@angular/router';
+
+const appRoutes: Routes = [
+
+];
+
+export const routing: ModuleWithProviders = RouterModule.forRoot(appRoutes);
diff --git a/admin-portal/src/app/components/nav-bar/nav-bar.component.css b/admin-portal/src/app/components/nav-bar/nav-bar.component.css
index e69de29..7ab073e 100644
--- a/admin-portal/src/app/components/nav-bar/nav-bar.component.css
+++ b/admin-portal/src/app/components/nav-bar/nav-bar.component.css
@@ -0,0 +1,9 @@
+.example-container {
+ width: 500px;
+}
+
+.example-button-row {
+ display: flex;
+ align-items: center;
+ justify-content: space-around;
+}
\ No newline at end of file
diff --git a/admin-portal/src/app/components/nav-bar/nav-bar.component.html b/admin-portal/src/app/components/nav-bar/nav-bar.component.html
index 52654a5..30be302 100644
--- a/admin-portal/src/app/components/nav-bar/nav-bar.component.html
+++ b/admin-portal/src/app/components/nav-bar/nav-bar.component.html
@@ -1,3 +1,42 @@
-
- nav-bar works!
-
+
+
+
+
+
+
+
+
+
+ {{ food.viewValue }}
+
+
+
+
+
+ {{tile.text}}
+
+
+
+
+
Normal Buttons
+
+
+
+
+
+
+
+
Link Buttons
+
+
\ No newline at end of file
diff --git a/admin-portal/src/app/components/nav-bar/nav-bar.component.ts b/admin-portal/src/app/components/nav-bar/nav-bar.component.ts
index 3c08aa2..ab51f0f 100644
--- a/admin-portal/src/app/components/nav-bar/nav-bar.component.ts
+++ b/admin-portal/src/app/components/nav-bar/nav-bar.component.ts
@@ -1,4 +1,6 @@
import { Component, OnInit } from '@angular/core';
+import {LoginService} from "../../services/login.service";
+import {Router} from "@angular/router";
@Component({
selector: 'app-nav-bar',
@@ -6,10 +8,43 @@ import { Component, OnInit } from '@angular/core';
styleUrls: ['./nav-bar.component.css']
})
export class NavBarComponent implements OnInit {
+ private loggedIn = false;
- constructor() { }
+ foods = [
+ {value: 'steak-0', viewValue: 'Steak'},
+ {value: 'pizza-1', viewValue: 'Pizza'},
+ {value: 'tacos-2', viewValue: 'Tacos'}
+ ];
+
+ tiles = [
+ {text: 'One', cols: 3, rows: 1, color: 'lightblue'},
+ {text: 'Two', cols: 1, rows: 2, color: 'lightgreen'},
+ {text: 'Three', cols: 1, rows: 1, color: 'lightpink'},
+ {text: 'Four', cols: 2, rows: 1, color: '#DDBDF1'},
+ ];
+
+ constructor(private loginService: LoginService, private router: Router) { }
ngOnInit() {
+ this.loginService.checkSession().subscribe(
+ res => {
+ this.loggedIn=true;
+ },
+ error => {
+ this.loggedIn=false;
+ }
+ );
+ }
+
+ logout(){
+ this.loginService.logout().subscribe(
+ res => {
+ location.reload();
+ },
+ err => console.log(err)
+ );
+ // location.reload();
+ this.router.navigate(['/']);
}
}
diff --git a/admin-portal/src/app/services/login.service.spec.ts b/admin-portal/src/app/services/login.service.spec.ts
new file mode 100644
index 0000000..babceb5
--- /dev/null
+++ b/admin-portal/src/app/services/login.service.spec.ts
@@ -0,0 +1,16 @@
+/* tslint:disable:no-unused-variable */
+
+import { TestBed, async, inject } from '@angular/core/testing';
+import { LoginService } from './login.service';
+
+describe('LoginService', () => {
+ beforeEach(() => {
+ TestBed.configureTestingModule({
+ providers: [LoginService]
+ });
+ });
+
+ it('should ...', inject([LoginService], (service: LoginService) => {
+ expect(service).toBeTruthy();
+ }));
+});
diff --git a/admin-portal/src/app/services/login.service.ts b/admin-portal/src/app/services/login.service.ts
new file mode 100644
index 0000000..714482b
--- /dev/null
+++ b/admin-portal/src/app/services/login.service.ts
@@ -0,0 +1,40 @@
+import {Injectable} from "@angular/core";
+import {Http, Headers} from '@angular/http';
+import {Observable} from 'rxjs/Observable';
+
+@Injectable()
+export class LoginService {
+
+ constructor (private http: Http) {}
+
+ sendCredential(username: string, password: string) {
+ let url = "http://localhost:8181/token";
+ let encodedCredentials = btoa(username+":"+password);
+ let basicHeader = "Basic "+ encodedCredentials;
+ let headers = new Headers(
+ {
+ 'Content-Type': 'application/x-www-form-urlencoded',
+ 'Authorization' : basicHeader
+
+ // 'Access-Control-Allow-Credentials' : true
+ });
+ return this.http.get(url, {headers: headers});
+ }
+
+ checkSession() {
+ let url = "http://localhost:8181/checkSession";
+ let tokenHeader = new Headers ({
+ 'x-auth-token' : localStorage.getItem("xAuthToken")
+ });
+ return this.http.get(url, {headers : tokenHeader});
+ }
+
+ logout() {
+ let url = "http://localhost:8181/user/logout";
+ let tokenHeader = new Headers ({
+ 'x-auth-token' : localStorage.getItem("xAuthToken")
+ });
+ return this.http.post(url,'', {headers : tokenHeader});
+ }
+
+}
diff --git a/admin-portal/src/index.html b/admin-portal/src/index.html
index 97c7a45..46566e3 100644
--- a/admin-portal/src/index.html
+++ b/admin-portal/src/index.html
@@ -6,6 +6,7 @@
+
diff --git a/admin-portal/src/styles.css b/admin-portal/src/styles.css
index 90d4ee0..e7b9b12 100644
--- a/admin-portal/src/styles.css
+++ b/admin-portal/src/styles.css
@@ -1 +1,2 @@
/* You can add global styles to this file, and also import other style files */
+@import '~@angular/material/core/theming/prebuilt/deeppurple-amber.css';
\ No newline at end of file
diff --git a/bookstore-api/.idea/workspace.xml b/bookstore-api/.idea/workspace.xml
index 1e81dfc..89fc6ea 100644
--- a/bookstore-api/.idea/workspace.xml
+++ b/bookstore-api/.idea/workspace.xml
@@ -31,7 +31,9 @@
-
+
+
+
@@ -51,7 +53,15 @@
-
+
+
+
+
+
+
+
+
+
@@ -61,7 +71,17 @@
-
+
+
+
+
+
+
+
+
+
+
+
@@ -675,12 +695,12 @@
-
+
-
+
@@ -703,7 +723,7 @@
-
+
@@ -801,7 +821,17 @@
-
+
+
+
+
+
+
+
+
+
+
+
@@ -809,7 +839,15 @@
-
+
+
+
+
+
+
+
+
+
@@ -1037,7 +1075,17 @@
-
+
+
+
+
+
+
+
+
+
+
+
@@ -1045,7 +1093,15 @@
-
+
+
+
+
+
+
+
+
+
@@ -1061,7 +1117,9 @@
-
+
+
+