-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathclinicdetails.php
442 lines (417 loc) · 19.9 KB
/
clinicdetails.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
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
<!doctype html>
<head>
<meta charset="utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Clinic Information Homepage</title>
<!-- Mobile viewport optimized: h5bp.com/viewport -->
<meta name="viewport" content="width=device-width" />
<!-- Style Sheet-->
<link href="http://fonts.googleapis.com/css?family=Dosis:200,300,400,500,600,700,800" rel="stylesheet" type="text/css" />
<link rel="stylesheet" type="text/css" href="css/clinicinfo.css" />
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.2.6/jquery.min.js" type="text/javascript"></script>
<script src="js/selectclinic.js"></script>
<script src="/jquery/jquery-1.11.1.min.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
<link rel="stylesheet" href="//cdnjs.cloudflare.com/ajax/libs/timepicker/1.3.5/jquery.timepicker.min.css">
<script>
$(document).ready(function(){
$(".cn").hide();
$(".picanddes").hide();
$(".basicinfo2").hide();
$("#schedulingtime2").hide();
$(".hide1").click(function(){
$(".pic_title_map").hide();
$(".clinic_intro").hide();
$(".picanddes").show();
});
$(".hide2").click(function(){
$(".basicinfo").hide();
$("iframe").hide();
$(".basicinfo2").show();
});
$(".hide3").click(function(){
$(".time_table").hide();
$("#schedulingtime2").show();
})
$('.timepicker').timepicker({
timeFormat: 'HH:mm:ss',
interval: 30,
minTime: '06:00:00',
maxTime: '20:00:00',
dynamic: true,
dropdown: true,
scrollbar: true
});
if(document.cookie=="")
{
alert("Please login to your account");
window.location='./login.html';
}
else
{
var strCookie=document.cookie;
//将多cookie切割为多个名/值对
var arrCookie=strCookie.split("; ");
var arrCookieUserName= arrCookie[0].split("=");
var arrCookieUserAuthority= arrCookie[1].split("=");
var UserName=arrCookieUserName[1];
var UserAuthority=arrCookieUserAuthority[1];
//alert(UserName+UserAuthority);
$("#name").text("Welcome "+UserName);
};
if(UserAuthority!="owner"&&UserAuthority!="manager")
{
$(".hide1").hide();
$(".hide2").hide();
$(".hide3").hide();
$(".deletebutton").hide();
}
});
</script>
</head>
<body>
<script src="//cdnjs.cloudflare.com/ajax/libs/timepicker/1.3.5/jquery.timepicker.min.js"></script>
<div class="container">
<!--SIDEBAR-->
<aside id="sidebar">
<!--logo-->
<p id="name" style="color:white;font-size:20px;margin-left:40px;margin-top:60px;"></p>
<a href="#" class="logo"><img src="pic/logo2.png" alt="logo" /></a>
<!--main-menu-->
<nav class="main-nav">
<ul>
<li><a href="homepage.html">Homepage</a></li>
<li class="active"><a href="clinicinfohomepage.php">Clinic Info</a></li>
<li><a href="petview.php?page=1">Pet Info</a></li>
<li><a href="petowner.php">Petowner Info</a></li>
<li><a href="appointmentinfo.html">Appointment Info</a></li>
<li><a href="treatmentinfo.php?page=1">Treatment Info</a></li>
<li><a href="treatmentrecord.php">Treatment Record</a></li>
<li><a href="staffinfo.php">Staff Info</a></li>
</ul>
</nav>
</aside>
<!--CONTENT-->
<section id="content">
<!--header-->
<header>
<h1>Clinic Management</h1>
</header>
<!--main-->
<div class="main">
<div class="page">
<div class="clinicname" style="margin-left:20%">
<table class="clinic_table">
<?php
$clinicname = $_POST['clinicname'];
?>
<?php
function fill_brand($con)
{
$query7 = mysql_query("SELECT * FROM clinic WHERE ClinicName='$_POST[clinicname]'");
while($run2 = mysql_fetch_array($query7)){
$query8 = mysql_query("SELECT * FROM staff WHERE WorkingClinicID ='". $run2['ClinicID'] . "' AND StaffPosition = 'Doctor'");
while($row2 = mysql_fetch_array($query8)){
echo "<option value='".$row2['StaffName']."'>".$row2['StaffName']."</option>";
}
}
}
error_reporting(0);
echo '<table>';
$con = mysql_connect('localhost', 'root');
//these are the aforementioned vars
$db = mysql_select_db('399lovelypets');
if(isset($_POST['update'])){
$UpdateQuery = "UPDATE docschedule SET MondayM = '$_POST[mm]', MondayA = '$_POST[ma]', TuesdayM = '$_POST[tm]', TuesdayA = '$_POST[ta]', WednesdayM = '$_POST[wm]', WednesdayA = '$_POST[wa]', ThursdayM = '$_POST[thm]', ThursdayA = '$_POST[tha]', FridayM = '$_POST[fm]', FridayA = '$_POST[fa]' WHERE docschedule.ClinicID = '$_POST[hidden]'";
mysql_query($UpdateQuery, $con);
};
if(isset($_POST['update2'])){
$UpdateQuery2 = "UPDATE clinic SET ClinicPhoto = '$_POST[photo]', ClinicDescription = '$_POST[des]', ClinicName='$_POST[clinicname]' WHERE ClinicID = '$_POST[hidden]'";
mysql_query($UpdateQuery2, $con);
};
if(isset($_POST['update3'])){
$UpdateQuery3 = "UPDATE clinic SET ClinicPhoneNumber = '$_POST[pn]', ClinicEmergencyContact = '$_POST[ec]', OpenTime = '$_POST[ot]', CloseTime = '$_POST[ct]', ClinicLocation = '$_POST[lo]', AddressLink = '$_POST[al]', ClinicName='$_POST[clinicname]' WHERE ClinicID = '$_POST[hidden]'";
mysql_query($UpdateQuery3, $con);
};
if(isset($_POST['delete'])){
$DeleteQuery = "DELETE FROM clinic WHERE ClinicName = '$clinicname'";
mysql_query($DeleteQuery, $con);
SUBMISSION();
}
function SUBMISSION(){
echo"<script type=\"text/javascript\">document.location.href='./clinicinfohomepage.php';</script>";
$CON->CLOSE();
}
$query = mysql_query("SELECT * FROM clinic WHERE ClinicName = '$_POST[clinicname]'");
while($row = mysql_fetch_array($query))
{
echo "<div class='pic_title_map'>
<img class='clinic_pic' src='" . $row['ClinicPhoto'] . "' width='160' height='160' />";
echo "<table class='clinic_intro' width='270'>";
echo "<tr>";
echo "<td style='font-size:25px; padding-bottom:40px'>" . $row['ClinicName'] . "</td>";
echo "<form method='POST'>";
echo "<td>" . "<input class=deletebutton type=submit name=delete value=delete" . " </td>";
echo "<input type='hidden' name='clinicname' value='" . $row['ClinicName'] . "' />";
echo "</form>";
echo "</tr>";
echo "<tr>";
echo "<td height='70' style='color:black'>" . $row['ClinicDescription'] . "</td>";
echo "<td><input type='button' name='hide1' class='hide1' style='background:url(pic/edit.png); border:none; width:22px; height:22px; background-repeat: no-repeat;'/></td>";
echo "</tr>";
echo "</table>";
?>
<form method="post">
<table class="picanddes">
<tr>
<td class="basictitle">Photo And Description
<input type="submit" name="update2" value="Update" />
</td>
</tr>
<tr>
<td><br>Clinic Photo Link</td>
</tr>
<tr>
<td><input style="width:80%" type="text" name="photo" value="<?php echo $row['ClinicPhoto'];?>" /></td>
</tr>
<tr>
<td><br>Clinic Description</td>
</tr>
<tr>
<td><textarea style="height:90px; width:80%" type="text" name="des" value="des"><?php echo $row['ClinicDescription'];?></textarea></td>
<td><input type="hidden" name="hidden" value="<?php echo $row['ClinicID'];?>" />
<input class="cn" type="text" name="clinicname" value="<?php echo $row['ClinicName']?>" />
</td>
</tr>
</table>
<?php
echo "<table class='basicinfo'>";
echo "<tr height='55'><td class='basictitle'><br>Basic Information <input type='button' name='hide2' class='hide2' style='background:url(pic/edit.png); border:none; width:22px; height:22px; background-repeat: no-repeat;'/><td></tr>";
echo "<tr class='timeaddress'><td><br>Phone Number: " . $row['ClinicPhoneNumber'] . "</td></tr>";
echo "<tr class='timeaddress'><td><br>Emergency Contact Number: " . $row['ClinicEmergencyContact'] . "</td></tr>";
echo "<tr class='timeaddress'><td><br>Opening time: " . $row['OpenTime'] . "</td></tr>";
echo "<tr class='timeaddress'><td> <br>Closing time: " .$row['CloseTime'] . "</td></tr>";
echo "<tr>";
echo "<td class='timeaddress'><br>Address: " . $row['ClinicLocation'] . "</td></tr>";
echo '</table>';
echo '<iframe src="' . $row['AddressLink'] . '" width=60% height="200" frameborder="0" style="border:0" allowfullscreen></iframe>';
?>
<table class='basicinfo2'>
<tr height='55'>
<td class='basictitle'><br>Basic Information <input type="submit" name="update3" value="Update" /><td>
</tr>
<tr class='timeaddress'>
<td>
<br>
<tr class='timeaddress'>
<td><br>Phone Number: <input type="text" name="pn" value="<?php echo $row['ClinicPhoneNumber']?>" /></td>
</tr>
<tr class='timeaddress'>
<td><br>Emergency Contact Number: <input type="text" name="ec" value="<?php echo $row['ClinicEmergencyContact'];?>" /></td>
</tr>
<tr class='timeaddress'>
<td><br>Opening time: <input type="text" name="ot" class="timepicker" value="<?php echo $row['OpenTime'];?>" /></td>
</tr>
<tr class='timeaddress'><td><br>Closing time: <input type="text" name="ct" class="timepicker" value="<?php echo $row['CloseTime'];?>" /></td>
</tr>
<tr>
<td class='timeaddress'><br>Address: <input type="text" name="lo" value="<?php echo $row['ClinicLocation'];?>" /></td>
</td>
</tr>
<tr>
<td class='timeaddress'><br><a href="https://www.google.com.au/maps" target="_blank">Address link:</a> <input style="width:300px" type="text" name="al" value="<?php echo $row['AddressLink'];?>" /></td>
</tr>
</table>
<table class="schedulingtime">
<tr>
<td class="basictitle">Scheduling time
<input type='button' name='hide3' class='hide3' style="background:url(pic/edit.png); border:none; width:22px; height:22px; background-repeat: no-repeat;"/>
</td>
</tr>
</table>
<table border="0" align="left" cellpadding="0" cellspacing="0" class="time_table">
<tr>
<td></td>
<td>Monday</td>
<td>Tuesday</td>
<td>Wednesday</td>
<td>Thursday</td>
<td>Friday</td>
</tr>
<tr>
<td>Morning Shift <?php echo $row['OpenTime'];?><br>-12:00:00</td>
<?php
}
?>
<?php
$query3= mysql_query("SELECT * FROM clinic WHERE ClinicName='$_POST[clinicname]'");
while($run = mysql_fetch_array($query3)){
$query4 = mysql_query("SELECT * FROM docschedule WHERE ClinicID ='". $run['ClinicID'] . "'");
while($row = mysql_fetch_array($query4)){
echo "<td>" . $row['MondayM'] . "</td>";
echo "<td>" . $row['TuesdayM'] . "</td>";
echo "<td>" . $row['WednesdayM'] . "</td>";
echo "<td>" . $row['ThursdayM'] . "</td>";
echo "<td>" . $row['FridayM'] . "</td>";
}
}
?>
</tr>
<tr>
<?php $query9 = mysql_query("SELECT * FROM clinic WHERE ClinicName = '$_POST[clinicname]'");
while($row3 = mysql_fetch_array($query9))
{
?>
<td>Afternoon Shift 12:00:00<br>-<?php echo $row3['CloseTime'];?></td>
<?php
}
?>
<?php
$query5= mysql_query("SELECT * FROM clinic WHERE ClinicName='$_POST[clinicname]'");
while($run = mysql_fetch_array($query5)){
$query6 = mysql_query("SELECT * FROM docschedule WHERE ClinicID ='". $run['ClinicID'] . "'");
while($row = mysql_fetch_array($query6)){
echo "<td>" . $row['MondayA'] . "</td>";
echo "<td>" . $row['TuesdayA'] . "</td>";
echo "<td>" . $row['WednesdayA'] . "</td>";
echo "<td>" . $row['ThursdayA'] . "</td>";
echo "<td>" . $row['FridayA'] . "</td>";
}
}
?>
</tr>
</table>
<table border='0' align='left' cellpadding='0' cellspacing='0' class='time_table' id="schedulingtime2">
<tr>
<td>
<input type='submit' name='update' value='Update' />
<input type=hidden name=hidden2 value="<?php echo $id ;?>" /></td>
<td>Monday</td>
<td>Tuesday</td>
<td>Wednesday</td>
<td>Thursday</td>
<td>Friday</td>
</tr>
<tr>
<?php $query10 = mysql_query("SELECT * FROM clinic WHERE ClinicName = '$_POST[clinicname]'");
while($row4 = mysql_fetch_array($query10))
{
?>
<td>Morning Shift <?php echo $row4['OpenTime'];?><br>-12:00:00</td>
<?php
}
?>
<td>
<select name="mm" value="mm" class='textbox'>
<option value="">Name</option>
<?php echo fill_brand($con);?>
</select>
</td>
<td>
<select name="tm" value="tm" class='textbox'>
<option value="">Name</option>
<?php echo fill_brand($con);?>
</select>
</td>
<td>
<select name="wm" value="wm" class='textbox'>
<option value="">Name</option>
<?php echo fill_brand($con);?>
</select>
</td>
<td>
<select name="thm" value="thm" class='textbox'>
<option value="">Name</option>
<?php echo fill_brand($con);?>
</select>
</td>
<td>
<select name="fm" value="fm" class='textbox'>
<option value="">Name</option>
<?php echo fill_brand($con);?>
</select>
</td>
</tr>
<tr>
<?php $query11 = mysql_query("SELECT * FROM clinic WHERE ClinicName = '$_POST[clinicname]'");
while($row5 = mysql_fetch_array($query11))
{
?>
<td>Afternoon Shift 12:00:00<br>-<?php echo $row5['CloseTime'];?></td>
<?php
}
?>
<td>
<select name="ma" value="ma" class='textbox'>
<option value="">Name</option>
<?php echo fill_brand($con);?>
</select>
</td>
<td>
<select name="ta" value="ta" class='textbox'>
<option value="">Name</option>
<?php echo fill_brand($con);?>
</select>
</td>
<td>
<select name="wa" value="wa" class='textbox'>
<option value="">Name</option>
<?php echo fill_brand($con);?>
</select>
</td>
<td>
<select name="tha" value="tha" class='textbox'>
<option value="">Name</option>
<?php echo fill_brand($con);?>
</select>
</td>
<td>
<select name="fa" value="fa" class='textbox'>
<option value="">Name</option>
<?php echo fill_brand($con);?>
</select>
</td>
</tr>
</table>
<table class="schedulingtime3">
<tr>
<td class="basictitle">
<a class="staffinformation" href="Staffinfo.php">Staff information</a>
</td>
</tr>
</table>
<table border="0" align="left" cellpadding="0" cellspacing="0" class="staff_info">
<tr>
<td>ID</td>
<td>Name</td>
<td>Phone</td>
<td>E-mail</td>
</tr>
<?php
$query1 = mysql_query("SELECT * FROM clinic WHERE ClinicName='$_POST[clinicname]'");
while($run = mysql_fetch_array($query1)){
$query2 = mysql_query("SELECT * FROM staff WHERE WorkingClinicID ='". $run['ClinicID'] . "'");
while($row = mysql_fetch_array($query2)){
$id = $row['StaffID'];
$name = $row['StaffName'];
$num = $row['StaffPhoneNumber'];
$email = $row['StaffEmail'];
echo '<tr><td>' . $id . '</td>';
echo '<td>' . $name . '</td>';
echo '<td>' . $num . '</td>';
echo '<td>' . $email . '</td>';
}
}
mysql_close($con);
?>
</table>
</form>
</table>
</div>
</div>
</div>
</section>
</div>
</body>
</html>