Implement selector drafts

This commit is contained in:
Dennis Eichhorn 2018-07-31 21:51:58 +02:00
parent 03d1a9455b
commit 2c02d12fde
17 changed files with 280 additions and 285 deletions

View File

@ -57,4 +57,23 @@ return [
'verb' => RouteVerb::DELETE, 'verb' => RouteVerb::DELETE,
], ],
], ],
'^.*/api/organization/find/unit.*$' => [
[
'dest' => '\Modules\Organization\Controller:apiUnitFind',
'verb' => RouteVerb::GET,
],
],
'^.*/api/organization/find/department.*$' => [
[
'dest' => '\Modules\Organization\Controller:apiDepartmentFind',
'verb' => RouteVerb::GET,
],
],
'^.*/api/organization/find/position.*$' => [
[
'dest' => '\Modules\Organization\Controller:apiPositionFind',
'verb' => RouteVerb::GET,
],
],
]; ];

View File

@ -1080,4 +1080,85 @@ final class Controller extends ModuleAbstract implements WebInterface
return $department; return $department;
} }
/**
* Api method to find units
*
* @param RequestAbstract $request Request
* @param ResponseAbstract $response Response
* @param mixed $data Generic data
*
* @return void
*
* @api
*
* @since 1.0.0
*/
public function apiUnitFind(RequestAbstract $request, ResponseAbstract $response, $data = null) : void
{
if (!$this->app->accountManager->get($request->getHeader()->getAccount())->hasPermission(
PermissionType::READ, $this->app->orgId, $this->app->appName, self::MODULE_NAME, PermissionState::UNIT)
) {
$response->set('unit_find', null);
$response->getHeader()->setStatusCode(RequestStatusCode::R_403);
return;
}
$response->getHeader()->set('Content-Type', MimeType::M_JSON . '; charset=utf-8', true);
$response->set($request->getUri()->__toString(), array_values(UnitMapper::find((string) ($request->getData('search') ?? ''))));
}
/**
* Api method to find departments
*
* @param RequestAbstract $request Request
* @param ResponseAbstract $response Response
* @param mixed $data Generic data
*
* @return void
*
* @api
*
* @since 1.0.0
*/
public function apiDepartmentFind(RequestAbstract $request, ResponseAbstract $response, $data = null) : void
{
if (!$this->app->accountManager->get($request->getHeader()->getAccount())->hasPermission(
PermissionType::READ, $this->app->orgId, $this->app->appName, self::MODULE_NAME, PermissionState::DEPARTMENT)
) {
$response->set('department_find', null);
$response->getHeader()->setStatusCode(RequestStatusCode::R_403);
return;
}
$response->getHeader()->set('Content-Type', MimeType::M_JSON . '; charset=utf-8', true);
$response->set($request->getUri()->__toString(), array_values(DepartmentMapper::find((string) ($request->getData('search') ?? ''))));
}
/**
* Api method to find positions
*
* @param RequestAbstract $request Request
* @param ResponseAbstract $response Response
* @param mixed $data Generic data
*
* @return void
*
* @api
*
* @since 1.0.0
*/
public function apiPositionFind(RequestAbstract $request, ResponseAbstract $response, $data = null) : void
{
if (!$this->app->accountManager->get($request->getHeader()->getAccount())->hasPermission(
PermissionType::READ, $this->app->orgId, $this->app->appName, self::MODULE_NAME, PermissionState::POSITION)
) {
$response->set('position_find', null);
$response->getHeader()->setStatusCode(RequestStatusCode::R_403);
return;
}
$response->getHeader()->set('Content-Type', MimeType::M_JSON . '; charset=utf-8', true);
$response->set($request->getUri()->__toString(), array_values(PositionMapper::find((string) ($request->getData('search') ?? ''))));
}
} }

View File

@ -48,6 +48,7 @@ class DepartmentTagSelectorView extends View
$this->id = $data[0]; $this->id = $data[0];
$this->isRequired = $data[1] ?? false; $this->isRequired = $data[1] ?? false;
$this->getData('department-selector-popup')->setId($this->id); $this->getData('department-selector-popup')->setId($this->id);
return parent::render(); return parent::render();
} }
} }

View File

