Skip to content

Commit 9fe57f0

Browse files
resolved merge conflict
2 parents 9b3190d + d4d4a00 commit 9fe57f0

File tree

1 file changed

+119
-74
lines changed

1 file changed

+119
-74
lines changed
Lines changed: 119 additions & 74 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,10 @@
11
{% load static %}
22
{% block appointment %}
33
{% comment %}the main tab starts here {% endcomment %}
4-
54
<div class="ui pointing secondary menu">
65
<a class="active item" data-tab="doctorappointment">
76
Doctor Apppointment
87
</a>
9-
108
<a class="item" data-tab="ambulancerequest">
119
Ambulance Request
1210
</a>
@@ -28,117 +26,165 @@
2826
<div class="field">
2927
<label>Date of Appointment</label>
3028
<!-- on selection of doctor few days should be displayed -->
31-
32-
<input type="date" id="inputdate" name="inputdate">
33-
<script>
34-
$(function(){
35-
var dtToday = new Date();
36-
var month = dtToday.getMonth() + 1;
37-
var day = dtToday.getDate();
38-
var year = dtToday.getFullYear();
39-
if(month < 10)
40-
month = '0' + month.toString();
41-
if(day < 10)
42-
day = '0' + day.toString();
43-
var maxDate = year + '-' + month + '-' + day;
44-
$('#inputdate').attr('min', maxDate);
45-
});
46-
</script>
29+
<input type="date" placeholder="Select" id="date" name="date">
4730
<p id="dte"></p>
48-
4931
<label>From Time</label>
5032
<input type="time" placeholder="Select" id="from_time" name="from_time">
5133
<p id="from_time"></p>
5234
<label>To Time</label>
5335
<input type="time" placeholder="Select" id="to_time" name="to_time">
5436
<p id="to_time"></p>
5537
</div>
56-
38+
5739
<div class="field">
58-
<label>Issues/Symptoms</label><p id="desc"></p>
40+
<label>Issues/Symptoms</label>
41+
<p id="desc"></p>
5942
<div class="ui fluid input">
60-
<textarea id="description" class="ui textarea" rows="2" name="description" required="true"></textarea>
43+
<textarea id="description" class="ui textarea" rows="2" name="description" required="true"></textarea>
6144
</div>
6245
</div>
6346

6447
<div class="field">
6548
<label><br></label>
6649

67-
<div >
50+
<div>
6851
<input type="submit" id="appo" name="Submit" value="Submit" class="ui small right floated primary button" />
6952
</div>
7053

