From 7316a137a1ece1a87d220bdc666dde2dec2edf46 Mon Sep 17 00:00:00 2001 From: Rorschach-ar Date: Thu, 19 Jan 2023 16:56:14 +0530 Subject: [PATCH 01/25] modified --- .../Library/src/app/app-routing.module.ts | 2 +- FrontEnd/Library/src/app/app.module.ts | 5 +- .../booksdisplay/booksdisplay.component.css | 82 +++++++++++++------ .../booksdisplay/booksdisplay.component.html | 25 +++--- .../booksdisplay/booksdisplay.component.ts | 11 ++- FrontEnd/Library/src/app/borrow.service.ts | 4 +- .../borrowhistory/borrowhistory.component.ts | 14 +--- .../findby-category.component.html | 42 +++++----- .../Library/src/app/login/login.component.ts | 15 ++-- .../notification/notification.component.css | 2 + .../notification/notification.component.html | 4 +- .../notification/notification.component.ts | 15 ++-- .../src/app/sidenav2/sidenav2.component.ts | 2 +- 13 files changed, 125 insertions(+), 98 deletions(-) diff --git a/FrontEnd/Library/src/app/app-routing.module.ts b/FrontEnd/Library/src/app/app-routing.module.ts index 25944010..8790383e 100644 --- a/FrontEnd/Library/src/app/app-routing.module.ts +++ b/FrontEnd/Library/src/app/app-routing.module.ts @@ -66,7 +66,7 @@ const routes: Routes = [ {path:'navbar2',component:Navbar2Component,canActivate: [HomeguardGuard]}, {path:'sidenav2',component:Sidenav2Component,canActivate: [HomeguardGuard]}, {path:'admin-navbar',component:AdminNavbarComponent,canActivate: [HomeguardGuard]}, - {path:'homepage',component:HomepageComponent,canActivate:[HomeguardGuard]} + {path:'homepage',component:HomepageComponent,canActivate:[HomeguardGuard]}, {path:'user-detailview',component:UserDetailviewComponent,canActivate: [HomeguardGuard]} ]; diff --git a/FrontEnd/Library/src/app/app.module.ts b/FrontEnd/Library/src/app/app.module.ts index f2abb287..9729a8dd 100644 --- a/FrontEnd/Library/src/app/app.module.ts +++ b/FrontEnd/Library/src/app/app.module.ts @@ -59,6 +59,8 @@ import { Navbar2Component } from './navbar2/navbar2.component'; import { AdminNavbarComponent } from './admin-navbar/admin-navbar.component'; import { HomepageComponent } from './homepage/homepage.component'; import { UserDetailviewComponent } from './user-detailview/user-detailview.component'; +import {MatTableModule} from '@angular/material/table'; + // import {MatIconModule} from '@angular/material/icon'; // import { MatToolbarModule } from '@angular/material'; @@ -125,7 +127,8 @@ import { UserDetailviewComponent } from './user-detailview/user-detailview.compo MatDialogModule, MatInputModule, MatListModule, - MatGridListModule + MatGridListModule, + MatTableModule // Chart diff --git a/FrontEnd/Library/src/app/booksdisplay/booksdisplay.component.css b/FrontEnd/Library/src/app/booksdisplay/booksdisplay.component.css index b3bb64ee..e1bda7e5 100644 --- a/FrontEnd/Library/src/app/booksdisplay/booksdisplay.component.css +++ b/FrontEnd/Library/src/app/booksdisplay/booksdisplay.component.css @@ -1,12 +1,11 @@ -p{ +p { padding: 0px 0px 30px 1000px; margin: 0px; background-color: rgb(0, 0, 0); - /* background-image: url('../../../a.png'); */ - + } -.btnhome{ +.btnhome { margin-top: 20px; margin-bottom: 10px; padding: 7; @@ -14,74 +13,111 @@ p{ background-color: rgba(83, 254, 3, 0.853); font-size: 13px; border-radius: 25px; - + } -.text-danger1{ +.text-danger1 { width: 160%; padding: 8px 6px; margin: 0px; box-sizing: border-box; - border: 1px ; + border: 1px; background-color: #a7bdb08f; color: rgb(0, 0, 0); border-radius: 7px; - } - -.dropbtn{ +.dropbtn { width: 160%; padding: 8px 6px; margin: 0px; box-sizing: border-box; - border: 1px ; + border: 1px; background-color: #a7bdb08f; color: rgb(0, 0, 0); border-radius: 7px; } -.btn{ + +.btn { width: 150%; padding: 7px 2px; - margin: 5px ; + margin: 5px; box-sizing: border-box; border: 2px solid rgb(250, 97, 97); - background-color:rgba(106, 215, 56, 0.682); + background-color: rgba(106, 215, 56, 0.682); color: rgb(0, 0, 0); border-radius: 7px; } -.table-bordered{ + +.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{ +.btnList { border: none; padding: 1px; background: rgb(0, 0, 0); font-size: 13px; - font-style: italic ; + font-style: italic; color: rgb(255, 255, 255); border-radius: 3px; } -.btnn2{ - padding-left: 10px;padding-right: 10px; + +.btnn2 { + color: white; + padding-left: 10px; + padding-right: 10px; border-color: rgb(0, 0, 0); - background-color: rgb(64, 133, 238); + background-color: black; font-size: 13px; } +.grid { + border-width: 2px; + width: 50%; +} + +mat-grid-tile { + border-radius: 10px; + background: lightblue; + height: 100px; +} + +.table { + margin-left: 100px; +width: 300px; +height: 250px; + + +} + +.example-card { + max-width: 400px; +} + +.example-header-image { + 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; + } + } \ No newline at end of file diff --git a/FrontEnd/Library/src/app/booksdisplay/booksdisplay.component.html b/FrontEnd/Library/src/app/booksdisplay/booksdisplay.component.html index b9fe1983..7f24d083 100644 --- a/FrontEnd/Library/src/app/booksdisplay/booksdisplay.component.html +++ b/FrontEnd/Library/src/app/booksdisplay/booksdisplay.component.html @@ -1,15 +1,11 @@ - -
-
-
-
-

