diff --git a/frontend/pages/incomingInvoices/[mode]/[id].vue b/frontend/pages/incomingInvoices/[mode]/[id].vue index ae05fb0..7e336b3 100644 --- a/frontend/pages/incomingInvoices/[mode]/[id].vue +++ b/frontend/pages/incomingInvoices/[mode]/[id].vue @@ -150,6 +150,17 @@ const bankBookingDateLabel = computed(() => { return bankBookingDates.value.map(formatDate).join(", ") }) +const hasActiveBankAssignment = computed(() => (itemInfo.value.statementallocations || []).some((allocation) => { + if (allocation?.archived) return false + + return Boolean(allocation?.bankstatement || allocation?.bs_id) +})) +const canArchiveIncomingInvoice = computed(() => { + if (itemInfo.value.archived) return false + if (mode.value !== "show") return true + + return itemInfo.value.state === "Gebucht" && !hasActiveBankAssignment.value +}) const vendorName = computed(() => vendors.value.find((vendor) => vendor.id === itemInfo.value.vendor)?.name || "-") const eInvoiceValidation = computed(() => itemInfo.value.eInvoiceValidation || null) const eInvoiceSourceLabel = computed(() => { @@ -322,7 +333,7 @@ const hasBlockingIncomingInvoiceErrors = computed(() => blockingIncomingInvoiceE