mirror of
https://github.com/Karaka-Management/oms-Organization.git
synced 2026-02-16 16:28:41 +00:00
make id public, organigram impl. media password/encryption, settings bug fix, Money->FloatInt change, ...
This commit is contained in:
parent
36012aab4e
commit
00472a4982
|
|
@ -90,7 +90,7 @@ final class Installer extends InstallerAbstract
|
||||||
$request->setData('title', \reset($attribute['l11n']));
|
$request->setData('title', \reset($attribute['l11n']));
|
||||||
$request->setData('language', \array_keys($attribute['l11n'])[0] ?? 'en');
|
$request->setData('language', \array_keys($attribute['l11n'])[0] ?? 'en');
|
||||||
$request->setData('is_required', $attribute['is_required'] ?? false);
|
$request->setData('is_required', $attribute['is_required'] ?? false);
|
||||||
$request->setData('is_custom_allowed', $attribute['is_custom_allowed'] ?? false);
|
$request->setData('custom', $attribute['is_custom_allowed'] ?? false);
|
||||||
$request->setData('validation_pattern', $attribute['validation_pattern'] ?? '');
|
$request->setData('validation_pattern', $attribute['validation_pattern'] ?? '');
|
||||||
$request->setData('datatype', (int) $attribute['value_type']);
|
$request->setData('datatype', (int) $attribute['value_type']);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -223,7 +223,7 @@ final class ApiController extends Controller
|
||||||
/** @var \Modules\Admin\Models\Group $group */
|
/** @var \Modules\Admin\Models\Group $group */
|
||||||
$group = $internalResponse->get($newRequest->uri->__toString())['response'];
|
$group = $internalResponse->get($newRequest->uri->__toString())['response'];
|
||||||
|
|
||||||
$content = \json_encode([$group->getId()]);
|
$content = \json_encode([$group->id]);
|
||||||
if ($content === false) {
|
if ($content === false) {
|
||||||
$content = '[]';
|
$content = '[]';
|
||||||
}
|
}
|
||||||
|
|
@ -232,7 +232,7 @@ final class ApiController extends Controller
|
||||||
0,
|
0,
|
||||||
ModelsSettingsEnum::UNIT_DEFAULT_GROUPS,
|
ModelsSettingsEnum::UNIT_DEFAULT_GROUPS,
|
||||||
$content,
|
$content,
|
||||||
unit: $unit->getId(),
|
unit: $unit->id,
|
||||||
module: 'Admin'
|
module: 'Admin'
|
||||||
);
|
);
|
||||||
$this->createModel($request->header->account, $setting, SettingMapper::class, 'setting', $request->getOrigin());
|
$this->createModel($request->header->account, $setting, SettingMapper::class, 'setting', $request->getOrigin());
|
||||||
|
|
@ -267,7 +267,7 @@ final class ApiController extends Controller
|
||||||
$unit = UnitMapper::get()->with('mainAddress')->where('id', $request->getData('unit'))->execute();
|
$unit = UnitMapper::get()->with('mainAddress')->where('id', $request->getData('unit'))->execute();
|
||||||
$oldUnit = clone $unit;
|
$oldUnit = clone $unit;
|
||||||
|
|
||||||
if ($unit->mainAddress->getId() !== 0) {
|
if ($unit->mainAddress->id !== 0) {
|
||||||
$oldAddr = clone $unit->mainAddress;
|
$oldAddr = clone $unit->mainAddress;
|
||||||
$addr = $this->updateUnitMainAddressFromRequest($request, $unit);
|
$addr = $this->updateUnitMainAddressFromRequest($request, $unit);
|
||||||
$this->updateModel($request->header->account, $oldAddr, $addr, AddressMapper::class, 'address', $request->getOrigin());
|
$this->updateModel($request->header->account, $oldAddr, $addr, AddressMapper::class, 'address', $request->getOrigin());
|
||||||
|
|
@ -276,7 +276,7 @@ final class ApiController extends Controller
|
||||||
$addr = $this->createUnitMainAddressFromRequest($request);
|
$addr = $this->createUnitMainAddressFromRequest($request);
|
||||||
$this->createModel($request->header->account, $addr, AddressMapper::class, 'address', $request->getOrigin());
|
$this->createModel($request->header->account, $addr, AddressMapper::class, 'address', $request->getOrigin());
|
||||||
|
|
||||||
$unit->mainAddress = new NullAddress($addr->getId());
|
$unit->mainAddress = new NullAddress($addr->id);
|
||||||
$this->updateModel($request->header->account, $oldUnit, $unit, UnitMapper::class, 'unit', $request->getOrigin());
|
$this->updateModel($request->header->account, $oldUnit, $unit, UnitMapper::class, 'unit', $request->getOrigin());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1109,7 +1109,7 @@ final class ApiController extends Controller
|
||||||
$this->createModelRelation(
|
$this->createModelRelation(
|
||||||
$request->header->account,
|
$request->header->account,
|
||||||
(int) $request->getData('type'),
|
(int) $request->getData('type'),
|
||||||
$attrValue->getId(),
|
$attrValue->id,
|
||||||
UnitAttributeTypeMapper::class, 'defaults', '', $request->getOrigin()
|
UnitAttributeTypeMapper::class, 'defaults', '', $request->getOrigin()
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -163,36 +163,17 @@ final class BackendController extends Controller
|
||||||
{
|
{
|
||||||
$tree = [];
|
$tree = [];
|
||||||
foreach ($components as $component) {
|
foreach ($components as $component) {
|
||||||
$ref = null;
|
$ref = 0;
|
||||||
if ($component instanceof Department) {
|
if ($component instanceof Department) {
|
||||||
$ref = $component->unit->getId();
|
$ref = $component->unit->id;
|
||||||
} elseif ($component instanceof Position) {
|
} elseif ($component instanceof Position) {
|
||||||
$ref = $component->department->getId();
|
$ref = $component->department->id;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!isset($tree[$ref])) {
|
$tree[$component->id] = [
|
||||||
$tree[$ref] = [];
|
'obj' => $component,
|
||||||
}
|
'ref' => $ref
|
||||||
|
];
|
||||||
if (!isset($tree[$ref][$component->getId()])) {
|
|
||||||
$tree[$ref][$component->getId()] = ['obj' => null, 'children' => [], 'index' => 0];
|
|
||||||
}
|
|
||||||
|
|
||||||
$tree[$ref][$component->getId()]['obj'] = $component;
|
|
||||||
|
|
||||||
$parent = $component->parent->getId();
|
|
||||||
if ($parent !== 0
|
|
||||||
&& (!($component instanceof Position) // parent could be in different department then ignore
|
|
||||||
|| $component->parent->department->getId() === $component->department->getId()
|
|
||||||
)
|
|
||||||
) {
|
|
||||||
if (!isset($tree[$ref][$parent])) {
|
|
||||||
$tree[$ref][$parent] = ['obj' => null, 'children' => [], 'index' => 0];
|
|
||||||
}
|
|
||||||
|
|
||||||
/** @phpstan-ignore-next-line */
|
|
||||||
$tree[$ref][$parent]['children'][] = &$tree[$ref][$component->getId()];
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return $tree;
|
return $tree;
|
||||||
|
|
|
||||||
|
|
@ -30,7 +30,7 @@ class Department implements \JsonSerializable
|
||||||
* @var int
|
* @var int
|
||||||
* @since 1.0.0
|
* @since 1.0.0
|
||||||
*/
|
*/
|
||||||
protected int $id = 0;
|
public int $id = 0;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Name.
|
* Name.
|
||||||
|
|
@ -54,7 +54,7 @@ class Department implements \JsonSerializable
|
||||||
* @var int
|
* @var int
|
||||||
* @since 1.0.0
|
* @since 1.0.0
|
||||||
*/
|
*/
|
||||||
protected int $status = Status::INACTIVE;
|
public int $status = Status::INACTIVE;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Unit this department belongs to
|
* Unit this department belongs to
|
||||||
|
|
|
||||||
|
|
@ -30,7 +30,7 @@ class Position implements \JsonSerializable
|
||||||
* @var int
|
* @var int
|
||||||
* @since 1.0.0
|
* @since 1.0.0
|
||||||
*/
|
*/
|
||||||
protected int $id = 0;
|
public int $id = 0;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Name.
|
* Name.
|
||||||
|
|
@ -78,7 +78,7 @@ class Position implements \JsonSerializable
|
||||||
* @var int
|
* @var int
|
||||||
* @since 1.0.0
|
* @since 1.0.0
|
||||||
*/
|
*/
|
||||||
protected int $status = Status::INACTIVE;
|
public int $status = Status::INACTIVE;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor.
|
* Constructor.
|
||||||
|
|
|
||||||
|
|
@ -35,7 +35,7 @@ class Unit implements \JsonSerializable
|
||||||
* @var int
|
* @var int
|
||||||
* @since 1.0.0
|
* @since 1.0.0
|
||||||
*/
|
*/
|
||||||
protected int $id = 0;
|
public int $id = 0;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Name.
|
* Name.
|
||||||
|
|
@ -83,7 +83,7 @@ class Unit implements \JsonSerializable
|
||||||
* @var int
|
* @var int
|
||||||
* @since 1.0.0
|
* @since 1.0.0
|
||||||
*/
|
*/
|
||||||
protected int $status = Status::INACTIVE;
|
public int $status = Status::INACTIVE;
|
||||||
|
|
||||||
public Address $mainAddress;
|
public Address $mainAddress;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -52,7 +52,7 @@ class DepartmentTagSelectorView extends View
|
||||||
* @var bool
|
* @var bool
|
||||||
* @since 1.0.0
|
* @since 1.0.0
|
||||||
*/
|
*/
|
||||||
private bool $isRequired = false;
|
public bool $isRequired = false;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* {@inheritdoc}
|
* {@inheritdoc}
|
||||||
|
|
|
||||||
|
|
@ -1,10 +1,10 @@
|
||||||
<div class="ipt-wrap">
|
<div class="ipt-wrap">
|
||||||
<div class="ipt-first">
|
<div class="ipt-first">
|
||||||
<span class="input">
|
<span class="input">
|
||||||
<button type="button" id="<?= $this->getId(); ?>-book-button" data-action='[
|
<button type="button" id="<?= $this->id; ?>-book-button" data-action='[
|
||||||
{
|
{
|
||||||
"key": 1, "listener": "click", "action": [
|
"key": 1, "listener": "click", "action": [
|
||||||
{"key": 1, "type": "dom.popup", "selector": "#acc-grp-tpl", "aniIn": "fadeIn", "id": "<?= $this->getId(); ?>"},
|
{"key": 1, "type": "dom.popup", "selector": "#acc-grp-tpl", "aniIn": "fadeIn", "id": "<?= $this->id; ?>"},
|
||||||
{"key": 2, "type": "message.request", "uri": "<?= \phpOMS\Uri\UriFactory::build('{/base}/admin/account?filter=some&limit=10'); ?>", "method": "GET", "request_type": "json"},
|
{"key": 2, "type": "message.request", "uri": "<?= \phpOMS\Uri\UriFactory::build('{/base}/admin/account?filter=some&limit=10'); ?>", "method": "GET", "request_type": "json"},
|
||||||
{"key": 3, "type": "dom.table.append", "id": "acc-table", "aniIn": "fadeIn", "data": [], "bindings": {"id": "id", "name": "name"}, "position": -1},
|
{"key": 3, "type": "dom.table.append", "id": "acc-table", "aniIn": "fadeIn", "data": [], "bindings": {"id": "id", "name": "name"}, "position": -1},
|
||||||
{"key": 4, "type": "message.request", "uri": "<?= \phpOMS\Uri\UriFactory::build('{/base}/admin/account?filter=some&limit=10'); ?>", "method": "GET", "request_type": "json"},
|
{"key": 4, "type": "message.request", "uri": "<?= \phpOMS\Uri\UriFactory::build('{/base}/admin/account?filter=some&limit=10'); ?>", "method": "GET", "request_type": "json"},
|
||||||
|
|
@ -12,19 +12,19 @@
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
]' formaction=""><i class="fa fa-book"></i></button>
|
]' formaction=""><i class="fa fa-book"></i></button>
|
||||||
<div class="advancedInput wf-100" id="<?= $this->getId(); ?>">
|
<div class="advancedInput wf-100" id="<?= $this->id; ?>">
|
||||||
<input autocomplete="off" class="input" type="text" id="i<?= $this->getId(); ?>"
|
<input autocomplete="off" class="input" type="text" id="i<?= $this->id; ?>"
|
||||||
data-emptyAfter="true"
|
data-emptyAfter="true"
|
||||||
data-autocomplete="off"
|
data-autocomplete="off"
|
||||||
data-src="api/organization/find/department?search={!#i<?= $this->getId(); ?>}">
|
data-src="api/organization/find/department?search={!#i<?= $this->id; ?>}">
|
||||||
<div id="<?= $this->getId(); ?>-popup" class="popup" data-active="true">
|
<div id="<?= $this->id; ?>-popup" class="popup" data-active="true">
|
||||||
<table class="default">
|
<table class="default">
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
<td>ID<i class="sort-asc fa fa-chevron-up"></i><i class="sort-desc fa fa-chevron-down"></i>
|
<td>ID<i class="sort-asc fa fa-chevron-up"></i><i class="sort-desc fa fa-chevron-down"></i>
|
||||||
<td>Name<i class="sort-asc fa fa-chevron-up"></i><i class="sort-desc fa fa-chevron-down"></i>
|
<td>Name<i class="sort-asc fa fa-chevron-up"></i><i class="sort-desc fa fa-chevron-down"></i>
|
||||||
<tbody>
|
<tbody>
|
||||||
<template id="<?= $this->getId(); ?>-rowElement" class="rowTemplate">
|
<template id="<?= $this->id; ?>-rowElement" class="rowTemplate">
|
||||||
<tr tabindex="-1">
|
<tr tabindex="-1">
|
||||||
<td data-tpl-text="/id" data-tpl-value="/id" data-value=""></td>
|
<td data-tpl-text="/id" data-tpl-value="/id" data-value=""></td>
|
||||||
<td data-tpl-text="/name" data-tpl-value="/name" data-value=""></td>
|
<td data-tpl-text="/name" data-tpl-value="/name" data-value=""></td>
|
||||||
|
|
@ -38,8 +38,8 @@
|
||||||
</div>
|
</div>
|
||||||
<div class="ipt-second"><button><?= $this->getHtml('Select', '0', '0'); ?></button></div>
|
<div class="ipt-second"><button><?= $this->getHtml('Select', '0', '0'); ?></button></div>
|
||||||
</div>
|
</div>
|
||||||
<div class="box" id="<?= $this->getId(); ?>-tags" data-limit="0" data-active="true">
|
<div class="box" id="<?= $this->id; ?>-tags" data-limit="0" data-active="true">
|
||||||
<template id="<?= $this->getId(); ?>-tagTemplate">
|
<template id="<?= $this->id; ?>-tagTemplate">
|
||||||
<span class="tag red" data-tpl-value="/id" data-value="" data-uuid="" data-name="<?= $this->printHtml($this->name); ?>">
|
<span class="tag red" data-tpl-value="/id" data-value="" data-uuid="" data-name="<?= $this->printHtml($this->name); ?>">
|
||||||
<i class="fa fa-times"></i>
|
<i class="fa fa-times"></i>
|
||||||
<span data-tpl-text="/id" data-name="id" data-tpl-value="/id" data-value=""></span>
|
<span data-tpl-text="/id" data-name="id" data-tpl-value="/id" data-value=""></span>
|
||||||
|
|
|
||||||
|
|
@ -52,7 +52,7 @@ class PositionTagSelectorView extends View
|
||||||
* @var bool
|
* @var bool
|
||||||
* @since 1.0.0
|
* @since 1.0.0
|
||||||
*/
|
*/
|
||||||
private bool $isRequired = false;
|
public bool $isRequired = false;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* {@inheritdoc}
|
* {@inheritdoc}
|
||||||
|
|
|
||||||
|
|
@ -1,10 +1,10 @@
|
||||||
<div class="ipt-wrap">
|
<div class="ipt-wrap">
|
||||||
<div class="ipt-first">
|
<div class="ipt-first">
|
||||||
<span class="input">
|
<span class="input">
|
||||||
<button type="button" id="<?= $this->getId(); ?>-book-button" data-action='[
|
<button type="button" id="<?= $this->id; ?>-book-button" data-action='[
|
||||||
{
|
{
|
||||||
"key": 1, "listener": "click", "action": [
|
"key": 1, "listener": "click", "action": [
|
||||||
{"key": 1, "type": "dom.popup", "selector": "#acc-grp-tpl", "aniIn": "fadeIn", "id": "<?= $this->getId(); ?>"},
|
{"key": 1, "type": "dom.popup", "selector": "#acc-grp-tpl", "aniIn": "fadeIn", "id": "<?= $this->id; ?>"},
|
||||||
{"key": 2, "type": "message.request", "uri": "<?= \phpOMS\Uri\UriFactory::build('{/base}/admin/account?filter=some&limit=10'); ?>", "method": "GET", "request_type": "json"},
|
{"key": 2, "type": "message.request", "uri": "<?= \phpOMS\Uri\UriFactory::build('{/base}/admin/account?filter=some&limit=10'); ?>", "method": "GET", "request_type": "json"},
|
||||||
{"key": 3, "type": "dom.table.append", "id": "acc-table", "aniIn": "fadeIn", "data": [], "bindings": {"id": "id", "name": "name"}, "position": -1},
|
{"key": 3, "type": "dom.table.append", "id": "acc-table", "aniIn": "fadeIn", "data": [], "bindings": {"id": "id", "name": "name"}, "position": -1},
|
||||||
{"key": 4, "type": "message.request", "uri": "<?= \phpOMS\Uri\UriFactory::build('{/base}/admin/account?filter=some&limit=10'); ?>", "method": "GET", "request_type": "json"},
|
{"key": 4, "type": "message.request", "uri": "<?= \phpOMS\Uri\UriFactory::build('{/base}/admin/account?filter=some&limit=10'); ?>", "method": "GET", "request_type": "json"},
|
||||||
|
|
@ -12,19 +12,19 @@
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
]' formaction=""><i class="fa fa-book"></i></button>
|
]' formaction=""><i class="fa fa-book"></i></button>
|
||||||
<div class="advancedInput wf-100" id="<?= $this->getId(); ?>">
|
<div class="advancedInput wf-100" id="<?= $this->id; ?>">
|
||||||
<input autocomplete="off" class="input" type="text" id="i<?= $this->getId(); ?>"
|
<input autocomplete="off" class="input" type="text" id="i<?= $this->id; ?>"
|
||||||
data-emptyAfter="true"
|
data-emptyAfter="true"
|
||||||
data-autocomplete="off"
|
data-autocomplete="off"
|
||||||
data-src="api/organization/find/position?search={!#i<?= $this->getId(); ?>}">
|
data-src="api/organization/find/position?search={!#i<?= $this->id; ?>}">
|
||||||
<div id="<?= $this->getId(); ?>-popup" class="popup" data-active="true">
|
<div id="<?= $this->id; ?>-popup" class="popup" data-active="true">
|
||||||
<table class="default">
|
<table class="default">
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
<td>ID<i class="sort-asc fa fa-chevron-up"></i><i class="sort-desc fa fa-chevron-down"></i>
|
<td>ID<i class="sort-asc fa fa-chevron-up"></i><i class="sort-desc fa fa-chevron-down"></i>
|
||||||
<td>Name<i class="sort-asc fa fa-chevron-up"></i><i class="sort-desc fa fa-chevron-down"></i>
|
<td>Name<i class="sort-asc fa fa-chevron-up"></i><i class="sort-desc fa fa-chevron-down"></i>
|
||||||
<tbody>
|
<tbody>
|
||||||
<template id="<?= $this->getId(); ?>-rowElement" class="rowTemplate">
|
<template id="<?= $this->id; ?>-rowElement" class="rowTemplate">
|
||||||
<tr tabindex="-1">
|
<tr tabindex="-1">
|
||||||
<td data-tpl-text="/id" data-tpl-value="/id" data-value=""></td>
|
<td data-tpl-text="/id" data-tpl-value="/id" data-value=""></td>
|
||||||
<td data-tpl-text="/name" data-tpl-value="/name" data-value=""></td>
|
<td data-tpl-text="/name" data-tpl-value="/name" data-value=""></td>
|
||||||
|
|
@ -38,8 +38,8 @@
|
||||||
</div>
|
</div>
|
||||||
<div class="ipt-second"><button><?= $this->getHtml('Select', '0', '0'); ?></button></div>
|
<div class="ipt-second"><button><?= $this->getHtml('Select', '0', '0'); ?></button></div>
|
||||||
</div>
|
</div>
|
||||||
<div class="box" id="<?= $this->getId(); ?>-tags" data-limit="0" data-active="true">
|
<div class="box" id="<?= $this->id; ?>-tags" data-limit="0" data-active="true">
|
||||||
<template id="<?= $this->getId(); ?>-tagTemplate">
|
<template id="<?= $this->id; ?>-tagTemplate">
|
||||||
<span class="tag red" data-tpl-value="/id" data-value="" data-uuid="" data-name="<?= $this->printHtml($this->name); ?>">
|
<span class="tag red" data-tpl-value="/id" data-value="" data-uuid="" data-name="<?= $this->printHtml($this->name); ?>">
|
||||||
<i class="fa fa-times"></i>
|
<i class="fa fa-times"></i>
|
||||||
<span data-tpl-text="/id" data-name="id" data-tpl-value="/id" data-value=""></span>
|
<span data-tpl-text="/id" data-name="id" data-tpl-value="/id" data-value=""></span>
|
||||||
|
|
|
||||||
|
|
@ -52,7 +52,7 @@ class UnitTagSelectorView extends View
|
||||||
* @var bool
|
* @var bool
|
||||||
* @since 1.0.0
|
* @since 1.0.0
|
||||||
*/
|
*/
|
||||||
private bool $isRequired = false;
|
public bool $isRequired = false;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* {@inheritdoc}
|
* {@inheritdoc}
|
||||||
|
|
|
||||||
|
|
@ -1,10 +1,10 @@
|
||||||
<div class="ipt-wrap">
|
<div class="ipt-wrap">
|
||||||
<div class="ipt-first">
|
<div class="ipt-first">
|
||||||
<span class="input">
|
<span class="input">
|
||||||
<button type="button" id="<?= $this->getId(); ?>-book-button" data-action='[
|
<button type="button" id="<?= $this->id; ?>-book-button" data-action='[
|
||||||
{
|
{
|
||||||
"key": 1, "listener": "click", "action": [
|
"key": 1, "listener": "click", "action": [
|
||||||
{"key": 1, "type": "dom.popup", "selector": "#acc-grp-tpl", "aniIn": "fadeIn", "id": "<?= $this->getId(); ?>"},
|
{"key": 1, "type": "dom.popup", "selector": "#acc-grp-tpl", "aniIn": "fadeIn", "id": "<?= $this->id; ?>"},
|
||||||
{"key": 2, "type": "message.request", "uri": "<?= \phpOMS\Uri\UriFactory::build('{/api}organization/find/unit'); ?>", "method": "GET", "request_type": "json"},
|
{"key": 2, "type": "message.request", "uri": "<?= \phpOMS\Uri\UriFactory::build('{/api}organization/find/unit'); ?>", "method": "GET", "request_type": "json"},
|
||||||
{"key": 3, "type": "dom.table.append", "id": "acc-table", "aniIn": "fadeIn", "data": [], "bindings": {"id": "id", "name": "name"}, "position": -1},
|
{"key": 3, "type": "dom.table.append", "id": "acc-table", "aniIn": "fadeIn", "data": [], "bindings": {"id": "id", "name": "name"}, "position": -1},
|
||||||
{"key": 4, "type": "message.request", "uri": "<?= \phpOMS\Uri\UriFactory::build('{/api}organization/find/unit'); ?>", "method": "GET", "request_type": "json"},
|
{"key": 4, "type": "message.request", "uri": "<?= \phpOMS\Uri\UriFactory::build('{/api}organization/find/unit'); ?>", "method": "GET", "request_type": "json"},
|
||||||
|
|
@ -12,19 +12,19 @@
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
]' formaction=""><i class="fa fa-book"></i></button>
|
]' formaction=""><i class="fa fa-book"></i></button>
|
||||||
<div class="advancedInput wf-100" id="<?= $this->getId(); ?>">
|
<div class="advancedInput wf-100" id="<?= $this->id; ?>">
|
||||||
<input autocomplete="off" class="input" type="text" id="i<?= $this->getId(); ?>"
|
<input autocomplete="off" class="input" type="text" id="i<?= $this->id; ?>"
|
||||||
data-emptyAfter="true"
|
data-emptyAfter="true"
|
||||||
data-autocomplete="off"
|
data-autocomplete="off"
|
||||||
data-src="api/organization/find/unit?search={!#i<?= $this->getId(); ?>}">
|
data-src="api/organization/find/unit?search={!#i<?= $this->id; ?>}">
|
||||||
<div id="<?= $this->getId(); ?>-popup" class="popup" data-active="true">
|
<div id="<?= $this->id; ?>-popup" class="popup" data-active="true">
|
||||||
<table class="default">
|
<table class="default">
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
<td>ID<i class="sort-asc fa fa-chevron-up"></i><i class="sort-desc fa fa-chevron-down"></i>
|
<td>ID<i class="sort-asc fa fa-chevron-up"></i><i class="sort-desc fa fa-chevron-down"></i>
|
||||||
<td>Name<i class="sort-asc fa fa-chevron-up"></i><i class="sort-desc fa fa-chevron-down"></i>
|
<td>Name<i class="sort-asc fa fa-chevron-up"></i><i class="sort-desc fa fa-chevron-down"></i>
|
||||||
<tbody>
|
<tbody>
|
||||||
<template id="<?= $this->getId(); ?>-rowElement" class="rowTemplate">
|
<template id="<?= $this->id; ?>-rowElement" class="rowTemplate">
|
||||||
<tr tabindex="-1">
|
<tr tabindex="-1">
|
||||||
<td data-tpl-text="/id" data-tpl-value="/id" data-value=""></td>
|
<td data-tpl-text="/id" data-tpl-value="/id" data-value=""></td>
|
||||||
<td data-tpl-text="/name" data-tpl-value="/name" data-value=""></td>
|
<td data-tpl-text="/name" data-tpl-value="/name" data-value=""></td>
|
||||||
|
|
@ -38,8 +38,8 @@
|
||||||
</div>
|
</div>
|
||||||
<div class="ipt-second"><button><?= $this->getHtml('Select', '0', '0'); ?></button></div>
|
<div class="ipt-second"><button><?= $this->getHtml('Select', '0', '0'); ?></button></div>
|
||||||
</div>
|
</div>
|
||||||
<div class="box" id="<?= $this->getId(); ?>-tags" data-limit="0" data-active="true">
|
<div class="box" id="<?= $this->id; ?>-tags" data-limit="0" data-active="true">
|
||||||
<template id="<?= $this->getId(); ?>-tagTemplate">
|
<template id="<?= $this->id; ?>-tagTemplate">
|
||||||
<span class="tag red" data-tpl-value="/id" data-value="" data-uuid="" data-name="<?= $this->printHtml($this->name); ?>">
|
<span class="tag red" data-tpl-value="/id" data-value="" data-uuid="" data-name="<?= $this->printHtml($this->name); ?>">
|
||||||
<i class="fa fa-times"></i>
|
<i class="fa fa-times"></i>
|
||||||
<span data-tpl-text="/id" data-name="id" data-tpl-value="/id" data-value=""></span>
|
<span data-tpl-text="/id" data-name="id" data-tpl-value="/id" data-value=""></span>
|
||||||
|
|
|
||||||
|
|
@ -22,11 +22,11 @@ $departments = $this->getData('departments') ?? [];
|
||||||
|
|
||||||
$previous = empty($departments)
|
$previous = empty($departments)
|
||||||
? 'organization/department/list'
|
? 'organization/department/list'
|
||||||
: 'organization/department/list?{?}&id=' . \reset($departments)->getId() . '&ptype=p';
|
: 'organization/department/list?{?}&id=' . \reset($departments)->id . '&ptype=p';
|
||||||
$next = empty($departments)
|
$next = empty($departments)
|
||||||
? 'organization/department/list'
|
? 'organization/department/list'
|
||||||
: 'organization/department/list?{?}&id='
|
: 'organization/department/list?{?}&id='
|
||||||
. ($this->getData('hasMore') ? \end($departments)->getId() : $this->request->getData('id'))
|
. ($this->getData('hasMore') ? \end($departments)->id : $this->request->getData('id'))
|
||||||
. '&ptype=n';
|
. '&ptype=n';
|
||||||
|
|
||||||
echo $this->getData('nav')->render(); ?>
|
echo $this->getData('nav')->render(); ?>
|
||||||
|
|
@ -90,12 +90,12 @@ echo $this->getData('nav')->render(); ?>
|
||||||
<tbody>
|
<tbody>
|
||||||
<?php $c = 0;
|
<?php $c = 0;
|
||||||
foreach ($departments as $key => $value) : ++$c;
|
foreach ($departments as $key => $value) : ++$c;
|
||||||
$url = UriFactory::build('{/base}/organization/department/profile?{?}&id=' . $value->getId()); ?>
|
$url = UriFactory::build('{/base}/organization/department/profile?{?}&id=' . $value->id); ?>
|
||||||
<tr tabindex="0" data-href="<?= $url; ?>">
|
<tr tabindex="0" data-href="<?= $url; ?>">
|
||||||
<td data-label="<?= $this->getHtml('ID', '0', '0'); ?>"><a href="<?= $url; ?>"><?= $value->getId(); ?></a>
|
<td data-label="<?= $this->getHtml('ID', '0', '0'); ?>"><a href="<?= $url; ?>"><?= $value->id; ?></a>
|
||||||
<td data-label="<?= $this->getHtml('Name'); ?>"><a href="<?= $url; ?>"><?= $this->printHtml($value->name); ?></a>
|
<td data-label="<?= $this->getHtml('Name'); ?>"><a href="<?= $url; ?>"><?= $this->printHtml($value->name); ?></a>
|
||||||
<td data-label="<?= $this->getHtml('Parent'); ?>"><a class="content" href="<?= UriFactory::build('{/base}/organization/department/profile?{?}&id=' . $value->parent->getId()); ?>"><?= $this->printHtml($value->parent->name); ?></a>
|
<td data-label="<?= $this->getHtml('Parent'); ?>"><a class="content" href="<?= UriFactory::build('{/base}/organization/department/profile?{?}&id=' . $value->parent->id); ?>"><?= $this->printHtml($value->parent->name); ?></a>
|
||||||
<td data-label="<?= $this->getHtml('Name'); ?>"><a class="content" href="<?= UriFactory::build('{/base}/organization/unit/profile?{?}&id=' . $value->unit->getId()); ?>"><?= $this->printHtml($value->unit->name); ?></a>
|
<td data-label="<?= $this->getHtml('Name'); ?>"><a class="content" href="<?= UriFactory::build('{/base}/organization/unit/profile?{?}&id=' . $value->unit->id); ?>"><?= $this->printHtml($value->unit->name); ?></a>
|
||||||
<?php endforeach; ?>
|
<?php endforeach; ?>
|
||||||
<?php if ($c === 0) : ?>
|
<?php if ($c === 0) : ?>
|
||||||
<tr>
|
<tr>
|
||||||
|
|
|
||||||
|
|
@ -19,115 +19,62 @@ $unitTree = $this->getData('unitTree');
|
||||||
$depTree = $this->getData('departmentTree');
|
$depTree = $this->getData('departmentTree');
|
||||||
$posTree = $this->getData('positionTree');
|
$posTree = $this->getData('positionTree');
|
||||||
|
|
||||||
$unitRoot = $unitTree[null][0]['children'];
|
function renderTree($parent, $ref, &$unitTree, &$depTree, &$posTree, $type = 'unit')
|
||||||
// units
|
{
|
||||||
// departments
|
$first = true;
|
||||||
// positions
|
|
||||||
|
$tree = [];
|
||||||
|
if ($type === 'unit') {
|
||||||
|
$tree = &$unitTree;
|
||||||
|
} elseif ($type === 'dep') {
|
||||||
|
$tree = &$depTree;
|
||||||
|
} else {
|
||||||
|
$tree = &$posTree;
|
||||||
|
}
|
||||||
|
|
||||||
|
$result = '';
|
||||||
|
|
||||||
|
foreach ($tree as $leaf) {
|
||||||
|
if (($parent !== $leaf['obj']->parent->id) || $ref !== $leaf['ref']) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($first && $parent !== 0) {
|
||||||
|
$result .= '<ul>';
|
||||||
|
$first = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
$result .= '<li><span><section class="box">' . $leaf['obj']->name . '</section>';
|
||||||
|
|
||||||
|
if ($type === 'unit') {
|
||||||
|
$temp = renderTree(0, $leaf['obj']->id, $unitTree, $depTree, $posTree, $type === 'unit' ? 'dep' : 'pos');
|
||||||
|
|
||||||
|
if ($temp !== '') {
|
||||||
|
$result .= '<ul class="tree">';
|
||||||
|
$result .= $temp;
|
||||||
|
$result .= '</ul>';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$result .= '</span>';
|
||||||
|
|
||||||
|
$result .= renderTree($leaf['obj']->id, $ref, $unitTree, $depTree, $posTree, $type);
|
||||||
|
$result .= '</li>';
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!$first) {
|
||||||
|
$result .= '</ul>';
|
||||||
|
}
|
||||||
|
|
||||||
|
return $result;
|
||||||
|
}
|
||||||
|
|
||||||
?>
|
?>
|
||||||
<div class="row organigram">
|
|
||||||
<?php foreach ($unitRoot as $unitEle) : ?>
|
|
||||||
<div class="row">
|
|
||||||
<?php while (!empty($unitEle) && $unitEle['obj'] !== null) {
|
|
||||||
$unitTree[null][$unitEle['obj']->parent->getId()]['index'] = $unitTree[null][$unitEle['obj']->parent->getId()]['index'] + 1;
|
|
||||||
?>
|
|
||||||
<?php while (!empty($unitEle)) {
|
|
||||||
$unitId = $unitEle['obj']->getId(); ?>
|
|
||||||
<div class="col">
|
|
||||||
<div class="portlet unit"><div class="portlet-body"><?= $unitEle['obj']->name; ?></div></div>
|
|
||||||
|
|
||||||
<?php if (isset($depTree[$unitId]) && !empty($depTree[$unitId])) : ?>
|
<div class="row">
|
||||||
<!-- departments -->
|
<div class="col-xs-12">
|
||||||
<div class="row">
|
<ul class="tree wf-100">
|
||||||
<?php
|
<?= renderTree(0, 0, $unitTree, $depTree, $posTree, 'unit') ?>
|
||||||
$depRoot = $depTree[$unitId][0]['children'] ?? []; foreach ($depRoot as $depEle) : ?>
|
</ul>
|
||||||
<div class="row" style="margin: 0 auto;">
|
|
||||||
<?php while (!empty($depEle) && $depEle['obj'] !== null) {
|
|
||||||
$depTree[$unitId][$depEle['obj']->parent->getId()]['index'] = $depTree[$unitId][$depEle['obj']->parent->getId()]['index'] + 1;
|
|
||||||
?>
|
|
||||||
<?php while (!empty($depEle)) { ?>
|
|
||||||
<div class="departments">
|
|
||||||
<div class="portlet">
|
|
||||||
<div class="portlet-head"><?= $depEle['obj']->name; ?></div>
|
|
||||||
|
|
||||||
<!-- positions -->
|
|
||||||
<div class="portlet-body">
|
|
||||||
<ul>
|
|
||||||
<?php
|
|
||||||
$depId = $depEle['obj']->getId();
|
|
||||||
$posRoot = !isset($posTree[$depId]) ? [] : $posTree[$depId];
|
|
||||||
|
|
||||||
foreach ($posRoot as $posEle) : ?>
|
|
||||||
<?php while (!empty($posEle) && $posEle['obj'] !== null) {
|
|
||||||
if (isset($posTree[$depId][$posEle['obj']->parent->getId()])) {
|
|
||||||
// here is a bug or somewhere else... the index is not moved correctly $c is always 0
|
|
||||||
$posTree[$depId][$posEle['obj']->parent->getId()]['index'] = $posTree[$depId][$posEle['obj']->parent->getId()]['index'] + $c + 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
$c = 0; while (!empty($posEle)) { ?>
|
|
||||||
<li><?= $posEle['obj']->name; ?>
|
|
||||||
<?php
|
|
||||||
$posEle = [];
|
|
||||||
} // if no more children go back to parrent
|
|
||||||
if (isset($posTree[$depId][$parentPosId ?? 0])) {
|
|
||||||
$posEle = $posTree[$depId][$parentPosId]['children'][$posTree[$depId][$parentPosId]['index'] + $c + 1] ?? [];
|
|
||||||
}
|
|
||||||
} ?>
|
|
||||||
<?php endforeach; ?>
|
|
||||||
</ul>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="row">
|
|
||||||
<?php
|
|
||||||
// find the closest parent who has un-rendered children
|
|
||||||
$toCloseDep = 0;
|
|
||||||
|
|
||||||
if (empty($depEle['children'])) {
|
|
||||||
$parentDep = $depEle['obj'];
|
|
||||||
|
|
||||||
do {
|
|
||||||
++$toCloseDep;
|
|
||||||
$parentDep = $parentDep->parent ?? null;
|
|
||||||
$parentDepId = $parentDep?->getId() ?? 0;
|
|
||||||
} while ($parentDepId !== 0
|
|
||||||
&& !isset($depTree[$unitId][$parentDepId]['children'][($depTree[$unitId][$parentDepId]['index'] ?? 0) + 1])
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
$depEle = $depEle['children'][0] ?? [];
|
|
||||||
} // if no more children go back to parrent?>
|
|
||||||
<?= \str_repeat('</div>', $toCloseDep * 2); ?>
|
|
||||||
<?php
|
|
||||||
$depEle = $depTree[$unitId][$parentDepId]['children'][$depTree[$unitId][$parentDepId]['index'] + 1] ?? [];
|
|
||||||
} ?>
|
|
||||||
</div>
|
|
||||||
<?php endforeach; ?>
|
|
||||||
</div>
|
|
||||||
<?php endif; ?>
|
|
||||||
|
|
||||||
<div class="row">
|
|
||||||
<?php
|
|
||||||
// find the closest parent who has un-rendered children
|
|
||||||
$toCloseUnit = 0;
|
|
||||||
|
|
||||||
if (empty($unitEle['children'])) {
|
|
||||||
$parentUnit = $unitEle['obj'];
|
|
||||||
|
|
||||||
do {
|
|
||||||
++$toCloseUnit;
|
|
||||||
$parentUnit = $parentUnit->parent;
|
|
||||||
$parentUnitId = $parentUnit->getId();
|
|
||||||
} while ($parentUnitId !== 0
|
|
||||||
&& !isset($unitTree[null][$parentUnitId]['children'][($unitTree[null][$parentUnitId]['index'] ?? 0) + 1])
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
$unitEle = $unitEle['children'][0] ?? [];
|
|
||||||
} // if no more children go back to parrent?>
|
|
||||||
<?= \str_repeat('</div>', $toCloseUnit * 2); ?>
|
|
||||||
<?php
|
|
||||||
$unitEle = $unitTree[null][$parentUnitId]['children'][$unitTree[null][$parentUnitId]['index'] + 1] ?? [];
|
|
||||||
} ?>
|
|
||||||
</div>
|
</div>
|
||||||
<?php endforeach; ?>
|
|
||||||
</div>
|
</div>
|
||||||
|
|
@ -20,8 +20,8 @@ use phpOMS\Uri\UriFactory;
|
||||||
*/
|
*/
|
||||||
$positions = $this->getData('positions') ?? [];
|
$positions = $this->getData('positions') ?? [];
|
||||||
|
|
||||||
$previous = empty($positions) ? 'organization/position/list' : '{/base}/organization/position/list?{?}&id=' . \reset($positions)->getId() . '&ptype=p';
|
$previous = empty($positions) ? 'organization/position/list' : '{/base}/organization/position/list?{?}&id=' . \reset($positions)->id . '&ptype=p';
|
||||||
$next = empty($positions) ? 'organization/position/list' : '{/base}/organization/position/list?{?}&id=' . \end($positions)->getId() . '&ptype=n';
|
$next = empty($positions) ? 'organization/position/list' : '{/base}/organization/position/list?{?}&id=' . \end($positions)->id . '&ptype=n';
|
||||||
|
|
||||||
echo $this->getData('nav')->render(); ?>
|
echo $this->getData('nav')->render(); ?>
|
||||||
|
|
||||||
|
|
@ -83,12 +83,12 @@ echo $this->getData('nav')->render(); ?>
|
||||||
</label>
|
</label>
|
||||||
<tbody>
|
<tbody>
|
||||||
<?php $count = 0; foreach ($positions as $key => $value) : ++$count;
|
<?php $count = 0; foreach ($positions as $key => $value) : ++$count;
|
||||||
$url = \phpOMS\Uri\UriFactory::build('organization/position/profile?{?}&id=' . $value->getId()); ?>
|
$url = \phpOMS\Uri\UriFactory::build('organization/position/profile?{?}&id=' . $value->id); ?>
|
||||||
<tr tabindex="0" data-href="<?= $url; ?>">
|
<tr tabindex="0" data-href="<?= $url; ?>">
|
||||||
<td data-label="<?= $this->getHtml('ID', '0', '0'); ?>"><a href="<?= $url; ?>"><?= $value->getId(); ?></a>
|
<td data-label="<?= $this->getHtml('ID', '0', '0'); ?>"><a href="<?= $url; ?>"><?= $value->id; ?></a>
|
||||||
<td data-label="<?= $this->getHtml('Name'); ?>"><a href="<?= $url; ?>"><?= $this->printHtml($value->name); ?></a>
|
<td data-label="<?= $this->getHtml('Name'); ?>"><a href="<?= $url; ?>"><?= $this->printHtml($value->name); ?></a>
|
||||||
<td data-label="<?= $this->getHtml('Parent'); ?>"><a class="content" href="<?= UriFactory::build('{/base}/organization/position/profile?{?}&id=' . $value->parent->getId()); ?>"><?= $this->printHtml($value->parent->name); ?></a>
|
<td data-label="<?= $this->getHtml('Parent'); ?>"><a class="content" href="<?= UriFactory::build('{/base}/organization/position/profile?{?}&id=' . $value->parent->id); ?>"><?= $this->printHtml($value->parent->name); ?></a>
|
||||||
<td data-label="<?= $this->getHtml('Department'); ?>"><a class="content" href="<?= UriFactory::build('{/base}/organization/department/profile?{?}&id=' . $value->department->getId()); ?>"><?= $this->printHtml($value->department->name); ?></a>
|
<td data-label="<?= $this->getHtml('Department'); ?>"><a class="content" href="<?= UriFactory::build('{/base}/organization/department/profile?{?}&id=' . $value->department->id); ?>"><?= $this->printHtml($value->department->name); ?></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'); ?>
|
||||||
|
|
|
||||||
|
|
@ -21,8 +21,8 @@ use phpOMS\Uri\UriFactory;
|
||||||
*/
|
*/
|
||||||
$units = $this->getData('units') ?? [];
|
$units = $this->getData('units') ?? [];
|
||||||
|
|
||||||
$previous = empty($units) ? 'organization/unit/list' : '{/base}/organization/unit/list?{?}&id=' . \reset($units)->getId() . '&ptype=p';
|
$previous = empty($units) ? 'organization/unit/list' : '{/base}/organization/unit/list?{?}&id=' . \reset($units)->id . '&ptype=p';
|
||||||
$next = empty($units) ? 'organization/unit/list' : '{/base}/organization/unit/list?{?}&id=' . \end($units)->getId() . '&ptype=n';
|
$next = empty($units) ? 'organization/unit/list' : '{/base}/organization/unit/list?{?}&id=' . \end($units)->id . '&ptype=n';
|
||||||
|
|
||||||
echo $this->getData('nav')->render(); ?>
|
echo $this->getData('nav')->render(); ?>
|
||||||
|
|
||||||
|
|
@ -84,14 +84,14 @@ echo $this->getData('nav')->render(); ?>
|
||||||
</label>
|
</label>
|
||||||
<tbody>
|
<tbody>
|
||||||
<?php foreach ($units as $key => $value) :
|
<?php foreach ($units as $key => $value) :
|
||||||
$url = UriFactory::build('{/base}/organization/unit/profile?{?}&id=' . $value->getId()); ?>
|
$url = UriFactory::build('{/base}/organization/unit/profile?{?}&id=' . $value->id); ?>
|
||||||
<tr tabindex="0" data-href="<?= $url; ?>">
|
<tr tabindex="0" data-href="<?= $url; ?>">
|
||||||
<td data-label="<?= $this->getHtml('ID', '0', '0'); ?>"><a href="<?= $url; ?>"><?= $value->getId(); ?></a>
|
<td data-label="<?= $this->getHtml('ID', '0', '0'); ?>"><a href="<?= $url; ?>"><?= $value->id; ?></a>
|
||||||
<td><a href="<?= $url; ?>"><img alt="<?= $this->getHtml('IMG_alt_profile'); ?>" class="profile-image" src="<?= $value->image instanceof NullMedia ?
|
<td><a href="<?= $url; ?>"><img alt="<?= $this->getHtml('IMG_alt_profile'); ?>" class="profile-image" src="<?= $value->image->id === 0 ?
|
||||||
UriFactory::build('Modules/Organization/Theme/Backend/img/org_default.png') :
|
UriFactory::build('Modules/Organization/Theme/Backend/img/org_default.png') :
|
||||||
UriFactory::build($value->image->getPath()); ?>"></a>
|
UriFactory::build($value->image->getPath()); ?>"></a>
|
||||||
<td data-label="<?= $this->getHtml('Name'); ?>"><a href="<?= $url; ?>"><?= $this->printHtml($value->name); ?></a>
|
<td data-label="<?= $this->getHtml('Name'); ?>"><a href="<?= $url; ?>"><?= $this->printHtml($value->name); ?></a>
|
||||||
<td data-label="<?= $this->getHtml('Parent'); ?>"><a class="content" href="<?= UriFactory::build('{/base}/organization/unit/profile?{?}&id=' . $value->parent->getId()); ?>"><?= $this->printHtml($value->parent->name); ?></a>
|
<td data-label="<?= $this->getHtml('Parent'); ?>"><a class="content" href="<?= UriFactory::build('{/base}/organization/unit/profile?{?}&id=' . $value->parent->id); ?>"><?= $this->printHtml($value->parent->name); ?></a>
|
||||||
<?php endforeach; ?>
|
<?php endforeach; ?>
|
||||||
</table>
|
</table>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
||||||
|
|
@ -42,7 +42,7 @@ echo $this->getData('nav')->render(); ?>
|
||||||
alt="<?= $this->getHtml('Logo'); ?>"
|
alt="<?= $this->getHtml('Logo'); ?>"
|
||||||
itemprop="logo" loading="lazy"
|
itemprop="logo" loading="lazy"
|
||||||
src="<?=
|
src="<?=
|
||||||
$unit->image instanceof NullMedia ?
|
$unit->image->id === 0 ?
|
||||||
UriFactory::build('Modules/Organization/Theme/Backend/img/org_default.png') :
|
UriFactory::build('Modules/Organization/Theme/Backend/img/org_default.png') :
|
||||||
UriFactory::build($unit->image->getPath()); ?>"
|
UriFactory::build($unit->image->getPath()); ?>"
|
||||||
width="40x">
|
width="40x">
|
||||||
|
|
@ -80,7 +80,7 @@ echo $this->getData('nav')->render(); ?>
|
||||||
); ?>
|
); ?>
|
||||||
</div>
|
</div>
|
||||||
<div class="portlet-foot">
|
<div class="portlet-foot">
|
||||||
<input id="iUnitId" name="id" type="hidden" value="<?= (int) $unit->getId(); ?>">
|
<input id="iUnitId" name="id" type="hidden" value="<?= (int) $unit->id; ?>">
|
||||||
<input id="iSubmit" name="submit" type="submit" value="<?= $this->getHtml('Save', '0', '0'); ?>">
|
<input id="iSubmit" name="submit" type="submit" value="<?= $this->getHtml('Save', '0', '0'); ?>">
|
||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
|
|
@ -130,7 +130,7 @@ echo $this->getData('nav')->render(); ?>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="portlet-foot">
|
<div class="portlet-foot">
|
||||||
<input id="iUnitId" name="id" type="hidden" value="<?= (int) $unit->getId(); ?>">
|
<input id="iUnitId" name="id" type="hidden" value="<?= (int) $unit->id; ?>">
|
||||||
<input id="iSubmit" name="submit" type="submit" value="<?= $this->getHtml('Save', '0', '0'); ?>">
|
<input id="iSubmit" name="submit" type="submit" value="<?= $this->getHtml('Save', '0', '0'); ?>">
|
||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
|
|
|
||||||
|
|
@ -102,7 +102,7 @@ final class ApiControllerTest extends \PHPUnit\Framework\TestCase
|
||||||
$this->module->apiUnitGet($request, $response);
|
$this->module->apiUnitGet($request, $response);
|
||||||
|
|
||||||
self::assertEquals('Karaka', $response->get('')['response']->name);
|
self::assertEquals('Karaka', $response->get('')['response']->name);
|
||||||
self::assertGreaterThan(0, $response->get('')['response']->getId());
|
self::assertGreaterThan(0, $response->get('')['response']->id);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -139,7 +139,7 @@ final class ApiControllerTest extends \PHPUnit\Framework\TestCase
|
||||||
$this->module->apiUnitFind($request, $response);
|
$this->module->apiUnitFind($request, $response);
|
||||||
|
|
||||||
self::assertEquals('OMS', $response->get('')[0]->name);
|
self::assertEquals('OMS', $response->get('')[0]->name);
|
||||||
self::assertGreaterThan(0, $response->get('')[0]->getId());
|
self::assertGreaterThan(0, $response->get('')[0]->id);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -159,15 +159,15 @@ final class ApiControllerTest extends \PHPUnit\Framework\TestCase
|
||||||
$this->module->apiUnitCreate($request, $response);
|
$this->module->apiUnitCreate($request, $response);
|
||||||
|
|
||||||
self::assertEquals('test', $response->get('')['response']->name);
|
self::assertEquals('test', $response->get('')['response']->name);
|
||||||
self::assertGreaterThan(0, $response->get('')['response']->getId());
|
self::assertGreaterThan(0, $response->get('')['response']->id);
|
||||||
|
|
||||||
// test delete
|
// test delete
|
||||||
/*
|
/*
|
||||||
not possible due to foreign keys (default settings in this case)
|
not possible due to foreign keys (default settings in this case)
|
||||||
$request->setData('id', $response->get('')['response']->getId());
|
$request->setData('id', $response->get('')['response']->id);
|
||||||
$this->module->apiUnitDelete($request, $response);
|
$this->module->apiUnitDelete($request, $response);
|
||||||
|
|
||||||
self::assertGreaterThan(0, $response->get('')['response']->getId());
|
self::assertGreaterThan(0, $response->get('')['response']->id);
|
||||||
*/
|
*/
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -207,9 +207,9 @@ final class ApiControllerTest extends \PHPUnit\Framework\TestCase
|
||||||
$this->module->apiDepartmentCreate($request, $response);
|
$this->module->apiDepartmentCreate($request, $response);
|
||||||
|
|
||||||
self::assertEquals('test', $response->get('')['response']->name);
|
self::assertEquals('test', $response->get('')['response']->name);
|
||||||
self::assertGreaterThan(0, $response->get('')['response']->getId());
|
self::assertGreaterThan(0, $response->get('')['response']->id);
|
||||||
|
|
||||||
self::$departmentId = $response->get('')['response']->getId();
|
self::$departmentId = $response->get('')['response']->id;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -227,7 +227,7 @@ final class ApiControllerTest extends \PHPUnit\Framework\TestCase
|
||||||
$this->module->apiDepartmentFind($request, $response);
|
$this->module->apiDepartmentFind($request, $response);
|
||||||
|
|
||||||
self::assertTrue(\stripos(\strtolower($response->get('')[0]->name), 'test') !== false);
|
self::assertTrue(\stripos(\strtolower($response->get('')[0]->name), 'test') !== false);
|
||||||
self::assertGreaterThan(0, $response->get('')[0]->getId());
|
self::assertGreaterThan(0, $response->get('')[0]->id);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -261,7 +261,7 @@ final class ApiControllerTest extends \PHPUnit\Framework\TestCase
|
||||||
$this->module->apiDepartmentGet($request, $response);
|
$this->module->apiDepartmentGet($request, $response);
|
||||||
|
|
||||||
self::assertEquals('test', $response->get('')['response']->name);
|
self::assertEquals('test', $response->get('')['response']->name);
|
||||||
self::assertGreaterThan(0, $response->get('')['response']->getId());
|
self::assertGreaterThan(0, $response->get('')['response']->id);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -296,7 +296,7 @@ final class ApiControllerTest extends \PHPUnit\Framework\TestCase
|
||||||
$request->setData('id', self::$departmentId);
|
$request->setData('id', self::$departmentId);
|
||||||
$this->module->apiDepartmentDelete($request, $response);
|
$this->module->apiDepartmentDelete($request, $response);
|
||||||
|
|
||||||
self::assertGreaterThan(0, $response->get('')['response']->getId());
|
self::assertGreaterThan(0, $response->get('')['response']->id);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected static $positionId = 0;
|
protected static $positionId = 0;
|
||||||
|
|
@ -318,8 +318,8 @@ final class ApiControllerTest extends \PHPUnit\Framework\TestCase
|
||||||
$this->module->apiPositionCreate($request, $response);
|
$this->module->apiPositionCreate($request, $response);
|
||||||
|
|
||||||
self::assertEquals('test', $response->get('')['response']->name);
|
self::assertEquals('test', $response->get('')['response']->name);
|
||||||
self::assertGreaterThan(0, $response->get('')['response']->getId());
|
self::assertGreaterThan(0, $response->get('')['response']->id);
|
||||||
self::$positionId = $response->get('')['response']->getId();
|
self::$positionId = $response->get('')['response']->id;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -337,7 +337,7 @@ final class ApiControllerTest extends \PHPUnit\Framework\TestCase
|
||||||
$this->module->apiPositionFind($request, $response);
|
$this->module->apiPositionFind($request, $response);
|
||||||
|
|
||||||
self::assertTrue(\stripos(\strtolower($response->get('')[0]->name), 'test') !== false);
|
self::assertTrue(\stripos(\strtolower($response->get('')[0]->name), 'test') !== false);
|
||||||
self::assertGreaterThan(0, $response->get('')[0]->getId());
|
self::assertGreaterThan(0, $response->get('')[0]->id);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -371,7 +371,7 @@ final class ApiControllerTest extends \PHPUnit\Framework\TestCase
|
||||||
$this->module->apiPositionGet($request, $response);
|
$this->module->apiPositionGet($request, $response);
|
||||||
|
|
||||||
self::assertEquals('test', $response->get('')['response']->name);
|
self::assertEquals('test', $response->get('')['response']->name);
|
||||||
self::assertGreaterThan(0, $response->get('')['response']->getId());
|
self::assertGreaterThan(0, $response->get('')['response']->id);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -406,7 +406,7 @@ final class ApiControllerTest extends \PHPUnit\Framework\TestCase
|
||||||
$request->setData('id', self::$positionId);
|
$request->setData('id', self::$positionId);
|
||||||
$this->module->apiPositionDelete($request, $response);
|
$this->module->apiPositionDelete($request, $response);
|
||||||
|
|
||||||
self::assertGreaterThan(0, $response->get('')['response']->getId());
|
self::assertGreaterThan(0, $response->get('')['response']->id);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
|
|
@ -38,11 +38,11 @@ final class DepartmentMapperTest extends \PHPUnit\Framework\TestCase
|
||||||
$id = DepartmentMapper::create()->execute($department);
|
$id = DepartmentMapper::create()->execute($department);
|
||||||
|
|
||||||
$departmentR = DepartmentMapper::get()->where('id', $id)->execute();
|
$departmentR = DepartmentMapper::get()->where('id', $id)->execute();
|
||||||
self::assertEquals($id, $departmentR->getId());
|
self::assertEquals($id, $departmentR->id);
|
||||||
self::assertEquals($department->name, $departmentR->name);
|
self::assertEquals($department->name, $departmentR->name);
|
||||||
self::assertEquals($department->description, $departmentR->description);
|
self::assertEquals($department->description, $departmentR->description);
|
||||||
self::assertInstanceOf('Modules\Organization\Models\NullDepartment', $departmentR->parent);
|
self::assertInstanceOf('Modules\Organization\Models\NullDepartment', $departmentR->parent);
|
||||||
self::assertEquals($department->unit->getId(), $departmentR->unit->getId());
|
self::assertEquals($department->unit->id, $departmentR->unit->id);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
|
|
@ -40,12 +40,12 @@ final class DepartmentTest extends \PHPUnit\Framework\TestCase
|
||||||
*/
|
*/
|
||||||
public function testDefault() : void
|
public function testDefault() : void
|
||||||
{
|
{
|
||||||
self::assertEquals(0, $this->department->getId());
|
self::assertEquals(0, $this->department->id);
|
||||||
self::assertEquals('', $this->department->name);
|
self::assertEquals('', $this->department->name);
|
||||||
self::assertEquals('', $this->department->description);
|
self::assertEquals('', $this->department->description);
|
||||||
self::assertEquals('', $this->department->descriptionRaw);
|
self::assertEquals('', $this->department->descriptionRaw);
|
||||||
self::assertInstanceOf(NullDepartment::class, $this->department->parent);
|
self::assertInstanceOf(NullDepartment::class, $this->department->parent);
|
||||||
self::assertEquals(0, $this->department->unit->getId());
|
self::assertEquals(0, $this->department->unit->id);
|
||||||
self::assertEquals(Status::INACTIVE, $this->department->getStatus());
|
self::assertEquals(Status::INACTIVE, $this->department->getStatus());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -96,7 +96,7 @@ final class DepartmentTest extends \PHPUnit\Framework\TestCase
|
||||||
public function testParentInputOutput() : void
|
public function testParentInputOutput() : void
|
||||||
{
|
{
|
||||||
$this->department->parent = new NullDepartment(1);
|
$this->department->parent = new NullDepartment(1);
|
||||||
self::assertEquals(1, $this->department->parent->getId());
|
self::assertEquals(1, $this->department->parent->id);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -106,7 +106,7 @@ final class DepartmentTest extends \PHPUnit\Framework\TestCase
|
||||||
public function testUnitInputOutput() : void
|
public function testUnitInputOutput() : void
|
||||||
{
|
{
|
||||||
$this->department->unit = new NullUnit(1);
|
$this->department->unit = new NullUnit(1);
|
||||||
self::assertEquals(1, $this->department->unit->getId());
|
self::assertEquals(1, $this->department->unit->id);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
|
|
@ -37,6 +37,6 @@ final class NullDepartmentTest extends \PHPUnit\Framework\TestCase
|
||||||
public function testId() : void
|
public function testId() : void
|
||||||
{
|
{
|
||||||
$null = new NullDepartment(2);
|
$null = new NullDepartment(2);
|
||||||
self::assertEquals(2, $null->getId());
|
self::assertEquals(2, $null->id);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -37,6 +37,6 @@ final class NullPositionTest extends \PHPUnit\Framework\TestCase
|
||||||
public function testId() : void
|
public function testId() : void
|
||||||
{
|
{
|
||||||
$null = new NullPosition(2);
|
$null = new NullPosition(2);
|
||||||
self::assertEquals(2, $null->getId());
|
self::assertEquals(2, $null->id);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -37,6 +37,6 @@ final class NullUnitTest extends \PHPUnit\Framework\TestCase
|
||||||
public function testId() : void
|
public function testId() : void
|
||||||
{
|
{
|
||||||
$null = new NullUnit(2);
|
$null = new NullUnit(2);
|
||||||
self::assertEquals(2, $null->getId());
|
self::assertEquals(2, $null->id);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -36,7 +36,7 @@ final class PositionMapperTest extends \PHPUnit\Framework\TestCase
|
||||||
$id = PositionMapper::create()->execute($position);
|
$id = PositionMapper::create()->execute($position);
|
||||||
|
|
||||||
$positionR = PositionMapper::get()->where('id', $id)->execute();
|
$positionR = PositionMapper::get()->where('id', $id)->execute();
|
||||||
self::assertEquals($id, $positionR->getId());
|
self::assertEquals($id, $positionR->id);
|
||||||
self::assertEquals($position->name, $positionR->name);
|
self::assertEquals($position->name, $positionR->name);
|
||||||
self::assertEquals($position->description, $positionR->description);
|
self::assertEquals($position->description, $positionR->description);
|
||||||
self::assertInstanceOf('Modules\Organization\Models\NullPosition', $positionR->parent);
|
self::assertInstanceOf('Modules\Organization\Models\NullPosition', $positionR->parent);
|
||||||
|
|
|
||||||
|
|
@ -40,12 +40,12 @@ final class PositionTest extends \PHPUnit\Framework\TestCase
|
||||||
*/
|
*/
|
||||||
public function testDefault() : void
|
public function testDefault() : void
|
||||||
{
|
{
|
||||||
self::assertEquals(0, $this->position->getId());
|
self::assertEquals(0, $this->position->id);
|
||||||
self::assertEquals('', $this->position->name);
|
self::assertEquals('', $this->position->name);
|
||||||
self::assertEquals('', $this->position->description);
|
self::assertEquals('', $this->position->description);
|
||||||
self::assertEquals('', $this->position->descriptionRaw);
|
self::assertEquals('', $this->position->descriptionRaw);
|
||||||
self::assertInstanceOf(NullPosition::class, $this->position->parent);
|
self::assertInstanceOf(NullPosition::class, $this->position->parent);
|
||||||
self::assertEquals(0, $this->position->department->getId());
|
self::assertEquals(0, $this->position->department->id);
|
||||||
self::assertEquals(Status::INACTIVE, $this->position->getStatus());
|
self::assertEquals(Status::INACTIVE, $this->position->getStatus());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -96,7 +96,7 @@ final class PositionTest extends \PHPUnit\Framework\TestCase
|
||||||
public function testParentInputOutput() : void
|
public function testParentInputOutput() : void
|
||||||
{
|
{
|
||||||
$this->position->parent = new NullPosition(1);
|
$this->position->parent = new NullPosition(1);
|
||||||
self::assertEquals(1, $this->position->parent->getId());
|
self::assertEquals(1, $this->position->parent->id);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -106,7 +106,7 @@ final class PositionTest extends \PHPUnit\Framework\TestCase
|
||||||
public function testDepartmentInputOutput() : void
|
public function testDepartmentInputOutput() : void
|
||||||
{
|
{
|
||||||
$this->position->department = new NullDepartment(1);
|
$this->position->department = new NullDepartment(1);
|
||||||
self::assertEquals(1, $this->position->department->getId());
|
self::assertEquals(1, $this->position->department->id);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
|
|
@ -37,9 +37,9 @@ final class UnitMapperTest extends \PHPUnit\Framework\TestCase
|
||||||
$id = UnitMapper::create()->execute($unit);
|
$id = UnitMapper::create()->execute($unit);
|
||||||
|
|
||||||
$unitR = UnitMapper::get()->where('id', $id)->execute();
|
$unitR = UnitMapper::get()->where('id', $id)->execute();
|
||||||
self::assertEquals($id, $unitR->getId());
|
self::assertEquals($id, $unitR->id);
|
||||||
self::assertEquals($unit->name, $unitR->name);
|
self::assertEquals($unit->name, $unitR->name);
|
||||||
self::assertEquals($unit->description, $unitR->description);
|
self::assertEquals($unit->description, $unitR->description);
|
||||||
self::assertEquals($unit->parent->getId(), $unitR->parent->getId());
|
self::assertEquals($unit->parent->id, $unitR->parent->id);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -40,7 +40,7 @@ final class UnitTest extends \PHPUnit\Framework\TestCase
|
||||||
*/
|
*/
|
||||||
public function testDefault() : void
|
public function testDefault() : void
|
||||||
{
|
{
|
||||||
self::assertEquals(0, $this->unit->getId());
|
self::assertEquals(0, $this->unit->id);
|
||||||
self::assertEquals('', $this->unit->name);
|
self::assertEquals('', $this->unit->name);
|
||||||
self::assertEquals('', $this->unit->description);
|
self::assertEquals('', $this->unit->description);
|
||||||
self::assertEquals('', $this->unit->descriptionRaw);
|
self::assertEquals('', $this->unit->descriptionRaw);
|
||||||
|
|
@ -96,7 +96,7 @@ final class UnitTest extends \PHPUnit\Framework\TestCase
|
||||||
public function testParentInputOutput() : void
|
public function testParentInputOutput() : void
|
||||||
{
|
{
|
||||||
$this->unit->parent = new NullUnit(1);
|
$this->unit->parent = new NullUnit(1);
|
||||||
self::assertEquals(1, $this->unit->parent->getId());
|
self::assertEquals(1, $this->unit->parent->id);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -106,7 +106,7 @@ final class UnitTest extends \PHPUnit\Framework\TestCase
|
||||||
public function testImageInputOutput() : void
|
public function testImageInputOutput() : void
|
||||||
{
|
{
|
||||||
$this->unit->image = new NullMedia(1);
|
$this->unit->image = new NullMedia(1);
|
||||||
self::assertEquals(1, $this->unit->image->getId());
|
self::assertEquals(1, $this->unit->image->id);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user