mirror of
https://github.com/Karaka-Management/oms-Organization.git
synced 2026-02-13 23:08:42 +00:00
Make organization output use belongsTo
This commit is contained in:
parent
016e31b077
commit
990062fbe9
|
|
@ -38,6 +38,10 @@ class DepartmentMapper extends DataMapperAbstract
|
||||||
'mapper' => UnitMapper::class,
|
'mapper' => UnitMapper::class,
|
||||||
'dest' => 'organization_department_unit',
|
'dest' => 'organization_department_unit',
|
||||||
],
|
],
|
||||||
|
'parent' => [
|
||||||
|
'mapper' => DepartmentMapper::class,
|
||||||
|
'dest' => 'organization_department_parent',
|
||||||
|
],
|
||||||
];
|
];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
19
Models/NullDepartment.php
Normal file
19
Models/NullDepartment.php
Normal file
|
|
@ -0,0 +1,19 @@
|
||||||
|
<?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\Organization\Models;
|
||||||
|
|
||||||
|
class NullDepartment extends Department
|
||||||
|
{
|
||||||
|
}
|
||||||
19
Models/NullPosition.php
Normal file
19
Models/NullPosition.php
Normal file
|
|
@ -0,0 +1,19 @@
|
||||||
|
<?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\Organization\Models;
|
||||||
|
|
||||||
|
class NullPosition extends Position
|
||||||
|
{
|
||||||
|
}
|
||||||
19
Models/NullUnit.php
Normal file
19
Models/NullUnit.php
Normal file
|
|
@ -0,0 +1,19 @@
|
||||||
|
<?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\Organization\Models;
|
||||||
|
|
||||||
|
class NullUnit extends Unit
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
@ -60,7 +60,7 @@ class Position implements ArrayableInterface, \JsonSerializable
|
||||||
return $this->department;
|
return $this->department;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function setDepartment(int $department)
|
public function setDepartment($department)
|
||||||
{
|
{
|
||||||
$this->department = $department;
|
$this->department = $department;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -35,10 +35,14 @@ class PositionMapper extends DataMapperAbstract
|
||||||
];
|
];
|
||||||
|
|
||||||
protected static $belongsTo = [
|
protected static $belongsTo = [
|
||||||
'account' => [
|
'parent' => [
|
||||||
'mapper' => PositionMapper::class,
|
'mapper' => PositionMapper::class,
|
||||||
'dest' => 'organization_position_parent',
|
'dest' => 'organization_position_parent',
|
||||||
],
|
],
|
||||||
|
'department' => [
|
||||||
|
'mapper' => DepartmentMapper::class,
|
||||||
|
'dest' => 'organization_position_department',
|
||||||
|
],
|
||||||
];
|
];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
|
|
@ -37,6 +37,10 @@ class UnitMapper extends DataMapperAbstract
|
||||||
'mapper' => UnitMapper::class,
|
'mapper' => UnitMapper::class,
|
||||||
'dest' => 'organization_uni_parent',
|
'dest' => 'organization_uni_parent',
|
||||||
],
|
],
|
||||||
|
'parent' => [
|
||||||
|
'mapper' => UnitMapper::class,
|
||||||
|
'dest' => 'organization_unit_parent',
|
||||||
|
],
|
||||||
];
|
];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
|
|
@ -43,8 +43,8 @@ echo $this->getData('nav')->render(); ?>
|
||||||
<tr data-href="<?= $url; ?>">
|
<tr data-href="<?= $url; ?>">
|
||||||
<td><a href="<?= $url; ?>"><?= htmlspecialchars($value->getId(), ENT_COMPAT, 'utf-8'); ?></a>
|
<td><a href="<?= $url; ?>"><?= htmlspecialchars($value->getId(), ENT_COMPAT, 'utf-8'); ?></a>
|
||||||
<td><a href="<?= $url; ?>"><?= htmlspecialchars($value->getName(), ENT_COMPAT, 'utf-8'); ?></a>
|
<td><a href="<?= $url; ?>"><?= htmlspecialchars($value->getName(), ENT_COMPAT, 'utf-8'); ?></a>
|
||||||
<td><a href="<?= $url; ?>"><?= htmlspecialchars($value->getParent(), ENT_COMPAT, 'utf-8'); ?></a>
|
<td><a href="<?= $url; ?>"><?= htmlspecialchars($value->getParent()->getName(), ENT_COMPAT, 'utf-8'); ?></a>
|
||||||
<td><a href="<?= $url; ?>"><?= htmlspecialchars($value->getUnit(), ENT_COMPAT, 'utf-8'); ?></a>
|
<td><a href="<?= $url; ?>"><?= htmlspecialchars($value->getUnit()->getName(), ENT_COMPAT, 'utf-8'); ?></a>
|
||||||
<?php endforeach; ?>
|
<?php endforeach; ?>
|
||||||
<?php if($c === 0) : ?>
|
<?php if($c === 0) : ?>
|
||||||
<tr>
|
<tr>
|
||||||
|
|
|
||||||
|
|
@ -29,7 +29,7 @@ echo $this->getData('nav')->render(); ?>
|
||||||
<tr><td><label for="iName"><?= $this->getHtml('Name') ?></label>
|
<tr><td><label for="iName"><?= $this->getHtml('Name') ?></label>
|
||||||
<tr><td><input type="text" name="name" id="iName" value="<?= htmlspecialchars($department->getName(), ENT_COMPAT, 'utf-8'); ?>">
|
<tr><td><input type="text" name="name" id="iName" value="<?= htmlspecialchars($department->getName(), ENT_COMPAT, 'utf-8'); ?>">
|
||||||
<tr><td><label for="iParent"><?= $this->getHtml('Parent') ?></label>
|
<tr><td><label for="iParent"><?= $this->getHtml('Parent') ?></label>
|
||||||
<tr><td><input type="text" name="parent" id="iParent" value="<?= htmlspecialchars($department->getParent(), ENT_COMPAT, 'utf-8'); ?>">
|
<tr><td><input type="text" name="parent" id="iParent" value="<?= htmlspecialchars($department->getParent()->getName(), ENT_COMPAT, 'utf-8'); ?>">
|
||||||
<tr><td><label for="iStatus"><?= $this->getHtml('Status') ?></label>
|
<tr><td><label for="iStatus"><?= $this->getHtml('Status') ?></label>
|
||||||
<tr><td><select name="status" id="iStatus">
|
<tr><td><select name="status" id="iStatus">
|
||||||
<option><?= $this->getHtml('Active') ?>
|
<option><?= $this->getHtml('Active') ?>
|
||||||
|
|
|
||||||
|
|
@ -36,6 +36,7 @@ echo $this->getData('nav')->render(); ?>
|
||||||
<td><?= $this->getHtml('ID', 0, 0); ?>
|
<td><?= $this->getHtml('ID', 0, 0); ?>
|
||||||
<td class="wf-100"><?= $this->getHtml('Name') ?>
|
<td class="wf-100"><?= $this->getHtml('Name') ?>
|
||||||
<td><?= $this->getHtml('Parent') ?>
|
<td><?= $this->getHtml('Parent') ?>
|
||||||
|
<td><?= $this->getHtml('Department') ?>
|
||||||
<tfoot>
|
<tfoot>
|
||||||
<tr><td colspan="3"><?= $footerView->render(); ?>
|
<tr><td colspan="3"><?= $footerView->render(); ?>
|
||||||
<tbody>
|
<tbody>
|
||||||
|
|
@ -44,7 +45,8 @@ echo $this->getData('nav')->render(); ?>
|
||||||
<tr data-href="<?= $url; ?>">
|
<tr data-href="<?= $url; ?>">
|
||||||
<td><a href="<?= $url; ?>"><?= htmlspecialchars($value->getId(), ENT_COMPAT, 'utf-8'); ?></a>
|
<td><a href="<?= $url; ?>"><?= htmlspecialchars($value->getId(), ENT_COMPAT, 'utf-8'); ?></a>
|
||||||
<td><a href="<?= $url; ?>"><?= htmlspecialchars($value->getName(), ENT_COMPAT, 'utf-8'); ?></a>
|
<td><a href="<?= $url; ?>"><?= htmlspecialchars($value->getName(), ENT_COMPAT, 'utf-8'); ?></a>
|
||||||
<td><a href="<?= $url; ?>"><?= htmlspecialchars($value->getParent(), ENT_COMPAT, 'utf-8'); ?></a>
|
<td><a href="<?= $url; ?>"><?= htmlspecialchars($value->getParent()->getName(), ENT_COMPAT, 'utf-8'); ?></a>
|
||||||
|
<td><a href="<?= $url; ?>"><?= 1//htmlspecialchars($value->getDepartment()->getName(), ENT_COMPAT, 'utf-8'); ?></a>
|
||||||
<?php endforeach; ?>
|
<?php endforeach; ?>
|
||||||
<?php if($count === 0) : ?>
|
<?php if($count === 0) : ?>
|
||||||
<tr><td colspan="5" class="empty"><?= $this->getHtml('Empty', 0, 0); ?>
|
<tr><td colspan="5" class="empty"><?= $this->getHtml('Empty', 0, 0); ?>
|
||||||
|
|
|
||||||
|
|
@ -29,7 +29,7 @@ echo $this->getData('nav')->render(); ?>
|
||||||
<tr><td><label for="iName"><?= $this->getHtml('Name') ?></label>
|
<tr><td><label for="iName"><?= $this->getHtml('Name') ?></label>
|
||||||
<tr><td><input type="text" name="name" id="iName" value="<?= htmlspecialchars($position->getName(), ENT_COMPAT, 'utf-8'); ?>">
|
<tr><td><input type="text" name="name" id="iName" value="<?= htmlspecialchars($position->getName(), ENT_COMPAT, 'utf-8'); ?>">
|
||||||
<tr><td><label for="iParent"><?= $this->getHtml('Parent') ?></label>
|
<tr><td><label for="iParent"><?= $this->getHtml('Parent') ?></label>
|
||||||
<tr><td><input type="text" name="parent" id="iParent" value="<?= htmlspecialchars($position->getParent(), ENT_COMPAT, 'utf-8'); ?>">
|
<tr><td><input type="text" name="parent" id="iParent" value="<?= htmlspecialchars($position->getParent()->getName(), ENT_COMPAT, 'utf-8'); ?>">
|
||||||
<tr><td><label for="iStatus"><?= $this->getHtml('Status') ?></label>
|
<tr><td><label for="iStatus"><?= $this->getHtml('Status') ?></label>
|
||||||
<tr><td><select name="status" id="iStatus">
|
<tr><td><select name="status" id="iStatus">
|
||||||
<option><?= $this->getHtml('Active') ?>
|
<option><?= $this->getHtml('Active') ?>
|
||||||
|
|
|
||||||
|
|
@ -40,9 +40,9 @@ echo $this->getData('nav')->render(); ?>
|
||||||
<?php foreach ($this->getData('list:elements') as $key => $value) :
|
<?php foreach ($this->getData('list:elements') as $key => $value) :
|
||||||
$url = \phpOMS\Uri\UriFactory::build('{/base}/{/lang}/backend/organization/unit/profile?{?}&id=' . $value->getId()); ?>
|
$url = \phpOMS\Uri\UriFactory::build('{/base}/{/lang}/backend/organization/unit/profile?{?}&id=' . $value->getId()); ?>
|
||||||
<tr data-href="<?= $url; ?>">
|
<tr data-href="<?= $url; ?>">
|
||||||
<td data-label="<?= $this->getHtml('ID', 0, 0); ?>"><a href="<?= $url; ?>"><?= htmlspecialchars($value->getId() ?></a>
|
<td data-label="<?= $this->getHtml('ID', 0, 0); ?>"><a href="<?= $url; ?>"><?= htmlspecialchars($value->getId()); ?></a>
|
||||||
<td data-label="<?= $this->getHtml('Name') ?>"><a href="<?= $url; ?>"><?= htmlspecialchars($value->getName(), ENT_COMPAT, 'utf-8'); ?></a>
|
<td data-label="<?= $this->getHtml('Name') ?>"><a href="<?= $url; ?>"><?= htmlspecialchars($value->getName(), ENT_COMPAT, 'utf-8'); ?></a>
|
||||||
<td data-label="<?= $this->getHtml('Parent') ?>"><a href="<?= $url; ?>"><?= htmlspecialchars($value->getParent(), ENT_COMPAT, 'utf-8'); ?></a>
|
<td data-label="<?= $this->getHtml('Parent') ?>"><a href="<?= $url; ?>"><?= htmlspecialchars($value->getParent()->getName(), ENT_COMPAT, 'utf-8'); ?></a>
|
||||||
<?php endforeach; ?>
|
<?php endforeach; ?>
|
||||||
</table>
|
</table>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
||||||
|
|
@ -29,7 +29,7 @@ echo $this->getData('nav')->render(); ?>
|
||||||
<tr><td><label for="iName"><?= $this->getHtml('Name') ?></label>
|
<tr><td><label for="iName"><?= $this->getHtml('Name') ?></label>
|
||||||
<tr><td><input type="text" name="name" id="iName" value="<?= htmlspecialchars($unit->getName(), ENT_COMPAT, 'utf-8'); ?>">
|
<tr><td><input type="text" name="name" id="iName" value="<?= htmlspecialchars($unit->getName(), ENT_COMPAT, 'utf-8'); ?>">
|
||||||
<tr><td><label for="iParent"><?= $this->getHtml('Parent') ?></label>
|
<tr><td><label for="iParent"><?= $this->getHtml('Parent') ?></label>
|
||||||
<tr><td><span class="input"><button type="button" formaction=""><i class="fa fa-book"></i></button><input type="text" name="parent" id="iParent" value="<?= htmlspecialchars($unit->getParent(), ENT_COMPAT, 'utf-8'); ?>" required></span>
|
<tr><td><span class="input"><button type="button" formaction=""><i class="fa fa-book"></i></button><input type="text" name="parent" id="iParent" value="<?= htmlspecialchars($unit->getParent()->getName(), ENT_COMPAT, 'utf-8'); ?>" required></span>
|
||||||
<tr><td><label for="iStatus"><?= $this->getHtml('Status') ?></label>
|
<tr><td><label for="iStatus"><?= $this->getHtml('Status') ?></label>
|
||||||
<tr><td><select name="status" id="iStatus">
|
<tr><td><select name="status" id="iStatus">
|
||||||
<option><?= $this->getHtml('Active') ?>
|
<option><?= $this->getHtml('Active') ?>
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user