mirror of
https://github.com/Karaka-Management/oms-Profile.git
synced 2026-01-18 10:28:42 +00:00
Implement basic lookup functionality
This commit is contained in:
parent
24e782af8c
commit
eaefcf435e
|
|
@ -23,6 +23,7 @@ use phpOMS\Message\ResponseAbstract;
|
|||
class BaseView extends View
|
||||
{
|
||||
private $id = '';
|
||||
private $isRequired = false;
|
||||
|
||||
public function __construct(ApplicationAbstract $app, RequestAbstract $request, ResponseAbstract $response)
|
||||
{
|
||||
|
|
@ -39,9 +40,15 @@ class BaseView extends View
|
|||
return $this->id;
|
||||
}
|
||||
|
||||
public function isRequired() : bool
|
||||
{
|
||||
return $this->isRequired;
|
||||
}
|
||||
|
||||
public function render(...$data) : string
|
||||
{
|
||||
$this->id = $data[0];
|
||||
$this->required = $data[1] ?? false;
|
||||
return parent::render();
|
||||
}
|
||||
}
|
||||
|
|
@ -13,7 +13,7 @@
|
|||
<input type="text" list="<?= $this->printHtml($this->getId()); ?>-datalist" id="<?= $this->printHtml($this->getId()); ?>" name="receiver" placeholder=" Guest" data-action='[
|
||||
{
|
||||
"key": 1, "listener": "keyup", "action": [
|
||||
{"key": 1, "type": "validate.keypress", "pressed": "!13"},
|
||||
{"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": 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"},
|
||||
|
|
@ -22,13 +22,22 @@
|
|||
},
|
||||
{
|
||||
"key": 2, "listener": "keydown", "action" : [
|
||||
{"key": 1, "type": "validate.keypress", "pressed": "13"},
|
||||
{"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", "data-path": "", "data": ""},
|
||||
{"key": 4, "type": "dom.setvalue", "overwrite": false, "id": "<?= $this->printHtml($this->getId()); ?>-taglist", "data-path": "", "data": ""}
|
||||
{"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": ""}
|
||||
]
|
||||
}
|
||||
]' required>
|
||||
]'<?= $this->isRequired() ? ' required' : ''; ?>>
|
||||
<datalist id="<?= $this->printHtml($this->getId()); ?>-datalist"></datalist>
|
||||
<input type="hidden" id="<?= $this->printHtml($this->getId()); ?>-idlist"></span>
|
||||
<div id="<?= $this->printHtml($this->getId()); ?>-taglist"></div>
|
||||
<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": ""}
|
||||
]
|
||||
}
|
||||
]'></div>
|
||||
Loading…
Reference in New Issue
Block a user