-
Notifications
You must be signed in to change notification settings - Fork 0
/
editBorrowIssue.php
137 lines (120 loc) · 6.93 KB
/
editBorrowIssue.php
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
<?php $title = 'Book Management';?>
<?php include 'includes/headlink.php';?>
<body>
<?php include 'includes/sidebar.php';?>
<?php include 'includes/navbar.php';?>
<div class="main_section">
<!-- <h4 class="text-center pt-4 font-weight-bold">Books</h4>-->
<div class="container">
<div class="row">
<!-- <a href="borrowIssueList.php?activePage=borrowIssueList" class="btn btn-success mt-4 mb-2 border-0 rounded-0">Borrow Issue List</a> -->
<form class="d-block mx-auto border col-12 mt-1 mb-5 pl-5 pr-55 m-height200" action="action/manageBorrowAction.php" method="post">
<h4 class="d-block text-center p-4 font-weight-bold">Borrow Issue Details</h4>
<?php
if (isset($_SESSION['alert']))
{
echo "<span class='d-block text-center alert alert-danger ' role='alert'>".$_SESSION['alert']."<button type='button' class='close' data-dismiss='alert' aria-label='Close'> <span aria-hidden='true'>×</span>
</button></span>";
}
unset($_SESSION['alert']);
if(isset($_GET['issue_id'])) {
$issue_id = $_GET['issue_id'];
$query = "SELECT * from borrow where status=1 and id=$issue_id";
$row = $conn->query($query);
if ($row->num_rows > 0) {
$obj = $row->fetch_object();
$book_id = $obj->book_id;
$std_tbl_id = $obj->student_id;
$copies = $obj->copies;
$date = $obj->borrow_date;
}
else {
$book_id = '';
$std_tbl_id = '';
$copies = '';
}
}
?>
<div class="form-group row">
<label class="col-md-3 col-form-label-sm text-right">Book Name</label>
<div class="col-md-9">
<!-- <input type="text" name="name" class="form-control" placeholder="Enter Name" required> -->
<select name="book_id" class="form-control" required>
<option value="">Select</option>
<?php
$query = "SELECT id,book_name,isbn from books where active_status=1";
$row = $conn->query($query);
if ($row->num_rows > 0) {
while ($data = $row->fetch_assoc()) {
$id = $data['id'];
$book_name = $data['book_name'];
$isbn = $data['isbn'];
if ($isbn == 0) {$isbn = '';}
else{
$isbn = "(".$isbn.")";
}
if ($book_id == $id) {
$selected_book = 'selected';
}
else {
$selected_book = '';
}
?>
<option value="<?=$id?>" <?=$selected_book?>><?php echo "$book_name $isbn"?></option>
<?php }
}
?>
</select>
</div>
</div>
<div class="form-group row">
<label class="col-md-3 col-form-label-sm text-right">Borrow By (Student Name)</label>
<div class="col-md-9">
<select name="std_id" class="form-control" required>
<option value="">Select</option>
<?php $query = "SELECT id,name,student_id from student where active_status=1";
$row = $conn->query($query);
if ($row->num_rows > 0) {
while ($data = $row->fetch_assoc()) {
$id = $data['id'];
$student_name = $data['name'];
$student_id = $data['student_id'];
if ($std_tbl_id == $id) {
$selected_student = 'selected';
}
else {
$selected_student = '';
}
?>
<option value="<?=$id?>" <?=$selected_student?>><?php echo "$student_name ($student_id)"?></option>
<?php }
}
?>
</select>
</div>
</div>
<div class="form-group row">
<label class="col-md-3 col-form-label-sm text-right">Number of Copies</label>
<div class="col-md-9">
<input type="hidden" name="prev_copy" value="<?=$copies?>">
<input type="number" value="<?=$copies?>" min="1" max="3" name="stock" class="form-control" placeholder="Copy of books" required>
</div>
</div>
<div class="form-group row">
<label class="col-md-3 col-form-label-sm text-right">Issue Date</label>
<div class="col-md-9 input-group date">
<input type="text" class="datepicker" value="<?=date("$date")?>" class="form-control" name="borrow_date">
</div>
</div>
<div class="form-group row">
<div class="col-md-12 text-center">
<button type="submit" name="update" class="btn btn-primary">Submit</button>
</div>
</div>
</form>
</div>
</div>
</div>
<?php include 'includes/footer_link.php';?>
</body>
<html>