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 519d9926..d8491b98 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 @@ -3,11 +3,15 @@ import java.io.IOException; //import java.security.Principal; 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; import org.springframework.http.HttpEntity; +import org.springframework.http.ResponseEntity; import org.springframework.util.StringUtils; import org.springframework.web.bind.annotation.DeleteMapping; import org.springframework.web.bind.annotation.GetMapping; @@ -21,6 +25,7 @@ import org.springframework.web.multipart.MultipartFile; import com.innovature.Library.entity.Books; +import com.innovature.Library.entity.Borrow; //import com.innovature.Library.entity.Category; import com.innovature.Library.form.BooksForm; import com.innovature.Library.repository.BooksRepository; @@ -85,6 +90,21 @@ public BooksDetailView update( + @GetMapping("/pagenated/") + public ResponseEntity>getAllBooks( + @RequestParam(defaultValue = "0") Integer pageNo, + @RequestParam(defaultValue = "10") Integer pageSize, + @RequestParam(defaultValue = "id") String sortBy) + { + List list = service.getAllBooks(pageNo, pageSize, sortBy); + return new ResponseEntity>(list,new HttpHeaders(), + HttpStatus.OK); + + } + + + + 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 722ba0df..c04bdd00 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 @@ -40,7 +40,7 @@ public class BorrowController { - +//borrow list @admin @GetMapping("/pagenated/") public ResponseEntity>getAllBorrow( @RequestParam(defaultValue = "0") Integer pageNo, @@ -53,6 +53,19 @@ public class BorrowController { } + @GetMapping("/user/pagenated/") + public ResponseEntity>getBorrowHistory( + @RequestParam(defaultValue = "0") Integer pageNo, + @RequestParam(defaultValue = "10") Integer pageSize, + @RequestParam(defaultValue = "id") String sortBy) + { + List list = bService.getBorrowHistory(pageNo, pageSize, sortBy); + return new ResponseEntity>(list,new HttpHeaders(), + HttpStatus.OK); + + } + + @@ -66,11 +79,12 @@ public class BorrowController { public BorrowDetailView add(@Valid @RequestBody BorrowForm form) { return bService.add(form); } - +//borrow history @user @GetMapping("/list/user") public Collection list1(Principal p) { return bService.list1(); } + @GetMapping("/user/notification") public Collection listNotification(Principal p) { return bService.listNotification(); @@ -90,6 +104,12 @@ public Collection listDue() { return bService.listDue(); } + + @GetMapping("/fine") + public Collection listfine() { + return bService.fine(); + } + @GetMapping("/dueByUser") public Collection listDueByUser() { return bService.listDueByUser(); diff --git a/BackEnd/Library/src/main/java/com/innovature/Library/repository/BooksRepository.java b/BackEnd/Library/src/main/java/com/innovature/Library/repository/BooksRepository.java index 79ae888c..d308d783 100644 --- a/BackEnd/Library/src/main/java/com/innovature/Library/repository/BooksRepository.java +++ b/BackEnd/Library/src/main/java/com/innovature/Library/repository/BooksRepository.java @@ -3,6 +3,8 @@ import org.springframework.data.jpa.repository.Query; import org.springframework.data.repository.Repository; import com.innovature.Library.entity.Books; +import org.springframework.data.domain.Page; +import org.springframework.data.domain.Pageable; public interface BooksRepository extends Repository { @@ -25,5 +27,8 @@ public interface BooksRepository extends Repository { @Query(value = "select * from books where books_id in(select books_id from books where category_id=?1)",nativeQuery = true) Collection findbyCategoryId(Integer categoryId); + + public Page findAll(Pageable paging); + } diff --git a/BackEnd/Library/src/main/java/com/innovature/Library/repository/BorrowRepository.java b/BackEnd/Library/src/main/java/com/innovature/Library/repository/BorrowRepository.java index 4d125440..28cd6bc6 100644 --- a/BackEnd/Library/src/main/java/com/innovature/Library/repository/BorrowRepository.java +++ b/BackEnd/Library/src/main/java/com/innovature/Library/repository/BorrowRepository.java @@ -22,7 +22,10 @@ public interface BorrowRepository extends PagingAndSortingRepository findAllByUserUserId(Integer userId); + + public Page findAll(Pageable paging); + public Page findAllByUserUserId(Integer userId,Pageable paging); // public Page findAll(org.springframework.data.domain.Pageable paging); @@ -39,13 +42,13 @@ public interface BorrowRepository extends PagingAndSortingRepository findbyBorrowIdandStatus(); - // @Query(value = "select * from borrow where borrow_id in(select borrow_id from borrow where due_date findbyBorrowIdandStat(); + @Query(value = "select * from borrow where borrow_id in(select borrow_id from borrow where due_date findbyBorrowIdandDueDateandStatus(); @@ -66,7 +69,10 @@ public interface BorrowRepository extends PagingAndSortingRepository borrow); - + + //total sum of fine /user + // @Query(value=" select sum(fine) from borrow where user_id=?",nativeQuery=true) + // void findFineByUserId(Integer userId); } 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 b0764152..19a9c141 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 @@ -2,6 +2,8 @@ import java.io.IOException; import java.util.Collection; +import java.util.List; + import org.springframework.http.HttpEntity; import org.springframework.web.multipart.MultipartFile; import org.springframework.web.servlet.view.RedirectView; @@ -31,6 +33,8 @@ public interface BooksService { RedirectView uploadImage(MultipartFile multipartFile) throws IOException; + List getAllBooks(Integer pageNo, Integer pageSize, String sortBy); + } diff --git a/BackEnd/Library/src/main/java/com/innovature/Library/service/BorrowService.java b/BackEnd/Library/src/main/java/com/innovature/Library/service/BorrowService.java index 1c64f3aa..216756b1 100644 --- a/BackEnd/Library/src/main/java/com/innovature/Library/service/BorrowService.java +++ b/BackEnd/Library/src/main/java/com/innovature/Library/service/BorrowService.java @@ -30,6 +30,7 @@ public interface BorrowService { BorrowDetailView updatereject(Integer borrowId,BorrowForm form); List getAllBorrow(Integer pageNo, Integer pageSize, String sortBy); + List getBorrowHistory(Integer pageNo, Integer pageSize, String sortBy); BorrowDetailView updateReturn(Integer borrowId, BorrowForm form); @@ -45,6 +46,8 @@ public interface BorrowService { void fineGeneration(); + Collection fine(); + diff --git a/BackEnd/Library/src/main/java/com/innovature/Library/service/impl/BooksServiceImpl.java b/BackEnd/Library/src/main/java/com/innovature/Library/service/impl/BooksServiceImpl.java index cdaffcba..5aeef40f 100644 --- a/BackEnd/Library/src/main/java/com/innovature/Library/service/impl/BooksServiceImpl.java +++ b/BackEnd/Library/src/main/java/com/innovature/Library/service/impl/BooksServiceImpl.java @@ -1,8 +1,11 @@ package com.innovature.Library.service.impl; import java.io.IOException; +import java.util.ArrayList; // import java.net.http.HttpHeaders; import java.util.Collection; +import java.util.List; + //import java.util.ArrayList; import javax.transaction.Transactional; //import java.util.Collection; @@ -15,6 +18,12 @@ import org.springframework.web.multipart.MultipartFile; import org.springframework.web.servlet.view.RedirectView; + +import org.springframework.data.domain.Page; +import org.springframework.data.domain.PageRequest; +import org.springframework.data.domain.Pageable; +import org.springframework.data.domain.Sort; + import com.innovature.Library.entity.Books; import com.innovature.Library.entity.Category; import com.innovature.Library.exception.NotFoundException; @@ -107,6 +116,22 @@ public RedirectView uploadImage(MultipartFile multipartFile) throws IOException return null; } + + + public ListgetAllBooks(Integer pageNo, Integer pageSize, String sortBy){ + + Pageable paging = PageRequest.of(pageNo, pageSize, Sort.by(sortBy)); + + Page pagedResult = booksRepository.findAll(paging); + + if(pagedResult.hasContent()){ + return pagedResult.getContent(); + } else { + return new ArrayList(); + } + } + + } 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 5c1f468c..1c3a95cd 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 @@ -76,12 +76,22 @@ public Collection listAll() { } + @Override + public Collection listDue() { + return borrowRepository.findbyBorrowIdandStatus(); + } + @Override public Collection listDueByUser() { return borrowRepository.findbyUserIdandStatus(SecurityUtil.getCurrentUserId()); } + @Override + public Collection fine() { + return borrowRepository.findbyBorrowIdandDueDateandStatus(); + } + @Override @@ -91,9 +101,6 @@ public BorrowDetailView list(Integer borrowId){ } - - - @Override public Collection list1() { return borrowRepository.findAllByUserUserId(SecurityUtil.getCurrentUserId()); @@ -200,7 +207,7 @@ public BorrowDetailView listByUser(Integer borrowId, BorrowForm form) { - +///pagenation and sort/// public ListgetAllBorrow(Integer pageNo, Integer pageSize, String sortBy){ @@ -216,10 +223,26 @@ public BorrowDetailView listByUser(Integer borrowId, BorrowForm form) { } - @Override - public Collection listDue() { - return borrowRepository.findbyBorrowIdandStatus(); + public ListgetBorrowHistory(Integer pageNo, Integer pageSize, String sortBy){ + + Pageable paging = PageRequest.of(pageNo, pageSize, Sort.by(sortBy)); + + Page pagedResult = borrowRepository.findAllByUserUserId(SecurityUtil.getCurrentUserId(),paging); + + if(pagedResult.hasContent()){ + return pagedResult.getContent(); + } else { + return new ArrayList(); + } } + + // @Override + // public Collection list1() { + // return borrowRepository.findAllByUserUserId(SecurityUtil.getCurrentUserId()); + // } + + + //mail// // @Override // @Transactional @@ -275,7 +298,7 @@ public void sendMail(Integer userId, String subject, String text) { @Override @Transactional // @Scheduled(cron="* */1 * * * * ") - @Scheduled(cron="0 0 12 * * ?") + @Scheduled(cron="0 0 9 * * ?") public void fineGeneration() { System.out.println("reachllllllllllllll"); @@ -290,8 +313,7 @@ public void fineGeneration() { due=due/86400000; //time conversion to date bor.setDueDays(due); - bor.setFine(due*5); - + bor.setFine(due*5); } } diff --git a/BackEnd/Library/src/main/java/com/innovature/Library/util/FileUtil.java b/BackEnd/Library/src/main/java/com/innovature/Library/util/FileUtil.java index 4cfcb13c..48a5fd8a 100644 --- a/BackEnd/Library/src/main/java/com/innovature/Library/util/FileUtil.java +++ b/BackEnd/Library/src/main/java/com/innovature/Library/util/FileUtil.java @@ -16,7 +16,7 @@ public class FileUtil { - public static final String PATH = "/home/negilbabu/Desktop/project/LibraryRepository/FrondEnd/iprjt-07-11/iprjt/src/assets/BooksImage/"; + public static final String PATH = "/home/negilbabu/Desktop/project/LibraryRepository/FrontEnd/iprjt/src/assets/BooksImage/"; //public static final String PATH = "/home/arun/Library@dec9@12PM/Library/iprjt-07-11/iprjt/src/assets/BooksImage/"; public static final String PROFILE_PIC_DIR = "item_pics/"; diff --git a/FrontEnd/iprjt/package-lock.json b/FrontEnd/iprjt/package-lock.json index c417d906..89afb2d5 100644 --- a/FrontEnd/iprjt/package-lock.json +++ b/FrontEnd/iprjt/package-lock.json @@ -20,9 +20,10 @@ "@angular/router": "^14.2.0", "@ng-bootstrap/ng-bootstrap": "^13.0.0", "@popperjs/core": "^2.10.2", - "bootstrap": "^5.2.0", + "bootstrap": "^5.2.3", "material-icons": "^1.13.1", "ng-angular-popup": "^0.2.0", + "ngx-pagination": "^6.0.3", "rxjs": "~7.5.0", "tslib": "^2.3.0", "zone.js": "~0.11.4" @@ -8028,6 +8029,18 @@ "@angular/core": "^14.2.1" } }, + "node_modules/ngx-pagination": { + "version": "6.0.3", + "resolved": "https://registry.npmjs.org/ngx-pagination/-/ngx-pagination-6.0.3.tgz", + "integrity": "sha512-lONjTQ7hFPh1SyhwDrRd5ZwM4NMGQ7bNR6vLrs6mrU0Z8Q1zCcWbf/pvyp4DOlGyd9uyZxRy2wUsSZLeIPjbAw==", + "dependencies": { + "tslib": "^2.3.0" + }, + "peerDependencies": { + "@angular/common": ">=13.0.0", + "@angular/core": ">=13.0.0" + } + }, "node_modules/nice-napi": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/nice-napi/-/nice-napi-1.0.2.tgz", @@ -17662,6 +17675,14 @@ "tslib": "^2.3.0" } }, + "ngx-pagination": { + "version": "6.0.3", + "resolved": "https://registry.npmjs.org/ngx-pagination/-/ngx-pagination-6.0.3.tgz", + "integrity": "sha512-lONjTQ7hFPh1SyhwDrRd5ZwM4NMGQ7bNR6vLrs6mrU0Z8Q1zCcWbf/pvyp4DOlGyd9uyZxRy2wUsSZLeIPjbAw==", + "requires": { + "tslib": "^2.3.0" + } + }, "nice-napi": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/nice-napi/-/nice-napi-1.0.2.tgz", diff --git a/FrontEnd/iprjt/package.json b/FrontEnd/iprjt/package.json index 2a9bb781..d52a1850 100644 --- a/FrontEnd/iprjt/package.json +++ b/FrontEnd/iprjt/package.json @@ -22,9 +22,10 @@ "@angular/router": "^14.2.0", "@ng-bootstrap/ng-bootstrap": "^13.0.0", "@popperjs/core": "^2.10.2", - "bootstrap": "^5.2.0", + "bootstrap": "^5.2.3", "material-icons": "^1.13.1", "ng-angular-popup": "^0.2.0", + "ngx-pagination": "^6.0.3", "rxjs": "~7.5.0", "tslib": "^2.3.0", "zone.js": "~0.11.4" @@ -43,4 +44,4 @@ "karma-jasmine-html-reporter": "~2.0.0", "typescript": "~4.7.2" } -} \ No newline at end of file +} diff --git a/FrontEnd/iprjt/src/app/app-routing.module.ts b/FrontEnd/iprjt/src/app/app-routing.module.ts index f69b813d..d71c9b23 100644 --- a/FrontEnd/iprjt/src/app/app-routing.module.ts +++ b/FrontEnd/iprjt/src/app/app-routing.module.ts @@ -20,6 +20,7 @@ import { NotificationComponent } from './notification/notification.component'; import { BookreturnComponent } from './bookreturn/bookreturn.component'; import { ViewAdminprofileComponent } from './view-adminprofile/view-adminprofile.component'; import { ImageuploadComponent } from './imageupload/imageupload.component'; +import { FineComponent } from './fine/fine.component'; const routes: Routes = [ @@ -41,8 +42,8 @@ const routes: Routes = [ {path : 'notification',component:NotificationComponent}, {path : 'bookreturn',component:BookreturnComponent}, {path : 'view-adminprofile',component:ViewAdminprofileComponent}, - {path : 'imageupload',component:ImageuploadComponent} - + {path : 'imageupload',component:ImageuploadComponent}, + {path : 'fine',component:FineComponent} ]; diff --git a/FrontEnd/iprjt/src/app/app.module.ts b/FrontEnd/iprjt/src/app/app.module.ts index fb2bc8ed..d56c0569 100644 --- a/FrontEnd/iprjt/src/app/app.module.ts +++ b/FrontEnd/iprjt/src/app/app.module.ts @@ -36,6 +36,8 @@ import { ViewAdminprofileComponent } from './view-adminprofile/view-adminprofile import {MatIconModule} from '@angular/material/icon'; import { ImageuploadComponent } from './imageupload/imageupload.component'; import { NgbModule } from '@ng-bootstrap/ng-bootstrap'; +import { FineComponent } from './fine/fine.component'; +import { NgxPaginationModule } from 'ngx-pagination'; // import {MatIconModule} from '@angular/material/icon'; // import { MatToolbarModule } from '@angular/material'; @@ -65,6 +67,7 @@ import { NgbModule } from '@ng-bootstrap/ng-bootstrap'; BookreturnComponent, ViewAdminprofileComponent, ImageuploadComponent, + FineComponent, ], @@ -77,6 +80,7 @@ import { NgbModule } from '@ng-bootstrap/ng-bootstrap'; NgToastModule, MatIconModule, NgbModule, + NgxPaginationModule ///MatIconModule, // MatToolbarModule, // MatTooltipModule, diff --git a/FrontEnd/iprjt/src/app/body/body.component.html b/FrontEnd/iprjt/src/app/body/body.component.html index 45585293..e3423375 100644 --- a/FrontEnd/iprjt/src/app/body/body.component.html +++ b/FrontEnd/iprjt/src/app/body/body.component.html @@ -1,4 +1,5 @@


