mirror of
https://github.com/Karaka-Management/oms-HumanResourceManagement.git
synced 2026-01-27 19:28: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->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;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -40,6 +40,10 @@ class Employee {
|
|||
|
||||
private $account = null;
|
||||
|
||||
private $history = [];
|
||||
|
||||
private $status = [];
|
||||
|
||||
public function setAccount(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 = [
|
||||
'account' => [
|
||||
'mapper' => '\Modules\Admin\Models\AccountMapper',
|
||||
'mapper' => \Modules\Admin\Models\AccountMapper::class,
|
||||
'src' => 'hr_staff',
|
||||
],
|
||||
];
|
||||
|
||||
protected static $hasMany = [
|
||||
'position' => [
|
||||
'mapper' => '',
|
||||
'table' => '',
|
||||
'src' => '',
|
||||
'dst' => '',
|
||||
'history' => [
|
||||
'mapper' => \Modules\HumanResourceManagement\Models\EmployeeHistoryMapper::class,
|
||||
'relationmapper' => \Modules\HumanResourceManagement\Models\EmployeeHistoryMapper::class,
|
||||
'table' => 'hr_history',
|
||||
'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->setResults(1);
|
||||
|
||||
$employees = $this->getData('employees');
|
||||
|
||||
echo $this->getData('nav')->render(); ?>
|
||||
|
||||
<section class="box w-100">
|
||||
|
|
@ -33,22 +35,22 @@ echo $this->getData('nav')->render(); ?>
|
|||
<tr>
|
||||
<td><?= $this->l11n->lang[0]['ID']; ?>
|
||||
<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']['Status']; ?>
|
||||
<tfoot>
|
||||
<tr><td colspan="4"><?= $footerView->render(); ?>
|
||||
<tbody>
|
||||
<?php $c = 0; foreach ([] as $key => $value) : $c++;
|
||||
$url = \phpOMS\Uri\UriFactory::build('/{/lang}/backend/admin/group/settings?id=' . $value->getId()); ?>
|
||||
<tr>
|
||||
<td><a href="<?= $url; ?>"><?= $value->getId(); ?></a>
|
||||
<td><a href="<?= $url; ?>"><?= $value->getName(); ?></a>
|
||||
<td>
|
||||
<td>
|
||||
<td>
|
||||
<?php endforeach; ?>
|
||||
<?php if($c === 0) : ?>
|
||||
<tr><td colspan="4" class="empty"><?= $this->l11n->lang[0]['Empty']; ?>
|
||||
<?php endif; ?>
|
||||
<?php $c = 0; foreach ($employees as $key => $value) : $c++;
|
||||
$url = \phpOMS\Uri\UriFactory::build('/{/lang}/backend/admin/group/settings?id=' . $value->getId()); ?>
|
||||
<tr>
|
||||
<td><a href="<?= $url; ?>"><?= $value->getId(); ?></a>
|
||||
<td><a href="<?= $url; ?>"><?= $value->getNewestHistory()->getPosition(); ?></a>
|
||||
<td><a href="<?= $url; ?>"><?= $value->getNewestHistory()->getPosition(); ?></a>
|
||||
<td><a href="<?= $url; ?>"><?= $value->getNewestStatus()->getStatus(); ?></a>
|
||||
<?php endforeach; ?>
|
||||
<?php if($c === 0) : ?>
|
||||
<tr><td colspan="4" class="empty"><?= $this->l11n->lang[0]['Empty']; ?>
|
||||
<?php endif; ?>
|
||||
</table>
|
||||
</section>
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user