Refactoring
This commit is contained in:
17
admin/projects/dashboard.html
Normal file
17
admin/projects/dashboard.html
Normal file
@@ -0,0 +1,17 @@
|
||||
<div class="col-lg-3 col-xs-12">
|
||||
|
||||
<div class="small-box bg-red">
|
||||
<div class="inner">
|
||||
<h3><t>Projects</t></h3>
|
||||
<p id="numberOfProjects">
|
||||
#_numberOfProjects_# <t>Active Projects</t>
|
||||
</p>
|
||||
</div>
|
||||
<div class="icon">
|
||||
<i class="ion ion-pie-graph"></i>
|
||||
</div>
|
||||
<a href="#_moduleLink_#" class="small-box-footer" id="projectsLink">
|
||||
<t>Update Clients/Projects</t> <i class="fa fa-arrow-circle-right"></i>
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
113
admin/projects/index.php
Normal file
113
admin/projects/index.php
Normal file
@@ -0,0 +1,113 @@
|
||||
<?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="tabClient" href="#tabPageClient"><?=t('Clients')?></a></li>
|
||||
<li><a id="tabProject" href="#tabPageProject"><?=t('Projects')?></a></li>
|
||||
<li><a id="tabEmployeeProject" href="#tabPageEmployeeProject"><?=t('Employee Projects')?></a></li>
|
||||
</ul>
|
||||
|
||||
<div class="tab-content">
|
||||
<div class="tab-pane active" id="tabPageClient">
|
||||
<div id="Client" class="reviewBlock" data-content="List" style="padding-left:5px;">
|
||||
|
||||
</div>
|
||||
<div id="ClientForm" class="reviewBlock" data-content="Form" style="padding-left:5px;display:none;">
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<div class="tab-pane" id="tabPageProject">
|
||||
<div id="Project" class="reviewBlock" data-content="List" style="padding-left:5px;">
|
||||
|
||||
</div>
|
||||
<div id="ProjectForm" class="reviewBlock" data-content="Form" style="padding-left:5px;display:none;">
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<div class="tab-pane" 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['tabClient'] = new ClientAdapter('Client','Client');
|
||||
|
||||
<?php if(isset($modulePermissions['perm']['Add Clients']) && $modulePermissions['perm']['Add Clients'] == "No"){?>
|
||||
modJsList['tabClient'].setShowAddNew(false);
|
||||
<?php }?>
|
||||
|
||||
<?php if(isset($modulePermissions['perm']['Delete Clients']) && $modulePermissions['perm']['Delete Clients'] == "No"){?>
|
||||
modJsList['tabClient'].setShowDelete(false);
|
||||
<?php }?>
|
||||
|
||||
<?php if(isset($modulePermissions['perm']['Edit Clients']) && $modulePermissions['perm']['Edit Clients'] == "No"){?>
|
||||
modJsList['tabClient'].setShowSave(false);
|
||||
<?php }?>
|
||||
|
||||
modJsList['tabProject'] = new ProjectAdapter('Project','Project');
|
||||
|
||||
<?php if(isset($modulePermissions['perm']['Add Projects']) && $modulePermissions['perm']['Add Projects'] == "No"){?>
|
||||
modJsList['tabProject'].setShowAddNew(false);
|
||||
<?php }?>
|
||||
|
||||
<?php if(isset($modulePermissions['perm']['Delete Projects']) && $modulePermissions['perm']['Delete Projects'] == "No"){?>
|
||||
modJsList['tabProject'].setShowDelete(false);
|
||||
<?php }?>
|
||||
|
||||
<?php if(isset($modulePermissions['perm']['Edit Projects']) && $modulePermissions['perm']['Edit Projects'] == "No"){?>
|
||||
modJsList['tabProject'].setShowSave(false);
|
||||
<?php }?>
|
||||
|
||||
|
||||
modJsList['tabEmployeeProject'] = new EmployeeProjectAdapter('EmployeeProject','EmployeeProject');
|
||||
modJsList['tabEmployeeProject'].setRemoteTable(true);
|
||||
|
||||
<?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['tabClient'];
|
||||
|
||||
</script>
|
||||
<?php include APP_BASE_PATH.'footer.php';?>
|
||||
172
admin/projects/lib.js
Normal file
172
admin/projects/lib.js
Normal file
@@ -0,0 +1,172 @@
|
||||
/**
|
||||
* Author: Thilina Hasantha
|
||||
*/
|
||||
|
||||
/**
|
||||
* ClientAdapter
|
||||
*/
|
||||
|
||||
function ClientAdapter(endPoint,tab,filter,orderBy) {
|
||||
this.initAdapter(endPoint,tab,filter,orderBy);
|
||||
}
|
||||
|
||||
ClientAdapter.inherits(AdapterBase);
|
||||
|
||||
|
||||
|
||||
ClientAdapter.method('getDataMapping', function() {
|
||||
return [
|
||||
"id",
|
||||
"name",
|
||||
"details",
|
||||
"address",
|
||||
"contact_number"
|
||||
];
|
||||
});
|
||||
|
||||
ClientAdapter.method('getHeaders', function() {
|
||||
return [
|
||||
{ "sTitle": "ID","bVisible":false },
|
||||
{ "sTitle": "Name" },
|
||||
{ "sTitle": "Details"},
|
||||
{ "sTitle": "Address"},
|
||||
{ "sTitle": "Contact Number"}
|
||||
];
|
||||
});
|
||||
|
||||
ClientAdapter.method('getFormFields', function() {
|
||||
if(this.showSave){
|
||||
return [
|
||||
[ "id", {"label":"ID","type":"hidden"}],
|
||||
[ "name", {"label":"Name","type":"text"}],
|
||||
[ "details", {"label":"Details","type":"textarea","validation":"none"}],
|
||||
[ "address", {"label":"Address","type":"textarea","validation":"none"}],
|
||||
[ "contact_number", {"label":"Contact Number","type":"text","validation":"none"}],
|
||||
[ "contact_email", {"label":"Contact Email","type":"text","validation":"none"}],
|
||||
[ "company_url", {"label":"Company Url","type":"text","validation":"none"}],
|
||||
[ "status", {"label":"Status","type":"select","source":[["Active","Active"],["Inactive","Inactive"]]}],
|
||||
[ "first_contact_date", {"label":"First Contact Date","type":"date","validation":"none"}]
|
||||
];
|
||||
}else{
|
||||
return [
|
||||
[ "id", {"label":"ID","type":"hidden"}],
|
||||
[ "name", {"label":"Name","type":"placeholder"}],
|
||||
[ "details", {"label":"Details","type":"placeholder","validation":"none"}],
|
||||
[ "address", {"label":"Address","type":"placeholder","validation":"none"}],
|
||||
[ "contact_number", {"label":"Contact Number","type":"placeholder","validation":"none"}],
|
||||
[ "contact_email", {"label":"Contact Email","type":"placeholder","validation":"none"}],
|
||||
[ "company_url", {"label":"Company Url","type":"placeholder","validation":"none"}],
|
||||
[ "status", {"label":"Status","type":"placeholder","source":[["Active","Active"],["Inactive","Inactive"]]}],
|
||||
[ "first_contact_date", {"label":"First Contact Date","type":"placeholder","validation":"none"}]
|
||||
];
|
||||
}
|
||||
});
|
||||
|
||||
ClientAdapter.method('getHelpLink', function () {
|
||||
return 'http://blog.icehrm.com/docs/projects/';
|
||||
});
|
||||
|
||||
/**
|
||||
* ProjectAdapter
|
||||
*/
|
||||
|
||||
function ProjectAdapter(endPoint,tab,filter,orderBy) {
|
||||
this.initAdapter(endPoint,tab,filter,orderBy);
|
||||
}
|
||||
|
||||
ProjectAdapter.inherits(AdapterBase);
|
||||
|
||||
|
||||
|
||||
ProjectAdapter.method('getDataMapping', function() {
|
||||
return [
|
||||
"id",
|
||||
"name",
|
||||
"client"
|
||||
];
|
||||
});
|
||||
|
||||
ProjectAdapter.method('getHeaders', function() {
|
||||
return [
|
||||
{ "sTitle": "ID","bVisible":false },
|
||||
{ "sTitle": "Name" },
|
||||
{ "sTitle": "Client"},
|
||||
];
|
||||
});
|
||||
|
||||
ProjectAdapter.method('getFormFields', function() {
|
||||
|
||||
if(this.showSave){
|
||||
return [
|
||||
[ "id", {"label":"ID","type":"hidden"}],
|
||||
[ "name", {"label":"Name","type":"text"}],
|
||||
[ "client", {"label":"Client","type":"select2","allow-null":true,"remote-source":["Client","id","name"]}],
|
||||
[ "details", {"label":"Details","type":"textarea","validation":"none"}],
|
||||
[ "status", {"label":"Status","type":"select","source":[["Active","Active"],["On Hold","On Hold"],["Completed","Completed"],["Dropped","Dropped"]]}]
|
||||
];
|
||||
}else{
|
||||
return [
|
||||
[ "id", {"label":"ID","type":"hidden"}],
|
||||
[ "name", {"label":"Name","type":"placeholder"}],
|
||||
[ "client", {"label":"Client","type":"placeholder","allow-null":true,"remote-source":["Client","id","name"]}],
|
||||
[ "details", {"label":"Details","type":"placeholder","validation":"none"}],
|
||||
[ "status", {"label":"Status","type":"select","source":[["Active","Active"],["On Hold","On Hold"],["Completed","Completed"],["Dropped","Dropped"]]}]
|
||||
];
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
ProjectAdapter.method('getHelpLink', function () {
|
||||
return 'http://blog.icehrm.com/docs/projects/';
|
||||
});
|
||||
|
||||
|
||||
/*
|
||||
* EmployeeProjectAdapter
|
||||
*/
|
||||
|
||||
|
||||
function EmployeeProjectAdapter(endPoint) {
|
||||
this.initAdapter(endPoint);
|
||||
}
|
||||
|
||||
EmployeeProjectAdapter.inherits(AdapterBase);
|
||||
|
||||
|
||||
|
||||
EmployeeProjectAdapter.method('getDataMapping', function() {
|
||||
return [
|
||||
"id",
|
||||
"employee",
|
||||
"project"
|
||||
];
|
||||
});
|
||||
|
||||
EmployeeProjectAdapter.method('getHeaders', function() {
|
||||
return [
|
||||
{ "sTitle": "ID" ,"bVisible":false},
|
||||
{ "sTitle": "Employee" },
|
||||
{ "sTitle": "Project" }
|
||||
];
|
||||
});
|
||||
|
||||
EmployeeProjectAdapter.method('getFormFields', function() {
|
||||
return [
|
||||
[ "id", {"label":"ID","type":"hidden"}],
|
||||
[ "employee", {"label":"Employee","type":"select2","remote-source":["Employee","id","first_name+last_name"]}],
|
||||
[ "project", {"label":"Project","type":"select2","remote-source":["Project","id","name"]}],
|
||||
[ "details", {"label":"Details","type":"textarea","validation":"none"}]
|
||||
];
|
||||
});
|
||||
|
||||
EmployeeProjectAdapter.method('getFilters', function() {
|
||||
return [
|
||||
[ "employee", {"label":"Employee","type":"select2","remote-source":["Employee","id","first_name+last_name"]}]
|
||||
|
||||
];
|
||||
});
|
||||
|
||||
EmployeeProjectAdapter.method('getHelpLink', function () {
|
||||
return 'http://blog.icehrm.com/docs/projects/';
|
||||
});
|
||||
|
||||
23
admin/projects/meta.json
Normal file
23
admin/projects/meta.json
Normal file
@@ -0,0 +1,23 @@
|
||||
{
|
||||
"label": "Projects\/Client Setup",
|
||||
"menu": "Admin",
|
||||
"order": "51",
|
||||
"icon": "fa-list-alt",
|
||||
"user_levels": [
|
||||
"Admin",
|
||||
"Manager"
|
||||
],
|
||||
"dashboardPosition": 4,
|
||||
"permissions": {
|
||||
"Manager": {
|
||||
"Add Projects": "Yes",
|
||||
"Edit Projects": "Yes",
|
||||
"Delete Projects": "No",
|
||||
"Add Clients": "Yes",
|
||||
"Edit Clients": "Yes",
|
||||
"Delete Clients": "No"
|
||||
}
|
||||
},
|
||||
"model_namespace": "\\Projects\\Common\\Model",
|
||||
"manager": "\\Projects\\Admin\\Api\\ProjectsAdminManager"
|
||||
}
|
||||
Reference in New Issue
Block a user