Kundenportal arbeiten
This commit is contained in:
@@ -14,10 +14,13 @@ const route = useRoute()
|
||||
const router = useRouter()
|
||||
const auth = useAuthStore()
|
||||
const dataStore = useDataStore()
|
||||
const toast = useToast()
|
||||
|
||||
const itemInfo = ref({})
|
||||
const linkedDocument =ref({})
|
||||
const links = ref([])
|
||||
const portalReleaseLoading = ref(false)
|
||||
const portalEligibleTypes = ["invoices", "advanceInvoices", "cancellationInvoices"]
|
||||
|
||||
const setupPage = async () => {
|
||||
if(route.params) {
|
||||
@@ -51,6 +54,30 @@ const openBankstatements = () => {
|
||||
navigateTo(`/banking/statements/edit/${itemInfo.value.statementallocations[0].bankstatement}`)
|
||||
}
|
||||
}
|
||||
|
||||
const togglePortalRelease = async () => {
|
||||
if (!itemInfo.value?.id) return
|
||||
|
||||
portalReleaseLoading.value = true
|
||||
|
||||
try {
|
||||
const nextValue = !itemInfo.value.availableInPortal
|
||||
await useEntities("createddocuments").update(itemInfo.value.id, {
|
||||
availableInPortal: nextValue
|
||||
}, true)
|
||||
|
||||
itemInfo.value = {
|
||||
...itemInfo.value,
|
||||
availableInPortal: nextValue
|
||||
}
|
||||
|
||||
toast.add({
|
||||
title: nextValue ? "Für Kundenportal freigegeben" : "Portal-Freigabe entfernt"
|
||||
})
|
||||
} finally {
|
||||
portalReleaseLoading.value = false
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
@@ -87,6 +114,15 @@ const openBankstatements = () => {
|
||||
>
|
||||
E-Mail
|
||||
</UButton>
|
||||
<UButton
|
||||
v-if="portalEligibleTypes.includes(itemInfo.type) && itemInfo.state !== 'Entwurf'"
|
||||
:icon="itemInfo.availableInPortal ? 'i-heroicons-eye-slash' : 'i-heroicons-eye'"
|
||||
variant="outline"
|
||||
:loading="portalReleaseLoading"
|
||||
@click="togglePortalRelease"
|
||||
>
|
||||
{{ itemInfo.availableInPortal ? "Portal-Freigabe entfernen" : "Für Kundenportal freigeben" }}
|
||||
</UButton>
|
||||
<UTooltip
|
||||
v-if="itemInfo.type === 'invoices' || itemInfo.type === 'advanceInvoices'"
|
||||
:text="links.find(i => i.type === 'cancellationInvoices') ? 'Bereits stoniert' : ''"
|
||||
@@ -170,6 +206,14 @@ const openBankstatements = () => {
|
||||
</template>
|
||||
</UDashboardToolbar>
|
||||
<UDashboardPanelContent>
|
||||
<div
|
||||
v-if="portalEligibleTypes.includes(itemInfo.type) && itemInfo.state !== 'Entwurf'"
|
||||
class="px-4 py-3"
|
||||
>
|
||||
<UBadge :color="itemInfo.availableInPortal ? 'primary' : 'neutral'" variant="soft">
|
||||
{{ itemInfo.availableInPortal ? "Im Kundenportal sichtbar" : "Nicht im Kundenportal freigegeben" }}
|
||||
</UBadge>
|
||||
</div>
|
||||
<!-- <object
|
||||
:data="linkedDocument.url"
|
||||
class="w-full previewDocumentMobile"
|
||||
@@ -187,4 +231,4 @@ const openBankstatements = () => {
|
||||
aspect-ratio: 1 / 1.414;
|
||||
|
||||
}
|
||||
</style>
|
||||
</style>
|
||||
|
||||
Reference in New Issue
Block a user