Icons for payment methods

This commit is contained in:
2026-08-05 17:41:35 +02:00
parent daff70b4fe
commit f8dba18854
16 changed files with 473 additions and 190 deletions
@@ -2,7 +2,6 @@
import {onMounted, reactive, ref} from "vue";
import ErrorText from "../../../../Views/Components/ErrorText.vue";
import AmountInput from "../../../../Views/Components/AmountInput.vue";
import TextEditor from "../../../../Views/Components/TextEditor.vue";
import {request} from "../../../../../resources/js/components/HttpClient.js";
import {toast} from "vue3-toastify";
@@ -17,14 +16,10 @@ const emit = defineEmits(['close'])
const dynmicProps = reactive({
localGroups: [],
eatingHabits:[],
paymentMethods: []
});
const contributingLocalGroups = ref([])
const eatingHabits = ref([]);
const paymentMethods = ref([]);
// pro-Event-Config je Zahlungsmethode: { slug: { option: value } }
const paymentMethodConfigurations = reactive({});
const errors = reactive({})
@@ -51,30 +46,9 @@ const emit = defineEmits(['close'])
contributingLocalGroups.value = props.event.contributingLocalGroups?.map(t => t.id) ?? []
eatingHabits.value = props.event.eatingHabits?.map(t => t.id) ?? []
paymentMethods.value = props.event.paymentMethods?.map(t => t.slug) ?? []
// Pro-Event-Config vorbelegen: bereits gespeicherte Pivot-Config des Events hat Vorrang,
// sonst der Tenant-Standard (Snapshot-Quelle für neu zugewiesene Methoden).
const eventConfigBySlug = {}
for (const pm of props.event.paymentMethods ?? []) {
eventConfigBySlug[pm.slug] = pm.configuration ?? {}
}
for (const method of dynmicProps.paymentMethods ?? []) {
const source = eventConfigBySlug[method.slug] ?? method.configuration ?? {}
const config = {}
for (const option of method.optionsSchema ?? []) {
config[option.name] = source[option.name] ?? ''
}
paymentMethodConfigurations[method.slug] = config
}
});
async function save() {
if (paymentMethods.value.length === 0) {
toast.error('Mindestens eine Zahlungsmöglichkeit muss ausgewählt sein.')
return
}
const response = await request('/api/v1/event/details/' + props.event.id + '/common-settings', {
method: 'POST',
headers: {
@@ -94,8 +68,6 @@ const emit = defineEmits(['close'])
supportPerson: formData.supportPerson,
contributingLocalGroups: contributingLocalGroups.value,
eatingHabits: eatingHabits.value,
paymentMethods: paymentMethods.value,
paymentMethodConfigurations: paymentMethodConfigurations,
}
})
@@ -227,31 +199,6 @@ const emit = defineEmits(['close'])
<label style="padding-left: 5px;" :for="'eatinghabit' + eatingHabit.id">{{eatingHabit.name}}</label>
</td>
</tr>
<tr>
<th style="padding-top: 40px !important;">Zahlungsmöglichkeiten</th>
</tr>
<tr v-for="paymentMethod in dynmicProps.paymentMethods">
<td>
<input type="checkbox" :id="'paymentmethod' + paymentMethod.id" :value="paymentMethod.slug" v-model="paymentMethods" />
<label style="padding-left: 5px;" :for="'paymentmethod' + paymentMethod.id">{{paymentMethod.name}}</label>
<div
v-if="paymentMethods.includes(paymentMethod.slug) && (paymentMethod.optionsSchema?.length ?? 0) > 0"
class="payment-method-config"
>
<div v-for="option in paymentMethod.optionsSchema" :key="option.name" class="payment-method-config-row">
<label>{{ option.label }}<span v-if="option.required" class="required-marker">*</span></label>
<TextEditor v-if="option.type === 'richtext'"
v-model="paymentMethodConfigurations[paymentMethod.slug][option.name]"/>
<input v-else type="text"
v-model="paymentMethodConfigurations[paymentMethod.slug][option.name]"
class="width-full"/>
</div>
</div>
</td>
</tr>
</table>
@@ -308,26 +255,4 @@ const emit = defineEmits(['close'])
width: 250px;
}
.payment-method-config {
margin: 6px 0 12px 24px;
padding-left: 10px;
border-left: 2px solid #d1d5db;
}
.payment-method-config-row {
margin-bottom: 6px;
}
.payment-method-config-row label {
display: block;
font-size: 0.85rem;
color: #374151;
margin-bottom: 2px;
}
.required-marker {
color: #ef4444;
margin-left: 2px;
}
</style>