Kundenportal arbeiten

This commit is contained in:
2026-04-08 18:52:04 +02:00
parent d9e5df07bf
commit f125617af0
9 changed files with 1017 additions and 23 deletions

View File

@@ -50,10 +50,12 @@ const route = useRoute()
const dataStore = useDataStore()
const modal = useModal()
const auth = useAuthStore()
const toast = useToast()
const dataType = dataStore.dataTypes[type]
const openTab = ref(String(route.query.tabIndex || 0))
const portalInviteLoading = ref(false)
@@ -152,6 +154,31 @@ const openCustomerInventoryLabelPrint = () => {
})
}
const invitePortalUser = async () => {
if (type !== "customers" || !props.item?.id) return
portalInviteLoading.value = true
try {
const response = await useAdmin().invitePortalUser(Number(props.item.id))
toast.add({
title: "Portal-Einladung versendet",
description: `E-Mail: ${response.email}${response.initialPassword ? ` | Initialpasswort: ${response.initialPassword}` : ""}`,
timeout: 9000
})
emit("updateNeeded")
} catch (err) {
toast.add({
title: "Portal-Einladung fehlgeschlagen",
description: err?.data?.error || "Die Einladung konnte nicht erstellt werden.",
color: "error",
timeout: 7000
})
} finally {
portalInviteLoading.value = false
}
}
</script>
<template>
@@ -217,6 +244,15 @@ const openCustomerInventoryLabelPrint = () => {
>
Label
</UButton>
<UButton
v-if="type === 'customers' && auth.user?.is_admin"
icon="i-heroicons-envelope"
variant="outline"
:loading="portalInviteLoading"
@click="invitePortalUser"
>
Portal einladen
</UButton>
<UButton
@click="router.push(`/standardEntity/${type}/edit/${item.id}`)"
>
@@ -246,6 +282,15 @@ const openCustomerInventoryLabelPrint = () => {
>
Label
</UButton>
<UButton
v-if="type === 'customers' && auth.user?.is_admin"
icon="i-heroicons-envelope"
variant="outline"
:loading="portalInviteLoading"
@click="invitePortalUser"
>
Portal einladen
</UButton>
<UButton
@click="router.push(`/standardEntity/${type}/edit/${item.id}`)"
>