Refactoring

This commit is contained in:
gamonoid
2017-09-03 20:39:22 +02:00
parent af40881847
commit a7274d3cfd
5075 changed files with 238202 additions and 16291 deletions

View 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">
<t>Punch In</t>
</h3>
<p><t>or</t> <t>Punch Out</t></p>
</div>
<div class="icon">
<i class="ion ion-ios7-alarm-outline"></i>
</div>
<a href="#_moduleLink_#" class="small-box-footer" id="atteandanceLink">
<t>Record Attendance</t> <i class="fa fa-arrow-circle-right"></i>
</a>
</div>
</div>

View File

@@ -0,0 +1,79 @@
<?php
/*
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 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/>.
------------------------------------------------------------------
Original work Copyright (c) 2012 [Gamonoid Media Pvt. Ltd]
Developer: Thilina Hasantha (thilina.hasantha[at]gmail.com / facebook.com/thilinah)
*/
$moduleName = 'attendance';
define('MODULE_PATH',dirname(__FILE__));
include APP_BASE_PATH.'header.php';
include APP_BASE_PATH.'modulejslibs.inc.php';
$useServerTime = \Classes\SettingsManager::getInstance()->getSetting('Attendance: Use Department Time Zone');
$photoAttendance = \Classes\SettingsManager::getInstance()->getSetting('Attendance: Photo Attendance');
$currentEmployeeTimeZone = \Classes\BaseService::getInstance()->getCurrentEmployeeTimeZone();
if(empty($currentEmployeeTimeZone)){
$useServerTime = 0;
}
?><div class="span9">
<ul class="nav nav-tabs" id="modTab" style="margin-bottom:0px;margin-left:5px;border-bottom: none;">
<li class="active"><a id="tabAttendance" href="#tabPageAttendance"><?=t('Attendance')?></a></li>
</ul>
<div class="tab-content">
<div class="tab-pane active" id="tabPageAttendance">
<div id="Attendance" class="reviewBlock" data-content="List" style="padding-left:5px;">
</div>
</div>
</div>
</div>
<style>
#Attendance .dataTables_filter label{
float:left;
}
</style>
<script>
var modJsList = [];
modJsList['tabAttendance'] = new AttendanceAdapter('Attendance','Attendance','','in_time desc');
modJsList['tabAttendance'].setUseServerTime(<?=$useServerTime?>);
modJsList['tabAttendance'].setPhotoAttendance(<?=$photoAttendance == '1'?>);
modJsList['tabAttendance'].setRemoteTable(true);
modJsList['tabAttendance'].updatePunchButton(true);
var modJs = modJsList['tabAttendance'];
</script>
<div class="modal" id="PunchModel" tabindex="-1" role="dialog" aria-labelledby="messageModelLabel" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true"><li class="fa fa-times"/></button>
<h3 style="font-size: 17px;">Punch Time</h3>
</div>
<div class="modal-body" style="max-height:530px;" id="AttendanceForm">
</div>
</div>
</div>
</div>
<?php include APP_BASE_PATH.'footer.php';?>

513
modules/attendance/lib.js Normal file
View File

@@ -0,0 +1,513 @@
/*
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 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/>.
------------------------------------------------------------------
Original work Copyright (c) 2012 [Gamonoid Media Pvt. Ltd]
Developer: Thilina Hasantha (thilina.hasantha[at]gmail.com / facebook.com/thilinah)
*/
function AttendanceAdapter(endPoint,tab,filter,orderBy) {
this.initAdapter(endPoint,tab,filter,orderBy);
this.punch = null;
this.useServerTime = 0;
this.photoTaken = 0;
this.photoAttendance = 0;
}
AttendanceAdapter.inherits(AdapterBase);
AttendanceAdapter.method('updatePunchButton', function() {
this.getPunch('changePunchButtonSuccessCallBack');
});
AttendanceAdapter.method('setUseServerTime', function(val) {
this.useServerTime = val;
});
AttendanceAdapter.method('setPhotoAttendance', function(val) {
this.photoAttendance = val;
});
AttendanceAdapter.method('getDataMapping', function() {
return [
"id",
"in_time",
"out_time",
"note"
];
});
AttendanceAdapter.method('getHeaders', function() {
return [
{ "sTitle": "ID" ,"bVisible":false},
{ "sTitle": "Time-In" },
{ "sTitle": "Time-Out"},
{ "sTitle": "Note"}
];
});
AttendanceAdapter.method('getFormFields', function() {
if(this.useServerTime == 0){
return [
[ "id", {"label":"ID","type":"hidden"}],
[ "time", {"label":"Time","type":"datetime"}],
[ "note", {"label":"Note","type":"textarea","validation":"none"}]
];
}else{
return [
[ "id", {"label":"ID","type":"hidden"}],
[ "note", {"label":"Note","type":"textarea","validation":"none"}]
];
}
});
AttendanceAdapter.method('getCustomTableParams', function() {
var that = this;
var dataTableParams = {
"aoColumnDefs": [
{
"fnRender": function(data, cell){
return that.preProcessRemoteTableData(data, cell, 1)
} ,
"aTargets": [1]
},
{
"fnRender": function(data, cell){
return that.preProcessRemoteTableData(data, cell, 2)
} ,
"aTargets": [2]
},
{
"fnRender": function(data, cell){
return that.preProcessRemoteTableData(data, cell, 3)
} ,
"aTargets": [3]
},
{
"fnRender": that.getActionButtons,
"aTargets": [that.getDataMapping().length]
}
]
};
return dataTableParams;
});
AttendanceAdapter.method('preProcessRemoteTableData', function(data, cell, id) {
if(id == 1){
if(cell == '0000-00-00 00:00:00' || cell == "" || cell == undefined || cell == null){
return "";
}
return Date.parse(cell).toString('yyyy MMM d <b>HH:mm</b>');
}else if(id == 2){
if(cell == '0000-00-00 00:00:00' || cell == "" || cell == undefined || cell == null){
return "";
}
return Date.parse(cell).toString('MMM d <b>HH:mm</b>');
}else if(id == 3){
if(cell != undefined && cell != null){
if(cell.length > 20){
return cell.substring(0,20)+"..";
}
}
return cell;
}
});
AttendanceAdapter.method('getActionButtonsHtml', function(id,data) {
/*
var html = '<div style="width:80px;"><img class="tableActionButton" src="_BASE_images/edit.png" style="cursor:pointer;" rel="tooltip" title="Edit" onclick="modJs.edit(_id_);return false;"></img><img class="tableActionButton" src="_BASE_images/download.png" style="margin-left:15px;cursor:pointer;" rel="tooltip" title="Download Document" onclick="download(\'_attachment_\');return false;"></img><img class="tableActionButton" src="_BASE_images/delete.png" style="margin-left:15px;cursor:pointer;" rel="tooltip" title="Delete" onclick="modJs.deleteRow(_id_);return false;"></img></div>';
html = html.replace(/_id_/g,id);
html = html.replace(/_attachment_/g,data[5]);
html = html.replace(/_BASE_/g,this.baseUrl);
return html;
*/
return "";
});
AttendanceAdapter.method('getTableTopButtonHtml', function() {
if(this.punch == null || this.punch == undefined){
return '<button id="punchButton" style="float:right;" onclick="modJs.showPunchDialog();return false;" class="btn btn-small">Punch-in <span class="icon-time"></span></button>';
}else{
return '<button id="punchButton" style="float:right;" onclick="modJs.showPunchDialog();return false;" class="btn btn-small">Punch-out <span class="icon-time"></span></button>';
}
});
AttendanceAdapter.method('save', function() {
var that = this;
var validator = new FormValidation(this.getTableName()+"_submit",true,{'ShowPopup':false,"LabelErrorClass":"error"});
if(validator.checkValues()){
var msg = this.doCustomValidation(params);
if(msg == null){
var params = validator.getFormParameters();
params = this.forceInjectValuesBeforeSave(params);
params['cdate'] = this.getClientDate(new Date()).toISOString().slice(0, 19).replace('T', ' ');
var reqJson = JSON.stringify(params);
var callBackData = [];
callBackData['callBackData'] = [];
callBackData['callBackSuccess'] = 'saveSuccessCallback';
callBackData['callBackFail'] = 'getPunchFailCallBack';
this.customAction('savePunch','modules=attendance',reqJson,callBackData, true);
}else{
$("#"+this.getTableName()+'Form .label').html(msg);
$("#"+this.getTableName()+'Form .label').show();
}
}
});
AttendanceAdapter.method('saveSuccessCallback', function(callBackData) {
this.punch = callBackData;
this.getPunch('changePunchButtonSuccessCallBack');
$('#PunchModel').modal('hide');
this.get([]);
});
AttendanceAdapter.method('cancel', function() {
$('#PunchModel').modal('hide');
});
AttendanceAdapter.method('showPunchDialog', function() {
this.getPunch('showPunchDialogShowPunchSuccessCallBack');
});
AttendanceAdapter.method('getPunch', function(successCallBack) {
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'] = successCallBack;
callBackData['callBackFail'] = 'getPunchFailCallBack';
this.customAction('getPunch','modules=attendance',reqJson,callBackData);
});
AttendanceAdapter.method('postRenderForm', function(object, $tempDomObj) {
$("#Attendance").show();
});
AttendanceAdapter.method('showPunchDialogShowPunchSuccessCallBack', function(callBackData) {
this.punch = callBackData;
$('#PunchModel').modal('show');
if(this.punch == null){
$('#PunchModel').find("h3").html("Punch Time-in");
modJs.renderForm();
}else{
$('#PunchModel').find("h3").html("Punch Time-out");
modJs.renderForm(this.punch);
}
$('#Attendance').show();
var picker = $('#time_datetime').data('datetimepicker');
picker.setLocalDate(new Date());
});
AttendanceAdapter.method('changePunchButtonSuccessCallBack', function(callBackData) {
this.punch = callBackData;
if(this.punch == null){
$("#punchButton").html('Punch-in <span class="icon-time"></span>');
}else{
$("#punchButton").html('Punch-out <span class="icon-time"></span>');
}
});
AttendanceAdapter.method('getPunchFailCallBack', function(callBackData) {
this.showMessage("Error Occured while Time Punch", callBackData);
});
AttendanceAdapter.method('getClientDate', function (date) {
var offset = this.getClientGMTOffset();
var tzDate = date.addMinutes(offset*60);
return tzDate;
});
AttendanceAdapter.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;
});
AttendanceAdapter.method('doCustomValidation', function(params) {
if (this.photoAttendance && !this.photoTaken) {
return "Please attach a photo before submitting";
}
return null;
});
AttendanceAdapter.method('forceInjectValuesBeforeSave', function(params) {
if (this.photoAttendance) {
var canvas = document.getElementById('attendnaceCanvas');
params.image = canvas.toDataURL();
}
return params;
});
AttendanceAdapter.method('postRenderForm', function() {
if (this.photoAttendance == '1') {
$('.photoAttendance').show();
var video = document.getElementById('attendnaceVideo');
// Get access to the camera!
if(navigator.mediaDevices && navigator.mediaDevices.getUserMedia) {
navigator.mediaDevices.getUserMedia({ video: true }).then(function(stream) {
video.src = window.URL.createObjectURL(stream);
video.play();
});
}
this.photoTaken = false;
this.configureEvents();
} else {
$('.photoAttendance').remove();
}
});
AttendanceAdapter.method('configureEvents', function() {
var that = this;
var canvas = document.getElementById('attendnaceCanvas');
var context = canvas.getContext('2d');
var video = document.getElementById('attendnaceVideo');
$('.attendnaceSnap').click(function() {
context.drawImage(video, 0, 0, 208, 156);
that.photoTaken = true;
return false;
});
});
function EmployeeAttendanceSheetAdapter(endPoint,tab,filter,orderBy) {
this.initAdapter(endPoint,tab,filter,orderBy);
}
EmployeeAttendanceSheetAdapter.inherits(AdapterBase);
this.currentTimesheetId = null;
this.currentTimesheet = null;
EmployeeAttendanceSheetAdapter.method('getDataMapping', function() {
return [
"id",
"date_start",
"date_end",
"total_time",
"status"
];
});
EmployeeAttendanceSheetAdapter.method('getHeaders', function() {
return [
{ "sTitle": "ID" ,"bVisible":false},
{ "sTitle": "Start Date"},
{ "sTitle": "End Date"},
{ "sTitle": "Total Time"},
{ "sTitle": "Status"}
];
});
EmployeeAttendanceSheetAdapter.method('getFormFields', function() {
return [
[ "id", {"label":"ID","type":"hidden"}],
[ "date_start", {"label":"TimeSheet Start Date","type":"date","validation":""}],
[ "date_end", {"label":"TimeSheet End Date","type":"date","validation":""}],
[ "details", {"label":"Reason","type":"textarea","validation":"none"}]
];
});
EmployeeAttendanceSheetAdapter.method('preProcessTableData', function(row) {
row[1] = Date.parse(row[1]).toString('MMM d, yyyy (dddd)');
row[2] = Date.parse(row[2]).toString('MMM d, yyyy (dddd)');
return row;
});
EmployeeAttendanceSheetAdapter.method('renderForm', function(object) {
var formHtml = this.templates['formTemplate'];
var html = "";
$("#"+this.getTableName()+'Form').html(formHtml);
$("#"+this.getTableName()+'Form').show();
$("#"+this.getTableName()).hide();
$('#attendnacesheet_start').html(Date.parse(object.date_start).toString('MMM d, yyyy (dddd)'));
$('#attendnacesheet_end').html(Date.parse(object.date_end).toString('MMM d, yyyy (dddd)'));
this.currentTimesheet = object;
this.getTimeEntries();
});
EmployeeAttendanceSheetAdapter.method('getTimeEntries', function() {
timesheetId = this.currentId;
var sourceMappingJson = JSON.stringify(modJsList['tabEmployeeTimeEntry'].getSourceMapping());
object = {"id":timesheetId,"sm":sourceMappingJson};
var reqJson = JSON.stringify(object);
var callBackData = [];
callBackData['callBackData'] = [];
callBackData['callBackSuccess'] = 'getTimeEntriesSuccessCallBack';
callBackData['callBackFail'] = 'getTimeEntriesFailCallBack';
this.customAction('getTimeEntries','modules=time_sheets',reqJson,callBackData);
});
EmployeeAttendanceSheetAdapter.method('getTimeEntriesSuccessCallBack', function(callBackData) {
var entries = callBackData;
var html = "";
var temp = '<tr><td><img class="tableActionButton" src="_BASE_images/delete.png" style="cursor:pointer;" rel="tooltip" title="Delete" onclick="modJsList[\'tabEmployeeTimeEntry\'].deleteRow(_id_);return false;"></img></td><td>_start_</td><td>_end_</td><td>_duration_</td><td>_project_</td><td>_details_</td>';
for(var i=0;i<entries.length;i++){
try{
var t = temp;
t = t.replace(/_start_/g,Date.parse(entries[i].date_start).toString('MMM d, yyyy [hh:mm tt]'));
t = t.replace(/_end_/g,Date.parse(entries[i].date_end).toString('MMM d, yyyy [hh:mm tt]'));
var mili = Date.parse(entries[i].date_end) - Date.parse(entries[i].date_start);
var minutes = Math.round(mili/60000);
var hourMinutes = (minutes % 60);
var hours = (minutes-hourMinutes)/60;
t = t.replace(/_duration_/g,"Hours ("+hours+") - Min ("+hourMinutes+")");
if(entries[i].project == 'null' || entries[i].project == null || entries[i].project == undefined){
t = t.replace(/_project_/g,"None");
}else{
t = t.replace(/_project_/g,entries[i].project);
}
t = t.replace(/_project_/g,entries[i].project);
t = t.replace(/_details_/g,entries[i].details);
t = t.replace(/_id_/g,entries[i].id);
t = t.replace(/_BASE_/g,this.baseUrl);
html += t;
}catch(e){}
}
$('.timesheet_entries_table_body').html(html);
if(modJs.getTableName() == 'SubEmployeeTimeSheetAll'){
$('#submit_sheet').hide();
$('#add_time_sheet_entry').hide();
}else{
if(this.currentElement.status == 'Approved'){
$('#submit_sheet').hide();
$('#add_time_sheet_entry').hide();
}else{
$('#submit_sheet').show();
$('#add_time_sheet_entry').show();
}
}
});
EmployeeAttendanceSheetAdapter.method('getTimeEntriesFailCallBack', function(callBackData) {
this.showMessage("Error", "Error occured while getting timesheet entries");
});
EmployeeAttendanceSheetAdapter.method('createPreviousAttendnacesheet', function(id) {
object = {"id":id};
var reqJson = JSON.stringify(object);
var callBackData = [];
callBackData['callBackData'] = [];
callBackData['callBackSuccess'] = 'createPreviousAttendnacesheetSuccessCallBack';
callBackData['callBackFail'] = 'createPreviousAttendnacesheetFailCallBack';
this.customAction('createPreviousAttendnaceSheet','modules=attendnace',reqJson,callBackData);
});
EmployeeAttendanceSheetAdapter.method('createPreviousAttendnacesheetSuccessCallBack', function(callBackData) {
$('.tooltip').css("display","none");
$('.tooltip').remove();
//this.showMessage("Success", "Previous Timesheet created");
this.get([]);
});
EmployeeAttendanceSheetAdapter.method('createPreviousAttendnacesheetFailCallBack', function(callBackData) {
this.showMessage("Error", callBackData);
});
EmployeeAttendanceSheetAdapter.method('getActionButtonsHtml', function(id,data) {
var html = '';
if(this.getTableName() == "EmployeeTimeSheetAll"){
html = '<div style="width:80px;"><img class="tableActionButton" src="_BASE_images/view.png" style="cursor:pointer;" rel="tooltip" title="Edit Timesheet Entries" onclick="modJs.edit(_id_);return false;"></img><img class="tableActionButton" src="_BASE_images/redo.png" style="cursor:pointer;margin-left:15px;" rel="tooltip" title="Create previous time sheet" onclick="modJs.createPreviousAttendnacesheet(_id_);return false;"></img></div>';
}else{
html = '<div style="width:80px;"><img class="tableActionButton" src="_BASE_images/view.png" style="cursor:pointer;" rel="tooltip" title="Edit Timesheet Entries" onclick="modJs.edit(_id_);return false;"></img></div>';
}
html = html.replace(/_id_/g,id);
html = html.replace(/_BASE_/g,this.baseUrl);
return html;
});
EmployeeAttendanceSheetAdapter.method('getCustomTableParams', function() {
var that = this;
var dataTableParams = {
"aoColumnDefs": [
{
"fnRender": function(data, cell){
return that.preProcessRemoteTableData(data, cell, 1)
} ,
"aTargets": [1]
},
{
"fnRender": function(data, cell){
return that.preProcessRemoteTableData(data, cell, 2)
} ,
"aTargets": [2]
},
{
"fnRender": that.getActionButtons,
"aTargets": [that.getDataMapping().length]
}
]
};
return dataTableParams;
});
EmployeeAttendanceSheetAdapter.method('preProcessRemoteTableData', function(data, cell, id) {
return Date.parse(cell).toString('MMM d, yyyy (dddd)');
});

View File

@@ -0,0 +1,15 @@
{
"label": "Attendance",
"menu": "Time Management",
"order": "2",
"icon": "fa-clock-o",
"user_levels": [
"Admin",
"Manager",
"Employee"
],
"dashboardPosition": 102,
"permissions": [],
"model_namespace": "\\Attendance\\Common\\Model",
"manager": "\\Attendance\\User\\Api\\AttendanceModulesManager"
}

View File

@@ -0,0 +1,31 @@
<form class="form-horizontal" id="_id_" role="form">
<div class="box-body">
<div class="control-group">
<div class="controls">
<span class="label label-warning" id="_id__error" style="display:none;"></span>
</div>
</div>
<div class="row photoAttendance" style="background: #f3f4f5; padding: 10px;">
<div class="col-sm-5">
<video id="attendnaceVideo" height="156" width="208" autoplay style="border: 1px #222 dotted;"></video>
</div>
<div class="col-sm-2">
<button style="margin-top:90px;" class="attendnaceSnap btn btn-primary pull-right"><i class="fa fa-camera"></i></button>
</div>
<div class="col-sm-5">
<canvas id="attendnaceCanvas" height="156" width="208" style="border: 1px #222 dotted;"></canvas>
</div>
</div>
_fields_
<div class="control-group row">
<div class="controls col-sm-9">
<button class="saveBtn btn btn-primary pull-right"><i class="fa fa-save"></i> <t>Save</t></button>
<button class="cancelBtn btn pull-right" style="margin-right:5px;"><i class="fa fa-times-circle-o"></i> <t>Cancel</t></button>
</div>
</div>
</div>
</form>

View File

