File: //home/cafsindia/groups_cafsindia_com/application/views/budget_capacity/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'];
$access_import = (int)$access_data[$controller_name]['access_import'];
$page_name = ucwords(str_replace("_"," ",$controller_name));
$uniqueId = "prime_".$controller_name."_id";
?>
<div class='row title_content'>
<div class='col-md-2 col-xs-4'>
<h1 class='page_txt'><?php echo $page_name;?></h1>
</div>
</div>
<div id="toolbar" class="">
<div class="col-md-12">
<div class="col-md-3">
<?php echo form_label("Select Branch", 'branch', array('class' => 'required'));
echo form_dropdown(array("name" =>'branch[]',"multiple id" => 'branch',"class" =>'form-control input-sm select2'),$branch_list);
echo "<label><input name='branch_to_select' id='branch_to_select' type='checkbox'> Select All</label>"; ?>
</div>
<div class="col-md-3">
<?php echo form_label("Select Channel", 'channel', array('class' => 'required'));
echo form_dropdown(array('name' => 'channel[]','multiple id' =>'channel','class' => 'form-control input-sm select2'), $channel_list);
echo "<label><input name='channel_to_select' id='channel_to_select' type='checkbox'> Select All</label>"; ?>
</div>
<!-- <div class="col-md-3">
<?php echo form_label("Select Login Code", 'login_code', array('class' => 'required'));
echo form_dropdown(array('name' => 'login_code[]','multiple id' =>'login_code','class' => 'form-control input-sm select2'), $login_code_list);
echo "<label><input name='login_code_to_select' id='login_code_to_select' type='checkbox'> Select All</label>"; ?>
</div> -->
</div>
</div>
<div id="toolbar">
<div style="padding:15px;" id="budget_capacity_report" class="col-md-12">
</div>
</div>
<script type="text/javascript">
$(document).ready(function (){
$(function(){
$(".datepicker").datetimepicker({
format: 'DD-MM-YYYY',
//debug: true
});
});
$(function(){
$('.select2').select2({
allowClear : true,
placeholder: "--- Select ---"
// tags: true
});
$('.select2-tags').select2({
allowClear: true,
tags: true,
placeholder: "--- Select ---",
tokenSeparators: [',']
});
$(".select2_user").select2({
placeholder: "--- Select ---",
allowClear: true,
tags: true
});
});
//FUNCTION FOR GET A BUDGET CAPACITY DATA
get_budget_capacity();
$("#branch_to_select").click(function(){
if($("#branch_to_select").is(':checked') ){
$("#branch > option").prop("selected","selected");
$("#branch").trigger("change");
}else{
$("#branch > option").removeAttr("selected");
$("#branch").trigger("change");
}
});
$("#channel_to_select").click(function(){
if($("#channel_to_select").is(':checked') ){
$("#channel > option").prop("selected","selected");
$("#channel").trigger("change");
}else{
$("#channel > option").removeAttr("selected");
$("#channel").trigger("change");
}
});
$("#branch,#channel").bind('keyup change', function(e) {
get_budget_capacity();
});
});
function get_budget_capacity(){
var branch = $('#branch').val();
var channel = $('#channel').val();
var login_code = $('#login_code').val();
var send_url = '<?php echo site_url("$controller_name/get_budget_capacity");?>';
$.ajax({
type: 'POST',
url: send_url,
data:{channel:channel,branch:branch,login_code:login_code},
success: function(data) {
var rslt = JSON.parse(data);
if(rslt.success){
$('#budget_capacity_report').html(rslt.table_info);
// var table = $('#budget_capacity_table').DataTable({
// destroy: true,
// // scrollY: 200,
// // lengthMenu: [[25,50,100],[25,50,100,"All"]],
// language:{
// searchPlaceholder: "Search records",
// search: "",
// },
// scrollX:true,
// dom: 'Bfrtip',
// "aoColumns": [ null,
// {
// "bSortable": true,
// "defaultContent":""
// }],
// buttons: [
// 'excelHtml5',
// 'pdfHtml5'
// ]
// });
// $("input[type='search']").addClass('form-control');
}else{
toastr.error(rslt.message);
}
}
});
}
function show_active_emp(branch,channel,level1,level2){
var send_url = '<?php echo site_url("$controller_name/get_active_emp_details");?>';
$.ajax({
type: 'POST',
url: send_url,
data:{branch:branch,channel:channel,level2:level2,level1:level1},
success: function(data) {
var rslt = JSON.parse(data);
if(rslt.success){
//MODAL BODY LOADING FOR SHOW A FIELD
$('.modal').modal({backdrop: 'static', keyboard: false});
$('.modal-title').html('<h4 class="modal-title">Active Employees Details</h4>');
$('.modal-body').html('<div style="text-align: center;padding:50px;color:#4b6fa2;"><i class="fa fa-spinner fa-spin fa-2x fa-fw"></i><br/>Please wait processing....</div>');
$('.modal-body').html("<ul class='nav nav-tabs' data-tabs='tabs'><li class='active' role='presentation'><a data-toggle='tab' href='#active_emp_detail'>Employee Details</a></li></ul><div class='tab-content'><div class='tab-pane fade in active' id='active_emp_detail'><table id='active_emp_table' width='100%' class='table table-hover'></table></div></div>");
var active_emp_table = $('#active_emp_table').DataTable( {
destroy: true,
paging :false,
language:{
searchPlaceholder: "Search records",
search: "",
},
data: rslt.active_emp_rslt,
columns: [
{ title: "Login Code",data: "emp_code" },
{ title: "branch",data: "branch_name" },
{ title: "Channel",data: "channel_name" },
{ title: "Designation",data: "designation" },
{ title: "Band",data: "band_value" },
{ title: "DOJ",data: "date_of_joining",
render:function(value, type, full, meta) {
if (value === null) return '';
return moment(value ,"YYYY-MM-DD").format('DD-MM-YYYY')}
},
{ title: "Employee Status",data: "active_status_value",className: "active_status" ,
render:function(value) {
let color = 'green';
if (value === "Training") {
color = 'blue';
}
return '<span style="color:' + color + '">' + value + '</span>';}}
],
dom: 'Bfrtip',
buttons: [
'excelHtml5',
'pdfHtml5'
]
});
$("input[type='search']").addClass('form-control');
}else{
toastr.error(rslt.message);
return false;
}
}
});
}
</script>
<style>
.buttons-html5{
padding: inherit!important;
}
.buttons-html5 > span{
background-color: #f75940;
color: #FFFFFF;
}
ul.select2-selection__rendered{
max-height: 102px;
overflow-y: auto !important;
}
th {
text-align: center;
}
td {
text-align: center;
}
#active_emp {
cursor: pointer;
}
</style>
<?php $this->load->view("partial/footer"); ?>