diff --git a/src/components/Header.vue b/src/components/Header.vue index 1c824c6..0512b4b 100644 --- a/src/components/Header.vue +++ b/src/components/Header.vue @@ -7,7 +7,11 @@
diff --git a/src/components/admin/user/user/InviteListItem.vue b/src/components/admin/user/user/InviteListItem.vue new file mode 100644 index 0000000..b7573d7 --- /dev/null +++ b/src/components/admin/user/user/InviteListItem.vue @@ -0,0 +1,48 @@ + + + + + diff --git a/src/components/admin/user/user/InviteUserModal.vue b/src/components/admin/user/user/InviteUserModal.vue new file mode 100644 index 0000000..fa57b2a --- /dev/null +++ b/src/components/admin/user/user/InviteUserModal.vue @@ -0,0 +1,93 @@ + + + + + diff --git a/src/router/index.ts b/src/router/index.ts index 967efe1..9377bdd 100644 --- a/src/router/index.ts +++ b/src/router/index.ts @@ -41,19 +41,33 @@ const router = createRouter({ ], }, { - path: "/reset", - name: "reset", + path: "/setup", + name: "setup", component: () => import("@/views/RouterView.vue"), + beforeEnter: [isSetup], children: [ { path: "", - name: "reset-start", - component: () => import("@/views/reset/Start.vue"), + name: "setup-create", + component: () => import("@/views/setup/Setup.vue"), }, { - path: "reset", - name: "reset-reset", - component: () => import("@/views/reset/Reset.vue"), + path: "verify", + name: "setup-verify", + component: () => import("@/views/setup/Verify.vue"), + props: (route) => ({ mail: route.query.mail, token: route.query.token }), + }, + ], + }, + { + path: "/invite", + name: "invite", + component: () => import("@/views/RouterView.vue"), + children: [ + { + path: "verify", + name: "invite-verify", + component: () => import("@/views/invite/Verify.vue"), props: (route) => ({ mail: route.query.mail, token: route.query.token }), }, ], @@ -403,6 +417,11 @@ const router = createRouter({ name: "admin-user-user", component: () => import("@/views/admin/user/User.vue"), }, + { + path: "invites", + name: "admin-user-user-invites", + component: () => import("@/views/admin/user/Invite.vue"), + }, { path: ":id/edit", name: "admin-user-user-edit", diff --git a/src/stores/admin/invite.ts b/src/stores/admin/invite.ts new file mode 100644 index 0000000..80526b4 --- /dev/null +++ b/src/stores/admin/invite.ts @@ -0,0 +1,34 @@ +import { defineStore } from "pinia"; +import type { InviteViewModel } from "@/viewmodels/admin/invite.models"; +import { http } from "@/serverCom"; +import type { PermissionObject } from "@/types/permissionTypes"; +import type { AxiosResponse } from "axios"; + +export const useInviteStore = defineStore("invite", { + state: () => { + return { + invites: [] as Array, + loading: "loading" as "loading" | "fetched" | "failed", + }; + }, + actions: { + fetchInvites() { + this.loading = "loading"; + http + .get("/admin/invite") + .then((result) => { + this.invites = result.data; + this.loading = "fetched"; + }) + .catch((err) => { + this.loading = "failed"; + }); + }, + deleteInvite(mail: string): Promise> { + return http.delete(`/admin/invite/${mail}`).then((result) => { + this.fetchInvites(); + return result; + }); + }, + }, +}); diff --git a/src/viewmodels/admin/invite.models.ts b/src/viewmodels/admin/invite.models.ts new file mode 100644 index 0000000..c6c860f --- /dev/null +++ b/src/viewmodels/admin/invite.models.ts @@ -0,0 +1,7 @@ +export interface InviteViewModel { + id: number; + username: string; + mail: string; + firstname: string; + lastname: string; +} diff --git a/src/views/admin/user/Invite.vue b/src/views/admin/user/Invite.vue new file mode 100644 index 0000000..a1f6fb3 --- /dev/null +++ b/src/views/admin/user/Invite.vue @@ -0,0 +1,39 @@ + + + + + diff --git a/src/views/admin/user/User.vue b/src/views/admin/user/User.vue index 3b73671..9650cfd 100644 --- a/src/views/admin/user/User.vue +++ b/src/views/admin/user/User.vue @@ -11,8 +11,10 @@
- - + + + offene Einladungen +
@@ -20,10 +22,12 @@ @@ -37,6 +41,10 @@ export default defineComponent({ }, methods: { ...mapActions(useUserStore, ["fetchUsers"]), + ...mapActions(useModalStore, ["openModal"]), + inviteUser() { + this.openModal(markRaw(defineAsyncComponent(() => import("@/components/admin/user/user/InviteUserModal.vue")))); + }, }, }); diff --git a/src/views/invite/Verify.vue b/src/views/invite/Verify.vue new file mode 100644 index 0000000..2a74ef8 --- /dev/null +++ b/src/views/invite/Verify.vue @@ -0,0 +1,118 @@ + + + + +