diff --git a/BackEnd/.vscode/settings.json b/BackEnd/.vscode/settings.json new file mode 100644 index 00000000..7b016a89 --- /dev/null +++ b/BackEnd/.vscode/settings.json @@ -0,0 +1,3 @@ +{ + "java.compile.nullAnalysis.mode": "automatic" +} \ No newline at end of file diff --git a/BackEnd/Library/pom.xml b/BackEnd/Library/pom.xml index 7ba01fb3..abd0355b 100644 --- a/BackEnd/Library/pom.xml +++ b/BackEnd/Library/pom.xml @@ -76,12 +76,6 @@ 1.8 - - net.sf.supercsv - super-csv - 2.4.0 - - 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 a68c1ba3..8d54d109 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 @@ -157,20 +157,5 @@ public List getcountByCategoryId() { } - //book search - - @GetMapping("/admin/searchBooks") - public ResponseEntity> getAllBookStockSearch( - @RequestParam(defaultValue = "") String keyword, - @RequestParam(defaultValue = "1") Integer pageNo, - @RequestParam(defaultValue = "10") Integer pageSize, - @RequestParam(defaultValue = "id") String sortBy) { - System.out.println("paage size" + pageSize); - Page list = service.getAllBookStocks(keyword, pageNo - 1, 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 ec0a46d4..55f9c2d9 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 @@ -1,14 +1,10 @@ package com.innovature.Library.controller; - import java.io.IOException; -import java.security.Principal; + import java.security.Principal; import java.util.Collection; import java.sql.Date; - -import java.text.SimpleDateFormat; import java.util.List; -import javax.servlet.http.HttpServletResponse; import javax.validation.Valid; import org.springframework.beans.factory.annotation.Autowired; @@ -16,31 +12,21 @@ import org.springframework.http.HttpHeaders; import org.springframework.http.HttpStatus; import org.springframework.http.ResponseEntity; -//import org.springframework.beans.factory.annotation.Autowired; -// import org.springframework.web.bind.annotation.DeleteMapping; - import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.PutMapping; -// import org.springframework.web.bind.annotation.PutMapping; import org.springframework.web.bind.annotation.RequestBody; 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; import com.innovature.Library.service.impl.BorrowServiceImpl; import com.innovature.Library.view.BorrowDetailView; import com.innovature.Library.view.rentChartView; -//import com.innovature.Library.view.BorrowListView; import com.innovature.Library.view.BorrowListView; @@ -61,6 +47,20 @@ public Collection list() { return bService.listAll(); } + @GetMapping("/user/statusFilter/") + public ResponseEntity>getAllBorrByStat( + @RequestParam(defaultValue = "1") Integer pageNo, + @RequestParam(defaultValue = "5") Integer pageSize, + @RequestParam(defaultValue = "borrowId") String sortBy, + @RequestParam(defaultValue = "1") Integer direction, + @RequestParam(defaultValue = "1") Integer status) + { + Page list = bService.getAllBorrByStat(pageNo-1, pageSize, sortBy,direction,status); + return new ResponseEntity>(list,new HttpHeaders(), + HttpStatus.OK); + + } + //pagenated borrow list at admin borrow // @GetMapping("/pagenated/") @@ -279,44 +279,16 @@ public rentChartView getchart(){ return test; } - - @GetMapping("admin/export") - public void Exportcsv(HttpServletResponse httpServletResponse) throws IOException { - httpServletResponse.setContentType("text/csv"); - java.text.DateFormat datefFormat = new SimpleDateFormat("yyyy-MM-dd_HH-mm-ss"); - String currentDateTime = datefFormat.format(new java.util.Date()); - String headerKey = "Content-Disposition"; - String headerValue = "attachment; filename=users_" + currentDateTime + ".csv"; - httpServletResponse.setHeader(headerKey, headerValue); - List rents = bService.listcsv(); - - ICsvBeanWriter csvWriter = new CsvBeanWriter(httpServletResponse.getWriter(), - CsvPreference.STANDARD_PREFERENCE); - String[] csvHeader = { "borrow_id","first_name","books_name", "issue_date", "return_date","due_date","book_returned_date","reason","due_days","fine","status"}; - String[] nameMapping = { "borrowId","firstName","booksName", "issueDate", "returnDate", "dueDate","bookReturnedDate","reason","dueDays","fine","status" }; - csvWriter.writeHeader(csvHeader); - for (Borrow rent : rents) { - // System.out.println(" :"+rent.getStatus()); - csvWriter.write(rent, nameMapping); - } - csvWriter.flush(); - csvWriter.close(); + @PutMapping("user/paymentStatus/{borrowId}") + public BorrowDetailView updatePaymentStatus( + @PathVariable("borrowId") Integer borrowId, + @Valid @RequestBody BorrowForm form + ) { + return bService.updatePaymentStatus(borrowId, form); } - @GetMapping("/admin/searchUser") - public ResponseEntity> getAllBorrowedUserSearch( - @RequestParam(defaultValue = "") String keyword, - @RequestParam(defaultValue = "1") Integer pageNo, - @RequestParam(defaultValue = "10") Integer pageSize) - // @RequestParam(defaultValue = "user_id") String sortBy) - { - System.out.println("paage size" + pageSize); - Page list = bService.getAllBorrowedUserSearch(keyword, pageNo - 1, pageSize); - return new ResponseEntity>(list, new HttpHeaders(), - HttpStatus.OK); - } } diff --git a/BackEnd/Library/src/main/java/com/innovature/Library/controller/EmailController.java b/BackEnd/Library/src/main/java/com/innovature/Library/controller/EmailController.java index 831fffa8..f5405b82 100644 --- a/BackEnd/Library/src/main/java/com/innovature/Library/controller/EmailController.java +++ b/BackEnd/Library/src/main/java/com/innovature/Library/controller/EmailController.java @@ -32,7 +32,7 @@ import com.innovature.Library.repository.UserRepository; import com.innovature.Library.service.EmailService; - +// tgsrhyrsrthr @RestController @RequestMapping("/email") public class EmailController { diff --git a/BackEnd/Library/src/main/java/com/innovature/Library/controller/csvController.java b/BackEnd/Library/src/main/java/com/innovature/Library/controller/csvController.java index 5a3f4b16..feb17fe1 100644 --- a/BackEnd/Library/src/main/java/com/innovature/Library/controller/csvController.java +++ b/BackEnd/Library/src/main/java/com/innovature/Library/controller/csvController.java @@ -60,8 +60,6 @@ public ResponseEntity uploadFile(@RequestParam("file") Multipar message = "Please upload a csv file!"; return ResponseEntity.status(HttpStatus.BAD_REQUEST).body(new ResponseMessage(message,"")); } - - } \ No newline at end of file diff --git a/BackEnd/Library/src/main/java/com/innovature/Library/csv_helper/csvHelper.java b/BackEnd/Library/src/main/java/com/innovature/Library/csv_helper/csvHelper.java index 9dd3baa3..2c44b3df 100644 --- a/BackEnd/Library/src/main/java/com/innovature/Library/csv_helper/csvHelper.java +++ b/BackEnd/Library/src/main/java/com/innovature/Library/csv_helper/csvHelper.java @@ -50,12 +50,15 @@ public static boolean hasCSVFormat(MultipartFile file){ Integer.parseInt(csvRecord.get("booksCopies")), Integer.parseInt(csvRecord.get("categoryId")), Integer.parseInt(csvRecord.get("status")) - //csvRecord.get("image") + //csvRecord.get("image") + + ); csvList.add(csvob); + } return csvList; - + }catch(IOException e){ throw new RuntimeException("fail to parse csv file"+e.getMessage()); } @@ -63,11 +66,6 @@ public static boolean hasCSVFormat(MultipartFile file){ } - - - - - } diff --git a/BackEnd/Library/src/main/java/com/innovature/Library/entity/Borrow.java b/BackEnd/Library/src/main/java/com/innovature/Library/entity/Borrow.java index d34f41b4..4ab5584a 100644 --- a/BackEnd/Library/src/main/java/com/innovature/Library/entity/Borrow.java +++ b/BackEnd/Library/src/main/java/com/innovature/Library/entity/Borrow.java @@ -51,6 +51,7 @@ private Status(byte value) { private User user; private String status; + private String paymentStatus; private String reason; public Long fine; public Long dueDays; @@ -74,6 +75,7 @@ public Borrow(BorrowForm form, Books books, User user2) { this.books = books; this.user = user2; this.status = getStatus(); + this.paymentStatus=getPaymentStatus(); this.reason = form.getReason(); LocalDateTime dt =LocalDateTime.now(); @@ -90,6 +92,7 @@ public Borrow(Books book, User user) { this.books = book; this.user = user; this.status = "REQUESTED"; + this.paymentStatus="UNBILLED"; this.dueDays=(long) 0; this.fine=(long) 0; } @@ -181,11 +184,12 @@ public void setFine(Long fine) { this.fine = fine; } - public String getFirstName(){ - return user.getFirstName(); + public String getPaymentStatus() { + return paymentStatus; } - public String getBooksName(){ - return books.getBooksName(); + public void setPaymentStatus(String paymentStatus) { + this.paymentStatus = paymentStatus; } + } 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 e7d35120..7210f6a1 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 @@ -36,8 +36,5 @@ public interface BooksRepository extends Repository { // @Query(value = "select sum(books_copies)", nativeQuery = true) // List findbyBooksId1(); - @Query(value = "Select * from books where status = 1 AND books_name like %?1% order by books_name like ?2% DESC,books_name like %?3 DESC,books_name like %?4% ", nativeQuery = true) - public Page findByKeywords(String keyword, String k, String k1, String k2, Pageable pageable); - } 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 62616c6a..b34ad487 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 @@ -58,7 +58,7 @@ public interface BorrowRepository extends PagingAndSortingRepository findbyUserIdandStatus(Integer userId); @@ -109,23 +109,26 @@ public interface BorrowRepository extends PagingAndSortingRepositoryfindAllC(); - // @Query(value = "Select * from borrow where books_name like %?1% order by books_name like ?2% DESC,books_name like %?3 DESC,books_name like %?4% ", nativeQuery = true) - // public Page findByKeywords(String keyword, String k, String k1, String k2, Pageable pageable); - + // filter by approved + @Query(value = "select * from borrow where status='APPROVED' and user_id=?", nativeQuery = true) + public Page findByAppStatusUser(Integer userId,Pageable paging); + + // filter by rejected + @Query(value = "select * from borrow where status='REJECTED' and user_id=?", nativeQuery = true) + public Page findByRejStatusUser(Integer userId,Pageable paging); + + //filter by returned + @Query(value = "select * from borrow where status='RETURNED' and user_id=?", nativeQuery = true) + public Page findByRetStatusUser(Integer userId,Pageable paging); + + //filter by requested + @Query(value = "select * from borrow where status='REQUESTED' and user_id=?", nativeQuery = true) + public Page findByReqStatusUser(Integer userId,Pageable paging); + + - // @Query(value = "SELECT * FROM borrow INNER JOIN user ON borrow.user_id = user.user_id where first_name like %?1% order by first_name like ?2% DESC,first_name like %?3 DESC,first_name like %?4% ", nativeQuery = true) - // public Page findByKeywords(String keyword, String k, String k1, String k2, Pageable pageable); - - @Query(value = "select * from borrow where user_id in(select user_id from user where first_name like %?%", nativeQuery = true) - public Page findByKeywords(String keyword, String k, String k1, String k2, Pageable pageable); - } //mysql> select count(borrow_id) from borrow where book_returned_date between '2023-01-01' and '2023-01-07'; -//select count(borrow_id) from borrow where book_returned_date='2022-12-27'; - -// inner join eg = SELECT user.first_name FROM borrow INNER JOIN user ON borrow.user_id = user.user_id -// >no innerjoin= select user.first_name from user,borrow where user.user_id=borrow.user_id; -//>select * from borrow where user_id in(select user_id from user where first_name like 'ashwin'); - +//select count(borrow_id) from borrow where book_returned_date='2022-12-27'; \ No newline at end of file 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 7f4373b6..f1c38a88 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 @@ -38,8 +38,6 @@ public interface BooksService { List getBookCountByCategory(); - PagegetAllBookStocks(String keyword, 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 bad51bad..c781f9ff 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 @@ -64,12 +64,12 @@ public interface BorrowService { Integer BorrowBlock(); - // public RentCharView getChart(); - - Listlistcsv(); + PagegetAllBorrByStat(Integer pageNo, Integer pageSize, String sortBy,Integer direction,Integer status); + + BorrowDetailView updatePaymentStatus(Integer borrowId, BorrowForm form); - PagegetAllBorrowedUserSearch(String keyword, Integer pageNo,Integer pageSize); + // public RentCharView getChart(); } diff --git a/BackEnd/Library/src/main/java/com/innovature/Library/service/csvService.java b/BackEnd/Library/src/main/java/com/innovature/Library/service/csvService.java index 10edb0c0..6262b671 100644 --- a/BackEnd/Library/src/main/java/com/innovature/Library/service/csvService.java +++ b/BackEnd/Library/src/main/java/com/innovature/Library/service/csvService.java @@ -34,8 +34,6 @@ public void save(MultipartFile file){ } - - public ListgetAll(){ return repository.findAll(); 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 64921e4d..4dca3d63 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 @@ -145,20 +145,6 @@ public List getBookCountByCategory() { return booksRepository.findCountByCategoryId(); } - //book search - - @Override - public Page getAllBookStocks(String keyword, Integer pageNo, Integer pageSize, String sortBy) { - Pageable paging = PageRequest.of(pageNo, pageSize, Sort.by(sortBy)); - System.out.println(keyword); - String k = keyword; - String k1 = keyword; - String k2 = keyword; - Page pagedResult = booksRepository.findByKeywords(keyword, k, k1, k2, paging); - return pagedResult; - - } - } 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 1f0b52b1..af482d51 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 @@ -16,8 +16,6 @@ import java.util.List; import java.util.Map; - - import javax.transaction.Transactional; import org.springframework.beans.factory.annotation.Autowired; @@ -46,12 +44,6 @@ import java.util.List; - - - - - - @Service public class BorrowServiceImpl implements BorrowService { @@ -60,8 +52,6 @@ public class BorrowServiceImpl implements BorrowService { @Autowired private JavaMailSender mailSender; - - @Autowired private BorrowRepository borrowRepository; @@ -71,73 +61,69 @@ public class BorrowServiceImpl implements BorrowService { @Autowired UserRepository userRepository; - // private Object mailSender; + // private Object mailSender; @Override - public BorrowDetailView add(BorrowForm form){ - Books books=booksRepository.findByBooksId(form.getBooksId()); - User user=userRepository.findById(SecurityUtil.getCurrentUserId()); - // String status= form.setStatus("REQUESTED"); - // return new BorrowDetailView(borrowRepository.save(new Borrow(form,books,user))); - - return new BorrowDetailView(borrowRepository.save(new Borrow(books,user))); - + public BorrowDetailView add(BorrowForm form) { + Books books = booksRepository.findByBooksId(form.getBooksId()); + User user = userRepository.findById(SecurityUtil.getCurrentUserId()); + // String status= form.setStatus("REQUESTED"); + // return new BorrowDetailView(borrowRepository.save(new + // Borrow(form,books,user))); + + return new BorrowDetailView(borrowRepository.save(new Borrow(books, user))); + } @Override public Collection listAll() { - return borrowRepository.findAll(); + return borrowRepository.findAll(); } - @Override public List loadtAllByIssueDate(java.sql.Date date1, java.sql.Date date2) { - return borrowRepository.findbyIssuDate(date1,date2); + return borrowRepository.findbyIssuDate(date1, date2); } - @Override public Collection listDue() { - return borrowRepository.findbyBorrowIdandStatus(); + return borrowRepository.findbyBorrowIdandStatus(); } - @Override public Collection listDueByUser() { - return borrowRepository.findbyUserIdandStatus(SecurityUtil.getCurrentUserId()); + return borrowRepository.findbyUserIdandStatus(SecurityUtil.getCurrentUserId()); } @Override public Collection fine() { - return borrowRepository.findbyBorrowIdandDueDateandStatus(); + return borrowRepository.findbyBorrowIdandDueDateandStatus(); } @Override public Borrow BorrowDetail(Integer borrowId) { - - return borrowRepository.findByBorrowId(borrowId); + + return borrowRepository.findByBorrowId(borrowId); } -///////////////////////////////////////////////////////////////////////////////////////////// + + ///////////////////////////////////////////////////////////////////////////////////////////// @Override public Integer BorrowBlock() { - - return borrowRepository.findbyUserIdAndStatus(SecurityUtil.getCurrentUserId()); - } + return borrowRepository.findbyUserIdAndStatus(SecurityUtil.getCurrentUserId()); + } @Override - public BorrowDetailView list(Integer borrowId){ - Borrow borrow=borrowRepository.findByBorrowId(borrowId); + public BorrowDetailView list(Integer borrowId) { + Borrow borrow = borrowRepository.findByBorrowId(borrowId); return new BorrowDetailView(borrow); } - @Override public Collection list1() { return borrowRepository.findAllByUserUserId(SecurityUtil.getCurrentUserId()); } - @Override public Collection listNotification() { return borrowRepository.findBorrowIdbyUserId(SecurityUtil.getCurrentUserId()); @@ -148,86 +134,70 @@ public Collection listUserNotification() { return borrowRepository.findbyUserIdDueDate(SecurityUtil.getCurrentUserId()); } - - - - - - - - @Override @Transactional - public BorrowDetailView updates(Integer borrowId, BorrowForm form) { - - Borrow borrow=borrowRepository.findByBorrowId(borrowId); - Books books=booksRepository.findbyBorrowId(borrowId); - - - borrow.setIssueDate(LocalDateTime.now()); - borrow.setDueDate(form.getDueDate()); - borrow.setReturnDate(form.getReturnDate()); - borrow.setReason(null); - borrow.setStatus("APPROVED"); - books.setBooksCopies(books.getBooksCopies() - 1); - return new BorrowDetailView(borrowRepository.save(borrow)); + public BorrowDetailView updates(Integer borrowId, BorrowForm form) { + + Borrow borrow = borrowRepository.findByBorrowId(borrowId); + Books books = booksRepository.findbyBorrowId(borrowId); + + borrow.setIssueDate(LocalDateTime.now()); + borrow.setDueDate(form.getDueDate()); + borrow.setReturnDate(form.getReturnDate()); + borrow.setReason(null); + borrow.setStatus("APPROVED"); + books.setBooksCopies(books.getBooksCopies() - 1); + return new BorrowDetailView(borrowRepository.save(borrow)); } - - - - @Override @Transactional - public BorrowDetailView updatereject(Integer borrowId, BorrowForm form) { - - Borrow borrow=borrowRepository.findByBorrowId(borrowId); - // Books books=booksRepository.findByBooksId(borrowId); - - // borrow.setIssueDate("NA"); - // borrow.setDueDate("NA"); - // borrow.setReturnDate("NA"); - // String status= form.setStatus("REQUESTED"); category.setCategoryName(form.getCategoryName()); - borrow.setReason(form.getReason()); - borrow.setIssueDate(null); - borrow.setReturnDate(null); - borrow.setDueDate(null); - borrow.setStatus("REJECTED"); - return new BorrowDetailView(borrow); + public BorrowDetailView updatereject(Integer borrowId, BorrowForm form) { + + Borrow borrow = borrowRepository.findByBorrowId(borrowId); + // Books books=booksRepository.findByBooksId(borrowId); + + // borrow.setIssueDate("NA"); + // borrow.setDueDate("NA"); + // borrow.setReturnDate("NA"); + // String status= form.setStatus("REQUESTED"); + // category.setCategoryName(form.getCategoryName()); + borrow.setReason(form.getReason()); + borrow.setIssueDate(null); + borrow.setReturnDate(null); + borrow.setDueDate(null); + borrow.setStatus("REJECTED"); + return new BorrowDetailView(borrow); } - @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()); - borrow.setDueDate(borrow.getDueDate()); - borrow.setStatus("RETURNED"); - books.setBooksCopies(books.getBooksCopies() + 1); - return new BorrowDetailView(borrowRepository.save(borrow)); + 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()); + borrow.setDueDate(borrow.getDueDate()); + borrow.setStatus("RETURNED"); + books.setBooksCopies(books.getBooksCopies() + 1); + return new BorrowDetailView(borrowRepository.save(borrow)); } @Override @Transactional - public BorrowDetailView undo(Integer borrowId, BorrowForm form) { - - Borrow borrow=borrowRepository.findByBorrowId(borrowId); - Books books=booksRepository.findbyBorrowId(borrowId); - - borrow.setBookReturnedDate(null); - borrow.setStatus("APPROVED"); - books.setBooksCopies(books.getBooksCopies() - 1); - return new BorrowDetailView(borrowRepository.save(borrow)); - } + public BorrowDetailView undo(Integer borrowId, BorrowForm form) { + Borrow borrow = borrowRepository.findByBorrowId(borrowId); + Books books = booksRepository.findbyBorrowId(borrowId); + borrow.setBookReturnedDate(null); + borrow.setStatus("APPROVED"); + books.setBooksCopies(books.getBooksCopies() - 1); + return new BorrowDetailView(borrowRepository.save(borrow)); + } @Override public BorrowDetailView listByUser(Integer borrowId, BorrowForm form) { @@ -235,115 +205,101 @@ public BorrowDetailView listByUser(Integer borrowId, BorrowForm form) { return null; } - - - -///pagenation and sort/// + /// pagenation and sort/// @Override @Transactional - public ListgetAllBorrow( java.sql.Date date1, java.sql.Date date2,Integer pageNo, Integer pageSize, String sortBy){ - - Pageable paging = PageRequest.of(pageNo, pageSize, Sort .by(sortBy)); + public List getAllBorrow(java.sql.Date date1, java.sql.Date date2, Integer pageNo, Integer pageSize, + String sortBy) { + + Pageable paging = PageRequest.of(pageNo, pageSize, Sort.by(sortBy)); - Page pagedResult = borrowRepository.findbyIssuDate(date1,date2,paging); + Page pagedResult = borrowRepository.findbyIssuDate(date1, date2, paging); - if(pagedResult.hasContent()){ + if (pagedResult.hasContent()) { return pagedResult.getContent(); } else { return new ArrayList(); } } - ////////////////////////////////// @Override @Transactional - public PagegetAllBor( java.sql.Date date1, java.sql.Date date2,Integer pageNo, Integer pageSize, String sortBy,Integer direction){ - - // Pageable paging = PageRequest.of(pageNo, pageSize, Sort .by(sortBy)); - var sortByDescending=Sort.by(sortBy).descending(); - var sortByAscending=Sort.by(sortBy).ascending(); + public Page getAllBor(java.sql.Date date1, java.sql.Date date2, Integer pageNo, Integer pageSize, + String sortBy, Integer direction) { - if(direction==1){ + // Pageable paging = PageRequest.of(pageNo, pageSize, Sort .by(sortBy)); + var sortByDescending = Sort.by(sortBy).descending(); + var sortByAscending = Sort.by(sortBy).ascending(); + + if (direction == 1) { Pageable paging = PageRequest.of(pageNo, pageSize, sortByDescending); - Page pagedResult = borrowRepository.findbyIssuDat(date1,date2,paging); - return pagedResult; + Page pagedResult = borrowRepository.findbyIssuDat(date1, date2, paging); + return pagedResult; } - else - { + else { Pageable paging = PageRequest.of(pageNo, pageSize, sortByAscending); - Page pagedResult = borrowRepository.findbyIssuDat(date1,date2,paging); - return pagedResult; + Page pagedResult = borrowRepository.findbyIssuDat(date1, date2, paging); + return pagedResult; } - // Page pagedResult = borrowRepository.findbyIssuDat(date1,date2,paging); + // Page pagedResult = + // borrowRepository.findbyIssuDat(date1,date2,paging); // return pagedResult; - - } - - - + } @Override @Transactional - public ListgetAllBorrows(Integer pageNo, Integer pageSize, String sortBy){ - + public List getAllBorrows(Integer pageNo, Integer pageSize, String sortBy) { + Pageable paging = PageRequest.of(pageNo, pageSize, Sort.by(sortBy)); Page pagedResult = borrowRepository.findAll(paging); - if(pagedResult.hasContent()){ + if (pagedResult.hasContent()) { return pagedResult.getContent(); } else { return new ArrayList(); } } - -//@admin borrow oninit + // @admin borrow oninit @Override @Transactional - public PagegetAllBorr(Integer pageNo, Integer pageSize, String sortBy,Integer direction){ - - var sortByDescending=Sort.by(sortBy).descending(); + public Page getAllBorr(Integer pageNo, Integer pageSize, String sortBy, Integer direction) { + + var sortByDescending = Sort.by(sortBy).descending(); - var sortByAscending=Sort.by(sortBy).ascending(); + var sortByAscending = Sort.by(sortBy).ascending(); - if(direction==1){ + if (direction == 1) { Pageable paging = PageRequest.of(pageNo, pageSize, sortByDescending); Page pagedResult = borrowRepository.findAll(paging); - return pagedResult; + return pagedResult; } - else - { + else { Pageable paging = PageRequest.of(pageNo, pageSize, sortByAscending); Page pagedResult = borrowRepository.findAll(paging); - return pagedResult; + return pagedResult; } - // return pagedResult; - - - - + // return pagedResult; - } - @Override @Transactional - public ListgetBorrowHistory(Integer pageNo, Integer pageSize, String sortBy){ - + public List getBorrowHistory(Integer pageNo, Integer pageSize, String sortBy) { + Pageable paging = PageRequest.of(pageNo, pageSize, Sort.by(sortBy)); - Page pagedResult = borrowRepository.findAllByUserUserId(SecurityUtil.getCurrentUserId(),paging); + Page pagedResult = borrowRepository.findAllByUserUserId(SecurityUtil.getCurrentUserId(), paging); - if(pagedResult.hasContent()){ + if (pagedResult.hasContent()) { return pagedResult.getContent(); } else { return new ArrayList(); @@ -352,185 +308,218 @@ public BorrowDetailView listByUser(Integer borrowId, BorrowForm form) { // @Override // public Collection list1() { - // return borrowRepository.findAllByUserUserId(SecurityUtil.getCurrentUserId()); + // return borrowRepository.findAllByUserUserId(SecurityUtil.getCurrentUserId()); // } - - -//mail// + // mail// // @Override // @Transactional // @Scheduled(cron="*/50 * * * * * ") // public void sendMail(Integer userId,String subject,String text) { - // System.out.println("ssss"); - // // User user = userRepository.findByUserId(userId); - // User user=userRepository.findById(userId); + // System.out.println("ssss"); + // // User user = userRepository.findByUserId(userId); + // User user=userRepository.findById(userId); - // SimpleMailMessage simpleMailMessage = new SimpleMailMessage(); - // simpleMailMessage.setFrom("bookstore.shopp@gmail.com"); - // simpleMailMessage.setTo(user.getEmail()); - // simpleMailMessage.setSubject(subject); - // simpleMailMessage.setText(text); + // SimpleMailMessage simpleMailMessage = new SimpleMailMessage(); + // simpleMailMessage.setFrom("bookstore.shopp@gmail.com"); + // simpleMailMessage.setTo(user.getEmail()); + // simpleMailMessage.setSubject(subject); + // simpleMailMessage.setText(text); - // this.mailSender.send(simpleMailMessage); + // this.mailSender.send(simpleMailMessage); // } @Override @Transactional - // @Scheduled(cron="* */1 * * * * ") - @Scheduled(cron="0 0 12 * * ?") + // @Scheduled(cron="* */1 * * * * ") + @Scheduled(cron = "0 0 12 * * ?") public void sendMails() { System.out.println("Email sent successfully"); - - // User user=userRepository.findById(userId); - Collection borrow=borrowRepository.findbyBorrowIdandStatus(); - for(Borrow bor: borrow){ - User user = userRepository.findById(bor.getUser().getUserId()); //fetching uid from user + + // User user=userRepository.findById(userId); + Collection borrow = borrowRepository.findbyBorrowIdandStatus(); + for (Borrow bor : borrow) { + User user = userRepository.findById(bor.getUser().getUserId()); // fetching uid from user SimpleMailMessage simpleMailMessage = new SimpleMailMessage(); - simpleMailMessage.setFrom("bookstore.shopp@gmail.com"); - simpleMailMessage.setTo(user.getEmail()); + simpleMailMessage.setFrom("bookstore.shopp@gmail.com"); + simpleMailMessage.setTo(user.getEmail()); simpleMailMessage.setSubject("Books are due"); - simpleMailMessage.setText("Please return the book '"+bor.getBooks().getBooksName()+"'. The due date has expired on "+bor.getDueDate() +". Fine will be generated for each day(5 rs/day)"); - - this.mailSender.send(simpleMailMessage); } + simpleMailMessage.setText( + "Please return the book '" + bor.getBooks().getBooksName() + "'. The due date has expired on " + + bor.getDueDate() + ". Fine will be generated for each day(5 rs/day)"); + + this.mailSender.send(simpleMailMessage); } + } + @Override public void sendMail(Integer userId, String subject, String text) { - // TODO Auto-generated method stub + // TODO Auto-generated method stub } - - - - - - @Override @Transactional - // @Scheduled(cron="* */1 * * * * ") - @Scheduled(cron="0 0 12 * * ?") + // @Scheduled(cron="* */1 * * * * ") + @Scheduled(cron = "0 0 12 * * ?") public void fineGeneration() { - System.out.println("reachllllllllllllll"); - + System.out.println("reachllllllllllllll"); - Collection borrow=borrowRepository.findbyBorrowId(); + Collection borrow = borrowRepository.findbyBorrowId(); System.out.println("hereeeeeeeeeeeeeee"); - for(Borrow bor:borrow){ + for (Borrow bor : borrow) { System.out.println(bor.getBorrowId()); - Date d=new Date(); - Long due=d.getTime()-bor.getDueDate().getTime(); //date conversion to time - due=due/86400000; //time conversion to date + Date d = new Date(); + Long due = d.getTime() - bor.getDueDate().getTime(); // date conversion to time + due = due / 86400000; // time conversion to date bor.setDueDays(due); - bor.setFine(due*5); + bor.setFine(due * 5); } - - } + } -public rentChartView getChart(){ - rentChartView result= new rentChartView(); - String[] weeks = {"Monday","Tuesday","Wednesday","Thursday","Friday","Saturday","Sunday"}; - result.setLabel(Arrays.asList(weeks)); - - HashMap hm - = new HashMap(); + public rentChartView getChart() { + rentChartView result = new rentChartView(); + String[] weeks = { "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday" }; + result.setLabel(Arrays.asList(weeks)); - hm.put(1, new Result(0, 0)); - hm.put(2, new Result(0, 0)); - hm.put(3, new Result(0, 0)); - hm.put(4, new Result(0, 0)); - hm.put(5, new Result(0, 0)); - hm.put(6, new Result(0, 0)); - hm.put(7, new Result(0, 0)); + HashMap hm = new HashMap(); - Lists=borrowRepository.findAllC(); + hm.put(1, new Result(0, 0)); + hm.put(2, new Result(0, 0)); + hm.put(3, new Result(0, 0)); + hm.put(4, new Result(0, 0)); + hm.put(5, new Result(0, 0)); + hm.put(6, new Result(0, 0)); + hm.put(7, new Result(0, 0)); + List s = borrowRepository.findAllC(); - for(Borrow a:s){ - // if(a.getStatus().equals("APPROVED" )) - if(a.getIssueDate()!=null) - { + for (Borrow a : s) { + if (a.getStatus().equals("APPROVED")) { LocalDateTime b = a.getIssueDate(); - // System.out.println("-----in issue----------------------"+b); - // System.out.println("........>>>>>>>>>>>>>>>>....."+ b.getDayOfWeek().getValue()); - + System.out.println("---------------------------" + b); + // System.out.println("........>>>>>>>>>>>>>>>>....."+ + // b.getDayOfWeek().getValue()); + hm.put(b.getDayOfWeek().getValue(), new Result(hm.get(b.getDayOfWeek().getValue()).getIssueCount() + 1, - hm.get(b.getDayOfWeek().getValue()).getReturnedCount())); - } + hm.get(b.getDayOfWeek().getValue()).getReturnedCount())); + } - LocalDateTime c=null; - - if(a.getStatus().equals("RETURNED")) - { + LocalDateTime c = null; - c = a.getBookReturnedDate(); - // System.out.println("cccccccccccccccccccccccccccccccccccccccccc="+c); + if (a.getStatus().equals("RETURNED")) { + c = a.getBookReturnedDate(); + System.out.println("cccccccccccccccccccccccccccccccccccccccccc=" + c); - hm.put(c.getDayOfWeek().getValue(), new Result(hm.get(c.getDayOfWeek().getValue()).getIssueCount() , - hm.get(c.getDayOfWeek().getValue()).getReturnedCount() +1)); - - // System.out.println(hm.get(c.getDayOfWeek().getValue()).getReturnedCount()); - } - } - for (Map.Entry mapElement : hm.entrySet()) { - result.getIssueCount().add(mapElement.getValue().getIssueCount()+""); - result.getReturnedCount().add(mapElement.getValue().getReturnedCount()+""); + hm.put(c.getDayOfWeek().getValue(), new Result(hm.get(c.getDayOfWeek().getValue()).getIssueCount(), + hm.get(c.getDayOfWeek().getValue()).getReturnedCount() + 1)); + System.out.println(hm.get(c.getDayOfWeek().getValue()).getReturnedCount()); } - return result; -} + } + for (Map.Entry mapElement : hm.entrySet()) { + result.getIssueCount().add(mapElement.getValue().getIssueCount() + ""); + result.getReturnedCount().add(mapElement.getValue().getReturnedCount() + ""); + } + return result; + } -public class Result { - private Integer issueCount; - private Integer returnedCount; + public class Result { + private Integer issueCount; + private Integer returnedCount; - public Result(Integer issueCount, Integer returnedCount) { - this.issueCount = issueCount; - this.returnedCount= returnedCount; - } + public Result(Integer issueCount, Integer returnedCount) { + this.issueCount = issueCount; + this.returnedCount = returnedCount; + } - public Integer getIssueCount() { - return issueCount; - } + public Integer getIssueCount() { + return issueCount; + } - public void setIssueCount(Integer issueCount) { - this.issueCount = issueCount; - } + public void setIssueCount(Integer issueCount) { + this.issueCount = issueCount; + } - public Integer getReturnedCount() { - return returnedCount; - } + public Integer getReturnedCount() { + return returnedCount; + } - public void setReturnedCount(Integer returnedCount) { - this.returnedCount = returnedCount; + public void setReturnedCount(Integer returnedCount) { + this.returnedCount = returnedCount; + } } -} -@Override -public List listcsv() { - return borrowRepository.findAllC(); -} + @Override + @Transactional + public Page getAllBorrByStat(Integer pageNo, Integer pageSize, String sortBy, Integer direction, + Integer status) { - -@Override -public Page getAllBorrowedUserSearch(String keyword, Integer pageNo, Integer pageSize) { - Pageable paging = PageRequest.of(pageNo, pageSize); - System.out.println(keyword); - String k = keyword; - String k1 = keyword; - String k2 = keyword; - Page pagedResult = borrowRepository.findByKeywords(keyword, k, k1, k2, paging); - return pagedResult; + var sortByDescending = Sort.by(sortBy).descending(); -} + var sortByAscending = Sort.by(sortBy).ascending(); + + if (direction == 1 && status == 1) { + + Pageable paging = PageRequest.of(pageNo, pageSize, sortByDescending); + Page pagedResult = borrowRepository.findByAppStatusUser(SecurityUtil.getCurrentUserId(), paging); + return pagedResult; + } + else if (direction == 1 && status == 2) { + Pageable paging = PageRequest.of(pageNo, pageSize, sortByAscending); + Page pagedResult = borrowRepository.findByRejStatusUser(SecurityUtil.getCurrentUserId(), paging); + return pagedResult; + } else if (direction == 1 && status == 3) { + Pageable paging = PageRequest.of(pageNo, pageSize, sortByAscending); + Page pagedResult = borrowRepository.findByRetStatusUser(SecurityUtil.getCurrentUserId(), paging); + return pagedResult; + } else if (direction == 1 && status == 4) { + Pageable paging = PageRequest.of(pageNo, pageSize, sortByAscending); + Page pagedResult = borrowRepository.findByReqStatusUser(SecurityUtil.getCurrentUserId(), paging); + return pagedResult; + } + + else if (direction == -1 && status == 1) { + Pageable paging = PageRequest.of(pageNo, pageSize, sortByAscending); + Page pagedResult = borrowRepository.findByAppStatusUser(SecurityUtil.getCurrentUserId(), paging); + return pagedResult; + } + else if (direction == -1 && status == 2) { + Pageable paging = PageRequest.of(pageNo, pageSize, sortByAscending); + Page pagedResult = borrowRepository.findByRejStatusUser(SecurityUtil.getCurrentUserId(), paging); + return pagedResult; + + } else if (direction == -1 && status == 3) { + Pageable paging = PageRequest.of(pageNo, pageSize, sortByAscending); + Page pagedResult = borrowRepository.findByRetStatusUser(SecurityUtil.getCurrentUserId(), paging); + return pagedResult; + + } else if (direction == -1 && status == 4) { + Pageable paging = PageRequest.of(pageNo, pageSize, sortByAscending); + Page pagedResult = borrowRepository.findByReqStatusUser(SecurityUtil.getCurrentUserId(), paging); + return pagedResult; + } else { + return null; + } + } + + @Override + @Transactional + public BorrowDetailView updatePaymentStatus(Integer borrowId, BorrowForm form) { + + Borrow borrow = borrowRepository.findByBorrowId(borrowId); + Books books = booksRepository.findbyBorrowId(borrowId); + + borrow.setPaymentStatus("PAID"); + return new BorrowDetailView(borrowRepository.save(borrow)); + } - } diff --git a/BackEnd/Library/src/main/java/com/innovature/Library/view/BorrowDetailView.java b/BackEnd/Library/src/main/java/com/innovature/Library/view/BorrowDetailView.java index ad10b24f..5344a723 100644 --- a/BackEnd/Library/src/main/java/com/innovature/Library/view/BorrowDetailView.java +++ b/BackEnd/Library/src/main/java/com/innovature/Library/view/BorrowDetailView.java @@ -18,7 +18,8 @@ public BorrowDetailView(Borrow borrow) { borrow.getStatus(), borrow.getReason(), borrow.getDueDays(), - borrow.getFine() + borrow.getFine(), + borrow.getPaymentStatus() ); } diff --git a/BackEnd/Library/src/main/java/com/innovature/Library/view/BorrowListView.java b/BackEnd/Library/src/main/java/com/innovature/Library/view/BorrowListView.java index c5d52aba..854c03cf 100644 --- a/BackEnd/Library/src/main/java/com/innovature/Library/view/BorrowListView.java +++ b/BackEnd/Library/src/main/java/com/innovature/Library/view/BorrowListView.java @@ -25,11 +25,12 @@ public class BorrowListView { // @Json.DateFormat private final LocalDateTime bookReturnedDate; private String status; + private String paymentStatus; private String reason; public Long fine; public Long dueDays; - public BorrowListView(int borrowId, User user, Books books, LocalDateTime issueDate, Date returnDate, LocalDateTime bookReturnedDate,Date dueDate, String status,String reason,Long dueDays,Long fine) { + public BorrowListView(int borrowId, User user, Books books, LocalDateTime issueDate, Date returnDate, LocalDateTime bookReturnedDate,Date dueDate, String status,String reason,Long dueDays,Long fine,String paymentStatus) { this.borrowId = borrowId; this.user = new UserDetailView(user); this.books = new BooksDetailView(books); @@ -42,7 +43,7 @@ public BorrowListView(int borrowId, User user, Books books, LocalDateTime issueD this.reason = reason; this.dueDays=dueDays; this.fine=fine; - + this.paymentStatus=paymentStatus; } @@ -96,7 +97,10 @@ public Long getDueDays() { return dueDays; } + public String getpaymentStatus(){ + return paymentStatus; + } } diff --git a/FrontEnd/Library/src/app/addbooks/addbooks.component.ts b/FrontEnd/Library/src/app/addbooks/addbooks.component.ts index f70a57f1..fb741cfc 100644 --- a/FrontEnd/Library/src/app/addbooks/addbooks.component.ts +++ b/FrontEnd/Library/src/app/addbooks/addbooks.component.ts @@ -192,6 +192,8 @@ onTableDataChange(event:any) { selectFile($event:any) { this.selectedFiles=$event.target.files; } + + upload(): void { diff --git a/FrontEnd/Library/src/app/app-routing.module.ts b/FrontEnd/Library/src/app/app-routing.module.ts index 693e53fb..e527bd9d 100644 --- a/FrontEnd/Library/src/app/app-routing.module.ts +++ b/FrontEnd/Library/src/app/app-routing.module.ts @@ -28,6 +28,8 @@ import { DemoComponent } from './demo/demo.component'; import { AddbooksComponent } from './addbooks/addbooks.component'; import { BorrowDetailViewComponent } from './borrow-detail-view/borrow-detail-view.component'; import { ForgotpasswordComponent } from './forgotpassword/forgotpassword.component'; +import { Sidenav2Component } from './sidenav2/sidenav2.component'; +import { Navbar2Component } from './navbar2/navbar2.component'; const routes: Routes = [ {path: '',redirectTo:'login',pathMatch:'full'}, @@ -57,6 +59,8 @@ const routes: Routes = [ {path:'addbooks',component:AddbooksComponent,canActivate: [HomeguardGuard]}, {path:'borrow-detail-view',component:BorrowDetailViewComponent}, {path:'forgotpassword',component:ForgotpasswordComponent}, + {path:'sidenav2',component:Sidenav2Component,canActivate: [HomeguardGuard]}, + {path:'navbar2',component:Navbar2Component,canActivate: [HomeguardGuard]} ]; @NgModule({ diff --git a/FrontEnd/Library/src/app/app.module.ts b/FrontEnd/Library/src/app/app.module.ts index bf0a1138..4cc3db4f 100644 --- a/FrontEnd/Library/src/app/app.module.ts +++ b/FrontEnd/Library/src/app/app.module.ts @@ -32,6 +32,7 @@ import { NotificationComponent } from './notification/notification.component'; import { BookreturnComponent } from './bookreturn/bookreturn.component'; import { ViewAdminprofileComponent } from './view-adminprofile/view-adminprofile.component'; import { BrowserAnimationsModule } from '@angular/platform-browser/animations'; +import { MatGridListModule } from '@angular/material/grid-list'; // import { MatIconModule, MatToolbarModule, MatTooltipModule } from '@angular/material'; import { MatListModule } from '@angular/material/list'; @@ -53,6 +54,8 @@ import { MatOptionModule } from '@angular/material/core'; import { BorrowDetailViewComponent } from './borrow-detail-view/borrow-detail-view.component'; import { ForgotpasswordComponent } from './forgotpassword/forgotpassword.component'; import {Chart} from 'chart.js'; +import { Sidenav2Component } from './sidenav2/sidenav2.component'; +import { Navbar2Component } from './navbar2/navbar2.component'; // import {MatIconModule} from '@angular/material/icon'; // import { MatToolbarModule } from '@angular/material'; @@ -90,6 +93,8 @@ import {Chart} from 'chart.js'; AddbooksComponent, BorrowDetailViewComponent, ForgotpasswordComponent, + Sidenav2Component, + Navbar2Component, // Chart // ModalComponent @@ -114,6 +119,7 @@ import {Chart} from 'chart.js'; MatDialogModule, MatInputModule, MatListModule, + MatGridListModule // Chart diff --git a/FrontEnd/Library/src/app/booksdisplay/booksdisplay.component.html b/FrontEnd/Library/src/app/booksdisplay/booksdisplay.component.html index 1fa3e1cb..f405e060 100644 --- a/FrontEnd/Library/src/app/booksdisplay/booksdisplay.component.html +++ b/FrontEnd/Library/src/app/booksdisplay/booksdisplay.component.html @@ -1,8 +1,8 @@ - + -

