Teilnahmerechnungen erstellen

This commit is contained in:
2026-09-03 00:08:46 +02:00
parent a61344395a
commit 9c4c28e566
79 changed files with 4303 additions and 75 deletions
@@ -1,7 +1,11 @@
<script setup>
import {computed, onMounted, reactive, watch} from "vue";
import {computed, onMounted, reactive, ref, watch} from "vue";
import {toast} from "vue3-toastify";
import AmountInput from "../../../../Views/Components/AmountInput.vue";
import DialableTelephoneNumber from "../../../../Views/Components/DialableTelephoneNumber.vue";
import {useAjax} from "../../../../../resources/js/components/ajaxHandler.js";
const {download} = useAjax();
const staticProps = defineProps({
editMode: Boolean,
@@ -146,6 +150,31 @@ function enableEditMode() {
emit('editParticipant');
}
/**
* Rechnung über den Teilnahmebeitrag herunterladen. Sie wird bei jedem Klick neu erzeugt und trägt immer
* dieselbe, aus Veranstaltung und Position des Teilis abgeleitete Nummer.
*
* Bei einem Beitrag von 0 € gibt es nichts zu berechnen -- dann entfällt der Knopf.
*/
const creatingInvoice = ref(false)
const hasAmount = computed(() => Number(props.participant?.amountExpectedValue ?? 0) > 0)
async function downloadInvoice() {
creatingInvoice.value = true
try {
// Der Dateiname (mit der Rechnungsnummer) kommt aus dem Content-Disposition-Header.
const ok = await download('/api/v1/participant-invoice/' + staticProps.participant.identifier)
if (!ok) {
toast.error('Die Rechnung konnte nicht erstellt werden.')
}
} finally {
creatingInvoice.value = false
}
}
function saveParticipant() {
emit('saveParticipant', { ...form });
close();
@@ -457,6 +486,12 @@ function saveParticipant() {
<button v-if="!props.participant.unregistered" class="button" @click="paymentComplete(props.participant)">Zahlung vollständig</button>
<button v-if="!props.participant.unregistered" class="button" @click="markCocExisting(props.participant)">eFZ liegt vor</button>
<button
v-if="!props.participant.unregistered && hasAmount"
class="button"
:disabled="creatingInvoice"
@click="downloadInvoice"
>{{ creatingInvoice ? 'Wird erstellt…' : 'Rechnung erstellen' }}</button>
<button v-if="!props.participant.unregistered" class="button" @click="cancelParticipation(props.participant)">Abmelden</button>
<button class="button" @click="close">Schließen</button>