Split clients and projects modules
This commit is contained in:
51
core/admin/clients/index.php
Normal file
51
core/admin/clients/index.php
Normal file
@@ -0,0 +1,51 @@
|
|||||||
|
<?php
|
||||||
|
/*
|
||||||
|
Copyright (c) 2020 [Glacies UG, Berlin, Germany] (http://glacies.de)
|
||||||
|
Developer: Thilina Hasantha (http://lk.linkedin.com/in/thilinah | https://github.com/thilinah)
|
||||||
|
*/
|
||||||
|
|
||||||
|
$moduleName = 'clients';
|
||||||
|
$moduleGroup = 'admin';
|
||||||
|
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>
|
||||||
|
</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>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
<script>
|
||||||
|
var modJsList = [];
|
||||||
|
|
||||||
|
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 }?>
|
||||||
|
|
||||||
|
|
||||||
|
var modJs = modJsList['tabClient'];
|
||||||
|
|
||||||
|
</script>
|
||||||
|
<?php include APP_BASE_PATH.'footer.php';?>
|
||||||
20
core/admin/clients/meta.json
Normal file
20
core/admin/clients/meta.json
Normal file
@@ -0,0 +1,20 @@
|
|||||||
|
{
|
||||||
|
"label": "Clients",
|
||||||
|
"menu": "Admin",
|
||||||
|
"order": "52",
|
||||||
|
"icon": "fa-user-circle",
|
||||||
|
"user_levels": [
|
||||||
|
"Admin",
|
||||||
|
"Manager"
|
||||||
|
],
|
||||||
|
"dashboardPosition": 4,
|
||||||
|
"permissions": {
|
||||||
|
"Manager": {
|
||||||
|
"Add Clients": "Yes",
|
||||||
|
"Edit Clients": "Yes",
|
||||||
|
"Delete Clients": "No"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"model_namespace": "\\Clients\\Common\\Model",
|
||||||
|
"manager": "\\Clients\\Admin\\Api\\ClientsAdminManager"
|
||||||
|
}
|
||||||
26
core/src/Clients/Admin/Api/ClientsAdminManager.php
Normal file
26
core/src/Clients/Admin/Api/ClientsAdminManager.php
Normal file
@@ -0,0 +1,26 @@
|
|||||||
|
<?php
|
||||||
|
namespace Clients\Admin\Api;
|
||||||
|
|
||||||
|
use Classes\AbstractModuleManager;
|
||||||
|
|
||||||
|
class ClientsAdminManager extends AbstractModuleManager
|
||||||
|
{
|
||||||
|
|
||||||
|
public function initializeUserClasses()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
public function initializeFieldMappings()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
public function initializeDatabaseErrorMappings()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
public function setupModuleClassDefinitions()
|
||||||
|
{
|
||||||
|
|
||||||
|
$this->addModelClass('Client');
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -6,8 +6,9 @@
|
|||||||
* Time: 5:53 PM
|
* Time: 5:53 PM
|
||||||
*/
|
*/
|
||||||
|
|
||||||
namespace Projects\Common\Model;
|
namespace Clients\Common\Model;
|
||||||
|
|
||||||
|
use Classes\ModuleAccess;
|
||||||
use Model\BaseModel;
|
use Model\BaseModel;
|
||||||
|
|
||||||
class Client extends BaseModel
|
class Client extends BaseModel
|
||||||
@@ -22,4 +23,11 @@ class Client extends BaseModel
|
|||||||
{
|
{
|
||||||
return array("get","element","save","delete");
|
return array("get","element","save","delete");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function getModuleAccess()
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
new ModuleAccess('clients', 'admin'),
|
||||||
|
];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -154,6 +154,7 @@ gulp.task('admin-js', (done) => {
|
|||||||
let files = [
|
let files = [
|
||||||
'attendance',
|
'attendance',
|
||||||
'company_structure',
|
'company_structure',
|
||||||
|
'clients',
|
||||||
'dashboard',
|
'dashboard',
|
||||||
'data',
|
'data',
|
||||||
'documents',
|
'documents',
|
||||||
|
|||||||
2
web/admin/dist/clients.js
vendored
Normal file
2
web/admin/dist/clients.js
vendored
Normal file
File diff suppressed because one or more lines are too long
5
web/admin/src/clients/index.js
Normal file
5
web/admin/src/clients/index.js
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
import {
|
||||||
|
ClientAdapter,
|
||||||
|
} from './lib';
|
||||||
|
|
||||||
|
window.ClientAdapter = ClientAdapter;
|
||||||
67
web/admin/src/clients/lib.js
Normal file
67
web/admin/src/clients/lib.js
Normal file
@@ -0,0 +1,67 @@
|
|||||||
|
/*
|
||||||
|
Copyright (c) 2018 [Glacies UG, Berlin, Germany] (http://glacies.de)
|
||||||
|
Developer: Thilina Hasantha (http://lk.linkedin.com/in/thilinah | https://github.com/thilinah)
|
||||||
|
*/
|
||||||
|
|
||||||
|
import AdapterBase from '../../../api/AdapterBase';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* ClientAdapter
|
||||||
|
*/
|
||||||
|
|
||||||
|
class ClientAdapter extends AdapterBase {
|
||||||
|
getDataMapping() {
|
||||||
|
return [
|
||||||
|
'id',
|
||||||
|
'name',
|
||||||
|
'details',
|
||||||
|
'address',
|
||||||
|
'contact_number',
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
getHeaders() {
|
||||||
|
return [
|
||||||
|
{ sTitle: 'ID', bVisible: false },
|
||||||
|
{ sTitle: 'Name' },
|
||||||
|
{ sTitle: 'Details' },
|
||||||
|
{ sTitle: 'Address' },
|
||||||
|
{ sTitle: 'Contact Number' },
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
getFormFields() {
|
||||||
|
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' }],
|
||||||
|
];
|
||||||
|
}
|
||||||
|
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' }],
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
getHelpLink() {
|
||||||
|
return 'http://blog.icehrm.com/docs/projects/';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
module.exports = {
|
||||||
|
ClientAdapter,
|
||||||
|
};
|
||||||
Reference in New Issue
Block a user