-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.php
255 lines (207 loc) · 10.3 KB
/
index.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
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
<?php //starting session
session_start();
if(isset($_SESSION['loggedin'])==true)
{ ?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Healthcare</title>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css"
integrity="sha384-Gn5384xqQ1aoWXA+058RXPxPg6fy4IWvTNh0E263XmFcJlSAwiGgFAW/dAiS6JXm" crossorigin="anonymous">
</head>
<body>
<nav class="navbar navbar-expand-md navbar-dark bg-dark">
<div class="navbar-collapse collapse w-100 order-1 order-md-0 dual-collapse2">
<span class="navbar-brand mb-0 h1">Hospital</span>
</div>
<!-- <div class="mx-auto order-0">
<a class="navbar-brand mx-auto" href="#">Navbar 2</a>
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target=".dual-collapse2">
<span class="navbar-toggler-icon"></span>
</button>
</div> -->
<div class="navbar-collapse collapse w-100 order-3 dual-collapse2">
<ul class="navbar-nav ml-auto">
<li class="nav-item">
<a class="nav-link" href="search.php">Search</a>
</li>
<li class="nav-item">
<a class="nav-link" href="createPharma.php">Create Pharmacy</a>
</li>
<li class="nav-item">
<a class="nav-link" href="createBloodBank.php">Create Blood Bank</a>
</li>
<li class="nav-item">
<a class="nav-link" href="createAmbulance.php">Create Ambulance</a>
</li>
<li class="nav-item">
<a class="nav-link" href="chat.php">Ambulance</a>
</li>
<?php if($_SESSION['loggedin']==true){ ?>
<li class="nav-item">
<a class="nav-link" href="logout.php">Logout</a>
</li><?php }else{}?>
</ul>
</div>
</nav>
<?php $name="";
$name= $_SESSION['userDetails']['name']; ?>
<div class="main-content-inner">
<div class="row">
<!-- Contextual Classes start -->
<div class="col-lg-6 mt-5" style="margin-left:26em;">
<div >
<div class="card-body" style="text-align:center;">
<u> <h4 style="text-align:center" class="header-title">Vaccine Supplies</h4></u>
<div class="single-table">
<div class="table-responsive">
<table class="table table-bordered">
<thead class="text-uppercase">
<tr class="table-active">
<th scope="col">ID</th>
<th scope="col">Name</th>
<th scope="col">Price</th>
<th scope="col">Quantity</th>
<!-- <th scope="col">Action</th> -->
</tr>
</thead>
<tbody>
<?php
$conn = new mysqli("localhost","root","","electrothon");
$sql = "SELECT * FROM resources WHERE name='$name' && type='vaccine' ";
$result = $conn->query($sql);
$count=0;
if ($result -> num_rows > 0) {
while ($row = $result->fetch_assoc())
{
$count=$count+1;
$quan=$row["quantity"];
?>
<tr <?php if($quan<=50){?>class="table-danger"<?php }else{?>class="table-success"<?php } ?>>
<th><?php echo $count ?></th>
<th><?php echo $row["rname"] ?></th>
<th><?php echo $row["price"] ?></th>
<th><?php echo $row["quantity"] ?></th>
<!-- <th> <a href="up" Edit</a> <a
href="edit.php?id=<?php echo $row["product_id"] ?>">Edit</a>
<a href="up" Edit</a> <a
href="delete.php?id=<?php echo $row["product_id"] ?>">Delete</a>
</th> -->
</tr>
<?php
}
}
?>
</tbody>
</table>
</div>
</div>
</div>
<div class="card-body" style="text-align:center;">
<u> <h4 style="text-align:center" class="header-title">Medicine Supplies</h4></u>
<div class="single-table">
<div class="table-responsive">
<table class="table table-bordered">
<thead class="text-uppercase">
<tr class="table-active">
<th scope="col">ID</th>
<th scope="col">Name</th>
<th scope="col">Price</th>
<th scope="col">Quantity</th>
<!-- <th scope="col">Action</th> -->
</tr>
</thead>
<tbody>
<?php
$conn = new mysqli("localhost","root","","electrothon");
$sql = "SELECT * FROM resources WHERE name='$name' && type='medicine' ";
$result = $conn->query($sql);
$count=0;
if ($result -> num_rows > 0) {
while ($row = $result->fetch_assoc())
{
$count=$count+1;
$quan=$row["quantity"];
?>
<tr <?php if($quan<=50){?>class="table-danger"<?php }else{?>class="table-success"<?php } ?>>
<th><?php echo $count ?></th>
<th><?php echo $row["rname"] ?></th>
<th><?php echo $row["price"] ?></th>
<th><?php echo $row["quantity"] ?></th>
<!-- <th> <a href="up" Edit</a> <a
href="edit.php?id=<?php echo $row["product_id"] ?>">Edit</a>
<a href="up" Edit</a> <a
href="delete.php?id=<?php echo $row["product_id"] ?>">Delete</a>
</th> -->
</tr>
<?php
}
}
?>
</tbody>
</table>
</div>
</div>
</div>
<div class="card-body" style="text-align:center;">
<u> <h4 style="text-align:center" class="header-title">Blood Bank Supplies</h4></u>
<div class="single-table">
<div class="table-responsive">
<table class="table table-bordered">
<thead class="text-uppercase">
<tr class="table-active">
<th scope="col">ID</th>
<th scope="col">Name</th>
<th scope="col">Quantity</th>
<!-- <th scope="col">Action</th> -->
</tr>
</thead>
<tbody>
<?php
$conn = new mysqli("localhost","root","","electrothon");
$sql = "SELECT * FROM resources WHERE name='$name' && type='blood'";
$result = $conn->query($sql);
$count=0;
if ($result -> num_rows > 0) {
while ($row = $result->fetch_assoc())
{
$count=$count+1;
$quan=$row["quantity"];
?>
<tr <?php if($quan<=50){?>class="table-danger"<?php }else{?>class="table-success"<?php } ?>>
<th><?php echo $count ?></th>
<th><?php echo $row["rname"] ?></th>
<th><?php echo $row["quantity"] ?></th>
<!-- <th> <a href="up" Edit</a> <a
href="edit.php?id=<?php echo $row["product_id"] ?>">Edit</a>
<a href="up" Edit</a> <a
href="delete.php?id=<?php echo $row["product_id"] ?>">Delete</a>
</th> -->
</tr>
<?php
}
}
?>
</tbody>
</table>
</div>
</div>
</div>
</div>
</div>
</div>
<script src="https://code.jquery.com/jquery-3.2.1.slim.min.js"
integrity="sha384-KJ3o2DKtIkvYIK3UENzmM7KCkRr/rE9/Qpg6aAZGJwFDMVNA/GpGFF93hXpG5KkN" crossorigin="anonymous">
</script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.12.9/umd/popper.min.js"
integrity="sha384-ApNbgh9B+Y1QKtv3Rn7W3mgPxhU9K/ScQsAP7hUibX39j7fakFPskvXusvfa0b4Q" crossorigin="anonymous">
</script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/js/bootstrap.min.js"
integrity="sha384-JZR6Spejh4U02d8jOt6vLEHfe/JQGiRRSQQxSfFWpi1MquVdAyjUar5+76PVCmYl" crossorigin="anonymous">
</script>
</body>
<?php }else{ header ("Location: login.php"); } ?>
</html>