mirror of
https://github.com/Karaka-Management/oms-Organization.git
synced 2026-01-28 07:38:41 +00:00
Merge remote-tracking branch 'origin/develop' into develop
# Conflicts: # Draw/Controller.js # Draw/Models/DrawType.enum.js # Draw/Models/Editor.js # Media/Models/UploadFile.php
This commit is contained in:
commit
2de2b27a1c
|
|
@ -2,7 +2,7 @@
|
|||
/**
|
||||
* Orange Management
|
||||
*
|
||||
* PHP Version 7.0
|
||||
* PHP Version 7.1
|
||||
*
|
||||
* @category TBD
|
||||
* @package TBD
|
||||
|
|
@ -16,7 +16,7 @@
|
|||
namespace Modules\Organization\Admin;
|
||||
|
||||
|
||||
use phpOMS\DataStorage\Database\Pool;
|
||||
use phpOMS\DataStorage\Database\DatabasePool;
|
||||
use phpOMS\Module\ActivateAbstract;
|
||||
use phpOMS\Module\InfoManager;
|
||||
|
||||
|
|
@ -37,7 +37,7 @@ class Activate extends ActivateAbstract
|
|||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public static function activate(Pool $dbPool, InfoManager $info)
|
||||
public static function activate(DatabasePool $dbPool, InfoManager $info)
|
||||
{
|
||||
parent::activate($dbPool, $info);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
/**
|
||||
* Orange Management
|
||||
*
|
||||
* PHP Version 7.0
|
||||
* PHP Version 7.1
|
||||
*
|
||||
* @category TBD
|
||||
* @package TBD
|
||||
|
|
@ -16,7 +16,7 @@
|
|||
namespace Modules\Organization\Admin;
|
||||
|
||||
|
||||
use phpOMS\DataStorage\Database\Pool;
|
||||
use phpOMS\DataStorage\Database\DatabasePool;
|
||||
use phpOMS\Module\DeactivateAbstract;
|
||||
use phpOMS\Module\InfoManager;
|
||||
|
||||
|
|
@ -37,7 +37,7 @@ class Deactivate extends DeactivateAbstract
|
|||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public static function deactivate(Pool $dbPool, InfoManager $info)
|
||||
public static function deactivate(DatabasePool $dbPool, InfoManager $info)
|
||||
{
|
||||
parent::deactivate($dbPool, $info);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
/**
|
||||
* Orange Management
|
||||
*
|
||||
* PHP Version 7.0
|
||||
* PHP Version 7.1
|
||||
*
|
||||
* @category TBD
|
||||
* @package TBD
|
||||
|
|
@ -14,7 +14,7 @@
|
|||
* @link http://orange-management.com
|
||||
*/
|
||||
namespace Modules\Organization\Admin\Install;
|
||||
use phpOMS\DataStorage\Database\Pool;
|
||||
use phpOMS\DataStorage\Database\DatabasePool;
|
||||
|
||||
/**
|
||||
* Navigation class.
|
||||
|
|
@ -32,7 +32,7 @@ class Navigation
|
|||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public static function install(Pool $dbPool)
|
||||
public static function install(string $path, DatabasePool $dbPool)
|
||||
{
|
||||
$navData = json_decode(file_get_contents(__DIR__ . '/Navigation.install.json'), true);
|
||||
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
/**
|
||||
* Orange Management
|
||||
*
|
||||
* PHP Version 7.0
|
||||
* PHP Version 7.1
|
||||
*
|
||||
* @category TBD
|
||||
* @package TBD
|
||||
|
|
@ -16,7 +16,7 @@
|
|||
namespace Modules\Organization\Admin;
|
||||
|
||||
use phpOMS\DataStorage\Database\DatabaseType;
|
||||
use phpOMS\DataStorage\Database\Pool;
|
||||
use phpOMS\DataStorage\Database\DatabasePool;
|
||||
use phpOMS\Module\InfoManager;
|
||||
use phpOMS\Module\InstallerAbstract;
|
||||
|
||||
|
|
@ -37,9 +37,9 @@ class Installer extends InstallerAbstract
|
|||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public static function install(Pool $dbPool, InfoManager $info)
|
||||
public static function install(string $path, DatabasePool $dbPool, InfoManager $info)
|
||||
{
|
||||
parent::install($dbPool, $info);
|
||||
parent::install($path, $dbPool, $info);
|
||||
|
||||
switch ($dbPool->get('core')->getType()) {
|
||||
case DatabaseType::MYSQL:
|
||||
|
|
@ -49,6 +49,7 @@ class Installer extends InstallerAbstract
|
|||
`organization_unit_name` varchar(50) DEFAULT NULL,
|
||||
`organization_unit_description` varchar(255) DEFAULT NULL,
|
||||
`organization_unit_parent` int(11) DEFAULT NULL,
|
||||
`organization_unit_status` int(3) DEFAULT NULL,
|
||||
PRIMARY KEY (`organization_unit_id`),
|
||||
KEY `organization_unit_parent` (`organization_unit_parent`)
|
||||
)ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1;'
|
||||
|
|
@ -65,6 +66,7 @@ class Installer extends InstallerAbstract
|
|||
`organization_department_name` varchar(30) DEFAULT NULL,
|
||||
`organization_department_description` varchar(255) DEFAULT NULL,
|
||||
`organization_department_parent` int(11) DEFAULT NULL,
|
||||
`organization_department_status` int(3) DEFAULT NULL,
|
||||
`organization_department_unit` int(11) NOT NULL,
|
||||
PRIMARY KEY (`organization_department_id`),
|
||||
KEY `organization_department_parent` (`organization_department_parent`),
|
||||
|
|
@ -84,6 +86,7 @@ class Installer extends InstallerAbstract
|
|||
`organization_position_name` varchar(50) DEFAULT NULL,
|
||||
`organization_position_description` varchar(255) DEFAULT NULL,
|
||||
`organization_position_parent` int(11) DEFAULT NULL,
|
||||
`organization_position_status` int(3) DEFAULT NULL,
|
||||
PRIMARY KEY (`organization_position_id`),
|
||||
KEY `organization_position_parent` (`organization_position_parent`)
|
||||
)ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1;'
|
||||
|
|
|
|||
24
Admin/Routes/Web/Api.php
Normal file
24
Admin/Routes/Web/Api.php
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
<?php
|
||||
|
||||
use phpOMS\Router\RouteVerb;
|
||||
|
||||
return [
|
||||
'^.*/api/organization/position.*$' => [
|
||||
[
|
||||
'dest' => '\Modules\Organization\Controller:apiPositionCreate',
|
||||
'verb' => RouteVerb::SET,
|
||||
],
|
||||
],
|
||||
'^.*/api/organization/department.*$' => [
|
||||
[
|
||||
'dest' => '\Modules\Organization\Controller:apiDepartmentCreate',
|
||||
'verb' => RouteVerb::SET,
|
||||
],
|
||||
],
|
||||
'^.*/api/organization/unit.*$' => [
|
||||
[
|
||||
'dest' => '\Modules\Organization\Controller:apiUnitCreate',
|
||||
'verb' => RouteVerb::SET,
|
||||
],
|
||||
],
|
||||
];
|
||||
|
|
@ -57,23 +57,4 @@ return [
|
|||
'verb' => RouteVerb::GET,
|
||||
],
|
||||
],
|
||||
|
||||
'^.*/api/organization/position.*$' => [
|
||||
[
|
||||
'dest' => '\Modules\Organization\Controller:apiPositionCreate',
|
||||
'verb' => RouteVerb::SET,
|
||||
],
|
||||
],
|
||||
'^.*/api/organization/department.*$' => [
|
||||
[
|
||||
'dest' => '\Modules\Organization\Controller:apiDepartmentCreate',
|
||||
'verb' => RouteVerb::SET,
|
||||
],
|
||||
],
|
||||
'^.*/api/organization/unit.*$' => [
|
||||
[
|
||||
'dest' => '\Modules\Organization\Controller:apiUnitCreate',
|
||||
'verb' => RouteVerb::SET,
|
||||
],
|
||||
],
|
||||
];
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
/**
|
||||
* Orange Management
|
||||
*
|
||||
* PHP Version 7.0
|
||||
* PHP Version 7.1
|
||||
*
|
||||
* @category TBD
|
||||
* @package TBD
|
||||
|
|
@ -16,7 +16,7 @@
|
|||
namespace Modules\Organization\Admin;
|
||||
|
||||
|
||||
use phpOMS\DataStorage\Database\Pool;
|
||||
use phpOMS\DataStorage\Database\DatabasePool;
|
||||
use phpOMS\DataStorage\Database\Schema\Builder;
|
||||
use phpOMS\Module\UninstallAbstract;
|
||||
|
||||
|
|
@ -37,7 +37,7 @@ class Uninstall extends UninstallAbstract
|
|||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public static function uninstall(Pool $dbPool, InfoManager $info)
|
||||
public static function uninstall(DatabasePool $dbPool, InfoManager $info)
|
||||
{
|
||||
parent::uninstall($dbPool, $info);
|
||||
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
/**
|
||||
* Orange Management
|
||||
*
|
||||
* PHP Version 7.0
|
||||
* PHP Version 7.1
|
||||
*
|
||||
* @category TBD
|
||||
* @package TBD
|
||||
|
|
@ -16,7 +16,7 @@
|
|||
namespace Modules\Organization\Admin;
|
||||
|
||||
|
||||
use phpOMS\DataStorage\Database\Pool;
|
||||
use phpOMS\DataStorage\Database\DatabasePool;
|
||||
use phpOMS\Module\UpdateAbstract;
|
||||
use phpOMS\System\File\Directory;
|
||||
|
||||
|
|
@ -37,7 +37,7 @@ class Update extends UpdateAbstract
|
|||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public static function update(Pool $dbPool, array $info)
|
||||
public static function update(DatabasePool $dbPool, array $info)
|
||||
{
|
||||
Directory::deletePath(__DIR__ . '/Update');
|
||||
mkdir('Update');
|
||||
|
|
|
|||
100
Controller.php
100
Controller.php
|
|
@ -2,7 +2,7 @@
|
|||
/**
|
||||
* Orange Management
|
||||
*
|
||||
* PHP Version 7.0
|
||||
* PHP Version 7.1
|
||||
*
|
||||
* @category TBD
|
||||
* @package TBD
|
||||
|
|
@ -15,10 +15,12 @@
|
|||
*/
|
||||
namespace Modules\Organization;
|
||||
|
||||
use Model\Message\FormValidation;
|
||||
use Modules\Organization\Models\Department;
|
||||
use Modules\Organization\Models\DepartmentMapper;
|
||||
use Modules\Organization\Models\Position;
|
||||
use Modules\Organization\Models\PositionMapper;
|
||||
use Modules\Organization\Models\Status;
|
||||
use Modules\Organization\Models\Unit;
|
||||
use Modules\Organization\Models\UnitMapper;
|
||||
use phpOMS\Message\RequestAbstract;
|
||||
|
|
@ -47,7 +49,7 @@ class Controller extends ModuleAbstract implements WebInterface
|
|||
* @var string
|
||||
* @since 1.0.0
|
||||
*/
|
||||
const MODULE_PATH = __DIR__;
|
||||
/* public */ const MODULE_PATH = __DIR__;
|
||||
|
||||
/**
|
||||
* Module version.
|
||||
|
|
@ -55,7 +57,7 @@ class Controller extends ModuleAbstract implements WebInterface
|
|||
* @var string
|
||||
* @since 1.0.0
|
||||
*/
|
||||
const MODULE_VERSION = '1.0.0';
|
||||
/* public */ const MODULE_VERSION = '1.0.0';
|
||||
|
||||
/**
|
||||
* Module name.
|
||||
|
|
@ -63,7 +65,7 @@ class Controller extends ModuleAbstract implements WebInterface
|
|||
* @var string
|
||||
* @since 1.0.0
|
||||
*/
|
||||
const MODULE_NAME = 'Organization';
|
||||
/* public */ const MODULE_NAME = 'Organization';
|
||||
|
||||
/**
|
||||
* Providing.
|
||||
|
|
@ -220,6 +222,8 @@ class Controller extends ModuleAbstract implements WebInterface
|
|||
$view->setTemplate('/Modules/Organization/Theme/Backend/position-list');
|
||||
$view->addData('nav', $this->app->moduleManager->get('Navigation')->createNavigationMid(1004704001, $request, $response));
|
||||
|
||||
$view->addData('list:elements', PositionMapper::getAll());
|
||||
|
||||
return $view;
|
||||
}
|
||||
|
||||
|
|
@ -239,6 +243,8 @@ class Controller extends ModuleAbstract implements WebInterface
|
|||
$view->setTemplate('/Modules/Organization/Theme/Backend/position-profile');
|
||||
$view->addData('nav', $this->app->moduleManager->get('Navigation')->createNavigationMid(1004704001, $request, $response));
|
||||
|
||||
$view->addData('position', PositionMapper::get((int) $request->getData('id')));
|
||||
|
||||
return $view;
|
||||
}
|
||||
|
||||
|
|
@ -261,33 +267,113 @@ class Controller extends ModuleAbstract implements WebInterface
|
|||
return $view;
|
||||
}
|
||||
|
||||
private function validateUnitCreate(RequestAbstract $request) : array
|
||||
{
|
||||
$val = [];
|
||||
if (
|
||||
($val['name'] = empty($request->getData('name')))
|
||||
|| ($val['parent'] = (
|
||||
!empty($request->getData('parent'))
|
||||
&& !is_numeric($request->getData('parent'))
|
||||
))
|
||||
|| ($val['status'] = (
|
||||
$request->getData('status') === null
|
||||
|| !Status::isValidValue((int) $request->getData('status'))
|
||||
))
|
||||
) {
|
||||
return $val;
|
||||
}
|
||||
|
||||
return [];
|
||||
}
|
||||
|
||||
public function apiUnitCreate(RequestAbstract $request, ResponseAbstract $response, $data = null)
|
||||
{
|
||||
if (!empty($val = $this->validateUnitCreate($request))) {
|
||||
$response->set('unit_create', new FormValidation($val));
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
$unit = new Unit();
|
||||
$unit->setName($request->getData('name'));
|
||||
$unit->setDescription($request->getData('desc'));
|
||||
$unit->setDescription($request->getData('description') ?? '');
|
||||
$unit->setStatus((int) $request->getData('status'));
|
||||
|
||||
UnitMapper::create($unit);
|
||||
|
||||
$response->set('unit', $unit->jsonSerialize());
|
||||
}
|
||||
|
||||
private function validatePositionCreate(RequestAbstract $request) : array
|
||||
{
|
||||
$val = [];
|
||||
if (
|
||||
($val['name'] = empty($request->getData('name')))
|
||||
|| ($val['parent'] = (
|
||||
!empty($request->getData('parent'))
|
||||
&& !is_numeric($request->getData('parent'))
|
||||
))
|
||||
|| ($val['status'] = (
|
||||
$request->getData('status') === null
|
||||
|| !Status::isValidValue((int) $request->getData('status'))
|
||||
))
|
||||
) {
|
||||
return $val;
|
||||
}
|
||||
|
||||
return [];
|
||||
}
|
||||
|
||||
public function apiPositionCreate(RequestAbstract $request, ResponseAbstract $response, $data = null)
|
||||
{
|
||||
if (!empty($val = $this->validatePositionCreate($request))) {
|
||||
$response->set('position_create', new FormValidation($val));
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
$position = new Position();
|
||||
$position->setName($request->getData('name'));
|
||||
$position->setDescription($request->getData('desc'));
|
||||
$position->setStatus((int) $request->getData('status'));
|
||||
$position->setDescription($request->getData('description') ?? '');
|
||||
|
||||
PositionMapper::create($position);
|
||||
|
||||
$response->set('position', $position->jsonSerialize());
|
||||
}
|
||||
|
||||
private function validateDepartmentCreate(RequestAbstract $request) : array
|
||||
{
|
||||
$val = [];
|
||||
if (
|
||||
($val['name'] = empty($request->getData('name')))
|
||||
|| ($val['parent'] = (
|
||||
!empty($request->getData('parent'))
|
||||
&& !is_numeric($request->getData('parent'))
|
||||
))
|
||||
|| ($val['unit'] = (
|
||||
!is_numeric((int) $request->getData('unit'))
|
||||
))
|
||||
) {
|
||||
return $val;
|
||||
}
|
||||
|
||||
return [];
|
||||
}
|
||||
|
||||
public function apiDepartmentCreate(RequestAbstract $request, ResponseAbstract $response, $data = null)
|
||||
{
|
||||
if (!empty($val = $this->validateDepartmentCreate($request))) {
|
||||
$response->set('department_create', new FormValidation($val));
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
$department = new Department();
|
||||
$department->setName($request->getData('name'));
|
||||
$department->setDescription($request->getData('desc'));
|
||||
$department->setStatus((int) $request->getData('status'));
|
||||
$department->setDescription($request->getData('description') ?? '');
|
||||
|
||||
DepartmentMapper::create($department);
|
||||
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
/**
|
||||
* Orange Management
|
||||
*
|
||||
* PHP Version 7.0
|
||||
* PHP Version 7.1
|
||||
*
|
||||
* @category TBD
|
||||
* @package TBD
|
||||
|
|
@ -23,6 +23,8 @@ class Department
|
|||
|
||||
protected $parent = null;
|
||||
|
||||
protected $status = Status::INACTIVE;
|
||||
|
||||
protected $unit = 1;
|
||||
|
||||
protected $description = '';
|
||||
|
|
@ -52,6 +54,16 @@ class Department
|
|||
$this->parent = $parent;
|
||||
}
|
||||
|
||||
public function getStatus() : int
|
||||
{
|
||||
return $this->status;
|
||||
}
|
||||
|
||||
public function setStatus(int $status)
|
||||
{
|
||||
$this->status = $status;
|
||||
}
|
||||
|
||||
public function getUnit() : int
|
||||
{
|
||||
return $this->unit;
|
||||
|
|
@ -92,7 +104,7 @@ class Department
|
|||
*/
|
||||
public function __toString()
|
||||
{
|
||||
return $this->jsonSerialize();
|
||||
return json_encode($this->toArray());
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -105,6 +117,6 @@ class Department
|
|||
*/
|
||||
public function jsonSerialize()
|
||||
{
|
||||
return json_encode($this->toArray());
|
||||
return $this->toArray();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
/**
|
||||
* Orange Management
|
||||
*
|
||||
* PHP Version 7.0
|
||||
* PHP Version 7.1
|
||||
*
|
||||
* @category TBD
|
||||
* @package TBD
|
||||
|
|
@ -22,7 +22,7 @@ class DepartmentMapper extends DataMapperAbstract
|
|||
/**
|
||||
* Columns.
|
||||
*
|
||||
* @var array<string, array>
|
||||
* @var array
|
||||
* @since 1.0.0
|
||||
*/
|
||||
protected static $columns = [
|
||||
|
|
@ -30,9 +30,17 @@ class DepartmentMapper extends DataMapperAbstract
|
|||
'organization_department_name' => ['name' => 'organization_department_name', 'type' => 'string', 'internal' => 'name'],
|
||||
'organization_department_description' => ['name' => 'organization_department_description', 'type' => 'string', 'internal' => 'description'],
|
||||
'organization_department_parent' => ['name' => 'organization_department_parent', 'type' => 'int', 'internal' => 'parent'],
|
||||
'organization_department_status' => ['name' => 'organization_department_status', 'type' => 'int', 'internal' => 'status'],
|
||||
'organization_department_unit' => ['name' => 'organization_department_unit', 'type' => 'int', 'internal' => 'unit'],
|
||||
];
|
||||
|
||||
protected static $belongsTo = [
|
||||
'account' => [
|
||||
'mapper' => UnitMapper::class,
|
||||
'dest' => 'organization_department_unit',
|
||||
],
|
||||
];
|
||||
|
||||
/**
|
||||
* Primary table.
|
||||
*
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
/**
|
||||
* Orange Management
|
||||
*
|
||||
* PHP Version 7.0
|
||||
* PHP Version 7.1
|
||||
*
|
||||
* @category TBD
|
||||
* @package TBD
|
||||
|
|
@ -27,6 +27,8 @@ class Position implements ArrayableInterface, \JsonSerializable
|
|||
|
||||
private $description = '';
|
||||
|
||||
protected $status = Status::INACTIVE;
|
||||
|
||||
public function getId() : int
|
||||
{
|
||||
return $this->id;
|
||||
|
|
@ -52,6 +54,16 @@ class Position implements ArrayableInterface, \JsonSerializable
|
|||
$this->parent = $parent;
|
||||
}
|
||||
|
||||
public function getStatus() : int
|
||||
{
|
||||
return $this->status;
|
||||
}
|
||||
|
||||
public function setStatus(int $status)
|
||||
{
|
||||
$this->status = $status;
|
||||
}
|
||||
|
||||
public function getDescription() : string
|
||||
{
|
||||
return $this->description;
|
||||
|
|
@ -81,7 +93,7 @@ class Position implements ArrayableInterface, \JsonSerializable
|
|||
*/
|
||||
public function __toString()
|
||||
{
|
||||
return $this->jsonSerialize();
|
||||
return json_encode($this->toArray());
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -94,6 +106,6 @@ class Position implements ArrayableInterface, \JsonSerializable
|
|||
*/
|
||||
public function jsonSerialize()
|
||||
{
|
||||
return json_encode($this->toArray());
|
||||
return $this->toArray();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
/**
|
||||
* Orange Management
|
||||
*
|
||||
* PHP Version 7.0
|
||||
* PHP Version 7.1
|
||||
*
|
||||
* @category TBD
|
||||
* @package TBD
|
||||
|
|
@ -23,7 +23,7 @@ class PositionMapper extends DataMapperAbstract
|
|||
/**
|
||||
* Columns.
|
||||
*
|
||||
* @var array<string, array>
|
||||
* @var array
|
||||
* @since 1.0.0
|
||||
*/
|
||||
protected static $columns = [
|
||||
|
|
@ -31,6 +31,14 @@ class PositionMapper extends DataMapperAbstract
|
|||
'organization_position_name' => ['name' => 'organization_position_name', 'type' => 'string', 'internal' => 'name'],
|
||||
'organization_position_description' => ['name' => 'organization_position_description', 'type' => 'string', 'internal' => 'description'],
|
||||
'organization_position_parent' => ['name' => 'organization_position_parent', 'type' => 'int', 'internal' => 'parent'],
|
||||
'organization_position_status' => ['name' => 'organization_position_status', 'type' => 'int', 'internal' => 'status'],
|
||||
];
|
||||
|
||||
protected static $belongsTo = [
|
||||
'account' => [
|
||||
'mapper' => PositionMapper::class,
|
||||
'dest' => 'organization_position_parent',
|
||||
],
|
||||
];
|
||||
|
||||
/**
|
||||
|
|
|
|||
38
Models/Status.php
Normal file
38
Models/Status.php
Normal file
|
|
@ -0,0 +1,38 @@
|
|||
<?php
|
||||
/**
|
||||
* Orange Management
|
||||
*
|
||||
* PHP Version 7.1
|
||||
*
|
||||
* @category TBD
|
||||
* @package TBD
|
||||
* @author OMS Development Team <dev@oms.com>
|
||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
||||
* @copyright 2013 Dennis Eichhorn
|
||||
* @license OMS License 1.0
|
||||
* @version 1.0.0
|
||||
* @link http://orange-management.com
|
||||
*/
|
||||
namespace Modules\Organization\Models;
|
||||
|
||||
use phpOMS\Datatypes\Enum;
|
||||
|
||||
/**
|
||||
* Accept status enum.
|
||||
*
|
||||
* @category Calendar
|
||||
* @package Modules
|
||||
* @author OMS Development Team <dev@oms.com>
|
||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
||||
* @license OMS License 1.0
|
||||
* @link http://orange-management.com
|
||||
* @since 1.0.0
|
||||
*/
|
||||
abstract class Status extends Enum
|
||||
{
|
||||
/* public */ const ACTIVE = 1;
|
||||
|
||||
/* public */ const INACTIVE = 2;
|
||||
|
||||
/* public */ const HIDDEN = 4;
|
||||
}
|
||||
|
|
@ -2,7 +2,7 @@
|
|||
/**
|
||||
* Orange Management
|
||||
*
|
||||
* PHP Version 7.0
|
||||
* PHP Version 7.1
|
||||
*
|
||||
* @category TBD
|
||||
* @package TBD
|
||||
|
|
@ -23,10 +23,12 @@ class Unit implements ArrayableInterface, \JsonSerializable
|
|||
|
||||
private $name = '';
|
||||
|
||||
private $parent = 0;
|
||||
private $parent = null;
|
||||
|
||||
private $description = '';
|
||||
|
||||
protected $status = Status::INACTIVE;
|
||||
|
||||
public function getId() : int
|
||||
{
|
||||
return $this->id;
|
||||
|
|
@ -42,7 +44,7 @@ class Unit implements ArrayableInterface, \JsonSerializable
|
|||
$this->name = $name;
|
||||
}
|
||||
|
||||
public function getParent() : int
|
||||
public function getParent()
|
||||
{
|
||||
return $this->parent;
|
||||
}
|
||||
|
|
@ -52,6 +54,16 @@ class Unit implements ArrayableInterface, \JsonSerializable
|
|||
$this->parent = $parent;
|
||||
}
|
||||
|
||||
public function getStatus() : int
|
||||
{
|
||||
return $this->status;
|
||||
}
|
||||
|
||||
public function setStatus(int $status)
|
||||
{
|
||||
$this->status = $status;
|
||||
}
|
||||
|
||||
public function getDescription() : string
|
||||
{
|
||||
return $this->description;
|
||||
|
|
@ -81,7 +93,7 @@ class Unit implements ArrayableInterface, \JsonSerializable
|
|||
*/
|
||||
public function __toString()
|
||||
{
|
||||
return $this->jsonSerialize();
|
||||
return json_encode($this->toArray());
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -94,6 +106,6 @@ class Unit implements ArrayableInterface, \JsonSerializable
|
|||
*/
|
||||
public function jsonSerialize()
|
||||
{
|
||||
return json_encode($this->toArray());
|
||||
return $this->toArray();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
/**
|
||||
* Orange Management
|
||||
*
|
||||
* PHP Version 7.0
|
||||
* PHP Version 7.1
|
||||
*
|
||||
* @category TBD
|
||||
* @package TBD
|
||||
|
|
@ -22,7 +22,7 @@ class UnitMapper extends DataMapperAbstract
|
|||
/**
|
||||
* Columns.
|
||||
*
|
||||
* @var array<string, array>
|
||||
* @var array
|
||||
* @since 1.0.0
|
||||
*/
|
||||
protected static $columns = [
|
||||
|
|
@ -30,6 +30,14 @@ class UnitMapper extends DataMapperAbstract
|
|||
'organization_unit_name' => ['name' => 'organization_unit_name', 'type' => 'string', 'internal' => 'name'],
|
||||
'organization_unit_description' => ['name' => 'organization_unit_description', 'type' => 'string', 'internal' => 'description'],
|
||||
'organization_unit_parent' => ['name' => 'organization_unit_parent', 'type' => 'int', 'internal' => 'parent'],
|
||||
'organization_unit_status' => ['name' => 'organization_unit_status', 'type' => 'int', 'internal' => 'status'],
|
||||
];
|
||||
|
||||
protected static $belongsTo = [
|
||||
'account' => [
|
||||
'mapper' => UnitMapper::class,
|
||||
'dest' => 'organization_uni_parent',
|
||||
],
|
||||
];
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
/**
|
||||
* Orange Management
|
||||
*
|
||||
* PHP Version 7.0
|
||||
* PHP Version 7.1
|
||||
*
|
||||
* @category TBD
|
||||
* @package TBD
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
/**
|
||||
* Orange Management
|
||||
*
|
||||
* PHP Version 7.0
|
||||
* PHP Version 7.1
|
||||
*
|
||||
* @category TBD
|
||||
* @package TBD
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
/**
|
||||
* Orange Management
|
||||
*
|
||||
* PHP Version 7.0
|
||||
* PHP Version 7.1
|
||||
*
|
||||
* @category TBD
|
||||
* @package TBD
|
||||
|
|
@ -22,7 +22,7 @@ echo $this->getData('nav')->render(); ?>
|
|||
<section class="box w-33">
|
||||
<header><h1><?= $this->getText('Department'); ?></h1></header>
|
||||
<div class="inner">
|
||||
<form>
|
||||
<form id="fDepartmentCreate" method="POST" action="<?= \phpOMS\Uri\UriFactory::build('{/base}{/rootPath}{/lang}/api/organization/department'); ?>">
|
||||
<table class="layout wf-100">
|
||||
<tr><td><label for="iName"><?= $this->getText('Name'); ?></label>
|
||||
<tr><td><input type="text" name="name" id="iName" placeholder=" R&D" required>
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
/**
|
||||
* Orange Management
|
||||
*
|
||||
* PHP Version 7.0
|
||||
* PHP Version 7.1
|
||||
*
|
||||
* @category TBD
|
||||
* @package TBD
|
||||
|
|
@ -39,7 +39,7 @@ echo $this->getData('nav')->render(); ?>
|
|||
<tr><td colspan="4"><?= $footerView->render(); ?>
|
||||
<tbody>
|
||||
<?php $c = 0; foreach ($this->getData('list:elements') as $key => $value) : $c++;
|
||||
$url = \phpOMS\Uri\UriFactory::build('/{/lang}/backend/business/department/profile?id=' . $value->getId()); ?>
|
||||
$url = \phpOMS\Uri\UriFactory::build('/{/lang}/backend/organization/department/profile?id=' . $value->getId()); ?>
|
||||
<tr>
|
||||
<td><a href="<?= $url; ?>"><?= $value->getId(); ?></a>
|
||||
<td><a href="<?= $url; ?>"><?= $value->getName(); ?></a>
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
/**
|
||||
* Orange Management
|
||||
*
|
||||
* PHP Version 7.0
|
||||
* PHP Version 7.1
|
||||
*
|
||||
* @category TBD
|
||||
* @package TBD
|
||||
|
|
@ -22,7 +22,7 @@ $department = $this->getData('department');
|
|||
echo $this->getData('nav')->render(); ?>
|
||||
|
||||
<section class="box w-33">
|
||||
<h1><?= $this->getText('Position'); ?></h1>
|
||||
<header><h1><?= $this->getText('Department'); ?></h1></header>
|
||||
<div class="inner">
|
||||
<form>
|
||||
<table class="layout wf-100">
|
||||
|
|
@ -37,7 +37,7 @@ echo $this->getData('nav')->render(); ?>
|
|||
</select>
|
||||
<tr><td><label for="iDescription"><?= $this->getText('Description'); ?></label>
|
||||
<tr><td><textarea name="description" id="iDescription"><?= $department->getDescription(); ?></textarea>
|
||||
<tr><td><input type="submit" value="<?= $this->getText('Save') ?>">
|
||||
<tr><td><input type="submit" value="<?= $this->getText('Save', 0) ?>">
|
||||
</table>
|
||||
</form>
|
||||
</div>
|
||||
|
|
@ -2,7 +2,7 @@
|
|||
/**
|
||||
* Orange Management
|
||||
*
|
||||
* PHP Version 7.0
|
||||
* PHP Version 7.1
|
||||
*
|
||||
* @category TBD
|
||||
* @package TBD
|
||||
|
|
@ -22,7 +22,7 @@ echo $this->getData('nav')->render(); ?>
|
|||
<section class="box w-33">
|
||||
<header><h1><?= $this->getText('Position'); ?></h1></header>
|
||||
<div class="inner">
|
||||
<form>
|
||||
<form id="fPositionCreate" method="POST" action="<?= \phpOMS\Uri\UriFactory::build('{/base}{/rootPath}{/lang}/api/organization/position'); ?>">
|
||||
<table class="layout wf-100">
|
||||
<tr><td><label for="iName"><?= $this->getText('Name'); ?></label>
|
||||
<tr><td><input type="text" name="name" id="iName" placeholder=" Orange Management" required>
|
||||
|
|
@ -30,8 +30,8 @@ echo $this->getData('nav')->render(); ?>
|
|||
<tr><td><span class="input"><button type="button" formaction=""><i class="fa fa-book"></i></button><input type="text" name="parent" id="iParent"></span>
|
||||
<tr><td><label for="iStatus"><?= $this->getText('Status'); ?></label>
|
||||
<tr><td><select name="status" id="iStatus">
|
||||
<option><?= $this->getText('Active'); ?>
|
||||
<option><?= $this->getText('Inactive'); ?>
|
||||
<option value="<?= \Modules\Organization\Models\Status::ACTIVE; ?>"><?= $this->getText('Active'); ?>
|
||||
<option value="<?= \Modules\Organization\Models\Status::INACTIVE; ?>"><?= $this->getText('Inactive'); ?>
|
||||
</select>
|
||||
<tr><td><label for="iDescription"><?= $this->getText('Description'); ?></label>
|
||||
<tr><td><textarea name="description" id="iDescription" placeholder=""></textarea>
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
/**
|
||||
* Orange Management
|
||||
*
|
||||
* PHP Version 7.0
|
||||
* PHP Version 7.1
|
||||
*
|
||||
* @category TBD
|
||||
* @package TBD
|
||||
|
|
@ -40,7 +40,7 @@ echo $this->getData('nav')->render(); ?>
|
|||
<tr><td colspan="3"><?= $footerView->render(); ?>
|
||||
<tbody>
|
||||
<?php $count = 0; foreach($listElements as $key => $value) : $count++;
|
||||
$url = \phpOMS\Uri\UriFactory::build('/{/lang}/backend/business/unit/profile?id=' . $value->getId()); ?>
|
||||
$url = \phpOMS\Uri\UriFactory::build('/{/lang}/backend/organization/position/profile?id=' . $value->getId()); ?>
|
||||
<tr>
|
||||
<td><a href="<?= $url; ?>"><?= $value->getId(); ?></a>
|
||||
<td><a href="<?= $url; ?>"><?= $value->getName(); ?></a>
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
/**
|
||||
* Orange Management
|
||||
*
|
||||
* PHP Version 7.0
|
||||
* PHP Version 7.1
|
||||
*
|
||||
* @category TBD
|
||||
* @package TBD
|
||||
|
|
@ -17,7 +17,7 @@
|
|||
* @var \phpOMS\Views\View $this
|
||||
*/
|
||||
|
||||
$unit = $this->getData('unit');
|
||||
$position = $this->getData('position');
|
||||
|
||||
echo $this->getData('nav')->render(); ?>
|
||||
|
||||
|
|
@ -27,17 +27,17 @@ echo $this->getData('nav')->render(); ?>
|
|||
<form>
|
||||
<table class="layout wf-100">
|
||||
<tr><td><label for="iName"><?= $this->getText('Name'); ?></label>
|
||||
<tr><td><input type="text" name="name" id="iName" value="<?= $unit->getName(); ?>">
|
||||
<tr><td><input type="text" name="name" id="iName" value="<?= $position->getName(); ?>">
|
||||
<tr><td><label for="iParent"><?= $this->getText('Parent'); ?></label>
|
||||
<tr><td><input type="text" name="parent" id="iParent" value="<?= $unit->getParent(); ?>">
|
||||
<tr><td><input type="text" name="parent" id="iParent" value="<?= $position->getParent(); ?>">
|
||||
<tr><td><label for="iStatus"><?= $this->getText('Status'); ?></label>
|
||||
<tr><td><select name="status" id="iStatus">
|
||||
<option><?= $this->getText('Active'); ?>
|
||||
<option><?= $this->getText('Inactive'); ?>
|
||||
</select>
|
||||
<tr><td><label for="iDescription"><?= $this->getText('Description'); ?></label>
|
||||
<tr><td><textarea name="description" id="iDescription"><?= $unit->getDescription(); ?></textarea>
|
||||
<tr><td><input type="submit" value="<?= $this->getText('Save') ?>">
|
||||
<tr><td><textarea name="description" id="iDescription"><?= $position->getDescription(); ?></textarea>
|
||||
<tr><td><input type="submit" value="<?= $this->getText('Save', 0) ?>">
|
||||
</table>
|
||||
</form>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
/**
|
||||
* Orange Management
|
||||
*
|
||||
* PHP Version 7.0
|
||||
* PHP Version 7.1
|
||||
*
|
||||
* @category TBD
|
||||
* @package TBD
|
||||
|
|
@ -22,7 +22,7 @@ echo $this->getData('nav')->render(); ?>
|
|||
<section class="box w-33">
|
||||
<header><h1><?= $this->getText('Unit'); ?></h1></header>
|
||||
<div class="inner">
|
||||
<form>
|
||||
<form id="fUnitCreate" method="POST" action="<?= \phpOMS\Uri\UriFactory::build('{/base}{/rootPath}{/lang}/api/organization/unit'); ?>">
|
||||
<table class="layout wf-100">
|
||||
<tr><td><label for="iName"><?= $this->getText('Name'); ?></label>
|
||||
<tr><td><input type="text" name="name" id="iName" placeholder=" Orange Management" required>
|
||||
|
|
@ -30,8 +30,8 @@ echo $this->getData('nav')->render(); ?>
|
|||
<tr><td><span class="input"><button type="button" formaction=""><i class="fa fa-book"></i></button><input type="text" name="parent" id="iParent"></span>
|
||||
<tr><td><label for="iStatus"><?= $this->getText('Status'); ?></label>
|
||||
<tr><td><select name="status" id="iStatus">
|
||||
<option><?= $this->getText('Active'); ?>
|
||||
<option><?= $this->getText('Inactive'); ?>
|
||||
<option value="<?= \Modules\Organization\Models\Status::ACTIVE; ?>"><?= $this->getText('Active'); ?>
|
||||
<option value="<?= \Modules\Organization\Models\Status::INACTIVE; ?>"><?= $this->getText('Inactive'); ?>
|
||||
</select>
|
||||
<tr><td><label for="iDescription"><?= $this->getText('Description'); ?></label>
|
||||
<tr><td><textarea name="description" id="iDescription" placeholder=""></textarea>
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
/**
|
||||
* Orange Management
|
||||
*
|
||||
* PHP Version 7.0
|
||||
* PHP Version 7.1
|
||||
*
|
||||
* @category TBD
|
||||
* @package TBD
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
/**
|
||||
* Orange Management
|
||||
*
|
||||
* PHP Version 7.0
|
||||
* PHP Version 7.1
|
||||
*
|
||||
* @category TBD
|
||||
* @package TBD
|
||||
|
|
@ -37,7 +37,7 @@ echo $this->getData('nav')->render(); ?>
|
|||
</select>
|
||||
<tr><td><label for="iDescription"><?= $this->getText('Description'); ?></label>
|
||||
<tr><td><textarea name="description" id="iDescription"><?= $unit->getDescription(); ?></textarea>
|
||||
<tr><td><input type="submit" value="<?= $this->getText('Save') ?>">
|
||||
<tr><td><input type="submit" value="<?= $this->getText('Save', 0) ?>">
|
||||
</table>
|
||||
</form>
|
||||
</div>
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user