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

73
admin/jobs/index.php Normal file
View File

@@ -0,0 +1,73 @@
<?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 = 'jobs';
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="tabJobTitles" href="#tabPageJobTitles"><?=t('Job Titles')?></a></li>
<li><a id="tabPayGrades" href="#tabPagePayGrades"><?=t('Pay Grades')?></a></li>
<li><a id="tabEmploymentStatus" href="#tabPageEmploymentStatus"><?=t('Employment Status')?></a></li>
</ul>
<div class="tab-content">
<div class="tab-pane active" id="tabPageJobTitles">
<div id="JobTitle" class="reviewBlock" data-content="List" style="padding-left:5px;">
</div>
<div id="JobTitleForm" class="reviewBlock" data-content="Form" style="padding-left:5px;display:none;">
</div>
</div>
<div class="tab-pane" id="tabPagePayGrades">
<div id="PayGrade" class="reviewBlock" data-content="List" style="padding-left:5px;">
</div>
<div id="PayGradeForm" class="reviewBlock" data-content="Form" style="padding-left:5px;display:none;">
</div>
</div>
<div class="tab-pane" id="tabPageEmploymentStatus">
<div id="EmploymentStatus" class="reviewBlock" data-content="List" style="padding-left:5px;">
</div>
<div id="EmploymentStatusForm" class="reviewBlock" data-content="Form" style="padding-left:5px;display:none;">
</div>
</div>
</div>
</div>
<script>
var modJsList = new Array();
modJsList['tabJobTitles'] = new JobTitleAdapter('JobTitle');
modJsList['tabPayGrades'] = new PayGradeAdapter('PayGrade');
modJsList['tabEmploymentStatus'] = new EmploymentStatusAdapter('EmploymentStatus');
var modJs = modJsList['tabJobTitles'];
</script>
<?php include APP_BASE_PATH.'footer.php';?>

139
admin/jobs/lib.js Normal file
View File

@@ -0,0 +1,139 @@
/**
* Author: Thilina Hasantha
*/
/**
* JobTitleAdapter
*/
function JobTitleAdapter(endPoint) {
this.initAdapter(endPoint);
}
JobTitleAdapter.inherits(AdapterBase);
JobTitleAdapter.method('getDataMapping', function() {
return [
"id",
"code",
"name"
];
});
JobTitleAdapter.method('getHeaders', function() {
return [
{ "sTitle": "ID" ,"bVisible":false},
{ "sTitle": "Code" },
{ "sTitle": "Name" }
];
});
JobTitleAdapter.method('getFormFields', function() {
return [
[ "id", {"label":"ID","type":"hidden"}],
[ "code", {"label":"Job Title Code","type":"text"}],
[ "name", {"label":"Job Title","type":"text"}],
[ "description", {"label":"Description","type":"textarea"}],
[ "specification", {"label":"Specification","type":"textarea"}]
];
});
JobTitleAdapter.method('getHelpLink', function () {
return 'http://blog.icehrm.com/docs/jobdetails/';
});
/**
* PayGradeAdapter
*/
function PayGradeAdapter(endPoint) {
this.initAdapter(endPoint);
}
PayGradeAdapter.inherits(AdapterBase);
PayGradeAdapter.method('getDataMapping', function() {
return [
"id",
"name",
"currency",
"min_salary",
"max_salary"
];
});
PayGradeAdapter.method('getHeaders', function() {
return [
{ "sTitle": "ID" ,"bVisible":false},
{ "sTitle": "Name" },
{ "sTitle": "Currency"},
{ "sTitle": "Min Salary" },
{ "sTitle": "Max Salary"}
];
});
PayGradeAdapter.method('getFormFields', function() {
return [
[ "id", {"label":"ID","type":"hidden"}],
[ "name", {"label":"Pay Grade Name","type":"text"}],
[ "currency", {"label":"Currency","type":"select2","remote-source":["CurrencyType","code","name"]}],
[ "min_salary", {"label":"Min Salary","type":"text","validation":"float"}],
[ "max_salary", {"label":"Max Salary","type":"text","validation":"float"}]
];
});
PayGradeAdapter.method('doCustomValidation', function(params) {
try{
if(parseFloat(params.min_salary)>parseFloat(params.max_salary)){
return "Min Salary should be smaller than Max Salary";
}
}catch(e){
}
return null;
});
/**
* EmploymentStatusAdapter
*/
function EmploymentStatusAdapter(endPoint) {
this.initAdapter(endPoint);
}
EmploymentStatusAdapter.inherits(AdapterBase);
EmploymentStatusAdapter.method('getDataMapping', function() {
return [
"id",
"name",
"description"
];
});
EmploymentStatusAdapter.method('getHeaders', function() {
return [
{ "sTitle": "ID" },
{ "sTitle": "Name" },
{ "sTitle": "Description"}
];
});
EmploymentStatusAdapter.method('getFormFields', function() {
return [
[ "id", {"label":"ID","type":"hidden"}],
[ "name", {"label":"Employment Status","type":"text"}],
[ "description", {"label":"Description","type":"textarea","validation":""}]
];
});

12
admin/jobs/meta.json Normal file
View File

@@ -0,0 +1,12 @@
{
"label": "Job Details Setup",
"menu": "Admin",
"order": "3",
"icon": "fa-columns",
"user_levels": [
"Admin"
],
"permissions": [],
"model_namespace": "\\Jobs\\Common\\Model",
"manager": "\\Jobs\\Admin\\Api\\JobsAdminManager"
}