@ -1,90 +1,48 @@
<template id="acc-grp-tpl"> <template id="org-department-selector-tpl">
<section id="acc-grp" class="box w-50" style="z-index: 9; position: absolute; margin: 0 auto; left: 50%; top: 50%; transform: translate(-50%, -50%);"> <section id="org-department-selector" class="box w-50" style="z-index: 9; position: absolute; margin: 0 auto; left: 50%; top: 50%; transform: translate(-50%, -50%);">
<header><h1><?= $this->getHtml('Account/Group', 'Admin') ?></h1></header> <header><h1><?= $this->getHtml('Department', 'Organization') ?></h1></header>
<div class="inner"> <div class="inner">
<div class="tabular-2"> <label for="iSearchOrgDepartment">Search</label>
<div class="box wf-100"> <input type="text" id="iSearchOrgDepartment" name="receiver-search" data-action='[
<ul class="tab-links"> {
<li><label for="c-tab-1"><?= $this->getHtml('Account', 'Admin') ?></label> "key": 1, "listener": "keyup", "action": [
<li><label for="c-tab-2"><?= $this->getHtml('Group', 'Admin') ?></label> {"key": 1, "type": "utils.timer", "id": "iSearchOrgDepartment", "delay": 500, "resets": true},
</ul> {"key": 2, "type": "dom.table.clear", "id": "acc-table"},
</div> {"key": 3, "type": "message.request", "uri": "{/base}/{/lang}/api/organization/find/department?search={#iSearchOrgDepartment}", "method": "GET", "request_type": "json"},
<div class="tab-content"> {"key": 4, "type": "dom.table.append", "id": "acc-table", "aniIn": "fadeIn", "data": [], "bindings": {"id": "id", "name": "name/0"}, "position": -1}
<input type="radio" id="c-tab-1" name="tabular-2" checked> ]
<div class="tab"> }
<label for="iSearchAcc">Search</label> ]' autocomplete="off">
<input type="text" id="iSearchAcc" name="receiver-search" data-action='[ <table id="acc-table" class="table">
{ <thead>
"listener": "keyup", "action": [ <tr>
{"key": 1, "type": "utils.timer", "id": "iSearchAcc", "delay": 500, "resets": true}, <th data-name="id">ID
{"key": 2, "type": "dom.table.clear", "id": "acc-table"}, <th data-name="name">Name
{"key": 3, "type": "message.request", "uri": "{/base}/{/lang}/api/admin/find/account?search={#iSearchAcc}", "method": "GET", "request_type": "json"}, <th data-name="address">Address
{"key": 4, "type": "dom.table.append", "id": "acc-table", "aniIn": "fadeIn", "data": [], "bindings": {"id": "id", "name": "name/0"}, "position": -1} <th data-name="city">City
] <th data-name="zip">Zip
} <th data-name="country">Country
]' autocomplete="off"> <!-- todo: get data from tr in action and pass it to next actions, or make new request based on table cell? -->
<table id="acc-table" class="table"> <tbody data-action='[
<thead> {
<tr> "key": 1, "listener": "click", "selector": "#acc-table tbody tr", "action": [
<th data-name="id">ID {"key": 1, "type": "dom.getvalue", "base": "self", "selector": ""},
<th data-name="name">Name {"key": 2, "type": "dom.setvalue", "overwrite": false, "selector": "#{$id}-idlist", "value": "{0/id}", "data": ""},
<th data-name="address">Address {"key": 3, "type": "dom.setvalue", "overwrite": false, "selector": "#{$id}-taglist", "value": "<span id=\"{$id}-taglist-{0/id}\" class=\"tag red\" data-id=\"{0/id}\"><i class=\"fa fa-times\"></i> {0/name/0}, {0/name/1}<span>", "data": ""},
<th data-name="city">City {"key": 4, "type": "dom.setvalue", "overwrite": true, "selector": "#{$id}", "value": "", "data": ""}
<th data-name="zip">Zip ]
<th data-name="country">Country }
<!-- todo: get data from tr in action and pass it to next actions, or make new request based on table cell? --> ]'>
<tbody data-action='[ <tfoot>
{ </table>
"key": 1, "listener": "click", "selector": "#acc-table tbody tr", "action": [ <button type="button" id="iSearchOrgDepartment-close" data-action='[
{"key": 1, "type": "dom.getvalue", "base": "self", "selector": ""}, {
{"key": 2, "type": "dom.setvalue", "overwrite": false, "selector": "#{$id}-idlist", "value": "{0/id}", "data": ""}, "key": 1, "listener": "click", "action": [
{"key": 3, "type": "dom.setvalue", "overwrite": false, "selector": "#{$id}-taglist", "value": "<span id=\"{$id}-taglist-{0/id}\" class=\"tag red\" data-id=\"{0/id}\"><i class=\"fa fa-times\"></i> {0/name/0}, {0/name/1}<span>", "data": ""}, {"key": 1, "type": "dom.remove", "selector": "#org-department-selector", "aniOut": "fadeOut"}
{"key": 4, "type": "dom.setvalue", "overwrite": true, "selector": "#{$id}", "value": "", "data": ""} ]
] }
} ]'><?= $this->getHtml('Close', 'Admin') ?></button>
]'>
<tfoot>
</table>
<button type="button" data-action='[
{
"listener": "click", "action": [
{"key": 1, "type": "dom.remove", "selector": "#acc-grp", "aniOut": "fadeOut"}
]
}
]'><?= $this->getHtml('Close', 'Admin') ?></button>
</div>
<input type="radio" id="c-tab-2" name="tabular-2">
<div class="tab">
<label for="iSearchGrp">Search</label>
<input type="text" id="iSearchGrp" name="receiver-search" data-action='[
{
"listener": "keyup", "action": [
{"key": 1, "type": "utils.timer", "id": "iSearchGrp", "delay": 500, "resets": true},
{"key": 2, "type": "dom.table.clear", "id": "grp-table"},
{"key": 3, "type": "message.request", "uri": "{/base}/{/lang}/api/admin/find/account?search={#iSearchGrp}", "method": "GET", "request_type": "json"},
{"key": 4, "type": "dom.table.append", "id": "grp-table", "aniIn": "fadeIn", "data": [], "bindings": {"id": "id", "name": "name/0"}, "position": -1}
]
}
]' autocomplete="off">
<table id="grp-table" class="table">
<thead>
<tr>
<th data-name="id">ID
<th data-name="name">Name
<th data-name="parent">Parent
<tbody>
<tfoot>
</table>
<button type="button" data-action='[
{
"listener": "click", "action": [
{"key": 1, "type": "dom.remove", "selector": "#acc-grp", "aniOut": "fadeOut"}
]
}
]'><?= $this->getHtml('Close', 'Admin') ?></button>
</div>
</div>
</div> </div>
</section> </section>
</template> </template>

