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 @@ -163,9 +163,10 @@ public ResponseEntity<Page<Books>> getAllBookStockSearch(
@RequestParam(defaultValue = "") String keyword,
@RequestParam(defaultValue = "1") Integer pageNo,
@RequestParam(defaultValue = "10") Integer pageSize,
@RequestParam(defaultValue = "id") String sortBy) {
@RequestParam(defaultValue = "books_id") String sortBy,
@RequestParam(defaultValue = "-1") Integer direction) {
System.out.println("paage size" + pageSize);
Page<Books> list = service.getAllBookStocks(keyword, pageNo - 1, pageSize, sortBy);
Page<Books> list = service.getAllBookStocks(keyword, pageNo - 1, pageSize, sortBy,direction);
return new ResponseEntity<Page<Books>>(list, new HttpHeaders(),
HttpStatus.OK);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ public interface BooksService {

List<Object[]> getBookCountByCategory();

Page<Books>getAllBookStocks(String keyword, Integer pageNo,Integer pageSize,String sortBy);
Page<Books>getAllBookStocks(String keyword, Integer pageNo,Integer pageSize,String sortBy,Integer direction);

}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -147,14 +147,34 @@ public List<Object[]> getBookCountByCategory() {
//book search

@Override
public Page<Books> getAllBookStocks(String keyword, Integer pageNo, Integer pageSize, String sortBy) {
Pageable paging = PageRequest.of(pageNo, pageSize, Sort.by(sortBy));
System.out.println(keyword);
public Page<Books> getAllBookStocks(String keyword, 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);
System.out.println(keyword);
String k = keyword;
String k1 = keyword;
String k2 = keyword;
Page<Books> pagedResult = booksRepository.findByKeywords(keyword, k, k1, k2, paging);
return pagedResult;
}

else
{
Pageable paging = PageRequest.of(pageNo, pageSize, sortByAscending);
System.out.println(keyword);
String k = keyword;
String k1 = keyword;
String k2 = keyword;
Page<Books> pagedResult = booksRepository.findByKeywords(keyword, k, k1, k2, paging);
return pagedResult;
}



}

Expand Down
130 changes: 129 additions & 1 deletion FrontEnd/Library/src/app/addbooks/addbooks.component.css
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
width: 80%;
border: none;
text-align: center;
height: 100px;

}
th {
Expand All @@ -22,4 +23,131 @@
}
.form-control{
width: fit-content;
}
}





