IceHrm v18.0

This commit is contained in:
Thilina Hasantha
2016-08-04 14:27:59 +05:30
parent 9e243073df
commit a10fbba14a
882 changed files with 90619 additions and 2546 deletions

View File

@@ -134,5 +134,45 @@ class AttendanceActionManager extends SubActionManager{
return new IceResponse(IceResponse::SUCCESS,$openPunch);
}
public function createPreviousAttendnaceSheet($req){
$employee = $this->baseService->getElement('Employee',$this->getCurrentProfileId(),null,true);
$timeSheet = new EmployeeAttendanceSheet();
$timeSheet->Load("id = ?",array($req->id));
if($timeSheet->id != $req->id){
return new IceResponse(IceResponse::ERROR,"Attendance Sheet not found");
}
if($timeSheet->employee != $employee->id){
return new IceResponse(IceResponse::ERROR,"You don't have permissions to add this Attendance Sheet");
}
$end = date("Y-m-d", strtotime("last Saturday", strtotime($timeSheet->date_start)));
$start = date("Y-m-d", strtotime("last Sunday", strtotime($end)));
$tempTimeSheet = new EmployeeTimeSheet();
$tempTimeSheet->Load("employee = ? and date_start = ?",array($employee->id, $start));
if($employee->id == $tempTimeSheet->employee){
return new IceResponse(IceResponse::ERROR,"Attendance Sheet already exists");
}
$newTimeSheet = new EmployeeTimeSheet();
$newTimeSheet->employee = $employee->id;
$newTimeSheet->date_start = $start;
$newTimeSheet->date_end = $end;
$newTimeSheet->status = "Pending";
$ok = $newTimeSheet->Save();
if(!$ok){
LogManager::getInstance()->info("Error creating time sheet : ".$newTimeSheet->ErrorMsg());
return new IceResponse(IceResponse::ERROR,"Error creating Attendance Sheet");
}
return new IceResponse(IceResponse::SUCCESS,"");
}
}
}

View File

@@ -3,15 +3,15 @@
<div class="small-box bg-aqua">
<div class="inner">
<h3 id="lastPunchTime">
Punch In
<t>Punch In</t>
</h3>
<p>or punch out</p>
<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">
Record Attendance <i class="fa fa-arrow-circle-right"></i>
<t>Record Attendance</t> <i class="fa fa-arrow-circle-right"></i>
</a>
</div>
</div>
</div>

View File