View File

@ -1,12 +1,14 @@
<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" data-action='[ <button type="button" id="<?= $this->printHtml($this->getId()); ?>-book-button" data-action='[
{ {
"listener": "click", "action": [ "key": 1, "listener": "click", "action": [
{"key": 1, "type": "dom.popup", "selector": "#acc-grp-tpl", "aniIn": "fadeIn", "id": "<?= $this->printHtml($this->getId()); ?>"}, {"key": 1, "type": "dom.popup", "selector": "#org-department-selector-tpl", "aniIn": "fadeIn", "id": "<?= $this->printHtml($this->getId()); ?>"},
{"key": 2, "type": "message.request", "uri": "<?= \phpOMS\Uri\UriFactory::build('/{/lang}/api/admin/account?filter=some&limit=10'); ?>", "method": "GET", "request_type": "json"}, {"key": 2, "type": "message.request", "uri": "<?= \phpOMS\Uri\UriFactory::build('/{/lang}/api/organization/department?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/0"}, "position": -1} {"key": 3, "type": "dom.table.append", "id": "acc-table", "aniIn": "fadeIn", "data": [], "bindings": {"id": "id", "name": "name/0"}, "position": -1},
{"key": 4, "type": "message.request", "uri": "<?= \phpOMS\Uri\UriFactory::build('/{/lang}/api/organization/department?filter=some&limit=10'); ?>", "method": "GET", "request_type": "json"},
{"key": 5, "type": "dom.table.append", "id": "grp-table", "aniIn": "fadeIn", "data": [], "bindings": {"id": "id", "name": "name/0"}, "position": -1}
] ]
} }
]' formaction=""><i class="fa fa-book"></i></button> ]' formaction=""><i class="fa fa-book"></i></button>
@ -16,16 +18,16 @@
{"key": 1, "type": "validate.keypress", "pressed": "!13!37!38!39!40"}, {"key": 1, "type": "validate.keypress", "pressed": "!13!37!38!39!40"},
{"key": 2, "type": "utils.timer", "id": "<?= $this->printHtml($this->getId()); ?>", "delay": 500, "resets": true}, {"key": 2, "type": "utils.timer", "id": "<?= $this->printHtml($this->getId()); ?>", "delay": 500, "resets": true},
{"key": 3, "type": "dom.datalist.clear", "id": "<?= $this->printHtml($this->getId()); ?>-datalist"}, {"key": 3, "type": "dom.datalist.clear", "id": "<?= $this->printHtml($this->getId()); ?>-datalist"},
{"key": 4, "type": "message.request", "uri": "{/base}/{/lang}/api/admin/find/account?search={#<?= $this->printHtml($this->getId()); ?>}", "method": "GET", "request_type": "json"}, {"key": 4, "type": "message.request", "uri": "{/base}/{/lang}/api/organization/find/department?search={#<?= $this->printHtml($this->getId()); ?>}", "method": "GET", "request_type": "json"},
{"key": 5, "type": "dom.datalist.append", "id": "<?= $this->printHtml($this->getId()); ?>-datalist", "value": "id", "text": "name"} {"key": 5, "type": "dom.datalist.append", "id": "<?= $this->printHtml($this->getId()); ?>-datalist", "value": "id", "text": "name"}
] ]
}, },
{ {
"key": 2, "listener": "keydown", "action" : [ "key": 2, "listener": "keydown", "action" : [
{"key": 1, "type": "validate.keypress", "pressed": "13|9"}, {"key": 1, "type": "validate.keypress", "pressed": "13|9"},
{"key": 2, "type": "message.request", "uri": "{/base}/{/lang}/api/admin/find/account?search={#<?= $this->printHtml($this->getId()); ?>}", "method": "GET", "request_type": "json"}, {"key": 2, "type": "message.request", "uri": "{/base}/{/lang}/api/organization/find/department?search={#<?= $this->printHtml($this->getId()); ?>}", "method": "GET", "request_type": "json"},
{"key": 3, "type": "dom.setvalue", "overwrite": true, "selector": "#<?= $this->printHtml($this->getId()); ?>-idlist", "value": "{0/id}", "data": ""}, {"key": 3, "type": "dom.setvalue", "overwrite": false, "selector": "#<?= $this->printHtml($this->getId()); ?>-idlist", "value": "{0/id}", "data": ""},
{"key": 4, "type": "dom.setvalue", "overwrite": true, "selector": "#<?= $this->printHtml($this->getId()); ?>-taglist", "value": "<span id=\"<?= $this->printHtml($this->getId()); ?>-taglist-{0/id}\" class=\"tag red\" data-id=\"{0/id}\"><i class=\"fa fa-times\"></i> {0/name/0}, {0/name/1}</span>", "data": ""}, {"key": 4, "type": "dom.setvalue", "overwrite": false, "selector": "#<?= $this->printHtml($this->getId()); ?>-taglist", "value": "<span id=\"<?= $this->printHtml($this->getId()); ?>-taglist-{0/id}\" class=\"tag red\" data-id=\"{0/id}\"><i class=\"fa fa-times\"></i> {0/name/0}, {0/name/1}</span>", "data": ""},
{"key": 5, "type": "dom.setvalue", "overwrite": true, "selector": "#<?= $this->printHtml($this->getId()); ?>", "value": "", "data": ""} {"key": 5, "type": "dom.setvalue", "overwrite": true, "selector": "#<?= $this->printHtml($this->getId()); ?>", "value": "", "data": ""}
] ]
} }

