Upgrade to v15.0.OS
This commit is contained in:
17
ext/modules/attendance/dashboard.html
Normal file
17
ext/modules/attendance/dashboard.html
Normal file
@@ -0,0 +1,17 @@
|
||||
<div class="col-lg-3 col-xs-12">
|
||||
<!-- small box -->
|
||||
<div class="small-box bg-aqua">
|
||||
<div class="inner">
|
||||
<h3 id="lastPunchTime">
|
||||
Punch In
|
||||
</h3>
|
||||
<p>or punch out</p>
|
||||
</div>
|
||||
<div class="icon">
|
||||
<i class="ion ion-ios7-alarm-outline"></i>
|
||||
</div>
|
||||
<a href="#_moduleLink_#" class="small-box-footer" id="atteandanceLink">
|
||||
Record Attendance <i class="fa fa-arrow-circle-right"></i>
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
@@ -4,7 +4,7 @@
|
||||
"order":"2",
|
||||
"icon":"fa-clock-o",
|
||||
"user_levels":["Admin","Manager","Employee"],
|
||||
|
||||
"dashboardPosition":102,
|
||||
"permissions":
|
||||
{
|
||||
}
|
||||
|
||||
@@ -21,49 +21,82 @@ Original work Copyright (c) 2012 [Gamonoid Media Pvt. Ltd]
|
||||
Developer: Thilina Hasantha (thilina.hasantha[at]gmail.com / facebook.com/thilinah)
|
||||
*/
|
||||
|
||||
include (APP_BASE_PATH."modules/leaves/api/LeavesActionManager.php");
|
||||
|
||||
class DashboardActionManager extends SubActionManager{
|
||||
|
||||
public function getPendingLeaves($req){
|
||||
|
||||
return new IceResponse(IceResponse::SUCCESS,0);
|
||||
|
||||
}
|
||||
|
||||
public function getLastTimeSheetHours($req){
|
||||
$timeSheet = new EmployeeTimeSheet();
|
||||
$timeSheet->Load("employee = ? order by date_end desc limit 1",array($this->getCurrentProfileId()));
|
||||
|
||||
if(empty($timeSheet->employee)){
|
||||
return new IceResponse(IceResponse::SUCCESS,"0:00");
|
||||
}
|
||||
|
||||
$timeSheetEntry = new EmployeeTimeEntry();
|
||||
$list = $timeSheetEntry->Find("timesheet = ?",array($timeSheet->id));
|
||||
|
||||
$seconds = 0;
|
||||
foreach($list as $entry){
|
||||
$seconds += (strtotime($entry->date_end) - strtotime($entry->date_start));
|
||||
}
|
||||
|
||||
$minutes = (int)($seconds/60);
|
||||
$rem = $minutes % 60;
|
||||
$hours = ($minutes - $rem)/60;
|
||||
if($rem < 10){
|
||||
$rem ="0".$rem;
|
||||
}
|
||||
return new IceResponse(IceResponse::SUCCESS,$hours.":".$rem);
|
||||
|
||||
}
|
||||
|
||||
public function getEmployeeActiveProjects($req){
|
||||
$project = new EmployeeProject();
|
||||
$projects = $project->Find("employee = ? and status =?",array($this->getCurrentProfileId(),'Current'));
|
||||
|
||||
|
||||
return new IceResponse(IceResponse::SUCCESS,count($projects));
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
public function getPendingLeaves($req){
|
||||
|
||||
$lam = new LeavesActionManager();
|
||||
$leavePeriod = $lam->getCurrentLeavePeriod(date("Y-m-d H:i:s"), date("Y-m-d H:i:s"));
|
||||
|
||||
$leave = new EmployeeLeave();
|
||||
$pendingLeaves = $leave->Find("status = ? and employee = ?",array("Pending", $this->getCurrentProfileId()));
|
||||
|
||||
return new IceResponse(IceResponse::SUCCESS,count($pendingLeaves));
|
||||
|
||||
}
|
||||
|
||||
public function getInitData($req){
|
||||
$data = array();
|
||||
|
||||
$emp = new Employee();
|
||||
$data['numberOfEmployees'] = $emp->Count("status = 'Active' and supervisor = ?",array($this->getCurrentProfileId()));
|
||||
|
||||
$data['lastTimeSheetHours'] = $this->getLastTimeSheetHours($req)->getData();
|
||||
$data['activeProjects'] = $this->getEmployeeActiveProjects($req)->getData();
|
||||
$data['pendingLeaves'] = $this->getPendingLeaves($req)->getData();
|
||||
$candidate = new Candidate();
|
||||
$data['numberOfCandidates'] = $candidate->Count("1 = 1");
|
||||
|
||||
$job = new Job();
|
||||
$data['numberOfJobs'] = $job->Count("status = 'Active'");
|
||||
|
||||
|
||||
$attendance = new Attendance();
|
||||
$data['numberOfAttendanceLastWeek'] = $attendance->Count("in_time > '".date("Y-m-d H:i:s",strtotime("-1 week"))."'");
|
||||
|
||||
$course = new Course();
|
||||
$data['numberOfCourses'] = $course->Count("1 = 1");
|
||||
|
||||
return new IceResponse(IceResponse::SUCCESS,$data);
|
||||
|
||||
}
|
||||
|
||||
public function getLastTimeSheetHours($req){
|
||||
$timeSheet = new EmployeeTimeSheet();
|
||||
$timeSheet->Load("employee = ? order by date_end desc limit 1",array($this->getCurrentProfileId()));
|
||||
|
||||
if(empty($timeSheet->employee)){
|
||||
return new IceResponse(IceResponse::SUCCESS,"0:00");
|
||||
}
|
||||
|
||||
$timeSheetEntry = new EmployeeTimeEntry();
|
||||
$list = $timeSheetEntry->Find("timesheet = ?",array($timeSheet->id));
|
||||
|
||||
$seconds = 0;
|
||||
foreach($list as $entry){
|
||||
$seconds += (strtotime($entry->date_end) - strtotime($entry->date_start));
|
||||
}
|
||||
|
||||
$minutes = (int)($seconds/60);
|
||||
$rem = $minutes % 60;
|
||||
$hours = ($minutes - $rem)/60;
|
||||
if($rem < 10){
|
||||
$rem ="0".$rem;
|
||||
}
|
||||
return new IceResponse(IceResponse::SUCCESS,$hours.":".$rem);
|
||||
|
||||
}
|
||||
|
||||
public function getEmployeeActiveProjects($req){
|
||||
$project = new EmployeeProject();
|
||||
$projects = $project->Find("employee = ? and status =?",array($this->getCurrentProfileId(),'Current'));
|
||||
|
||||
|
||||
return new IceResponse(IceResponse::SUCCESS,count($projects));
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -26,166 +26,41 @@ define('MODULE_PATH',dirname(__FILE__));
|
||||
include APP_BASE_PATH.'header.php';
|
||||
include APP_BASE_PATH.'modulejslibs.inc.php';
|
||||
?><div class="span9">
|
||||
|
||||
<div class="row">
|
||||
<div class="col-lg-3 col-xs-12">
|
||||
<!-- small box -->
|
||||
<div class="small-box bg-aqua">
|
||||
<div class="inner">
|
||||
<h3 id="lastPunchTime">
|
||||
..
|
||||
</h3>
|
||||
<p id="punchTimeText">
|
||||
Waiting for Response..
|
||||
</p>
|
||||
</div>
|
||||
<div class="icon">
|
||||
<i class="ion ion-ios7-alarm-outline"></i>
|
||||
</div>
|
||||
<a href="#" class="small-box-footer" id="atteandanceLink">
|
||||
Record Attendance <i class="fa fa-arrow-circle-right"></i>
|
||||
</a>
|
||||
</div>
|
||||
</div><!-- ./col -->
|
||||
<div class="col-lg-3 col-xs-12">
|
||||
<!-- small box -->
|
||||
<div class="small-box bg-yellow">
|
||||
<div class="inner">
|
||||
<h3 id="timeSheetHoursWorked">..</h3>
|
||||
<p>
|
||||
Hours worked Last Week
|
||||
</p>
|
||||
</div>
|
||||
<div class="icon">
|
||||
<i class="ion ion-clock"></i>
|
||||
</div>
|
||||
<a href="#" class="small-box-footer" id="timesheetLink">
|
||||
Update Time Sheet <i class="fa fa-arrow-circle-right"></i>
|
||||
</a>
|
||||
</div>
|
||||
</div><!-- ./col -->
|
||||
<div class="col-lg-3 col-xs-12">
|
||||
<!-- small box -->
|
||||
<div class="small-box bg-red">
|
||||
<div class="inner">
|
||||
<h3 id="numberOfProjects">..</h3>
|
||||
<p>
|
||||
Active Projects
|
||||
</p>
|
||||
</div>
|
||||
<div class="icon">
|
||||
<i class="ion ion-pie-graph"></i>
|
||||
</div>
|
||||
<a href="#" class="small-box-footer" id="projectsLink">
|
||||
More info <i class="fa fa-arrow-circle-right"></i>
|
||||
</a>
|
||||
</div>
|
||||
</div><!-- ./col -->
|
||||
|
||||
<div class="col-lg-3 col-xs-12">
|
||||
<!-- small box -->
|
||||
<div class="small-box bg-teal">
|
||||
<div class="inner">
|
||||
<h3>
|
||||
My Travel
|
||||
</h3>
|
||||
<p>
|
||||
Requests
|
||||
</p>
|
||||
</div>
|
||||
<div class="icon">
|
||||
<i class="ion ion-plane"></i>
|
||||
</div>
|
||||
<a href="#" class="small-box-footer" id="travelLink">
|
||||
Travel Requests <i class="fa fa-arrow-circle-right"></i>
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="col-lg-3 col-xs-12">
|
||||
<!-- small box -->
|
||||
<div class="small-box bg-yellow">
|
||||
<div class="inner">
|
||||
<h3>
|
||||
Help
|
||||
</h3>
|
||||
<p>
|
||||
User Guide
|
||||
</p>
|
||||
</div>
|
||||
<div class="icon">
|
||||
<i class="ion ion-help"></i>
|
||||
</div>
|
||||
<a href="http://blog.icehrm.com/docs/home/" target="_blank" class="small-box-footer" id="icehrmHelpLink">
|
||||
Documentation <i class="fa fa-arrow-circle-right"></i>
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<?php if($user->user_level == "Manager" || $user->user_level == "Admin"){?>
|
||||
|
||||
<div class="col-lg-3 col-xs-12">
|
||||
<!-- small box -->
|
||||
<div class="small-box bg-yellow">
|
||||
<div class="inner">
|
||||
<h3>
|
||||
Travel
|
||||
</h3>
|
||||
<p id="numberOfTravel">
|
||||
Management
|
||||
</p>
|
||||
</div>
|
||||
<div class="icon">
|
||||
<i class="ion ion-plane"></i>
|
||||
</div>
|
||||
<a href="#" class="small-box-footer" id="traveAdminlLink">
|
||||
Manage Travel <i class="fa fa-arrow-circle-right"></i>
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
|
||||
|
||||
<div class="col-lg-3 col-xs-12">
|
||||
<!-- small box -->
|
||||
<div class="small-box bg-red">
|
||||
<div class="inner">
|
||||
<h3>
|
||||
Attendance
|
||||
</h3>
|
||||
<p id="numberOfDocuments">
|
||||
Monitor
|
||||
</p>
|
||||
</div>
|
||||
<div class="icon">
|
||||
<i class="ion ion-ios7-timer"></i>
|
||||
</div>
|
||||
<a href="#" class="small-box-footer" id="attendanceAdminLink">
|
||||
View Attendance <i class="fa fa-arrow-circle-right"></i>
|
||||
</a>
|
||||
</div>
|
||||
</div><!-- ./col -->
|
||||
|
||||
<div class="col-lg-3 col-xs-12">
|
||||
<!-- small box -->
|
||||
<div class="small-box bg-teal">
|
||||
<div class="inner">
|
||||
<h3>Reports</h3>
|
||||
<p>
|
||||
View / Download Reports
|
||||
</p>
|
||||
</div>
|
||||
<div class="icon">
|
||||
<i class="ion ion-document-text"></i>
|
||||
</div>
|
||||
<a href="#" class="small-box-footer" id="reportsLink">
|
||||
Create a Report <i class="fa fa-arrow-circle-right"></i>
|
||||
</a>
|
||||
</div>
|
||||
</div><!-- ./col -->
|
||||
|
||||
|
||||
<?php }?>
|
||||
</div>
|
||||
<?php
|
||||
$moduleManagers = BaseService::getInstance()->getModuleManagers();
|
||||
$dashBoardList = array();
|
||||
foreach($moduleManagers as $moduleManagerObj){
|
||||
|
||||
$allowed = BaseService::getInstance()->isModuleAllowedForUser($moduleManagerObj);
|
||||
|
||||
if(!$allowed){
|
||||
continue;
|
||||
}
|
||||
|
||||
$item = $moduleManagerObj->getDashboardItem();
|
||||
if(!empty($item)) {
|
||||
$index = $moduleManagerObj->getDashboardItemIndex();
|
||||
$dashBoardList[$index] = $item;
|
||||
}
|
||||
}
|
||||
|
||||
ksort($dashBoardList);
|
||||
|
||||
foreach($dashBoardList as $k=>$v){
|
||||
echo $v;
|
||||
}
|
||||
?>
|
||||
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<script>
|
||||
@@ -194,22 +69,30 @@ var modJsList = new Array();
|
||||
modJsList['tabDashboard'] = new DashboardAdapter('Dashboard','Dashboard');
|
||||
|
||||
var modJs = modJsList['tabDashboard'];
|
||||
/*
|
||||
$("#employeeLink").attr("href",modJs.getCustomUrl('?g=admin&n=employees&m=admin_Admin'));
|
||||
$("#jobsLink").attr("href",modJs.getCustomUrl('?g=admin&n=jobpositions&m=admin_Recruitment'));
|
||||
$("#candidatesLink").attr("href",modJs.getCustomUrl('?g=admin&n=candidates&m=admin_Recruitment'));
|
||||
$("#projectAdminLink").attr("href",modJs.getCustomUrl('?g=admin&n=projects&m=admin_Admin'));
|
||||
$("#trainingLink").attr("href",modJs.getCustomUrl('?g=admin&n=training&m=admin_Admin'));
|
||||
$("#travelLink").attr("href",modJs.getCustomUrl('?g=admin&n=travel&m=admin_Employees'));
|
||||
$("#documentLink").attr("href",modJs.getCustomUrl('?g=admin&n=documents&m=admin_Employees'));
|
||||
$("#expenseLink").attr("href",modJs.getCustomUrl('?g=admin&n=expenses&m=admin_Employees'));
|
||||
|
||||
|
||||
|
||||
$("#myProfileLink").attr("href",modJs.getCustomUrl('?g=modules&n=employees&m=module_Personal_Information'));
|
||||
$("#atteandanceLink").attr("href",modJs.getCustomUrl('?g=modules&n=attendance&m=module_Time_Management'));
|
||||
$("#attendanceAdminLink").attr("href",modJs.getCustomUrl('?g=admin&n=attendance&m=admin_Admin'));
|
||||
$("#leavesLink").attr("href",modJs.getCustomUrl('?g=modules&n=leaves&m=module_Leaves'));
|
||||
$("#timesheetLink").attr("href",modJs.getCustomUrl('?g=modules&n=time_sheets&m=module_Time_Management'));
|
||||
$("#projectsLink").attr("href",modJs.getCustomUrl('?g=modules&n=projects&m=module_Time_Management'));
|
||||
$("#traveAdminlLink").attr("href",modJs.getCustomUrl('?g=admin&n=travel&m=admin_Employees'));
|
||||
$("#travelLink").attr("href",modJs.getCustomUrl('?g=modules&n=travel&m=module_Travel_Management'));
|
||||
$("#reportsLink").attr("href",modJs.getCustomUrl('?g=admin&n=reports&m=admin_Reports'));
|
||||
|
||||
|
||||
$("#projectsLink").attr("href",modJs.getCustomUrl('?g=modules&n=projects&m=module_Personal_Information'));
|
||||
$("#myDocumentsLink").attr("href",modJs.getCustomUrl('?g=modules&n=documents&m=module_Documents'));
|
||||
$("#mytravelLink").attr("href",modJs.getCustomUrl('?g=modules&n=travel&m=module_Travel_Management'));
|
||||
$("#myExpensesLink").attr("href",modJs.getCustomUrl('?g=modules&n=expenses&m=module_Finance'));
|
||||
|
||||
modJs.getPunch();
|
||||
modJs.getPendingLeaves();
|
||||
modJs.getLastTimeSheetHours();
|
||||
modJs.getEmployeeActiveProjects();
|
||||
modJs.getInitData();
|
||||
*/
|
||||
|
||||
</script>
|
||||
<?php include APP_BASE_PATH.'footer.php';?>
|
||||
@@ -1,27 +1,27 @@
|
||||
/*
|
||||
This file is part of iCE Hrm.
|
||||
This file is part of iCE Hrm.
|
||||
|
||||
iCE Hrm is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
iCE Hrm is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
iCE Hrm is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
iCE Hrm is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with iCE Hrm. If not, see <http://www.gnu.org/licenses/>.
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with iCE Hrm. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
------------------------------------------------------------------
|
||||
------------------------------------------------------------------
|
||||
|
||||
Original work Copyright (c) 2012 [Gamonoid Media Pvt. Ltd]
|
||||
Developer: Thilina Hasantha (thilina.hasantha[at]gmail.com / facebook.com/thilinah)
|
||||
Original work Copyright (c) 2012 [Gamonoid Media Pvt. Ltd]
|
||||
Developer: Thilina Hasantha (thilina.hasantha[at]gmail.com / facebook.com/thilinah)
|
||||
*/
|
||||
|
||||
function DashboardAdapter(endPoint) {
|
||||
this.initAdapter(endPoint);
|
||||
this.initAdapter(endPoint);
|
||||
}
|
||||
|
||||
DashboardAdapter.inherits(AdapterBase);
|
||||
@@ -29,15 +29,15 @@ DashboardAdapter.inherits(AdapterBase);
|
||||
|
||||
|
||||
DashboardAdapter.method('getDataMapping', function() {
|
||||
return [];
|
||||
return [];
|
||||
});
|
||||
|
||||
DashboardAdapter.method('getHeaders', function() {
|
||||
return [];
|
||||
return [];
|
||||
});
|
||||
|
||||
DashboardAdapter.method('getFormFields', function() {
|
||||
return [];
|
||||
return [];
|
||||
});
|
||||
|
||||
|
||||
@@ -46,128 +46,85 @@ DashboardAdapter.method('get', function(callBackData) {
|
||||
|
||||
|
||||
DashboardAdapter.method('getPunch', function() {
|
||||
var that = this;
|
||||
var object = {};
|
||||
|
||||
object['date'] = this.getClientDate(new Date()).toISOString().slice(0, 19).replace('T', ' ');
|
||||
object['offset'] = this.getClientGMTOffset();
|
||||
var reqJson = JSON.stringify(object);
|
||||
var callBackData = [];
|
||||
callBackData['callBackData'] = [];
|
||||
callBackData['callBackSuccess'] = 'getPunchSuccessCallBack';
|
||||
callBackData['callBackFail'] = 'getPunchFailCallBack';
|
||||
|
||||
this.customAction('getPunch','modules=attendance',reqJson,callBackData);
|
||||
var that = this;
|
||||
var object = {};
|
||||
|
||||
object['date'] = this.getClientDate(new Date()).toISOString().slice(0, 19).replace('T', ' ');
|
||||
object['offset'] = this.getClientGMTOffset();
|
||||
var reqJson = JSON.stringify(object);
|
||||
var callBackData = [];
|
||||
callBackData['callBackData'] = [];
|
||||
callBackData['callBackSuccess'] = 'getPunchSuccessCallBack';
|
||||
callBackData['callBackFail'] = 'getPunchFailCallBack';
|
||||
|
||||
this.customAction('getPunch','modules=attendance',reqJson,callBackData);
|
||||
});
|
||||
|
||||
|
||||
|
||||
DashboardAdapter.method('getPunchSuccessCallBack', function(callBackData) {
|
||||
var punch = callBackData;
|
||||
if(punch == null){
|
||||
$("#lastPunchTime").html("Not");
|
||||
$("#punchTimeText").html("Punched In");
|
||||
}else{
|
||||
$("#lastPunchTime").html(Date.parse(punch.in_time).toString('h:mm tt'));
|
||||
$("#punchTimeText").html("Punched In");
|
||||
}
|
||||
var punch = callBackData;
|
||||
if(punch == null){
|
||||
$("#lastPunchTime").html("Not");
|
||||
$("#punchTimeText").html("Punched In");
|
||||
}else{
|
||||
$("#lastPunchTime").html(Date.parse(punch.in_time).toString('h:mm tt'));
|
||||
$("#punchTimeText").html("Punched In");
|
||||
}
|
||||
});
|
||||
|
||||
DashboardAdapter.method('getPunchFailCallBack', function(callBackData) {
|
||||
|
||||
|
||||
});
|
||||
|
||||
DashboardAdapter.method('getInitData', function() {
|
||||
var that = this;
|
||||
var object = {};
|
||||
var reqJson = JSON.stringify(object);
|
||||
var callBackData = [];
|
||||
callBackData['callBackData'] = [];
|
||||
callBackData['callBackSuccess'] = 'getInitDataSuccessCallBack';
|
||||
callBackData['callBackFail'] = 'getInitDataFailCallBack';
|
||||
|
||||
DashboardAdapter.method('getPendingLeaves', function() {
|
||||
var that = this;
|
||||
var object = {};
|
||||
|
||||
var reqJson = JSON.stringify(object);
|
||||
var callBackData = [];
|
||||
callBackData['callBackData'] = [];
|
||||
callBackData['callBackSuccess'] = 'getPendingLeavesSuccessCallBack';
|
||||
callBackData['callBackFail'] = 'getPendingLeavesFailCallBack';
|
||||
|
||||
this.customAction('getPendingLeaves','modules=dashboard',reqJson,callBackData);
|
||||
this.customAction('getInitData','modules=dashboard',reqJson,callBackData);
|
||||
});
|
||||
|
||||
|
||||
|
||||
DashboardAdapter.method('getPendingLeavesSuccessCallBack', function(callBackData) {
|
||||
var leaveCount = callBackData;
|
||||
$("#pendingLeaveCount").html(leaveCount);
|
||||
DashboardAdapter.method('getInitDataSuccessCallBack', function(data) {
|
||||
|
||||
$("#timeSheetHoursWorked").html(data['lastTimeSheetHours']);
|
||||
$("#numberOfProjects").html(data['activeProjects']);
|
||||
$("#pendingLeaveCount").html(data['pendingLeaves']);
|
||||
|
||||
$("#numberOfEmployees").html(data['numberOfEmployees']+" Subordinates");
|
||||
$("#numberOfCandidates").html(data['numberOfCandidates']+" Candidates");
|
||||
$("#numberOfJobs").html(data['numberOfJobs']+" Active");
|
||||
$("#numberOfCourses").html(data['numberOfCourses']+" Active");
|
||||
|
||||
});
|
||||
|
||||
DashboardAdapter.method('getPendingLeavesFailCallBack', function(callBackData) {
|
||||
|
||||
DashboardAdapter.method('getInitDataFailCallBack', function(callBackData) {
|
||||
|
||||
});
|
||||
|
||||
DashboardAdapter.method('getLastTimeSheetHours', function() {
|
||||
var that = this;
|
||||
var object = {};
|
||||
|
||||
var reqJson = JSON.stringify(object);
|
||||
var callBackData = [];
|
||||
callBackData['callBackData'] = [];
|
||||
callBackData['callBackSuccess'] = 'getLastTimeSheetHoursSuccessCallBack';
|
||||
callBackData['callBackFail'] = 'getLastTimeSheetHoursFailCallBack';
|
||||
|
||||
this.customAction('getLastTimeSheetHours','modules=dashboard',reqJson,callBackData);
|
||||
});
|
||||
|
||||
|
||||
|
||||
DashboardAdapter.method('getLastTimeSheetHoursSuccessCallBack', function(callBackData) {
|
||||
var hours = callBackData;
|
||||
$("#timeSheetHoursWorked").html(hours);
|
||||
});
|
||||
|
||||
DashboardAdapter.method('getLastTimeSheetHoursFailCallBack', function(callBackData) {
|
||||
|
||||
});
|
||||
|
||||
|
||||
|
||||
DashboardAdapter.method('getEmployeeActiveProjects', function() {
|
||||
var that = this;
|
||||
var object = {};
|
||||
|
||||
var reqJson = JSON.stringify(object);
|
||||
var callBackData = [];
|
||||
callBackData['callBackData'] = [];
|
||||
callBackData['callBackSuccess'] = 'getEmployeeActiveProjectsSuccessCallBack';
|
||||
callBackData['callBackFail'] = 'getEmployeeActiveProjectsFailCallBack';
|
||||
|
||||
this.customAction('getEmployeeActiveProjects','modules=dashboard',reqJson,callBackData);
|
||||
});
|
||||
|
||||
|
||||
|
||||
DashboardAdapter.method('getEmployeeActiveProjectsSuccessCallBack', function(callBackData) {
|
||||
var hours = callBackData;
|
||||
$("#numberOfProjects").html(hours);
|
||||
});
|
||||
|
||||
DashboardAdapter.method('getEmployeeActiveProjectsFailCallBack', function(callBackData) {
|
||||
|
||||
});
|
||||
|
||||
DashboardAdapter.method('getClientDate', function (date) {
|
||||
|
||||
var offset = this.getClientGMTOffset();
|
||||
var offset = this.getClientGMTOffset();
|
||||
var tzDate = date.addMinutes(offset*60);
|
||||
return tzDate;
|
||||
|
||||
});
|
||||
|
||||
DashboardAdapter.method('getClientGMTOffset', function () {
|
||||
|
||||
var rightNow = new Date();
|
||||
var jan1 = new Date(rightNow.getFullYear(), 0, 1, 0, 0, 0, 0);
|
||||
var temp = jan1.toGMTString();
|
||||
var jan2 = new Date(temp.substring(0, temp.lastIndexOf(" ")-1));
|
||||
var std_time_offset = (jan1 - jan2) / (1000 * 60 * 60);
|
||||
|
||||
return std_time_offset;
|
||||
|
||||
|
||||
var rightNow = new Date();
|
||||
var jan1 = new Date(rightNow.getFullYear(), 0, 1, 0, 0, 0, 0);
|
||||
var temp = jan1.toGMTString();
|
||||
var jan2 = new Date(temp.substring(0, temp.lastIndexOf(" ")-1));
|
||||
var std_time_offset = (jan1 - jan2) / (1000 * 60 * 60);
|
||||
|
||||
return std_time_offset;
|
||||
|
||||
});
|
||||
|
||||
15
ext/modules/projects/dashboard.html
Normal file
15
ext/modules/projects/dashboard.html
Normal file
@@ -0,0 +1,15 @@
|
||||
<div class="col-lg-3 col-xs-12">
|
||||
<!-- small box -->
|
||||
<div class="small-box bg-red">
|
||||
<div class="inner">
|
||||
<h3>My Projects</h3>
|
||||
<p>Projects Assigned</p>
|
||||
</div>
|
||||
<div class="icon">
|
||||
<i class="ion ion-pie-graph"></i>
|
||||
</div>
|
||||
<a href="#_moduleLink_#" class="small-box-footer" id="projectsLink">
|
||||
More info <i class="fa fa-arrow-circle-right"></i>
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
@@ -4,7 +4,7 @@
|
||||
"order":"1",
|
||||
"icon":"fa-pencil-square",
|
||||
"user_levels":["Admin","Manager","Employee"],
|
||||
|
||||
"dashboardPosition":105,
|
||||
"permissions":
|
||||
{
|
||||
"Manager":{
|
||||
|
||||
@@ -64,6 +64,13 @@ class Time_sheetsActionManager extends SubActionManager{
|
||||
|
||||
$oldStatus = $timeSheet->status;
|
||||
$timeSheet->status = $req->status;
|
||||
|
||||
|
||||
//Auto approve admin timesheets
|
||||
if($req->status == 'Submitted' && BaseService::getInstance()->getCurrentUser()->user_level == "Admin"){
|
||||
$timeSheet->status = 'Approved';
|
||||
}
|
||||
|
||||
|
||||
if($oldStatus == $req->status){
|
||||
return new IceResponse(IceResponse::SUCCESS,"");
|
||||
|
||||
@@ -23,6 +23,39 @@ if (!class_exists('Time_sheetsModulesManager')) {
|
||||
|
||||
}
|
||||
|
||||
public function getDashboardItemData(){
|
||||
$data = array();
|
||||
$data['timeSheetHoursWorked'] = $this->getLastTimeSheetHours()->getData();
|
||||
return $data;
|
||||
|
||||
}
|
||||
|
||||
private function getLastTimeSheetHours(){
|
||||
$timeSheet = new EmployeeTimeSheet();
|
||||
$timeSheet->Load("employee = ? order by date_end desc limit 1",array(BaseService::getInstance()->getCurrentProfileId()));
|
||||
|
||||
if(empty($timeSheet->employee)){
|
||||
return new IceResponse(IceResponse::SUCCESS,"0:00");
|
||||
}
|
||||
|
||||
$timeSheetEntry = new EmployeeTimeEntry();
|
||||
$list = $timeSheetEntry->Find("timesheet = ?",array($timeSheet->id));
|
||||
|
||||
$seconds = 0;
|
||||
foreach($list as $entry){
|
||||
$seconds += (strtotime($entry->date_end) - strtotime($entry->date_start));
|
||||
}
|
||||
|
||||
$minutes = (int)($seconds/60);
|
||||
$rem = $minutes % 60;
|
||||
$hours = ($minutes - $rem)/60;
|
||||
if($rem < 10){
|
||||
$rem ="0".$rem;
|
||||
}
|
||||
return new IceResponse(IceResponse::SUCCESS,$hours.":".$rem);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -46,6 +79,41 @@ if (!class_exists('EmployeeTimeSheet')) {
|
||||
public function getUserOnlyMeAccess(){
|
||||
return array("element","save","delete");
|
||||
}
|
||||
|
||||
public function getTotalTime()
|
||||
{
|
||||
|
||||
$start = $this->date_start . " 00:00:00";
|
||||
$end = $this->date_end . " 23:59:59";
|
||||
|
||||
$timeEntry = new EmployeeTimeEntry();
|
||||
$list = $timeEntry->Find("employee = ? and ((date_start >= ? and date_start <= ?) or (date_end >= ? and date_end <= ?))", array($this->employee, $start, $end, $start, $end));
|
||||
|
||||
|
||||
$seconds = 0;
|
||||
|
||||
foreach ($list as $entry) {
|
||||
|
||||
$secondsTemp = (strtotime($entry->date_end) - strtotime($entry->date_start));
|
||||
if ($secondsTemp < 0) {
|
||||
$secondsTemp = 0;
|
||||
}
|
||||
|
||||
|
||||
$seconds += $secondsTemp;
|
||||
}
|
||||
|
||||
$totMinutes = round($seconds / 60);
|
||||
$minutes = $totMinutes % 60;
|
||||
$hours = ($totMinutes - $minutes) / 60;
|
||||
|
||||
return CalendarTools::addLeadingZero($hours) . ":" . CalendarTools::addLeadingZero($minutes);
|
||||
}
|
||||
|
||||
public function postProcessGetData($entry){
|
||||
$entry->total_time = $this->getTotalTime();
|
||||
return $entry;
|
||||
}
|
||||
}
|
||||
|
||||
class EmployeeTimeEntry extends ICEHRM_Record {
|
||||
|
||||
17
ext/modules/time_sheets/dashboard.html
Normal file
17
ext/modules/time_sheets/dashboard.html
Normal file
@@ -0,0 +1,17 @@
|
||||
<div class="col-lg-3 col-xs-12">
|
||||
<!-- small box -->
|
||||
<div class="small-box bg-yellow">
|
||||
<div class="inner">
|
||||
<h3>#_timeSheetHoursWorked_#</h3>
|
||||
<p>
|
||||
Hours worked Last Week
|
||||
</p>
|
||||
</div>
|
||||
<div class="icon">
|
||||
<i class="ion ion-clock"></i>
|
||||
</div>
|
||||
<a href="#_moduleLink_#" class="small-box-footer" id="timesheetLink">
|
||||
Update Time Sheet <i class="fa fa-arrow-circle-right"></i>
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
@@ -34,6 +34,7 @@ EmployeeTimeSheetAdapter.method('getDataMapping', function() {
|
||||
"id",
|
||||
"date_start",
|
||||
"date_end",
|
||||
"total_time",
|
||||
"status"
|
||||
];
|
||||
});
|
||||
@@ -43,6 +44,7 @@ EmployeeTimeSheetAdapter.method('getHeaders', function() {
|
||||
{ "sTitle": "ID" ,"bVisible":false},
|
||||
{ "sTitle": "Start Date"},
|
||||
{ "sTitle": "End Date"},
|
||||
{ "sTitle": "Total Time"},
|
||||
{ "sTitle": "Status"}
|
||||
];
|
||||
});
|
||||
@@ -533,14 +535,16 @@ EmployeeTimeEntryAdapter.method('renderForm', function(object) {
|
||||
|
||||
//append dates
|
||||
|
||||
var dateStart = new Date(this.currentTimesheet.date_start.replace(" ","T"));
|
||||
var dateStop = new Date(this.currentTimesheet.date_end.replace(" ","T"));
|
||||
var dateStart = new Date(this.currentTimesheet.date_start);
|
||||
var dateStop = new Date(this.currentTimesheet.date_end);
|
||||
|
||||
var datesArray = this.getDates(dateStart, dateStop);
|
||||
|
||||
var optionList = "";
|
||||
for(var i=0; i<datesArray.length; i++){
|
||||
optionList += '<option value="'+datesArray[i].toString("yyyy-MM-dd")+'">'+datesArray[i].toString("d-MMM-yyyy")+'</option>';
|
||||
var k = datesArray[i];
|
||||
//optionList += '<option value="'+datesArray[i].toString("yyyy-MM-dd")+'">'+datesArray[i].toString("d-MMM-yyyy")+'</option>';
|
||||
optionList += '<option value="'+k.getUTCFullYear()+"-"+(k.getUTCMonth()+1)+"-"+k.getUTCDate()+'">'+k.toUTCString().slice(0, -13)+'</option>';
|
||||
}
|
||||
|
||||
|
||||
@@ -665,8 +669,8 @@ EmployeeTimeEntryAdapter.method('save', function() {
|
||||
});
|
||||
|
||||
EmployeeTimeEntryAdapter.method('doCustomValidation', function(params) {
|
||||
var st = Date.parse(params.date_start.replace(" ","T"));
|
||||
var et = Date.parse(params.date_end.replace(" ","T"));
|
||||
var st = Date.parse(params.date_start);
|
||||
var et = Date.parse(params.date_end);
|
||||
if(st.compareTo(et) != -1){
|
||||
return "Start time should be less than End time";
|
||||
}
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
"order":"3",
|
||||
"icon":"fa-check-circle-o",
|
||||
"user_levels":["Admin","Manager","Employee"],
|
||||
"dashboardPosition":104,
|
||||
|
||||
"permissions":
|
||||
{
|
||||
|
||||
17
ext/modules/travel/dashboard.html
Normal file
17
ext/modules/travel/dashboard.html
Normal file
@@ -0,0 +1,17 @@
|
||||
<div class="col-lg-3 col-xs-12">
|
||||
<!-- small box -->
|
||||
<div class="small-box bg-aqua">
|
||||
<div class="inner">
|
||||
<h3>My Travel</h3>
|
||||
<p>
|
||||
Management
|
||||
</p>
|
||||
</div>
|
||||
<div class="icon">
|
||||
<i class="ion ion-plane"></i>
|
||||
</div>
|
||||
<a href="#_moduleLink_#" class="small-box-footer" id="mytravelLink">
|
||||
Travel Management <i class="fa fa-arrow-circle-right"></i>
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
@@ -4,7 +4,7 @@
|
||||
"order":"1",
|
||||
"icon":"fa-plane",
|
||||
"user_levels":["Admin","Manager","Employee"],
|
||||
|
||||
"dashboardPosition":107,
|
||||
"permissions":
|
||||
{
|
||||
"Manager":{
|
||||
|
||||
Reference in New Issue
Block a user