File: /home/cafsindia/hrms_cafsinfotech_in/application_bk14FEB2026/views/time_card/manage.php
<?php
$this->load->view("partial/header");
$page_name = ucwords(str_replace("_"," ",$controller_name));
$prime_id = "prime_".$controller_name."_id";
$search_url = site_url($controller_name ."/search");
$view_url = site_url($controller_name ."/view/");
$import_url = site_url($controller_name ."/import/");
$category = $this->session->userdata('logged_role');
$user_role = $this->session->userdata('logged_user_role');
$process_month = date('m-Y');
$user_read_only = "";
?>
<div class='row title_content'>
<div class='col-md-2'>
<h1 class='page_txt'><?php echo $page_name;?></h1>
</div>
</div>
<div id="holder" class="form-inline" style="margin-top:20px;">
<div class="col-md-12" style="margin-bottom:10px;">
<div class="form-group">
<?php
echo form_label('Process Month', 'process_month', array('class' => 'required'));
echo form_input(array('name' => 'process_month', 'id' => 'process_month', 'class' => 'form-control input-sm datepicker', 'value'=>$process_month));
?>
</div>
<div class="form-group">
<button class='btn btn-primary btn-sm' id="search">View</button>
</div>
</div>
</div>
<div class="col-md-12" id="employee_table_view" style="margin:10px;padding:10px;background-color: #f2f2f2;"></div>
<div class="modal" id="myModal">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<h4 class="modal-title">Time Card</h4>
<button type="button" class="close" data-dismiss="modal">×</button>
</div>
<div class="modal-body" id="example1">
</div>
<div class="modal-footer">
<button type="button" class="btn btn-danger" data-dismiss="modal">Close</button>
</div>
</div>
</div>
</div>
<script type="text/javascript">
$(document).ready(function (){
<?php echo $user_read_only; ?>
var user_role = '<?php echo $user_role; ?>';
$(function () {
$(".datepicker").datetimepicker({
format: 'MM-YYYY',
//debug: true
});
});
select_call();
$('#employee_table_view').hide();
$('#process_month').on("dp.hide",function (e) {
var process_month = $('#process_month').val();
if(toPartialIso(from_month) > toPartialIso(to_month) ){
toastr.error("To Month should be Greater than From Month!!");
$('#to_month').val('');
}
});
// if(parseInt(user_role) !== 1 && parseInt(user_role) !== 2) {
// //FOR READ ONLY(AUTO SELECT EMP CODE WITH NAME) NOT APPLY FOR USER ROLE 1 and 2
// var process_month = $('#process_month').val();
// time_card(process_month);
// } => [MS 09-11-2024]
$("#search").on('click', function(e){
var process_month = $('#process_month').val();
if(!process_month){
toastr.error('Please choose Process Month?');
return false;
}
time_card(process_month);
});
});
function time_card(process_month){
var send_url = '<?php echo site_url("$controller_name/time_card");?>'
if(process_month){
$("#search").html("<i class='fa fa-spinner fa-spin'></i> Processing...");
$('#search').attr('disabled','disabled');
var key = '<?php echo $key; ?>';
var data = {process_month:process_month};
var encData = encrypt(key,data);
$.ajax({
type: 'POST',
url: send_url,
data:encData,
contentType: 'text/plain',
success: function(data) {
var rslt = JSON.parse(data);
$('#employee_table_view').show();
$('#employee_table_view').html(rslt.table_data);
$('#search').attr('disabled',false);
$("#search").html("View");
}
});
}
}
function select_call(){
$(function(){
$('.select2').select2({
placeholder: '---- Select ----',
});
$('.select2-tags').select2({
tags: true,
tokenSeparators: [',']
});
});
}
function pdf_viewer(url){
PDFObject.embed(url, "#example1");
$("#myModal").modal("show");
}
//from and to month validation
// function toPartialIso(month) {
// var m = month.match(/(\d{2})-(\d{4})/);
// if (m) {
// return m[2] + "-" + m[1]
// }
// throw "Choose Correct Date!"
// }
</script>
<style>
.pdfobject-container { height: 50rem; border: 1rem solid rgba(0,0,0,.1); }
.modal-dialog {
width: 100% !important;
height: 100% !important;
margin: 0;
padding: 0;
}
.modal-content {
height: auto;
min-height: 100% !important;
border-radius: 0;
}
.modal .modal-body div {
height: 100% !important;
overflow-y: auto;
width: 100%;
}
</style>
<?php $this->load->view("partial/footer"); ?>