307 lines
12 KiB
PHP
307 lines
12 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 = 'setting' ;
|
|
$active_sub_menu = 'setting-hr' ;
|
|
$active_menu = 'setting-hr-chief' ;
|
|
|
|
// mode type | all list | new | edit
|
|
switch($page_mode){
|
|
|
|
// edit chief
|
|
case 'new' :
|
|
case 'edit' :
|
|
|
|
// check query exsits
|
|
$submit_type = 'new' ;
|
|
$mysqli_page = $mysqli->query("SELECT * FROM setting_chief
|
|
WHERE chief_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 ){
|
|
|
|
// keep value in variable
|
|
$page_title = escapeString($_POST['title']) ;
|
|
$page_title = ($page_title != '' ? $page_title : 'No Title') ;
|
|
|
|
if ( $page == '' ){
|
|
$mysqli->query("INSERT INTO setting_chief (created_at) VALUES ('".TODAYDATE."')") ;
|
|
$page = $mysqli->insert_id ;
|
|
}
|
|
|
|
// update database
|
|
$mysqli->query("UPDATE setting_chief SET
|
|
chief_desc = '".$page_title."',
|
|
chief_totaldepartment = '".escapeString($_POST['chief_totaldepartment'])."',
|
|
chief_format = '".escapeString($_POST['chief_format'])."',
|
|
chief_salary_type = '".escapeString($_POST['chief_salary_type'])."',
|
|
chief_period = '".escapeString($_POST['chief_period'])."',
|
|
updated_at = '".TODAYDATE."'
|
|
WHERE chief_id = '".$page."'") ;
|
|
|
|
// refresh page
|
|
header("Location:setting-chief.php?page_mode=edit&page=".$page."&success=1") ;
|
|
$_SESSION['system_result'] = 'success-updated' ;
|
|
exit ;
|
|
}
|
|
|
|
// start header here
|
|
include 'requires/page_header.php';
|
|
include 'requires/page_top.php';
|
|
|
|
?>
|
|
|
|
<style>
|
|
#map-container,#canvas,#existMap {
|
|
height: 400px;
|
|
}
|
|
.list_first, .list_second, .list_third, .list_four, .list_five {
|
|
border: 1px solid #ccc;
|
|
border-top: 0;
|
|
padding: 0;
|
|
width: 20%;
|
|
text-align: center;
|
|
}
|
|
.list_border {
|
|
border-top: 1px solid #ccc;
|
|
}
|
|
.bold{
|
|
font-weight: bold;
|
|
}
|
|
/* Map styles. */
|
|
</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['Chief'] ?> <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_your_chief_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="setting-chief.php?page_mode=edit&page=<?= $page ?>&type=edit" novalidate="novalidate">
|
|
<div class="form-group">
|
|
<div class="col-sm-2 control-label"><?= $lang['Description'] ?></div>
|
|
<div class="col-sm-9">
|
|
<input type="text" name="title" class="form-control ui-search-input" value="<?= dataFilter($row_page['chief_desc']) ?>" placeholder="<?= $lang['Description'] ?>" >
|
|
</div>
|
|
</div>
|
|
<div class="form-group">
|
|
<div class="col-sm-2 control-label"><?= $lang['Total Department'] ?></div>
|
|
<div class="col-sm-9">
|
|
<input type="number" name="chief_totaldepartment" class="form-control ui-search-input" value="<?= dataFilter($row_page['chief_totaldepartment']) ?>" placeholder="<?= $lang['Total Department'] ?>" >
|
|
</div>
|
|
</div>
|
|
<div class="form-group">
|
|
<div class="col-sm-2 control-label"><?= $lang['Format'] ?></div>
|
|
<div class="col-sm-9">
|
|
<select name="chief_format" class="form-control modaldata" id="chief_format">
|
|
<option value=""><?= $lang['select'] ?></option>
|
|
<option value="or" <?= $row_page['chief_format'] == 'or' ? 'selected' : '' ?> ><?= $lang['OR'] ?></option>
|
|
<option value="and" <?= $row_page['chief_format'] == 'and' ? 'selected' : '' ?> ><?= $lang['AND'] ?></option>
|
|
</select>
|
|
</div>
|
|
</div>
|
|
<div class="form-group">
|
|
<div class="col-sm-2 control-label"><?= $lang['Salary Type'] ?></div>
|
|
<div class="col-sm-9">
|
|
<select name="chief_salary_type" class="form-control modaldata" id="chief_format">
|
|
<option value=""><?= $lang['select'] ?></option>
|
|
<option value="basic" <?= $row_page['chief_salary_type'] == 'basic' ? 'selected' : '' ?> ><?= $lang['Basic'] ?></option>
|
|
<option value="contract" <?= $row_page['chief_salary_type'] == 'contract' ? 'selected' : '' ?> ><?= $lang['Contract'] ?></option>
|
|
</select>
|
|
</div>
|
|
</div>
|
|
<div class="form-group">
|
|
<div class="col-sm-2 control-label"><?= $lang['Period'] ?></div>
|
|
<div class="col-sm-9">
|
|
<input type="number" name="chief_period" class="form-control ui-search-input" value="<?= dataFilter($row_page['chief_period']) ?>" placeholder="<?= $lang['Period'] ?>" >
|
|
</div>
|
|
</div>
|
|
|
|
<div class="form-group">
|
|
<div class="col-sm-2 control-label"></div>
|
|
<div class="col-sm-9">
|
|
<button type="submit" class="btn" style="color:white;background-color: #5e5bd0;float:right; margin-top: 5px;width: 100px;"><?= $lang['submit'] ?></button>
|
|
<input type="hidden" name="hide" value="1">
|
|
<input type="hidden" name="page_status" value="<?= $submit_type ?>">
|
|
</div>
|
|
</div>
|
|
</form>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<?php
|
|
|
|
break ;
|
|
|
|
// all chief list
|
|
case 'all' :
|
|
default :
|
|
|
|
// query type
|
|
$search_query = '' ;
|
|
|
|
// search query
|
|
if ($search != ''){
|
|
$search_query .= " AND (chief_desc LIKE '%".$search."%')" ;
|
|
}
|
|
|
|
// form submit
|
|
if ($_POST['hide'] == '1' && $_POST['hide_status'] == 'action'){
|
|
// trash item
|
|
switch($_POST['page_action']){
|
|
case 'trash':
|
|
$mysqli_query = "UPDATE " . setting_chief . " SET
|
|
deleted_at = '".TODAYDATE."'
|
|
WHERE chief_id = " ;
|
|
$trash_page = trashPage('chief', $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 ;
|
|
|
|
// page query
|
|
$mysqli_query = "SELECT * FROM setting_chief
|
|
WHERE deleted_at IS NULL " . $search_query ;
|
|
$mysqli_page = $mysqli->query($mysqli_query." ORDER BY chief_id 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' ;
|
|
|
|
?>
|
|
<!-- 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><?= $lang['Chief'] ?> <small><?= $lang['list'] ?></small></h1>
|
|
</div>
|
|
<div class="pull-right col">
|
|
<a href="setting-chief.php?page_mode=new" class="btn" style="color:white;background-color: #5e5bd0;" target="_blank"><?= $lang['add_new'] ?></a>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<form method="post">
|
|
<!-- 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="color:white; background-color:#5e5bd0; width:100px;" value="<?= $lang['submit'] ?>" />
|
|
</div>
|
|
</div>
|
|
<!-- end trash -->
|
|
<div class="panel panel-default">
|
|
<div class="panel-heading"></div>
|
|
<div class="panel-body">
|
|
<table cellpadding="0" cellspacing="0" border="0" class="responsive table table-striped table-bordered" id="basic-datatable">
|
|
<thead>
|
|
<tr>
|
|
<th><?= $lang['Description'] ?></th>
|
|
<th><?= $lang['Total Department'] ?></th>
|
|
<th><?= $lang['Format'] ?></th>
|
|
<th><?= $lang['Salary Type'] ?></th>
|
|
<th><?= $lang['Period'] ?></th>
|
|
<th><?= $lang['date'] ?></th>
|
|
<th width="50"><?= $lang['trash'] ?></th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
<?php
|
|
if ($mysqli_page->num_rows > 0){
|
|
while ($row_page = $mysqli_page->fetch_array(MYSQLI_ASSOC)){
|
|
|
|
// default variable
|
|
$id = $row_page['chief_id'] ;
|
|
$title = dataFilter($row_page['chief_desc']) ;
|
|
|
|
echo '
|
|
<tr class="odd gradeX">
|
|
<td><a href="setting-chief.php?page_mode=edit&page='.$id.'">'.$title.'</a></td>
|
|
<td>'.dataFilter($row_page['chief_totaldepartment']).'</td>
|
|
<td>'.dataFilter($row_page['chief_format']).'</td>
|
|
<td>'.dataFilter($row_page['chief_salary_type']).'</td>
|
|
<td>'.dataFilter($row_page['chief_period']).'</td>
|
|
<td>'.resetDateFormat($row_page['created_at']).'</td>
|
|
<td>
|
|
<div class="checkbox multiple_trash">
|
|
<input type="checkbox" name="multiple_trash['.$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>
|
|
</tr>' ;
|
|
}
|
|
?>
|
|
</tbody>
|
|
</table>
|
|
<?= $page_pagination['page_pagination'] ?>
|
|
</div>
|
|
</div>
|
|
</form>
|
|
</div>
|
|
</div>
|
|
<?php
|
|
break ;
|
|
}
|
|
// footer
|
|
include 'requires/page_footer.php' ;
|
|
?>
|