diff --git a/admin-portal/src/app/app.module.ts b/admin-portal/src/app/app.module.ts
index 335e38c..a1839e2 100644
--- a/admin-portal/src/app/app.module.ts
+++ b/admin-portal/src/app/app.module.ts
@@ -21,6 +21,9 @@ import {GetBookListService} from "./services/get-book-list.service";
import {GetBookService} from "./services/get-book.service";
// import { EditBookComponent } from './components/edit-book/edit-book.component';
import {EditBookService} from "./services/edit-book.service";
+import { BookListComponent } from './components/book-list/book-list.component';
+import { EditBookComponent } from './components/edit-book/edit-book.component';
+import { ViewBookComponent } from './components/view-book/view-book.component';
@NgModule({
declarations: [
@@ -28,6 +31,9 @@ import {EditBookService} from "./services/edit-book.service";
NavBarComponent,
LoginComponent,
AddNewBookComponent,
+ BookListComponent,
+ EditBookComponent,
+ ViewBookComponent,
// BookListComponent,
// BookListComponent,
// ViewBookComponent,
diff --git a/admin-portal/src/app/app.routing.ts b/admin-portal/src/app/app.routing.ts
index d6686e9..cbc3a36 100644
--- a/admin-portal/src/app/app.routing.ts
+++ b/admin-portal/src/app/app.routing.ts
@@ -5,9 +5,9 @@ import {ModuleWithProviders} from '@angular/core';
import {Routes, RouterModule} from '@angular/router';
import {LoginComponent} from "./components/login/login.component";
import {AddNewBookComponent} from "./components/add-new-book/add-new-book.component";
-// import {BookListComponent} from "./components/book-list/book-list.component";
-// import {ViewBookComponent} from "./components/view-book/view-book.component";
-// import {EditBookComponent} from "./components/edit-book/edit-book.component";
+import {BookListComponent} from "./components/book-list/book-list.component";
+import {ViewBookComponent} from "./components/view-book/view-book.component";
+import {EditBookComponent} from "./components/edit-book/edit-book.component";
const appRoutes: Routes = [
{
@@ -22,19 +22,19 @@ const appRoutes: Routes = [
{
path: 'addNewBook',
component: AddNewBookComponent
+ },
+ {
+ path: 'editBook/:id',
+ component: EditBookComponent
+ },
+ {
+ path: 'bookList',
+ component: BookListComponent
+ },
+ {
+ path: 'viewBook/:id',
+ component: ViewBookComponent
}
- // {
- // path: 'editBook/:id',
- // component: EditBookComponent
- // },
- // {
- // path: 'bookList',
- // component: BookListComponent
- // },
- // {
- // path: 'viewBook/:id',
- // component: ViewBookComponent
- // }
];
export const routing: ModuleWithProviders = RouterModule.forRoot(appRoutes);
diff --git a/admin-portal/src/app/components/book-list/book-list.component.css b/admin-portal/src/app/components/book-list/book-list.component.css
new file mode 100644
index 0000000..c4e1dff
--- /dev/null
+++ b/admin-portal/src/app/components/book-list/book-list.component.css
@@ -0,0 +1,51 @@
+table {
+ border-collapse: separate;
+ border-spacing: 0;
+ color: #4a4a4d;
+ font: 14px/1.4 "Helvetica Neue", Helvetica, Arial, sans-serif;
+}
+th,
+td {
+ padding: 10px 15px;
+ vertical-align: middle;
+}
+thead {
+ background: #395870;
+ color: #fff;
+}
+th {
+ font-weight: bold;
+}
+th:first-child {
+ text-align: left;
+}
+tbody tr:nth-child(even) {
+ background: #f0f0f2;
+}
+td {
+ border-bottom: 1px solid #cecfd5;
+ border-right: 1px solid #cecfd5;
+}
+td:first-child {
+ border-left: 1px solid #cecfd5;
+}
+.book-title {
+ color: #395870;
+ display: block;
+}
+.item-stock,
+.item-qty {
+ text-align: center;
+}
+.item-price {
+ text-align: right;
+}
+.item-multiple {
+ display: block;
+}
+tfoot {
+ text-align: right;
+}
+tfoot tr:last-child {
+ background: #f0f0f2;
+}
\ No newline at end of file
diff --git a/admin-portal/src/app/components/book-list/book-list.component.html b/admin-portal/src/app/components/book-list/book-list.component.html
new file mode 100644
index 0000000..1df3d16
--- /dev/null
+++ b/admin-portal/src/app/components/book-list/book-list.component.html
@@ -0,0 +1,39 @@
+
diff --git a/admin-portal/src/app/components/book-list/book-list.component.spec.ts b/admin-portal/src/app/components/book-list/book-list.component.spec.ts
new file mode 100644
index 0000000..d5af318
--- /dev/null
+++ b/admin-portal/src/app/components/book-list/book-list.component.spec.ts
@@ -0,0 +1,28 @@
+/* tslint:disable:no-unused-variable */
+import { async, ComponentFixture, TestBed } from '@angular/core/testing';
+import { By } from '@angular/platform-browser';
+import { DebugElement } from '@angular/core';
+
+import { BookListComponent } from './book-list.component';
+
+describe('BookListComponent', () => {
+ let component: BookListComponent;
+ let fixture: ComponentFixture;
+
+ beforeEach(async(() => {
+ TestBed.configureTestingModule({
+ declarations: [ BookListComponent ]
+ })
+ .compileComponents();
+ }));
+
+ beforeEach(() => {
+ fixture = TestBed.createComponent(BookListComponent);
+ component = fixture.componentInstance;
+ fixture.detectChanges();
+ });
+
+ it('should create', () => {
+ expect(component).toBeTruthy();
+ });
+});
diff --git a/admin-portal/src/app/components/book-list/book-list.component.ts b/admin-portal/src/app/components/book-list/book-list.component.ts
new file mode 100644
index 0000000..1f7121e
--- /dev/null
+++ b/admin-portal/src/app/components/book-list/book-list.component.ts
@@ -0,0 +1,38 @@
+import { Component, OnInit } from '@angular/core';
+import {LoginService} from "../../services/login.service";
+import {Book} from "../../models/book";
+import {GetBookListService} from "../../services/get-book-list.service";
+import {Router} from "@angular/router";
+
+@Component({
+ selector: 'app-book-list',
+ templateUrl: './book-list.component.html',
+ styleUrls: ['./book-list.component.css']
+})
+export class BookListComponent implements OnInit {
+
+ private selectedBook : Book;
+ private bookList: Book[];
+
+ constructor(private getBookListService: GetBookListService, private router: Router) {
+ this.getBookListService.getBookList().subscribe(
+ res => {
+ console.log(res.json());
+ this.bookList=res.json();
+ },
+ err => {
+ console.log(err);
+ }
+ );
+ }
+
+ onSelect(book:Book) {
+ this.selectedBook = book;
+ this.router.navigate(['/viewBook', this.selectedBook.id]);
+ }
+
+ ngOnInit() {
+
+ }
+
+}
diff --git a/admin-portal/src/app/components/edit-book/edit-book.component.css b/admin-portal/src/app/components/edit-book/edit-book.component.css
new file mode 100644
index 0000000..e69de29
diff --git a/admin-portal/src/app/components/edit-book/edit-book.component.html b/admin-portal/src/app/components/edit-book/edit-book.component.html
new file mode 100644
index 0000000..c1ee4ba
--- /dev/null
+++ b/admin-portal/src/app/components/edit-book/edit-book.component.html
@@ -0,0 +1,120 @@
+
+
+
Update Book Information * is a required field
+
+
+
+
+
Book updated successfully!
+
+
diff --git a/admin-portal/src/app/components/edit-book/edit-book.component.spec.ts b/admin-portal/src/app/components/edit-book/edit-book.component.spec.ts
new file mode 100644
index 0000000..9bbddef
--- /dev/null
+++ b/admin-portal/src/app/components/edit-book/edit-book.component.spec.ts
@@ -0,0 +1,28 @@
+/* tslint:disable:no-unused-variable */
+import { async, ComponentFixture, TestBed } from '@angular/core/testing';
+import { By } from '@angular/platform-browser';
+import { DebugElement } from '@angular/core';
+
+import { EditBookComponent } from './edit-book.component';
+
+describe('EditBookComponent', () => {
+ let component: EditBookComponent;
+ let fixture: ComponentFixture;
+
+ beforeEach(async(() => {
+ TestBed.configureTestingModule({
+ declarations: [ EditBookComponent ]
+ })
+ .compileComponents();
+ }));
+
+ beforeEach(() => {
+ fixture = TestBed.createComponent(EditBookComponent);
+ component = fixture.componentInstance;
+ fixture.detectChanges();
+ });
+
+ it('should create', () => {
+ expect(component).toBeTruthy();
+ });
+});
diff --git a/admin-portal/src/app/components/edit-book/edit-book.component.ts b/admin-portal/src/app/components/edit-book/edit-book.component.ts
new file mode 100644
index 0000000..3a194fc
--- /dev/null
+++ b/admin-portal/src/app/components/edit-book/edit-book.component.ts
@@ -0,0 +1,52 @@
+import {Component, OnInit} from '@angular/core';
+import {EditBookService} from "../../services/edit-book.service";
+import {UploadImageService} from "../../services/upload-image.service";
+import {Book} from "../../models/book";
+import {Params, ActivatedRoute, Router} from "@angular/router";
+import {GetBookService} from "../../services/get-book.service";
+
+@Component({
+ selector: 'app-edit-book',
+ templateUrl: './edit-book.component.html',
+ styleUrls: ['./edit-book.component.css']
+})
+export class EditBookComponent implements OnInit {
+
+ private bookId: number;
+ private book: Book = new Book();
+ private bookUpdated: boolean;
+
+ constructor(private uploadImageService: UploadImageService,
+ private editBookService: EditBookService,
+ private getBookService: GetBookService,
+ private route: ActivatedRoute,
+ private router: Router) {
+ this.route.params.forEach((params: Params) => {
+ this.bookId = Number.parseInt(params['id']);
+ });
+
+ this.getBookService.getBook(this.bookId).subscribe(
+ res => {
+ this.book = res.json();
+ },
+ error => console.log(error)
+ );
+ }
+
+ onSubmit() {
+ this.editBookService.sendBook(this.book)
+ .subscribe(
+ data => {
+ this.uploadImageService.modify(JSON.parse(JSON.parse(JSON.stringify(data))._body).id);
+ this.bookUpdated = true;
+ },
+ error => console.log(error)
+ );
+ }
+
+
+
+ ngOnInit() {
+ }
+
+}
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 0efb422..73b0e89 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,6 +1,7 @@
ADMIN PORTAL
+ View Book List
Add a Book
Logout
diff --git a/admin-portal/src/app/components/view-book/view-book.component.css b/admin-portal/src/app/components/view-book/view-book.component.css
new file mode 100644
index 0000000..e69de29
diff --git a/admin-portal/src/app/components/view-book/view-book.component.html b/admin-portal/src/app/components/view-book/view-book.component.html
new file mode 100644
index 0000000..ebc8d1f
--- /dev/null
+++ b/admin-portal/src/app/components/view-book/view-book.component.html
@@ -0,0 +1,95 @@
+
+
+
+
+
+
+
![]()
+
+
+
+
+ {{book.title}}
+
+
+
+
+ Author: {{book.author}}
+
+
+ Publisher: {{book.publisher}}
+
+
+ Publication Date: {{book.publicationDate}}
+
+
+ Language: {{book.language}}
+
+
+ Category: {{book.category}}
+
+
+ Pages: {{book.numberOfPages}}
+
+
+
+
+
+
+ Format: {{book.format}}
+
+
+ ISBN: {{book.isbn}}
+
+
+ Shipping Weight: {{book.shippingWeight}}
+
+
+ List Price: {{book.listPrice}}
+
+
+ Our Price: {{book.ourPrice}}
+
+
+ Number in Stock: {{book.inStockNumber}}
+
+
+
+
+ Description: {{book.description}}
+
+
+
+
diff --git a/admin-portal/src/app/components/view-book/view-book.component.spec.ts b/admin-portal/src/app/components/view-book/view-book.component.spec.ts
new file mode 100644
index 0000000..7035dab
--- /dev/null
+++ b/admin-portal/src/app/components/view-book/view-book.component.spec.ts
@@ -0,0 +1,28 @@
+/* tslint:disable:no-unused-variable */
+import { async, ComponentFixture, TestBed } from '@angular/core/testing';
+import { By } from '@angular/platform-browser';
+import { DebugElement } from '@angular/core';
+
+import { ViewBookComponent } from './view-book.component';
+
+describe('ViewBookComponent', () => {
+ let component: ViewBookComponent;
+ let fixture: ComponentFixture;
+
+ beforeEach(async(() => {
+ TestBed.configureTestingModule({
+ declarations: [ ViewBookComponent ]
+ })
+ .compileComponents();
+ }));
+
+ beforeEach(() => {
+ fixture = TestBed.createComponent(ViewBookComponent);
+ component = fixture.componentInstance;
+ fixture.detectChanges();
+ });
+
+ it('should create', () => {
+ expect(component).toBeTruthy();
+ });
+});
diff --git a/admin-portal/src/app/components/view-book/view-book.component.ts b/admin-portal/src/app/components/view-book/view-book.component.ts
new file mode 100644
index 0000000..561cf7e
--- /dev/null
+++ b/admin-portal/src/app/components/view-book/view-book.component.ts
@@ -0,0 +1,36 @@
+import { Component, OnInit } from '@angular/core';
+import {Params, ActivatedRoute, Router} from "@angular/router";
+import {GetBookService} from "../../services/get-book.service";
+import {Book} from "../../models/book";
+
+@Component({
+ selector: 'app-view-book',
+ templateUrl: './view-book.component.html',
+ styleUrls: ['./view-book.component.css']
+})
+export class ViewBookComponent implements OnInit {
+
+ private book: Book = new Book();
+ private bookId: number;
+
+ constructor ( private getBookService: GetBookService, private route: ActivatedRoute, private router:Router){
+ this.route.params.forEach((params: Params) => {
+ this.bookId = Number.parseInt(params['id']);
+ });
+
+
+ this.getBookService.getBook(this.bookId).subscribe(
+ res => {
+ this.book=res.json();
+ },
+ error => console.log(error)
+ );
+ }
+
+ onSelect(book: Book) {
+ this.router.navigate(['/editBook', this.book.id]).then(s =>location.reload());
+ }
+
+ ngOnInit(){}
+
+}