-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathadmin-add-schedule.php
165 lines (125 loc) Β· 4.66 KB
/
admin-add-schedule.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
<?php include_once('session-active.php'); ?>
<?php include_once('../../service/admin_service.php');?>
<!--dashboard options -->
<?php include("admindashboard.php");?>
<title>index</title>
<style>
input[type=text], select {
width: 100%;
padding: 8px 15px;
margin: 2px 0;
border: 1px solid #ccc;
border-radius: 4px;
}
input[type=submit] {
width: 100%;
background-color: #4CAF50;
color: white;
padding: 10px 20px;
margin: 8px 0;
border: none;
border-radius: 4px;
cursor: pointer;
}
input[type=submit]:hover {
background-color: #45a049;
}
div #regdiv{
align: center;
border-radius: 4px;
background-color: #ECEDED;
padding: 20px;
width: 360px;
margin-left: 250px;
}
</style>
<hr style="color:red;" />
<div id="main" align="center">
<div id="Registration">
<h3 style="color:blue;">ADD DOCTOR SCHDULE</h3>
<hr style="color:red" />
</div>
</div>
<div id="regdiv">
<div align="center">
<h3 style="color:#4CAF50">Add New Schedule</h3>
<hr/>
</div>
<?php
$errormsg1="";
$errormsg2="";
if(isset($_POST['submitbtn'])){
$doctor_id=$_POST['doctor_select'];
$appoint_date=$_POST['date'];
$appoint_time=$_POST['time'];
$status=$_POST['status'];
if($doctor_id =="Select doctor" && empty($appoint_date)){
$errormsg1="Select doctor";
$errormsg2="Enter date";
}
else if($doctor_id!="Select doctor" && empty($appoint_date)){
$errormsg2="Enter date";
}
else if($doctor_id =="Select doctor" && !empty($appoint_date)){
$errormsg1="Select doctor";
}
else{
$date=$appoint_date;
if(preg_match("/^[0-9]{4}-(0[1-9]|1[0-2])-(0[1-9]|[1-2][0-9]|3[0-1])$/",$date)){
$opening_date = new DateTime($date);
$current_date = new DateTime();
if ($opening_date >= $current_date){
//to do
add_schedule($doctor_id,$appoint_date,$appoint_time,$status);
echo '<div align="center">
<label style="color:green">Schedule Successfully Added</label>
</div>';
}
else{
echo '<div align="center">
<label style="color:red">Please enter a future date</label>
</div>';
}
}
else{
$errormsg2="Invalid date";
}
}
}
?>
<form method="post" action="admin-add-schedule.php">
<label>Select Doctor<span style="color:red">*</span></label>
<select id="doctor_select" name="doctor_select">
<option>Select doctor</option>
<?php
$result = get_all_doctor();
while($row = mysqli_fetch_assoc($result)){
echo '<option value="'.$row['id'].'">'.$row['first_name'].'</option>';
}
?>
</select><span style="color:red"><?=$errormsg1?></span><br/>
<label>Date<span style="color:red">*</span></label>
<input type="text" id="date" name="date" placeholder="yyyy-mm-dd">
<span style="color:red"><?=$errormsg2?></span><br/>
<label>Time<span style="color:red">*</span></label>
<select id="time" name="time">
<option>9:00 am</option>
<option>10:00 am</option>
<option>11:00 am</option>
<option>12:00 pm</option>
<option>1:00 pm</option>
<option>3:00 pm</option>
<option>4:00 pm</option>
<option>5:00 pm</option>
<option>6:00 pm</option>
</select>
<label>Status</label>
<select id="status" name="status">
<option value="available">available</option>
<option value="not available">not available</option>
</select>
<input type="submit" id="submitbtn" name="submitbtn" value="Add Schedule">
</form>
</div>
<!--Bottom options -->
<?php //include("bottomfotor.php");?>