fix(portal) : handle ticket creation error and hide new ticket button for admins
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -12,6 +12,7 @@
|
|||||||
<h1 class="mt-1 text-xl font-bold text-primary-500 sm:text-2xl">{{ projectName }}</h1>
|
<h1 class="mt-1 text-xl font-bold text-primary-500 sm:text-2xl">{{ projectName }}</h1>
|
||||||
</div>
|
</div>
|
||||||
<NuxtLink
|
<NuxtLink
|
||||||
|
v-if="isClient"
|
||||||
:to="`/portal/projects/${projectId}/new-ticket`"
|
:to="`/portal/projects/${projectId}/new-ticket`"
|
||||||
class="shrink-0 rounded-md bg-primary-500 px-3 py-2 text-xs font-semibold text-white hover:bg-secondary-500 sm:px-4 sm:text-sm"
|
class="shrink-0 rounded-md bg-primary-500 px-3 py-2 text-xs font-semibold text-white hover:bg-secondary-500 sm:px-4 sm:text-sm"
|
||||||
>
|
>
|
||||||
@@ -99,6 +100,7 @@ const projectName = computed(() => {
|
|||||||
return ''
|
return ''
|
||||||
})
|
})
|
||||||
|
|
||||||
|
const isClient = computed(() => auth.user?.roles?.includes('ROLE_CLIENT') ?? false)
|
||||||
const { typeBadgeClass, statusBadgeClass, formatDate } = useClientTicketHelpers()
|
const { typeBadgeClass, statusBadgeClass, formatDate } = useClientTicketHelpers()
|
||||||
|
|
||||||
function openDetail(ticket: ClientTicket) {
|
function openDetail(ticket: ClientTicket) {
|
||||||
|
|||||||
@@ -125,6 +125,8 @@ async function handleSubmit() {
|
|||||||
project: `/api/projects/${projectId.value}`,
|
project: `/api/projects/${projectId.value}`,
|
||||||
})
|
})
|
||||||
await navigateTo(`/portal/projects/${projectId.value}`)
|
await navigateTo(`/portal/projects/${projectId.value}`)
|
||||||
|
} catch {
|
||||||
|
// Toast already shown by useApi
|
||||||
} finally {
|
} finally {
|
||||||
isSubmitting.value = false
|
isSubmitting.value = false
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user