mirror of
https://github.com/Karaka-Management/oms-Profile.git
synced 2026-02-01 08:48:40 +00:00
Fix selector bugs
This commit is contained in:
parent
44839477b2
commit
16d49c4b3e
|
|
@ -30,8 +30,7 @@ class BaseView extends View
|
|||
parent::__construct($app, $request, $response);
|
||||
$this->setTemplate('/Modules/Profile/Theme/Backend/Components/AccountGroupSelector/base');
|
||||
|
||||
$view = new View($app, $request, $response);
|
||||
$view->setTemplate('/Modules/Profile/Theme/Backend/Components/AccountGroupSelector/popup');
|
||||
$view = new PopupView($app, $request, $response);
|
||||
$this->addData('popup', $view);
|
||||
}
|
||||
|
||||
|
|
@ -49,6 +48,7 @@ class BaseView extends View
|
|||
{
|
||||
$this->id = $data[0];
|
||||
$this->required = $data[1] ?? false;
|
||||
$this->getData('popup')->setId($this->id);
|
||||
return parent::render();
|
||||
}
|
||||
}
|
||||
48
Theme/Backend/Components/AccountGroupSelector/PopupView.php
Normal file
48
Theme/Backend/Components/AccountGroupSelector/PopupView.php
Normal file
|
|
@ -0,0 +1,48 @@
|
|||
<?php
|
||||
/**
|
||||
* Orange Management
|
||||
*
|
||||
* PHP Version 7.1
|
||||
*
|
||||
* @category TBD
|
||||
* @package TBD
|
||||
* @copyright Dennis Eichhorn
|
||||
* @license OMS License 1.0
|
||||
* @version 1.0.0
|
||||
* @link http://orange-management.com
|
||||
*/
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Modules\Profile\Theme\Backend\Components\AccountGroupSelector;
|
||||
|
||||
use phpOMS\Views\View;
|
||||
use phpOMS\ApplicationAbstract;
|
||||
use phpOMS\Message\RequestAbstract;
|
||||
use phpOMS\Message\ResponseAbstract;
|
||||
|
||||
class PopupView extends View
|
||||
{
|
||||
private $id = '';
|
||||
|
||||
public function __construct(ApplicationAbstract $app, RequestAbstract $request, ResponseAbstract $response)
|
||||
{
|
||||
parent::__construct($app, $request, $response);
|
||||
$this->setTemplate('/Modules/Profile/Theme/Backend/Components/AccountGroupSelector/popup');
|
||||
}
|
||||
|
||||
public function setId(string $id)
|
||||
{
|
||||
$this->id = $id;
|
||||
}
|
||||
|
||||
public function getId() : string
|
||||
{
|
||||
return $this->id;
|
||||
}
|
||||
|
||||
public function render(...$data) : string
|
||||
{
|
||||
$this->id = $data[0] ?? $this->id;
|
||||
return parent::render();
|
||||
}
|
||||
}
|
||||
|
|
@ -2,7 +2,7 @@
|
|||
<button type="button" data-action='[
|
||||
{
|
||||
"listener": "click", "action": [
|
||||
{"key": 1, "type": "dom.popup", "tpl": "acc-grp-tpl", "aniIn": "fadeIn"},
|
||||
{"key": 1, "type": "dom.popup", "selector": "#acc-grp-tpl", "aniIn": "fadeIn"},
|
||||
{"key": 2, "type": "message.request", "uri": "<?= \phpOMS\Uri\UriFactory::build('{/base}/{/lang}/api/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/0"}, "position": -1},
|
||||
{"key": 4, "type": "message.request", "uri": "<?= \phpOMS\Uri\UriFactory::build('{/base}/{/lang}/api/admin/account?filter=some&limit=10'); ?>", "method": "GET", "request_type": "json"},
|
||||
|
|
@ -24,9 +24,9 @@
|
|||
"key": 2, "listener": "keydown", "action" : [
|
||||
{"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": 3, "type": "dom.setvalue", "overwrite": false, "id": "<?= $this->printHtml($this->getId()); ?>-idlist", "value": "{0/id}", "data": ""},
|
||||
{"key": 4, "type": "dom.setvalue", "overwrite": false, "id": "<?= $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, "id": "<?= $this->printHtml($this->getId()); ?>", "value": "", "data": ""}
|
||||
{"key": 3, "type": "dom.setvalue", "overwrite": false, "selector": "#<?= $this->printHtml($this->getId()); ?>-idlist", "value": "{0/id}", "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": ""}
|
||||
]
|
||||
}
|
||||
]'<?= $this->isRequired() ? ' required' : ''; ?>>
|
||||
|
|
@ -35,9 +35,9 @@
|
|||
<div class="box taglist" id="<?= $this->printHtml($this->getId()); ?>-taglist" data-action='[
|
||||
{
|
||||
"key": 1, "listener": "click", "selector": "#<?= $this->printHtml($this->getId()); ?>-taglist span fa", "action": [
|
||||
{"key": 1, "type": "dom.remove", "tpl": "self"},
|
||||
{"key": 2, "type": "dom.getvalue", "selector": "self"},
|
||||
{"key": 3, "type": "dom.removevalue", "id": "<?= $this->printHtml($this->getId()); ?>-idlist", "data": ""}
|
||||
{"key": 1, "type": "dom.remove", "selector": "", "base": "self"},
|
||||
{"key": 2, "type": "dom.getvalue", "selector": "", "base": "self"},
|
||||
{"key": 3, "type": "dom.removevalue", "selector": "#<?= $this->printHtml($this->getId()); ?>-idlist", "data": ""}
|
||||
]
|
||||
}
|
||||
]'></div>
|
||||
|
|
@ -37,13 +37,14 @@
|
|||
<th data-name="city">City
|
||||
<th data-name="zip">Zip
|
||||
<th data-name="country">Country
|
||||
<!-- todo: get data from tr in action and pass it to next actions -->
|
||||
<!-- todo: get data from tr in action and pass it to next actions, or make new request based on table cell? -->
|
||||
<tbody data-action='[
|
||||
{
|
||||
"key": 1, "listener": "click", "selector": "#acc-table tbody tr", "action": [
|
||||
{"key": 1, "type": "dom.setvalue", "overwrite": false, "id": "<?= $this->printHtml($this->getId()); ?>-idlist", "value": "{0/id}", "data": ""},
|
||||
{"key": 2, "type": "dom.setvalue", "overwrite": false, "id": "<?= $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": 3, "type": "dom.setvalue", "overwrite": true, "id": "<?= $this->printHtml($this->getId()); ?>", "value": "", "data": ""}
|
||||
{"key": 1, "type": "dom.getvalue", "base": "self", "selector": ""},
|
||||
{"key": 2, "type": "dom.setvalue", "overwrite": false, "selector": "#<?= $this->printHtml($this->getId()); ?>-idlist", "value": "{0/id}", "data": ""},
|
||||
{"key": 3, "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": 4, "type": "dom.setvalue", "overwrite": true, "selector": "#<?= $this->printHtml($this->getId()); ?>", "value": "", "data": ""}
|
||||
]
|
||||
}
|
||||
]'>
|
||||
|
|
@ -52,7 +53,7 @@
|
|||
<tr><td colspan="2"><button type="button" data-action='[
|
||||
{
|
||||
"listener": "click", "action": [
|
||||
{"key": 1, "type": "dom.remove", "tpl": "acc-grp", "aniOut": "fadeOut"}
|
||||
{"key": 1, "type": "dom.remove", "selector": "#acc-grp", "aniOut": "fadeOut"}
|
||||
]
|
||||
}
|
||||
]'><?= $this->getHtml('Close', 'Admin') ?></button>
|
||||
|
|
@ -88,7 +89,7 @@
|
|||
<tr><td colspan="2"><button type="button" data-action='[
|
||||
{
|
||||
"listener": "click", "action": [
|
||||
{"key": 1, "type": "dom.remove", "tpl": "acc-grp", "aniOut": "fadeOut"}
|
||||
{"key": 1, "type": "dom.remove", "selector": "#acc-grp", "aniOut": "fadeOut"}
|
||||
]
|
||||
}
|
||||
]'><?= $this->getHtml('Close', 'Admin') ?></button>
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user