@@ -0,0 +1,95 @@
<?php
/*
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 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/>.
------------------------------------------------------------------
Original work Copyright (c) 2012 [Gamonoid Media Pvt. Ltd]
Developer: Thilina Hasantha (thilina.hasantha[at]gmail.com / facebook.com/thilinah)
*/
$moduleName = 'dashboard';
define('MODULE_PATH',dirname(__FILE__));
include APP_BASE_PATH.'header.php';
include APP_BASE_PATH.'modulejslibs.inc.php';
?><div class="span9">
<div class="row">
<?php
$moduleManagers = \Classes\BaseService::getInstance()->getModuleManagers();
$dashBoardList = array();
foreach($moduleManagers as $moduleManagerObj){
$allowed = \Classes\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 \Classes\LanguageManager::translateTnrText($v);
}
?>
</div>
</div>
<script>
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'));
$("#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_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.getInitData();
*/
</script>
<?php include APP_BASE_PATH.'footer.php';?>

130
modules/dashboard/lib.js Normal file
View File

@@ -0,0 +1,130 @@
/*
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 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/>.
------------------------------------------------------------------
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);
}
DashboardAdapter.inherits(AdapterBase);
DashboardAdapter.method('getDataMapping', function() {
return [];
});
DashboardAdapter.method('getHeaders', function() {
return [];
});
DashboardAdapter.method('getFormFields', function() {
return [];
});
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);
});
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");
}
});
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';
this.customAction('getInitData','modules=dashboard',reqJson,callBackData);
});
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('getInitDataFailCallBack', function(callBackData) {
});
DashboardAdapter.method('getClientDate', function (date) {
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;
});

View File

@@ -0,0 +1,14 @@
{
"label": "Dashboard",
"menu": "Personal Information",
"order": "1",
"icon": "fa-desktop",
"user_levels": [
"Admin",
"Manager",
"Employee"
],
"permissions": [],
"model_namespace": "\\Dashboard\\Common\\Model",
"manager": "\\Dashboard\\User\\Api\\DashboardModulesManager"
}

View File

@@ -0,0 +1,63 @@
<?php
/*
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 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/>.
------------------------------------------------------------------
Original work Copyright (c) 2012 [Gamonoid Media Pvt. Ltd]
Developer: Thilina Hasantha (thilina.hasantha[at]gmail.com / facebook.com/thilinah)
*/
$moduleName = 'emergency_contact';
define('MODULE_PATH',dirname(__FILE__));
include APP_BASE_PATH.'header.php';
include APP_BASE_PATH.'modulejslibs.inc.php';
?><div class="span9">
<ul class="nav nav-tabs" id="modTab" style="margin-bottom:0px;margin-left:5px;border-bottom: none;">
<li class="active"><a id="tabEmployeeDependent" href="#tabPageEmployeeDependent"><?=t('Dependents')?></a></li>
</ul>
<div class="tab-content">
<div class="tab-pane active" id="tabPageEmployeeDependent">
<div id="EmployeeDependent" class="reviewBlock" data-content="List" style="padding-left:5px;">
</div>
<div id="EmployeeDependentForm" class="reviewBlock" data-content="Form" style="padding-left:5px;display:none;">
</div>
</div>
</div>
</div>
<script>
var modJsList = new Array();
modJsList['tabEmployeeDependent'] = new EmployeeDependentAdapter('EmployeeDependent');
<?php if(isset($modulePermissions['perm']['Add Dependents']) && $modulePermissions['perm']['Add Dependents'] == "No"){?>
modJsList['tabEmployeeDependent'].setShowAddNew(false);
<?php }?>
<?php if(isset($modulePermissions['perm']['Delete Dependents']) && $modulePermissions['perm']['Delete Dependents'] == "No"){?>
modJsList['tabEmployeeDependent'].setShowDelete(false);
<?php }?>
<?php if(isset($modulePermissions['perm']['Edit Dependents']) && $modulePermissions['perm']['Edit Dependents'] == "No"){?>
modJsList['tabEmployeeDependent'].setShowEdit(false);
<?php }?>
var modJs = modJsList['tabEmployeeDependent'];
</script>
<?php include APP_BASE_PATH.'footer.php';?>

64
modules/dependents/lib.js Normal file
View File

@@ -0,0 +1,64 @@
/*
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 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/>.
------------------------------------------------------------------
Original work Copyright (c) 2012 [Gamonoid Media Pvt. Ltd]
Developer: Thilina Hasantha (thilina.hasantha[at]gmail.com / facebook.com/thilinah)
*/
/**
* EmployeeDependentAdapter
*/
function EmployeeDependentAdapter(endPoint) {
this.initAdapter(endPoint);
}
EmployeeDependentAdapter.inherits(AdapterBase);
EmployeeDependentAdapter.method('getDataMapping', function() {
return [
"id",
"name",
"relationship",
"dob",
"id_number"
];
});
EmployeeDependentAdapter.method('getHeaders', function() {
return [
{ "sTitle": "ID" ,"bVisible":false},
{ "sTitle": "Name" },
{ "sTitle": "Relationship"},
{ "sTitle": "Date of Birth"},
{ "sTitle": "Id Number"}
];
});
EmployeeDependentAdapter.method('getFormFields', function() {
return [
[ "id", {"label":"ID","type":"hidden"}],
[ "name", {"label":"Name","type":"text","validation":""}],
[ "relationship", {"label":"Relationship","type":"select","source":[["Child","Child"],["Spouse","Spouse"],["Parent","Parent"],["Other","Other"]]}],
[ "dob", {"label":"Date of Birth","type":"date","validation":""}],
[ "id_number", {"label":"Id Number","type":"text","validation":"none"}]
];
});

View File

@@ -0,0 +1,24 @@
{
"label":"Dependents",
"menu":"Personal Information",
"order":"5",
"icon":"fa-sliders",
"user_levels":["Admin","Manager","Employee"],
"permissions":
{
"Manager":{
"Add Dependents":"Yes",
"Edit Dependents":"Yes",
"Delete Dependents":"Yes"
},
"Employee":{
"Add Dependents":"Yes",
"Edit Dependents":"Yes",
"Delete Dependents":"Yes"
}
},
"model_namespace": "\\Dependents\\Common\\Model",
"manager": "\\Dependents\\User\\Api\\DependentsModulesManager"
}

View File

@@ -0,0 +1,64 @@
<?php
/*
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 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/>.
------------------------------------------------------------------
Original work Copyright (c) 2012 [Gamonoid Media Pvt. Ltd]
Developer: Thilina Hasantha (thilina.hasantha[at]gmail.com / facebook.com/thilinah)
*/
$moduleName = 'emergency_contact';
define('MODULE_PATH',dirname(__FILE__));
include APP_BASE_PATH.'header.php';
include APP_BASE_PATH.'modulejslibs.inc.php';
?><div class="span9">
<ul class="nav nav-tabs" id="modTab" style="margin-bottom:0px;margin-left:5px;border-bottom: none;">
<li class="active"><a id="tabEmergencyContact" href="#tabPageEmergencyContact"><?=t('Emergency Contacts')?></a></li>
</ul>
<div class="tab-content">
<div class="tab-pane active" id="tabPageEmergencyContact">
<div id="EmergencyContact" class="reviewBlock" data-content="List" style="padding-left:5px;">
</div>
<div id="EmergencyContactForm" class="reviewBlock" data-content="Form" style="padding-left:5px;display:none;">
</div>
</div>
</div>
</div>
<script>
var modJsList = new Array();
modJsList['tabEmergencyContact'] = new EmergencyContactAdapter('EmergencyContact');
<?php if(isset($modulePermissions['perm']['Add Emergency Contacts']) && $modulePermissions['perm']['Add Emergency Contacts'] == "No"){?>
modJsList['tabEmergencyContact'].setShowAddNew(false);
<?php }?>
<?php if(isset($modulePermissions['perm']['Delete Emergency Contacts']) && $modulePermissions['perm']['Delete Emergency Contacts'] == "No"){?>
modJsList['tabEmergencyContact'].setShowDelete(false);
<?php }?>
<?php if(isset($modulePermissions['perm']['Edit Emergency Contacts']) && $modulePermissions['perm']['Edit Emergency Contacts'] == "No"){?>
modJsList['tabEmergencyContact'].setShowEdit(false);
<?php }?>
var modJs = modJsList['tabEmergencyContact'];
</script>
<?php include APP_BASE_PATH.'footer.php';?>

View File

@@ -0,0 +1,63 @@
/*
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 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/>.
------------------------------------------------------------------
Original work Copyright (c) 2012 [Gamonoid Media Pvt. Ltd]
Developer: Thilina Hasantha (thilina.hasantha[at]gmail.com / facebook.com/thilinah)
*/
function EmergencyContactAdapter(endPoint) {
this.initAdapter(endPoint);
}
EmergencyContactAdapter.inherits(AdapterBase);
EmergencyContactAdapter.method('getDataMapping', function() {
return [
"id",
"name",
"relationship",
"home_phone",
"work_phone",
"mobile_phone"
];
});
EmergencyContactAdapter.method('getHeaders', function() {
return [
{ "sTitle": "ID" ,"bVisible":false},
{ "sTitle": "Name" },
{ "sTitle": "Relationship"},
{ "sTitle": "Home Phone"},
{ "sTitle": "Work Phone"},
{ "sTitle": "Mobile Phone"}
];
});
EmergencyContactAdapter.method('getFormFields', function() {
return [
[ "id", {"label":"ID","type":"hidden"}],
[ "name", {"label":"Name","type":"text","validation":""}],
[ "relationship", {"label":"Relationship","type":"text","validation":"none"}],
[ "home_phone", {"label":"Home Phone","type":"text","validation":"none"}],
[ "work_phone", {"label":"Work Phone","type":"text","validation":"none"}],
[ "mobile_phone", {"label":"Mobile Phone","type":"text","validation":"none"}]
];
});

View File

@@ -0,0 +1,24 @@
{
"label":"Emergency Contacts",
"menu":"Personal Information",
"order":"6",
"icon":"fa-phone-square",
"user_levels":["Admin","Manager","Employee"],
"permissions":
{
"Manager":{
"Add Emergency Contacts":"Yes",
"Edit Emergency Contacts":"Yes",
"Delete Emergency Contacts":"Yes"
},
"Employee":{
"Add Emergency Contacts":"Yes",
"Edit Emergency Contacts":"Yes",
"Delete Emergency Contacts":"Yes"
}
},
"model_namespace": "\\EmergencyContacts\\Common\\Model",
"manager": "\\EmergencyContacts\\User\\Api\\EmergencyContactModulesManager"
}

View File

@@ -0,0 +1,219 @@
<div class="row">
<div class="col-xs-12 col-md-2">
<div class="row-fluid">
<div class="col-xs-12" style="text-align: center;">
<img id="profile_image__id_" src="" class="img-polaroid img-thumbnail" style="max-width: 140px;max-height: 140px;">
</div>
</div>
</div>
<div class="col-xs-12 col-md-10">
<div class="row-fluid">
<div class="col-md-12"><h2 id="name"></h2></div>
</div>
<div class="row-fluid">
<div class="col-md-12">
<p>
<i class="fa fa-phone"></i> <span id="mobile_phone"></span>&nbsp;&nbsp;
<i class="fa fa-envelope"></i> <span id="work_email"></span>
</p>
</div>
</div>
<div class="row-fluid">
<div class="col-xs-12" style="font-size:18px;border-bottom: 1px solid #DDD;margin-bottom: 10px;padding-bottom: 10px;">
<button id="employeeProfileEditInfo" class="btn btn-small btn-success" onclick="modJs.editEmployee();" style="margin-right:10px;"><i class="fa fa-edit"></i> Edit Info</button>
<button id="employeeUploadProfileImage" onclick="showUploadDialog('profile_image__id_','Upload Profile Image','profile_image',_id_,'profile_image__id_','src','url','image');return false;" class="btn btn-small btn-primary" type="button" style="margin-right:10px;"><i class="fa fa-upload"></i> Upload Profile Image</button>
<button id="employeeDeleteProfileImage" onclick="modJs.deleteProfileImage(_id_);return false;" class="btn btn-small btn-warning" type="button" style="margin-right:10px;"><i class="fa fa-times"></i> Delete Profile Image</button>
<button id="employeeUpdatePassword" onclick="modJs.changePassword();return false;" class="btn btn-small btn-success" type="button" style="margin-right:10px;"><i class="fa fa-lock"></i> Change Password</button>
</div>
</div>
<div class="row-fluid" style="border-top: 1px;">
<div class="col-xs-6 col-md-4" style="font-size:16px;">
<label class="control-label col-xs-12" style="font-size:13px;font-size:13px;">#_label_employee_id_#</label>
<label class="control-label col-xs-12 iceLabel" style="font-size:13px;font-weight: bold;" id="employee_id"></label>
</div>
<div class="col-xs-6 col-md-4" style="font-size:16px;">
<label class="control-label col-xs-12" style="font-size:13px;">#_label_nic_num_#</label>
<label class="control-label col-xs-12 iceLabel" style="font-size:13px;font-weight: bold;" id="nic_num"></label>
</div>
<div class="col-xs-6 col-md-4" style="font-size:16px;">
<label class="control-label col-xs-12" style="font-size:13px;">#_label_ssn_num_#</label>
<label class="control-label col-xs-12 iceLabel" style="font-size:13px;font-weight: bold;" id="ssn_num"></label>
</div>
</div>
</div>
</div>
<div class="row" style="margin-left:10px;">
<div class="panel panel-default" style="width:97.5%;">
<div class="panel-heading"><h4>Personal Information</h4></div>
<div class="panel-body">
<div class="row-fluid">
<div class="col-xs-6 col-md-3" style="font-size:16px;">
<label class="control-label col-xs-12" style="font-size:13px;">#_label_driving_license_#</label>
<label class="control-label col-xs-12 iceLabel" style="font-size:13px;font-weight: bold;" id="driving_license"></label>
</div>
<div class="col-xs-6 col-md-3" style="font-size:16px;">
<label class="control-label col-xs-12" style="font-size:13px;">#_label_other_id_#</label>
<label class="control-label col-xs-12 iceLabel" style="font-size:13px;font-weight: bold;" id="other_id"></label>
</div>
<div class="col-xs-6 col-md-3" style="font-size:16px;">
<label class="control-label col-xs-12" style="font-size:13px;">#_label_birthday_#</label>
<label class="control-label col-xs-12 iceLabel" style="font-size:13px;font-weight: bold;" id="birthday"></label>
</div>
<div class="col-xs-6 col-md-3" style="font-size:16px;">
<label class="control-label col-xs-12" style="font-size:13px;">#_label_gender_#</label>
<label class="control-label col-xs-12 iceLabel" style="font-size:13px;font-weight: bold;" id="gender"></label>
</div>
</div>
<hr/>
<div class="row-fluid">
<div class="col-xs-6 col-md-3" style="font-size:16px;">
<label class="control-label col-xs-12" style="font-size:13px;">#_label_nationality_#</label>
<label class="control-label col-xs-12 iceLabel" style="font-size:13px;font-weight: bold;" id="nationality_Name"></label>
</div>
<div class="col-xs-6 col-md-3" style="font-size:16px;">
<label class="control-label col-xs-12" style="font-size:13px;">#_label_marital_status_#</label>
<label class="control-label col-xs-12 iceLabel" style="font-size:13px;font-weight: bold;" id="marital_status"></label>
</div>
<div class="col-xs-6 col-md-3" style="font-size:16px;">
<label class="control-label col-xs-12" style="font-size:13px;">#_label_joined_date_#</label>
<label class="control-label col-xs-12 iceLabel" style="font-size:13px;font-weight: bold;" id="joined_date"></label>
</div>
</div>
</div>
</div>
</div>
<div class="row" style="margin-left:10px;margin-top:20px;">
<div class="panel panel-default" style="width:97.5%;">
<div class="panel-heading"><h4>Contact Information</h4></div>
<div class="panel-body">
<div class="row-fluid">
<div class="col-xs-6 col-md-3" style="font-size:16px;">
<label class="control-label col-xs-12" style="font-size:13px;">#_label_address1_#</label>
<label class="control-label col-xs-12 iceLabel" style="font-size:13px;font-weight: bold;" id="address1"></label>
</div>
<div class="col-xs-6 col-md-3" style="font-size:16px;">
<label class="control-label col-xs-12" style="font-size:13px;">#_label_address2_#</label>
<label class="control-label col-xs-12 iceLabel" style="font-size:13px;font-weight: bold;" id="address2"></label>
</div>
<div class="col-xs-6 col-md-3" style="font-size:16px;">
<label class="control-label col-xs-12" style="font-size:13px;">#_label_city_#</label>
<label class="control-label col-xs-12 iceLabel" style="font-size:13px;font-weight: bold;" id="city"></label>
</div>
<div class="col-xs-6 col-md-3" style="font-size:16px;">
<label class="control-label col-xs-12" style="font-size:13px;">#_label_country_#</label>
<label class="control-label col-xs-12 iceLabel" style="font-size:13px;font-weight: bold;" id="country_Name"></label>
</div>
</div>
<hr/>
<div class="row-fluid">
<div class="col-xs-6 col-md-3" style="font-size:16px;">
<label class="control-label col-xs-12" style="font-size:13px;">#_label_postal_code_#</label>
<label class="control-label col-xs-12 iceLabel" style="font-size:13px;font-weight: bold;" id="postal_code"></label>
</div>
<div class="col-xs-6 col-md-3" style="font-size:16px;">
<label class="control-label col-xs-12" style="font-size:13px;">#_label_home_phone_#</label>
<label class="control-label col-xs-12 iceLabel" style="font-size:13px;font-weight: bold;" id="home_phone"></label>
</div>
<div class="col-xs-6 col-md-3" style="font-size:16px;">
<label class="control-label col-xs-12" style="font-size:13px;">#_label_work_phone_#</label>
<label class="control-label col-xs-12 iceLabel" style="font-size:13px;font-weight: bold;" id="work_phone"></label>
</div>
<div class="col-xs-6 col-md-3" style="font-size:16px;">
<label class="control-label col-xs-12" style="font-size:13px;">#_label_private_email_#</label>
<label class="control-label col-xs-12 iceLabel" style="font-size:13px;font-weight: bold;" id="private_email"></label>
</div>
</div>
</div>
</div>
</div>
<div class="row" style="margin-left:10px;margin-top:20px;">
<div class="panel panel-default" style="width:97.5%;">
<div class="panel-heading"><h4>Job Details</h4></div>
<div class="panel-body">
<div class="row-fluid">
<div class="col-xs-6 col-md-3" style="font-size:16px;">
<label class="control-label col-xs-12" style="font-size:13px;">#_label_job_title_#</label>
<label class="control-label col-xs-12 iceLabel" style="font-size:13px;font-weight: bold;" id="job_title_Name"></label>
</div>
<div class="col-xs-6 col-md-3" style="font-size:16px;">
<label class="control-label col-xs-12" style="font-size:13px;">#_label_employment_status_#</label>
<label class="control-label col-xs-12 iceLabel" style="font-size:13px;font-weight: bold;" id="employment_status_Name"></label>
</div>
<div class="col-xs-6 col-md-3" style="font-size:16px;">
<label class="control-label col-xs-12" style="font-size:13px;">Supervisor</label>
<label class="control-label col-xs-12 iceLabel" style="font-size:13px;font-weight: bold;" id="supervisor_Name"></label>
</div>
<div class="col-xs-6 col-md-3" style="font-size:16px;">
<label class="control-label col-xs-12" style="font-size:13px;">Direct Reports</label>
<label class="control-label col-xs-12 iceLabel" style="font-size:13px;font-weight: bold;" id="subordinates"></label>
</div>
</div>
<hr/>
<div class="row-fluid">
<div class="col-xs-6 col-md-3" style="font-size:16px;">
<label class="control-label col-xs-12" style="font-size:13px;">#_label_department_#</label>
<label class="control-label col-xs-12 iceLabel" style="font-size:13px;font-weight: bold;" id="department_Name"></label>
</div>
</div>
</div>
</div>
</div>
<div class="row" id="customFieldsCont" style="margin-left:10px;margin-top:20px;">
<!--
<div class="panel panel-default" style="width:97.5%;">
<div class="panel-heading"><h4>Other Details</h4></div>
<div class="panel-body">
<div class="row-fluid" id="customFields">
</div>
</div>
</div>
-->
</div>
<div class="modal" id="adminUsersModel" tabindex="-1" role="dialog" aria-labelledby="messageModelLabel" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true"><li class="fa fa-times"/></button>
<h3 style="font-size: 17px;">Change User Password</h3>
</div>
<div class="modal-body">
<form id="adminUsersChangePwd">
<div class="control-group">
<div class="controls">
<span class="label label-warning" id="adminUsersChangePwd_error" style="display:none;"></span>
</div>
</div>
<div class="control-group" id="field_newpwd">
<label class="control-label" for="newpwd">New Password</label>
<div class="controls">
<input class="" type="password" id="newpwd" name="newpwd" value="" class="form-control"/>
<span class="help-inline" id="help_newpwd"></span>
</div>
</div>
<div class="control-group" id="field_conpwd">
<label class="control-label" for="conpwd">Confirm Password</label>
<div class="controls">
<input class="" type="password" id="conpwd" name="conpwd" value="" class="form-control"/>
<span class="help-inline" id="help_conpwd"></span>
</div>
</div>
</form>
</div>
<div class="modal-footer">
<button class="btn btn-primary" onclick="modJs.changePasswordConfirm();">Change Password</button>
<button class="btn" onclick="modJs.closeChangePassword();">Not Now</button>
</div>
</div>
</div>
</div>

View File

@@ -0,0 +1,17 @@
<div class="col-lg-3 col-xs-12">
<!-- small box -->
<div class="small-box bg-red">
<div class="inner">
<h3><t>My Profile</t></h3>
<p>
<t>Edit Details</t>
</p>
</div>
<div class="icon">
<i class="ion ion-ios7-person"></i>
</div>
<a href="#_moduleLink_#" class="small-box-footer" id="myProfileLink">
<t>View/Edit Profile</t> <i class="fa fa-arrow-circle-right"></i>
</a>
</div>
</div>

View File

@@ -0,0 +1,86 @@
<?php
/*
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 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/>.
------------------------------------------------------------------
Original work Copyright (c) 2012 [Gamonoid Media Pvt. Ltd]
Developer: Thilina Hasantha (thilina.hasantha[at]gmail.com / facebook.com/thilinah)
*/
$moduleName = 'employees';
define('MODULE_PATH',dirname(__FILE__));
include APP_BASE_PATH.'header.php';
include APP_BASE_PATH.'modulejslibs.inc.php';
$fieldNameMap = \Classes\BaseService::getInstance()->getFieldNameMappings("Employee");
$customFields = \Classes\BaseService::getInstance()->getCustomFields("Employee");
?>
<script type="text/javascript" src="<?=BASE_URL.'js/d3js/d3.js?v='.$jsVersion?>"></script>
<script type="text/javascript" src="<?=BASE_URL.'js/d3js/d3.layout.js?v='.$jsVersion?>"></script>
<style type="text/css">
.node circle {
cursor: pointer;
fill: #fff;
stroke: steelblue;
stroke-width: 1.5px;
}
.node text {
font-size: 11px;
}
path.link {
fill: none;
stroke: #ccc;
stroke-width: 1.5px;
}
</style>
<div class="span9">
<ul class="nav nav-tabs" id="modTab" style="margin-bottom:0px;margin-left:5px;border-bottom: none;">
<li class="active"><a id="tabEmployee" href="#tabPageEmployee"><?=t('My Details')?></a></li>
<li><a id="tabCompanyGraph" href="#tabPageCompanyGraph"><?=t('Company')?></a></li>
</ul>
<div class="tab-content">
<div class="tab-pane active" id="tabPageEmployee">
<div id="Employee" class="container reviewBlock" data-content="List" style="padding:25px 0px 0px 0px; width:99%;">
</div>
<div id="EmployeeForm" class="reviewBlock" data-content="Form" style="padding-left:5px;display:none;">
</div>
</div>
<div class="tab-pane reviewBlock" id="tabPageCompanyGraph" style="overflow-x: scroll;">
</div>
</div>
</div>
<script>
var modJsList = new Array();
modJsList['tabEmployee'] = new EmployeeAdapter('Employee');
modJsList['tabEmployee'].setFieldNameMap(<?=json_encode($fieldNameMap)?>);
modJsList['tabEmployee'].setCustomFields(<?=json_encode($customFields)?>);
modJsList['tabCompanyGraph'] = new CompanyGraphAdapter('CompanyStructure');
var modJs = modJsList['tabEmployee'];
</script>
<?php include APP_BASE_PATH.'footer.php';?>

712
modules/employees/lib.js Normal file
View File

@@ -0,0 +1,712 @@
/*
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 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/>.
------------------------------------------------------------------
Original work Copyright (c) 2012 [Gamonoid Media Pvt. Ltd]
Developer: Thilina Hasantha (thilina.hasantha[at]gmail.com / facebook.com/thilinah)
*/
function EmployeeAdapter(endPoint) {
this.initAdapter(endPoint);
this.fieldNameMap = {};
this.hiddenFields = {};
this.tableFields = {};
this.formOnlyFields = {};
this.customFields = [];
}
EmployeeAdapter.inherits(AdapterBase);
this.currentUserId = null;
EmployeeAdapter.method('setFieldNameMap', function(fields) {
var field;
for(var i=0;i<fields.length;i++){
field = fields[i];
this.fieldNameMap[field.name] = field;
if(field.display == "Hidden"){
this.hiddenFields[field.name] = field;
}else{
if(field.display == "Table and Form"){
this.tableFields[field.name] = field;
}else{
this.formOnlyFields[field.name] = field;
}
}
}
});
EmployeeAdapter.method('setCustomFields', function(fields) {
var field, parsed;
for(var i=0;i<fields.length;i++){
field = fields[i];
if(field.display != "Hidden" && field.data != "" && field.data != undefined){
try{
parsed = JSON.parse(field.data);
if(parsed == undefined || parsed == null){
continue;
}else if(parsed.length != 2){
continue;
}else if(parsed[1].type == undefined || parsed[1].type == null){
continue;
}
this.customFields.push(parsed);
}catch(e){
}
}
}
});
EmployeeAdapter.method('getDataMapping', function() {
return [
"id",
"employee_id",
"first_name",
"last_name",
"mobile_phone",
"department",
"gender",
"supervisor"
];
});
EmployeeAdapter.method('getHeaders', function() {
return [
{ "sTitle": "ID" },
{ "sTitle": "Employee Number" },
{ "sTitle": "First Name" },
{ "sTitle": "Last Name"},
{ "sTitle": "Mobile"},
{ "sTitle": "Department"},
{ "sTitle": "Gender"},
{ "sTitle": "Supervisor"}
];
});
EmployeeAdapter.method('getFormFields', function() {
var fields, newFields = [];
var employee_id, ssn_num, employment_status, job_title, pay_grade, joined_date, department, work_email, country;
if(this.checkPermission("Edit Employee Number") == "Yes"){
employee_id = [ "employee_id", {"label":"Employee Number","type":"text","validation":""}];
}else{
employee_id = [ "employee_id", {"label":"Employee Number","type":"placeholder","validation":""}];
}
if(this.checkPermission("Edit EPF/CPF Number") == "Yes"){
ssn_num = [ "ssn_num", {"label":"EPF/CPF/SS No","type":"text","validation":"none"}];
}else{
ssn_num = [ "ssn_num", {"label":"EPF/CPF/SS No","type":"placeholder","validation":"none"}];
}
if(this.checkPermission("Edit Employment Status") == "Yes"){
employment_status = [ "employment_status", {"label":"Employment Status","type":"select2","remote-source":["EmploymentStatus","id","name"]}];
}else{
employment_status = [ "employment_status", {"label":"Employment Status","type":"placeholder","remote-source":["EmploymentStatus","id","name"]}];
}
if(this.checkPermission("Edit Job Title") == "Yes"){
job_title = [ "job_title", {"label":"Job Title","type":"select2","remote-source":["JobTitle","id","name"]}];
}else{
job_title = [ "job_title", {"label":"Job Title","type":"placeholder","remote-source":["JobTitle","id","name"]}];
}
if(this.checkPermission("Edit Pay Grade") == "Yes"){
pay_grade = [ "pay_grade", {"label":"Pay Grade","type":"select2","allow-null":true,"remote-source":["PayGrade","id","name"]}];
}else{
pay_grade = [ "pay_grade", {"label":"Pay Grade","type":"placeholder","allow-null":true,"remote-source":["PayGrade","id","name"]}];
}
if(this.checkPermission("Edit Joined Date") == "Yes"){
joined_date = [ "joined_date", {"label":"Joined Date","type":"date","validation":""}];
}else{
joined_date = [ "joined_date", {"label":"Joined Date","type":"placeholder","validation":""}];
}
if(this.checkPermission("Edit Department") == "Yes"){
department = [ "department", {"label":"Department","type":"select2","remote-source":["CompanyStructure","id","title"]}];
}else{
department = [ "department", {"label":"Department","type":"placeholder","remote-source":["CompanyStructure","id","title"]}];
}
if(this.checkPermission("Edit Work Email") == "Yes"){
work_email = [ "work_email", {"label":"Work Email","type":"text","validation":"email"}];
}else{
work_email = [ "work_email", {"label":"Work Email","type":"placeholder","validation":"emailOrEmpty"}];
}
if(this.checkPermission("Edit Country") == "Yes"){
country = [ "country", {"label":"Country","type":"select2","remote-source":["Country","code","name"]}];
}else{
country = [ "country", {"label":"Country","type":"placeholder","remote-source":["Country","code","name"]}];
}
fields = [
[ "id", {"label":"ID","type":"hidden","validation":""}],
employee_id,
[ "first_name", {"label":"First Name","type":"text","validation":""}],
[ "middle_name", {"label":"Middle Name","type":"text","validation":"none"}],
[ "last_name", {"label":"Last Name","type":"text","validation":""}],
[ "nationality", {"label":"Nationality","type":"select2","remote-source":["Nationality","id","name"]}],
[ "birthday", {"label":"Date of Birth","type":"date","validation":""}],
[ "gender", {"label":"Gender","type":"select","source":[["Male","Male"],["Female","Female"]]}],
[ "marital_status", {"label":"Marital Status","type":"select","source":[["Married","Married"],["Single","Single"],["Divorced","Divorced"],["Widowed","Widowed"],["Other","Other"]]}],
ssn_num,
[ "nic_num", {"label":"NIC","type":"text","validation":"none"}],
[ "other_id", {"label":"Other ID","type":"text","validation":"none"}],
[ "driving_license", {"label":"Driving License No","type":"text","validation":"none"}],
employment_status,
job_title,
pay_grade,
[ "work_station_id", {"label":"Work Station Id","type":"text","validation":"none"}],
[ "address1", {"label":"Address Line 1","type":"text","validation":"none"}],
[ "address2", {"label":"Address Line 2","type":"text","validation":"none"}],
[ "city", {"label":"City","type":"text","validation":"none"}],
country,
[ "province", {"label":"Province","type":"select2","allow-null":true,"remote-source":["Province","id","name"]}],
[ "postal_code", {"label":"Postal/Zip Code","type":"text","validation":"none"}],
[ "home_phone", {"label":"Home Phone","type":"text","validation":"none"}],
[ "mobile_phone", {"label":"Mobile Phone","type":"text","validation":"none"}],
[ "work_phone", {"label":"Work Phone","type":"text","validation":"none"}],
work_email,
[ "private_email", {"label":"Private Email","type":"text","validation":"emailOrEmpty"}],
joined_date,
department
];
for(var i=0;i<this.customFields.length;i++){
fields.push(this.customFields[i]);
}
for(var i=0;i<fields.length;i++){
tempField = fields[i];
if(this.hiddenFields[tempField[0]] == undefined || this.hiddenFields[tempField[0]] == null ){
if(this.fieldNameMap[tempField[0]] != undefined && this.fieldNameMap[tempField[0]] != null){
title = this.fieldNameMap[tempField[0]].textMapped;
tempField[1]['label'] = title;
}
newFields.push(tempField);
}
}
return newFields;
});
EmployeeAdapter.method('getSourceMapping' , function() {
var k = this.sourceMapping ;
k['supervisor'] = ["Employee","id","first_name+last_name"];
return k;
});
EmployeeAdapter.method('get', function() {
var that = this;
var sourceMappingJson = JSON.stringify(this.getSourceMapping());
var req = {"map":sourceMappingJson};
var reqJson = JSON.stringify(req);
var callBackData = [];
callBackData['callBackData'] = [];
callBackData['callBackSuccess'] = 'modEmployeeGetSuccessCallBack';
callBackData['callBackFail'] = 'modEmployeeGetFailCallBack';
this.customAction('get','modules=employees',reqJson,callBackData);
});
EmployeeAdapter.method('deleteProfileImage', function(empId) {
var that = this;
var req = {"id":empId};
var reqJson = JSON.stringify(req);
var callBackData = [];
callBackData['callBackData'] = [];
callBackData['callBackSuccess'] = 'modEmployeeDeleteProfileImageCallBack';
callBackData['callBackFail'] = 'modEmployeeDeleteProfileImageCallBack';
this.customAction('deleteProfileImage','modules=employees',reqJson,callBackData);
});
EmployeeAdapter.method('modEmployeeDeleteProfileImageCallBack', function(data) {
top.location.href = top.location.href;
});
EmployeeAdapter.method('modEmployeeGetSuccessCallBack' , function(data) {
var fields = this.getFormFields();
var currentEmpId = data[1];
var userEmpId = data[2];
data = data[0];
var html = this.getCustomTemplate('myDetails.html');
for(var i=0;i<fields.length;i++) {
if(this.fieldNameMap[fields[i][0]] != undefined && this.fieldNameMap[fields[i][0]] != null){
title = this.fieldNameMap[fields[i][0]].textMapped;
html = html.replace("#_label_"+fields[i][0]+"_#",title);
}
}
html = html.replace(/#_.+_#/gi,"");
html = html.replace(/_id_/g,data.id);
$("#"+this.getTableName()).html(html);
for(var i=0;i<fields.length;i++) {
$("#"+this.getTableName()+" #" + fields[i][0]).html(data[fields[i][0]]);
$("#"+this.getTableName()+" #" + fields[i][0]+"_Name").html(data[fields[i][0]+"_Name"]);
}
var subordinates = "";
for(var i=0;i<data.subordinates.length;i++){
if(data.subordinates[i].first_name != undefined && data.subordinates[i].first_name != null){
subordinates += data.subordinates[i].first_name+" ";
}
+data.subordinates[i].middle_name
if(data.subordinates[i].middle_name != undefined && data.subordinates[i].middle_name != null && data.subordinates[i].middle_name != ""){
subordinates += data.subordinates[i].middle_name+" ";
}
if(data.subordinates[i].last_name != undefined && data.subordinates[i].last_name != null && data.subordinates[i].last_name != ""){
subordinates += data.subordinates[i].last_name;
}
subordinates += "<br/>";
}
//Add custom fields
if(data.customFields != undefined && data.customFields != null && Object.keys(data.customFields).length > 0) {
var ct = '<div class="col-xs-6 col-md-3" style="font-size:16px;"><label class="control-label col-xs-12" style="font-size:13px;">#_label_#</label><label class="control-label col-xs-12 iceLabel" style="font-size:13px;font-weight: bold;">#_value_#</label></div>';
var sectionTemplate = '<div class="panel panel-default" style="width:97.5%;"><div class="panel-heading"><h4>#_section.name_#</h4></div> <div class="panel-body" id="cont_#_section_#"> </div></div>';
var customFieldHtml;
for (index in data.customFields) {
if(!data.customFields[index][1]){
data.customFields[index][1] = 'Other Details';
}
sectionId = data.customFields[index][1].toLocaleLowerCase();
sectionId = sectionId.replace(' ','_');
if($("#cont_"+sectionId).length <= 0){
//Add section
sectionHtml = sectionTemplate;
sectionHtml = sectionHtml.replace('#_section_#', sectionId);
sectionHtml = sectionHtml.replace('#_section.name_#', data.customFields[index][1]);
$("#customFieldsCont").append($(sectionHtml));
}
customFieldHtml = ct;
customFieldHtml = customFieldHtml.replace('#_label_#', index);
customFieldHtml = customFieldHtml.replace('#_value_#', data.customFields[index][0]);
$("#cont_"+sectionId).append($(customFieldHtml));
}
}else{
$("#customFieldsCont").remove();
}
$("#"+this.getTableName()+" #subordinates").html(subordinates);
$("#"+this.getTableName()+" #name").html(data.first_name + " " + data.last_name);
this.currentUserId = data.id;
$("#"+this.getTableName()+" #profile_image_"+data.id).attr('src',data.image);
if(this.checkPermission("Upload/Delete Profile Image") == "No"){
$("#employeeUploadProfileImage").remove();
$("#employeeDeleteProfileImage").remove();
}
if(this.checkPermission("Edit Employee Details") == "No"){
$("#employeeProfileEditInfo").remove();
}
if(currentEmpId != userEmpId){
$("#employeeUpdatePassword").remove();
}
this.cancel();
});
EmployeeAdapter.method('modEmployeeGetFailCallBack' , function(data) {
});
EmployeeAdapter.method('editEmployee' , function() {
this.edit(this.currentUserId);
});
EmployeeAdapter.method('changePassword', function() {
$('#adminUsersModel').modal('show');
$('#adminUsersChangePwd #newpwd').val('');
$('#adminUsersChangePwd #conpwd').val('');
});
EmployeeAdapter.method('changePasswordConfirm', function() {
$('#adminUsersChangePwd_error').hide();
var passwordValidation = function (str) {
var val = /^[a-zA-Z0-9]\w{6,}$/;
return str != null && val.test(str);
};
var password = $('#adminUsersChangePwd #newpwd').val();
if(!passwordValidation(password)){
$('#adminUsersChangePwd_error').html("Password may contain only letters, numbers and should be longer than 6 characters");
$('#adminUsersChangePwd_error').show();
return;
}
var conPassword = $('#adminUsersChangePwd #conpwd').val();
if(conPassword != password){
$('#adminUsersChangePwd_error').html("Passwords don't match");
$('#adminUsersChangePwd_error').show();
return;
}
var req = {"pwd":conPassword};
var reqJson = JSON.stringify(req);
var callBackData = [];
callBackData['callBackData'] = [];
callBackData['callBackSuccess'] = 'changePasswordSuccessCallBack';
callBackData['callBackFail'] = 'changePasswordFailCallBack';
this.customAction('changePassword','modules=employees',reqJson,callBackData);
});
EmployeeAdapter.method('closeChangePassword', function() {
$('#adminUsersModel').modal('hide');
});
EmployeeAdapter.method('changePasswordSuccessCallBack', function(callBackData,serverData) {
this.closeChangePassword();
this.showMessage("Password Change","Password changed successfully");
});
EmployeeAdapter.method('changePasswordFailCallBack', function(callBackData,serverData) {
this.closeChangePassword();
this.showMessage("Error",callBackData);
});
/*
* Company Graph
*/
function CompanyStructureAdapter(endPoint) {
this.initAdapter(endPoint);
}
CompanyStructureAdapter.inherits(AdapterBase);
CompanyStructureAdapter.method('getDataMapping', function() {
return [
"id",
"title",
"address",
"type",
"country",
"parent"
];
});
CompanyStructureAdapter.method('getHeaders', function() {
return [
{ "sTitle": "ID","bVisible":false },
{ "sTitle": "Name" },
{ "sTitle": "Address"},
{ "sTitle": "Type"},
{ "sTitle": "Country", "sClass": "center" },
{ "sTitle": "Parent Structure"}
];
});
CompanyStructureAdapter.method('getFormFields', function() {
return [
[ "id", {"label":"ID","type":"hidden","validation":""}],
[ "title", {"label":"Name","type":"text","validation":""}],
[ "description", {"label":"Details","type":"textarea","validation":""}],
[ "address", {"label":"Address","type":"textarea","validation":"none"}],
[ "type", {"label":"Type","type":"select","source":[["Company","Company"],["Head Office","Head Office"],["Regional Office","Regional Office"],["Department","Department"],["Unit","Unit"],["Sub Unit","Sub Unit"],["Other","Other"]]}],
[ "country", {"label":"Country","type":"select","remote-source":["Country","code","name"]}],
[ "parent", {"label":"Parent Structure","type":"select","allow-null":true,"remote-source":["CompanyStructure","id","title"]}]
];
});
function CompanyGraphAdapter(endPoint) {
this.initAdapter(endPoint);
this.nodeIdCounter = 0;
}
CompanyGraphAdapter.inherits(CompanyStructureAdapter);
CompanyGraphAdapter.method('convertToTree', function(data) {
var ice = {};
ice['id'] = -1;
ice['title'] = '';
ice['name'] = '';
ice['children'] = [];
var parent = null;
var added = {};
for(var i=0;i<data.length;i++){
data[i].name = data[i].title;
if(data[i].parent != null && data[i].parent != undefined){
parent = this.findParent(data,data[i].parent);
if(parent != null){
if(parent.children == undefined || parent.children == null){
parent.children = [];
}
parent.children.push(data[i]);
}
}
}
for(var i=0;i<data.length;i++){
if(data[i].parent == null || data[i].parent == undefined){
ice['children'].push(data[i]);
}
}
return ice;
});
CompanyGraphAdapter.method('findParent', function(data, parent) {
for(var i=0;i<data.length;i++){
if(data[i].title == parent || data[i].title == parent){
return data[i];
}
}
return null;
});
CompanyGraphAdapter.method('createTable', function(elementId) {
$("#tabPageCompanyGraph").html("");
var that = this;
var sourceData = this.sourceData;
//this.fixCyclicParent(sourceData);
var treeData = this.convertToTree(sourceData);
var m = [20, 120, 20, 120],
w = 5000 - m[1] - m[3],
h = 1000 - m[0] - m[2],
root;
var tree = d3.layout.tree()
.size([h, w]);
this.diagonal = d3.svg.diagonal()
.projection(function(d) { return [d.y, d.x]; });
this.vis = d3.select("#tabPageCompanyGraph").append("svg:svg")
.attr("width", w + m[1] + m[3])
.attr("height", h + m[0] + m[2])
.append("svg:g")
.attr("transform", "translate(" + m[3] + "," + m[0] + ")");
root = treeData;
root.x0 = h / 2;
root.y0 = 0;
function toggleAll(d) {
if (d.children) {
console.log(d.name);
d.children.forEach(toggleAll);
that.toggle(d);
}
}
this.update(root, tree, root);
});
CompanyGraphAdapter.method('update', function(source, tree, root) {
var that = this;
var duration = d3.event && d3.event.altKey ? 5000 : 500;
// Compute the new tree layout.
var nodes = tree.nodes(root).reverse();
// Normalize for fixed-depth.
nodes.forEach(function(d) { d.y = d.depth * 180; });
// Update the nodes<65>
var node = that.vis.selectAll("g.node")
.data(nodes, function(d) { return d.id || (d.id = ++that.nodeIdCounter); });
// Enter any new nodes at the parent's previous position.
var nodeEnter = node.enter().append("svg:g")
.attr("class", "node")
.attr("transform", function(d) { return "translate(" + source.y0 + "," + source.x0 + ")"; })
.on("click", function(d) { that.toggle(d); that.update(d, tree, root); });
nodeEnter.append("svg:circle")
.attr("r", 1e-6)
.style("fill", function(d) { return d._children ? "lightsteelblue" : "#fff"; });
nodeEnter.append("svg:text")
.attr("x", function(d) { return d.children || d._children ? -10 : 10; })
.attr("dy", ".35em")
.attr("text-anchor", function(d) { return d.children || d._children ? "end" : "start"; })
.text(function(d) { return d.name; })
.style("fill-opacity", 1e-6);
// Transition nodes to their new position.
var nodeUpdate = node.transition()
.duration(duration)
.attr("transform", function(d) { return "translate(" + d.y + "," + d.x + ")"; });
nodeUpdate.select("circle")
.attr("r", 4.5)
.style("fill", function(d) { return d._children ? "lightsteelblue" : "#fff"; });
nodeUpdate.select("text")
.style("fill-opacity", 1);
// Transition exiting nodes to the parent's new position.
var nodeExit = node.exit().transition()
.duration(duration)
.attr("transform", function(d) { return "translate(" + source.y + "," + source.x + ")"; })
.remove();
nodeExit.select("circle")
.attr("r", 1e-6);
nodeExit.select("text")
.style("fill-opacity", 1e-6);
// Update the links<6B>
var link = that.vis.selectAll("path.link")
.data(tree.links(nodes), function(d) { return d.target.id; });
// Enter any new links at the parent's previous position.
link.enter().insert("svg:path", "g")
.attr("class", "link")
.attr("d", function(d) {
var o = {x: source.x0, y: source.y0};
return that.diagonal({source: o, target: o});
})
.transition()
.duration(duration)
.attr("d", that.diagonal);
// Transition links to their new position.
link.transition()
.duration(duration)
.attr("d", that.diagonal);
// Transition exiting nodes to the parent's new position.
link.exit().transition()
.duration(duration)
.attr("d", function(d) {
var o = {x: source.x, y: source.y};
return that.diagonal({source: o, target: o});
})
.remove();
// Stash the old positions for transition.
nodes.forEach(function(d) {
d.x0 = d.x;
d.y0 = d.y;
});
});
// Toggle children.
CompanyGraphAdapter.method('toggle', function(d) {
if (d.children) {
d._children = d.children;
d.children = null;
} else {
d.children = d._children;
d._children = null;
}
});
CompanyGraphAdapter.method('getSourceDataById', function(id) {
for(var i=0; i< this.sourceData.length; i++){
if(this.sourceData[i].id == id){
return this.sourceData[i];
}
}
return null;
});
CompanyGraphAdapter.method('fixCyclicParent', function(sourceData) {
var errorMsg = "";
for(var i=0; i< sourceData.length; i++){
var obj = sourceData[i];
var curObj = obj;
var parentIdArr = {};
parentIdArr[curObj.id] = 1;
while(curObj.parent != null && curObj.parent != undefined){
var parent = this.getSourceDataById(curObj.parent);
if(parent == null){
break;
}else if(parentIdArr[parent.id] == 1){
errorMsg = obj.title +"'s parent structure set to "+parent.title+"<br/>";
obj.parent = null;
break;
}
parentIdArr[parent.id] = 1;
curObj = parent;
}
}
if(errorMsg != ""){
this.showMessage("Company Structure is having a cyclic dependency","We found a cyclic dependency due to following reasons:<br/>"+errorMsg);
return false;
}
return true;
});

View File

@@ -0,0 +1,42 @@
{
"label": "Basic Information",
"menu": "Personal Information",
"order": "2",
"icon": "fa-user",
"user_levels": [
"Admin",
"Manager",
"Employee"
],
"dashboardPosition": 101,
"permissions": {
"Manager": {
"Edit Employee Number": "No",
"Edit EPF\/CPF Number": "Yes",
"Edit Employment Status": "No",
"Edit Job Title": "Yes",
"Edit Pay Grade": "Yes",
"Edit Joined Date": "Yes",
"Edit Department": "Yes",
"Edit Work Email": "Yes",
"Edit Country": "Yes",
"Upload\/Delete Profile Image": "Yes",
"Edit Employee Details": "Yes"
},
"Employee": {
"Edit Employee Number": "No",
"Edit EPF\/CPF Number": "Yes",
"Edit Employment Status": "No",
"Edit Job Title": "No",
"Edit Pay Grade": "No",
"Edit Joined Date": "No",
"Edit Department": "No",
"Edit Work Email": "No",
"Edit Country": "No",
"Upload\/Delete Profile Image": "Yes",
"Edit Employee Details": "Yes"
}
},
"model_namespace": "\\Employees\\Common\\Model",
"manager": "\\Employees\\User\\Api\\EmployeesModulesManager"
}

58
modules/loans/index.php Normal file
View File

@@ -0,0 +1,58 @@
<?php
/*
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 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/>.
------------------------------------------------------------------
Original work Copyright (c) 2012 [Gamonoid Media Pvt. Ltd]
Developer: Thilina Hasantha (thilina.hasantha[at]gmail.com / facebook.com/thilinah)
*/
$moduleName = 'loans';
define('MODULE_PATH',dirname(__FILE__));
include APP_BASE_PATH.'header.php';
include APP_BASE_PATH.'modulejslibs.inc.php';
?><div class="span9">
<ul class="nav nav-tabs" id="modTab" style="margin-bottom:0px;margin-left:5px;border-bottom: none;">
<li class="active"><a id="tabEmployeeCompanyLoan" href="#tabPageEmployeeCompanyLoan"><?=t('Loans Taken')?></a></li>
</ul>
<div class="tab-content">
<div class="tab-pane active" id="tabPageEmployeeCompanyLoan">
<div id="EmployeeCompanyLoan" class="reviewBlock" data-content="List" style="padding-left:5px;">
</div>
<div id="EmployeeCompanyLoanForm" class="reviewBlock" data-content="Form" style="padding-left:5px;display:none;">
</div>
</div>
</div>
</div>
<script>
var modJsList = new Array();
modJsList['tabEmployeeCompanyLoan'] = new EmployeeCompanyLoanAdapter('EmployeeCompanyLoan','EmployeeCompanyLoan');
modJsList['tabEmployeeCompanyLoan'].setShowAddNew(false);
modJsList['tabEmployeeCompanyLoan'].setShowSave(false);
modJsList['tabEmployeeCompanyLoan'].setShowDelete(false);
modJsList['tabEmployeeCompanyLoan'].setShowEdit(true);
var modJs = modJsList['tabEmployeeCompanyLoan'];
</script>
<?php include APP_BASE_PATH.'footer.php';?>

91
modules/loans/lib.js Normal file
View File

@@ -0,0 +1,91 @@
/*
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 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/>.
------------------------------------------------------------------
Original work Copyright (c) 2012 [Gamonoid Media Pvt. Ltd]
Developer: Thilina Hasantha (thilina.hasantha[at]gmail.com / facebook.com/thilinah)
*/
function EmployeeCompanyLoanAdapter(endPoint) {
this.initAdapter(endPoint);
}
EmployeeCompanyLoanAdapter.inherits(AdapterBase);
EmployeeCompanyLoanAdapter.method('getDataMapping', function() {
return [
"id",
"loan",
"start_date",
"period_months",
"currency",
"amount",
"status"
];
});
EmployeeCompanyLoanAdapter.method('getHeaders', function() {
return [
{ "sTitle": "ID" ,"bVisible":false},
{ "sTitle": "Loan Type" },
{ "sTitle": "Loan Start Date"},
{ "sTitle": "Loan Period (Months)"},
{ "sTitle": "Currency"},
{ "sTitle": "Amount"},
{ "sTitle": "Status"}
];
});
EmployeeCompanyLoanAdapter.method('getFormFields', function() {
return [
[ "id", {"label":"ID","type":"hidden"}],
[ "loan", {"label":"Loan Type","type":"placeholder","remote-source":["CompanyLoan","id","name"]}],
[ "start_date", {"label":"Loan Start Date","type":"placeholder","validation":""}],
[ "last_installment_date", {"label":"Last Installment Date","type":"placeholder","validation":"none"}],
[ "period_months", {"label":"Loan Period (Months)","type":"placeholder","validation":"number"}],
[ "currency", {"label":"Currency","type":"placeholder","remote-source":["CurrencyType","id","name"]}],
[ "amount", {"label":"Loan Amount","type":"placeholder","validation":"float"}],
[ "monthly_installment", {"label":"Monthly Installment","type":"placeholder","validation":"float"}],
[ "status", {"label":"Status","type":"placeholder","source":[["Approved","Approved"],["Paid","Paid"],["Suspended","Suspended"]]}],
[ "details", {"label":"Details","type":"placeholder","validation":"none"}]
];
});
EmployeeCompanyLoanAdapter.method('getActionButtonsHtml', function(id,data) {
var editButton = '<img class="tableActionButton" src="_BASE_images/view.png" style="cursor:pointer;" rel="tooltip" title="View" onclick="modJs.edit(_id_);return false;"></img>';
var deleteButton = '<img class="tableActionButton" src="_BASE_images/delete.png" style="margin-left:15px;cursor:pointer;" rel="tooltip" title="Delete" onclick="modJs.deleteRow(_id_);return false;"></img>';
var html = '<div style="width:80px;">_edit__delete_</div>';
if(this.showDelete){
html = html.replace('_delete_',deleteButton);
}else{
html = html.replace('_delete_','');
}
if(this.showEdit){
html = html.replace('_edit_',editButton);
}else{
html = html.replace('_edit_','');
}
html = html.replace(/_id_/g,id);
html = html.replace(/_BASE_/g,this.baseUrl);
return html;
});

14
modules/loans/meta.json Normal file
View File

@@ -0,0 +1,14 @@
{
"label": "Loans",
"menu": "Finance",
"order": "3",
"icon": "fa-shield",
"user_levels": [
"Admin",
"Manager",
"Employee"
],
"permissions": [],
"model_namespace": "\\Loans\\Common\\Model",
"manager": "\\Loans\\User\\Api\\LoansModulesManager"
}

11
modules/meta.json Normal file
View File

@@ -0,0 +1,11 @@
{
"Personal Information":"fa-male",
"Leave":"fa-calendar-o",
"Time Management":"fa-clock-o",
"Documents":"fa-files-o",
"Company":"fa-building",
"Training":"fa-briefcase",
"Travel Management":"fa-plane",
"Finance":"fa-money",
"User Reports":"fa-file-text"
}

View File

@@ -0,0 +1,94 @@
<?php
/*
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 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/>.
------------------------------------------------------------------
Original work Copyright (c) 2012 [Gamonoid Media Pvt. Ltd]
Developer: Thilina Hasantha (thilina.hasantha[at]gmail.com / facebook.com/thilinah)
*/
$moduleName = 'overtime';
$moduleMainName = "EmployeeOvertime"; // for creating module js lib
$subModuleMainName = "SubordinateEmployeeOvertime";
$moduleItemName = "Overtime Request"; // For permissions
$itemName = $moduleItemName; // for status change popup
$itemNameLower = strtolower($moduleMainName); // for status change popup
$appModName = $moduleMainName.'Approval';
define('MODULE_PATH',dirname(__FILE__));
include APP_BASE_PATH.'header.php';
$additionalJs = array();
$additionalJs[] = BASE_URL.'admin/overtime/lib.js?v='.$jsVersion;
include APP_BASE_PATH.'modulejslibs.inc.php';
?><div class="span9">
<ul class="nav nav-tabs" id="modTab" style="margin-bottom:0px;margin-left:5px;border-bottom: none;">
<li class="active"><a id="tab<?=$moduleMainName?>" href="#tabPage<?=$moduleMainName?>"><?=t('Overtime Requests')?></a></li>
<li class=""><a id="tab<?=$subModuleMainName?>" href="#tabPage<?=$subModuleMainName?>"><?=t('Subordinate Overtime Requests')?></a></li>
<li class=""><a id="tab<?=$appModName?>" href="#tabPage<?=$appModName?>"><?=t('Overtime Request Approval')?></a></li>
</ul>
<div class="tab-content">
<div class="tab-pane active" id="tabPage<?=$moduleMainName?>">
<div id="<?=$moduleMainName?>" class="reviewBlock" data-content="List" style="padding-left:5px;">
</div>
<div id="<?=$moduleMainName?>Form" class="reviewBlock" data-content="Form" style="padding-left:5px;display:none;">
</div>
</div>
<div class="tab-pane" id="tabPage<?=$subModuleMainName?>">
<div id="<?=$subModuleMainName?>" class="reviewBlock" data-content="List" style="padding-left:5px;">
</div>
<div id="<?=$subModuleMainName?>Form" class="reviewBlock" data-content="Form" style="padding-left:5px;display:none;">
</div>
</div>
<div class="tab-pane" id="tabPage<?=$appModName?>">
<div id="<?=$appModName?>" class="reviewBlock" data-content="List" style="padding-left:5px;">
</div>
<div id="<?=$appModName?>Form" class="reviewBlock" data-content="Form" style="padding-left:5px;display:none;">
</div>
</div>
</div>
</div>
<script>
var modJsList = new Array();
modJsList['tab<?=$moduleMainName?>'] = new <?=$moduleMainName?>Adapter('<?=$moduleMainName?>','<?=$moduleMainName?>');
modJsList['tab<?=$appModName?>'] = new <?=$moduleMainName?>ApproverAdapter('<?=$appModName?>', '<?=$appModName?>');
modJsList['tab<?=$appModName?>'].setShowAddNew(false);
modJsList['tab<?=$appModName?>'].setShowDelete(false);
modJsList['tab<?=$appModName?>'].setShowEdit(false);
modJsList['tab<?=$subModuleMainName?>'] = new <?=$subModuleMainName?>Adapter('<?=$moduleMainName?>','<?=$subModuleMainName?>');
modJsList['tab<?=$subModuleMainName?>'].setRemoteTable(true);
modJsList['tab<?=$subModuleMainName?>'].setShowAddNew(false);
modJsList['tab<?=$subModuleMainName?>'].setShowDelete(false);
modJsList['tab<?=$subModuleMainName?>'].setShowEdit(true);
var modJs = modJsList['tab<?=$moduleMainName?>'];
</script>
<?php include APP_BASE_PATH.'footer.php';?>

120
modules/overtime/lib.js Normal file
View File

@@ -0,0 +1,120 @@
/*
This file is part of iCE Hrm.
Original work Copyright (c) 2012 [Gamonoid Media Pvt. Ltd]
Developer: Thilina Hasantha (thilina.hasantha[at]gmail.com / facebook.com/thilinah)
*/
function EmployeeOvertimeAdapter(endPoint) {
this.initAdapter(endPoint);
this.itemName = 'Overtime';
this.itemNameLower = 'employeeovertime';
this.modulePathName = 'overtime';
}
EmployeeOvertimeAdapter.inherits(ApproveModuleAdapter);
EmployeeOvertimeAdapter.method('getDataMapping', function() {
return [
"id",
"category",
"start_time",
"end_time",
"project",
"status"
];
});
EmployeeOvertimeAdapter.method('getHeaders', function() {
return [
{ "sTitle": "ID" ,"bVisible":false},
{ "sTitle": "Category" },
{ "sTitle": "Start Time" },
{ "sTitle": "End Time"},
{ "sTitle": "Project"},
{ "sTitle": "Status"}
];
});
EmployeeOvertimeAdapter.method('getFormFields', function() {
return [
["id", {"label": "ID", "type": "hidden"}],
["category", {"label": "Category", "type": "select2", "allow-null":false, "remote-source": ["OvertimeCategory", "id", "name"]}],
["start_time", {"label": "Start Time", "type": "datetime", "validation": ""}],
["end_time", {"label": "End Time", "type": "datetime", "validation": ""}],
["project", {"label": "Project", "type": "select2", "allow-null":true,"null=label":"none","remote-source": ["Project", "id", "name"]}],
["notes", {"label": "Notes", "type": "textarea", "validation": "none"}]
];
});
/*
EmployeeOvertimeApproverAdapter
*/
function EmployeeOvertimeApproverAdapter(endPoint) {
this.initAdapter(endPoint);
this.itemName = 'Overtime';
this.itemNameLower = 'employeeovertime';
this.modulePathName = 'overtime';
}
EmployeeOvertimeApproverAdapter.inherits(EmployeeOvertimeAdminAdapter);
EmployeeOvertimeApproverAdapter.method('getActionButtonsHtml', function(id,data) {
var statusChangeButton = '<img class="tableActionButton" src="_BASE_images/run.png" style="cursor:pointer;" rel="tooltip" title="Change Status" onclick="modJs.openStatus(_id_, \'_cstatus_\');return false;"></img>';
var viewLogsButton = '<img class="tableActionButton" src="_BASE_images/log.png" style="margin-left:15px;cursor:pointer;" rel="tooltip" title="View Logs" onclick="modJs.getLogs(_id_);return false;"></img>';
var html = '<div style="width:80px;">_status__logs_</div>';
html = html.replace('_logs_',viewLogsButton);
if(data[this.getStatusFieldPosition()] == 'Processing'){
html = html.replace('_status_',statusChangeButton);
}else{
html = html.replace('_status_','');
}
html = html.replace(/_id_/g,id);
html = html.replace(/_BASE_/g,this.baseUrl);
html = html.replace(/_cstatus_/g,data[this.getStatusFieldPosition()]);
return html;
});
EmployeeOvertimeApproverAdapter.method('getStatusOptionsData', function(currentStatus) {
var data = {};
if(currentStatus != 'Processing'){
}else{
data["Approved"] = "Approved";
data["Rejected"] = "Rejected";
}
return data;
});
EmployeeOvertimeApproverAdapter.method('getStatusOptions', function(currentStatus) {
return this.generateOptions(this.getStatusOptionsData(currentStatus));
});
/*
EmployeeOvertimeAdapter
*/
function SubordinateEmployeeOvertimeAdapter(endPoint,tab,filter,orderBy) {
this.initAdapter(endPoint,tab,filter,orderBy);
this.itemName = 'Overtime';
this.itemNameLower = 'employeeovertime';
this.modulePathName = 'overtime';
}
SubordinateEmployeeOvertimeAdapter.inherits(EmployeeOvertimeAdminAdapter);

View File

@@ -0,0 +1,15 @@
{
"label": "Overtime Requests",
"menu": "Time Management",
"order": "5",
"icon": "fa-align-center",
"user_levels": [
"Admin",
"Manager",
"Employee"
],
"dashboardPosition": 106,
"permissions": [],
"model_namespace": "\\Overtime\\Common\\Model",
"manager": "\\Overtime\\User\\Api\\OvertimeModulesManager"
}

View File

@@ -0,0 +1,15 @@
<div class="col-lg-3 col-xs-12">
<!-- small box -->
<div class="small-box bg-aqua">
<div class="inner">
<h3><t>My Projects</t></h3>
<p><t>Projects Assigned</t></p>
</div>
<div class="icon">
<i class="ion ion-pie-graph"></i>
</div>
<a href="#_moduleLink_#" class="small-box-footer" id="projectsLink">
<t>More info</t> <i class="fa fa-arrow-circle-right"></i>
</a>
</div>
</div>

View File

@@ -0,0 +1,64 @@
<?php
/*
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 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/>.
------------------------------------------------------------------
Original work Copyright (c) 2012 [Gamonoid Media Pvt. Ltd]
Developer: Thilina Hasantha (thilina.hasantha[at]gmail.com / facebook.com/thilinah)
*/
$moduleName = 'projects';
define('MODULE_PATH',dirname(__FILE__));
include APP_BASE_PATH.'header.php';
include APP_BASE_PATH.'modulejslibs.inc.php';
?><div class="span9">
<ul class="nav nav-tabs" id="modTab" style="margin-bottom:0px;margin-left:5px;border-bottom: none;">
<li class="active"><a id="tabEmployeeProject" href="#tabPageEmployeeProject"><?=t('My Projects')?></a></li>
</ul>
<div class="tab-content">
<div class="tab-pane active" id="tabPageEmployeeProject">
<div id="EmployeeProject" class="reviewBlock" data-content="List" style="padding-left:5px;">
</div>
<div id="EmployeeProjectForm" class="reviewBlock" data-content="Form" style="padding-left:5px;display:none;">
</div>
</div>
</div>
</div>
<script>
var modJsList = new Array();
modJsList['tabEmployeeProject'] = new EmployeeProjectAdapter('EmployeeProject','EmployeeProject');
<?php if(isset($modulePermissions['perm']['Add Projects']) && $modulePermissions['perm']['Add Projects'] == "No"){?>
modJsList['tabEmployeeProject'].setShowAddNew(false);
<?php }?>
<?php if(isset($modulePermissions['perm']['Delete Projects']) && $modulePermissions['perm']['Delete Projects'] == "No"){?>
modJsList['tabEmployeeProject'].setShowDelete(false);
<?php }?>
<?php if(isset($modulePermissions['perm']['Edit Projects']) && $modulePermissions['perm']['Edit Projects'] == "No"){?>
modJsList['tabEmployeeProject'].setShowEdit(false);
<?php }?>
var modJs = modJsList['tabEmployeeProject'];
</script>
<?php include APP_BASE_PATH.'footer.php';?>

51
modules/projects/lib.js Normal file
View File

@@ -0,0 +1,51 @@
/*
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 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/>.
------------------------------------------------------------------
Original work Copyright (c) 2012 [Gamonoid Media Pvt. Ltd]
Developer: Thilina Hasantha (thilina.hasantha[at]gmail.com / facebook.com/thilinah)
*/
function EmployeeProjectAdapter(endPoint) {
this.initAdapter(endPoint);
}
EmployeeProjectAdapter.inherits(AdapterBase);
EmployeeProjectAdapter.method('getDataMapping', function() {
return [
"id",
"project"
];
});
EmployeeProjectAdapter.method('getHeaders', function() {
return [
{ "sTitle": "ID" ,"bVisible":false},
{ "sTitle": "Project" }
];
});
EmployeeProjectAdapter.method('getFormFields', function() {
return [
[ "id", {"label":"ID","type":"hidden"}],
[ "project", {"label":"Project","type":"select2","remote-source":["Project","id","name"]}],
[ "details", {"label":"Details","type":"textarea","validation":"none"}]
];
});

View File

@@ -0,0 +1,26 @@
{
"label": "Projects",
"menu": "Time Management",
"order": "1",
"icon": "fa-pencil-square",
"user_levels": [
"Admin",
"Manager",
"Employee"
],
"dashboardPosition": 105,
"permissions": {
"Manager": {
"Add Projects": "Yes",
"Edit Projects": "Yes",
"Delete Projects": "Yes"
},
"Employee": {
"Add Projects": "No",
"Edit Projects": "No",
"Delete Projects": "No"
}
},
"model_namespace": "\\Projects\\Common\\Model",
"manager": "\\Projects\\User\\Api\\ProjectsModulesManager"
}

View File

@@ -0,0 +1,84 @@
<?php
/*
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 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/>.
------------------------------------------------------------------
Original work Copyright (c) 2012 [Gamonoid Media Pvt. Ltd]
Developer: Thilina Hasantha (thilina.hasantha[at]gmail.com / facebook.com/thilinah)
*/
$moduleName = 'qualifications';
define('MODULE_PATH',dirname(__FILE__));
include APP_BASE_PATH.'header.php';
include APP_BASE_PATH.'modulejslibs.inc.php';
?><div class="span9">
<ul class="nav nav-tabs" id="modTab" style="margin-bottom:0px;margin-left:5px;border-bottom: none;">
<li class="active"><a id="tabEmployeeSkill" href="#tabPageEmployeeSkill"><?=t('Skills')?></a></li>
<li><a id="tabEmployeeEducation" href="#tabPageEmployeeEducation"><?=t('Education')?></a></li>
<li><a id="tabEmployeeCertification" href="#tabPageEmployeeCertification"><?=t('Certifications')?></a></li>
<li><a id="tabEmployeeLanguage" href="#tabPageEmployeeLanguage"><?=t('Languages')?></a></li>
</ul>
<div class="tab-content">
<div class="tab-pane active" id="tabPageEmployeeSkill">
<div id="EmployeeSkill" class="reviewBlock" data-content="List" style="padding-left:5px;">
</div>
<div id="EmployeeSkillForm" class="reviewBlock" data-content="Form" style="padding-left:5px;display:none;">
</div>
</div>
<div class="tab-pane" id="tabPageEmployeeEducation">
<div id="EmployeeEducation" class="reviewBlock" data-content="List" style="padding-left:5px;">
</div>
<div id="EmployeeEducationForm" class="reviewBlock" data-content="Form" style="padding-left:5px;display:none;">
</div>
</div>
<div class="tab-pane" id="tabPageEmployeeCertification">
<div id="EmployeeCertification" class="reviewBlock" data-content="List" style="padding-left:5px;">
</div>
<div id="EmployeeCertificationForm" class="reviewBlock" data-content="Form" style="padding-left:5px;display:none;">
</div>
</div>
<div class="tab-pane" id="tabPageEmployeeLanguage">
<div id="EmployeeLanguage" class="reviewBlock" data-content="List" style="padding-left:5px;">
</div>
<div id="EmployeeLanguageForm" class="reviewBlock" data-content="Form" style="padding-left:5px;display:none;">
</div>
</div>
</div>
</div>
<script>
var modJsList = new Array();
modJsList['tabEmployeeSkill'] = new EmployeeSkillAdapter('EmployeeSkill');
modJsList['tabEmployeeEducation'] = new EmployeeEducationAdapter('EmployeeEducation');
modJsList['tabEmployeeCertification'] = new EmployeeCertificationAdapter('EmployeeCertification');
modJsList['tabEmployeeLanguage'] = new EmployeeLanguageAdapter('EmployeeLanguage');
var modJs = modJsList['tabEmployeeSkill'];
</script>
<?php include APP_BASE_PATH.'footer.php';?>

View File

@@ -0,0 +1,200 @@
/*
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 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/>.
------------------------------------------------------------------
Original work Copyright (c) 2012 [Gamonoid Media Pvt. Ltd]
Developer: Thilina Hasantha (thilina.hasantha[at]gmail.com / facebook.com/thilinah)
*/
function EmployeeSkillAdapter(endPoint) {
this.initAdapter(endPoint);
}
EmployeeSkillAdapter.inherits(AdapterBase);
EmployeeSkillAdapter.method('getDataMapping', function() {
return [
"id",
"skill_id",
"details"
];
});
EmployeeSkillAdapter.method('getHeaders', function() {
return [
{ "sTitle": "ID" ,"bVisible":false},
{ "sTitle": "Skill" },
{ "sTitle": "Details"}
];
});
EmployeeSkillAdapter.method('getFormFields', function() {
return [
[ "id", {"label":"ID","type":"hidden"}],
[ "skill_id", {"label":"Skill","type":"select2","allow-null":true,"remote-source":["Skill","id","name"]}],
[ "details", {"label":"Details","type":"textarea","validation":""}]
];
});
/**
* EmployeeEducationAdapter
*/
function EmployeeEducationAdapter(endPoint) {
this.initAdapter(endPoint);
}
EmployeeEducationAdapter.inherits(AdapterBase);
EmployeeEducationAdapter.method('getDataMapping', function() {
return [
"id",
"education_id",
"institute",
"date_start",
"date_end"
];
});
EmployeeEducationAdapter.method('getHeaders', function() {
return [
{ "sTitle": "ID", "bVisible":false},
{ "sTitle": "Qualification" },
{ "sTitle": "Institute"},
{ "sTitle": "Start Date"},
{ "sTitle": "Completed On"},
];
});
EmployeeEducationAdapter.method('getFormFields', function() {
return [
[ "id", {"label":"ID","type":"hidden"}],
[ "education_id", {"label":"Qualification","type":"select2","allow-null":false,"remote-source":["Education","id","name"]}],
[ "institute", {"label":"Institute","type":"text","validation":""}],
[ "date_start", {"label":"Start Date","type":"date","validation":"none"}],
[ "date_end", {"label":"Completed On","type":"date","validation":"none"}]
];
});
/**
* EmployeeCertificationAdapter
*/
function EmployeeCertificationAdapter(endPoint) {
this.initAdapter(endPoint);
}
EmployeeCertificationAdapter.inherits(AdapterBase);
EmployeeCertificationAdapter.method('getDataMapping', function() {
return [
"id",
"certification_id",
"institute",
"date_start",
"date_start"
];
});
EmployeeCertificationAdapter.method('getHeaders', function() {
return [
{ "sTitle": "ID","bVisible":false},
{ "sTitle": "Certification" },
{ "sTitle": "Institute"},
{ "sTitle": "Granted On"},
{ "sTitle": "Valid Thru"},
];
});
EmployeeCertificationAdapter.method('getFormFields', function() {
return [
[ "id", {"label":"ID","type":"hidden"}],
[ "certification_id", {"label":"Certification","type":"select2","allow-null":false,"remote-source":["Certification","id","name"]}],
[ "institute", {"label":"Institute","type":"text","validation":""}],
[ "date_start", {"label":"Granted On","type":"date","validation":"none"}],
[ "date_end", {"label":"Valid Thru","type":"date","validation":"none"}]
];
});
/**
* EmployeeLanguageAdapter
*/
function EmployeeLanguageAdapter(endPoint) {
this.initAdapter(endPoint);
}
EmployeeLanguageAdapter.inherits(AdapterBase);
EmployeeLanguageAdapter.method('getDataMapping', function() {
return [
"id",
"language_id",
"reading",
"speaking",
"writing",
"understanding"
];
});
EmployeeLanguageAdapter.method('getHeaders', function() {
return [
{ "sTitle": "ID", "bVisible":false },
{ "sTitle": "Language" },
{ "sTitle": "Reading"},
{ "sTitle": "Speaking"},
{ "sTitle": "Writing"},
{ "sTitle": "Understanding"}
];
});
EmployeeLanguageAdapter.method('getFormFields', function() {
var compArray = [["Elementary Proficiency","Elementary Proficiency"],
["Limited Working Proficiency","Limited Working Proficiency"],
["Professional Working Proficiency","Professional Working Proficiency"],
["Full Professional Proficiency","Full Professional Proficiency"],
["Native or Bilingual Proficiency","Native or Bilingual Proficiency"]];
return [
[ "id", {"label":"ID","type":"hidden"}],
[ "language_id", {"label":"Language","type":"select2","allow-null":false,"remote-source":["Language","id","description"]}],
[ "reading", {"label":"Reading","type":"select","source":compArray}],
[ "speaking", {"label":"Speaking","type":"select","source":compArray}],
[ "writing", {"label":"Writing","type":"select","source":compArray}],
[ "understanding", {"label":"Understanding","type":"select","source":compArray}]
];
});

View File

@@ -0,0 +1,14 @@
{
"label": "Qualifications",
"menu": "Personal Information",
"order": "3",
"icon": "fa-graduation-cap",
"user_levels": [
"Admin",
"Manager",
"Employee"
],
"permissions": [],
"model_namespace": "\\Qualifications\\Common\\Model",
"manager": "\\Qualifications\\User\\Api\\QualificationsModulesManager"
}

View File

@@ -0,0 +1,156 @@
<html>
<head>
<meta charset="utf-8">
<title>Client Project Timesheet</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="description" content="">
<meta name="author" content="">
<link href="{{BASE_URL}}themecss/AdminLTE.css" rel="stylesheet">
<link href="{{BASE_URL}}themecss/bootstrap.min.css" rel="stylesheet">
<link href="{{BASE_URL}}themecss/font-awesome.min.css" rel="stylesheet">
<link href="{{BASE_URL}}themecss/ionicons.min.css" rel="stylesheet">
<script src="{{BASE_URL}}themejs/bootstrap.js"></script>
</head>
<body>
<div class="container" style="margin-top:10px;">
<div class="row">
<div class="col-xs-12">
<div class="text-center">
<i class="pull-right"><img class="logo" src="{{LOGO}}" style="max-height: 100px;"/></i>
</div>
<table class="table">
<thead>
<th>Company</th>
<th>Client</th>
<th>Reporting Period</th>
<th>Projects</th>
</thead>
<tbody>
<tr>
<td>{{company}}</td>
<td>{{client}}</td>
<td>{{period}}</td>
<td>{{projects}}</td>
</tr>
</tbody>
</table>
</div>
<div class="col-xs-12">
<table class="table table-bordered">
<tbody>
<tr>
<td style="width:30%">Employee<br/>{{employee}}</td>
<td style="width:70%"></td>
</tr>
<tr>
<td style="width:30%">Manager</td>
<td style="width:70%"></td>
</tr>
<tr>
<td style="width:30%">Account Manager</td>
<td style="width:70%"></td>
</tr>
</tbody>
</table>
</div>
</div>
<div class="row">
<div class="col-xs-12">
<table class="table borderless">
<tbody>
<tr style="font-weight: bold;">
<td>Date</td>
<td>Start Time</td>
<td>End Time</td>
<td>Details</td>
<td>Project</td>
<td>Duration</td>
</tr>
{% for entry in entries %}
<tr>
<td>{{entry.date}}</td>
<td>{{entry.startTime}}</td>
<td>{{entry.endTime}}</td>
<td>{{entry.details}}</td>
<td>{{entry.project}}</td>
<td>{{entry.duration | number_format(2, '.', ',')}}</td>
</tr>
{% endfor %}
<tr>
<td><br/><br/></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
</tr>
<tr>
<td></td>
<td></td>
<td></td>
<td></td>
<td><b>Total</b></td>
<td>{{totalHours | number_format(2, '.', ',')}}</td>
</tr>
<tr>
<td></td>
<td></td>
<td></td>
<td></td>
<td>Working Day</td>
<td>{{totalHoursWorking | number_format(2, '.', ',')}}</td>
</tr>
<tr>
<td></td>
<td></td>
<td></td>
<td></td>
<td>Non Working Day / Holiday</td>
<td>{{totalHoursNonWorking | number_format(2, '.', ',')}}</td>
</tr>
<tr>
<td><br/></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
</tr>
<tr>
<td></td>
<td></td>
<td></td>
<td></td>
<td><b>Project Statistics</b></td>
<td></td>
</tr>
{% for project,time in projectTimes %}
<tr>
<td></td>
<td></td>
<td></td>
<td></td>
<td>{{project}}</td>
<td>{{time|number_format(2, '.', ',')}}</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
</div>
</div>
<style type="text/css">
.borderless td {
border: none;
}
* {
font-size: 12px;
}
</style>
</body>
</html>

View File

@@ -0,0 +1,43 @@
<html>
<head>
<meta charset="utf-8">
<title>Payslip {{employeeName}} {{payroll.name}}</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="description" content="">
<meta name="author" content="">
<link href="{{BASE_URL}}themecss/AdminLTE.css" rel="stylesheet">
<link href="{{BASE_URL}}themecss/bootstrap.min.css" rel="stylesheet">
<link href="{{BASE_URL}}themecss/font-awesome.min.css" rel="stylesheet">
<link href="{{BASE_URL}}themecss/ionicons.min.css" rel="stylesheet">
<script src="{{BASE_URL}}themejs/bootstrap.js"></script>
</head>
<body>
<div class="container" style="margin-top:10px;">
<div class="col-xs-2"></div>
<div class="col-xs-8">
{% for field in fields %}
{% if field.type == 'Company Logo' %}
{% include 'payslip/logo.html' with {'field': field} %}
{% elseif field.type == 'Company Name' %}
{% include 'payslip/companyname.html' with {'field': field} %}
{% elseif field.type == 'Payroll Column' %}
{% include 'payslip/column.html' with {'field': field} %}
{% elseif field.type == 'Text' %}
{% include 'payslip/text.html' with {'field': field} %}
{% elseif field.type == 'Separators' %}
{% include 'payslip/hr.html' with {'field': field} %}
{% endif %}
{% endfor %}
</div>
<div class="col-xs-2"></div>
</div>
<style type="text/css">
.borderless td {
border: none;
}
* {
font-size: 12px;
}
</style>
</body>
</html>

View File

@@ -0,0 +1,8 @@
<div class="row">
<div class="col-xs-6">
<b>{{field.label}}</b>
</div>
<div class="col-xs-6" style="text-align: right">
{{field.value}}
</div>
</div>

View File

@@ -0,0 +1,16 @@
<div class="row">
<div class="col-xs-12">
<div class="">
<h2>{{companyName}}</h2>
{% if field.label != "" %}
<h3>{{field.label}}</h3>
{% endif %}
{% if field.text != "" %}
<p>{{field.text}}</p>
{% endif %}
</div>
</div>
</div>

View File

@@ -0,0 +1,5 @@
<div class="row">
<div class="col-xs-12">
<hr/>
</div>
</div>

View File

@@ -0,0 +1,8 @@
<div class="row">
<div class="col-xs-12">
<div class="">
<img src="{{LOGO}}" />
</div>
</div>
</div>

View File

@@ -0,0 +1,14 @@
<div class="row">
<div class="col-xs-12">
<div class="">
{% if field.label != "" %}
<h3>{{field.label}}</h3>
{% endif %}
{% if field.text != "" %}
<p>{{field.text}}</p>
{% endif %}
</div>
</div>
</div>

44
modules/reports/index.php Normal file
View File

@@ -0,0 +1,44 @@
<?php
$moduleName = 'Reports';
define('MODULE_PATH',dirname(__FILE__));
include APP_BASE_PATH.'header.php';
$additionalJs = array();
$additionalJs[] = BASE_URL.'admin/reports/lib.js?v='.$jsVersion;
include APP_BASE_PATH.'modulejslibs.inc.php';
?>
<div class="span9">
<ul class="nav nav-tabs" id="modTab" style="margin-bottom:0px;margin-left:5px;border-bottom: none;">
<li class="active"><a id="tabUserReport" href="#tabPageUserReport"><?=t('Reports')?></a></li>
</ul>
<div class="tab-content">
<div class="tab-pane active" id="tabPageUserReport">
<div id="UserReport" class="reviewBlock" data-content="List" style="padding-left:5px;">
</div>
<div id="UserReportForm" class="reviewBlock" data-content="Form" style="padding-left:5px;display:none;">
</div>
</div>
</div>
</div>
<script>
var modJsList = new Array();
modJsList['tabUserReport'] = new UserReportAdapter('UserReport','UserReport','','report_group');
modJsList['tabUserReport'].setShowAddNew(false);
modJsList['tabUserReport'].setRemoteTable(true);
/*
modJsList['tabReport'] = new ReportGenAdapter('File','File','{"file_group":"Report"}','group');
modJsList['tabReport'].setShowAddNew(false);
*/
var modJs = modJsList['tabUserReport'];
</script>
<?php include APP_BASE_PATH.'footer.php';?>

34
modules/reports/lib.js Normal file
View File

@@ -0,0 +1,34 @@
/**
* Author: Thilina Hasantha
*/
/**
* UserReportAdapter
*/
function UserReportAdapter(endPoint,tab,filter,orderBy) {
this.initAdapter(endPoint,tab,filter,orderBy);
this._construct();
}
UserReportAdapter.inherits(ReportAdapter);
UserReportAdapter.method('renderForm', function(object) {
var that = this;
this.processFormFieldsWithObject(object);
if(this.remoteFieldsExists){
var cb = function(){
that.renderFormNew(object);
};
this.initFieldMasterData(cb);
}else{
this.initFieldMasterData();
that.renderFormNew(object);
}
this.currentReport = object;
});

15
modules/reports/meta.json Normal file
View File

@@ -0,0 +1,15 @@
{
"label": "Reports",
"menu": "User Reports",
"order": "1",
"icon": "fa-file-o",
"user_levels": [
"Admin",
"Manager",
"Employee"
],
"dashboardPosition": 7,
"permissions": [],
"model_namespace": "\\Reports\\Common\\Model",
"manager": "\\Reports\\User\\Api\\ReportsModulesManager"
}

View File

@@ -0,0 +1,18 @@
INSERT INTO `Reports` (`name`, `details`, `parameters`, `query`, `paramOrder`, `type`) VALUES
('Active Employee Report', 'This report list employees who are currently active based on joined date and termination date ',
'[\r\n[ "department", {"label":"Department","type":"select2","remote-source":["CompanyStructure","id","title"],"allow-null":true}]\r\n]',
'ActiveEmployeeReport',
'["department"]', 'Class');
INSERT INTO `Reports` (`name`, `details`, `parameters`, `query`, `paramOrder`, `type`) VALUES
('New Hires Employee Report', 'This report list employees who are joined between given two dates ',
'[[ "department", {"label":"Department","type":"select2","remote-source":["CompanyStructure","id","title"],"allow-null":true}],\r\n[ "date_start", {"label":"Start Date","type":"date"}],\r\n[ "date_end", {"label":"End Date","type":"date"}]\r\n]',
'NewHiresEmployeeReport',
'["department","date_start","date_end"]', 'Class');
INSERT INTO `Reports` (`name`, `details`, `parameters`, `query`, `paramOrder`, `type`) VALUES
('Terminated Employee Report', 'This report list employees who are terminated between given two dates ',
'[[ "department", {"label":"Department","type":"select2","remote-source":["CompanyStructure","id","title"],"allow-null":true}],\r\n[ "date_start", {"label":"Start Date","type":"date"}],\r\n[ "date_end", {"label":"End Date","type":"date"}]\r\n]',
'TerminatedEmployeeReport',
'["department","date_start","date_end"]', 'Class');

View File

@@ -0,0 +1,6 @@
<div class="control-group" id="field__id_">
<div class="controls">
<label id="_id_" name="_id_" style="font-weight:bold"></label>
<hr/>
</div>
</div>

View File

@@ -0,0 +1,14 @@
<form class="form-horizontal" id="_id_">
<div class="control-group">
<div class="controls">
<span class="label label-warning" id="_id__error" style="display:none;"></span>
</div>
</div>
_fields_
<div class="control-group">
<div class="controls">
<button onclick="try{modJs.save()}catch(e){};return false;" class="btn"><t>Download</t></button>
<button onclick="modJs.cancel();return false;" class="btn"><t>Cancel</t></button>
</div>
</div>
</form>

64
modules/salary/index.php Normal file
View File

@@ -0,0 +1,64 @@
<?php
/*
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 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/>.
------------------------------------------------------------------
Original work Copyright (c) 2012 [Gamonoid Media Pvt. Ltd]
Developer: Thilina Hasantha (thilina.hasantha[at]gmail.com / facebook.com/thilinah)
*/
$moduleName = 'salary';
define('MODULE_PATH',dirname(__FILE__));
include APP_BASE_PATH.'header.php';
include APP_BASE_PATH.'modulejslibs.inc.php';
?><div class="span9">
<ul class="nav nav-tabs" id="modTab" style="margin-bottom:0px;margin-left:5px;border-bottom: none;">
<li class="active"><a id="tabEmployeeSalary" href="#tabPageEmployeeSalary"><?=t('Salary')?></a></li>
</ul>
<div class="tab-content">
<div class="tab-pane active" id="tabPageEmployeeSalary">
<div id="EmployeeSalary" class="reviewBlock" data-content="List" style="padding-left:5px;">
</div>
<div id="EmployeeSalaryForm" class="reviewBlock" data-content="Form" style="padding-left:5px;display:none;">
</div>
</div>
</div>
</div>
<script>
var modJsList = new Array();
modJsList['tabEmployeeSalary'] = new EmployeeSalaryAdapter('EmployeeSalary');
<?php if(isset($modulePermissions['perm']['Add Salary']) && $modulePermissions['perm']['Add Salary'] == "No"){?>
modJsList['tabEmployeeSalary'].setShowAddNew(false);
<?php }?>
<?php if(isset($modulePermissions['perm']['Delete Salary']) && $modulePermissions['perm']['Delete Salary'] == "No"){?>
modJsList['tabEmployeeSalary'].setShowDelete(false);
<?php }?>
<?php if(isset($modulePermissions['perm']['Edit Salary']) && $modulePermissions['perm']['Edit Salary'] == "No"){?>
modJsList['tabEmployeeSalary'].setShowEdit(false);
<?php }?>
var modJs = modJsList['tabEmployeeSalary'];
</script>
<?php include APP_BASE_PATH.'footer.php';?>

56
modules/salary/lib.js Normal file
View File

@@ -0,0 +1,56 @@
/*
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 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/>.
------------------------------------------------------------------
Original work Copyright (c) 2012 [Gamonoid Media Pvt. Ltd]
Developer: Thilina Hasantha (thilina.hasantha[at]gmail.com / facebook.com/thilinah)
*/
function EmployeeSalaryAdapter(endPoint) {
this.initAdapter(endPoint);
}
EmployeeSalaryAdapter.inherits(AdapterBase);
EmployeeSalaryAdapter.method('getDataMapping', function() {
return [
"id",
"component",
"amount",
"details"
];
});
EmployeeSalaryAdapter.method('getHeaders', function() {
return [
{ "sTitle": "ID" ,"bVisible":false},
{ "sTitle": "Salary Component" },
{ "sTitle": "Amount"},
{ "sTitle": "Details"}
];
});
EmployeeSalaryAdapter.method('getFormFields', function() {
return [
[ "id", {"label":"ID","type":"hidden"}],
[ "component", {"label":"Salary Component","type":"select2","remote-source":["SalaryComponent","id","name"]}],
[ "amount", {"label":"Amount","type":"text","validation":"float"}],
[ "details", {"label":"Details","type":"textarea","validation":"none"}]
];
});

25
modules/salary/meta.json Normal file
View File

@@ -0,0 +1,25 @@
{
"label": "Salary",
"menu": "Finance",
"order": "2",
"icon": "fa-calculator",
"user_levels": [
"Admin",
"Manager",
"Employee"
],
"permissions": {
"Manager": {
"Add Salary": "No",
"Edit Salary": "No",
"Delete Salary": "No"
},
"Employee": {
"Add Salary": "No",
"Edit Salary": "No",
"Delete Salary": "No"
}
},
"model_namespace": "\\Salary\\Common\\Model",
"manager": "\\Salary\\User\\Api\\SalaryModulesManager"
}

View File

@@ -0,0 +1,19 @@
<form class="form-horizontal" id="_id_" role="form">
<div class="box-body">
<div class="control-group">
<div class="controls">
<span class="label label-warning" id="_id__error" style="display:none;"></span>
</div>
</div>
_fields_
<div class="control-group row">
<div class="controls col-sm-9">
<button onclick="try{modJs.save()}catch(e){};return false;" class="saveBtn btn btn-primary pull-right"><i class="fa fa-save"></i> <t>Save</t></button>
<button onclick="modJs.cancel();return false;" class="cancelBtn btn pull-right" style="margin-right:5px;"><i class="fa fa-times-circle-o"></i> <t>Cancel</t></button>
</div>
<div class="controls col-sm-3">
</div>
</div>
</div>
</form>

View 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>
<t>Hours in Time Sheets</t>
</p>
</div>
<div class="icon">
<i class="ion ion-clock"></i>
</div>
<a href="#_moduleLink_#" class="small-box-footer" id="timesheetLink">
<t>Update Time Sheet</t> <i class="fa fa-arrow-circle-right"></i>
</a>
</div>
</div>

View File

@@ -0,0 +1,201 @@
<?php
/*
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 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/>.
------------------------------------------------------------------
Original work Copyright (c) 2012 [Gamonoid Media Pvt. Ltd]
Developer: Thilina Hasantha (thilina.hasantha[at]gmail.com / facebook.com/thilinah)
*/
$moduleName = 'employee_TimeSheet';
define('MODULE_PATH',dirname(__FILE__));
include APP_BASE_PATH.'header.php';
include APP_BASE_PATH.'modulejslibs.inc.php';
$startEndTimeNeeded = \Classes\SettingsManager::getInstance()->getSetting(
'System: Time-sheet Entry Start and End time Required'
);
?><script type="text/javascript" src="<?=BASE_URL?>js/mindmup-editabletable.js?v=<?=$jsVersion?>"></script>
<div class="span9">
<ul class="nav nav-tabs" id="modTab" style="margin-bottom:0px;margin-left:5px;border-bottom: none;">
<li class="modTabPage active"><a id="tabEmployeeTimeSheetAll" href="#tabPageEmployeeTimeSheetAll"><?=t('All My TimeSheets')?></a></li>
<li class="modTabPage"><a id="tabEmployeeTimeSheetApproved" href="#tabPageEmployeeTimeSheetApproved"><?=t('Approved TimeSheets')?></a></li>
<li class="modTabPage"><a id="tabEmployeeTimeSheetPending" href="#tabPageEmployeeTimeSheetPending"><?=t('Pending TimeSheets')?></a></li>
<li class="modTabPage"><a id="tabSubEmployeeTimeSheetAll" href="#tabPageSubEmployeeTimeSheetAll"><?=t('Subordinate TimeSheets')?></a></li>
</ul>
<div class="tab-content" id="timesheetTabs">
<div class="tab-pane active" id="tabPageEmployeeTimeSheetAll">
<div id="EmployeeTimeSheetAll" class="reviewBlock reviewBlockTable" data-content="List" style="padding-left:5px;">
</div>
<div id="EmployeeTimeSheetAllForm" class="reviewBlock" data-content="Form" style="padding-left:5px;display:none;">
</div>
</div>
<div class="tab-pane" id="tabPageEmployeeTimeSheetApproved">
<div id="EmployeeTimeSheetApproved" class="reviewBlock reviewBlockTable" data-content="List" style="padding-left:5px;">
</div>
<div id="EmployeeTimeSheetApprovedForm" class="reviewBlock" data-content="Form" style="padding-left:5px;display:none;">
</div>
</div>
<div class="tab-pane" id="tabPageEmployeeTimeSheetPending">
<div id="EmployeeTimeSheetPending" class="reviewBlock reviewBlockTable" data-content="List" style="padding-left:5px;">
</div>
<div id="EmployeeTimeSheetPendingForm" class="reviewBlock" data-content="Form" style="padding-left:5px;display:none;">
</div>
</div>
<div class="tab-pane" id="tabPageSubEmployeeTimeSheetAll">
<div id="SubEmployeeTimeSheetAll" class="reviewBlock reviewBlockTable" data-content="List" style="padding-left:5px;">
</div>
<div id="SubEmployeeTimeSheetAllForm" class="reviewBlock" data-content="Form" style="padding-left:5px;display:none;">
</div>
</div>
<div id="QtsheetHeader" class="reviewBlock" style="text-align: right;display:none;padding: 12px 19px 14px;">
<span style="font-size:17px;font-weight:bold;color:#999;margin-left:10px;">
Timesheet From <span class="timesheet_start"></span> to <span class="timesheet_end"></span>
</span>
</div>
<div id="Qtsheet" class="reviewBlock" data-content="List" style="padding-left:5px;display:none;overflow-x: auto;">
</div>
<div id="QtsheetDataButtons" style="text-align: right;margin-top: 10px;">
<button class="cancelBtnTable btn" style="margin-right:5px;"><i class="fa fa-times-circle-o"></i> Cancel</button>
<button class="saveBtnTable btn btn-primary" style="margin-right:5px;"><i class="fa fa-save"></i> Save</button>
<button class="downloadBtnTable btn btn-primary" style="margin-right:5px;"><i class="fa fa-check"></i> Download</button>
<button class="completeBtnTable btn btn-primary" style="margin-right:5px;"><i class="fa fa-check-square-o"></i> Submit</button>
</div>
</div>
</div>
<script>
var modJsList = new Array();
modJsList['tabEmployeeTimeSheetAll'] = new EmployeeTimeSheetAdapter('EmployeeTimeSheet','EmployeeTimeSheetAll','','date_start desc');
modJsList['tabEmployeeTimeSheetAll'].setShowAddNew(false);
modJsList['tabEmployeeTimeSheetAll'].setRemoteTable(true);
modJsList['tabEmployeeTimeSheetAll'].setNeedStartEndTime(<?=$startEndTimeNeeded?>);
modJsList['tabEmployeeTimeSheetApproved'] = new EmployeeTimeSheetAdapter('EmployeeTimeSheet','EmployeeTimeSheetApproved',{"status":"Approved"});
modJsList['tabEmployeeTimeSheetApproved'].setShowAddNew(false);
modJsList['tabEmployeeTimeSheetApproved'].setRemoteTable(true);
modJsList['tabEmployeeTimeSheetApproved'].setNeedStartEndTime(<?=$startEndTimeNeeded?>);
modJsList['tabEmployeeTimeSheetPending'] = new EmployeeTimeSheetAdapter('EmployeeTimeSheet','EmployeeTimeSheetPending',{"status":"Pending"});
modJsList['tabEmployeeTimeSheetPending'].setShowAddNew(false);
modJsList['tabEmployeeTimeSheetPending'].setRemoteTable(true);
modJsList['tabEmployeeTimeSheetPending'].setNeedStartEndTime(<?=$startEndTimeNeeded?>);
modJsList['tabSubEmployeeTimeSheetAll'] = new SubEmployeeTimeSheetAdapter('EmployeeTimeSheet','SubEmployeeTimeSheetAll','','date_start desc');
modJsList['tabSubEmployeeTimeSheetAll'].setShowAddNew(false);
modJsList['tabSubEmployeeTimeSheetAll'].setRemoteTable(true);
modJsList['tabSubEmployeeTimeSheetAll'].setNeedStartEndTime(<?=$startEndTimeNeeded?>);
modJsList['tabEmployeeTimeEntry'] = new EmployeeTimeEntryAdapter('EmployeeTimeEntry','EmployeeTimeEntry','','');
modJsList['tabEmployeeTimeEntry'].setShowAddNew(false);
modJsList['tabQtsheet'] = new QtsheetAdapter('Qtsheet','Qtsheet');
modJsList['tabQtsheet'].setRemoteTable(false);
modJsList['tabQtsheet'].setShowAddNew(false);
modJsList['tabQtsheet'].setModulePath('modules=time_sheets');
modJsList['tabQtsheet'].setRowFieldName('project');
modJsList['tabQtsheet'].setColumnFieldName('date');
modJsList['tabQtsheet'].setTables('Project','QTDays','EmployeeTimeEntry');
$(".saveBtnTable").off().on('click',function(){
modJsList['tabQtsheet'].sendCellDataUpdates();
});
$(".completeBtnTable").off().on('click',function(){
modJsList['tabQtsheet'].sendAllCellDataUpdates();
$(".completeBtnTable").hide();
$(".saveBtnTable").hide();
});
$(".downloadBtnTable").off().on('click',function(){
modJsList['tabQtsheet'].downloadTimesheet();
});
$(".cancelBtnTable").off().on('click',function(){
var lastTabName = $('#Qtsheet').data('lastActiveTab');
modJs = modJsList['tab'+lastTabName];
modJs.get([]);
$('#QtsheetHeader').hide();
$('#Qtsheet').hide();
$('#QtsheetDataButtons').hide();
});
$(".modTabPage").on('click',function(){
$('#QtsheetHeader').hide();
$('#Qtsheet').hide();
$('#QtsheetDataButtons').hide();
});
var modJs = modJsList['tabEmployeeTimeSheetAll'];
</script>
<div class="modal" id="TimeSheetStatusModel" tabindex="-1" role="dialog" aria-labelledby="messageModelLabel" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true"><li class="fa fa-times"/></button>
<h3 style="font-size: 17px;">Change Timesheet Status</h3>
</div>
<div class="modal-body">
<form id="TimeSheetStatusForm">
<div class="control-group">
<label class="control-label" for="timesheet_status">Timesheet Status</label>
<div class="controls">
<select class="" type="text" id="timesheet_status" name="timesheet_status">
<option value="Approved">Approved</option>
<option value="Pending">Pending</option>
<option value="Rejected">Rejected</option>
<option value="Submitted">Submitted</option>
</select>
</div>
</div>
</form>
</div>
<div class="modal-footer">
<button class="btn btn-primary" onclick="modJs.changeTimeSheetStatus();">Change Status</button>
<button class="btn" onclick="modJs.closeTimeSheetStatus();">Not Now</button>
</div>
</div>
</div>
</div>
<div class="modal" id="TimeEntryModel" tabindex="-1" role="dialog" aria-labelledby="messageModelLabel" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true"><li class="fa fa-times"/></button>
<h3 style="font-size: 17px;">Time Entry</h3>
</div>
<div class="modal-body" style="max-height:530px;" id="EmployeeTimeEntryForm">
</div>
</div>
</div>
</div>
<?php include APP_BASE_PATH.'footer.php';?>

965
modules/time_sheets/lib.js Normal file
View File

@@ -0,0 +1,965 @@
/*
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 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/>.
------------------------------------------------------------------
Original work Copyright (c) 2012 [Gamonoid Media Pvt. Ltd]
Developer: Thilina Hasantha (thilina.hasantha[at]gmail.com / facebook.com/thilinah)
*/
function EmployeeTimeSheetAdapter(endPoint,tab,filter,orderBy) {
this.initAdapter(endPoint,tab,filter,orderBy);
}
EmployeeTimeSheetAdapter.inherits(AdapterBase);
this.currentTimesheetId = null;
this.currentTimesheet = null;
this.needStartEndTime = false;
EmployeeTimeSheetAdapter.method('getDataMapping', function() {
return [
"id",
"date_start",
"date_end",
"total_time",
"status"
];
});
EmployeeTimeSheetAdapter.method('getHeaders', function() {
return [
{ "sTitle": "ID" ,"bVisible":false},
{ "sTitle": "Start Date"},
{ "sTitle": "End Date"},
{ "sTitle": "Total Time"},
{ "sTitle": "Status"}
];
});
EmployeeTimeSheetAdapter.method('getFormFields', function() {
return [
[ "id", {"label":"ID","type":"hidden"}],
[ "date_start", {"label":"TimeSheet Start Date","type":"date","validation":""}],
[ "date_end", {"label":"TimeSheet End Date","type":"date","validation":""}],
[ "details", {"label":"Reason","type":"textarea","validation":"none"}]
];
});
EmployeeTimeSheetAdapter.method('preProcessTableData', function(row) {
row[1] = Date.parse(row[1]).toString('MMM d, yyyy (dddd)');
row[2] = Date.parse(row[2]).toString('MMM d, yyyy (dddd)');
return row;
});
EmployeeTimeSheetAdapter.method('setNeedStartEndTime', function(status) {
this.needStartEndTime = status;
});
EmployeeTimeSheetAdapter.method('renderForm', function(object) {
var formHtml = this.templates['formTemplate'];
$('#EmployeeTimesheetBlock').remove();
$("#"+this.getTableName()+'Form').html(formHtml);
$("#"+this.getTableName()+'Form').show();
$("#"+this.getTableName()).hide();
$('.timesheet_start').html(Date.parse(object.date_start).toString('MMM d, yyyy (dddd)'));
$('.timesheet_end').html(Date.parse(object.date_end).toString('MMM d, yyyy (dddd)'));
this.currentTimesheet = object;
this.getTimeEntries();
var st = Date.parse(object.date_start);
$('#EmployeeTimesheetBlock').fullCalendar({
header: {
//left: 'prev,next today',
left: false,
//center: 'title',
center: false,
//right: 'month,agendaWeek,agendaDay'
right: false
},
year: st.toString('yyyy'),
month: st.toString('M'),
date: st.toString('d'),
defaultView: 'basicWeek',
height:200,
editable: false,
events: modJs.getScheduleJsonUrl(this.currentTimesheet.employee),
loading: function(bool) {
if (bool) $('#loadingBlock').show();
else $('#loadingBlock').hide();
},
dayClick: function(date, jsEvent, view, resourceObj) {
modJs.renderFormByDate(date.format());
},
eventClick: function(calEvent, jsEvent, view) {
modJs.renderFormTimeEntryCalender(calEvent.id);
},
eventRender: function(event, element) {
element.find(".fc-time").remove();
}
});
$('#EmployeeTimesheetBlock').fullCalendar('gotoDate', st);
$('.fc-toolbar').hide();
});
EmployeeTimeSheetAdapter.method('quickEdit', function(id, status, sdate, edate) {
$('#Qtsheet').data('lastActiveTab', modJs.tab);
modJs = modJsList['tabQtsheet'];
modJs.setCurrentTimeSheetId(id);
$('.timesheet_start').html(sdate);
$('.timesheet_end').html(edate);
$("#timesheetTabs").find('.active').find('.reviewBlock.reviewBlockTable').hide();
$("#QtsheetHeader").show();
$("#Qtsheet").show();
$("#QtsheetDataButtons").show();
if(status == 'Submitted' || status == 'Approved'){
$(".completeBtnTable").hide();
$(".saveBtnTable").hide();
}else{
$(".completeBtnTable").show();
$(".saveBtnTable").show();
}
modJs.get([]);
});
EmployeeTimeSheetAdapter.method('getScheduleJsonUrl', function(employeeId) {
var url = this.moduleRelativeURL+"?a=ca&sa=getEmployeeTimeEntries&t="+this.table+"&mod=modules%3Dtime_sheets&e="+employeeId;
return url;
});
EmployeeTimeSheetAdapter.method('renderFormByDate', function (date) {
var start, end;
var origDate = date;
if(date.indexOf('T') < 0){
var s1 = moment();
date = date + " " + s1.format("HH:mm:ss");
}
start = date.replace('T',' ');
var m1 = moment(start);
m1.add(1,'h');
end = m1.format('YYYY-MM-DD HH:mm:ss');
var obj = {};
obj.date = origDate;
obj.date_start = start;
obj.date_end = end;
this.renderFormTimeEntryCalender(obj);
});
EmployeeTimeSheetAdapter.method('renderFormTimeEntryCalender', function(object) {
if (this.needStartEndTime+'' == '0') {
return;
}
this.openTimeEntryDialog(object);
if(object.id != undefined && object.id != null){
var cid = object.id;
$('.deleteBtnWorkSchedule').show();
$('.deleteBtnWorkSchedule').off().on('click',function(){
modJs.deleteRow(cid);
return false;
});
}else{
$('.deleteBtnWorkSchedule').remove();
}
});
EmployeeTimeSheetAdapter.method('openTimeEntryDialog', function(object) {
this.currentTimesheetId = this.currentId;
var obj = modJsList['tabEmployeeTimeEntry'];
$('#TimeEntryModel').modal({
backdrop: 'static',
keyboard: false
});
obj.currentTimesheet = this.currentTimesheet;
obj.renderForm(object);
obj.timesheetId = this.currentId;
});
EmployeeTimeSheetAdapter.method('closeTimeEntryDialog', function() {
$('#TimeEntryModel').modal('hide');
});
EmployeeTimeSheetAdapter.method('getTimeEntries', function() {
timesheetId = this.currentId;
var sourceMappingJson = JSON.stringify(modJsList['tabEmployeeTimeEntry'].getSourceMapping());
object = {"id":timesheetId,"sm":sourceMappingJson};
var reqJson = JSON.stringify(object);
var callBackData = [];
callBackData['callBackData'] = [];
callBackData['callBackSuccess'] = 'getTimeEntriesSuccessCallBack';
callBackData['callBackFail'] = 'getTimeEntriesFailCallBack';
this.customAction('getTimeEntries','modules=time_sheets',reqJson,callBackData);
});
EmployeeTimeSheetAdapter.method('getTimeEntriesSuccessCallBack', function(callBackData) {
var entries = callBackData;
var html = "";
var temp = '<tr><td><img class="tableActionButton" src="_BASE_images/delete.png" style="cursor:pointer;" rel="tooltip" title="Delete" onclick="modJsList[\'tabEmployeeTimeEntry\'].deleteRow(_id_);return false;"></img></td><td>_start_</td><td>_end_</td><td>_duration_</td><td>_project_</td><td>_details_</td>';
for(var i=0;i<entries.length;i++){
try{
var t = temp;
t = t.replace(/_start_/g,Date.parse(entries[i].date_start).toString('MMM d, yyyy [hh:mm tt]'));
t = t.replace(/_end_/g,Date.parse(entries[i].date_end).toString('MMM d, yyyy [hh:mm tt]'));
var mili = Date.parse(entries[i].date_end) - Date.parse(entries[i].date_start);
var minutes = Math.round(mili/60000);
var hourMinutes = (minutes % 60);
var hours = (minutes-hourMinutes)/60;
t = t.replace(/_duration_/g,"Hours ("+hours+") - Min ("+hourMinutes+")");
if(entries[i].project == 'null' || entries[i].project == null || entries[i].project == undefined){
t = t.replace(/_project_/g,"None");
}else{
t = t.replace(/_project_/g,entries[i].project);
}
t = t.replace(/_project_/g,entries[i].project);
t = t.replace(/_details_/g,entries[i].details);
t = t.replace(/_id_/g,entries[i].id);
t = t.replace(/_BASE_/g,this.baseUrl);
html += t;
}catch(e){}
}
$('.timesheet_entries_table_body').html(html);
if(modJs.getTableName() == 'SubEmployeeTimeSheetAll' || this.needStartEndTime+'' == '0'){
$('.submit_sheet').hide();
$('.add_time_sheet_entry').hide();
}else{
if(this.currentElement.status == 'Approved'){
$('.submit_sheet').hide();
$('.add_time_sheet_entry').hide();
}else{
$('.submit_sheet').show();
$('.add_time_sheet_entry').show();
}
}
$('#EmployeeTimesheetBlock').fullCalendar( 'refetchEvents' );
});
EmployeeTimeSheetAdapter.method('getTimeEntriesFailCallBack', function(callBackData) {
this.showMessage("Error", "Error occured while getting timesheet entries");
});
EmployeeTimeSheetAdapter.method('createPreviousTimesheet', function(id) {
object = {"id":id};
var reqJson = JSON.stringify(object);
var callBackData = [];
callBackData['callBackData'] = [];
callBackData['callBackSuccess'] = 'createPreviousTimesheetSuccessCallBack';
callBackData['callBackFail'] = 'createPreviousTimesheetFailCallBack';
this.customAction('createPreviousTimesheet','modules=time_sheets',reqJson,callBackData);
});
EmployeeTimeSheetAdapter.method('createPreviousTimesheetSuccessCallBack', function(callBackData) {
$('.tooltip').css("display","none");
$('.tooltip').remove();
//this.showMessage("Success", "Previous Timesheet created");
this.get([]);
});
EmployeeTimeSheetAdapter.method('createPreviousTimesheetFailCallBack', function(callBackData) {
this.showMessage("Error", callBackData);
});
EmployeeTimeSheetAdapter.method('changeTimeSheetStatusWithId', function(id, status) {
if(status == "" || status ==null || status == undefined){
this.showMessage("Status Error","Please select a status");
return;
}
object = {"id":id,"status":status};
var reqJson = JSON.stringify(object);
var callBackData = [];
callBackData['callBackData'] = [];
callBackData['callBackSuccess'] = 'changeTimeSheetStatusSuccessCallBack';
callBackData['callBackFail'] = 'changeTimeSheetStatusFailCallBack';
this.customAction('changeTimeSheetStatus','modules=time_sheets',reqJson,callBackData);
});
EmployeeTimeSheetAdapter.method('changeTimeSheetStatusSuccessCallBack', function(callBackData) {
this.showMessage("Successful", "Timesheet status changed successfully");
this.get([]);
});
EmployeeTimeSheetAdapter.method('changeTimeSheetStatusFailCallBack', function(callBackData) {
this.showMessage("Error", "Error occured while changing Timesheet status");
});
EmployeeTimeSheetAdapter.method('getActionButtonsHtml', function(id,data) {
var html = '';
if(this.needStartEndTime+'' == '0'){
html = '<div style="width:100px;">' +
'<img class="tableActionButton" src="_BASE_images/view.png" style="cursor:pointer;" rel="tooltip" title="Edit Timesheet Entries" onclick="modJs.edit(_id_);return false;"></img>' +
'<img class="tableActionButton" src="_BASE_images/edit.png" style="cursor:pointer;margin-left:15px;" rel="tooltip" title="Edit Timesheet Entries" onclick="modJs.quickEdit(_id_,\'_status_\',\'_sdate_\',\'_edate_\');return false;"></img>' +
'_redoBtn_'+
'</div>';
}else{
html = '<div style="width:80px;">' +
'<img class="tableActionButton" src="_BASE_images/edit.png" style="cursor:pointer;" rel="tooltip" title="Edit Timesheet Entries" onclick="modJs.edit(_id_);return false;"></img>' +
'_redoBtn_'+
'</div>';
}
if(this.getTableName() == "EmployeeTimeSheetAll"){
var redoBtn = '<img class="tableActionButton" src="_BASE_images/redo.png" style="cursor:pointer;margin-left:15px;" rel="tooltip" title="Create previous time sheet" onclick="modJs.createPreviousTimesheet(_id_);return false;"></img>';
html = html.replace(/_redoBtn_/g,redoBtn);
} else {
html = html.replace(/_redoBtn_/g,'');
}
html = html.replace(/_id_/g,id);
html = html.replace(/_sdate_/g,data[1]);
html = html.replace(/_edate_/g,data[2]);
html = html.replace(/_status_/g,data[4]);
html = html.replace(/_BASE_/g,this.baseUrl);
return html;
});
EmployeeTimeSheetAdapter.method('getCustomTableParams', function() {
var that = this;
var dataTableParams = {
"aoColumnDefs": [
{
"fnRender": function(data, cell){
return that.preProcessRemoteTableData(data, cell, 1)
} ,
"aTargets": [1]
},
{
"fnRender": function(data, cell){
return that.preProcessRemoteTableData(data, cell, 2)
} ,
"aTargets": [2]
},
{
"fnRender": that.getActionButtons,
"aTargets": [that.getDataMapping().length]
}
]
};
return dataTableParams;
});
EmployeeTimeSheetAdapter.method('preProcessRemoteTableData', function(data, cell, id) {
return Date.parse(cell).toString('MMM d, yyyy (dddd)');
});
/*
* Subordinate TimeSheets
*/
function SubEmployeeTimeSheetAdapter(endPoint,tab,filter,orderBy) {
this.initAdapter(endPoint,tab,filter,orderBy);
}
this.timeSheetStatusChangeId = null;
SubEmployeeTimeSheetAdapter.inherits(EmployeeTimeSheetAdapter);
SubEmployeeTimeSheetAdapter.method('getDataMapping', function() {
return [
"id",
"employee",
"date_start",
"date_end",
"status"
];
});
SubEmployeeTimeSheetAdapter.method('getHeaders', function() {
return [
{ "sTitle": "ID" ,"bVisible":false},
{ "sTitle": "Employee","bSearchable":true},
{ "sTitle": "Start Date","bSearchable":true},
{ "sTitle": "End Date","bSearchable":true},
{ "sTitle": "Status"}
];
});
SubEmployeeTimeSheetAdapter.method('getFormFields', function() {
return [
[ "id", {"label":"ID","type":"hidden"}],
[ "employee", {"label":"Employee","type":"select","allow-null":false,"remote-source":["Employee","id","first_name+last_name"]}],
[ "date_start", {"label":"TimeSheet Start Date","type":"date","validation":""}],
[ "date_end", {"label":"TimeSheet Start Date","type":"date","validation":""}],
[ "details", {"label":"Reason","type":"textarea","validation":"none"}]
];
});
SubEmployeeTimeSheetAdapter.method('isSubProfileTable', function() {
return true;
});
SubEmployeeTimeSheetAdapter.method('getCustomSuccessCallBack', function(serverData) {
var data = [];
var mapping = this.getDataMapping();
for(var i=0;i<serverData.length;i++){
var row = [];
for(var j=0;j<mapping.length;j++){
row[j] = serverData[i][mapping[j]];
}
data.push(this.preProcessTableData(row));
}
this.tableData = data;
this.createTable(this.getTableName());
$("#"+this.getTableName()+'Form').hide();
$("#"+this.getTableName()).show();
});
SubEmployeeTimeSheetAdapter.method('preProcessTableData', function(row) {
row[2] = Date.parse(row[2]).toString('MMM d, yyyy (dddd)');
row[3] = Date.parse(row[3]).toString('MMM d, yyyy (dddd)');
return row;
});
SubEmployeeTimeSheetAdapter.method('openTimeSheetStatus', function(timeSheetId,status) {
this.currentTimesheetId = timeSheetId;
$('#TimeSheetStatusModel').modal('show');
$('#timesheet_status').val(status);
this.timeSheetStatusChangeId = timeSheetId;
});
SubEmployeeTimeSheetAdapter.method('closeTimeSheetStatus', function() {
$('#TimeSheetStatusModel').modal('hide');
});
SubEmployeeTimeSheetAdapter.method('changeTimeSheetStatus', function() {
var timeSheetStatus = $('#timesheet_status').val();
this.changeTimeSheetStatusWithId(this.timeSheetStatusChangeId,timeSheetStatus);
this.closeTimeSheetStatus();
this.timeSheetStatusChangeId = null;
});
SubEmployeeTimeSheetAdapter.method('getActionButtonsHtml', function(id,data) {
var html;
if(this.needStartEndTime+'' == '0'){
html = '<div style="width:100px;">' +
'<img class="tableActionButton" src="_BASE_images/view.png" style="cursor:pointer;" rel="tooltip" title="Edit Timesheet Entries" onclick="modJs.edit(_id_);return false;"></img>' +
'<img class="tableActionButton" src="_BASE_images/edit.png" style="cursor:pointer;margin-left:15px;" rel="tooltip" title="Edit Timesheet Entries" onclick="modJs.quickEdit(_id_,\'_status_\',\'_sdate_\',\'_edate_\');return false;"></img>' +
'<img class="tableActionButton" src="_BASE_images/run.png" style="cursor:pointer;margin-left:15px;" rel="tooltip" title="Change TimeSheet Status" onclick="modJs.openTimeSheetStatus(_id_,\'_status_\');return false;"></img>' +
'</div>';
}else{
html = '<div style="width:80px;">' +
'<img class="tableActionButton" src="_BASE_images/edit.png" style="cursor:pointer;" rel="tooltip" title="Edit Timesheet Entries" onclick="modJs.edit(_id_);return false;"></img>' +
'<img class="tableActionButton" src="_BASE_images/run.png" style="cursor:pointer;margin-left:15px;" rel="tooltip" title="Change TimeSheet Status" onclick="modJs.openTimeSheetStatus(_id_,\'_status_\');return false;"></img>' +
'</div>';
}
html = html.replace(/_id_/g,id);
html = html.replace(/_BASE_/g,this.baseUrl);
html = html.replace(/_sdate_/g,data[1]);
html = html.replace(/_edate_/g,data[2]);
html = html.replace(/_status_/g,data[4]);
return html;
});
SubEmployeeTimeSheetAdapter.method('getCustomTableParams', function() {
var that = this;
var dataTableParams = {
"aoColumnDefs": [
{
"fnRender": function(data, cell){
return that.preProcessRemoteTableData(data, cell, 2)
} ,
"aTargets": [2]
},
{
"fnRender": function(data, cell){
return that.preProcessRemoteTableData(data, cell, 3)
} ,
"aTargets": [3]
},
{
"fnRender": that.getActionButtons,
"aTargets": [that.getDataMapping().length]
}
]
};
return dataTableParams;
});
SubEmployeeTimeSheetAdapter.method('getFilters', function() {
return [
[ "employee", {"label":"Employee","type":"select2","allow-null":true,"null-label":"All Employees","remote-source":["Employee","id","first_name+last_name"]}]
];
});
/**
* EmployeeTimeEntryAdapter
*/
function EmployeeTimeEntryAdapter(endPoint,tab,filter,orderBy) {
this.initAdapter(endPoint,tab,filter,orderBy);
}
EmployeeTimeEntryAdapter.inherits(AdapterBase);
this.timesheetId = null;
this.currentTimesheet = null;
this.allProjectsAllowed = 1;
this.employeeProjects = [];
EmployeeTimeEntryAdapter.method('getDataMapping', function() {
return [
"id",
"project",
"date_start",
"time_start",
"date_end",
"time_end",
"details"
];
});
EmployeeTimeEntryAdapter.method('getHeaders', function() {
return [
{ "sTitle": "ID" ,"bVisible":false},
{ "sTitle": "Project"},
{ "sTitle": "Start Date"},
{ "sTitle": "Start Time"},
{ "sTitle": "End Date"},
{ "sTitle": "End Time"},
{ "sTitle": "Details"}
];
});
EmployeeTimeEntryAdapter.method('getFormFields', function() {
return [
[ "id", {"label":"ID","type":"hidden"}],
[ "project", {"label":"Project","type":"select2","allow-null":false,"remote-source":["Project","id","name","getEmployeeProjects"]}],
[ "date_select", {"label":"Date","type":"select","source":[]}],
[ "date_start", {"label":"Start Time","type":"time","validation":""}],
[ "date_end", {"label":"End Time","type":"time","validation":""}],
[ "details", {"label":"Details","type":"textarea","validation":""}]
];
});
EmployeeTimeEntryAdapter.method('getDates', function(startDate, stopDate) {
var dateArray = new Array();
var currentDate = startDate;
while (currentDate <= stopDate) {
dateArray.push( new Date (currentDate) );
currentDate = currentDate.add({ days: 1 });
}
return dateArray;
});
EmployeeTimeEntryAdapter.method('renderForm', function(object) {
var formHtml = this.getCustomTemplate('time_entry_form.html');
formHtml = formHtml.replace(/modJs/g,"modJsList['tabEmployeeTimeEntry']");
var html = "";
var fields = this.getFormFields();
for(var i=0;i<fields.length;i++){
var metaField = this.getMetaFieldForRendering(fields[i][0]);
if(metaField == "" || metaField == undefined){
html += this.renderFormField(fields[i]);
}else{
var metaVal = object[metaField];
if(metaVal != '' && metaVal != null && metaVal != undefined && metaVal.trim() != ''){
html += this.renderFormField(JSON.parse(metaVal));
}else{
html += this.renderFormField(fields[i]);
}
}
}
//append dates
//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<this.currentTimesheet.days.length; i++){
var k = this.currentTimesheet.days[i];
//optionList += '<option value="'+timeUtils.getMySQLFormatDate(k)+'">'+k.toUTCString().slice(0, -13)+'</option>';
optionList += '<option value="'+k[0]+'">'+k[1]+'</option>';
}
formHtml = formHtml.replace(/_id_/g,this.getTableName()+"_submit");
formHtml = formHtml.replace(/_fields_/g,html);
$("#"+this.getTableName()+'Form').html(formHtml);
$("#"+this.getTableName()+'Form').show();
$("#"+this.getTableName()).hide();
$("#"+this.getTableName()+'Form .datefield').datepicker({'viewMode':2});
$("#"+this.getTableName()+'Form .datetimefield').datetimepicker({
language: 'en'
});
$("#"+this.getTableName()+'Form .timefield').datetimepicker({
language: 'en',
pickDate: false
});
$("#"+this.getTableName()+'Form .select2Field').select2();
$("#date_select").html(optionList);
if(object != undefined && object != null){
this.fillForm(object);
}
});
EmployeeTimeEntryAdapter.method('fillForm', function(object, formId, fields) {
if(formId == null || formId == undefined || formId == ""){
formId = "#"+this.getTableName()+'Form';
}
if(object.id != null && object.id != undefined){
$(formId + ' #id').val(object.id);
}
if(object.project != null && object.project != undefined){
$(formId + ' #project').select2('val',object.project);
}
if(object.date != null && object.date != undefined){
$(formId + ' #date_select').val(object.date);
}
});
EmployeeTimeEntryAdapter.method('cancel', function() {
$('#TimeEntryModel').modal('hide');
});
EmployeeTimeEntryAdapter.method('setAllProjectsAllowed', function(allProjectsAllowed) {
this.allProjectsAllowed = allProjectsAllowed;
});
EmployeeTimeEntryAdapter.method('setEmployeeProjects', function(employeeProjects) {
this.employeeProjects = employeeProjects;
});
EmployeeTimeEntryAdapter.method('save', function() {
var validator = new FormValidation(this.getTableName()+"_submit",true,{'ShowPopup':false,"LabelErrorClass":"error"});
if(validator.checkValues()){
var params = validator.getFormParameters();
$(params).attr('timesheet',this.timesheetId);
params.time_start = params.date_start;
params.time_end = params.date_end;
params.date_start = params.date_select+" "+params.date_start;
params.date_end = params.date_select+" "+params.date_end;
var msg = this.doCustomValidation(params);
if(msg == null){
var id = $('#'+this.getTableName()+"_submit #id").val();
if(id != null && id != undefined && id != ""){
$(params).attr('id',id);
}
this.add(params,[]);
this.cancel();
}else{
$("#"+this.getTableName()+'Form .label').html(msg);
$("#"+this.getTableName()+'Form .label').show();
}
}
});
EmployeeTimeEntryAdapter.method('doCustomValidation', function(params) {
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";
}
/*
var sd = Date.parse(this.currentTimesheet.date_start);
var ed = Date.parse(this.currentTimesheet.date_end).addDays(1);
if(sd.compareTo(et) != -1 || sd.compareTo(st) > 0 || st.compareTo(ed) != -1 || et.compareTo(ed) != -1){
return "Start time and end time shoud be with in " + sd.toString('MMM d, yyyy (dddd)') + " and " + ed.toString('MMM d, yyyy (dddd)');
}
*/
return null;
});
EmployeeTimeEntryAdapter.method('addSuccessCallBack', function(callBackData,serverData) {
this.get(callBackData);
modJs.getTimeEntries();
});
EmployeeTimeEntryAdapter.method('deleteRow', function(id) {
this.deleteObj(id,[]);
});
EmployeeTimeEntryAdapter.method('deleteSuccessCallBack', function(callBackData,serverData) {
modJs.getTimeEntries();
});
/**
* QtsheetAdapter
*/
function QtsheetAdapter(endPoint) {
this.initAdapter(endPoint);
this.cellDataUpdates = {};
this.currentId = null;
}
QtsheetAdapter.inherits(TableEditAdapter);
QtsheetAdapter.method('validateCellValue', function(element, evt, newValue) {
if ( !ValidationRules.float(newValue)) {
return false;
}
var val = parseFloat(newValue);
if(val <= 0 || val > 24){
return false;
}
//Update total
//Find current column number
//Adding 2 because nth child is based on 1 and we are adding a virtual column for row names
var coldNum = this.columnIDMap[element.data('colId')] + 2;
var columnTotal = 0;
var columnTotalWithoutCurrent = 0;
$("#"+this.getTableName()+' tr td:nth-child('+coldNum+')').each(function(){
var rowId = $(this).data('rowId');
var tval = '';
if(element.data('rowId') == rowId){
tval = newValue;
}else{
tval = $(this).html();
}
if(rowId != -1){
if(ValidationRules.float(tval)){
columnTotal += parseFloat(tval);
if(element.data('rowId') != rowId){
columnTotalWithoutCurrent += parseFloat(tval);
}
}
}else{
if(columnTotal > 24){
$(this).html(columnTotalWithoutCurrent);
}else{
$(this).html(columnTotal);
}
}
});
if(columnTotal > 24){
return false;
}
modJs.addCellDataUpdate(element.data('colId'),element.data('rowId'),newValue);
return true;
});
QtsheetAdapter.method('setCurrentTimeSheetId', function(val) {
this.currentId = val;
this.cellDataUpdates = {};
});
QtsheetAdapter.method('addAdditionalRequestData' , function(type, req) {
if(type == 'updateData'){
req.currentId = this.currentId;
}else if(type == 'updateAllData'){
req.currentId = this.currentId;
}else if(type == 'getAllData'){
req.currentId = this.currentId;
}
return req;
});
QtsheetAdapter.method('modifyCSVHeader', function(header) {
header.unshift("");
return header;
});
QtsheetAdapter.method('getCSVData' , function() {
var csv = "";
for(var i=0;i<this.csvData.length;i++){
csv += this.csvData[i].join(",");
if(i < this.csvData.length -1){
csv += "\r\n";
}
}
return csv;
});
QtsheetAdapter.method('downloadTimesheet' , function() {
var element = document.createElement('a');
element.setAttribute('href', 'data:text/plain;charset=utf-8,' + encodeURIComponent(this.getCSVData()));
element.setAttribute('download', "payroll_"+this.currentId+".csv");
element.style.display = 'none';
document.body.appendChild(element);
element.click();
document.body.removeChild(element);
});
QtsheetAdapter.method('createTable', function(elementId) {
var data = this.getTableData();
var headers = this.getHeaders();
if(this.showActionButtons()){
headers.push({ "sTitle": "", "sClass": "center" });
}
if(this.showActionButtons()){
for(var i=0;i<data.length;i++){
data[i].push(this.getActionButtonsHtml(data[i][0],data[i]));
}
}
var html = "";
html = this.getTableTopButtonHtml()+'<div class="box-body table-responsive"><table cellpadding="0" cellspacing="0" border="0" class="table table-bordered table-striped" id="grid"></table></div>';
//Find current page
var activePage = $('#'+elementId +" .dataTables_paginate .active a").html();
var start = 0;
if(activePage != undefined && activePage != null){
start = parseInt(activePage, 10)*100 - 100;
}
$('#'+elementId).html(html);
var dataTableParams = {
"oLanguage": {
"sLengthMenu": "_MENU_ records per page"
},
"aaData": data,
"aoColumns": headers,
"bSort": false,
"iDisplayLength": 100,
"iDisplayStart": start
};
var customTableParams = this.getCustomTableParams();
$.extend(dataTableParams, customTableParams);
$('#'+elementId+' #grid').dataTable( dataTableParams );
$('#'+elementId+' #grid tr:last').find('td').removeClass('editcell');
$(".dataTables_paginate ul").addClass("pagination");
$(".dataTables_length").hide();
$(".dataTables_filter input").addClass("form-control");
$(".dataTables_filter input").attr("placeholder","Search");
$(".dataTables_filter label").contents().filter(function(){
return (this.nodeType == 3);
}).remove();
//$('.tableActionButton').tooltip();
$('#'+elementId+' #grid').editableTableWidget();
$('#'+elementId+' #grid .editcell').on('validate', function(evt, newValue) {
return modJs.validateCellValue($(this), evt, newValue);
});
});

