diff --git a/api/src/Controller/DashboardController.php b/api/src/Controller/DashboardController.php index 845fdd80..ad191451 100644 --- a/api/src/Controller/DashboardController.php +++ b/api/src/Controller/DashboardController.php @@ -85,7 +85,17 @@ public function notificationsAction(Session $session, Request $request, CommonGr public function claimsAction(Session $session, Request $request, CommonGroundService $commonGroundService, ApplicationService $applicationService, ParameterBagInterface $params, string $slug = 'home') { $variables = []; - $variables['claims'] = $commonGroundService->getResourceList('https://dev.zuid-drecht.nl/api/v1/wac/claims')['hydra:member']; //['component' => 'wac', 'type' => 'claims'], ['person' => $this->getUser()->getPerson(), 'order[dateCreated]' => 'desc'] + $variables['claims'] = $commonGroundService->getResourceList(['component' => 'wac', 'type' => 'claims'], ['person' => $this->getUser()->getPerson(), 'order[dateCreated]' => 'desc'])['hydra:member']; + + if ($request->isMethod('POST')) { + $resource = $request->request->all(); + + $resource['person'] = $this->getUser()->getPerson(); + + $commonGroundService->saveResource($resource, (['component' => 'wac', 'type' => 'claims'])); + + return $this->redirect($this->generateUrl('app_dashboard_claims')); + } return $variables; } @@ -97,7 +107,7 @@ public function claimsAction(Session $session, Request $request, CommonGroundSer public function contractsAction(Session $session, Request $request, CommonGroundService $commonGroundService, ApplicationService $applicationService, ParameterBagInterface $params, string $slug = 'home') { $variables = []; - $variables['contracts'] = $commonGroundService->getResourceList('https://dev.zuid-drecht.nl/api/v1/wac/contracts')['hydra:member']; //['component' => 'wac', 'type' => 'contracts'], ['person' => $this->getUser()->getPerson(), 'order[dateCreated]' => 'desc'] + $variables['contracts'] = $commonGroundService->getResourceList(['component' => 'wac', 'type' => 'contracts'], ['person' => $this->getUser()->getPerson(), 'order[dateCreated]' => 'desc'])['hydra:member']; return $variables; } diff --git a/api/templates/dashboard/claims.html.twig b/api/templates/dashboard/claims.html.twig index cb26d6c5..5451f8d7 100644 --- a/api/templates/dashboard/claims.html.twig +++ b/api/templates/dashboard/claims.html.twig @@ -65,7 +65,7 @@ -