Zahlungszwecke

This commit is contained in:
2026-09-07 14:17:50 +02:00
parent 350c8dd0d0
commit 40d5634764
27 changed files with 927 additions and 205 deletions
@@ -37,15 +37,6 @@ const props = defineProps({
<td style="font-weight: bold">{{props.invoice.amount}}</td>
</tr>
<tr>
<th>Marterialtransport</th>
<td>{{props.invoice.transportation}}</td>
</tr>
<tr>
<th>Hat Personen mitgenommen</th>
<td>{{props.invoice.passengers}}</td>
</tr>
</table>
</template>
@@ -16,11 +16,18 @@ const props = defineProps({
const emit = defineEmits(['submit', 'cancel'])
/**
* Die Anmerkung heißt in der Resource `comment` und ist dort `'--'`, wenn keine gesetzt ist -- beides
* muss hier stimmen, sonst startet das Feld leer und das Speichern löscht die vorhandene Anmerkung.
*/
const existingComment = props.newInvoice.comment
const formData = reactive({
type_internal: props.newInvoice.internalType || '',
cost_unit: props.newInvoice.costUnitId || '',
amount: props.newInvoice.amountPlain || '',
notices: props.newInvoice.comments || '',
purpose: props.newInvoice.purpose || '',
notices: !existingComment || existingComment === '--' ? '' : existingComment,
})
const submitForm = () => {
@@ -70,6 +77,13 @@ onMounted(async () => {
</td>
</tr>
<tr>
<td>Zahlungsgrund:</td>
<td>
<input type="text" v-model="formData.purpose" class="width-almost-full" />
</td>
</tr>
<tr>
<td>Anmerkungen:</td>
<td>
@@ -100,6 +100,10 @@ const emit = defineEmits(["accept", "deny", "fix", "reopen"])
<td v-else-if="props.data.externalPayment">Rechnungszahlung</td>
<td v-else>Klassische Auszahlung</td>
</tr>
<tr>
<td>Zahlungsgrund:</td>
<td colspan="3">{{props.data.purpose}}</td>
</tr>
<tr>
<td>Status:</td>
<td>{{props.data.readableStatus}}</td>
@@ -32,15 +32,6 @@ const props = defineProps({
<td style="font-weight: bold">{{props.invoice.amount}}</td>
</tr>
<tr>
<th>Marterialtransport</th>
<td>{{props.invoice.transportation}}</td>
</tr>
<tr>
<th>Hat Personen mitgenommen</th>
<td>{{props.invoice.passengers}}</td>
</tr>
</table>
</template>
@@ -24,8 +24,6 @@ const props = defineProps({
userTelephone: String,
userAccountOwner: String,
userAccountIban: String,
havePassengers: Number,
materialTransportation: Boolean,
travelReason: String,
})
@@ -61,8 +59,6 @@ async function sendData() {
formData.append('accountOwner', userAccountOwner.value)
formData.append('accountIban', userIban.value)
formData.append('paymentPurpose', paymentPurpose.value)
formData.append('havePassengers', props.havePassengers ? 1 : 0)
formData.append('materialTransportation', props.materialTransportation ? 1 : 0)
formData.append('travelReason', props.travelReason)
if (props.receipt) {
@@ -24,9 +24,9 @@ const props = defineProps({
userTelephone: String,
userAccountOwner: String,
userAccountIban: String,
havePassengers: Number,
materialTransportation: Boolean,
travelReason: String,
travelReasonNote: String,
travellers: String,
})
const finalStep = ref(true)
@@ -60,9 +60,9 @@ async function sendData() {
formData.append('decision', decision.value)
formData.append('accountOwner', userAccountOwner.value)
formData.append('accountIban', userIban.value)
formData.append('havePassengers', props.havePassengers ? 1 : 0)
formData.append('materialTransportation', props.materialTransportation ? 1 : 0)
formData.append('travelReason', props.travelReason)
formData.append('travelReasonNote', props.travelReasonNote ?? '')
formData.append('travellers', props.travellers ?? '')
formData.append('notices', notices.value)
if (props.receipt) {
@@ -1,5 +1,5 @@
<script setup>
import { ref, onMounted, reactive } from 'vue'
import { ref, computed, onMounted, reactive } from 'vue'
import {checkFilesize} from "../../../../../../resources/js/components/InvoiceUploadChecks.js";
import RefundData from "./refund-data.vue";
import NumericInput from "../../../../../Views/Components/NumericInput.vue";
@@ -19,15 +19,44 @@ const { request } = useAjax();
const distanceAllowance = ref(null);
const travelDirection = ref(null);
const travelReason = ref(null);
const travelReasonNote = ref('');
const travelReasonCollection = reactive({
travelReasons: []
});
const selectedTravelReason = computed(() =>
travelReasonCollection.travelReasons.find((reason) => reason.value === travelReason.value)
);
/**
* Ein Grund ist erst vollständig, wenn die Erläuterung steht, die er verlangt: "Anderer Grund" allein
* sagt nichts aus. Die drei anderen Gründe bremsen den Ablauf dadurch nicht.
*/
const travelReasonComplete = computed(() =>
selectedTravelReason.value !== undefined
&& (!selectedTravelReason.value.requiresNote || travelReasonNote.value.trim() !== '')
);
/**
* Wer gereist ist, steht später als Zahlungsgrund in der Belegliste, auf der EüR und auf dem Beleg. Wer
* den Beleg einreicht, war meist selbst dabei -- deshalb der eigene Name als Vorschlag. Ohne Login
* bleibt das Feld leer, und es hält den Ablauf auch dann nicht auf: Ein Name ist eine Hilfe, keine
* Bedingung.
*/
const travellers = ref(data.userName || '');
const have_receipt = ref('')
const havePassengers = ref(false);
const materialTransportation = ref(false);
const amount = ref(0.00);
const invoiceType = ref(null);
const otherText = ref('');
const receipt = ref(null)
const finalStep = ref(false)
onMounted(async () => {
const response = await fetch('/api/v1/core/retrieve-travel-reasons');
travelReasonCollection.travelReasons = await response.json();
});
async function getDistanceAllowance() {
const tempData = await request('/api/v1/cost-unit/get-distance-allowance/' + data.eventId, {
method: "GET",
@@ -59,14 +88,40 @@ function handleFileChange(event) {
<fieldset v-if="travelDirection !== null">
<legend><span style="font-weight: bolder;">Was war der Grund für deine Reise?</span></legend>
<p v-for="availableReason in travelReasonCollection.travelReasons">
<input
name="travel-reason"
type="radio"
:value="availableReason.value"
:id="'travel_reason_' + availableReason.value"
v-model="travelReason"
>
<label :for="'travel_reason_' + availableReason.value">{{ availableReason.label }}</label><br />
</p>
<template v-if="selectedTravelReason?.requiresNote">
<input
type="text"
class="width-full"
name="travel-reason-note"
placeholder="z. B. Abholung der Ausrüstung aus dem Lager"
v-model="travelReasonNote"
/>
</template>
</fieldset><br /><br />
<fieldset v-if="travelReasonComplete">
<legend><span style="font-weight: bolder;">Welche Personen sind gereist?</span></legend>
<input
type="text"
name="travel-reason"
v-model="travelReason"
name="travellers"
placeholder="z. B. Mika, Kim und Alex"
v-model="travellers"
/>
</fieldset><br /><br />
<fieldset v-if="travelReason !== null">
<fieldset v-if="travelReasonComplete">
<legend><span style="font-weight: bolder;">Bist du mit dem ÖPNV gefahren oder besitzt du einen Beleg</span></legend>
<input type="button" style="border-radius: 0; width: 100px;" @click="have_receipt='yes'" value="Ja" />
<input type="button" style="border-radius: 0; width: 100px;" @click="getDistanceAllowance" value="Nein" />
@@ -93,8 +148,6 @@ function handleFileChange(event) {
invoice-type="travelling"
:amount="amount"
:other-text="travelDirection"
:materialTransportation="materialTransportation"
:havePassengers="havePassengers"
:userName="data.userName"
:userEmail="data.userEmail"
:userTelephone="data.userTelephone"
@@ -102,6 +155,8 @@ function handleFileChange(event) {
:userAccountOwner="data.userAccountOwner"
:receipt="receipt"
:travelReason="travelReason"
:travelReasonNote="travelReasonNote"
:travellers="travellers"
@close="finalStep = false"
/>
</fieldset>
@@ -117,22 +172,6 @@ function handleFileChange(event) {
<span style="font-weight: normal">({{ amount }} km x {{distanceAllowance.toFixed(2).replace('.', ',')}} Euro / km = <strong>{{ (amount * distanceAllowance).toFixed(2).replace('.', ',') }} Euro</strong>)</span>
<br /><br />
<input
type="checkbox"
name="havePassengers"
v-model="havePassengers"
id="havePassengers"
/> <label style="margin-bottom: 20px;" for="havePassengers">Ich habe Personen mitgenommen</label>
<br />
<input
type="checkbox"
name="materialTransportation"
v-model="materialTransportation"
id="materialTransportation"
/> <label style="margin-bottom: 20px;" for="materialTransportation">Ich habe Material transportiert</label>
<br /><br />
<input
v-if="amount !== null && have_receipt === 'no' && amount != '0'"
@click="finalStep = true;"
@@ -145,14 +184,14 @@ function handleFileChange(event) {
invoice-type="travelling"
:amount="amount"
:other-text="travelDirection"
:materialTransportation="materialTransportation"
:havePassengers="havePassengers"
:userName="data.userName"
:userEmail="data.userEmail"
:userTelephone="data.userTelephone"
:userAccountIban="data.userAccountIban"
:userAccountOwner="data.userAccountOwner"
:travelReason="travelReason"
:travelReasonNote="travelReasonNote"
:travellers="travellers"
@close="finalStep = false"
/>