mirror of
https://github.com/Karaka-Management/oms-HumanResourceManagement.git
synced 2026-01-26 18:58:41 +00:00
draft time recording
This commit is contained in:
parent
f642b31197
commit
186c17042b
|
|
@ -15,32 +15,6 @@
|
|||
"null": false,
|
||||
"foreignTable": "account",
|
||||
"foreignKey": "account_id"
|
||||
},
|
||||
"hr_staff_unit": {
|
||||
"name": "hr_staff_unit",
|
||||
"type": "INT",
|
||||
"null": false,
|
||||
"foreignTable": "organization_unit",
|
||||
"foreignKey": "organization_unit_id"
|
||||
},
|
||||
"hr_staff_department": {
|
||||
"name": "hr_staff_department",
|
||||
"type": "INT",
|
||||
"null": false,
|
||||
"foreignTable": "organization_department",
|
||||
"foreignKey": "organization_department_id"
|
||||
},
|
||||
"hr_staff_position": {
|
||||
"name": "hr_staff_position",
|
||||
"type": "INT",
|
||||
"null": false,
|
||||
"foreignTable": "organization_position",
|
||||
"foreignKey": "organization_position_id"
|
||||
},
|
||||
"hr_staff_active": {
|
||||
"name": "hr_staff_active",
|
||||
"type": "TINYINT",
|
||||
"null": false
|
||||
}
|
||||
}
|
||||
},
|
||||
|
|
@ -90,7 +64,8 @@
|
|||
"hr_staff_history_end": {
|
||||
"name": "hr_staff_history_end",
|
||||
"type": "DATETIME",
|
||||
"null": false
|
||||
"null": true,
|
||||
"default": null
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
20
Admin/Routes/Web/Api.php
Normal file
20
Admin/Routes/Web/Api.php
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
<?php declare(strict_types=1);
|
||||
|
||||
use Modules\HumanResourceManagement\Controller\ApiController;
|
||||
use Modules\HumanResourceManagement\Models\PermissionState;
|
||||
use phpOMS\Account\PermissionType;
|
||||
use phpOMS\Router\RouteVerb;
|
||||
|
||||
return [
|
||||
'^.*/humanresource/staff.*$' => [
|
||||
[
|
||||
'dest' => '\Modules\HumanResourceManagement\Controller\ApiController:apiEmployeeFromAccountCreate',
|
||||
'verb' => RouteVerb::PUT,
|
||||
'permission' => [
|
||||
'module' => ApiController::MODULE_NAME,
|
||||
'type' => PermissionType::CREATE,
|
||||
'state' => PermissionState::HR,
|
||||
],
|
||||
],
|
||||
],
|
||||
];
|
||||
|
|
@ -6,7 +6,7 @@ use phpOMS\Account\PermissionType;
|
|||
use phpOMS\Router\RouteVerb;
|
||||
|
||||
return [
|
||||
'^.*/hr/staff/list.*$' => [
|
||||
'^.*/humanresource/staff/list.*$' => [
|
||||
[
|
||||
'dest' => '\Modules\HumanResourceManagement\Controller\BackendController:viewHrStaffList',
|
||||
'verb' => RouteVerb::GET,
|
||||
|
|
@ -17,7 +17,7 @@ return [
|
|||
],
|
||||
],
|
||||
],
|
||||
'^.*/hr/staff/profile.*$' => [
|
||||
'^.*/humanresource/staff/profile.*$' => [
|
||||
[
|
||||
'dest' => '\Modules\HumanResourceManagement\Controller\BackendController:viewHrStaffProfile',
|
||||
'verb' => RouteVerb::GET,
|
||||
|
|
@ -28,7 +28,7 @@ return [
|
|||
],
|
||||
],
|
||||
],
|
||||
'^.*/hr/staff/create.*$' => [
|
||||
'^.*/humanresource/staff/create.*$' => [
|
||||
[
|
||||
'dest' => '\Modules\HumanResourceManagement\Controller\BackendController:viewHrStaffCreate',
|
||||
'verb' => RouteVerb::GET,
|
||||
|
|
@ -39,7 +39,7 @@ return [
|
|||
],
|
||||
],
|
||||
],
|
||||
'^.*/hr/department/list.*$' => [
|
||||
'^.*/humanresource/department/list.*$' => [
|
||||
[
|
||||
'dest' => '\Modules\HumanResourceManagement\Controller\BackendController:viewHrDepartmentList',
|
||||
'verb' => RouteVerb::GET,
|
||||
|
|
|
|||
177
Controller/ApiController.php
Normal file
177
Controller/ApiController.php
Normal file
|
|
@ -0,0 +1,177 @@
|
|||
<?php
|
||||
/**
|
||||
* Orange Management
|
||||
*
|
||||
* PHP Version 7.2
|
||||
*
|
||||
* @package Modules\HumanResourceManagement
|
||||
* @copyright Dennis Eichhorn
|
||||
* @license OMS License 1.0
|
||||
* @version 1.0.0
|
||||
* @link https://orange-management.org
|
||||
*/
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Modules\HumanResourceManagement\Controller;
|
||||
|
||||
use Modules\HumanResourceManagement\Models\Employee;
|
||||
use Modules\HumanResourceManagement\Models\EmployeeMapper;
|
||||
use Modules\HumanResourceManagement\Models\EmployeeHistory;
|
||||
use Modules\HumanResourceManagement\Models\EmployeeHistoryMapper;
|
||||
|
||||
use phpOMS\Account\Account;
|
||||
use phpOMS\Localization\ISO639x1Enum;
|
||||
use phpOMS\Message\NotificationLevel;
|
||||
use phpOMS\Message\RequestAbstract;
|
||||
use phpOMS\Message\ResponseAbstract;
|
||||
use phpOMS\Model\Message\FormValidation;
|
||||
use phpOMS\Utils\Parser\Markdown\Markdown;
|
||||
|
||||
/**
|
||||
* HumanResourceManagement controller class.
|
||||
*
|
||||
* @package Modules\HumanResourceManagement
|
||||
* @license OMS License 1.0
|
||||
* @link https://orange-management.org
|
||||
* @since 1.0.0
|
||||
*/
|
||||
final class ApiController extends Controller
|
||||
{
|
||||
/**
|
||||
* Api method to create an employee from an existing account
|
||||
*
|
||||
* @param RequestAbstract $request Request
|
||||
* @param ResponseAbstract $response Response
|
||||
* @param mixed $data Generic data
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
* @api
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public function apiEmployeeFromAccountCreate(RequestAbstract $request, ResponseAbstract $response, $data = null) : void
|
||||
{
|
||||
if (!empty($val = $this->validateEmployeeFromAccountCreate($request))) {
|
||||
$response->set('employee_create', new FormValidation($val));
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
$employee = $this->createEmployeeFromAccountFromRequest($request);
|
||||
$this->createModel($request->getHeader()->getAccount(), $employee, EmployeeMapper::class, 'employee');
|
||||
$this->fillJsonResponse($request, $response, NotificationLevel::OK, 'Employee', 'Employee successfully created', $employee);
|
||||
}
|
||||
|
||||
/**
|
||||
* Validate employee from account create request
|
||||
*
|
||||
* @param RequestAbstract $request Request
|
||||
*
|
||||
* @return array<string, bool>
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
private function validateEmployeeFromAccountCreate(RequestAbstract $request) : array
|
||||
{
|
||||
$val = [];
|
||||
if (($val['account'] = empty($request->getData('account')))
|
||||
) {
|
||||
return $val;
|
||||
}
|
||||
|
||||
return [];
|
||||
}
|
||||
|
||||
/**
|
||||
* Method to create employee from account from request.
|
||||
*
|
||||
* @param RequestAbstract $request Request
|
||||
*
|
||||
* @return Employee
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
private function createEmployeeFromAccountFromRequest(RequestAbstract $request) : Employee
|
||||
{
|
||||
$employee = new Employee();
|
||||
$employee->setAccount((int) ($request->getData('account') ?? 0));
|
||||
|
||||
return $employee;
|
||||
}
|
||||
|
||||
/**
|
||||
* Api method to create an employee history
|
||||
*
|
||||
* @param RequestAbstract $request Request
|
||||
* @param ResponseAbstract $response Response
|
||||
* @param mixed $data Generic data
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
* @api
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public function apiEmployeeHistoryCreate(RequestAbstract $request, ResponseAbstract $response, $data = null) : void
|
||||
{
|
||||
if (!empty($val = $this->validateEmployeeHistoryCreate($request))) {
|
||||
$response->set('history_create', new FormValidation($val));
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
$history = $this->createEmployeeHistoryFromRequest($request);
|
||||
$this->createModel($request->getHeader()->getAccount(), $history, EmployeeHistoryMapper::class, 'history');
|
||||
$this->fillJsonResponse($request, $response, NotificationLevel::OK, 'History', 'History successfully created', $history);
|
||||
}
|
||||
|
||||
/**
|
||||
* Validate employee history
|
||||
*
|
||||
* @param RequestAbstract $request Request
|
||||
*
|
||||
* @return array<string, bool>
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
private function validateEmployeeHistoryCreate(RequestAbstract $request) : array
|
||||
{
|
||||
$val = [];
|
||||
if (($val['employee'] = empty($request->getData('employee')))
|
||||
|| ($val['start'] = empty($request->getData('start')))
|
||||
|| ($val['unit'] = empty($request->getData('unit')))
|
||||
|| ($val['department'] = empty($request->getData('department')))
|
||||
|| ($val['position'] = empty($request->getData('position')))
|
||||
) {
|
||||
return $val;
|
||||
}
|
||||
|
||||
return [];
|
||||
}
|
||||
|
||||
/**
|
||||
* Method to create employee history from request.
|
||||
*
|
||||
* @param RequestAbstract $request Request
|
||||
*
|
||||
* @return EmployeeHistory
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
private function createEmployeeHistoryFromRequest(RequestAbstract $request) : EmployeeHistory
|
||||
{
|
||||
$history = new EmployeeHistory();
|
||||
$history->setEmployee((int) ($request->getData('employee') ?? 0));
|
||||
$history->setUnit((int) ($request->getData('unit') ?? 0));
|
||||
$history->setDepartment((int) ($request->getData('department') ?? 0));
|
||||
$history->setPosition((int) ($request->getData('position') ?? 0));
|
||||
$history->setStart(new \DateTime($request->getData('start') ?? 'now'));
|
||||
|
||||
if (!empty($request->getData('end'))) {
|
||||
$history->setEnd(new \DateTime($request->getData('end')));
|
||||
}
|
||||
|
||||
return $history;
|
||||
}
|
||||
}
|
||||
|
|
@ -70,6 +70,9 @@ final class BackendController extends Controller
|
|||
$view->setTemplate('/Modules/HumanResourceManagement/Theme/Backend/staff-create');
|
||||
$view->addData('nav', $this->app->moduleManager->get('Navigation')->createNavigationMid(1002402001, $request, $response));
|
||||
|
||||
$accSelector = new \Modules\Profile\Theme\Backend\Components\AccountGroupSelector\BaseView($this->app, $request, $response);
|
||||
$view->addData('accSelector', $accSelector);
|
||||
|
||||
return $view;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@ declare(strict_types=1);
|
|||
|
||||
namespace Modules\HumanResourceManagement\Models;
|
||||
|
||||
use Modules\Admin\Models\Account;
|
||||
use phpOMS\Contract\ArrayableInterface;
|
||||
|
||||
/**
|
||||
* Employee class.
|
||||
|
|
@ -24,7 +24,7 @@ use Modules\Admin\Models\Account;
|
|||
* @link https://orange-management.org
|
||||
* @since 1.0.0
|
||||
*/
|
||||
class Employee
|
||||
class Employee implements ArrayableInterface, \JsonSerializable
|
||||
{
|
||||
|
||||
/**
|
||||
|
|
@ -37,68 +37,18 @@ class Employee
|
|||
|
||||
private $account = null;
|
||||
|
||||
private $unit = null;
|
||||
|
||||
private $department = null;
|
||||
|
||||
private $position = null;
|
||||
|
||||
private $isActive = true;
|
||||
|
||||
private $history = [];
|
||||
|
||||
private $status = [];
|
||||
|
||||
public function setAccount(Account $account) : void
|
||||
public function setAccount($account) : void
|
||||
{
|
||||
$this->account = $account;
|
||||
}
|
||||
|
||||
public function getAccount() : Account
|
||||
public function getAccount()
|
||||
{
|
||||
return $this->account;
|
||||
}
|
||||
|
||||
public function setActivity(bool $active) : void
|
||||
{
|
||||
$this->isActive = $active;
|
||||
}
|
||||
|
||||
public function isActive() : bool
|
||||
{
|
||||
return $this->isActive;
|
||||
}
|
||||
|
||||
public function setUnit($unit) : void
|
||||
{
|
||||
$this->unit = $unit;
|
||||
}
|
||||
|
||||
public function getUnit()
|
||||
{
|
||||
return $this->unit;
|
||||
}
|
||||
|
||||
public function setDepartment($department) : void
|
||||
{
|
||||
$this->department = $department;
|
||||
}
|
||||
|
||||
public function getDepartment()
|
||||
{
|
||||
return $this->department;
|
||||
}
|
||||
|
||||
public function setPosition($position) : void
|
||||
{
|
||||
$this->position = $position;
|
||||
}
|
||||
|
||||
public function getPosition()
|
||||
{
|
||||
return $this->position;
|
||||
}
|
||||
|
||||
public function getId() : int
|
||||
{
|
||||
return $this->id;
|
||||
|
|
@ -106,11 +56,38 @@ class Employee
|
|||
|
||||
public function getHistory() : array
|
||||
{
|
||||
return [];
|
||||
return $this->history;
|
||||
}
|
||||
|
||||
public function getNewestHistory() : void
|
||||
public function getNewestHistory() : EmployeeHistory
|
||||
{
|
||||
return empty($this->history) ? new NullEmployeeHistory : end($this->history);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function toArray() : array
|
||||
{
|
||||
return [
|
||||
'id' => $this->id,
|
||||
'account' => $this->account,
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function __toString()
|
||||
{
|
||||
return (string) \json_encode($this->toArray());
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function jsonSerialize()
|
||||
{
|
||||
return $this->toArray();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -14,6 +14,15 @@ declare(strict_types=1);
|
|||
|
||||
namespace Modules\HumanResourceManagement\Models;
|
||||
|
||||
use Modules\Organization\Models\Position;
|
||||
use Modules\Organization\Models\NullPosition;
|
||||
use Modules\Organization\Models\Unit;
|
||||
use Modules\Organization\Models\NullUnit;
|
||||
use Modules\Organization\Models\Department;
|
||||
use Modules\Organization\Models\NullDepartment;
|
||||
|
||||
use phpOMS\Contract\ArrayableInterface;
|
||||
|
||||
/**
|
||||
* Employee class.
|
||||
*
|
||||
|
|
@ -22,7 +31,116 @@ namespace Modules\HumanResourceManagement\Models;
|
|||
* @link https://orange-management.org
|
||||
* @since 1.0.0
|
||||
*/
|
||||
class EmployeeHistory
|
||||
class EmployeeHistory implements ArrayableInterface, \JsonSerializable
|
||||
{
|
||||
private $id = 0;
|
||||
|
||||
private $employee = null;
|
||||
|
||||
private $unit = null;
|
||||
|
||||
private $department = null;
|
||||
|
||||
private $position = null;
|
||||
|
||||
private $start = null;
|
||||
|
||||
private $end = null;
|
||||
|
||||
public function getId() : int
|
||||
{
|
||||
return $this->id;
|
||||
}
|
||||
|
||||
public function getEmployee()
|
||||
{
|
||||
return $this->employee ?? new NullEmployee();
|
||||
}
|
||||
|
||||
public function setEmployee($employee) : void
|
||||
{
|
||||
$this->employee = $employee;
|
||||
}
|
||||
|
||||
public function getPosition() : Position
|
||||
{
|
||||
return $this->position ?? new NullPosition();
|
||||
}
|
||||
|
||||
public function setPosition($position) : void
|
||||
{
|
||||
$this->position = $position;
|
||||
}
|
||||
|
||||
public function getUnit() : Unit
|
||||
{
|
||||
return $this->unit ?? new NullUnit();
|
||||
}
|
||||
|
||||
public function setUnit($unit) : void
|
||||
{
|
||||
$this->unit = $unit;
|
||||
}
|
||||
|
||||
public function getDepartment() : Department
|
||||
{
|
||||
return $this->department ?? new NullDepartment();
|
||||
}
|
||||
|
||||
public function setDepartment($department) : void
|
||||
{
|
||||
$this->department = $department;
|
||||
}
|
||||
|
||||
public function getStart() : ?\DateTime
|
||||
{
|
||||
return $this->start;
|
||||
}
|
||||
|
||||
public function setStart(\DateTime $start) : void
|
||||
{
|
||||
$this->start = $start;
|
||||
}
|
||||
|
||||
public function getEnd() : ?\DateTime
|
||||
{
|
||||
return $this->end;
|
||||
}
|
||||
|
||||
public function setEnd(\DateTime $end) : void
|
||||
{
|
||||
$this->end = $end;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function toArray() : array
|
||||
{
|
||||
return [
|
||||
'id' => $this->id,
|
||||
'employee' => !\is_int($this->employee) ? $this->employee->getId() : $this->employee,
|
||||
'unit' => $this->unit,
|
||||
'department' => $this->department,
|
||||
'position' => $this->position,
|
||||
'start' => $this->start->format('Y-m-d H:i:s'),
|
||||
'end' => $this->end === null ? null : $this->end->format('Y-m-d H:i:s'),
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function __toString()
|
||||
{
|
||||
return (string) \json_encode($this->toArray());
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function jsonSerialize()
|
||||
{
|
||||
return $this->toArray();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -15,9 +15,49 @@ declare(strict_types=1);
|
|||
namespace Modules\HumanResourceManagement\Models;
|
||||
|
||||
use phpOMS\DataStorage\Database\DataMapperAbstract;
|
||||
use Modules\Organization\Models\DepartmentMapper;
|
||||
use Modules\Organization\Models\PositionMapper;
|
||||
use Modules\Organization\Models\UnitMapper;
|
||||
|
||||
final class EmployeeHistoryMapper extends DataMapperAbstract
|
||||
{
|
||||
/**
|
||||
* Columns.
|
||||
*
|
||||
* @var array<string, array<string, bool|string>>
|
||||
* @since 1.0.0
|
||||
*/
|
||||
protected static $columns = [
|
||||
'hr_staff_history_id' => ['name' => 'hr_staff_history_id', 'type' => 'int', 'internal' => 'id'],
|
||||
'hr_staff_history_staff' => ['name' => 'hr_staff_history_staff', 'type' => 'int', 'internal' => 'employee'],
|
||||
'hr_staff_history_unit' => ['name' => 'hr_staff_history_unit', 'type' => 'int', 'internal' => 'unit'],
|
||||
'hr_staff_history_department' => ['name' => 'hr_staff_history_department', 'type' => 'int', 'internal' => 'department'],
|
||||
'hr_staff_history_position' => ['name' => 'hr_staff_history_position', 'type' => 'int', 'internal' => 'position'],
|
||||
'hr_staff_history_start' => ['name' => 'hr_staff_history_start', 'type' => 'DateTime', 'internal' => 'start'],
|
||||
'hr_staff_history_end' => ['name' => 'hr_staff_history_end', 'type' => 'DateTime', 'internal' => 'end'],
|
||||
];
|
||||
|
||||
/**
|
||||
* Belongs to.
|
||||
*
|
||||
* @var array<string, array<string, string>>
|
||||
* @since 1.0.0
|
||||
*/
|
||||
protected static $belongsTo = [
|
||||
'unit' => [
|
||||
'mapper' => UnitMapper::class,
|
||||
'src' => 'hr_staff_history_unit',
|
||||
],
|
||||
'department' => [
|
||||
'mapper' => DepartmentMapper::class,
|
||||
'src' => 'hr_staff_history_department',
|
||||
],
|
||||
'position' => [
|
||||
'mapper' => PositionMapper::class,
|
||||
'src' => 'hr_staff_history_position',
|
||||
],
|
||||
];
|
||||
|
||||
/**
|
||||
* Primary field name.
|
||||
*
|
||||
|
|
|
|||
|
|
@ -15,9 +15,6 @@ declare(strict_types=1);
|
|||
namespace Modules\HumanResourceManagement\Models;
|
||||
|
||||
use Modules\Admin\Models\AccountMapper;
|
||||
use Modules\Organization\Models\DepartmentMapper;
|
||||
use Modules\Organization\Models\PositionMapper;
|
||||
use Modules\Organization\Models\UnitMapper;
|
||||
use phpOMS\DataStorage\Database\DataMapperAbstract;
|
||||
|
||||
final class EmployeeMapper extends DataMapperAbstract
|
||||
|
|
@ -32,10 +29,6 @@ final class EmployeeMapper extends DataMapperAbstract
|
|||
protected static $columns = [
|
||||
'hr_staff_id' => ['name' => 'hr_staff_id', 'type' => 'int', 'internal' => 'id'],
|
||||
'hr_staff_account' => ['name' => 'hr_staff_account', 'type' => 'int', 'internal' => 'account'],
|
||||
'hr_staff_unit' => ['name' => 'hr_staff_unit', 'type' => 'int', 'internal' => 'unit'],
|
||||
'hr_staff_department' => ['name' => 'hr_staff_department', 'type' => 'int', 'internal' => 'department'],
|
||||
'hr_staff_position' => ['name' => 'hr_staff_position', 'type' => 'int', 'internal' => 'position'],
|
||||
'hr_staff_active' => ['name' => 'hr_staff_active', 'type' => 'bool', 'internal' => 'isActive'],
|
||||
];
|
||||
|
||||
/**
|
||||
|
|
@ -49,17 +42,20 @@ final class EmployeeMapper extends DataMapperAbstract
|
|||
'mapper' => AccountMapper::class,
|
||||
'src' => 'hr_staff_account',
|
||||
],
|
||||
'unit' => [
|
||||
'mapper' => UnitMapper::class,
|
||||
'src' => 'hr_staff_unit',
|
||||
],
|
||||
'department' => [
|
||||
'mapper' => DepartmentMapper::class,
|
||||
'src' => 'hr_staff_department',
|
||||
],
|
||||
'position' => [
|
||||
'mapper' => PositionMapper::class,
|
||||
'src' => 'hr_staff_position',
|
||||
];
|
||||
|
||||
/**
|
||||
* Has many relation.
|
||||
*
|
||||
* @var array<string, array<string, null|string>>
|
||||
* @since 1.0.0
|
||||
*/
|
||||
protected static $hasMany = [
|
||||
'history' => [
|
||||
'mapper' => EmployeeHistoryMapper::class,
|
||||
'table' => 'hr_staff_history',
|
||||
'dst' => 'hr_staff_history_staff',
|
||||
'src' => null,
|
||||
],
|
||||
];
|
||||
|
||||
|
|
|
|||
27
Models/NullEmployee.php
Normal file
27
Models/NullEmployee.php
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
<?php
|
||||
/**
|
||||
* Orange Management
|
||||
*
|
||||
* PHP Version 7.2
|
||||
*
|
||||
* @package Modules\News
|
||||
* @copyright Dennis Eichhorn
|
||||
* @license OMS License 1.0
|
||||
* @version 1.0.0
|
||||
* @link https://orange-management.org
|
||||
*/
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Modules\HumanResourceManagement\Models;
|
||||
|
||||
/**
|
||||
* Null model
|
||||
*
|
||||
* @package Modules\HumanResourceManagement
|
||||
* @license OMS License 1.0
|
||||
* @link https://orange-management.org
|
||||
* @since 1.0.0
|
||||
*/
|
||||
class NullEmployee extends Employee
|
||||
{
|
||||
}
|
||||
27
Models/NullEmployeeHistory.php
Normal file
27
Models/NullEmployeeHistory.php
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
<?php
|
||||
/**
|
||||
* Orange Management
|
||||
*
|
||||
* PHP Version 7.2
|
||||
*
|
||||
* @package Modules\News
|
||||
* @copyright Dennis Eichhorn
|
||||
* @license OMS License 1.0
|
||||
* @version 1.0.0
|
||||
* @link https://orange-management.org
|
||||
*/
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Modules\HumanResourceManagement\Models;
|
||||
|
||||
/**
|
||||
* Null model
|
||||
*
|
||||
* @package Modules\HumanResourceManagement
|
||||
* @license OMS License 1.0
|
||||
* @link https://orange-management.org
|
||||
* @since 1.0.0
|
||||
*/
|
||||
class NullEmployeeHistory extends EmployeeHistory
|
||||
{
|
||||
}
|
||||
|
|
@ -15,3 +15,59 @@
|
|||
*/
|
||||
|
||||
echo $this->getData('nav')->render();
|
||||
?>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-xs-12 col-md-4">
|
||||
<section class="box wf-100">
|
||||
<header><h1><?= $this->getHtml('Account'); ?></h1></header>
|
||||
<div class="inner">
|
||||
<form id="fAccount" action="<?= \phpOMS\Uri\UriFactory::build('{/api}admin/account'); ?>" method="put">
|
||||
<table class="layout wf-100">
|
||||
<tbody>
|
||||
<tr><td><label for="iType"><?= $this->getHtml('Type'); ?></label>
|
||||
<tr><td><select id="Type" name="type">
|
||||
<option value="<?= $this->printHtml(\phpOMS\Account\AccountType::USER); ?>"><?= $this->getHtml('Person'); ?>
|
||||
<option value="<?= $this->printHtml(\phpOMS\Account\AccountType::GROUP); ?>"><?= $this->getHtml('Organization'); ?>
|
||||
</select>
|
||||
<tr><td><label for="iStatus"><?= $this->getHtml('Status'); ?></label>
|
||||
<tr><td><select id="iStatus" name="status">
|
||||
<option value="<?= $this->printHtml(\phpOMS\Account\AccountStatus::ACTIVE); ?>"><?= $this->getHtml('Active'); ?>
|
||||
<option value="<?= $this->printHtml(\phpOMS\Account\AccountStatus::INACTIVE); ?>"><?= $this->getHtml('Inactive'); ?>
|
||||
<option value="<?= $this->printHtml(\phpOMS\Account\AccountStatus::TIMEOUT); ?>"><?= $this->getHtml('Timeout'); ?>
|
||||
<option value="<?= $this->printHtml(\phpOMS\Account\AccountStatus::BANNED); ?>"><?= $this->getHtml('Banned'); ?>
|
||||
</select>
|
||||
<tr><td><label for="iUsername"><?= $this->getHtml('Username'); ?></label>
|
||||
<tr><td><input id="iUsername" name="login" type="text" placeholder=" Fred">
|
||||
<tr><td><label for="iName1"><?= $this->getHtml('Name1'); ?></label>
|
||||
<tr><td><input id="iName1" name="name1" type="text" placeholder=" Donald" required>
|
||||
<tr><td><label for="iName2"><?= $this->getHtml('Name2'); ?></label>
|
||||
<tr><td><input id="iName2" name="name2" type="text" placeholder=" Fauntleroy">
|
||||
<tr><td><label for="iName3"><?= $this->getHtml('Name3'); ?></label>
|
||||
<tr><td><input id="iName3" name="name3" type="text" placeholder=" Duck">
|
||||
<tr><td><label for="iEmail"><?= $this->getHtml('Email'); ?></label>
|
||||
<tr><td><input id="iEmail" name="email" type="email" placeholder=" d.duck@duckburg.com">
|
||||
<tr><td><label for="iPassword"><?= $this->getHtml('Name3'); ?></label>
|
||||
<tr><td><input id="iPassword" name="password" type="password" placeholder=" Pa55ssw0rd?">
|
||||
<tr><td><input id="account-create-submit" name="createSubmit" type="submit" value="<?= $this->getHtml('Create', '0', '0'); ?>">
|
||||
</table>
|
||||
</form>
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
|
||||
<div class="col-xs-12 col-md-4">
|
||||
<section class="box wf-100">
|
||||
<header><h1><?= $this->getHtml('CreateFromExistingAccount'); ?></h1></header>
|
||||
<div class="inner">
|
||||
<form id="fAccount" action="<?= \phpOMS\Uri\UriFactory::build('{/api}admin/account'); ?>" method="put">
|
||||
<table class="layout wf-100">
|
||||
<tbody>
|
||||
<tr><td><label for="iAccount"><?= $this->getHtml('Account'); ?></label>
|
||||
<tr><td><?= $this->getData('accSelector')->render('iAccount', 'account', true); ?>
|
||||
</table>
|
||||
</form>
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -14,13 +14,6 @@
|
|||
* @var \phpOMS\Views\View $this
|
||||
*/
|
||||
|
||||
$footerView = new \phpOMS\Views\PaginationView($this->app, $this->request, $this->response);
|
||||
$footerView->setTemplate('/Web/Templates/Lists/Footer/PaginationBig');
|
||||
|
||||
$footerView->setPages(25);
|
||||
$footerView->setPage(1);
|
||||
$footerView->setResults(1);
|
||||
|
||||
$employees = $this->getData('employees');
|
||||
|
||||
echo $this->getData('nav')->render(); ?>
|
||||
|
|
@ -42,14 +35,10 @@ echo $this->getData('nav')->render(); ?>
|
|||
<tr><td colspan="5">
|
||||
<tbody>
|
||||
<?php $c = 0; foreach ($employees as $key => $value) : ++$c;
|
||||
$url = \phpOMS\Uri\UriFactory::build('{/prefix}hr/staff/profile?{?}&id=' . $value->getId()); ?>
|
||||
$url = \phpOMS\Uri\UriFactory::build('{/prefix}humanresource/staff/profile?{?}&id=' . $value->getId()); ?>
|
||||
<tr data-href="<?= $url; ?>">
|
||||
<td data-label="<?= $this->getHtml('ID', '0', '0') ?>"><a href="<?= $url; ?>"><?= $this->printHtml($value->getId()); ?></a>
|
||||
<td data-label="<?= $this->getHtml('Name') ?>"><a href="<?= $url; ?>"><?= $this->printHtml($value->getAccount()->getName1()); ?></a>
|
||||
<td data-label="<?= $this->getHtml('Unit') ?>"><a href="<?= $url; ?>"><?= $this->printHtml($value->getUnit()->getName()); ?></a>
|
||||
<td data-label="<?= $this->getHtml('Department') ?>"><a href="<?= $url; ?>"><?= $this->printHtml($value->getDepartment()->getName()); ?></a>
|
||||
<td data-label="<?= $this->getHtml('Position') ?>"><a href="<?= $url; ?>"><?= $this->printHtml($value->getPosition()->getName()); ?></a>
|
||||
<td data-label="<?= $this->getHtml('Status') ?>"><a href="<?= $url; ?>"><?= $this->printHtml($value->getPosition()->getName()); ?></a>
|
||||
<?php endforeach; ?>
|
||||
<?php if ($c === 0) : ?>
|
||||
<tr><td colspan="5" class="empty"><?= $this->getHtml('Empty', '0', '0'); ?>
|
||||
|
|
@ -58,4 +47,3 @@ echo $this->getData('nav')->render(); ?>
|
|||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
|
|
|||
|
|
@ -12,6 +12,8 @@
|
|||
*/
|
||||
|
||||
$employee = $this->getData('employee');
|
||||
$history = $employee->getHistorY();
|
||||
$recentHistory = $employee->getNewestHistory();
|
||||
|
||||
echo $this->getData('nav')->render(); ?>
|
||||
|
||||
|
|
@ -24,13 +26,13 @@ echo $this->getData('nav')->render(); ?>
|
|||
<table class="list">
|
||||
<tr>
|
||||
<th><?= $this->getHtml('Position') ?>
|
||||
<td itemprop="jobTitle"><?= $this->printHtml($employee->getPosition()->getName()); ?>
|
||||
<td itemprop="jobTitle"><?= $this->printHtml($recentHistory->getPosition()->getName()); ?>
|
||||
<tr>
|
||||
<th><?= $this->getHtml('Department') ?>
|
||||
<td itemprop="jobTitle"><?= $this->printHtml($employee->getDepartment()->getName()); ?>
|
||||
<td itemprop="jobTitle"><?= $this->printHtml($recentHistory->getDepartment()->getName()); ?>
|
||||
<tr>
|
||||
<th><?= $this->getHtml('Unit') ?>
|
||||
<td itemprop="jobTitle"><?= $this->printHtml($employee->getUnit()->getName()); ?>
|
||||
<td itemprop="jobTitle"><?= $this->printHtml($recentHistory->getUnit()->getName()); ?>
|
||||
<tr>
|
||||
<th><?= $this->getHtml('Birthday') ?>
|
||||
<td itemprop="birthDate">06.09.1934
|
||||
|
|
@ -86,10 +88,25 @@ echo $this->getData('nav')->render(); ?>
|
|||
</div>
|
||||
|
||||
<div class="col-xs-12 col-md-6">
|
||||
<section class="box wf-100">
|
||||
<header><h1><?= $this->getHtml('History') ?></h1></header>
|
||||
<div class="inner">
|
||||
</div>
|
||||
</section>
|
||||
<div class="box wf-100 x-overflow">
|
||||
<table id="taskList" class="default">
|
||||
<caption><?= $this->getHtml('History') ?><i class="fa fa-download floatRight download btn"></i></caption>
|
||||
<thead>
|
||||
<td><?= $this->getHtml('Start') ?><i class="sort-asc fa fa-chevron-up"></i><i class="sort-desc fa fa-chevron-down"></i>
|
||||
<td><?= $this->getHtml('End') ?><i class="sort-asc fa fa-chevron-up"></i><i class="sort-desc fa fa-chevron-down"></i>
|
||||
<td><?= $this->getHtml('Unit') ?><i class="sort-asc fa fa-chevron-up"></i><i class="sort-desc fa fa-chevron-down"></i>
|
||||
<td><?= $this->getHtml('Department') ?><i class="sort-asc fa fa-chevron-up"></i><i class="sort-desc fa fa-chevron-down"></i>
|
||||
<td><?= $this->getHtml('Position') ?><i class="sort-asc fa fa-chevron-up"></i><i class="sort-desc fa fa-chevron-down"></i>
|
||||
<tfoot>
|
||||
<tbody>
|
||||
<?php foreach ($history as $hist) : ?>
|
||||
<tr><td><?= $hist->getStart()->format('Y-m-d'); ?>
|
||||
<td><?= $hist->getEnd() === null ? '' : $hist->getEnd()->format('Y-m-d'); ?>
|
||||
<td><?= $this->printHtml($hist->getUnit()->getName()); ?>
|
||||
<td><?= $this->printHtml($hist->getDepartment()->getName()); ?>
|
||||
<td><?= $this->printHtml($hist->getPosition()->getName()); ?>
|
||||
<?php endforeach; ?>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user