workflow.blade.php
31.3 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
<?php
$kformlib=new \App\Jobs\KFormLib($wakka->HRCoreVars["HRFiledsStr"]);
$themehome=$wakka->GetThemePath('/');
$themehomeweb=$wakka->GetThemePathWeb('/');
$usertime=time();//+(-app_path().1*($wakka->GetBBBUserData('timezone'))*60);
$mytaskfilter="";if(isset($_GET['mytaskfilter']))$mytaskfilter=$_GET["mytaskfilter"];
if($mytaskfilter=='undefined')$mytaskfilter="";
require_once(app_path().'/lib/htmlpurifier-4.6.0/library/HTMLPurifier.auto.php');
$config = HTMLPurifier_Config::createDefault();
$purifier = new HTMLPurifier($config);
$tusername=$wakka->GetUserName();
$tcuser=$wakka->GetUser();
if(isset($_GET['cst']))$wakka->cleanSystemTask('',$kformlib->HRFiledsStr);
else $wakka->cleanSystemTask($wakka->GetUserName());
$curvaltask=$wakka->GetBBBUserData("showsystask");if($curvaltask=="")$curvaltask="Hide System Task";
if(isset($_GET['showhidesystesk']))
{
if($curvaltask=="Show System Task")$curvaltask="Hide System Task";
else if($curvaltask=="Hide System Task")$curvaltask="Show System Task";
$wakka->SetBBBUserData("showsystask",$curvaltask);
}
if(isset($_GET['tusername']))
{
$tusername=Input::get("tusername");
}
function mkdir_r ($dir)
{
if (strlen($dir) == 0)return 0;
if (is_dir($dir))return 1;
elseif (dirname($dir) == $dir)return 1;
return (mkdir_r(dirname($dir)) and mkdir($dir,0777));
}
if($wakka->GetUser())
{
$message="";
$success="";
if(isset($_GET["revert"]))
{
$id = Input::get('revert');
if($wakka->getCount("hrms_tasks","(username='".$wakka->GetUserName()."' or creatorid='".$wakka->GetUserName()."') and id='$id'")==1)
{
$tasks=$wakka->LoadSingle("select * from hrms_tasks where id='$id'");
$dtask=$wakka->LoadSingle("select * from hrms_tasks where name='".$tasks['name']."' and status in ('NEW','WIP') and id!='$id'");
if(empty($dtask))
{
$wakka->Query("UPDATE hrms_tasks set username='".$wakka->GetUserName()."',status='WIP',accepted='".date("Y-m-d H:i:s", $usertime)."' where id='$id'");
$success="Task Reverted to WIP.";
}
else
{
$message='Not Reverted!!. A new Task Already exists with this Name with User : ('.$dtask['username'].') in ('.$dtask['status'].') created by ('.$dtask['creatorid'].').';
}
}
else $message='No Access to Revert';
}
if(isset($_POST['rtusername']))
{
$tsearch=trim(Input::get("filter"));
$rtusername=trim(Input::get("rtusername"));
if($tusername==""||!$wakka->IsAdmin())$tusername=$wakka->GetUserName();
if($rtusername!=''&&$tsearch!='')
{
$tsp=explode(" ",$tsearch);
$likequery=array();
foreach($tsp as $tpart)
{
$likequery[]=" KEYWORDSTR like '%$tpart%' ";
}
$likequery=implode(" or ",$likequery);
$wherequery=" ( ".str_replace("KEYWORDSTR","name",$likequery)." ) ";
$wherequery.=" or ( ".str_replace("KEYWORDSTR","remarks",$likequery)." ) ";
$result=$wakka->LoadAll("select * from hrms_tasks where ( $wherequery ) and (username='$tusername' or (username='' and escalation2 like '%$tusername%')) and status in ('WIP','NEW')");
//print_r($result);
foreach($result as $rline)
{
$skip=0;
foreach($tsp as $tpart)
{
if(!stristr($rline['name'],$tpart)&&!stristr($rline['remarks'],$tpart)&&!stristr($rline['creatorid'],$tpart)){$skip=1;break;}
}
if($skip==0)
{
$rRemarks=$wakka->safeString(str_replace('\n',"<br>",$rline['remarks']))."<br>[".date('Y-m-d_H')."] BulkReassign from $tusername to $rtusername (search by:$tsearch)";
$wakka->Query("update hrms_tasks set username='$rtusername',remarks='$rRemarks' where id='$rline[id]' limit 1;");
//echo "update hrms_tasks set username='$rtusername',remarks='$rRemarks' where id='$rline[id]' limit 1;<br>";
}
}
$success="Tasks ReAssigned to user : $rtusername from Original $tusername (Search by: '$tsearch')";
$wakka->sendPopUpUserAlert("system",$rtusername,Config::get("app.name")." Notification : Task ReAssigned",$success);
}
else $message='Please Select Both a Search Value and a Target User';
}
if(isset($_GET['accept']))
{
$id = Input::get('accept');
if($wakka->getCount("hrms_tasks","(username='".$wakka->GetUserName()."' or escalation2 like '%".$wakka->GetUserName()."%') and id='$id'")==1)
{
$wakka->Query("UPDATE hrms_tasks set username='".$wakka->GetUserName()."',status='WIP',accepted='".date("Y-m-d H:i:s", $usertime)."' where id='$id'");
$tasks=$wakka->LoadSingle("select * from hrms_tasks where id='$id'");
$tasks=$wakka->LoadSingle("select * from hrms_tasks where id='$id'");
//$wakka->alertMail($tasks['username'],$tasks['creatorid'],'TaskAccepted',$tasks['name']);
$success="Task Accepted.";
}
}
if(isset($_GET['reject']))
{
$id = Input::get('reject');
if($wakka->getCount("hrms_tasks","(username='".$wakka->GetUserName()."' or escalation2 like '%".$wakka->GetUserName()."%') and completecheck=''and id='$id'")==1)
{
$wakka->Query("UPDATE hrms_tasks set status='REJECT',accepted='".date("Y-m-d H:i:s", $usertime)."',username='".$wakka->GetUserName()."' where id='$id'");
$tasks=$wakka->LoadSingle("select * from hrms_tasks where id='$id'");
$mailbody="<pre><b>Details of Task:</b>
Title: <b>".$tasks["name"]."</b>
Creation Time: <b>".$tasks['created_at']."</b>
Completion Time: <b>".$tasks['endtime']."</b>
Current Status: <b>".$tasks['status']."</b>
Created By: <b>".$tasks['creatorid']."</b>
Assigned to: <b>".$tasks['username']."</b>
Remarks: <b>".$tasks['remarks']."</b></pre>";
$wakka->sendPopUpUserAlert("system",$tasks['creatorid'],Config::get("app.name")." Notification : Task Rejected",$mailbody);
$success="Task Rejected.";
}
}
if(isset($_POST['editsave']))
{
$id = Input::get('editsave');
$name = $wakka->safeString(Input::get('tname'));
$assignto = Input::get('username');
$duration = explode(".",Input::get('endtime'));
$remarks = $wakka->safeString(str_replace('\n',"<br>",Input::get('remarks')));
$time = Input::get('time');
$duration=mktime($time, 0, 0, $duration[1], $duration[0], $duration[2]);
$durationSQL=date("Y-m-d H:i:s", $duration);
if(strlen(Input::get('endtime'))>15){$durationSQL=Input::get('endtime');$duration=strtotime($durationSQL);}
if(strlen($name) < 5)$message="Please Fill Task Name";
else if(strlen($assignto) == 0)$message="Please Assign task";
//else if($duration<($usertime+(1*60*60)))$message="End time cannot be less then one hour from Now";
else if(strlen($remarks)<4)$message="Please provide detailed remarks [$name] - [$remarks]";
else
{
$tasks=$wakka->LoadSingle("select * from hrms_tasks where id='$id'");
$remarks=$wakka->safeString(str_replace('\n',"<br>",$tasks['remarks']))."<br>[".date('Y-m-d_H')."][".$wakka->GetUserName()."]: $remarks";
if($assignto!=$wakka->GetUserName())$remarks.="<br>Reassign from ".$wakka->GetUserName()." to $assignto";
$wakka->Query("update hrms_tasks set name='$name',username='$assignto',endtime='$durationSQL',status='NEW',remarks='$remarks' where id='$id'");
$mailbody="<b>Details of Task Update:</b><br>
Title: <b>$name</b><br>
Creation Time: <b>".$tasks['created_at']."</b><br>
Completion Time: <b>$durationSQL</b><br>
Current Status: <b>".$tasks['status']."</b><br>
Created By: <b>".$tasks['creatorid']."</b><br>
Assigned to: <b>$assignto</b><br>
Remarks: <b>$remarks</b>";
if($tasks['creatorid']!='System')$wakka->sendPopUpUserAlert("system",$tasks['creatorid'],Config::get("app.name")." Notification : Task Updated",$mailbody);
else
{
$userid=$wakka->loadAllDBUsers($tasks[username]);
$wakka->sendPopUpUserAlert("system",$userid['manager'],Config::get("app.name")." Notification : System Task Changed",$mailbody);
}
$success="Task Edited.";
}
}
if(isset($_GET['id'])&&isset($_GET['cstatus']))
{
$id = Input::get('id');
$tasks=$wakka->LoadSingle("select * from hrms_tasks where id='$id'");
$status = Input::get('cstatus');
if($wakka->getCount("hrms_tasks","username='".$wakka->GetUserName()."' and id='$id'")==1)
{
$statusok=1;
$completedstr='';
if($status=="DONE"||$status=="Cancel")
{
$completedstr=",completed='".date("Y-m-d H:i:s", $usertime)."'";
if($tasks['completecheck']!='')
{
$tname=explode(" ",$tasks['name']);
$personarr=$wakka->getPerson($tname[0]);
if(is_array($personarr))
{
if($personarr['peopledata'][$tasks['completecheck']]=='')$statusok=0;
}
}
}
if($statusok==1)
{
$wakka->Query("UPDATE hrms_tasks set status='$status' $completedstr where id='$id'");
$tasks=$wakka->LoadSingle("select * from hrms_tasks where id='$id'");
$mailbody="<b>Details of Task:</b><br>
Title: <b>".$wakka->safeString($tasks["name"])."</b><br>
Creation Time: <b>".$tasks['created_at']."</b><br>
Completion Time: <b>".$tasks['endtime']."</b><br>
Current Status: <b>".$tasks['status']."</b><br>
Created By: <b>".$tasks['creatorid']."</b><br>
Assigned to: <b>".$tasks['username']."</b><br>
Remarks: <b>".$wakka->safeString($tasks['remarks'])."</b>";
if($tasks['creatorid']!=$tasks['username']&&$tasks['creatorid']!="System"&&$status!="WIP"&&$status=="NEW")$wakka->sendPopUpUserAlert("system",$tasks['creatorid'],Config::get("app.name")." Notification : Task Updated",$mailbody);
$success="Task Updated.";
}
else
{
$message='Error Cant Complete Task as required value "'.$kformlib->HRFieldNames[$tasks['completecheck']].'" not saved yet in Employee data.';
}
}
}
?>
<div class="layout-app"><!-- row-app -->
<div class="row row-app">
<div class="col-md-12">
<div class="col-separator col-separator-first col-unscrollable box">
<div class=innerAll>
<div id=wresults>
<?php if($success!="")echo "<script>simpleNotification('success','topRight','$success');</script>>"; ?>
<?php if($message!="")echo "<script>simpleNotification('error','topRight','$message');</script>"; ?>
</div>
<div style='clear:both'></div>
<?php
$namelist='';
$uids=$wakka->loadAllDBUsers();
foreach($uids as $uid)$namelist.= "<option value='$uid[name]'>$uid[name] - $uid[role]</option>";
if($wakka->IsAdmin())
{
echo "<fieldset><legend class='task_legend'>Select a User to view Tasks</legend>
<p style='font-weight: 600;'>
<select class='form_hrm_select' id=taskusername onchange='changeTaskUser()' style='margin-right:2%'>
<option value='$tusername'>$tusername</option>$namelist</select>Current Status:<select class='form_hrm_select' name=stype id=stype style='margin-right:2%;margin-left: 1%;'><option value=''>ALL Status</option><option value='NEW'>NEW</option><option value='WIP'>WIP</option><option value='DONE'>DONE</option><option value='Cancel'>Cancel</option><option value='Reject'>Reject</option></select> By<select class='form_hrm_select' id=dateby style='margin-right:2%;margin-left: 1%;'><option value='created'>Created</option><option value='accepted'>Accepted</option><option value='completed'>Completed</option><option value='endtime'>Deadline</option></select> From <input type=text id=fdatepicker> To <input type=text id=tdatepicker><button type='button' class='btn btn-blu' onclick='taskdownload();return false;' style='float: right;margin: -3px 10px;'><i class='fa fa-cloud-download'> Download</i></button>
<!-- <input type=button class=button value='Download Tasks For Today' onclick='todaytaskdownload();return false;'><input type=button class=button value='Download All Tasks' onclick='alltaskdownload();return false;'> -->
</p>
</fieldset>
<script>
$('#fdatepicker').datepicker({dateFormat: 'yy-mm-dd',inline: true,changeYear: true,selectOtherMonths: true,yearRange: '".(date('Y')-70).":".(date('Y')+20)."'});
$('#tdatepicker').datepicker({dateFormat: 'yy-mm-dd',inline: true,changeYear: true,selectOtherMonths: true,yearRange: '".(date('Y')-70).":".(date('Y')+20)."'});
function changeTaskUser()
{
doAjax('hr/Workflow?tusername='+$('#taskusername').val(),'','content','ajaxMutex','varajax','GET');
}
function taskdownload()
{
window.open('hr/TaskReport?dlusername='+$('#taskusername').val()+'&stype='+$('#stype').val()+'&fdatepicker='+$('#fdatepicker').val()+'&tdatepicker='+$('#tdatepicker').val()+'&dateby='+$('#dateby').val());
}
function todaytaskdownload()
{
window.open('hr/TaskReport?todaytasks=1');
}
function alltaskdownload()
{
window.open('hr/TaskReport?alltasks=1');
}
</script>
";
}
?>
<div class="relativeWrap" >
<div class="tab_generic">
<!-- Tabs Heading -->
<div class="tab_bar_blu tabsbar-2">
<ul class="row row-merge">
<li class=active><a href="#tabsT-1" data-toggle="tab">My Tasks</a></li>
<li><a href="#tabsT-2" data-toggle="tab">Created Tasks</a></li>
<li><a href="#tabsT-3" data-toggle="tab">Create a New Task</a></li>
<li><a href="#tabsT-4" data-toggle="tab">Completed Task</a></li>
<?php if($wakka->IsAdmin()){ ?><li><a href="#tabsT-5" data-toggle="tab">Self Service Tasks</a></li><?php } ?>
</ul>
</div>
<div class="tab-content">
<div id=tabsT-1 class="tab-pane active">
<legend class='task_legend'>Tasks Assigned to You</legend>
<div style='width:100%; height:70px'>
<form method=post style='float:left; width:65%'>
Search <input name="filter" id=frmfilter class='form_new' onkeyup="filter2(this, 'mytasktab')" type="text" id=mytaskfilter value=<?php echo $mytaskfilter; ?>>
New User<select class='form_hrm_select' name=rtusername id=frmrtusername style='margin:0 2%'>
<option value=''></option>
<?php echo $namelist; ?></select>
<input type=button class='btn btn-blu' value='Re Assign' style='margin-right:2%' onclick="doReAssign();return false;">
<input type=button class='btn btn-blu_outline' value='<?php echo $curvaltask; ?>' onclick='showHideSystemTask();return false;' style='margin-right:2%'>
</form>
<script>
function doReAssign()
{
var tdata='filter='+$("#frmfilter").val()+'&rtusername='+$("#frmrtusername").val();
doAjax('hr?action=Workflow',tdata,'content','ajaxMutex','varajax');
}
</script>
<form method=post enctype='multipart/form-data' target=wresultsf action="hr?action=WorkflowSubmit" style='float:left; width:35%'>
<button type=button class='btn btn-blu' onclick='doDownloadTask();return false;' style='float: right; margin: -5% 10% 2% 0;'><i class='fa fa-cloud-download'> Download</i></button>
<div style='clear:both'></div>
<div>
<input type=hidden name=_token value='<?php echo csrf_token(); ?>'>
<input type=file name=taskbulkupload size=5 style='float: left;margin-top: 2%;'>
<button type=submit class='btn btn-blu_outline' value=Upload name=ftaskbulkupload style='float: right;margin-right: 10%;'><i class='fa fa-cloud-upload'></i> Upload</button>
</div>
</form>
</div>
<table id=mytasktab class='footable table' cellpadding="0" cellspacing="0" border="0">
<thead><tr>
<td class='table_hrm_heading_blu'>#</td>
<td class='table_hrm_heading_blu'>Title</td>
<td class='table_hrm_heading_blu'>AssignedTo</td>
<td class='table_hrm_heading_blu'>Created</td>
<td class='table_hrm_heading_blu'>End Time</td>
<td class='table_hrm_heading_blu'>Attachment</td>
<td class='table_hrm_heading_blu'>Status</td>
<td class='table_hrm_heading_blu'>AcceptedOn</td>
<td class='table_hrm_heading_blu'>Remarks</td>
<td class='table_hrm_heading_blu'>CreatedBy</td>
</tr></thead>
<?php
$editid='';$outstr="";
if(isset($_GET['edit']))
{
$editid = Input::get('edit');
if($wakka->getCount("hrms_tasks","(username='".$wakka->GetUserName()."' or escalation2 like '%".$wakka->GetUserName()."%') and id='$editid'")==1);
else $editid='';
}
$i=0;$reccnt=0;$oldempid=0;
$staskstr="";if($curvaltask=="Show System Task")$staskstr=" and creatorid!='System'";
$tasksarr=$wakka->LoadAll("select * from hrms_tasks where ((status!='DONE' and status !='REJECT' and status!='UNSET' and status!='Cancel') ) and (username='$tusername' or (username='' and escalation2 like '%$tusername%')) $staskstr order by empid,endtime");
foreach($tasksarr as $taskline)
{
$taskline['remarks']=str_replace(array("<table","<div","<td","<tr","<tbody","<colgroup","<col","<thead"),"<span",$taskline['remarks']);
$taskline['remarks']=str_replace(array("</table","</div","</td","</tr","</tbody","</colgroup","</col","</thead"),"</span",$taskline['remarks']);
$taskline['remarks'] = $purifier->purify($taskline['remarks']);
$i++;
if($oldempid!=$taskline['empid']){$reccnt++;$oldempid=$taskline['empid'];$outstr.="<tr><td colspan=9 align=center><b>$oldempid</b></td></tr>";}
$style='';$accepted='';$statusstr='';$stfilter='';
$tparts=explode(" ",$taskline['name']);
if(intval($tparts[0])==$tparts[0]&&$taskline['empid']=='')$taskline['empid']=$tparts[0];
if(file_exists($themehome."/uploads/".$taskline['username']."/".$taskline['attachment']))$attachuser=$taskline['username'];
else if(file_exists($themehome."/uploads/Array/".$taskline['attachment']))$attachuser="Array";
$attach="<a href='".$themehomeweb."/uploads/$attachuser/".$taskline['attachment']."' target=_blank>".substr($taskline['attachment'],0,15)."</a>";
if(strtotime($taskline['endtime'])<$usertime){$style='background:#FDCEA4';$stfilter="red";}
else if(strtotime($taskline['endtime'])<$usertime+3600){$style='background:#FEFFC8';$stfilter="orange";}
else {$style='background:#D4F684';$stfilter="green";}
if($taskline['accepted']=="0000-00-00 00:00:00"||$taskline['username']=='')
{
$accepted="<a href='#' onclick='doAccept($taskline[id]);return false;' class='aceptd_stats'>Accept</a> <a href='#' onclick='doReject($taskline[id]);return false;' class='aceptd_stats'>Reject</a> <a href='#' onclick='doEdit($taskline[id]);return false;' class='aceptd_stats'>Edit</a>";
$statusstr=$taskline['status'];
if($editid==$taskline['id'])
{
$accepted="<a href='#' onclick='saveTFrom();return false;'>Save</a>";
}
}
else
{
$accepted=$taskline['accepted'];
$statusstr="<select id=changestatus$i onchange='fchangestatus(".$taskline['id'].",$i);'>";
$statusstr.="<option value='".$taskline['status']."'>".$taskline['status']."</option>";
$statusstr.="<option value='WIP'>WIP</option>";
$statusstr.="<option value='DONE'>DONE</option>";
$statusstr.="<option value='Cancel'>Cancel</option>";
$statusstr.="</select> ";
if($editid==$taskline['id'])$statusstr.="<a href='#' onclick='saveTFrom();return false;'>Save</a>";
else $statusstr.="<a href='#' onclick='doEdit($taskline[id]);return false;'>Edit</a>";
}
if($editid==$taskline['id'])
{
$edittaskstr="
<form method=post name=tform action=Workflow>
<tr style='".($i%2?'background-color:#f0f0f0':'')."'>
<td>Task:-<b>$taskline[name]</b><br><select class='form_hrm_select' name=username id=tformusername><option value='$taskline[username]'>$taskline[username]</option><option value='".$wakka->GetUserName()."'>".$wakka->GetUserName()."</option>$namelist</select></td>
<td><input class='form_new' type=text name=endtime value='$taskline[endtime]' id=tformendtime size=10>
<select class='form_hrm_select' name=time id=tformtime><option value=20>EOD</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><option value=14>14</option>
<option value=15>15</option><option value=16>16</option><option value=17>17</option><option value=18>18</option>
<option value=19>19</option><option value=20>20</option></select></td>
<td style='$style'>$statusstr<div style='display:none'>$stfilter</div></td>
<td colspan=6>$taskline[remarks]<textarea name=remarks id=tformremarks style='width:99%;background:white'></textarea></td>
</tr></form>
<script>
$('#tformendtime').datepicker({dateFormat: 'dd.mm.yy',inline: true,changeYear: true,selectOtherMonths: true,yearRange: '".(date('Y')-70).":".(date('Y')+20)."'});
function saveTFrom()
{
var tdata='editsave=$editid&tname=$taskline[name]&username='+$('#tformusername').val()+'&endtime='+$('#tformendtime').val()+'&time='+$('#tformtime').val();
tdata+='&remarks='+$('#tformremarks').val()
doAjax('hr?action=Workflow',tdata,'content','ajaxMutex','varajax');
}
</script>";
}
else
{
if($taskline['username']=="")$taskline['username']=$taskline['escalation2'];
$outstr.="
<tr style='".($i%2?'background-color:#f0f0f0':'')."'>
<td>$reccnt</td>
<td ".($taskline['empid']!=''?" onclick='window.open(\"home#h-$taskline[empid]\");'":"").">$taskline[name]</td>
<td>".str_replace(","," ",$taskline['username'])."</td>
<td>$taskline[created_at]</td>
<td>$taskline[endtime]</td>
<td>$attach</td>
<td style='$style'>$statusstr<div style='display:none'>$stfilter</div></td>
<td>$accepted</td>
<td>$taskline[remarks]</td>
<td title='$taskline[id]'>$taskline[creatorid]</td>
</tr>";
}
}
echo $edittaskstr.$outstr;
?>
</table>
</div>
<div id=tabsT-2 class="tab-pane">
<legend class='task_legend'>Tasks Created By You</legend>
<br>
<table class='kDataTable tableTools table table-striped table-bordered table-condensed table-white' id=mycreatedtasktbl>
<thead><tr>
<td class='table_hrm_heading_blu'>Title</td>
<td class='table_hrm_heading_blu'>Assigned To</td>
<td class='table_hrm_heading_blu'>End Time</td>
<td class='table_hrm_heading_blu'>Attachment</td>
<td class='table_hrm_heading_blu'>Status</td>
<td class='table_hrm_heading_blu'>Accepted On</td>
<td class='table_hrm_heading_blu'>Remarks</td>
<td class='table_hrm_heading_blu'>Created On</td>
<td class='table_hrm_heading_blu'></td>
</tr></thead>
<?php
$i=0;
$tasksarr=$wakka->LoadAll("select * from hrms_tasks where creatorid='$tusername' order by endtime desc limit 1000");
foreach($tasksarr as $taskline)
{
$taskline['remarks']=str_replace(array("<table","<div","<td","<tr","<tbody","<colgroup","<col","<thead"),"<span",$taskline['remarks']);
$taskline['remarks']=str_replace(array("</table","</div","</td","</tr","</tbody","</colgroup","</col","</thead"),"</span",$taskline['remarks']);
$taskline['remarks'] = $purifier->purify($taskline['remarks']);
$i++;
$style='';
if(file_exists($themehome."/uploads/".$taskline['username']."/".$taskline['attachment']))$attachuser=$taskline['username'];
else if(file_exists($themehome."/uploads/Array/".$taskline['attachment']))$attachuser="Array";
$attach="<a href='".$themehomeweb."/uploads/$attachuser/".$taskline['attachment']."' target=_blank>".substr($taskline['attachment'],0,15)."</a>";
if(strtotime($taskline['endtime'])<$usertime)$style='background:#FDCEA4';
else if(strtotime($taskline['endtime'])<$usertime+3600)$style='background:#FEFFC8';
else $style='background:#D4F684';
echo "
<tr style='".($i%2?'background-color:#f0f0f0':'')."'>
<td>$taskline[name]</td>
<td>".str_replace(","," ",$taskline['username'])."</td>
<td>$taskline[endtime]</td>
<td>$attach</td>
<td style='$style'>$taskline[status]</td>
<td>$taskline[accepted]</td>
<td>$taskline[remarks]</td>
<td title=$taskline[id]>$taskline[created_at]</td>
<td><a href=# onclick='doRevert($taskline[id]);return false;' class='aceptd_stats'>Revert</a></td>
</tr>";
}
?>
</table>
</div>
<div id="tabsT-3" class="tab-pane">
<form method=post enctype='multipart/form-data' target=wresultsf action="hr?action=WorkflowSubmit">
<input type=hidden name=_token value='<?php echo csrf_token(); ?>'>
<fieldset id="task" class="usersettings"><legend class='task_legend'>Add New Task</legend>
<label for="name" class='label_new'>Task Name</label>
<input id="name" type="text" name="name" size="40" class='form_new mrgn' />
<br />
<label for="assignto" class='label_new'>Assign to</label>
<select id="assignto" name="assignto[]" multiple=multiple size=4 class='form_new mrgn'>
<?php
$uids=$wakka->loadAllDBUsers();
foreach($uids as $uid)echo "<option value='$uid[name]'>$uid[name] - $uid[role]</option>";
?>
</select>
<br />
<label for="attach" class='label_new' style='float: left;'>Attachment</label>
<input id="attach" type="file" name="attach" size="40" style=''/>
<br />
<label for="duration" class='label_new'>Completed By Date</label>
<input type=text name=duration id=datepicker class='form_new mrgn'> Time (Hrs) <select name=time><option value=20>EOD</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>
<option value=14>14</option>
<option value=15>15</option>
<option value=16>16</option>
<option value=17>17</option>
<option value=18>18</option>
<option value=19>19</option>
<option value=20>20</option>
</select>
<br />
<label for="remarks" class='label_new'>Description</label>
<textarea name=remarks id=remarks style='font-size:12px;color:#333' class='form_hrm_textbox form_new mrgn'></textarea>
<br />
<br>
<label class='label_new'> </label>
<input type=submit name=addtask value="Create Task" class='btn btn-blu' style='margin-top:4%'>
<input type=hidden id=timezone name=timezone value=''>
</fieldset>
</form>
</div>
<iframe name=wresultsf id="wresultsf" style='width:0px;height:0px;display:none'></iframe>
<div id=tabsT-4 class="tab-pane">
<legend class='task_legend'>Completed Tasks</legend>
<br>
<table class='kDataTable tableTools table table-striped table-bordered table-condensed table-white' id=mycompletedtbl>
<thead><tr>
<td class='table_hrm_heading_blu'>Title</td>
<td class='table_hrm_heading_blu'>Assigned To</td>
<td class='table_hrm_heading_blu'>End Time</td>
<td class='table_hrm_heading_blu'>Attachment</td>
<td class='table_hrm_heading_blu'>Status</td>
<td class='table_hrm_heading_blu'>Completed On</td>
<td class='table_hrm_heading_blu'>Remarks</td>
<td class='table_hrm_heading_blu'>Created By</td>
<td class='table_hrm_heading_blu'></td>
</tr></thead>
<?php
$i=0;
$tasksarr=$wakka->LoadAll("select * from hrms_tasks where (status='DONE' or status='REJECT' or status='Cancel') and username='$tusername' order by completed desc limit 1000");
foreach($tasksarr as $taskline)
{
$taskline['remarks']=str_replace(array("<table","<div","<td","<tr","<tbody","<colgroup","<col","<thead"),"<span",$taskline['remarks']);
$taskline['remarks']=str_replace(array("</table","</div","</td","</tr","</tbody","</colgroup","</col","</thead"),"</span",$taskline['remarks']);
$taskline['remarks'] = $purifier->purify($taskline['remarks']);
$i++;
$style='';
if(file_exists($themehome."/uploads/".$taskline['username']."/".$taskline['attachment']))$attachuser=$taskline['username'];
else if(file_exists($themehome."/uploads/Array/".$taskline['attachment']))$attachuser="Array";
$attach="<a href='".$themehomeweb."/uploads/$attachuser/".$taskline['attachment']."' target=_blank>".substr($taskline['attachment'],0,15)."</a>";
if(strtotime($taskline['endtime'])<strtotime($taskline['completed']))$style='background:#FDCEA4';
else $style='background:#D4F684';
echo "
<tr style='".($i%2?'background-color:#f0f0f0':'')."'>
<td>$taskline[name]</td>
<td>".str_replace(","," ",$taskline['username'])."</td>
<td>$taskline[endtime]</td>
<td>$attach</td>
<td style='$style'>$taskline[status]</td>
<td>$taskline[completed]</td>
<td>$taskline[remarks]</td>
<td title=$taskline[id]>$taskline[creatorid]</td>
<td><a href=# onclick='doRevert($taskline[id]);return false;'>Revert</a></td>
</tr>";
}
?>
</table>
</div>
<?php if($wakka->IsAdmin()){ ?>
<div id=tabsT-5 class="tab-pane">
<legend class='task_legend'>Self Service Tasks</legend>
<br>
<table class='kDataTable tableTools table table-striped table-bordered table-condensed table-white' cellpadding="0" cellspacing="0" border="0" id=allselfservicetasks>
<thead><tr>
<td class='table_hrm_heading_blu'>Title</td>
<td class='table_hrm_heading_blu'>Assigned To</td>
<td class='table_hrm_heading_blu'>End Time</td>
<td class='table_hrm_heading_blu'>Attachment</td>
<td class='table_hrm_heading_blu'>Status</td>
<td class='table_hrm_heading_blu'>Completed On</td>
<td class='table_hrm_heading_blu'>Remarks</td>
<td class='table_hrm_heading_blu'>Created By</td>
<td class='table_hrm_heading_blu'></td>
</tr></thead>
<?php
$i=0;
$tasksarr=$wakka->LoadAll("select * from hrms_tasks where name like '%SELFSERV%' and creatorid != 'FailedMails' order by endtime desc limit 100");
foreach($tasksarr as $taskline)
{
$taskline['remarks']=str_replace(array("<table","<div","<td","<tr","<tbody","<colgroup","<col","<thead"),"<span",$taskline['remarks']);
$taskline['remarks']=str_replace(array("</table","</div","</td","</tr","</tbody","</colgroup","</col","</thead"),"</span",$taskline['remarks']);
$taskline['remarks'] = $purifier->purify($taskline['remarks']);
$i++;
$style='';
if(file_exists($themehome."/uploads/".$taskline['username']."/".$taskline['attachment']))$attachuser=$taskline['username'];
else if(file_exists($themehome."/uploads/Array/".$taskline['attachment']))$attachuser="Array";
$attach="<a href='".$themehomeweb."/uploads/$attachuser/".$taskline['attachment']."' target=_blank>".substr($taskline['attachment'],0,15)."</a>";
if(strtotime($taskline['endtime'])<strtotime($taskline['completed']))$style='background:#FDCEA4';
else $style='background:#D4F684';
echo "
<tr style='".($i%2?'background-color:#f0f0f0':'')."'>
<td>$taskline[name]</td>
<td>".str_replace(","," ",$taskline['username'])."</td>
<td>$taskline[endtime]</td>
<td>$attach</td>
<td style='$style'>$taskline[status]</td>
<td>$taskline[completed]</td>
<td>$taskline[remarks]</td>
<td title=$taskline[id]>$taskline[creatorid]</td>
<td><!--<a href=# onclick='doRevert($taskline[id]);return false;'>Revert</a>--></td>
</tr>";
}
?>
</table>
</div>
<?php } ?>
</div>
</div>
</div>
<script>
var offset = new Date().getTimezoneOffset();
try{
if($("#timezone").length)$("#timezone").val(offset);
}catch(e){}
function fchangestatus(vid,cnt)
{
var oval=$('#changestatus'+cnt).val();
doAjax("hr/Workflow?id="+vid+"&cstatus="+oval,'',"content","ajaxMutex","varajax","GET");
}
function doEdit(varid)
{
doAjax("hr/Workflow?edit="+varid+"&mytaskfilter="+$("#mytaskfilter").val(),'',"content","ajaxMutex","varajax","GET");
}
function doAccept(varid)
{
doAjax("hr/Workflow?accept="+varid+"&mytaskfilter="+$("#mytaskfilter").val(),'',"content","ajaxMutex","varajax","GET");
}
function doReject(varid)
{
doAjax("hr/Workflow?reject="+varid+"&mytaskfilter="+$("#mytaskfilter").val(),'',"content","ajaxMutex","varajax","GET");
}
function doRevert(varid)
{
doAjax("hr/Workflow?revert="+varid,'',"content","ajaxMutex","varajax","GET");
}
function doDownloadTask()
{
window.open("hr/WorkflowSubmit?nodebug=1&dlwip=1&mytaskfilter="+$("#mytaskfilter").val());
}
function showHideSystemTask()
{
doAjax("hr/Workflow?showhidesystesk=1",'',"content","ajaxMutex","varajax","GET");
}
$(document).ready(function()
{
if($("#mytaskfilter").length)filter2(document.getElementById("mytaskfilter"), 'mytasktab');
});
<?php echo "$('#datepicker').datepicker({dateFormat: 'dd.mm.yy',inline: true,changeYear: true,selectOtherMonths: true,yearRange: '".(date('Y')-70).":".(date('Y')+20)."'});"; ?>
</script>
<?php } ?>
</div>
</div>
</div>
</div>
</div><!-- // END row-app -->