+ diff --git a/FrontEnd/iprjt/src/app/body/body.component.ts b/FrontEnd/iprjt/src/app/body/body.component.ts index ac72060d..59fd1f93 100644 --- a/FrontEnd/iprjt/src/app/body/body.component.ts +++ b/FrontEnd/iprjt/src/app/body/body.component.ts @@ -29,6 +29,11 @@ export class BodyComponent implements OnInit { } + onClickDue() + { + this.router.navigate(['/fine']) + } + onClickCategory() { this.router.navigate(['/category']) diff --git a/FrontEnd/iprjt/src/app/booksdisplay/booksdisplay.component.ts b/FrontEnd/iprjt/src/app/booksdisplay/booksdisplay.component.ts index 315f6933..52bcf449 100644 --- a/FrontEnd/iprjt/src/app/booksdisplay/booksdisplay.component.ts +++ b/FrontEnd/iprjt/src/app/booksdisplay/booksdisplay.component.ts @@ -42,7 +42,6 @@ catdata: any; }); } - requestBook(booksId: any) { console.log(booksId) if(booksId.booksCopies==0){ diff --git a/FrontEnd/iprjt/src/app/borrow.service.ts b/FrontEnd/iprjt/src/app/borrow.service.ts index 23557ecd..0eb5c965 100644 --- a/FrontEnd/iprjt/src/app/borrow.service.ts +++ b/FrontEnd/iprjt/src/app/borrow.service.ts @@ -7,9 +7,7 @@ import { Observable } from 'rxjs'; }) export class BorrowService { - // update(id: any, data: any) { - // return this.http.put(this.apiurl + "/borrow/" + sessionStorage.getItem('borrowId'), data); - // } + apiurl='http://localhost:8080'; @@ -32,6 +30,9 @@ export class BorrowService { LoadDue(){ return this.http.get('http://localhost:8080/borrow/due'); } + LoadFine(){ + return this.http.get('http://localhost:8080/borrow/fine'); + } LoadDueByUser(){ return this.http.get('http://localhost:8080/borrow/dueByUser'); } diff --git a/FrontEnd/iprjt/src/app/borrow/borrow.component.css b/FrontEnd/iprjt/src/app/borrow/borrow.component.css index 34b53d69..a6998674 100644 --- a/FrontEnd/iprjt/src/app/borrow/borrow.component.css +++ b/FrontEnd/iprjt/src/app/borrow/borrow.component.css @@ -83,15 +83,19 @@ p{ th { background-color: #232524; color: white; - width: 15%; + width: 10%; text-align: center; + margin-left: 5px; + margin-right: 5px; } td { background-color: #a7bdb08f; color: rgb(0, 0, 0); - width: 15%; + width: 10%; text-align: center; margin-top: auto; + margin-left: 5px; + margin-right: 5px; padding: auto; } diff --git a/FrontEnd/iprjt/src/app/borrow/borrow.component.html b/FrontEnd/iprjt/src/app/borrow/borrow.component.html index bf51a003..98abf1af 100644 --- a/FrontEnd/iprjt/src/app/borrow/borrow.component.html +++ b/FrontEnd/iprjt/src/app/borrow/borrow.component.html @@ -22,14 +22,16 @@

Borrow Details

Issue Date Return Date Due Date + DueDays + Fine(INR) Returned Date Status Reason Action - - + + + + + {{ post.user.firstName }} + + + {{post.books.booksName}} + {{post.issueDate| date:'dd/MM/yyyy'}} + {{post.returnDate| date:'dd/MM/yyyy'}} + {{post.dueDate| date:'dd/MM/yyyy'}} + {{post.dueDays}} + {{post.fine}} + + {{post.bookReturnedDate| date:'dd/MM/yyyy'}} + {{post.status}} + {{post.reason}} + + +    +   
+ +

+ + + + + diff --git a/FrontEnd/iprjt/src/app/borrow/borrow.component.ts b/FrontEnd/iprjt/src/app/borrow/borrow.component.ts index 8e9ae2d3..375847ef 100644 --- a/FrontEnd/iprjt/src/app/borrow/borrow.component.ts +++ b/FrontEnd/iprjt/src/app/borrow/borrow.component.ts @@ -17,6 +17,12 @@ export class BorrowComponent implements OnInit { borrowdata:any; booksdata:any; + POSTS: any; + page: number = 1; + count: number = 0; + tableSize: number = 5; + tableSizes: any = [3, 6, 9, 12]; + constructor(private router:Router ,private service:BorrowService,private booksService:BooksService) { this.borrowList=[]; @@ -31,11 +37,39 @@ export class BorrowComponent implements OnInit { LoadBorrow(){ - this.service.Load().subscribe((data: any)=>{ - this.borrowdata=data; - console.log(data);}); - - } + // this.service.Load().subscribe((data: any)=>{ + // this.borrowdata=data; + // console.log(data);}); + this.service.Load().subscribe( + (response) => { + this.POSTS = response; + this.borrowdata=response; + console.log(response); + }, + (error) => { + console.log(error); + } + ); + } + + onTableDataChange(event: any) { + this.page = event; + this.LoadBorrow(); + } + // onTableSizeChange(event: any): void { + // this.tableSize = event.target.value; + // this.page = 1; + // this.LoadBorrow(); + // } + + + + + + + + + home() { diff --git a/FrontEnd/iprjt/src/app/fine/fine.component.css b/FrontEnd/iprjt/src/app/fine/fine.component.css new file mode 100644 index 00000000..34b53d69 --- /dev/null +++ b/FrontEnd/iprjt/src/app/fine/fine.component.css @@ -0,0 +1,107 @@ +p{ + padding: 0px 0px 30px 1000px; + margin: 0px; + background-color: rgb(0, 0, 0); + background-image: url('../../../a.png'); + +} + +.btnhome{ + margin-top: 20px; + margin-bottom: 10px; + padding: 7; + border-color: rgb(124, 241, 134); + background-color: rgba(83, 254, 3, 0.853); + font-size: 13px; + border-radius: 25px; + +} +.btnn{ + padding: 7; + border-color: rgb(124, 241, 134); + background-color: rgba(83, 254, 3, 0.853); + font-size: 13px; +} +.btnn1{ + padding-left: 13px;padding-right: 13px; + border-color: rgb(0, 0, 0); + background-color: rgba(58, 100, 216, 0.705); + font-size: 13px; +} +.btnn0{ + padding-left: 10px;padding-right: 10px; + border-color: rgb(0, 0, 0); + background-color: rgba(40, 216, 78, 0.705); + font-size: 13px; +} +.btnn2{ + padding-left: 10px;padding-right: 10px; + border-color: rgb(0, 0, 0); + background-color: rgb(216, 40, 40); + font-size: 13px; + +} + + + +.text-danger1{ + + width: 160%; + padding: 8px 6px; + margin: 0px; + box-sizing: border-box; + border: 1px ; + background-color: #a7bdb08f; + color: rgb(0, 0, 0); + border-radius: 7px; + +} + +.dropbtn{ + width: 160%; + padding: 8px 6px; + margin: 0px; + box-sizing: border-box; + border: 1px ; + background-color: #a7bdb08f; + color: rgb(0, 0, 0); + border-radius: 7px; +} +.btn{ + width: 150%; + padding: 7px 2px; + margin: 5px ; + box-sizing: border-box; + border: 2px solid rgb(250, 97, 97); + background-color:rgba(106, 215, 56, 0.682); + color: rgb(0, 0, 0); + border-radius: 7px; +} +.table-bordered{ + border: 1px solid; +} +th { + background-color: #232524; + color: white; + width: 15%; + text-align: center; + } + td { + background-color: #a7bdb08f; + color: rgb(0, 0, 0); + width: 15%; + text-align: center; + margin-top: auto; + padding: auto; + } + + + .btnList{ + border: none; + padding: 1px; + background: rgb(0, 0, 0); + font-size: 13px; + font-style: italic ; + color: rgb(255, 255, 255); + border-radius: 3px; +} diff --git a/FrontEnd/iprjt/src/app/fine/fine.component.html b/FrontEnd/iprjt/src/app/fine/fine.component.html new file mode 100644 index 00000000..f5363e16 --- /dev/null +++ b/FrontEnd/iprjt/src/app/fine/fine.component.html @@ -0,0 +1,45 @@ + + +

+

+

+ +
+
+
+
+

+

Fine Details

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + +
User NameBook NameIssue DateDue DateDueDaysFine(INR)
{{borrow.user.firstName}}{{borrow.books.booksName}}{{borrow.issueDate| date:'dd/MM/yyyy'}}{{borrow.dueDate| date:'dd/MM/yyyy'}}{{borrow.dueDays}}{{borrow.fine}}
+ +
+
+
\ No newline at end of file diff --git a/FrontEnd/iprjt/src/app/fine/fine.component.spec.ts b/FrontEnd/iprjt/src/app/fine/fine.component.spec.ts new file mode 100644 index 00000000..bd228097 --- /dev/null +++ b/FrontEnd/iprjt/src/app/fine/fine.component.spec.ts @@ -0,0 +1,23 @@ +import { ComponentFixture, TestBed } from '@angular/core/testing'; + +import { FineComponent } from './fine.component'; + +describe('FineComponent', () => { + let component: FineComponent; + let fixture: ComponentFixture; + + beforeEach(async () => { + await TestBed.configureTestingModule({ + declarations: [ FineComponent ] + }) + .compileComponents(); + + fixture = TestBed.createComponent(FineComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); + + it('should create', () => { + expect(component).toBeTruthy(); + }); +}); diff --git a/FrontEnd/iprjt/src/app/fine/fine.component.ts b/FrontEnd/iprjt/src/app/fine/fine.component.ts new file mode 100644 index 00000000..a5429b61 --- /dev/null +++ b/FrontEnd/iprjt/src/app/fine/fine.component.ts @@ -0,0 +1,102 @@ +import { Component, OnInit } from '@angular/core'; +import { Router } from '@angular/router'; +import { BooksService } from '../books.service'; +import { BorrowService } from '../borrow.service'; + +@Component({ + selector: 'app-fine', + templateUrl: './fine.component.html', + styleUrls: ['./fine.component.css'] +}) +export class FineComponent implements OnInit { + + + borrowList: any[]; + borrowId:any; + borrowdata:any; + booksdata:any; + + constructor(private router:Router ,private service:BorrowService,private booksService:BooksService) { + + this.borrowList=[]; + } + + + ngOnInit(): void { + sessionStorage.clear() + this.LoadBorrow() + + } + + + LoadBorrow(){ + this.service.LoadFine().subscribe((data: any)=>{ + this.borrowdata=data; + console.log(data);}); + + } + + home() + { + this.router.navigate(['/body']) + } + + + + acceptRequest(borrow:any) + { + console.log("in borrow"); + console.log(borrow); + console.log(borrow.borrowId); + + sessionStorage.setItem('borrowId',borrow.borrowId) + this.router.navigate(['/acceptrequest']) + } + + + rejectRequest(borrow:any){ + + console.log("in borrow"); + console.log(borrow); + console.log(borrow.borrowId); + + sessionStorage.setItem('borrowId',borrow.borrowId) + this.router.navigate(['/rejectrequest']) + + } + + bookReturn(borrow: any) { + + this.service.bookReturn(borrow.borrowId).subscribe({ + next: (Response: any) => { + console.log(Response); + alert(" Book Returned") + window.location.reload() + }, + error: (Response: any) => { + console.log(Response) + alert("invalid Borrow details") + } + }) + this.router.navigate(['/borrow']) + } + + + undo(borrow: any) { + + this.service.undo(borrow.borrowId).subscribe({ + next: (Response: any) => { + console.log(Response); + alert(" Book Returned status revoked") + window.location.reload() + }, + error: (Response: any) => { + console.log(Response) + alert("invalid Borrow details") + } + }) + this.router.navigate(['/borrow']) + } + + } + \ No newline at end of file diff --git a/FrontEnd/iprjt/src/app/login/login.component.html b/FrontEnd/iprjt/src/app/login/login.component.html index c66edfeb..b8266b85 100644 --- a/FrontEnd/iprjt/src/app/login/login.component.html +++ b/FrontEnd/iprjt/src/app/login/login.component.html @@ -25,7 +25,7 @@ password is required
use (uppercase ,lowercase and numbers)
minimum 8 character --> - + \ No newline at end of file diff --git a/FrontEnd/iprjt/src/app/user-reg/user-reg.component.html b/FrontEnd/iprjt/src/app/user-reg/user-reg.component.html index 657981cf..0fc9324c 100644 --- a/FrontEnd/iprjt/src/app/user-reg/user-reg.component.html +++ b/FrontEnd/iprjt/src/app/user-reg/user-reg.component.html @@ -60,7 +60,7 @@ -



+







diff --git a/FrontEnd/iprjt/src/app/view-adminprofile/view-adminprofile.component.ts b/FrontEnd/iprjt/src/app/view-adminprofile/view-adminprofile.component.ts index 83a8b03d..a8757dbf 100644 --- a/FrontEnd/iprjt/src/app/view-adminprofile/view-adminprofile.component.ts +++ b/FrontEnd/iprjt/src/app/view-adminprofile/view-adminprofile.component.ts @@ -32,17 +32,9 @@ export class ViewAdminprofileComponent implements OnInit { home() - { - - this.role=sessionStorage.getItem('role.value')|| ''; - console.log(this.role) - // if(role!=2){ - // this.router.navigate(['/body']) - // } - // else{ - this.router.navigate(['/body']) + { - // } + this.router.navigate(['/body']) }