first commit
This commit is contained in:
@@ -0,0 +1,275 @@
|
||||
<?php
|
||||
include 'connect/cms-config.php' ;
|
||||
include 'requires/function.php' ;
|
||||
include 'requires/session.php' ;
|
||||
|
||||
// include the class
|
||||
include 'requires/class_resize.php' ;
|
||||
|
||||
// check permission
|
||||
if ( !permissionCheck($row_user, 'setting') ){
|
||||
header('Location: index.php') ;
|
||||
exit ;
|
||||
}
|
||||
|
||||
// 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-salary' ;
|
||||
$active_menu = 'setting-zakat' ;
|
||||
|
||||
// mode type | all list | new | edit
|
||||
switch($page_mode){
|
||||
|
||||
// edit hostel
|
||||
case 'new' :
|
||||
case 'edit' :
|
||||
|
||||
// check query exsits
|
||||
$submit_type = 'new' ;
|
||||
$mysqli_page = $mysqli->query("SELECT * FROM setting_salary_tax
|
||||
WHERE tax_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') ;
|
||||
|
||||
$employee_rate = $_POST['employee_rate'];
|
||||
$employee_rate = ($employee_rate != '' ? $employee_rate : '0') ;
|
||||
|
||||
$employer_rate = $_POST['employer_rate'];
|
||||
$employer_rate = ($employer_rate != '' ? $employer_rate : '0') ;
|
||||
|
||||
if ( $page == '' ){
|
||||
$mysqli->query("INSERT INTO setting_salary_tax (created_at, tax_type) VALUES ('".TODAYDATE."', 'ZAKAT')") ;
|
||||
$page = $mysqli->insert_id ;
|
||||
}
|
||||
|
||||
// update database
|
||||
$mysqli->query("UPDATE setting_salary_tax SET
|
||||
tax_title = '".$page_title."',
|
||||
employee_rate = '".$employee_rate."',
|
||||
employer_rate = '".$employer_rate."',
|
||||
updated_at = '".TODAYDATE."'
|
||||
WHERE tax_id = '".$page."'") ;
|
||||
|
||||
// refresh page
|
||||
header("Location:setting-zakat.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="page-header"><h1>Muslim Zakat Fund <small><?= $lang[$page_mode] ?></small></h1></div>
|
||||
<?php
|
||||
if ($_SESSION['system_result'] != ''){
|
||||
switch($_SESSION['system_result']){
|
||||
case 'success-updated' :
|
||||
echo '
|
||||
<div class="result_success">
|
||||
Thank you, the details have been saved.
|
||||
</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-zakat.php?page_mode=edit&page=<?= $page ?>&type=edit" novalidate="novalidate">
|
||||
<div class="form-group">
|
||||
<div class="col-sm-2 control-label"><?= $lang['title'] ?></div>
|
||||
<div class="col-sm-9">
|
||||
<input type="text" name="title" class="form-control ui-search-input" value="<?= $row_page['tax_title'] ?>" placeholder="<?= $lang['title'] ?>" >
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<div class="col-sm-2 control-label">Employee Zakat Rate (%)</div>
|
||||
<div class="col-sm-9">
|
||||
<input type="number" min='0' name="employee_rate" class="form-control ui-search-input" value="<?= ($row_page['employee_rate']!='' ? $row_page['employee_rate'] : 0 ) ?>" placeholder="Employee Zakat Rate (%)" >
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<div class="col-sm-2 control-label">Employer Zakat Rate (%)</div>
|
||||
<div class="col-sm-9">
|
||||
<input type="number" min='0' name="employer_rate" class="form-control ui-search-input" value="<?= ($row_page['employer_rate']!='' ? $row_page['employer_rate'] : 0 ) ?>" placeholder="Employer Zakat Rate (%)" >
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<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>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<?php
|
||||
|
||||
break ;
|
||||
|
||||
// all hostel list
|
||||
case 'all' :
|
||||
default :
|
||||
|
||||
// query type
|
||||
$search_query = '' ;
|
||||
|
||||
// search query
|
||||
if ($search != ''){
|
||||
$search_query .= " AND tax_title LIKE '%".$search."%' ";
|
||||
}
|
||||
|
||||
// form submit
|
||||
if ($_POST['hide'] == '1' && $_POST['hide_status'] == 'action'){
|
||||
// trash item
|
||||
switch($_POST['page_action']){
|
||||
case 'trash':
|
||||
$mysqli_query = "UPDATE " . setting_salary_tax . " SET
|
||||
deleted_at = '".TODAYDATE."'
|
||||
WHERE tax_id = " ;
|
||||
$trash_page = trashPage('hostel', $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_salary_tax
|
||||
WHERE tax_type = 'ZAKAT' AND deleted_at IS NULL " . $search_query ;
|
||||
$mysqli_page = $mysqli->query($mysqli_query." ORDER BY tax_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="page-header">
|
||||
<h1>Muslim Zakat Fund <small><?= $lang['list'] ?></small></h1>
|
||||
<a href="setting-zakat.php?page_mode=new" class="btn btn-purple" target="_blank"><?= $lang['add_new'] ?></a>
|
||||
</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 btn-purple" 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['title'] ?></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['tax_id'] ;
|
||||
$title = $row_page['tax_title'] ;
|
||||
|
||||
echo '
|
||||
<tr class="odd gradeX">
|
||||
<td><a href="setting-zakat.php?page_mode=edit&page='.$id.'">'.$title.'</a></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>
|
||||
</tr>' ;
|
||||
}
|
||||
?>
|
||||
</tbody>
|
||||
</table>
|
||||
<?= $page_pagination['page_pagination'] ?>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
<?php
|
||||
break ;
|
||||
}
|
||||
// footer
|
||||
include 'requires/page_footer.php' ;
|
||||
?>
|
||||
Reference in New Issue
Block a user