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

64
admin/loans/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 = 'CompanyLoans';
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="tabCompanyLoan" href="#tabPageCompanyLoan"><?=t('Loan Types')?></a></li>
<li><a id="tabEmployeeCompanyLoan" href="#tabPageEmployeeCompanyLoan"><?=t('Employee Loans')?></a></li>
</ul>
<div class="tab-content">
<div class="tab-pane active" id="tabPageCompanyLoan">
<div id="CompanyLoan" class="reviewBlock" data-content="List" style="padding-left:5px;">
</div>
<div id="CompanyLoanForm" class="reviewBlock" data-content="Form" style="padding-left:5px;display:none;">
</div>
</div>
<div class="tab-pane" 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['tabCompanyLoan'] = new CompanyLoanAdapter('CompanyLoan','CompanyLoan');
modJsList['tabEmployeeCompanyLoan'] = new EmployeeCompanyLoanAdapter('EmployeeCompanyLoan','EmployeeCompanyLoan');
var modJs = modJsList['tabCompanyLoan'];
</script>
<?php include APP_BASE_PATH.'footer.php';?>

102
admin/loans/lib.js Normal file
View File

@@ -0,0 +1,102 @@
/**
* Author: Thilina Hasantha
*/
/**
* CompanyLoanAdapter
*/
function CompanyLoanAdapter(endPoint) {
this.initAdapter(endPoint);
}
CompanyLoanAdapter.inherits(AdapterBase);
CompanyLoanAdapter.method('getDataMapping', function() {
return [
"id",
"name",
"details"
];
});
CompanyLoanAdapter.method('getHeaders', function() {
return [
{ "sTitle": "ID" ,"bVisible":false},
{ "sTitle": "Name" },
{ "sTitle": "Details"}
];
});
CompanyLoanAdapter.method('getFormFields', function() {
return [
[ "id", {"label":"ID","type":"hidden"}],
[ "name", {"label":"Name","type":"text","validation":""}],
[ "details", {"label":"Details","type":"textarea","validation":"none"}]
];
});
/*
* EmployeeCompanyLoanAdapter
*/
function EmployeeCompanyLoanAdapter(endPoint) {
this.initAdapter(endPoint);
}
EmployeeCompanyLoanAdapter.inherits(AdapterBase);
EmployeeCompanyLoanAdapter.method('getDataMapping', function() {
return [
"id",
"employee",
"loan",
"start_date",
"period_months",
"currency",
"amount",
"status"
];
});
EmployeeCompanyLoanAdapter.method('getHeaders', function() {
return [
{ "sTitle": "ID" ,"bVisible":false},
{ "sTitle": "Employee" },
{ "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"}],
[ "employee", {"label":"Employee","type":"select2","remote-source":["Employee","id","first_name+last_name"]}],
[ "loan", {"label":"Loan Type","type":"select","remote-source":["CompanyLoan","id","name"]}],
[ "start_date", {"label":"Loan Start Date","type":"date","validation":""}],
[ "last_installment_date", {"label":"Last Installment Date","type":"date","validation":"none"}],
[ "period_months", {"label":"Loan Period (Months)","type":"text","validation":"number"}],
[ "currency", {"label":"Currency","type":"select2","remote-source":["CurrencyType","id","name"]}],
[ "amount", {"label":"Loan Amount","type":"text","validation":"float"}],
[ "monthly_installment", {"label":"Monthly Installment","type":"text","validation":"float"}],
[ "status", {"label":"Status","type":"select","source":[["Approved","Approved"],["Paid","Paid"],["Suspended","Suspended"]]}],
[ "details", {"label":"Details","type":"textarea","validation":"none"}]
];
});
EmployeeCompanyLoanAdapter.method('getFilters', function() {
return [
[ "employee", {"label":"Employee","type":"select2","allow-null":true,"null-label":"All Employees","remote-source":["Employee","id","first_name+last_name"]}],
[ "loan", {"label":"Loan Type","type":"select","allow-null":true,"null-label":"All Loan Types","remote-source":["CompanyLoan","id","name"]}],
];
});

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

@@ -0,0 +1,12 @@
{
"label": "Company Loans",
"menu": "Admin",
"order": "81",
"icon": "fa-shield",
"user_levels": [
"Admin"
],
"permissions": [],
"model_namespace": "\\Loans\\Common\\Model",
"manager": "\\Loans\\Admin\\Api\\LoansAdminManager"
}