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
5 changes: 3 additions & 2 deletions FrontEnd/Library/src/app/addbooks/addbooks.component.css
Original file line number Diff line number Diff line change
Expand Up @@ -60,20 +60,21 @@ margin-left: 20%;
table{
width: 90%;
border: none;
text-align: center;
text-align: left;
height: 100px;
text-size-adjust: auto;

}
th {
background-color: #ffffff;
color: rgb(0, 0, 0);
text-align: center;
text-align: left;
border: none;
}
td {
border: none;
padding-top: 6px;padding-bottom: 6px;
text-align: left;
}
/* .form-control{
width: fit-content;
Expand Down
110 changes: 1 addition & 109 deletions FrontEnd/Library/src/app/addbooks/addbooks.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -35,13 +35,6 @@
.form-control{
width: 30vh;
}

/* .col-md-6{
display: flex;
flex-wrap: wrap;
flex-direction: row;
} */


}
</style>
Expand All @@ -67,7 +60,7 @@
<button mat-icon-button style="position: relative; left:10%; "> <i class="material-icons" style="color:rgb(0, 0, 0)" >search</i></button>
</form>
<span class="csvv">
<input type="file" id="myFile" (change)="selectFile($event)" style="position: relative; ">
<input type="file" id="myFile" accept=".csv, application/vnd.openxmlformats-officedocument.spreadsheetml.sheet, application/vnd.ms-excel" (change)="selectFile($event)" style="position: relative; ">
<button mat-icon-button [disabled]="!selectedFiles" >
<i class="material-icons" style="color:rgb(142, 179, 137);position: relative; " (click)="upload() " >cloud_upload</i>
</button> </span>
Expand Down Expand Up @@ -198,104 +191,3 @@



<!--


<br><br>

<div class="table-responsive">
<table align="center" class=".table-hover" >
<caption>Book Results</caption>
<thead class="bg-primary text-white">
<tr role="row" *ngIf="this.pkey==null">
<th (click)="sortfn('category.categoryName')">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>

<th (click)="sortfn('publication')">Publication
<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>

<th (click)="sortfn('booksName')">Book 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>
<th (click)="sortfn('auther')">Auther
<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>
<th (click)="sortfn('booksCopies')">Book Copies
<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>
<th>Book Cover</th>
<th></th>
</tr>

<tr role="row" *ngIf="this.pkey!=null">
<th (click)="sortfn('category_id')">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>

<th (click)="sortfn('publication')">Publication
<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>

<th (click)="sortfn('books_name')">Book 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>
<th (click)="sortfn('auther')">Auther
<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>
<th (click)="sortfn('books_copies')">Book Copies
<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>
<th>Book Cover</th>
<th></th>
</tr>
</thead>
<tbody>

<tr *ngFor="let books of data | paginate
: {
itemsPerPage: tableSize,
currentPage: page,
totalItems: count
};


">

<td>{{books.category.categoryName}}</td>
<td>{{books.publication}}</td>
<td>{{books.booksName}}</td>
<td>{{books.auther}}</td>
<td>{{books.booksCopies}}</td>
<td align="right"><img src="../../assets/BooksImage/item_pics/{{books.image}}" width="90" height="110" ></td>


<td>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;

<button mat-icon-button> <i class="material-icons" style="color:red" (click)="delete(books)">delete</i></button>&nbsp;
<button mat-icon-button> <i class="material-icons" style="color:green" (click)="edit(books.booksId)">edit</i></button>
</tr>
</tbody>
</table>
unfold_more
</div>


Pagenation Controler
<div class="d-flex justify-content-center">
<pagination-controls (pageChange)="onTableDataChange(page=$event)">
</pagination-controls>
</div>

