diff --git a/BackEnd/Library/src/main/java/com/innovature/Library/controller/csvController.java b/BackEnd/Library/src/main/java/com/innovature/Library/controller/csvController.java index 606b9427..7eb7584d 100644 --- a/BackEnd/Library/src/main/java/com/innovature/Library/controller/csvController.java +++ b/BackEnd/Library/src/main/java/com/innovature/Library/controller/csvController.java @@ -35,7 +35,7 @@ public class csvController { csvService csvService; - @PostMapping("/upload") + @PostMapping("/admin/upload") public ResponseEntity uploadFile(@RequestParam("file") MultipartFile file) { String message = ""; diff --git a/BackEnd/Library/src/main/java/com/innovature/Library/csv_helper/csvHelper.java b/BackEnd/Library/src/main/java/com/innovature/Library/csv_helper/csvHelper.java index 206433e8..a03d0543 100644 --- a/BackEnd/Library/src/main/java/com/innovature/Library/csv_helper/csvHelper.java +++ b/BackEnd/Library/src/main/java/com/innovature/Library/csv_helper/csvHelper.java @@ -50,7 +50,7 @@ public static boolean hasCSVFormat(MultipartFile file){ Integer.parseInt(csvRecord.get("booksCopies")), Integer.parseInt(csvRecord.get("categoryId")), Integer.parseInt(csvRecord.get("status")) - // csvRecord.get("image") + //csvRecord.get("image") ); @@ -73,7 +73,7 @@ public static ByteArrayInputStream loadFromdb(ListcsvList){ csvPrinter.printRecord(HEADERs); for( csvUpload csv:csvList){ Listdata=Arrays.asList( - String.valueOf(csv.getBooksId()), + //String.valueOf(csv.getBooksId()), csv.getBooksName(), csv.getBooksAuther(), csv.getPublication(), diff --git a/BackEnd/Library/src/main/java/com/innovature/Library/entity/csvUpload.java b/BackEnd/Library/src/main/java/com/innovature/Library/entity/csvUpload.java index 50cff811..aaa7bdbd 100644 --- a/BackEnd/Library/src/main/java/com/innovature/Library/entity/csvUpload.java +++ b/BackEnd/Library/src/main/java/com/innovature/Library/entity/csvUpload.java @@ -25,10 +25,16 @@ private Status(byte value) { this.value = value; } } +// @Id +// @GeneratedValue(strategy = GenerationType.IDENTITY) +// @Column(name="book_id") +// private Long booksId; + + @Id @GeneratedValue(strategy = GenerationType.IDENTITY) -@Column(name="book_id") -private Long booksId; +@Column(name="books_id") +private Integer booksId; @Column(name="books_name") private String booksName; @@ -71,19 +77,19 @@ public csvUpload(String booksName,String publication, String booksAuther, Intege @Override public String toString() { -return "Csv [booksId=" + booksId + ", booksName=" + booksName + ", booksAuthor=" + booksAuther + ", booksCopies=" + booksCopies +return "Csv [ booksName=" + booksName + ", booksAuthor=" + booksAuther + ", booksCopies=" + booksCopies + ", categoryId=" + categoryId + ", status=" + status + "]"; } -public Long getBooksId() { - return booksId; -} +// public Long getBooksId() { +// return booksId; +// } -public void setBooksId(Long booksId) { - this.booksId = booksId; -} +// public void setBooksId(Long booksId) { +// this.booksId = booksId; +// } public String getBooksName() { diff --git a/BackEnd/Library/src/main/resources/application.properties b/BackEnd/Library/src/main/resources/application.properties index 17e145e7..0d97ff4e 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/FrontEnd/iprjt/src/app/acceptrequest/acceptrequest.component.ts b/FrontEnd/iprjt/src/app/acceptrequest/acceptrequest.component.ts index 973ef016..a412fc58 100644 --- a/FrontEnd/iprjt/src/app/acceptrequest/acceptrequest.component.ts +++ b/FrontEnd/iprjt/src/app/acceptrequest/acceptrequest.component.ts @@ -1,6 +1,7 @@ import { Component, OnInit } from '@angular/core'; import { FormGroup, FormControl, Validators } from '@angular/forms'; import { Router } from '@angular/router'; +import { NgToastService } from 'ng-angular-popup'; import { BooksService } from '../books.service'; import { BorrowService } from '../borrow.service'; import { CategoryService } from '../category.service'; @@ -17,7 +18,10 @@ export class AcceptrequestComponent implements OnInit { val: any; date: any; - constructor(private router:Router ,private booksService:BooksService,private borrowService:BorrowService) { + constructor(private router:Router , + private toast : NgToastService, + private booksService:BooksService, + private borrowService:BorrowService) { // this.booksList=[]; this.borrowList=[]; } @@ -59,15 +63,21 @@ update(borrowId:any){ this.borrowService.update(borrowId, body).subscribe({ next: (Response: any) => { console.log(Response); - alert(" Book approved") - window.location.reload() + this.toast.success({detail:'Success',summary:'The Book '+Response.booksName+' Approved',duration:5000}); + + setTimeout(() => { + this.router.navigate(['/borrow']) + window.location.reload() + }, 5000); + // window.location.reload() }, error: (Response: any) => { console.log(Response) - alert("invalid Borrow details") + this.toast.info({detail:'INVALID',summary:'Something went wrong',duration:5000}); + } }) - this.router.navigate(['/borrow']) + // this.router.navigate(['/borrow']) } diff --git a/FrontEnd/iprjt/src/app/addbooks/addbooks.component.html b/FrontEnd/iprjt/src/app/addbooks/addbooks.component.html index 473af476..832bfe8d 100644 --- a/FrontEnd/iprjt/src/app/addbooks/addbooks.component.html +++ b/FrontEnd/iprjt/src/app/addbooks/addbooks.component.html @@ -5,6 +5,11 @@

+
+ + + +
diff --git a/FrontEnd/iprjt/src/app/addbooks/addbooks.component.ts b/FrontEnd/iprjt/src/app/addbooks/addbooks.component.ts index 1d4e49e1..c651a081 100644 --- a/FrontEnd/iprjt/src/app/addbooks/addbooks.component.ts +++ b/FrontEnd/iprjt/src/app/addbooks/addbooks.component.ts @@ -2,6 +2,7 @@ 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 { NgToastService } from 'ng-angular-popup'; import { BooksService } from '../books.service'; import { BooksComponent } from '../books/books.component'; import { CategoryService } from '../category.service'; @@ -40,8 +41,12 @@ len: any; result: any; booksCount: any; direction=-1; + + key:any; +selectedFiles?: FileList; +currentFile?: File; // ObjSampleForm:FormGroup; - constructor(private router:Router ,private booksService:BooksService,private service:CategoryService,private imageService:ImageuploadService,private dialog: MatDialog) { + constructor(private router:Router ,private toast : NgToastService,private booksService:BooksService,private service:CategoryService,private imageService:ImageuploadService,private dialog: MatDialog) { this.booksList=[]; this.categoryList=[]; @@ -100,7 +105,12 @@ onTableDataChange(event:any) { openDialog() { const dialogConfig = new MatDialogConfig(); - this.dialog.open(BooksComponent, dialogConfig); + this.dialog.open(BooksComponent, + { + width:'32%',height:'70%' + + } + ); } @@ -108,10 +118,13 @@ onTableDataChange(event:any) { if(confirm('Are you sure want to delete?')) { console.log(booksId); + this.toast.error({detail:'BOOK DELETED',summary:'The book '+booksId.booksName+' Has DELETED',duration:5000}); this.booksService.delete(booksId.booksId).subscribe({next:(res)=>{ - console.log(res); - alert("Books deleted"); - window.location.reload(); + console.log(res); + setTimeout(() => { + + window.location.reload() + }, 1500); }, error:(msg)=>{} }) @@ -125,10 +138,53 @@ onTableDataChange(event:any) { // localStorage.setItem('flag',this.flag); localStorage.setItem('booksId',booksId); const dialogConfig = new MatDialogConfig(); - this.dialog.open(BooksComponent, dialogConfig); + this.dialog.open(BooksComponent, + { + width:'32%',height:'70%' + + } + ); } + + + +//////////////////////////////////// + +selectFile($event:any) { + this.selectedFiles=$event.target.files; + } + + upload(): void { + + if (this.selectedFiles) { + const file: File | null = this.selectedFiles.item(0); + + if (file) { + this.currentFile = file; + this.booksService.uploadCsv(this.currentFile).subscribe(res=>{ + console.log(res); + if(res!==null){ + this.toast.success({detail:'SUCCESS',summary:'The CSV File upload is successfull',duration:5000}); + + + setTimeout(() => { + + window.location.reload() + }, 5000); + + } + }) + + + } + + this.selectedFiles = undefined; + } + } + + diff --git a/FrontEnd/iprjt/src/app/addcategory/addcategory.component.css b/FrontEnd/iprjt/src/app/addcategory/addcategory.component.css index 7f80b29c..c2f650fe 100644 --- a/FrontEnd/iprjt/src/app/addcategory/addcategory.component.css +++ b/FrontEnd/iprjt/src/app/addcategory/addcategory.component.css @@ -1,21 +1,4 @@ -/* -.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; diff --git a/FrontEnd/iprjt/src/app/addcategory/addcategory.component.html b/FrontEnd/iprjt/src/app/addcategory/addcategory.component.html index 333c7861..dbf0bdb7 100644 --- a/FrontEnd/iprjt/src/app/addcategory/addcategory.component.html +++ b/FrontEnd/iprjt/src/app/addcategory/addcategory.component.html @@ -1,8 +1,7 @@

-
- +


@@ -12,7 +11,8 @@ - Category Name +       + Category Name diff --git a/FrontEnd/iprjt/src/app/addcategory/addcategory.component.ts b/FrontEnd/iprjt/src/app/addcategory/addcategory.component.ts index 21c63f56..c9ea5792 100644 --- a/FrontEnd/iprjt/src/app/addcategory/addcategory.component.ts +++ b/FrontEnd/iprjt/src/app/addcategory/addcategory.component.ts @@ -97,7 +97,17 @@ result: any; openDialog() { const dialogConfig = new MatDialogConfig(); - this.dialog.open(CategoryComponent, dialogConfig); + this.dialog.open(CategoryComponent, + { + width:'25%',height:'40%' + + } + ); + +// this.matdialog.open(ChangePassComponent,{ + +// width: '60%' +// }); } @@ -105,7 +115,12 @@ editCategory(categoryId:any) { // localStorage.setItem('flag',this.flag); localStorage.setItem('categoryId',categoryId); const dialogConfig = new MatDialogConfig(); - this.dialog.open(CategoryComponent, dialogConfig); + this.dialog.open(CategoryComponent, + { + width:'25%',height:'40%' + + } + ); } diff --git a/FrontEnd/iprjt/src/app/body/body.component.css b/FrontEnd/iprjt/src/app/body/body.component.css index c6395dba..64269233 100644 --- a/FrontEnd/iprjt/src/app/body/body.component.css +++ b/FrontEnd/iprjt/src/app/body/body.component.css @@ -40,3 +40,216 @@ h1{ -webkit-filter: blur(5px); } +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/body/body.component.html b/FrontEnd/iprjt/src/app/body/body.component.html index e3423375..5d96435a 100644 --- a/FrontEnd/iprjt/src/app/body/body.component.html +++ b/FrontEnd/iprjt/src/app/body/body.component.html @@ -1,4 +1,4 @@ -


+ +

\ No newline at end of file diff --git a/FrontEnd/iprjt/src/app/body/body.component.ts b/FrontEnd/iprjt/src/app/body/body.component.ts index 59fd1f93..307636c7 100644 --- a/FrontEnd/iprjt/src/app/body/body.component.ts +++ b/FrontEnd/iprjt/src/app/body/body.component.ts @@ -52,13 +52,13 @@ export class BodyComponent implements OnInit { } logout() { - if (confirm('Are you sure you want to LogOuT?')) { - localStorage. clear() - this.router.navigate(['/login']) - } else { + // if (confirm('Are you sure you want to LogOuT?')) { + // localStorage. clear() + // this.router.navigate(['/login']) + // } else { - this.router.navigate(['/body']) - } + this.router.navigate(['/login']) + // } } onClickProfile() { diff --git a/FrontEnd/iprjt/src/app/books.service.ts b/FrontEnd/iprjt/src/app/books.service.ts index 46a1d95d..fed44370 100644 --- a/FrontEnd/iprjt/src/app/books.service.ts +++ b/FrontEnd/iprjt/src/app/books.service.ts @@ -25,6 +25,16 @@ handleError(err: HttpErrorResponse): any { } ////////////////////////////////////////////// + uploadCsv(file: File): Observable { + const formData: FormData = new FormData(); + + formData.append('file', file); + return this.http.post('http://localhost:8080/csv/admin/upload', formData) + + } + + + add(data:any):Observable{ return this.http.post('http://localhost:8080/books',data).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 e69de29b..2a8c7264 100644 --- a/FrontEnd/iprjt/src/app/books/books.component.css +++ b/FrontEnd/iprjt/src/app/books/books.component.css @@ -0,0 +1,5 @@ +mat-form-field { + width: 80% ; + padding-left:15%; + /* padding-right: ; */ +} \ No newline at end of file diff --git a/FrontEnd/iprjt/src/app/books/books.component.html b/FrontEnd/iprjt/src/app/books/books.component.html index bc13b96d..88f40006 100644 --- a/FrontEnd/iprjt/src/app/books/books.component.html +++ b/FrontEnd/iprjt/src/app/books/books.component.html @@ -1,8 +1,10 @@
-
-

ADD BOOKS

+
+

ADD BOOKS

+

EDIT BOOKS

+
@@ -40,9 +42,9 @@
-
-    - +
                                   +     +
diff --git a/FrontEnd/iprjt/src/app/books/books.component.ts b/FrontEnd/iprjt/src/app/books/books.component.ts index b8bd3395..306c5d0b 100644 --- a/FrontEnd/iprjt/src/app/books/books.component.ts +++ b/FrontEnd/iprjt/src/app/books/books.component.ts @@ -5,6 +5,7 @@ import { CategoryService } from '../category.service'; import { BooksService } from '../books.service'; import { ImageuploadService } from '../imageupload.service'; import { NgToastService } from 'ng-angular-popup'; +import { MatDialog } from '@angular/material/dialog'; @Component({ @@ -93,16 +94,15 @@ onSubmit(){ console.log(result); 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.toast.success({detail:'Success',summary:'The Book '+result.booksName+' Added',duration:5000}); this.imageService.setId(result.booksId) console.log("bid=",result.booksId) + // MatDialog.close(); this.router.navigate(['/imageupload']) - // window.location.reload(); } else{ - this.toast.success({detail:'Invalid',summary:'Add new Book Failed',duration:5000}); + this.toast.error({detail:'Invalid',summary:'Add new Book Failed',duration:5000}); } }) @@ -151,16 +151,24 @@ update(booksId:any){ this.booksService.update(booksId, body).subscribe({ next: (Response: any) => { console.log(Response); - this.toast.success({detail:'Success',summary:Response.booksName+' Edited Successfully',duration:5000}); - // window.location.reload() - if (confirm('Do you want to change Book cover?')) { + + + + + if (confirm('Do you want to change Book cover?')) { + this.toast.info({detail:'Success ',summary:'The book '+this.ObjSampleForm.controls['booksName'].value+' Edited Successfully',duration:5000}); + this.imageService.setId(Response.booksId) console.log("bookId=",Response.booksId) this.router.navigate(['/imageupload']) } else { - this.router.navigate(['/addbooks']) - window.location.reload() + this.toast.info({detail:'Success ',summary:this.ObjSampleForm.controls['booksName'].value+' Edited Successfully',duration:5000}); + + setTimeout(() => { + this.router.navigate(['/addbooks']) + window.location.reload() + }, 5000); } diff --git a/FrontEnd/iprjt/src/app/category/category.component.css b/FrontEnd/iprjt/src/app/category/category.component.css index fd209fb5..a18723bc 100644 --- a/FrontEnd/iprjt/src/app/category/category.component.css +++ b/FrontEnd/iprjt/src/app/category/category.component.css @@ -1,21 +1,4 @@ -/* 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{ @@ -29,6 +12,7 @@ border-radius: 7px; } + .btn{ width: 100%; padding: 7px 2px; @@ -67,3 +51,21 @@ th { color: rgb(255, 255, 255); border-radius: 3px; } + + +mat-dialog-content{ + width: 100%; + text-align: center; + margin-top: 5%; +} +mat-dialog-actions{ + text-align: center; +} +/* dialog-form{ + width: 25%; +} */ +/* +mat-form-field{ + text-align: center; + width: 100%; +} */ \ No newline at end of file diff --git a/FrontEnd/iprjt/src/app/category/category.component.html b/FrontEnd/iprjt/src/app/category/category.component.html index 3f2df0d7..03eeb768 100644 --- a/FrontEnd/iprjt/src/app/category/category.component.html +++ b/FrontEnd/iprjt/src/app/category/category.component.html @@ -1,20 +1,23 @@ -
-

ADD CATEGORY

- +
+

ADD CATEGORY

+

EDIT CATEGORY

+ +
- - - This field is mandatory. + + + + This field is mandatory. -
-    - +
                    +    +
diff --git a/FrontEnd/iprjt/src/app/forgotpassword/forgotpassword.component.html b/FrontEnd/iprjt/src/app/forgotpassword/forgotpassword.component.html index f20a2c41..6b2ed929 100644 --- a/FrontEnd/iprjt/src/app/forgotpassword/forgotpassword.component.html +++ b/FrontEnd/iprjt/src/app/forgotpassword/forgotpassword.component.html @@ -1,3 +1,5 @@ + +
@@ -5,8 +7,8 @@



- + required>

+
@@ -19,7 +21,7 @@