-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbook_list.php
More file actions
517 lines (428 loc) · 23.9 KB
/
book_list.php
File metadata and controls
517 lines (428 loc) · 23.9 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
<?php
ob_start();
?>
<style>
.bti{
background-color: Transparent;
background-repeat:no-repeat;
text-decoration:none;
border: none;
cursor:pointer;
overflow: hidden;
outline:none;
color:#007bff;
font-weight:bold;
float: left;
margin-top: -10px;
}
</style>
<!--Title-->
<div class="col-12 d-flex align-items-center justify-content-between">
<h4 class="page-title">
<!-- header dashboard -->
<div class="col-12 d-flex align-items-center justify-content-between">
<div class="wrapper">
<a data-toggle="modal" data-target="#myModal" href="#myModal">
<i class="mdi mdi-import" style="margin-right:5px"></i>Import CSV</a>
<div class="modal fade" id="myModal">
<div class="modal-dialog modal-dialog-centered">
<div class="modal-content">
<div class="d-block p-4" style="border-radius:6px; background-color:#f9fbfd">
<!-- Modal Header -->
<div class="modal-header" style="margin-left:130px">
<h4 class="modal-title">Import CSV File</h4>
<button type="button" class="close" data-dismiss="modal">×</button>
</div>
<!-- Modal body -->
<form class="form-horizontal" action="add_book_insert_code" method="POST" name="upload_excel" enctype="multipart/form-data">
<div class="row">
<div class="col-md-12 mb-3">
<label class="label">File</label>
<div class="input-group">
<div class="input-group-prepend">
<span class="menu-icon icon-folder input-group-text" style="background-color:#eee"></span>
</div>
<input type="file" name="file" id="file" class="input-large" >
</div>
</div>
</div>
<div class="input-group">
<button class="btn btn-primary submit-btn btn-block button-loading" data-loading-text="Loading..." type="submit" id="submit" name="Import">Upload</button>
</div>
</form>
<!-- Modal footer -->
<div class="modal-footer">
<button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</h4>
<div class="d-flex align-items-center">
<div class="wrapper mr-4 d-none d-sm-block">
<p class="mb-0">Manage
<b class="mb-0">Section</b>
</p>
</div>
<div class="wrapper">
<a href="system" class="btn btn-link btn-sm font-weight-bold">
<i class="icon-home"></i>Home</a>
</div>
</div>
</div>
<!--end title-->
<!-- end row -->
<div class="row col-12 d-flex align-items-center justify-content-between" style="margin-top:20px;">
<div class="col-12">
<div class="card">
<div class="card-body">
<h4 class="header-title">Recent Manage Book</h4><br>
<div class="wrapper">
<a href="book_table" class="btn btn-link btn-sm font-weight-bold">
<i class="icon-book-open"></i>Show All Book</a>
<form class="form-horizontal" action="add_book_insert_code.php" method="post" name="upload_excel"
enctype="multipart/form-data">
<div class="form-group" style="float:right; margin-top:-18px;">
<button name="Export" class="bti" value="Export To Excel"><i class="icon-share-alt"></i> Export To CSV</button>
</div>
</form>
</div>
<div class="d-block" style="height:2px; background-color:#564a4a26"></div><br>
<div class="table-responsive mt-3">
<?php
include 'add_book_insert_code.php';
if (isset($_SESSION['response'])) { ?>
<div class="alert alert-<?= $_SESSION['res_type'];?> alert-dismissible text-center auto-close">
<button type="button" class="close" data-dismiss="alert">×</button>
<b class=""><?= $_SESSION['response'];?></b>
</div>
<?php } unset($_SESSION['response']);?>
<div class="col-md-12">
<form action="book_list" method="post">
<div class="row">
<div class="col-md-6 form-group">
<label for="validationCustomUsername">Book ID</label>
<div class="input-group">
<div class="input-group-prepend">
<span class="input-group-text" style="background-color:#eee;">#</span>
</div>
<input type="number" class="form-control" placeholder="Search by id.." name="book_id" style="height:40px;">
</div>
</div>
<div class="col-md-6 form-group">
<label for="validationCustomUsername">Book Title</label>
<div class="input-group">
<div class="input-group-prepend">
<span class="input-group-text menu-icon icon-speech" style="background-color:#eee;"></span>
</div>
<input type="text" class="form-control" placeholder="Search by title.." name="book_title" style="height:40px;">
</div>
</div>
<div class="col-md-6 form-group">
<label for="validationCustomUsername">Author</label>
<div class="input-group">
<div class="input-group-prepend">
<span class="input-group-text menu-icon icon-user" style="background-color:#eee;"></span>
</div>
<input type="text" class="form-control" placeholder="Search by author.." name="author" style="height:40px;">
</div>
</div>
<div class="col-md-6 form-group">
<label for="validationCustomUsername">Date</label>
<div class="input-group">
<div class="input-group-prepend">
<span class="input-group-text menu-icon icon-calendar" style="background-color:#eee;"></span>
</div>
<input type="date" class="form-control" placeholder="Search by publish year.." name="created_at" style="height:40px;">
</div>
</div>
<div class="col-md-6 form-group">
<label for="validationCustomUsername">Departmenet</label>
<div class="input-group">
<div class="input-group-prepend">
<span class="input-group-text menu-icon icon-drawer" style="background-color:#eee;"></span>
</div>
<?php
include('connection_DB.php');
$Q = "SELECT * FROM `department`";
$query=mysqli_query($con,$Q);
$account=mysqli_num_rows($query);
?>
<select class="form-control" name="department" style="height:40px;">
<option selected hidden value="none">Select Department</option>
<?php
for($i=1; $i<=$account; $i++){
$row=mysqli_fetch_array($query);
?>
<option value="<?php echo $row["department_id"]; ?>"><?php echo $row["department_name"]; ?></option>
<?php
}
?>
</select>
</div>
</div>
<div class="col-md-6 form-group">
<button type="submit" name="search" class="col-md-6 offset-6 btn btn-primary mdi mdi-magnify mt-3"> Search</button>
</div>
</div>
</form>
</div>
<?php
if(isset($_POST['search'])){
$book_id = $_POST['book_id'];
$book_title = $_POST['book_title'];
$author = $_POST['author'];
$created_at = $_POST['created_at'];
$department = $_POST['department'];
$q = 'SELECT * FROM `book` JOIN book_case ON book.b_c_id = book_case.b_c_id JOIN faculty ON book.faculty_id = faculty.faculty_id JOIN department ON
book.department_id = department.department_id WHERE book.book_id LIKE "'.$book_id.'" OR book.book_title LIKE "'.$book_title.'" OR book.author LIKE "'.$author.'" OR book.created_at LIKE "'.$created_at.'" OR book.department_id LIKE "'.$department.'"';
$query = mysqli_query($con,$q);
if (mysqli_num_rows($query) > 0) {
?>
<table class="table table-responsive table-hover table-centered mb-0" id="order-listing">
<form action="barcode_page" method="POST">
<thead class="bg-info text-white">
<tr>
<th>
<div class="checkbox">
<input type="checkbox" id="select-all" name="check" class="checkitem">
</div>
</th>
<th>Book ID</th>
<th>Book Title</th>
<th>Author</th>
<th>Translator</th>
<th>Publish Place</th>
<th>Publisher</th>
<th>Publish Year</th>
<th>Volume</th>
<th>Book Edition</th>
<th>Page</th>
<th>Book Language </th>
<th>Copy</th>
<th>BC ID</th>
<th>Faculty</th>
<th>Dep</th>
<th>Action</th>
</tr>
</thead>
<tbody>
<?php
while($res = mysqli_fetch_array($query)){
?>
<tr>
<th>
<div class="checkbox">
<input type="checkbox" name="barcodeText[]" value="<?php echo $res['book_id'];?>" class="checkitem">
</div>
</th>
<th scope="row">
<?php echo $res['book_id'];?>
</th>
<td>
<?php echo $res['book_title'];?>
</td>
<td>
<?php echo $res['author'];?>
</td>
<td>
<?php echo $res['translator'];?>
</td>
<td>
<?php echo $res['publish_place'];?>
</td>
<td>
<?php echo $res['publisher'];?>
</td>
<td>
<?php echo $res['publish_year'];?>
</td>
<td>
<?php echo $res['volume'];?>
</td>
<td>
<?php echo $res['book_edition'];?>
</td>
<td>
<?php echo $res['number_page'];?>
</td>
<td>
<?php echo $res['book_language'];?>
</td>
<td>
<?php
if($res['copy']==1){
//echo"Admin";
?>
<label class="badge badge-success"><?php echo "1";?></lable>
<?php
}
elseif($res['copy']==2){
//echo"Librarian";
?>
<label class="badge badge-warning"><?php echo"2";?></lable>
<?php
} elseif ($res['copy']==3) {
# code...
?>
<label class="badge badge-dark"><?php echo "3";?></lable>
<?php
} elseif ($res['copy']==4) {
# code...
?>
<label class="badge badge-danger"><?php echo "4";?></lable>
<?php
} elseif ($res['copy']==5) {
# code...
?>
<label class="badge badge-primary"><?php echo "5";?></lable>
<?php
} elseif ($res['copy']==6) {
# code...
?>
<label class="badge badge-secondary text-warning"><?php echo "6";?></lable>
<?php
}elseif ($res['copy']==7) {
# code...
?>
<label class="badge badge-success"><?php echo "7";?></lable>
<?php
}elseif ($res['copy']==8) {
# code...
?>
<label class="badge badge-info"><?php echo "8";?></lable>
<?php
}elseif ($res['copy']==9) {
# code...
?>
<label class="badge badge-dark"><?php echo "9";?></lable>
<?php
}elseif ($res['copy']==10) {
# code...
?>
<label class="badge badge-secondary text-warning"><?php echo "10";?></lable>
<?php }?>
</td>
<td>
<?php echo $res['book_case_id'];?><?php echo $res['c_row'];?><?php echo $res['c_column'];?>
</td>
<td>
<?php echo $res['faculty_name'];?>
</td>
<td>
<?php echo $res['department_name'];?>
</td>
<td>
<div class="btn-group dropdown">
<a href="javascript: void(0);" class="dropdown-toggle arrow-none btn btn-light btn-sm" data-toggle="dropdown" aria-expanded="false"><i class="mdi mdi-dots-horizontal"></i></a>
<div class="dropdown-menu dropdown-menu-right">
<a class="dropdown-item" href="edit_book?book_id=<?php echo $res['book_id'];?>"><i class="mdi mdi-pencil mr-1 text-muted"></i>Edit</a>
<?php if($_SESSION['role'] ==0){?>
<input type="hidden" name="" class="delete_id_value" value="<?php echo $res['book_id'];?>">
<a class="dropdown-item delete_btn_ajax" href="javascript: void(0);"><i class="mdi mdi-delete mr-1 text-muted"></i>Remove</a>
<?php }?>
</div>
</div>
</td>
</tr>
<?php
}
?>
</tbody>
</table>
<input type="hidden" name="barcodeType" value="code128" <?php echo (@$_POST['barcodeType'] == 'code128' ? 'selected="selected"' : ''); ?>>
<input type="hidden" name="barcodeDisplay" value="horizontal" <?php echo (@$_POST['barcodeDisplay'] == 'horizontal' ? 'selected="selected"' : ''); ?>>
<input type="hidden" name="barcodeSize" id="barcodeSize" value="20">
<input type="hidden" name="printText" id="printText" value="true"><br>
<button type="submit" class="btn btn-info float-right" name="generateBarcode" >Generate Barcode</button>
</form>
<?php
}else{?>
<div class="alert alert-success alert-dismissible text-center">
<h6> Hops! No Record Found</h6>
</div>
<?php }
}else{
?>
<div class="mt-4">
<div class="alert alert-warning alert-dismissible text-center">
<b class="">Search Data To Show Record.!</b>
</div>
</div>
<?php
}
?>
</div>
</div>
</div>
</div>
</div>
<!-- end row -->
<script src="js/jquery-3.4.1.js" charset="utf-8"></script>
<script>
$(document).ready(function(){
$('.delete_btn_ajax').click(function (e){
e.preventDefault();
var deleteid = $(this).closest("tr").find('.delete_id_value').val();
console.log(deleteid);
swal({
title: "Are you sure?",
text: "Once deleted, you will not be able to recover this Data!",
icon: "warning",
buttons: true,
dangerMode: true,
})
.then((willDelete) => {
if (willDelete) {
$.ajax({
type: "POST",
url: "add_book_insert_code.php",
data: {
"delete_btn_set": 1,
"delete_id": deleteid,
},
success: function (response){
swal("Data Deleted Successfully.!", {
icon: "success",
}).then((result) => {
location.reload();
});
}
});
}
});
});
});
</script>
<!-- alert auto dismiss code -->
<script src="js/jquery-3.4.1.js" charset="utf-8"></script>
<script>
$(document).ready(function(){
setTimeout(function() {
$('.auto-close').fadeOut('slow');
}, 2000);
});
</script>
<script>
$(document).ready(function() {
$("#select-all").click (function () {
$(" input[type='checkbox']").prop('checked',this.checked);
});
$(".checkitem").change(function () {
if($(this).prop("checked")==false){
$("#select-all").prop("checked", false)
}
if($(".checkitem:checked").length == $(".checkitem").length){
$("#select-all").prop("checked", true)
}
});
});
</script>
<?php
$section = ob_get_contents();
ob_end_clean();
include_once("master_page.php");
?>