View File

@@ -0,0 +1,14 @@
{
"label":"Time Sheets",
"menu":"Time Management",
"order":"3",
"icon":"fa-check-circle-o",
"user_levels":["Admin","Manager","Employee"],
"dashboardPosition":104,
"permissions":
{
},
"model_namespace": "\\TimeSheets\\Common\\Model",
"manager": "\\TimeSheets\\User\\Api\\TimeSheetsModulesManager"
}

View File

@@ -0,0 +1,29 @@
<form class="form-horizontal" id="timesheet_entries_cont">
<div id="loadingBlock" style="display:none;position: absolute;top: 10px;left: 10px;font-weight: bold">Loading...</div>
<div class="control-group">
<button style="margin-left:5px;display:none;" onclick="try{modJs.openTimeEntryDialog()}catch(e){};return false;" class="add_time_sheet_entry btn btn-primary"><i class="fa fa-plus"></i> <t>Add Time Entry</t></button>
<button onclick="modJs.changeTimeSheetStatusWithId(modJs.currentId,'Submitted');return false;" class="submit_sheet btn btn-success" style="display:none;"><i class="fa fa-check"></i> <t>Submit</t></button>
<span style="font-size:17px;font-weight:bold;color:#999;margin-left:10px;">
Timesheet From <span class="timesheet_start"></span> to <span class="timesheet_end"></span>
</span>
</div>
<hr/>
<div id="EmployeeTimesheetBlock" style="width:100%;margin-left:5px;"></div>
<table class="table table-condensed table-bordered table-striped" id="timesheet_entries" style="width:100%;font-size:12px;margin-left:5px;">
<thead>
<tr>
<th></th>
<th>Start</th>
<th>End</th>
<th>Duration</th>
<th>Project</th>
<th>Details</th>
</tr>
</thead>
<tbody id="timesheet_entries_table_body" class="timesheet_entries_table_body">
</tbody>
</table>
</form>

