-
Notifications
You must be signed in to change notification settings - Fork 0
/
review.html
329 lines (318 loc) · 19.3 KB
/
review.html
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
<!DOCTYPE html>
<html>
<head>
<title>ReviewPage</title>
<link rel="stylesheet" href="css\style8.css">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">
</head>
<body>
<div class="split left">
<div class="userimg" >
<img src="other/avatar.png" style="width: 45%; height:60% ;padding: 15px; background-size: cover; border-radius: 110px;">
</div>
<div class="navbar">
<button class="btn" onclick="window.location.href='home.html'">About Me</button>
<button class="btn" onclick="window.location.href='prescription.html'">Past Prescriptions</button>
<button class="btn" onclick="window.location.href='testing.html'">Past testing</button>
<button class="btn" onclick="window.location.href='operation.html'">Past operations</button>
<button class="btn" style="background-color: white;"onclick="window.location.href='review.html'">Past reviews</button>
<button class="btn" onclick="window.location.href='find_doctor.html'">Find a new doctor</button>
<button class="btn" onclick="window.location.href='rate.html'">Rate it</button>
<button class="btn" onclick="window.location.href='recommenddoctor.html'">Recommend doctor</button>
</div>
</div>
<div class="split right" id="addreview">
<!-- <div class="doctor_card">
<div class="leftcard">
<div class="pic">
<img src="other/avatar.png" style="width:80%; padding-left:20% ;">
</div>
<div class="stars">
<span class="fa fa-star checked" style="font-size:20px ;"></span>
<span class="fa fa-star checked" style="font-size:20px ;"></span>
<span class="fa fa-star checked" style="font-size: 20px;"></span>
<span class="fa fa-star" style="font-size:20px ;"></span>
<span class="fa fa-star" style="font-size:20px ;"></span>
</div>
<div>
<button class="bookbtn">Book appointment</button>
</div>
</div>
<div class="details">
<div>Name</div>
<div>Age</div>
<div>Gender</div>
<div>Hospital</div>
<div>Specialization</div>
<div>charges</div>
</div>
<div class="rightcard">
<div class="review">This is the user review. blah blah blah. the doctor was nice. nice prescription. allover good. blah blah blah blah blah blah blah blah blah blah balh blah blah blah blah blah blah</div>
<div class="allratings">
<div class="leftrate">
<div class="userrating">
<span class="fa fa-star checked" style="font-size:20px ;"></span>
<span class="fa fa-star checked" style="font-size:20px ;"></span>
<span class="fa fa-star checked" style="font-size: 20px;"></span>
<span class="fa fa-star" style="font-size:20px ;"></span>
<span class="fa fa-star" style="font-size:20px ;"></span>
</div>
<div class="userrating">
<span class="fa fa-star checked" style="font-size:20px ;"></span>
<span class="fa fa-star checked" style="font-size:20px ;"></span>
<span class="fa fa-star checked" style="font-size: 20px;"></span>
<span class="fa fa-star" style="font-size:20px ;"></span>
<span class="fa fa-star" style="font-size:20px ;"></span>
</div>
</div>
<div class="rightrate">
<div class="userrating">
<span class="fa fa-star checked" style="font-size:20px ;"></span>
<span class="fa fa-star checked" style="font-size:20px ;"></span>
<span class="fa fa-star checked" style="font-size: 20px;"></span>
<span class="fa fa-star" style="font-size:20px ;"></span>
<span class="fa fa-star" style="font-size:20px ;"></span>
</div>
<div class="userrating">
<span class="fa fa-star checked" style="font-size:20px ;"></span>
<span class="fa fa-star checked" style="font-size:20px ;"></span>
<span class="fa fa-star checked" style="font-size: 20px;"></span>
<span class="fa fa-star" style="font-size:20px ;"></span>
<span class="fa fa-star" style="font-size:20px ;"></span>
</div>
</div>
</div>
</div>
</div> -->
</div>
<script type="text/javascript" src="js\bookapointment.js"></script>
<script>
//Now iterate on all the feedbacks in the database
//which ever feedback is given by this patient?? what is his id lololol uhm
//ok we need to recover it from login api's object
//so whichever feedback given by this id and approved go ahead
//iterate on all the doctors first
//first find id of looged in person
var myHeaders = new Headers();
var pid;
console.log(JSON.parse(localStorage.getItem('token')));
myHeaders.append("Authorization", `Token ${JSON.parse(localStorage.getItem('token'))}`);
var requestOptions = {
method: 'GET',
headers: myHeaders,
redirect: 'follow'
};
fetch("http://localhost:8000/specificpatientview/", requestOptions)
.then(response => response.text())
.then((result) =>{
let data = JSON.parse(result)
console.log(data);
// document.getElementById("name").innerHTML = `<b>Name : ${data.name} </b><br>Date of Birth: ${data.birth_date}<br>Contact No. ${data.phone_number}</b>`
// document.getElementById("marital").innerHTML = `<b>Martial Status</b> : ${data.marital_status}`
// document.getElementById("address").innerHTML = `<b>Address</b> : ${data.address}`
// document.getElementById("gender").innerHTML = `<b>Gender</b> : ${data.gender}`
// let allerhist="";
// for(i=0;i<data.allergic_history.length();i++){
// allerhist+=`<tr><th>${i+1}</th><th>${data.allergic_history[i]}</th><th>${}`
// }
var pidd=data.id
pid=pidd;
console.log(data.id)
console.log(pidd)
})
.catch((error) => {
console.log(error)
document.getElementById("message").innerHTML ="There was some error in getting the details"
});
console.log('currently logged in')
console.log(pid)
// var pid;
// var myHeaderscur = new Headers();
// console.log(JSON.parse(localStorage.getItem('token')));
// myHeaderscur.append("Authorization", `Token ${JSON.parse(localStorage.getItem('token'))}`);
// var requestOptions = {
// method: 'GET',
// headers: myHeaderscur,
// redirect: 'follow'
// };
// fetch("http://localhost:8000/specificpatientview/", requestOptions)
// .then(response => response.text())
// .then((result) =>{
// let data = JSON.parse(result)
// console.log(data);
// pid=data.id;
// })
// .catch((error) => {
// console.log(error)
// document.getElementById("message").innerHTML ="There was some error in getting the details"
// });
// console.log('current loogedd in person is')
// console.log(pid)
//finding compatible feedback
let imgsrc='other\\avatar.png';
var myHeaders = new Headers();
// myHeaders.append("Authorization", `Token ${JSON.parse(localStorage.getItem('token'))}`);
var requestOptions = {
method: 'GET',
headers: myHeaders,
redirect: 'follow'
};
fetch("http://localhost:8000/doctor/", requestOptions)
.then((response) => response.text())
.then((result) => {
let data = JSON.parse(result)
console.log(data);
data.forEach((elem) => {
console.log(elem);
let docid=elem.id;
//now fetch the feedback for this doctor
var requestOptions = {
method: 'GET',
redirect: 'follow'
};
fetch(`http://localhost:8000/openfeedback/${docid}`, requestOptions)
.then(response => response.text())
.then((result2) => {
let docfeeddata=JSON.parse(result2)
console.log('feedback');
console.log(docfeeddata);
docfeeddata.forEach((feedback)=>{
console.log(feedback)
let curpatid=feedback.patient;
console.log('patient who posted this is ')
console.log(curpatid)
console.log(pid)
if(curpatid==pid){
console.log('this feeback matches this is the one')
console.log(feedback)
//now for this one insert inside the card
// const e1 = document.createElement('div');
let cnt=0;
let rates=["","","","",""];
let avg=(elem.availability_rating+elem.collaboration_rating+elem.communication_rating+elem.treatment_rating)/4;
console.log(avg/2);
avg=avg/2;
for(i=1;i<=5;i++){
if(i<=avg){
rates[i-1]="checked";
}
}
let treatrate=["","","","",""];
for(i=1;i<=5;i++){
if(i<=(feedback.treatment_rating)/2){
treatrate[i-1]="checked";
}
}
let collabrate=["","","","",""];
for(i=1;i<=5;i++){
if(i<=(feedback.collaboration_rating)/2){
collabrate[i-1]="checked";
}
}
let comrate=["","","","",""];
for(i=1;i<=5;i++){
if(i<=(feedback.communication_rating)/2){
comrate[i-1]="checked";
}
}
let avail=["","","","",""];
for(i=1;i<=5;i++){
if(i<=(feedback.availability)/2){
avail[i-1]="checked";
}
}
const e1 = document.createElement('div');
e1.innerHTML=`
<div class="doctor_card">
<div class="leftcard">
<div class="pic">
<img src=${imgsrc} style="width:80%; padding-left:20% ;">
</div>
<div class="stars">
<span class="fa fa-star ${rates[0]}" style="font-size:20px ;"></span>
<span class="fa fa-star ${rates[1]}" style="font-size:20px ;"></span>
<span class="fa fa-star ${rates[2]}" style="font-size: 20px;"></span>
<span class="fa fa-star ${rates[3]}" style="font-size:20px ;"></span>
<span class="fa fa-star ${rates[4]}" style="font-size:20px ;"></span>
</div>
<div>
<button class="bookbtn" onclick="bookappoint(this,this.nextElementSibling,${elem.id})">Book appointment</button>
<input type="text" name="popup" class="hide" placeholder="Enter in yyyy-mm-dd format">
</div>
</div>
<div class="details">
<div>Name: ${elem.name}</div>
<div>Age: ${elem.age}</div>
<div>Gender: ${elem.gender}</div>
<div>Hospital: ${elem.hospital.name}</div>
<div>Specialization: ${elem.specialization}</div>
<div>Charges: ${elem.consultation_charges}</div>
</div>
<div class="rightcard">
<div class="review">${feedback.reviews}</div>
<div class="allratings">
<div class="leftrate">
<div class="userrating">
<span class="fa fa-star ${treatrate[0]}" style="font-size:20px ;"></span>
<span class="fa fa-star ${treatrate[1]}" style="font-size:20px ;"></span>
<span class="fa fa-star ${treatrate[2]}" style="font-size: 20px;"></span>
<span class="fa fa-star ${treatrate[3]}" style="font-size:20px ;"></span>
<span class="fa fa-star ${treatrate[4]}" style="font-size:20px ;"></span>
</div>
<div class="ratetxt">Treatment Rating</div>
<div class="userrating">
<span class="fa fa-star ${collabrate[0]}" style="font-size:20px ;"></span>
<span class="fa fa-star ${collabrate[1]}" style="font-size:20px ;"></span>
<span class="fa fa-star ${collabrate[2]}" style="font-size: 20px;"></span>
<span class="fa fa-star ${collabrate[3]}" style="font-size:20px ;"></span>
<span class="fa fa-star ${collabrate[4]}" style="font-size:20px ;"></span>
</div>
<div class="ratetxt">Collaboration Rating</div>
</div>
<div class="rightrate">
<div class="userrating">
<span class="fa fa-star ${comrate[0]}" style="font-size:20px ;"></span>
<span class="fa fa-star ${comrate[1]}" style="font-size:20px ;"></span>
<span class="fa fa-star ${comrate[2]}" style="font-size: 20px;"></span>
<span class="fa fa-star ${comrate[3]}" style="font-size:20px ;"></span>
<span class="fa fa-star ${comrate[4]}" style="font-size:20px ;"></span>
</div>
<div class="ratetxt">Communication Rating</div>
<div class="userrating">
<span class="fa fa-star ${avail[0]}" style="font-size:20px ;"></span>
<span class="fa fa-star ${avail[1]}" style="font-size:20px ;"></span>
<span class="fa fa-star ${avail[2]}" style="font-size: 20px;"></span>
<span class="fa fa-star ${avail[3]}" style="font-size:20px ;"></span>
<span class="fa fa-star ${avail[4]}" style="font-size:20px ;"></span>
</div>
<div class="ratetxt">Availability</div>
</div>
</div>
</div>
</div>
`
console.log(e1);
document.getElementById("addreview").appendChild(e1);
console.log(document.getElementById('addreview'));
cnt+=1;
}
})
})
.catch((error) => {
console.log(error)
});
});
})
.catch((error) => {
console.log(error)
});
console.log('coming out')
const e2=document.createElement('div');
e2.innerHTML=`<div style="position:relative;top:100% ;height: 30px"></div>`;
document.getElementById("addreview").appendChild(e2);
console.log('e2 element is')
console.log(e2);
console.log(document.getElementById("addreview"));
</script>
</body>
</html>