forked from tsg-iitkgp/tsg
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmrf.html
More file actions
462 lines (407 loc) · 22.1 KB
/
mrf.html
File metadata and controls
462 lines (407 loc) · 22.1 KB
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
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Mess Menu</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="theme-color" content="#D02451" />
<link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
<link href="https://fonts.googleapis.com/css?family=Lato:400,400i,700|Playfair+Display|Roboto+Slab:400,700" rel="stylesheet">
<link rel="stylesheet" href="css/style.css">
<link rel="icon" type="image/png" href="favicon.png">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script>
<link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
<style>
#halls{display: block;z-index: 100;position: relative;left: 50%;width: 30%;margin-right: -50%;transform: translate(-50%, -50%);text-align: center;border: solid red; z-index: -3;}
#test{font-size: larger;text-align: center;margin: 10px;}
th:not(:first-of-type){background-color:lightgray;font-size: ;}
th:first-child{direction:rtl; width: auto;color: #1e7e34;font-size: 2em;}
td:not(:first-of-type){width: 14.3%;height: max-content;}
td:first-child{color: black;font-family: "Roboto Light";font-size: 1.2em;background-color: #7abaff;}
table{overflow-x: scroll;position: relative; margin: auto; width: 96%;}
#mrf-container{align-self: center;margin: 5% auto;width: 50%;}
div#days{margin: 10px 5px;}
div#days div{display:inline-block; width: 30%;margin-left:15%;}
div#days label{font-weight: 400; font-size: larger;}
label.container{font-size:x-large;}
#ansinput, #pass, #days, #submit2{display: none;}
h3{margin: auto;}
button{margin-top: 30px;padding: 1%; font-size: larger; color: black; border-radius: 12px;box-shadow: none; position: relative;left: 50%; margin-right: -50%;transform: translate(-50%, -50%);text-align: center;}
div#description{margin-top: 90px;border-radius:12px; display: none;font-size: medium;color:black;font-family: Georgia, 'Times New Roman', Times, serif;text-align: justify; z-index: 6;background-color: aliceblue; position: absolute;left: 50%; margin-right: -50%;transform: translate(-50%, -50%);text-align: center; width:45%;}
i.material-icons{cursor: pointer;}
input.erpinput{width: 30%;padding: 8px 10px;border-color: blue; outline: 0; border-width: 0 0 2px;}
@media only screen and (max-width: 1100px) {
#header {
position: absolute;
left: 0px;
}
#mob-nav {
display: block;
}
#not-on-mob {
display: none;
visibility: hidden;
}
}
</style>
<script>
$(function(){
$("#header").load("header.html");
$("#footer").load("footer.html");
});
</script>
</head>
<body>
<div class="container page z-depth-5">
<div id="header"></div>
<!-- <nav class="navigation">
<div class="nav-wrapper">
<a href="#" data-target="mobile-demo" class="sidenav-trigger"><i class="material-icons">menu</i></a>
<a href="#" class="brand-logo left valign-wrapper">
<img src="./static/images/IIT_Kharagpur_Logo.svg" alt="" class="responsive-img">
</a>
<ul id="nav-mobile" class="hide-on-med-and-down right">
<li><a href="index.html" class="waves-effect waves-light">Home</a></li>
<li><a href="interiit.php" class="waves-effect">Inter IIT</a></li>
<li ><a href="notices.php" class="waves-effect">Notices</a></li>
<li class="active"><a href='events.html' class="waves-effect">Mess</a></li>
<li><a href='events.html' class="waves-effect">Events</a></li>
<li><a href='openiit.html' class="waves-effect">Open IIT</a></li>
<li><a href="gc-results.html" class="waves-effect">GC 19</a></li>
<li><a href="gc.php" class="waves-effect">GC</a></li>
<li><a href="fests.html" class="waves-effect">Fests</a></li>
<li><a href="societies.html" class="waves-effect">Societies</a></li>
<li><a href="contacts.html" class="waves-effect">Contacts</a></li>
<li><a href="blogpost.html" class="waves-effect">Blog</a></li>
</ul>
</div>
</nav> -->
<br>
<div id='mrf-container'> <br><br>
<h3 style="text-align: center">Mess Rebate Form <span><i onMouseOver='show_info()' onMouseOut='hide_info()' class="material-icons"></i></span> </h3>
<div id='description'>
<p>Mess rebate can be availed by providing a two day notice period and can be availed for a minimum
stretch of 5 days (no upper limit) from the date of rebate start.<br/><br/>
For, e.g. if today is 29 Feb, you can choose rebate from minimum 3 March and it should be minimum
upto 7 March. Both dates are inclusive for the rebate.<br/><br/>
You'll get a confirmational email once it is approved; please contact mess incharge in case it is not
approved before your rebate start date.
</p>
</div>
<br>
<input class="erpinput" id="rollinput" type="text" placeholder="ERP Roll Number">
<br>
<button id="submit1" onclick="getQue()" type="submit">Get Security Question</button>
<p id="question"></p>
<input class="erpinput" id="ansinput" type="password" placeholder="Security Question's Answer">
<input class="erpinput" id="pass" type="password" placeholder="ERP Password">
<div id="days">
<div><label for="from">From:</label><input type="date" id="from" name="from"></div>
<div><label for="to">To:</label><input type="date" id="to" name="to"></div>
</div>
<button id="submit2" onclick="onSubmit()" type="submit">SUBMIT!</button><br>
</div>
<h3 style="text-align: center">Mess Menu </h3><br>
<select id="halls" onChange="getHall(this);">
<option selected disabled> Choose hall</option>
</select>
<table class="table table-bordered table-responsive table-hover">
<thead>
<tr>
<th id="hall_name"> Hall Name </th>
<th> Monday </th>
<th> Tuesday </th>
<th> Wednesday </th>
<th> Thursday </th>
<th> Friday</th>
<th> Saturday </th>
<th> Sunday </th>
</tr>
</thead>
<tbody id="messtable">
<tr>
<td>Breakfast</td>
</tr>
<tr>
<td>Lunch</td>
</tr>
<tr>
<td>Snacks</td>
</tr>
<tr>
<td>Dinner</td>
</tr>
</tbody>
</table>
</div>
<div class="links container z-depth-3">
<div class="container white-text">
<div class="row">
<div class="col l4 s12">
<h5>Contact Us</h5>
<address>
<strong>Technology Students' Gymkhana</strong><br>
IIT Kharagpur, Kharagpur<br>
West Bengal - 721302<br>
</address>
<p class="grey-text text-lighten-4"></p>
</div>
<div class="col l4 s6">
<ul>
<li><a class="grey-text text-lighten-3" href="http://www.apna.iitkgp.ac.in/">Apna IIT KGP</a></li>
<li><a class="grey-text text-lighten-3" href="http://www.iitkgp.ac.in/files/acad_cal1920.pdf">Academic Calendar 19-20</a></li>
<li><a class="grey-text text-lighten-3" href="http://www.iitkgp.ac.in/files/acad_cal1819.pdf">Academic Calendar 18-19</a></li>
<li><a class="grey-text text-lighten-3" href="http://www.iitkgp.ac.in/iitkgp-announcements;jsessionid=13FBA3CA280A81F185131F0CBC27CE0F">Announcements</a></li>
<li><a class="grey-text text-lighten-3" href="https://erp.iitkgp.ernet.in/ERPWebServices/curricula/specialisationList.jsp?stuType=UG">Academic Curriculum (UG)</a></li>
<li><a class="grey-text text-lighten-3" href="https://erp.iitkgp.ernet.in/ERPWebServices/curricula/specialisationList.jsp?stuType=PG">Academic Curriculum (PG)</a></li>
<li><a class="grey-text text-lighten-3" href="http://www.counsellingcentre.iitkgp.ac.in/">Counselling Centre</a></li>
<li><a class="grey-text text-lighten-3" href="https://wiki.metakgp.org/w/Yellow_pages">Yellow Pages</a></li>
<li><a class="grey-text text-lighten-3" href="https://www.mykgp.com/">MY KGP</a></li>
<li><a class="grey-text text-lighten-3" href="http://www.bcrth.iitkgp.ac.in/">BC Roy Hospital</a></li>
<li><a class="grey-text text-lighten-3" href="http://www.library.iitkgp.ernet.in/">Library</a></li>
<li><a class="grey-text text-lighten-3" href="http://www.cdc.iitkgp.ac.in/">CDC</a></li>
<li><a class="grey-text text-lighten-3" href="http://www.swgiitkgp.in/freshers_forum/">SWG Forum</a></li>
<li><a class="grey-text text-lighten-3" href="http://www.dak.iitkgp.ernet.in/phd/">Doctorates Info System</a></li>
<li><a class="grey-text text-lighten-3" href="https://erp.iitkgp.ernet.in/DupCertReqPortal/auth/welcome.htm">Degree Verification/Transcripts/Certificates</a></li>
</ul>
</div>
<div class="col l4 s6">
<ul>
<li><a class="grey-text text-lighten-3" href="https://erp.iitkgp.ernet.in/">ERP</a></li>
<li><a class="grey-text text-lighten-3" href="https://erp.iitkgp.ernet.in/StudentPerformanceV2/auth/login.htm">For Parents/Guardians</a></li>
<li><a class="grey-text text-lighten-3" href="http://www.iitkgp.ac.in/for-students;jsessionid=13FBA3CA280A81F185131F0CBC27CE0F">For Students</a></li>
<li><a class="grey-text text-lighten-3" href="http://www.tgh.iitkgp.ac.in/">Guest House</a></li>
<li><a class="grey-text text-lighten-3" href="http://www.iitkgp.ac.in/holidays;jsessionid=13FBA3CA280A81F185131F0CBC27CE0F">Holidays</a></li>
<li><a class="grey-text text-lighten-3" href="http://www.iitkgp.ac.in/internal-complaints-committee;jsessionid=13FBA3CA280A81F185131F0CBC27CE0F">Internal Complaints Committee</a></li>
<li><a class="grey-text text-lighten-3" href="http://noticeboard.iitkgp.ernet.in/">Internal Notice Board</a></li>
<li><a class="grey-text text-lighten-3" href="http://www.iitkgp.ac.in/media;jsessionid=13FBA3CA280A81F185131F0CBC27CE0F">Media</a></li>
<li><a class="grey-text text-lighten-3" href="http://www.iitkgp.ac.in/rajbhasha">Rajbhasha Vibhag</a></li>
<li><a class="grey-text text-lighten-3" href="https://erp.iitkgp.ernet.in/SupplierFacilities/login.htm">Vendor Registration under GST</a></li>
<li><a class="grey-text text-lighten-3" href="http://www.sric.iitkgp.ac.in/main.php">Sponsored Research</a></li>
<li><a class="grey-text text-lighten-3" href="https://iitkgpmail.iitkgp.ac.in/">Web Mail</a></li>
</ul>
</div>
</div>
</div>
</div>
<ul class="sidenav" id="mobile-demo">
<div class="header-sidenav row valign-wrapper" style="position: relative; top: 1.5rem;">
<div class="col s5 m3 center">
<img src="./static/images/IIT_Kharagpur_Logo.svg" alt="IIT Icon" class="responsive-img">
</div>
<div class="col m9 s7 valign-wrapper">
<h1>Technology Students' Gymkhana</h1>
<!-- <h2>Indian Institute of Technology Kharagpur</h2> -->
</div>
</div>
<li><a href="index.php">Home</a></li>
<li><a href="interiit.php">Inter IIT</a></li>
<li><a href="gc.php">GC</a></li>
<li><a href="fests.html">Fests</a></li>
<li class="active"><a href="societies.html">Societies</a></li>
<li><a href="contacts.html">Contacts</a></li>
<li><a href="blog/">Blog</a></li>
</ul>
<div class="footer center">
<div class="footer-copyright">
© 2019 TSG IIT Kharagpur
</div>
</div>
<script type="text/javascript" src="https://code.jquery.com/jquery-3.3.1.min.js"></script>
<script type="text/javascript" src="materialize/js/bin/materialize.min.js"></script>
<!-- <script type="text/javascript" src="js/blogpost.js"></script> -->
<script type="text/javascript">
$(document).ready(function(){
$('.modal').modal();
$('.sidenav').sidenav();
});
</script>
<script type="text/javascript">
var hall = "";
const link = 'http://gymk-back.herokuapp.com/mess/';
var req = '';
var hallnames = ["Azad", "BCRH", "BRH", "Gokhale", "HJB", "JCB", "Nehru", "LBS", "LLR", "MMM", "MS", "MT", "SNVH", "Patel", "Patel", "RK", "RLB", "RP", "SAM", "SNIG", "VS"];
window.onload = fillHalls;
function fillHalls() {
var sel = document.getElementById("halls");
for (let i = 0; i < hallnames.length; i++){
var opt = document.createElement("option");
opt.appendChild(document.createTextNode(hallnames[i]));
let val = i + 1;
opt.value = val;
sel.appendChild(opt);
}
}
function getHall(sel){
var hallname = sel.options[sel.selectedIndex].text;
document.getElementById('hall_name').innerHTML = hallname;
hall = hallname;
req = link + hall.toLowerCase(); // hallwise link here
fetchMenuData(req);
}
function fetchMenuData(link) { // changed name of the function
let output = "";
document.getElementById('messtable').innerHTML = `<img src="gif/loader.gif">`; // id changed to messtable
fetch(link)
.then (response => response.json())
.then( menu => {
if(menu == []) {
document.getElementById('messtable').innerHTML = `<tr><td colspan=7><h1 style="text-align:center;">To Be Updated</h1></td></td>`;
return;
}
menu = JSON.parse(menu);
menu.map(row => {
let indiv_row = `
<tr>
<td>${row['time']}</td>
<td>${row['monday']}</td>
<td>${row['tuesday']}</td>
<td>${row['wednesday']}</td>
<td>${row['thursday']}</td>
<td>${row['friday']}</td>
<td>${row['saturday']}</td>
<td>${row['sunday']}</td>
</tr>
`
if (indiv_row != undefined)
{
output += indiv_row;
}
});
})
.then(() => {
console.log(output);
console.log("here");
document.getElementById('messtable').innerHTML = output;
})
.catch(() => {
document.getElementById('messtable').innerHTML = `<tr><td colspan=7><h1 style="text-align:center;">To Be Updated</h1></td></td>`;
return;
});
}
const URL = 'http://18570a66.ngrok.io';
function getQue(){
var roll_no = document.getElementById("rollinput").value;
if (roll_no === ''){
alert("Roll number is empty");
return;
}
(async () => {
try{
var rawResponse = await fetch(URL + '/que', {
method: 'POST',
headers: {
'Accept': 'application/json',
'Content-Type': 'application/json'
},
body: JSON.stringify({ "roll_number": roll_no })
});}
catch(err){
alert('Failed to connect to server. Please try again later !');
}
const content = await rawResponse.json();
console.log('response is ', content)
if (content['que'] === 'Invalid Roll Number') {
alert('Roll number is incorrect!');
document.getElementById("submit1").disabled = false;
return;
}
document.getElementById("question").innerHTML = content['que'];
document.getElementById("ansinput").style.display = "block";
document.getElementById("pass").style.display = "block"; // #ansinput, #pass, #days, #submit
document.getElementById("days").style.display = "block";
document.getElementById("submit2").style.display = "block";
// getDays();
})();
document.getElementById("submit1").disabled = true;
}
function onSubmit(){
var roll_no = document.getElementById("rollinput").value;
var pwd = document.getElementById("pass").value;
var ans = document.getElementById("ansinput").value;
/* var days = document.getElementsByTagName('input');
var selectdays = []; // values of checked days
for (let i = 0; i < days.length; i++) {
if (days[i].type == 'checkbox' && days[i].checked == true)
selectdays.push(days[i].value);
} */
var from = document.getElementById('from').value;
var to = document.getElementById('to').value;
console.log('inside');
(async () => {
try{
const rawResponse = await fetch(URL + '/check', {
method: 'POST',
headers: {
'Accept': 'application/json',
'Content-Type': 'application/json'
},
body: JSON.stringify({"roll_number": roll_no, "password": pwd, "answer":ans, "from": from, "to": to})
});
const content = await rawResponse.json();
console.log('try',content.message == "success")
console.log('false ', content.message == "wrong creds")
if(content.message == "success") {
alert('SucessFully Registered Dates');
window.location.reload();
}
else if(content.message == "DB Error") {
alert('Failed to update to Database, Try again please');
window.location.reload();
}
else if(content.message == "wrong creds") {
alert('Wrong credentails');
window.location.reload();
}
else{
alert(content.message);
}
console.log(content);
}
catch(err){
alert('Failed to connect to server. Please try again later !');
}
})();
/* document.getElementById("rollinput").value = ''; // clear form after submit
document.getElementById("pass").value = '';
document.getElementById("ansinput").value = '';
document.getElementById("question").innerHTML = '';
document.getElementById("pass").disabled = true;
document.getElementById("ansinput").disabled = true; */
}
/* function getDays(){
var result = []; // dates go here
var next = new Date();
next.setDate(next.getDate() + (7 - next.getDay()) % 7 + 1); // next Monday
for (var i = 1; i <= 7; i++){ // January 0 - December 11
var d = new Date(); // Sunday 0 - Saturday 6
d.setDate(next.getDate() + i - 1);
result.push(d)
// var weekday = new Array("Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday");
var days = new Array("Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday")
for(let i = 0; i < days.length; i++){
/*
var dt = result[i].getDate() + '-' + (result[i].getMonth() + 1) + '-' + result[i].getFullYear() + ' (' + weekday[result[i].getDay()] + ')';
document.getElementById('days').innerHTML += '<label class=\"container\">' + dt + '<input type=\"checkbox\" value=\"' +
document.getElementById('days').innerHTML += '<label class=\"container\">' + days[i] + '<input type=\"checkbox\" value=\"' +
i + '\">' + '<span class=\"checkmark\"></span></label>';
}
((result[i].getDay() + 6) %7 ) + '\">' + '<span class=\"checkmark\"></span></label>'; // 0 - Monday -- 6 Sunday */
function show_info() {
document.getElementById('description').style.display = "block";
}
function hide_info() {
document.getElementById('description').style.display = "none";
}
</script>
<script type="text/javascript" src="https://code.jquery.com/jquery-3.3.1.min.js"></script>
<script type="text/javascript" src="materialize/js/bin/materialize.min.js"></script>
<!-- <script type="text/javascript" src="js/blogpost.js"></script> -->
<script type="text/javascript">
$(document).ready(function(){
$('.modal').modal();
$('.sidenav').sidenav();
});
</script>
</body>
</html>