@import url(//netdna.bootstrapcdn.com/font-awesome/4.0.3/css/font-awesome.css);
@import url(https://fonts.googleapis.com/css?family=Titillium+Web:300);
.fa-2x {
font-size: 2em;
}
.fa {
position: relative;
display: table-cell;
width: 60px;
height: 36px;
text-align: center;
vertical-align: middle;
font-size:20px;
}

.main-menu {
background:#446cb3;
margin: 0%;

border-right:0px solid #030303;
position:absolute;
top:0;
bottom:0;
height: 770px;
overflow: hidden;

left:0;
width:220px;
overflow:-moz-hidden-unscrollable;
-webkit-transition:width .05s linear;
transition:width .05s linear;
-webkit-transform:translateZ(0) scale(1,1);
z-index:1000;
}

.main-menu>ul {
margin:7px 0;
}
body{height: 0vh;
background-color: #030303;
}
.main-menu li {
position:relative;
display:block;
width:250px;
}

.main-menu li>a {
position:relative;
display:table;
border-collapse:collapse;
border-spacing:0;
color:rgb(237, 248, 244);
font-family: arial;
font-size: 14px;
text-decoration:none;
-webkit-transform:translateZ(0) scale(1,1);
-webkit-transition:all .1s linear;
transition:all .1s linear;
}

.main-menu .nav-icon {
position:relative;
display:table-cell;
width:60px;
height:36px;
text-align:center;
vertical-align:middle;
font-size:18px;
}

.main-menu .nav-text {
position:relative;
display:table-cell;
vertical-align:middle;
width:190px;
font-family: 'Titillium Web', sans-serif;
}

.main-menu>ul.logout {
position:absolute;
left:0;
bottom:0;
}

.no-touch .scrollable.hover {
overflow-y:hidden;
}

.no-touch .scrollable.hover:hover {
overflow-y:auto;
overflow:visible;
}

a:hover,a:focus {
text-decoration:none;
}

nav {
-webkit-user-select:none;
-moz-user-select:none;
-ms-user-select:none;
-o-user-select:none;
user-select:none;
}

nav ul,nav li {
outline:0;
margin:0;
padding:0;
}
.main-menu li:hover>a,nav.main-menu li.active>a,.dropdown-menu>li>a:hover,.dropdown-menu>li>a:focus,.dropdown-menu>.active>a,.dropdown-menu>.active>a:hover,.dropdown-menu>.active>a:focus,.no-touch .dashboard-page nav.dashboard-menu ul li:hover a,.dashboard-page nav.dashboard-menu ul li.active a {
color:rgb(243, 234, 234);
background-color:#565985;
}
@font-face {
font-family: 'Titillium Web';
font-style: normal;
font-weight: 300;
src: local('Titillium WebLight'), local('TitilliumWeb-Light'), url(http://themes.googleusercontent.com/static/fonts/titilliumweb/v2/anMUvcNT0H1YN4FII8wpr24bNCNEoFTpS2BTjF6FB5E.woff) format('woff');
}

122 changes: 110 additions & 12 deletions FrontEnd/Library/src/app/addbooks/addbooks.component.html
Original file line number Diff line number Diff line change
@@ -1,31 +1,100 @@
<app-sidenav></app-sidenav>

<br><br>
<div style="text-align: center;">
<!-- <app-sidenav></app-sidenav> -->

<router-outlet></router-outlet>
<app-admin-navbar></app-admin-navbar>

<div class="area"></div>
<nav class="main-menu">
<ul>
<br><br><br>
<li><br>
<a href="body">
<i class="fa fa-home fa-2x"></i>
<span class="nav-text">
HOME
</span>
</a>
</li>
<br>
<li class="has-subnav">
<a href="addcategory">
<i class="fa fa-bars fa-2x"></i>
<span class="nav-text">
CATEGORY
</span>
</a>
</li>
<br>
<li>
<a href="addbooks">
<i class="fa fa-refresh fa-2x"></i>
<span class="nav-text">
BOOKS
</span>
</a>
</li>
<br>

<li>
<a href="borrow">
<i class="fa fa-refresh fa-2x"></i>
<span class="nav-text">
BORROW
</span>
</a>
</li>
<br>

<li>
<a href="user-details">
<i class="fa fa-book fa-2x"></i>
<span class="nav-text">
USERS
</span>
</a>
</li>
<br>

<li>
<a href="fine">
<i class="fa fa-inr fa-2x"></i>
<span class="nav-text">
FINE
</span><br>
</a>
</li>

</ul>

</nav>

<br><br> <body style="position:relative; left: 7%;">
<div style="text-align: center;left: 5%;">
<button mat-raised-button (click)="openDialog()" color="primary" >ADD BOOKS</button></div>
<br><br>



<form [formGroup]="search" style="display: inline-flex;padding: 0px;" class="col-md-4">
<input type="text" style="position: relative; left:1030px; top:-75px;" class="form-control" formControlName="inp" placeholder="Enter Book Name to Search "
<input type="text" style="position: relative; left:950px; top:-75px;" class="form-control" formControlName="inp" placeholder="Enter Book Name to Search "
aria-label="Recipient's username" aria-describedby="basic-addon2" (ngModelChange)="search1(this.search.controls['inp'].value)" >
<button mat-icon-button style="position: relative; left:1030px; top:-75px;"> <i class="material-icons" style="color:rgb(0, 0, 0)" >search</i></button>
<button mat-icon-button style="position: relative; left:950px; top:-75px;"> <i class="material-icons" style="color:rgb(0, 0, 0)" >search</i></button>

</form>



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


<div class="table-responsive">
<table align="center" class=".table-hover" >
<table align="center" class=".table-hover" >
<caption>Book Results</caption>
<thead class="bg-primary text-white">
<tr role="row">
<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>
Expand All @@ -51,6 +120,33 @@
<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>

Expand Down Expand Up @@ -87,4 +183,6 @@
<div class="d-flex justify-content-center">
<pagination-controls (pageChange)="onTableDataChange(page=$event)">
</pagination-controls>
</div>
</div>

</body>
Loading