Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ public class csvController {
csvService csvService;


@PostMapping("/upload")
@PostMapping("/admin/upload")
public ResponseEntity<ResponseMessage> uploadFile(@RequestParam("file") MultipartFile file) {
String message = "";

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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")


);
Expand All @@ -73,7 +73,7 @@ public static ByteArrayInputStream loadFromdb(List<csvUpload>csvList){
csvPrinter.printRecord(HEADERs);
for( csvUpload csv:csvList){
List<String>data=Arrays.asList(
String.valueOf(csv.getBooksId()),
//String.valueOf(csv.getBooksId()),
csv.getBooksName(),
csv.getBooksAuther(),
csv.getPublication(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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() {
Expand Down
2 changes: 1 addition & 1 deletion BackEnd/Library/src/main/resources/application.properties
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
20 changes: 15 additions & 5 deletions FrontEnd/iprjt/src/app/acceptrequest/acceptrequest.component.ts
Original file line number Diff line number Diff line change
@@ -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';
Expand All @@ -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=[];
}
Expand Down Expand Up @@ -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'])

}

Expand Down
5 changes: 5 additions & 0 deletions FrontEnd/iprjt/src/app/addbooks/addbooks.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,11 @@
<button mat-raised-button (click)="openDialog()" color="primary" >ADD BOOKS</button></div>
<br><br>

<div class="col-md-6" style="position: relative; left:1030px; top:-70px;">
<input type="file" id="myFile" (change)="selectFile($event)" style="margin-top: 3px;">
<button mat-icon-button [disabled]="!selectedFiles" > <i class="material-icons" style="color:rgb(142, 179, 137);" (click)="upload() " >cloud_upload</i></button>

</div>


<div class="card-box">
Expand Down
68 changes: 62 additions & 6 deletions FrontEnd/iprjt/src/app/addbooks/addbooks.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down Expand Up @@ -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=[];

Expand Down Expand Up @@ -100,18 +105,26 @@ onTableDataChange(event:any) {
openDialog() {

const dialogConfig = new MatDialogConfig();
this.dialog.open(BooksComponent, dialogConfig);
this.dialog.open(BooksComponent,
{
width:'32%',height:'70%'

}
);

}

delete(booksId:any): void{
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)=>{}
})
Expand All @@ -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;
}
}





Expand Down
19 changes: 1 addition & 18 deletions FrontEnd/iprjt/src/app/addcategory/addcategory.component.css
Original file line number Diff line number Diff line change
@@ -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;
Expand Down
6 changes: 3 additions & 3 deletions FrontEnd/iprjt/src/app/addcategory/addcategory.component.html
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
<app-sidenav></app-sidenav>
<br><br>
<div style="text-align: center;">
<button mat-raised-button (click)="openDialog()" color="primary" >ADD CATEGORY</button></div>

<button mat-raised-button (click)="openDialog()" color="primary" >ADD CATEGORY</button></div>
<br><br>

<div class="card-box">
Expand All @@ -12,7 +11,8 @@
<thead class="bg-primary text-white">
<tr role="row">

<th (click)="sortfn('categoryName')">Category Name
<th (click)="sortfn('categoryName')">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
Category Name
<button mat-icon-button *ngIf="this.direction==1"> <i class="material-icons" style="color:rgb(0, 0, 0)" >keyboard_arrow_up</i></button>
<button mat-icon-button *ngIf="this.direction==-1"> <i class="material-icons" style="color:rgb(0, 0, 0)" >keyboard_arrow_down</i></button>
</th>
Expand Down
19 changes: 17 additions & 2 deletions FrontEnd/iprjt/src/app/addcategory/addcategory.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -97,15 +97,30 @@ 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%'
// });

}

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%'

}
);

}

Expand Down
Loading