From 63fe44ae7bb1814808c3d795086d7482a4ab06e4 Mon Sep 17 00:00:00 2001 From: Rorschach-ar Date: Fri, 20 Jan 2023 17:50:18 +0530 Subject: [PATCH 1/5] UI --- .../Library/controller/BorrowController.java | 12 +- .../src/app/addbooks/addbooks.component.html | 5 - .../booksdisplay/booksdisplay.component.css | 20 +-- .../booksdisplay/booksdisplay.component.html | 5 +- .../borrowhistory.component.html | 49 ++++--- .../findby-category.component.css | 12 +- .../findby-category.component.html | 130 ++++++++++-------- .../findby-category.component.ts | 84 +++++------ .../src/app/homepage/homepage.component.css | 2 +- .../src/app/homepage/homepage.component.html | 8 ++ .../Library/src/app/login/login.component.ts | 88 ++++++------ .../src/app/navbar2/navbar2.component.html | 12 ++ .../notification/notification.component.css | 6 + .../notification/notification.component.html | 3 +- .../notification/notification.component.ts | 7 - .../src/app/sidenav2/sidenav2.component.html | 20 ++- 16 files changed, 253 insertions(+), 210 deletions(-) diff --git a/BackEnd/Library/src/main/java/com/innovature/Library/controller/BorrowController.java b/BackEnd/Library/src/main/java/com/innovature/Library/controller/BorrowController.java index 73617045..473eee5b 100644 --- a/BackEnd/Library/src/main/java/com/innovature/Library/controller/BorrowController.java +++ b/BackEnd/Library/src/main/java/com/innovature/Library/controller/BorrowController.java @@ -104,13 +104,8 @@ public Collection list() { } - - - - - //load results of issuedate filter at User BorrowHistory -@GetMapping("user/loadByIssueDate/{date1}/{date2}") +@GetMapping("/user/loadByIssueDate/{date1}/{date2}") public ResponseEntity> loadByIssueDateUser( @PathVariable("date1") Date date1, @PathVariable("date2") Date date2) @@ -134,11 +129,6 @@ public ResponseEntity> loadByIssueDateUser( HttpStatus.OK); } - - - - - @PostMapping public BorrowDetailView add(@Valid @RequestBody BorrowForm form) { return bService.add(form); diff --git a/FrontEnd/Library/src/app/addbooks/addbooks.component.html b/FrontEnd/Library/src/app/addbooks/addbooks.component.html index e8536c29..1111c0eb 100644 --- a/FrontEnd/Library/src/app/addbooks/addbooks.component.html +++ b/FrontEnd/Library/src/app/addbooks/addbooks.component.html @@ -36,11 +36,6 @@ width: 30vh; } - /* .col-md-6{ - display: flex; - flex-wrap: wrap; - flex-direction: row; - } */ } diff --git a/FrontEnd/Library/src/app/booksdisplay/booksdisplay.component.css b/FrontEnd/Library/src/app/booksdisplay/booksdisplay.component.css index e1bda7e5..07f1f0c8 100644 --- a/FrontEnd/Library/src/app/booksdisplay/booksdisplay.component.css +++ b/FrontEnd/Library/src/app/booksdisplay/booksdisplay.component.css @@ -49,25 +49,23 @@ p { border-radius: 7px; } -.table-bordered { - border: 1px solid; -} + th { background-color: #232524; color: white; width: 15%; text-align: center; -} +} -/* td { + td { background-color: #a7bdb08f; color: rgb(0, 0, 0); width: 15%; text-align: center; margin-top: auto; padding: auto; -} */ +} .btnList { @@ -100,13 +98,6 @@ mat-grid-tile { height: 100px; } -.table { - margin-left: 100px; -width: 300px; -height: 250px; - - -} .example-card { max-width: 400px; @@ -116,6 +107,9 @@ height: 250px; background-image: url('https://material.angular.io/assets/img/examples/shiba1.jpg'); background-size: cover; } + + + @media only screen and (max-width: 600px) { body { background-color: lightblue; diff --git a/FrontEnd/Library/src/app/booksdisplay/booksdisplay.component.html b/FrontEnd/Library/src/app/booksdisplay/booksdisplay.component.html index 7f24d083..aaefe8e4 100644 --- a/FrontEnd/Library/src/app/booksdisplay/booksdisplay.component.html +++ b/FrontEnd/Library/src/app/booksdisplay/booksdisplay.component.html @@ -5,7 +5,7 @@

-

Books Details

+

Books Details

@@ -33,7 +33,6 @@

Books Details

}; "> - @@ -52,7 +51,7 @@

Books Details