+

diff --git a/FrontEnd/Library/src/app/borrow.service.ts b/FrontEnd/Library/src/app/borrow.service.ts index 7e8bac39..1fc20259 100644 --- a/FrontEnd/Library/src/app/borrow.service.ts +++ b/FrontEnd/Library/src/app/borrow.service.ts @@ -3,12 +3,20 @@ import { Injectable } from '@angular/core'; import { catchError, Observable } from 'rxjs'; import { HttpErrorResponse } from '@angular/common/http'; import { Router } from '@angular/router'; +function _window() : any { + // return the global native browser window object + return window; +} @Injectable({ providedIn: 'root' }) export class BorrowService { - + + get nativeWindow() : any { + return _window(); + } + @@ -27,6 +35,9 @@ handleError(err: HttpErrorResponse): any { this.router.navigateByUrl(`/login`); } } + + + ////////////////////////////////////////////// export(): Observable { return this.http.get('http://localhost:8080/borrow/admin/export', { responseType: 'blob' }); @@ -58,11 +69,28 @@ handleError(err: HttpErrorResponse): any { console.log(date1,' to ',date2) return this.http.get(this.apiurl + "/borrow/admin/"+date1+"/"+date2+"/?pageNo="+page+"&pageSize="+tableSize+"&sortBy="+sort+"&direction="+direction).pipe((catchError(err => this.handleError(err)))) } + // 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) + } + + ////////////// + statusfilterBor(page:any,tableSize:any,sort:any,direction:any,status:any):Observable{ + return this.http.get("http://localhost:8080/borrow/user/statusFilter/?pageNo="+page+"&pageSize="+tableSize+"&sortBy="+sort+"&direction="+direction+"&status="+status) + // return this.http.get(this.apiurl + "/borrow/user/statusFilter?pageNo="+page+"&pageSize="+tableSize+"&sortBy="+sort+"&direction="+direction+"&status="+status) + } + // 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)))); } + //user + LoadByIssueDateUser(date1:any,date2:any){ + return this.http.get(this.apiurl + "/borrow/user/loadByIssueDateUser/"+date1+"/"+date2); + } + Load(){ return this.http.get('http://localhost:8080/borrow').pipe((catchError(err => this.handleError(err)))); } @@ -82,8 +110,9 @@ handleError(err: HttpErrorResponse): any { LoadFine(){ return this.http.get('http://localhost:8080/borrow/admin/fine').pipe((catchError(err => this.handleError(err)))); } + //user LoadDueByUser(){ - return this.http.get('http://localhost:8080/borrow/dueByUser').pipe((catchError(err => this.handleError(err)))); + return this.http.get('http://localhost:8080/borrow/user/dueByUser').pipe((catchError(err => this.handleError(err)))); } @@ -106,6 +135,36 @@ handleError(err: HttpErrorResponse): any { getBorrowID(borrowId:any){ return this.http.get('http://localhost:8080/borrow'+borrowId); } + + + payment(id: any) { + return this.http.put(this.apiurl + "/borrow/user/paymentStatus/" + id,{headers:Headers}); + } + + + + + + + + + + + + + + + + + + + + + + + + + delete(booksId:any):Observable{ let tocken=localStorage.getItem('accesstoken') diff --git a/FrontEnd/Library/src/app/borrowhistory/borrowhistory.component.html b/FrontEnd/Library/src/app/borrowhistory/borrowhistory.component.html index 71875546..5a90ad61 100644 --- a/FrontEnd/Library/src/app/borrowhistory/borrowhistory.component.html +++ b/FrontEnd/Library/src/app/borrowhistory/borrowhistory.component.html @@ -1,38 +1,59 @@ -

-


-

+ +
+ +
+
+
+

Borrow Details

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

Borrow Details

+ +
+ + + + + + + + + + + + -
Book NameIssued DateReturn DateDue date + + + + ReasonDueDaysFine(INR)
- - - - - - - - - - - - - - - - - + + Borrow Details totalItems: count }; "> - - - - - - - - - - - - - -
Book NameIssued DateReturn DateDue dateStatusReasonDueDaysFine(INR)
{{borrow.books.booksName}}{{borrow.issueDate| date:'dd/MM/yyyy'}}{{borrow.returnDate| date:'dd/MM/yyyy'}}{{borrow.dueDate| date:'dd/MM/yyyy'}}{{borrow.status}}{{borrow.reason}}{{borrow.dueDays}}{{borrow.fine}}
- -
- - -
-
-
-
\ No newline at end of file + {{borrow.books.booksName}} + {{borrow.issueDate| date:'dd/MM/yyyy'}} + {{borrow.returnDate| date:'dd/MM/yyyy'}} + {{borrow.dueDate| date:'dd/MM/yyyy'}} + {{borrow.status}} + {{borrow.reason}} + {{borrow.dueDays}} + {{borrow.fine}} + + +
+ + +
\ No newline at end of file diff --git a/FrontEnd/Library/src/app/borrowhistory/borrowhistory.component.ts b/FrontEnd/Library/src/app/borrowhistory/borrowhistory.component.ts index 98465790..004d0726 100644 --- a/FrontEnd/Library/src/app/borrowhistory/borrowhistory.component.ts +++ b/FrontEnd/Library/src/app/borrowhistory/borrowhistory.component.ts @@ -1,4 +1,5 @@ import { Component, OnInit } from '@angular/core'; +import { FormControl, FormGroup, Validators } from '@angular/forms'; import { Sort } from '@angular/material/sort'; import { Router } from '@angular/router'; import { BorrowService } from '../borrow.service'; @@ -11,115 +12,237 @@ import { UserserviceService } from '../userservice.service'; }) export class BorrowhistoryComponent implements OnInit { - + // borrowList: any[]; - borrowId:any; - borrowdata:any; - -//////////////// -data: any; -page:number=1; -count: any; -tableSize: number = 5; -ProdData: any; -sortedData: any; -a:any; -b:any; -searchResult:any -searchData:any -sort:string="borrowId"; -len: any; - constructor(private router:Router , - private service:BorrowService) { - // this.borrowList=[]; - } - - ngOnInit(): void { - // this.Load(); - this.service.LoadUserList().subscribe(result=>{ - this.len=result; + borrowId: any; + borrowdata: any; - // console.log(result) - this.count=this.len.length; - // console.log(this.count) - //this.data=result; - - }) - //this.onTableDataChange(this.page); - - if(this.searchData==null || this.searchData==""){ - this.service.borrowHistoryPagination(this.page,this.tableSize,this.sort).subscribe((result=>{ - this.data=result; - console.log(this.data) - })); - } - else{ - - this.data=this.searchData - } + //////////////// + selected="status"; + result: any; + direction=-1; + status=1; + date: any; + data: any; + page: number = 1; + count: any; + tableSize: number = 5; + ProdData: any; + sortedData: any; + a: any; + b: any; + searchResult: any + searchData: any + sort: string = "status"; + len: any; + flag: number = 0; + selectedGroup: any; + constructor(private router: Router, + private service: BorrowService) { + // this.borrowList=[]; + } + + disp1() { + this.status=1; + console.log('stat-------------------=',this.status) + if(this.filter.controls['status'].value==1){ + console.log('/////------------=',this.status) + this.service.statusfilterBor(this.page,this.tableSize,this.sort,this.direction,1).subscribe(response=>{ + this.result=response.content; + this.count=response.totalElements + console.log(this.result); + this.data=this.result; + }); } - - // Load() { - // this.service.LoadUserList().subscribe((data: any)=>{ - // this.borrowdata=data; - // }); } + else if(this.filter.controls['status'].value==2){ - sortfn(a:any){ - - this.sort=a; - this.page=this.page; - this.tableSize=5; - this.ngOnInit(); - + 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; + }); } - // sortData(sort: Sort) { - // const data1 = this.data.slice(); - // if (!sort.active || sort.direction === '') { - // this.sortedData = data1; - // return; - // } - - // this.sortedData = this.data.sort((a: { userId: string | number; firstName: string | number; }, b: { userId: string | number; firstName: string | number; }) => { - // const isAsc = sort.direction === 'asc'; - // switch (sort.active) { - // case 'userId': - // return compare(a.userId, b.userId, isAsc); - // case 'firstName': - // return compare(a.firstName, b.firstName, isAsc); - - // default: - // return 0; - // } - // }); + 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; + }); + } + 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; + }); + } + else{ + + } + + } + ngOnInit(): void { + // this.Load(); + this.service.LoadUserList().subscribe(result => { + this.len = result; + console.log(this.sort); + console.log(result); - onTableDataChange(event:any) { - - console.log(event) - this.service.borrowHistoryPagination(event,this.tableSize,this.sort).subscribe((result=>{ - this.data=result; - console.log('hey') - }), - ); + // console.log(result) + this.count = this.len.length; + // console.log(this.count) + //this.data=result; + }) + //this.onTableDataChange(this.page); + + if (this.searchData == null || this.searchData == "") { + this.service.borrowHistoryPagination(this.page, this.tableSize, this.sort).subscribe((result => { + this.data = result; + console.log(this.data) + })); } + else { + + this.data = this.searchData + } + } + + // Load() { + // this.service.LoadUserList().subscribe((data: any)=>{ + // this.borrowdata=data; + // }); } + + sortfn(a: any) { + + this.sort = a; + this.page = this.page; + this.tableSize = 5; + this.ngOnInit(); + + } + ObjSampleForm: FormGroup = new FormGroup( + { + date1: new FormControl('', [Validators.required]), + date2: new FormControl('', [Validators.required]), + + } + ) + filter:FormGroup = new FormGroup({ + status:new FormControl('',[Validators.required]) + }) - home() - { - this.router.navigate(['/userbody']) - } - + + // sortData(sort: Sort) { + // const data1 = this.data.slice(); + // if (!sort.active || sort.direction === '') { + // this.sortedData = data1; + // return; + // } + + // this.sortedData = this.data.sort((a: { userId: string | number; firstName: string | number; }, b: { userId: string | number; firstName: string | number; }) => { + // const isAsc = sort.direction === 'asc'; + // switch (sort.active) { + // case 'userId': + // return compare(a.userId, b.userId, isAsc); + // case 'firstName': + // return compare(a.firstName, b.firstName, isAsc); + + // default: + // return 0; + // } + // }); + + + + // } + + + onTableDataChange(event: any) { + + console.log(event) + this.service.borrowHistoryPagination(event, this.tableSize, this.sort).subscribe((result => { + this.data = result; + console.log('hey') + }), + ); + + } + + home() { + this.router.navigate(['/userbody']) + } + // filter starts + getFilter() { + + console.log(this.ObjSampleForm) + // this.page=1 + this.flag = 1; + this.service.LoadByIssueDateUser(this.ObjSampleForm.controls['date1'].value, this.ObjSampleForm.controls['date2'].value).subscribe(result => { + this.len = result; + console.log(result) + this.count = this.len.length; + 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(){ +console.log('display works') + } + clearFilter() { + this.flag = 0; + window.location.reload(); + } + + sortfilter(a: any) { + + this.sort = a; + this.page = this.page; + this.tableSize; + + if (this.flag == 0) { + this.ngOnInit(); + } + + else if (this.flag = 1) { + this.getFilter(); + } + + } + } -// function compare(a: number | string, b: number | string, isAsc: boolean) { -// return (a < b ? -1 : 1) * (isAsc ? 1 : -1); -// } +function compare(a: number | string, b: number | string, isAsc: boolean) { + return (a < b ? -1 : 1) * (isAsc ? 1 : -1); +} - \ 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 a1e11ee2..66c95cf2 100644 --- a/FrontEnd/Library/src/app/findby-category/findby-category.component.html +++ b/FrontEnd/Library/src/app/findby-category/findby-category.component.html @@ -1,109 +1,60 @@ - + -

-


-

- - -
-
- - - - - - - - -
- × - Note! You can select Book by category +
+ +
+ +
+ + +
+
+
- - - - - -


-
- - -
- - - - -
-
- -
-
-
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Book NameCategory-NamePublicationAutherBook CopiesBook CoverAction
{{books.booksName}}{{books.category.categoryName}}{{books.publication}}{{books.auther}}{{books.booksCopies}} - - -
- -
- \ No newline at end of file +
+
+ +
+
NO BOOKS FOUND!!!
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Book NameCategory-NamePublicationAutherBook CopiesBook CoverAction
{{books.booksName}}{{books.category.categoryName}}{{books.publication}}{{books.auther}}{{books.booksCopies}} + + + +
\ No newline at end of file diff --git a/FrontEnd/Library/src/app/homeguard.guard.ts b/FrontEnd/Library/src/app/homeguard.guard.ts index 29dc6b80..e162783e 100644 --- a/FrontEnd/Library/src/app/homeguard.guard.ts +++ b/FrontEnd/Library/src/app/homeguard.guard.ts @@ -11,10 +11,7 @@ export class HomeguardGuard implements CanActivate { constructor(private auth: GuardserviceService , private router: Router) {} - canActivate( route:ActivatedRouteSnapshot , state:RouterStateSnapshot): boolean { - - - + canActivate( route:ActivatedRouteSnapshot , state:RouterStateSnapshot): boolean { if(this.auth.IsLoggedIn()){ return true; diff --git a/FrontEnd/Library/src/app/login/login.component.ts b/FrontEnd/Library/src/app/login/login.component.ts index a2c785ef..9d70f439 100644 --- a/FrontEnd/Library/src/app/login/login.component.ts +++ b/FrontEnd/Library/src/app/login/login.component.ts @@ -44,7 +44,7 @@ export class LoginComponent implements OnInit { 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(['/user-sidenav']) + this.router.navigate(['/sidenav2']) } diff --git a/FrontEnd/Library/src/app/navbar2/navbar2.component.css b/FrontEnd/Library/src/app/navbar2/navbar2.component.css new file mode 100644 index 00000000..a5b47ea5 --- /dev/null +++ b/FrontEnd/Library/src/app/navbar2/navbar2.component.css @@ -0,0 +1,104 @@ +* { + box-sizing: border-box; + } + + body { + margin: 0px; + font-family: 'segoe ui'; + } + + .nav { + margin-top: -1%; + height: 60px; + width: 101%; + background-color: #150242; + position: relative; + padding-left: 50%; + padding-top: 10px; + } + + .nav > .nav-header { + display: inline; + } + + .nav > .nav-header > .nav-title { + display: inline-block; + font-size: 22px; + color: #fff; + padding: 10px 10px 10px 10px; + } + + .nav > .nav-btn { + display: none; + } + + .nav > .nav-links { + display: inline; + float: right; + font-size: 18px; + } + + .nav > .nav-links > a { + display: inline-block; + padding: 13px 10px 13px 10px; + text-decoration: none; + color: #efefef; + } + + .nav > .nav-links > a:hover { + background-color: rgba(0, 0, 0, 0.3); + } + + .nav > #nav-check { + display: none; + } + + @media (max-width:600px) { + .nav > .nav-btn { + display: inline-block; + position: absolute; + right: 0px; + top: 0px; + } + .nav > .nav-btn > label { + display: inline-block; + width: 50px; + height: 50px; + padding: 13px; + } + .nav > .nav-btn > label:hover,.nav #nav-check:checked ~ .nav-btn > label { + background-color: rgba(0, 0, 0, 0.3); + } + .nav > .nav-btn > label > span { + display: block; + width: 25px; + height: 10px; + border-top: 2px solid #eee; + } + .nav > .nav-links { + position: absolute; + display: block; + width: 100%; + background-color: #333; + height: 0px; + transition: all 0.3s ease-in; + overflow-y: hidden; + top: 50px; + left: 0px; + } + .nav > .nav-links > a { + display: block; + width: 100%; + } + .nav > #nav-check:not(:checked) ~ .nav-links { + height: 0px; + } + .nav > #nav-check:checked ~ .nav-links { + height: calc(100vh - 50px); + overflow-y: auto; + } + .nav-title{ + text-align: center; + + } + } \ No newline at end of file diff --git a/FrontEnd/Library/src/app/navbar2/navbar2.component.html b/FrontEnd/Library/src/app/navbar2/navbar2.component.html new file mode 100644 index 00000000..57c5c22a --- /dev/null +++ b/FrontEnd/Library/src/app/navbar2/navbar2.component.html @@ -0,0 +1,24 @@ + + \ No newline at end of file diff --git a/FrontEnd/Library/src/app/navbar2/navbar2.component.spec.ts b/FrontEnd/Library/src/app/navbar2/navbar2.component.spec.ts new file mode 100644 index 00000000..e6823702 --- /dev/null +++ b/FrontEnd/Library/src/app/navbar2/navbar2.component.spec.ts @@ -0,0 +1,23 @@ +import { ComponentFixture, TestBed } from '@angular/core/testing'; + +import { Navbar2Component } from './navbar2.component'; + +describe('Navbar2Component', () => { + let component: Navbar2Component; + let fixture: ComponentFixture; + + beforeEach(async () => { + await TestBed.configureTestingModule({ + declarations: [ Navbar2Component ] + }) + .compileComponents(); + + fixture = TestBed.createComponent(Navbar2Component); + component = fixture.componentInstance; + fixture.detectChanges(); + }); + + it('should create', () => { + expect(component).toBeTruthy(); + }); +}); diff --git a/FrontEnd/Library/src/app/navbar2/navbar2.component.ts b/FrontEnd/Library/src/app/navbar2/navbar2.component.ts new file mode 100644 index 00000000..64419965 --- /dev/null +++ b/FrontEnd/Library/src/app/navbar2/navbar2.component.ts @@ -0,0 +1,15 @@ +import { Component, OnInit } from '@angular/core'; + +@Component({ + selector: 'app-navbar2', + templateUrl: './navbar2.component.html', + styleUrls: ['./navbar2.component.css'] +}) +export class Navbar2Component implements OnInit { + + constructor() { } + + ngOnInit(): void { + } + +} diff --git a/FrontEnd/Library/src/app/notification/notification.component.css b/FrontEnd/Library/src/app/notification/notification.component.css index cfe63df0..2ec9706a 100644 --- a/FrontEnd/Library/src/app/notification/notification.component.css +++ b/FrontEnd/Library/src/app/notification/notification.component.css @@ -78,3 +78,12 @@ th { color: rgb(255, 255, 255); border-radius: 3px; } +mat-grid-tile { + background: white; + color: rgb(39, 54, 104); + + } + button{ + color: white; + background-color: black; + } \ No newline at end of file diff --git a/FrontEnd/Library/src/app/notification/notification.component.html b/FrontEnd/Library/src/app/notification/notification.component.html index 93813290..7143bda0 100644 --- a/FrontEnd/Library/src/app/notification/notification.component.html +++ b/FrontEnd/Library/src/app/notification/notification.component.html @@ -1,120 +1,13 @@ -

-


-

- + - - - - - - - - - -
- × - Warning!Please Return the book on or before due date -
- - - - - -
- - -
- - -
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Book NameIssued DateDue dateStatusDueDaysFine(INR)Note
{{borrow.books.booksName}}{{borrow.issueDate| date:'dd/MM/yyyy'}}{{borrow.dueDate| date:'dd/MM/yyyy'}}{{borrow.status}}{{borrow.dueDays}}{{borrow.fine}}Book due date is Tommorrow
{{return.books.booksName}}{{return.issueDate| date:'dd/MM/yyyy'}}{{return.dueDate| date:'dd/MM/yyyy'}}{{return.status}}{{return.dueDays}}{{return.fine}}Book due date is today
Return book today itself to avoid fine
{{due.books.booksName}}{{due.issueDate| date:'dd/MM/yyyy'}}{{due.dueDate| date:'dd/MM/yyyy'}}{{due.status}}{{due.dueDays}}{{due.fine}}Book due date has Expired
Return book ASAP
- -
-
-
\ No newline at end of file + +

+ 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 5d629bd7..f0c3db42 100644 --- a/FrontEnd/Library/src/app/notification/notification.component.ts +++ b/FrontEnd/Library/src/app/notification/notification.component.ts @@ -1,4 +1,10 @@ -import { Component, OnInit } from '@angular/core'; + +import { BooksService } from './../books.service'; +// import { Borrow } from '././borrow'; +import { BorrowComponent } from '../borrow/borrow.component'; +// import { BorrowComponent } from './borrow/borrow.component'; +import { FineComponent } from './../fine/fine.component'; +import { Component, HostListener, OnInit } from '@angular/core'; import { Router } from '@angular/router'; import { NgToastService } from 'ng-angular-popup'; import { BorrowService } from '../borrow.service'; @@ -9,73 +15,146 @@ import { BorrowService } from '../borrow.service'; styleUrls: ['./notification.component.css'] }) export class NotificationComponent implements OnInit { - - borrowList: any[]; - borrowId:any; - borrowdata:any; - duedata:any; + borrowId: any; + borrowdata: any; + status: any; + duedata: any; returnData: any; - - constructor(private router:Router ,private service:BorrowService,private toast : NgToastService) { - this.borrowList=[]; - } - - ngOnInit(): void { - - this.Load(); - this.DueToday(); - this.DueExpired(); - } - - Load() { - this.service.LoadNotification().subscribe((data: any)=>{ - this.borrowdata=data; + rzp1: any; + borrow: BorrowComponent[] | undefined; + tot: any; + name = localStorage.getItem('name') + email = localStorage.getItem('email') + phone = localStorage.getItem('phone') + displayedColumns: any; + constructor(private router: Router, private service: BorrowService, private toast: NgToastService) { + this.borrowList = []; + } + + ngOnInit(): void { + + this.Load(); + this.DueToday(); + this.DueExpired(); + } + + Load() { + this.service.LoadNotification().subscribe((data: any) => { + this.borrowdata = data; - if(data[0].borrowId!=null){ - this.toast.success({detail:'REMAINDER',summary:'Watchout the due date :)',duration:5000}); + if (data[0].borrowId != null) { + this.toast.success({ detail: 'REMAINDER', summary: 'Watchout the due date :)', duration: 5000 }); } - else{ - this.toast.success({detail:'REMAINDER',summary:'Nothing here :)',duration:5000}); + else { + this.toast.success({ detail: 'REMAINDER', summary: 'Nothing here :)', duration: 5000 }); } - if(data[0].borrowId==null){ - this.toast.success({detail:'REMAINDER',summary:'Nothing here :)',duration:5000}); + if (data[0].borrowId == null) { + this.toast.success({ detail: 'REMAINDER', summary: 'Nothing here :)', duration: 5000 }); } - // if(data=[]) - // {alert("nothing here") - // // this.router.navigate(['/userbody']) - // } - console.log("<1") + // if(data=[]) + // {alert("nothing here") + // // this.router.navigate(['/userbody']) + // } + console.log("<1") console.log(data) - }); - } - - - DueExpired() { - this.service.LoadDueByUser().subscribe((data: any)=>{ - // if(data=[]){alert("nothing here") - // // this.router.navigate(['/userbody']) - // } - this.duedata=data; - console.log(">1") - console.log(data); - }); - } - - DueToday(){ - // this.service.LoadUserNotification().subscribe((data: any)=>{ - // this.returnData=data; - // console.log("=1") - // console.log(data); - // }); + }); + } + + DueExpired() { + this.service.LoadDueByUser().subscribe((data: any) => { + this.duedata = data; + console.log(">1") + console.log("due",data); + }); + } + + DueToday() { + // this.service.LoadUserNotification().subscribe((data: any)=>{ + // this.returnData=data; + // console.log("=1") + // console.log(data); + // }); + } + + home() { + this.router.navigate(['/userbody']) + } + // payment + options = { + "key": "rzp_test_7z2YIWtTzdWzRh", // Enter the Key ID generated from the Dashboard + "amount": "", // Amount is in currency subunits. Default currency is INR. Hence, 50000 refers to 50000 paise + "currency": "INR", + "name": "", + "description": "Test Transaction", + "image": "../assets/BooksImage/item_pics/item_pics/sherlok.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) { + var event = new CustomEvent("payment.success", + { + detail: response, + bubbles: true, + cancelable: true + } + ); + window.dispatchEvent(event); + }, + "prefill": { + "name": this.name, + "email": this.email, + "contact": this.phone + }, + "notes": { + "address": "Razorpay Corporate Office" + }, + "theme": { + "color": "#3399cc" } + }; + pay(fine: number, bookname: string) { + console.log(fine) + this.tot = fine * 100; + this.options.amount = this.tot; + this.options.name = bookname; + this.service.LoadDueByUser().subscribe((data: any) => { + this.duedata = data; + this.borrow = data; + console.log(this.duedata.fine) + console.log(">1") + console.log(data); + }); + this.rzp1 = new this.service.nativeWindow.Razorpay(this.options); + this.rzp1.open(); + this.rzp1.on('payment.failed', function (response: any) { - home() - { - this.router.navigate(['/userbody']) + // this.message ="Payment Failed" + + console.log(response.console.error.code); + } + ); + } + @HostListener('window:payment.success', ['$event']) + onPaymentSuccess(event: any): void { + this.status == 1; + + + console.log(this.duedata[0].borrowId) + this.service.payment(this.duedata[0].borrowId).subscribe({ + next: (Response: any) => { + console.log(Response); + alert("Payment Success") + // window.location.reload() + }, + error: (Response: any) => { + console.log(Response) + alert("invalid Payment details") } - + }) + + + } - \ No newline at end of file +} \ No newline at end of file diff --git a/FrontEnd/Library/src/app/sidenav2/sidenav2.component.css b/FrontEnd/Library/src/app/sidenav2/sidenav2.component.css new file mode 100644 index 00000000..811fd075 --- /dev/null +++ b/FrontEnd/Library/src/app/sidenav2/sidenav2.component.css @@ -0,0 +1,123 @@ +@import url(//netdna.bootstrapcdn.com/font-awesome/4.0.3/css/font-awesome.css); +@import url(https://fonts.googleapis.com/css?family=Titillium+Web:300); +.fa-2x { +font-size: 2em; +} +.fa { +position: relative; +display: table-cell; +width: 60px; +height: 36px; +text-align: center; +vertical-align: middle; +font-size:20px; +} + +.main-menu:hover,nav.main-menu.expanded { +width:250px; +overflow:visible; +} + +.main-menu { +background:#150242; +border-right:1px solid #030303; +position:absolute; +top:0; +bottom:0; +height:100%; +left:0; +width:60px; +overflow:auto; +-webkit-transition:width .05s linear; +transition:width .05s linear; +-webkit-transform:translateZ(0) scale(1,1); +z-index:1000; +} + +.main-menu>ul { +margin:7px 0; +} +body{height: 0vh; +background-color: #030303; +} +.main-menu li { +position:relative; +display:block; +width:250px; +} + +.main-menu li>a { +position:relative; +display:table; +border-collapse:collapse; +border-spacing:0; +color:rgb(237, 248, 244); + font-family: arial; +font-size: 14px; +text-decoration:none; +-webkit-transform:translateZ(0) scale(1,1); +-webkit-transition:all .1s linear; +transition:all .1s linear; + +} + +.main-menu .nav-icon { +position:relative; +display:table-cell; +width:60px; +height:36px; +text-align:center; +vertical-align:middle; +font-size:18px; +} + +.main-menu .nav-text { +position:relative; +display:table-cell; +vertical-align:middle; +width:190px; + font-family: 'Titillium Web', sans-serif; +} + +.main-menu>ul.logout { +position:absolute; +left:0; +bottom:0; +} + +.no-touch .scrollable.hover { +overflow-y:hidden; +} + +.no-touch .scrollable.hover:hover { +overflow-y:auto; +overflow:visible; +} + +a:hover,a:focus { +text-decoration:none; +} + +nav { +-webkit-user-select:none; +-moz-user-select:none; +-ms-user-select:none; +-o-user-select:none; +user-select:none; +} + +nav ul,nav li { +outline:0; +margin:0; +padding:0; +} +.main-menu li:hover>a,nav.main-menu li.active>a,.dropdown-menu>li>a:hover,.dropdown-menu>li>a:focus,.dropdown-menu>.active>a,.dropdown-menu>.active>a:hover,.dropdown-menu>.active>a:focus,.no-touch .dashboard-page nav.dashboard-menu ul li:hover a,.dashboard-page nav.dashboard-menu ul li.active a { +color:rgb(243, 234, 234); +background-color:#565985; +} +@font-face { + font-family: 'Titillium Web'; + font-style: normal; + font-weight: 300; + src: local('Titillium WebLight'), local('TitilliumWeb-Light'), url(http://themes.googleusercontent.com/static/fonts/titilliumweb/v2/anMUvcNT0H1YN4FII8wpr24bNCNEoFTpS2BTjF6FB5E.woff) format('woff'); +} diff --git a/FrontEnd/Library/src/app/sidenav2/sidenav2.component.html b/FrontEnd/Library/src/app/sidenav2/sidenav2.component.html new file mode 100644 index 00000000..36d449b9 --- /dev/null +++ b/FrontEnd/Library/src/app/sidenav2/sidenav2.component.html @@ -0,0 +1,73 @@ + + + + +
+ \ No newline at end of file diff --git a/FrontEnd/Library/src/app/sidenav2/sidenav2.component.spec.ts b/FrontEnd/Library/src/app/sidenav2/sidenav2.component.spec.ts new file mode 100644 index 00000000..d27fe47c --- /dev/null +++ b/FrontEnd/Library/src/app/sidenav2/sidenav2.component.spec.ts @@ -0,0 +1,23 @@ +import { ComponentFixture, TestBed } from '@angular/core/testing'; + +import { Sidenav2Component } from './sidenav2.component'; + +describe('Sidenav2Component', () => { + let component: Sidenav2Component; + let fixture: ComponentFixture; + + beforeEach(async () => { + await TestBed.configureTestingModule({ + declarations: [ Sidenav2Component ] + }) + .compileComponents(); + + fixture = TestBed.createComponent(Sidenav2Component); + component = fixture.componentInstance; + fixture.detectChanges(); + }); + + it('should create', () => { + expect(component).toBeTruthy(); + }); +}); diff --git a/FrontEnd/Library/src/app/sidenav2/sidenav2.component.ts b/FrontEnd/Library/src/app/sidenav2/sidenav2.component.ts new file mode 100644 index 00000000..73277aac --- /dev/null +++ b/FrontEnd/Library/src/app/sidenav2/sidenav2.component.ts @@ -0,0 +1,25 @@ +import { Component, OnInit } from '@angular/core'; +import { Router } from '@angular/router'; + +@Component({ + selector: 'app-sidenav2', + templateUrl: './sidenav2.component.html', + styleUrls: ['./sidenav2.component.css'] +}) +export class Sidenav2Component implements OnInit { + + constructor(private router:Router) { } + + ngOnInit(): void { + } +logout(){ + if (confirm('Are you sure want to Logout?')) { + localStorage.clear(); + localStorage.removeItem('token'); + this.router.navigate(['/login']) + } else { + + this.router.navigate(['/sidenav2']) + } + } +} diff --git a/FrontEnd/Library/src/app/view-profile/view-profile.component.css b/FrontEnd/Library/src/app/view-profile/view-profile.component.css index a6539a64..e92a712c 100644 --- a/FrontEnd/Library/src/app/view-profile/view-profile.component.css +++ b/FrontEnd/Library/src/app/view-profile/view-profile.component.css @@ -1,72 +1,214 @@ -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; - -} - -/* .text-danger1{ - - width: 160%; - padding: 8px 6px; - margin: 0px; +* { + -webkit-box-sizing: border-box; + -moz-box-sizing: border-box; box-sizing: border-box; - border: 1px ; - background-color: #a7bdb08f; - color: rgb(0, 0, 0); - border-radius: 7px; + } + body { + font-family: 'Dosis', sans-serif; + background: #c5cae9; + text-align: center; + } + .clear { + clear: both; + } + /*** CARD STLES ***/ + .cards-container { + width: 100%; + height: 100%; + place-items: center; + display: grid; + } + .card { + float: left; + margin: 3rem; + } + .card-one { + + position: relative; + width: 300px; + background: rgb(44, 49, 85); -} */ -/* .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: 3px solid; -} -th { - background-color: #ffffff; - color: white; - width: 5%; + box-shadow: 0 10px 7px -5px rgba(0, 0, 0, .4); + } + .card-one header { + + position: relative; + width: 100%; + height: 60px; + background-color: #c8c; + } + .card-one header::before, .card-one header::after { + content: ''; + position: absolute; + top: 0; + bottom: 0; + left: 0; + right: 0; + background: inherit; + } + .card-one header::before { + -webkit-transform: skewY(-8deg); + -moz-transform: skewY(-8deg); + -ms-transform: skewY(-8deg); + -o-transform: skewY(-8deg); + transform: skewY(-8deg); + -webkit-transform-origin: 100% 100%; + -moz-transform-origin: 100% 100%; + -ms-transform-origin: 100% 100%; + -o-transform-origin: 100% 100%; + transform-origin: 100% 100%; + } + .card-one header::after { + -webkit-transform: skewY(8deg); + -moz-transform: skewY(8deg); + -ms-transform: skewY(8deg); + -o-transform: skewY(8deg); + transform: skewY(8deg); + -webkit-transform-origin: 0 100%; + -moz-transform-origin: 0 100%; + -ms-transform-origin: 0 100%; + -o-transform-origin: 0 100%; + transform-origin: 0 100%; + } + .card-one header .avatar { + position: absolute; + left: 50%; + top: 30px; + margin-left: -50px; + z-index: 5; + width: 100px; + height: 100px; + border-radius: 50%; + overflow: hidden; + background: rgb(204, 204, 204); + border: 3px solid #fff; + } + .card-one header .avatar img { + position: absolute; + top: 50%; + left: 50%; + -webkit-transform: translate(-50%, -50%); + -moz-transform: translate(-50%, -50%); + -ms-transform: translate(-50%, -50%); + -o-transform: translate(-50%, -50%); + transform: translate(-50%, -50%); + width: 100px; + height: auto; + } + .card-one h3 { + position: relative; + margin: 80px 0 30px; text-align: center; - padding: 12px; - } - td { - /* border-color: rgb(22, 133, 133); - background-color: #a7bdb08f; */ - color: rgb(0, 0, 0); - width: 220px; - /* text-align: center; */ - /* margin-top: auto; */ - /* padding: auto; */ - padding: 8px; + color: rgb(252, 249, 249); } - - - /* .btnAction{ - border: none; - padding: 1px; - background: rgb(0, 0, 0); - font-size: 13px; - font-style: italic ; - color: rgb(255, 255, 255); - border-radius: 3px; -} */ + .card-one h3::after { + content: ''; + position: absolute; + bottom: -15px; + left: 50%; + margin-left: -15px; + width: 30px; + height: 1px; + background: rgb(235, 227, 227); + } + .card-one .desc { + padding: 0 1rem 2rem; + text-align: center; + line-height: 1.5; + color: rgb(237, 237, 245); + } + .card-one .contacts { + width: 200px; + max-width: 100%; + margin: 0 auto 3rem; + } + .card-one .contacts a { + display: block; + width: 33.333333%; + float: left; + text-align: center; + color: #c8c; + } + .card-one .contacts a:hover { + color: #333; + } + .card-one .contacts a:hover .fa::before { + color: #fff; + } + .card-one .contacts a:hover .fa::after { + width: 100%; + height: 100%; + } + .card-one .contacts a .fa { + position: relative; + width: 40px; + height: 40px; + line-height: 39px; + overflow: hidden; + text-align: center; + font-size: 1.3em; + } + .card-one .contacts a .fa:before { + position: relative; + z-index: 1; + } + .card-one .contacts a .fa::after { + + content: ''; + position: absolute; + top: 50%; + left: 50%; + width: 0; + height: 0; + -webkit-transform: translate(-50%, -50%); + -moz-transform: translate(-50%, -50%); + -ms-transform: translate(-50%, -50%); + -o-transform: translate(-50%, -50%); + transform: translate(-50%, -50%); + background: #c8c; + -webkit-transition: width 0.3s, height 0.3s; + -moz-transition: width 0.3s, height 0.3s; + -ms-transition: width 0.3s, height 0.3s; + -o-transition: width 0.3s, height 0.3s; + transition: width 0.3s, height 0.3s; + } + .card-one .contacts a:last-of-type .fa { + line-height: 36px; + } + .card-one footer { + position: relative; + padding: 1rem; + background-color: #6573d0; + text-align: center; + } + .card-one footer a { + padding: 0 1rem; + color: #e2e2e2; + -webkit-transition: color 0.4s; + -moz-transition: color 0.4s; + -ms-transition: color 0.4s; + -o-transition: color 0.4s; + transition: color 0.4s; + } + .card-one footer a:hover { + color: #c8c; + } + .card-one footer::before { + content: ''; + position: absolute; + top: -27px; + left: 50%; + margin-left: -15px; + border: 15px solid transparent; + border-bottom-color: #6573d0; + } + /*** RESPONSIVE ***/ + @media only screen and (max-width: 810px) { + .card { + float: none; + margin-left: auto; + margin-right: auto; + } + } + \ No newline at end of file diff --git a/FrontEnd/Library/src/app/view-profile/view-profile.component.html b/FrontEnd/Library/src/app/view-profile/view-profile.component.html index a43d3c0b..ffc08da6 100644 --- a/FrontEnd/Library/src/app/view-profile/view-profile.component.html +++ b/FrontEnd/Library/src/app/view-profile/view-profile.component.html @@ -1,69 +1,27 @@ -

-


-

- - -
- - -
- - -
-

-

PROFILE

- - - - - - - - - - - - - - - - - - - - - - - - - - - -
NAME {{userdata[0].firstName}} {{userdata[0].lastName}}
ADDRESS {{userdata[0].address}}
PHONE {{userdata[0].phone}}
EMAIL {{userdata[0].email}}
CREATED DATE {{userdata[0].createDate| date:'dd/MM/yyyy'}}
UPDATE DATE {{userdata[0].updateDate| date:'dd/MM/yyyy'}}
- -
-
-
\ No newline at end of file + + +
+
+

{{userdata[0].firstName}} {{userdata[0].lastName}}

+
+ ID : {{userdata[0].userId}} + +
+
+ ADDRESS : {{userdata[0].address}}
+ PHONE: {{userdata[0].phone}} + +
+ +
+ {{userdata[0].email}}
+ DOB : {{userdata[0].dob| date:'dd/MM/yyyy'}} +
+
+ CREATED DATE : {{userdata[0].createDate| date:'dd/MM/yyyy'}}

+ UPDATE DATE :{{userdata[0].updateDate| date:'dd/MM/yyyy'}} +
+ \ No newline at end of file diff --git a/FrontEnd/Library/src/index.html b/FrontEnd/Library/src/index.html index 8636c8ab..0ed63bdc 100644 --- a/FrontEnd/Library/src/index.html +++ b/FrontEnd/Library/src/index.html @@ -27,6 +27,7 @@ +