View 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><t>My Travel</t></h3>
<p>
<t>Management</t>
</p>
</div>
<div class="icon">
<i class="ion ion-plane"></i>
</div>
<a href="#_moduleLink_#" class="small-box-footer" id="mytravelLink">
<t>Travel Management</t> <i class="fa fa-arrow-circle-right"></i>
</a>
</div>
</div>

103
modules/travel/index.php Normal file
View File

@@ -0,0 +1,103 @@
<?php
/*
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 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/>.
------------------------------------------------------------------
Original work Copyright (c) 2012 [Gamonoid Media Pvt. Ltd]
Developer: Thilina Hasantha (thilina.hasantha[at]gmail.com / facebook.com/thilinah)
*/
$moduleName = 'travel';
$moduleMainName = "EmployeeTravelRecord"; // for creating module js lib
$subModuleMainName = "SubordinateEmployeeTravelRecord";
$moduleItemName = "Travel Request"; // For permissions
$itemName = $moduleItemName; // for status change popup
$itemNameLower = strtolower($moduleMainName); // for status change popup
$appModName = $moduleMainName.'Approval';
define('MODULE_PATH',dirname(__FILE__));
include APP_BASE_PATH.'header.php';
$additionalJs = array();
$additionalJs[] = BASE_URL.'admin/travel/lib.js?v='.$jsVersion;
include APP_BASE_PATH.'modulejslibs.inc.php';
?><div class="span9">
<ul class="nav nav-tabs" id="modTab" style="margin-bottom:0px;margin-left:5px;border-bottom: none;">
<li class="active"><a id="tab<?=$moduleMainName?>" href="#tabPage<?=$moduleMainName?>"><?=t('Travel Requests')?></a></li>
<li class=""><a id="tab<?=$subModuleMainName?>" href="#tabPage<?=$subModuleMainName?>"><?=t('Subordinate Travel Requests')?></a></li>
<li class=""><a id="tab<?=$appModName?>" href="#tabPage<?=$appModName?>"><?=t('Travel Request Approval')?></a></li>
</ul>
<div class="tab-content">
<div class="tab-pane active" id="tabPage<?=$moduleMainName?>">
<div id="<?=$moduleMainName?>" class="reviewBlock" data-content="List" style="padding-left:5px;">
</div>
<div id="<?=$moduleMainName?>Form" class="reviewBlock" data-content="Form" style="padding-left:5px;display:none;">
</div>
</div>
<div class="tab-pane" id="tabPage<?=$subModuleMainName?>">
<div id="<?=$subModuleMainName?>" class="reviewBlock" data-content="List" style="padding-left:5px;">
</div>
<div id="<?=$subModuleMainName?>Form" class="reviewBlock" data-content="Form" style="padding-left:5px;display:none;">
</div>
</div>
<div class="tab-pane" id="tabPage<?=$appModName?>">
<div id="<?=$appModName?>" class="reviewBlock" data-content="List" style="padding-left:5px;">
</div>
<div id="<?=$appModName?>Form" class="reviewBlock" data-content="Form" style="padding-left:5px;display:none;">
</div>
</div>
</div>
</div>
<script>
var modJsList = new Array();
modJsList['tab<?=$moduleMainName?>'] = new <?=$moduleMainName?>Adapter('<?=$moduleMainName?>','<?=$moduleMainName?>');
<?php if(isset($modulePermissions['perm']['Add '.$moduleItemName]) && $modulePermissions['perm']['Add '.$moduleItemName] == "No"){?>
modJsList['tab<?=$moduleMainName?>'].setShowAddNew(false);
<?php }?>
<?php if(isset($modulePermissions['perm']['Delete '.$moduleItemName]) && $modulePermissions['perm']['Delete '.$moduleItemName] == "No"){?>
modJsList['tab<?=$moduleMainName?>'].setShowDelete(false);
<?php }?>
<?php if(isset($modulePermissions['perm']['Edit '.$moduleItemName]) && $modulePermissions['perm']['Edit '.$moduleItemName] == "No"){?>
modJsList['tab<?=$moduleMainName?>'].setShowEdit(false);
<?php }?>
modJsList['tab<?=$appModName?>'] = new <?=$moduleMainName?>ApproverAdapter('<?=$appModName?>', '<?=$appModName?>');
modJsList['tab<?=$appModName?>'].setShowAddNew(false);
modJsList['tab<?=$appModName?>'].setShowDelete(false);
modJsList['tab<?=$appModName?>'].setShowEdit(false);
modJsList['tab<?=$subModuleMainName?>'] = new <?=$subModuleMainName?>Adapter('<?=$moduleMainName?>','<?=$subModuleMainName?>');
modJsList['tab<?=$subModuleMainName?>'].setRemoteTable(true);
modJsList['tab<?=$subModuleMainName?>'].setShowAddNew(false);
modJsList['tab<?=$subModuleMainName?>'].setShowDelete(false);
modJsList['tab<?=$subModuleMainName?>'].setShowEdit(true);
var modJs = modJsList['tab<?=$moduleMainName?>'];
</script>
<?php include APP_BASE_PATH.'footer.php';?>