7154
</div>
7255
</form>
7356
<script type="text/javascript" src="{% static 'globals/js/jquery.min.js' %}"></script>
7457
<script type="text/javascript">
75-
function trimfield(str)
76-
{
77-
return str.replace(/^\s+|\s+$/g,'');
58+
function trimfield(str) {
59+
return str.replace(/^\s+|\s+$/g, '');
7860
}
79-
$('#appo').on('click',function(e){
61+
$('#appo').on('click', function (e) {
8062
e.preventDefault();
8163

8264
var tod = new Date(new Date().setHours(0, 0, 0, 0));
8365
var today = new Date(new Date());
8466
var now = today.getHours();
8567

86-
if(trimfield(document.getElementById("description").value) == '')
87-
{
68+
if (trimfield(document.getElementById("description").value) == '') {
8869
$('#desc').html('*Please fill out the Description!');
8970
document.getElementById("description").focus();
90-
}
91-
else{
71+
} else {
9272
$.ajax({
93-
type:'post',
94-
url:'/healthcenter/student/',
73+
type: 'post',
74+
url: '/healthcenter/student/',
9575
data: {
9676
csrfmiddlewaretoken: '{{ csrf_token }}',
97-
doctor:$("#doc").val(),
98-
date:$("#date").val(),
99-
description:$("#description").val(),
100-
appointment:$("#appo").val(),
77+
doctor: $("#doc").val(),
78+
date: $("#date").val(),
79+
from_time: $("#from_time").val(),
80+
to_time: $("#to_time").val(),
81+
description: $("#description").val(),
82+
appointment: $("#appo").val(),
10183
},
102-
success: function(data){
84+
success: function (data) {
10385
var dte = new Date(data.dt);
10486
dte.setHours(0, 0, 0, 0);
105-
alert("Appointment requested.Check history for the status of appointment. ")
106-
document.getElementById("doc").value=""
107-
document.getElementById("date").value=""
108-
document.getElementById("description").value=" "
87+
88+
if (data.status == '1') {
89+
alert("Appointment requested.Check history for the status of appointment. ")
90+
} else if (data.status == '0') {
91+
alert(data.message);
92+
}
93+
94+
document.getElementById("doc").value = ""
95+
document.getElementById("date").value = ""
96+
document.getElementById("description").value = " "
10997
$('#desc').html('');
11098
window.location.reload();
11199
$('#app_dte').html('');
112100
}
113101
});
114102
}
115103
});
104+
116105
</script>
106+
117107
<br>
118108
<br>
119109
</div>
120-
<br>
121-
<div class="extra segment"></div>
110+
</div>
111+
112+
<div class="field">
113+
<label><br></label>
114+
115+
<div>
116+
<input type="submit" id="appo" name="Submit" value="Submit" class="ui small right floated primary button" />
117+
</div>
118+
119+
</div>
120+
</form>
121+
<script type="text/javascript" src="{% static 'globals/js/jquery.min.js' %}"></script>
122+
<script type="text/javascript">
123+
function trimfield(str) {
124+
return str.replace(/^\s+|\s+$/g, '');
125+
}
126+
$('#appo').on('click', function (e) {
127+
e.preventDefault();
128+
129+
var tod = new Date(new Date().setHours(0, 0, 0, 0));
130+
var today = new Date(new Date());
131+
var now = today.getHours();
132+
133+
if (trimfield(document.getElementById("description").value) == '') {
134+
$('#desc').html('*Please fill out the Description!');
135+
document.getElementById("description").focus();
136+
} else {
137+
$.ajax({
138+
type: 'post',
139+
url: '/healthcenter/student/',
140+
data: {
141+
csrfmiddlewaretoken: '{{ csrf_token }}',
142+
doctor: $("#doc").val(),
143+
date: $("#date").val(),
144+
description: $("#description").val(),
145+
appointment: $("#appo").val(),
146+
},
147+
success: function (data) {
148+
var dte = new Date(data.dt);
149+
dte.setHours(0, 0, 0, 0);
150+
alert("Appointment requested.Check history for the status of appointment. ")
151+
document.getElementById("doc").value = ""
152+
document.getElementById("date").value = ""
153+
document.getElementById("description").value = " "
154+
$('#desc').html('');
155+
window.location.reload();
156+
$('#app_dte').html('');
157+
}
158+
});
159+
}
160+
});
161+
</script>
162+
<br>
163+
<br>
164+
</div>
165+
<br>
166+
<div class="extra segment"></div>
122167
</div>
123168
{% comment %}the doctor appointment tab ends here {% endcomment %}
124169

125170
{% comment %}the ambulance appointment tab starts here {% endcomment %}
126171
<div class="ui tab" data-tab="ambulancerequest">
127172
<div class="ui vertical segment">
128-
<form m class="ui form" method="POST" style="padding: 8px; padding-left: 24px; padding-right: 24px;">{% csrf_token %}
129-
<div class="two fields" >
173+
<form m class="ui form" method="POST" style="padding: 8px; padding-left: 24px; padding-right: 24px;">{% csrf_token
174+
%}
175+
<div class="two fields">
130176
<div class="field">
131177
<label>From</label>
132178
<input type="date" id="inputdate1" name="inputdate1">
133179
<script>
134-
$(function(){
180+
$(function () {
135181
var dtToday = new Date();
136182
var month = dtToday.getMonth() + 1;
137183
var day = dtToday.getDate();
138184
var year = dtToday.getFullYear();
139-
if(month < 10)
185+
if (month < 10)
140186
month = '0' + month.toString();
141-
if(day < 10)
187+
if (day < 10)
142188
day = '0' + day.toString();
143189
var maxDate = year + '-' + month + '-' + day;
144190
$('#inputdate1').attr('min', maxDate);
@@ -149,14 +195,14 @@
149195
<label>To</label>
150196
<input type="date" id="inputdate2" name="inputdate2">
151197
<script>
152-
$(function(){
198+
$(function () {
153199
var dtToday = new Date();
154200
var month = dtToday.getMonth() + 1;
155201
var day = dtToday.getDate();
156202
var year = dtToday.getFullYear();
157-
if(month < 10)
203+
if (month < 10)
158204
month = '0' + month.toString();
159-
if(day < 10)
205+
if (day < 10)
160206
day = '0' + day.toString();
161207
var maxDate = year + '-' + month + '-' + day;
162208
$('#inputdate2').attr('min', maxDate);
@@ -173,58 +219,56 @@
173219

174220
<div class="field">
175221
<label><br></label>
176-
<div >
177-
<input type="button" id="amb_submit" name="amb_submit" value="Submit" class="ui large right floated primary button" />
178-
</div>
222+
<div>
223+
<input type="button" id="amb_submit" name="amb_submit" value="Submit"
224+
class="ui large right floated primary button" />
225+
</div>
179226
</div>
180227
</form>
181228
<script type="text/javascript">
182229

183-
function trimfield(str)
184-
{
185-
return str.replace(/^\s+|\s+$/g,'');
230+
function trimfield(str) {
231+
return str.replace(/^\s+|\s+$/g, '');
186232
}
187233

188234
$('#amb_submit').click(function(e)
189235
{
190236
var startDate = document.getElementById('inputdate1').value;
191237
var endDate = document.getElementById('inputdate2').value;
192238
var start = new Date(startDate);
193-
var end=new Date(endDate);
239+
var end = new Date(endDate);
194240
var today = new Date(new Date().setHours(0, 0, 0, 0));
195241

196242
$('#stdt').html('');
197243
$('#endt').html('');
198-
if ( +start < +today ) {
244+
245+
if (+start < +today) {
199246
$('#stdt').html('You cannot enter a date before today!.');
200247
return false;
201248
}
202-
if(endDate!="")
203-
{
204-
if ( +end < +start ) {
205-
$('#endt').html('You cannot enter a date before start date!.');
206-
return false;
249+
250+
if (endDate != "") {
251+
if (+end < +start) {
252+
$('#endt').html('You cannot enter a date before start date!.');
253+
return false;
207254
}
208255
}
209256

210-
if(trimfield(document.getElementById("reason").value) == '')
211-
{
257+
if (trimfield(document.getElementById("reason").value) == '') {
212258
$('#reas').html('*Please fill out the details!');
213259
document.getElementById("reason").focus();
214-
}
215-
216-
else{
260+
} else {
217261
$.ajax({
218-
type:'post',
219-
url:'/healthcenter/student/',
262+
type: 'post',
263+
url: '/healthcenter/student/',
220264
data: {
221265
csrfmiddlewaretoken: '{{ csrf_token }}',
222266
start_date:$("#inputdate1").val(),
223267
end_date:$("#inputdate2").val(),
224268
reason:$("#reason").val(),
225269
amb_submit:$("#amb_submit").val()
226270
},
227-
success: function(data){
271+
success: function (data) {
228272
alert("Ambulance requested.");
229273
window.location.reload();
230274

@@ -236,12 +280,13 @@
236280
});
237281
}
238282
});
283+
239284
</script>
240285
<br>
241286
<br>
242287
</div>
243288
<br>
244289
<div class="extra segment"></div>
245-
</div>
290+
</div>
246291
{% comment %}the ambulance appointment tab ends here {% endcomment %}
247292
{% endblock %}

0 commit comments

Comments
 (0)