File: /home/cafsindia/.trash/application_bkold/views/experience_letter/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));
$prime_id = "prime_".$controller_name."_id";
$employee_code = "employee_code";
$emp_prime_id = "prime_employees_id";
$search_url = site_url($controller_name ."/search");
$print_url = site_url($controller_name ."/sent_print/");
/* PAGE TITLE AND BUTTONS- START */
$breadcrumb = "";
$quick_link = explode(",",$quick_link->quicklink);
$link_li_line = "";
foreach($quick_link as $link){
if($link){
$url = site_url("$link");
$name = ucwords(str_replace("_"," ",$link));
$link_li_line .= "<li><a href='$url'> <i class='fa fa-angle-double-right fa-lg' aria-hidden='true'></i> $name</a></li>";
}
}
if($link_li_line){
$breadcrumb .= "<li class='dropdown'>
<a class='btn btn-xs btn-primary dropdown-toggle' type='button' id='dropdownMenu2' data-toggle='dropdown' aria-haspopup='true' aria-expanded='false'>
<i class='fa fa-plus-circle' aria-hidden='true'></i> Quick Links
</a>
<ul class='dropdown-menu dropdown-menu-left' aria-labelledby='dropdownMenu2'>
$link_li_line
</ul>
</li>";
}
$breadcrumb .="<li><a href='$site_url#Home'>Home</a></li>
<li><a href='".site_url($controller_name)."#$controller_name'>$page_name</a></li>
<li class='active'>List</li>";
/* PAGE TITLE AND BUTTONS- END */
?>
<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 echo $breadcrumb; ?>
</ol>
</div>
</div>
<div class="row" style='margin:0px;overflow:auto;'>
<div class='col-md-12' style='padding:8px;min-height: 400px;'>
<table id="table" class='table table-striped table-hover' style='width:100% !important;'></table>
</div>
</div>
<script type="text/javascript">
$(document).ready(function (){
$('.modal-dialog').draggable({ handle: ".modal-header" });
var a = <?php echo json_encode($master_pick); ?>;
$table = $('#table').DataTable( {
processing: true,
serverSide: true,
serverMethod: 'post',
lengthMenu: [[10,25,50,100,500,1000,-1],[10,25,50,100,500,1000,"All"]],
fixedColumns:{leftColumns: 3},
scrollX:true,
//fixedHeader: true,
language:{
lengthMenu:"<span style='margin-top:8px;margin-left:10px;'>Display</span> _MENU_ <span style='margin-top:8px;'>Records</span>",
searchPlaceholder: "Search records",
search: "",
//processing: '<div style="text-align: center; padding: 50px;color:#4b6fa2;z-index:999999999;"><i class="fa fa-spinner fa-spin fa-2x fa-fw"></i><br/>Loading...</div>',
},
ajax:{
'url': '<?php echo $search_url; ?>',
'data': function(data){
<?php echo $table_map_list;?>
//console.log(data);
},
beforeSend: function(){
$('.dataTables_processing').html('<span style="color:#CC3366;"><i class="fa fa-spinner fa-spin fa-2x fa-fw"></i><br/>Loading...</span>');
},
},
columns: [{
title:'<input type="checkbox" name="select_all" class="select_all">',
data: '<?php echo $prime_id; ?>',
type: 'html',
orderable: false,
className: 'select-checkbox',
searchable:false,
width:'1%',
render:function (value) {
return '<input type="checkbox" value="'+value+'" name="select_one" class="select_one">';
}
},
<?php
foreach($table_head as $table){
$label_name = $table->label_name;
$view_name = $table->view_name;
$field_type = (int)$table->field_type;
$date_type = $table->date_type;
if($field_type === 4){
if((int)$date_type === 1){
echo "{title:'$view_name',data: '$label_name',type: 'date',visible:true,
render:function(value) {
if (value === '' || value === '0000-00-00' || value === null || value === '1970-01-01') return '';
return moment(value).format('DD/MM/YYYY');
}
},\n";
}else{
echo "{title:'$view_name',data: '$label_name',type: 'date',visible:true,
render:function(value) {
if (value === '' || value === '0000-00-00' || value === null || value === '1970') return '';
return value;
}
},\n";
}
}else
if($field_type === 13){
echo "{title:'$view_name',data: '$label_name',type: 'date',visible:true,
render:function(value) {
if(value){
if (value === '' || value === '0000-00-00' || value === null || value === '1970-01-01 05:30:00' || value === '0000-00-00 00:00:00') return '';
return moment(value).format('DD/MM/YYYY HH:mm:ss');
}else{
return '';
}
}
},\n";
}else
if($field_type === 6){
echo "{title:'$view_name',data: '$label_name',type: 'date',visible:true,
render:function(value) {
send_val = 'No';
if(value === '1'){ send_val = 'No'; }
return send_val;
}
},\n";
}else
if($field_type === 7){
echo "{title:'$view_name',data: '$label_name',type: 'date',visible:true,
render:function(value) {
if(value !== ''){
var rslt = '';
var multi_val = value.split(',');
var count = 0
$.each(multi_val,function(i){
count++;
var multi_key = multi_val[i];
if(multi_key in a['$label_name']){
if(count === 1){
rslt += a['$label_name'][multi_key];
}else{
rslt += ' , '+a['$label_name'][multi_key];
}
}
});
return rslt;
}else {
return '-';
}
}
},\n";
}else
if($field_type === 10){
$img = '<img src="@URL@" alt="img" height="30" width="30">';
echo "{title:'$view_name',data: '$label_name',type: 'date',visible:true,sClass: 'center',
render:function(value) {
if(value !== ''){
var image = '$img';
image = image.replace('@URL@', value);
return image;
}else{
return '';
}
}
},\n";
}else
if($field_type === 1 || $field_type === 8){
echo "{title:'$view_name',data: '$label_name',visible:true,
render:function(value) {
if(value){
var val = value.replace(/\~/g,'\"');
var val = val.replace(/\`/g,'\'');
var val = val.replace(/\^/g,'\&');
return val;
}else{
return '';
}
}
},\n";
}else{
echo "{title:'$view_name',data:'$label_name',visible:true,},\n";
}
}
?>
{title:'Print',
data: '<?php echo $emp_prime_id; ?>',
type: 'html',
render:function (value) {
return '<a class="btn btn-xs btn-edit print_text" data-btn-submit="Submit" title="Update <?php echo $page_name;?>" href="<?php echo $print_url;?>'+value+'" data_form="<?php echo $controller_name;?>"> <span class="fa fa-print"></span> Print</a>';
}
},
],
});
$("<?php echo $input_ids;?>").bind('keyup change', function(e) {
$table.draw();
});
$("<?php echo $date_ids;?>").on("dp.hide",function (e) {
$table.draw();
});
var table_option = "<table><td id='export' style='padding:8px 2px;'></td></tr></table>";
$("#table_filter").append(table_option);
var buttons = new $.fn.dataTable.Buttons(table, {
buttons: [{
extend: 'collection',
text: 'Export',
buttons: [
{extend:'copy',exportOptions:{modifier :{order:'index',page:'all',search:'none'},columns:':visible'}},
{extend:'csv',exportOptions:{modifier:{order:'index',page:'all',search:'none'},columns:':visible'}},
{extend:'excel',exportOptions:{modifier:{order :'index',page: 'all',search:'none'},columns:':visible'}},
{extend:'pdf',exportOptions:{modifier:{order :'index',page:'all',search:'none'},columns:':visible'}},
{extend:'print',exportOptions:{modifier:{order :'index',page:'all',search:'none'},columns:':visible',}},
]
}]
}).container().appendTo($('#export'));
$(".buttons-collection").addClass("btn btn-xs btn-edit");
$('input[type=search]').addClass('form-control input-sm');
$("select[name='table_length']" ).addClass('form-control input-sm');
$table.on('click','a.print_text',function(event){
event.preventDefault();
var action = $(this).attr('data-btn-submit');
var title = $(this).attr('title');
var control = $(this).attr('href');
var form_id = "print_div_body";
$('.modal').modal({backdrop: 'static', keyboard: false});
$('.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>');
$.ajax({
type: 'POST',
url: control,
dataType: "html",
success: function (response){
$('.modal-title').html('<h4 class="modal-title">'+title+'</h4>');
$('.modal-body').html(response);
var btn_info = '<button type="button" class="btn btn-danger" data-dismiss="modal">Close</button>';
if(action === "Submit"){
btn_info += '<button class="btn btn-primary" onclick="print_doc(print_div_body);" style="margin-left: 15px;" data-dismiss="modal">Print</button>';
}
btn_info = '<div class="col-md-12" style="background-color:#FFFFFF;padding: 10px 20px; text-align: right; border-top: 1px solid #e5e5e5;">'+btn_info+'</div>';
$('#'+form_id).after(btn_info);
}
});
});
/* DELETE PROCESS - END*/
$(function (){$(".datepicker").datetimepicker({format: 'DD-MM-YYYY',});});
$(".datepicker_time").datetimepicker({format: 'DD-MM-YYYY HH:mm:ss',});
$('.select2').select2({placeholder: '---- Select ----',});
});
// function view_form_data(action,title,control,form_id){
// $('.modal').modal({backdrop: 'static', keyboard: false});
// $('.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>');
// $.ajax({
// type: 'POST',
// url: control,
// dataType: "html",
// success: function (response){
// $('.modal-title').html('<h4 class="modal-title">'+title+'</h4>');
// $('.modal-body').html(response);
// var btn_info = '<button type="button" class="btn btn-danger" data-dismiss="modal">Close</button>';
// if(action === "Submit"){
// btn_info += '<button class="btn btn-primary" id="submit" style="margin-left: 15px;">Submit</button>';
// }
// btn_info = '<div class="col-md-12" style="background-color:#FFFFFF;padding: 10px 20px; text-align: right; border-top: 1px solid #e5e5e5;">'+btn_info+'</div>';
// $('#'+form_id).append(btn_info);
// }
// });
// }
function print_doc(elem){
var domClone = elem.cloneNode(true);
var $printSection = document.getElementById("printSection");
if (!$printSection) {
var $printSection = document.createElement("div");
$printSection.id = "printSection";
document.body.appendChild($printSection);
}
$printSection.innerHTML = "";
$printSection.appendChild(domClone);
window.print();
setTimeout(function(){
window.location.reload();
},50);
}
</script>
<style type="text/css">
@media screen and (min-width: 768px) {
.print_modal{
width: 760px; /* New width for default modal */
}
}
@media screen {
#printSection {
display: none;
}
}
@media print {
body * {
visibility:hidden;
}
#printSection, #printSection * {
visibility:visible;
}
#printSection {
position:absolute;
margin-left:15px;
top:10px;
}
}
tbody>tr>td{
border: 0px !important;
font-size: 13px !important;
}
</style>
<?php $this->load->view("partial/footer"); ?>