</body> -->
21 changes: 18 additions & 3 deletions FrontEnd/Library/src/app/addbooks/addbooks.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -160,11 +160,16 @@ onTableDataChange(event:any) {
const dialogConfig = new MatDialogConfig();
this.dialog.open(BooksComponent,
{
closeOnNavigation: true,
// width:'32%',height:'70%'
width:'55%',height:'auto'

}
);
this.router.events
.subscribe(() => {
this.dialog.closeAll();
});

}

Expand Down Expand Up @@ -194,10 +199,15 @@ onTableDataChange(event:any) {
const dialogConfig = new MatDialogConfig();
this.dialog.open(BooksComponent,
{
closeOnNavigation: true,
width:'30%',height:'70%'

}
);
this.router.events
.subscribe(() => {
this.dialog.closeAll();
});

}

Expand All @@ -208,6 +218,7 @@ onTableDataChange(event:any) {

selectFile($event:any) {
this.selectedFiles=$event.target.files;
console.log("sel-",this.selectedFiles)
}


Expand All @@ -223,15 +234,19 @@ selectFile($event:any) {
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);

}, 5000);
}
})
}),
(error: any) =>{
console.log("in error")
this.toast.error({detail:'CSV upload failed',summary:'Invalid csv file',duration:5000});
console.log(error)};


}
Expand Down
12 changes: 9 additions & 3 deletions FrontEnd/Library/src/app/addcategory/addcategory.component.css
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
table{
width: auto;
border: none;
text-align: center;
text-align: left;

}
/* tr{
Expand All @@ -11,12 +11,18 @@
th {
background-color: #ffffff;
color: rgb(0, 0, 0);
text-align: center;
text-align: left;
/* text-align: center; */
border: none;

}
td {
border: none;
padding-top: 16px;padding-bottom: 6px;
text-align: center;
text-align: left;
/* text-align: center; */
}

td text{
padding-top: 30%;
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@
<div class="card-box">
<div class="row">
<div class="table-responsive">
<table align="center" class="table table-white table-hover">
<table align="center" class=".table-hover">
<thead class="bg-primary text-white">
<tr role="row">

<th (click)="sortfn('categoryName')">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<th (click)="sortfn('categoryName')">
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>
Expand All @@ -34,7 +34,7 @@
<td>{{category.categoryName}}</td>

<td>
<button mat-icon-button><i class="material-icons" style="color:red" (click)="deleteCategory(category)">delete</i> </button>
<button mat-icon-button><i class="material-icons" style="color:red;" (click)="deleteCategory(category)">delete</i> </button>

<button mat-icon-button> <i class="material-icons" style="color:green" (click)="editCategory(category.categoryId)">edit</i></button>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -124,11 +124,15 @@ editCategory(categoryId:any) {

this.dialog.open(CategoryComponent,
{
// width:'25%',height:'35%'
closeOnNavigation: true,
width:'auto',height:'auto'

}
);
this.router.events
.subscribe(() => {
this.dialog.closeAll();
});

}

Expand Down
9 changes: 8 additions & 1 deletion FrontEnd/Library/src/app/books.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,13 @@ handleError(err: HttpErrorResponse): any {
localStorage.clear()
this.router.navigateByUrl(`/login`); }
}
handleCsvError(err: HttpErrorResponse): any {
console.log('hhhii');
if ( err.status === 417) {
alert("CSV upload failed : Invalid csv file")

}
}

//////////////////////////////////////////////

Expand All @@ -37,7 +44,7 @@ handleError(err: HttpErrorResponse): any {
const formData: FormData = new FormData();

formData.append('file', file);
return this.http.post('http://localhost:8080/csv/admin/upload', formData)
return this.http.post('http://localhost:8080/csv/admin/upload', formData).pipe((catchError(err => this.handleCsvError(err))))

}
//pie
Expand Down
59 changes: 7 additions & 52 deletions FrontEnd/Library/src/app/books/books.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -49,30 +49,31 @@
<br>

