Basic implementation of payment methods
This commit is contained in:
@@ -15,11 +15,13 @@
|
||||
|
||||
const dynmicProps = reactive({
|
||||
localGroups: [],
|
||||
eatingHabits:[]
|
||||
eatingHabits:[],
|
||||
paymentMethods: []
|
||||
});
|
||||
|
||||
const contributingLocalGroups = ref([])
|
||||
const eatingHabits = ref([]);
|
||||
const paymentMethods = ref([]);
|
||||
|
||||
const errors = reactive({})
|
||||
|
||||
@@ -46,9 +48,18 @@
|
||||
|
||||
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.id) ?? []
|
||||
});
|
||||
|
||||
async function save() {
|
||||
if (paymentMethods.value.length === 0) {
|
||||
toast.error('Mindestens eine Zahlungsmöglichkeit muss ausgewählt sein.')
|
||||
return
|
||||
} else if(paymentMethods.value.length > 1) {
|
||||
toast.error('Aktuell wird nur exakt eine Zahlungseinstellung unterstützt.')
|
||||
return
|
||||
}
|
||||
|
||||
const response = await request('/api/v1/event/details/' + props.event.id + '/common-settings', {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
@@ -68,6 +79,7 @@
|
||||
supportPerson: formData.supportPerson,
|
||||
contributingLocalGroups: contributingLocalGroups.value,
|
||||
eatingHabits: eatingHabits.value,
|
||||
paymentMethods: paymentMethods.value,
|
||||
}
|
||||
})
|
||||
|
||||
@@ -75,7 +87,7 @@
|
||||
toast.success('Einstellungen wurden erfolgreich gespeichert.')
|
||||
emit('close')
|
||||
} else {
|
||||
toast.error('Beim Speichern ist ein Fehler aufgetreten.')
|
||||
toast.error(response.message ?? 'Beim Speichern ist ein Fehler aufgetreten.')
|
||||
}
|
||||
}
|
||||
|
||||
@@ -199,6 +211,17 @@
|
||||
<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.id" v-model="paymentMethods" />
|
||||
<label style="padding-left: 5px;" :for="'paymentmethod' + paymentMethod.id">{{paymentMethod.name}}</label>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user