-
Notifications
You must be signed in to change notification settings - Fork 13
/
index.html
377 lines (343 loc) · 21.6 KB
/
index.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
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
<!DOCTYPE html>
<html lang="en">
<head>
<link href="css/bootstrap.min.css" rel="stylesheet" id="bootstrap-css">
<link href="style.css" rel="stylesheet" id="bootstrap-css">
<script src="js/jquerymin.js"></script>
<script src="js/bootstrap.min.js"></script>
<script type="text/javascript" src="js/jquery.serializejson.min.js"></script>
<!------ Include the above in your HEAD tag ---------->
<div class="container register">
<div class="row">
<div class="col-md-3 register-left">
<img src="src/Logo.jpg" alt="" />
<h3>Welcome</h3>
<p>Joseph Vaz College - Student Registration!</p>
<button id="checkUser" type="button" class="btn btn-primary" data-toggle="modal" data-target="#basicExampleModal">
Check Student
</button>
<button id="updateUser" type="button" class="btn btn-primary" data-toggle="modal" data-target="#basicUpdateeModal">
Update Student
</button>
<button id="updateUser" type="button" class="btn btn-primary" data-toggle="modal" data-target="#basicUpdateeModal">
Logout
</button>
</div>
<div class="col-md-9 register-right">
<form id="studentreg" data-toggle="validator" role="form">
<div class="tab-content" id="myTabContent">
<div class="tab-pane fade show active" id="home" role="tabpanel" aria-labelledby="home-tab">
<div class="notify_panel2"></div>
<h3 class="register-heading">Student Registration</h3>
<div class="row register-form">
<div class="col-md-6">
<div class="form-group">
<input name="indexNo" type="number" class="form-control" placeholder="Index No *" value="" required>
</div>
<div class="form-group">
<input name="nameWithInitials" type="text" class="form-control" placeholder="Name With Initials *" value="" required>
</div>
<!-- <div class="form-group">
<input name="initials" type="text" class="form-control" placeholder="Initials *" value="" required>
</div>
<div class="form-group">
<input name="lastName" type="text" class="form-control" placeholder="Last Name *" value="" required>
</div> -->
<div class="form-group">
<input name="fullName" type="text" class="form-control" placeholder="Full Name *" value="" required>
</div>
<div class="form-group">
<label for="dob">DOB</label>
<input name="DOB" id="dob " type="date" class="form-control" value="" required>
</div>
<div class="form-group">
<input name="address" type="text" class="form-control" placeholder="Adress *" value="" required>
</div>
<div class="form-group">
<div class="maxl">
<label class="radio inline">
<input type="radio" name="gender" value="male" checked>
<span> Male </span>
</label>
<label class="radio inline">
<input type="radio" name="gender" value="female">
<span>Female </span>
</label>
</div>
</div>
</div>
<div class="col-md-6">
<div class="row">
<div class="col-md-4">
<select name="grade" class="form-control" required>
<option value="" class="hidden" selected disabled> Grade</option>
<option value="1">1</option>
<option value="2">2</option>
<option value="3">3</option>
<option value="4">4</option>
<option value="5">5</option>
<option value="6">6</option>
<option value="7">7</option>
<option value="8">8</option>
<option value="9">9</option>
<option value="10">10</option>
<option value="11">11</option>
<option value="12">12</option>
<option value="13">13</option>
</select>
</div>
<div class="col-md-8">
<div class="form-group">
<input name="section" type="text" class="form-control" placeholder="Section/Class" value="" required>
</div>
</div>
</div>
<div class="form-group">
<select name="medium" class="form-control" required>
<option value="" class="hidden" selected disabled> Medium</option>
<option value="Sinhala">Sinhala</option>
<option value="English">English</option>
</select>
</div>
<!-- <div class="form-group">
<input type="number" minlength="10" maxlength="10" name="homeTel" class="form-control" placeholder="Home Tel *" value="" required>
</div> -->
<div class="form-group">
<input name="guardianName" type="text" class="form-control" placeholder="Guardian Name" value="" >
</div>
<div class="form-group">
<input name="guardianAddress" type="text" class="form-control" placeholder="Guardian Adress" value="" >
</div>
<div class="form-group">
<input name="guardianRelationship" type="text" class="form-control" placeholder="Guardian Relationship" value="" >
</div>
<!-- <div class="form-group">
<input name="guardianContact" type="text" class="form-control" placeholder="Guardian Contact" value="" >
</div> -->
<div class="form-group">
<input type="number" minlength="10" maxlength="10" name="contactNo1" class="form-control" placeholder="Contact Number 1 *" value="" required>
</div>
<div class="form-group">
<input type="number" minlength="10" maxlength="10" name="conatctNo2" class="form-control" placeholder="Contact Number 2" value="">
</div>
<input type="submit" class="btnRegister" value="Register" />
</div>
</div>
</div>
</div>
</form>
</div>
</div>
</div>
<div class="modal fade" id="basicExampleModal" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel" aria-hidden="true">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<div class="notify_panel"></div>
<h5 class="modal-title" id="exampleModalLabel">Enter Student Index Number</h5>
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">×</span>
</button>
</div>
<form id="studentreg" data-toggle="validator" role="form">
<div class="modal-body">
<div class="form-group">
<input id="checkIndexNumber" name="checkIndexNumber" type="text" class="form-control" placeholder="Index Number" value="" required>
</div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button>
<button id="tag-form-submit" type="button" class="btn btn-primary">Enter</button>
</div>
</form>
</div>
</div>
</div>
<!-- <div class="modal fade" id="basicUpdateModal" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel" aria-hidden="true">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<div class="notify_panel"></div>
<h5 class="modal-title" id="exampleModalLabel">Update Student</h5>
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">×</span>
</button>
</div>
<form id="studentreg" data-toggle="validator" role="form">
<div class="modal-body">
<div class="tab-content" id="myTabContent">
<div class="tab-pane fade show active" id="home" role="tabpanel" aria-labelledby="home-tab">
<div class="row register-form">
<div class="col-md-12">
<div class="form-group">
<input name="indexNo" type="number" class="form-control" placeholder="Index No *" value="">
</div>
</div>
<br>
<div class="col-md-6">
<div class="form-group">
<input name="initials" type="text" class="form-control" placeholder="Initials *" value="" />
</div>
<div class="form-group">
<input name="lastName" type="text" class="form-control" placeholder="Last Name *" value="">
</div>
<div class="form-group">
<input name="fullName" type="text" class="form-control" placeholder="Full Name *" value="">
</div>
<div class="form-group">
<label for="dob">DOB</label>
<input name="DOB" id="dob " type="date" class="form-control" value="">
</div>
<div class="form-group">
<input name="address" type="text" class="form-control" placeholder="Adress *" value="" />
</div>
<div class="form-group">
<div class="maxl">
<label class="radio inline">
<input type="radio" name="gender" value="male" checked>
<span> Male </span>
</label>
<label class="radio inline">
<input type="radio" name="gender" value="female">
<span>Female </span>
</label>
</div>
</div>
</div>
<div class="col-md-6">
<div class="row">
<div class="col-md-4">
<select name="grade" class="form-control" required>
<option value="" class="hidden" selected disabled> Grade</option>
<option value="Advertise">1</option>
<option value="Partnership">2</option>
<option value="General Question">3</option>
<option value="Advertise">4</option>
<option value="Partnership">5</option>
<option value="General Question">6</option>
<option value="Advertise">7</option>
<option value="Partnership">8</option>
<option value="General Question">9</option>
<option value="Advertise">10</option>
<option value="Partnership">11</option>
<option value="General Question">12</option>
<option value="General Question">13</option>
</select>
</div>
<div class="col-md-4">
<div class="form-group">
<input name="section" type="text" class="form-control" placeholder="Section/Class" value="" required>
</div>
</div>
<div class="col-md-4">
<select name="medium" class="form-control">
<option class="hidden" selected disabled> Medium</option>
<option value="Advertise">Sinhala</option>
<option value="Partnership">English</option>
</select>
</div>
</div>
<div class="form-group">
<input type="text" minlength="10" maxlength="10" name="homeTel" class="form-control" placeholder="Home Tel *" value="" />
</div>
<div class="form-group">
<input name="guardianName" type="text" class="form-control" placeholder="Guardian Name" value="" required>
</div>
<div class="form-group">
<input name="guardianAddress" type="text" class="form-control" placeholder="Guardian Adress" value="" required>
</div>
<div class="form-group">
<input name="guardianRelationship" type="text" class="form-control" placeholder="Guardian Relationship" value="" required>
</div>
<div class="form-group">
<input name="guardianContact" type="text" class="form-control" placeholder="Guardian Contact" value="" required>
</div>
<input type="submit" class="btnRegister" value="Register" />
</div>
</div>
</div>
</div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button>
<button id="tag-form-submit" type="button" class="btn btn-primary">Enter</button>
</div>
</form>
</div>
</div>
</div> -->
<script>
/* stop form from submitting normally */
$("#studentreg").submit(function(event) {
event.preventDefault();
$.fn.serializeObject = function() {
var o = {};
var a = this.serializeArray();
$.each(a, function() {
if (o[this.name] !== undefined) {
if (!o[this.name].push) {
o[this.name] = [o[this.name]];
}
o[this.name].push(this.value || '');
} else {
o[this.name] = this.value || '';
}
});
return o;
};
var data = JSON.stringify($('#studentreg').serializeObject());
console.log("data: " + data)
$.ajax({
type: "POST",
url: "http://127.0.0.1:3000/public/students",
data: data,
dataType: 'json',
contentType: 'application/json;charset=UTF-8',
success: function(response) {
if (response.indexNo != null) {
$(".notify_panel2").notify("User Added", "success");
$('#studentreg')[0].reset();
}
},
error: function(err) {
console.log("Error: ", err)
alert(err);
},
});
});
$('#checkUser').click(function() {
$('#basicExampleModal').modal({
show: true
});
});
$('#updateUser').click(function() {
$('#basicUpdateModal').modal({
show: true
});
});
$('#tag-form-submit').on('click', function(e) {
var cindex = $("#checkIndexNumber").val();
e.preventDefault();
$.ajax({
type: "GET",
url: "http://127.0.0.1:3000/public/students/" + cindex,
data: {
},
success: function(response) {
console.log(response)
if (response.indexNo != null) {
$(".notify_panel").notify("User Exists", "success");
} else {
$(".notify_panel").notify("User does not Exists", "warning");
}
},
error: function(err) {
$(".notify_panel").notify("User does not Exists", "warning");
}
});
return false;
});
</script>
<script src="js/notify.js"></script>
</head>
</html>