-
Notifications
You must be signed in to change notification settings - Fork 7
/
dashboard.php
160 lines (130 loc) · 3.76 KB
/
dashboard.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
<?php
//dashboard.php
include('class/Appointment.php');
$object = new Appointment;
include('header.php');
?>
<div class="container-fluid">
<?php
include('navbar.php');
?>
<br />
<div class="card">
<div class="card-header"><h4>Doctor Schedule List</h4></div>
<div class="card-body">
<div class="table-responsive">
<table class="table table-striped table-bordered" id="appointment_list_table">
<thead>
<tr>
<th>Doctor Name</th>
<th>Education</th>
<th>Speciality</th>
<th>Appointment Date</th>
<th>Appointment Day</th>
<th>Available Time</th>
<th>Action</th>
</tr>
</thead>
<tbody></tbody>
</table>
</div>
</div>
</div>
</div>
</div>
<?php
include('footer.php');
?>
<div id="appointmentModal" class="modal fade">
<div class="modal-dialog">
<form method="post" id="appointment_form">
<div class="modal-content">
<div class="modal-header">
<h4 class="modal-title" id="modal_title">Make Appointment</h4>
<button type="button" class="close" data-dismiss="modal">×</button>
</div>
<div class="modal-body">
<span id="form_message"></span>
<div id="appointment_detail"></div>
<div class="form-group">
<label><b>Reason for Appointment</b></label>
<textarea name="reason_for_appointment" id="reason_for_appointment" class="form-control" required rows="5"></textarea>
</div>
</div>
<div class="modal-footer">
<input type="hidden" name="hidden_doctor_id" id="hidden_doctor_id" />
<input type="hidden" name="hidden_doctor_schedule_id" id="hidden_doctor_schedule_id" />
<input type="hidden" name="action" id="action" value="book_appointment" />
<input type="submit" name="submit" id="submit_button" class="btn btn-success" value="Book" />
<button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
</div>
</div>
</form>
</div>
</div>
<script>
$(document).ready(function(){
var dataTable = $('#appointment_list_table').DataTable({
"processing" : true,
"serverSide" : true,
"order" : [],
"ajax" : {
url:"action.php",
type:"POST",
data:{action:'fetch_schedule'}
},
"columnDefs":[
{
"targets":[6],
"orderable":false,
},
],
});
$(document).on('click', '.get_appointment', function(){
var doctor_schedule_id = $(this).data('doctor_schedule_id');
var doctor_id = $(this).data('doctor_id');
$.ajax({
url:"action.php",
method:"POST",
data:{action:'make_appointment', doctor_schedule_id:doctor_schedule_id},
success:function(data)
{
$('#appointmentModal').modal('show');
$('#hidden_doctor_id').val(doctor_id);
$('#hidden_doctor_schedule_id').val(doctor_schedule_id);
$('#appointment_detail').html(data);
}
});
});
$('#appointment_form').parsley();
$('#appointment_form').on('submit', function(event){
event.preventDefault();
if($('#appointment_form').parsley().isValid())
{
$.ajax({
url:"action.php",
method:"POST",
data:$(this).serialize(),
dataType:"json",
beforeSend:function(){
$('#submit_button').attr('disabled', 'disabled');
$('#submit_button').val('wait...');
},
success:function(data)
{
$('#submit_button').attr('disabled', false);
$('#submit_button').val('Book');
if(data.error != '')
{
$('#form_message').html(data.error);
}
else
{
window.location.href="appointment.php";
}
}
})
}
})
});
</script>