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 26e13a3b..e95fd05c 100644 --- a/BackEnd/Library/src/main/java/com/innovature/Library/controller/BooksController.java +++ b/BackEnd/Library/src/main/java/com/innovature/Library/controller/BooksController.java @@ -1,8 +1,11 @@ package com.innovature.Library.controller; + import java.io.IOException; import java.util.Collection; import java.util.List; + import javax.validation.Valid; + import org.springframework.http.HttpHeaders; import org.springframework.http.HttpStatus; import org.springframework.beans.factory.annotation.Autowired; @@ -20,6 +23,7 @@ import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RestController; import org.springframework.web.multipart.MultipartFile; + import com.innovature.Library.entity.Books; import com.innovature.Library.form.BooksForm; import com.innovature.Library.repository.BooksRepository; @@ -27,6 +31,7 @@ import com.innovature.Library.util.FileUtil; import com.innovature.Library.view.BooksDetailView; + @RestController @RequestMapping("/books") public class BooksController { @@ -37,6 +42,8 @@ public class BooksController { @Autowired private BooksRepository booksRepository; + + @PostMapping public BooksDetailView add(@Valid @RequestBody BooksForm form) { return service.add(form); @@ -53,6 +60,7 @@ public Collection listByCategory( { return service.listByCategory(categoryId); } + @GetMapping("/{booksId}") public BooksDetailView list( @@ -62,6 +70,7 @@ public BooksDetailView list( return service.list(booksId); } + @DeleteMapping("/{booksId}") public void deletes( @PathVariable("booksId") Integer booksId) { @@ -76,6 +85,8 @@ public BooksDetailView update( return service.updates(booksId, form); } + + @GetMapping("admin/pagenated/") public ResponseEntity>getAllBooks( @RequestParam(defaultValue = "1") Integer pageNo, diff --git a/BackEnd/Library/src/main/java/com/innovature/Library/controller/BorrowController.java b/BackEnd/Library/src/main/java/com/innovature/Library/controller/BorrowController.java index e09244d2..e5720e06 100644 --- a/BackEnd/Library/src/main/java/com/innovature/Library/controller/BorrowController.java +++ b/BackEnd/Library/src/main/java/com/innovature/Library/controller/BorrowController.java @@ -23,9 +23,14 @@ 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; @@ -64,8 +69,27 @@ public Collection list() { return new ResponseEntity>(list,new HttpHeaders(), HttpStatus.OK); + + + } + + @GetMapping("/admin/statusFilter/") + public ResponseEntity>getAllBorrowByStatus( + @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); + + + } + //BORROW @ADMIN //pagenated borrow list at admin VIEW borrow single api @GetMapping("/admin/pagenated/") @@ -99,8 +123,13 @@ public Collection list() { } + + + + + //load results of issuedate filter at User BorrowHistory -@GetMapping("/user/loadByIssueDate/{date1}/{date2}") +@GetMapping("user/loadByIssueDate/{date1}/{date2}") public ResponseEntity> loadByIssueDateUser( @PathVariable("date1") Date date1, @PathVariable("date2") Date date2) @@ -124,6 +153,11 @@ public ResponseEntity> loadByIssueDateUser( HttpStatus.OK); } + + + + + @PostMapping public BorrowDetailView add(@Valid @RequestBody BorrowForm form) { return bService.add(form); @@ -143,6 +177,7 @@ public Collection listUserNotification(Principal p) { return bService.listNotification(); } + @GetMapping("user/due") public Collection listDue() { @@ -150,6 +185,20 @@ public Collection listDue() { } + @GetMapping("/admin/fine/") +public ResponseEntity>listfine( + @RequestParam(defaultValue = "1") Integer pageNo, + @RequestParam(defaultValue = "5") Integer pageSize, + @RequestParam(defaultValue = "borrowId") String sortBy, + @RequestParam(defaultValue = "1") Integer direction) +{ + Page list = bService.getAllFine(pageNo-1, pageSize, sortBy,direction); + return new ResponseEntity>(list,new HttpHeaders(), + HttpStatus.OK); + +} + + @GetMapping("admin/fine") public Collection listfine() { return bService.fine(); @@ -222,7 +271,7 @@ public BorrowDetailView undo( - +//chart @GetMapping("/admin/chart") public rentChartView getchart(){ rentChartView test =borrowServices.getChart(); 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 54745ee9..bfdea767 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 @@ -1,7 +1,10 @@ package com.innovature.Library.controller; + import java.util.Random; +import java.time.LocalTime; + import org.springframework.beans.factory.annotation.Autowired; import org.springframework.http.HttpStatus; import org.springframework.http.ResponseEntity; @@ -11,21 +14,17 @@ import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; - import com.innovature.Library.form.EmailForm; import com.innovature.Library.form.OtpForm; import com.innovature.Library.repository.EmailRepository; import com.innovature.Library.service.BorrowService; import com.innovature.Library.service.EmailService; - - import com.innovature.Library.entity.Email; import com.innovature.Library.entity.User; import com.innovature.Library.repository.UserRepository; -// tgsrhyrsrthr @RestController @RequestMapping("/email") public class EmailController { @@ -58,43 +57,138 @@ public String sendMail(@PathVariable("userId") Integer userId) { @PostMapping("/emailsentotp") - public ResponseEntitysendOtpEmail(@RequestBody EmailForm form){ + public ResponseEntity sendOtpEmail(@RequestBody EmailForm form){ + String emailid=form.getSentto(); + if("".equals(emailid) ){ + return ResponseEntity.status(HttpStatus.NOT_ACCEPTABLE).body("NULL VALUE EXCEPTION-"); + } + else{ User user=userRepository.findByEmailId(form.getSentto()); if(user!=null){ - emailRepository.deleteAll(); + Random random = new Random(); int otp = 100000 + random.nextInt(900000); Email otp2= new Email(); otp2.setOtp(otp); - otp2.setEmail(form.getSentto()); + otp2.setEmail(form.getSentto()); + + LocalTime myObj = LocalTime.now(); + LocalTime exp=myObj; + otp2.setExpiry(exp); - emailRepository.save(otp2); + var email=form.getSentto(); + Email email2= emailRepository.findByEmail(email); + + if(email2!=null){ + email2.setOtp(otp); + email2.setExpiry(exp); + emailRepository.save(email2); + } + else + emailRepository.save(otp2); + boolean result = this.emailService.sendEmail("OTP Verification","Your OTP to change your password is \t"+ otp +"\tuse it to create a new password.", form.getSentto()); // "OTP Verification", "Your OTP to change your password is "+"otp"+"use it to create a new password." if(result){ return new ResponseEntity(null,HttpStatus.ACCEPTED); } else{ - return new ResponseEntity(null,HttpStatus.BAD_REQUEST); + return new ResponseEntity(null,HttpStatus.EXPECTATION_FAILED); } } else{ - return new ResponseEntity(null,HttpStatus.NOT_ACCEPTABLE); + return new ResponseEntity(null,HttpStatus.BAD_REQUEST); } + } + } + @PostMapping("verify") + public ResponseEntity add(@RequestBody OtpForm form){ + var otp=form.getOtp(); + if(otp==null){ + return ResponseEntity.status(HttpStatus.BAD_REQUEST).body("NULL VALUE EXCEPTION"); + } + else{ + ResponseEntity result = emailService.add(form); - @PostMapping("verify") - public boolean add(@RequestBody OtpForm form){ + if(result.getStatusCodeValue()==202){ + return new ResponseEntity(HttpStatus.ACCEPTED); + + } + else if(result.getStatusCodeValue()==504){ + return ResponseEntity.status(HttpStatus.GATEWAY_TIMEOUT).body("OTP EXPIRED"); + } + + else + return ResponseEntity.status(HttpStatus.NOT_ACCEPTABLE).body("OTP VERIFICATION FAILED"); + } + } + + + // @PostMapping("verify") + // public ResponseEntity add(@RequestBody OtpForm form){ + // var otp=form.getOtp(); + // if(otp==null){ + // return ResponseEntity.status(HttpStatus.BAD_REQUEST).body("NULL VALUE EXCEPTION"); + // } + // else{ - return emailService.add(form); + // boolean result = emailService.add(form); + // if(result) + // { + // return new ResponseEntity(null,HttpStatus.ACCEPTED); + // // return new ResponseEntity.status(HttpStatus.ACCEPTED).body("OTP VERIFICATION SUCCESS"); + // } + // else + // { + // // return new ResponseEntity(null,HttpStatus.BAD_REQUEST); + + // return ResponseEntity.status(HttpStatus.NOT_ACCEPTABLE).body("OTP VERIFICATION FAILED"); + // } + // } + // } + + + + @PostMapping("verifyPassword") + public ResponseEntity addPassword(@RequestBody OtpForm form){ + + var psd=form.getNewPassword(); + var npsd=form.getCnewPassword(); + + if(psd==null || npsd==null){ + return ResponseEntity.status(HttpStatus.BAD_REQUEST).body("NULL VALUE EXCEPTION"); + } + else if(!psd.equals(npsd) ){ + return ResponseEntity.status(HttpStatus.BAD_GATEWAY).body("PASSWORD MISSMATCH"); + } + else{ + + boolean result = emailService.addPassword(form); + if(result) + { + return new ResponseEntity(null,HttpStatus.ACCEPTED); + } + else + { + // return new ResponseEntity(null,HttpStatus.BAD_REQUEST); + return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body("PASSWORD CHANGE FAILED"); + } +} + + + + + + } diff --git a/BackEnd/Library/src/main/java/com/innovature/Library/controller/UsersController.java b/BackEnd/Library/src/main/java/com/innovature/Library/controller/UsersController.java index f5f8aba8..4c34a15c 100644 --- a/BackEnd/Library/src/main/java/com/innovature/Library/controller/UsersController.java +++ b/BackEnd/Library/src/main/java/com/innovature/Library/controller/UsersController.java @@ -1,8 +1,4 @@ -/* - * To change this license header, choose License Headers in Project Properties. - * To change this template file, choose Tools | Templates - * and open the template in the editor. - */ + package com.innovature.Library.controller; import java.security.Principal; @@ -13,29 +9,22 @@ import org.springframework.http.HttpStatus; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.data.domain.Page; -import org.springframework.http.HttpEntity; import org.springframework.http.ResponseEntity; -import org.springframework.util.StringUtils; + 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.springframework.web.multipart.MultipartFile; -// import java.util.Collection; import javax.validation.Valid; 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.RequestBody; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RestController; + import com.innovature.Library.entity.User; -// import com.innovature.Library.entity.User; import com.innovature.Library.form.UserForm; import com.innovature.Library.security.util.SecurityUtil; import com.innovature.Library.service.UserService; @@ -91,11 +80,6 @@ public void deletes( userService.deletes(userId); } - // @GetMapping("/{userId}") - // public void deletes( - // @PathVariable("userId") Integer userId) { - // userService.deletes(userId); - // } @GetMapping("/admin/{userId}") 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 2c44b3df..efb4ee23 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 @@ -21,52 +21,47 @@ import org.springframework.web.multipart.MultipartFile; import com.innovature.Library.entity.csvUpload; + public class csvHelper { - csvUpload Csv; - public static String TYPE="text/csv"; - static String[] HEADERs={"books_name","publications","books_author","booksCopies","categoryId","status"}; + public static String TYPE = "text/csv"; + static String[] HEADERs = { "books_name", "publications", "books_author", "booksCopies", "categoryId", "status" }; - public static boolean hasCSVFormat(MultipartFile file){ + public static boolean hasCSVFormat(MultipartFile file) { System.out.println(file.getContentType()); - if(TYPE.equals(file.getContentType())||file.getContentType().equals("application/vnd.ms-excel")){ + if (TYPE.equals(file.getContentType()) || file.getContentType().equals("application/vnd.ms-excel")) { return true; } return false; } - public static ListcsvToDb(InputStream is){ - try(BufferedReader fileReader=new BufferedReader(new InputStreamReader(is,"UTF-8")); - CSVParser csvParser = new CSVParser(fileReader, - CSVFormat.DEFAULT.withFirstRecordAsHeader().withIgnoreHeaderCase().withTrim());) { - ListcsvList=new ArrayList<>(); - Iterable csvRecords=csvParser.getRecords(); - for(CSVRecord csvRecord:csvRecords){ - csvUpload csvob=new csvUpload( - csvRecord.get("booksName"), - csvRecord.get("publication"), - csvRecord.get("booksAuther"), - Integer.parseInt(csvRecord.get("booksCopies")), - Integer.parseInt(csvRecord.get("categoryId")), - Integer.parseInt(csvRecord.get("status")) - //csvRecord.get("image") - + public static List csvToDb(InputStream is) { + try (BufferedReader fileReader = new BufferedReader(new InputStreamReader(is, "UTF-8")); + CSVParser csvParser = new CSVParser(fileReader, + CSVFormat.DEFAULT.withFirstRecordAsHeader().withIgnoreHeaderCase().withTrim());) { + List csvList = new ArrayList<>(); + Iterable csvRecords = csvParser.getRecords(); + for (CSVRecord csvRecord : csvRecords) { + csvUpload csvob = new csvUpload( + csvRecord.get("booksName"), + csvRecord.get("publication"), + csvRecord.get("booksAuther"), + Integer.parseInt(csvRecord.get("booksCopies")), + Integer.parseInt(csvRecord.get("categoryId")), + Integer.parseInt(csvRecord.get("status")) + // csvRecord.get("image") ); csvList.add(csvob); } return csvList; - - }catch(IOException e){ - throw new RuntimeException("fail to parse csv file"+e.getMessage()); - } - -} - -} + } catch (IOException e) { + throw new RuntimeException("fail to parse csv file" + e.getMessage()); + } - + } +} diff --git a/BackEnd/Library/src/main/java/com/innovature/Library/entity/Books.java b/BackEnd/Library/src/main/java/com/innovature/Library/entity/Books.java index b27ffb6b..e9d8632a 100644 --- a/BackEnd/Library/src/main/java/com/innovature/Library/entity/Books.java +++ b/BackEnd/Library/src/main/java/com/innovature/Library/entity/Books.java @@ -31,6 +31,7 @@ private Status(byte value) { private String booksName; private String publication; private String auther; + // private String status; private Integer booksCopies; @ManyToOne(optional = false, fetch = FetchType.EAGER) private Category category; @@ -44,13 +45,14 @@ public Books(Integer booksId){ this.booksId=booksId; } + public Books(BooksForm form,Category category){ this.booksName=form.getBooksName(); this.publication= form.getPublication(); this.auther = form.getAuther(); this.booksCopies= form.getBooksCopies(); this.category = category; - + //this.categoryName = new Category(Category); } @@ -61,6 +63,8 @@ public String getPhotosImagePath() { return "/items - photos/" + booksId + image; } + + public Integer getBooksId() { return booksId; } @@ -109,6 +113,8 @@ public void setCategory(Category category) { this.category = category; } + + public String getImage() { return image; } @@ -125,10 +131,114 @@ public Books(int booksId, String booksName,String publication,String auther,Stri this.booksName = booksName; this.publication = publication; this.auther = auther; - + //this.status = status; this.booksCopies = booksCopies; this.category = category; } + + + + + + + + + + + + + + + + + + + +// public Integer getBooksId() { +// return booksId; +// } +// public void setBooks(Integer booksId) { +// this.booksId = booksId; +// } + + +// ////////////category////////////////// + + + + +// // public String getCategoryName() { +// // return categoryName; +// // } + +// ////////////////////////////////// + + + +// public String getBooksName() { +// return booksName; +// } + +// public void setBooksId(Integer booksId) { +// this.booksId = booksId; +// } + +// public Category getCategory() { +// return category; +// } + +// public void setCategory(Category category) { +// this.category = category; +// } + +// public void setBooksName(String booksName) { +// this.booksName = booksName; +// } + +// public String getPublication() { +// return publication; +// } + +// public void setPublication(String publication) { +// this.publication = publication; +// } + +// public String getAuther() { +// return auther; +// } + +// public void setAuther(String auther) { +// this.auther = auther; +// } +// // public String getStatus() { +// // return status; +// // } + +// // public void setStatus(String status) { +// // this.status = status; +// // } +// public String getBooksCopies() { +// return booksCopies; +// } + +// public void setBooksCopies(String bookscopies) { +// this.booksCopies = bookscopies; +// } + +// public String getBooksName(int booksId2) { +// return null; +// } + + + + + + + + + + + } diff --git a/BackEnd/Library/src/main/java/com/innovature/Library/entity/Email.java b/BackEnd/Library/src/main/java/com/innovature/Library/entity/Email.java index 47eb0356..c9fb5432 100644 --- a/BackEnd/Library/src/main/java/com/innovature/Library/entity/Email.java +++ b/BackEnd/Library/src/main/java/com/innovature/Library/entity/Email.java @@ -3,6 +3,8 @@ import javax.persistence.GeneratedValue; import javax.persistence.GenerationType; import javax.persistence.Id; +import java.time.LocalTime; + @Entity public class Email { @@ -13,11 +15,13 @@ public class Email { @GeneratedValue(strategy = GenerationType.IDENTITY) private Integer otpId; - + private String email; private Integer otp; + private LocalTime expiry; + public String getEmail() { return email; @@ -37,6 +41,12 @@ public Integer getOtp() { public void setOtp(Integer otp) { this.otp = otp; } + public LocalTime getExpiry() { + return expiry; + } + public void setExpiry(LocalTime expiry) { + this.expiry = expiry; + } diff --git a/BackEnd/Library/src/main/java/com/innovature/Library/entity/csvUpload.java b/BackEnd/Library/src/main/java/com/innovature/Library/entity/csvUpload.java index aaa7bdbd..28bc9d55 100644 --- a/BackEnd/Library/src/main/java/com/innovature/Library/entity/csvUpload.java +++ b/BackEnd/Library/src/main/java/com/innovature/Library/entity/csvUpload.java @@ -1,5 +1,4 @@ package com.innovature.Library.entity; -import java.util.Date; import javax.persistence.Column; import javax.persistence.Entity; @@ -7,161 +6,116 @@ import javax.persistence.GeneratedValue; import javax.persistence.Id; import javax.persistence.Table; -import javax.persistence.Temporal; -import javax.persistence.TemporalType; - @Entity -@Table(name="books") - +@Table(name = "books") -public class csvUpload { public static enum Status { - INACTIVE((byte) 0), - ACTIVE((byte) 1); +public class csvUpload { + public static enum Status { + INACTIVE((byte) 0), + ACTIVE((byte) 1); - public final byte value; + public final byte value; - private Status(byte value) { - this.value = value; + private Status(byte value) { + this.value = value; + } } -} -// @Id -// @GeneratedValue(strategy = GenerationType.IDENTITY) -// @Column(name="book_id") -// private Long booksId; - - -@Id -@GeneratedValue(strategy = GenerationType.IDENTITY) -@Column(name="books_id") -private Integer booksId; - -@Column(name="books_name") -private String booksName; - -@Column(name="auther") -private String booksAuther; - -@Column(name="books_copies") -private Integer booksCopies; - -@Column(name = "status") -private Integer status; - -@Column(name="publication") -private String publication; - -@Column(name="category_id") -private Integer categoryId; - -@Column(name="image") -private String image; - -public csvUpload(){ - -} - - -public csvUpload(String booksName,String publication, String booksAuther, Integer booksCopies,Integer categoryId,Integer status) { -this.booksName = booksName; -this.publication = publication; -this.booksAuther = booksAuther; -this.booksCopies = booksCopies; - -this.categoryId = categoryId; -this.status=status; -// this.image = image; - - -} - -@Override -public String toString() { -return "Csv [ booksName=" + booksName + ", booksAuthor=" + booksAuther + ", booksCopies=" + booksCopies - + ", categoryId=" + categoryId + ", status=" + status + "]"; -} - - -// public Long getBooksId() { -// return booksId; -// } - -// public void setBooksId(Long booksId) { -// this.booksId = booksId; -// } + @Id + @GeneratedValue(strategy = GenerationType.IDENTITY) + @Column(name = "books_id") + private Integer booksId; + @Column(name = "books_name") + private String booksName; -public String getBooksName() { - return booksName; -} + @Column(name = "auther") + private String booksAuther; + @Column(name = "books_copies") + private Integer booksCopies; -public void setBooksName(String booksName) { - this.booksName = booksName; -} + @Column(name = "status") + private Integer status; + @Column(name = "publication") + private String publication; -public String getBooksAuther() { - return booksAuther; -} + @Column(name = "category_id") + private Integer categoryId; + @Column(name = "image") + private String image; -public void setBooksAuther(String booksAuther) { - this.booksAuther = booksAuther; -} - - -public Integer getBooksCopies() { - return booksCopies; -} - - -public void setBooksCopies(Integer booksCopies) { - this.booksCopies = booksCopies; -} - - -public Integer getStatus() { - return status; -} + public csvUpload() { + } -public void setStatus(Integer status) { - this.status = status; -} + public csvUpload(String booksName, String publication, String booksAuther, Integer booksCopies, Integer categoryId, + Integer status) { + this.booksName = booksName; + this.publication = publication; + this.booksAuther = booksAuther; + this.booksCopies = booksCopies; + this.categoryId = categoryId; + this.status = status; -public String getPublication() { - return publication; -} + } + @Override + public String toString() { + return "Csv [ booksName=" + booksName + ", booksAuthor=" + booksAuther + ", booksCopies=" + booksCopies + + ", categoryId=" + categoryId + ", status=" + status + "]"; + } -public void setPublication(String publication) { - this.publication = publication; -} + public String getBooksName() { + return booksName; + } + public void setBooksName(String booksName) { + this.booksName = booksName; + } -public Integer getCategoryId() { - return categoryId; -} + public String getBooksAuther() { + return booksAuther; + } + public void setBooksAuther(String booksAuther) { + this.booksAuther = booksAuther; + } -public void setCategoryId(Integer categoryId) { - this.categoryId = categoryId; -} + public Integer getBooksCopies() { + return booksCopies; + } + public void setBooksCopies(Integer booksCopies) { + this.booksCopies = booksCopies; + } -// public String getImage() { -// return image; -// } + public Integer getStatus() { + return status; + } + public void setStatus(Integer status) { + this.status = status; + } -// public void setImage(String image) { -// this.image = image; -// } + public String getPublication() { + return publication; + } + public void setPublication(String publication) { + this.publication = publication; + } + public Integer getCategoryId() { + return categoryId; + } + public void setCategoryId(Integer categoryId) { + this.categoryId = categoryId; + } } \ No newline at end of file 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 0ac9378f..3cbc1645 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 @@ -1,10 +1,8 @@ package com.innovature.Library.repository; -import java.sql.Date; import java.util.Collection; import java.util.List; -//import org.springframework.data.repository.Repository; import org.springframework.data.repository.PagingAndSortingRepository; import org.springframework.data.domain.Page; import org.springframework.data.domain.Pageable; @@ -15,139 +13,129 @@ public interface BorrowRepository extends PagingAndSortingRepository { - public Borrow save(Collection borrow); + public Borrow save(Collection borrow); - Collection findAll(); + Collection findAll(); - // Optional findByBorrowId(Integer borrowId) - Borrow findByBorrowId(Integer borrowId); + Borrow findByBorrowId(Integer borrowId); - //Collection findByBorrowId(Integer borrowId); + Collection findAllByUserUserId(Integer userId); - Collection findAllByUserUserId(Integer userId); + // load all @ pagenation + public Page findAll(Pageable paging); - -//load all @ pagenation - public Page findAll(Pageable paging); + // load all @ fine pagenation -//load all with userId(in user-login) - public Page findAllByUserUserId(Integer userId,Pageable paging); + @Query(value = "select * from borrow where borrow_id in(select borrow_id from borrow where due_date findbyBorrowIdandDueDateandStatus(Pageable paging); - - //To select borrow details with user_id,a day before due day - @Query(value = "select * from borrow where borrow_id in(select borrow_id from borrow where due_date=date_add(curdate(),interval 1 day) and status='APPROVED' and user_id=?1)", nativeQuery = true) - Collection findBorrowIdbyUserId(Integer userId); + // load all with userId(in user-login) + public Page findAllByUserUserId(Integer userId, Pageable paging); - -//at notification of user to pick data when duedate=currrent date - @Query(value = "select * from borrow where borrow_id in(select borrow_id from borrow where due_date=curdate() and status='APPROVED' and user_id=?1)", nativeQuery = true) - Collection findbyUserIdDueDate(Integer userId); + // To select borrow details with user_id,a day before due day + @Query(value = "select * from borrow where borrow_id in(select borrow_id from borrow where due_date=date_add(curdate(),interval 1 day) and status='APPROVED' and user_id=?1)", nativeQuery = true) + Collection findBorrowIdbyUserId(Integer userId); + // at notification of user to pick data when duedate=currrent date + @Query(value = "select * from borrow where borrow_id in(select borrow_id from borrow where due_date=curdate() and status='APPROVED' and user_id=?1)", nativeQuery = true) + Collection findbyUserIdDueDate(Integer userId); + // To select all user(without used_id) by due date expired(@admin side) + @Query(value = "select * from borrow where borrow_id in(select borrow_id from borrow where due_date findbyBorrowIdandStatus(); + @Query(value = "select * from borrow where borrow_id in(select borrow_id from borrow where due_date findbyBorrowIdandDueDateandStatus(); - //To select all user(without used_id) by due date expired(@admin side) - @Query(value = "select * from borrow where borrow_id in(select borrow_id from borrow where due_date findbyBorrowIdandStatus(); + // To select user by due date expired + @Query(value = "select * from borrow where borrow_id in(select borrow_id from borrow where due_date findbyUserIdandStatus(Integer userId); + // @Query(value = "select email from user where user_id in(select user_id from + // borrow where borrow_id in(select borrow_id from borrow where + // due_date findbyBorrowId(); - @Query(value = "select * from borrow where borrow_id in(select borrow_id from borrow where due_date findbyBorrowIdandDueDateandStatus(); + @Query(value = "update borrow set due_days=DATEDIFF(curdate(),due_date) WHERE borrow_id=?", nativeQuery = true) + void findDueDays(Integer borrowId); - - //To select user by due date expired - @Query(value = "select * from borrow where borrow_id in(select borrow_id from borrow where due_date findbyUserIdandStatus(Integer userId); + // total sum of fine /user + // @Query(value=" select sum(fine) from borrow where + // user_id=?",nativeQuery=true) + // LOAD-FILTER @ADMIN ### ON-Load Filterd results + @Query(value = "select * from borrow where issue_date between DATE(?1) and DATE(?2) and status!='REQUESTED'", nativeQuery = true) + List findbyIssuDate(java.sql.Date date1, java.sql.Date date2); + // GET FILTER-RSLT @ADMIN- filtered results + @Query(value = "select * from borrow where issue_date between DATE(?1) and DATE(?2) and status!='REQUESTED'", nativeQuery = true) + public Page findbyIssuDate(java.sql.Date date1, java.sql.Date date2, Pageable paging); - // @Query(value = "select email from user where user_id in(select user_id from borrow where borrow_id in(select borrow_id from borrow where due_date findbyBorrowIdandStatus(); + // test + @Query(value = "select * from borrow where issue_date between DATE(?1) and DATE(?2) and status!='REQUESTED'", nativeQuery = true) + public Page findbyIssuDat(java.sql.Date date1, java.sql.Date date2, Pageable paging); - @Query(value = "select * from borrow where status='APPROVED' and due_date findbyBorrowId(); + // Load Filterd results at user borrow history + @Query(value = "select * from borrow where issue_date between DATE(?1) and DATE(?2) and user_id=?1", nativeQuery = true) + List findbyIssuDateAndUserId(java.sql.Date date1, java.sql.Date date2); - @Query(value="update borrow set due_days=DATEDIFF(curdate(),due_date) WHERE borrow_id=?",nativeQuery=true) - void findDueDays(Integer borrowId); + // to get total books in-hand by user + @Query(value = "select count(user_id) from borrow where status='APPROVED' and user_id=?1", nativeQuery = true) + Integer findbyUserIdAndStatus(Integer userId); - //total sum of fine /user - // @Query(value=" select sum(fine) from borrow where user_id=?",nativeQuery=true) - // void findFineByUserId(Integer userId); public Page findAll(Pageable paging); + // @Query(value = "SELECT * FROM borrow",nativeQuery = true) + // filter by approved in ADMIN SIDE + @Query(value = "select * from borrow where status='APPROVED' and user_id=?", nativeQuery = true) + public Page findByApprovedStatusUser(Pageable paging); + // @Query(value = "select * from borrow where issue_date between + // date_sub(curdate(),interval 7 day) and curdate()",nativeQuery = true) - //LOAD-FILTER @ADMIN ### ON-Load Filterd results - @Query(value = "select * from borrow where issue_date between DATE(?1) and DATE(?2) and status!='REQUESTED'", nativeQuery = true) - List findbyIssuDate(java.sql.Date date1,java.sql.Date date2); - -//GET FILTER-RSLT @ADMIN- filtered results - @Query(value = "select * from borrow where issue_date between DATE(?1) and DATE(?2) and status!='REQUESTED'", nativeQuery = true) - public Page findbyIssuDate( java.sql.Date date1,java.sql.Date date2,Pageable paging); + // 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); - //test - @Query(value = "select * from borrow where issue_date between DATE(?1) and DATE(?2) and status!='REQUESTED'", nativeQuery = true) - public Page findbyIssuDat( java.sql.Date date1,java.sql.Date date2,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); - // public Page findbyIssuDate(java.util.Date date1, java.util.Date date2, 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", nativeQuery = true) + List findAllC(); - //Load Filterd results at user borrow history - @Query(value = "select * from borrow where issue_date between DATE(?1) and DATE(?2) and user_id=?1", nativeQuery = true) - List findbyIssuDateAndUserId(java.sql.Date date1,java.sql.Date date2); + @Query(value = "select * from borrow where issue_date between date_sub(curdate(),interval 7 day) and curdate()", nativeQuery = true) + List findAllL7(); + // @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) - //to get total books in-hand by user - @Query(value = "select count(user_id) from borrow where status='APPROVED' and user_id=?1", nativeQuery = true) - Integer findbyUserIdAndStatus(Integer userId); - + // @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) - // @Query(value = "SELECT * FROM borrow",nativeQuery = true) - // ListfindAllC(); + // @Query(value = "select * from borrow where user_id in(select user_id from + // user where first_name like %?%", nativeQuery = true) - // @Query(value = "select * from borrow where issue_date between date_sub(curdate(),interval 7 day) and curdate()",nativeQuery = true) - // ListfindAllC(); + // 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' - // 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",nativeQuery = true) - ListfindAllC(); - - @Query(value = "select * from borrow where issue_date between date_sub(curdate(),interval 7 day) and curdate()",nativeQuery = true) - ListfindAllL7(); - - // @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); - - - // @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'); \ No newline at end of file + // 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') + +} diff --git a/BackEnd/Library/src/main/java/com/innovature/Library/repository/EmailRepository.java b/BackEnd/Library/src/main/java/com/innovature/Library/repository/EmailRepository.java index 134fa683..4e31ab7a 100644 --- a/BackEnd/Library/src/main/java/com/innovature/Library/repository/EmailRepository.java +++ b/BackEnd/Library/src/main/java/com/innovature/Library/repository/EmailRepository.java @@ -6,14 +6,13 @@ import com.innovature.Library.entity.Email; - -public interface EmailRepository extends Repository { +public interface EmailRepository extends Repository { void deleteAll(); Email save(Email email); - CollectionfindAll(); + Collection findAll(); Email findByEmail(String email); 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 b4c22d31..efba1b80 100644 --- a/BackEnd/Library/src/main/java/com/innovature/Library/service/BooksService.java +++ b/BackEnd/Library/src/main/java/com/innovature/Library/service/BooksService.java @@ -16,7 +16,10 @@ public interface BooksService { BooksDetailView add(BooksForm form); - + + // Collection listAll(); + + // BooksDetailView listAll(); Collection listAll(); Collection listByCategory(Integer categoryId); diff --git a/BackEnd/Library/src/main/java/com/innovature/Library/service/BorrowService.java b/BackEnd/Library/src/main/java/com/innovature/Library/service/BorrowService.java index 58ef4199..e1f737f3 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 @@ -38,6 +38,8 @@ public interface BorrowService { List getAllBorrows(Integer pageNo, Integer pageSize, String sortBy); Page getAllBorr(Integer pageNo, Integer pageSize, String sortBy,Integer direction); + Page getAllFine(Integer pageNo, Integer pageSize, String sortBy,Integer direction); //fine + List getAllBorrow(Date date1, Date date2, Integer pageNo, Integer pageSize, String sortBy); Page getAllBor(Date date1, Date date2, Integer pageNo, Integer pageSize, String sortBy,Integer direction); diff --git a/BackEnd/Library/src/main/java/com/innovature/Library/service/CategoryService.java b/BackEnd/Library/src/main/java/com/innovature/Library/service/CategoryService.java index 1a618b6a..fa5f3ca6 100644 --- a/BackEnd/Library/src/main/java/com/innovature/Library/service/CategoryService.java +++ b/BackEnd/Library/src/main/java/com/innovature/Library/service/CategoryService.java @@ -2,21 +2,9 @@ import java.util.Collection; import org.springframework.data.domain.Page; - -//import javax.validation.Valid; - -// import org.springframework.http.HttpEntity; -// import javax.validation.Valid; -// import org.springframework.validation.Errors; import com.innovature.Library.view.CategoryDetailView; -// import com.innovature.Library.entity.Category; -//import com.innovature.Library.view.CategoryListView; import com.innovature.Library.entity.Category; -//import com.innovature.Library.exception.NotFoundException; import com.innovature.Library.form.CategoryForm; -// import com.innovature.Library.entity.Category; -// import com.innovature.Library.exception.BadRequestException; -// import com.innovature.Library.exception.NotFoundException; public interface CategoryService { diff --git a/BackEnd/Library/src/main/java/com/innovature/Library/service/EmailService.java b/BackEnd/Library/src/main/java/com/innovature/Library/service/EmailService.java index dc2e95fc..ac2a77f7 100644 --- a/BackEnd/Library/src/main/java/com/innovature/Library/service/EmailService.java +++ b/BackEnd/Library/src/main/java/com/innovature/Library/service/EmailService.java @@ -1,12 +1,14 @@ package com.innovature.Library.service; - +import org.springframework.http.ResponseEntity; import com.innovature.Library.form.OtpForm; public interface EmailService { boolean sendEmail(String subject, String message, String sentto); // boolean sendOtpEmail(String subject, String message, String sentto); - boolean add(OtpForm form); + ResponseEntity add(OtpForm form); + + boolean addPassword(OtpForm form); } diff --git a/BackEnd/Library/src/main/java/com/innovature/Library/service/UserService.java b/BackEnd/Library/src/main/java/com/innovature/Library/service/UserService.java index ef0d4244..a17cef9d 100644 --- a/BackEnd/Library/src/main/java/com/innovature/Library/service/UserService.java +++ b/BackEnd/Library/src/main/java/com/innovature/Library/service/UserService.java @@ -36,6 +36,10 @@ public interface UserService { LoginView refresh(String refreshToken) throws BadRequestException; + // Collection list(); + + // UserView edit(UserForm form); + UserView updates(Integer userId, UserForm form); void deletes(Integer userId); @@ -44,10 +48,12 @@ public interface UserService { Collection listAll(); + // Collection list(); + UserView edit(Integer userId, UserForm form); Collection viewProfile(Integer userId); - Page getAllUser(Integer pageNo, Integer pageSize, String sortBy, Integer direction); + Page getAllUser(Integer pageNo, Integer pageSize, String sortBy,Integer direction); } diff --git a/BackEnd/Library/src/main/java/com/innovature/Library/service/impl/BooksServiceImpl.java b/BackEnd/Library/src/main/java/com/innovature/Library/service/impl/BooksServiceImpl.java index e04cf32f..38b6a1ad 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,14 +1,10 @@ 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; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.http.HttpEntity; @@ -17,8 +13,6 @@ import org.springframework.stereotype.Service; 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; @@ -36,7 +30,7 @@ import com.innovature.Library.util.FileUtil; @Service -public class BooksServiceImpl implements BooksService{ +public class BooksServiceImpl implements BooksService { @Autowired private BooksRepository booksRepository; @@ -45,140 +39,129 @@ public class BooksServiceImpl implements BooksService{ CategoryRepository catRepo; @Override - public BooksDetailView add(BooksForm form){ - Category category=catRepo.findByCategoryId(form.getCategoryId()); - return new BooksDetailView(booksRepository.save(new Books(form,category))); + public BooksDetailView add(BooksForm form) { + Category category = catRepo.findByCategoryId(form.getCategoryId()); + return new BooksDetailView(booksRepository.save(new Books(form, category))); } - @Override - public Collection listAll() { - return booksRepository.findAll(); - } + public Collection listAll() { + return booksRepository.findAll(); + } @Override - public Collection listByCategory(Integer categoryId) { - return booksRepository.findbyCategoryId(categoryId); - } - + public Collection listByCategory(Integer categoryId) { + return booksRepository.findbyCategoryId(categoryId); + } @Override public BooksDetailView list(Integer booksId) { - Books books=booksRepository.findByBooksId(booksId); + Books books = booksRepository.findByBooksId(booksId); return new BooksDetailView(books); } - @Override @Transactional - public BooksDetailView updates(Integer booksId, BooksForm form) { + public BooksDetailView updates(Integer booksId, BooksForm form) { - Category category=catRepo.findByCategoryId(form.getCategoryId()); - Books books=booksRepository.findByBooksId(booksId); + Category category = catRepo.findByCategoryId(form.getCategoryId()); + Books books = booksRepository.findByBooksId(booksId); books.setCategory(category); books.setPublication(form.getPublication()); books.setBooksName(form.getBooksName()); books.setAuther(form.getAuther()); books.setBooksCopies(form.getBooksCopies()); - // return new BooksDetailView(booksRepository.save(new Books(form,category))); + return new BooksDetailView(books); } @Override public void deletes(Integer categoryId) throws NotFoundException { booksRepository.delete( - booksRepository.findByBooksId(categoryId) - + booksRepository.findByBooksId(categoryId) + ); } @Override public HttpEntity getImagePic(Integer booksId) { - + String image = booksRepository.findByBooksId(booksId) .getImage(); - + byte[] file = FileUtil.getImage(image); - + HttpHeaders headers = new HttpHeaders(); headers.setContentType(MediaType.IMAGE_PNG); headers.setContentLength(file.length); - + return new HttpEntity<>(file, headers); } - @Override public RedirectView uploadImage(MultipartFile multipartFile) throws IOException { // TODO Auto-generated method stub return null; } - @Override @Transactional - public PagegetAllBooks(Integer pageNo, Integer pageSize, String sortBy,Integer direction){ - - var sortByDescending=Sort.by(sortBy).descending(); - var sortByAscending=Sort.by(sortBy).ascending(); + public Page getAllBooks(Integer pageNo, Integer pageSize, String sortBy, Integer direction) { + + var sortByDescending = Sort.by(sortBy).descending(); + var sortByAscending = Sort.by(sortBy).ascending(); - if(direction==1){ + if (direction == 1) { Pageable paging = PageRequest.of(pageNo, pageSize, sortByDescending); Page pagedResult = booksRepository.findAll(paging); - return pagedResult; + return pagedResult; } - else - { + else { Pageable paging = PageRequest.of(pageNo, pageSize, sortByAscending); Page pagedResult = booksRepository.findAll(paging); - return pagedResult; + return pagedResult; } } - //pie + // pie @Override public List getBookCountByCategory() { return booksRepository.findCountByCategoryId(); } - //book search + // book search @Override - public Page getAllBookStocks(String keyword, Integer pageNo, Integer pageSize, String sortBy,Integer direction) { + public Page getAllBookStocks(String keyword, Integer pageNo, Integer pageSize, String sortBy, + Integer direction) { - var sortByDescending=Sort.by(sortBy).descending(); - var sortByAscending=Sort.by(sortBy).ascending(); + var sortByDescending = Sort.by(sortBy).descending(); + var sortByAscending = Sort.by(sortBy).ascending(); - if(direction==1){ + if (direction == 1) { Pageable paging = PageRequest.of(pageNo, pageSize, sortByDescending); - System.out.println(keyword); - String k = keyword; - String k1 = keyword; - String k2 = keyword; - Page pagedResult = booksRepository.findByKeywords(keyword, k, k1, k2, paging); - return pagedResult; + + String k = keyword; + String k1 = keyword; + String k2 = keyword; + Page pagedResult = booksRepository.findByKeywords(keyword, k, k1, k2, paging); + return pagedResult; } - else - { + else { Pageable paging = PageRequest.of(pageNo, pageSize, sortByAscending); - System.out.println(keyword); + String k = keyword; String k1 = keyword; String k2 = keyword; Page pagedResult = booksRepository.findByKeywords(keyword, k, k1, k2, paging); - return pagedResult; + 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 fd2daa22..1e012756 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 @@ -87,10 +87,7 @@ public Collection listDueByUser() { return borrowRepository.findbyUserIdandStatus(SecurityUtil.getCurrentUserId()); } - @Override - public Collection fine() { - return borrowRepository.findbyBorrowIdandDueDateandStatus(); - } + @Override public Borrow BorrowDetail(Integer borrowId) { @@ -159,8 +156,10 @@ public BorrowDetailView updatereject(Integer borrowId, BorrowForm form) { @Override @Transactional public BorrowDetailView updateReturn(Integer borrowId, BorrowForm form) { + Borrow borrow = borrowRepository.findByBorrowId(borrowId); Books books = booksRepository.findbyBorrowId(borrowId); + borrow.setBookReturnedDate(LocalDateTime.now()); borrow.setIssueDate(borrow.getIssueDate()); borrow.setReturnDate(borrow.getReturnDate()); @@ -273,6 +272,9 @@ public Page getAllBorr(Integer pageNo, Integer pageSize, String sortBy, } + + + @Override @Transactional public List getBorrowHistory(Integer pageNo, Integer pageSize, String sortBy) { @@ -288,6 +290,37 @@ public List getBorrowHistory(Integer pageNo, Integer pageSize, String so } } + @Override + public Collection fine() { + return borrowRepository.findbyBorrowIdandDueDateandStatus(); + } + + // @admin borrow oninit + @Override + @Transactional + public Page getAllFine(Integer pageNo, Integer pageSize, String sortBy, Integer direction) { + + 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.findbyBorrowIdandDueDateandStatus(paging); + return pagedResult; + } + + else { + Pageable paging = PageRequest.of(pageNo, pageSize, sortByAscending); + Page pagedResult = borrowRepository.findbyBorrowIdandDueDateandStatus(paging); + return pagedResult; + } + + + } + + @Override @Transactional @@ -411,8 +444,7 @@ public void setReturnedCount(Integer returnedCount) { @Override @Transactional - public Page getAllBorrByStat(Integer pageNo, Integer pageSize, String sortBy, Integer direction, - Integer status) { + public Page getAllBorrByStat(Integer pageNo, Integer pageSize, String sortBy, Integer direction,Integer status) { var sortByDescending = Sort.by(sortBy).descending(); @@ -450,16 +482,19 @@ else if (direction == -1 && status == 2) { Page pagedResult = borrowRepository.findByRejStatusUser(SecurityUtil.getCurrentUserId(), paging); return pagedResult; - } else if (direction == -1 && status == 3) { + } + 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) { + } + else if (direction == -1 && status == 4) { Pageable paging = PageRequest.of(pageNo, pageSize, sortByAscending); Page pagedResult = borrowRepository.findByReqStatusUser(SecurityUtil.getCurrentUserId(), paging); return pagedResult; - } else { + } + else { return null; } } diff --git a/BackEnd/Library/src/main/java/com/innovature/Library/service/impl/EmailServiceImpl.java b/BackEnd/Library/src/main/java/com/innovature/Library/service/impl/EmailServiceImpl.java index 8c6ac643..786322dc 100644 --- a/BackEnd/Library/src/main/java/com/innovature/Library/service/impl/EmailServiceImpl.java +++ b/BackEnd/Library/src/main/java/com/innovature/Library/service/impl/EmailServiceImpl.java @@ -6,17 +6,17 @@ import com.innovature.Library.repository.EmailRepository; import com.innovature.Library.repository.UserRepository; import com.innovature.Library.service.EmailService; - +import org.springframework.http.ResponseEntity; +import org.springframework.http.HttpStatus; import java.util.Properties; - - - import javax.mail.*; import javax.mail.internet.InternetAddress; import javax.mail.internet.MimeMessage; import javax.mail.Session; +import java.time.LocalTime; +import java.time.temporal.ChronoUnit; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.security.crypto.password.PasswordEncoder; @@ -24,7 +24,7 @@ @Service public class EmailServiceImpl implements EmailService { - + @Autowired private EmailRepository emailRepository; @@ -33,104 +33,126 @@ public class EmailServiceImpl implements EmailService { @Autowired private UserRepository userRepository; - - + + + @Override - public boolean add(OtpForm form){ - System.out.println("----------------------------"); - Email otp=emailRepository.findByEmail(form.getEmail()); - User user=userRepository.findByEmailId(form.getEmail()); - System.out.println(form.getEmail()); - // System.out.println(form.getOtp()); - System.out.println(otp); + public ResponseEntity add(OtpForm form) { + + Email otp = emailRepository.findByEmail(form.getEmail()); + + LocalTime myObj = LocalTime.now(); + + var exp = otp.getExpiry().until(myObj, ChronoUnit.SECONDS); + if ((form.getOtp().equals(otp.getOtp()))) { - System.out.println("----------inside if of otp ==-------"); + + if (exp < 181) { + + return new ResponseEntity(null,HttpStatus.ACCEPTED); + + } + //otp expiry + return new ResponseEntity(null,HttpStatus.GATEWAY_TIMEOUT); + + } + return new ResponseEntity(null,HttpStatus.NOT_ACCEPTABLE); +} + + +// @Override +// public boolean add(OtpForm form) { + +// Email otp = emailRepository.findByEmail(form.getEmail()); + +// LocalTime myObj = LocalTime.now(); + +// var exp = otp.getExpiry().until(myObj, ChronoUnit.SECONDS); + +// if ((form.getOtp().equals(otp.getOtp()))) { + +// if (exp < 181) { + +// return true; + +// } +// return false; + +// } +// return false; +// } + + + + +@Override +public boolean addPassword(OtpForm form) { + + User user = userRepository.findByEmailId(form.getEmail()); + if (form.getNewPassword().equals(form.getCnewPassword())) - + { - System.out.println("----------inside if of passwrd ==-------"); + user.setPassword(passwordEncoder.encode(form.getNewPassword())); userRepository.save(user); return true; - } + } return false; - - } - else{ - return false; - } - } - - - - - - - - - - - - @Override - public boolean sendEmail(String subject, String message, String to) - { + } - User user=userRepository.findByEmailId(to); - if(user!=null){ - boolean s=false; - String senderEmail="stormhokspam@gmail.com"; - String senderPassword="cyckyhziponehguf"; - - Properties properties = new Properties(); - properties.put("mail.smtp.auth", "true"); - properties.put("mail.smtp.starttls.enable", "true"); - properties.put("mail.smtp.host", "smtp.gmail.com"); - properties.put("mail.smtp.port", "587"); // 587 is TLS port number - Session session = Session.getInstance(properties, new Authenticator() - { - protected PasswordAuthentication getPasswordAuthentication(){ - - return new PasswordAuthentication(senderEmail, senderPassword); - } - }); - try { - MimeMessage msg = new MimeMessage(session); + @Override + public boolean sendEmail(String subject, String message, String to) { - msg.setFrom(new InternetAddress(senderEmail)); + User user = userRepository.findByEmailId(to); + if (user != null) { - msg.addRecipient(Message.RecipientType.TO, new InternetAddress(to)); + boolean s = false; + String senderEmail = "stormhokspam@gmail.com"; + String senderPassword = "cyckyhziponehguf"; - msg.setSubject(subject); - msg.setText(message); - Transport.send(msg); + Properties properties = new Properties(); + properties.put("mail.smtp.auth", "true"); + properties.put("mail.smtp.starttls.enable", "true"); + properties.put("mail.smtp.host", "smtp.gmail.com"); + properties.put("mail.smtp.port", "587"); // 587 is TLS port number + Session session = Session.getInstance(properties, new Authenticator() { + protected PasswordAuthentication getPasswordAuthentication() { - s = true; + return new PasswordAuthentication(senderEmail, senderPassword); + } + }); - }catch(Exception e){ + try { - } - return s; - } + MimeMessage msg = new MimeMessage(session); - else{ - return (Boolean) null; - } - - - - } + msg.setFrom(new InternetAddress(senderEmail)); + msg.addRecipient(Message.RecipientType.TO, new InternetAddress(to)); + msg.setSubject(subject); + msg.setText(message); + Transport.send(msg); + s = true; + } catch (Exception e) { + } + return s; + } + else { + return (Boolean) null; + } + } } \ No newline at end of file diff --git a/BackEnd/Library/src/main/java/com/innovature/Library/service/impl/UserServiceImpl.java b/BackEnd/Library/src/main/java/com/innovature/Library/service/impl/UserServiceImpl.java index c40ef327..36dea071 100644 --- a/BackEnd/Library/src/main/java/com/innovature/Library/service/impl/UserServiceImpl.java +++ b/BackEnd/Library/src/main/java/com/innovature/Library/service/impl/UserServiceImpl.java @@ -1,23 +1,21 @@ -/* - * To change this license header, choose License Headers in Project Properties. - * To change this template file, choose Tools | Templates - * and open the template in the editor. - */ + package com.innovature.Library.service.impl; import static com.innovature.Library.security.AccessTokenUserDetailsService.PURPOSE_ACCESS_TOKEN; import java.util.Collection; import javax.transaction.Transactional; + 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 org.springframework.beans.factory.annotation.Autowired; -import org.springframework.data.domain.Page; + import org.springframework.security.crypto.password.PasswordEncoder; import org.springframework.stereotype.Service; import org.springframework.validation.Errors; + import com.innovature.Library.entity.User; import com.innovature.Library.exception.BadRequestException; import com.innovature.Library.exception.NotFoundException; @@ -28,6 +26,8 @@ import com.innovature.Library.security.util.InvalidTokenException; import com.innovature.Library.security.util.SecurityUtil; import com.innovature.Library.security.util.TokenExpiredException; + + import com.innovature.Library.security.util.TokenGenerator; import com.innovature.Library.security.util.TokenGenerator.Status; import com.innovature.Library.security.util.TokenGenerator.Token; @@ -129,11 +129,6 @@ private static BadRequestException badRequestException() { return new BadRequestException("Invalid credentials"); } - // @Override - // public Collection list() { - // return userRepository.findAll(); - // } - @@ -174,7 +169,7 @@ public Collection listAll() { @Override public UserView edit(Integer userId,UserForm form) { - // Integer userId=SecurityUtil.getCurrentUserId(); + User user=userRepository.findById(userId); user.edit( @@ -191,8 +186,7 @@ public UserView edit(Integer userId,UserForm form) { } @Override public Collection viewProfile(Integer userId) { - //User user=userRepository.findById(userId); - // return UserView( userRepository.save(user)); + return userRepository.findByUserId(userId); } diff --git a/BackEnd/Library/src/main/java/com/innovature/Library/view/BooksListView.java b/BackEnd/Library/src/main/java/com/innovature/Library/view/BooksListView.java index 03ec463b..e482ffb4 100644 --- a/BackEnd/Library/src/main/java/com/innovature/Library/view/BooksListView.java +++ b/BackEnd/Library/src/main/java/com/innovature/Library/view/BooksListView.java @@ -1,16 +1,19 @@ package com.innovature.Library.view; + + import com.innovature.Library.entity.Category; + public class BooksListView { private final int booksId; private final String booksName; - private CategoryDetailView category; + private CategoryDetailView category; private final String publication; private final String auther; private final Integer booksCopies; private String image; - public BooksListView(int booksId, String booksName, Category category, String publication, String auther, - Integer booksCopies) { + public BooksListView(int booksId, String booksName,Category category,String publication,String auther,Integer booksCopies) + { this.booksId = booksId; this.booksName = booksName; @@ -18,32 +21,22 @@ public BooksListView(int booksId, String booksName, Category category, String pu this.publication = publication; this.auther = auther; - this.image = image; + this.booksCopies = booksCopies; } - // public BooksListView(int booksId, String booksName,Integer categoryId,String - // categoryName,String publication,String auther,String booksCopies) - // { - // this.booksId = booksId; - // this.booksName = booksName; - // this.category = new Category(categoryId,categoryName); - // this.publication = publication; - // this.auther = auther; - // // this.status = status; - // this.booksCopies = booksCopies; - // } + + public int getBooksId() { return booksId; } - public String getbooksName() { return booksName; } - - public CategoryDetailView getCategory() { + + public CategoryDetailView getCategory() { return category; } @@ -63,8 +56,11 @@ public String getCategoryName() { return this.category.getCategoryName(); } + public String getImage() { return image; } + + } diff --git a/FrontEnd/Library/src/app/addbooks/addbooks.component.ts b/FrontEnd/Library/src/app/addbooks/addbooks.component.ts index 9e55c9e0..438905f7 100644 --- a/FrontEnd/Library/src/app/addbooks/addbooks.component.ts +++ b/FrontEnd/Library/src/app/addbooks/addbooks.component.ts @@ -120,10 +120,7 @@ else{ } onTableDataChange(event:any) { - - console.log("p-",this.pkey) - - + if(this.pkey==null){ this.booksService.pagination1(this.page,this.tableSize,this.sort,this.direction).subscribe(result=>{ @@ -134,12 +131,6 @@ onTableDataChange(event:any) { }) } else{ - - - console.log("page=",event) - console.log("pkey in page=",this.pkey) - - this.booksService.search(this.pkey,this.page,this.tableSize,this.sort,this.direction).subscribe(result=>{ this.result=result.content; this.count=result.totalElements @@ -155,10 +146,7 @@ onTableDataChange(event:any) { const dialogConfig = new MatDialogConfig(); this.dialog.open(BooksComponent, { - - closeOnNavigation: true, - width:'55%',height:'auto' } @@ -225,14 +213,14 @@ selectFile($event:any) { if (file) { this.currentFile = file; this.booksService.uploadCsv(this.currentFile).subscribe(res=>{ -console.log("csv-",res) + if(res!==null){ this.toast.success({detail:'SUCCESS',summary:'The CSV File upload is successfull',duration:5000}); setTimeout(() => { - +this.Load() // window.location.reload() - }, 5000); + }, 3000); } },(error: any) =>{ this.toast.error({detail:'CSV Upload Failed',summary:'Invalid CSV File',duration:5000}); diff --git a/FrontEnd/Library/src/app/addcategory/addcategory.component.ts b/FrontEnd/Library/src/app/addcategory/addcategory.component.ts index 9cee16aa..4bef77be 100644 --- a/FrontEnd/Library/src/app/addcategory/addcategory.component.ts +++ b/FrontEnd/Library/src/app/addcategory/addcategory.component.ts @@ -1,6 +1,6 @@ import { Component, OnInit } from '@angular/core'; import { CategoryComponent } from '../category/category.component'; -import { MatDialog} from '@angular/material/dialog'; +import { MatDialog } from '@angular/material/dialog'; import { Router } from '@angular/router'; import { CategoryService } from '../category.service'; import { NgToastService } from 'ng-angular-popup'; @@ -11,134 +11,137 @@ import { NgToastService } from 'ng-angular-popup'; templateUrl: './addcategory.component.html', styleUrls: ['./addcategory.component.css'] }) -export class AddcategoryComponent implements OnInit { +export class AddcategoryComponent implements OnInit { categoryList: any[]; - categoryId:any; - categorydata:any; - -data: any; -page:number=1; -count: any; -tableSize: number = 5; -a:any; -b:any; - -sort:string="categoryId"; -sort1:string="categoryName"; -len: any; -result: any; + categoryId: any; + categorydata: any; + + data: any; + page: number = 1; + count: any; + tableSize: number = 5; + a: any; + b: any; + + sort: string = "categoryId"; + sort1: string = "categoryName"; + len: any; + result: any; booksCount: any; - direction=-1; + direction = -1; category_id: any; categoryName: any; category_name: any; constructor(private dialog: MatDialog, - private router:Router , - private service:CategoryService, - private toast : NgToastService - ) { - this.categoryList=[]; - - } - - ngOnInit(): void { - - this.LoadCategory(); - localStorage.removeItem('categoryId'); + private router: Router, + private service: CategoryService, + private toast: NgToastService + ) { + this.categoryList = []; + + } + + ngOnInit(): void { + + this.LoadCategory(); + localStorage.removeItem('categoryId'); } LoadCategory() { - this.service.CatPageAdmin(this.page,this.tableSize,this.sort,this.direction).subscribe(result=>{ - this.result=result.content; - this.count=result.totalElements - this.data=this.result; - this.categorydata=this.result; - }); } + this.service.CatPageAdmin(this.page, this.tableSize, this.sort, this.direction).subscribe(result => { + this.result = result.content; + this.count = result.totalElements + this.data = this.result; + this.categorydata = this.result; + }); + + } - sortfn(a:any){ - this.sort=a; - this.page=this.page; + sortfn(a: any) { + this.sort = a; + this.page = this.page; this.tableSize; - - if(this.direction==1){ - this.direction=-1; - this.ngOnInit(); + + if (this.direction == 1) { + this.direction = -1; + this.LoadCategory(); } - - else{ - this.direction=1; - this.LoadCategory(); + + else { + this.direction = 1; + this.LoadCategory(); } - + } - onTableDataChange(event:any) { - - this.service.CatPageAdmin(this.page,this.tableSize,this.sort,this.direction).subscribe(result=>{ - this.result=result.content; - this.count=result.totalElements - this.data=this.result; - this.categorydata=this.result; - }) - } - + onTableDataChange(event: any) { -openDialog() { + this.service.CatPageAdmin(this.page, this.tableSize, this.sort, this.direction).subscribe(result => { + this.result = result.content; + this.count = result.totalElements + this.data = this.result; + this.categorydata = this.result; + }) + } - this.dialog.open(CategoryComponent, - { - // width:'25%',height:'35%' - width:'auto+50px',height:'auto' - - } + openDialog() { + + + this.dialog.open(CategoryComponent, + { + // width:'25%',height:'35%' + width: 'auto+50px', height: 'auto' + + } ); -} + } -editCategory(categoryId:any) { + editCategory(categoryId: any) { - localStorage.setItem('categoryId',categoryId); + localStorage.setItem('categoryId', categoryId); - this.dialog.open(CategoryComponent, - { - closeOnNavigation: true, - width:'auto',height:'auto' + this.dialog.open(CategoryComponent, + { + closeOnNavigation: true, + width: 'auto', height: 'auto' + + } - } ); - this.router.events - .subscribe(() => { - this.dialog.closeAll(); - }); -} + + this.LoadCategory(); + // this.ngOnInit(); + + } + + + deleteCategory(category: any): void { + if (confirm('Are you sure want to delete?')) { -deleteCategory(category:any): void{ - if(confirm('Are you sure want to delete?')) - { - - - this.service.delete(category.categoryId).subscribe({next:(res)=>{ - - this.toast.error({detail:'Success',summary:'The Category '+category.categoryName+' Deleted',duration:5000}); - setTimeout(() => { - // window.location.reload() - this.LoadCategory() - }, 1500); - - }, - error:(msg)=>{} - }) - } - else{ - this.router.navigate(['/addcategory']) - } + this.service.delete(category.categoryId).subscribe({ + next: (res) => { + + this.toast.error({ detail: 'Success', summary: 'The Category ' + category.categoryName + ' Deleted', duration: 5000 }); + + + this.LoadCategory() + + + }, + error: (msg) => { } + }) + } + else { + this.router.navigate(['/addcategory']) + } + } } - } diff --git a/FrontEnd/Library/src/app/app-routing.module.ts b/FrontEnd/Library/src/app/app-routing.module.ts index fc214f68..2ac61beb 100644 --- a/FrontEnd/Library/src/app/app-routing.module.ts +++ b/FrontEnd/Library/src/app/app-routing.module.ts @@ -38,21 +38,21 @@ import { PageNotfoundComponent } from './page-notfound/page-notfound.component'; const routes: Routes = [ {path: '',redirectTo:'login',pathMatch:'full'}, - {path : 'login',component:LoginComponent,canActivate: [HomeguardGuard]}, + {path : 'login',component:LoginComponent}, {path: 'body',component:BodyComponent,canActivate: [HomeguardGuard]}, - {path: 'user-reg',component:UserRegComponent,canActivate: [HomeguardGuard]}, + {path: 'user-reg',component:UserRegComponent}, {path : 'category',component:CategoryComponent,canActivate: [HomeguardGuard]}, {path : 'books',component:BooksComponent,canActivate: [HomeguardGuard]}, {path : 'user-details',component:UserDetailsComponent,canActivate: [HomeguardGuard]}, {path : 'userbody',component:UserbodyComponent}, - {path : 'booksdisplay',component:BooksdisplayComponent,canActivate: [HomeguardGuard]}, + {path : 'booksdisplay',component:BooksdisplayComponent}, {path : 'borrow',component:BorrowComponent,canActivate: [HomeguardGuard]}, {path : 'acceptrequest',component:AcceptrequestComponent,canActivate: [HomeguardGuard]}, {path : 'rejectrequest',component:RejectrequestComponent,canActivate: [HomeguardGuard]}, - {path : 'borrowhistory',component:BorrowhistoryComponent,canActivate: [HomeguardGuard]}, + {path : 'borrowhistory',component:BorrowhistoryComponent}, {path : 'view-profile',component:ViewProfileComponent}, - {path : 'findby-category',component:FindbyCategoryComponent,canActivate: [HomeguardGuard]}, - {path : 'notification',component:NotificationComponent,canActivate: [HomeguardGuard]}, + {path : 'findby-category',component:FindbyCategoryComponent}, + {path : 'notification',component:NotificationComponent}, {path : 'bookreturn',component:BookreturnComponent}, {path : 'view-adminprofile',component:ViewAdminprofileComponent,canActivate: [HomeguardGuard]}, {path : 'imageupload',component:ImageuploadComponent,canActivate: [HomeguardGuard]}, diff --git a/FrontEnd/Library/src/app/books.service.ts b/FrontEnd/Library/src/app/books.service.ts index 537c492e..8d19febb 100644 --- a/FrontEnd/Library/src/app/books.service.ts +++ b/FrontEnd/Library/src/app/books.service.ts @@ -45,6 +45,7 @@ handleCsvError(err: HttpErrorResponse): any { return this.http.get(this.baseUrl+'/books/admin/pie') } + add(data:any):Observable{ return this.http.post(this.baseUrl+'/books',data) @@ -69,6 +70,7 @@ handleCsvError(err: HttpErrorResponse): any { } + pagination1(page:any,tableSize:any,sort:any,direction:any):Observable{ return this.http.get(this.baseUrl+"/books/admin/pagenated/?pageNo="+page+"&pageSize="+tableSize+"&sortBy="+sort+"&direction="+direction) diff --git a/FrontEnd/Library/src/app/books/books.component.html b/FrontEnd/Library/src/app/books/books.component.html index 4c3a1674..f967989b 100644 --- a/FrontEnd/Library/src/app/books/books.component.html +++ b/FrontEnd/Library/src/app/books/books.component.html @@ -21,15 +21,21 @@ flex-wrap: wrap; flex-direction: row; } */ + + } + +

ADD BOOKS

EDIT BOOKS

+ + @@ -70,6 +76,7 @@ + diff --git a/FrontEnd/Library/src/app/books/books.component.ts b/FrontEnd/Library/src/app/books/books.component.ts index 553600a3..e02bb8ec 100644 --- a/FrontEnd/Library/src/app/books/books.component.ts +++ b/FrontEnd/Library/src/app/books/books.component.ts @@ -14,169 +14,166 @@ import { MatDialog } from '@angular/material/dialog'; styleUrls: ['./books.component.css'] }) export class BooksComponent implements OnInit { + + + + categoryList: any[]; - categoryId:any; + categoryId: any; + + booksList: any[]; books: any; booksId: any; - categorydata:any; - booksdata:any; + + categorydata: any; + booksdata: any; catdata: any; - ObjSampleForm:FormGroup; + ObjSampleForm: FormGroup; displayStyle: any; - constructor(private router:Router , - private booksService:BooksService, - private service:CategoryService, - private imageService:ImageuploadService, - private toast : NgToastService) { - this.booksList=[]; - this.categoryList=[]; - - this.ObjSampleForm=new FormGroup( - { - categoryId:new FormControl('',[Validators.required]), - publication:new FormControl('',[Validators.required]), - booksName:new FormControl('',[Validators.required]), - auther:new FormControl('',[Validators.required]), - booksCopies:new FormControl('',[Validators.required]) - // categoryId:new FormControl('',[Validators.required]) , - } - ); - } + constructor(private router: Router, + private booksService: BooksService, + private service: CategoryService, + private imageService: ImageuploadService, + private toast: NgToastService, + private dialog: MatDialog,) { + this.booksList = []; + this.categoryList = []; + + this.ObjSampleForm = new FormGroup( + { + categoryId: new FormControl('', [Validators.required]), + publication: new FormControl('', [Validators.required]), + booksName: new FormControl('', [Validators.required]), + auther: new FormControl('', [Validators.required]), + booksCopies: new FormControl('', [Validators.required]) + // categoryId:new FormControl('',[Validators.required]) , + } + ); + } - ngOnInit(): void { - + ngOnInit(): void { - this.LoadCategory(); - this.loadEdit(); + this.LoadCategory(); + this.loadEdit(); -} - + } -disp(categoryId:any){ - console.log(categoryId) -} -LoadCategory() { - - this.service.LoadCategory().subscribe((data: any)=>{ - this.catdata=data; - console.log('catadata=',this.catdata) + + disp(categoryId: any) { + console.log(categoryId) + } + + LoadCategory() { + + this.service.LoadCategory().subscribe((data: any) => { + this.catdata = data; + }); - } - + } + clear() { localStorage.removeItem('categoryId'); + this.ObjSampleForm.reset() - } - -onSubmit(){ - - // let booksId=localStorage.getItem("booksId") - - if(this.booksId!=undefined){ - this.update(this.booksId) - }else - { - - - this.booksService.add(this.ObjSampleForm.value).subscribe(result=>{ - console.log(result); - if(result.booksId){ - console.log(result); - this.toast.success({detail:'Success',summary:'The Book '+result.booksName+' Added',duration:5000}); - this.imageService.setId(result.booksId) - console.log("bid=",result.booksId) - // MatDialog.close(); - this.router.navigate(['/imageupload']) - this.displayStyle = "none"; - } - else{ - this.toast.error({detail:'Invalid',summary:'Add new Book Failed',duration:5000}); - } - }) - } -} + onSubmit() { -closePopup() { - this.displayStyle = "none"; -} -loadEdit(): void{ - - let booksId=localStorage.getItem("booksId") - if(booksId!=null){ - this.booksService.edit(booksId).subscribe({ - next:(res)=>{ - this.booksId=res.booksId; - this.ObjSampleForm.controls['categoryId'].setValue(res.category.categoryId) - this.ObjSampleForm.controls['publication'].setValue(res.publication) - this.ObjSampleForm.controls['booksName'].setValue(res.booksName) - this.ObjSampleForm.controls['auther'].setValue(res.auther) - this.ObjSampleForm.controls['booksCopies'].setValue(res.booksCopies) - console.log("edit",res); - //console.log(res); - - }, - error:(msg)=>{} - }) -} -} + if (this.booksId != undefined) { + this.update(this.booksId) + } else { + + + this.booksService.add(this.ObjSampleForm.value).subscribe(result => { + if (result.booksId) { -update(booksId:any){ + this.toast.success({ detail: 'Success', summary: 'The Book ' + result.booksName + ' Added', duration: 5000 }); + this.imageService.setId(result.booksId) + this.router.navigate(['/imageupload']) + this.displayStyle = "none"; + } + else { + this.toast.error({ detail: 'Invalid', summary: 'Add new Book Failed', duration: 5000 }); + } + }) - console.log("ebd") - console.log(this.ObjSampleForm.controls['categoryId'].value) - let body={ - categoryId: this.ObjSampleForm.controls['categoryId'].value, - publication: this.ObjSampleForm.controls['publication'].value, - booksName: this.ObjSampleForm.controls['booksName'].value, - auther: this.ObjSampleForm.controls['auther'].value, - booksCopies: this.ObjSampleForm.controls['booksCopies'].value } + } - console.log(body) - - this.booksService.update(booksId, body).subscribe({ - next: (Response: any) => { - console.log(Response); - - - - - if (confirm('Do you want to change Book cover?')) { - this.toast.info({detail:'Success ',summary:'The book '+this.ObjSampleForm.controls['booksName'].value+' Edited Successfully',duration:5000}); - - this.imageService.setId(Response.booksId) - console.log("bookId=",Response.booksId) - this.router.navigate(['/imageupload']) - } else { - - this.toast.info({detail:'Success ',summary:this.ObjSampleForm.controls['booksName'].value+' Edited Successfully',duration:5000}); - - setTimeout(() => { - this.router.navigate(['/addbooks']) - window.location.reload() - }, 5000); - } - - - }, - error: (Response: any) => { - console.log(Response) - this.toast.success({detail:'Invalid',summary:'Enter valid details ',duration:5000}); + closePopup() { + this.displayStyle = "none"; + } + + loadEdit(): void { + + let booksId = localStorage.getItem("booksId") + if (booksId != null) { + this.booksService.edit(booksId).subscribe({ + next: (res) => { + this.booksId = res.booksId; + this.ObjSampleForm.controls['categoryId'].setValue(res.category.categoryId) + this.ObjSampleForm.controls['publication'].setValue(res.publication) + this.ObjSampleForm.controls['booksName'].setValue(res.booksName) + this.ObjSampleForm.controls['auther'].setValue(res.auther) + this.ObjSampleForm.controls['booksCopies'].setValue(res.booksCopies) + + + }, + error: (msg) => { } + }) + } + } + + + update(booksId: any) { + + let body = { + categoryId: this.ObjSampleForm.controls['categoryId'].value, + publication: this.ObjSampleForm.controls['publication'].value, + booksName: this.ObjSampleForm.controls['booksName'].value, + auther: this.ObjSampleForm.controls['auther'].value, + booksCopies: this.ObjSampleForm.controls['booksCopies'].value } - }) - localStorage.removeItem('booksId'); - } - + this.booksService.update(booksId, body).subscribe({ + next: (Response: any) => { + console.log(Response); + + if (confirm('Do you want to change Book cover?')) { + this.toast.info({ detail: 'Success ', summary: 'The book ' + this.ObjSampleForm.controls['booksName'].value + ' Edited Successfully', duration: 5000 }); + + this.imageService.setId(Response.booksId) + console.log("bookId=", Response.booksId) + this.router.navigate(['/imageupload']) + } else { + this.dialog.closeAll(); + this.toast.info({ detail: 'Success ', summary: this.ObjSampleForm.controls['booksName'].value + ' Edited Successfully', duration: 5000 }); + + setTimeout(() => { + this.router.navigate(['/addbooks']) + window.location.reload() + }, 3000); + } + + + }, + error: (Response: any) => { + console.log(Response) + this.toast.success({ detail: 'Invalid', summary: 'Enter valid details ', duration: 5000 }); + } + }) + localStorage.removeItem('booksId'); + } + + + } diff --git a/FrontEnd/Library/src/app/booksdisplay/booksdisplay.component.css b/FrontEnd/Library/src/app/booksdisplay/booksdisplay.component.css index 07f1f0c8..e1bda7e5 100644 --- a/FrontEnd/Library/src/app/booksdisplay/booksdisplay.component.css +++ b/FrontEnd/Library/src/app/booksdisplay/booksdisplay.component.css @@ -49,23 +49,25 @@ p { border-radius: 7px; } - +.table-bordered { + border: 1px solid; +} th { background-color: #232524; color: white; width: 15%; text-align: center; -} +} - td { +/* td { background-color: #a7bdb08f; color: rgb(0, 0, 0); width: 15%; text-align: center; margin-top: auto; padding: auto; -} +} */ .btnList { @@ -98,6 +100,13 @@ mat-grid-tile { height: 100px; } +.table { + margin-left: 100px; +width: 300px; +height: 250px; + + +} .example-card { max-width: 400px; @@ -107,9 +116,6 @@ mat-grid-tile { background-image: url('https://material.angular.io/assets/img/examples/shiba1.jpg'); background-size: cover; } - - - @media only screen and (max-width: 600px) { body { background-color: lightblue; diff --git a/FrontEnd/Library/src/app/booksdisplay/booksdisplay.component.html b/FrontEnd/Library/src/app/booksdisplay/booksdisplay.component.html index cb028afb..7f24d083 100644 --- a/FrontEnd/Library/src/app/booksdisplay/booksdisplay.component.html +++ b/FrontEnd/Library/src/app/booksdisplay/booksdisplay.component.html @@ -1,10 +1,11 @@ +

-

Books Details

+

Books Details

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

Books Detail }; "> +

@@ -50,7 +52,7 @@

Books Detail - + \ No newline at end of file diff --git a/FrontEnd/Library/src/app/booksdisplay/booksdisplay.component.ts b/FrontEnd/Library/src/app/booksdisplay/booksdisplay.component.ts index 32f6faaf..e2cadc46 100644 --- a/FrontEnd/Library/src/app/booksdisplay/booksdisplay.component.ts +++ b/FrontEnd/Library/src/app/booksdisplay/booksdisplay.component.ts @@ -11,114 +11,139 @@ import { CategoryService } from '../category.service'; styleUrls: ['./booksdisplay.component.css'] }) export class BooksdisplayComponent implements OnInit { + +//booksdata:any; +// categoryList: any[]; +categoryId:any; - categoryId: any; - books: any; - booksId: any; - categorydata: any; - booksdata: any; - catdata: any; - data: any; - page: number = 1; - count: any; - tableSize: number = 3; - ProdData: any; - sortedData: any; - a: any; - b: any; - searchResult: any - searchData: any - sort: string = "auther"; - len: any; - result: any; +// booksList: any[]; +books: any; +booksId: any; + +categorydata:any; +booksdata:any; +catdata: any; + +////////////// +data: any; +page:number=1; +count: any; +tableSize: number = 3; +ProdData: any; +sortedData: any; +a:any; +b:any; +searchResult:any +searchData:any +sort:string="auther"; +len: any; +result: any; booksCount: any; - direction = -1; - constructor(private router: Router, private booksservice: BooksService, private service: CategoryService, private borrowservice: BorrowService, private toast: NgToastService) { + direction=-1; - } + + constructor(private router:Router ,private booksservice:BooksService,private service:CategoryService,private borrowservice:BorrowService,private toast:NgToastService) { + // this.booksList=[]; + // this.categoryList=[]; + } ngOnInit(): void { - this.LoadData(); - this.borrowBlock(); + + +this.LoadData(); +this.borrowBlock(); + + + } - LoadData() { - this.booksservice.paginationForUser(this.page, this.tableSize, this.sort, this.direction).subscribe(result => { - this.result = result.content; - this.count = result.totalElements - console.log("loaded books=", this.result); - this.data = this.result; - }); + LoadData(){ + this.booksservice.paginationForUser(this.page,this.tableSize,this.sort,this.direction).subscribe(result=>{ + this.result=result.content; + this.count=result.totalElements + console.log("loaded books=",this.result); + this.data=this.result; + }); } - borrowBlock() { - this.borrowservice.borrowBlock().subscribe({ - next: (res) => { - this.booksCount = res; - console.log("block rslt=", res); - } - }) + + borrowBlock(){ +this.borrowservice.borrowBlock().subscribe({ + next:(res)=>{ + this.booksCount=res; + // console.log("blk"); + console.log("block rslt=",res); + }}) +} + +borrowStockEmpty(){ + +} + +sortfn(a:any){ + this.sort=a; + this.page=this.page; + this.tableSize; + + if(this.direction==1){ + this.direction=-1; + console.log("from desc to :",this.direction) + this.ngOnInit(); } - borrowStockEmpty() { + else{ + this.direction=1; + console.log("from asc to desc",this.direction) + this.ngOnInit(); } - sortfn(a: any) { - this.sort = a; - this.page = this.page; - this.tableSize; - - if (this.direction == 1) { - this.direction = -1; - console.log("from desc to :", this.direction) - this.ngOnInit(); - } + +} + - else { - this.direction = 1; - console.log("from asc to desc", this.direction) - this.ngOnInit(); - } +onTableDataChange(event:any) { + + console.log("page no=",event) + this.booksservice.paginationForUser(this.page,this.tableSize,this.sort,this.direction).subscribe(result=>{ + this.result=result.content; + this.count=result.totalElements + console.log("loaded books=",this.result); + this.data=this.result; + }) } - onTableDataChange(event: any) { - console.log("page no=", event) - this.booksservice.paginationForUser(this.page, this.tableSize, this.sort, this.direction).subscribe(result => { - this.result = result.content; - this.count = result.totalElements - console.log("loaded books=", this.result); - this.data = this.result; - }) - } - requestBook(booksId: any) { - console.log(booksId) - if (booksId.booksCopies == 0) { - alert("Sorry, This book is out of stock") - this.router.navigate(['/booksdisplay']) - } - else { - if (this.booksCount >= 3) { - alert("you cannot request any book, please return the current in hand books, thank you") - } - else { - let data = booksId - this.borrowservice.add(data).subscribe({ - next: (res) => { - this.booksId = res.booksId; - console.log(res); - this.toast.info({ summary: 'Booking Successfull', duration: 5000 }); - this.router.navigate(['/borrowhistory']) - }, - error: (msg) => { } - }) + requestBook(booksId: any) { + console.log(booksId) + if(booksId.booksCopies==0){ + alert("Sorry, This book is out of stock") + this.router.navigate(['/booksdisplay']) } + else{ + if(this.booksCount>=3){ + alert("you cannot request any book, please return the current in hand books, thank you") + } + else{ + let data=booksId + this.borrowservice.add(data).subscribe({ + next:(res)=>{ + this.booksId=res.booksId; + console.log(res); + + // alert("Book request successfull") + this.toast.info({summary:'Booking Successfull',duration:5000}); + this.router.navigate(['/borrowhistory']) + }, + error:(msg)=>{} + }) + }} } - } - home() { - this.router.navigate(['/userbody']) - } + + home() + { + this.router.navigate(['/userbody']) + } } diff --git a/FrontEnd/Library/src/app/borrow-detail-view/borrow-detail-view.component.css b/FrontEnd/Library/src/app/borrow-detail-view/borrow-detail-view.component.css index a96ee23b..fd9810c9 100644 --- a/FrontEnd/Library/src/app/borrow-detail-view/borrow-detail-view.component.css +++ b/FrontEnd/Library/src/app/borrow-detail-view/borrow-detail-view.component.css @@ -1,24 +1,10 @@ -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; - -} + table{ border: none; width: 35%; + margin-top:2%; + /* text-align: left; */ } diff --git a/FrontEnd/Library/src/app/borrow-detail-view/borrow-detail-view.component.html b/FrontEnd/Library/src/app/borrow-detail-view/borrow-detail-view.component.html index 262dcb4e..6bc9316b 100644 --- a/FrontEnd/Library/src/app/borrow-detail-view/borrow-detail-view.component.html +++ b/FrontEnd/Library/src/app/borrow-detail-view/borrow-detail-view.component.html @@ -1,16 +1,16 @@
-
+

-

Borrow Details

+

Borrow Details

-

{{books.booksName}} {{books.category.categoryName}} {{books.publication}}
+
- + diff --git a/FrontEnd/Library/src/app/borrow.service.ts b/FrontEnd/Library/src/app/borrow.service.ts index e0b34238..3d06d5dc 100644 --- a/FrontEnd/Library/src/app/borrow.service.ts +++ b/FrontEnd/Library/src/app/borrow.service.ts @@ -18,21 +18,10 @@ export class BorrowService { return _window(); } - // apiurl='http://localhost:8080'; - + baseUrl=environment.apiUrl; - accesstocken:any constructor(private http:HttpClient,private router:Router) { } - -handleError(err: HttpErrorResponse): any { - console.log('hhhii'); - if ( err.status === 403) { - alert("UNAUTHORIZED ACCESS DETECTED") - sessionStorage.clear() - localStorage.clear() - this.router.navigateByUrl(`/login`); } -} - + export(): Observable { return this.http.get(this.baseUrl+'/borrow/admin/export', { responseType: 'blob' }); @@ -52,6 +41,8 @@ handleError(err: HttpErrorResponse): any { return this.http.post(this.baseUrl+'/borrow',data) } + + borrowHistoryPagination(page:any,tableSize:any,sort:any){ return this.http.get(this.baseUrl+"/borrow/userBorrow/pagenated/?pageNo="+page+"&pageSize="+tableSize+"&sortBy="+sort) @@ -62,6 +53,12 @@ handleError(err: HttpErrorResponse): any { } + + finePagination(page:any,tableSize:any,sort:any,direction:any):Observable{ + return this.http.get(this.baseUrl+"/borrow/admin/fine/?pageNo="+page+"&pageSize="+tableSize+"&sortBy="+sort+"&direction="+direction) + + } + filterBorrowPagination(date1:any,date2:any,page:any,tableSize:any,sort:any,direction:any):Observable{ console.log(date1,' to ',date2) return this.http.get(this.baseUrl+"/borrow/admin/"+date1+"/"+date2+"/?pageNo="+page+"&pageSize="+tableSize+"&sortBy="+sort+"&direction="+direction) @@ -79,15 +76,18 @@ handleError(err: HttpErrorResponse): any { } + AdminStatusfilterBorrow(page:any,tableSize:any,sort:any,direction:any,status:any):Observable{ + return this.http.get(this.baseUrl+"/borrow/admin/statusFilter/?pageNo="+page+"&pageSize="+tableSize+"&sortBy="+sort+"&direction="+direction+"&status="+status) + + } + LoadByIssueDate(date1:any,date2:any){ return this.http.get(this.baseUrl+ "/borrow/loadByIssueDate/"+date1+"/"+date2); } //user LoadByIssueDateUser(date1:any,date2:any){ - - return this.http.get(this.baseUrl + "/borrow/user/loadByIssueDateUser/"+date1+"/"+date2); - } - + return this.http.get(this.baseUrl+"/borrow/user/loadByIssueDateUser/"+date1+"/"+date2); + } Load(){ return this.http.get(this.baseUrl+'/borrow') @@ -111,10 +111,9 @@ handleError(err: HttpErrorResponse): any { return this.http.get(this.baseUrl+'/borrow/admin/fine') } - + //user LoadDueByUser(){ - - return this.http.get('http://localhost:8080/borrow/user/dueByUser').pipe((catchError(err => this.handleError(err)))); + return this.http.get(this.baseUrl+'/borrow/user/dueByUser') } @@ -129,19 +128,20 @@ handleError(err: HttpErrorResponse): any { } LoadUserNotification(){ + return this.http.get(this.baseUrl+'/borrow/user/UserNotification') - return this.http.get('http://localhost:8080/borrow/user/UserNotification').pipe((catchError(err => this.handleError(err)))); } - - + getBorrowID(borrowId:any){ return this.http.get(this.baseUrl+'/borrow'+borrowId); } + payment(id: any) { return this.http.put(this.baseUrl+ "/borrow/user/paymentStatus/" + id,{headers:Headers}); } + delete(booksId:any):Observable{ let tocken=localStorage.getItem('accesstoken') let head_obj=new HttpHeaders({"Authorization":"library " + tocken}) @@ -149,6 +149,7 @@ handleError(err: HttpErrorResponse): any { } + update(id: any, data: any) { return this.http.put(this.baseUrl + "/borrow/admin/accept/" + localStorage.getItem('borrowId'), data) @@ -170,6 +171,8 @@ handleError(err: HttpErrorResponse): any { } + + edit(booksId:any): Observable{ let tocken=localStorage.getItem('accesstoken') let head_obj=new HttpHeaders({"Authorization":"library " + tocken}) diff --git a/FrontEnd/Library/src/app/borrow/borrow.component.html b/FrontEnd/Library/src/app/borrow/borrow.component.html index 52f7d179..6b0998a6 100644 --- a/FrontEnd/Library/src/app/borrow/borrow.component.html +++ b/FrontEnd/Library/src/app/borrow/borrow.component.html @@ -48,7 +48,7 @@

Borrow Details

- diff --git a/FrontEnd/Library/src/app/borrow/borrow.component.ts b/FrontEnd/Library/src/app/borrow/borrow.component.ts index c5b3481a..990f4607 100644 --- a/FrontEnd/Library/src/app/borrow/borrow.component.ts +++ b/FrontEnd/Library/src/app/borrow/borrow.component.ts @@ -35,12 +35,14 @@ export class BorrowComponent implements OnInit { result: any; direction=1; direction1=-1; - + status=1; + selectedGroup: any; + selected="status"; constructor(private router:Router , private datePipe:DatePipe, private service:BorrowService, private toast : NgToastService) { - + this.date=new Date(); } @@ -68,8 +70,80 @@ export class BorrowComponent implements OnInit { date1:new FormControl('',[Validators.required]), date2:new FormControl('',[Validators.required]), + } ) + + + filter:FormGroup = new FormGroup({ + status:new FormControl('',[Validators.required]) + + }) + + + + + + + + + + + + disp1() { + // this.status=1; + console.log('stat-------------------=',this.status) + if(this.filter.controls['status'].value==1){ + console.log('/////------------=',this.status) + this.service.AdminStatusfilterBorrow(this.page,this.tableSize,this.sort,this.direction,1).subscribe(response=>{ + this.result=response.content; + this.count=response.totalElements + console.log('in approved',this.result); + this.data=this.result; + }); + } + else if(this.filter.controls['status'].value==2){ + console.log('>>>>>>>>>>>>>>>>>>>>>>>>>>',this.status) + this.service.AdminStatusfilterBorrow(this.page,this.tableSize,this.sort,this.direction,2).subscribe(response=>{ + this.result=response.content; + this.count=response.totalElements + console.log(this.result); + this.data=this.result; + }); } - ) + + else if(this.filter.controls['status'].value==3){ + + this.service.AdminStatusfilterBorrow(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.AdminStatusfilterBorrow(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{ + + } + + } + + + + + + + + + + dwn() { diff --git a/FrontEnd/Library/src/app/borrowhistory/borrowhistory.component.html b/FrontEnd/Library/src/app/borrowhistory/borrowhistory.component.html index 57dd89c1..dea0afcb 100644 --- a/FrontEnd/Library/src/app/borrowhistory/borrowhistory.component.html +++ b/FrontEnd/Library/src/app/borrowhistory/borrowhistory.component.html @@ -1,41 +1,27 @@ + - - - - -
-

Borrow Details

- - - - +

Borrow Details

+ +
+ +
+ START DATE          + END DATE         +          
-
+
- +
NAME : {{this.borrowdata.user.firstName}}
BOOK NAME : {{this.borrowdata.books.booksName}}
ISSUE DATE : {{this.borrowdata.issueDate| date:'dd/MM/yyyy'}}Issue Date - + Due Date @@ -60,9 +60,22 @@

Borrow Details

Status + + + + + +
@@ -47,7 +33,7 @@

Borrow Details

+ + + { - this.result = response.content; - this.count = response.totalElements - console.log(this.result); - this.data = this.result; - }); + else if(this.filter.controls['status'].value==2){ + + this.service.statusfilterBor(this.page,this.tableSize,this.sort,this.direction,2).subscribe(response=>{ + this.result=response.content; + this.count=response.totalElements + console.log(this.result); + this.data=this.result; + }); } - else if (this.filter.controls['status'].value == 3) { + else if(this.filter.controls['status'].value==3){ - this.service.statusfilterBor(this.page, this.tableSize, this.sort, this.direction, 3).subscribe(response => { - this.result = response.content; - this.count = response.totalElements - console.log(this.result); - this.data = this.result; - }); + this.service.statusfilterBor(this.page,this.tableSize,this.sort,this.direction,3).subscribe(response=>{ + this.result=response.content; + this.count=response.totalElements + console.log(this.result); + this.data=this.result; + }); } - else if (this.filter.controls['status'].value == 4) { + else if(this.filter.controls['status'].value==4){ - this.service.statusfilterBor(this.page, this.tableSize, this.sort, this.direction, 4).subscribe(response => { - this.result = response.content; - this.count = response.totalElements - console.log(this.result); - this.data = this.result; - }); + this.service.statusfilterBor(this.page,this.tableSize,this.sort,this.direction,4).subscribe(response=>{ + this.result=response.content; + this.count=response.totalElements + console.log(this.result); + this.data=this.result; + }); } - else { - + else{ + } - + } ngOnInit(): void { @@ -97,6 +103,7 @@ export class BorrowhistoryComponent implements OnInit { //this.data=result; }) + //this.onTableDataChange(this.page); if (this.searchData == null || this.searchData == "") { this.service.borrowHistoryPagination(this.page, this.tableSize, this.sort).subscribe((result => { @@ -130,11 +137,11 @@ export class BorrowhistoryComponent implements OnInit { } ) - filter: FormGroup = new FormGroup({ - status: new FormControl('', [Validators.required]) - - }) - + filter:FormGroup = new FormGroup({ + status:new FormControl('',[Validators.required]) + + }) + // sortData(sort: Sort) { // const data1 = this.data.slice(); @@ -185,23 +192,23 @@ export class BorrowhistoryComponent implements OnInit { this.len = result; console.log(result) this.count = this.len.length; - console.log('1111', this.sort); + console.log('1111',this.sort); }) - - this.service.filterBorrowPagination2(this.ObjSampleForm.controls['date1'].value, this.ObjSampleForm.controls['date2'].value, this.page, this.tableSize, this.sort).subscribe({ - next: (res: any) => { - console.log('filter', res); - console.log(this.ObjSampleForm.controls['date1'].value); - this.data = res; - }, - }); + + this.service.filterBorrowPagination2(this.ObjSampleForm.controls['date1'].value, this.ObjSampleForm.controls['date2'].value, this.page, this.tableSize, this.sort).subscribe({ + next: (res: any) => { + console.log('filter',res); + console.log(this.ObjSampleForm.controls['date1'].value); + this.data = res; + }, + }); } - display() { - console.log('display works') + display(){ +console.log('display works') } - + clearFilter() { this.flag = 0; window.location.reload(); diff --git a/FrontEnd/Library/src/app/category.service.ts b/FrontEnd/Library/src/app/category.service.ts index 5c71ba1d..31bdfacd 100644 --- a/FrontEnd/Library/src/app/category.service.ts +++ b/FrontEnd/Library/src/app/category.service.ts @@ -16,16 +16,6 @@ export class CategoryService { constructor(private http:HttpClient,private router:Router) { } - handleError(err: HttpErrorResponse): any { - console.log('hhhii'); - if ( err.status === 403) { - alert("UNAUTHORIZED ACCESS DETECTED") - sessionStorage.clear() - localStorage.clear() - this.router.navigateByUrl(`/login`); } - } - - addCategory(data:any):Observable{ diff --git a/FrontEnd/Library/src/app/category/category.component.ts b/FrontEnd/Library/src/app/category/category.component.ts index 7e842c9c..84e58fa5 100644 --- a/FrontEnd/Library/src/app/category/category.component.ts +++ b/FrontEnd/Library/src/app/category/category.component.ts @@ -2,13 +2,13 @@ import { Component, OnInit } from '@angular/core'; import { FormControl, FormGroup, Validators } from '@angular/forms'; import { Router } from '@angular/router'; import { CategoryService } from '../category.service'; -import {MatDialog, MAT_DIALOG_DATA, MatDialogRef} from '@angular/material/dialog'; +import { MatDialog, MAT_DIALOG_DATA, MatDialogRef } from '@angular/material/dialog'; import { NgToastService } from 'ng-angular-popup'; -export interface DialogData { -categoryName:string; +export interface DialogData { + categoryName: string; } @Component({ @@ -20,114 +20,130 @@ export class CategoryComponent implements OnInit { -categoryId:any; -categoryName:any; -data: any; -test:any; + categoryId: any; + categoryName: any; + data: any; + test: any; -ObjSampleForm:FormGroup; + ObjSampleForm: FormGroup; constructor( - private router:Router , - private service:CategoryService, - private toast : NgToastService, - ) - { - this.ObjSampleForm=new FormGroup( - { - categoryName:new FormControl('',[Validators.required]), - } - ); - } + private router: Router, + private service: CategoryService, + private toast: NgToastService, + private dialog: MatDialog, + ) { + this.ObjSampleForm = new FormGroup( + { + categoryName: new FormControl('', [Validators.required]), + } + ); + } ngOnInit(): void { -this.LoadEdit() + this.LoadEdit() } - -LoadEdit(){ - let categoryId=localStorage.getItem("categoryId") + LoadEdit() { + let categoryId = localStorage.getItem("categoryId") - if(categoryId!=null){ - this.service.editCategory(categoryId).subscribe({ - next:(res)=>{ - this.categoryId=res.categoryId; - this.ObjSampleForm.controls['categoryName'].setValue(res.categoryName) - - - }, - error:(msg)=>{} - }) -} -} + if (categoryId != null) { + this.service.editCategory(categoryId).subscribe({ + next: (res) => { + this.categoryId = res.categoryId; + this.ObjSampleForm.controls['categoryName'].setValue(res.categoryName) - categorydata:any; + }, + error: (msg) => { } + }) + } + } + categorydata: any; -onSubmit(){ + onSubmit() { - let categoryId=localStorage.getItem("categoryId") + let categoryId = localStorage.getItem("categoryId") - if(categoryId!=undefined){ - this.updateCategory(categoryId) - }else{ - this.addCategory() + if (categoryId != undefined) { + this.updateCategory(categoryId) + } else { + this.addCategory() + + } } + + addCategory() { + this.service.addCategory(this.ObjSampleForm.value).subscribe({ + next: (result: any) => { -} - addCategory(){ - this.service.addCategory(this.ObjSampleForm.value).subscribe(result=>{ - - if(result.categoryId){ - this.toast.success({detail:'Success',summary:'The Category '+result.categoryName+' Added',duration:5000}); - this.router.navigate(['/addcategory']) - + if (result.categoryId) { + this.toast.success({ detail: 'Success', summary: 'The Category ' + result.categoryName + ' Added', duration: 5000 }); + + setTimeout(() => { + this.router.navigate(['/addcategory']) + this.dialog.closeAll(); + window.location.reload(); + }, 1000); + + } - + + }, + error: (Response: any) => { + console.log(Response) + if (Response.status == 400) { + this.toast.warning({ detail: 'Failed', summary: 'Please Fill up the fields', duration: 10000, position: 'tr' }) } - else{ - alert("category Not added"); + else if (Response.status == 500) { + this.toast.warning({ detail: 'FAILED to add Category', summary: 'INTERNAL SERVER ERROR', duration: 5000, position: 'tr' }) } - }) - } + } + }) -updateCategory(categoryId:any){ - let body={ - categoryName: this.ObjSampleForm.controls['categoryName'].value } - console.log(body) - this.service.update(categoryId, body).subscribe({ - next: (Response: any) => { + updateCategory(categoryId: any) { + let body = { + categoryName: this.ObjSampleForm.controls['categoryName'].value + } - this.toast.success({detail:'Success',summary:'The Category - '+Response.categoryName+' Edited',duration:5000}); - // setTimeout(() => { - this.router.navigate(['/addcategory']) - // }, 1500); + this.service.update(categoryId, body).subscribe({ + next: (Response: any) => { - }, - error: (Response: any) => { - console.log(Response) - alert("invalid Category credentials") - } - }) - localStorage.removeItem('categoryId'); + this.toast.success({ detail: 'Success', summary: 'The Category - ' + Response.categoryName + ' Edited', duration: 5000 }); + setTimeout(() => { + + this.router.navigate(['/addcategory']) + this.dialog.closeAll(); + window.location.reload(); + }, 1000); + + }, + error: (Response: any) => { + console.log(Response) + alert("invalid Category credentials") + } + }) + + + localStorage.removeItem('categoryId'); - } - clear() { - localStorage.removeItem('categoryId'); - window.location.reload() } - + clear() { + localStorage.removeItem('categoryId'); + this.ObjSampleForm.reset() + } + + - } diff --git a/FrontEnd/Library/src/app/email.service.ts b/FrontEnd/Library/src/app/email.service.ts index 5c106eec..bf9ec2de 100644 --- a/FrontEnd/Library/src/app/email.service.ts +++ b/FrontEnd/Library/src/app/email.service.ts @@ -22,4 +22,9 @@ export class EmailService { verify(data:any):Observable{ return this.http.post(this.baseUrl+'/email/verify',data) } + + + verifyPassword(data:any):Observable{ + return this.http.post(this.baseUrl+'/email/verifyPassword',data) + } } diff --git a/FrontEnd/Library/src/app/findby-category/findby-category.component.css b/FrontEnd/Library/src/app/findby-category/findby-category.component.css index aea931c0..6103feba 100644 --- a/FrontEnd/Library/src/app/findby-category/findby-category.component.css +++ b/FrontEnd/Library/src/app/findby-category/findby-category.component.css @@ -54,15 +54,15 @@ p{ border: 1px solid; } th { - background-color: white; - color:black; + background-color: #232524; + color: white; width: 15%; text-align: center; border: none; } td { - background-color: white; - color: black; + background-color: #a7bdb08f; + color: rgb(0, 0, 0); width: 15%; text-align: center; margin-top: auto; @@ -80,7 +80,3 @@ th { color: rgb(255, 255, 255); border-radius: 3px; } -.btnn2{ - background-color: black; - color: white; -} \ No newline at end of file diff --git a/FrontEnd/Library/src/app/findby-category/findby-category.component.html b/FrontEnd/Library/src/app/findby-category/findby-category.component.html index e0c33c7f..33a8b33b 100644 --- a/FrontEnd/Library/src/app/findby-category/findby-category.component.html +++ b/FrontEnd/Library/src/app/findby-category/findby-category.component.html @@ -1,77 +1,60 @@ - - - - - -
-
- -
+
+ +
+
Return Date Due date - +

-
- -
- - - - -
- -
- - - - - - - - - - - - - - - - - - - - - - - - -
Book NameCategory-NamePublicationAuthorBook CopiesBook CoverAction
{{books.booksName}}{{books.category.categoryName}}{{books.publication}}{{books.auther}}{{books.booksCopies}} - - - -
+ + + +
+
- - +
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Book NameCategory-NamePublicationAuthorBook 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/findby-category/findby-category.component.ts b/FrontEnd/Library/src/app/findby-category/findby-category.component.ts index e8560cc1..2fcb6ea4 100644 --- a/FrontEnd/Library/src/app/findby-category/findby-category.component.ts +++ b/FrontEnd/Library/src/app/findby-category/findby-category.component.ts @@ -13,60 +13,76 @@ import { CategoryService } from '../category.service'; export class FindbyCategoryComponent implements OnInit { categoryList: any[]; - categoryId: any; + categoryId:any; booksList: any[]; books: any; booksId: any; - selectedGroup: any; + selectedGroup:any; - categorydata: any; - booksdata: any; + categorydata:any; + booksdata:any; catdata: any; - ObjSampleForm: FormGroup = new FormGroup( - { - categoryId: new FormControl('', [Validators.required]) + ObjSampleForm:FormGroup=new FormGroup( + { + categoryId:new FormControl('',[Validators.required]) }) - - constructor(private router: Router, private booksService: BooksService, private service: CategoryService, private borrowservice: BorrowService) { - this.booksList = []; - this.categoryList = []; - } + + constructor(private router:Router ,private booksService:BooksService,private service:CategoryService,private borrowservice:BorrowService) { + this.booksList=[]; + this.categoryList=[];} ngOnInit(): void { - this.service.LoadCategoryForUser().subscribe((data: any) => { - this.catdata = data; - console.log(this.catdata) + + + this.service.LoadCategoryForUser().subscribe((data: any)=>{ + this.catdata=data; + console.log(this.catdata) }); - } - home() { + + } + + + home() + { this.router.navigate(['/userbody']) } - disp() { - console.log(this.selectedGroup); - this.booksService.LoadbyCategory(this.selectedGroup).subscribe((data: any) => { - if (data.length>0) { - this.booksdata = data; - console.log(data) - } else{ - this.booksdata=null - } - }); - } -requestBook(booksId: any) { - console.log(booksId) - let data = booksId - this.borrowservice.add(data).subscribe({ - next: (res) => { - this.booksId = res.booksId; - console.log(res); - alert("Book request successfull") + disp(){ + + console.log(this.selectedGroup); + // console.log(this.selectedGroup.categoryId); + // console.log(this.categoryId) + //this.LoadbyCategory(); + this.booksService.LoadbyCategory(this.selectedGroup).subscribe((data: any)=>{ + console.log(data) + this.booksdata=data; + }); + } + + + + + requestBook(booksId: any) { + console.log(booksId) + let data=booksId + this.borrowservice.add(data).subscribe({ + next:(res)=>{ + this.booksId=res.booksId; + console.log(res); + alert("Book request successfull") this.router.navigate(['/borrowhistory']) - }, - error: (msg) => { } - }) - } + }, + error:(msg)=>{} + }) + } + + // LoadbyCategory() { + // this.booksService.LoadbyCategory().subscribe((data: any)=>{ + // console.log(data) + // this.booksdata=data; + // }); } + } diff --git a/FrontEnd/Library/src/app/fine/fine.component.css b/FrontEnd/Library/src/app/fine/fine.component.css index 6c5a7184..03948260 100644 --- a/FrontEnd/Library/src/app/fine/fine.component.css +++ b/FrontEnd/Library/src/app/fine/fine.component.css @@ -1,3 +1,44 @@ +* { + box-sizing: border-box; +} + + + +@media only screen and (max-width: 620px) { + /* For mobile phones: */ + .menu, .main, .right { + width: 100%; + } + .right { +right: 0; +width: 100%; +float: left; +background-color: rgb(255, 255, 255); +} + +table{ +width: 55%; +border: none; +text-align: center; +position:relative; +overflow-x: scroll; +overflow-x: visible; +font-size: 0.675em; +/* overflow-x: scroll; +overflow:visible; */ +} + + +} + + + + + + + + + .split { height: 100%; /* width: 50%; */ diff --git a/FrontEnd/Library/src/app/fine/fine.component.html b/FrontEnd/Library/src/app/fine/fine.component.html index b9486537..16a3cf32 100644 --- a/FrontEnd/Library/src/app/fine/fine.component.html +++ b/FrontEnd/Library/src/app/fine/fine.component.html @@ -3,43 +3,9 @@ - - - -
@@ -65,7 +31,14 @@

OUTSTANDING FINE DETAILS

- + {{borrow.user.firstName}} {{borrow.books.booksName}} @@ -75,15 +48,15 @@

OUTSTANDING FINE DETAILS

{{borrow.fine}} - - NO RECORDS FOUND - - + - +
+ + +
diff --git a/FrontEnd/Library/src/app/fine/fine.component.ts b/FrontEnd/Library/src/app/fine/fine.component.ts index 09e600e0..771836b6 100644 --- a/FrontEnd/Library/src/app/fine/fine.component.ts +++ b/FrontEnd/Library/src/app/fine/fine.component.ts @@ -14,35 +14,82 @@ export class FineComponent implements OnInit { borrowdata:any; booksdata:any; data:number=1; + + + + +page:number=1; +count: any; +tableSize: number = 10; +a:any; +b:any; +sort:string="borrow_id"; +len: any; +result: any; +booksCount: any; +direction=-1; + constructor(private router:Router ,private service:BorrowService,private booksService:BooksService) { } ngOnInit(): void { - sessionStorage.clear() + this.LoadBorrow() } LoadBorrow(){ - this.service.LoadFine().subscribe((data: any)=>{ - this.borrowdata=data; + this.service.finePagination(this.page,this.tableSize,this.sort,this.direction).subscribe(result=>{ + this.result=result.content; + this.count=result.totalElements + this.data=this.result; + this.borrowdata=this.result; + - if(data.length!==0){ - this.data=0; + // if(result.length!==0){ + // this.data=0; - } - else if(data.length==0){ - this.data=1; - } + // } + // else if(result.length==0){ + // this.data=1; + // } + }); - } + + sortfn(a:any){ + this.sort=a; + this.page=this.page; + this.tableSize; + + if(this.direction==1){ + this.direction=-1; + this.ngOnInit(); + } + + else{ + this.direction=1; + this.ngOnInit(); + } + + } + + onTableDataChange(event:any) { + + + this.service.finePagination(this.page,this.tableSize,this.sort,this.direction).subscribe(result=>{ + this.result=result.content; + this.count=result.totalElements + this.data=this.result; + this.borrowdata=this.result; + }) + } diff --git a/FrontEnd/Library/src/app/forgotpassword/forgotpassword.component.css b/FrontEnd/Library/src/app/forgotpassword/forgotpassword.component.css index 5036e2dc..347555cf 100644 --- a/FrontEnd/Library/src/app/forgotpassword/forgotpassword.component.css +++ b/FrontEnd/Library/src/app/forgotpassword/forgotpassword.component.css @@ -97,15 +97,15 @@ input { /* spinner css */ .loader { - border: 16px solid #f3f3f3; + border: 7px solid #f3f3f3; border-radius: 50%; - border-top: 16px solid #3498db; - width: 120px; - height: 120px; + border-top: 7px solid #3498db; + width: 60px; + height: 60px; -webkit-animation: spin 2s linear infinite; /* Safari */ animation: spin 2s linear infinite; z-index: 1; - margin-left: 45%; + margin-left: 47%; } diff --git a/FrontEnd/Library/src/app/forgotpassword/forgotpassword.component.html b/FrontEnd/Library/src/app/forgotpassword/forgotpassword.component.html index 21af8a46..578a76f4 100644 --- a/FrontEnd/Library/src/app/forgotpassword/forgotpassword.component.html +++ b/FrontEnd/Library/src/app/forgotpassword/forgotpassword.component.html @@ -2,7 +2,7 @@
+
+
+ + + + diff --git a/FrontEnd/Library/src/app/forgotpassword/forgotpassword.component.ts b/FrontEnd/Library/src/app/forgotpassword/forgotpassword.component.ts index f32b205d..c8116dd5 100644 --- a/FrontEnd/Library/src/app/forgotpassword/forgotpassword.component.ts +++ b/FrontEnd/Library/src/app/forgotpassword/forgotpassword.component.ts @@ -11,132 +11,150 @@ import { EmailService } from '../email.service'; }) export class ForgotpasswordComponent implements OnInit { displayStyle: any; - result:any; - rslt=0; - val=0; - spin=0; + result: any; + rslt = 0; + val = 0; + spin = 0; - ObjForm:FormGroup=new FormGroup({ - sentto:new FormControl('',[Validators.maxLength(50),Validators.required]), + ObjForm: FormGroup = new FormGroup({ + sentto: new FormControl('', [Validators.maxLength(50), Validators.required]), }) - ObjForgetForm:FormGroup=new FormGroup({ - otp:new FormControl('',[Validators.maxLength(50),Validators.required]), - newPassword:new FormControl('',[Validators.maxLength(50),Validators.required]), - cnewPassword:new FormControl('',[Validators.maxLength(50),Validators.required]), - email:new FormControl() + ObjForgetForm: FormGroup = new FormGroup({ + otp: new FormControl('', [Validators.maxLength(50), Validators.required]), + newPassword: new FormControl('', [Validators.maxLength(50), Validators.required]), + cnewPassword: new FormControl('', [Validators.maxLength(50), Validators.required]), + email: new FormControl() }) email: any; - constructor( private emails:EmailService, - private toast:NgToastService, - private router:Router) { } - ngOnInit(): void { - console.log('rslt=',this.rslt) + constructor(private emails: EmailService, + private toast: NgToastService, + private router: Router) { } + + ngOnInit(): void { - this.ObjForgetForm.reset() - this.spin=0; + this.spin = 0; - if(this.rslt==1){ - this.toast.error({detail:'OTP Sent Failed :(',summary:'Unregistered Email Detected ', duration:5000,position:'tr'}) + if (this.rslt == 1) { + this.toast.error({ detail: 'OTP Sent Failed :(', summary: 'Unregistered Email Detected ', duration: 5000, position: 'tr' }) setTimeout(() => { - this.ObjForm.reset() - this.rslt=0; - this.val=0; - }, 3000); + this.ObjForm.reset() + this.rslt = 0; + this.val = 0; + }, 3000); + } - + } - Login() - { + Login() { this.router.navigate(['/login']) } -//verify otp - SaveData() { - - - this.ObjForgetForm.value.email=this.email; - - if(this.ObjForgetForm.value.otp==null ) { - this.toast.warning({detail:'OTP =required',summary:'Please Enter valid OTP', duration:10000,position:'tr'}) - } - if(this.ObjForgetForm.value.newPassword==null ) { - this.toast.warning({detail:' Password required',summary:'Please EnternewPassword', duration:10000,position:'tr'}) - } - - - if(this.ObjForgetForm.value.newPassword==this.ObjForgetForm.value.cnewPassword){ - this.emails.verify(this.ObjForgetForm.value).subscribe(result=>{ - if(result){ - this.toast.success({detail:'password changed',summary:'Please Login', duration:10000,position:'tr'}) - this.router.navigate(['/login']) - } - else{ - this.toast.warning({detail:'Failed',summary:'Please Enter valid OTP', duration:10000,position:'tr'}) - } - - }) + closePopup() { + this.displayStyle = "none"; + this.ObjForgetForm.reset() } - else{ - this.toast.warning({detail:'Password Mismatch',summary:'Please Enter valid password', duration:10000,position:'tr'}) - - + openSuccess() { + this.toast.success({ detail: 'OTP Sent Success', summary: 'OTP Has been Sent to your mail', duration: 5000, position: 'tr' }) } - } - //send otp openPopup() { - - if(this.ObjForm.valid!==true){ - this.toast.warning({detail:'Warning',summary:'Please provide email ', duration:5000,position:'tr'}) - this.val=0 - } - else{ - this.val=1; - this.spin=1; - console.log("val=",this.val) - console.log("spin=",this.spin) - this.email=this.ObjForm.value.sentto; - this.emails.sendotp(this.ObjForm.value).subscribe((result=>{ - this.rslt=2; - this.spin=0; - this.openSuccess(); - console.log("msg=",result) + this.val = 1; + this.spin = 1; + this.email = this.ObjForm.value.sentto; + this.emails.sendotp(this.ObjForm.value).subscribe((result => { + this.rslt = 2; + this.spin = 0; + this.openSuccess(); }), - (error)=>{ -// console.log("in err-",error.status) -// if(error.status===406){ - this.rslt=1; - this.ngOnInit() - // } - - - }); - - - } + (error) => { + + if (error.status == 406) { + this.toast.error({ detail: 'OTP Sent Failed :(', summary: 'Fill the fields', duration: 5000, position: 'tr' }) + this.spin = 0; + this.val = 0; + } + + else if (error.status == 400) { + this.rslt = 1; + this.spin = 0; + this.ngOnInit() + } + + else if (error.status == 417) { + this.toast.error({ detail: 'OTP Sent Failed :(', summary: 'Internal server error', duration: 5000, position: 'tr' }) + } + + + }); + + this.displayStyle = "block"; - this.displayStyle = "block"; - } - closePopup() { - this.displayStyle = "none"; - this.ObjForgetForm.reset() + //verify otp + Otp() { + + this.ObjForgetForm.value.email = this.email; + this.emails.verify(this.ObjForgetForm.value).subscribe({ + next: (result: any) => { + this.val = 2; + this.toast.success({ detail: 'OTP', summary: 'Please Change Password', duration: 10000, position: 'tr' }) + + }, + error: (Response: any) => { + console.log("response-", Response.error) + if (Response.status == 400) { + this.toast.warning({ detail: 'Failed', summary: 'Please Fill in the fields', duration: 5000, position: 'tr' }) + } + else if (Response.status == 406) { + this.toast.error({ detail: 'Failed', summary: 'OTP VERIFICATION FAILED', duration: 5000, position: 'tr' }) + } + else if (Response.status == 504) { + this.toast.error({ detail: 'Failed', summary: 'OTP EXPIRED', duration: 5000, position: 'tr' }) + } + } + }) } - openSuccess(){ - this.toast.success({detail:'OTP Sent Success',summary:'OTP Has been Sent to your mail', duration:5000,position:'tr'}) - } + + + + ChangePassword() { + + this.ObjForgetForm.value.email = this.email; + this.emails.verifyPassword(this.ObjForgetForm.value).subscribe({ + next: (result: any) => { + console.log("log", result) + this.toast.success({ detail: 'Success', summary: 'Changed Password, please Login', duration: 10000, position: 'tr' }) + this.router.navigate(['/login']) + }, + error: (Response: any) => { + console.log(Response) + if (Response.status == 400) { + this.toast.warning({ detail: 'Failed', summary: 'Please Fill up the fields', duration: 10000, position: 'tr' }) + } + else if (Response.status == 502) { + this.toast.warning({ detail: 'Failed', summary: 'Password missmatch', duration: 10000, position: 'tr' }) + } + else if (Response.status == 500) { + this.toast.warning({ detail: 'Failed to change password', summary: 'INTERNAL SERVER ERROR', duration: 10000, position: 'tr' }) + } + + } + + }) + + } } diff --git a/FrontEnd/Library/src/app/homepage/homepage.component.css b/FrontEnd/Library/src/app/homepage/homepage.component.css index c75a2809..0aa062c7 100644 --- a/FrontEnd/Library/src/app/homepage/homepage.component.css +++ b/FrontEnd/Library/src/app/homepage/homepage.component.css @@ -1,7 +1,7 @@ .home img { width: 100%; - height: 635px; + height: 574px; object-position: center; } diff --git a/FrontEnd/Library/src/app/homepage/homepage.component.html b/FrontEnd/Library/src/app/homepage/homepage.component.html index a3b0958b..908a0b89 100644 --- a/FrontEnd/Library/src/app/homepage/homepage.component.html +++ b/FrontEnd/Library/src/app/homepage/homepage.component.html @@ -1,12 +1,4 @@ - - - -
diff --git a/FrontEnd/Library/src/app/login/login.component.html b/FrontEnd/Library/src/app/login/login.component.html index 396cf4af..32b28486 100644 --- a/FrontEnd/Library/src/app/login/login.component.html +++ b/FrontEnd/Library/src/app/login/login.component.html @@ -4,6 +4,7 @@
Library

+