-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathadmin.html
More file actions
879 lines (831 loc) · 32.8 KB
/
admin.html
File metadata and controls
879 lines (831 loc) · 32.8 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
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
<html>
<head>
<title>DashBoard</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="https://www.w3schools.com/w3css/4/w3.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
<link href="https://fonts.googleapis.com/css?family=Ubuntu" rel="stylesheet">
<link href="https://fonts.googleapis.com/css?family=Lato" rel="stylesheet">
<link href="https://maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css" rel="stylesheet">
<link href="https://fonts.googleapis.com/css?family=Audiowide|Source+Sans+Pro|Special+Elite" rel="stylesheet">
<link rel="stylesheet" href="https://www.w3schools.com/lib/w3-colors-flat.css">
<style>
.fontAudiowide{
font-family: 'Audiowide', cursive;
}
.fontSpecialElite{
font-family: 'Special Elite', cursive;
}
.fontSourceSansPro{
font-family: 'Source Sans Pro', sans-serif;
color:grey;
}
a[name='dashBoardButtons']:hover{
background-color: red;
}
[name=historyComplaintInfo] .fa {
color: #003366;
}
[name=historyStudentInfo] .fa {
color: #307be1;
}
[name=historyHandymanInfo] .fa {
color: #003366;
}
</style>
</head>
<body>
<div class="w3-sidebar w3-bar-block w3-white w3-center w3-animate-left" style="width:20%">
<h3 class="w3-bar-item w3-center fontSpecialElite w3-border-bottom w3-border-grey" style="margin-bottom:0;">DashBoard</h3>
<a href="#assignDiv" class="w3-bar-item w3-button w3-padding-small w3-hover-blue" id="assignButton" name="dashBoardButtons"><h1><i class="fa fa-briefcase" aria-hidden="true"></i></h1>
<h6 class="fontAudiowide">Assign</h6></a>
<a href="#watchDiv" class="w3-bar-item w3-button w3-padding-small w3-hover-blue" id="watchButton" name="dashBoardButtons"><h1><i class="fa fa-eye" aria-hidden="true"></i></h1>
<h6 class="fontAudiowide">Watch</h6></a>
<a href="#historyDiv" class="w3-bar-item w3-button w3-padding-small w3-hover-blue" id="historyButton" name="dashBoardButtons"><h1><i class="fa fa-history" aria-hidden="true"></i></h1>
<h6 class="fontAudiowide">History</h6></a>
<a href="#infoDiv" class="w3-bar-item w3-button w3-hover-blue w3-border-white" id="infoButton" name="dashBoardButtons"><h1><i class="fa fa-info" aria-hidden="true"></i></h1><h6 class="fontAudiowide">Info</h6></a>
<a class="w3-bar-item w3-button w3-padding-small w3-hover-blue" id="logoutButton" name="dashBoardButtons"><h1><i class="fa fa-sign-out" aria-hidden="true"></i></h1>
<h6 class="fontAudiowide">Log Out</h6></a>
</div>
<!-- //////////////////////////////////// ASSIGN FORM/////////////////////////////////// -->
<div class="w3-flat-clouds w3-display-container" style="margin-left:20%;min-height:100vh;" id="assignDiv" name="commonDivName">
<div style="width:90%;margin:0 auto;">
<div class="w3-white">
<header class="w3-container w3-flat-belize-hole">
<h2 class="fontSourceSansPro w3-text-white" >Assign Work</h2>
</header>
<div class="w3-container fontSourceSansPro">
<form class="w3-margin-top" id="assignForm" method='get' action='/generateWork'>
</form>
</div>
</div>
</div>
</div>
<!-- ////////////////////////////// History ////////////////////////-->
<div class="w3-flat-clouds w3-display-container" style="margin-left:20%;height:100vh;max-height:100vh;overflow-y: scroll;" id="historyDiv" name="commonDivName">
<div class="w3-center" style="width:90%;margin:0 auto;">
<header class="w3-container w3-flat-belize-hole">
<h2 class="fontSourceSansPro w3-text-white" >History</h2>
</header>
<div class="w3-container w3-flat-belize-hole w3-row" style="margin:10px auto;">
<div class="w3-third">
<div class="w3-col m5" style="margin:10px auto; ">
<label>Handyman Id:</label>
</div>
<div class="w3-col m5">
<input type="number" class="w3-input w3-flat-belize-hole w3-text-white w3-border w3-border-white" style="margin: 4px auto;" id="historyHandymanId" placeholder="Input Here">
</div>
</div>
<div class="w3-twothird">
<div class="w3-col m3" style="margin:10px auto; ">
<label class="">Student: </label>
</div>
<div class="w3-col m6" style="margin: 4px auto;">
<input type="radio" name="sInfo" id="sInfo" class="w3-radio" value="name" checked><label>Name</label>
<input type="radio" name="sInfo" id="sInfo" class="w3-radio" value="roll"><label>Roll No</label>
<input type="radio" name="sInfo" id="sInfo" class="w3-radio" value="room"><label>Room No</label>
</div>
<div class="w3-col m3" style="margin: 4px auto;">
<input type="test" id="historySInfoValue" class="w3-input w3-flat-belize-hole w3-text-white w3-border w3-border-white" placeholder="Input Here">
</div>
</div>
</div>
<div class="w3-container w3-flat-belize-hole w3-row" style="margin: 10px auto;">
<div class="w3-third">
<div class="w3-col m5 w3-display-container">
<label class="" style="padding: 70px 0">Equipment:</label>
</div>
<div class="w3-col m5">
<select class="w3-select w3-flat-belize-hole w3-border-0" id="historyEquipment">
<option>Any</option>
</select>
</div>
</div>
<div class="w3-third">
<div class="w3-col m5 w3-display-container">
<label class="">Time:</label>
</div>
<div class="w3-col m5">
<select class="w3-select w3-flat-belize-hole w3-border-0" id="historyTimeSlot">
<option>Any</option>
<option>10:00-12:00</option>
<option>13:00-15:00</option>
<option>16:00-18:00</option>
</select>
</div>
</div>
<div class="w3-third">
<div class="w3-col m5 w3-display-container">
<label class="">Assistance: </label>
</div>
<div class="w3-col m5">
<select class="w3-select w3-flat-belize-hole w3-border-0" id="historyAssistance">
<option>Any</option>
<option>Electrician</option>
<option>Carpenter</option>
<option>Other</option>
</select>
</div>
</div>
</div>
<div class="w3-container w3-flat-belize-hole w3-row" style="margin: 10px auto;">
<div class="w3-third">
<div class="w3-col m5 w3-display-container">
<label class="">Type:</label>
</div>
<div class="w3-col m5">
<select class="w3-select w3-flat-belize-hole w3-border-0" id="historyType">
<option>Any</option>
<option>Personnel</option>
<option>Hostel</option>
</select>
</div>
</div>
<div class="w3-third">
<div class="w3-col m5 w3-display-container">
<label class="">Status:</label>
</div>
<div class="w3-col m5">
<select class="w3-select w3-flat-belize-hole w3-border-0" id="historyStatus">
<option>Any</option>
<option>Lodged</option>
<option>Unsolved</option>
<option>Progress</option>
<option>Solved</option>
<option>Closed</option>
</select>
</div>
</div>
<div class="w3-third">
<div class="w3-col m5 w3-display-container">
<label class="">Rating: </label>
</div>
<div class="w3-col m5 ">
<select class="w3-select w3-flat-belize-hole w3-border-0" id="historyRating">
<option>Any</option>
<option>Poor</option>
<option>Average</option>
<option>Good</option>
</select>
</div>
</div>
</div>
<div class="w3-container w3-flat-belize-hole w3-row" style="margin: 10px auto;">
<div class="w3-third" >
<input class="w3-check" id="historyStudentCheck" type="checkbox" checked="checked">
<label>Student Info</label>
</div>
<div class="w3-third" >
<input class="w3-check" id="historyHandymanCheck" type="checkbox" checked="checked">
<label>Handyman Info</label>
</div>
<div class="w3-third" >
<input class="w3-check" id="historyComplaintCheck" type="checkbox" checked="checked">
<label>Complaint Info</label>
<button class="w3-btn w3-right w3-border-white w3-border w3-hover-blue" onclick="$('#historyButton').trigger('click');"><i class="fa fa-arrow-right" aria-hidden="true"></i></button>
</div>
</div>
</div>
<div id="historyDivChild" class="w3-center" style="width:90%;margin:0 auto;">
</div>
</div>
<!-- ////////////////////////////// Watch ////////////////////////// -->
<div class="w3-flat-clouds w3-display-container" style="margin-left:20%;height:100vh;max-height:100vh;overflow-y: scroll;" id="watchDiv" name="commonDivName">
<div class="w3-center" style="width:90%;margin:0 auto;">
<header class="w3-container w3-flat-belize-hole" style="width:100%;">
<h2 class="fontSourceSansPro w3-text-white" >Watch</h2>
</header>
</div>
<div style="width:90%;margin:0 auto;">
<div class="fontSourceSansPro w3-margin-top">
<div class="w3-center">
<header class="w3-container w3-tag w3-center w3-flat-belize-hole w3-margin-top">
<h5 class="fontSourceSansPro w3-center w3-text-white" >Electrician</h5>
</header>
</div>
<div id="watchDivElectrician" class="w3-margin-top">
</div>
<div class="w3-center">
<header class="w3-container w3-tag w3-center w3-flat-belize-hole">
<h5 class="fontSourceSansPro w3-center w3-text-white" >Carpenter</h5>
</header>
</div>
<div id="watchDivCarpenter" class="w3-margin-top">
</div>
<div class="w3-center">
<header class="w3-container w3-tag w3-center w3-flat-belize-hole">
<h5 class="fontSourceSansPro w3-center w3-text-white" >Others</h5>
</header>
</div>
<div id="watchDivOthers" class="w3-margin-top">
</div>
</div>
</div>
</div>
<!-- ////////////////////////////// Info ////////////////////////-->
<div class="w3-flat-clouds w3-display-container" style="margin-left:20%;height:100vh;" id="infoDiv" name="commonDivName">
<div class="w3-display-middle" style="width:70%;">
<div class="w3-white ">
<header class="w3-container w3-flat-belize-hole">
<h2 class="fontSourceSansPro w3-text-white" >Welcome <span id="userName"></span>
<span id="changePass"><h6 style="display:inline;"><button class="w3-btn w3-right w3-hover-blue w3-border-white w3-border" id="changeInfo" onclick="$('#changeInfoModal').css('display','block');">Change Info</button></h6></span></h2>
</header>
<div class="w3-container fontSourceSansPro">
<input id="admin_id" name="admin_id" value="" style="display:none;">
<h2><span class="fa fa-user-o w3-col m2 s4"></span></h2><h3><span id="actype" class="w3-rest"></span></h3>
<h2><span class="fa fa-envelope-o w3-col m2 s4"></span></h2><h3><span id="email" class="w3-rest"></span></h3>
<h2><span class="fa fa-phone w3-col m2 s4"></span></h2><h3><span id="mobile" class="w3-rest"></span></h3>
</div>
</div>
<div class="w3-margin-top">
<div class="w3-third w3-light-grey">
<header style="text-align: center;" class="fontSourceSansPro">
<span class="w3-border-bottom w3-border-blue w3-tag w3-jumbo w3-flat-belize-hole w3-padding-large">
<span id="complaintsRegistered">5</span>
<h5 style="padding:0;margin:0;">Registered</h5></span>
</header>
</div>
<div class="w3-third w3-light-grey">
<header style="text-align: center;" class="fontSourceSansPro">
<span class="w3-border-bottom w3-border-blue w3-tag w3-jumbo w3-flat-belize-hole w3-padding-large">
<span id="complaintsSolved">4</span>
<h5 style="padding:0;margin:0;">Completed</h5></span>
</header>
</div>
<div class="w3-third w3-light-grey">
<header style="text-align: center;" class="fontSourceSansPro">
<span class="w3-border-bottom w3-border-blue w3-tag w3-jumbo w3-flat-belize-hole w3-padding-large">
<span id="complaintsPending">1</span>
<h5 style="padding:0;margin:0;">Pending</h5></span>
</header>
</div>
</div>
</div>
</div>
<!-- /////////////////////////////////////////// Change Info Modal ////////////////////////////////////////// -->
<div id="changeInfoModal" class="w3-modal w3-card-4 w3-animate-zoom">
<div class="w3-modal-content">
<header class="w3-flat-belize-hole w3-container">
<span onclick="closeChangeModal('changeInfoModal');" class="w3-button w3-display-topright w3-hover-blue">×</span>
<h2 class="fontSourceSansPro w3-text-white" >Change Info</h2>
</header>
<div class="w3-container w3-padding-16 w3-center">
<div class=" w3-container" style="margin:5px auto;width:50%;">
<input class="w3-input w3-border fontSourceSansPro" id="old_pass" type="password" val="" placeholder="Old Password" style="margin:5px;">
<input class="w3-input w3-border fontSourceSansPro" id="new_pass" type="password" value="" placeholder="New Password" style="margin:5px;">
<input class="w3-input w3-border fontSourceSansPro" id="new_re_pass" type="password" val="" placeholder="Re-Enter New Password" style="margin:5px;">
<input class="w3-button w3-hover-blue w3-flat-belize-hole" id="changeInfoButton" type="button" value="Change Password" style="margin:5px;">
</div>
</div>
<div class="w3-container w3-padding-16 w3-center">
<div class=" w3-container" style="margin:5px auto;width:50%;">
<input class="w3-input w3-border fontSourceSansPro" id="new_phone_no" type="number" val="" placeholder="Phone_no" style="margin:5px;">
<input class="w3-button w3-hover-blue w3-flat-belize-hole" id="changePhoneButton" type="button" value="Update Phone no" style="margin:5px;">
</div>
</div>
</div>
</div>
</body>
<script>
$('[name="dashBoardButtons"]').click(function(){
$('[name="dashBoardButtons"]').removeClass('w3-border-light-grey w3-rightbar w3-flat-belize-hole');
$(this).addClass('w3-border-light-grey w3-rightbar w3-flat-belize-hole');
$('[name="commonDivName"]').addClass('w3-hide');
$('[name="commonDivName"]').removeClass('w3-animate-zoom');
$($(this).attr('href')).removeClass('w3-hide').addClass('w3-animate-zoom');
});
$('#assignButton').addClass('w3-border-light-grey w3-rightbar w3-flat-belize-hole');
$('[name="commonDivName"]').addClass('w3-hide');
$('[name="commonDivName"]').removeClass('w3-animate-zoom');
$('#assignDiv').removeClass('w3-hide').addClass('w3-animate-zoom');
$.ajax({
type:'get',
url:'/getAllEquipment',
success:function(data){
data=JSON.parse(data);
//console.log(data);
$("#historyEquipment").html("")
$("#historyEquipment").append("<option>Any</option>");
for(i in data)
$("#historyEquipment").append("<option>"+data[i].equipment+"</option>")
}
});
$('#assignButton').click(function(){
$.ajax({
type:'get',
url:'/adminGetAllHandyManInfo',
success:function(data){
if(data=="false"){
return;
}
data=JSON.parse(data);
//console.log(data);
$('#assignForm').html('');
for(i in data)
createAssignForm(data[i]);
$('#assignForm').append(
'<div class="w3-center w3-margin-top">'+
'<input class="w3-button w3-flat-belize-hole w3-hover-blue" type="submit" id="submitAssign" value="Generate">'+
'</div>'
);
}
});
});
$('#watchButton').click(function(){
var arr=["Electrician","Carpenter","Others"];
$.ajax({
type:'get',
url:'/adminGetAllHandyManInfo',
async:false,
success:function(data){
if(data=="false"){
return;
}
data=JSON.parse(data);
for(i in arr){
$("#watchDiv"+arr[i]).html("")
}
for(i in data){
var handymanType="Others";
//console.log(data[i]);
if(data[i].Catagory=="Electrician"){
handymanType="Electrician"
}
else if(data[i].Catagory=="Carpenter"){
handymanType="Carpenter";
}
$.ajax({
type:'get',
url:'/getHandyManRating',
async:false,
data:{
"handyman_id":data[i].handyman_id
},
success:function(rating){
if(rating=="false"){
alert("Error Try Again");
return;
}
data[i].rating=(JSON.parse(rating))[0].rating;
if(data[i].rating==null){
data[i].rating="-";
}
createWatch(handymanType,data[i]);
}
});
}
},
complete:function(){
for(i in arr){
if($("#watchDiv"+arr[i]).html()==""){
$("#watchDiv"+arr[i]).append(
'<div style="width:100%"><h4 class="w3-center fontAudiowide w3-text-grey">NO HANDYMAN HERE</h4></div>'
);
}
}
}
});
});
var assignForm = $('#assignForm');
assignForm.submit(function(){
$.ajax({
type:assignForm.attr('method'),
url: assignForm.attr('action'),
data: assignForm.serialize(),
timeout:10000,
success:function(data){
if(data=="true"){
//console.log(typeof data);
$("#submitAssign").fadeOut("slow",function() {
$(this).val("DONE");
$(this).prop("disabled",true);
}).fadeIn("slow",function(){
});
setTimeout(function(){$("#submitAssign").fadeOut("slow",function(){
$(this).val("Generate");
$(this).prop("disabled",false);
}).fadeIn("slow",function(){
$('#assignForm')[0].reset();
})},5000);
}
},
error: function(jqXHR, textStatus){
if(textStatus === 'timeout')
{
alert('TimeOut Try Again');
}
}
});
return false;
});
$('#historyButton').click(function(){
$.ajax({
type:'get',
url:'/adminGetAllHistory',
data:{
sInfoRadio:$('[name="sInfo"]:checked').val(),
sInfoValue:$('#historySInfoValue').val(),
handyman_id:$('#historyHandymanId').val(),
subject:$('#historyEquipment').val(),
catagory:$("#historyAssistance").val(),
time_slot:$("#historyTimeSlot").val(),
type:$("#historyType").val(),
status:$("#historyStatus").val(),
rating:$("#historyRating").val()
},
success:function(data){
data=JSON.parse(data);
//console.log(data);
$("#historyDivChild").html("");
for(var i=0;i<data.length;++i){
createHistory(data[i]);
}
if($('#historyHandymanCheck').prop('checked')==false){
$("[name='historyHandymanInfo']").addClass('w3-hide');
}
if($('#historyComplaintCheck').prop('checked')== false){
$("[name='historyComplaintInfo']").addClass('w3-hide');
}
if($('#historyStudentCheck').prop('checked')== false){
$("[name='historyStudentInfo']").addClass('w3-hide');
}
}
})
})
$('#logoutButton').click(function(){
$.ajax({
type: 'get',
url: '/logout',
success: function(data){
if(data=="true"){
window.location.href="./";
}
}
});
});
$(document).ready(function(){
$('#infoButton').trigger('click');
});
$("#infoButton").click(function(){
$.ajax({
type: 'get',
url: '/getData',
data:{
'email':sessionStorage.email,
'type':sessionStorage.type
},
success: function (data) {
if(data=="false")
window.location.href = "./";
else{
var value=JSON.parse(data);
//console.log(value);
$("#admin_id").val(value[0].admin_id);
$("#userName").html(" "+value[0].name);
$("#actype").html(" Admin");
$("#email").html(" "+value[0].email);
$("#mobile").html(" "+value[0].phone_no);
}
},
complete:function(data){
$.ajax({
type:'get',
url:'/adminComplaintAnalysis',
success:function(data){
data=JSON.parse(data);
//console.log(data);
if(data!="false"){
$("#complaintsRegistered").html(data[0].total);
if(data.length>1){
$("#complaintsSolved").html(data[1].total);
$("#complaintsPending").html(data[0].total-data[1].total);
}
else{
$("#complaintsSolved").html(data[0].total);
$("#complaintsPending").html(0);
}
}
}
});
}
});
});
$('#changeInfoButton').click(function(){
var passw= /[^A-Za-z0-9!@_]/;
if($("#old_pass").val().match(passw)||$("#new_pass").val().match(passw))
{
alert("A-Z a-z 0-9 and !@_ are allowed");
return false;
}
else if($("#old_pass").val().length>15||$("#old_pass").val().length<7||$("#new_pass").val().length>15||$("#new_pass").val().length<7)
{
alert("password length must be between 7-15");
return false;
}
else if($("#new_pass").val()!=$("#new_re_pass").val())
{
alert("Re-Enter password wrong");
return false;
}
$.ajax({
type:'get',
url:'/changeAdminPass',
data:{
"admin_id":$("#admin_id").val(),
"old_Pass":$("#old_pass").val(),
"new_Pass":$("#new_pass").val()
},
success:function(data){
if(data=="old"){
alert("Wrong Old Password");
return false;
}
if(data=="false"){
alert("Something went wrong, Try Again");
return false;
}
else
{
alert("updated Successfully");
$("#old_pass").val("");
$("#new_pass").val("");
$("#new_re_pass").val("");
$("#new_phone_no").val("");
return true;
}
}
});
});
$("#changePhoneButton").click(function(){
if($("#new_phone_no").val().length!=10){
alert("Must be of 10 digit");
return false;
}
$.ajax({
type:'get',
url:'/changeAdminPhone',
data:{
"admin_id":$("#admin_id").val(),
"new_phone":$("#new_phone_no").val(),
},
success:function(data){
if(data=="false"){
alert("Something went wrong, Try Again");
return false;
}
else
{
alert("updated Successfully");
$("#old_pass").val("");
$("#new_pass").val("");
$("#new_re_pass").val("");
$("#new_phone_no").val("");
$('#infoButton').trigger('click');
return true;
}
}
});
})
function createHistory(data){
var c=data.c;
var h=data.h;
var s=data.s;
if(c.status==0){
c.status="Lodged";
}
if(c.status==1){
c.status="In progress";
}
if(c.status==2){
c.status="Solved";
}
if(c.status==3){
c.status="Closed";
}
$('#historyDivChild').append(
'<div class=" w3-panel w3-white" id="panel_'+c.complaint_id+'">'+
'<div name="historyComplaintInfo">'+
'<div class="w3-row">'+
'<div class="w3-third fontSourceSansPro">'+
'<h5><span class="fa fa-id-badge w3-col m1 s3 w3-hide-small w3-hide-medium"></span></h5><h6><span><b>C_Id: </b></span><span ><span class="w3-rest"> '+c.complaint_id+'</span></h6>'+
'</div>'+
'<div class="w3-third fontSourceSansPro">'+
'<h5><span class="fa fa-calendar w3-col m1 s3 w3-hide-small w3-hide-medium"></span></h5><h6><span><b>Date: </b></span><span> '+c.date.split("T")[0]+'</span></h6>'+
'</div>'+
'<div class="w3-third fontSourceSansPro">'+
'<h5><span class="fa fa-clock-o w3-col m1 s3 w3-hide-small w3-hide-medium"></span></h5><h6><h6><span><b>Time: </b></span><span >'+c.date.split("T")[1].split(".")[0]+'</span></h6>'+
'</div>'+
'</div>'+
'<div class="w3-row">'+
'<div class="w3-third fontSourceSansPro">'+
'<h5><span class="fa fa-lightbulb-o w3-col m1 s3 w3-hide-small w3-hide-medium"></span></h5><h6><span><b>Equipment: </b></span><span > '+c.subject+'</span></h6>'+
'</div>'+
'<div class="w3-third fontSourceSansPro">'+
'<h5><span class="fa fa-list-ul w3-col m1 s3 w3-hide-small w3-hide-medium"></span></h5><h6><span><b>Type: </b></span><span ><span class="w3-rest"> '+c.type+'</span></h6>'+
'</div>'+
'<div class="w3-third fontSourceSansPro">'+
'<h5><span class="fa fa-user-o w3-col m1 s3 w3-hide-small w3-hide-medium"></span></h5><h6><span><b>Assistance: </b></span><span ><span class="w3-rest"> '+c.catagory+'</span></h6>'+
'</div>'+
'</div>'+
'<div class="w3-row">'+
'<div class="w3-third fontSourceSansPro">'+
'<h5><span class="fa fa-clock-o w3-col m1 s3 w3-hide-small w3-hide-medium"></span></h5><h6><span><b>Slot: </b></span><span ><span class="w3-rest"> '+c.time_slot+'</span></h6>'+
'</div>'+
'<div class="w3-third fontSourceSansPro">'+
'<h5><span class="fa fa-inr w3-col m1 s3 w3-hide-small w3-hide-medium"></span></h5><h6><span><b>Cost: </b></span><span ><span class="w3-rest"> '+c.cost+'</span></h6>'+
'</div>'+
'<div class="w3-third fontSourceSansPro w3-dropdown-hover">'+
'<h5><span class="fa fa-pencil w3-col m1 s3 w3-hide-small w3-hide-medium"></span></h5><h6><span><b>Description: </b></span><span ><span class="w3-rest"> '+c.description+'</span></h6>'+
'<div class="w3-dropdown-content w3-card-4" >'+
'<div class="w3-container">'+
'<p>'+c.descriptionFull+'</p>'+
'</div>'+
'</div>'+
'</div>'+
'</div>'+
'</div>'+
'<div name="historyStudentInfo">'+
'<div class="w3-row">'+
'<div class="w3-third fontSourceSansPro">'+
'<h5><span class="fa fa-id-badge w3-col m1 s3 w3-hide-small w3-hide-medium"></span></h5><h6><span><b>S_Id: </b></span><span ><span class="w3-rest"> '+s.student_id+'</span></h6>'+
'</div>'+
'<div class="w3-third fontSourceSansPro">'+
'<h5><span class="fa fa-phone w3-col m1 s3 w3-hide-small w3-hide-medium"></span></h5><h6><span><b>Phone no </b></span><span ><span class="w3-rest"> '+s.phone_no+'</span></h6>'+
'</div>'+
'<div class="w3-third fontSourceSansPro">'+
'<h5><span class="fa fa-envelope-o w3-col m1 s3 w3-hide-small w3-hide-medium"></span></h5><h6><span><b>Email: </b></span><span ><span class="w3-rest"> '+s.email+'</span></h6>'+
'</div>'+
'</div>'+
'<div class="w3-row">'+
' <div class="w3-third fontSourceSansPro">'+
' <h5><span class="fa fa-user-circle-o w3-col m1 s3 w3-hide-small w3-hide-medium"></span></h5><h6><span><b>Name: </b></span><span ><span class="w3-rest"> '+s.name+'</span></h6>'+
' </div>'+
' <div class="w3-third fontSourceSansPro">'+
' <h5><span class="fa fa-home w3-col m1 s3 w3-hide-small w3-hide-medium"></span></h5><h6><span><b>Room: </b></span><span ><span class="w3-rest"> '+s.gender+' '+s.room_no+'</span></h6>'+
' </div>'+
' <div class="w3-third fontSourceSansPro">'+
' <h5><span class="fa fa-sort-alpha-asc w3-col m1 s3 w3-hide-small w3-hide-medium"></span></h5><h6><span><b>Roll No: </b></span><span ><span class="w3-rest"> '+s.roll_no+'</span></h6>'+
' </div>'+
'</div>'+
'</div>'+
'<div name="historyHandymanInfo">'+
'<div class="w3-row">'+
'<div class="w3-third fontSourceSansPro">'+
'<h5><span class="fa fa-id-badge w3-col m1 s3 w3-hide-small w3-hide-medium"></span></h5><h6><span><b>H_Id: </b></span><span ><span class="w3-rest"> '+h.handyman_id+'</span></h6>'+
'</div>'+
'<div class="w3-third fontSourceSansPro">'+
'<h5><span class="fa fa-envelope-o w3-col m1 s3 w3-hide-small w3-hide-medium"> </span></h5><h6><span><b> Email: </b></span><span ><span class="w3-rest"> '+h.email+'</span></h6>'+
'</div>'+
'<div class="w3-third fontSourceSansPro">'+
'<h5><span class="fa fa-phone w3-col m1 s3 w3-hide-small w3-hide-medium"> </span></h5><h6><span><b> Phone no: </b></span><span ><span class="w3-rest"> '+h.phone_no+'</span></h6>'+
'</div>'+
'</div>'+
'<div class="w3-row">'+
'<div class="w3-third fontSourceSansPro">'+
'<h5><span class="fa fa-male w3-col m1 s3 w3-hide-small w3-hide-medium"> </span></h5><h6><span><b> Name: </b></span><span ><span class="w3-rest"> '+h.name+'</span></h6>'+
'</div>'+
'<div class="w3-third fontSourceSansPro">'+
'<h5><span class="fa fa-wrench w3-col m1 s3 w3-hide-small w3-hide-medium"> </span></h5><h6><span><b> Catagory: </b></span><span ><span class="w3-rest"> '+h.Catagory+'</span></h6>'+
'</div>'+
'<div class="w3-third fontSourceSansPro">'+
'<h5><span class="fa fa-star w3-col m1 s3 w3-hide-small w3-hide-medium"> </span></h5><h6><span><b> Rating: </b></span><span ><span class="w3-rest"> '+c.rating+'</span></h6>'+
'</div>'+
'</div>'+
'</div>'+
'</div>');
if(c.status=="Solved"){
$('#panel_'+c.complaint_id).addClass('w3-border-blue w3-rightbar');
}
if(c.status=="In progress"){
$('#panel_'+c.complaint_id).addClass('w3-border-yellow w3-rightbar');
}
if(c.status=="Lodged"){
$('#panel_'+c.complaint_id).addClass('w3-border-red w3-rightbar');
}
if(c.status=="Closed"){
$('#panel_'+c.complaint_id).addClass('w3-border-green w3-rightbar');
}
}
function createAssignForm(data){
$("#assignForm").append(
'<div class="w3-row w3-margin-top" style="margin:0 auto;">'+
'<div class="w3-col m1 w3-container s2 w3-center">'+
' <div class="w3-container w3-flat-belize-hole">'+
' <h3 class="fontSourceSansPro w3-text-white">'+(data.Catagory).charAt(0)+'</h3>'+
' </div>'+
'</div>'+
'<div class="w3-col m3 s3">'+
' <h5>'+data.name+'</h5>'+
'</div>'+
'<div class="w3-col m3 s3">'+
' <h5>'+data.phone_no+'</h5>'+
'</div>'+
'<div class="w3-col m3 s3">'+
' <h5>'+data.email+'</h5>'+
'</div>'+
'<div class="w3-col m1 s1 w3-right">'+
'<input class="w3-check" type="checkbox" name="handyman_'+data.handyman_id+'">'+
'</div>'+
'</div>'
);
}
function createWatch(handymanType,data){
////console.log(data);
$("#watchDiv"+handymanType).append(
'<div class="w3-panel w3-white w3-margin-top ">'+
'<div class="w3-row fontSourceSansPro" style="margin:0 auto;">'+
'<div class="w3-col m3 w3-mobile">'+
' <h5>'+data.name+'</h5>'+
'</div>'+
'<div class="w3-col m3 w3-mobile">'+
' <h5>'+data.phone_no+'</h5>'+
'</div>'+
'<div class="w3-col m4 w3-mobile">'+
' <h5>'+data.email+'</h5>'+
'</div>'+
'<div class="w3-col m1 w3-mobile">'+
'<h5>'+data.rating+'<span class="fa fa-star"></span></h5>'+
'</div>'+
'<div class="w3-right">'+
'<button class="w3-button w3-flat-belize-hole w3-hover-blue" type="button" style="width:100%;" id="watch_'+data.handyman_id+'"><i class="fa fa-caret-down" aria-hidden="true"></i></button>'+
'</div>'+
'</div>'+
'<div class="w3-hide" id="watchAnalysisDiv_'+data.handyman_id+'">'+
'<div class="w3-section w3-row">'+
'<div class="w3-center">'+
'<header class="w3-container w3-center w3-flat-belize-hole">'+
' <h5 class="fontSourceSansPro w3-center w3-text-white" >Today"s Analysis</h5>'+
'</header>'+
'</div>'+
'<div class="w3-third">'+
' <header style="text-align: center;" class="fontSourceSansPro">'+
' <span class="w3-border-bottom w3-border-blue w3-tag w3-jumbo w3-flat-belize-hole w3-padding-large">'+
' <span id="todayComplaintsRegistered_'+data.handyman_id+'">NA</span>'+
' <h5 style="padding:0;margin:0;">Registered</h5></span>'+
' </header>'+
'</div>'+
'<div class="w3-third">'+
' <header style="text-align: center;" class="fontSourceSansPro">'+
' <span class="w3-border-bottom w3-border-blue w3-tag w3-jumbo w3-flat-belize-hole w3-padding-large">'+
' <span id="todayComplaintsSolved_'+data.handyman_id+'">NA</span>'+
' <h5 style="padding:0;margin:0;">Completed</h5></span>'+
' </header>'+
'</div>'+
'<div class="w3-third w3-margin-bottom">'+
' <header style="text-align: center;" class="fontSourceSansPro">'+
' <span class="w3-border-bottom w3-border-blue w3-tag w3-jumbo w3-flat-belize-hole w3-padding-large">'+
' <span id="todayComplaintsPending_'+data.handyman_id+'">NA</span>'+
' <h5 style="padding:0;margin:0;">Pending</h5></span>'+
' </header>'+
'</div>'+
'</div>'+
'<div class="w3-section">'+
' <div class="w3-center">'+
' <header class="w3-container w3-center w3-flat-belize-hole">'+
' <h5 class="fontSourceSansPro w3-center w3-text-white" >Overall Analysis</h5>'+
' </header>'+
' </div>'+
' <div class="w3-third">'+
' <header style="text-align: center;" class="fontSourceSansPro">'+
' <span class="w3-border-bottom w3-border-blue w3-tag w3-jumbo w3-flat-belize-hole w3-padding-large">'+
' <span id="complaintsRegistered_'+data.handyman_id+'">NA</span>'+
' <h5 style="padding:0;margin:0;">Registered</h5></span>'+
' </header>'+
' </div>'+
' <div class="w3-third">'+
' <header style="text-align: center;" class="fontSourceSansPro">'+
' <span class="w3-border-bottom w3-border-blue w3-tag w3-jumbo w3-flat-belize-hole w3-padding-large">'+
' <span id="complaintsSolved_'+data.handyman_id+'">NA</span>'+
' <h5 style="padding:0;margin:0;">Completed</h5></span>'+
' </header>'+
' </div>'+
' <div class="w3-third w3-margin-bottom">'+
' <header style="text-align: center;" class="fontSourceSansPro">'+
' <span class="w3-border-bottom w3-border-blue w3-tag w3-jumbo w3-flat-belize-hole w3-padding-large">'+
' <span id="complaintsPending_'+data.handyman_id+'">NA</span>'+
' <h5 style="padding:0;margin:0;">Unattended</h5></span>'+
' </header>'+
' </div>'+
'</div>'+
'</div>'+
'</div>'
);
$("#watch_"+data.handyman_id).click(function(){
$("#watchAnalysisDiv_"+data.handyman_id).toggleClass("w3-hide w3-animate-top");
})
$("#complaintsRegistered_"+data.handyman_id).html(data.issued);
$("#complaintsSolved_"+data.handyman_id).html(data.solved);
$("#complaintsPending_"+data.handyman_id).html(data.issued-data.solved);
var totalToday=data.slot1+data.slot2+data.slot3;
$("#todayComplaintsRegistered_"+data.handyman_id).html(totalToday);
$("#todayComplaintsSolved_"+data.handyman_id).html(data.today);
$("#todayComplaintsPending_"+data.handyman_id).html(totalToday-data.today);
}
function closeChangeModal(data){
document.getElementById(data).style.display='none';
$("#old_pass").val("");
$("#new_pass").val("");
$("#new_re_pass").val("");
}
</script>
</html>