diff --git a/BackEnd/Library/src/main/java/com/innovature/Library/controller/BooksController.java b/BackEnd/Library/src/main/java/com/innovature/Library/controller/BooksController.java index e95fd05c..26e13a3b 100644 --- a/BackEnd/Library/src/main/java/com/innovature/Library/controller/BooksController.java +++ b/BackEnd/Library/src/main/java/com/innovature/Library/controller/BooksController.java @@ -1,11 +1,8 @@ package com.innovature.Library.controller; - import java.io.IOException; import java.util.Collection; import java.util.List; - import javax.validation.Valid; - import org.springframework.http.HttpHeaders; import org.springframework.http.HttpStatus; import org.springframework.beans.factory.annotation.Autowired; @@ -23,7 +20,6 @@ import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RestController; import org.springframework.web.multipart.MultipartFile; - import com.innovature.Library.entity.Books; import com.innovature.Library.form.BooksForm; import com.innovature.Library.repository.BooksRepository; @@ -31,7 +27,6 @@ import com.innovature.Library.util.FileUtil; import com.innovature.Library.view.BooksDetailView; - @RestController @RequestMapping("/books") public class BooksController { @@ -42,8 +37,6 @@ public class BooksController { @Autowired private BooksRepository booksRepository; - - @PostMapping public BooksDetailView add(@Valid @RequestBody BooksForm form) { return service.add(form); @@ -60,7 +53,6 @@ public Collection listByCategory( { return service.listByCategory(categoryId); } - @GetMapping("/{booksId}") public BooksDetailView list( @@ -70,7 +62,6 @@ public BooksDetailView list( return service.list(booksId); } - @DeleteMapping("/{booksId}") public void deletes( @PathVariable("booksId") Integer booksId) { @@ -85,8 +76,6 @@ public BooksDetailView update( return service.updates(booksId, form); } - - @GetMapping("admin/pagenated/") public ResponseEntity>getAllBooks( @RequestParam(defaultValue = "1") Integer pageNo, 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..e09244d2 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 @@ -23,14 +23,9 @@ import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RestController; - - - import org.supercsv.io.CsvBeanWriter; import org.supercsv.io.ICsvBeanWriter; import org.supercsv.prefs.CsvPreference; - - import com.innovature.Library.entity.Borrow; import com.innovature.Library.form.BorrowForm; import com.innovature.Library.service.BorrowService; @@ -104,13 +99,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 +124,6 @@ public ResponseEntity> loadByIssueDateUser( HttpStatus.OK); } - - - - - @PostMapping public BorrowDetailView add(@Valid @RequestBody BorrowForm form) { return bService.add(form); @@ -158,7 +143,6 @@ public Collection listUserNotification(Principal p) { return bService.listNotification(); } - @GetMapping("user/due") public Collection listDue() { diff --git a/BackEnd/Library/src/main/java/com/innovature/Library/entity/Books.java b/BackEnd/Library/src/main/java/com/innovature/Library/entity/Books.java index e9d8632a..b27ffb6b 100644 --- a/BackEnd/Library/src/main/java/com/innovature/Library/entity/Books.java +++ b/BackEnd/Library/src/main/java/com/innovature/Library/entity/Books.java @@ -31,7 +31,6 @@ private Status(byte value) { private String booksName; private String publication; private String auther; - // private String status; private Integer booksCopies; @ManyToOne(optional = false, fetch = FetchType.EAGER) private Category category; @@ -45,14 +44,13 @@ public Books(Integer booksId){ this.booksId=booksId; } - public Books(BooksForm form,Category category){ this.booksName=form.getBooksName(); this.publication= form.getPublication(); this.auther = form.getAuther(); this.booksCopies= form.getBooksCopies(); this.category = category; - //this.categoryName = new Category(Category); + } @@ -63,8 +61,6 @@ public String getPhotosImagePath() { return "/items - photos/" + booksId + image; } - - public Integer getBooksId() { return booksId; } @@ -113,8 +109,6 @@ public void setCategory(Category category) { this.category = category; } - - public String getImage() { return image; } @@ -131,114 +125,10 @@ public Books(int booksId, String booksName,String publication,String auther,Stri this.booksName = booksName; this.publication = publication; this.auther = auther; - //this.status = status; + this.booksCopies = booksCopies; this.category = category; } - - - - - - - - - - - - - - - - - - - -// public Integer getBooksId() { -// return booksId; -// } -// public void setBooks(Integer booksId) { -// this.booksId = booksId; -// } - - -// ////////////category////////////////// - - - - -// // public String getCategoryName() { -// // return categoryName; -// // } - -// ////////////////////////////////// - - - -// public String getBooksName() { -// return booksName; -// } - -// public void setBooksId(Integer booksId) { -// this.booksId = booksId; -// } - -// public Category getCategory() { -// return category; -// } - -// public void setCategory(Category category) { -// this.category = category; -// } - -// public void setBooksName(String booksName) { -// this.booksName = booksName; -// } - -// public String getPublication() { -// return publication; -// } - -// public void setPublication(String publication) { -// this.publication = publication; -// } - -// public String getAuther() { -// return auther; -// } - -// public void setAuther(String auther) { -// this.auther = auther; -// } -// // public String getStatus() { -// // return status; -// // } - -// // public void setStatus(String status) { -// // this.status = status; -// // } -// public String getBooksCopies() { -// return booksCopies; -// } - -// public void setBooksCopies(String bookscopies) { -// this.booksCopies = bookscopies; -// } - -// public String getBooksName(int booksId2) { -// return null; -// } - - - - - - - - - - - } diff --git a/BackEnd/Library/src/main/java/com/innovature/Library/service/BooksService.java b/BackEnd/Library/src/main/java/com/innovature/Library/service/BooksService.java index efba1b80..b4c22d31 100644 --- a/BackEnd/Library/src/main/java/com/innovature/Library/service/BooksService.java +++ b/BackEnd/Library/src/main/java/com/innovature/Library/service/BooksService.java @@ -16,10 +16,7 @@ public interface BooksService { BooksDetailView add(BooksForm form); - - // Collection listAll(); - - // BooksDetailView listAll(); + Collection listAll(); Collection listByCategory(Integer categoryId); diff --git a/BackEnd/Library/src/main/java/com/innovature/Library/service/UserService.java b/BackEnd/Library/src/main/java/com/innovature/Library/service/UserService.java index a17cef9d..ef0d4244 100644 --- a/BackEnd/Library/src/main/java/com/innovature/Library/service/UserService.java +++ b/BackEnd/Library/src/main/java/com/innovature/Library/service/UserService.java @@ -36,10 +36,6 @@ public interface UserService { LoginView refresh(String refreshToken) throws BadRequestException; - // Collection list(); - - // UserView edit(UserForm form); - UserView updates(Integer userId, UserForm form); void deletes(Integer userId); @@ -48,12 +44,10 @@ public interface UserService { Collection listAll(); - // Collection list(); - UserView edit(Integer userId, UserForm form); Collection viewProfile(Integer userId); - Page getAllUser(Integer pageNo, Integer pageSize, String sortBy,Integer direction); + Page getAllUser(Integer pageNo, Integer pageSize, String sortBy, Integer direction); } diff --git a/BackEnd/Library/src/main/java/com/innovature/Library/service/impl/BorrowServiceImpl.java b/BackEnd/Library/src/main/java/com/innovature/Library/service/impl/BorrowServiceImpl.java index 94297cc4..fd2daa22 100644 --- a/BackEnd/Library/src/main/java/com/innovature/Library/service/impl/BorrowServiceImpl.java +++ b/BackEnd/Library/src/main/java/com/innovature/Library/service/impl/BorrowServiceImpl.java @@ -159,10 +159,8 @@ public BorrowDetailView updatereject(Integer borrowId, BorrowForm form) { @Override @Transactional public BorrowDetailView updateReturn(Integer borrowId, BorrowForm form) { - Borrow borrow = borrowRepository.findByBorrowId(borrowId); Books books = booksRepository.findbyBorrowId(borrowId); - borrow.setBookReturnedDate(LocalDateTime.now()); borrow.setIssueDate(borrow.getIssueDate()); borrow.setReturnDate(borrow.getReturnDate()); diff --git a/BackEnd/Library/src/main/java/com/innovature/Library/service/impl/UserServiceImpl.java b/BackEnd/Library/src/main/java/com/innovature/Library/service/impl/UserServiceImpl.java index fd9ce1a8..c40ef327 100644 --- a/BackEnd/Library/src/main/java/com/innovature/Library/service/impl/UserServiceImpl.java +++ b/BackEnd/Library/src/main/java/com/innovature/Library/service/impl/UserServiceImpl.java @@ -9,7 +9,6 @@ import java.util.Collection; import javax.transaction.Transactional; -//import javax.validation.Valid; import org.springframework.data.domain.Page; import org.springframework.data.domain.PageRequest; import org.springframework.data.domain.Pageable; @@ -19,7 +18,6 @@ import org.springframework.security.crypto.password.PasswordEncoder; import org.springframework.stereotype.Service; import org.springframework.validation.Errors; - import com.innovature.Library.entity.User; import com.innovature.Library.exception.BadRequestException; import com.innovature.Library.exception.NotFoundException; @@ -30,8 +28,6 @@ import com.innovature.Library.security.util.InvalidTokenException; import com.innovature.Library.security.util.SecurityUtil; import com.innovature.Library.security.util.TokenExpiredException; - - import com.innovature.Library.security.util.TokenGenerator; import com.innovature.Library.security.util.TokenGenerator.Status; import com.innovature.Library.security.util.TokenGenerator.Token; diff --git a/BackEnd/Library/src/main/java/com/innovature/Library/view/BooksListView.java b/BackEnd/Library/src/main/java/com/innovature/Library/view/BooksListView.java index e482ffb4..03ec463b 100644 --- a/BackEnd/Library/src/main/java/com/innovature/Library/view/BooksListView.java +++ b/BackEnd/Library/src/main/java/com/innovature/Library/view/BooksListView.java @@ -1,19 +1,16 @@ package com.innovature.Library.view; - - import com.innovature.Library.entity.Category; - public class BooksListView { private final int booksId; private final String booksName; - private CategoryDetailView category; + private CategoryDetailView category; private final String publication; private final String auther; private final Integer booksCopies; private String image; - public BooksListView(int booksId, String booksName,Category category,String publication,String auther,Integer booksCopies) - { + public BooksListView(int booksId, String booksName, Category category, String publication, String auther, + Integer booksCopies) { this.booksId = booksId; this.booksName = booksName; @@ -21,22 +18,32 @@ public BooksListView(int booksId, String booksName,Category category,String publ this.publication = publication; this.auther = auther; - + this.image = image; this.booksCopies = booksCopies; } + // public BooksListView(int booksId, String booksName,Integer categoryId,String + // categoryName,String publication,String auther,String booksCopies) + // { + // this.booksId = booksId; + // this.booksName = booksName; + // this.category = new Category(categoryId,categoryName); + // this.publication = publication; + // this.auther = auther; + // // this.status = status; + // this.booksCopies = booksCopies; + // } - - public int getBooksId() { return booksId; } + public String getbooksName() { return booksName; } - - public CategoryDetailView getCategory() { + + public CategoryDetailView getCategory() { return category; } @@ -56,11 +63,8 @@ public String getCategoryName() { return this.category.getCategoryName(); } - public String getImage() { return image; } - - } diff --git a/FrontEnd/Library/src/app/acceptrequest/acceptrequest.component.html b/FrontEnd/Library/src/app/acceptrequest/acceptrequest.component.html index cfa4bded..3b1c6c66 100644 --- a/FrontEnd/Library/src/app/acceptrequest/acceptrequest.component.html +++ b/FrontEnd/Library/src/app/acceptrequest/acceptrequest.component.html @@ -1,14 +1,12 @@ - -
-

- +
- -
- Return Date + +
+
Return Date      
+ Return Date is required @@ -17,10 +15,11 @@
- -
- -
+ +


+ +
+
diff --git a/FrontEnd/Library/src/app/addbooks/addbooks.component.html b/FrontEnd/Library/src/app/addbooks/addbooks.component.html index 7a23c8ee..46d92c01 100644 --- a/FrontEnd/Library/src/app/addbooks/addbooks.component.html +++ b/FrontEnd/Library/src/app/addbooks/addbooks.component.html @@ -1,6 +1,41 @@ +@media only screen and (max-width: 620px) { + /* For mobile phones: */ + .right { + width: 87%; + + } + /* .form-control{ + top:15%; + } +*/ + .csvv{ + position: relative; + left: 8%; + top:65px; + } + + .centered{ + top: 18%; + left:45%; + } +.mat-dialog-container{ +margin-left: 20%; +} + +.form-control{ + width: 30vh; +} + + + +} + + +




+
diff --git a/FrontEnd/Library/src/app/addbooks/addbooks.component.ts b/FrontEnd/Library/src/app/addbooks/addbooks.component.ts index 52f54579..9e55c9e0 100644 --- a/FrontEnd/Library/src/app/addbooks/addbooks.component.ts +++ b/FrontEnd/Library/src/app/addbooks/addbooks.component.ts @@ -120,7 +120,10 @@ else{ } onTableDataChange(event:any) { - + + console.log("p-",this.pkey) + + if(this.pkey==null){ this.booksService.pagination1(this.page,this.tableSize,this.sort,this.direction).subscribe(result=>{ @@ -131,6 +134,12 @@ onTableDataChange(event:any) { }) } else{ + + + console.log("page=",event) + console.log("pkey in page=",this.pkey) + + this.booksService.search(this.pkey,this.page,this.tableSize,this.sort,this.direction).subscribe(result=>{ this.result=result.content; this.count=result.totalElements @@ -146,7 +155,10 @@ onTableDataChange(event:any) { const dialogConfig = new MatDialogConfig(); this.dialog.open(BooksComponent, { + + closeOnNavigation: true, + width:'55%',height:'auto' } diff --git a/FrontEnd/Library/src/app/app-routing.module.ts b/FrontEnd/Library/src/app/app-routing.module.ts index 2ac61beb..fc214f68 100644 --- a/FrontEnd/Library/src/app/app-routing.module.ts +++ b/FrontEnd/Library/src/app/app-routing.module.ts @@ -38,21 +38,21 @@ import { PageNotfoundComponent } from './page-notfound/page-notfound.component'; const routes: Routes = [ {path: '',redirectTo:'login',pathMatch:'full'}, - {path : 'login',component:LoginComponent}, + {path : 'login',component:LoginComponent,canActivate: [HomeguardGuard]}, {path: 'body',component:BodyComponent,canActivate: [HomeguardGuard]}, - {path: 'user-reg',component:UserRegComponent}, + {path: 'user-reg',component:UserRegComponent,canActivate: [HomeguardGuard]}, {path : 'category',component:CategoryComponent,canActivate: [HomeguardGuard]}, {path : 'books',component:BooksComponent,canActivate: [HomeguardGuard]}, {path : 'user-details',component:UserDetailsComponent,canActivate: [HomeguardGuard]}, {path : 'userbody',component:UserbodyComponent}, - {path : 'booksdisplay',component:BooksdisplayComponent}, + {path : 'booksdisplay',component:BooksdisplayComponent,canActivate: [HomeguardGuard]}, {path : 'borrow',component:BorrowComponent,canActivate: [HomeguardGuard]}, {path : 'acceptrequest',component:AcceptrequestComponent,canActivate: [HomeguardGuard]}, {path : 'rejectrequest',component:RejectrequestComponent,canActivate: [HomeguardGuard]}, - {path : 'borrowhistory',component:BorrowhistoryComponent}, + {path : 'borrowhistory',component:BorrowhistoryComponent,canActivate: [HomeguardGuard]}, {path : 'view-profile',component:ViewProfileComponent}, - {path : 'findby-category',component:FindbyCategoryComponent}, - {path : 'notification',component:NotificationComponent}, + {path : 'findby-category',component:FindbyCategoryComponent,canActivate: [HomeguardGuard]}, + {path : 'notification',component:NotificationComponent,canActivate: [HomeguardGuard]}, {path : 'bookreturn',component:BookreturnComponent}, {path : 'view-adminprofile',component:ViewAdminprofileComponent,canActivate: [HomeguardGuard]}, {path : 'imageupload',component:ImageuploadComponent,canActivate: [HomeguardGuard]}, diff --git a/FrontEnd/Library/src/app/books.service.ts b/FrontEnd/Library/src/app/books.service.ts index 8d19febb..537c492e 100644 --- a/FrontEnd/Library/src/app/books.service.ts +++ b/FrontEnd/Library/src/app/books.service.ts @@ -45,7 +45,6 @@ handleCsvError(err: HttpErrorResponse): any { return this.http.get(this.baseUrl+'/books/admin/pie') } - add(data:any):Observable{ return this.http.post(this.baseUrl+'/books',data) @@ -70,7 +69,6 @@ handleCsvError(err: HttpErrorResponse): any { } - pagination1(page:any,tableSize:any,sort:any,direction:any):Observable{ return this.http.get(this.baseUrl+"/books/admin/pagenated/?pageNo="+page+"&pageSize="+tableSize+"&sortBy="+sort+"&direction="+direction) diff --git a/FrontEnd/Library/src/app/books/books.component.html b/FrontEnd/Library/src/app/books/books.component.html index f967989b..4c3a1674 100644 --- a/FrontEnd/Library/src/app/books/books.component.html +++ b/FrontEnd/Library/src/app/books/books.component.html @@ -21,21 +21,15 @@ flex-wrap: wrap; flex-direction: row; } */ - - } - -

ADD BOOKS

EDIT BOOKS

- - @@ -76,7 +70,6 @@
- diff --git a/FrontEnd/Library/src/app/books/books.component.ts b/FrontEnd/Library/src/app/books/books.component.ts index d0801a09..553600a3 100644 --- a/FrontEnd/Library/src/app/books/books.component.ts +++ b/FrontEnd/Library/src/app/books/books.component.ts @@ -14,18 +14,11 @@ import { MatDialog } from '@angular/material/dialog'; styleUrls: ['./books.component.css'] }) export class BooksComponent implements OnInit { - - - - categoryList: any[]; categoryId:any; - - booksList: any[]; books: any; booksId: any; - categorydata:any; booksdata:any; catdata: any; 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..cb028afb 100644 --- a/FrontEnd/Library/src/app/booksdisplay/booksdisplay.component.html +++ b/FrontEnd/Library/src/app/booksdisplay/booksdisplay.component.html @@ -1,11 +1,10 @@ -

-

Books Details

+

Books Details

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

Books Details

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

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 e2cadc46..32f6faaf 100644 --- a/FrontEnd/Library/src/app/booksdisplay/booksdisplay.component.ts +++ b/FrontEnd/Library/src/app/booksdisplay/booksdisplay.component.ts @@ -11,139 +11,114 @@ import { CategoryService } from '../category.service'; styleUrls: ['./booksdisplay.component.css'] }) export class BooksdisplayComponent implements OnInit { - -//booksdata:any; -// categoryList: any[]; -categoryId:any; -// booksList: any[]; -books: any; -booksId: any; - -categorydata:any; -booksdata:any; -catdata: any; - -////////////// -data: any; -page:number=1; -count: any; -tableSize: number = 3; -ProdData: any; -sortedData: any; -a:any; -b:any; -searchResult:any -searchData:any -sort:string="auther"; -len: any; -result: any; + categoryId: any; + books: any; + booksId: any; + categorydata: any; + booksdata: any; + catdata: any; + data: any; + page: number = 1; + count: any; + tableSize: number = 3; + ProdData: any; + sortedData: any; + a: any; + b: any; + searchResult: any + searchData: any + sort: string = "auther"; + len: any; + result: any; booksCount: any; - direction=-1; + direction = -1; + constructor(private router: Router, private booksservice: BooksService, private service: CategoryService, private borrowservice: BorrowService, private toast: NgToastService) { - - constructor(private router:Router ,private booksservice:BooksService,private service:CategoryService,private borrowservice:BorrowService,private toast:NgToastService) { - // this.booksList=[]; - // this.categoryList=[]; - } + } ngOnInit(): void { - - -this.LoadData(); -this.borrowBlock(); - - - + this.LoadData(); + this.borrowBlock(); } - LoadData(){ - this.booksservice.paginationForUser(this.page,this.tableSize,this.sort,this.direction).subscribe(result=>{ - this.result=result.content; - this.count=result.totalElements - console.log("loaded books=",this.result); - this.data=this.result; - }); + LoadData() { + this.booksservice.paginationForUser(this.page, this.tableSize, this.sort, this.direction).subscribe(result => { + this.result = result.content; + this.count = result.totalElements + console.log("loaded books=", this.result); + this.data = this.result; + }); } - - borrowBlock(){ -this.borrowservice.borrowBlock().subscribe({ - next:(res)=>{ - this.booksCount=res; - // console.log("blk"); - console.log("block rslt=",res); - }}) -} - -borrowStockEmpty(){ - -} - -sortfn(a:any){ - this.sort=a; - this.page=this.page; - this.tableSize; - - if(this.direction==1){ - this.direction=-1; - console.log("from desc to :",this.direction) - this.ngOnInit(); + borrowBlock() { + this.borrowservice.borrowBlock().subscribe({ + next: (res) => { + this.booksCount = res; + console.log("block rslt=", res); + } + }) } - else{ - this.direction=1; - console.log("from asc to desc",this.direction) - this.ngOnInit(); + borrowStockEmpty() { } - -} - + sortfn(a: any) { + this.sort = a; + this.page = this.page; + this.tableSize; + + if (this.direction == 1) { + this.direction = -1; + console.log("from desc to :", this.direction) + this.ngOnInit(); + } + else { + this.direction = 1; + console.log("from asc to desc", this.direction) + this.ngOnInit(); + } -onTableDataChange(event:any) { - - console.log("page no=",event) - this.booksservice.paginationForUser(this.page,this.tableSize,this.sort,this.direction).subscribe(result=>{ - this.result=result.content; - this.count=result.totalElements - console.log("loaded books=",this.result); - this.data=this.result; - }) } + onTableDataChange(event: any) { + console.log("page no=", event) + this.booksservice.paginationForUser(this.page, this.tableSize, this.sort, this.direction).subscribe(result => { + this.result = result.content; + this.count = result.totalElements + console.log("loaded books=", this.result); + this.data = this.result; + }) + } - requestBook(booksId: any) { - console.log(booksId) - if(booksId.booksCopies==0){ - alert("Sorry, This book is out of stock") - this.router.navigate(['/booksdisplay']) + requestBook(booksId: any) { + console.log(booksId) + if (booksId.booksCopies == 0) { + alert("Sorry, This book is out of stock") + this.router.navigate(['/booksdisplay']) + } + else { + if (this.booksCount >= 3) { + alert("you cannot request any book, please return the current in hand books, thank you") + } + else { + let data = booksId + this.borrowservice.add(data).subscribe({ + next: (res) => { + this.booksId = res.booksId; + console.log(res); + this.toast.info({ summary: 'Booking Successfull', duration: 5000 }); + this.router.navigate(['/borrowhistory']) + }, + error: (msg) => { } + }) } - else{ - if(this.booksCount>=3){ - alert("you cannot request any book, please return the current in hand books, thank you") - } - else{ - let data=booksId - this.borrowservice.add(data).subscribe({ - next:(res)=>{ - this.booksId=res.booksId; - console.log(res); - - // alert("Book request successfull") - this.toast.info({summary:'Booking Successfull',duration:5000}); - this.router.navigate(['/borrowhistory']) - }, - error:(msg)=>{} - }) - }} } + } - - home() - { - this.router.navigate(['/userbody']) - } + home() { + this.router.navigate(['/userbody']) + } } diff --git a/FrontEnd/Library/src/app/borrow.service.ts b/FrontEnd/Library/src/app/borrow.service.ts index 51f07669..f1df94e7 100644 --- a/FrontEnd/Library/src/app/borrow.service.ts +++ b/FrontEnd/Library/src/app/borrow.service.ts @@ -18,10 +18,19 @@ export class BorrowService { return _window(); } - - baseUrl=environment.apiUrl; + apiurl='http://localhost:8080'; + accesstocken:any constructor(private http:HttpClient,private router:Router) { } - + +handleError(err: HttpErrorResponse): any { + console.log('hhhii'); + if ( err.status === 403) { + alert("UNAUTHORIZED ACCESS DETECTED") + sessionStorage.clear() + localStorage.clear() + this.router.navigateByUrl(`/login`); } +} + export(): Observable { return this.http.get(this.baseUrl+'/borrow/admin/export', { responseType: 'blob' }); @@ -41,8 +50,6 @@ export class BorrowService { return this.http.post(this.baseUrl+'/borrow',data) } - - borrowHistoryPagination(page:any,tableSize:any,sort:any){ return this.http.get(this.baseUrl+"/borrow/userBorrow/pagenated/?pageNo="+page+"&pageSize="+tableSize+"&sortBy="+sort) @@ -75,8 +82,10 @@ export class BorrowService { } //user LoadByIssueDateUser(date1:any,date2:any){ - return this.http.get(this.baseUrl+"/borrow/user/loadByIssueDateUser/"+date1+"/"+date2); - } + + return this.http.get(this.apiurl + "/borrow/user/loadByIssueDateUser/"+date1+"/"+date2); + } + Load(){ return this.http.get(this.baseUrl+'/borrow') @@ -100,9 +109,10 @@ export class BorrowService { return this.http.get(this.baseUrl+'/borrow/admin/fine') } - //user + LoadDueByUser(){ - return this.http.get(this.baseUrl+'/borrow/user/dueByUser') + + return this.http.get('http://localhost:8080/borrow/user/dueByUser').pipe((catchError(err => this.handleError(err)))); } @@ -117,20 +127,19 @@ export class BorrowService { } LoadUserNotification(){ - return this.http.get(this.baseUrl+'/borrow/user/UserNotification') + return this.http.get('http://localhost:8080/borrow/user/UserNotification').pipe((catchError(err => this.handleError(err)))); } - + + getBorrowID(borrowId:any){ return this.http.get(this.baseUrl+'/borrow'+borrowId); } - payment(id: any) { return this.http.put(this.baseUrl+ "/borrow/user/paymentStatus/" + id,{headers:Headers}); } - delete(booksId:any):Observable{ let tocken=localStorage.getItem('accesstoken') let head_obj=new HttpHeaders({"Authorization":"library " + tocken}) @@ -138,7 +147,6 @@ export class BorrowService { } - update(id: any, data: any) { return this.http.put(this.baseUrl + "/borrow/admin/accept/" + localStorage.getItem('borrowId'), data) @@ -160,8 +168,6 @@ export class BorrowService { } - - edit(booksId:any): Observable{ let tocken=localStorage.getItem('accesstoken') let head_obj=new HttpHeaders({"Authorization":"library " + tocken}) diff --git a/FrontEnd/Library/src/app/borrow/borrow.component.ts b/FrontEnd/Library/src/app/borrow/borrow.component.ts index 8920e30a..c5b3481a 100644 --- a/FrontEnd/Library/src/app/borrow/borrow.component.ts +++ b/FrontEnd/Library/src/app/borrow/borrow.component.ts @@ -40,7 +40,7 @@ export class BorrowComponent implements OnInit { private datePipe:DatePipe, private service:BorrowService, private toast : NgToastService) { - + this.date=new Date(); } 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

- - - { - this.result=response.content; - this.count=response.totalElements - console.log(this.result); - this.data=this.result; - }); + else if (this.filter.controls['status'].value == 2) { + + this.service.statusfilterBor(this.page, this.tableSize, this.sort, this.direction, 2).subscribe(response => { + this.result = response.content; + this.count = response.totalElements + console.log(this.result); + this.data = this.result; + }); } - else if(this.filter.controls['status'].value==3){ + else if (this.filter.controls['status'].value == 3) { - this.service.statusfilterBor(this.page,this.tableSize,this.sort,this.direction,3).subscribe(response=>{ - this.result=response.content; - this.count=response.totalElements - console.log(this.result); - this.data=this.result; - }); + this.service.statusfilterBor(this.page, this.tableSize, this.sort, this.direction, 3).subscribe(response => { + this.result = response.content; + this.count = response.totalElements + console.log(this.result); + this.data = this.result; + }); } - else if(this.filter.controls['status'].value==4){ + else if (this.filter.controls['status'].value == 4) { - this.service.statusfilterBor(this.page,this.tableSize,this.sort,this.direction,4).subscribe(response=>{ - this.result=response.content; - this.count=response.totalElements - console.log(this.result); - this.data=this.result; - }); + this.service.statusfilterBor(this.page, this.tableSize, this.sort, this.direction, 4).subscribe(response => { + this.result = response.content; + this.count = response.totalElements + console.log(this.result); + this.data = this.result; + }); } - else{ - + else { + } - + } ngOnInit(): void { @@ -103,7 +97,6 @@ export class BorrowhistoryComponent implements OnInit { //this.data=result; }) - //this.onTableDataChange(this.page); if (this.searchData == null || this.searchData == "") { this.service.borrowHistoryPagination(this.page, this.tableSize, this.sort).subscribe((result => { @@ -137,11 +130,11 @@ export class BorrowhistoryComponent implements OnInit { } ) - filter:FormGroup = new FormGroup({ - status:new FormControl('',[Validators.required]) - - }) - + filter: FormGroup = new FormGroup({ + status: new FormControl('', [Validators.required]) + + }) + // sortData(sort: Sort) { // const data1 = this.data.slice(); @@ -192,23 +185,23 @@ export class BorrowhistoryComponent implements OnInit { this.len = result; console.log(result) this.count = this.len.length; - console.log('1111',this.sort); + console.log('1111', this.sort); }) - - 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('filter',res); - console.log(this.ObjSampleForm.controls['date1'].value); - this.data = res; - }, - }); + + 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('filter', res); + console.log(this.ObjSampleForm.controls['date1'].value); + this.data = res; + }, + }); } - display(){ -console.log('display works') + display() { + console.log('display works') } - + clearFilter() { this.flag = 0; window.location.reload(); diff --git a/FrontEnd/Library/src/app/category.service.ts b/FrontEnd/Library/src/app/category.service.ts index 31bdfacd..5c71ba1d 100644 --- a/FrontEnd/Library/src/app/category.service.ts +++ b/FrontEnd/Library/src/app/category.service.ts @@ -16,6 +16,16 @@ export class CategoryService { constructor(private http:HttpClient,private router:Router) { } + handleError(err: HttpErrorResponse): any { + console.log('hhhii'); + if ( err.status === 403) { + alert("UNAUTHORIZED ACCESS DETECTED") + sessionStorage.clear() + localStorage.clear() + this.router.navigateByUrl(`/login`); } + } + + addCategory(data:any):Observable{ diff --git a/FrontEnd/Library/src/app/findby-category/findby-category.component.css b/FrontEnd/Library/src/app/findby-category/findby-category.component.css index 6103feba..aea931c0 100644 --- a/FrontEnd/Library/src/app/findby-category/findby-category.component.css +++ b/FrontEnd/Library/src/app/findby-category/findby-category.component.css @@ -54,15 +54,15 @@ p{ border: 1px solid; } th { - background-color: #232524; - color: white; + background-color: white; + color:black; width: 15%; text-align: center; border: none; } td { - background-color: #a7bdb08f; - color: rgb(0, 0, 0); + background-color: white; + color: black; width: 15%; text-align: center; margin-top: auto; @@ -80,3 +80,7 @@ th { color: rgb(255, 255, 255); border-radius: 3px; } +.btnn2{ + background-color: black; + color: white; +} \ No newline at end of file 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 33a8b33b..e0c33c7f 100644 --- a/FrontEnd/Library/src/app/findby-category/findby-category.component.html +++ b/FrontEnd/Library/src/app/findby-category/findby-category.component.html @@ -1,60 +1,77 @@ + + + + + +
+
+ +

- - -
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..e8560cc1 100644 --- a/FrontEnd/Library/src/app/findby-category/findby-category.component.ts +++ b/FrontEnd/Library/src/app/findby-category/findby-category.component.ts @@ -13,76 +13,60 @@ 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=[];} - ngOnInit(): void { + constructor(private router: Router, private booksService: BooksService, private service: CategoryService, private borrowservice: BorrowService) { + this.booksList = []; + this.categoryList = []; + } - - this.service.LoadCategoryForUser().subscribe((data: any)=>{ - this.catdata=data; - console.log(this.catdata) + ngOnInit(): void { + this.service.LoadCategoryForUser().subscribe((data: any) => { + this.catdata = data; + console.log(this.catdata) }); + } - - } - - - home() - { + home() { this.router.navigate(['/userbody']) } + disp() { + 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 + } - 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; - }); - } - - - - - 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)=>{} - }) - } - - // LoadbyCategory() { - // this.booksService.LoadbyCategory().subscribe((data: any)=>{ - // console.log(data) - // this.booksdata=data; - // }); } - + }, + error: (msg) => { } + }) + } } diff --git a/FrontEnd/Library/src/app/fine/fine.component.html b/FrontEnd/Library/src/app/fine/fine.component.html index 77f65c81..b9486537 100644 --- a/FrontEnd/Library/src/app/fine/fine.component.html +++ b/FrontEnd/Library/src/app/fine/fine.component.html @@ -10,38 +10,10 @@ box-sizing: border-box; } - /* .menu { - float: left; - width: 20%; - text-align: center; - } - - .menu a { - background-color: #e5e5e5; - padding: 8px; - margin-top: 7px; - display: block; - width: 100%; - color: black; - } - .main { - float: left; - width: 60%; - padding: 0 20px; - } - - .right { - background-color: #e5e5e5; - float: left; - width: 20%; - padding: 15px; - margin-top: 7px; - text-align: center; - } */ @media only screen and (max-width: 620px) { - /* For mobile phones: */ + .menu, .main, .right { width: 100%; } diff --git a/FrontEnd/Library/src/app/forgotpassword/forgotpassword.component.ts b/FrontEnd/Library/src/app/forgotpassword/forgotpassword.component.ts index 50e4c93f..f32b205d 100644 --- a/FrontEnd/Library/src/app/forgotpassword/forgotpassword.component.ts +++ b/FrontEnd/Library/src/app/forgotpassword/forgotpassword.component.ts @@ -27,14 +27,14 @@ export class ForgotpasswordComponent implements OnInit { email:new FormControl() }) email: any; - - - constructor( private emails:EmailService, private toast:NgToastService, private router:Router) { } ngOnInit(): void { + + console.log('rslt=',this.rslt) + this.ObjForgetForm.reset() this.spin=0; @@ -47,8 +47,7 @@ export class ForgotpasswordComponent implements OnInit { this.rslt=0; this.val=0; }, 3000); - - + } } @@ -58,9 +57,6 @@ export class ForgotpasswordComponent implements OnInit { this.router.navigate(['/login']) } - - - //verify otp SaveData() { @@ -95,10 +91,8 @@ export class ForgotpasswordComponent implements OnInit { } - } - //send otp openPopup() { 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.html b/FrontEnd/Library/src/app/login/login.component.html index 32b28486..396cf4af 100644 --- a/FrontEnd/Library/src/app/login/login.component.html +++ b/FrontEnd/Library/src/app/login/login.component.html @@ -4,7 +4,6 @@
Library

-