diff --git a/appinfo/routes.php b/appinfo/routes.php index cae6f6d..f2b27a0 100644 --- a/appinfo/routes.php +++ b/appinfo/routes.php @@ -45,14 +45,24 @@ ['name' => 'dashboard#page', 'url' => '/', 'verb' => 'GET'], ['name' => 'configuration#index', 'url' => '/api/configuration', 'verb' => 'GET'], ['name' => 'configuration#create', 'url' => '/api/configuration', 'verb' => 'POST'], + ['name' => 'contactMomenten#page', 'url' => '/contactmomenten', 'verb' => 'GET'], + ['name' => 'contactMomenten#page', 'postfix' => 'details', 'url' => '/contactmomenten/{id}', 'verb' => 'GET'], ['name' => 'zaken#page', 'url' => '/zaken', 'verb' => 'GET'], + ['name' => 'zaken#page', 'postfix' => 'details', 'url' => '/zaken/{id}', 'verb' => 'GET'], ['name' => 'rollen#page', 'url' => '/rollen', 'verb' => 'GET'], ['name' => 'statussen#page', 'url' => '/statussen', 'verb' => 'GET'], ['name' => 'zaakinformatieobjecten#page', 'url' => '/zaakinformatieobjecten', 'verb' => 'GET'], - ['name' => 'zaakTypen#page','url' => '/zaak_typen', 'verb' => 'GET'], + ['name' => 'zaakTypen#page','url' => '/zaaktypen', 'verb' => 'GET'], + ['name' => 'zaakTypen#page','postfix' => 'details', 'url' => '/zaaktypen/{id}', 'verb' => 'GET'], ['name' => 'taken#page','url' => '/taken', 'verb' => 'GET'], + ['name' => 'taken#page','postfix' => 'details', 'url' => '/taken/{id}', 'verb' => 'GET'], ['name' => 'klanten#page','url' => '/klanten', 'verb' => 'GET'], - ['name' => 'berichten#index','url' => '/berichten', 'verb' => 'GET'], + ['name' => 'klanten#page','postfix' => 'details', 'url' => '/klanten/{id}', 'verb' => 'GET'], + ['name' => 'medewerkers#page','url' => '/medewerkers', 'verb' => 'GET'], + ['name' => 'medewerkers#page','postfix' => 'details', 'url' => '/medewerkers/{id}', 'verb' => 'GET'], + ['name' => 'berichten#page','url' => '/berichten', 'verb' => 'GET'], + ['name' => 'berichten#page','postfix' => 'details', 'url' => '/berichten/{id}', 'verb' => 'GET'], + ['name' => 'dashboard#page', 'postfix' => 'search', 'url' => '/zoeken', 'verb' => 'GET'], // user Settings ['name' => 'settings#index','url' => '/settings', 'verb' => 'GET'], ['name' => 'settings#create', 'url' => '/settings', 'verb' => 'POST'], diff --git a/lib/Controller/BerichtenController.php b/lib/Controller/BerichtenController.php index bef5944..f3fb8ce 100644 --- a/lib/Controller/BerichtenController.php +++ b/lib/Controller/BerichtenController.php @@ -6,6 +6,8 @@ use OCP\AppFramework\Controller; use OCP\AppFramework\Http\JSONResponse; use OCP\IRequest; +use OCP\AppFramework\Http\TemplateResponse; +use OCP\AppFramework\Http\ContentSecurityPolicy; class BerichtenController extends Controller { @@ -39,6 +41,42 @@ public function index(): JSONResponse return new JSONResponse($data); } + /** + * Render no page. + * + * @param string|null $getParameter Optional GET parameter + * @return TemplateResponse The rendered template response + * + * @NoAdminRequired + * @NoCSRFRequired + */ + public function page(?string $getParameter): TemplateResponse + { + try { + // Create a new TemplateResponse for the index page + $response = new TemplateResponse( + $this->appName, + 'index', + [] + ); + + // Set up Content Security Policy + $csp = new ContentSecurityPolicy(); + $csp->addAllowedConnectDomain('*'); + $response->setContentSecurityPolicy($csp); + + return $response; + } catch (\Exception $e) { + // Return an error template response if an exception occurs + return new TemplateResponse( + $this->appName, + 'error', + ['error' => $e->getMessage()], + '500' + ); + } + } + /** * Read a single object * diff --git a/lib/Controller/ContactMomentenController.php b/lib/Controller/ContactMomentenController.php index 05a1fd4..cec2b96 100644 --- a/lib/Controller/ContactMomentenController.php +++ b/lib/Controller/ContactMomentenController.php @@ -6,6 +6,8 @@ use OCP\AppFramework\Controller; use OCP\AppFramework\Http\JSONResponse; use OCP\IRequest; +use OCP\AppFramework\Http\TemplateResponse; +use OCP\AppFramework\Http\ContentSecurityPolicy; /** * Controller for handling contact moments (contactmomenten) operations @@ -41,6 +43,42 @@ public function index(): JSONResponse return new JSONResponse($data); } + /** + * Render no page. + * + * @param string|null $getParameter Optional GET parameter + * @return TemplateResponse The rendered template response + * + * @NoAdminRequired + * @NoCSRFRequired + */ + public function page(?string $getParameter): TemplateResponse + { + try { + // Create a new TemplateResponse for the index page + $response = new TemplateResponse( + $this->appName, + 'index', + [] + ); + + // Set up Content Security Policy + $csp = new ContentSecurityPolicy(); + $csp->addAllowedConnectDomain('*'); + $response->setContentSecurityPolicy($csp); + + return $response; + } catch (\Exception $e) { + // Return an error template response if an exception occurs + return new TemplateResponse( + $this->appName, + 'error', + ['error' => $e->getMessage()], + '500' + ); + } + } + /** * Read a single contact moment * diff --git a/lib/Controller/KlantenController.php b/lib/Controller/KlantenController.php index b6e8fe8..83639be 100644 --- a/lib/Controller/KlantenController.php +++ b/lib/Controller/KlantenController.php @@ -6,6 +6,8 @@ use OCP\AppFramework\Controller; use OCP\AppFramework\Http\JSONResponse; use OCP\IRequest; +use OCP\AppFramework\Http\TemplateResponse; +use OCP\AppFramework\Http\ContentSecurityPolicy; class KlantenController extends Controller { @@ -41,6 +43,42 @@ public function index(): JSONResponse return new JSONResponse($data); } + /** + * Render no page. + * + * @param string|null $getParameter Optional GET parameter + * @return TemplateResponse The rendered template response + * + * @NoAdminRequired + * @NoCSRFRequired + */ + public function page(?string $getParameter): TemplateResponse + { + try { + // Create a new TemplateResponse for the index page + $response = new TemplateResponse( + $this->appName, + 'index', + [] + ); + + // Set up Content Security Policy + $csp = new ContentSecurityPolicy(); + $csp->addAllowedConnectDomain('*'); + $response->setContentSecurityPolicy($csp); + + return $response; + } catch (\Exception $e) { + // Return an error template response if an exception occurs + return new TemplateResponse( + $this->appName, + 'error', + ['error' => $e->getMessage()], + '500' + ); + } + } + /** * Read a single object * diff --git a/lib/Controller/MedewerkersController.php b/lib/Controller/MedewerkersController.php index 751d052..29dff0e 100644 --- a/lib/Controller/MedewerkersController.php +++ b/lib/Controller/MedewerkersController.php @@ -6,6 +6,8 @@ use OCP\AppFramework\Controller; use OCP\AppFramework\Http\JSONResponse; use OCP\IRequest; +use OCP\AppFramework\Http\TemplateResponse; +use OCP\AppFramework\Http\ContentSecurityPolicy; /** * Controller for handling employees (medewerkers) operations @@ -41,6 +43,42 @@ public function index(): JSONResponse return new JSONResponse($data); } + /** + * Render no page. + * + * @param string|null $getParameter Optional GET parameter + * @return TemplateResponse The rendered template response + * + * @NoAdminRequired + * @NoCSRFRequired + */ + public function page(?string $getParameter): TemplateResponse + { + try { + // Create a new TemplateResponse for the index page + $response = new TemplateResponse( + $this->appName, + 'index', + [] + ); + + // Set up Content Security Policy + $csp = new ContentSecurityPolicy(); + $csp->addAllowedConnectDomain('*'); + $response->setContentSecurityPolicy($csp); + + return $response; + } catch (\Exception $e) { + // Return an error template response if an exception occurs + return new TemplateResponse( + $this->appName, + 'error', + ['error' => $e->getMessage()], + '500' + ); + } + } + /** * Read a single employee * diff --git a/lib/Controller/TakenController.php b/lib/Controller/TakenController.php index fed3e4d..7a046e2 100644 --- a/lib/Controller/TakenController.php +++ b/lib/Controller/TakenController.php @@ -1,142 +1,180 @@ -request->getParams(); - - // Fetch catalog objects based on filters and order - $data = $this->objectService->getResultArrayForRequest('taken', $requestParams); - - // Return JSON response - return new JSONResponse($data); - } - - /** - * Read a single object - * - * @NoAdminRequired - * @NoCSRFRequired - * - * @return JSONResponse - */ - public function show(string $id): JSONResponse - { - // Fetch the catalog object by its ID - $object = $this->objectService->getObject('taken', $id); - - // Return the catalog as a JSON response - return new JSONResponse($object); - } - - - /** - * Creatue an object - * - * @NoAdminRequired - * @NoCSRFRequired - * - * @return JSONResponse - */ - public function create(): JSONResponse - { - // Get all parameters from the request - $data = $this->request->getParams(); - - // Remove the 'id' field if it exists, as we're creating a new object - unset($data['id']); - - // Save the new catalog object - $object = $this->objectService->saveObject('taken', $data); - - $this->mailService->sendMail([], is_array($object) === true ? $object : $object->jsonSerialize()); - - // Return the created object as a JSON response - return new JSONResponse($object); - } - - /** - * Update an object - * - * @NoAdminRequired - * @NoCSRFRequired - * - * @return JSONResponse - */ - public function update(string $id): JSONResponse - { - // Get all parameters from the request - $data = $this->request->getParams(); - - $oldObject = $this->objectService->getObject('taken', $id); - - $data['id'] = $id; - - // Save the new catalog object - $object = $this->objectService->saveObject('taken', $data); - - $this->mailService->sendMail(is_array($oldObject) === true ? $oldObject : $oldObject->jsonSerialize(), is_array($object) === true ? $object : $object->jsonSerialize()); - - // Return the created object as a JSON response - return new JSONResponse($object); - } - - /** - * Delate an object - * - * @NoAdminRequired - * @NoCSRFRequired - * - * @return JSONResponse - */ - public function destroy(string $id): JSONResponse - { - // Delete the catalog object - $result = $this->objectService->deleteObject('taken', $id); - - // Return the result as a JSON response - return new JSONResponse(['success' => $result], $result === true ? '200' : '404'); - } - - /** - * Get audit trail for a specific klant - * - * @NoAdminRequired - * @NoCSRFRequired - * - * @return JSONResponse - */ - public function getAuditTrail(string $id): JSONResponse - { - $auditTrail = $this->objectService->getAuditTrail('taken', $id); - return new JSONResponse($auditTrail); - } -} +request->getParams(); + + // Fetch catalog objects based on filters and order + $data = $this->objectService->getResultArrayForRequest('taken', $requestParams); + + // Return JSON response + return new JSONResponse($data); + } + + /** + * Render no page. + * + * @param string|null $getParameter Optional GET parameter + * @return TemplateResponse The rendered template response + * + * @NoAdminRequired + * @NoCSRFRequired + */ + public function page(?string $getParameter): TemplateResponse + { + try { + // Create a new TemplateResponse for the index page + $response = new TemplateResponse( + $this->appName, + 'index', + [] + ); + + // Set up Content Security Policy + $csp = new ContentSecurityPolicy(); + $csp->addAllowedConnectDomain('*'); + $response->setContentSecurityPolicy($csp); + + return $response; + } catch (\Exception $e) { + // Return an error template response if an exception occurs + return new TemplateResponse( + $this->appName, + 'error', + ['error' => $e->getMessage()], + '500' + ); + } + } + + /** + * Read a single object + * + * @NoAdminRequired + * @NoCSRFRequired + * + * @return JSONResponse + */ + public function show(string $id): JSONResponse + { + // Fetch the catalog object by its ID + $object = $this->objectService->getObject('taken', $id); + + // Return the catalog as a JSON response + return new JSONResponse($object); + } + + + /** + * Creatue an object + * + * @NoAdminRequired + * @NoCSRFRequired + * + * @return JSONResponse + */ + public function create(): JSONResponse + { + // Get all parameters from the request + $data = $this->request->getParams(); + + // Remove the 'id' field if it exists, as we're creating a new object + unset($data['id']); + + // Save the new catalog object + $object = $this->objectService->saveObject('taken', $data); + + $this->mailService->sendMail([], is_array($object) === true ? $object : $object->jsonSerialize()); + + // Return the created object as a JSON response + return new JSONResponse($object); + } + + /** + * Update an object + * + * @NoAdminRequired + * @NoCSRFRequired + * + * @return JSONResponse + */ + public function update(string $id): JSONResponse + { + // Get all parameters from the request + $data = $this->request->getParams(); + + $oldObject = $this->objectService->getObject('taken', $id); + + $data['id'] = $id; + + // Save the new catalog object + $object = $this->objectService->saveObject('taken', $data); + + $this->mailService->sendMail(is_array($oldObject) === true ? $oldObject : $oldObject->jsonSerialize(), is_array($object) === true ? $object : $object->jsonSerialize()); + + // Return the created object as a JSON response + return new JSONResponse($object); + } + + /** + * Delate an object + * + * @NoAdminRequired + * @NoCSRFRequired + * + * @return JSONResponse + */ + public function destroy(string $id): JSONResponse + { + // Delete the catalog object + $result = $this->objectService->deleteObject('taken', $id); + + // Return the result as a JSON response + return new JSONResponse(['success' => $result], $result === true ? '200' : '404'); + } + + /** + * Get audit trail for a specific klant + * + * @NoAdminRequired + * @NoCSRFRequired + * + * @return JSONResponse + */ + public function getAuditTrail(string $id): JSONResponse + { + $auditTrail = $this->objectService->getAuditTrail('taken', $id); + return new JSONResponse($auditTrail); + } +} diff --git a/lib/Controller/ZaakTypenController.php b/lib/Controller/ZaakTypenController.php index ffed1e1..e7e5186 100644 --- a/lib/Controller/ZaakTypenController.php +++ b/lib/Controller/ZaakTypenController.php @@ -6,6 +6,8 @@ use OCP\AppFramework\Controller; use OCP\AppFramework\Http\JSONResponse; use OCP\IRequest; +use OCP\AppFramework\Http\TemplateResponse; +use OCP\AppFramework\Http\ContentSecurityPolicy; class ZaakTypenController extends Controller { @@ -39,6 +41,42 @@ public function index(): JSONResponse return new JSONResponse($data); } + /** + * Render no page. + * + * @param string|null $getParameter Optional GET parameter + * @return TemplateResponse The rendered template response + * + * @NoAdminRequired + * @NoCSRFRequired + */ + public function page(?string $getParameter): TemplateResponse + { + try { + // Create a new TemplateResponse for the index page + $response = new TemplateResponse( + $this->appName, + 'index', + [] + ); + + // Set up Content Security Policy + $csp = new ContentSecurityPolicy(); + $csp->addAllowedConnectDomain('*'); + $response->setContentSecurityPolicy($csp); + + return $response; + } catch (\Exception $e) { + // Return an error template response if an exception occurs + return new TemplateResponse( + $this->appName, + 'error', + ['error' => $e->getMessage()], + '500' + ); + } + } + /** * Read a single object * diff --git a/lib/Controller/ZakenController.php b/lib/Controller/ZakenController.php index 6e8529e..fa54500 100644 --- a/lib/Controller/ZakenController.php +++ b/lib/Controller/ZakenController.php @@ -6,6 +6,8 @@ use OCP\AppFramework\Controller; use OCP\AppFramework\Http\JSONResponse; use OCP\IRequest; +use OCP\AppFramework\Http\TemplateResponse; +use OCP\AppFramework\Http\ContentSecurityPolicy; /** * Geeft invulling aan https://vng-realisatie.github.io/gemma-zaken/standaard/zaken/ @@ -41,6 +43,42 @@ public function index(): JSONResponse return new JSONResponse($data); } + /** + * Render no page. + * + * @param string|null $getParameter Optional GET parameter + * @return TemplateResponse The rendered template response + * + * @NoAdminRequired + * @NoCSRFRequired + */ + public function page(?string $getParameter): TemplateResponse + { + try { + // Create a new TemplateResponse for the index page + $response = new TemplateResponse( + $this->appName, + 'index', + [] + ); + + // Set up Content Security Policy + $csp = new ContentSecurityPolicy(); + $csp->addAllowedConnectDomain('*'); + $response->setContentSecurityPolicy($csp); + + return $response; + } catch (\Exception $e) { + // Return an error template response if an exception occurs + return new TemplateResponse( + $this->appName, + 'error', + ['error' => $e->getMessage()], + '500' + ); + } + } + /** * Read a single object * diff --git a/package-lock.json b/package-lock.json index 7ac9a80..5e35d3d 100644 --- a/package-lock.json +++ b/package-lock.json @@ -15,7 +15,7 @@ "@nextcloud/dialogs": "^3.2.0", "@nextcloud/initial-state": "^2.2.0", "@nextcloud/l10n": "^2.0.1", - "@nextcloud/router": "^2.0.1", + "@nextcloud/router": "^2.1.2", "@nextcloud/vue": "^8.12.0", "bootstrap-vue": "^2.23.1", "lodash": "^4.17.21", @@ -23,6 +23,7 @@ "vue": "^2.7.14", "vue-loading-overlay": "^3.4.3", "vue-material-design-icons": "^5.3.0", + "vue-router": "^3.6.5", "zod": "^3.23.8" }, "devDependencies": { @@ -3554,17 +3555,16 @@ } }, "node_modules/@nextcloud/router": { - "version": "2.2.1", - "resolved": "https://registry.npmjs.org/@nextcloud/router/-/router-2.2.1.tgz", - "integrity": "sha512-ZRc/WI0RaksEJMz08H/6LimIdP+1A1xTHThCYEghs7VgAKNp5917vT2OKSpG0cMRbIwk0ongFVt5FB5qjy/iFg==", - "license": "GPL-3.0-or-later", + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/@nextcloud/router/-/router-2.1.2.tgz", + "integrity": "sha512-Jj5fgjeHT1vVIgOyUGOeHfwk2KgaO77QGfqZAT6GWXvpAsN0mkqwljkg4FkHrQRouYqCE4VnJ5o8/w0DAN89tA==", "dependencies": { - "@nextcloud/typings": "^1.7.0", + "@nextcloud/typings": "^1.0.0", "core-js": "^3.6.4" }, "engines": { - "node": "^20.0.0", - "npm": "^10.0.0" + "node": "^16.0.0", + "npm": "^7.0.0 || ^8.0.0" } }, "node_modules/@nextcloud/sharing": { @@ -21872,8 +21872,7 @@ "node_modules/vue-router": { "version": "3.6.5", "resolved": "https://registry.npmjs.org/vue-router/-/vue-router-3.6.5.tgz", - "integrity": "sha512-VYXZQLtjuvKxxcshuRAwjHnciqZVoXAjTjcqBTz4rKc8qih9g9pI3hbDjmqXaHdgL3v8pV6P8Z335XvHzESxLQ==", - "license": "MIT" + "integrity": "sha512-VYXZQLtjuvKxxcshuRAwjHnciqZVoXAjTjcqBTz4rKc8qih9g9pI3hbDjmqXaHdgL3v8pV6P8Z335XvHzESxLQ==" }, "node_modules/vue-style-loader": { "version": "4.1.3", diff --git a/package.json b/package.json index 2be7d13..239e9f0 100644 --- a/package.json +++ b/package.json @@ -26,7 +26,7 @@ "@nextcloud/dialogs": "^3.2.0", "@nextcloud/initial-state": "^2.2.0", "@nextcloud/l10n": "^2.0.1", - "@nextcloud/router": "^2.0.1", + "@nextcloud/router": "^2.1.2", "@nextcloud/vue": "^8.12.0", "bootstrap-vue": "^2.23.1", "lodash": "^4.17.21", @@ -34,6 +34,7 @@ "vue": "^2.7.14", "vue-loading-overlay": "^3.4.3", "vue-material-design-icons": "^5.3.0", + "vue-router": "^3.6.5", "zod": "^3.23.8" }, "devDependencies": { diff --git a/src/App.vue b/src/App.vue index 2a2f5b2..b2612fe 100644 --- a/src/App.vue +++ b/src/App.vue @@ -1,7 +1,7 @@ - diff --git a/src/sidebars/dashboard/DashboardSideBar.vue b/src/sidebars/dashboard/DashboardSideBar.vue index 43a42d0..9dc8894 100644 --- a/src/sidebars/dashboard/DashboardSideBar.vue +++ b/src/sidebars/dashboard/DashboardSideBar.vue @@ -1,7 +1,3 @@ - - @@ -29,7 +29,7 @@ import { navigationStore, berichtStore } from '../../store/store.js' diff --git a/src/views/berichten/BerichtenList.vue b/src/views/berichten/BerichtenList.vue index 65707e7..416660c 100644 --- a/src/views/berichten/BerichtenList.vue +++ b/src/views/berichten/BerichtenList.vue @@ -30,19 +30,17 @@ import { navigationStore, berichtStore } from '../../store/store.js' -
+
+ @click="openBericht(bericht)"> @@ -44,8 +44,7 @@ export default { }, data() { return { - activeMetaData: false, - medewerkerId: undefined, + id: this.$route.params.id, } }, } diff --git a/src/views/medewerkers/MedewerkerList.vue b/src/views/medewerkers/MedewerkerList.vue index e6d5c9f..2200b6d 100644 --- a/src/views/medewerkers/MedewerkerList.vue +++ b/src/views/medewerkers/MedewerkerList.vue @@ -30,18 +30,16 @@ import { navigationStore, medewerkerStore } from '../../store/store.js'
-
+
+ @click="openMedewerker(medewerker)"> @@ -43,5 +43,10 @@ export default { TaakDetails, CalendarMonthOutline, }, + data() { + return { + id: this.$route.params.id, + } + }, } diff --git a/src/views/taken/TakenList.vue b/src/views/taken/TakenList.vue index 41ee6fc..f880421 100644 --- a/src/views/taken/TakenList.vue +++ b/src/views/taken/TakenList.vue @@ -35,14 +35,12 @@ import { klantStore, navigationStore, taakStore } from '../../store/store.js' :key="`${taak}${i}`" :name="taak?.title" :force-display-actions="true" - :active="taakStore.taakItem?.id === taak?.id" + :active="$route.params?.id === taak?.id" :details="taak.status" :counter-number="taak.deadline ? `${Math.ceil((new Date(taak.deadline) - new Date()) / (1000 * 60 * 60 * 24))} dagen` : 'no deadline'" - @click="taakStore.setTaakItem(taak)"> + @click="openTaak(taak)"> @@ -42,5 +42,10 @@ export default { ZaakTypeList, ZaakTypeDetails, }, + data() { + return { + id: this.$route.params.id, + } + }, } diff --git a/src/views/zaken/ZaakDetails.vue b/src/views/zaken/ZaakDetails.vue index 48703ca..4938120 100644 --- a/src/views/zaken/ZaakDetails.vue +++ b/src/views/zaken/ZaakDetails.vue @@ -5,8 +5,9 @@ import { navigationStore, zaakStore } from '../../store/store.js'