diff --git a/BackEnd/Library/pom.xml b/BackEnd/Library/pom.xml index 2818a626..718ee8a8 100644 --- a/BackEnd/Library/pom.xml +++ b/BackEnd/Library/pom.xml @@ -73,6 +73,15 @@ spring-boot-starter-test test + + + org.apache.commons + commons-csv + 1.8 + + + + diff --git a/BackEnd/Library/src/main/java/com/innovature/Library/configuration/WebSecurityConfiguration.java b/BackEnd/Library/src/main/java/com/innovature/Library/configuration/WebSecurityConfiguration.java index 151c2bde..6209278b 100644 --- a/BackEnd/Library/src/main/java/com/innovature/Library/configuration/WebSecurityConfiguration.java +++ b/BackEnd/Library/src/main/java/com/innovature/Library/configuration/WebSecurityConfiguration.java @@ -9,6 +9,9 @@ import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.http.HttpMethod; + +import static org.springframework.http.HttpMethod.DELETE; +import static org.springframework.http.HttpMethod.GET; import static org.springframework.http.HttpMethod.OPTIONS; import static org.springframework.http.HttpMethod.POST; import static org.springframework.http.HttpMethod.PUT; @@ -54,11 +57,37 @@ protected void configure(HttpSecurity http) throws Exception { .antMatchers(POST, "/users").anonymous() .antMatchers(OPTIONS, "/login").anonymous() .antMatchers(POST, "/login").anonymous() + .antMatchers(POST, "/email/**").anonymous() .antMatchers(PUT, "/login").anonymous() - .antMatchers(OPTIONS, "/**").anonymous() + .antMatchers(OPTIONS, "/**").anonymous() + + //category + .antMatchers(GET,"/category/admin").access("hasRole('ROLE_ADMIN')") + .antMatchers(POST,"/category").access("hasRole('ROLE_ADMIN')") + .antMatchers(DELETE,"/category").access("hasRole('ROLE_ADMIN')") + .antMatchers(PUT,"/category/{catogoryId}").access("hasRole('ROLE_ADMIN')") + + //books + .antMatchers(GET,"/books/admin/**/").access("hasRole('ROLE_ADMIN')") + .antMatchers(GET,"/books/user/**/").access("hasRole('ROLE_USER')") + .antMatchers(POST,"/books").access("hasRole('ROLE_ADMIN')") + .antMatchers(DELETE,"/books/{booksId}").access("hasRole('ROLE_ADMIN')") + .antMatchers(PUT,"/books/{booksId}").access("hasRole('ROLE_ADMIN')") - + //borrow + .antMatchers(GET,"/borrow/admin/**").access("hasRole('ROLE_ADMIN')") + .antMatchers(GET,"/borrow/user/**/").access("hasRole('ROLE_USER')") + .antMatchers(POST,"/borrow/").access("hasRole('ROLE_USER')") + .antMatchers(PUT,"/borrow/admin/**").access("hasRole('ROLE_ADMIN')") + + + + + .anyRequest().authenticated(); + + + } @Bean 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 a9be3632..1c0b547c 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 @@ -10,6 +10,7 @@ import org.springframework.http.HttpHeaders; 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; @@ -52,12 +53,12 @@ public BooksDetailView add(@Valid @RequestBody BooksForm form) { return service.add(form); } - @GetMapping + @GetMapping("/admin") public Collection list() { return service.listAll(); } - @GetMapping("/findByCategory/{categoryId}") + @GetMapping("user/findByCategory/{categoryId}") public Collection listByCategory( @PathVariable("categoryId") Integer categoryId) { @@ -90,18 +91,31 @@ public BooksDetailView update( - @GetMapping("/pagenated/") - public ResponseEntity>getAllBooks( - @RequestParam(defaultValue = "0") Integer pageNo, + @GetMapping("admin/pagenated/") + public ResponseEntity>getAllBooks( + @RequestParam(defaultValue = "1") Integer pageNo, @RequestParam(defaultValue = "10") Integer pageSize, - @RequestParam(defaultValue = "id") String sortBy) + @RequestParam(defaultValue = "auther") String sortBy, + @RequestParam(defaultValue = "1") Integer direction) { - List list = service.getAllBooks(pageNo-1, pageSize, sortBy); - return new ResponseEntity>(list,new HttpHeaders(), + Page list = service.getAllBooks(pageNo-1, pageSize, sortBy,direction); + return new ResponseEntity>(list,new HttpHeaders(), HttpStatus.OK); } + @GetMapping("user/pagenated/") + public ResponseEntity>getAllBooksforUser( + @RequestParam(defaultValue = "1") Integer pageNo, + @RequestParam(defaultValue = "10") Integer pageSize, + @RequestParam(defaultValue = "auther") String sortBy, + @RequestParam(defaultValue = "1") Integer direction) + { + Page list = service.getAllBooks(pageNo-1, pageSize, sortBy,direction); + return new ResponseEntity>(list,new HttpHeaders(), + HttpStatus.OK); + + } diff --git a/BackEnd/Library/src/main/java/com/innovature/Library/controller/BorrowController.java b/BackEnd/Library/src/main/java/com/innovature/Library/controller/BorrowController.java index 1633bad8..50a4e84b 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 @@ -8,6 +8,7 @@ import javax.validation.Valid; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.data.domain.Page; import org.springframework.http.HttpHeaders; import org.springframework.http.HttpStatus; import org.springframework.http.ResponseEntity; @@ -47,55 +48,96 @@ public Collection list() { //pagenated borrow list at admin borrow -@GetMapping("/pagenated/") -public ResponseEntity>getAllBorrows( +// @GetMapping("/pagenated/") +// public ResponseEntity>getAllBorrows( +// @RequestParam(defaultValue = "1") Integer pageNo, +// @RequestParam(defaultValue = "5") Integer pageSize, +// @RequestParam(defaultValue = "id") String sortBy) +// { +// List list = bService.getAllBorrows(pageNo-1, pageSize, sortBy); +// return new ResponseEntity>(list,new HttpHeaders(), +// HttpStatus.OK); + +// } + +//BORROW @ADMIN //pagenated borrow list at admin VIEW borrow single api +@GetMapping("/admin/pagenated/") +public ResponseEntity>getAllBorTest( @RequestParam(defaultValue = "1") Integer pageNo, @RequestParam(defaultValue = "5") Integer pageSize, - @RequestParam(defaultValue = "id") String sortBy) + @RequestParam(defaultValue = "borrowId") String sortBy, + @RequestParam(defaultValue = "1") Integer direction) { - List list = bService.getAllBorrows(pageNo-1, pageSize, sortBy); - return new ResponseEntity>(list,new HttpHeaders(), + Page list = bService.getAllBorr(pageNo-1, pageSize, sortBy,direction); + return new ResponseEntity>(list,new HttpHeaders(), HttpStatus.OK); } -//load results of issuedate filter -@GetMapping("/loadByIssueDate/{date1}/{date2}") -public ResponseEntity> loadByIssueDate( -@PathVariable("date1") Date date1, - @PathVariable("date2") Date date2) +//LOAD-FILTER@ADMIN//load results of issuedate filter at Admin Borrow +// @GetMapping("/loadByIssueDate/{date1}/{date2}") +// public ResponseEntity> loadByIssueDate( +// @PathVariable("date1") Date date1, +// @PathVariable("date2") Date date2) + +// { +// List list = bService.loadtAllByIssueDate(date1, date2); +// return new ResponseEntity>(list,new HttpHeaders(), +// HttpStatus.OK); +// } + + +//GET FILTER RESULT@ADMIN//filtered pagenated borrow list [on filtering] @admin// +// @GetMapping("/{date1}/{date2}") +// public ResponseEntity>getFilterBorrow( +// // @PathVariable Date date1, @PathVariable Date date2, +// @PathVariable("date1") Date date1, +// @PathVariable("date2") Date date2, +// @RequestParam(defaultValue = "1") Integer pageNo, +// @RequestParam(defaultValue = "5") Integer pageSize, +// @RequestParam(defaultValue = "id") String sortBy) // { -// return bService.loadtAllByIssueDate(Date date1, Date date2); + +// List list = bService.getAllBorrow(date1, date2,pageNo-1, pageSize, sortBy); +// return new ResponseEntity>(list,new HttpHeaders(), +// HttpStatus.OK); + // } -{ - List list = bService.loadtAllByIssueDate(date1, date2); - return new ResponseEntity>(list,new HttpHeaders(), - HttpStatus.OK); -} +//GET FILTER RESULT@ADMIN//filtered single api +@GetMapping("/admin/{date1}/{date2}") +public ResponseEntity>getTestFilterBorrow( + // @PathVariable Date date1, @PathVariable Date date2, + @PathVariable("date1") Date date1, + @PathVariable("date2") Date date2, + @RequestParam(defaultValue = "1") Integer pageNo, + @RequestParam(defaultValue = "5") Integer pageSize, + @RequestParam(defaultValue = "borrow_id") String sortBy, + @RequestParam(defaultValue = "1") Integer direction) +{ + Page list = bService.getAllBor(date1, date2,pageNo-1, pageSize, sortBy,direction); + return new ResponseEntity>(list,new HttpHeaders(), HttpStatus.OK); +} +////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -//Load filtered pagenated borrow list [on filtering] - @GetMapping("/{date1}/{date2}") - public ResponseEntity>getFilterBorrow( - // @PathVariable Date date1, @PathVariable Date date2, - @PathVariable("date1") Date date1, - @PathVariable("date2") Date date2, - @RequestParam(defaultValue = "1") Integer pageNo, - @RequestParam(defaultValue = "5") Integer pageSize, - @RequestParam(defaultValue = "id") String sortBy) - { - - List list = bService.getAllBorrow(date1, date2,pageNo-1, pageSize, sortBy); - return new ResponseEntity>(list,new HttpHeaders(), - HttpStatus.OK); - } +//load results of issuedate filter at User BorrowHistory +@GetMapping("user/loadByIssueDate/{date1}/{date2}") +public ResponseEntity> loadByIssueDateUser( +@PathVariable("date1") Date date1, + @PathVariable("date2") Date date2) + +{ + List list = bService.loadtAllByIssueDate(date1, date2); + return new ResponseEntity>(list,new HttpHeaders(), + HttpStatus.OK); +} //pagenation+sort at user borrow history @@ -111,7 +153,7 @@ public ResponseEntity> loadByIssueDate( } - +//////////////////////////////////////////////////////////////////////////////////// @@ -137,18 +179,28 @@ public Collection listUserNotification(Principal p) { - @GetMapping("/due") + @GetMapping("user/due") public Collection listDue() { return bService.listDue(); } - @GetMapping("/fine") + @GetMapping("admin/fine") public Collection listfine() { return bService.fine(); } - @GetMapping("/dueByUser") + @GetMapping("/borrowDetailView") + public Borrow BorrowDetail(Integer borrowId) { + return bService.BorrowDetail(borrowId); + } + + @GetMapping("/borrowBlock") + public Integer BorrowBlock() { + return bService.BorrowBlock(); + } + + @GetMapping("user/dueByUser") public Collection listDueByUser() { return bService.listDueByUser(); } @@ -167,7 +219,7 @@ public BorrowDetailView list( - @PutMapping("/{borrowId}") + @PutMapping("admin/accept/{borrowId}") public BorrowDetailView updateApprove( @PathVariable("borrowId") Integer borrowId, @Valid @RequestBody BorrowForm form @@ -176,7 +228,7 @@ public BorrowDetailView updateApprove( } - @PutMapping("reject/{borrowId}") + @PutMapping("admin/reject/{borrowId}") public BorrowDetailView updateReject( @PathVariable("borrowId") Integer borrowId, @Valid @RequestBody BorrowForm form @@ -185,14 +237,14 @@ public BorrowDetailView updateReject( } - @PutMapping("return/{borrowId}") + @PutMapping("admin/return/{borrowId}") public BorrowDetailView updateReturn( @PathVariable("borrowId") Integer borrowId, @Valid @RequestBody BorrowForm form ) { return bService.updateReturn(borrowId, form); } - @PutMapping("undo/{borrowId}") + @PutMapping("admin/undo/{borrowId}") public BorrowDetailView undo( @PathVariable("borrowId") Integer borrowId, @Valid @RequestBody BorrowForm form diff --git a/BackEnd/Library/src/main/java/com/innovature/Library/controller/CategoryController.java b/BackEnd/Library/src/main/java/com/innovature/Library/controller/CategoryController.java index 4051c351..dad31472 100644 --- a/BackEnd/Library/src/main/java/com/innovature/Library/controller/CategoryController.java +++ b/BackEnd/Library/src/main/java/com/innovature/Library/controller/CategoryController.java @@ -4,6 +4,10 @@ import java.util.Collection; import javax.validation.Valid; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.data.domain.Page; +import org.springframework.http.HttpHeaders; +import org.springframework.http.HttpStatus; +import org.springframework.http.ResponseEntity; import org.springframework.web.bind.annotation.DeleteMapping; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PathVariable; @@ -11,6 +15,7 @@ import org.springframework.web.bind.annotation.PutMapping; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RestController; import com.innovature.Library.entity.Category; @@ -25,11 +30,16 @@ public class CategoryController { @Autowired private CategoryService service; - @GetMapping + @GetMapping("/admin") public Collection list(Principal p) { return service.listAll(); } + @GetMapping("/user") + public Collection listforUser(Principal p) { + return service.listAll(); + } + @PostMapping public CategoryDetailView add(@Valid @RequestBody CategoryForm form) { @@ -62,7 +72,18 @@ public CategoryDetailView list( return service.list(catogoryId); } + @GetMapping("admin/pagenated/") + public ResponseEntity>getAllCategory( + @RequestParam(defaultValue = "1") Integer pageNo, + @RequestParam(defaultValue = "10") Integer pageSize, + @RequestParam(defaultValue = "categoryId") String sortBy, + @RequestParam(defaultValue = "1") Integer direction) + { + Page list = service.getAllCategory(pageNo-1, pageSize, sortBy,direction); + return new ResponseEntity>(list,new HttpHeaders(), + HttpStatus.OK); + } diff --git a/BackEnd/Library/src/main/java/com/innovature/Library/controller/EmailController.java b/BackEnd/Library/src/main/java/com/innovature/Library/controller/EmailController.java index 1e35e7c8..831fffa8 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,5 +1,7 @@ package com.innovature.Library.controller; +import java.util.Random; + import javax.security.auth.Subject; import javax.validation.Valid; @@ -16,11 +18,21 @@ import com.innovature.Library.form.BorrowForm; 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.view.BorrowDetailView; +import com.innovature.Library.entity.Email; +import com.innovature.Library.entity.User; +import com.innovature.Library.form.EmailForm; +import com.innovature.Library.repository.EmailRepository; +import com.innovature.Library.repository.UserRepository; +import com.innovature.Library.service.EmailService; + + @RestController @RequestMapping("/email") public class EmailController { @@ -30,16 +42,67 @@ public class EmailController { @Autowired private BorrowService service; + + + @Autowired + private EmailService emailService; + + @Autowired + private EmailRepository emailRepository; + + @Autowired + private UserRepository userRepository; + + //to send mail to due expired users @PostMapping("emailsent/{userId}") public String sendMail(@PathVariable("userId") Integer userId) { - System.out.println(userId); this.service.sendMail(userId, "Due date expired", "Please return the books" ); return "message sent"; - // return service.sendMail(userId); + + } + + + @PostMapping("/emailsentotp") + public ResponseEntitysendOtpEmail(@RequestBody EmailForm form){ + + + 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()); + + 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 ResponseEntity.ok("Email Sent!"); + }else{ + return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body("Email not sent."); + } + } + else{ + return null; + } + + + } + + + + + @PostMapping("verify") + public boolean add(@RequestBody OtpForm form){ + System.out.println("????????????????"+form.getEmail()); + System.out.println("........."+form.getCnewPassword()+form.getNewPassword()); + return emailService.add(form); } 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 9abc885b..e380d196 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 @@ -8,9 +8,22 @@ import java.security.Principal; import java.util.Collection; + +import org.springframework.http.HttpHeaders; +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.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.DeleteMapping; import org.springframework.web.bind.annotation.GetMapping; // import org.springframework.web.bind.annotation.GetMapping; @@ -74,12 +87,18 @@ public void deletes( - // @GetMapping - // public Collection list1() { - // return userService.list(); - // } + @GetMapping("admin/pagenated/") + public ResponseEntity>getAllBooks( + @RequestParam(defaultValue = "1") Integer pageNo, + @RequestParam(defaultValue = "10") Integer pageSize, + @RequestParam(defaultValue = "userId") String sortBy, + @RequestParam(defaultValue = "1") Integer direction) + { + Page list = userService.getAllUser(pageNo-1, pageSize, sortBy,direction); + return new ResponseEntity>(list,new HttpHeaders(), + HttpStatus.OK); - + } } diff --git a/BackEnd/Library/src/main/java/com/innovature/Library/controller/csvController.java b/BackEnd/Library/src/main/java/com/innovature/Library/controller/csvController.java new file mode 100644 index 00000000..606b9427 --- /dev/null +++ b/BackEnd/Library/src/main/java/com/innovature/Library/controller/csvController.java @@ -0,0 +1,88 @@ +package com.innovature.Library.controller; + + +import java.util.List; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.core.io.InputStreamResource; +import org.springframework.core.io.Resource; +import org.springframework.http.HttpHeaders; +import org.springframework.http.HttpStatus; +import org.springframework.http.MediaType; +import org.springframework.http.ResponseEntity; +import org.springframework.stereotype.Controller; +import org.springframework.web.bind.annotation.CrossOrigin; +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.RequestMapping; +import org.springframework.web.bind.annotation.RequestParam; +import org.springframework.web.multipart.MultipartFile; +import org.springframework.web.servlet.support.ServletUriComponentsBuilder; + + +import com.innovature.Library.entity.csvUpload; +import com.innovature.Library.csv_helper.csvHelper; +import com.innovature.Library.csv_helper.ResponseMessage; +import com.innovature.Library.service.csvService; +// import librarymanagement.library.message.ResponseMeassage; + +@Controller +@RequestMapping("/csv") +public class csvController { + + @Autowired + csvService csvService; + + + @PostMapping("/upload") + public ResponseEntity uploadFile(@RequestParam("file") MultipartFile file) { + String message = ""; + + if (csvHelper .hasCSVFormat(file)) { + try { + csvService.save(file); + + message = "Uploaded the file successfully: " + file.getOriginalFilename(); + + String fileDownloadUri = ServletUriComponentsBuilder.fromCurrentContextPath() + .path("/api/csv/download/") + .path(file.getOriginalFilename()) + .toUriString(); + + return ResponseEntity.status(HttpStatus.OK).body(new ResponseMessage(message,fileDownloadUri)); + } catch (Exception e) { + message = "Could not upload the file: " + file.getOriginalFilename() + "!"; + return ResponseEntity.status(HttpStatus.EXPECTATION_FAILED).body(new ResponseMessage(message,"")); + } + } + + message = "Please upload a csv file!"; + return ResponseEntity.status(HttpStatus.BAD_REQUEST).body(new ResponseMessage(message,"")); + } + + @GetMapping("/tutorials") + public ResponseEntity> getAllTutorials() { + try { + List tutorials = csvService.getAll(); + + if (tutorials.isEmpty()) { + return new ResponseEntity<>(HttpStatus.NO_CONTENT); + } + + return new ResponseEntity<>(tutorials, HttpStatus.OK); + } catch (Exception e) { + return new ResponseEntity<>(null, HttpStatus.INTERNAL_SERVER_ERROR); + } + } + + @GetMapping("/download") + public ResponseEntity downloadFile() { + InputStreamResource file = new InputStreamResource(csvService.load()); + + return ResponseEntity.ok() + .header(HttpHeaders.CONTENT_DISPOSITION, "attachment;") + .contentType(MediaType.parseMediaType("application/csv")) + .body(file); + } +} \ No newline at end of file diff --git a/BackEnd/Library/src/main/java/com/innovature/Library/csv_helper/ResponseMessage.java b/BackEnd/Library/src/main/java/com/innovature/Library/csv_helper/ResponseMessage.java new file mode 100644 index 00000000..f991bd90 --- /dev/null +++ b/BackEnd/Library/src/main/java/com/innovature/Library/csv_helper/ResponseMessage.java @@ -0,0 +1,37 @@ +package com.innovature.Library.csv_helper; + +public class ResponseMessage { + private String message; + private String fileDownloadUri; + + + public ResponseMessage(String message, String fileDownloadUri) { + this.message = message; + this.fileDownloadUri = fileDownloadUri; + } + + + + + + public String getMessage() { + return message; + } + + + public void setMessage(String message) { + this.message = message; + } + + + public String getFileDownloadUri() { + return fileDownloadUri; + } + + + public void setFileDownloadUri(String fileDownloadUri) { + this.fileDownloadUri = fileDownloadUri; + } + + +} 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 new file mode 100644 index 00000000..206433e8 --- /dev/null +++ b/BackEnd/Library/src/main/java/com/innovature/Library/csv_helper/csvHelper.java @@ -0,0 +1,97 @@ +package com.innovature.Library.csv_helper; + +import java.io.InputStream; +import java.io.InputStreamReader; +import java.io.PrintWriter; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import java.io.BufferedReader; +import java.io.ByteArrayInputStream; +import java.io.ByteArrayOutputStream; +import java.io.IOException; + +import javax.mail.Multipart; + +import org.apache.commons.csv.CSVFormat; +import org.apache.commons.csv.CSVParser; +import org.apache.commons.csv.CSVPrinter; +import org.apache.commons.csv.CSVRecord; +import org.apache.commons.csv.QuoteMode; +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 boolean hasCSVFormat(MultipartFile file){ + System.out.println(file.getContentType()); + 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") + + + ); + csvList.add(csvob); + + } + return csvList; + + }catch(IOException e){ + throw new RuntimeException("fail to parse csv file"+e.getMessage()); + } + +} + +public static ByteArrayInputStream loadFromdb(ListcsvList){ + final CSVFormat format=CSVFormat.DEFAULT.withQuoteMode(QuoteMode.MINIMAL); + try(ByteArrayOutputStream out=new ByteArrayOutputStream(); + CSVPrinter csvPrinter=new CSVPrinter(new PrintWriter(out),format);){ + String[] HEADERs={"books_name","books_auther","publication","books_copies","category_id","status"}; + csvPrinter.printRecord(HEADERs); + for( csvUpload csv:csvList){ + Listdata=Arrays.asList( + String.valueOf(csv.getBooksId()), + csv.getBooksName(), + csv.getBooksAuther(), + csv.getPublication(), + String.valueOf(csv.getBooksCopies()), + String.valueOf(csv.getCategoryId()), + String.valueOf(csv.getStatus()) + // csv.getImage() + ); + csvPrinter.printRecord(data); + + } + csvPrinter.flush(); + return new ByteArrayInputStream(out.toByteArray()); + }catch(IOException e){ + throw new RuntimeException("fail to import data to CSV file: " + e.getMessage()); + } +} +} + + + 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 b49ba6a1..47eb0356 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 @@ -1,15 +1,23 @@ package com.innovature.Library.entity; -// import javax.persistence.Entity; -// import javax.persistence.GeneratedValue; -// import javax.persistence.GenerationType; -// import javax.persistence.Id; - +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +@Entity public class Email { - private String email; + @Id + @GeneratedValue(strategy = GenerationType.IDENTITY) + private Integer otpId; + + + private String email; + + private Integer otp; + public String getEmail() { return email; @@ -17,6 +25,18 @@ public String getEmail() { public void setEmail(String email) { this.email = email; } + public Integer getOtpId() { + return otpId; + } + public void setOtpId(Integer otpId) { + this.otpId = otpId; + } + public Integer getOtp() { + return otp; + } + public void setOtp(Integer otp) { + this.otp = otp; + } diff --git a/BackEnd/Library/src/main/java/com/innovature/Library/entity/Id.java b/BackEnd/Library/src/main/java/com/innovature/Library/entity/Id.java deleted file mode 100644 index e30ec9c7..00000000 --- a/BackEnd/Library/src/main/java/com/innovature/Library/entity/Id.java +++ /dev/null @@ -1,5 +0,0 @@ -package com.innovature.Library.entity; - -public @interface Id { - -} diff --git a/BackEnd/Library/src/main/java/com/innovature/Library/entity/User.java b/BackEnd/Library/src/main/java/com/innovature/Library/entity/User.java index 7a294f36..6db1ebc9 100644 --- a/BackEnd/Library/src/main/java/com/innovature/Library/entity/User.java +++ b/BackEnd/Library/src/main/java/com/innovature/Library/entity/User.java @@ -31,6 +31,18 @@ private Status(byte value) { this.value = value; } } + public static enum Role{ + + ADMIN((byte)1), + USER((byte)2); + + + public final byte value; + + private Role(byte value){ + this.value=value; + } + } @Id @GeneratedValue(strategy = GenerationType.IDENTITY) 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 new file mode 100644 index 00000000..50cff811 --- /dev/null +++ b/BackEnd/Library/src/main/java/com/innovature/Library/entity/csvUpload.java @@ -0,0 +1,161 @@ +package com.innovature.Library.entity; +import java.util.Date; + +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GenerationType; +import javax.persistence.GeneratedValue; +import javax.persistence.Id; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + + +@Entity +@Table(name="books") + + +public class csvUpload { public static enum Status { + INACTIVE((byte) 0), + ACTIVE((byte) 1); + + public final byte value; + + private Status(byte value) { + this.value = value; + } +} +@Id +@GeneratedValue(strategy = GenerationType.IDENTITY) +@Column(name="book_id") +private Long 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 [booksId=" + booksId + ", booksName=" + booksName + ", booksAuthor=" + booksAuther + ", booksCopies=" + booksCopies + + ", categoryId=" + categoryId + ", status=" + status + "]"; +} + + +public Long getBooksId() { + return booksId; +} + + +public void setBooksId(Long booksId) { + this.booksId = booksId; +} + + +public String getBooksName() { + return booksName; +} + + +public void setBooksName(String booksName) { + this.booksName = booksName; +} + + +public String getBooksAuther() { + return booksAuther; +} + + +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 void setStatus(Integer status) { + this.status = status; +} + + +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; +} + + +// public String getImage() { +// return image; +// } + + +// public void setImage(String image) { +// this.image = image; +// } + + + + +} \ No newline at end of file diff --git a/BackEnd/Library/src/main/java/com/innovature/Library/form/EmailForm.java b/BackEnd/Library/src/main/java/com/innovature/Library/form/EmailForm.java index 60efcbfb..ffdd6c6e 100644 --- a/BackEnd/Library/src/main/java/com/innovature/Library/form/EmailForm.java +++ b/BackEnd/Library/src/main/java/com/innovature/Library/form/EmailForm.java @@ -1,6 +1,10 @@ package com.innovature.Library.form; +import javax.validation.constraints.Email; + public class EmailForm { + + @Email public String sentto; public String getSentto() { diff --git a/BackEnd/Library/src/main/java/com/innovature/Library/form/OtpForm.java b/BackEnd/Library/src/main/java/com/innovature/Library/form/OtpForm.java new file mode 100644 index 00000000..c497c646 --- /dev/null +++ b/BackEnd/Library/src/main/java/com/innovature/Library/form/OtpForm.java @@ -0,0 +1,40 @@ +package com.innovature.Library.form; +import javax.validation.constraints.NotBlank; + +public class OtpForm { + private String email; + + @NotBlank + private Integer otp; + private String newPassword; + private String cnewPassword; + + + + public String getEmail() { + return email; + } + public void setEmail(String email) { + this.email = email; + } + public Integer getOtp() { + return otp; + } + public void setOtp(Integer otp) { + this.otp = otp; + } + public String getNewPassword() { + return newPassword; + } + public void setNewPassword(String newPassword) { + this.newPassword = newPassword; + } + public String getCnewPassword() { + return cnewPassword; + } + public void setCnewPassword(String cnewPassword) { + this.cnewPassword = cnewPassword; + } + + +} 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 6c52deb1..6f9bda2b 100644 --- a/BackEnd/Library/src/main/java/com/innovature/Library/repository/BorrowRepository.java +++ b/BackEnd/Library/src/main/java/com/innovature/Library/repository/BorrowRepository.java @@ -22,6 +22,8 @@ public interface BorrowRepository extends PagingAndSortingRepository findByBorrowId(Integer borrowId) Borrow findByBorrowId(Integer borrowId); + //Collection findByBorrowId(Integer borrowId); + Collection findAllByUserUserId(Integer userId); @@ -54,8 +56,6 @@ public interface BorrowRepository extends PagingAndSortingRepository findbyBorrowIdandDueDateandStatus(); - - //To select user by due date expired @Query(value = "select * from borrow where borrow_id in(select borrow_id from borrow where due_date findAll(Pageable paging); - //Load Filterd results + //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); -//pagenated filtered results +//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); + + //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); + // public Page findbyIssuDate(java.util.Date date1, java.util.Date date2, Pageable paging); - + //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); + + + //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); diff --git a/BackEnd/Library/src/main/java/com/innovature/Library/repository/CategoryRepository.java b/BackEnd/Library/src/main/java/com/innovature/Library/repository/CategoryRepository.java index 3bd3c31d..70d95b63 100644 --- a/BackEnd/Library/src/main/java/com/innovature/Library/repository/CategoryRepository.java +++ b/BackEnd/Library/src/main/java/com/innovature/Library/repository/CategoryRepository.java @@ -4,7 +4,8 @@ // import java.util.Optional; // import java.util.Optional; //import java.util.Optional; - +import org.springframework.data.domain.Page; +import org.springframework.data.domain.Pageable; import org.springframework.data.repository.Repository; // import org.aspectj.apache.bcel.util.Repository; @@ -26,5 +27,7 @@ public interface CategoryRepository extends Repository { // void delete(Collection collection); void delete(Category orElseThrow); + public Page findAll(Pageable paging); + } 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 d45d170a..134fa683 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 @@ -4,9 +4,17 @@ import org.springframework.data.repository.Repository; +import com.innovature.Library.entity.Email; -public class EmailRepository { +public interface EmailRepository extends Repository { + void deleteAll(); + + Email save(Email email); + + CollectionfindAll(); + + Email findByEmail(String email); } diff --git a/BackEnd/Library/src/main/java/com/innovature/Library/repository/UserRepository.java b/BackEnd/Library/src/main/java/com/innovature/Library/repository/UserRepository.java index 2d892073..0a7ff391 100644 --- a/BackEnd/Library/src/main/java/com/innovature/Library/repository/UserRepository.java +++ b/BackEnd/Library/src/main/java/com/innovature/Library/repository/UserRepository.java @@ -8,6 +8,9 @@ import java.util.Collection; import java.util.Optional; import org.springframework.data.repository.Repository; +import org.springframework.data.domain.Page; +import org.springframework.data.domain.Pageable; +import org.springframework.data.jpa.repository.Query; import com.innovature.Library.entity.User; @@ -29,7 +32,12 @@ public interface UserRepository extends Repository { Collection findAll(); Collection findByUserId(Integer userId); - + + public Page findAll(Pageable paging); + + + @Query(value = "SELECT * FROM user WHERE email=?",nativeQuery = true) + User findByEmailId(String email); // User findById(User userId); } diff --git a/BackEnd/Library/src/main/java/com/innovature/Library/repository/csvRepository.java b/BackEnd/Library/src/main/java/com/innovature/Library/repository/csvRepository.java new file mode 100644 index 00000000..432428d0 --- /dev/null +++ b/BackEnd/Library/src/main/java/com/innovature/Library/repository/csvRepository.java @@ -0,0 +1,12 @@ +package com.innovature.Library.repository; + + +import org.springframework.data.jpa.repository.JpaRepository; +import org.springframework.stereotype.Repository; + +import com.innovature.Library.entity.csvUpload; + +@Repository +public interface csvRepository extends JpaRepository { + +} diff --git a/BackEnd/Library/src/main/java/com/innovature/Library/security/AccessTokenUserDetails.java b/BackEnd/Library/src/main/java/com/innovature/Library/security/AccessTokenUserDetails.java index e77e873b..3befbdc4 100644 --- a/BackEnd/Library/src/main/java/com/innovature/Library/security/AccessTokenUserDetails.java +++ b/BackEnd/Library/src/main/java/com/innovature/Library/security/AccessTokenUserDetails.java @@ -6,26 +6,46 @@ //package com.innovaturelabs.training.contacts.security; package com.innovature.Library.security; +import java.util.ArrayList; import java.util.Collection; import java.util.List; import org.springframework.security.core.GrantedAuthority; import org.springframework.security.core.authority.AuthorityUtils; +import org.springframework.security.core.authority.SimpleGrantedAuthority; import org.springframework.security.core.userdetails.UserDetails; public class AccessTokenUserDetails implements UserDetails { private static final List ROLES = AuthorityUtils.createAuthorityList("ROLE_USER"); - + // AuthorityUtils.createAuthorityList("ROLE_ADMIN"); + public final int userId; + public String userRole; - public AccessTokenUserDetails(int userId) { + public AccessTokenUserDetails(int userId,int role) { this.userId = userId; + switch(role){ + case 1: + userRole="ADMIN"; + break; + + case 2: + userRole="USER"; + break; + + default: + break; + } + } @Override public Collection getAuthorities() { - return ROLES; + String ROLE_PREFIX = "ROLE_"; + List ROLES = new ArrayList<>(); + ROLES.add(new SimpleGrantedAuthority(ROLE_PREFIX + userRole)); + return ROLES; } @Override diff --git a/BackEnd/Library/src/main/java/com/innovature/Library/security/AccessTokenUserDetailsService.java b/BackEnd/Library/src/main/java/com/innovature/Library/security/AccessTokenUserDetailsService.java index 6de598b2..f6b520c4 100644 --- a/BackEnd/Library/src/main/java/com/innovature/Library/security/AccessTokenUserDetailsService.java +++ b/BackEnd/Library/src/main/java/com/innovature/Library/security/AccessTokenUserDetailsService.java @@ -16,6 +16,8 @@ import org.springframework.security.core.userdetails.UsernameNotFoundException; import org.springframework.security.web.authentication.preauth.PreAuthenticatedAuthenticationToken; +import com.innovature.Library.entity.User; +import com.innovature.Library.repository.UserRepository; import com.innovature.Library.security.util.InvalidTokenException; import com.innovature.Library.security.util.TokenExpiredException; import com.innovature.Library.security.util.TokenGenerator; @@ -31,6 +33,9 @@ public class AccessTokenUserDetailsService implements AuthenticationUserDetailsS @Autowired private TokenGenerator tokenGenerator; + + @Autowired + private UserRepository userRepository; @Override public UserDetails loadUserDetails(PreAuthenticatedAuthenticationToken token) throws UsernameNotFoundException { @@ -47,6 +52,11 @@ public UserDetails loadUserDetails(PreAuthenticatedAuthenticationToken token) th throw new UsernameNotFoundException("Access token expired", e); } - return new AccessTokenUserDetails(Integer.parseInt(status.data)); + int userId = Integer.parseInt(status.data); + User user = userRepository.findById(userId); + + return new AccessTokenUserDetails(userId, user.getRole()); + + // return new AccessTokenUserDetails(Integer.parseInt(status.data), 1); } } 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 19a9c141..d2e7f17f 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 @@ -4,6 +4,7 @@ import java.util.Collection; import java.util.List; +import org.springframework.data.domain.Page; import org.springframework.http.HttpEntity; import org.springframework.web.multipart.MultipartFile; import org.springframework.web.servlet.view.RedirectView; @@ -33,7 +34,7 @@ public interface BooksService { RedirectView uploadImage(MultipartFile multipartFile) throws IOException; - List getAllBooks(Integer pageNo, Integer pageSize, String sortBy); + Page getAllBooks(Integer pageNo, Integer pageSize, String sortBy,Integer direction); 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 ef8754ba..8423395b 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 @@ -1,10 +1,13 @@ package com.innovature.Library.service; + import java.util.Collection; import java.sql.Date; import java.util.List; import javax.validation.Valid; +import org.springframework.data.domain.Page; + import com.innovature.Library.entity.Borrow; import com.innovature.Library.form.BorrowForm; import com.innovature.Library.view.BorrowDetailView; @@ -15,24 +18,30 @@ public interface BorrowService { BorrowDetailView add(BorrowForm form); Collection listAll(); + List loadtAllByIssueDate(Date date1, Date date2); BorrowDetailView list(Integer borrowId); - BorrowDetailView updates(Integer borrowId,BorrowForm form); + BorrowDetailView updates(Integer borrowId, BorrowForm form); + + BorrowDetailView listByUser(Integer borrowId, BorrowForm form); - BorrowDetailView listByUser(Integer borrowId,BorrowForm form); + Collection list1(); - Collectionlist1(); + Collection listNotification(); - CollectionlistNotification(); - - CollectionlistUserNotification(); + Collection listUserNotification(); + + BorrowDetailView updatereject(Integer borrowId, BorrowForm form); - BorrowDetailView updatereject(Integer borrowId,BorrowForm form); - List getAllBorrows(Integer pageNo, Integer pageSize, String sortBy); + Page getAllBorr(Integer pageNo, Integer pageSize, String sortBy,Integer direction); + 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); + + List getBorrowHistory(Integer pageNo, Integer pageSize, String sortBy); BorrowDetailView updateReturn(Integer borrowId, BorrowForm form); @@ -41,7 +50,7 @@ public interface BorrowService { Collection listDue(); - void sendMail(Integer userId,String subject,String text); + void sendMail(Integer userId, String subject, String text); Collection listDueByUser(); @@ -51,13 +60,8 @@ public interface BorrowService { Collection fine(); - - - - - - - + Borrow BorrowDetail(Integer borrowId); + Integer BorrowBlock(); } 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 e8ec2299..1a618b6a 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 @@ -1,6 +1,8 @@ package com.innovature.Library.service; import java.util.Collection; +import org.springframework.data.domain.Page; + //import javax.validation.Valid; // import org.springframework.http.HttpEntity; @@ -30,5 +32,8 @@ public interface CategoryService { CategoryDetailView updates(Integer categoryId, CategoryForm form); + Page getAllCategory(Integer pageNo, Integer pageSize, String sortBy,Integer direction); + + } 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 3574443a..dc2e95fc 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,6 +1,12 @@ package com.innovature.Library.service; +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); + + } 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 40760ee7..c104baf5 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 @@ -9,6 +9,10 @@ //import javax.validation.Valid; +import org.springframework.data.domain.Page; +import org.springframework.http.HttpEntity; +import org.springframework.web.multipart.MultipartFile; +import org.springframework.web.servlet.view.RedirectView; import org.springframework.validation.Errors; import com.innovature.Library.entity.User; @@ -47,4 +51,7 @@ public interface UserService { UserView edit(Integer userId, UserForm form); Collection viewProfile(Integer userId); + + Page getAllUser(Integer pageNo, Integer pageSize, String sortBy,Integer direction); + } diff --git a/BackEnd/Library/src/main/java/com/innovature/Library/service/csvService.java b/BackEnd/Library/src/main/java/com/innovature/Library/service/csvService.java new file mode 100644 index 00000000..d49762d4 --- /dev/null +++ b/BackEnd/Library/src/main/java/com/innovature/Library/service/csvService.java @@ -0,0 +1,46 @@ +package com.innovature.Library.service; + + +import org.springframework.web.multipart.MultipartFile; + +import java.io.ByteArrayInputStream; +import java.io.IOException; +import java.util.List; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + + +import com.innovature.Library.entity.csvUpload; +import com.innovature.Library.csv_helper.csvHelper; +import com.innovature.Library.repository.csvRepository; + +@Service +public class csvService { + + @Autowired + csvRepository repository; + + + + + public void save(MultipartFile file){ + try{ + ListcsvTest=csvHelper.csvToDb(file.getInputStream()); + repository.saveAll(csvTest); + }catch(IOException e){ + throw new RuntimeException("fail to store csv data"+e.getMessage()); + } + } + + public ByteArrayInputStream load(){ + List csvTest=repository.findAll(); + ByteArrayInputStream in=csvHelper.loadFromdb(csvTest); + return in; + } + + public ListgetAll(){ + return repository.findAll(); + } + +} diff --git a/BackEnd/Library/src/main/java/com/innovature/Library/service/impl/BooksServiceImpl.java b/BackEnd/Library/src/main/java/com/innovature/Library/service/impl/BooksServiceImpl.java index 5aeef40f..839301ef 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 @@ -117,17 +117,25 @@ public RedirectView uploadImage(MultipartFile multipartFile) throws IOException } + @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 ListgetAllBooks(Integer pageNo, Integer pageSize, String sortBy){ - - Pageable paging = PageRequest.of(pageNo, pageSize, Sort.by(sortBy)); + if(direction==1){ - Page pagedResult = booksRepository.findAll(paging); + Pageable paging = PageRequest.of(pageNo, pageSize, sortByDescending); + Page pagedResult = booksRepository.findAll(paging); + return pagedResult; + } - if(pagedResult.hasContent()){ - return pagedResult.getContent(); - } else { - return new ArrayList(); + else + { + Pageable paging = PageRequest.of(pageNo, pageSize, sortByAscending); + Page pagedResult = booksRepository.findAll(paging); + return pagedResult; } } diff --git a/BackEnd/Library/src/main/java/com/innovature/Library/service/impl/BorrowServiceImpl.java b/BackEnd/Library/src/main/java/com/innovature/Library/service/impl/BorrowServiceImpl.java index e34ba534..3a67df1c 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 @@ -98,6 +98,17 @@ public Collection fine() { return borrowRepository.findbyBorrowIdandDueDateandStatus(); } + @Override + public Borrow BorrowDetail(Integer borrowId) { + + return borrowRepository.findByBorrowId(borrowId); + } +///////////////////////////////////////////////////////////////////////////////////////////// + @Override + public Integer BorrowBlock() { + + return borrowRepository.findbyUserIdAndStatus(SecurityUtil.getCurrentUserId()); + } @Override @@ -227,14 +238,41 @@ public BorrowDetailView listByUser(Integer borrowId, BorrowForm form) { } else { return new ArrayList(); } + } -// @Override -// public Collection listinguserdropdown(String string, java.sql.Date date1, java.sql.Date date2) { -// return bookingRepository.findAll(string, date1, date2).stream().map(BookingView::new).collect(Collectors.toList()); -// } + ////////////////////////////////// + @Override + @Transactional + public PagegetAllBor( java.sql.Date date1, java.sql.Date date2,Integer pageNo, Integer pageSize, String sortBy,Integer direction){ + + // Pageable paging = PageRequest.of(pageNo, pageSize, Sort .by(sortBy)); + var sortByDescending=Sort.by(sortBy).descending(); + var sortByAscending=Sort.by(sortBy).ascending(); + + if(direction==1){ + + Pageable paging = PageRequest.of(pageNo, pageSize, sortByDescending); + Page pagedResult = borrowRepository.findbyIssuDat(date1,date2,paging); + return pagedResult; + } + + else + { + Pageable paging = PageRequest.of(pageNo, pageSize, sortByAscending); + Page pagedResult = borrowRepository.findbyIssuDat(date1,date2,paging); + return pagedResult; + } + + // Page pagedResult = borrowRepository.findbyIssuDat(date1,date2,paging); + // return pagedResult; + } + + + + @Override @Transactional public ListgetAllBorrows(Integer pageNo, Integer pageSize, String sortBy){ @@ -251,6 +289,37 @@ public BorrowDetailView listByUser(Integer borrowId, BorrowForm form) { } +//@admin borrow oninit + @Override + @Transactional + public PagegetAllBorr(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.findAll(paging); + return pagedResult; + } + + else + { + Pageable paging = PageRequest.of(pageNo, pageSize, sortByAscending); + Page pagedResult = borrowRepository.findAll(paging); + return pagedResult; + } + // return pagedResult; + + + + + + + } + @Override @Transactional @@ -329,7 +398,7 @@ public void sendMail(Integer userId, String subject, String text) { @Override @Transactional // @Scheduled(cron="* */1 * * * * ") - @Scheduled(cron="0 0 9 * * ?") + @Scheduled(cron="0 0 12 * * ?") public void fineGeneration() { System.out.println("reachllllllllllllll"); diff --git a/BackEnd/Library/src/main/java/com/innovature/Library/service/impl/CategoryServiceImpl.java b/BackEnd/Library/src/main/java/com/innovature/Library/service/impl/CategoryServiceImpl.java index cf901537..9122ae86 100644 --- a/BackEnd/Library/src/main/java/com/innovature/Library/service/impl/CategoryServiceImpl.java +++ b/BackEnd/Library/src/main/java/com/innovature/Library/service/impl/CategoryServiceImpl.java @@ -4,7 +4,10 @@ import javax.transaction.Transactional; import org.springframework.beans.factory.annotation.Autowired; -// import org.springframework.beans.factory.annotation.Autowired; +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.stereotype.Service; import com.innovature.Library.view.CategoryDetailView; @@ -64,6 +67,28 @@ public CategoryDetailView updates(Integer categoryId, CategoryForm form) { } + @Override + @Transactional + public PagegetAllCategory(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 = categoryRepository.findAll(paging); + return pagedResult; + } + + else + { + Pageable paging = PageRequest.of(pageNo, pageSize, sortByAscending); + Page pagedResult = categoryRepository.findAll(paging); + return pagedResult; + } + } + } 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 25c44d7b..eee6b062 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 @@ -1,63 +1,174 @@ -// package com.innovature.Library.service.impl; +package com.innovature.Library.service.impl; + +import com.innovature.Library.entity.Email; +import com.innovature.Library.entity.User; +import com.innovature.Library.form.OtpForm; +import com.innovature.Library.repository.EmailRepository; +import com.innovature.Library.repository.UserRepository; +import com.innovature.Library.service.EmailService; + + +import java.util.Properties; + + + + +import javax.mail.*; +import javax.mail.internet.InternetAddress; +import javax.mail.internet.MimeMessage; +import javax.mail.Session; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.security.crypto.password.PasswordEncoder; +import org.springframework.stereotype.Service; + +@Service +public class EmailServiceImpl implements EmailService { + + @Autowired + private EmailRepository emailRepository; + + @Autowired + private PasswordEncoder passwordEncoder; + + @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); + if ((form.getOtp().equals(otp.getOtp()))) { + System.out.println("----------inside if of otp ==-------"); + + 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; + + + } + return false; + } + + + + + + + + + + + + @Override + public boolean sendEmail(String subject, String message, String to) + { -// import com.innovature.Library.service.EmailService; + 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); + } + }); -// import java.util.Properties; + try { + MimeMessage msg = new MimeMessage(session); + msg.setFrom(new InternetAddress(senderEmail)); -// import javax.mail.*; -// import javax.mail.internet.InternetAddress; -// import javax.mail.internet.MimeMessage; -// import javax.mail.Session; + msg.addRecipient(Message.RecipientType.TO, new InternetAddress(to)); -// import org.springframework.stereotype.Service; + msg.setSubject(subject); + msg.setText(message); + Transport.send(msg); -// @Service -// public class EmailServiceImpl implements EmailService { -// @Override -// public boolean sendEmail(String subject, String message, String to) -// { -// boolean s=false; -// String senderEmail="stormhokspam@gmail.com"; -// String senderPassword="cyckyhziponehguf"; + s = true; // Set the "foo" variable to true after successfully sending emails -// 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(){ + }catch(Exception e){ -// return new PasswordAuthentication(senderEmail, senderPassword); -// } -// }); -// try { + } + return s; + } -// MimeMessage msg = new MimeMessage(session); + else{ + return (Boolean) null; + } + -// msg.setFrom(new InternetAddress(senderEmail)); + // boolean s=false; + // String senderEmail="stormhokspam@gmail.com"; + // String senderPassword="cyckyhziponehguf"; -// msg.addRecipient(Message.RecipientType.TO, new InternetAddress(to)); + // 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(){ -// msg.setSubject(subject); -// msg.setText(message); -// Transport.send(msg); + // return new PasswordAuthentication(senderEmail, senderPassword); + // } + // }); + // try { -// s = true; // Set the "foo" variable to true after successfully sending emails + // MimeMessage msg = new MimeMessage(session); -// }catch(Exception e){ + // msg.setFrom(new InternetAddress(senderEmail)); -// } + // msg.addRecipient(Message.RecipientType.TO, new InternetAddress(to)); -// return s; // and return foo variable -// } + // msg.setSubject(subject); + // msg.setText(message); + // Transport.send(msg); + // s = true; // Set the "foo" variable to true after successfully sending emails + // }catch(Exception e){ + // } -// } \ No newline at end of file + // return s; // and return foo variable + + + + + + + } + + + + + + + + +} \ 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 0ac6bcdc..3a61ef3b 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 @@ -8,10 +8,14 @@ import static com.innovature.Library.security.AccessTokenUserDetailsService.PURPOSE_ACCESS_TOKEN; import java.util.Collection; - +import javax.transaction.Transactional; //import javax.validation.Valid; - +import org.springframework.data.domain.Page; +import org.springframework.data.domain.PageRequest; +import org.springframework.data.domain.Pageable; +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; @@ -142,6 +146,34 @@ public Collection listAll() { return userRepository.findAll(); } + + + @Override + @Transactional + public PagegetAllUser(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 = userRepository.findAll(paging); + return pagedResult; + } + + else + { + Pageable paging = PageRequest.of(pageNo, pageSize, sortByAscending); + Page pagedResult = userRepository.findAll(paging); + return pagedResult; + } + } + + + + + @Override @@ -204,11 +236,5 @@ public void deletes(Integer userId) throws NotFoundException { - // @Override - // public Collection list() { - // // TODO Auto-generated method stub - // return null; - // } - } diff --git a/BackEnd/Library/src/main/resources/application.properties b/BackEnd/Library/src/main/resources/application.properties index 06ad3933..17e145e7 100644 --- a/BackEnd/Library/src/main/resources/application.properties +++ b/BackEnd/Library/src/main/resources/application.properties @@ -28,7 +28,7 @@ spring.mail.properties.mail.smtp.starttls.enable=true spring.jpa.show-sql=true ## -#spring.jpa.hibernate.ddl-auto=update +spring.jpa.hibernate.ddl-auto=update ## Application security configuration ## #Password for token generator - must be exactly 16 ASCII characters diff --git a/BackEnd/Library29.zip b/BackEnd/Library29.zip new file mode 100644 index 00000000..06ad1009 Binary files /dev/null and b/BackEnd/Library29.zip differ diff --git a/FrontEnd/iprjt/angular.json b/FrontEnd/iprjt/angular.json index 33a3242b..17a5379c 100644 --- a/FrontEnd/iprjt/angular.json +++ b/FrontEnd/iprjt/angular.json @@ -23,6 +23,7 @@ "src/assets" ], "styles": [ + "./node_modules/@angular/material/prebuilt-themes/indigo-pink.css", "node_modules/bootstrap/dist/css/bootstrap.min.css", "src/styles.css" ], @@ -91,6 +92,7 @@ "src/assets" ], "styles": [ + "./node_modules/@angular/material/prebuilt-themes/indigo-pink.css", "src/styles.css" ], "scripts": [] diff --git a/FrontEnd/iprjt/package-lock.json b/FrontEnd/iprjt/package-lock.json index 89afb2d5..e3508b3e 100644 --- a/FrontEnd/iprjt/package-lock.json +++ b/FrontEnd/iprjt/package-lock.json @@ -9,12 +9,13 @@ "version": "0.0.0", "dependencies": { "@angular/animations": "^14.2.0", + "@angular/cdk": "^13.0.0", "@angular/common": "^14.2.0", "@angular/compiler": "^14.2.0", "@angular/core": "^14.2.0", "@angular/forms": "^14.2.0", "@angular/localize": "^14.2.0", - "@angular/material": "^7.3.7", + "@angular/material": "^13.0.0", "@angular/platform-browser": "^14.2.0", "@angular/platform-browser-dynamic": "^14.2.0", "@angular/router": "^14.2.0", @@ -358,27 +359,21 @@ } }, "node_modules/@angular/cdk": { - "version": "7.3.7", - "resolved": "https://registry.npmjs.org/@angular/cdk/-/cdk-7.3.7.tgz", - "integrity": "sha512-xbXxhHHKGkVuW6K7pzPmvpJXIwpl0ykBnvA2g+/7Sgy5Pd35wCC+UtHD9RYczDM/mkygNxMQtagyCErwFnDtQA==", - "peer": true, + "version": "13.0.0", + "resolved": "https://registry.npmjs.org/@angular/cdk/-/cdk-13.0.0.tgz", + "integrity": "sha512-OUgDSyiZM16kdaEqMgivg7qSULfYFQBH7qv/v6NKKz9gYuBStqv/dgbsoYdKUb8SNMON9KlYd3zZX0lRutoXFA==", "dependencies": { - "tslib": "^1.7.1" + "tslib": "^2.3.0" }, "optionalDependencies": { "parse5": "^5.0.0" }, "peerDependencies": { - "@angular/common": ">=7.0.0", - "@angular/core": ">=7.0.0" + "@angular/common": "^13.0.0 || ^14.0.0-0", + "@angular/core": "^13.0.0 || ^14.0.0-0", + "rxjs": "^6.5.3 || ^7.4.0" } }, - "node_modules/@angular/cdk/node_modules/tslib": { - "version": "1.14.1", - "resolved": "https://registry.npmjs.org/tslib/-/tslib-1.14.1.tgz", - "integrity": "sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg==", - "peer": true - }, "node_modules/@angular/cli": { "version": "14.2.10", "resolved": "https://registry.npmjs.org/@angular/cli/-/cli-14.2.10.tgz", @@ -570,24 +565,21 @@ } }, "node_modules/@angular/material": { - "version": "7.3.7", - "resolved": "https://registry.npmjs.org/@angular/material/-/material-7.3.7.tgz", - "integrity": "sha512-Eq+7frkeNGkLOfEtmkmJgR+AgoWajOipXZWWfCSamNfpCcPof82DwvGOpAmgGni9FuN2XFQdqP5MoaffQzIvUA==", + "version": "13.0.0", + "resolved": "https://registry.npmjs.org/@angular/material/-/material-13.0.0.tgz", + "integrity": "sha512-v9TB0LHRweSwafPM6BP+pPGi398jlH5SUIqRNfR8Fbg9nujm/mvDNvxFDOJMRLrob69Fqztt7Uw+sK2FSzkjrA==", "dependencies": { - "tslib": "^1.7.1" + "tslib": "^2.3.0" }, "peerDependencies": { - "@angular/animations": ">=7.0.0", - "@angular/cdk": "7.3.7", - "@angular/common": ">=7.0.0", - "@angular/core": ">=7.0.0" + "@angular/animations": "^13.0.0 || ^14.0.0-0", + "@angular/cdk": "13.0.0", + "@angular/common": "^13.0.0 || ^14.0.0-0", + "@angular/core": "^13.0.0 || ^14.0.0-0", + "@angular/forms": "^13.0.0 || ^14.0.0-0", + "rxjs": "^6.5.3 || ^7.4.0" } }, - "node_modules/@angular/material/node_modules/tslib": { - "version": "1.14.1", - "resolved": "https://registry.npmjs.org/tslib/-/tslib-1.14.1.tgz", - "integrity": "sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg==" - }, "node_modules/@angular/platform-browser": { "version": "14.2.12", "resolved": "https://registry.npmjs.org/@angular/platform-browser/-/platform-browser-14.2.12.tgz", @@ -8714,8 +8706,7 @@ "version": "5.1.1", "resolved": "https://registry.npmjs.org/parse5/-/parse5-5.1.1.tgz", "integrity": "sha512-ugq4DFI0Ptb+WWjAdOK16+u/nHfiIrcE+sh8kZMaM0WllQKLI9rOUq6c2b7cwPkXdzfQESqvoqK6ug7U/Yyzug==", - "optional": true, - "peer": true + "optional": true }, "node_modules/parse5-html-rewriting-stream": { "version": "6.0.1", @@ -12146,21 +12137,12 @@ } }, "@angular/cdk": { - "version": "7.3.7", - "resolved": "https://registry.npmjs.org/@angular/cdk/-/cdk-7.3.7.tgz", - "integrity": "sha512-xbXxhHHKGkVuW6K7pzPmvpJXIwpl0ykBnvA2g+/7Sgy5Pd35wCC+UtHD9RYczDM/mkygNxMQtagyCErwFnDtQA==", - "peer": true, + "version": "13.0.0", + "resolved": "https://registry.npmjs.org/@angular/cdk/-/cdk-13.0.0.tgz", + "integrity": "sha512-OUgDSyiZM16kdaEqMgivg7qSULfYFQBH7qv/v6NKKz9gYuBStqv/dgbsoYdKUb8SNMON9KlYd3zZX0lRutoXFA==", "requires": { "parse5": "^5.0.0", - "tslib": "^1.7.1" - }, - "dependencies": { - "tslib": { - "version": "1.14.1", - "resolved": "https://registry.npmjs.org/tslib/-/tslib-1.14.1.tgz", - "integrity": "sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg==", - "peer": true - } + "tslib": "^2.3.0" } }, "@angular/cli": { @@ -12280,18 +12262,11 @@ } }, "@angular/material": { - "version": "7.3.7", - "resolved": "https://registry.npmjs.org/@angular/material/-/material-7.3.7.tgz", - "integrity": "sha512-Eq+7frkeNGkLOfEtmkmJgR+AgoWajOipXZWWfCSamNfpCcPof82DwvGOpAmgGni9FuN2XFQdqP5MoaffQzIvUA==", + "version": "13.0.0", + "resolved": "https://registry.npmjs.org/@angular/material/-/material-13.0.0.tgz", + "integrity": "sha512-v9TB0LHRweSwafPM6BP+pPGi398jlH5SUIqRNfR8Fbg9nujm/mvDNvxFDOJMRLrob69Fqztt7Uw+sK2FSzkjrA==", "requires": { - "tslib": "^1.7.1" - }, - "dependencies": { - "tslib": { - "version": "1.14.1", - "resolved": "https://registry.npmjs.org/tslib/-/tslib-1.14.1.tgz", - "integrity": "sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg==" - } + "tslib": "^2.3.0" } }, "@angular/platform-browser": { @@ -18187,8 +18162,7 @@ "version": "5.1.1", "resolved": "https://registry.npmjs.org/parse5/-/parse5-5.1.1.tgz", "integrity": "sha512-ugq4DFI0Ptb+WWjAdOK16+u/nHfiIrcE+sh8kZMaM0WllQKLI9rOUq6c2b7cwPkXdzfQESqvoqK6ug7U/Yyzug==", - "optional": true, - "peer": true + "optional": true }, "parse5-html-rewriting-stream": { "version": "6.0.1", diff --git a/FrontEnd/iprjt/package.json b/FrontEnd/iprjt/package.json index d52a1850..f24ab8e5 100644 --- a/FrontEnd/iprjt/package.json +++ b/FrontEnd/iprjt/package.json @@ -11,12 +11,13 @@ "private": true, "dependencies": { "@angular/animations": "^14.2.0", + "@angular/cdk": "^13.0.0", "@angular/common": "^14.2.0", "@angular/compiler": "^14.2.0", "@angular/core": "^14.2.0", "@angular/forms": "^14.2.0", "@angular/localize": "^14.2.0", - "@angular/material": "^7.3.7", + "@angular/material": "^13.0.0", "@angular/platform-browser": "^14.2.0", "@angular/platform-browser-dynamic": "^14.2.0", "@angular/router": "^14.2.0", @@ -44,4 +45,4 @@ "karma-jasmine-html-reporter": "~2.0.0", "typescript": "~4.7.2" } -} +} \ No newline at end of file diff --git a/FrontEnd/iprjt/src/app/acceptrequest/acceptrequest.component.html b/FrontEnd/iprjt/src/app/acceptrequest/acceptrequest.component.html index f04c04c9..2c861a1c 100644 --- a/FrontEnd/iprjt/src/app/acceptrequest/acceptrequest.component.html +++ b/FrontEnd/iprjt/src/app/acceptrequest/acceptrequest.component.html @@ -1,7 +1,4 @@ - -

-

-

+
diff --git a/FrontEnd/iprjt/src/app/acceptrequest/acceptrequest.component.ts b/FrontEnd/iprjt/src/app/acceptrequest/acceptrequest.component.ts index c1a18b89..973ef016 100644 --- a/FrontEnd/iprjt/src/app/acceptrequest/acceptrequest.component.ts +++ b/FrontEnd/iprjt/src/app/acceptrequest/acceptrequest.component.ts @@ -73,7 +73,7 @@ update(borrowId:any){ home() { - this.router.navigate(['/body']) + this.router.navigate(['/sidenav']) } datas(){ diff --git a/FrontEnd/iprjt/src/app/addbooks/addbooks.component.css b/FrontEnd/iprjt/src/app/addbooks/addbooks.component.css new file mode 100644 index 00000000..79690e5a --- /dev/null +++ b/FrontEnd/iprjt/src/app/addbooks/addbooks.component.css @@ -0,0 +1,22 @@ +/* /* +.table-bordered{ + border: 1px solid; +} + + */ + table{ + width: 80%; + border: none; + text-align: center; + + } + th { + background-color: #ffffff; + color: rgb(0, 0, 0); + text-align: center; + border: none; + } + td { + border: none; + padding-top: 6px;padding-bottom: 6px; + } \ No newline at end of file diff --git a/FrontEnd/iprjt/src/app/addbooks/addbooks.component.html b/FrontEnd/iprjt/src/app/addbooks/addbooks.component.html new file mode 100644 index 00000000..473af476 --- /dev/null +++ b/FrontEnd/iprjt/src/app/addbooks/addbooks.component.html @@ -0,0 +1,80 @@ + + +

+
+
+

+ + + +
+ + +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Category-Name + + + Publication + + + Book Name + + + Auther + + + Book Copies + + + Book Cover
{{books.category.categoryName}}{{books.publication}}{{books.booksName}}{{books.auther}}{{books.booksCopies}} + + + +
+ +
+
+
+ +
+ + +
\ No newline at end of file diff --git a/FrontEnd/iprjt/src/app/addbooks/addbooks.component.spec.ts b/FrontEnd/iprjt/src/app/addbooks/addbooks.component.spec.ts new file mode 100644 index 00000000..e8f38a6e --- /dev/null +++ b/FrontEnd/iprjt/src/app/addbooks/addbooks.component.spec.ts @@ -0,0 +1,23 @@ +import { ComponentFixture, TestBed } from '@angular/core/testing'; + +import { AddbooksComponent } from './addbooks.component'; + +describe('AddbooksComponent', () => { + let component: AddbooksComponent; + let fixture: ComponentFixture; + + beforeEach(async () => { + await TestBed.configureTestingModule({ + declarations: [ AddbooksComponent ] + }) + .compileComponents(); + + fixture = TestBed.createComponent(AddbooksComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); + + it('should create', () => { + expect(component).toBeTruthy(); + }); +}); diff --git a/FrontEnd/iprjt/src/app/addbooks/addbooks.component.ts b/FrontEnd/iprjt/src/app/addbooks/addbooks.component.ts new file mode 100644 index 00000000..1d4e49e1 --- /dev/null +++ b/FrontEnd/iprjt/src/app/addbooks/addbooks.component.ts @@ -0,0 +1,137 @@ +import { Component, OnInit } from '@angular/core'; +import { MatDialog,MatDialogRef, MatDialogModule} from '@angular/material/dialog'; +import { MatDialogConfig } from '@angular/material/dialog'; +import { Router } from '@angular/router'; +import { BooksService } from '../books.service'; +import { BooksComponent } from '../books/books.component'; +import { CategoryService } from '../category.service'; +import { ImageuploadService } from '../imageupload.service'; + +@Component({ + selector: 'app-addbooks', + templateUrl: './addbooks.component.html', + styleUrls: ['./addbooks.component.css'] +}) +export class AddbooksComponent implements OnInit { + categoryList: any[]; + categoryId:any; + + + booksList: any[]; + books: any; + booksId: any; + + categorydata:any; + booksdata:any; + catdata: any; + +data: any; +page:number=1; +count: any; +tableSize: number = 5; +ProdData: any; +sortedData: any; +a:any; +b:any; +searchResult:any +searchData:any +sort:string="auther"; +len: any; +result: any; + booksCount: any; + direction=-1; + // ObjSampleForm:FormGroup; + constructor(private router:Router ,private booksService:BooksService,private service:CategoryService,private imageService:ImageuploadService,private dialog: MatDialog) { + this.booksList=[]; + this.categoryList=[]; + + + } + + ngOnInit(): void { + this.Load(); + localStorage.removeItem('booksId'); + } + +Load() { + this.booksService.pagination1(this.page,this.tableSize,this.sort,this.direction).subscribe(result=>{ + this.result=result.content; + this.count=result.totalElements + console.log("loaded books=",this.result); + console.log("page=",this.page); + this.data=this.result; + this.booksdata=this.result; + }); +} + + +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=",event) + this.booksService.pagination1(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; + this.booksdata=this.result; + }) + } + + + openDialog() { + + const dialogConfig = new MatDialogConfig(); + this.dialog.open(BooksComponent, dialogConfig); + + } + + delete(booksId:any): void{ + if(confirm('Are you sure want to delete?')) + { + console.log(booksId); + this.booksService.delete(booksId.booksId).subscribe({next:(res)=>{ + console.log(res); + alert("Books deleted"); + window.location.reload(); + }, + error:(msg)=>{} + }) + } + else{ + this.router.navigate(['/books']) + } + } + + edit(booksId:any) { + // localStorage.setItem('flag',this.flag); + localStorage.setItem('booksId',booksId); + const dialogConfig = new MatDialogConfig(); + this.dialog.open(BooksComponent, dialogConfig); + + } + + + + + + +} diff --git a/FrontEnd/iprjt/src/app/addcategory/addcategory.component.css b/FrontEnd/iprjt/src/app/addcategory/addcategory.component.css new file mode 100644 index 00000000..7f80b29c --- /dev/null +++ b/FrontEnd/iprjt/src/app/addcategory/addcategory.component.css @@ -0,0 +1,39 @@ +/* +.table-bordered{ + border: 1px solid; +} +th { + background-color: #232524; + color: white; + width: 18%; + text-align: center; + } + td { + background-color: #a7bdb08f; + color: rgb(0, 0, 0); + width: 18%; + text-align: center; + margin-top: auto; + padding: auto; + } */ + table{ + width: 28%; + border: none; + text-align: center; + + } + /* tr{ + border: none; + } */ + th { + background-color: #ffffff; + color: rgb(0, 0, 0); + text-align: center; + border: none; + + } + td { + border: none; + padding-top: 16px;padding-bottom: 6px; + text-align: center; + } \ No newline at end of file diff --git a/FrontEnd/iprjt/src/app/addcategory/addcategory.component.html b/FrontEnd/iprjt/src/app/addcategory/addcategory.component.html new file mode 100644 index 00000000..333c7861 --- /dev/null +++ b/FrontEnd/iprjt/src/app/addcategory/addcategory.component.html @@ -0,0 +1,54 @@ + +

+
+
+ +

+ +
+
+
+ + + + + + + + + + + + + + + + + + +
Category Name + + +
{{category.categoryName}} + + + + +
+
+ + +
+
+
+
+ + diff --git a/FrontEnd/iprjt/src/app/addcategory/addcategory.component.spec.ts b/FrontEnd/iprjt/src/app/addcategory/addcategory.component.spec.ts new file mode 100644 index 00000000..f7344ad5 --- /dev/null +++ b/FrontEnd/iprjt/src/app/addcategory/addcategory.component.spec.ts @@ -0,0 +1,23 @@ +import { ComponentFixture, TestBed } from '@angular/core/testing'; + +import { AddcategoryComponent } from './addcategory.component'; + +describe('AddcategoryComponent', () => { + let component: AddcategoryComponent; + let fixture: ComponentFixture; + + beforeEach(async () => { + await TestBed.configureTestingModule({ + declarations: [ AddcategoryComponent ] + }) + .compileComponents(); + + fixture = TestBed.createComponent(AddcategoryComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); + + it('should create', () => { + expect(component).toBeTruthy(); + }); +}); diff --git a/FrontEnd/iprjt/src/app/addcategory/addcategory.component.ts b/FrontEnd/iprjt/src/app/addcategory/addcategory.component.ts new file mode 100644 index 00000000..21c63f56 --- /dev/null +++ b/FrontEnd/iprjt/src/app/addcategory/addcategory.component.ts @@ -0,0 +1,145 @@ +import { Component, OnInit } from '@angular/core'; +import { CategoryComponent } from '../category/category.component'; +import { MatDialog,MatDialogRef, MatDialogModule} from '@angular/material/dialog'; +import { MatDialogConfig } from '@angular/material/dialog'; +import { Router } from '@angular/router'; +import { CategoryService } from '../category.service'; +import { HttpErrorResponse } from '@angular/common/http'; +import { Observable } from 'rxjs'; + +@Component({ + selector: 'app-addcategory', + templateUrl: './addcategory.component.html', + styleUrls: ['./addcategory.component.css'] +}) +export class AddcategoryComponent implements OnInit { + + categoryList: any[]; + categoryId:any; + categorydata:any; + // flag:string="ONE"; + + + data: any; +page:number=1; +count: any; +tableSize: number = 5; +ProdData: any; +sortedData: any; +a:any; +b:any; +searchResult:any +searchData:any +sort:string="categoryId"; +sort1:string="categoryName"; +len: any; +result: any; + booksCount: any; + direction=-1; + category_id: any; + categoryName: any; + category_name: any; + constructor(private dialog: MatDialog,private router:Router ,private service:CategoryService) { + 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 + console.log("loaded cat=",this.result); + console.log("page=",this.page); + this.data=this.result; + this.categorydata=this.result; + }); } + + + sortfn(a:any){ + this.sort=a; + console.log("sortbyname",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.LoadCategory(); + } + + } + + onTableDataChange(event:any) { + + console.log("page=",event) + this.service.CatPageAdmin(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; + this.categorydata=this.result; + }) + } + + +openDialog() { + + const dialogConfig = new MatDialogConfig(); + this.dialog.open(CategoryComponent, dialogConfig); + +} + +editCategory(categoryId:any) { + // localStorage.setItem('flag',this.flag); + localStorage.setItem('categoryId',categoryId); + const dialogConfig = new MatDialogConfig(); + this.dialog.open(CategoryComponent, dialogConfig); + +} + + + + +deleteCategory(categoryId:any): void{ + if(confirm('Are you sure want to delete?')) + { + console.log(categoryId); + this.service.delete(categoryId.categoryId).subscribe({next:(res)=>{ + console.log(res); + alert("item deleted"); + window.location.reload(); + }, + error:(msg)=>{} + }) + } + else{ + this.router.navigate(['/addcategory']) + } +} + + + + + + + + + + + + + + + } diff --git a/FrontEnd/iprjt/src/app/app-routing.module.ts b/FrontEnd/iprjt/src/app/app-routing.module.ts index d71c9b23..693e53fb 100644 --- a/FrontEnd/iprjt/src/app/app-routing.module.ts +++ b/FrontEnd/iprjt/src/app/app-routing.module.ts @@ -21,7 +21,13 @@ import { BookreturnComponent } from './bookreturn/bookreturn.component'; import { ViewAdminprofileComponent } from './view-adminprofile/view-adminprofile.component'; import { ImageuploadComponent } from './imageupload/imageupload.component'; import { FineComponent } from './fine/fine.component'; - +import { SidenavComponent } from './sidenav/sidenav.component'; +import { UserSidenavComponent } from './user-sidenav/user-sidenav.component'; +import { AddcategoryComponent } from './addcategory/addcategory.component'; +import { DemoComponent } from './demo/demo.component'; +import { AddbooksComponent } from './addbooks/addbooks.component'; +import { BorrowDetailViewComponent } from './borrow-detail-view/borrow-detail-view.component'; +import { ForgotpasswordComponent } from './forgotpassword/forgotpassword.component'; const routes: Routes = [ {path: '',redirectTo:'login',pathMatch:'full'}, @@ -41,10 +47,16 @@ const routes: Routes = [ {path : 'findby-category',component:FindbyCategoryComponent}, {path : 'notification',component:NotificationComponent}, {path : 'bookreturn',component:BookreturnComponent}, - {path : 'view-adminprofile',component:ViewAdminprofileComponent}, - {path : 'imageupload',component:ImageuploadComponent}, - {path : 'fine',component:FineComponent} - + {path : 'view-adminprofile',component:ViewAdminprofileComponent,canActivate: [HomeguardGuard]}, + {path : 'imageupload',component:ImageuploadComponent,canActivate: [HomeguardGuard]}, + {path : 'fine',component:FineComponent,canActivate: [HomeguardGuard]}, + {path : 'sidenav',component:SidenavComponent,canActivate: [HomeguardGuard]}, + {path : 'user-sidenav',component:UserSidenavComponent}, + {path : 'addcategory',component:AddcategoryComponent,canActivate: [HomeguardGuard]}, + {path:'demo',component:DemoComponent}, + {path:'addbooks',component:AddbooksComponent,canActivate: [HomeguardGuard]}, + {path:'borrow-detail-view',component:BorrowDetailViewComponent}, + {path:'forgotpassword',component:ForgotpasswordComponent}, ]; @NgModule({ diff --git a/FrontEnd/iprjt/src/app/app.module.ts b/FrontEnd/iprjt/src/app/app.module.ts index d56c0569..1c8098c0 100644 --- a/FrontEnd/iprjt/src/app/app.module.ts +++ b/FrontEnd/iprjt/src/app/app.module.ts @@ -8,7 +8,8 @@ import { LoginComponent } from './login/login.component'; import { FormsModule, ReactiveFormsModule } from '@angular/forms'; import { BodyComponent } from './body/body.component'; - +//import { ModalComponent } from './modal/modal.component'; +import {MatDialogConfig, MatDialogModule, MAT_DIALOG_DEFAULT_OPTIONS,} from '@angular/material/dialog'; import { HttpClientModule, HTTP_INTERCEPTORS } from '@angular/common/http'; import { provideCloudflareLoader } from '@angular/common'; import { TokenInterceptorService } from './token-interceptor.service'; @@ -30,6 +31,7 @@ import { RejectrequestComponent } from './rejectrequest/rejectrequest.component' import { NotificationComponent } from './notification/notification.component'; import { BookreturnComponent } from './bookreturn/bookreturn.component'; import { ViewAdminprofileComponent } from './view-adminprofile/view-adminprofile.component'; +import { BrowserAnimationsModule } from '@angular/platform-browser/animations'; // import { MatIconModule, MatToolbarModule, MatTooltipModule } from '@angular/material'; @@ -38,6 +40,18 @@ import { ImageuploadComponent } from './imageupload/imageupload.component'; import { NgbModule } from '@ng-bootstrap/ng-bootstrap'; import { FineComponent } from './fine/fine.component'; import { NgxPaginationModule } from 'ngx-pagination'; +import { SidenavComponent } from './sidenav/sidenav.component'; +import { UserSidenavComponent } from './user-sidenav/user-sidenav.component'; +import { MatFormFieldModule } from '@angular/material/form-field'; +import { AddcategoryComponent } from './addcategory/addcategory.component'; +import { MatButtonModule } from '@angular/material/button'; +import { MatSelect, MatSelectModule } from '@angular/material/select'; +import { DemoComponent } from './demo/demo.component'; +import { AddbooksComponent } from './addbooks/addbooks.component'; +import { MatInputModule } from '@angular/material/input'; +import { MatOptionModule } from '@angular/material/core'; +import { BorrowDetailViewComponent } from './borrow-detail-view/borrow-detail-view.component'; +import { ForgotpasswordComponent } from './forgotpassword/forgotpassword.component'; // import {MatIconModule} from '@angular/material/icon'; // import { MatToolbarModule } from '@angular/material'; @@ -68,6 +82,15 @@ import { NgxPaginationModule } from 'ngx-pagination'; ViewAdminprofileComponent, ImageuploadComponent, FineComponent, + SidenavComponent, + UserSidenavComponent, + AddcategoryComponent, + DemoComponent, + AddbooksComponent, + BorrowDetailViewComponent, + ForgotpasswordComponent, + + // ModalComponent ], @@ -80,13 +103,24 @@ import { NgxPaginationModule } from 'ngx-pagination'; NgToastModule, MatIconModule, NgbModule, - NgxPaginationModule + NgxPaginationModule, + MatDialogModule, + MatFormFieldModule, + BrowserAnimationsModule , + MatButtonModule, + MatSelectModule, + MatDialogModule, + MatInputModule + + ///MatIconModule, // MatToolbarModule, // MatTooltipModule, //BrowserAnimationsModule ], + // ,{provide: MAT_DIALOG_DEFAULT_OPTIONS, useValue: {hasBackdrop: false}} providers: [ {provide:HTTP_INTERCEPTORS,useClass:TokenInterceptorService,multi:true},[HomeguardGuard, GuardserviceService] ], - bootstrap: [AppComponent] + bootstrap: [AppComponent], + entryComponents:[CategoryComponent,DemoComponent], }) export class AppModule { } diff --git a/FrontEnd/iprjt/src/app/books.service.ts b/FrontEnd/iprjt/src/app/books.service.ts index 3f5632f9..46a1d95d 100644 --- a/FrontEnd/iprjt/src/app/books.service.ts +++ b/FrontEnd/iprjt/src/app/books.service.ts @@ -1,6 +1,8 @@ import { HttpClient, HttpHeaders } from '@angular/common/http'; import { Injectable } from '@angular/core'; -import { Observable } from 'rxjs'; +import { catchError, Observable } from 'rxjs'; +import { HttpErrorResponse } from '@angular/common/http'; +import { Router } from '@angular/router'; @Injectable({ providedIn: 'root' @@ -8,32 +10,48 @@ import { Observable } from 'rxjs'; export class BooksService { apiurl='http://localhost:8080'; accesstocken:any - constructor(private http:HttpClient) { } + 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`); } +} + + ////////////////////////////////////////////// + add(data:any):Observable{ - return this.http.post('http://localhost:8080/books',data) + return this.http.post('http://localhost:8080/books',data).pipe((catchError(err => this.handleError(err)))) } Load(){ - return this.http.get('http://localhost:8080/books'); + return this.http.get('http://localhost:8080/books/admin').pipe((catchError(err => this.handleError(err)))) } LoadbyCategory(categoryId:any):Observable{ - return this.http.get('http://localhost:8080/books/findByCategory/'+categoryId); + return this.http.get('http://localhost:8080/books/user/findByCategory/'+categoryId).pipe((catchError(err => this.handleError(err)))); } delete(booksId:any):Observable{ let tocken=localStorage.getItem('accesstoken') let head_obj=new HttpHeaders({"Authorization":"library " + tocken}) - return this.http.delete(this.apiurl+'/books/'+booksId,{headers:head_obj}); + return this.http.delete(this.apiurl+'/books/'+booksId,{headers:head_obj}).pipe((catchError(err => this.handleError(err)))); } - pagination1(page:any,tableSize:any,sort:any){ - return this.http.get("http://localhost:8080/books/pagenated/?pageNo="+page+"&pageSize="+tableSize+"&sortBy="+sort) + pagination1(page:any,tableSize:any,sort:any,direction:any):Observable{ + return this.http.get("http://localhost:8080/books/admin/pagenated/?pageNo="+page+"&pageSize="+tableSize+"&sortBy="+sort+"&direction="+direction).pipe((catchError(err => this.handleError(err)))) + } + paginationForUser(page:any,tableSize:any,sort:any,direction:any):Observable{ + return this.http.get("http://localhost:8080/books/user/pagenated/?pageNo="+page+"&pageSize="+tableSize+"&sortBy="+sort+"&direction="+direction).pipe((catchError(err => this.handleError(err)))) } @@ -45,13 +63,13 @@ export class BooksService { 'Authorization': 'library ' + localStorage.getItem('accessToken') }) } - return this.http.put(this.apiurl + "/books/" + id, data, httpOptions) + return this.http.put(this.apiurl + "/books/" + id, data, httpOptions).pipe((catchError(err => this.handleError(err)))) } edit(booksId:any): Observable{ let tocken=localStorage.getItem('accesstoken') let head_obj=new HttpHeaders({"Authorization":"library " + tocken}) - return this.http.get(this.apiurl + '/books/'+ booksId,{headers:head_obj}); + return this.http.get(this.apiurl + '/books/'+ booksId,{headers:head_obj}).pipe((catchError(err => this.handleError(err)))); } } diff --git a/FrontEnd/iprjt/src/app/books/books.component.css b/FrontEnd/iprjt/src/app/books/books.component.css index 16c45ecf..e69de29b 100644 --- a/FrontEnd/iprjt/src/app/books/books.component.css +++ b/FrontEnd/iprjt/src/app/books/books.component.css @@ -1,632 +0,0 @@ -p{ - padding: 0px 0px 30px 1000px; - margin: 0px; - background-color: rgb(0, 0, 0); - background-image: url('../../../a.png'); - -} - -.btnhome{ - margin-top: 20px; - margin-bottom: 10px; - padding: 7; - border-color: rgb(124, 241, 134); - background-color: rgba(83, 254, 3, 0.853); - font-size: 13px; - border-radius: 25px; - -} - -.text-danger1{ - - width: 160%; - padding: 8px 6px; - margin: 0px; - box-sizing: border-box; - border: 1px ; - background-color: #a7bdb08f; - color: rgb(0, 0, 0); - border-radius: 7px; - -} - -.dropbtn{ - width: 160%; - padding: 8px 6px; - margin: 0px; - box-sizing: border-box; - border: 1px ; - background-color: #a7bdb08f; - color: rgb(0, 0, 0); - border-radius: 7px; -} -.btn{ - width: 150%; - padding: 7px 2px; - margin: 5px ; - box-sizing: border-box; - border: 2px solid rgb(250, 97, 97); - background-color:rgba(106, 215, 56, 0.682); - color: rgb(0, 0, 0); - border-radius: 7px; -} -.table-bordered{ - border: 1px solid; -} -th { - background-color: #232524; - color: white; - width: 15%; - text-align: center; - } - td { - background-color: #a7bdb08f; - color: rgb(0, 0, 0); - width: 15%; - text-align: center; - margin-top: auto; - padding: auto; - } - - - .btnList{ - border: none; - padding: 1px; - background: rgb(0, 0, 0); - font-size: 13px; - font-style: italic ; - color: rgb(255, 255, 255); - border-radius: 3px; -} -/* new css */ -html { - height: 100%; -} - -body { - overflow: hidden; - background-size: cover; - position: fixed; - padding: 0px; - margin: 0px; - width: 100%; - height: 100%; - font: normal 14px/1.618em "Roboto", sans-serif; - -webkit-font-smoothing: antialiased; -} - -body:before { - content: ""; - height: 0px; - padding: 0px; - border: 130em solid #313440; - position: absolute; - left: 50%; - top: 100%; - z-index: 2; - display: block; - -webkit-border-radius: 50%; - border-radius: 50%; - -webkit-transform: translate(-50%, -50%); - transform: translate(-50%, -50%); - -webkit-animation: puff 0.5s 1.8s cubic-bezier(0.55, 0.055, 0.675, 0.19) - forwards, - borderRadius 0.2s 2.3s linear forwards; - animation: puff 0.5s 1.8s cubic-bezier(0.55, 0.055, 0.675, 0.19) forwards, - borderRadius 0.2s 2.3s linear forwards; -} - -.nav-bar { - background: rgba(68 10 10 / 89%); - color: #fff; - height: 50px; - padding-bottom: 20; - padding-top: 14px; -} - -.nav-bar-ul { - margin: 0 auto; - width: 1500px; -} - -.nav-bar-li { - float: left; - list-style-type: none; - text-align: center; - width: 25%; -} - -.nav-bar-item { - color: #fff; - font-size: 1em; - text-decoration: none; -} - -h1, -h2 { - font-weight: 500; - margin: 0px 0px 5px 0px; -} - -h1 { - font-size: 24px; -} - -h2 { - font-size: 16px; -} - -p { - margin: 0px; -} - -.profile-card { - background: #e9dede; - width: 100px; - height: 350px; - position: absolute; - left: 50%; - top: 60%; - z-index: 2; - /* overflow: hidden; */ - opacity: 0; - /* margin-top: 100px; */ - /* -webkit-transform: translate(-50%, -50%); */ - transform: translate(-50%, -50%); - -webkit-border-radius: 50%; - border-radius: 50%; - /* -webkit-box-shadow: 0px 3px 6px rgba(0, 0, 0, 0.16), - 0px 3px 6px rgba(0, 0, 0, 0.23); - box-shadow: 0px 3px 6px rgba(0, 0, 0, 0.16), 0px 3px 6px rgba(0, 0, 0, 0.23); */ - -webkit-animation: init 0.5s 0.2s cubic-bezier(0.55, 0.055, 0.675, 0.19) - forwards, - moveDown 1s 0.8s cubic-bezier(0.6, -0.28, 0.735, 0.045) forwards, - moveUp 1s 1.8s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards, - materia 0.5s 2.7s cubic-bezier(0.86, 0, 0.07, 1) forwards; - animation: init 0.5s 0.2s cubic-bezier(0.55, 0.055, 0.675, 0.19) forwards, - moveDown 1s 0.8s cubic-bezier(0.6, -0.28, 0.735, 0.045) forwards, - moveUp 1s 1.8s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards, - materia 0.5s 2.7s cubic-bezier(0.86, 0, 0.07, 1) forwards; -} - -.profile-card header { - width: 179px; - height: 280px; - padding: 40px 20px 30px 20px; - display: inline-block; - border-right: 2px dashed #eeeeee; - background: #ffffff; - color: #000000; - margin-top: 50px; - opacity: 0; - text-align: center; - -webkit-animation: moveIn 1s 3.1s ease forwards; - animation: moveIn 1s 3.1s ease forwards; -} - -.profile-card header h1 { - color: #ff5722; -} - -.profile-card header a { - display: inline-block; - text-align: center; - position: relative; - margin: 25px 30px; -} - -.profile-card header a:after { - position: absolute; - content: ""; - bottom: 3px; - right: 3px; - width: 20px; - height: 20px; - border: 4px solid #ffffff; - -webkit-transform: scale(0); - transform: scale(0); - background: -webkit-linear-gradient( - top, - #2196f3 0%, - #2196f3 50%, - #ffc107 50%, - #ffc107 100% - ); - background: linear-gradient( - #2196f3 0%, - #2196f3 50%, - #ffc107 50%, - #ffc107 100% - ); - -webkit-border-radius: 50%; - border-radius: 50%; - -webkit-box-shadow: 0px 1px 3px rgba(0, 0, 0, 0.1); - box-shadow: 0px 1px 3px rgba(0, 0, 0, 0.1); - -webkit-animation: scaleIn 0.3s 3.5s ease forwards; - animation: scaleIn 0.3s 3.5s ease forwards; -} - -.profile-card header a > img { - width: 120px; - max-width: 100%; - -webkit-border-radius: 50%; - border-radius: 50%; - -webkit-transition: -webkit-box-shadow 0.3s ease; - transition: box-shadow 0.3s ease; - -webkit-box-shadow: 0px 0px 0px 8px rgba(0, 0, 0, 0.06); - box-shadow: 0px 0px 0px 8px rgba(0, 0, 0, 0.06); -} - -.profile-card header a:hover > img { - -webkit-box-shadow: 0px 0px 0px 12px rgba(0, 0, 0, 0.1); - box-shadow: 0px 0px 0px 12px rgba(0, 0, 0, 0.1); -} - -.profile-card .profile-bio { - width: 175px; - height: 180px; - display: inline-block; - padding: 50px 20px 30px 20px; - background: #ffffff; - color: #333333; - margin-top: 50px; - text-align: center; - opacity: 0; - -webkit-animation: moveIn 1s 3.1s ease forwards; - animation: moveIn 1s 3.1s ease forwards; -} - -.profile-social-links { - width: 218px; - display: inline-block; - margin: 0px; - padding: 15px 20px; - background: #ffffff; - margin-top: 50px; - text-align: center; - opacity: 0; - -webkit-box-sizing: border-box; - box-sizing: border-box; - -webkit-animation: moveIn 1s 3.1s ease forwards; - animation: moveIn 1s 3.1s ease forwards; -} - -.profile-social-links li { - list-style: none; - margin: -5px 0px 0px 0px; - padding: 0px; - float: left; - width: 25%; - text-align: center; -} - -.profile-social-links li a { - display: inline-block; - color: red; - width: 24px; - height: 24px; - padding: 6px; - position: relative; - overflow: hidden !important; - -webkit-border-radius: 50%; - border-radius: 50%; -} - -.profile-social-links li a i { - position: relative; - z-index: 1; -} - -.profile-social-links li a img, -.profile-social-links li a svg { - width: 24px; -} - -@-webkit-keyframes init { - 0% { - width: 0px; - height: 0px; - } - 100% { - width: 56px; - height: 56px; - margin-top: 0px; - opacity: 1; - } -} - -@keyframes init { - 0% { - width: 0px; - height: 0px; - } - 100% { - width: 56px; - height: 56px; - margin-top: 0px; - opacity: 1; - } -} - -@-webkit-keyframes puff { - 0% { - top: 100%; - height: 0px; - padding: 0px; - } - 100% { - top: 50%; - height: 100%; - padding: 0px 100%; - } -} - -@keyframes puff { - 0% { - top: 100%; - height: 0px; - padding: 0px; - } - 100% { - top: 50%; - height: 100%; - padding: 0px 100%; - } -} - -@-webkit-keyframes borderRadius { - 0% { - -webkit-border-radius: 50%; - } - 100% { - -webkit-border-radius: 0px; - } -} - -@keyframes borderRadius { - 0% { - -webkit-border-radius: 50%; - } - 100% { - border-radius: 0px; - } -} - -@-webkit-keyframes moveDown { - 0% { - top: 50%; - } - 50% { - top: 40%; - } - 100% { - top: 100%; - } -} - -@keyframes moveDown { - 0% { - top: 50%; - } - 50% { - top: 40%; - } - 100% { - top: 100%; - } -} - -@-webkit-keyframes moveUp { - 0% { - background: #ffb300; - top: 100%; - } - 50% { - top: 40%; - } - 100% { - top: 50%; - background: #e0e0e0; - } -} - -@keyframes moveUp { - 0% { - background: #ffb300; - top: 100%; - } - 50% { - top: 40%; - } - 100% { - top: 50%; - background: #e0e0e0; - } -} - -@-webkit-keyframes materia { - 0% { - background: #e0e0e0; - } - 50% { - -webkit-border-radius: 4px; - } - 100% { - width: 440px; - height: 280px; - background: #ffffff; - -webkit-border-radius: 4px; - } -} - -@keyframes materia { - 0% { - background: #e0e0e0; - } - 50% { - border-radius: 4px; - } - 100% { - width: 440px; - height: 280px; - background: #ffffff; - border-radius: 4px; - } -} - -@-webkit-keyframes moveIn { - 0% { - margin-top: 50px; - opacity: 0; - } - 100% { - opacity: 1; - margin-top: -20px; - } -} - -@keyframes moveIn { - 0% { - margin-top: 50px; - opacity: 0; - } - 100% { - opacity: 1; - margin-top: -20px; - } -} - -@-webkit-keyframes scaleIn { - 0% { - -webkit-transform: scale(0); - } - 100% { - -webkit-transform: scale(1); - } -} - -@keyframes scaleIn { - 0% { - transform: scale(0); - } - 100% { - transform: scale(1); - } -} - -@-webkit-keyframes ripple { - 0% { - transform: scale3d(0, 0, 0); - } - 50%, - 100% { - -webkit-transform: scale3d(1, 1, 1); - } - 100% { - opacity: 0; - } -} - -@keyframes ripple { - 0% { - transform: scale3d(0, 0, 0); - } - 50%, - 100% { - transform: scale3d(1, 1, 1); - } - 100% { - opacity: 0; - } -} - -@media screen and (min-aspect-ratio: 4x/3) { - body { - background-size: cover; - } - body:before { - width: 0px; - } - @-webkit-keyframes puff { - 0% { - top: 100%; - width: 0px; - padding-bottom: 0px; - } - 100% { - top: 50%; - width: 100%; - padding-bottom: 100%; - } - } - @keyframes puff { - 0% { - top: 100%; - width: 0px; - padding-bottom: 0px; - } - 100% { - top: 50%; - width: 100%; - padding-bottom: 100%; - } - } -} - -@media screen and (min-height: 480px) { - .profile-card header { - width: auto; - height: auto; - padding: 30px 20px; - display: block; - float: none; - border-right: none; - } - .profile-card .profile-bio { - width: auto; - height: 350px; - padding: 15px 20px 30px 20px; - display: block; - float: none; - } - .profile-social-links { - width: 100%; - display: block; - float: none; - } - @-webkit-keyframes materia { - 0% { - background: #e0e0e0; - } - 50% { - -webkit-border-radius: 4px; - } - 100% { - width: 280px; - height: 440px; - background: #ffffff; - -webkit-border-radius: 4px; - } - } - @keyframes materia { - 0% { - background: #e0e0e0; - } - 50% { - border-radius: 4px; - } - 100% { - width: 280px; - height: 440px; - background: #ffffff; - border-radius: 4px; - } - } - .btn { - display: inline-block; - border-radius: 2em; - border: 1; - padding: 0.5rem 1rem; - white-space: nowrap; - } -} diff --git a/FrontEnd/iprjt/src/app/books/books.component.html b/FrontEnd/iprjt/src/app/books/books.component.html index e669c05e..bc13b96d 100644 --- a/FrontEnd/iprjt/src/app/books/books.component.html +++ b/FrontEnd/iprjt/src/app/books/books.component.html @@ -1,11 +1,84 @@ - -

-

-

- + +
+
+

ADD BOOKS

+ + + + + + + + {{category.categoryName}} + + + + + +
+ + + + This field is mandatory. + +
+ + + This field is mandatory. + +
+ + + This field is mandatory. + +
+ + + This field is mandatory. + +
+
+ +
+    + + +
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - -


+ +


- -
- - -
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Category-NamePublicationBook NameAutherBook CopiesBook imageAction
{{books.category.categoryName}}{{books.publication}}{{books.booksName}}{{books.auther}}{{books.booksCopies}} - - - - - - -
- -
-
-
\ No newline at end of file + --> diff --git a/FrontEnd/iprjt/src/app/books/books.component.ts b/FrontEnd/iprjt/src/app/books/books.component.ts index 3969b797..b8bd3395 100644 --- a/FrontEnd/iprjt/src/app/books/books.component.ts +++ b/FrontEnd/iprjt/src/app/books/books.component.ts @@ -4,6 +4,8 @@ import { Router } from '@angular/router'; import { CategoryService } from '../category.service'; import { BooksService } from '../books.service'; import { ImageuploadService } from '../imageupload.service'; +import { NgToastService } from 'ng-angular-popup'; + @Component({ selector: 'app-books', @@ -12,7 +14,7 @@ import { ImageuploadService } from '../imageupload.service'; }) export class BooksComponent implements OnInit { - + categoryList: any[]; @@ -26,50 +28,65 @@ export class BooksComponent implements OnInit { categorydata:any; booksdata:any; catdata: any; + ObjSampleForm:FormGroup; - - constructor(private router:Router ,private booksService:BooksService,private service:CategoryService,private imageService:ImageuploadService) { + 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]) , + } + ); } ngOnInit(): void { + + + this.LoadCategory(); + this.loadEdit(); + + +} + + +disp(categoryId:any){ + console.log(categoryId) +} + +LoadCategory() { + this.service.LoadCategory().subscribe((data: any)=>{ this.catdata=data; - console.log(this.catdata) + console.log('catadata=',this.catdata) }); - - this.Load(); + } -} - -ObjSampleForm:FormGroup=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]) , + clear() { + localStorage.removeItem('categoryId'); + window.location.reload() } -) -disp(){ - console.log(this.categoryId) -} - -Load() { - this.booksService.Load().subscribe((data: any)=>{ - console.log(data) - this.booksdata=data; - }); } - onSubmit(){ + + // let booksId=localStorage.getItem("booksId") + if(this.booksId!=undefined){ this.update(this.booksId) - }else{ + }else + { this.booksService.add(this.ObjSampleForm.value).subscribe(result=>{ @@ -77,12 +94,15 @@ onSubmit(){ if(result.booksId){ console.log(result); alert(" The Book "+result.booksName+" Added"); + this.toast.success({detail:'Success',summary:'The Book'+result.booksName+'Added',duration:5000}); this.imageService.setId(result.booksId) + console.log("bid=",result.booksId) this.router.navigate(['/imageupload']) + // window.location.reload(); } else{ - alert("Books Not added"); + this.toast.success({detail:'Invalid',summary:'Add new Book Failed',duration:5000}); } }) @@ -92,42 +112,26 @@ onSubmit(){ } - delete(booksId:any): void{ - if(confirm('Are you sure want to delete?')) - { - console.log(booksId); - this.booksService.delete(booksId.booksId).subscribe({next:(res)=>{ - console.log(res); - alert("Books deleted"); - window.location.reload(); - }, - error:(msg)=>{} - }) - } - else{ - this.router.navigate(['/books']) - } -} - - - +loadEdit(): void{ -edit(booksId:any): void{ - - this.booksService.edit(booksId.booksId).subscribe({ + 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.categoryName) + 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(res); + console.log("edit",res); + //console.log(res); }, error:(msg)=>{} }) } +} update(booksId:any){ @@ -143,25 +147,32 @@ update(booksId:any){ } console.log(body) - // console.log(body.categoryName) + this.booksService.update(booksId, body).subscribe({ next: (Response: any) => { console.log(Response); - alert(" Edited successfully") + this.toast.success({detail:'Success',summary:Response.booksName+' Edited Successfully',duration:5000}); + // window.location.reload() + if (confirm('Do you want to change Book cover?')) { + this.imageService.setId(Response.booksId) + console.log("bookId=",Response.booksId) + this.router.navigate(['/imageupload']) + } else { + + this.router.navigate(['/addbooks']) window.location.reload() + } + + }, error: (Response: any) => { console.log(Response) - alert("invalid Book Details") + this.toast.success({detail:'Invalid',summary:'Enter valid details ',duration:5000}); } }) - + localStorage.removeItem('booksId'); } - home() - { - this.router.navigate(['/body']) - } } diff --git a/FrontEnd/iprjt/src/app/booksdisplay/booksdisplay.component.ts b/FrontEnd/iprjt/src/app/booksdisplay/booksdisplay.component.ts index 4a642428..3d1c5636 100644 --- a/FrontEnd/iprjt/src/app/booksdisplay/booksdisplay.component.ts +++ b/FrontEnd/iprjt/src/app/booksdisplay/booksdisplay.component.ts @@ -34,9 +34,11 @@ a:any; b:any; searchResult:any searchData:any -sort:string="booksId"; +sort:string="auther"; len: any; result: any; + booksCount: any; + direction=-1; constructor(private router:Router ,private booksservice:BooksService,private service:CategoryService,private borrowservice:BorrowService) { @@ -45,51 +47,70 @@ result: any; } ngOnInit(): void { -// this.Load(); -this.booksservice.Load().subscribe(result=>{ - this.len=result; - this.count=this.len.length; - console.log(result) -}) -if(this.searchData==null || this.searchData==""){ - this.booksservice.pagination1(this.page,this.tableSize,this.sort).subscribe((result=>{ - this.data=result; - console.log("thisata") - console.log(this.data) - console.log(result) - })); -} -else{ - this.data=this.searchData +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; + }); + } + + + borrowBlock(){ +this.borrowservice.borrowBlock().subscribe({ + next:(res)=>{ + this.booksCount=res; + // console.log("blk"); + console.log("block rslt=",res); + }}) } +borrowStockEmpty(){ + } -sortfn(a:any){ - +sortfn(a:any){ this.sort=a; this.page=this.page; this.tableSize; - this.ngOnInit(); + 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(event) - this.booksservice.pagination1(event,this.tableSize,this.sort).subscribe((result=>{ - this.data=result; - }), - ); + 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; + }) } - // Load() { - // this.booksservice.Load().subscribe((data: any)=>{ - // this.len=data; - // }); } + requestBook(booksId: any) { @@ -99,6 +120,10 @@ onTableDataChange(event:any) { 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)=>{ @@ -109,7 +134,7 @@ onTableDataChange(event:any) { }, error:(msg)=>{} }) - } + }} } diff --git a/FrontEnd/iprjt/src/app/borrow-detail-view/borrow-detail-view.component.css b/FrontEnd/iprjt/src/app/borrow-detail-view/borrow-detail-view.component.css new file mode 100644 index 00000000..fd0373aa --- /dev/null +++ b/FrontEnd/iprjt/src/app/borrow-detail-view/borrow-detail-view.component.css @@ -0,0 +1,35 @@ +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%; +} + + +.table-bordered{ +border: none; +width: 60%; +} + + td { + color: rgb(0, 0, 0); + width: auto; + padding: 8px; + } + diff --git a/FrontEnd/iprjt/src/app/borrow-detail-view/borrow-detail-view.component.html b/FrontEnd/iprjt/src/app/borrow-detail-view/borrow-detail-view.component.html new file mode 100644 index 00000000..ae1a079f --- /dev/null +++ b/FrontEnd/iprjt/src/app/borrow-detail-view/borrow-detail-view.component.html @@ -0,0 +1,30 @@ + +
+
+
+
+

+

Borrow Details

+ + + + + + + + + + + + + + + + + + +
NAME : {{this.borrowdata.user.firstName}}
BOOK NAME : {{this.borrowdata.books.booksName}}
ISSUE DATE : {{this.borrowdata.issueDate| date:'dd/MM/yyyy'}}
RETURN DATE : {{this.borrowdata.returnDate| date:'dd/MM/yyyy'}}
DUE DATE : {{this.borrowdata.dueDate| date:'dd/MM/yyyy'}}
DUE DAYS : {{this.borrowdata.dueDays}}
FINE (INR) : {{this.borrowdata.fine}}
RETURNED DATE :{{this.borrowdata.bookReturnedDate| date:'dd/MM/yyyy'}}
STATUS : {{this.borrowdata.status}}
Reason: {{this.borrowdata.reason}}
+ +
+
+
\ No newline at end of file diff --git a/FrontEnd/iprjt/src/app/borrow-detail-view/borrow-detail-view.component.spec.ts b/FrontEnd/iprjt/src/app/borrow-detail-view/borrow-detail-view.component.spec.ts new file mode 100644 index 00000000..27b6ec32 --- /dev/null +++ b/FrontEnd/iprjt/src/app/borrow-detail-view/borrow-detail-view.component.spec.ts @@ -0,0 +1,23 @@ +import { ComponentFixture, TestBed } from '@angular/core/testing'; + +import { BorrowDetailViewComponent } from './borrow-detail-view.component'; + +describe('BorrowDetailViewComponent', () => { + let component: BorrowDetailViewComponent; + let fixture: ComponentFixture; + + beforeEach(async () => { + await TestBed.configureTestingModule({ + declarations: [ BorrowDetailViewComponent ] + }) + .compileComponents(); + + fixture = TestBed.createComponent(BorrowDetailViewComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); + + it('should create', () => { + expect(component).toBeTruthy(); + }); +}); diff --git a/FrontEnd/iprjt/src/app/borrow-detail-view/borrow-detail-view.component.ts b/FrontEnd/iprjt/src/app/borrow-detail-view/borrow-detail-view.component.ts new file mode 100644 index 00000000..d4b9f304 --- /dev/null +++ b/FrontEnd/iprjt/src/app/borrow-detail-view/borrow-detail-view.component.ts @@ -0,0 +1,35 @@ +import { Component, OnInit } from '@angular/core'; +import { Router } from '@angular/router'; +import { BooksService } from '../books.service'; +import { BorrowService } from '../borrow.service'; + +@Component({ + selector: 'app-borrow-detail-view', + templateUrl: './borrow-detail-view.component.html', + styleUrls: ['./borrow-detail-view.component.css'] +}) +export class BorrowDetailViewComponent implements OnInit { + + borrowId:any; + borrowdata:any; + booksdata:any; + + constructor(private router:Router ,private service:BorrowService,private booksService:BooksService) { + + } + + ngOnInit(): void { + //sessionStorage.clear() + this.LoadBorrow(this.borrowId) + + } + + LoadBorrow(borrow:any){ + this.service.LoadBorrowDetailView(borrow).subscribe((data)=>{ + this.borrowdata=data; + console.log(this.borrowdata);}); + +} + + +} diff --git a/FrontEnd/iprjt/src/app/borrow.service.ts b/FrontEnd/iprjt/src/app/borrow.service.ts index 51cf4faa..f65089ca 100644 --- a/FrontEnd/iprjt/src/app/borrow.service.ts +++ b/FrontEnd/iprjt/src/app/borrow.service.ts @@ -1,6 +1,8 @@ import { HttpClient, HttpHeaders } from '@angular/common/http'; import { Injectable } from '@angular/core'; -import { Observable } from 'rxjs'; +import { catchError, Observable } from 'rxjs'; +import { HttpErrorResponse } from '@angular/common/http'; +import { Router } from '@angular/router'; @Injectable({ providedIn: 'root' @@ -12,60 +14,83 @@ export class BorrowService { apiurl='http://localhost:8080'; accesstocken:any - constructor(private http:HttpClient) { } + 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`); } +} + + ////////////////////////////////////////////// + sendMail(userId: any):Observable { console.log("inservice"+userId) - return this.http.post('http://localhost:8080/email/emailsent/'+userId,userId); + return this.http.post('http://localhost:8080/email/emailsent/'+userId,userId).pipe((catchError(err => this.handleError(err)))); } add(data:any):Observable{ - return this.http.post('http://localhost:8080/borrow',data) + return this.http.post('http://localhost:8080/borrow',data).pipe((catchError(err => this.handleError(err)))) } borrowHistoryPagination(page:any,tableSize:any,sort:any){ - return this.http.get("http://localhost:8080/borrow/userBorrow/pagenated/?pageNo="+page+"&pageSize="+tableSize+"&sortBy="+sort) + return this.http.get("http://localhost:8080/borrow/userBorrow/pagenated/?pageNo="+page+"&pageSize="+tableSize+"&sortBy="+sort).pipe((catchError(err => this.handleError(err)))) } - borrowPagination(page:any,tableSize:any,sort:any){ - return this.http.get("http://localhost:8080/borrow/pagenated/?pageNo="+page+"&pageSize="+tableSize+"&sortBy="+sort) + borrowPagination(page:any,tableSize:any,sort:any,direction:any):Observable{ + return this.http.get("http://localhost:8080/borrow/admin/pagenated/?pageNo="+page+"&pageSize="+tableSize+"&sortBy="+sort+"&direction="+direction).pipe((catchError(err => this.handleError(err)))) } - filterBorrowPagination(date1:any,date2:any,page:any,tableSize:any,sort:any){ - console.log(date1) - return this.http.get(this.apiurl + "/borrow/"+date1+"/"+date2+"/?pageNo="+page+"&pageSize="+tableSize+"&sortBy="+sort) + filterBorrowPagination(date1:any,date2:any,page:any,tableSize:any,sort:any,direction:any):Observable{ + console.log(date1,' to ',date2) + return this.http.get(this.apiurl + "/borrow/admin/"+date1+"/"+date2+"/?pageNo="+page+"&pageSize="+tableSize+"&sortBy="+sort+"&direction="+direction).pipe((catchError(err => this.handleError(err)))) } // return this.http.get(this.apiurl + `/users/fetching/${type}/${date1}/${date2}`, httpOptions) LoadByIssueDate(date1:any,date2:any){ - return this.http.get(this.apiurl + "/borrow/loadByIssueDate/"+date1+"/"+date2); + return this.http.get(this.apiurl + "/borrow/loadByIssueDate/"+date1+"/"+date2).pipe((catchError(err => this.handleError(err)))); } Load(){ - return this.http.get('http://localhost:8080/borrow'); + return this.http.get('http://localhost:8080/borrow').pipe((catchError(err => this.handleError(err)))); + } + + LoadBorrowDetailView(id: any){ + return this.http.get('http://localhost:8080/borrow/'+ sessionStorage.getItem('borrowId')).pipe((catchError(err => this.handleError(err)))); } + + borrowBlock(){ + return this.http.get('http://localhost:8080/borrow/borrowBlock'); + } + + LoadDue(){ - return this.http.get('http://localhost:8080/borrow/due'); + return this.http.get('http://localhost:8080/borrow/due').pipe((catchError(err => this.handleError(err)))); } LoadFine(){ - return this.http.get('http://localhost:8080/borrow/fine'); + return this.http.get('http://localhost:8080/borrow/admin/fine').pipe((catchError(err => this.handleError(err)))); } LoadDueByUser(){ - return this.http.get('http://localhost:8080/borrow/dueByUser'); + return this.http.get('http://localhost:8080/borrow/dueByUser').pipe((catchError(err => this.handleError(err)))); } LoadUserList(){ - return this.http.get('http://localhost:8080/borrow/list/user'); + return this.http.get('http://localhost:8080/borrow/list/user').pipe((catchError(err => this.handleError(err)))); } LoadNotification(){ - return this.http.get('http://localhost:8080/borrow/user/notification'); + return this.http.get('http://localhost:8080/borrow/user/notification').pipe((catchError(err => this.handleError(err)))); } LoadUserNotification(){ - return this.http.get('http://localhost:8080/borrow/user/UserNotification'); + return this.http.get('http://localhost:8080/borrow/user/UserNotification').pipe((catchError(err => this.handleError(err)))); } @@ -93,7 +118,7 @@ export class BorrowService { // } update(id: any, data: any) { - return this.http.put(this.apiurl + "/borrow/" + sessionStorage.getItem('borrowId'), data); + return this.http.put(this.apiurl + "/borrow/admin/accept/" + sessionStorage.getItem('borrowId'), data).pipe((catchError(err => this.handleError(err)))); } @@ -101,15 +126,15 @@ export class BorrowService { // return this.http.put(this.apiurl + "/borrow/reject/" + id,{headers:Headers}); // } updateReject(id: any, data:any) { - return this.http.put(this.apiurl + "/borrow/reject/" + sessionStorage.getItem('borrowId'), data); + return this.http.put(this.apiurl + "/borrow/admin/reject/" + sessionStorage.getItem('borrowId'), data).pipe((catchError(err => this.handleError(err)))); } bookReturn(id: any) { - return this.http.put(this.apiurl + "/borrow/return/" + id,{headers:Headers}); + return this.http.put(this.apiurl + "/borrow/admin/return/" + id,{headers:Headers}).pipe((catchError(err => this.handleError(err)))); } undo(id: any) { - return this.http.put(this.apiurl + "/borrow/undo/" + id,{headers:Headers}); + return this.http.put(this.apiurl + "/borrow/admin/undo/" + id,{headers:Headers}).pipe((catchError(err => this.handleError(err)))); } @@ -117,7 +142,7 @@ export class BorrowService { edit(booksId:any): Observable{ let tocken=localStorage.getItem('accesstoken') let head_obj=new HttpHeaders({"Authorization":"library " + tocken}) - return this.http.get(this.apiurl + '/borrow/'+ booksId,{headers:head_obj}); + return this.http.get(this.apiurl + '/borrow/'+ booksId,{headers:head_obj}).pipe((catchError(err => this.handleError(err)))); } } diff --git a/FrontEnd/iprjt/src/app/borrow/borrow.component.css b/FrontEnd/iprjt/src/app/borrow/borrow.component.css index a6998674..e697fb10 100644 --- a/FrontEnd/iprjt/src/app/borrow/borrow.component.css +++ b/FrontEnd/iprjt/src/app/borrow/borrow.component.css @@ -1,38 +1,26 @@ -p{ - padding: 0px 0px 30px 1000px; - margin: 0px; - background-color: rgb(0, 0, 0); - background-image: url('../../../a.png'); - -} + -.btnhome{ - margin-top: 20px; - margin-bottom: 10px; - padding: 7; - border-color: rgb(124, 241, 134); - background-color: rgba(83, 254, 3, 0.853); - font-size: 13px; - border-radius: 25px; - -} .btnn{ - padding: 7; - border-color: rgb(124, 241, 134); - background-color: rgba(83, 254, 3, 0.853); + padding-left: 10px;padding-right: 10px; + border-color: rgb(0, 0, 0); + background-color: rgba(107, 235, 48, 0.853); font-size: 13px; } .btnn1{ padding-left: 13px;padding-right: 13px; border-color: rgb(0, 0, 0); - background-color: rgba(58, 100, 216, 0.705); + background-color: rgba(179, 58, 216, 0.705); + margin-left: -19px; font-size: 13px; } .btnn0{ padding-left: 10px;padding-right: 10px; border-color: rgb(0, 0, 0); - background-color: rgba(40, 216, 78, 0.705); + background-color: rgba(0, 247, 49, 0.812); font-size: 13px; + margin-left: 23px; + /* position:absolute; left:1180px; */ + } .btnn2{ padding-left: 10px;padding-right: 10px; @@ -77,13 +65,25 @@ p{ color: rgb(0, 0, 0); border-radius: 7px; } + + + .btnList{ + border: none; + padding: 1px; + background: rgb(0, 0, 0); + font-size: 13px; + font-style: italic ; + color: rgb(255, 255, 255); + border-radius: 3px; +} +/* .table-bordered{ border: 1px solid; } th { background-color: #232524; color: white; - width: 10%; + width: 8%; text-align: center; margin-left: 5px; margin-right: 5px; @@ -91,21 +91,27 @@ th { td { background-color: #a7bdb08f; color: rgb(0, 0, 0); - width: 10%; + width: 8%; text-align: center; margin-top: auto; margin-left: 5px; margin-right: 5px; padding: auto; - } - + } */ - .btnList{ + table{ + width: 80%; border: none; - padding: 1px; - background: rgb(0, 0, 0); - font-size: 13px; - font-style: italic ; - color: rgb(255, 255, 255); - border-radius: 3px; -} + text-align: center; + + } + th { + background-color: #ffffff; + color: rgb(0, 0, 0); + text-align: center; + + } + td { + + padding-top: 6px;padding-bottom: 6px; + } \ No newline at end of file diff --git a/FrontEnd/iprjt/src/app/borrow/borrow.component.html b/FrontEnd/iprjt/src/app/borrow/borrow.component.html index 48d5120b..c55ac124 100644 --- a/FrontEnd/iprjt/src/app/borrow/borrow.component.html +++ b/FrontEnd/iprjt/src/app/borrow/borrow.component.html @@ -1,8 +1,5 @@ - -

-

-

+
@@ -11,51 +8,54 @@

Borrow Details

-
-
-
          - -
+
- +
+START DATE          +END DATE         +          +
+
+ +
- - - - - - - - - - - + + + + + + + + + + + - - + Borrow Details }; let i = index " > - - - + - - - - - +
User NameBook NameIssue DateReturn DateDue DateDueDaysFine(INR)Returned DateStatusReasonActionUser Name + + + Book Name + + + Issue Date + + + Due Date + + + Fine(INR) + + + Status + + +
{{ post.user.firstName }}{{ post.user.firstName }} {{post.books.booksName}} {{post.issueDate| date:'dd/MM/yyyy'}}{{post.returnDate| date:'dd/MM/yyyy'}} {{post.dueDate| date:'dd/MM/yyyy'}}{{post.dueDays}} {{post.fine}}{{post.bookReturnedDate| date:'dd/MM/yyyy'}} {{post.status}}{{post.reason}} -    -   
- -

+    +    +    +    +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
User NameBook NameIssue DateDue DateFine(INR)Status
{{ post.user.firstName }}{{post.books.booksName}}{{post.issueDate| date:'dd/MM/yyyy'}}{{post.dueDate| date:'dd/MM/yyyy'}}{{post.fine}}{{post.status}} + +  
+ +

+
+ + +
+ +
diff --git a/FrontEnd/iprjt/src/app/borrow/borrow.component.ts b/FrontEnd/iprjt/src/app/borrow/borrow.component.ts index b6361b8b..aa385c26 100644 --- a/FrontEnd/iprjt/src/app/borrow/borrow.component.ts +++ b/FrontEnd/iprjt/src/app/borrow/borrow.component.ts @@ -1,5 +1,6 @@ import { Component, OnInit } from '@angular/core'; import { FormGroup, FormControl, Validators } from '@angular/forms'; +import {MatSort,Sort} from '@angular/material/sort'; import { Router } from '@angular/router'; import { BooksService } from '../books.service'; import { BorrowService } from '../borrow.service'; @@ -13,16 +14,12 @@ import { CategoryService } from '../category.service'; export class BorrowComponent implements OnInit { - // borrowList: any[]; + borrowId:any; borrowdata:any; booksdata:any; - // POSTS: any; - // page: number = 1; - // count: number = 0; - // tableSize: number = 5; - // tableSizes: any = [3, 6, 9, 12]; + date:any; data: any; page:number=1; @@ -34,9 +31,13 @@ export class BorrowComponent implements OnInit { b:any; searchResult:any searchData:any - sort:string="status"; + sort1:string="borrowId"; + sort:string="borrow_id"; len: any; flag:number=0; + result: any; + direction=1; + direction1=-1; //borrow_id:any; constructor(private router:Router ,private service:BorrowService,private booksService:BooksService) { @@ -46,29 +47,21 @@ export class BorrowComponent implements OnInit { ngOnInit(): void { - sessionStorage.clear() - // this.LoadBorrow() - this.service.Load().subscribe(result=>{ - this.len=result; - console.log(result) - this.count=this.len.length; - //this.data=result; + - }) - - - if(this.searchData==null || this.searchData==""){ - this.service.borrowPagination(this.page,this.tableSize,this.sort).subscribe((result=>{ - this.data=result; - console.log('OnloadPagenation') - console.log(this.data) - })); - } - else{ + + sessionStorage.clear() + this.LoadData(); - this.data=this.searchData - } + } + LoadData(){ + this.service.borrowPagination(this.page,this.tableSize,this.sort1,this.direction).subscribe(result=>{ + this.result=result.content; + this.count=result.totalElements + console.log(this.result); + this.data=this.result; + }); } ObjSampleForm:FormGroup=new FormGroup( @@ -81,41 +74,60 @@ export class BorrowComponent implements OnInit { sortfn(a:any){ - this.sort=a; + this.sort1=a; this.page=this.page; this.tableSize; - this.ngOnInit(); - // this.getFilter(); - } - getFilter() { - - console.log(this.ObjSampleForm) - // this.page=1 - this.flag=1; - this.service.LoadByIssueDate(this.ObjSampleForm.controls['date1'].value,this.ObjSampleForm.controls['date2'].value).subscribe(result=>{ - this.len=result; - console.log(result) - this.count=this.len.length; - }) - - if(this.searchData==null || this.searchData==""){ - - this.sort="borrow_id"; - this.service.filterBorrowPagination(this.ObjSampleForm.controls['date1'].value,this.ObjSampleForm.controls['date2'].value,this.page,this.tableSize,this.sort).subscribe({ - next: (res: any) => { - //console.log("--------") - console.log(res); - this.data=res; - }, - }); - + + + + if(this.direction==1){ + this.direction=-1; + console.log("DIR -----1",this.direction) + this.ngOnInit(); } + else{ + this.direction=1; + console.log("dir -1",this.direction) + this.ngOnInit(); + } + + + } + + sortfilter(a:any){ + + this.sort=a; + this.page=this.page; + this.tableSize; + + if(this.direction1==1){ + this.direction1=-1; + console.log("DIR -----1",this.direction1) + this.getFilter(); + } + + else{ + this.direction1=1; + console.log("dir -1",this.direction1) + this.getFilter(); + } + } - this.data=this.searchData - } + + getFilter() { + + this.flag=1; + this.service.filterBorrowPagination(this.ObjSampleForm.controls['date1'].value,this.ObjSampleForm.controls['date2'].value,this.page,this.tableSize,this.sort,this.direction1).subscribe(response=>{ + this.result=response.content; + this.count=response.totalElements + console.log(this.result); + this.data=this.result; + }); } + + clearFilter(){ this.flag=0; window.location.reload(); @@ -126,32 +138,40 @@ export class BorrowComponent implements OnInit { console.log(event) if(this.flag==0){ console.log('flag=',this.flag) - this.service.borrowPagination(event,this.tableSize,this.sort).subscribe((result=>{ - this.data=result; - console.log('sorted') - }), - ); + this.service.borrowPagination(this.page,this.tableSize,this.sort1,this.direction).subscribe(result=>{ + this.result=result.content; + this.count=result.totalElements + console.log(this.result); + this.data=this.result; + }); } else if(this.flag==1){ console.log('flag=',this.flag) - this.service.filterBorrowPagination(this.ObjSampleForm.controls['date1'].value,this.ObjSampleForm.controls['date2'].value,this.page,this.tableSize,this.sort).subscribe({ - next: (res: any) => { - console.log("--------") - console.log(res); - this.data=res; - }, + this.service.filterBorrowPagination(this.ObjSampleForm.controls['date1'].value,this.ObjSampleForm.controls['date2'].value,this.page,this.tableSize,this.sort,this.direction1).subscribe(response=>{ + this.result=response.content; + this.count=response.totalElements + console.log(this.result); + this.data=this.result; + }); } } + + + ///////////////////////////////////////////////- C R U D -//////////////////////////////////////////////////// home() { - this.router.navigate(['/body']) + this.router.navigate(['/sidenav']) } - + LogOut(){ + sessionStorage.clear() + localStorage.clear() + this.router.navigate(['/login']) + } acceptRequest(borrow:any) @@ -194,7 +214,7 @@ export class BorrowComponent implements OnInit { undo(borrow: any) { - + alert(" Are you want to undo last change?") this.service.undo(borrow.borrowId).subscribe({ next: (Response: any) => { console.log(Response); @@ -208,6 +228,31 @@ export class BorrowComponent implements OnInit { }) this.router.navigate(['/borrow']) } + + + DetailView(borrow: any) { + + console.log("in borrow"); + console.log(borrow); + console.log(borrow.borrowId); + + sessionStorage.setItem('borrowId',borrow.borrowId) + this.router.navigate(['/borrow-detail-view']) + + } + + + + + } - \ No newline at end of file + + + + + + + function compare(a: number | string, b: number | string, isAsc: boolean) { + return (a < b ? -1 : 1) * (isAsc ? 1 : -1); + } diff --git a/FrontEnd/iprjt/src/app/category.service.ts b/FrontEnd/iprjt/src/app/category.service.ts index 4a05724a..b6ba9005 100644 --- a/FrontEnd/iprjt/src/app/category.service.ts +++ b/FrontEnd/iprjt/src/app/category.service.ts @@ -1,6 +1,8 @@ import { HttpClient, HttpHeaders } from '@angular/common/http'; import { Injectable } from '@angular/core'; -import { Observable } from 'rxjs'; +import { catchError, Observable } from 'rxjs'; +import { HttpErrorResponse } from '@angular/common/http'; +import { Router } from '@angular/router'; @Injectable({ providedIn: 'root' @@ -9,16 +11,36 @@ export class CategoryService { apiurl='http://localhost:8080'; accesstocken:any tocken:any; - constructor(private http:HttpClient) { } + constructor(private http:HttpClient,private router:Router) { } + + //error handling + 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{ - return this.http.post('http://localhost:8080/category',data) + return this.http.post('http://localhost:8080/category',data).pipe((catchError(err => this.handleError(err)))); } LoadCategory(){ - return this.http.get('http://localhost:8080/category'); + return this.http.get('http://localhost:8080/category/admin').pipe((catchError(err => this.handleError(err)))); + } + + CatPageAdmin(page:any,tableSize:any,sort:any,direction:any):Observable{ + return this.http.get("http://localhost:8080/category/admin/pagenated/?pageNo="+page+"&pageSize="+tableSize+"&sortBy="+sort+"&direction="+direction).pipe((catchError(err => this.handleError(err)))) + } + + LoadCategoryForUser(){ + return this.http.get('http://localhost:8080/category/user').pipe((catchError(err => this.handleError(err)))); } @@ -28,11 +50,11 @@ export class CategoryService { update(id: any, data: any) { - return this.http.put(this.apiurl + "/category/" + id, data); + return this.http.put(this.apiurl + "/category/" + id, data).pipe((catchError(err => this.handleError(err)))); } editCategory(categoryId:any): Observable{ - return this.http.get(this.apiurl + '/category/'+ categoryId); + return this.http.get(this.apiurl + '/category/'+ categoryId).pipe((catchError(err => this.handleError(err)))); } } diff --git a/FrontEnd/iprjt/src/app/category/category.component.css b/FrontEnd/iprjt/src/app/category/category.component.css index b44a38a3..fd209fb5 100644 --- a/FrontEnd/iprjt/src/app/category/category.component.css +++ b/FrontEnd/iprjt/src/app/category/category.component.css @@ -1,10 +1,10 @@ -p{ +/* p{ padding: 0px 0px 30px 1000px; margin: 0px; background-color: rgb(0, 0, 0); background-image: url('../../../a.png'); -} +} */ .btnhome{ margin-top: 20px; diff --git a/FrontEnd/iprjt/src/app/category/category.component.html b/FrontEnd/iprjt/src/app/category/category.component.html index ec19afc6..3f2df0d7 100644 --- a/FrontEnd/iprjt/src/app/category/category.component.html +++ b/FrontEnd/iprjt/src/app/category/category.component.html @@ -1,72 +1,22 @@ -

-

-

+ +
+

ADD CATEGORY

+ - + + + This field is mandatory. + -
- -
-
-

- -
- - Category Name is required - -

-


+ -
-
- +
+    + +
+ -
- - -
-
- - - - - - - - - - - - - - - - - - -
Category NameAction
{{category.categoryName}} - - - - - - - - - -
- -
-
-
\ No newline at end of file diff --git a/FrontEnd/iprjt/src/app/category/category.component.ts b/FrontEnd/iprjt/src/app/category/category.component.ts index 36d5a1ac..86125cb3 100644 --- a/FrontEnd/iprjt/src/app/category/category.component.ts +++ b/FrontEnd/iprjt/src/app/category/category.component.ts @@ -2,6 +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'; + + + +export interface DialogData { +categoryName:string; +} @Component({ selector: 'app-category', @@ -9,38 +16,71 @@ import { CategoryService } from '../category.service'; styleUrls: ['./category.component.css'] }) export class CategoryComponent implements OnInit { - - categoryList: any[]; - categoryId:any; - constructor(private router:Router ,private service:CategoryService) { - - this.categoryList=[]; - } - categorydata:any; - ngOnInit(): void { - this.LoadCategory(); - -} - -ObjSampleForm:FormGroup=new FormGroup( - { - categoryName:new FormControl('',[Validators.required]), + +categoryId:any; +categoryName:any; +data: any; +test:any; + + +ObjSampleForm:FormGroup; + + constructor( + private router:Router , + private service:CategoryService, + ) + { + this.ObjSampleForm=new FormGroup( + { + categoryName:new FormControl('',[Validators.required]), + } + ); + } + ngOnInit(): void { + +this.LoadEdit() + } -) + +LoadEdit(){ + let categoryId=localStorage.getItem("categoryId") + //set edit data to fields + + if(categoryId!=null){ + this.service.editCategory(categoryId).subscribe({ + next:(res)=>{ + this.categoryId=res.categoryId; + this.ObjSampleForm.controls['categoryName'].setValue(res.categoryName) + console.log(res); + + }, + error:(msg)=>{} + }) +} + +} + + categorydata:any; + -LoadCategory() { - this.service.LoadCategory().subscribe((data: any)=>{ - this.categorydata=data; - }); } - onSubmit(){ - if(this.categoryId!=undefined){ - this.updateCategory(this.categoryId) + + let categoryId=localStorage.getItem("categoryId") + + if(categoryId!=undefined){ + this.updateCategory(categoryId) }else{ + this.addCategory() + + } + +} + addCategory(){ this.service.addCategory(this.ObjSampleForm.value).subscribe(result=>{ + console.log(result); if(result.categoryId){ console.log(result); @@ -52,39 +92,6 @@ onSubmit(){ } }) } -} - - - deleteCategory(categoryId:any): void{ - if(confirm('Are you sure want to delete?')) - { - console.log(categoryId); - this.service.delete(categoryId.categoryId).subscribe({next:(res)=>{ - console.log(res); - alert("item deleted"); - window.location.reload(); - }, - error:(msg)=>{} - }) - } - else{ - this.router.navigate(['/category']) - } -} - - -editCategory(categoryId:any): void{ - - this.service.editCategory(categoryId.categoryId).subscribe({ - next:(res)=>{ - this.categoryId=res.categoryId; - this.ObjSampleForm.controls['categoryName'].setValue(res.categoryName) - console.log(res); - - }, - error:(msg)=>{} - }) -} updateCategory(categoryId:any){ @@ -104,12 +111,18 @@ updateCategory(categoryId:any){ alert("invalid Contact") } }) + localStorage.removeItem('categoryId'); + // localStorage.removeItem("categoryId") } - + clear() { + localStorage.removeItem('categoryId'); + window.location.reload() + } + home() { - this.router.navigate(['/body']) + this.router.navigate(['/sidenav']) } diff --git a/FrontEnd/iprjt/src/app/demo/demo.component.css b/FrontEnd/iprjt/src/app/demo/demo.component.css new file mode 100644 index 00000000..e69de29b diff --git a/FrontEnd/iprjt/src/app/demo/demo.component.html b/FrontEnd/iprjt/src/app/demo/demo.component.html new file mode 100644 index 00000000..15840fd2 --- /dev/null +++ b/FrontEnd/iprjt/src/app/demo/demo.component.html @@ -0,0 +1 @@ +

demo works!

diff --git a/FrontEnd/iprjt/src/app/demo/demo.component.spec.ts b/FrontEnd/iprjt/src/app/demo/demo.component.spec.ts new file mode 100644 index 00000000..43493a4a --- /dev/null +++ b/FrontEnd/iprjt/src/app/demo/demo.component.spec.ts @@ -0,0 +1,23 @@ +import { ComponentFixture, TestBed } from '@angular/core/testing'; + +import { DemoComponent } from './demo.component'; + +describe('DemoComponent', () => { + let component: DemoComponent; + let fixture: ComponentFixture; + + beforeEach(async () => { + await TestBed.configureTestingModule({ + declarations: [ DemoComponent ] + }) + .compileComponents(); + + fixture = TestBed.createComponent(DemoComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); + + it('should create', () => { + expect(component).toBeTruthy(); + }); +}); diff --git a/FrontEnd/iprjt/src/app/demo/demo.component.ts b/FrontEnd/iprjt/src/app/demo/demo.component.ts new file mode 100644 index 00000000..350495e7 --- /dev/null +++ b/FrontEnd/iprjt/src/app/demo/demo.component.ts @@ -0,0 +1,15 @@ +import { Component, OnInit } from '@angular/core'; + +@Component({ + selector: 'app-demo', + templateUrl: './demo.component.html', + styleUrls: ['./demo.component.css'] +}) +export class DemoComponent implements OnInit { + + constructor() { } + + ngOnInit(): void { + } + +} diff --git a/FrontEnd/iprjt/src/app/email.service.ts b/FrontEnd/iprjt/src/app/email.service.ts new file mode 100644 index 00000000..6257e222 --- /dev/null +++ b/FrontEnd/iprjt/src/app/email.service.ts @@ -0,0 +1,24 @@ +import { HttpClient } from '@angular/common/http'; +import { Injectable } from '@angular/core'; +import { Observable } from 'rxjs'; + +@Injectable({ + providedIn: 'root' +}) +export class EmailService { + + private baseUrl="http://localhost:8080"; + constructor( + private http: HttpClient, + ) + { } + + + sendotp(data:any):Observable{ + return this.http.post('http://localhost:8080/email/emailsentotp',data) + } + + verify(data:any):Observable{ + return this.http.post('http://localhost:8080/email/verify',data) + } +} diff --git a/FrontEnd/iprjt/src/app/findby-category/findby-category.component.ts b/FrontEnd/iprjt/src/app/findby-category/findby-category.component.ts index a89af70a..2fcb6ea4 100644 --- a/FrontEnd/iprjt/src/app/findby-category/findby-category.component.ts +++ b/FrontEnd/iprjt/src/app/findby-category/findby-category.component.ts @@ -35,7 +35,7 @@ export class FindbyCategoryComponent implements OnInit { ngOnInit(): void { - this.service.LoadCategory().subscribe((data: any)=>{ + this.service.LoadCategoryForUser().subscribe((data: any)=>{ this.catdata=data; console.log(this.catdata) }); diff --git a/FrontEnd/iprjt/src/app/fine/fine.component.css b/FrontEnd/iprjt/src/app/fine/fine.component.css index 34b53d69..0bef6858 100644 --- a/FrontEnd/iprjt/src/app/fine/fine.component.css +++ b/FrontEnd/iprjt/src/app/fine/fine.component.css @@ -1,107 +1,21 @@ -p{ - padding: 0px 0px 30px 1000px; - margin: 0px; - background-color: rgb(0, 0, 0); - background-image: url('../../../a.png'); - -} - -.btnhome{ - margin-top: 20px; - margin-bottom: 10px; - padding: 7; - border-color: rgb(124, 241, 134); - background-color: rgba(83, 254, 3, 0.853); - font-size: 13px; - border-radius: 25px; - -} -.btnn{ - padding: 7; - border-color: rgb(124, 241, 134); - background-color: rgba(83, 254, 3, 0.853); - font-size: 13px; -} -.btnn1{ - padding-left: 13px;padding-right: 13px; - border-color: rgb(0, 0, 0); - background-color: rgba(58, 100, 216, 0.705); - font-size: 13px; -} -.btnn0{ - padding-left: 10px;padding-right: 10px; - border-color: rgb(0, 0, 0); - background-color: rgba(40, 216, 78, 0.705); - font-size: 13px; -} -.btnn2{ - padding-left: 10px;padding-right: 10px; - border-color: rgb(0, 0, 0); - background-color: rgb(216, 40, 40); - font-size: 13px; - -} - - - -.text-danger1{ - - width: 160%; - padding: 8px 6px; - margin: 0px; - box-sizing: border-box; - border: 1px ; - background-color: #a7bdb08f; - color: rgb(0, 0, 0); - border-radius: 7px; - -} - -.dropbtn{ - width: 160%; - padding: 8px 6px; - margin: 0px; - box-sizing: border-box; - border: 1px ; - background-color: #a7bdb08f; - color: rgb(0, 0, 0); - border-radius: 7px; -} -.btn{ - width: 150%; - padding: 7px 2px; - margin: 5px ; - box-sizing: border-box; - border: 2px solid rgb(250, 97, 97); - background-color:rgba(106, 215, 56, 0.682); - color: rgb(0, 0, 0); - border-radius: 7px; -} -.table-bordered{ - border: 1px solid; -} -th { - background-color: #232524; - color: white; - width: 15%; +table{ + width: 58%; + border: none; text-align: center; + } - td { - background-color: #a7bdb08f; + /* tr{ + border: none; + } */ + th { + background-color: #ffffff; color: rgb(0, 0, 0); - width: 15%; text-align: center; - margin-top: auto; - padding: auto; + border: none; + } - - - .btnList{ + td { border: none; - padding: 1px; - background: rgb(0, 0, 0); - font-size: 13px; - font-style: italic ; - color: rgb(255, 255, 255); - border-radius: 3px; -} + padding-top: 16px;padding-bottom: 6px; + text-align: center; + } \ No newline at end of file diff --git a/FrontEnd/iprjt/src/app/fine/fine.component.html b/FrontEnd/iprjt/src/app/fine/fine.component.html index f5363e16..ccfe60f4 100644 --- a/FrontEnd/iprjt/src/app/fine/fine.component.html +++ b/FrontEnd/iprjt/src/app/fine/fine.component.html @@ -1,9 +1,4 @@ - - -

-

-

- +
@@ -12,7 +7,7 @@

Fine Details

- +
diff --git a/FrontEnd/iprjt/src/app/fine/fine.component.ts b/FrontEnd/iprjt/src/app/fine/fine.component.ts index a5429b61..8b0e478d 100644 --- a/FrontEnd/iprjt/src/app/fine/fine.component.ts +++ b/FrontEnd/iprjt/src/app/fine/fine.component.ts @@ -38,7 +38,7 @@ export class FineComponent implements OnInit { home() { - this.router.navigate(['/body']) + this.router.navigate(['/sidenav']) } diff --git a/FrontEnd/iprjt/src/app/forgotpassword/forgotpassword.component.css b/FrontEnd/iprjt/src/app/forgotpassword/forgotpassword.component.css new file mode 100644 index 00000000..e69de29b diff --git a/FrontEnd/iprjt/src/app/forgotpassword/forgotpassword.component.html b/FrontEnd/iprjt/src/app/forgotpassword/forgotpassword.component.html new file mode 100644 index 00000000..f20a2c41 --- /dev/null +++ b/FrontEnd/iprjt/src/app/forgotpassword/forgotpassword.component.html @@ -0,0 +1,58 @@ + + +
+ + +


+
+ +
+ +
+ + + + +

+ + + + +

- + - \ No newline at end of file + \ No newline at end of file diff --git a/FrontEnd/iprjt/src/app/imageupload/imageupload.component.ts b/FrontEnd/iprjt/src/app/imageupload/imageupload.component.ts index 56845e7e..61f2d7f1 100644 --- a/FrontEnd/iprjt/src/app/imageupload/imageupload.component.ts +++ b/FrontEnd/iprjt/src/app/imageupload/imageupload.component.ts @@ -31,26 +31,22 @@ export class ImageuploadComponent implements OnInit { selectFile(event: any): void { this.selectedFiles = event.target.files; } + upload() { - - if (this.selectedFiles) { + if (this.selectedFiles) { const file: File | null = this.selectedFiles.item(0); if (file) { this.currentFile = file; } - //this.assi.assignmentId= - //this.assi.studentId=this.studentDetails.studentId - // this.assi.file=this.currentFile; - console.log(this.data.hotelId) + console.log(this.data.booksId) this.service.imageUpload(this.currentFile,this.service.getId()).subscribe( response =>{ - this.toast.success({detail:'Success',summary:'Book cover uploaded',duration:5000}); - this.router.navigate(['/books']) - - + this.toast.success({detail:'Success',summary:' Book cover uploaded',duration:5000}); + this.router.navigate(['/addbooks']) console.log(response) + if(response) { alert("IMAGE UPLOADED SUCCESSFULLY") @@ -64,7 +60,7 @@ export class ImageuploadComponent implements OnInit { home() { - this.router.navigate(['/body']) + this.router.navigate(['/sidenav']) } } diff --git a/FrontEnd/iprjt/src/app/login/login.component.html b/FrontEnd/iprjt/src/app/login/login.component.html index b8266b85..a0004e7b 100644 --- a/FrontEnd/iprjt/src/app/login/login.component.html +++ b/FrontEnd/iprjt/src/app/login/login.component.html @@ -4,11 +4,11 @@
Library

- + library_books - +

Email is required @@ -20,12 +20,8 @@ password is required
use (uppercase ,lowercase and numbers)
minimum 8 character
- + - + + Forgot_Password - \ No newline at end of file diff --git a/FrontEnd/iprjt/src/app/login/login.component.ts b/FrontEnd/iprjt/src/app/login/login.component.ts index 10131aca..4f4b6295 100644 --- a/FrontEnd/iprjt/src/app/login/login.component.ts +++ b/FrontEnd/iprjt/src/app/login/login.component.ts @@ -44,14 +44,14 @@ export class LoginComponent implements OnInit { if(result.role==2){ localStorage.setItem('token',this.responsedata.accessToken.value) this.toast.success({detail:'success msg',summary:'LogIn Successfull',duration:5000}); - this.router.navigate(['/userbody']) + this.router.navigate(['/user-sidenav']) } else{ localStorage.setItem('token',this.responsedata.accessToken.value) this.toast.success({detail:'success msg',summary:'LogIn Successfull',duration:5000}); - this.router.navigate(['/body']) + this.router.navigate(['/sidenav']) } diff --git a/FrontEnd/iprjt/src/app/rejectrequest/rejectrequest.component.html b/FrontEnd/iprjt/src/app/rejectrequest/rejectrequest.component.html index 7437ad2b..f180d057 100644 --- a/FrontEnd/iprjt/src/app/rejectrequest/rejectrequest.component.html +++ b/FrontEnd/iprjt/src/app/rejectrequest/rejectrequest.component.html @@ -1,8 +1,4 @@ - -

-

-

- +
diff --git a/FrontEnd/iprjt/src/app/rejectrequest/rejectrequest.component.ts b/FrontEnd/iprjt/src/app/rejectrequest/rejectrequest.component.ts index 45644b6e..88bc1fcb 100644 --- a/FrontEnd/iprjt/src/app/rejectrequest/rejectrequest.component.ts +++ b/FrontEnd/iprjt/src/app/rejectrequest/rejectrequest.component.ts @@ -90,7 +90,7 @@ rejectRequest(borrowId:any){ home() { - this.router.navigate(['/body']) + this.router.navigate(['/sidenav']) } diff --git a/FrontEnd/iprjt/src/app/sidenav/sidenav.component.css b/FrontEnd/iprjt/src/app/sidenav/sidenav.component.css new file mode 100644 index 00000000..d2620b51 --- /dev/null +++ b/FrontEnd/iprjt/src/app/sidenav/sidenav.component.css @@ -0,0 +1,213 @@ +body, html { + + position: fixed; + margin: 0; + font-family: arial; + height: 0vh; + background: #ccc; + } + *, *:before, *:after { + box-sizing: border-box; + } + .nav-mobile { + /* position: fixed; */ + background: #446cb3; + /* background: #9f3800; */ + color: #fff; + padding: 0; + margin: 0; + cursor: auto; + font-size: 18px; + list-style-type: none; + box-shadow: 0 5px 5px -5px #333; + } + .nav-mobile:after { + content: ""; + display: table; + clear: both; + } + .nav-mobile svg { + height: 45px; + width: 65px; + padding: 9px; + } + .nav-mobile svg path { + fill: #fff; + } + .nav-mobile svg.icon-close { + display: none; + padding: 15px; + } + .nav-mobile li { + width: 100%; + height: 45px; + line-height: 46px; + text-align: center; + float: left; + } + .nav-mobile li a { + display: block; + color: #333; + width: 100%; + height: 100%; + text-decoration: none; + } + .nav-mobile .menu-button { + position: absolute; + top: 0; + left: 0; + width: 100%; + height: 100%; + margin: 0; + cursor: pointer; + display: block; + } + .nav-mobile .menu-button:after { + opacity: 0; + top: 45px; + content: ""; + width: 100vw; + display: block; + position: fixed; + height: 100vh; + background: rgba(0, 0, 0, 0.5); + content: ""; + pointer-events: none; + transition: opacity 0.2s cubic-bezier(0, 0, 0.3, 1); + transition-delay: 0.1s; + } + .nav-mobile #menu-toggle { + display: none; + } + .nav-mobile #menu-toggle.active ~ .menu-button .icon-close, .nav-mobile #menu-toggle:checked ~ .menu-button .icon-close { + display: block; + } + .nav-mobile #menu-toggle.active ~ .menu-button .icon-open, .nav-mobile #menu-toggle:checked ~ .menu-button .icon-open { + display: none; + } + .nav-mobile #menu-toggle.active ~ .menu-button:after, .nav-mobile #menu-toggle:checked ~ .menu-button:after { + opacity: 1; + pointer-events: auto; + transition: opacity 0.3s cubic-bezier(0, 0, 0.3, 1); + } + .nav-mobile #menu-toggle.active ~ .menu-sidebar, .nav-mobile #menu-toggle:checked ~ .menu-sidebar { + transform: translateX(0); + transition: transform 0.3s cubic-bezier(0, 0, 0.3, 1); + } + .nav-mobile .menu-container { + width: 65px; + float: left; + cursor: pointer; + position: absolute; + + } + .nav-mobile .menu-container .menu-sidebar { + box-shadow: 5px 0 5px -5px #333; + display: block; + width: 65vw; + bottom: 0; + background: white; + color: #333; + position: fixed; + transform: translateX(-405px); + transition: transform 0.3s cubic-bezier(0, 0, 0.3, 1); + top: 45px; + z-index: 2; + list-style-type: none; + padding: 0; + max-width: 250px; + } + .nav-mobile .menu-container .menu-sidebar .arrow { + position: absolute; + line-height: 50px; + font-size: 32px; + color: #555; + top: 0; + z-index: 0; + } + .nav-mobile .menu-container .menu-sidebar .arrow.left { + left: 25px; + } + .nav-mobile .menu-container .menu-sidebar .arrow.right { + right: 25px; + } + .nav-mobile .menu-container .menu-sidebar li { + height: 55px; + line-height: 55px; + font-size: 16px; + text-align: left; + position: relative; + border-bottom: 1px solid rgba(0, 0, 0, 0.1); + padding-left: 20px; + } + .nav-mobile .menu-container .menu-sidebar li:hover { + background: rgb(244, 244, 247); + } + .nav-mobile .menu-container .menu-sidebar li .menu-sub { + position: fixed; + top: 0; + right: 0; + bottom: 0; + width: 0; + overflow: hidden; + background: rgb(248, 248, 250); + visibility: hidden; + transition: all 0.3s cubic-bezier(0, 0, 0.3, 1); + border-left: 1px solid #ccc; + list-style-type: none; + padding: 0; + margin: 0; + z-index: 2; + max-width: 250px; + /* width side */ + } + .nav-mobile .menu-container .menu-sidebar li .menu-sub li { + overflow: hidden; + } + .nav-mobile .menu-container .menu-sidebar li .menu-sub .menu-sub-title { + padding-left: 50px; + } + .nav-mobile .menu-container .menu-sidebar li .submenu-label { + cursor: pointer; + width: 100%; + height: 100%; + display: block; + } + .nav-mobile .menu-container .menu-sidebar li .submenu-toggle { + display: none; + } + .nav-mobile .menu-container .menu-sidebar li .submenu-toggle.active ~ .menu-sub, .nav-mobile .menu-container .menu-sidebar li .submenu-toggle:checked ~ .menu-sub { + width: 65vw; + visibility: visible; + z-index: 1; + transition: width 0.35s cubic-bezier(0, 0, 0.3, 1); + } + + .alert { + padding: 20px; + background-color: #3b9438; + color: white; + } + + .closebtn { + margin-left: 15px; + color: white; + font-weight: bold; + float: right; + font-size: 22px; + line-height: 20px; + cursor: pointer; + transition: 0.3s; + } + + .closebtn:hover { + color: black; + } + .btnItem1{ + border: none; + padding: 0; + background: none; + font-size: 18px; + font-style: normal ; + color: rgba(238, 248, 248, 0.73); +} \ No newline at end of file diff --git a/FrontEnd/iprjt/src/app/sidenav/sidenav.component.html b/FrontEnd/iprjt/src/app/sidenav/sidenav.component.html new file mode 100644 index 00000000..3c4d7206 --- /dev/null +++ b/FrontEnd/iprjt/src/app/sidenav/sidenav.component.html @@ -0,0 +1,85 @@ + + + + + + + + + + + + + + + + + + + + diff --git a/FrontEnd/iprjt/src/app/sidenav/sidenav.component.spec.ts b/FrontEnd/iprjt/src/app/sidenav/sidenav.component.spec.ts new file mode 100644 index 00000000..646caccd --- /dev/null +++ b/FrontEnd/iprjt/src/app/sidenav/sidenav.component.spec.ts @@ -0,0 +1,23 @@ +import { ComponentFixture, TestBed } from '@angular/core/testing'; + +import { SidenavComponent } from './sidenav.component'; + +describe('SidenavComponent', () => { + let component: SidenavComponent; + let fixture: ComponentFixture; + + beforeEach(async () => { + await TestBed.configureTestingModule({ + declarations: [ SidenavComponent ] + }) + .compileComponents(); + + fixture = TestBed.createComponent(SidenavComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); + + it('should create', () => { + expect(component).toBeTruthy(); + }); +}); diff --git a/FrontEnd/iprjt/src/app/sidenav/sidenav.component.ts b/FrontEnd/iprjt/src/app/sidenav/sidenav.component.ts new file mode 100644 index 00000000..56b4827a --- /dev/null +++ b/FrontEnd/iprjt/src/app/sidenav/sidenav.component.ts @@ -0,0 +1,45 @@ +import { Component, OnInit } from '@angular/core'; +import { Router } from '@angular/router'; +import { CategoryService } from '../category.service'; + +@Component({ + selector: 'app-sidenav', + templateUrl: './sidenav.component.html', + styleUrls: ['./sidenav.component.css'] +}) +export class SidenavComponent implements OnInit { + status: any = 0; + + constructor(private router:Router,private categoryservice:CategoryService) { } + + ngOnInit(): void { + } +close() +{ + this.status=1 +} +logout() +{ +if (confirm('Are you sure want to Logout?')) { + localStorage. clear() + this.router.navigate(['/login']) +} else { + + this.router.navigate(['/sidenav']) +} +} +home() +{ + this.router.navigate(['/sidenav']) +} + +profile() +{ + this.router.navigate(['/view-adminprofile']) +} + +dash() +{ + this.router.navigate(['/sidenav']) +} +} \ No newline at end of file diff --git a/FrontEnd/iprjt/src/app/user-details/user-details.component.css b/FrontEnd/iprjt/src/app/user-details/user-details.component.css index a4f606eb..5915373e 100644 --- a/FrontEnd/iprjt/src/app/user-details/user-details.component.css +++ b/FrontEnd/iprjt/src/app/user-details/user-details.component.css @@ -1,44 +1,6 @@ -p{ - padding: 0px 0px 30px 1000px; - margin: 0px; - background-color: rgb(0, 0, 0); - background-image: url('../../../a.png'); - -} - -.btnhome{ - margin-top: 20px; - margin-bottom: 10px; - padding: 7; - border-color: rgb(124, 241, 134); - background-color: rgba(83, 254, 3, 0.853); - font-size: 13px; - border-radius: 25px; - -} -/* .text-danger1{ - width: 160%; - padding: 8px 6px; - margin: 0px; - box-sizing: border-box; - border: 1px ; - background-color: #a7bdb08f; - color: rgb(0, 0, 0); - border-radius: 7px; - -} */ -/* .btn{ - width: 150%; - padding: 7px 2px; - margin: 5px ; - box-sizing: border-box; - border: 2px solid rgb(250, 97, 97); - background-color:rgba(106, 215, 56, 0.682); - color: rgb(0, 0, 0); - border-radius: 7px; -} */ +/* .table-bordered{ border: 1px solid; } @@ -57,14 +19,22 @@ th { margin-top: auto; padding: 8px; } + */ - /* .btnAction{ + table{ + width: 100%; border: none; - padding: 1px; - background: rgb(0, 0, 0); - font-size: 13px; - font-style: italic ; - color: rgb(255, 255, 255); - border-radius: 3px; -} */ + text-align: center; + + } + th { + background-color: #ffffff; + color: rgb(0, 0, 0); + text-align: center; + + } + td { + + padding-top: 16px;padding-bottom: 16px; + } diff --git a/FrontEnd/iprjt/src/app/user-details/user-details.component.html b/FrontEnd/iprjt/src/app/user-details/user-details.component.html index 8949a54c..d95cb907 100644 --- a/FrontEnd/iprjt/src/app/user-details/user-details.component.html +++ b/FrontEnd/iprjt/src/app/user-details/user-details.component.html @@ -1,8 +1,4 @@ - -

-

-

- +
@@ -15,29 +11,75 @@

USER DETAILS

-
- + - +
+
- - - - - - + + + + + + + + + + + + + + - + - - - + + + - - - + + @@ -57,7 +99,9 @@

USER DETAILS

User IdFirst NameLast NameAddressPhoneEmailUser Id + + + First Name + + + Last Name + + + Address + + + Phone + + + Email + + + StatusStatus + + + DOBCreateDateUpdateDateDOB + + + CreateDate + + + UpdateDate + + +
{{user.userId}}
{{user.userId}} {{user.firstName}} {{user.lastName}} {{user.address}}
- +
+ +
\ No newline at end of file diff --git a/FrontEnd/iprjt/src/app/user-details/user-details.component.ts b/FrontEnd/iprjt/src/app/user-details/user-details.component.ts index 7ba5fa1e..ef0463e9 100644 --- a/FrontEnd/iprjt/src/app/user-details/user-details.component.ts +++ b/FrontEnd/iprjt/src/app/user-details/user-details.component.ts @@ -13,6 +13,24 @@ export class UserDetailsComponent implements OnInit { userdata: any; userList:any[]; + +data: any; +page:number=1; +count: any; +tableSize: number = 5; +ProdData: any; +sortedData: any; +a:any; +b:any; +searchResult:any +searchData:any +sort:string="userId"; +len: any; +result: any; + booksCount: any; + direction=-1; +userId: any; + constructor(private router:Router ,private service:UserserviceService) { this.userList=[]; } @@ -23,15 +41,52 @@ userList:any[]; this.Load(); } - Load() { - this.service.Load().subscribe((data: any)=>{ - this.userdata=data; - }); } + Load(){ + // { + // this.service.Load().subscribe((data: any)=>{ + // this.userdata=data; + // }); } + this.service.userPaginationAdmin(this.page,this.tableSize,this.sort,this.direction).subscribe(result=>{ + this.result=result.content; + this.count=result.totalElements + console.log("loaded books=",this.result); + console.log("page=",this.page); + this.data=this.result; + this.userdata=this.result; + }); +} + +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=",event) + this.service.userPaginationAdmin(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; + this.userdata=this.result; + }) + } - home() - { - this.router.navigate(['/body']) - } + } diff --git a/FrontEnd/iprjt/src/app/user-reg/user-reg.component.html b/FrontEnd/iprjt/src/app/user-reg/user-reg.component.html index 0fc9324c..4d91cfed 100644 --- a/FrontEnd/iprjt/src/app/user-reg/user-reg.component.html +++ b/FrontEnd/iprjt/src/app/user-reg/user-reg.component.html @@ -15,53 +15,50 @@
- - Firstname is required - -

+ + Firstname is required + Firstname Should be Characters + Firstname must be less than 30 +

- Lastname is required - + Lastname is required

- Date-of-birth is required - + Date-of-birth is required

- Address is required - + Address is required

- Phone n.o is required - + Phone n.o is required

- pswd is required
use (uppercase,lowercase & numbers)
minimum 8 character
+ pswd is required
use (uppercase,lowercase & numbers)
minimum 8 character


- + - Email is required + Email is required


-



-
+



+



diff --git a/FrontEnd/iprjt/src/app/user-reg/user-reg.component.ts b/FrontEnd/iprjt/src/app/user-reg/user-reg.component.ts index 0b0adef8..94c3b29d 100644 --- a/FrontEnd/iprjt/src/app/user-reg/user-reg.component.ts +++ b/FrontEnd/iprjt/src/app/user-reg/user-reg.component.ts @@ -11,6 +11,7 @@ import { UserserviceService } from '../userservice.service'; export class UserRegComponent implements OnInit { [x: string]: any; date: any; +var:any; constructor(private router:Router ,private service:UserserviceService) { } @@ -37,9 +38,9 @@ date: any; onSubmit(){ console.log("aaaa"); - //debugger - //if(this.ObjSampleForm.valid){ - + + // if(this.ObjSampleForm.valid){ + this.var=this.ObjSampleForm.value this.service.add(this.ObjSampleForm.value).subscribe(result=>{ if(result.userId){ console.log("bbb"); @@ -51,7 +52,7 @@ date: any; alert("User Not added"); } }) - // } + // } } diff --git a/FrontEnd/iprjt/src/app/user-sidenav/user-sidenav.component.css b/FrontEnd/iprjt/src/app/user-sidenav/user-sidenav.component.css new file mode 100644 index 00000000..595425b9 --- /dev/null +++ b/FrontEnd/iprjt/src/app/user-sidenav/user-sidenav.component.css @@ -0,0 +1,209 @@ +body, html { + margin: 0; + font-family: arial; + height: 0vh; + background: #ccc; + } + *, *:before, *:after { + box-sizing: border-box; + } + .nav-mobile { + background: #14a337; + color: #fff; + padding: 0; + margin: 0; + cursor: auto; + font-size: 18px; + list-style-type: none; + box-shadow: 0 5px 5px -5px #333; + } + .nav-mobile:after { + content: ""; + display: table; + clear: both; + } + .nav-mobile svg { + height: 45px; + width: 65px; + padding: 9px; + } + .nav-mobile svg path { + fill: #fff; + } + .nav-mobile svg.icon-close { + display: none; + padding: 15px; + } + .nav-mobile li { + width: 100%; + height: 45px; + line-height: 46px; + text-align: center; + float: left; + } + .nav-mobile li a { + display: block; + color: #333; + width: 100%; + height: 100%; + text-decoration: none; + } + .nav-mobile .menu-button { + position: absolute; + top: 0; + left: 0; + width: 100%; + height: 100%; + margin: 0; + cursor: pointer; + display: block; + } + .nav-mobile .menu-button:after { + opacity: 0; + top: 45px; + content: ""; + width: 100vw; + display: block; + position: fixed; + height: 100vh; + background: rgba(0, 0, 0, 0.5); + content: ""; + pointer-events: none; + transition: opacity 0.2s cubic-bezier(0, 0, 0.3, 1); + transition-delay: 0.1s; + } + .nav-mobile #menu-toggle { + display: none; + } + .nav-mobile #menu-toggle.active ~ .menu-button .icon-close, .nav-mobile #menu-toggle:checked ~ .menu-button .icon-close { + display: block; + } + .nav-mobile #menu-toggle.active ~ .menu-button .icon-open, .nav-mobile #menu-toggle:checked ~ .menu-button .icon-open { + display: none; + } + .nav-mobile #menu-toggle.active ~ .menu-button:after, .nav-mobile #menu-toggle:checked ~ .menu-button:after { + opacity: 1; + pointer-events: auto; + transition: opacity 0.3s cubic-bezier(0, 0, 0.3, 1); + } + .nav-mobile #menu-toggle.active ~ .menu-sidebar, .nav-mobile #menu-toggle:checked ~ .menu-sidebar { + transform: translateX(0); + transition: transform 0.3s cubic-bezier(0, 0, 0.3, 1); + } + .nav-mobile .menu-container { + width: 65px; + float: left; + cursor: pointer; + position: absolute; + + } + .nav-mobile .menu-container .menu-sidebar { + box-shadow: 5px 0 5px -5px #333; + display: block; + width: 65vw; + bottom: 0; + background: rgb(234, 237, 241); + color: #333; + position: fixed; + transform: translateX(-405px); + transition: transform 0.3s cubic-bezier(0, 0, 0.3, 1); + top: 45px; + z-index: 2; + list-style-type: none; + padding: 0; + max-width: 250px; + } + .nav-mobile .menu-container .menu-sidebar .arrow { + position: absolute; + line-height: 50px; + font-size: 32px; + color: #555; + top: 0; + z-index: 0; + } + .nav-mobile .menu-container .menu-sidebar .arrow.left { + left: 25px; + } + .nav-mobile .menu-container .menu-sidebar .arrow.right { + right: 25px; + } + .nav-mobile .menu-container .menu-sidebar li { + height: 55px; + line-height: 55px; + font-size: 16px; + text-align: left; + position: relative; + border-bottom: 1px solid rgba(0, 0, 0, 0.1); + padding-left: 20px; + } + .nav-mobile .menu-container .menu-sidebar li:hover { + background: rgb(244, 244, 247); + } + .nav-mobile .menu-container .menu-sidebar li .menu-sub { + position: fixed; + top: 0; + right: 0; + bottom: 0; + width: 0; + overflow: hidden; + background: rgb(248, 248, 250); + visibility: hidden; + transition: all 0.3s cubic-bezier(0, 0, 0.3, 1); + border-left: 1px solid #ccc; + list-style-type: none; + padding: 0; + margin: 0; + z-index: 2; + max-width: 250px; + /* width side */ + } + .nav-mobile .menu-container .menu-sidebar li .menu-sub li { + overflow: hidden; + } + .nav-mobile .menu-container .menu-sidebar li .menu-sub .menu-sub-title { + padding-left: 50px; + } + .nav-mobile .menu-container .menu-sidebar li .submenu-label { + cursor: pointer; + width: 100%; + height: 100%; + display: block; + } + .nav-mobile .menu-container .menu-sidebar li .submenu-toggle { + display: none; + } + .nav-mobile .menu-container .menu-sidebar li .submenu-toggle.active ~ .menu-sub, .nav-mobile .menu-container .menu-sidebar li .submenu-toggle:checked ~ .menu-sub { + width: 65vw; + visibility: visible; + z-index: 1; + transition: width 0.35s cubic-bezier(0, 0, 0.3, 1); + } + + .alert { + padding: 20px; + background-color: #3b9438; + color: white; + } + + .closebtn { + margin-left: 15px; + color: white; + font-weight: bold; + float: right; + font-size: 22px; + line-height: 20px; + cursor: pointer; + transition: 0.3s; + } + + .closebtn:hover { + color: black; + } + .btnItem1{ + border: none; + padding: 0; + background: none; + font-size: 18px; + font-style: normal ; + color: rgba(238, 248, 248, 0.73); +} \ No newline at end of file diff --git a/FrontEnd/iprjt/src/app/user-sidenav/user-sidenav.component.html b/FrontEnd/iprjt/src/app/user-sidenav/user-sidenav.component.html new file mode 100644 index 00000000..ca5c6bff --- /dev/null +++ b/FrontEnd/iprjt/src/app/user-sidenav/user-sidenav.component.html @@ -0,0 +1,86 @@ + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/FrontEnd/iprjt/src/app/user-sidenav/user-sidenav.component.spec.ts b/FrontEnd/iprjt/src/app/user-sidenav/user-sidenav.component.spec.ts new file mode 100644 index 00000000..1e098dfd --- /dev/null +++ b/FrontEnd/iprjt/src/app/user-sidenav/user-sidenav.component.spec.ts @@ -0,0 +1,23 @@ +import { ComponentFixture, TestBed } from '@angular/core/testing'; + +import { UserSidenavComponent } from './user-sidenav.component'; + +describe('UserSidenavComponent', () => { + let component: UserSidenavComponent; + let fixture: ComponentFixture; + + beforeEach(async () => { + await TestBed.configureTestingModule({ + declarations: [ UserSidenavComponent ] + }) + .compileComponents(); + + fixture = TestBed.createComponent(UserSidenavComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); + + it('should create', () => { + expect(component).toBeTruthy(); + }); +}); diff --git a/FrontEnd/iprjt/src/app/user-sidenav/user-sidenav.component.ts b/FrontEnd/iprjt/src/app/user-sidenav/user-sidenav.component.ts new file mode 100644 index 00000000..ef8c924c --- /dev/null +++ b/FrontEnd/iprjt/src/app/user-sidenav/user-sidenav.component.ts @@ -0,0 +1,29 @@ +import { Component, OnInit } from '@angular/core'; +import { Router } from '@angular/router'; +import { CategoryService } from '../category.service'; + +@Component({ + selector: 'app-user-sidenav', + templateUrl: './user-sidenav.component.html', + styleUrls: ['./user-sidenav.component.css'] +}) +export class UserSidenavComponent implements OnInit { + status:any =0 + + constructor(private router:Router,private categoryservice:CategoryService) { } + + ngOnInit(): void { + } + close(){ + this.status=1 + } + logout(){ + if (confirm('Are you sure want to Logout?')) { + localStorage. clear() + this.router.navigate(['/login']) + } else { + + this.router.navigate(['/sidenav']) + } + } + } \ No newline at end of file diff --git a/FrontEnd/iprjt/src/app/userservice.service.ts b/FrontEnd/iprjt/src/app/userservice.service.ts index ce592d63..e041017e 100644 --- a/FrontEnd/iprjt/src/app/userservice.service.ts +++ b/FrontEnd/iprjt/src/app/userservice.service.ts @@ -1,6 +1,8 @@ import { Injectable } from '@angular/core'; import {HttpClient,HttpHeaders} from '@angular/common/http' -import { Observable } from 'rxjs'; +import { catchError, Observable } from 'rxjs'; +import { HttpErrorResponse } from '@angular/common/http'; +import { Router } from '@angular/router'; @Injectable({ providedIn: 'root' @@ -11,9 +13,30 @@ export class UserserviceService { - constructor(private http: HttpClient) { + 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`); } + } + + //////////////////////////////////////////////////////////////////// + + + userPaginationAdmin(page:any,tableSize:any,sort:any,direction:any):Observable{ + return this.http.get("http://localhost:8080/users/admin/pagenated/?pageNo="+page+"&pageSize="+tableSize+"&sortBy="+sort+"&direction="+direction).pipe((catchError(err => this.handleError(err)))) + } + + + + + add(data:any):Observable{ return this.http.post('http://localhost:8080/users',data) } diff --git a/FrontEnd/iprjt/src/app/view-adminprofile/view-adminprofile.component.css b/FrontEnd/iprjt/src/app/view-adminprofile/view-adminprofile.component.css index dfe37928..5d0470df 100644 --- a/FrontEnd/iprjt/src/app/view-adminprofile/view-adminprofile.component.css +++ b/FrontEnd/iprjt/src/app/view-adminprofile/view-adminprofile.component.css @@ -17,55 +17,15 @@ p{ } -/* .text-danger1{ - width: 160%; - padding: 8px 6px; - margin: 0px; - box-sizing: border-box; - border: 1px ; - background-color: #a7bdb08f; - color: rgb(0, 0, 0); - border-radius: 7px; - -} */ -/* .btn{ - width: 150%; - padding: 7px 2px; - margin: 5px ; - box-sizing: border-box; - border: 2px solid rgb(250, 97, 97); - background-color:rgba(106, 215, 56, 0.682); - color: rgb(0, 0, 0); - border-radius: 7px; -} */ + .table-bordered{ - border: 1px solid; +border: none; } -th { - background-color: #232524; - color: white; - width: 5%; - text-align: center; - padding: 12px; - } + td { - background-color: #a7bdb08f; color: rgb(0, 0, 0); - width: 5%; - text-align: center; - margin-top: auto; - padding: auto; - padding: 8px; + width: auto; + padding: 8px; } - - /* .btnAction{ - border: none; - padding: 1px; - background: rgb(0, 0, 0); - font-size: 13px; - font-style: italic ; - color: rgb(255, 255, 255); - border-radius: 3px; -} */ diff --git a/FrontEnd/iprjt/src/app/view-adminprofile/view-adminprofile.component.html b/FrontEnd/iprjt/src/app/view-adminprofile/view-adminprofile.component.html index 5221ada0..54d5b1b8 100644 --- a/FrontEnd/iprjt/src/app/view-adminprofile/view-adminprofile.component.html +++ b/FrontEnd/iprjt/src/app/view-adminprofile/view-adminprofile.component.html @@ -1,64 +1,18 @@ - -

-

-

+ - - -
+



+

PROFILE

-
- - -
-

-

User Details

- + -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
First NameLast NameAddressPhoneEmailDOBCreateDateUpdateDate
{{user.firstName}}{{user.lastName}}{{user.address}}{{user.phone}}{{user.email}}{{user.dob}}{{user.createDate| date:'dd/MM/yyyy'}}{{user.updateDate| date:'dd/MM/yyyy'}}
- -
-
-
\ No newline at end of file + NAME :{{userdata[0].firstName}} {{userdata.lastName}} + ADDRESS :{{userdata[0].address}} + PHONE :{{userdata[0].phone}} + EMAIL :{{userdata[0].email}} + DOB :{{userdata[0].dob| date:'dd/MM/yyyy'}} + CREATED DATE :{{userdata[0].createDate| date:'dd/MM/yyyy'}} + UPDATE DATE :{{userdata[0].updateDate| date:'dd/MM/yyyy'}} + + + \ No newline at end of file diff --git a/FrontEnd/iprjt/src/app/view-adminprofile/view-adminprofile.component.ts b/FrontEnd/iprjt/src/app/view-adminprofile/view-adminprofile.component.ts index a8757dbf..01534af3 100644 --- a/FrontEnd/iprjt/src/app/view-adminprofile/view-adminprofile.component.ts +++ b/FrontEnd/iprjt/src/app/view-adminprofile/view-adminprofile.component.ts @@ -34,7 +34,7 @@ export class ViewAdminprofileComponent implements OnInit { home() { - this.router.navigate(['/body']) + this.router.navigate(['/sidenav']) } diff --git a/FrontEnd/iprjt/src/app/view-profile/view-profile.component.css b/FrontEnd/iprjt/src/app/view-profile/view-profile.component.css index dfe37928..a6539a64 100644 --- a/FrontEnd/iprjt/src/app/view-profile/view-profile.component.css +++ b/FrontEnd/iprjt/src/app/view-profile/view-profile.component.css @@ -40,22 +40,23 @@ p{ border-radius: 7px; } */ .table-bordered{ - border: 1px solid; + border: 3px solid; } th { - background-color: #232524; + background-color: #ffffff; color: white; width: 5%; text-align: center; padding: 12px; } td { - background-color: #a7bdb08f; + /* border-color: rgb(22, 133, 133); + background-color: #a7bdb08f; */ color: rgb(0, 0, 0); - width: 5%; - text-align: center; - margin-top: auto; - padding: auto; + width: 220px; + /* text-align: center; */ + /* margin-top: auto; */ + /* padding: auto; */ padding: 8px; } diff --git a/FrontEnd/iprjt/src/app/view-profile/view-profile.component.html b/FrontEnd/iprjt/src/app/view-profile/view-profile.component.html index 42a47815..a43d3c0b 100644 --- a/FrontEnd/iprjt/src/app/view-profile/view-profile.component.html +++ b/FrontEnd/iprjt/src/app/view-profile/view-profile.component.html @@ -12,50 +12,56 @@

-

User Details

+

PROFILE

- +
- + - + --> + + --> - + + + - + --> + - + - - + --> + + + + + + + + + + +
First NameUser IdPassword DOB{{user.firstName}}{{user.userId}} {{user.dob}}
NAME {{userdata[0].firstName}} {{userdata[0].lastName}}
ADDRESS {{userdata[0].address}}
PHONE {{userdata[0].phone}}
EMAIL {{userdata[0].email}}
CREATED DATE {{userdata[0].createDate| date:'dd/MM/yyyy'}}
UPDATE DATE {{userdata[0].updateDate| date:'dd/MM/yyyy'}}
diff --git a/FrontEnd/iprjt/src/app/view-profile/view-profile.component.ts b/FrontEnd/iprjt/src/app/view-profile/view-profile.component.ts index 234cb988..70f1d669 100644 --- a/FrontEnd/iprjt/src/app/view-profile/view-profile.component.ts +++ b/FrontEnd/iprjt/src/app/view-profile/view-profile.component.ts @@ -1,3 +1,4 @@ +import { ConditionalExpr } from '@angular/compiler'; import { Component, OnInit } from '@angular/core'; import { Router } from '@angular/router'; import { UserserviceService } from '../userservice.service'; @@ -27,6 +28,7 @@ export class ViewProfileComponent implements OnInit { Load() { this.service.getUser().subscribe((data: any)=>{ this.userdata=data; + console.log(this.userdata) sessionStorage.setItem('role',data[0].role) }); } diff --git a/FrontEnd/iprjt/src/assets/BooksImage/item_pics/Screenshot from 2022-12-21 09-40-05.png b/FrontEnd/iprjt/src/assets/BooksImage/item_pics/Screenshot from 2022-12-21 09-40-05.png new file mode 100644 index 00000000..570f335d Binary files /dev/null and b/FrontEnd/iprjt/src/assets/BooksImage/item_pics/Screenshot from 2022-12-21 09-40-05.png differ diff --git a/FrontEnd/iprjt/src/assets/BooksImage/item_pics/Screenshot from 2022-12-27 14-21-41.png b/FrontEnd/iprjt/src/assets/BooksImage/item_pics/Screenshot from 2022-12-27 14-21-41.png new file mode 100644 index 00000000..229a9947 Binary files /dev/null and b/FrontEnd/iprjt/src/assets/BooksImage/item_pics/Screenshot from 2022-12-27 14-21-41.png differ diff --git a/FrontEnd/iprjt/src/assets/BooksImage/item_pics/Screenshot from 2022-12-27 14-29-06.png b/FrontEnd/iprjt/src/assets/BooksImage/item_pics/Screenshot from 2022-12-27 14-29-06.png new file mode 100644 index 00000000..5e4ac35d Binary files /dev/null and b/FrontEnd/iprjt/src/assets/BooksImage/item_pics/Screenshot from 2022-12-27 14-29-06.png differ diff --git a/FrontEnd/iprjt/src/assets/BooksImage/item_pics/Screenshot from 2022-12-28 12-16-47.png b/FrontEnd/iprjt/src/assets/BooksImage/item_pics/Screenshot from 2022-12-28 12-16-47.png new file mode 100644 index 00000000..5c6de76c Binary files /dev/null and b/FrontEnd/iprjt/src/assets/BooksImage/item_pics/Screenshot from 2022-12-28 12-16-47.png differ diff --git a/FrontEnd/iprjt/src/assets/BooksImage/item_pics/Screenshot from 2022-12-28 13-56-58.png b/FrontEnd/iprjt/src/assets/BooksImage/item_pics/Screenshot from 2022-12-28 13-56-58.png new file mode 100644 index 00000000..0fdf64e2 Binary files /dev/null and b/FrontEnd/iprjt/src/assets/BooksImage/item_pics/Screenshot from 2022-12-28 13-56-58.png differ diff --git a/FrontEnd/iprjt/src/assets/BooksImage/item_pics/Screenshot from 2022-12-29 11-10-32.png b/FrontEnd/iprjt/src/assets/BooksImage/item_pics/Screenshot from 2022-12-29 11-10-32.png new file mode 100644 index 00000000..2086fdc5 Binary files /dev/null and b/FrontEnd/iprjt/src/assets/BooksImage/item_pics/Screenshot from 2022-12-29 11-10-32.png differ diff --git a/FrontEnd/iprjt/src/assets/BooksImage/item_pics/Screenshot from 2022-12-30 17-21-34.png b/FrontEnd/iprjt/src/assets/BooksImage/item_pics/Screenshot from 2022-12-30 17-21-34.png new file mode 100644 index 00000000..caecb0e8 Binary files /dev/null and b/FrontEnd/iprjt/src/assets/BooksImage/item_pics/Screenshot from 2022-12-30 17-21-34.png differ diff --git a/FrontEnd/iprjt/src/assets/BooksImage/item_pics/b.png b/FrontEnd/iprjt/src/assets/BooksImage/item_pics/b.png new file mode 100644 index 00000000..59f5b329 Binary files /dev/null and b/FrontEnd/iprjt/src/assets/BooksImage/item_pics/b.png differ diff --git a/FrontEnd/iprjt/src/assets/BooksImage/item_pics/ksakinteIthihasam.jpeg b/FrontEnd/iprjt/src/assets/BooksImage/item_pics/ksakinteIthihasam.jpeg new file mode 100644 index 00000000..f903b57f Binary files /dev/null and b/FrontEnd/iprjt/src/assets/BooksImage/item_pics/ksakinteIthihasam.jpeg differ diff --git a/FrontEnd/iprjt/src/index.html b/FrontEnd/iprjt/src/index.html index e65022c6..8636c8ab 100644 --- a/FrontEnd/iprjt/src/index.html +++ b/FrontEnd/iprjt/src/index.html @@ -21,10 +21,12 @@ + + - + diff --git a/FrontEnd/iprjt/src/styles.css b/FrontEnd/iprjt/src/styles.css index 90d4ee00..7e7239a2 100644 --- a/FrontEnd/iprjt/src/styles.css +++ b/FrontEnd/iprjt/src/styles.css @@ -1 +1,4 @@ /* You can add global styles to this file, and also import other style files */ + +html, body { height: 100%; } +body { margin: 0; font-family: Roboto, "Helvetica Neue", sans-serif; } diff --git a/FrontEnd/iprjt/src29.zip b/FrontEnd/iprjt/src29.zip new file mode 100644 index 00000000..6474c2da Binary files /dev/null and b/FrontEnd/iprjt/src29.zip differ