From 2933d957a6f74e9e0ddeac8dac64a40309848b7e Mon Sep 17 00:00:00 2001 From: "bert.hausmans" Date: Wed, 15 Apr 2026 01:27:40 +0200 Subject: [PATCH] feat: add create organisation button and dialog on platform page Add "Nieuwe organisatie" button to the platform organisations list page. Dialog with name field (auto-generates slug) and slug field. Uses the existing POST /organisations endpoint. On success, navigates to the new organisation's detail page. Co-Authored-By: Claude Opus 4.6 (1M context) --- apps/app/src/composables/api/useAdmin.ts | 18 ++++ .../pages/platform/organisations/index.vue | 101 +++++++++++++++++- apps/app/src/types/admin.ts | 6 ++ 3 files changed, 123 insertions(+), 2 deletions(-) diff --git a/apps/app/src/composables/api/useAdmin.ts b/apps/app/src/composables/api/useAdmin.ts index a187dde6..2fa98d23 100644 --- a/apps/app/src/composables/api/useAdmin.ts +++ b/apps/app/src/composables/api/useAdmin.ts @@ -7,6 +7,7 @@ import type { AdminOrganisationDetail, AdminOrganisationMember, AdminUser, + CreateOrganisationPayload, ImpersonationResponse, InviteMemberPayload, PlatformStats, @@ -77,6 +78,23 @@ export function useUpdateAdminOrganisation() { }) } +export function useCreateOrganisation() { + const queryClient = useQueryClient() + + return useMutation({ + mutationFn: async (payload: CreateOrganisationPayload) => { + const { data } = await apiClient.post>( + '/organisations', + payload, + ) + return data.data + }, + onSuccess: () => { + queryClient.invalidateQueries({ queryKey: ['admin', 'organisations'] }) + }, + }) +} + export function useDeleteAdminOrganisation() { const queryClient = useQueryClient() diff --git a/apps/app/src/pages/platform/organisations/index.vue b/apps/app/src/pages/platform/organisations/index.vue index 2f54df23..d5f2436e 100644 --- a/apps/app/src/pages/platform/organisations/index.vue +++ b/apps/app/src/pages/platform/organisations/index.vue @@ -1,6 +1,6 @@ + + + + + + + {{ createError }} + + + + + + + + + + + + + + Annuleren + + + Aanmaken + + + + diff --git a/apps/app/src/types/admin.ts b/apps/app/src/types/admin.ts index daa5b5cc..67a2136f 100644 --- a/apps/app/src/types/admin.ts +++ b/apps/app/src/types/admin.ts @@ -96,6 +96,12 @@ export interface UpdateMemberRolePayload { role: string } +export interface CreateOrganisationPayload { + name: string + slug: string + billing_status?: BillingStatus +} + export interface UpdateAdminOrganisationPayload { name?: string slug?: string