2022-05-17 01:37:07 +02:00
|
|
|
<template>
|
2023-04-29 23:41:26 +02:00
|
|
|
<page-layout>
|
|
|
|
<form target="_BLANK" class="max-w-4xl w-full mx-auto gap-6 grid-cols-2 grid p-6">
|
2023-10-30 23:46:41 +01:00
|
|
|
<f-text id="eventName" v-model="values.eventName" name="eventName" class="col-span-2"
|
|
|
|
label="Veranstaltungs-Name" required></f-text>
|
2023-10-27 00:48:50 +02:00
|
|
|
<f-text id="dateFrom" v-model="values.dateFrom" name="dateFrom" type="date" label="Datum von" required></f-text>
|
2023-10-30 23:46:41 +01:00
|
|
|
<f-text id="dateUntil" v-model="values.dateUntil" name="dateUntil" type="date" label="Datum bis"
|
|
|
|
required></f-text>
|
2022-05-20 01:18:11 +02:00
|
|
|
|
2023-10-27 00:48:50 +02:00
|
|
|
<f-text id="zipLocation" v-model="values.zipLocation" name="zipLocation" label="PLZ / Ort" required></f-text>
|
2023-10-30 23:46:41 +01:00
|
|
|
<f-select id="country" v-model="values.country" :options="countries" name="country" label="Land"
|
|
|
|
required></f-select>
|
2022-08-23 23:49:19 +02:00
|
|
|
|
2023-04-29 23:41:26 +02:00
|
|
|
<div class="border-gray-200 shadow shadow-primary-700 p-3 shadow-[0_0_4px_gray] col-span-2">
|
2023-10-30 23:46:41 +01:00
|
|
|
<f-text id="search_text" ref="search_text_field" v-model="searchText" class="col-span-2" name="search_text"
|
|
|
|
label="Suchen …" size="sm" @keypress.enter.prevent="onSubmitFirstMemberResult"></f-text>
|
2023-04-29 23:41:26 +02:00
|
|
|
<div class="mt-2 grid grid-cols-[repeat(auto-fill,minmax(180px,1fr))] gap-2 col-span-2">
|
2023-10-30 23:46:41 +01:00
|
|
|
<f-switch v-for="member in search.results" :id="`members-${member.id}`" :key="member.id"
|
|
|
|
v-model="values.members" :label="`${member.firstname} ${member.lastname}`" name="members[]"
|
|
|
|
:value="member.id" size="sm" inline
|
|
|
|
@keypress.enter.prevent="onSubmitMemberResult(member)"></f-switch>
|
2023-04-29 23:41:26 +02:00
|
|
|
</div>
|
2022-08-11 23:19:52 +02:00
|
|
|
</div>
|
2022-05-20 01:18:11 +02:00
|
|
|
|
2023-10-30 23:46:41 +01:00
|
|
|
<button v-for="(compiler, index) in compilers" class="btn btn-primary mt-3 inline-block" @click.prevent="
|
|
|
|
values.type = compiler.class;
|
|
|
|
submit();
|
2023-10-31 11:01:22 +01:00
|
|
|
" v-text="compiler.title"></button>
|
2023-04-29 23:41:26 +02:00
|
|
|
</form>
|
|
|
|
</page-layout>
|
2022-05-17 01:37:07 +02:00
|
|
|
</template>
|
|
|
|
|
|
|
|
<script>
|
2023-02-26 20:51:59 +01:00
|
|
|
import debounce from 'lodash/debounce';
|
|
|
|
|
2022-05-17 01:37:07 +02:00
|
|
|
export default {
|
2023-10-27 00:48:50 +02:00
|
|
|
props: {
|
|
|
|
data: {},
|
|
|
|
countries: {},
|
|
|
|
compilers: {},
|
|
|
|
},
|
2022-05-17 01:37:07 +02:00
|
|
|
data: function () {
|
|
|
|
return {
|
2023-02-26 20:51:59 +01:00
|
|
|
search: {
|
|
|
|
s: '',
|
|
|
|
results: [],
|
|
|
|
},
|
2022-05-17 01:37:07 +02:00
|
|
|
values: {
|
2023-03-09 02:14:24 +01:00
|
|
|
type: null,
|
2022-05-20 01:18:11 +02:00
|
|
|
members: [],
|
2022-05-17 01:37:07 +02:00
|
|
|
event_name: '',
|
|
|
|
dateFrom: '',
|
|
|
|
dateUntil: '',
|
2022-08-23 23:49:19 +02:00
|
|
|
zipLocation: '',
|
|
|
|
country: null,
|
2023-02-26 20:51:59 +01:00
|
|
|
...this.data,
|
2022-05-17 01:37:07 +02:00
|
|
|
},
|
|
|
|
};
|
|
|
|
},
|
2022-08-11 23:19:52 +02:00
|
|
|
computed: {
|
2023-02-26 20:51:59 +01:00
|
|
|
searchText: {
|
|
|
|
get() {
|
|
|
|
return this.search.s;
|
|
|
|
},
|
2023-10-30 23:46:41 +01:00
|
|
|
set: function (event) {
|
2023-02-26 20:51:59 +01:00
|
|
|
this.search.s = event;
|
|
|
|
|
2023-10-30 23:46:41 +01:00
|
|
|
debounce(async () => {
|
2023-10-31 11:01:22 +01:00
|
|
|
var response = await this.axios.post(
|
|
|
|
'/api/member/search',
|
|
|
|
{
|
|
|
|
filter: {
|
|
|
|
search: event,
|
|
|
|
hasBirthday: true,
|
|
|
|
hasFullAddress: true,
|
|
|
|
},
|
2023-10-30 23:46:41 +01:00
|
|
|
},
|
2023-10-31 11:01:22 +01:00
|
|
|
{ headers: { 'X-Meta': 'false' } }
|
|
|
|
);
|
2022-08-11 23:19:52 +02:00
|
|
|
|
2023-10-30 23:46:41 +01:00
|
|
|
this.search.results = response.data.data;
|
|
|
|
}, 300)();
|
|
|
|
},
|
2022-08-11 23:19:52 +02:00
|
|
|
},
|
|
|
|
},
|
|
|
|
methods: {
|
2023-03-14 22:29:39 +01:00
|
|
|
async submit() {
|
|
|
|
try {
|
|
|
|
await this.axios.post('/contribution-validate', this.values);
|
2023-10-27 00:48:50 +02:00
|
|
|
var payload = btoa(encodeURIComponent(JSON.stringify(this.values)));
|
2023-03-14 22:29:39 +01:00
|
|
|
window.open(`/contribution-generate?payload=${payload}`);
|
|
|
|
} catch (e) {
|
|
|
|
this.errorsFromException(e);
|
|
|
|
}
|
2023-03-09 02:14:24 +01:00
|
|
|
},
|
2022-08-11 23:19:52 +02:00
|
|
|
onSubmitMemberResult(selected) {
|
|
|
|
if (this.values.members.find((m) => m === selected.id) !== undefined) {
|
|
|
|
this.values.members = this.values.members.filter((m) => m === selected.id);
|
|
|
|
} else {
|
|
|
|
this.values.members.push(selected.id);
|
|
|
|
}
|
|
|
|
|
2023-02-26 20:51:59 +01:00
|
|
|
this.searchText = '';
|
|
|
|
this.$refs.search_text_field.$el.querySelector('input').focus();
|
2022-08-11 23:19:52 +02:00
|
|
|
},
|
|
|
|
onSubmitFirstMemberResult() {
|
2023-02-26 20:51:59 +01:00
|
|
|
if (this.search.results.length === 0) {
|
|
|
|
this.searchText = '';
|
2022-08-11 23:19:52 +02:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2023-02-26 20:51:59 +01:00
|
|
|
this.onSubmitMemberResult(this.search.results[0]);
|
2022-08-11 23:19:52 +02:00
|
|
|
},
|
|
|
|
},
|
2022-05-17 01:37:07 +02:00
|
|
|
};
|
|
|
|
</script>
|