View File

@ -48,6 +48,7 @@ class PositionTagSelectorView extends View
$this->id = $data[0]; $this->id = $data[0];
$this->isRequired = $data[1] ?? false; $this->isRequired = $data[1] ?? false;
$this->getData('position-selector-popup')->setId($this->id); $this->getData('position-selector-popup')->setId($this->id);
return parent::render(); return parent::render();
} }
} }

View File

@ -1,90 +1,48 @@
<template id="acc-grp-tpl"> <template id="org-position-selector-tpl">
<section id="acc-grp" class="box w-50" style="z-index: 9; position: absolute; margin: 0 auto; left: 50%; top: 50%; transform: translate(-50%, -50%);"> <section id="org-position-selector" class="box w-50" style="z-index: 9; position: absolute; margin: 0 auto; left: 50%; top: 50%; transform: translate(-50%, -50%);">
<header><h1><?= $this->getHtml('Account/Group', 'Admin') ?></h1></header> <header><h1><?= $this->getHtml('Position', 'Organization') ?></h1></header>
<div class="inner"> <div class="inner">
<div class="tabular-2"> <label for="iSearchOrgPosition">Search</label>
<div class="box wf-100"> <input type="text" id="iSearchOrgPosition" name="receiver-search" data-action='[
<ul class="tab-links"> {
<li><label for="c-tab-1"><?= $this->getHtml('Account', 'Admin') ?></label> "key": 1, "listener": "keyup", "action": [
<li><label for="c-tab-2"><?= $this->getHtml('Group', 'Admin') ?></label> {"key": 1, "type": "utils.timer", "id": "iSearchOrgPosition", "delay": 500, "resets": true},
</ul> {"key": 2, "type": "dom.table.clear", "id": "acc-table"},
</div> {"key": 3, "type": "message.request", "uri": "{/base}/{/lang}/api/organization/find/position?search={#iSearchOrgPosition}", "method": "GET", "request_type": "json"},
<div class="tab-content"> {"key": 4, "type": "dom.table.append", "id": "acc-table", "aniIn": "fadeIn", "data": [], "bindings": {"id": "id", "name": "name/0"}, "position": -1}
<input type="radio" id="c-tab-1" name="tabular-2" checked> ]
<div class="tab"> }
<label for="iSearchAcc">Search</label> ]' autocomplete="off">
<input type="text" id="iSearchAcc" name="receiver-search" data-action='[ <table id="acc-table" class="table">
{ <thead>
"listener": "keyup", "action": [ <tr>
{"key": 1, "type": "utils.timer", "id": "iSearchAcc", "delay": 500, "resets": true}, <th data-name="id">ID
{"key": 2, "type": "dom.table.clear", "id": "acc-table"}, <th data-name="name">Name
{"key": 3, "type": "message.request", "uri": "{/base}/{/lang}/api/admin/find/account?search={#iSearchAcc}", "method": "GET", "request_type": "json"}, <th data-name="address">Address
{"key": 4, "type": "dom.table.append", "id": "acc-table", "aniIn": "fadeIn", "data": [], "bindings": {"id": "id", "name": "name/0"}, "position": -1} <th data-name="city">City
] <th data-name="zip">Zip
} <th data-name="country">Country
]' autocomplete="off"> <!-- todo: get data from tr in action and pass it to next actions, or make new request based on table cell? -->
<table id="acc-table" class="table"> <tbody data-action='[
<thead> {
<tr> "key": 1, "listener": "click", "selector": "#acc-table tbody tr", "action": [
<th data-name="id">ID {"key": 1, "type": "dom.getvalue", "base": "self", "selector": ""},
<th data-name="name">Name {"key": 2, "type": "dom.setvalue", "overwrite": false, "selector": "#{$id}-idlist", "value": "{0/id}", "data": ""},
<th data-name="address">Address {"key": 3, "type": "dom.setvalue", "overwrite": false, "selector": "#{$id}-taglist", "value": "<span id=\"{$id}-taglist-{0/id}\" class=\"tag red\" data-id=\"{0/id}\"><i class=\"fa fa-times\"></i> {0/name/0}, {0/name/1}<span>", "data": ""},
<th data-name="city">City {"key": 4, "type": "dom.setvalue", "overwrite": true, "selector": "#{$id}", "value": "", "data": ""}
<th data-name="zip">Zip ]
<th data-name="country">Country }
<!-- todo: get data from tr in action and pass it to next actions, or make new request based on table cell? --> ]'>
<tbody data-action='[ <tfoot>
{ </table>
"key": 1, "listener": "click", "selector": "#acc-table tbody tr", "action": [ <button type="button" id="iSearchOrgPosition-close" data-action='[
{"key": 1, "type": "dom.getvalue", "base": "self", "selector": ""}, {
{"key": 2, "type": "dom.setvalue", "overwrite": false, "selector": "#{$id}-idlist", "value": "{0/id}", "data": ""}, "key": 1, "listener": "click", "action": [
{"key": 3, "type": "dom.setvalue", "overwrite": false, "selector": "#{$id}-taglist", "value": "<span id=\"{$id}-taglist-{0/id}\" class=\"tag red\" data-id=\"{0/id}\"><i class=\"fa fa-times\"></i> {0/name/0}, {0/name/1}<span>", "data": ""}, {"key": 1, "type": "dom.remove", "selector": "#org-position-selector", "aniOut": "fadeOut"}
{"key": 4, "type": "dom.setvalue", "overwrite": true, "selector": "#{$id}", "value": "", "data": ""} ]
] }
} ]'><?= $this->getHtml('Close', 'Admin') ?></button>
]'>
<tfoot>
</table>
<button type="button" data-action='[
{
"listener": "click", "action": [
{"key": 1, "type": "dom.remove", "selector": "#acc-grp", "aniOut": "fadeOut"}
]
}
]'><?= $this->getHtml('Close', 'Admin') ?></button>
</div>
<input type="radio" id="c-tab-2" name="tabular-2">
<div class="tab">
<label for="iSearchGrp">Search</label>
<input type="text" id="iSearchGrp" name="receiver-search" data-action='[
{
"listener": "keyup", "action": [
{"key": 1, "type": "utils.timer", "id": "iSearchGrp", "delay": 500, "resets": true},
{"key": 2, "type": "dom.table.clear", "id": "grp-table"},
{"key": 3, "type": "message.request", "uri": "{/base}/{/lang}/api/admin/find/account?search={#iSearchGrp}", "method": "GET", "request_type": "json"},
{"key": 4, "type": "dom.table.append", "id": "grp-table", "aniIn": "fadeIn", "data": [], "bindings": {"id": "id", "name": "name/0"}, "position": -1}
]
}
]' autocomplete="off">
<table id="grp-table" class="table">
<thead>
<tr>
<th data-name="id">ID
<th data-name="name">Name
<th data-name="parent">Parent
<tbody>
<tfoot>
</table>
<button type="button" data-action='[
{
"listener": "click", "action": [
{"key": 1, "type": "dom.remove", "selector": "#acc-grp", "aniOut": "fadeOut"}
]
}
]'><?= $this->getHtml('Close', 'Admin') ?></button>
</div>
</div>
</div> </div>
</section> </section>
</template> </template>