230
modules/travel/lib.js Normal file
View File

@@ -0,0 +1,230 @@
/*
This file is part of iCE Hrm.
Original work Copyright (c) 2012 [Gamonoid Media Pvt. Ltd]
Developer: Thilina Hasantha (thilina.hasantha[at]gmail.com / facebook.com/thilinah)
*/
function EmployeeImmigrationAdapter(endPoint) {
this.initAdapter(endPoint);
}
EmployeeImmigrationAdapter.inherits(AdapterBase);
EmployeeImmigrationAdapter.method('getDataMapping', function() {
return [
"id",
"document",
"documentname",
"valid_until",
"status"
];
});
EmployeeImmigrationAdapter.method('getHeaders', function() {
return [
{ "sTitle": "ID" ,"bVisible":false},
{ "sTitle": "Document" },
{ "sTitle": "Document Id" },
{ "sTitle": "Valid Until"},
{ "sTitle": "Status"}
];
});
EmployeeImmigrationAdapter.method('getFormFields', function() {
return [
[ "id", {"label":"ID","type":"hidden"}],
[ "document", {"label":"Document","type":"select2","remote-source":["ImmigrationDocument","id","name"]}],
[ "documentname", {"label":"Document Id","type":"text","validation":""}],
[ "valid_until", {"label":"Valid Until","type":"date","validation":"none"}],
[ "status", {"label":"Status","type":"select","source":[["Active","Active"],["Inactive","Inactive"],["Draft","Draft"]]}],
[ "details", {"label":"Details","type":"textarea","validation":"none"}],
[ "attachment1", {"label":"Attachment 1","type":"fileupload","validation":"none"}],
[ "attachment2", {"label":"Attachment 2","type":"fileupload","validation":"none"}],
[ "attachment3", {"label":"Attachment 3","type":"fileupload","validation":"none"}]
];
});
function EmployeeTravelRecordAdapter(endPoint,tab,filter,orderBy) {
this.initAdapter(endPoint,tab,filter,orderBy);
this.itemName = 'Travel';
this.itemNameLower = 'employeetravelrecord';
this.modulePathName = 'travel';
}
EmployeeTravelRecordAdapter.inherits(ApproveModuleAdapter);
EmployeeTravelRecordAdapter.method('getDataMapping', function() {
return [
"id",
"type",
"purpose",
"travel_from",
"travel_to",
"travel_date",
"return_date",
"status"
];
});
EmployeeTravelRecordAdapter.method('getHeaders', function() {
return [
{ "sTitle": "ID" ,"bVisible":false},
{ "sTitle": "Travel Type" },
{ "sTitle": "Purpose" },
{ "sTitle": "From"},
{ "sTitle": "To"},
{ "sTitle": "Travel Date"},
{ "sTitle": "Return Date"},
{ "sTitle": "Status"}
];
});
EmployeeTravelRecordAdapter.method('getFormFields', function() {
return [
[ "id", {"label":"ID","type":"hidden"}],
[ "type", {"label":"Travel Type","type":"select","source":[["Local","Local"],["International","International"]]}],
[ "purpose", {"label":"Purpose of Travel","type":"textarea","validation":""}],
[ "travel_from", {"label":"Travel From","type":"text","validation":""}],
[ "travel_to", {"label":"Travel To","type":"text","validation":""}],
[ "travel_date", {"label":"Travel Date","type":"datetime","validation":""}],
[ "return_date", {"label":"Return Date","type":"datetime","validation":""}],
[ "details", {"label":"Notes","type":"textarea","validation":"none"}],
[ "currency", {"label":"Currency","type":"select2","allow-null":false,"remote-source":["CurrencyType","id","code"]}],
[ "funding", {"label":"Total Funding Proposed","type":"text","validation":"float"}],
[ "attachment1", {"label":"Itinerary / Cab Receipt","type":"fileupload","validation":"none"}],
[ "attachment2", {"label":"Other Attachment 1","type":"fileupload","validation":"none"}],
[ "attachment3", {"label":"Other Attachment 2","type":"fileupload","validation":"none"}]
];
});
/*
EmployeeTravelRecordAdapter.method('getActionButtonsHtml', function(id,data) {
var editButton = '<img class="tableActionButton" src="_BASE_images/edit.png" style="cursor:pointer;" rel="tooltip" title="Edit" onclick="modJs.edit(_id_);return false;"></img>';
var deleteButton = '<img class="tableActionButton" src="_BASE_images/delete.png" style="margin-left:15px;cursor:pointer;" rel="tooltip" title="Delete" onclick="modJs.deleteRow(_id_);return false;"></img>';
var requestCancellationButton = '<img class="tableActionButton" src="_BASE_images/delete.png" style="margin-left:15px;cursor:pointer;" rel="tooltip" title="Cancel Travel Request" onclick="modJs.cancelTravel(_id_);return false;"></img>';
var html = '<div style="width:80px;">_edit__delete_</div>';
if(this.showDelete){
if(data[7] == "Approved"){
html = html.replace('_delete_',requestCancellationButton);
}else{
html = html.replace('_delete_',deleteButton);
}
}else{
html = html.replace('_delete_','');
}
if(this.showEdit){
html = html.replace('_edit_',editButton);
}else{
html = html.replace('_edit_','');
}
html = html.replace(/_id_/g,id);
html = html.replace(/_BASE_/g,this.baseUrl);
return html;
});
EmployeeTravelRecordAdapter.method('cancelTravel', function(id) {
var that = this;
var object = {};
object['id'] = id;
var reqJson = JSON.stringify(object);
var callBackData = [];
callBackData['callBackData'] = [];
callBackData['callBackSuccess'] = 'cancelSuccessCallBack';
callBackData['callBackFail'] = 'cancelFailCallBack';
this.customAction('cancelTravel','modules=travel',reqJson,callBackData);
});
EmployeeTravelRecordAdapter.method('cancelSuccessCallBack', function(callBackData) {
this.showMessage("Successful", "Travel request cancellation request sent");
this.get([]);
});
EmployeeTravelRecordAdapter.method('cancelFailCallBack', function(callBackData) {
this.showMessage("Error Occurred while cancelling Travel request", callBackData);
});
*/
/*
EmployeeTravelRecordApproverAdapter
*/
function EmployeeTravelRecordApproverAdapter(endPoint,tab,filter,orderBy) {
this.initAdapter(endPoint,tab,filter,orderBy);
this.itemName = 'Travel';
this.itemNameLower = 'employeetravelrecord';
this.modulePathName = 'travel';
}
EmployeeTravelRecordApproverAdapter.inherits(EmployeeTravelRecordAdminAdapter);
EmployeeTravelRecordApproverAdapter.method('getActionButtonsHtml', function(id,data) {
var statusChangeButton = '<img class="tableActionButton" src="_BASE_images/run.png" style="cursor:pointer;" rel="tooltip" title="Change Status" onclick="modJs.openStatus(_id_, \'_cstatus_\');return false;"></img>';
var viewLogsButton = '<img class="tableActionButton" src="_BASE_images/log.png" style="margin-left:15px;cursor:pointer;" rel="tooltip" title="View Logs" onclick="modJs.getLogs(_id_);return false;"></img>';
var html = '<div style="width:80px;">_status__logs_</div>';
html = html.replace('_logs_',viewLogsButton);
if(data[this.getStatusFieldPosition()] == 'Processing'){
html = html.replace('_status_',statusChangeButton);
}else{
html = html.replace('_status_','');
}
html = html.replace(/_id_/g,id);
html = html.replace(/_BASE_/g,this.baseUrl);
html = html.replace(/_cstatus_/g,data[this.getStatusFieldPosition()]);
return html;
});
EmployeeTravelRecordApproverAdapter.method('getStatusOptionsData', function(currentStatus) {
var data = {};
if(currentStatus != 'Processing'){
}else{
data["Approved"] = "Approved";
data["Rejected"] = "Rejected";
}
return data;
});
EmployeeTravelRecordApproverAdapter.method('getStatusOptions', function(currentStatus) {
return this.generateOptions(this.getStatusOptionsData(currentStatus));
});
/*
SubordinateExpenseModuleAdapter
*/
function SubordinateEmployeeTravelRecordAdapter(endPoint,tab,filter,orderBy) {
this.initAdapter(endPoint,tab,filter,orderBy);
this.itemName = 'Travel';
this.itemNameLower = 'employeetravelrecord';
this.modulePathName = 'travel';
}
SubordinateEmployeeTravelRecordAdapter.inherits(EmployeeTravelRecordAdminAdapter);

26
modules/travel/meta.json Normal file
View File

@@ -0,0 +1,26 @@
{
"label": "Travel",
"menu": "Travel Management",
"order": "1",
"icon": "fa-plane",
"user_levels": [
"Admin",
"Manager",
"Employee"
],
"dashboardPosition": 107,
"permissions": {
"Manager": {
"Add Travel Request": "Yes",
"Edit Travel Request": "Yes",
"Delete Travel Request": "Yes"
},
"Employee": {
"Add Travel Request": "Yes",
"Edit Travel Request": "Yes",
"Delete Travel Request": "Yes"
}
},
"model_namespace": "\\Travel\\Common\\Model",
"manager": "\\Travel\\User\\Api\\TravelModulesManager"
}