<mat-form-field>
<input formControlName="publication" matInput placeholder="publication" />
<input formControlName="publication" matInput placeholder="publication" maxlength="30" />
<mat-error>This field is mandatory.</mat-error>
</mat-form-field>
<br>
<mat-form-field>
<input formControlName="booksName" matInput placeholder="booksName" />
<input formControlName="booksName" matInput placeholder="booksName" maxlength="30" />
<mat-error>This field is mandatory.</mat-error>
</mat-form-field>
<br>
<mat-form-field>
<input formControlName="auther" matInput placeholder="auther" />
<input formControlName="auther" matInput placeholder="auther" maxlength="30" />
<mat-error>This field is mandatory.</mat-error>
</mat-form-field>
<br>
<mat-form-field>
<input formControlName="booksCopies" matInput placeholder="booksCopies" />
<input formControlName="booksCopies" matInput placeholder="booksCopies" pattern="[0-9]+" type="number" min="0" />
<mat-error>This field is mandatory.</mat-error>
<!-- <mat-error>Numeric values only</mat-error> -->
</mat-form-field>
<br>
</mat-dialog-content>

<div mat-dialog-actions >&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<button mat-raised-button color="warn" (click)="clear()">Clear</button> &nbsp;&nbsp;&nbsp;
<button mat-raised-button (click)="onSubmit()" color="primary" [disabled]="ObjSampleForm.invalid" >Submit</button>
<button mat-raised-button color="warn" (click)="clear()" type="reset">Clear</button> &nbsp;&nbsp;&nbsp;
<button mat-raised-button (click)="onSubmit()" color="primary" [disabled]="ObjSampleForm.invalid" >Submit</button>

</div>

Expand Down Expand Up @@ -103,49 +104,3 @@





<!--

<div class="text-center">
<form [formGroup]="ObjSampleForm" class="dialog-form" >
<br>
<div style="width: 200px; margin:0 auto;" class="example-container" >
<label><h1>ADD BOOKS</h1></label>
<table align="center">
<br>
<label for="categoryId">Select Category </label>
<select class="dropbtn" type="input" formControlName="categoryId" name="select" placeholder="Select Category" (click)="disp()" >
<option *ngFor="let category of catdata" value={{category.categoryId}}>
{{category.categoryName}}
</option>
</select>
<span class="text-danger" class="text-danger" *ngIf="ObjSampleForm.controls['categoryId'].touched && ObjSampleForm.hasError('required','categoryId')"><small>Category Name is required</small>
</span>
<br><br>

<div><input type="text" class="text-danger1" placeholder="publication" formControlName="publication" name="publication" maxlength="20" required></div>
<span class="text-danger" class="text-danger" *ngIf="ObjSampleForm.controls['publication'].touched && ObjSampleForm.hasError('required','publication')"><small>Publication is required</small>
</span><br>

<div><input type="text" class="text-danger1" placeholder="booksName" formControlName="booksName" name="booksName" maxlength="20" required></div>
<span class="text-danger" class="text-danger" *ngIf="ObjSampleForm.controls['booksName'].touched && ObjSampleForm.hasError('required','booksName')"><small>Books Name is required</small>
</span><br>

<div><input type="text" class="text-danger1" placeholder="author" formControlName="auther" name="auther" maxlength="20" required></div>
<span class="text-danger" class="text-danger" *ngIf="ObjSampleForm.controls['auther'].touched && ObjSampleForm.hasError('required','auther')"><small>Author Name is required</small>
</span><br>

<div><input type="text" class="text-danger1" placeholder="booksCopies" formControlName="booksCopies" name="booksCopies" maxlength="20" required></div><br>
<span class="text-danger" class="text-danger" *ngIf="ObjSampleForm.controls['booksCopies'].touched && ObjSampleForm.hasError('required','booksCopies')"><small>booksCopies is required</small>
</span>


<input class="btn" type="submit" name="onSubmit" value="Submit" ><br><br><br>

</table>
</div>
</form>
</div>

-->
Loading