Minor functioinality improvements

This commit is contained in:
Dennis Eichhorn 2018-11-23 11:37:30 +01:00
parent a4c8f01cf5
commit f1ed15cb24
2 changed files with 24 additions and 9 deletions

View File

@ -639,8 +639,13 @@ class ApiController extends Controller
*/
public function apiUnitFind(RequestAbstract $request, ResponseAbstract $response, $data = null) : void
{
$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') ?? ''))));
$response->getHeader()->set('Content-Type', MimeType::M_JSON, true);
$response->set(
$request->getUri()->__toString(),
\array_values(
UnitMapper::find((string) ($request->getData('search') ?? ''))
)
);
}
/**
@ -658,8 +663,13 @@ class ApiController extends Controller
*/
public function apiDepartmentFind(RequestAbstract $request, ResponseAbstract $response, $data = null) : void
{
$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') ?? ''))));
$response->getHeader()->set('Content-Type', MimeType::M_JSON, true);
$response->set(
$request->getUri()->__toString(),
\array_values(
DepartmentMapper::find((string) ($request->getData('search') ?? ''))
)
);
}
/**
@ -677,7 +687,12 @@ class ApiController extends Controller
*/
public function apiPositionFind(RequestAbstract $request, ResponseAbstract $response, $data = null) : void
{
$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') ?? ''))));
$response->getHeader()->set('Content-Type', MimeType::M_JSON, true);
$response->set(
$request->getUri()->__toString(),
\array_values(
PositionMapper::find((string) ($request->getData('search') ?? ''))
)
);
}
}

View File

@ -6,9 +6,9 @@
"key": 1, "listener": "click", "action": [
{"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/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"}, "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}
{"key": 5, "type": "dom.table.append", "id": "grp-table", "aniIn": "fadeIn", "data": [], "bindings": {"id": "id", "name": "name"}, "position": -1}
]
}
]' formaction=""><i class="fa fa-book"></i></button>
@ -27,7 +27,7 @@
{"key": 1, "type": "validate.keypress", "pressed": "13|9"},
{"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": 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": 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}</span>", "data": ""},
{"key": 5, "type": "dom.setvalue", "overwrite": true, "selector": "#<?= $this->printHtml($this->getId()); ?>", "value": "", "data": ""}
]
}