View File

@ -1,12 +1,14 @@
<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" data-action='[ <button type="button" id="<?= $this->printHtml($this->getId()); ?>-book-button" data-action='[
{ {
"listener": "click", "action": [ "key": 1, "listener": "click", "action": [
{"key": 1, "type": "dom.popup", "selector": "#acc-grp-tpl", "aniIn": "fadeIn", "id": "<?= $this->printHtml($this->getId()); ?>"}, {"key": 1, "type": "dom.popup", "selector": "#org-position-selector-tpl", "aniIn": "fadeIn", "id": "<?= $this->printHtml($this->getId()); ?>"},
{"key": 2, "type": "message.request", "uri": "<?= \phpOMS\Uri\UriFactory::build('/{/lang}/api/admin/account?filter=some&limit=10'); ?>", "method": "GET", "request_type": "json"}, {"key": 2, "type": "message.request", "uri": "<?= \phpOMS\Uri\UriFactory::build('/{/lang}/api/organization/position?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/0"}, "position": -1} {"key": 3, "type": "dom.table.append", "id": "acc-table", "aniIn": "fadeIn", "data": [], "bindings": {"id": "id", "name": "name/0"}, "position": -1},
{"key": 4, "type": "message.request", "uri": "<?= \phpOMS\Uri\UriFactory::build('/{/lang}/api/organization/position?filter=some&limit=10'); ?>", "method": "GET", "request_type": "json"},
{"key": 5, "type": "dom.table.append", "id": "grp-table", "aniIn": "fadeIn", "data": [], "bindings": {"id": "id", "name": "name/0"}, "position": -1}
] ]
} }
]' formaction=""><i class="fa fa-book"></i></button> ]' formaction=""><i class="fa fa-book"></i></button>
@ -16,16 +18,16 @@
{"key": 1, "type": "validate.keypress", "pressed": "!13!37!38!39!40"}, {"key": 1, "type": "validate.keypress", "pressed": "!13!37!38!39!40"},
{"key": 2, "type": "utils.timer", "id": "<?= $this->printHtml($this->getId()); ?>", "delay": 500, "resets": true}, {"key": 2, "type": "utils.timer", "id": "<?= $this->printHtml($this->getId()); ?>", "delay": 500, "resets": true},
{"key": 3, "type": "dom.datalist.clear", "id": "<?= $this->printHtml($this->getId()); ?>-datalist"}, {"key": 3, "type": "dom.datalist.clear", "id": "<?= $this->printHtml($this->getId()); ?>-datalist"},
{"key": 4, "type": "message.request", "uri": "{/base}/{/lang}/api/admin/find/account?search={#<?= $this->printHtml($this->getId()); ?>}", "method": "GET", "request_type": "json"}, {"key": 4, "type": "message.request", "uri": "{/base}/{/lang}/api/organization/find/position?search={#<?= $this->printHtml($this->getId()); ?>}", "method": "GET", "request_type": "json"},
{"key": 5, "type": "dom.datalist.append", "id": "<?= $this->printHtml($this->getId()); ?>-datalist", "value": "id", "text": "name"} {"key": 5, "type": "dom.datalist.append", "id": "<?= $this->printHtml($this->getId()); ?>-datalist", "value": "id", "text": "name"}
] ]
}, },
{ {
"key": 2, "listener": "keydown", "action" : [ "key": 2, "listener": "keydown", "action" : [
{"key": 1, "type": "validate.keypress", "pressed": "13|9"}, {"key": 1, "type": "validate.keypress", "pressed": "13|9"},
{"key": 2, "type": "message.request", "uri": "{/base}/{/lang}/api/admin/find/account?search={#<?= $this->printHtml($this->getId()); ?>}", "method": "GET", "request_type": "json"}, {"key": 2, "type": "message.request", "uri": "{/base}/{/lang}/api/organization/find/position?search={#<?= $this->printHtml($this->getId()); ?>}", "method": "GET", "request_type": "json"},
{"key": 3, "type": "dom.setvalue", "overwrite": true, "selector": "#<?= $this->printHtml($this->getId()); ?>-idlist", "value": "{0/id}", "data": ""}, {"key": 3, "type": "dom.setvalue", "overwrite": false, "selector": "#<?= $this->printHtml($this->getId()); ?>-idlist", "value": "{0/id}", "data": ""},
{"key": 4, "type": "dom.setvalue", "overwrite": true, "selector": "#<?= $this->printHtml($this->getId()); ?>-taglist", "value": "<span id=\"<?= $this->printHtml($this->getId()); ?>-taglist-{0/id}\" class=\"tag red\" data-id=\"{0/id}\"><i class=\"fa fa-times\"></i> {0/name/0}, {0/name/1}</span>", "data": ""}, {"key": 4, "type": "dom.setvalue", "overwrite": false, "selector": "#<?= $this->printHtml($this->getId()); ?>-taglist", "value": "<span id=\"<?= $this->printHtml($this->getId()); ?>-taglist-{0/id}\" class=\"tag red\" data-id=\"{0/id}\"><i class=\"fa fa-times\"></i> {0/name/0}, {0/name/1}</span>", "data": ""},
{"key": 5, "type": "dom.setvalue", "overwrite": true, "selector": "#<?= $this->printHtml($this->getId()); ?>", "value": "", "data": ""} {"key": 5, "type": "dom.setvalue", "overwrite": true, "selector": "#<?= $this->printHtml($this->getId()); ?>", "value": "", "data": ""}
] ]
} }

