mirror of
https://github.com/Karaka-Management/oms-HumanResourceManagement.git
synced 2026-02-14 11:58:40 +00:00
Doc + Mapper::class implementation
This commit is contained in:
parent
dea6bd0e2e
commit
62fec13e3f
|
|
@ -117,6 +117,9 @@ class Controller extends ModuleAbstract implements WebInterface
|
||||||
$view->setTemplate('/Modules/HumanResourceManagement/Theme/Backend/staff-list');
|
$view->setTemplate('/Modules/HumanResourceManagement/Theme/Backend/staff-list');
|
||||||
$view->addData('nav', $this->app->moduleManager->get('Navigation')->createNavigationMid(1002402001, $request, $response));
|
$view->addData('nav', $this->app->moduleManager->get('Navigation')->createNavigationMid(1002402001, $request, $response));
|
||||||
|
|
||||||
|
$mapper = new EmployeeMapper($this->app->dbPool()->get());
|
||||||
|
$view->setData('employees', $mapper->getAll());
|
||||||
|
|
||||||
return $view;
|
return $view;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -40,6 +40,10 @@ class Employee {
|
||||||
|
|
||||||
private $account = null;
|
private $account = null;
|
||||||
|
|
||||||
|
private $history = [];
|
||||||
|
|
||||||
|
private $status = [];
|
||||||
|
|
||||||
public function setAccount(Account $account)
|
public function setAccount(Account $account)
|
||||||
{
|
{
|
||||||
$this->account = $account;
|
$this->account = $account;
|
||||||
|
|
|
||||||
0
Models/EmployeeHistory.php
Normal file
0
Models/EmployeeHistory.php
Normal file
0
Models/EmployeeHistoryMapper.php
Normal file
0
Models/EmployeeHistoryMapper.php
Normal file
|
|
@ -33,17 +33,25 @@ class EmployeeMapper
|
||||||
|
|
||||||
protected static $ownsOne = [
|
protected static $ownsOne = [
|
||||||
'account' => [
|
'account' => [
|
||||||
'mapper' => '\Modules\Admin\Models\AccountMapper',
|
'mapper' => \Modules\Admin\Models\AccountMapper::class,
|
||||||
'src' => 'hr_staff',
|
'src' => 'hr_staff',
|
||||||
],
|
],
|
||||||
];
|
];
|
||||||
|
|
||||||
protected static $hasMany = [
|
protected static $hasMany = [
|
||||||
'position' => [
|
'history' => [
|
||||||
'mapper' => '',
|
'mapper' => \Modules\HumanResourceManagement\Models\EmployeeHistoryMapper::class,
|
||||||
'table' => '',
|
'relationmapper' => \Modules\HumanResourceManagement\Models\EmployeeHistoryMapper::class,
|
||||||
'src' => '',
|
'table' => 'hr_history',
|
||||||
'dst' => '',
|
'src' => 'hr_history_staff',
|
||||||
|
'dst' => null,
|
||||||
|
],
|
||||||
|
'status' => [
|
||||||
|
'mapper' => \Modules\HumanResourceManagement\Models\EmployeeStatus::class,
|
||||||
|
'relationmapper' => \Modules\HumanResourceManagement\Models\EmployeeStatus::class,
|
||||||
|
'table' => 'hr_status',
|
||||||
|
'src' => 'hr_status_staff',
|
||||||
|
'dst' => null,
|
||||||
],
|
],
|
||||||
];
|
];
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -24,6 +24,8 @@ $footerView->setPages(1 / 25);
|
||||||
$footerView->setPage(1);
|
$footerView->setPage(1);
|
||||||
$footerView->setResults(1);
|
$footerView->setResults(1);
|
||||||
|
|
||||||
|
$employees = $this->getData('employees');
|
||||||
|
|
||||||
echo $this->getData('nav')->render(); ?>
|
echo $this->getData('nav')->render(); ?>
|
||||||
|
|
||||||
<section class="box w-100">
|
<section class="box w-100">
|
||||||
|
|
@ -33,22 +35,22 @@ echo $this->getData('nav')->render(); ?>
|
||||||
<tr>
|
<tr>
|
||||||
<td><?= $this->l11n->lang[0]['ID']; ?>
|
<td><?= $this->l11n->lang[0]['ID']; ?>
|
||||||
<td class="wf-100"><?= $this->l11n->lang['HumanResourceManagement']['Name']; ?>
|
<td class="wf-100"><?= $this->l11n->lang['HumanResourceManagement']['Name']; ?>
|
||||||
|
<td><?= $this->l11n->lang['HumanResourceManagement']['Position']; ?>
|
||||||
<td><?= $this->l11n->lang['HumanResourceManagement']['Department']; ?>
|
<td><?= $this->l11n->lang['HumanResourceManagement']['Department']; ?>
|
||||||
<td><?= $this->l11n->lang['HumanResourceManagement']['Status']; ?>
|
<td><?= $this->l11n->lang['HumanResourceManagement']['Status']; ?>
|
||||||
<tfoot>
|
<tfoot>
|
||||||
<tr><td colspan="4"><?= $footerView->render(); ?>
|
<tr><td colspan="4"><?= $footerView->render(); ?>
|
||||||
<tbody>
|
<tbody>
|
||||||
<?php $c = 0; foreach ([] as $key => $value) : $c++;
|
<?php $c = 0; foreach ($employees as $key => $value) : $c++;
|
||||||
$url = \phpOMS\Uri\UriFactory::build('/{/lang}/backend/admin/group/settings?id=' . $value->getId()); ?>
|
$url = \phpOMS\Uri\UriFactory::build('/{/lang}/backend/admin/group/settings?id=' . $value->getId()); ?>
|
||||||
<tr>
|
<tr>
|
||||||
<td><a href="<?= $url; ?>"><?= $value->getId(); ?></a>
|
<td><a href="<?= $url; ?>"><?= $value->getId(); ?></a>
|
||||||
<td><a href="<?= $url; ?>"><?= $value->getName(); ?></a>
|
<td><a href="<?= $url; ?>"><?= $value->getNewestHistory()->getPosition(); ?></a>
|
||||||
<td>
|
<td><a href="<?= $url; ?>"><?= $value->getNewestHistory()->getPosition(); ?></a>
|
||||||
<td>
|
<td><a href="<?= $url; ?>"><?= $value->getNewestStatus()->getStatus(); ?></a>
|
||||||
<td>
|
<?php endforeach; ?>
|
||||||
<?php endforeach; ?>
|
<?php if($c === 0) : ?>
|
||||||
<?php if($c === 0) : ?>
|
<tr><td colspan="4" class="empty"><?= $this->l11n->lang[0]['Empty']; ?>
|
||||||
<tr><td colspan="4" class="empty"><?= $this->l11n->lang[0]['Empty']; ?>
|
<?php endif; ?>
|
||||||
<?php endif; ?>
|
|
||||||
</table>
|
</table>
|
||||||
</section>
|
</section>
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user