Skip to content

Commit

Permalink
feat(ZMS-1808): add validation
Browse files Browse the repository at this point in the history
  • Loading branch information
manjencic committed Jan 17, 2024
1 parent 0a95e61 commit 8533473
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 4 deletions.
22 changes: 19 additions & 3 deletions zmsadmin/src/Zmsadmin/WorkstationProcessRedirect.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,24 @@ public function readResponse(
$process = $workstation->process;

if ($request->getMethod() === 'POST') {
$validator = $request->getAttribute('validator');
$selectedLocation = $validator->getParameter('location')->isNumber()->getValue();

if (empty($selectedLocation)) {
return \BO\Slim\Render::redirect(
'workstationProcessRedirect',
[],
[
'errors' => [
'location' => 'Bitte wählen Sie einen Standort aus.'
]
]
);
}

$scope = \App::$http
->readGetResult(
'/scope/' . $input['location'] . '/',
'/scope/' . $selectedLocation . '/',
['resolveReferences' => 2]
)->getEntity();

Expand All @@ -54,7 +69,7 @@ public function readResponse(
array()
);
}

return \BO\Slim\Render::withHtml(
$response,
'page/workstationProcessRedirect.twig',
Expand All @@ -64,7 +79,8 @@ public function readResponse(
'department' => $department,
'scope' => $workstation->scope,
'scopes' => $department->getScopeList(),
'menuActive' => 'workstation'
'menuActive' => 'workstation',
'errors' => $request->getParam('errors')
)
);
}
Expand Down
3 changes: 2 additions & 1 deletion zmsadmin/templates/block/appointment/formRedirect.twig
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,10 @@
{% set scopeOptionsGroup = scopeOptionsGroup|merge([{ 'name' : department.name, 'options' : scopeOptionsGroupOptions|msort('name') }]) %}

{{ formgroup(
{"label": "Weiterleiten zu Standort"},
{"label": "Weiterleiten zu Standort", "required": true, "errors": [errors.location]},
[{
"type": "select",
"required": true,
"parameter": {
"name": "location",
"options": scopeOptionsGroup
Expand Down

0 comments on commit 8533473

Please sign in to comment.