Implement new account selector

This commit is contained in:
Dennis Eichhorn 2019-02-23 19:09:31 +01:00
parent 3c3f0835af
commit aaddc1b48c
2 changed files with 41 additions and 32 deletions

View File

@ -31,6 +31,7 @@ use phpOMS\Views\View;
class BaseView extends View class BaseView extends View
{ {
private $id = ''; private $id = '';
private $name = '';
private $isRequired = false; private $isRequired = false;
/** /**
@ -50,6 +51,11 @@ class BaseView extends View
return $this->id; return $this->id;
} }
public function getName() : string
{
return $this->name;
}
public function isRequired() : bool public function isRequired() : bool
{ {
return $this->isRequired; return $this->isRequired;
@ -61,7 +67,8 @@ class BaseView extends View
public function render(...$data) : string public function render(...$data) : string
{ {
$this->id = $data[0]; $this->id = $data[0];
$this->isRequired = $data[1] ?? false; $this->name = $data[1];
$this->isRequired = $data[2] ?? false;
$this->getData('popup')->setId($this->id); $this->getData('popup')->setId($this->id);
return parent::render(); return parent::render();
} }

View File

@ -12,38 +12,40 @@
] ]
} }
]' formaction=""><i class="fa fa-book"></i></button> ]' formaction=""><i class="fa fa-book"></i></button>
<input type="text" list="<?= $this->printHtml($this->getId()); ?>-datalist" id="<?= $this->printHtml($this->getId()); ?>" name="receiver" placeholder="&#xf007; Guest" data-action='[ <div class="advancedInput wf-100" id="<?= $this->printHtml($this->getId()); ?>">
{ <input autocomplete="off" class="input" type="text" id="i<?= $this->printHtml($this->getId()); ?>" placeholder="&#xf007; Guest"
"key": 1, "listener": "keyup", "action": [ data-emptyAfter="true"
{"key": 1, "type": "validate.keypress", "pressed": "!13!37!38!39!40"}, data-autocomplete="false"
{"key": 2, "type": "utils.timer", "id": "<?= $this->printHtml($this->getId()); ?>", "delay": 500, "resets": true}, data-src="{/lang}/api/admin/find/account?search={#i<?= $this->printHtml($this->getId()); ?>}">
{"key": 3, "type": "dom.datalist.clear", "id": "<?= $this->printHtml($this->getId()); ?>-datalist"}, <div id="<?= $this->printHtml($this->getId()); ?>-dropdown" class="dropdown" data-active="true">
{"key": 4, "type": "message.request", "uri": "{/base}/{/lang}/api/admin/find/account?search={#<?= $this->printHtml($this->getId()); ?>}", "method": "GET", "request_type": "json"}, <table class="table darkred">
{"key": 5, "type": "dom.datalist.append", "id": "<?= $this->printHtml($this->getId()); ?>-datalist", "value": "id", "text": "name"} <thead>
] <tr>
}, <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>
"key": 2, "listener": "keydown", "action" : [ <td>Email<i class="sort-asc fa fa-chevron-up"></i><i class="sort-desc fa fa-chevron-down"></i>
{"key": 1, "type": "validate.keypress", "pressed": "13|9"}, <tbody>
{"key": 2, "type": "message.request", "uri": "{/base}/{/lang}/api/admin/find/account?search={#<?= $this->printHtml($this->getId()); ?>}", "method": "GET", "request_type": "json"}, <template id="<?= $this->printHtml($this->getId()); ?>-rowElement" class="rowTemplate">
{"key": 3, "type": "dom.setvalue", "overwrite": false, "selector": "#<?= $this->printHtml($this->getId()); ?>-idlist", "value": "{0/id}", "data": ""}, <tr tabindex="-1">
{"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": ""}, <td data-tpl-text="/id" data-tpl-value="/id" data-value=""></td>
{"key": 5, "type": "dom.setvalue", "overwrite": true, "selector": "#<?= $this->printHtml($this->getId()); ?>", "value": "", "data": ""} <td data-tpl-text="/name/0" data-tpl-value="/name/0" data-value=""></td>
] <td data-tpl-text="/email" data-tpl-value="/email" data-value=""></td>
} </tr>
]'> </template>
<datalist id="<?= $this->printHtml($this->getId()); ?>-datalist"></datalist> </tbody>
<input type="hidden" id="<?= $this->printHtml($this->getId()); ?>-idlist"<?= $this->isRequired() ? ' required' : ''; ?>> </table>
</div>
</div>
</span> </span>
</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 taglist" id="<?= $this->printHtml($this->getId()); ?>-taglist" data-action='[ <div class="box" id="<?= $this->printHtml($this->getId()); ?>-tags" data-limit="0" data-active="true">
{ <template id="<?= $this->printHtml($this->getId()); ?>-tagTemplate">
"key": 1, "listener": "click", "selector": "#<?= $this->printHtml($this->getId()); ?>-taglist span fa", "action": [ <span class="tag red" data-tpl-value="/id" data-value="" data-uuid="" data-name="<?= $this->printHtml($this->getName()); ?>">
{"key": 1, "type": "dom.getvalue", "base": "self"}, <i class="fa fa-times"></i>
{"key": 2, "type": "dom.removevalue", "selector": "#<?= $this->printHtml($this->getId()); ?>-idlist", "data": ""}, <span data-tpl-text="/id" data-tpl-value="/id" data-value=""></span>
{"key": 3, "type": "dom.remove", "base": "self"} <span data-tpl-text="/name/0" data-tpl-value="/name/0" data-value=""></span>
] </span>
} </template>
]'></div> </div>