-

Books Details

- - - +
+
+
+

+
+

Books Details

@@ -50,10 +46,13 @@

Books Details

-
+
+
-
- +
+ + + \ No newline at end of file diff --git a/FrontEnd/Library/src/app/booksdisplay/booksdisplay.component.ts b/FrontEnd/Library/src/app/booksdisplay/booksdisplay.component.ts index 3d1c5636..e2cadc46 100644 --- a/FrontEnd/Library/src/app/booksdisplay/booksdisplay.component.ts +++ b/FrontEnd/Library/src/app/booksdisplay/booksdisplay.component.ts @@ -1,5 +1,6 @@ import { Component, OnInit } from '@angular/core'; import { Router } from '@angular/router'; +import { NgToastService } from 'ng-angular-popup'; import { BooksService } from '../books.service'; import { BorrowService } from '../borrow.service'; import { CategoryService } from '../category.service'; @@ -10,7 +11,7 @@ import { CategoryService } from '../category.service'; styleUrls: ['./booksdisplay.component.css'] }) export class BooksdisplayComponent implements OnInit { - + //booksdata:any; // categoryList: any[]; categoryId:any; @@ -41,7 +42,7 @@ result: any; direction=-1; - constructor(private router:Router ,private booksservice:BooksService,private service:CategoryService,private borrowservice:BorrowService) { + constructor(private router:Router ,private booksservice:BooksService,private service:CategoryService,private borrowservice:BorrowService,private toast:NgToastService) { // this.booksList=[]; // this.categoryList=[]; } @@ -128,8 +129,10 @@ onTableDataChange(event:any) { this.borrowservice.add(data).subscribe({ next:(res)=>{ this.booksId=res.booksId; - console.log(res); - alert("Book request successfull") + console.log(res); + + // alert("Book request successfull") + this.toast.info({summary:'Booking Successfull',duration:5000}); this.router.navigate(['/borrowhistory']) }, error:(msg)=>{} diff --git a/FrontEnd/Library/src/app/borrow.service.ts b/FrontEnd/Library/src/app/borrow.service.ts index 1fc20259..8909e52f 100644 --- a/FrontEnd/Library/src/app/borrow.service.ts +++ b/FrontEnd/Library/src/app/borrow.service.ts @@ -72,7 +72,7 @@ handleError(err: HttpErrorResponse): any { // user filer filterBorrowPagination2(date1:any,date2:any,page:any,tableSize:any,sort:any){ console.log(date1) - return this.http.get(this.apiurl + "/borrow/user/"+date1+"/"+date2+"?pageNo="+page+"&pageSize="+tableSize+"&sortBy="+sort) + return this.http.get(this.apiurl + "/borrow/user/loadByIssueDate/"+date1+"/"+date2) } ////////////// @@ -83,7 +83,7 @@ handleError(err: HttpErrorResponse): any { // return this.http.get(this.apiurl + `/users/fetching/${type}/${date1}/${date2}`, httpOptions) LoadByIssueDate(date1:any,date2:any){ - return this.http.get(this.apiurl + "/borrow/loadByIssueDate/"+date1+"/"+date2).pipe((catchError(err => this.handleError(err)))); + return this.http.get(this.apiurl + "/borrow/loadByIssueDate/"+date1+"/"+date2); } //user LoadByIssueDateUser(date1:any,date2:any){ diff --git a/FrontEnd/Library/src/app/borrowhistory/borrowhistory.component.ts b/FrontEnd/Library/src/app/borrowhistory/borrowhistory.component.ts index 004d0726..f6ba1370 100644 --- a/FrontEnd/Library/src/app/borrowhistory/borrowhistory.component.ts +++ b/FrontEnd/Library/src/app/borrowhistory/borrowhistory.component.ts @@ -11,7 +11,8 @@ import { UserserviceService } from '../userservice.service'; styleUrls: ['./borrowhistory.component.css'] }) export class BorrowhistoryComponent implements OnInit { - + + // borrowList: any[]; borrowId: any; @@ -194,25 +195,14 @@ export class BorrowhistoryComponent implements OnInit { console.log('1111',this.sort); }) - // if (this.searchData == null || this.searchData == "") { - - // // this.sort="borrow_id"; this.service.filterBorrowPagination2(this.ObjSampleForm.controls['date1'].value, this.ObjSampleForm.controls['date2'].value, this.page, this.tableSize, this.sort).subscribe({ next: (res: any) => { - - //console.log("--------") console.log('filter',res); console.log(this.ObjSampleForm.controls['date1'].value); this.data = res; }, }); - - // } - // else { - - // this.data = this.searchData - // } } display(){ diff --git a/FrontEnd/Library/src/app/findby-category/findby-category.component.html b/FrontEnd/Library/src/app/findby-category/findby-category.component.html index 66c95cf2..33a8b33b 100644 --- a/FrontEnd/Library/src/app/findby-category/findby-category.component.html +++ b/FrontEnd/Library/src/app/findby-category/findby-category.component.html @@ -1,12 +1,12 @@ - +

- -
+
@@ -30,31 +30,31 @@ - + - + - + - - - - - - - - + + + + + + + - - + +
Book Name Category-Name PublicationAutherAuthor Book Copies Book Cover Action
{{books.booksName}}{{books.category.categoryName}}{{books.publication}}{{books.auther}}{{books.booksCopies}} - - - + {{books.booksName}}{{books.category.categoryName}}{{books.publication}}{{books.auther}}{{books.booksCopies}} + + +
\ No newline at end of file diff --git a/FrontEnd/Library/src/app/login/login.component.ts b/FrontEnd/Library/src/app/login/login.component.ts index e5f7e39f..62859ad4 100644 --- a/FrontEnd/Library/src/app/login/login.component.ts +++ b/FrontEnd/Library/src/app/login/login.component.ts @@ -37,6 +37,10 @@ export class LoginComponent implements OnInit { if(result.userId){ this.responsedata=result console.log("log=",result); + localStorage.setItem('name',result.firstName); + localStorage.setItem('email',result.email); + localStorage.setItem('phone',result.phone); + if(result.role==2){ localStorage.setItem('token',this.responsedata.accessToken.value) @@ -55,21 +59,12 @@ export class LoginComponent implements OnInit { } 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{ - // return; - // } } diff --git a/FrontEnd/Library/src/app/notification/notification.component.css b/FrontEnd/Library/src/app/notification/notification.component.css index b354b8d1..e8a877b0 100644 --- a/FrontEnd/Library/src/app/notification/notification.component.css +++ b/FrontEnd/Library/src/app/notification/notification.component.css @@ -52,6 +52,8 @@ p{ } .table-bordered{ border: 1px solid; + margin-left: 70px; + margin-right: 20px; } th { background-color: #232524; diff --git a/FrontEnd/Library/src/app/notification/notification.component.html b/FrontEnd/Library/src/app/notification/notification.component.html index 7143bda0..0e27d003 100644 --- a/FrontEnd/Library/src/app/notification/notification.component.html +++ b/FrontEnd/Library/src/app/notification/notification.component.html @@ -2,12 +2,12 @@ -

+ Issue date : {{due.issueDate| date:'dd/MM/yyyy'}}
Due date : {{due.dueDate| date:'dd/MM/yyyy'}}
Status : {{due.status}}
Due days : {{due.dueDays}}
Fine : {{due.fine}}
- +
\ No newline at end of file diff --git a/FrontEnd/Library/src/app/notification/notification.component.ts b/FrontEnd/Library/src/app/notification/notification.component.ts index f0c3db42..a0f594eb 100644 --- a/FrontEnd/Library/src/app/notification/notification.component.ts +++ b/FrontEnd/Library/src/app/notification/notification.component.ts @@ -89,7 +89,7 @@ export class NotificationComponent implements OnInit { "currency": "INR", "name": "", "description": "Test Transaction", - "image": "../assets/BooksImage/item_pics/item_pics/sherlok.jpeg", + "image": "../../assets/BooksImage/item_pics/aadu.jpeg", "order_id": "", //This is a sample Order ID. Pass the `id` obtained in the response of Step 1 // "callback_url": "https://eneqd3r9zrjok.x.pipedream.net/", "handler": function (response: any) { @@ -105,7 +105,7 @@ export class NotificationComponent implements OnInit { "prefill": { "name": this.name, "email": this.email, - "contact": this.phone + "contact": this.phone, }, "notes": { "address": "Razorpay Corporate Office" @@ -114,11 +114,12 @@ export class NotificationComponent implements OnInit { "color": "#3399cc" } }; - pay(fine: number, bookname: string) { + pay(fine: number, bookname: string,BooksImage:string) { console.log(fine) this.tot = fine * 100; this.options.amount = this.tot; this.options.name = bookname; + this.options.image=BooksImage; this.service.LoadDueByUser().subscribe((data: any) => { this.duedata = data; this.borrow = data; @@ -129,9 +130,6 @@ export class NotificationComponent implements OnInit { this.rzp1 = new this.service.nativeWindow.Razorpay(this.options); this.rzp1.open(); this.rzp1.on('payment.failed', function (response: any) { - - // this.message ="Payment Failed" - console.log(response.console.error.code); } ); @@ -145,8 +143,9 @@ export class NotificationComponent implements OnInit { this.service.payment(this.duedata[0].borrowId).subscribe({ next: (Response: any) => { console.log(Response); - alert("Payment Success") - // window.location.reload() + // alert("Payment Success") + this.toast.info({summary:'payment Successfull',duration:5000}); + }, error: (Response: any) => { console.log(Response) diff --git a/FrontEnd/Library/src/app/sidenav2/sidenav2.component.ts b/FrontEnd/Library/src/app/sidenav2/sidenav2.component.ts index 73277aac..b03ef5df 100644 --- a/FrontEnd/Library/src/app/sidenav2/sidenav2.component.ts +++ b/FrontEnd/Library/src/app/sidenav2/sidenav2.component.ts @@ -15,7 +15,7 @@ export class Sidenav2Component implements OnInit { logout(){ if (confirm('Are you sure want to Logout?')) { localStorage.clear(); - localStorage.removeItem('token'); + this.router.navigate(['/login']) } else { From 51d291ebede145eaf5762984ae867c19d9f8906a Mon Sep 17 00:00:00 2001 From: Rorschach-ar Date: Fri, 20 Jan 2023 10:17:05 +0530 Subject: [PATCH 02/25] login --- .../Library/src/app/login/login.component.ts | 21 ++++++++++++------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/FrontEnd/Library/src/app/login/login.component.ts b/FrontEnd/Library/src/app/login/login.component.ts index 62859ad4..2f84b2c3 100644 --- a/FrontEnd/Library/src/app/login/login.component.ts +++ b/FrontEnd/Library/src/app/login/login.component.ts @@ -32,15 +32,11 @@ export class LoginComponent implements OnInit { login(){ - // if(this.ObjSampleForm.valid){ + if(this.loginForm.valid){ this.service.login(this.loginForm.value).subscribe(result=>{ if(result.userId){ this.responsedata=result console.log("log=",result); - localStorage.setItem('name',result.firstName); - localStorage.setItem('email',result.email); - localStorage.setItem('phone',result.phone); - if(result.role==2){ localStorage.setItem('token',this.responsedata.accessToken.value) @@ -52,19 +48,28 @@ export class LoginComponent implements OnInit { else{ localStorage.setItem('token',this.responsedata.accessToken.value) this.toast.info({detail:'Hello Admin : '+result.firstName,summary:'LogIn Successfull',duration:5000}); - this.router.navigate(['/sidenav']) + 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}); + } } @@ -74,4 +79,4 @@ export class LoginComponent implements OnInit { } -} +} \ No newline at end of file From 63fe44ae7bb1814808c3d795086d7482a4ab06e4 Mon Sep 17 00:00:00 2001 From: Rorschach-ar Date: Fri, 20 Jan 2023 17:50:18 +0530 Subject: [PATCH 03/25] 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 @@ + + + + +