File: /home/cafsindia/hrms_cafsinfotech_in/application_bk14FEB2026/views/home.php
<?php
$this->load->view("partial/header");
if($main_menu !== 'is_exist'){
$calendar_style = 'display:none';
}
?>
<style type="text/css">
@media (min-width:200px) and (max-width:928px){
.container{
width: 100% !important;
}
}
@media (min-width:930px) and (max-width:1099px){
.container{
width: 1075px !important;
}
}
@media (min-width:1100px) and (max-width:1299px){
.container{
width: 1212px !important;
}
}
@media (min-width:1300px) and (max-width:3500px){
.container{
width: 1355px !important;
}
}
@media (min-width:1500px) and (max-width:3500px){
.container{
width: 1466px !important;
}
}
.form-group{
display: inline-block;
}
.single-menu-item {
text-align: center;
padding: 10px 0px;
}
.single-menu-item img {
max-width: 80px;
margin-bottom: 5px;
}
.single-menu-item p {
font-size: 14px;
color: #000000;
padding: 10px;
}
p {
word-wrap: break-word;
text-decoration: none !important;
cursor: pointer;
}
.pl-0 {
padding-left: 0px !important;
padding: 10px;
}
.title-1 {
font-weight: 500;
font-size: 18px;
color: #2a333e;
}
.font-16{
font-size: 16px !important;
}
.title-1 {
font-weight: 500;
font-size: 18px;
color: #2a333e;
}
.pl-32{
padding-left: 32px !important;
}
.single-menu-item .module-icon-wrapper {
width: 80px;
height: 80px;
border-radius: 16px;
background-color: #f8f8f8;
border: solid 1px #dbe1e8;
margin: 0 auto 5px;
transition: all 0.5s ease;
position: relative;
box-shadow: 0 4px 8px 0 rgb(0 0 0 / 10%);
text-align: center;
}
.modal-content{
width: 35%;
margin-top: 10%;
position: absolute;
left: 50%;
transform: translate(-50%, -50%);
}
</style>
<nav class="main-navigation mt-x pb-50" style="margin-top: 30px;">
<div class="container pt-24" >
<div class="row" style='<?php echo $calendar_style;?>'>
<div class="col-sm-2" id="calendar_btn">
<i class="fa fa-calendar fa-lg calendar_logo"></i>
<button class="btn btn-xs btn-primary toggle_btn" ><span style="margin-left: 10px;"> Calendar</span></button>
</div>
<div class="col-sm-2" id="quick_link_btn" style="display:none;">
<i class="fa fa-th-large calendar_logo"></i>
<button class="btn btn-xs btn-primary toggle_btn" ><span style="margin-left: 10px;" > Quick Link</span></button>
</div>
</div>
<div style="height: 10px;"></div>
<div id ="quick_link">
<?php
$header_list = array();
$report_list = array();
foreach($quick_header_menu as $menu){
$header_list[$menu->menu_name][] = array('module_id'=>$menu->module_id,'module_name'=>$menu->module_name,'menu_icon'=>$menu->menu_icon);
}
foreach($quick_report_menu as $menu){
$report_list[$menu->report_menu][] = array('module_id'=>$menu->prime_report_setting_id,'module_name'=>$menu->report_name,'menu_icon'=>$menu->menu_icon);
}
$menu_data = "";
foreach ($header_list as $menu_name => $menu_list){
$sub_list = "";
foreach ($menu_list as $key => $value){
$module_id = $value['module_id'];
$module_name = $value['module_name'];
$menu_icon = $value['menu_icon'];
$url = site_url("$module_id");
$img_url = base_url("$menu_icon");
$sub_list .= "<div class='col-md-2 col-sm-2 inBlock'>
<div class='single-menu-item'>
<a href='$url'>
<div class='module-icon-wrapper'>
<img src='$img_url'>
</div>
<p>$module_name</p>
</a>
</div>
</div>";
}
//$report_url = site_url("$module_id/index")."/".$report_id;
$menu_data .= "<div class='row'><div class='col-md-2 pl-0 desktopDisplay'>
<div class='title-1 font-16 ptb-8 pl-32 plx-0'>$menu_name</div>
</div><div class='col-md-4 text-right text-center_x pr-32 plrx-12'>
</div></div><div class='row'>$sub_list</div>";
}
$reportmenu_data = "";
foreach ($quick_report_menu as $key => $report_menu_rslt){
$report_list = "";
foreach($report_menu_rslt as $sub_reports => $report_rslt){
$report_id = $report_rslt['prime_report_setting_id'];
$report_name = $report_rslt['report_name'];
$menu_icon = $report_rslt['menu_icon'];
$report_menu_name = $report_rslt['menu_name'];
$img_url = base_url("$menu_icon");
$report_url = site_url("report/index")."/".$report_id;
$report_list .= "<div class='col-md-2 col-sm-2 inBlock'>
<div class='single-menu-item'>
<a href='$report_url'>
<div class='module-icon-wrapper'>
<img src='$img_url'>
</div>
<p>$report_name</p>
</a>
</div>
</div>";
}
$reportmenu_data .= "<div class='row'><div class='col-md-4 pl-0 desktopDisplay'>
<div class='title-1 font-16 ptb-8 pl-32 plx-0'> Report Wizard </div>
</div><div class='col-md-8 text-right text-center_x pr-32 plrx-12'>
</div></div><div class='row'>$report_list</div>";
}
echo $menu_data.$reportmenu_data;
?>
</div>
</div>
<div style="display: flex;overflow-x: scroll;" class="container">
<input type="hidden" name="employee_code_hidden" value="" id="employee_code_hidden" placeholder="fff" class="form-control input-sm alpha" style="width: 200px;height:25px;" autocomplete="off">
<input type="hidden" name="employee_code_hidden" value="" id="employee_name_hidden" placeholder="fff" class="form-control input-sm alpha" style="width: 200px;height:25px;" autocomplete="off">
<div id = 'calendar' style="display: none;width: 2012px;"></div>
</div>
<?php
$this->load->view('partial/footer');
?>
<script>
$(document).ready(function(){
// $(document).keydown(function (event) { // [MS 10-10-2024]
// if (event.keyCode == 123) { // Prevent F12
// return false;
// } else if (event.ctrlKey && event.shiftKey && event.keyCode == 73) { // Prevent Ctrl+Shift+I
// return false;
// }
// });
// document.addEventListener('contextmenu', event => event.preventDefault()); // PREVENT RIGHT CLICK
let date = new Date();
let month = date.getMonth() +1;
let year = date.getFullYear();
let calendar_show = '<?php echo $main_menu?>'
if(calendar_show == 'is_exist'){
get_calendar(month,year);
}
emp_suggest(month,year);
$('.toggle_btn').click(function(){
$('#quick_link').toggle();
$('#calendar').toggle();
$('#quick_link_btn').toggle();
$('#calendar_btn').toggle();
// get_calendar(month,year);
});
});
function get_calendar(month,year){
var send_url = '<?php echo site_url("home/get_calendar"); ?>';
var logged_role = <?php echo (int)$this->logged_role;?>;
var logged_role_arr = [1,8,10,11,12];
var emp_code_div = '';
if(jQuery.inArray(logged_role, logged_role_arr) == 0){
emp_code_div = '<div class="col-sm-3" style="margin-left: 280px !important;"><input type="text" name="employee_code" value="'+$('#employee_name_hidden').val()+'" id="employee_code" placeholder="Employee Code" class="form-control input-sm alpha" style="width: 200px;height:25px;" autocomplete="off"><div class="append_div"></div></div><div class="col-sm-2"><span id="autocomplete_spinner" style=color:#e64c3d !important;></span></div>';
}
var employee_code = $('#employee_code_hidden').val();
// Encryption
var encKey = '<?php echo $encKey; ?>';
var encData = encrypt(encKey,{employee_code:employee_code,month:month,year:year});
$.ajax({
url:send_url,
data:encData,
contentType: 'text/plain',
type:'POST',
dataType:'json',
success:function(response){
var events_arr = [];
if(response.status){
events = response.events;
var tos = response.tos
$.each(events,function(a , b){
events_arr[a] = {date:new Date(b.date) , eventName:b.eventName , className:b.className , dateColor:b.dateColor };
});
create_calendar(events_arr,month,year,tos);
var info_div = response.info_div;
var leave_bal = response.leave_bal;
$('.gc-calendar-header').append('<div class = "row" style="margin-top: -30px;">'+emp_code_div+'<div class="col-sm-1" style="float:right;width: 135px;"><button class="btn btn-xs btn-primary toggle_btn" ><span id="my_leave" style="">My Balance</span></button></div><div class="" style="float:right">'+info_div+'</div></div>');
$('#my_leave').click(function(){
get_leave_bal(leave_bal);
});
$('#employee_code').click(function(){
$(this).val('');
});
// EMPLOYEE CODE AUTO COMPLETE PROCESS
emp_suggest(month,year);
}else{
create_calendar(events_arr,month,year,tos)
toastr.error(response.message);
}
}
});
}
function create_calendar(events_arr,month,year,tos){
var calendar = $("#calendar").calendarGC({
dayBegin: 0,
events:events_arr,
onPrevMonth: function (e) {
let month = e.getMonth() +1;
let year = e.getFullYear();
get_calendar(month,year);
},
onNextMonth: function (e) {
let month = e.getMonth() +1;
let year = e.getFullYear();
get_calendar(month,year);
},
tos : tos,
});
calendar.setDate(year+'-'+month+'-01');
}
// FUNCTION AUTOCOMPLETE
function emp_suggest(month,year){
$('#employee_code').autocomplete({
source: function(request, response) {
// Encryption
var key = '<?php echo $encKey; ?>';
var encData = encrypt(key,{term:request.term});
$.ajax({
url : '<?php echo site_url("home/emp_suggest");?>',
type: 'POST',
data: encData,
success: function (data) {
var rslt = JSON.parse(data);
response($.map(rslt, function (el) {
if(el.value === '0'){
$('#hidden_id').val('');
}
return {
value: el.value,
label: el.label,
display_name:el.display_name
};
}));
}
});
},
minChars:1,
autoFocus: true,
scroll: true,
appendTo: '.append_div',
select: function(e, ui) {
$('#employee_name_hidden').val(ui.item.label);
$('#employee_code_hidden').val(ui.item.value);
$('#autocomplete_spinner').html('<i class="fa fa-spinner fa-spin" ></i> Processing...');
get_calendar(month,year);
}
});
}
//FUNCTION GET LEAVE BALANCE
function get_leave_bal(leave_bal){
$('.modal').modal({backdrop: 'static', keyboard: false});
$('.modal-title').html('<h4 class="modal-title">My Leave Balance</h4>');
$('.modal-body').html(leave_bal);
}
</script>