View File

@ -48,6 +48,7 @@ class UnitTagSelectorView extends View
$this->id = $data[0]; $this->id = $data[0];
$this->isRequired = $data[1] ?? false; $this->isRequired = $data[1] ?? false;
$this->getData('unit-selector-popup')->setId($this->id); $this->getData('unit-selector-popup')->setId($this->id);
return parent::render(); return parent::render();
} }
} }

View File

@ -1,90 +1,48 @@
<template id="acc-grp-tpl"> <template id="org-unit-selector-tpl">
<section id="acc-grp" class="box w-50" style="z-index: 9; position: absolute; margin: 0 auto; left: 50%; top: 50%; transform: translate(-50%, -50%);"> <section id="org-unit-selector" class="box w-50" style="z-index: 9; position: absolute; margin: 0 auto; left: 50%; top: 50%; transform: translate(-50%, -50%);">
<header><h1><?= $this->getHtml('Account/Group', 'Admin') ?></h1></header> <header><h1><?= $this->getHtml('Unit', 'Organization') ?></h1></header>
<div class="inner"> <div class="inner">
<div class="tabular-2"> <label for="iSearchOrgUnit">Search</label>
<div class="box wf-100"> <input type="text" id="iSearchOrgUnit" name="receiver-search" data-action='[
<ul class="tab-links"> {
<li><label for="c-tab-1"><?= $this->getHtml('Account', 'Admin') ?></label> "key": 1, "listener": "keyup", "action": [
<li><label for="c-tab-2"><?= $this->getHtml('Group', 'Admin') ?></label> {"key": 1, "type": "utils.timer", "id": "iSearchOrgUnit", "delay": 500, "resets": true},
</ul> {"key": 2, "type": "dom.table.clear", "id": "acc-table"},
</div> {"key": 3, "type": "message.request", "uri": "{/base}/{/lang}/api/organization/find/unit?search={#iSearchOrgUnit}", "method": "GET", "request_type": "json"},
<div class="tab-content"> {"key": 4, "type": "dom.table.append", "id": "acc-table", "aniIn": "fadeIn", "data": [], "bindings": {"id": "id", "name": "name/0"}, "position": -1}
<input type="radio" id="c-tab-1" name="tabular-2" checked> ]
<div class="tab"> }
<label for="iSearchAcc">Search</label> ]' autocomplete="off">
<input type="text" id="iSearchAcc" name="receiver-search" data-action='[ <table id="acc-table" class="table">
{ <thead>
"listener": "keyup", "action": [ <tr>
{"key": 1, "type": "utils.timer", "id": "iSearchAcc", "delay": 500, "resets": true}, <th data-name="id">ID
{"key": 2, "type": "dom.table.clear", "id": "acc-table"}, <th data-name="name">Name
{"key": 3, "type": "message.request", "uri": "{/base}/{/lang}/api/admin/find/account?search={#iSearchAcc}", "method": "GET", "request_type": "json"}, <th data-name="address">Address
{"key": 4, "type": "dom.table.append", "id": "acc-table", "aniIn": "fadeIn", "data": [], "bindings": {"id": "id", "name": "name/0"}, "position": -1} <th data-name="city">City
] <th data-name="zip">Zip
} <th data-name="country">Country
]' autocomplete="off"> <!-- todo: get data from tr in action and pass it to next actions, or make new request based on table cell? -->
<table id="acc-table" class="table"> <tbody data-action='[
<thead> {
<tr> "key": 1, "listener": "click", "selector": "#acc-table tbody tr", "action": [
<th data-name="id">ID {"key": 1, "type": "dom.getvalue", "base": "self", "selector": ""},
<th data-name="name">Name {"key": 2, "type": "dom.setvalue", "overwrite": false, "selector": "#{$id}-idlist", "value": "{0/id}", "data": ""},
<th data-name="address">Address {"key": 3, "type": "dom.setvalue", "overwrite": false, "selector": "#{$id}-taglist", "value": "<span id=\"{$id}-taglist-{0/id}\" class=\"tag red\" data-id=\"{0/id}\"><i class=\"fa fa-times\"></i> {0/name/0}, {0/name/1}<span>", "data": ""},
<th data-name="city">City {"key": 4, "type": "dom.setvalue", "overwrite": true, "selector": "#{$id}", "value": "", "data": ""}
<th data-name="zip">Zip ]
<th data-name="country">Country }
<!-- todo: get data from tr in action and pass it to next actions, or make new request based on table cell? --> ]'>
<tbody data-action='[ <tfoot>
{ </table>
"key": 1, "listener": "click", "selector": "#acc-table tbody tr", "action": [ <button type="button" id="iSearchOrgUnit-close" data-action='[
{"key": 1, "type": "dom.getvalue", "base": "self", "selector": ""}, {
{"key": 2, "type": "dom.setvalue", "overwrite": false, "selector": "#{$id}-idlist", "value": "{0/id}", "data": ""}, "key": 1, "listener": "click", "action": [
{"key": 3, "type": "dom.setvalue", "overwrite": false, "selector": "#{$id}-taglist", "value": "<span id=\"{$id}-taglist-{0/id}\" class=\"tag red\" data-id=\"{0/id}\"><i class=\"fa fa-times\"></i> {0/name/0}, {0/name/1}<span>", "data": ""}, {"key": 1, "type": "dom.remove", "selector": "#org-unit-selector", "aniOut": "fadeOut"}
{"key": 4, "type": "dom.setvalue", "overwrite": true, "selector": "#{$id}", "value": "", "data": ""} ]
] }
} ]'><?= $this->getHtml('Close', 'Admin') ?></button>
]'>
<tfoot>
</table>
<button type="button" data-action='[
{
"listener": "click", "action": [
{"key": 1, "type": "dom.remove", "selector": "#acc-grp", "aniOut": "fadeOut"}
]
}
]'><?= $this->getHtml('Close', 'Admin') ?></button>
</div>
<input type="radio" id="c-tab-2" name="tabular-2">
<div class="tab">
<label for="iSearchGrp">Search</label>
<input type="text" id="iSearchGrp" name="receiver-search" data-action='[
{
"listener": "keyup", "action": [
{"key": 1, "type": "utils.timer", "id": "iSearchGrp", "delay": 500, "resets": true},
{"key": 2, "type": "dom.table.clear", "id": "grp-table"},
{"key": 3, "type": "message.request", "uri": "{/base}/{/lang}/api/admin/find/account?search={#iSearchGrp}", "method": "GET", "request_type": "json"},
{"key": 4, "type": "dom.table.append", "id": "grp-table", "aniIn": "fadeIn", "data": [], "bindings": {"id": "id", "name": "name/0"}, "position": -1}
]
}
]' autocomplete="off">
<table id="grp-table" class="table">
<thead>
<tr>
<th data-name="id">ID
<th data-name="name">Name
<th data-name="parent">Parent
<tbody>
<tfoot>
</table>
<button type="button" data-action='[
{
"listener": "click", "action": [
{"key": 1, "type": "dom.remove", "selector": "#acc-grp", "aniOut": "fadeOut"}
]
}
]'><?= $this->getHtml('Close', 'Admin') ?></button>
</div>
</div>
</div> </div>
</section> </section>
</template> </template>

