Optimize hr templates

This commit is contained in:
Dennis Eichhorn 2017-09-30 11:04:00 +02:00
parent 95cdff502c
commit fca9e23636
9 changed files with 100 additions and 183 deletions

View File

@ -47,6 +47,7 @@ class Installer extends InstallerAbstract
`hr_staff_unit` int(11) DEFAULT NULL,
`hr_staff_department` int(11) DEFAULT NULL,
`hr_staff_position` int(11) DEFAULT NULL,
`hr_staff_active` int(1) NOT NULL,
PRIMARY KEY (`hr_staff_id`),
KEY `hr_staff_account` (`hr_staff_account`),
KEY `hr_staff_unit` (`hr_staff_unit`),

View File

@ -137,6 +137,10 @@ class Controller extends ModuleAbstract implements WebInterface
$view->setTemplate('/Modules/HumanResourceManagement/Theme/Backend/staff-single');
$view->addData('nav', $this->app->moduleManager->get('Navigation')->createNavigationMid(1002402001, $request, $response));
$employee = EmployeeMapper::get((int) $request->getData('id'));
$view->addData('employee', $employee);
return $view;
}

View File

@ -43,6 +43,8 @@ class Employee {
private $position = null;
private $isActive = true;
private $history = [];
private $status = [];
@ -56,6 +58,16 @@ class Employee {
return $this->account;
}
public function setActivity(bool $active)
{
$this->active = $active;
}
public function isActive() : bool
{
return $this->isActive;
}
public function setUnit($unit)
{
$this->unit = $unit;

View File

@ -35,6 +35,7 @@ class EmployeeMapper extends DataMapperAbstract
'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'],
];
static protected $belongsTo = [

View File

@ -1,45 +0,0 @@
<?php
/**
* Orange Management
*
* PHP Version 7.1
*
* @category TBD
* @package TBD
* @copyright Dennis Eichhorn
* @license OMS License 1.0
* @version 1.0.0
* @link http://orange-management.com
*/
declare(strict_types=1);
namespace Modules\HumanResourceManagement\Models;
use phpOMS\Stdlib\Base\Enum;
/**
* Position type enum.
*
* @category Module
* @package Modules\HumanResources
* @license OMS License 1.0
* @link http://orange-management.com
* @since 1.0.0
*/
abstract class PositionType extends Enum
{
/* public */ const INTERN = 0;
/* public */ const APPRENTICE = 1;
/* public */ const JUNIOR = 2;
/* public */ const REGULAR = 3;
/* public */ const SENIOR = 4;
/* public */ const ASSISTANT = 5;
/* public */ const TEAMLEADER = 6;
/* public */ const HEAD = 7;
}

View File

@ -12,9 +12,13 @@
* @link http://orange-management.com
*/
return ['HumanResourceManagement' => [
'Birthday' => 'Birthday',
'Clocking' => 'Clocking',
'Department' => 'Department',
'Departments' => 'Departments',
'Email' => 'Email',
'Employees' => 'Employees',
'History' => 'History',
'Name' => 'Name',
'Parent' => 'Parent',
'Personnel' => 'Personnel',
@ -22,5 +26,6 @@ return ['HumanResourceManagement' => [
'Shifts' => 'Shifts',
'Staff' => 'Staff',
'Status' => 'Status',
'Unit' => 'Unit',
'Vacation' => 'Vacation',
]];

View File

@ -42,7 +42,7 @@ echo $this->getData('nav')->render(); ?>
<tbody>
<?php $c = 0; foreach ($departments as $key => $value) : $c++;
$url = \phpOMS\Uri\UriFactory::build('{/base}/{/lang}/backend/hr/department/single?{?}&id=' . $value->getId()); ?>
<tr>
<tr data-href="<?= $url; ?>">
<td><a href="<?= $url; ?>"><?= $this->printHtml($value->getId()); ?></a>
<td><a href="<?= $url; ?>"><?= $this->printHtml($value->getName()); ?></a>
<td>

View File

@ -42,7 +42,7 @@ echo $this->getData('nav')->render(); ?>
<tr><td colspan="5"><?= $footerView->render(); ?>
<tbody>
<?php $c = 0; foreach ($employees as $key => $value) : $c++;
$url = \phpOMS\Uri\UriFactory::build('{/base}/{/lang}/backend/hr/staff/single?{?}&id=' . $value->getId()); ?>
$url = \phpOMS\Uri\UriFactory::build('{/base}/{/lang}/backend/hr/staff/profile?{?}&id=' . $value->getId()); ?>
<tr data-href="<?= $url; ?>">
<td><a href="<?= $url; ?>"><?= $this->printHtml($value->getId()); ?></a>
<td><a href="<?= $url; ?>"><?= $this->printHtml($value->getAccount()->getName1()); ?></a>

View File

@ -11,147 +11,86 @@
* @version 1.0.0
* @link http://orange-management.com
*/
$employee = $this->getData('employee');
echo $this->getData('nav')->render(); ?>
<section itemscope itemtype="http://schema.org/Person" class="box w-33">
<header><h1><?= $this->getHtml('Employee') ?></h1></header>
<div class="inner">
<!-- @formatter:off -->
<table class="list">
<tr>
<th><?= $this->getHtml('Name') ?>
<td><span itemprop="familyName"><?= $this->printHtml($account->getName3()); ?></span>, <span itemprop="givenName"><?= $this->printHtml($account->getName1()); ?></span>
<tr>
<th><?= $this->getHtml('Position') ?>
<td itemprop="jobTitle">Sailor
<tr>
<th><?= $this->getHtml('Department') ?>
<td itemprop="jobTitle">Sailor
<tr>
<th><?= $this->getHtml('Birthday') ?>
<td itemprop="birthDate">06.09.1934
<tr>
<th><?= $this->getHtml('Email') ?>
<td itemprop="email"><a href="mailto:>donald.duck@email.com<"><?= $this->printHtml($account->getEmail()); ?></a>
<tr>
<th>Address
<td>
<tr>
<th class="vT">Private
<td itemprop="address">SMALLSYS INC<br>795 E DRAGRAM<br>TUCSON AZ 85705<br>USA
<tr>
<th class="vT">Work
<td itemprop="address">SMALLSYS INC<br>795 E DRAGRAM<br>TUCSON AZ 85705<br>USA
<tr>
<th><?= $this->getHtml('Phone') ?>
<td>
<tr>
<th>Private
<td itemprop="telephone">+01 12345-4567
<tr>
<th>Mobile
<td itemprop="telephone">+01 12345-4567
<tr>
<th>Work
<td itemprop="telephone">+01 12345-4567
<tr>
<th><?= $this->getHtml('Status') ?>
<td><span class="tag green"><?= $this->printHtml($account->getStatus()); ?></span>
</table>
<!-- @formatter:on -->
<div class="row">
<div class="col-xs-12 col-md-6">
<section itemscope itemtype="http://schema.org/Person" class="box wf-100">
<header><h1><span itemprop="familyName"><?= $this->printHtml($employee->getAccount()->getName3()); ?></span>, <span itemprop="givenName"><?= $this->printHtml($employee->getAccount()->getName1()); ?></span></h1></header>
<div class="inner">
<!-- @formatter:off -->
<table class="list">
<tr>
<th><?= $this->getHtml('Position') ?>
<td itemprop="jobTitle"><?= $this->printHtml($employee->getPosition()->getName()); ?>
<tr>
<th><?= $this->getHtml('Department') ?>
<td itemprop="jobTitle"><?= $this->printHtml($employee->getDepartment()->getName()); ?>
<tr>
<th><?= $this->getHtml('Unit') ?>
<td itemprop="jobTitle"><?= $this->printHtml($employee->getUnit()->getName()); ?>
<tr>
<th><?= $this->getHtml('Birthday') ?>
<td itemprop="birthDate">06.09.1934
<tr>
<th><?= $this->getHtml('Email') ?>
<td itemprop="email"><a href="mailto:>donald.duck@email.com<"><?= $this->printHtml($employee->getAccount()->getEmail()); ?></a>
<tr>
<th>Address
<td>
<tr>
<th class="vT">Private
<td itemprop="address">SMALLSYS INC<br>795 E DRAGRAM<br>TUCSON AZ 85705<br>USA
<tr>
<th class="vT">Work
<td itemprop="address">SMALLSYS INC<br>795 E DRAGRAM<br>TUCSON AZ 85705<br>USA
<tr>
<th><?= $this->getHtml('Phone') ?>
<td>
<tr>
<th>Private
<td itemprop="telephone">+01 12345-4567
<tr>
<th>Mobile
<td itemprop="telephone">+01 12345-4567
<tr>
<th>Work
<td itemprop="telephone">+01 12345-4567
<tr>
<th><?= $this->getHtml('Status') ?>
<td><span class="tag green"><?= $this->printHtml($employee->getAccount()->getStatus()); ?></span>
</table>
<!-- @formatter:on -->
</div>
</section>
</div>
</section>
<section class="box w-33">
<header><h1><?= $this->getHtml('Overview') ?></h1></header>
<div class="inner">
<!-- @formatter:off -->
<table class="list">
<tr>
<th><?= $this->getHtml('Start') ?>
<td><span itemprop="familyName"><?= $this->printHtml($account->getName3()); ?></span>
<tr>
<th><?= $this->getHtml('End') ?>
<td><span itemprop="familyName"><?= $this->printHtml($account->getName3()); ?></span>
<tr>
<th><?= $this->getHtml('Hours') ?>
<td><span itemprop="familyName"><?= $this->printHtml($account->getName3()); ?></span>
<tr>
<th><?= $this->getHtml('Vacation') ?>
<td><span itemprop="familyName"><?= $this->printHtml($account->getName3()); ?></span>
<tr>
<th><?= $this->getHtml('Salary') ?>
<td><span itemprop="familyName"><?= $this->printHtml($account->getName3()); ?></span>
</table>
<!-- @formatter:on -->
<div class="col-xs-12 col-md-6">
<section class="box wf-100">
<header><h1><?= $this->getHtml('Clocking') ?></h1></header>
<div class="inner">
</div>
</section>
</div>
</section>
<div class="box w-100">
<table class="table red">
<caption><?= $this->getHtml('Working') ?></caption>
<thead>
<tr>
<td><?= $this->getHtml('Start') ?>
<td><?= $this->getHtml('End') ?>
<td><?= $this->getHtml('Position') ?>
<td><?= $this->getHtml('Department') ?>
<td><?= $this->getHtml('Salary') ?>
<tfoot>
<tr><td colspan="4"><?= $footerView->render(); ?>
<tbody>
<?php $c = 0; foreach ($employees as $key => $value) : $c++;
$url = \phpOMS\Uri\UriFactory::build('{/base}/{/lang}/backend/admin/group/settings?{?}&id=' . $value->getId()); ?>
<tr>
<td><a href="<?= $url; ?>"><?= $this->printHtml($value->getId()); ?></a>
<td><a href="<?= $url; ?>"><?= $this->printHtml($value->getNewestHistory()->getPosition()); ?></a>
<td><a href="<?= $url; ?>"><?= $this->printHtml($value->getNewestHistory()->getPosition()); ?></a>
<?php endforeach; ?>
<?php if($c === 0) : ?>
<tr><td colspan="4" class="empty"><?= $this->getHtml('Empty', 0, 0); ?>
<?php endif; ?>
</table>
</div>
<div class="box w-100">
<table class="table red">
<caption><?= $this->getHtml('Timing') ?></caption>
<thead>
<tr>
<td><?= $this->getHtml('Start') ?>
<td><?= $this->getHtml('End') ?>
<td class="wf-100"><?= $this->getHtml('Type') ?>
<tfoot>
<tr><td colspan="4"><?= $footerView->render(); ?>
<tbody>
<?php $c = 0; foreach ($employees as $key => $value) : $c++;
$url = \phpOMS\Uri\UriFactory::build('{/base}/{/lang}/backend/admin/group/settings?{?}&id=' . $value->getId()); ?>
<tr>
<td><a href="<?= $url; ?>"><?= $this->printHtml($value->getId()); ?></a>
<td><a href="<?= $url; ?>"><?= $this->printHtml($value->getNewestHistory()->getPosition()); ?></a>
<td><a href="<?= $url; ?>"><?= $this->printHtml($value->getNewestHistory()->getPosition()); ?></a>
<?php endforeach; ?>
<?php if($c === 0) : ?>
<tr><td colspan="4" class="empty"><?= $this->getHtml('Empty', 0, 0); ?>
<?php endif; ?>
</table>
</div>
<section class="box w-33">
<header><h1><?= $this->getHtml('Salary') ?></h1></header>
<div class="inner">
<!-- @formatter:off -->
<table class="list">
<tr>
<th><?= $this->getHtml('Date') ?>
<td><span itemprop="familyName"><?= $this->printHtml($account->getName3()); ?></span>
<tr>
<th><?= $this->getHtml('SalaryType') ?>
<td><span itemprop="familyName"><?= $this->printHtml($account->getName3()); ?></span>
<tr>
<th><?= $this->getHtml('Amount') ?>
<td><span itemprop="familyName"><?= $this->printHtml($account->getName3()); ?></span>
</table>
<!-- @formatter:on -->
<div class="row">
<div class="col-xs-12 col-md-6">
<section class="box wf-100">
<header><h1><?= $this->getHtml('Clocking') ?></h1></header>
<div class="inner">
</div>
</section>
</div>
</section>
<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>
</div>