681 lines
33 KiB
PHP
681 lines
33 KiB
PHP
<?php
|
|
include 'connect/cms-config.php' ;
|
|
include 'requires/function.php' ;
|
|
include 'requires/session.php' ;
|
|
|
|
// include the class
|
|
include 'requires/class_resize.php' ;
|
|
|
|
// keep parameter in value
|
|
$page = escapeString($_GET['page']) ;
|
|
$page_mode = escapeString($_GET['page_mode']) ;
|
|
$type = escapeString($_GET['type']) ;
|
|
$search = escapeString($_GET['search']) ;
|
|
|
|
// active menu bar
|
|
$active_main_menu = 'service' ;
|
|
$active_sub_menu = 'ourinbox' ;
|
|
$active_menu = 'ourinbox-request-list' ;
|
|
|
|
// check permission
|
|
if ( !permissionCheck($row_user, 'our-request-view') ){
|
|
header('Location: index.php') ;
|
|
exit ;
|
|
}
|
|
|
|
|
|
// mode type | all list | new | edit
|
|
switch($page_mode){
|
|
|
|
// edit request
|
|
case 'new' :
|
|
case 'edit' :
|
|
|
|
// check query exsits
|
|
$submit_type = 'new' ;
|
|
$mysqli_page = $mysqli->query("SELECT * FROM request
|
|
WHERE request_id = '".$page."' LIMIT 1");
|
|
if ($mysqli_page->num_rows > 0){
|
|
// keep query value in array
|
|
$row_page = $mysqli_page->fetch_array(MYSQLI_ASSOC) ;
|
|
$submit_type = 'edit' ;
|
|
}
|
|
|
|
// update database
|
|
if ( isset($type) && ( $type == 'new' || $type == 'edit' ) && $_POST['hide'] == 1 ){
|
|
|
|
// update database
|
|
$mysqli->query( "UPDATE request SET
|
|
comment = '".escapeString($_POST['comment'])."',
|
|
status = '".escapeString($_POST['status'])."'
|
|
WHERE request_id = '".$page."'" ) ;
|
|
|
|
if ( $_POST['status'] == 'confirmed' ){
|
|
|
|
// get last movment
|
|
$updateremark = 'Stock deduct from so number ' . $row_page['request_so'] ;
|
|
$updatequantity= -($row_page['quantity']) ;
|
|
|
|
if ( ( $updatequantity < 0 || $updatequantity > 0) && $updatequantity != '' ){
|
|
$before = 0 ;
|
|
|
|
$main_id = $row_page['main_id'] ;
|
|
$sub_id = $row_page['sub_id'] ;
|
|
if ( $sub_id > 0 ){
|
|
$main_id = 0 ;
|
|
}
|
|
|
|
// get last movment
|
|
$mysqli_select = $mysqli->query( "SELECT balance FROM setting_request_movement
|
|
WHERE deleted_at IS NULL AND main_id = '".$main_id."' AND sub_id = '".$sub_id."'
|
|
ORDER BY movement_id DESC
|
|
LIMIT 1" ) ;
|
|
if ( $mysqli_select->num_rows > 0 ){
|
|
$row_select = $mysqli_select->fetch_assoc() ;
|
|
$before = $row_select['balance'] ;
|
|
}
|
|
|
|
$quantity = $updatequantity ;
|
|
$balance = ( $before + $quantity ) ;
|
|
|
|
$mysqli->query( "INSERT INTO setting_request_movement
|
|
( main_id, sub_id, before_quantity, quantity, balance, remark ) VALUES
|
|
( '".$main_id."', '".$sub_id."', '".$before."', '".$quantity."', '".$balance."', '".$updateremark."' )" ) ;
|
|
}
|
|
}
|
|
|
|
if ( $row_page['status'] != $_POST['status'] ){
|
|
pushToUserCron( 'request', $page, $row_page['staff_id'], 'Request', 'Request has been update.' ) ;
|
|
}
|
|
|
|
// refresh page
|
|
header("Location:app-request.php?page_mode=edit&page=".$page."&success=1") ;
|
|
$_SESSION['system_result'] = 'success-updated' ;
|
|
exit ;
|
|
}
|
|
|
|
if ( ( $page_mode == 'new' && !permissionCheck($row_user, 'our-request-new') ) ||
|
|
( $page_mode == 'edit' && !permissionCheck($row_user, 'our-request-edit') ) ){
|
|
header('Location: app-request.php') ;
|
|
exit ;
|
|
}
|
|
|
|
// get all media
|
|
$media_list = [] ;
|
|
$mysqli_media = $mysqli->query( "SELECT file, filetype FROM request_media
|
|
WHERE deleted_at IS NULL AND request_id = '".$page."'" ) ;
|
|
if ( $mysqli_media->num_rows > 0 ){
|
|
while ( $row_media = $mysqli_media->fetch_assoc() ){
|
|
$media_list[] = $row_media ;
|
|
}
|
|
}
|
|
|
|
// get all staff
|
|
$staff_list = [] ;
|
|
$mysqli_staff = $mysqli->query( "SELECT staff_id, staff_name, staff_idno FROM staff
|
|
WHERE deleted_at IS NULL ".$user_branch_permission_sql) ;
|
|
if ( $mysqli_staff->num_rows > 0 ){
|
|
while ( $row_staff = $mysqli_staff->fetch_assoc() ){
|
|
$staff_list[$row_staff['staff_id']] = dataFilter($row_staff['staff_name']) . ' ( ' . dataFilter($row_staff['staff_idno']) . ' )' ;
|
|
}
|
|
}
|
|
|
|
// start header here
|
|
include 'requires/page_header.php';
|
|
include 'requires/page_top.php';
|
|
?>
|
|
|
|
<div class="warper container-fluid">
|
|
<div class="page-header"><h1>Request <small><?= $lang[$page_mode] ?></small></h1></div>
|
|
<?php
|
|
if ($_SESSION['system_result'] != ''){
|
|
switch($_SESSION['system_result']){
|
|
case 'success-updated' :
|
|
echo '<div class="result_success">'.$lang['Thank you details has been updated'].'</div>' ;
|
|
break ;
|
|
}
|
|
unset($_SESSION['system_result']) ;
|
|
}
|
|
?>
|
|
<div class="panel panel-default">
|
|
<div class="panel-heading"></div>
|
|
<div class="panel-body">
|
|
<form method="post" class="form-horizontal" id="quotationForm" enctype="multipart/form-data" action="app-request.php?page_mode=edit&page=<?= $page ?>&type=edit" novalidate="novalidate">
|
|
|
|
<div class="form-group">
|
|
<div class="col-sm-2 control-label">Staff</div>
|
|
<div class="col-sm-9">
|
|
<select name="staff_id" id="staff_id" class="chosen-select form-control tab_index ui-dropdown-select ui-search-input select2-basic-single">
|
|
<option value="">Select</option>
|
|
<?php
|
|
if ( count($staff_list) > 0 ){
|
|
foreach ( $staff_list as $k => $v ){
|
|
echo '<option value="'.$k.'" '.( $k == $row_page['staff_id'] ? 'selected' : '').'>'.$v.'</option>' ;
|
|
}
|
|
}
|
|
?>
|
|
</select>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="form-group">
|
|
<div class="col-sm-2 control-label">
|
|
<?= ( $row_page['type'] == 'item' || $row_page['type'] == 'item-size' ) ? 'Request Item' : 'Title' ?>
|
|
</div>
|
|
<div class="col-sm-9">
|
|
<input type="text" name="title" class="form-control ui-search-input" value="<?= dataFilter($row_page['title']) ?>" readonly placeholder="Title" />
|
|
</div>
|
|
</div>
|
|
|
|
<?php if ( $row_page['type'] == 'item' || $row_page['type'] == 'item-size' ){ ?>
|
|
<div class="form-group">
|
|
<div class="col-sm-2 control-label">Quantity</div>
|
|
<div class="col-sm-9">
|
|
<input type="text" name="quantity" class="form-control ui-search-input" value="<?= dataFilter($row_page['quantity']) ?>" readonly placeholder="Quantity" />
|
|
</div>
|
|
</div>
|
|
<?php } ?>
|
|
<?php if ( $row_page['type'] == 'item-size' ){ ?>
|
|
<div class="form-group">
|
|
<div class="col-sm-2 control-label">Size</div>
|
|
<div class="col-sm-9">
|
|
<input type="text" name="size" class="form-control ui-search-input" value="<?= dataFilter($row_page['size']) ?>" readonly placeholder="Size" />
|
|
</div>
|
|
</div>
|
|
<?php } ?>
|
|
|
|
<?php if ( $row_page['type'] == 'reservation' ){ ?>
|
|
<div class="form-group">
|
|
<div class="col-sm-2 control-label">Selected Date</div>
|
|
<div class="col-sm-9">
|
|
<input type="text" name="selected_date" class="form-control ui-search-input" value="<?= date( 'Y-m-d', strtotime( $row_page['date_from'] ) ) ?>" readonly placeholder="Selected Date" />
|
|
</div>
|
|
</div>
|
|
<div class="form-group">
|
|
<div class="col-sm-2 control-label">Time From</div>
|
|
<div class="col-sm-9">
|
|
<input type="text" name="time_from" class="form-control ui-search-input" value="<?= date( 'H:ia', strtotime( $row_page['date_from'] ) ) ?>" readonly placeholder="Time From" />
|
|
</div>
|
|
</div>
|
|
<div class="form-group">
|
|
<div class="col-sm-2 control-label">Time To</div>
|
|
<div class="col-sm-9">
|
|
<input type="text" name="time_to" class="form-control ui-search-input" value="<?= date( 'H:ia', strtotime( $row_page['date_to'] ) ) ?>" readonly placeholder="Time To" />
|
|
</div>
|
|
</div>
|
|
<?php } ?>
|
|
|
|
<div class="form-group">
|
|
<div class="col-sm-2 control-label">Request Reason</div>
|
|
<div class="col-sm-9">
|
|
<textarea name="reason" class="form-control ui-search-input" readonly><?= dataFilter($row_page['reason']) ?></textarea>
|
|
</div>
|
|
</div>
|
|
<div class="form-group">
|
|
<div class="col-sm-2 control-label">Remark</div>
|
|
<div class="col-sm-9">
|
|
<textarea name="content" class="form-control ui-search-input" readonly><?= dataFilter($row_page['content']) ?></textarea>
|
|
</div>
|
|
</div>
|
|
|
|
<?php if ( count($media_list) ){ ?>
|
|
<div class="form-group form-group-pdf">
|
|
<div class="col-sm-2 control-label"><?= $lang['preview']?></div>
|
|
<div class="col-sm-9">
|
|
<?php foreach ( $media_list as $k => $v ){ ?>
|
|
<a href="<?= PATH.'uploads/Request/'.dataFilter($v['file']) ?>" style="rmargin-bottom:10px;" target="_blank">
|
|
<img src="<?= PATH.'uploads/Request/'.dataFilter($v['file']) ?>" style="width:100px;" />
|
|
</a>
|
|
<?php } ?>
|
|
</div>
|
|
</div>
|
|
<?php } ?>
|
|
|
|
<hr />
|
|
|
|
<div class="form-group">
|
|
<div class="col-sm-2 control-label">Status</div>
|
|
<div class="col-sm-9">
|
|
<select name="status" class="form-control ui-search-input" >
|
|
<option value="pending" <?= ( $row_page['status'] == 'pending' ? 'selected' : '' ) ?> >Pending Review</option>
|
|
<option value="awaiting-arrival" <?= ( $row_page['status'] == 'awaiting-arrival' ? 'selected' : '' ) ?> >Item Request - Awaiting Item Arrival</option>
|
|
<option value="awaiting-collection" <?= ( $row_page['status'] == 'awaiting-collection' ? 'selected' : '' ) ?> >Item Request - Awaiting Staff Collection</option>
|
|
<option value="confirmed" <?= ( $row_page['status'] == 'confirmed' ? 'selected' : '' ) ?> >Request Resolved</option>
|
|
<option value="rejected" <?= ( $row_page['status'] == 'rejected' ? 'selected' : '' ) ?> >Item Request - Rejected</option>
|
|
</select>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="form-group">
|
|
<div class="col-sm-2 control-label">Comment</div>
|
|
<div class="col-sm-9">
|
|
<textarea name="comment" class="content" id="editor2" rows="10" cols="80"><?= dataFilter($row_page['comment']) ?></textarea>
|
|
<script>
|
|
CKEDITOR.replace('editor2') ;
|
|
</script>
|
|
</div>
|
|
</div>
|
|
|
|
<?php if ( $row_page['status'] != 'confirmed' && $row_page['status'] != 'rejected' ){ ?>
|
|
<div class="form-group">
|
|
<div class="col-sm-2 control-label"></div>
|
|
<div class="col-sm-9">
|
|
<button type="submit" class="btn btn-purple" style="float:right"><?= $lang['submit']?></button>
|
|
<input type="hidden" name="hide" value="1">
|
|
<input type="hidden" name="page_status" value="<?= $submit_type ?>">
|
|
</div>
|
|
</div>
|
|
<?php } ?>
|
|
|
|
</form>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<?php
|
|
|
|
break ;
|
|
|
|
// all announcement list
|
|
case 'all' :
|
|
default :
|
|
|
|
$search_type = escapeString($_GET['search_type']) ;
|
|
$search_main_id = escapeString($_GET['search_main_id']) ;
|
|
$search_sub_id = escapeString($_GET['search_sub_id']) ;
|
|
$search_title = escapeString($_GET['search_title']) ;
|
|
$search_name = escapeString($_GET['search_name']) ;
|
|
$search_idno = escapeString($_GET['search_idno']) ;
|
|
$search_mobile = escapeString($_GET['search_mobile']) ;
|
|
$search_mail = escapeString($_GET['search_mail']) ;
|
|
$search_date = ( $_GET['search_date']!= '' ? date('Y-m-d', strtotime($_GET['search_date'])) : '' ) ;
|
|
$search_update_date = ( $_GET['search_update_date']!= '' ? date('Y-m-d', strtotime($_GET['search_update_date'])) : '' ) ;
|
|
$search_status = $_GET['search_status'] ;
|
|
$export_excel = escapeString($_GET['export-excel']) ;
|
|
|
|
// query type
|
|
$search_query = '' ;
|
|
|
|
// search query
|
|
if ( $search_type != '' ){
|
|
$search_query .= " AND a.type = '".$search_type."'" ;
|
|
}
|
|
if ( $search_main_id != '' ){
|
|
$search_query .= " AND a.main_id = '".$search_main_id."'" ;
|
|
}
|
|
if ( $search_sub_id != '' ){
|
|
$search_query .= " AND a.sub_id = '".$search_sub_id."'" ;
|
|
}
|
|
if ( $search_title != '' ){
|
|
$search_query .= " AND a.title LIKE '%".$search_title."%'" ;
|
|
}
|
|
if( $search_name != ''){
|
|
$search_query .= " AND b.staff_name LIKE '%".$search_name."%'" ;
|
|
}
|
|
if( $search_idno != ''){
|
|
$search_query .= " AND b.staff_idno LIKE '%".$search_idno."%'" ;
|
|
}
|
|
if( $search_mobile != ''){
|
|
$search_query .= " AND b.staff_mobileno LIKE '%".$search_mobile."%'" ;
|
|
}
|
|
if( $search_mail != ''){
|
|
$search_query .= " AND b.staff_email LIKE '%".$search_mail."%'" ;
|
|
}
|
|
if ( $search_date != '' ){
|
|
$search_query .= " AND a.created_at like '%".$search_date."%' " ;
|
|
}
|
|
if ( $search_update_date != '' ){
|
|
$search_query .= " AND a.updated_at like '%".$search_update_date."%' " ;
|
|
}
|
|
if( $search_status != ''){
|
|
$search_query .= " AND a.status IN ('".implode("', '",$search_status)."') " ;
|
|
}
|
|
|
|
// form submit
|
|
if ( $_POST['hide'] == '1' && $_POST['hide_status'] == 'action' ){
|
|
switch($_POST['page_action']){
|
|
case 'trash':
|
|
$mysqli_query = "UPDATE request SET
|
|
deleted_at = '".TODAYDATE."'
|
|
WHERE request_id = " ;
|
|
$trash_page = trashPage('request', $mysqli, $mysqli_query, $_POST['multiple_trash']) ;
|
|
break;
|
|
}
|
|
}
|
|
|
|
// 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_type='.$search_type.'&search_main_id='.$search_main_id.'&search_sub_id='.$search_sub_id.'&search_title='.$search_title.'&search_name='.$search_name.'&search_date='.$search_date.'&search_update_date='.$search_update_date.'&page_mode='.$page_mode.'&search_idno='.$search_idno.'&search_mobile='.$search_mobile.'&search_mail='.$search_mail.'&'.http_build_query(array('search_status' => $search_status));
|
|
|
|
// page query
|
|
$mysqli_query = "SELECT a.*, b.staff_idno, b.staff_name, c.title as main_title, d.title as sub_title FROM request a
|
|
LEFT JOIN staff b ON ( a.staff_id = b.staff_id )
|
|
LEFT JOIN setting_request c ON ( a.main_id = c.main_id )
|
|
LEFT JOIN setting_request_sub d ON ( a.sub_id = d.sub_id )
|
|
WHERE a.deleted_at IS NULL " . $search_query . $user_branch_permission_sql_a ;
|
|
|
|
$mysqli_page = $mysqli->query( $mysqli_query." ORDER BY a.request_id DESC LIMIT $start_from, " . LIMIT ) ;
|
|
|
|
// load pagination
|
|
$page_pagination = nextPrevious($product_page, LIMIT, $search_url, $mysqli_query) ;
|
|
|
|
if ( $export_excel == 'export_eae' ){
|
|
|
|
$page_export_file_name = 'Request Report-';
|
|
|
|
$array_header_excel = array(
|
|
'No.',
|
|
'ID',
|
|
'Name',
|
|
'Type',
|
|
'Main Category',
|
|
'Sub Category',
|
|
'Title',
|
|
'Status',
|
|
'Created At',
|
|
'Updated At'
|
|
) ;
|
|
|
|
$mysqli_export = $mysqli->query( $mysqli_query ) ;
|
|
|
|
if ( $mysqli_export->num_rows > 0 ){
|
|
$count_mysqli_export_page = 0;
|
|
while ( $mysqli_export_page = $mysqli_export->fetch_assoc() ){
|
|
$count_mysqli_export_page ++;
|
|
$array_body_excel[] = array(
|
|
$count_mysqli_export_page,
|
|
$mysqli_export_page['staff_idno'],
|
|
$mysqli_export_page['staff_name'],
|
|
$mysqli_export_page['type'],
|
|
dataFilter($mysqli_export_page['main_title']),
|
|
dataFilter($mysqli_export_page['sub_title']),
|
|
strip_tags(dataFilter($mysqli_export_page['title'])),
|
|
$mysqli_export_page['status'],
|
|
date('Y-m-d', strtotime($mysqli_export_page['created_at'])),
|
|
date('Y-m-d', strtotime($mysqli_export_page['updated_at']))
|
|
) ;
|
|
}
|
|
$count_mysqli_export_page = 0;
|
|
}
|
|
|
|
include 'export_excel_default.php';
|
|
|
|
}
|
|
|
|
// start header here
|
|
include 'requires/page_header.php' ;
|
|
include 'requires/page_top.php' ;
|
|
|
|
?>
|
|
<!-- Header Ends -->
|
|
<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;">
|
|
<div class="row">
|
|
<div class="pull-left col">
|
|
<h1>Request <small><?= $lang['list']?></small></h1>
|
|
</div>
|
|
<div class="pull-right col">
|
|
<!-- <?php if ( permissionCheck($row_user, 'our-request-new') ){ ?>
|
|
<a href="app-request.php?page_mode=new" class="btn btn-purple" target="_blank"><?= $lang['add_new']?></a>
|
|
<?php } ?> -->
|
|
|
|
<?php if ( permissionCheck($row_user, 'our-category-main-view') ){ ?>
|
|
<a href="app-request-main.php?page_mode=list" class="btn" style="color:white;margin:5px;background-color: #5e5bd0;margin-top: 5px;" target="_blank"><?= $lang['Main Category']?></a>
|
|
<?php } ?>
|
|
<?php if ( permissionCheck($row_user, 'our-category-sub-view') ){ ?>
|
|
<a href="app-request-sub.php?page_mode=list" class="btn" style="color:white;margin:5px;background-color: #5e5bd0;margin-top: 5px;" target="_blank"><?= $lang['Sub Category']?></a>
|
|
<?php } ?>
|
|
<?php if ( permissionCheck($row_user, 'our-request-gallery') ){ ?>
|
|
<a href="app-request-gallery.php?page_mode=list" class="btn" style="color:white;margin:5px;background-color: #5e5bd0;margin-top: 5px;" target="_blank">Gallery</a>
|
|
<?php } ?>
|
|
<a class="btn" style="color:white;margin:5px;background-color: #5e5bd0;margin-top: 5px;" href="?search_type=<?= $search_type ?>&search_main_id=<?= $search_main_id ?>&search_sub_id=<?= $search_sub_id ?>&search_title=<?= $search_title?>&search_name=<?= $search_name ?>&search_idno=<?= $search_idno ?>&search_mobile=<?= $search_mobile ?>&search_mail=<?= $search_mail ?>&search_date=<?= $search_date ?>&search_update_date=<?= $search_update_date ?>&page_mode=list&search=<?= $search ?>&export-excel=export_eae">Export As Excel</a>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="panel panel-default" id="basic-table-title">
|
|
<div class="panel-heading">
|
|
|
|
</div>
|
|
<div class="panel-body">
|
|
<form method="get" class="form-horizontal">
|
|
<div class="form-group">
|
|
<label class="col-sm-2 control-label"><?= $lang['type'] ?></label>
|
|
<div class="col-sm-9">
|
|
<select class="form-control" name="search_type">
|
|
<option value="">Select Type</option>
|
|
<option value="item" <?= ( $search_type == 'item' ? 'selected' : '' ) ?> >Item</option>
|
|
<option value="item-size" <?= ( $search_type == 'item-size' ? 'selected' : '' ) ?> >Item with Size</option>
|
|
<option value="association" <?= ( $search_type == 'association' ? 'selected' : '' ) ?> >Association</option>
|
|
<option value="training" <?= ( $search_type == 'training' ? 'selected' : '' ) ?> >Training</option>
|
|
<option value="reservation" <?= ( $search_type == 'reservation' ? 'selected' : '' ) ?> >Reservation</option>
|
|
</select>
|
|
</div>
|
|
</div>
|
|
<div class="form-group">
|
|
<label class="col-sm-2 control-label">Main Category</label>
|
|
<div class="col-sm-9">
|
|
<select class="form-control" name="search_main_id">
|
|
<option value="">Select Main</option>
|
|
<?php
|
|
$mysqli_query_main = "SELECT a.main_id, b.title FROM setting_request a
|
|
LEFT JOIN setting_request_translation b ON ( a.main_id = b.main_id )
|
|
WHERE a.deleted_at IS NULL AND b.lang = 'en' " . $user_branch_permission_sql_symbol ;
|
|
$mysqli_main = $mysqli->query( $mysqli_query_main ) ;
|
|
if ( $mysqli_main->num_rows > 0 ){
|
|
while ( $row_main = $mysqli_main->fetch_assoc() ){
|
|
echo '<option '.( $row_main['main_id'] == $search_main_id ? 'selected' : '' ).' value="'.$row_main['main_id'].'">'.dataFilter($row_main['title']).'</option>' ;
|
|
}
|
|
}
|
|
?>
|
|
</select>
|
|
</div>
|
|
</div>
|
|
<div class="form-group">
|
|
<label class="col-sm-2 control-label">Sub Category</label>
|
|
<div class="col-sm-9">
|
|
<select class="form-control" name="search_sub_id">
|
|
<option value="">Select Sub</option>
|
|
<?php
|
|
$mysqli_query_sub = "SELECT a.sub_id, b.title FROM setting_request_sub a
|
|
LEFT JOIN setting_request_sub_translation b ON ( a.sub_id = b.sub_id )
|
|
WHERE a.deleted_at IS NULL AND b.lang = 'en' " . $user_branch_permission_sql_symbol ;
|
|
$mysqli_sub = $mysqli->query( $mysqli_query_sub ) ;
|
|
if ( $mysqli_sub->num_rows > 0 ){
|
|
while ( $row_sub = $mysqli_sub->fetch_assoc() ){
|
|
echo '<option '.( $row_sub['sub_id'] == $search_sub_id ? 'selected' : '' ).' value="'.$row_sub['sub_id'].'">'.dataFilter($row_sub['title']).'</option>' ;
|
|
}
|
|
}
|
|
?>
|
|
</select>
|
|
</div>
|
|
</div>
|
|
<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['Name'] ?></label>
|
|
<div class="col-sm-9">
|
|
<input type="text" name="search_name" value="<?= $search_name ?>" class="form-control" />
|
|
</div>
|
|
</div>
|
|
<div class="form-group">
|
|
<label class="col-sm-2 control-label"><?= $lang['ID No'] ?></label>
|
|
<div class="col-sm-9">
|
|
<input type="text" name="search_idno" value="<?= $search_idno ?>" class="form-control" />
|
|
</div>
|
|
</div>
|
|
<div class="form-group">
|
|
<label class="col-sm-2 control-label"><?= $lang['Mobile'] ?></label>
|
|
<div class="col-sm-9">
|
|
<input type="text" name="search_mobile" value="<?= $search_mobile ?>" class="form-control" />
|
|
</div>
|
|
</div>
|
|
<div class="form-group">
|
|
<label class="col-sm-2 control-label"><?= $lang['email'] ?></label>
|
|
<div class="col-sm-9">
|
|
<input type="text" name="search_mail" value="<?= $search_mail ?>" class="form-control" />
|
|
</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_date" type="date" value="<?= $search_date ?>" placeholder="Date Resigned">
|
|
</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 ?>" placeholder="Date Updated">
|
|
</div>
|
|
</div>
|
|
<div class="form-group">
|
|
<label class="col-sm-2 control-label"><?= $lang['status'] ?></label>
|
|
<div class="col-sm-9">
|
|
<select name="search_status[]" 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_status) ? 'selected' : '') ?>>Pending</option>
|
|
<option value="awaiting-arrival" <?= (in_array("awaiting-arrival", $search_status) ? 'selected' : '') ?>>Awaiting Arrival</option>
|
|
<option value="awaiting-collection" <?= (in_array("awaiting-collection", $search_status) ? 'selected' : '') ?>>Awaiting Collection</option>
|
|
<option value="confirmed" <?= (in_array("confirmed", $search_status) ? 'selected' : '') ?>>Confirmed</option>
|
|
<option value="rejected" <?= (in_array("rejected", $search_status) ? 'selected' : '') ?>>Rejected</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 ?>" />
|
|
<button type="submit" class="btn" style="margin-top:5px;float:right;width:100px;color:white;background-color: #5e5bd0;"><?= $lang['submit'] ?></button>
|
|
</div>
|
|
</div>
|
|
</form>
|
|
</div>
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<form method="post">
|
|
|
|
<?php if ( permissionCheck($row_user, 'our-request-trash') ){ ?>
|
|
<div class="panel panel-default">
|
|
<div class="panel-body">
|
|
<select name="page_action" class="form-control selectpicker">
|
|
<option value=""><?= $lang['select']?></option>
|
|
<option value="trash"><?= $lang['move_to_trash']?></option>
|
|
</select>
|
|
<input type="hidden" name="hide" value="1" />
|
|
<input type="hidden" name="hide_status" value="action" />
|
|
<input type="submit" class="btn" style="width:100px;color:white;background-color: #5e5bd0;" value="<?= $lang['submit']?>" />
|
|
</div>
|
|
</div>
|
|
<?php } ?>
|
|
|
|
<div class="panel panel-default">
|
|
<div class="panel-heading"></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['Staff']?></th>
|
|
<th><?= $lang['Department']?></th>
|
|
<th><?= $lang['type']?></th>
|
|
<th><?= $lang['Main Category']?></th>
|
|
<th><?= $lang['Sub Category']?></th>
|
|
<th><?= $lang['title']?></th>
|
|
<th><?= $lang['Created At']?></th>
|
|
<th><?= $lang['Updated At']?></th>
|
|
<th><?= $lang['status']?></th>
|
|
<th width="50"><?= $lang['trash']?></th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
<?php
|
|
$staff_lists = [] ;
|
|
$staff_ids = [] ;
|
|
if ($mysqli_page->num_rows > 0){
|
|
|
|
while( $row_page = $mysqli_page->fetch_assoc() ){
|
|
$staff_lists[] = $row_page ;
|
|
$staff_ids[] = $row_page['staff_id'] ;
|
|
}
|
|
|
|
$staff_departments = [] ;
|
|
$select_departments = $mysqli->query( "SELECT a.staff_id, b.department_desc FROM staff_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' AND a.staff_id IN ( ".implode(', ', $staff_ids)." )" ) ;
|
|
if ( $select_departments->num_rows > 0 ){
|
|
while ( $row_departments = $select_departments->fetch_assoc() ){
|
|
$staff_departments[$row_departments['staff_id']][] = $row_departments['department_desc'] ;
|
|
}
|
|
}
|
|
|
|
foreach ( $staff_lists as $k => $row_page ){
|
|
echo '
|
|
<tr class="odd gradeX">
|
|
<td class="align_center">' ;
|
|
if ( permissionCheck($row_user, 'our-request-edit') ){
|
|
echo '
|
|
<a title="Edit Current Request" href="app-request.php?page_mode=edit&page='.$row_page['request_id'].'"><i class="fa fa-edit"></i></a>' ;
|
|
}else{
|
|
echo '-' ;
|
|
}
|
|
echo '
|
|
</td>
|
|
<td class="text-center">'.dataFilter($row_page['staff_name']).' ( '.dataFilter($row_page['staff_idno']).' )</td>
|
|
<td>'.( count($staff_departments[$row_page['staff_id']]) > 0 ? ( implode( '<br />', $staff_departments[$row_page['staff_id']] ) ) : '' ).'</td>
|
|
<td>'.ucwords( str_replace( '-', ' ', $row_page['type'] ) ).'</td>
|
|
<td>'.dataFilter($row_page['main_title']).'</td>
|
|
<td>'.dataFilter($row_page['sub_title']).'</td>
|
|
<td>'.dataFilter($row_page['title']).'</td>
|
|
<td class="text-center">'.resetDateFormat($row_page['created_at']).'</td>
|
|
<td class="text-center">'.resetDateFormat($row_page['updated_at']).'</td>
|
|
<td class="text-center">'.resetStatus($row_page['status']).'</td>
|
|
<td>
|
|
<div class="checkbox multiple_trash">
|
|
<input type="checkbox" name="multiple_trash['.$row_page['request_id'].']" class="trash_button" value="1">
|
|
<label for="checkbox1"></label>
|
|
</div>
|
|
</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>
|
|
</tr>' ;
|
|
}
|
|
?>
|
|
</tbody>
|
|
</table>
|
|
<?= $page_pagination['page_pagination'] ?>
|
|
</div>
|
|
</div>
|
|
</form>
|
|
</div>
|
|
</div>
|
|
<?php
|
|
break ;
|
|
}
|
|
|
|
include 'requires/page_footer.php' ;
|
|
?>
|