@@ -33,7 +33,7 @@ if(empty($currentEmployeeTimeZone)){
?><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">Attendance</a></li>
<li class="active"><a id="tabAttendance" href="#tabPageAttendance"><?=LanguageManager::tran('Attendance')?></a></li>
</ul>
<div class="tab-content">
@@ -74,4 +74,4 @@ var modJs = modJsList['tabAttendance'];
</div>
</div>
</div>
<?php include APP_BASE_PATH.'footer.php';?>
<?php include APP_BASE_PATH.'footer.php';?>

View File

@@ -247,3 +247,212 @@ AttendanceAdapter.method('getClientGMTOffset', function () {
return std_time_offset;
});
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

@@ -53,7 +53,7 @@ include APP_BASE_PATH.'modulejslibs.inc.php';
ksort($dashBoardList);
foreach($dashBoardList as $k=>$v){
echo $v;
echo LanguageManager::translateTnrText($v);
}
?>
@@ -95,4 +95,4 @@ modJs.getInitData();
*/
</script>
<?php include APP_BASE_PATH.'footer.php';?>
<?php include APP_BASE_PATH.'footer.php';?>

View File

@@ -28,7 +28,7 @@ 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">Dependents</a></li>
<li class="active"><a id="tabEmployeeDependent" href="#tabPageEmployeeDependent"><?=LanguageManager::tran('Dependents')?></a></li>
</ul>
<div class="tab-content">
@@ -60,4 +60,4 @@ modJsList['tabEmployeeDependent'].setShowEdit(false);
var modJs = modJsList['tabEmployeeDependent'];
</script>
<?php include APP_BASE_PATH.'footer.php';?>
<?php include APP_BASE_PATH.'footer.php';?>

View File

@@ -28,7 +28,7 @@ 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">Emergency Contacts</a></li>
<li class="active"><a id="tabEmergencyContact" href="#tabPageEmergencyContact"><?=LanguageManager::tran('Emergency Contacts')?></a></li>
</ul>
<div class="tab-content">
@@ -61,4 +61,4 @@ modJsList['tabEmergencyContact'].setShowEdit(false);
var modJs = modJsList['tabEmergencyContact'];
</script>
<?php include APP_BASE_PATH.'footer.php';?>
<?php include APP_BASE_PATH.'footer.php';?>

View File

@@ -24,13 +24,57 @@ Developer: Thilina Hasantha (thilina.hasantha[at]gmail.com / facebook.com/thilin
class EmployeesActionManager extends SubActionManager{
public function get($req){
$profileId = $this->getCurrentProfileId();
$subordinate = new Employee();
$subordinatesCount = $subordinate->Count("supervisor = ? and id = ?",array($profileId, $req->id));
$cemp = $profileId;
$obj = new Employee();
$cempObj = new Employee();
$cempObj->Load("id = ?",array($cemp));
if($obj->getUserOnlyMeAccessField() == 'id' &&
SettingsManager::getInstance()->getSetting('System: Company Structure Managers Enabled') == 1 &&
CompanyStructure::isHeadOfCompanyStructure($cempObj->department, $cemp)){
$subordinates = $obj->Find("supervisor = ?",array($cemp));
if(empty($subordinates)){
$subordinates = array();
}
$childCompaniesIds = array();
if(SettingsManager::getInstance()->getSetting('System: Child Company Structure Managers Enabled') == '1'){
$childCompaniesResp = CompanyStructure::getAllChildCompanyStructures($cempObj->department);
$childCompanies = $childCompaniesResp->getObject();
foreach($childCompanies as $cc){
$childCompaniesIds[] = $cc->id;
}
}else{
$childCompaniesIds[] = $cempObj->department;
}
if($this->user->user_level == 'Admin' || $subordinatesCount > 0){
$id = $req->id;
if(!empty($childCompaniesIds)) {
$childStructureSubordinates = $obj->Find("department in (" . implode(',', $childCompaniesIds) . ") and id != ?", array($cemp));
$subordinates = array_merge($subordinates, $childStructureSubordinates);
}
foreach ($subordinates as $subordinate){
if($subordinate->id == $req->id){
$id = $req->id;
break;
}
}
}else{
$subordinate = new Employee();
$subordinatesCount = $subordinate->Count("supervisor = ? and id = ?",array($profileId, $req->id));
if($this->user->user_level == 'Admin' || $subordinatesCount > 0){
$id = $req->id;
}
}
if(empty($id)){
$id = $profileId;
@@ -56,7 +100,13 @@ class EmployeesActionManager extends SubActionManager{
if(!empty($employee->joined_date)){
$employee->joined_date = date("F jS, Y",strtotime($employee->joined_date));
}
//Read custom fields
try {
$employee = BaseService::getInstance()->customFieldManager->enrichObjectCustomFields('Employee', $employee);
}catch(Exception $e){
}
if(empty($employee->id)){
return new IceResponse(IceResponse::ERROR,$employee);
@@ -98,4 +148,4 @@ class EmployeesActionManager extends SubActionManager{
}
return new IceResponse(IceResponse::SUCCESS,$user);
}
}
}

View File

@@ -166,6 +166,18 @@
</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">

View File

@@ -2,16 +2,16 @@
<!-- small box -->
<div class="small-box bg-red">
<div class="inner">
<h3>My Profile</h3>
<h3><t>My Profile</t></h3>
<p>
Edit Details
<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">
Manage Profile <i class="fa fa-arrow-circle-right"></i>
<t>View/Edit Profile</t> <i class="fa fa-arrow-circle-right"></i>
</a>
</div>
</div>
</div>

View File

@@ -54,8 +54,8 @@ path.link {
<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">My Details</a></li>
<li><a id="tabCompanyGraph" href="#tabPageCompanyGraph">Company</a></li>
<li class="active"><a id="tabEmployee" href="#tabPageEmployee"><?=LanguageManager::tran('My Details')?></a></li>
<li><a id="tabCompanyGraph" href="#tabPageCompanyGraph"><?=LanguageManager::tran('Company')?></a></li>
</ul>
<div class="tab-content">
@@ -83,4 +83,4 @@ modJsList['tabCompanyGraph'] = new CompanyGraphAdapter('CompanyStructure');
var modJs = modJsList['tabEmployee'];
</script>
<?php include APP_BASE_PATH.'footer.php';?>
<?php include APP_BASE_PATH.'footer.php';?>

View File

@@ -289,6 +289,20 @@ EmployeeAdapter.method('modEmployeeGetSuccessCallBack' , function(data) {
}
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 customFieldHtml;
for (index in data.customFields) {
customFieldHtml = ct;
customFieldHtml = customFieldHtml.replace('#_label_#', index);
customFieldHtml = customFieldHtml.replace('#_value_#', data.customFields[index]);
$("#customFields").append($(customFieldHtml));
}
}else{
$("#customFieldsCont").remove();
}
$("#"+this.getTableName()+" #subordinates").html(subordinates);

View File

@@ -28,7 +28,7 @@ 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">Loans Taken</a></li>
<li class="active"><a id="tabEmployeeCompanyLoan" href="#tabPageEmployeeCompanyLoan"><?=LanguageManager::tran('Loans Taken')?></a></li>
</ul>
<div class="tab-content">
@@ -55,4 +55,4 @@ modJsList['tabEmployeeCompanyLoan'].setShowEdit(true);
var modJs = modJsList['tabEmployeeCompanyLoan'];
</script>
<?php include APP_BASE_PATH.'footer.php';?>
<?php include APP_BASE_PATH.'footer.php';?>

View File

@@ -6,5 +6,6 @@
"Company":"fa-building",
"Training":"fa-briefcase",
"Travel Management":"fa-plane",
"Finance":"fa-money"
"Finance":"fa-money",
"User Reports":"fa-file-text"
}

View File

@@ -47,5 +47,19 @@ if (!class_exists('EmployeeProject')) {
public function getUserOnlyMeAccess(){
return array("element","save","delete");
}
public function executePreSaveActions($obj){
if(empty($obj->status)){
$obj->status = "Current";
}
return new IceResponse(IceResponse::SUCCESS,$obj);
}
public function executePreUpdateActions($obj){
if(empty($obj->status)){
$obj->status = "Current";
}
return new IceResponse(IceResponse::SUCCESS,$obj);
}
}
}

View File

@@ -1,15 +1,15 @@
<div class="col-lg-3 col-xs-12">
<!-- small box -->
<div class="small-box bg-red">
<div class="small-box bg-aqua">
<div class="inner">
<h3>My Projects</h3>
<p>Projects Assigned</p>
<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">
More info <i class="fa fa-arrow-circle-right"></i>
<t>More info</t> <i class="fa fa-arrow-circle-right"></i>
</a>
</div>
</div>
</div>

View File

@@ -28,7 +28,7 @@ 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">My Projects</a></li>
<li class="active"><a id="tabEmployeeProject" href="#tabPageEmployeeProject"><?=LanguageManager::tran('My Projects')?></a></li>
</ul>
<div class="tab-content">
@@ -61,4 +61,4 @@ modJsList['tabEmployeeProject'].setShowEdit(false);
var modJs = modJsList['tabEmployeeProject'];
</script>
<?php include APP_BASE_PATH.'footer.php';?>
<?php include APP_BASE_PATH.'footer.php';?>

View File

@@ -31,16 +31,14 @@ EmployeeProjectAdapter.inherits(AdapterBase);
EmployeeProjectAdapter.method('getDataMapping', function() {
return [
"id",
"project",
"status"
"project"
];
});
EmployeeProjectAdapter.method('getHeaders', function() {
return [
{ "sTitle": "ID" ,"bVisible":false},
{ "sTitle": "Project" },
{ "sTitle": "Status"}
{ "sTitle": "Project" }
];
});
@@ -48,7 +46,6 @@ EmployeeProjectAdapter.method('getFormFields', function() {
return [
[ "id", {"label":"ID","type":"hidden"}],
[ "project", {"label":"Project","type":"select2","remote-source":["Project","id","name"]}],
[ "status", {"label":"Status","type":"select","source":[["Current","Current"],["Inactive","Inactive"],["Completed","Completed"]]}],
[ "details", {"label":"Details","type":"textarea","validation":"none"}]
];
});

View File

@@ -28,10 +28,10 @@ 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">Skills</a></li>
<li><a id="tabEmployeeEducation" href="#tabPageEmployeeEducation">Education</a></li>
<li><a id="tabEmployeeCertification" href="#tabPageEmployeeCertification">Certifications</a></li>
<li><a id="tabEmployeeLanguage" href="#tabPageEmployeeLanguage">Languages</a></li>
<li class="active"><a id="tabEmployeeSkill" href="#tabPageEmployeeSkill"><?=LanguageManager::tran('Skills')?></a></li>
<li><a id="tabEmployeeEducation" href="#tabPageEmployeeEducation"><?=LanguageManager::tran('Education')?></a></li>
<li><a id="tabEmployeeCertification" href="#tabPageEmployeeCertification"><?=LanguageManager::tran('Certifications')?></a></li>
<li><a id="tabEmployeeLanguage" href="#tabPageEmployeeLanguage"><?=LanguageManager::tran('Languages')?></a></li>
</ul>
<div class="tab-content">
@@ -81,4 +81,4 @@ modJsList['tabEmployeeLanguage'] = new EmployeeLanguageAdapter('EmployeeLanguage
var modJs = modJsList['tabEmployeeSkill'];
</script>
<?php include APP_BASE_PATH.'footer.php';?>
<?php include APP_BASE_PATH.'footer.php';?>

View File

@@ -190,7 +190,7 @@ EmployeeLanguageAdapter.method('getFormFields', function() {
return [
[ "id", {"label":"ID","type":"hidden"}],
[ "language_id", {"label":"Language","type":"select2","allow-null":false,"remote-source":["Language","id","name"]}],
[ "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}],

View File

@@ -28,7 +28,7 @@ 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">Salary</a></li>
<li class="active"><a id="tabEmployeeSalary" href="#tabPageEmployeeSalary"><?=LanguageManager::tran('Salary')?></a></li>
</ul>
<div class="tab-content">
@@ -61,4 +61,4 @@ modJsList['tabEmployeeSalary'].setShowEdit(false);
var modJs = modJsList['tabEmployeeSalary'];
</script>
<?php include APP_BASE_PATH.'footer.php';?>
<?php include APP_BASE_PATH.'footer.php';?>

View File

@@ -145,6 +145,8 @@ if (!class_exists('EmployeeTimeSheet')) {
}
return new IceResponse(IceResponse::SUCCESS,"");
}
}
}

View File

@@ -9,8 +9,8 @@
_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> Save</button>
<button onclick="modJs.cancel();return false;" class="cancelBtn btn pull-right" style="margin-right:5px;"><i class="fa fa-times-circle-o"></i> Cancel</button>
<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>

View File

@@ -4,14 +4,14 @@
<div class="inner">
<h3>#_timeSheetHoursWorked_#</h3>
<p>
Hours worked Last Week
<t>Hours worked Last Week</t>
</p>
</div>
<div class="icon">
<i class="ion ion-clock"></i>
</div>
<a href="#_moduleLink_#" class="small-box-footer" id="timesheetLink">
Update Time Sheet <i class="fa fa-arrow-circle-right"></i>
<t>Update Time Sheet</t> <i class="fa fa-arrow-circle-right"></i>
</a>
</div>
</div>
</div>

View File

@@ -26,31 +26,13 @@ define('MODULE_PATH',dirname(__FILE__));
include APP_BASE_PATH.'header.php';
include APP_BASE_PATH.'modulejslibs.inc.php';
//custom code
$employeeProjects = array();
$allowAllProjects = $settingsManager->getSetting("Projects: Make All Projects Available to Employees");
if($allowAllProjects == 0){
$employeeProjects = array();
$employeeProjectsTemp = $baseService->get("EmployeeProject");
foreach($employeeProjectsTemp as $p){
$project = new Project();
$project->Load("id = ?",$p->project);
$p->name = $project->name;
$employeeProjects[] = $p;
}
}else{
$employeeProjects = $baseService->get("Project");
}
?><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="tabEmployeeTimeSheetAll" href="#tabPageEmployeeTimeSheetAll">All My TimeSheets</a></li>
<li class=""><a id="tabEmployeeTimeSheetApproved" href="#tabPageEmployeeTimeSheetApproved">Approved TimeSheets</a></li>
<li class=""><a id="tabEmployeeTimeSheetPending" href="#tabPageEmployeeTimeSheetPending">Pending TimeSheets</a></li>
<li class=""><a id="tabSubEmployeeTimeSheetAll" href="#tabPageSubEmployeeTimeSheetAll">Subordinate TimeSheets</a></li>
<li class="active"><a id="tabEmployeeTimeSheetAll" href="#tabPageEmployeeTimeSheetAll"><?=LanguageManager::tran('All My TimeSheets')?></a></li>
<li class=""><a id="tabEmployeeTimeSheetApproved" href="#tabPageEmployeeTimeSheetApproved"><?=LanguageManager::tran('Approved TimeSheets')?></a></li>
<li class=""><a id="tabEmployeeTimeSheetPending" href="#tabPageEmployeeTimeSheetPending"><?=LanguageManager::tran('Pending TimeSheets')?></a></li>
<li class=""><a id="tabSubEmployeeTimeSheetAll" href="#tabPageSubEmployeeTimeSheetAll"><?=LanguageManager::tran('Subordinate TimeSheets')?></a></li>
</ul>
<div class="tab-content">
@@ -110,8 +92,6 @@ modJsList['tabSubEmployeeTimeSheetAll'].setRemoteTable(true);
modJsList['tabEmployeeTimeEntry'] = new EmployeeTimeEntryAdapter('EmployeeTimeEntry','EmployeeTimeEntry','','');
modJsList['tabEmployeeTimeEntry'].setShowAddNew(false);
modJsList['tabEmployeeTimeEntry'].setAllProjectsAllowed(<?=$allowAllProjects?>);
modJsList['tabEmployeeTimeEntry'].setEmployeeProjects(<?=json_encode($employeeProjects)?>);
var modJs = modJsList['tabEmployeeTimeSheetAll'];
@@ -160,4 +140,4 @@ var modJs = modJsList['tabEmployeeTimeSheetAll'];
</div>
</div>
<?php include APP_BASE_PATH.'footer.php';?>
<?php include APP_BASE_PATH.'footer.php';?>

View File

@@ -464,13 +464,10 @@ EmployeeTimeEntryAdapter.method('getHeaders', function() {
EmployeeTimeEntryAdapter.method('getFormFields', function() {
return [
[ "id", {"label":"ID","type":"hidden"}],
[ "project", {"label":"Project","type":"select2","allow-null":true,"remote-source":["Project","id","name"]}],
//[ "project", {"label":"Project","type":"select","source":[]}],
[ "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":""}],
/*[ "time_start", {"label":"Start Time","type":"time"}],*/
[ "date_end", {"label":"End Time","type":"time","validation":""}],
/*[ "time_end", {"label":"End Time","type":"time"}],*/
[ "details", {"label":"Details","type":"textarea","validation":""}]
];
});
@@ -567,7 +564,8 @@ EmployeeTimeEntryAdapter.method('renderForm', function(object) {
$("#"+this.getTableName()+'Form .select2Field').select2();
$("#date_select").html(optionList);
/*
var projectOptionList = "";
projectOptionList += '<option value="NULL">None</option>';
if(this.allProjectsAllowed == 0){
@@ -581,7 +579,8 @@ EmployeeTimeEntryAdapter.method('renderForm', function(object) {
}
$("#project").html(projectOptionList);
*/
if(object != undefined && object != null){
this.fillForm(object);
}

View File

@@ -17,7 +17,7 @@
</tbody>
</table>
<div class="control-group">
<button id="add_time_sheet_entry" style="margin-left:5px;display:none;" onclick="try{modJs.openTimeEntryDialog()}catch(e){};return false;" class="btn"><span class="icon-plus-sign"></span> Add Time Entry</button>
<button id="submit_sheet" onclick="modJs.changeTimeSheetStatusWithId(modJs.currentId,'Submitted');return false;" class="btn" style="display:none;"><span class="icon-ok"></span> Submit Timesheet</button>
<button id="add_time_sheet_entry" style="margin-left:5px;display:none;" onclick="try{modJs.openTimeEntryDialog()}catch(e){};return false;" class="btn"><span class="icon-plus-sign"></span> <t>Add Time Entry</t></button>
<button id="submit_sheet" onclick="modJs.changeTimeSheetStatusWithId(modJs.currentId,'Submitted');return false;" class="btn" style="display:none;"><span class="icon-ok"></span> <t>Submit</t></button>
</div>
</form>
</form>

View File

@@ -14,46 +14,6 @@ class TravelActionManager extends ApproveModuleActionManager{
}
public function getModuleTabUrl(){
return "g=admin&n=travel&m=admin_Employees#tabEmployeeTravelRecord";
return "g=modules&n=travel&m=module_Travel_Management#tabSubordinateEmployeeTravelRecord";
}
}
/*
class TravelActionManager extends SubActionManager{
public function cancelTravel($req){
$employee = $this->baseService->getElement('Employee',$this->getCurrentProfileId(),null,true);
$employeeTravel = new EmployeeTravelRecord();
$employeeTravel->Load("id = ?",array($req->id));
if($employeeTravel->id != $req->id){
return new IceResponse(IceResponse::ERROR,"Travel record not found");
}
if($this->user->user_level != 'Admin' && $this->getCurrentProfileId() != $employeeTravel->employee){
return new IceResponse(IceResponse::ERROR,"Only an admin or owner of the travel request can do this");
}
if($employeeTravel->status != 'Approved'){
return new IceResponse(IceResponse::ERROR,"Only an approved travel request can be cancelled");
}
$employeeTravel->status = 'Cancellation Requested';
$ok = $employeeTravel->Save();
if(!$ok){
LogManager::getInstance()->error("Error occured while cancelling the travel:".$employeeTravel->ErrorMsg());
return new IceResponse(IceResponse::ERROR,"Error occurred while cancelling the travel request. Please contact admin.");
}
$this->baseService->audit(IceConstants::AUDIT_ACTION, "Travel cancellation \ start:".$employeeTravel->date_start."\ end:".$employeeTravel->date_end);
$notificationMsg = $employee->first_name." ".$employee->last_name." cancelled a travel. Visit travel management module to approve";
$this->baseService->notificationManager->addNotification($employee->supervisor,$notificationMsg,'{"type":"url","url":"g=admin&n=travel&m=admin_Employees#tabEmployeeTravelRecord"}',
"Travel Module", null, false, true);
return new IceResponse(IceResponse::SUCCESS,$employeeTravel);
}
}
*/

View File

@@ -2,16 +2,16 @@
<!-- small box -->
<div class="small-box bg-aqua">
<div class="inner">
<h3>My Travel</h3>
<h3><t>My Travel</t></h3>
<p>
Management
<t>Management</t>
</p>
</div>
<div class="icon">
<i class="ion ion-plane"></i>
</div>
<a href="#_moduleLink_#" class="small-box-footer" id="mytravelLink">
Travel Management <i class="fa fa-arrow-circle-right"></i>
<t>Travel Management</t> <i class="fa fa-arrow-circle-right"></i>
</a>
</div>
</div>
</div>

View File

@@ -22,15 +22,25 @@ Developer: Thilina Hasantha (thilina.hasantha[at]gmail.com / facebook.com/thilin
*/
$moduleName = 'travel';
$moduleMainName = "EmployeeTravelRecord";
$moduleItemName = "Travel Request";
$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?>">Travel Requests</a></li>
<li class="active"><a id="tab<?=$moduleMainName?>" href="#tabPage<?=$moduleMainName?>"><?=LanguageManager::tran('Travel Requests')?></a></li>
<li class=""><a id="tab<?=$subModuleMainName?>" href="#tabPage<?=$subModuleMainName?>"><?=LanguageManager::tran('Subordinate Travel Requests')?></a></li>
<li class=""><a id="tab<?=$appModName?>" href="#tabPage<?=$appModName?>"><?=LanguageManager::tran('Travel Request Approval')?></a></li>
</ul>
<div class="tab-content">
@@ -40,6 +50,22 @@ include APP_BASE_PATH.'modulejslibs.inc.php';
</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>
@@ -60,7 +86,18 @@ include APP_BASE_PATH.'modulejslibs.inc.php';
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';?>
<?php include APP_BASE_PATH.'footer.php';?>

View File

@@ -51,11 +51,14 @@ EmployeeImmigrationAdapter.method('getFormFields', function() {
function EmployeeTravelRecordAdapter(endPoint) {
this.initAdapter(endPoint);
function EmployeeTravelRecordAdapter(endPoint,tab,filter,orderBy) {
this.initAdapter(endPoint,tab,filter,orderBy);
this.itemName = 'Travel';
this.itemNameLower = 'employeetravelrecord';
this.modulePathName = 'travel';
}
EmployeeTravelRecordAdapter.inherits(AdapterBase);
EmployeeTravelRecordAdapter.inherits(ApproveModuleAdapter);
@@ -103,6 +106,7 @@ EmployeeTravelRecordAdapter.method('getFormFields', function() {
];
});
/*
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>';
@@ -155,4 +159,72 @@ EmployeeTravelRecordAdapter.method('cancelSuccessCallBack', function(callBackDat
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);