File: /home/cafsindia/uds.cafsinfotech.in/application/views/report_setting/manage.php
<?php
$this->load->view("partial/header");
$access_data = $this->session->userdata('access_data');
$access_add = (int)$access_data[$controller_name]['access_add'];
$access_update = (int)$access_data[$controller_name]['access_update'];
$access_delete = (int)$access_data[$controller_name]['access_delete'];
$access_search = (int)$access_data[$controller_name]['access_search'];
$access_export = (int)$access_data[$controller_name]['access_export'];
$page_name = "Report Setting";
?>
<script type="text/javascript">
$(document).ready(function (){
<?php $this->load->view('partial/bootstrap_tables_locale'); ?>
table_support.init({
resource: '<?php echo site_url($controller_name); ?>',
headers: <?php echo $table_headers; ?>,
pageSize: <?php echo $this->config->item('lines_per_page'); ?>,
uniqueId: '<?php echo "prime_".$controller_name."_id";?>',
});
$('#delete_btn').on('click',function(){
var checked_id = [];
var confirmation = confirm("Are you sure you want to delete this item?");
if(confirmation){
checked_id = Array.from(checkedRows.values());
// Encryption
var encKey = '<?php echo $encKey; ?>';
var data = {from_month:from_month,last_month:last_month};
var encData = encrypt(encKey,data);
$.ajax({
type: "POST",
url: '<?php echo site_url($controller_name . "/delete_function"); ?>',
data:{checked_id:checked_id},
success: function (data) {
var rslt = JSON.parse(data);
if(rslt.success == false){
toastr.error(rslt.message);
}else{
toastr.success(rslt.message);
location.reload(true);
}
}
});
}else{
toastr.error("Delete Cancelled...!");
}
})
const table = document.getElementById('table');
table.addEventListener('change', handleCheckboxChange);
});
const checkedRows = new Map();
function handleCheckboxChange(event) {
// checkedRows ="";
// Check if the target element is a checkbox
if (event.target.tagName === 'INPUT' && event.target.type === 'checkbox') {
// Get the parent <tr> element of the checkbox
const trElement = event.target.closest('tr');
// Retrieve the data-uniqueid and data-index attribute values from the <tr> element
const uniqueId = trElement.getAttribute('data-uniqueid');
const dataIndex = trElement.getAttribute('data-index');
// Update the checkedRows map based on checkbox state
if (event.target.checked) {
checkedRows.set(dataIndex, uniqueId);
} else {
checkedRows.delete(dataIndex);
}
}
}
</script>
<div class='row title_content'>
<div class='col-md-2 col-xs-4'>
<h1 class='page_txt'><?php echo $page_name;?></h1>
</div>
<div class='col-md-10 col-xs-8'>
<ol class="breadcrumb">
<?php
if($access_add === 1){
?>
<li>
<a class='btn btn-xs btn-primary modal-dlg' data-href='<?php echo site_url($controller_name . "/view"); ?>'
title='Add New Report'> <span class="fa fa-user-plus"> </span> Add New Report
</a>
</li>
<?php
}
?>
<li><a href="<?php echo site_url()?>#Home">Home</a></li>
<li><a href="<?php echo site_url($controller_name)?>#<?php echo "$controller_name";?>"><?php echo "$page_name";?></a></li>
<li class="active">List</li>
</ol>
</div>
</div>
<div id="toolbar" class="form-inline">
<?php
if($access_delete === 1){
?>
<button id="delete_btn" class="btn btn-xs btn-danger" style="margin-left:25px;"><i class='fa fa-trash' style=' margin-right:5px;' aria-hidden='true'></i>Delete
<!-- <span class="fa fa-trash-o"> </span><?php echo $this->lang->line("common_delete"); ?> -->
</button>
<?php
}
?>
</div>
<div id="table_holder">
<table id="table"></table>
</div>
<style>
.pull-right.search {
display: none !important;
}
.columns.columns-right.btn-group.pull-right {
display: none !important;
}
<?php
if($access_search === 1){
echo ".pull-right.search { display: block !important; }";
}
if($access_export === 1){
echo ".columns.columns-right.btn-group.pull-right{display: block !important;}";
}
?>
</style>
<?php $this->load->view("partial/footer"); ?>