827 lines
38 KiB
PHP
827 lines
38 KiB
PHP
<?php
|
|
include 'connect/cms-config.php' ;
|
|
include 'requires/function.php' ;
|
|
|
|
$is_app = escapeString($_GET['is_app']) ;
|
|
if ( $is_app == 'yes' ){
|
|
|
|
}else{
|
|
include 'requires/session.php' ;
|
|
if ( !permissionCheck($row_user, 'task-list-view') ){
|
|
header('Location: index.php') ;
|
|
exit ;
|
|
}
|
|
}
|
|
|
|
$array_department = [];
|
|
|
|
$mysqli_department = $mysqli->query("SELECT a.department_id, b.department_desc FROM setting_department a
|
|
LEFT JOIN setting_department_translation b ON ( a.department_id = b.department_id )
|
|
WHERE a.deleted_at IS NULL AND b.lang = 'en'") ;
|
|
if($mysqli_department->num_rows > 0){
|
|
while($row_department = $mysqli_department->fetch_assoc()){
|
|
$array_department[$row_department['department_id']] = $row_department['department_desc'];
|
|
}
|
|
}
|
|
|
|
$array_staff = [];
|
|
|
|
$mysqli_staff = $mysqli->query("SELECT staff_id,staff_name FROM staff WHERE deleted_at is null");
|
|
if($mysqli_staff->num_rows > 0){
|
|
while($row_staff = $mysqli_staff->fetch_assoc()){
|
|
$array_staff[$row_staff['staff_id']] = $row_staff['staff_name'];
|
|
}
|
|
}
|
|
|
|
// keep parameter in value
|
|
$page = escapeString($_GET['page']) ;
|
|
$page_mode = escapeString($_GET['page_mode']) ;
|
|
$type = escapeString($_GET['type']) ;
|
|
$search = escapeString($_GET['search']) ;
|
|
$search_staffid = escapeString($_GET['search_staffid']) ;
|
|
$search_mode = escapeString($_GET['search_mode']) ;
|
|
|
|
// active menu bar
|
|
$active_main_menu = 'task' ;
|
|
$active_sub_menu = 'task-list' ;
|
|
$active_menu = 'task-list' ;
|
|
|
|
// mode type | all list | new | edit
|
|
switch($page_mode){
|
|
//view item
|
|
case 'view':
|
|
|
|
//define initial data
|
|
$department_name = $staff_name_created = $staff_name_assigned = '-';
|
|
$staff_name_executed = [] ;
|
|
|
|
//get all data
|
|
$mysqli_page = $mysqli->query("SELECT * FROM task WHERE task_id = '".$page."' ");
|
|
|
|
if($mysqli_page->num_rows > 0){
|
|
$row_page = $mysqli_page->fetch_assoc();
|
|
|
|
//handle task status
|
|
$status = taskStatusButton($row_page['status']);
|
|
|
|
//handle task difficulty
|
|
$difficulty_color = setDifficulty($row_page['difficulty']);
|
|
|
|
$task_type = resetTaskType($row_page['task_type']);
|
|
|
|
//todo summary
|
|
if($row_page['todo_list'] > 0){
|
|
$todo = $row_page['todo_done'].' / '.$row_page['todo_list'];
|
|
}else{
|
|
$todo = '-';
|
|
}
|
|
|
|
|
|
//get department name
|
|
if($row_page['department_id'] != '' && $row_page['department_id'] != '0'){
|
|
$department_name = getDepartmentName($row_page['department_id']);
|
|
}
|
|
|
|
//get create task staff
|
|
if($row_page['created_by'] != '' && $row_page['created_by'] != '0'){
|
|
$staff_name_created = getStaffName($row_page['created_by']);
|
|
}
|
|
|
|
//get assign task staff
|
|
if($row_page['assigned_by'] != '' && $row_page['assigned_by'] != '0'){
|
|
$staff_name_assigned = getStaffName($row_page['assigned_by']);
|
|
}
|
|
|
|
//get execute task staff
|
|
$select_executed = $mysqli->query( "SELECT staff_id FROM task_joinstaff WHERE task_id = '".$page."'" ) ;
|
|
if ( $select_executed->num_rows > 0 ){
|
|
while ( $row_executed = $select_executed->fetch_assoc() ){
|
|
$staff_name_executed[] = getStaffName($row_executed['staff_id']);
|
|
}
|
|
}
|
|
|
|
//get reject task staff
|
|
if($row_page['rejected_by'] != '' && $row_page['rejected_by'] != '0'){
|
|
$staff_name_rejected = getStaffName($row_page['rejected_by']);
|
|
}
|
|
|
|
//get all todo list
|
|
$mysqli_todo = $mysqli->query("SELECT * FROM task_todo WHERE task_id = '".$page."' AND deleted_at IS NULL ORDER BY sortable ASC, todo_id ASC");
|
|
|
|
$mysqli_rejected = $mysqli->query("SELECT * FROM task_rejected WHERE task_id='".$page."' AND deleted_at IS NULL");
|
|
}
|
|
|
|
// start header here
|
|
include 'requires/page_header.php';
|
|
include 'requires/page_top.php';
|
|
?>
|
|
<?php if ( $is_app == 'yes' ){ ?>
|
|
<style>
|
|
header, aside.left-panel, .marquee, .page-header, footer{ display: none; }
|
|
.content{ margin-left: 0; }
|
|
</style>
|
|
<?php } ?>
|
|
<style>
|
|
.view-data .col-sm-9{
|
|
margin-bottom: 5px;
|
|
}
|
|
</style>
|
|
<div class="warper container-fluid">
|
|
<div class='container' style="background-color: white; border-radius: 10px;">
|
|
<div class="page-header" style="margin: 30px 0px 0px 0px;padding: 0px;">
|
|
<h1><?= $lang['Task']?> <small><?= $lang[$page_mode] ?></small></h1>
|
|
</div>
|
|
<div class="panel panel-default view-data">
|
|
<div class="panel-heading"></div>
|
|
<div class="panel-body">
|
|
<div class="form-group">
|
|
<div class="col-sm-2 control-label"><?= $lang['Task']?></div>
|
|
<div class="col-sm-9">
|
|
<input type="text" name="task" class="form-control" value="<?= dataFilter($row_page['title']) ?>" placeholder="<?= $lang['Task']?>" readonly>
|
|
</div>
|
|
</div>
|
|
<div class="form-group">
|
|
<div class="col-sm-2 control-label"><?= $lang['Task Type']?></div>
|
|
<div class="col-sm-9">
|
|
<input type="text" name="task" class="form-control" value="<?= $task_type ?>" placeholder="<?= $lang['Task Type']?>" readonly>
|
|
</div>
|
|
</div>
|
|
<div class="form-group">
|
|
<div class="col-sm-2 control-label"><?= $lang['Department']?></div>
|
|
<div class="col-sm-9">
|
|
<input type="text" name="task" class="form-control" value="<?= dataFilter($department_name) ?>" placeholder="<?= $lang['Department']?>" readonly>
|
|
</div>
|
|
</div>
|
|
<div class="form-group">
|
|
<div class="col-sm-2 control-label"><?= $lang['Created By']?></div>
|
|
<div class="col-sm-9">
|
|
<input type="text" name="task" class="form-control" value="<?= dataFilter($staff_name_created) ?>" placeholder="<?= $lang['Created By']?>" readonly>
|
|
</div>
|
|
</div>
|
|
<div class="form-group">
|
|
<div class="col-sm-2 control-label"><?= $lang['Assigned By']?></div>
|
|
<div class="col-sm-9">
|
|
<input type="text" name="task" class="form-control" value="<?= dataFilter($staff_name_assigned) ?>" placeholder="<?= $lang['Assigned By']?>" readonly>
|
|
</div>
|
|
</div>
|
|
<div class="form-group">
|
|
<div class="col-sm-2 control-label"><?= $lang['Executed By']?></div>
|
|
<div class="col-sm-9">
|
|
<textarea name="task" class="form-control" placeholder="<?= $lang['Executed By']?>" readonly><?= implode( "\n", $staff_name_executed ) ?></textarea>
|
|
</div>
|
|
</div>
|
|
<div class="form-group">
|
|
<div class="col-sm-2 control-label"><?= $lang['Difficulty']?></div>
|
|
<div class="col-sm-9">
|
|
<input type="text" name="task" class="form-control" value="<?= dataFilter($row_page['difficulty']) ?>" placeholder="<?= $lang['Difficulty']?>" style="color:<?=$difficulty_color?>; text-transform: capitalize;" readonly>
|
|
</div>
|
|
</div>
|
|
<div class="form-group">
|
|
<div class="col-sm-2 control-label"><?= $lang['start date']?></div>
|
|
<div class="col-sm-9">
|
|
<input type="text" name="task" class="form-control" value="<?= resetDateFormat($row_page['date_start']) ?>" placeholder="<?= $lang['start date']?>" readonly>
|
|
</div>
|
|
</div>
|
|
<div class="form-group">
|
|
<div class="col-sm-2 control-label"><?= $lang['End Date']?></div>
|
|
<div class="col-sm-9">
|
|
<input type="text" name="task" class="form-control" value="<?= resetDateFormat($row_page['date_end']) ?>" placeholder="<?= $lang['End Date']?>" readonly>
|
|
</div>
|
|
</div>
|
|
<div class="form-group">
|
|
<div class="col-sm-2 control-label"><?= $lang['remark']?></div>
|
|
<div class="col-sm-9">
|
|
<input type="text" name="task" class="form-control" value="<?= dataFilter($row_page['remark']) ?>" placeholder="<?= $lang['remark']?>" readonly>
|
|
</div>
|
|
</div>
|
|
<div class="form-group">
|
|
<div class="col-sm-2 control-label"><?= $lang['Incentive']?></div>
|
|
<div class="col-sm-9">
|
|
<input type="text" name="task" class="form-control" value="<?= dataFilter($row_page['incentive']) ?>" placeholder="<?= $lang['Incentive']?>" readonly>
|
|
</div>
|
|
</div>
|
|
<div class="form-group">
|
|
<div class="col-sm-2 control-label"><?= $lang['status']?></div>
|
|
<div class="col-sm-9">
|
|
<?= $status ?>
|
|
</div>
|
|
</div>
|
|
<?php if($row_page['rejected_by']){ ?>
|
|
<div class="form-group">
|
|
<div class="col-sm-2 control-label"><?= $lang['Rejected At']?></div>
|
|
<div class="col-sm-9">
|
|
<input type="text" name="task" class="form-control" value="<?= resetDateFormat($row_page['rejected_at']) ?>" placeholder="<?= $lang['Rejected At']?>" readonly>
|
|
</div>
|
|
</div>
|
|
<div class="form-group">
|
|
<div class="col-sm-2 control-label"><?= $lang['Rejected By']?></div>
|
|
<div class="col-sm-9">
|
|
<input type="text" name="task" class="form-control" value="<?= $staff_name_rejected ?>" placeholder="<?= $lang['Rejected By']?>" readonly>
|
|
</div>
|
|
</div>
|
|
<?php } ?>
|
|
<!--
|
|
<div class="form-group">
|
|
<div class="col-sm-2 control-label"><?= $lang['photo']?></div>
|
|
<div class="col-sm-9">
|
|
<div class="file_upload">
|
|
<div class="file_form">
|
|
<input type="hidden" name="hide_image" value="<?= dataFilter($row_page['payment_file']) ?>" />
|
|
<input type="hidden" name="remove_photo" value="">
|
|
<input type="file" name="image" class="file_button control-label" />
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<?php if ($row_page['payment_file'] != ''){ ?>
|
|
<div class="form-group form-group-pdf">
|
|
<div class="col-sm-2 control-label"><?= $lang['preview']?></div>
|
|
<div class="col-sm-9">
|
|
<label class="remove_photo"><input type="checkbox" name="remove_photo" class="ui-checkbox tick" value="1"> <?= $lang['Remove']?> <?= $lang['File']?></label>
|
|
<a href="<?= PATH.'uploads/PaymentSlip/'.dataFilter($row_page['payment_file']) ?>" target="_blank"><?= $lang['Download']?></a>
|
|
</div>
|
|
</div>
|
|
<?php }else{ ?>
|
|
<input type="hidden" name="remove_photo" value="">
|
|
<?php } ?>
|
|
-->
|
|
|
|
</div>
|
|
</div>
|
|
<div class="panel panel-default">
|
|
<div class="panel-heading"></div>
|
|
<div class="panel-body">
|
|
<div class="form-group">
|
|
<div class="col-sm-2 control-label"><?= $lang['Todo']?></div>
|
|
<div class="col-sm-9">
|
|
<?= $todo ?>
|
|
</div>
|
|
</div>
|
|
<br/>
|
|
<div class="form-group">
|
|
<table cellpadding="0" cellspacing="0" border="0" class="responsive table table-striped table-bordered" id="basic-datatable">
|
|
<thead>
|
|
<tr>
|
|
<th><?= $lang['title']?></th>
|
|
<th><?= $lang['status']?></th>
|
|
<th><?= $lang['Done By']?></th>
|
|
<th><?= $lang['Done At']?></th>
|
|
<th width="300"><?= $lang['Image']?></th>
|
|
<th width="200"><?= $lang['remark']?></th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
<?php
|
|
if( $mysqli_todo->num_rows > 0 ){
|
|
while( $row_todo = $mysqli_todo->fetch_assoc() ){
|
|
$staff_name_done = '-';
|
|
|
|
if($row_todo['is_done'] == 'yes'){
|
|
$is_done = '<i class="fa fa-check-circle" aria-hidden="true" style="font-size:20px; color:green"></i>';
|
|
}else{
|
|
$is_done = '<i class="fa fa-times-circle" aria-hidden="true" style="font-size:20px; color:red"></i>';
|
|
}
|
|
|
|
//get create task staff
|
|
if($row_todo['done_by'] != '' && $row_todo['done_by'] != '0'){
|
|
$staff_name_done = getStaffName($row_todo['done_by']);
|
|
}
|
|
|
|
$mysqli_image = $mysqli->query("SELECT file, filetype FROM task_media WHERE todo_id = '".$row_todo['todo_id']."' AND deleted_at IS NULL") ;
|
|
|
|
$mysqli_remark = $mysqli->query("SELECT title FROM task_todo_remark WHERE todo_id = '".$row_todo['todo_id']."' AND deleted_at IS NULL") ;
|
|
|
|
echo '
|
|
<tr>
|
|
<td class="text-center pre">'.dataFilter($row_todo['title']).'</td>
|
|
<td class="text-center">'.$is_done.'</td>
|
|
<td class="text-center">'.$staff_name_done.'</td>
|
|
<td class="text-center">'.resetDateFormat($row_todo['done_at']).'</td>
|
|
<td class="text-center">' ;
|
|
if( $mysqli_image->num_rows > 0 ){
|
|
while( $row_image = $mysqli_image->fetch_assoc() ){
|
|
|
|
switch ( $row_image['filetype'] ){
|
|
case 'jpg' :
|
|
case 'jpeg' :
|
|
case 'png' :
|
|
echo '
|
|
<a href="'.PATH.'uploads/Task/b/'.dataFilter($row_image['file']).'" class="fancybox fancybox_iframe fancybox_iframe_background" style="background-image:url('.PATH.'uploads/Task/'.dataFilter($row_image['file']).')" >
|
|
</a>' ;
|
|
break ;
|
|
default :
|
|
echo '
|
|
<a href="'.PATH.'uploads/Task/'.dataFilter($row_image['file']).'" target="_blank" class="fancybox_iframe_background" style="background-image:url(images/filetype/'.$row_image['filetype'].'.png)" >
|
|
</a>' ;
|
|
}
|
|
|
|
}
|
|
}else{
|
|
echo '-';
|
|
}
|
|
echo '
|
|
</td>
|
|
<td class="text-center">' ;
|
|
if( $mysqli_remark->num_rows > 0 ){
|
|
while( $row_remark = $mysqli_remark->fetch_assoc() ){
|
|
echo $row_remark['title'].'<br/>';
|
|
}
|
|
}else{
|
|
echo '-';
|
|
}
|
|
echo '
|
|
</td>
|
|
</tr>';
|
|
}
|
|
}
|
|
?>
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="panel panel-default">
|
|
<div class="panel-heading"></div>
|
|
<div class="panel-body">
|
|
<div class="form-group">
|
|
<div class="col-sm-2 control-label"><?= $lang['Rejected']?></div>
|
|
</div>
|
|
<br/>
|
|
<div class="form-group">
|
|
<table cellpadding="0" cellspacing="0" border="0" class="responsive table table-striped table-bordered" id="basic-datatable">
|
|
<thead>
|
|
<tr>
|
|
<th><?= $lang['title']?></th>
|
|
<th><?= $lang['Done At']?></th>
|
|
<th width="200"><?= $lang['remark']?></th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
<?php
|
|
if( $mysqli_rejected->num_rows > 0 ){
|
|
while( $row_rejected = $mysqli_rejected->fetch_assoc() ){
|
|
echo '
|
|
<tr>
|
|
<td class="text-center pre">'.dataFilter($row_rejected['title']).'</td>
|
|
<td class="text-center">'.resetDateFormat($row_rejected['done_at']).'</td>
|
|
<td class="text-center">'.dataFilter($row_rejected['remark']).'</td>
|
|
</tr>';
|
|
}
|
|
}else{
|
|
echo '
|
|
<tr class="odd gradeX">
|
|
<td class="border_none">'.$lang['no_data'].'</td>
|
|
<td class="border_none"></td>
|
|
<td class="border_none"></td>
|
|
</tr>' ;
|
|
}
|
|
?>
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<?php
|
|
break;
|
|
// all task list
|
|
case 'all' :
|
|
default :
|
|
|
|
// // query type
|
|
$search_query = '' ;
|
|
$search_title = $_GET['search_title'] ;
|
|
$search_type = $_GET['search_type'] ;
|
|
$search_task_type = $_GET['search_task_type'] ;
|
|
$search_department = $_GET['search_department'] ;
|
|
$search_staff = $_GET['search_staff'] ;
|
|
$search_difficulty = $_GET['search_difficulty'] ;
|
|
$search_start_date = $_GET['search_start_date'] ;
|
|
$search_end_date = $_GET['search_end_date'] ;
|
|
$search_create_date = $_GET['search_create_date'] ;
|
|
$search_update_date = $_GET['search_update_date'] ;
|
|
$export = $_GET['export'] ;
|
|
if($search_title){
|
|
$search_query .= " AND a.title LIKE '%".$search_title."%'" ;
|
|
}
|
|
if($search_type){
|
|
$search_query .= " AND a.status IN ('".implode("', '",$search_type)."') " ;
|
|
}
|
|
if($search_task_type){
|
|
$search_query .= " AND a.task_type = '".$search_task_type."'" ;
|
|
}
|
|
if($search_department){
|
|
$search_query .= " AND a.department_id = '".$search_department."'" ;
|
|
}
|
|
if($search_staff){
|
|
$search_query .= " AND a.created_by = '".$search_staff."'" ;
|
|
}
|
|
if($search_difficulty){
|
|
$search_query .= " AND a.difficulty = '".$search_difficulty."'" ;
|
|
}
|
|
if($search_start_date){
|
|
$search_query .= " AND a.date_start LIKE '%".date( 'Y-m-d', strtotime( $search_start_date ) )."%'" ;
|
|
}
|
|
if($search_end_date){
|
|
$search_query .= " AND a.date_end LIKE '%".date( 'Y-m-d', strtotime( $search_end_date ) )."%'" ;
|
|
}
|
|
if($search_create_date){
|
|
$search_query .= " AND a.created_at LIKE '%".date( 'Y-m-d', strtotime( $search_create_date ) )."%'" ;
|
|
}
|
|
if($search_update_date){
|
|
$search_query .= " AND a.updated_at LIKE '%".date( 'Y-m-d', strtotime( $search_update_date ) )."%'" ;
|
|
}
|
|
|
|
if ( $search_mode != '' ){
|
|
switch ( $search_mode ){
|
|
case 'created' :
|
|
$search_query .= " AND a.created_by = '".$search_staffid."'" ;
|
|
break ;
|
|
case 'assigned' :
|
|
$search_query .= " AND a.assigned_by = '".$search_staffid."'" ;
|
|
break ;
|
|
case 'executed' :
|
|
$search_query .= " AND EXISTS ( SELECT b.staff_id FROM task_joinstaff b WHERE a.task_id = b.task_id AND b.staff_id = '".$search_staffid."' LIMIT 1 )" ;
|
|
break ;
|
|
}
|
|
}else{
|
|
if ( $search_staffid != '' ){
|
|
|
|
}
|
|
}
|
|
|
|
if($_GET['action'] == 'trash'){
|
|
|
|
$mysqli->query("UPDATE task SET
|
|
deleted_at = '".TODAYDATE."'
|
|
WHERE task_id = '".$_GET['id']."' ") ;
|
|
|
|
header('Location: '.PATH.'task.php?page_mode=list');
|
|
|
|
|
|
}
|
|
|
|
// pagination
|
|
if (isset($page) && !empty($page)) { $product_page = $page ; } else { $product_page = 1 ; } // next and prev page (5 thing need to change)
|
|
$start_from = ($product_page - 1) * LIMIT ; //end next and prev page
|
|
|
|
// set search url
|
|
$search_url = 'search='.$search.'&search_staffid='.$search_staffid.'&search_mode='.$search_mode ;
|
|
|
|
// page query
|
|
$mysqli_query = "SELECT * FROM task a
|
|
WHERE a.deleted_at IS NULL " . $search_query.$user_branch_permission_sql_task ;
|
|
// print_r($mysqli_query);exit;
|
|
// export excel
|
|
if ( $export == 'yes' ){
|
|
|
|
include 'PhpExcel/PHPExcel.php' ;
|
|
|
|
$page_filename = 'Task-'.date( 'Ymd', time() ) ;
|
|
$objPHPExcel = new PHPExcel() ;
|
|
$objPHPExcel->getProperties()
|
|
->setCreator(COMPANY)
|
|
->setTitle(COMPANY)
|
|
->setSubject(COMPANY)
|
|
->setDescription(COMPANY)
|
|
->setKeywords(COMPANY)
|
|
->setCategory(COMPANY) ;
|
|
|
|
$objPHPExcel->getActiveSheet()->setTitle( $page_filename ) ;
|
|
$objPHPExcel->setActiveSheetIndex(0);
|
|
$objWriter = PHPExcel_IOFactory::createWriter( $objPHPExcel, 'Excel5' ) ;
|
|
|
|
// default parameter
|
|
$count = 1 ;
|
|
$char = 'A' ;
|
|
$count_staff = 1 ;
|
|
|
|
$array_title = array( 'No.', 'Task', 'Task Type', 'Status', 'Department','Created By', 'Difficulty','Todo','start date','End Date','Created At' ) ;
|
|
|
|
$newChar = $char ;
|
|
foreach( $array_title as $k => $v ){
|
|
$objPHPExcel->setActiveSheetIndex(0)->setCellValue( $newChar.$count, $v ) ;
|
|
$newChar++ ;
|
|
}
|
|
$count++ ;
|
|
|
|
$redeem_q = $mysqli->query( $mysqli_query ) ;
|
|
if ( $redeem_q->num_rows > 0 ){
|
|
while ( $redeem_page = $redeem_q->fetch_assoc() ){
|
|
// default variable
|
|
$id = $redeem_page['task_id'] ;
|
|
|
|
//handle task status
|
|
$status = $redeem_page['status'];
|
|
|
|
//handle task difficulty
|
|
$difficulty_color = setDifficulty($redeem_page['difficulty']);
|
|
|
|
$task_type = resetTaskType($redeem_page['task_type']);
|
|
|
|
//get department name
|
|
if($redeem_page['department_id'] != '' && $redeem_page['department_id'] != '0'){
|
|
$department_name = getDepartmentName($redeem_page['department_id']);
|
|
}
|
|
|
|
//get create task staff
|
|
if($redeem_page['created_by'] != '' && $redeem_page['created_by'] != '0'){
|
|
$staff_name_created = getStaffName($redeem_page['created_by']);
|
|
}
|
|
|
|
$todo = $redeem_page['todo_done'].' / '.$redeem_page['todo_list'];
|
|
|
|
|
|
$newChar = $char ;
|
|
$objPHPExcel->setActiveSheetIndex(0)->setCellValue( ($newChar++).$count, $count_staff ) ;
|
|
$objPHPExcel->setActiveSheetIndex(0)->setCellValue( ($newChar++).$count, dataFilter($redeem_page['title']) ) ;
|
|
$objPHPExcel->setActiveSheetIndex(0)->setCellValue( ($newChar++).$count, $task_type ) ;
|
|
$objPHPExcel->setActiveSheetIndex(0)->setCellValue( ($newChar++).$count, ucfirst($status) ) ;
|
|
$objPHPExcel->setActiveSheetIndex(0)->setCellValue( ($newChar++).$count, dataFilter($department_name != '' ? $department_name : 'Cross Department') ) ;
|
|
$objPHPExcel->setActiveSheetIndex(0)->setCellValue( ($newChar++).$count, dataFilter($staff_name_created) ) ;
|
|
$objPHPExcel->setActiveSheetIndex(0)->setCellValue( ($newChar++).$count, dataFilter($redeem_page['difficulty']) );
|
|
$objPHPExcel->setActiveSheetIndex(0)->setCellValue( ($newChar++).$count, dataFilter($todo) );
|
|
$objPHPExcel->setActiveSheetIndex(0)->setCellValue( ($newChar++).$count, resetDateFormat($redeem_page['date_start']) );
|
|
$objPHPExcel->setActiveSheetIndex(0)->setCellValue( ($newChar++).$count, resetDateFormat($redeem_page['date_end']) );
|
|
$objPHPExcel->setActiveSheetIndex(0)->setCellValue( ($newChar++).$count, resetDateFormat($redeem_page['created_at']) ) ;
|
|
|
|
$count++ ;
|
|
$count_staff++ ;
|
|
}
|
|
}
|
|
|
|
header( 'Content-Type: application/vnd.openxmlformats-officedocument.spreadsheetml.sheet;charset=utf-8' ) ;
|
|
header( 'Content-Disposition: attachment;filename="'.$page_filename.'.xls"' ) ;
|
|
header( 'Cache-Control: max-age=0' ) ;
|
|
// save to pc
|
|
ob_clean();
|
|
$objWriter->save('php://output') ;
|
|
header( "Refresh: 0" ) ;
|
|
exit ;
|
|
|
|
}
|
|
|
|
// print_r($mysqli_query);exit;
|
|
|
|
$mysqli_page = $mysqli->query( $mysqli_query." ORDER BY a.task_id DESC LIMIT $start_from, " . LIMIT ) ;
|
|
|
|
// load pagination
|
|
$page_pagination = nextPrevious($product_page, LIMIT, $search_url, $mysqli_query) ;
|
|
|
|
// start header here
|
|
include 'requires/page_header.php' ;
|
|
include 'requires/page_top.php' ;
|
|
?>
|
|
<?php if ( $is_app == 'yes' ){ ?>
|
|
<style>
|
|
header, aside.left-panel, .marquee, .report_button, .page-header, footer{ display: none; }
|
|
.content{ margin-left: 0; }
|
|
</style>
|
|
<?php } ?>
|
|
<div class="warper container-fluid">
|
|
<div class='container' style="background-color: white; border-radius: 10px;">
|
|
<div class="page-header" style="margin: 30px 0px 0px 0px;padding: 0px;">
|
|
<h1><?= $lang['Task']?> <small><?= $lang['list']?></small></h1>
|
|
</div>
|
|
|
|
<div class="panel panel-default" id="basic-table-title">
|
|
<div class="panel-heading">search</div>
|
|
<div class="panel-body">
|
|
<form method="get" class="form-horizontal">
|
|
<div class="form-group">
|
|
<label class="col-sm-2 control-label"><?= $lang['title'] ?></label>
|
|
<div class="col-sm-9">
|
|
<input type="text" name="search_title" value="<?= $search_title ?>" class="form-control" />
|
|
</div>
|
|
</div>
|
|
<div class="form-group">
|
|
<label class="col-sm-2 control-label"><?= $lang['type'] ?></label>
|
|
<div class="col-sm-9">
|
|
<select name="search_type[]" class="form-control ui-search-input chosen-select select2-basic-single" id="" multiple>
|
|
<option value=""><?= $lang['All'] ?></option>
|
|
<option value="pending" <?= (in_array("pending", $search_type) ? 'selected' : '') ?>><?= $lang['Pending'] ?></option>
|
|
<option value="assigned" <?= (in_array("assigned", $search_type) ? 'selected' : '') ?>><?= $lang['Assigned'] ?></option>
|
|
<option value="resubmit" <?= (in_array("resubmit", $search_type) ? 'selected' : '') ?>><?= $lang['Resubmit'] ?></option>
|
|
<option value="progress" <?= (in_array("progress", $search_type) ? 'selected' : '') ?>><?= $lang['Progress'] ?></option>
|
|
<option value="completed" <?= (in_array("completed", $search_type) ? 'selected' : '') ?>><?= $lang['Completed'] ?></option>
|
|
<option value="approved" <?= (in_array("approved", $search_type) ? 'selected' : '') ?>><?= $lang['Approved'] ?></option>
|
|
<option value="rejected" <?= (in_array("rejected", $search_type) ? 'selected' : '') ?>><?= $lang['Rejected'] ?></option>
|
|
</select>
|
|
</div>
|
|
</div>
|
|
<div class="form-group">
|
|
<label class="col-sm-2 control-label"><?= $lang['Task Type'] ?></label>
|
|
<div class="col-sm-9">
|
|
<select class="form-control" name="search_task_type">
|
|
<option value=""><?= $lang['All'] ?></option>
|
|
<option value="1time" <?= ($search_task_type == '1time' ? 'selected' : '') ?>><?= $lang['1time'] ?></option>
|
|
<option value="daily" <?= ($search_task_type == 'daily' ? 'selected' : '') ?>><?= $lang['daily'] ?></option>
|
|
<option value="weekly" <?= ($search_task_type == 'weekly' ? 'selected' : '') ?>><?= $lang['weekly'] ?></option>
|
|
<option value="monthly" <?= ($search_task_type == 'monthly' ? 'selected' : '') ?>><?= $lang['monthly'] ?></option>
|
|
<option value="yearly" <?= ($search_task_type == 'yearly' ? 'selected' : '') ?>><?= $lang['yearly'] ?></option>
|
|
</select>
|
|
</div>
|
|
</div>
|
|
<div class="form-group">
|
|
<label class="col-sm-2 control-label"><?= $lang['Department'] ?></label>
|
|
<div class="col-sm-9">
|
|
<select class="form-control" name="search_department">
|
|
<option value=""><?= $lang['All'] ?></option>
|
|
<option value="0">CROSS DEPARTMENT</option>
|
|
<?php
|
|
foreach ($array_department as $key => $value) {
|
|
echo'<option value="'.$key.'" '.($search_department == $key ? 'selected' : '').'>'.$value.'</option>';
|
|
}
|
|
?>
|
|
</select>
|
|
</div>
|
|
</div>
|
|
<div class="form-group">
|
|
<label class="col-sm-2 control-label"><?= $lang['Created By'] ?></label>
|
|
<div class="col-sm-9">
|
|
<select class="form-control" name="search_staff">
|
|
<option value=""><?= $lang['All'] ?></option>
|
|
<?php
|
|
foreach ($array_staff as $key => $value) {
|
|
echo'<option value="'.$key.'" '.($search_staff == $key ? 'selected' : '').'>'.$value.'</option>';
|
|
}
|
|
?>
|
|
</select>
|
|
</div>
|
|
</div>
|
|
<div class="form-group">
|
|
<label class="col-sm-2 control-label"><?= $lang['Difficulty'] ?></label>
|
|
<div class="col-sm-9">
|
|
<select class="form-control" name="search_difficulty">
|
|
<option value="">All</option>
|
|
<option value="normal" <?= ($search_difficulty == 'normal' ? 'selected' : '') ?>>Normal</option>
|
|
<option value="easy" <?= ($search_difficulty == 'easy' ? 'selected' : '') ?>>Easy</option>
|
|
<option value="medium" <?= ($search_difficulty == 'medium' ? 'selected' : '') ?>>Medium</option>
|
|
<option value="hard" <?= ($search_difficulty == 'hard' ? 'selected' : '') ?>>Hard</option>
|
|
<option value="master" <?= ($search_difficulty == 'master' ? 'selected' : '') ?>>Master</option>
|
|
</select>
|
|
</div>
|
|
</div>
|
|
<div class="form-group">
|
|
<label class="col-sm-2 control-label"><?= $lang['start date'] ?></label>
|
|
<div class="col-sm-9">
|
|
<input class="form-control" name="search_start_date" type="date" value="<?= $search_start_date ?>">
|
|
</div>
|
|
</div>
|
|
<div class="form-group">
|
|
<label class="col-sm-2 control-label"><?= $lang['End Date'] ?></label>
|
|
<div class="col-sm-9">
|
|
<input class="form-control" name="search_end_date" type="date" value="<?= $search_end_date ?>">
|
|
</div>
|
|
</div>
|
|
<div class="form-group">
|
|
<label class="col-sm-2 control-label"><?= $lang['Created At'] ?></label>
|
|
<div class="col-sm-9">
|
|
<input class="form-control" name="search_create_date" type="date" value="<?= $search_create_date ?>">
|
|
</div>
|
|
</div>
|
|
<div class="form-group">
|
|
<label class="col-sm-2 control-label"><?= $lang['Updated At'] ?></label>
|
|
<div class="col-sm-9">
|
|
<input class="form-control" name="search_update_date" type="date" value="<?= $search_update_date ?>">
|
|
</div>
|
|
</div>
|
|
<div class="form-group">
|
|
<label class="col-sm-2 control-label">View Type</label>
|
|
<div class="col-sm-9">
|
|
<select name="export" class="form-control">
|
|
<option value="">Search</option>
|
|
<option value="yes">View as Excel </option>
|
|
</select>
|
|
</div>
|
|
</div>
|
|
<div class="form-group">
|
|
<div class="col-sm-11">
|
|
<input type="hidden" name="page_mode" value="<?= $page_mode ?>" />
|
|
<input type="hidden" name="search" value="<?= $search ?>" />
|
|
<input type="hidden" name="search_staffid" value="<?= $search_staffid ?>" />
|
|
<input type="hidden" name="search_mode" value="<?= $search_mode ?>" />
|
|
<button type="submit" class="btn" style="float:right;color:white;background-color: #5e5bd0;width: 100px;" value="<?= $lang['submit'] ?>"><?= $lang['submit'] ?></button>
|
|
</div>
|
|
</div>
|
|
</form>
|
|
</div>
|
|
</div>
|
|
|
|
<form method="post">
|
|
|
|
<div class="panel panel-default">
|
|
<div class="panel-heading clearfix">listing
|
|
<!-- <a href="task-report.php" class="btn btn-purple float_right report_button" target="_blank">Report</a> -->
|
|
</div>
|
|
<div class="panel-body">
|
|
<table cellpadding="0" cellspacing="0" border="0" class="listing-table responsive table table-striped table-bordered" id="basic-datatable">
|
|
<thead>
|
|
<tr>
|
|
<th><?= $lang['Action']?></th>
|
|
<th><?= $lang['Task']?></th>
|
|
<th><?= $lang['Task Type']?></th>
|
|
<th><?= $lang['Department']?></th>
|
|
<th><?= $lang['Created By']?></th>
|
|
<th><?= $lang['Difficulty']?></th>
|
|
<th><?= $lang['Todo']?></th>
|
|
<th><?= $lang['start date']?></th>
|
|
<th><?= $lang['End Date']?></th>
|
|
<th><?= $lang['Created At']?></th>
|
|
<th><?= $lang['Updated At']?></th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
<?php
|
|
|
|
$popup_message="return confirm('Are you sure you want to delete?')";
|
|
|
|
|
|
if ($mysqli_page->num_rows > 0){
|
|
while ($row_page = $mysqli_page->fetch_array(MYSQLI_ASSOC)){
|
|
|
|
// default variable
|
|
$id = $row_page['task_id'] ;
|
|
|
|
//handle task status
|
|
$status = taskStatusButton($row_page['status']);
|
|
|
|
//handle task difficulty
|
|
$difficulty_color = setDifficulty($row_page['difficulty']);
|
|
|
|
$task_type = resetTaskType($row_page['task_type']);
|
|
|
|
//get department name
|
|
if($row_page['department_id'] != '' && $row_page['department_id'] != '0'){
|
|
$department_name = getDepartmentName($row_page['department_id']);
|
|
}
|
|
|
|
//get create task staff
|
|
if($row_page['created_by'] != '' && $row_page['created_by'] != '0'){
|
|
$staff_name_created = getStaffName($row_page['created_by']);
|
|
}
|
|
|
|
$todo = $row_page['todo_done'].' / '.$row_page['todo_list'];
|
|
|
|
echo '
|
|
<tr class="odd gradeX">
|
|
<td class="align_center">
|
|
<a class="app_click_task_report" title="'.$lang['view'].$lang['Task'].'" href="'.PATH.'task.php?is_app='.$is_app.'&page_mode=view&page='.$id.'"><i class="fa fa-book"></i></a>';
|
|
|
|
if($row_user['user_permission'] == 'admin' || permissionCheck($row_user, 'task-list-trash')){
|
|
echo'<span class="order_print_span">|</span>
|
|
|
|
<a class="app_click_task_report" title="'.$lang['trash'].'" href="'.PATH.'task.php?page_mode=list&id='.$id.'&action=trash" onclick="'.$popup_message.'" ><i class="fa fa-trash"></i></a>';
|
|
}
|
|
|
|
|
|
|
|
echo'
|
|
</td>
|
|
<td>'.dataFilter($row_page['title']).'</td>
|
|
<td>'.$task_type.' <br/> '.$status.'</td>
|
|
<td>'.dataFilter($department_name != '' ? $department_name : 'Cross Department').'</td>
|
|
<td>'.dataFilter($staff_name_created).'</td>
|
|
<td><span style="text-transform:capitalize;color:'.$difficulty_color.'">'.dataFilter($row_page['difficulty']).'</span></td>
|
|
<td>'.dataFilter($todo).'</td>
|
|
<td class="align_center">'.resetDateFormat($row_page['date_start']).'</td>
|
|
<td class="align_center">'.resetDateFormat($row_page['date_end']).'</td>
|
|
<td class="align_center">'.resetDateFormat($row_page['created_at']).'</td>
|
|
<td class="align_center">'.resetDateFormat($row_page['updated_at']).'</td>
|
|
</tr>';
|
|
}
|
|
}else{
|
|
echo '
|
|
<tr class="odd gradeX">
|
|
<td class="border_none">'.$lang['no_data'].'</td>
|
|
<td class="border_none"></td>
|
|
<td class="border_none"></td>
|
|
<td class="border_none"></td>
|
|
<td class="border_none"></td>
|
|
<td class="border_none"></td>
|
|
<td class="border_none"></td>
|
|
<td class="border_none"></td>
|
|
<td class="border_none"></td>
|
|
<td class="border_none"></td>
|
|
<td class="border_none"></td>
|
|
<td class="border_none"></td>
|
|
</tr>' ;
|
|
}
|
|
?>
|
|
</tbody>
|
|
</table>
|
|
<?= $page_pagination['page_pagination'] ?>
|
|
</div>
|
|
</div>
|
|
</form>
|
|
</div>
|
|
</div>
|
|
<?php
|
|
break ;
|
|
}
|
|
// footer
|
|
include 'requires/page_footer.php' ;
|
|
?>
|