mirror of
https://github.com/Karaka-Management/oms-HumanResourceManagement.git
synced 2026-01-10 20:08:40 +00:00
fix templates
This commit is contained in:
parent
034918a977
commit
a14b555342
|
|
@ -29,7 +29,7 @@
|
|||
"children": [
|
||||
{
|
||||
"id": 1002402101,
|
||||
"pid": "/humanresource/staff",
|
||||
"pid": "/humanresource",
|
||||
"type": 3,
|
||||
"subtype": 1,
|
||||
"name": "List",
|
||||
|
|
@ -45,7 +45,7 @@
|
|||
},
|
||||
{
|
||||
"id": 1002402201,
|
||||
"pid": "/humanresource/staff",
|
||||
"pid": "/humanresource",
|
||||
"type": 3,
|
||||
"subtype": 1,
|
||||
"name": "Create",
|
||||
|
|
|
|||
|
|
@ -23,6 +23,7 @@ use Modules\HumanResourceManagement\Models\EmployeeHistoryMapper;
|
|||
use Modules\HumanResourceManagement\Models\EmployeeMapper;
|
||||
use Modules\HumanResourceManagement\Models\EmployeeWorkHistory;
|
||||
use Modules\HumanResourceManagement\Models\EmployeeWorkHistoryMapper;
|
||||
use Modules\HumanResourceManagement\Models\NullEmployee;
|
||||
use Modules\HumanResourceManagement\Models\PermissionCategory;
|
||||
use Modules\Media\Models\NullCollection;
|
||||
use Modules\Media\Models\PathSettings;
|
||||
|
|
@ -274,7 +275,8 @@ final class ApiController extends Controller
|
|||
*/
|
||||
private function createEmployeeHistoryFromRequest(RequestAbstract $request) : EmployeeHistory
|
||||
{
|
||||
$history = new EmployeeHistory($request->getDataInt('employee') ?? 0);
|
||||
$history = new EmployeeHistory();
|
||||
$history->employee = new NullEmployee($request->getDataInt('employee') ?? 0);
|
||||
$history->unit = new NullUnit($request->getDataInt('unit') ?? 0);
|
||||
$history->department = new NullDepartment($request->getDataInt('department') ?? 0);
|
||||
$history->position = new NullPosition($request->getDataInt('position') ?? 0);
|
||||
|
|
|
|||
|
|
@ -14,6 +14,7 @@ declare(strict_types=1);
|
|||
|
||||
namespace Modules\HumanResourceManagement\Controller;
|
||||
|
||||
use Modules\HumanResourceManagement\Models\EmployeeHistory;
|
||||
use Modules\HumanResourceManagement\Models\EmployeeHistoryMapper;
|
||||
use Modules\HumanResourceManagement\Models\EmployeeMapper;
|
||||
use Modules\HumanResourceTimeRecording\Models\SessionMapper;
|
||||
|
|
@ -26,6 +27,7 @@ use Modules\Organization\Models\UnitMapper;
|
|||
use Modules\Profile\Models\SettingsEnum;
|
||||
use phpOMS\Contract\RenderableInterface;
|
||||
use phpOMS\DataStorage\Database\Query\OrderType;
|
||||
use phpOMS\Message\Http\RequestStatusCode;
|
||||
use phpOMS\Message\RequestAbstract;
|
||||
use phpOMS\Message\ResponseAbstract;
|
||||
use phpOMS\Stdlib\Base\SmartDateTime;
|
||||
|
|
@ -69,20 +71,17 @@ final class BackendController extends Controller
|
|||
->with('companyHistory/unit')
|
||||
->with('companyHistory/department')
|
||||
->with('companyHistory/position')
|
||||
->sort('companyHistory/start', OrderType::DESC)
|
||||
->sort('companyHistory/end', OrderType::DESC)
|
||||
//->limit(1, 'companyHistory') // @todo This is not working since it returns 1 for ALL employees instead of per employee
|
||||
->executeGetArray();
|
||||
|
||||
/** @var \Model\Setting $profileImage */
|
||||
$profileImage = $this->app->appSettings->get(names: SettingsEnum::DEFAULT_PROFILE_IMAGE, module: 'Profile');
|
||||
|
||||
/** @var \Modules\Media\Models\Media $image */
|
||||
$image = MediaMapper::get()
|
||||
$view->data['defaultImage'] = MediaMapper::get()
|
||||
->where('id', (int) $profileImage->content)
|
||||
->execute();
|
||||
|
||||
$view->data['defaultImage'] = $image;
|
||||
|
||||
return $view;
|
||||
}
|
||||
|
||||
|
|
@ -125,6 +124,13 @@ final class BackendController extends Controller
|
|||
public function viewHrStaffView(RequestAbstract $request, ResponseAbstract $response, array $data = []) : RenderableInterface
|
||||
{
|
||||
$view = new View($this->app->l11nManager, $request, $response);
|
||||
if (!$request->hasData('id')) {
|
||||
$response->header->status = RequestStatusCode::R_404;
|
||||
$view->setTemplate('/Web/Backend/Error/404');
|
||||
|
||||
return $view;
|
||||
}
|
||||
|
||||
$view->setTemplate('/Modules/HumanResourceManagement/Theme/Backend/staff-view');
|
||||
$view->data['nav'] = $this->app->moduleManager->get('Navigation')->createNavigationMid(1002402001, $request, $response);
|
||||
|
||||
|
|
@ -144,7 +150,7 @@ final class BackendController extends Controller
|
|||
->with('educationHistory')
|
||||
->with('workHistory')
|
||||
->where('id', (int) $request->getData('id'))
|
||||
->sort('companyHistory/start', OrderType::DESC)
|
||||
->sort('companyHistory/end', OrderType::DESC)
|
||||
->sort('educationHistory/start', OrderType::DESC)
|
||||
->sort('workHistory/start', OrderType::DESC)
|
||||
->execute();
|
||||
|
|
@ -207,6 +213,8 @@ final class BackendController extends Controller
|
|||
|
||||
$histories = EmployeeHistoryMapper::getAll()
|
||||
->where('department', \array_map(function (Department $department) : int { return $department->id; }, $view->data['departments']))
|
||||
->where('unit', $this->app->unitId)
|
||||
->where('end', null)
|
||||
->executeGetArray();
|
||||
|
||||
$stats = [];
|
||||
|
|
@ -223,6 +231,100 @@ final class BackendController extends Controller
|
|||
return $view;
|
||||
}
|
||||
|
||||
/**
|
||||
* Routing end-point for application behavior.
|
||||
*
|
||||
* @param RequestAbstract $request Request
|
||||
* @param ResponseAbstract $response Response
|
||||
* @param array $data Generic data
|
||||
*
|
||||
* @return RenderableInterface
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @codeCoverageIgnore
|
||||
*/
|
||||
public function viewHrDepartmentView(RequestAbstract $request, ResponseAbstract $response, array $data = []) : RenderableInterface
|
||||
{
|
||||
$view = new View($this->app->l11nManager, $request, $response);
|
||||
$view->setTemplate('/Modules/HumanResourceManagement/Theme/Backend/staff-list');
|
||||
$view->data['nav'] = $this->app->moduleManager->get('Navigation')->createNavigationMid(1002402001, $request, $response);
|
||||
|
||||
$histories = EmployeeHistoryMapper::getAll()
|
||||
->where('unit', $this->app->unitId)
|
||||
->where('department', (int) $request->getData('id'))
|
||||
->where('end', null)
|
||||
->executeGetArray();
|
||||
|
||||
$view->data['employees'] = empty($histories) ? [] : EmployeeMapper::getAll()
|
||||
->with('profile')
|
||||
->with('profile/account')
|
||||
->with('image')
|
||||
->with('profile/image')
|
||||
->with('companyHistory')
|
||||
->with('companyHistory/unit')
|
||||
->with('companyHistory/department')
|
||||
->with('companyHistory/position')
|
||||
->sort('companyHistory/end', OrderType::DESC)
|
||||
->where('id', \array_map(function (EmployeeHistory $history) : int { return $history->employee->id; }, $histories))
|
||||
->executeGetArray();
|
||||
|
||||
/** @var \Model\Setting $profileImage */
|
||||
$profileImage = $this->app->appSettings->get(names: SettingsEnum::DEFAULT_PROFILE_IMAGE, module: 'Profile');
|
||||
|
||||
$view->data['defaultImage'] = MediaMapper::get()
|
||||
->where('id', (int) $profileImage->content)
|
||||
->execute();
|
||||
|
||||
return $view;
|
||||
}
|
||||
|
||||
/**
|
||||
* Routing end-point for application behavior.
|
||||
*
|
||||
* @param RequestAbstract $request Request
|
||||
* @param ResponseAbstract $response Response
|
||||
* @param array $data Generic data
|
||||
*
|
||||
* @return RenderableInterface
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @codeCoverageIgnore
|
||||
*/
|
||||
public function viewHrPositionView(RequestAbstract $request, ResponseAbstract $response, array $data = []) : RenderableInterface
|
||||
{
|
||||
$view = new View($this->app->l11nManager, $request, $response);
|
||||
$view->setTemplate('/Modules/HumanResourceManagement/Theme/Backend/staff-list');
|
||||
$view->data['nav'] = $this->app->moduleManager->get('Navigation')->createNavigationMid(1002402001, $request, $response);
|
||||
|
||||
$histories = EmployeeHistoryMapper::getAll()
|
||||
->where('unit', $this->app->unitId)
|
||||
->where('position', (int) $request->getData('id'))
|
||||
->where('end', null)
|
||||
->executeGetArray();
|
||||
|
||||
$view->data['employees'] = empty($histories) ? [] : EmployeeMapper::getAll()
|
||||
->with('profile')
|
||||
->with('profile/account')
|
||||
->with('image')
|
||||
->with('profile/image')
|
||||
->with('companyHistory')
|
||||
->with('companyHistory/unit')
|
||||
->with('companyHistory/department')
|
||||
->with('companyHistory/position')
|
||||
->sort('companyHistory/end', OrderType::DESC)
|
||||
->where('id', \array_map(function (EmployeeHistory $history) : int { return $history->employee->id; }, $histories))
|
||||
->executeGetArray();
|
||||
|
||||
/** @var \Model\Setting $profileImage */
|
||||
$profileImage = $this->app->appSettings->get(names: SettingsEnum::DEFAULT_PROFILE_IMAGE, module: 'Profile');
|
||||
|
||||
$view->data['defaultImage'] = MediaMapper::get()
|
||||
->where('id', (int) $profileImage->content)
|
||||
->execute();
|
||||
|
||||
return $view;
|
||||
}
|
||||
|
||||
/**
|
||||
* Routing end-point for application behavior.
|
||||
*
|
||||
|
|
@ -253,6 +355,8 @@ final class BackendController extends Controller
|
|||
$histories = EmployeeHistoryMapper::getAll()
|
||||
->where('department', \array_map(function (Department $department) : int { return $department->id; }, $departments))
|
||||
->where('position', \array_map(function (Position $position) : int { return $position->id; }, $view->data['positions']))
|
||||
->where('unit', $this->app->unitId)
|
||||
->where('end', null)
|
||||
->executeGetArray();
|
||||
|
||||
$stats = [];
|
||||
|
|
|
|||
|
|
@ -44,10 +44,10 @@ class EmployeeHistory implements \JsonSerializable
|
|||
/**
|
||||
* Employee
|
||||
*
|
||||
* @var int|Employee
|
||||
* @var Employee
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public $employee = 0;
|
||||
public Employee $employee;
|
||||
|
||||
/**
|
||||
* Unit
|
||||
|
|
@ -99,9 +99,9 @@ class EmployeeHistory implements \JsonSerializable
|
|||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public function __construct($employee = 0)
|
||||
public function __construct()
|
||||
{
|
||||
$this->employee = $employee;
|
||||
$this->employee = new NullEmployee();
|
||||
$this->start = new \DateTime('now');
|
||||
$this->unit = new NullUnit();
|
||||
$this->department = new NullDepartment();
|
||||
|
|
|
|||
|
|
@ -46,4 +46,6 @@ return ['HumanResourceManagement' => [
|
|||
'Title' => 'Titel',
|
||||
'Unit' => 'Einheit',
|
||||
'Work' => 'Arbeiten',
|
||||
'Total' => 'Gesamt',
|
||||
'FTE' => 'MAK',
|
||||
]];
|
||||
|
|
|
|||
|
|
@ -46,4 +46,6 @@ return ['HumanResourceManagement' => [
|
|||
'Title' => 'Title',
|
||||
'Unit' => 'Unit',
|
||||
'Work' => 'Work',
|
||||
'Total' => 'Total',
|
||||
'FTE' => 'FTE',
|
||||
]];
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@ echo $this->data['nav']->render(); ?>
|
|||
|
||||
<div class="row">
|
||||
<div class="col-xs-12">
|
||||
<div class="portlet">
|
||||
<section class="portlet">
|
||||
<div class="portlet-head"><?= $this->getHtml('Positions'); ?><i class="g-icon download btn end-xs">download</i></div>
|
||||
<div class="slider">
|
||||
<table class="default sticky">
|
||||
|
|
@ -48,6 +48,6 @@ echo $this->data['nav']->render(); ?>
|
|||
<?php endif; ?>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -25,7 +25,7 @@ echo $this->data['nav']->render(); ?>
|
|||
|
||||
<div class="row">
|
||||
<div class="col-xs-12">
|
||||
<div class="portlet">
|
||||
<section class="portlet">
|
||||
<div class="portlet-head"><?= $this->getHtml('Staff'); ?><i class="g-icon download btn end-xs">download</i></div>
|
||||
<div class="slider">
|
||||
<table id="employeeList" class="default sticky">
|
||||
|
|
@ -58,10 +58,13 @@ echo $this->data['nav']->render(); ?>
|
|||
<td><?= $value->getNewestHistory()->id > 0 ? $this->getHtml('Active') : $this->getHtml('Inactive'); ?>
|
||||
<?php endforeach; ?>
|
||||
<?php if ($c === 0) : ?>
|
||||
<tr><td colspan="6" class="empty"><?= $this->getHtml('Empty', '0', '0'); ?>
|
||||
<tr><td colspan="7" class="empty"><?= $this->getHtml('Empty', '0', '0'); ?>
|
||||
<?php endif; ?>
|
||||
<tr class="hl-3">
|
||||
<td colspan="6"><?= $this->getHtml('Total'); ?>
|
||||
<td><?= $c; ?>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -397,20 +397,20 @@ echo $this->data['nav']->render(); ?>
|
|||
<th colspan="6" class="hl-3"> <?= $startWeek->format('Y/m/d'); ?> - <?= $endWeek->format('Y/m/d'); ?>
|
||||
<th class="hl-3"><?= (int) ($busy['week'] / 3600); ?>h <?= ((int) ($busy['week'] / 60) % 60); ?>m
|
||||
<?php
|
||||
$endWeek = $startWeek->createModify(0, 0, -1);
|
||||
$startWeek = $startWeek->createModify(0, 0, -7);
|
||||
$busy['week'] = 0;
|
||||
endif;
|
||||
$endWeek = $startWeek->createModify(0, 0, -1);
|
||||
$startWeek = $startWeek->createModify(0, 0, -7);
|
||||
$busy['week'] = 0;
|
||||
endif;
|
||||
?>
|
||||
<?php if ($current->getTimestamp() <= $startMonth->getTimestamp()) : ?>
|
||||
<tr>
|
||||
<th colspan="6" class="hl-2"><?= $startMonth->format('Y/m/d'); ?> - <?= $endMonth->format('Y/m/d'); ?>
|
||||
<th class="hl-2"><?= (int) ($busy['month'] / 3600); ?>h <?= ((int) ($busy['month'] / 60) % 60); ?>m
|
||||
<?php
|
||||
$endMonth = $startMonth->createModify(0, 0, -1);
|
||||
$startMonth = $startMonth->createModify(0, -1, 0);
|
||||
$busy['month'] = 0;
|
||||
endif;
|
||||
$endMonth = $startMonth->createModify(0, 0, -1);
|
||||
$startMonth = $startMonth->createModify(0, -1, 0);
|
||||
$busy['month'] = 0;
|
||||
endif;
|
||||
?>
|
||||
<?php endwhile; ?>
|
||||
</table>
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user