- + \ No newline at end of file diff --git a/FrontEnd/Library/src/app/borrowhistory/borrowhistory.component.html b/FrontEnd/Library/src/app/borrowhistory/borrowhistory.component.html index dea0afcb..57dd89c1 100644 --- a/FrontEnd/Library/src/app/borrowhistory/borrowhistory.component.html +++ b/FrontEnd/Library/src/app/borrowhistory/borrowhistory.component.html @@ -1,27 +1,41 @@ - + + + + +
-

Borrow Details

- -
- -
- START DATE          - END DATE         -           +

Borrow Details

+ + + +
-
+
-
+
{{books.booksName}} {{books.category.categoryName}} {{books.publication}}
@@ -33,7 +47,7 @@

Borrow Details

- - - -
- -
-
Return Date Due date - +
+ + + + +
+
+ +

- - -
-
- -
-
-
-
-
+
+ +
+ +
+
+
+
+ + + - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Book NameCategory-NamePublicationAuthorBook CopiesBook CoverAction
{{books.booksName}}{{books.category.categoryName}}{{books.publication}}{{books.auther}}{{books.booksCopies}} - - - -
\ No newline at end of file + + + Book Name + Category-Name + Publication + Author + Book Copies + Book Cover + Action + + + + + + {{books.booksName}} + {{books.category.categoryName}} + {{books.publication}} + {{books.auther}} + {{books.booksCopies}} + + + + + + + + +
+ + diff --git a/FrontEnd/Library/src/app/findby-category/findby-category.component.ts b/FrontEnd/Library/src/app/findby-category/findby-category.component.ts index 2fcb6ea4..4f305e4c 100644 --- a/FrontEnd/Library/src/app/findby-category/findby-category.component.ts +++ b/FrontEnd/Library/src/app/findby-category/findby-category.component.ts @@ -13,71 +13,75 @@ import { CategoryService } from '../category.service'; export class FindbyCategoryComponent implements OnInit { categoryList: any[]; - categoryId:any; + categoryId: any; booksList: any[]; books: any; booksId: any; - selectedGroup:any; + selectedGroup: any; - categorydata:any; - booksdata:any; + categorydata: any; + booksdata: any; catdata: any; - ObjSampleForm:FormGroup=new FormGroup( - { - categoryId:new FormControl('',[Validators.required]) + ObjSampleForm: FormGroup = new FormGroup( + { + categoryId: new FormControl('', [Validators.required]) }) - - constructor(private router:Router ,private booksService:BooksService,private service:CategoryService,private borrowservice:BorrowService) { - this.booksList=[]; - this.categoryList=[];} + + constructor(private router: Router, private booksService: BooksService, private service: CategoryService, private borrowservice: BorrowService) { + this.booksList = []; + this.categoryList = []; + } ngOnInit(): void { - - this.service.LoadCategoryForUser().subscribe((data: any)=>{ - this.catdata=data; - console.log(this.catdata) + + this.service.LoadCategoryForUser().subscribe((data: any) => { + this.catdata = data; + console.log(this.catdata) }); - } + } - home() - { + home() { this.router.navigate(['/userbody']) } - disp(){ + disp() { - console.log(this.selectedGroup); - // console.log(this.selectedGroup.categoryId); - // console.log(this.categoryId) - //this.LoadbyCategory(); - this.booksService.LoadbyCategory(this.selectedGroup).subscribe((data: any)=>{ - console.log(data) - this.booksdata=data; - }); - } + console.log(this.selectedGroup); + this.booksService.LoadbyCategory(this.selectedGroup).subscribe((data: any) => { + if (data.length>0) { + this.booksdata = data; + console.log(data) + } else{ + this.booksdata=null + } + }); + } - requestBook(booksId: any) { - console.log(booksId) - let data=booksId - this.borrowservice.add(data).subscribe({ - next:(res)=>{ - this.booksId=res.booksId; - console.log(res); - alert("Book request successfull") + + + + requestBook(booksId: any) { + console.log(booksId) + let data = booksId + this.borrowservice.add(data).subscribe({ + next: (res) => { + this.booksId = res.booksId; + console.log(res); + alert("Book request successfull") this.router.navigate(['/borrowhistory']) - }, - error:(msg)=>{} - }) - } + }, + error: (msg) => { } + }) + } // LoadbyCategory() { // this.booksService.LoadbyCategory().subscribe((data: any)=>{ diff --git a/FrontEnd/Library/src/app/homepage/homepage.component.css b/FrontEnd/Library/src/app/homepage/homepage.component.css index 0aa062c7..c75a2809 100644 --- a/FrontEnd/Library/src/app/homepage/homepage.component.css +++ b/FrontEnd/Library/src/app/homepage/homepage.component.css @@ -1,7 +1,7 @@ .home img { width: 100%; - height: 574px; + height: 635px; object-position: center; } diff --git a/FrontEnd/Library/src/app/homepage/homepage.component.html b/FrontEnd/Library/src/app/homepage/homepage.component.html index 908a0b89..a3b0958b 100644 --- a/FrontEnd/Library/src/app/homepage/homepage.component.html +++ b/FrontEnd/Library/src/app/homepage/homepage.component.html @@ -1,4 +1,12 @@ + + + +
diff --git a/FrontEnd/Library/src/app/login/login.component.ts b/FrontEnd/Library/src/app/login/login.component.ts index 2f84b2c3..afc86ed2 100644 --- a/FrontEnd/Library/src/app/login/login.component.ts +++ b/FrontEnd/Library/src/app/login/login.component.ts @@ -1,5 +1,5 @@ import { Component, OnInit } from '@angular/core'; -import { FormControl,FormGroup,Validators } from '@angular/forms'; +import { FormControl, FormGroup, Validators } from '@angular/forms'; import { Route, Router } from '@angular/router'; import { UserserviceService } from '../userservice.service'; import { NgToastModule, NgToastService } from 'ng-angular-popup'; @@ -15,14 +15,13 @@ export class LoginComponent implements OnInit { responsedata: any; - constructor(private router:Router, private service:UserserviceService,private toast : NgToastService ) - { - } - loginForm:FormGroup=new FormGroup( - { - email:new FormControl('',[Validators.required]), - password:new FormControl('',[Validators.required]) - + constructor(private router: Router, private service: UserserviceService, private toast: NgToastService) { + } + loginForm: FormGroup = new FormGroup( + { + email: new FormControl('', [Validators.required]), + password: new FormControl('', [Validators.required]) + } ) @@ -30,50 +29,51 @@ export class LoginComponent implements OnInit { } - login(){ + login() { - if(this.loginForm.valid){ - this.service.login(this.loginForm.value).subscribe(result=>{ - if(result.userId){ - this.responsedata=result - console.log("log=",result); + if (this.loginForm.valid) { + this.service.login(this.loginForm.value).subscribe(result => { + if (result.userId) { + this.responsedata = result + console.log("log=", result); - if(result.role==2){ - localStorage.setItem('token',this.responsedata.accessToken.value) - this.toast.info({detail:'Hello User ',summary:'LogIn Successfull',duration:5000}); + if (result.role == 2) { + localStorage.setItem('token', this.responsedata.accessToken.value) + this.toast.info({ detail: 'Hello User ', summary: 'LogIn Successfull', duration: 5000 }); this.router.navigate(['/homepage']) - } - - - else{ - localStorage.setItem('token',this.responsedata.accessToken.value) - this.toast.info({detail:'Hello Admin : '+result.firstName,summary:'LogIn Successfull',duration:5000}); - this.router.navigate(['/body']) + } - } + + else { + localStorage.setItem('token', this.responsedata.accessToken.value) + this.toast.info({ detail: 'Hello Admin : ' + result.firstName, summary: 'LogIn Successfull', duration: 5000 }); + this.router.navigate(['/body']) } - - else{ - //alert("login not sucessful"); - this.toast.warning({detail:'success msg',summary:'LogIn failed',duration:5000}); - } - }, (error: any) =>{ - this.toast.error({detail:'Login Failed',summary:'Invalid Credentials',duration:5000}); - console.log(error)}); - - - } - - - - else{ - this.toast.error({detail:'Login Failed',summary:'Fill up the fields',duration:5000}); - } + + } + + else { + //alert("login not sucessful"); + this.toast.warning({ detail: 'success msg', summary: 'LogIn failed', duration: 5000 }); + } + }, (error: any) => { + this.toast.error({ detail: 'Login Failed', summary: 'Invalid Credentials', duration: 5000 }); + console.log(error) + }); + + + } + + + + else { + this.toast.error({ detail: 'Login Failed', summary: 'Fill up the fields', duration: 5000 }); + } } - onSignUp(){ + onSignUp() { this.router.navigate(['/user-reg']) diff --git a/FrontEnd/Library/src/app/navbar2/navbar2.component.html b/FrontEnd/Library/src/app/navbar2/navbar2.component.html index 487a78de..7af6b854 100644 --- a/FrontEnd/Library/src/app/navbar2/navbar2.component.html +++ b/FrontEnd/Library/src/app/navbar2/navbar2.component.html @@ -1,4 +1,16 @@ + + + + +