View File

@ -1,12 +1,14 @@
<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" data-action='[ <button type="button" id="<?= $this->printHtml($this->getId()); ?>-book-button" data-action='[
{ {
"listener": "click", "action": [ "key": 1, "listener": "click", "action": [
{"key": 1, "type": "dom.popup", "selector": "#acc-grp-tpl", "aniIn": "fadeIn", "id": "<?= $this->printHtml($this->getId()); ?>"}, {"key": 1, "type": "dom.popup", "selector": "#org-unit-selector-tpl", "aniIn": "fadeIn", "id": "<?= $this->printHtml($this->getId()); ?>"},
{"key": 2, "type": "message.request", "uri": "<?= \phpOMS\Uri\UriFactory::build('/{/lang}/api/admin/account?filter=some&limit=10'); ?>", "method": "GET", "request_type": "json"}, {"key": 2, "type": "message.request", "uri": "<?= \phpOMS\Uri\UriFactory::build('/{/lang}/api/organization/unit?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/0"}, "position": -1} {"key": 3, "type": "dom.table.append", "id": "acc-table", "aniIn": "fadeIn", "data": [], "bindings": {"id": "id", "name": "name/0"}, "position": -1},
{"key": 4, "type": "message.request", "uri": "<?= \phpOMS\Uri\UriFactory::build('/{/lang}/api/organization/unit?filter=some&limit=10'); ?>", "method": "GET", "request_type": "json"},
{"key": 5, "type": "dom.table.append", "id": "grp-table", "aniIn": "fadeIn", "data": [], "bindings": {"id": "id", "name": "name/0"}, "position": -1}
] ]
} }
]' formaction=""><i class="fa fa-book"></i></button> ]' formaction=""><i class="fa fa-book"></i></button>
@ -16,16 +18,16 @@
{"key": 1, "type": "validate.keypress", "pressed": "!13!37!38!39!40"}, {"key": 1, "type": "validate.keypress", "pressed": "!13!37!38!39!40"},
{"key": 2, "type": "utils.timer", "id": "<?= $this->printHtml($this->getId()); ?>", "delay": 500, "resets": true}, {"key": 2, "type": "utils.timer", "id": "<?= $this->printHtml($this->getId()); ?>", "delay": 500, "resets": true},
{"key": 3, "type": "dom.datalist.clear", "id": "<?= $this->printHtml($this->getId()); ?>-datalist"}, {"key": 3, "type": "dom.datalist.clear", "id": "<?= $this->printHtml($this->getId()); ?>-datalist"},
{"key": 4, "type": "message.request", "uri": "{/base}/{/lang}/api/admin/find/account?search={#<?= $this->printHtml($this->getId()); ?>}", "method": "GET", "request_type": "json"}, {"key": 4, "type": "message.request", "uri": "{/base}/{/lang}/api/organization/find/unit?search={#<?= $this->printHtml($this->getId()); ?>}", "method": "GET", "request_type": "json"},
{"key": 5, "type": "dom.datalist.append", "id": "<?= $this->printHtml($this->getId()); ?>-datalist", "value": "id", "text": "name"} {"key": 5, "type": "dom.datalist.append", "id": "<?= $this->printHtml($this->getId()); ?>-datalist", "value": "id", "text": "name"}
] ]
}, },
{ {
"key": 2, "listener": "keydown", "action" : [ "key": 2, "listener": "keydown", "action" : [
{"key": 1, "type": "validate.keypress", "pressed": "13|9"}, {"key": 1, "type": "validate.keypress", "pressed": "13|9"},
{"key": 2, "type": "message.request", "uri": "{/base}/{/lang}/api/admin/find/account?search={#<?= $this->printHtml($this->getId()); ?>}", "method": "GET", "request_type": "json"}, {"key": 2, "type": "message.request", "uri": "{/base}/{/lang}/api/organization/find/unit?search={#<?= $this->printHtml($this->getId()); ?>}", "method": "GET", "request_type": "json"},
{"key": 3, "type": "dom.setvalue", "overwrite": true, "selector": "#<?= $this->printHtml($this->getId()); ?>-idlist", "value": "{0/id}", "data": ""}, {"key": 3, "type": "dom.setvalue", "overwrite": false, "selector": "#<?= $this->printHtml($this->getId()); ?>-idlist", "value": "{0/id}", "data": ""},
{"key": 4, "type": "dom.setvalue", "overwrite": true, "selector": "#<?= $this->printHtml($this->getId()); ?>-taglist", "value": "<span id=\"<?= $this->printHtml($this->getId()); ?>-taglist-{0/id}\" class=\"tag red\" data-id=\"{0/id}\"><i class=\"fa fa-times\"></i> {0/name/0}, {0/name/1}</span>", "data": ""}, {"key": 4, "type": "dom.setvalue", "overwrite": false, "selector": "#<?= $this->printHtml($this->getId()); ?>-taglist", "value": "<span id=\"<?= $this->printHtml($this->getId()); ?>-taglist-{0/id}\" class=\"tag red\" data-id=\"{0/id}\"><i class=\"fa fa-times\"></i> {0/name/0}, {0/name/1}</span>", "data": ""},
{"key": 5, "type": "dom.setvalue", "overwrite": true, "selector": "#<?= $this->printHtml($this->getId()); ?>", "value": "", "data": ""} {"key": 5, "type": "dom.setvalue", "overwrite": true, "selector": "#<?= $this->printHtml($this->getId()); ?>", "value": "", "data": ""}
] ]
} }

