forked from BackCheck/backcheck.io.verify
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathfollowups_check.php
More file actions
590 lines (467 loc) · 16.6 KB
/
followups_check.php
File metadata and controls
590 lines (467 loc) · 16.6 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
<?php
include ('include/config.php');
include ('include/config_actions.php');
?> <script type="text/javascript" src="<?php echo SURL;?>scripts/jquery-latest.js"></script>
<script type="text/javascript" language="javascript" src="https://cdn.datatables.net/1.10.11/js/jquery.dataTables.min.js"></script><link rel="stylesheet" type="text/css" href="https://cdn.datatables.net/1.10.11/css/jquery.dataTables.min.css">
<?php
if(isset($_REQUEST['forbulkupdate']))
{
print_r($_REQUEST);
}
if(isset($_REQUEST['singleupdate']))
{
print_r($_REQUEST);
}
?>
<div id="tabs">
<ul>
<!-- <li><a href="#tabs-1">Savvion Checks</a></li>
--> <li><a href="#tabs-2">Local Checks</a></li>
</ul>
<?php /*?><div id="tabs-1">
<h2>Savvion Checks</h2>
<table>
<form method="post">
<input type="text" name="searchfield" value="<?=$_REQUEST['searchfield']?>" />
<select name="selectby">
<option value="0" >--Search By--</option>
<option value="subbarcode" <?php if($_REQUEST['selectby'] == "subbarcode"){echo "selected";}?>>Sub Barcode</option>
<option value="ianame" <?php if($_REQUEST['selectby'] == "ianame"){echo "selected";}?>>IA Name</option>
<option value="applicantname" <?php if($_REQUEST['selectby'] == "applicantname"){echo "selected";}?>>Candidate</option>
</select>
<input type="submit" name="searched" value="Search" />
</form>
<form method="post" id="formsubmit">
<input type="hidden" name="bulkupdate" value="yes" />
<input type="hidden" name="checkbulk_sav" value="yes" />
<div id="commonmessage_savv" style="display:none"><textarea name="commonmessage" id="commonmessage" placeholder="Type Here Common Message"></textarea></div>
<thead>
<tr>
<th><input type="checkbox" id="select_all"/></th>
<th>Serial # </th>
<th>Sub Barcode</th>
<th>IA Name</th>
<th>Candidate</th>
<th>Qualification</th>
<th>Create Date</th>
<th>Internal History</th>
<th>Internal Comment</th>
<th>External History</th>
<th>External Comment</th>
<th>Action</th>
</tr>
</thead>
<tbody id="loadmoreresponse">
<?php
SELECT * FROM records WHERE subbarcode LIKE '%HUSSAIN%' OR EMP_IA_Name LIKE '%HUSSAIN%'
OR HLT_ia_name LIKE '%HUSSAIN%' OR EDU_ia_name LIKE '%HUSSAIN%' OR applicantname LIKE '%HUSSAIN%'
if(isset($_REQUEST['searched']))
{
$searchfield = $_REQUEST['searchfield'];
$selectby = $_REQUEST['selectby'];
if($searchfield != "" && $selectby == "" || $selectby == "0")
{
$searchTerms = explode(' ', $searchfield);
$searchTermBits = array();
foreach ($searchTerms as $term) {
$term = trim($term);
if (!empty($term)) {
$searchTermBits1[] = "EMP_IA_Name LIKE '%$term%'";
}
}
$searchTerms = explode(' ', $searchfield);
$searchTermBits = array();
foreach ($searchTerms as $term) {
$term = trim($term);
if (!empty($term)) {
$searchTermBits2[] = "HLT_ia_name LIKE '%$term%'";
}
}
$searchTerms = explode(' ', $searchfield);
$searchTermBits = array();
foreach ($searchTerms as $term) {
$term = trim($term);
if (!empty($term)) {
$searchTermBits3[] = "EDU_ia_name LIKE '%$term%'";
}
}
$searchTerms = explode(' ', $searchfield);
$searchTermBits = array();
foreach ($searchTerms as $term) {
$term = trim($term);
if (!empty($term)) {
$applicantname[] = "applicantname LIKE '%$term%'";
}
}
$where = "and subbarcode LIKE '%".$searchfield."%' OR ".implode(' AND ', $searchTermBits1)." OR ".implode(' AND ', $searchTermBits2)." OR ".implode(' AND ', $searchTermBits3)." OR ".implode(' AND ', $applicantname)."";
$select_by = "noby";
}
else if($searchfield != "" && $selectby != "" && $selectby != "0")
{
if($selectby == "subbarcode")
{
$where = "and subbarcode LIKE '%".$searchfield."%'";
}
else if($selectby == "ianame")
{
$searchTerms = explode(' ', $searchfield);
$searchTermBits = array();
foreach ($searchTerms as $term) {
$term = trim($term);
if (!empty($term)) {
$searchTermBits1[] = "EMP_IA_Name LIKE '%$term%'";
}
}
$searchTerms = explode(' ', $searchfield);
$searchTermBits = array();
foreach ($searchTerms as $term) {
$term = trim($term);
if (!empty($term)) {
$searchTermBits2[] = "HLT_ia_name LIKE '%$term%'";
}
}
$searchTerms = explode(' ', $searchfield);
$searchTermBits = array();
foreach ($searchTerms as $term) {
$term = trim($term);
if (!empty($term)) {
$searchTermBits3[] = "EDU_ia_name LIKE '%$term%'";
}
}
$where = "and ".implode(' AND ', $searchTermBits1)." OR ".implode(' AND ', $searchTermBits2)." OR ".implode(' AND ', $searchTermBits3)."";
}
else if($selectby == "applicantname")
{
$searchTerms = explode(' ', $searchfield);
$searchTermBits = array();
foreach ($searchTerms as $term) {
$term = trim($term);
if (!empty($term)) {
$searchTermBits[] = "applicantname LIKE '%$term%'";
}
}
$where = "and ".implode(' AND ', $searchTermBits)."";
}
$select_by = $selectby;
}
else
{
$where = "";
$searchfield = "nosearch";
$select_by = "noby";
}
}
$records = $db->select("records","*","1=1 $where LIMIT 0,10");
$inc = 1;
while($savvion = mysql_fetch_array($records))
{
switch($savvion['component']){
case "education":
$ia_name = urldecode($savvion['EDU_ia_name']);
$qualification = urldecode($savvion['EDU_QualificationSelect_Ver']);
$history = urldecode($savvion['EDU_history']);
$component = "EDU_";
break;
case "employment":
$ia_name = urldecode($savvion['EMP_IA_Name']);
$qualification = "-";
$history = urldecode($savvion['EMP_history']);
$component = "EMP_";
break;
case "healthlicense":
$ia_name = urldecode($savvion['HLT_ia_name']);
$qualification = "-";
$history = urldecode($savvion['HLT_history']);
$component = "HLT_";
break;
default:
$ia_name = "";
$qualification = "-";
$history = "-";
$component = "";
}
?>
<tr>
<td id="record_list_<?=$savvion['primid']?>">
<input type="checkbox" name="select[]" id="checkid[]" class="cheks savchecks checksingle_sav_<?=$savvion['primid']?>" value="<?=$savvion['primid']?>"/>
</td>
<td><?=$inc?></td>
<td><?=$savvion['subbarcode']?></td>
<td><?=$ia_name?></td>
<td><?=urldecode($savvion['applicantname'])?></td>
<td><?=$qualification?></td>
<td><?=date("d-m-Y",strtotime($savvion['Timestamp']))?></td>
<td><textarea readonly="readonly"><?php if($history != "" && $history != '-'){echo $history;}else{echo '-';}?></textarea></td>
<td><textarea id="intrcmnt_<?=$savvion['primid']?>" name="intrcmnt_<?=$savvion['primid']?>"><?=$savvion['InsufficiencyComment']?></textarea>
</td>
<td><textarea readonly="readonly"><?php if($history != "" && $history != '-'){echo $history;}else{echo '-';}?></textarea></td>
<td><textarea name="extrnlcmnt_<?=$savvion['primid']?>" id="extrnlcmnt_<?=$savvion['primid']?>"><?=$savvion['extra_qc_comments']?></textarea></td>
<td>
<input type="hidden" name="checkcomponent_<?=$savvion['primid']?>" id="check_comp_<?=$savvion['primid']?>" value="<?=$component?>" />
<input type="button" onclick="submitsinglerecord(<?=$savvion['primid']?>,'savv_sing');" name="singleupdate" value="Submit" /></td>
</tr>
<?php
$inc++;
}
?>
<input type="submit" name="forbulkupdate" value="All Update" />
</tbody>
</form>
</table>
<div id="nomoreres_savv" style="display:none;">No More Result Found.</div>
<button type="button" class="btn btn-success btn-lg" id="load_more"><i class="icon-rotate-cw3 position-left"></i> Load More</button>
</div><?php */?>
<!--tab 1 close here and tab 2 start-->
<div id="ta ">
<h2>Local Checks</h2>
<style>
.fornotrecord { width:100%; color:#FF0000;}
</style>
<form method="post">
<input type="text" name="searchfield_loc" value="<?=$_REQUEST['searchfield_loc']?>" /><input type="submit" name="searched_loc" value="Search" />
</form>
<table id="example" class="table">
<form method="post" id="formsubmit_loc">
<input type="hidden" name="bulkupdate" value="yes" />
<input type="hidden" name="checkbulk_loc" value="yes" />
<div id="commonmessage_loc" style="display:none"><textarea name="commonmessage" id="commonmessage" placeholder="Type Here Common Message"></textarea></div>
<thead>
<tr>
<th><input type="checkbox" id="select_all_loc"/></th>
<th>Serial # </th>
<th>Barcode</th>
<th>IA Name</th>
<th>TAT</th>
<th>V Status</th>
<th>Follow Up History</th>
<th>Add Follow Ups</th>
<th>Check Add Date</th>
<th>Action</th>
</tr>
</thead>
<tbody id="loadmoreresponse_loc">
<?php
if(isset($_REQUEST['searched_loc']))
{
$searchfield_loc = $_REQUEST['searchfield_loc'];
$searchTerms = explode(' ', $searchfield_loc);
$searchTermBits = array();
foreach ($searchTerms as $term) {
$term = trim($term);
if (!empty($term)) {
$searchTermBits[] = "ui.uni_Name LIKE '%$term%'";
}
}
$where = "and vc.as_bcode LIKE '%".$searchfield_loc."%' OR ".implode(' AND ', $searchTermBits)."";
}
else
{
$where = "";
$searchfield_loc = "nosearch";
}
$tabl = "ver_checks vc INNER JOIN add_data ad ON vc.as_id=ad.as_id INNER JOIN ver_data vd ON vc.v_id=vd.v_id INNER JOIN uni_info ui ON vc.as_uni=ui.uni_id";
$cols = "*";
$selRoles = $db->select($tabl,$cols,"vc.as_vstatus='Followup' $where AND vc.checks_id=1 AND vc.as_uni <> 0 AND vc.as_isdlt = 0 AND vd.v_isdlt = 0 AND vc.as_status <> 'Close' GROUP BY vc.as_id ORDER BY vc.as_addate DESC ");
//$records_loc = $db->select("records","*","1=1 $where LIMIT 0,10");
/*$savvion2 = mysql_fetch_array($selRoles);
print_r($savvion2);*/
//echo $tabl.$cols."vc.as_vstatus='Followup' $where AND vc.checks_id=1 AND vc.as_uni <> 0 AND vc.as_isdlt = 0 AND vd.v_isdlt = 0 AND vc.as_status <> 'Close' GROUP BY vc.as_id ORDER BY vc.as_id DESC LIMIT 0,10";
$inc = 1;
while($savvion = mysql_fetch_array($selRoles))
{
$add_data = $db->select("add_data","*","as_id = ".$savvion['as_id']." and d_type='followup'");
$flw_ups = mysql_fetch_array($add_data);
//print_r($flw_ups);
?>
<tr>
<td id="record_list_<?=$savvion['as_id']?>">
<input type="checkbox" name="select_loc[]" id="checkid[]" class="cheks locchecks checksingle_loc_<?=$savvion['as_id']?>" value="<?=$savvion['as_id']?>"/>
</td>
<td><?=$inc?></td>
<td><?=$savvion['as_bcode']?></td>
<td><?=$savvion['uni_Name']?></td>
<td><?=getDaysFromDates(date("Y-m-d"),$savvion['as_addate'],$savvion['com_id']);?></td>
<td><?=urldecode($savvion['as_vstatus'])?></td>
<td><textarea readonly="readonly"><?=$flw_ups['d_value']?></textarea></td>
<td><textarea name="followups_ins_<?=$savvion['as_id']?>" id="followups_ins_<?=$savvion['as_id']?>"></textarea></td>
<td><?=date("m-d-Y",strtotime($savvion['as_addate']))?></td>
<td><input type="button" onclick="submitsinglerecord(<?=$savvion['as_id']?>,'loc_sing');" name="singleupdate" value="Submit" /></td>
</tr>
<?php
$inc++;
}
?>
<input type="submit" name="forbulkupdate_loc" value="All Update" />
</tbody>
</form>
</table>
</div>
<script>
//FOR SAVVION //
$("#select_all").change(function () {
$(".savchecks").prop('checked', $(this).prop("checked"));
if(this.checked)
$('#commonmessage_savv').fadeIn('slow');
else
$('#commonmessage_savv').fadeOut('slow');
});
// FOR ALL savvion CHECKS START HERE //
$("#formsubmit").submit(function(e) {
var url = "followupsubmit.php"; // the script where you handle the form input.
var selchbox = [];
$('.savchecks').each(function() {
if(this.checked == true){
selchbox.push($(this).val());
};
});
if(selchbox==''){
alert("Please select atleast 1 savvion check");
return false;
}
else{
$.ajax({
type: "POST",
url: url,
data: $("#formsubmit").serialize(), // serializes the form's elements.
success: function(data)
{
alert(data); // show response from the php script.
}
});
}
e.preventDefault(); // avoid to execute the actual submit of the form.
});
// FOR ALL CHECKS END HERE //
// FOR ALL local CHECKS START HERE //
$("#formsubmit_loc").submit(function(e) {
var url = "followupsubmit.php"; // the script where you handle the form input.
var selchbox = [];
$('.locchecks').each(function() {
if(this.checked == true){
selchbox.push($(this).val());
};
});
if(selchbox==''){
alert("Please select atleast 1 local check");
return false;
}
else{
$.ajax({
type: "POST",
url: url,
data: $("#formsubmit_loc").serialize(), // serializes the form's elements.
success: function(data)
{
alert(data); // show response from the php script.
}
});
}
e.preventDefault(); // avoid to execute the actual submit of the form.
});
// FOR ALL CHECKS END HERE //
// FOR SAVVION END HERE
// FOR LOCAL //
$("#select_all_loc").change(function () {
$(".locchecks").prop('checked', $(this).prop("checked"));
if(this.checked)
$('#commonmessage_loc').fadeIn('slow');
else
$('#commonmessage_loc').fadeOut('slow');
});
// FOR LOCAL END HERE //
// FOR INDIVIDUAL CHECK COMMON //
function submitsinglerecord(id,single_check)
{
var url = "followupsubmit.php";
if(single_check == "savv_sing")
{
var intcomment = $("#intrcmnt_"+id).val();
var extcomment = $("#extrnlcmnt_"+id).val();
var forclas = '.checksingle_sav_'+id;
var msgx = 'Please check on this record of savvion check';
var checkdetail = 'savvion';
var component = $("#check_comp_"+id).val();
var checkcomponent = '&checkcomponent='+component;
}
else if(single_check == "loc_sing")
{
var intcomment = '';
var extcomment = $("#followups_ins_"+id).val();
var forclas = '.checksingle_loc_'+id;
var msgx = 'Please check on this record of local check';
var checkdetail = 'local';
var checkcomponent = '';
}
var selchbox = [];
$(forclas).each(function() {
if(this.checked == true){
selchbox.push($(this).val());
};
});
if(selchbox==''){
alert(msgx);
return false;
}else{
$.ajax({
type: "POST",
url: url,
data: 'individual=yes&checkid='+id+'&intcomment='+intcomment+'&extcomment='+extcomment+'&checknature='+checkdetail+checkcomponent, // serializes the form's elements.
success: function(data)
{
alert(data); // show response from the php script.
}
});
}
}
/*$(function() {
$( "#tabs" ).tabs();
});*/
var cur_index=10;
cur_index=parseInt(cur_index)+10;
var screen_height = $('body').height();
var cury = $(window).scrollTop();
var screen = $(window).height();
$('#load_more').click(function(){
// make an ajax call to your server and fetch the next 100, then update
//some vars
$.ajax({
type: 'POST',
url: "actions.php",
data: 'ePage=add_rating&followup_listing_savv=yes&limit='+cur_index+'&searchword=<?=$searchfield?>&searchby=<?=$select_by?>',
success: function(result){
console.log(result);
cur_index +=10;
screen_height = $('body').height();
$( "#loadmoreresponse" ).fadeIn( 400 ).append(result);
if(result == ''|| result == '0')
{
$('#nomoreres_savv').show();$('#load_more').hide();
}
}
});
});
$('#load_more_loc').click(function(){
// make an ajax call to your server and fetch the next 100, then update
//some vars
$.ajax({
type: 'POST',
url: "actions.php",
data: 'ePage=add_rating&followup_listing_loc=yes&limit='+cur_index+'&searchword=<?=$searchfield_loc?>',
success: function(result){
console.log(result);
cur_index +=10;
screen_height = $('body').height();
$( "#loadmoreresponse_loc" ).fadeIn( 400 ).append(result);
if(result == '' || result == '0')
{
$('#nomoreres_loc').show();$('#load_more_loc').hide();
}
}
});
});
</script>
<script>
$( document ).ready(function() {
$('#example').DataTable({"order": [[4, 'desc']]});
});
</script>