View File

@ -39,3 +39,5 @@ echo $this->getData('nav')->render(); ?>
</section> </section>
</div> </div>
</div> </div>
<?= $this->getData('department-selector')->getData('department-selector-popup')->render(); ?>

View File

@ -45,3 +45,5 @@ echo $this->getData('nav')->render(); ?>
</section> </section>
</div> </div>
</div> </div>
<?= $this->getData('department-selector')->getData('department-selector-popup')->render(); ?>

View File

@ -43,3 +43,5 @@ echo $this->getData('nav')->render(); ?>
</section> </section>
</div> </div>
</div> </div>
<?= $this->getData('position-selector')->getData('position-selector-popup')->render(); ?>

View File

@ -45,3 +45,5 @@ echo $this->getData('nav')->render(); ?>
</section> </section>
</div> </div>
</div> </div>
<?= $this->getData('position-selector')->getData('position-selector-popup')->render(); ?>

View File

@ -41,3 +41,5 @@ echo $this->getData('nav')->render(); ?>
</section> </section>
</div> </div>
</div> </div>
<?= $this->getData('unit-selector')->getData('unit-selector-popup')->render(); ?>

View File

@ -43,3 +43,5 @@ echo $this->getData('nav')->render(); ?>
</section> </section>
</div> </div>
</div> </div>
<?= $this->getData('unit-selector')->getData('unit-selector-popup')->render(); ?>