diff --git a/assets/eventregistration-ausbildung.js b/assets/eventregistration-ausbildung.js new file mode 100644 index 0000000..ac4e508 --- /dev/null +++ b/assets/eventregistration-ausbildung.js @@ -0,0 +1,91 @@ +import scrollToElement from './scrollToElement.js'; + +var toastedOptions = { + position: 'top-right', + duration: 3000, + fitToScreen: true, + fullWidth: true, + theme: 'material', +}; + +export default function (toasted) { + var toasted = new toasted(toastedOptions); + + return { + finished: false, + submitRequest: null, + errorFields: [], + active: 0, + slideTo(e, index) { + if (e !== null) { + e.preventDefault(); + } + if (index < 0 || index > this.slides.length-1) { + return; + } + this.scrollForm(this.$refs.form); + this.active = index; + this.$refs.slider.scrollLeft = this.$refs.slider.scrollWidth / this.slides.length * index; + this.$refs.mobileSlider.scrollLeft = this.$refs.mobileSlider.scrollWidth / this.slides.length * index; + }, + scrollForm(el) { + var margin = window.getComputedStyle(el).marginTop.replace('px', ''); + scrollToElement(el, 300, (margin?margin:0) * -1); + }, + submit() { + var _self = this; + var promise = fetch(window.location.href, { + method: 'POST', + headers: { + 'Content-Type': 'application/json', + 'Accept': 'application/json', + 'X-WINTER-REQUEST-HANDLER': this.submitRequest, + 'X-WINTER-REQUEST-PARTIALS': [], + 'X-Requested-With': 'XMLHttpRequest', + }, + body: JSON.stringify(this.data), + }); + + promise.then(function(response) { + if (response.status === 422) { + response.json().then((errors) => { + _self.scrollToFirstError(errors); + Object.keys(errors).forEach((field) => { + toasted.error(errors[field].join('
')); + }); + }); + } + if (response.status === 201) { + _self.finished = true; + _self.scrollForm(_self.$refs.form); + } + }); + }, + scrollToFirstError(errors) { + if (Object.keys(errors).length === 0) { + return; + } + + var firstField = Object.keys(errors)[0]; + var field = this.$refs.form.querySelector('[name="'+firstField+'"]'); + + if (field === null) { + return; + } + + var slideElement = field.closest('.slider-element'); + this.slideTo(null, Array.from(slideElement.parentNode.children).indexOf(slideElement)); + }, + prevButton: { + [':class']() { + return this.active == 0 ? 'opacity-40' : ''; + } + }, + nextButton: { + [':class']() { + return this.active == this.core.slides.length - 1 ? 'opacity-40' : ''; + } + }, + }; +} + diff --git a/assets/eventregistration.js b/assets/eventregistration.js index 706bdb8..0d0b3d0 100644 --- a/assets/eventregistration.js +++ b/assets/eventregistration.js @@ -19,6 +19,8 @@ export default function (toasted) { address: '', zip: '', location: '', + courses: [], + fcourses: [], food_preferences: [], activity: 'Teilnehmer*in', gender: '', @@ -34,143 +36,152 @@ export default function (toasted) { parent: false, vorteam: null, }, - meta: { - finished: false, - submitRequest: null, - errorFields: [], - active: 0, - slides: [ - 'Persönliches', - 'Veranstaltung', - 'Sonstiges' - ], - activities: [ - {"id": "Orga", "name": "Orga"}, - {"id": "Teilnehmer*in", "name": "Teilnehmer*in"}, - ], - genders: [ - {"id": "Männlich", "name": "Männlich"}, - {"id": "Weiblich", "name": "Weiblich"}, - {"id": "Divers", "name": "Divers"}, - ], - groups: [ - {"id": "Gallier", "name": "Gallier (Wuppertal)"}, - {"id": "Gandalf", "name": "Gandalf (SG-Mangenberg)"}, - {"id": "Gravenrode", "name": "Gravenrode (SG-Gräfrath)"}, - {"id": "Lennep", "name": "Lennep (RS-Lennep)"}, - {"id": "Silva", "name": "Silva (SG-Wald)"}, - {"id": "Sugambrer", "name": "Sugambrer (SG-Höhscheid)"}, - {"id": "Tenkterer", "name": "Tenkterer (SG-Löhdorf)"}, - {"id": "von Berg", "name": "von Berg (SG-Ohligs)"}, - ], - agegroups: [ - {"id": "Biber", "name": "Biber"}, - {"id": "Wölfling", "name": "Wölfling"}, - {"id": "Jungpfadfinder", "name": "Jungpfadfinder"}, - {"id": "Pfadfinder", "name": "Pfadfinder"}, - {"id": "Rover", "name": "Rover"}, - {"id": "Leiter*in", "name": "Leiter*in"}, - ], - agegroups_leaders: [ - {"id": "Biber", "name": "Biber"}, - {"id": "Wölfling", "name": "Wölfling"}, - {"id": "Jungpfadfinder", "name": "Jungpfadfinder"}, - {"id": "Pfadfinder", "name": "Pfadfinder"}, - {"id": "Rover", "name": "Rover"}, - ], - boolean: [ - {"id": "Ja", "name": "Ja"}, - {"id": "Nein", "name": "Nein"}, - ], - foodPreferences: [ - {"id": "Fleisch", "name": "Ich esse Fleisch"}, - {"id": "Vegan", "name": "Ich ernähre mich vegan"}, - {"id": "Glutenfrei", "name": "Ich vertrage kein Gluten"}, - {"id": "Laktosefrei", "name": "Ich vertrage keine Laktose"}, - ] + finished: false, + submitRequest: null, + errorFields: [], + active: 0, + slides: [ + 'Persönliches', + 'Veranstaltung', + 'Sonstiges' + ], + activities: [ + {"id": "Orga", "name": "Orga"}, + {"id": "Teilnehmer*in", "name": "Teilnehmer*in"}, + ], + genders: [ + {"id": "Männlich", "name": "Männlich"}, + {"id": "Weiblich", "name": "Weiblich"}, + {"id": "Divers", "name": "Divers"}, + ], + fcourses: [ + {"id": "Ich bin Samstags beim Abendprogramm dabei", "name": "Ich bin Samstags beim Abendprogramm dabei"}, + {"id": "Ich esse sonntag Mittag mit", "name": "Ich esse sonntag Mittag mit"}, + ], + groups: [ + {"id": "Gallier", "name": "Gallier (Wuppertal)"}, + {"id": "Gandalf", "name": "Gandalf (SG-Mangenberg)"}, + {"id": "Gravenrode", "name": "Gravenrode (SG-Gräfrath)"}, + {"id": "Lennep", "name": "Lennep (RS-Lennep)"}, + {"id": "Silva", "name": "Silva (SG-Wald)"}, + {"id": "Sugambrer", "name": "Sugambrer (SG-Höhscheid)"}, + {"id": "Tenkterer", "name": "Tenkterer (SG-Löhdorf)"}, + {"id": "von Berg", "name": "von Berg (SG-Ohligs)"}, + ], + agegroups: [ + {"id": "Biber", "name": "Biber"}, + {"id": "Wölfling", "name": "Wölfling"}, + {"id": "Jungpfadfinder", "name": "Jungpfadfinder"}, + {"id": "Pfadfinder", "name": "Pfadfinder"}, + {"id": "Rover", "name": "Rover"}, + {"id": "Leiter*in", "name": "Leiter*in"}, + ], + agegroupsroverleiter: [ + {"id": "Rover", "name": "Rover"}, + {"id": "Leiter*in", "name": "Leiter*in"}, + ], + agegroups_leaders: [ + {"id": "Biber", "name": "Biber"}, + {"id": "Wölfling", "name": "Wölfling"}, + {"id": "Jungpfadfinder", "name": "Jungpfadfinder"}, + {"id": "Pfadfinder", "name": "Pfadfinder"}, + {"id": "Rover", "name": "Rover"}, + ], + boolean: [ + {"id": "Ja", "name": "Ja"}, + {"id": "Nein", "name": "Nein"}, + ], + foodPreferences: [ + {"id": "Fleisch", "name": "Ich esse Fleisch"}, + {"id": "Vegan", "name": "Ich ernähre mich vegan"}, + {"id": "Glutenfrei", "name": "Ich vertrage kein Gluten"}, + {"id": "Laktosefrei", "name": "Ich vertrage keine Laktose"}, + ], + foodPreferencesVeg: [ + {"id": "Vegan", "name": "Ich ernähre mich vegan"}, + {"id": "Glutenfrei", "name": "Ich vertrage kein Gluten"}, + {"id": "Laktosefrei", "name": "Ich vertrage keine Laktose"}, + ], + get courses() { + return this.data.agegroup === 'Rover' ? [ + {id: 'Schritt 2', name: 'Schritt 2', hint: 'Sonntag, 10 - 18 Uhr'}, + ] : [ + {id: 'Baustein 2c', name: 'Baustein 2c', hint: 'Pfadfinderische Methodik - Samstag 10 - 18 Uhr'}, + {id: 'Baustein 2e', name: 'Baustein 2e', hint: 'Präventionsschulung - Sonntag 10 - 13 Uhr'}, + {id: 'Baustein 3c', name: 'Baustein 3c', hint: 'Finanzen, Haftung, Versicherung - Sonntag 14 - 17 Uhr'}, + {id: 'Schritt 2', name: 'Schritt 2', hint: 'Sonntag, 10 - 18 Uhr'}, + ]; }, - methods: { - uuu(event) { - console.log(event); - }, - hasAddress() { - return this.data.location && this.data.address && this.data.zip; - }, - slideTo(e, index) { - if (e !== null) { - e.preventDefault(); - } - if (index < 0 || index > this.meta.slides.length-1) { - return; - } - this.scrollForm(this.$refs.form); - this.meta.active = index; - this.$refs.slider.scrollLeft = this.$refs.slider.scrollWidth / this.meta.slides.length * index; - this.$refs.mobileSlider.scrollLeft = this.$refs.mobileSlider.scrollWidth / this.meta.slides.length * index; - }, - scrollForm(el) { - var margin = window.getComputedStyle(el).marginTop.replace('px', ''); - scrollToElement(el, 300, (margin?margin:0) * -1); - }, - submit() { - var _self = this; - var promise = fetch(window.location.href, { - method: 'POST', - headers: { - 'Content-Type': 'application/json', - 'Accept': 'application/json', - 'X-WINTER-REQUEST-HANDLER': this.meta.submitRequest, - 'X-WINTER-REQUEST-PARTIALS': [], - 'X-Requested-With': 'XMLHttpRequest', - }, - body: JSON.stringify(this.data), - }); + slideTo(e, index) { + if (e !== null) { + e.preventDefault(); + } + if (index < 0 || index > this.slides.length-1) { + return; + } + this.scrollForm(this.$refs.form); + this.active = index; + this.$refs.slider.scrollLeft = this.$refs.slider.scrollWidth / this.slides.length * index; + this.$refs.mobileSlider.scrollLeft = this.$refs.mobileSlider.scrollWidth / this.slides.length * index; + }, + scrollForm(el) { + var margin = window.getComputedStyle(el).marginTop.replace('px', ''); + scrollToElement(el, 300, (margin?margin:0) * -1); + }, + submit() { + var _self = this; + var promise = fetch(window.location.href, { + method: 'POST', + headers: { + 'Content-Type': 'application/json', + 'Accept': 'application/json', + 'X-WINTER-REQUEST-HANDLER': this.submitRequest, + 'X-WINTER-REQUEST-PARTIALS': [], + 'X-Requested-With': 'XMLHttpRequest', + }, + body: JSON.stringify(this.data), + }); - promise.then(function(response) { - if (response.status === 422) { - response.json().then((errors) => { - _self.scrollToFirstError(errors); - Object.keys(errors).forEach((field) => { - toasted.error(errors[field].join('
')); - }); + promise.then(function(response) { + if (response.status === 422) { + response.json().then((errors) => { + _self.scrollToFirstError(errors); + Object.keys(errors).forEach((field) => { + toasted.error(errors[field].join('
')); }); - } - if (response.status === 201) { - _self.meta.finished = true; - _self.scrollForm(_self.$refs.form); - } - }); - }, - scrollToFirstError(errors) { - if (Object.keys(errors).length === 0) { - return; + }); } - - var firstField = Object.keys(errors)[0]; - var field = this.$refs.form.querySelector('[name="'+firstField+'"]'); - - if (field === null) { - return; + if (response.status === 201) { + _self.finished = true; + _self.scrollForm(_self.$refs.form); } - - var slideElement = field.closest('.slider-element'); - this.slideTo(null, Array.from(slideElement.parentNode.children).indexOf(slideElement)); - }, + }); }, - spreads: { - prevButton: { - [':class']() { - return this.active == 0 ? 'opacity-40' : ''; - } - }, - nextButton: { - [':class']() { - return this.active == this.meta.slides.length - 1 ? 'opacity-40' : ''; - } - }, + scrollToFirstError(errors) { + if (Object.keys(errors).length === 0) { + return; + } + + var firstField = Object.keys(errors)[0]; + var field = this.$refs.form.querySelector('[name="'+firstField+'"]'); + + if (field === null) { + return; + } + + var slideElement = field.closest('.slider-element'); + this.slideTo(null, Array.from(slideElement.parentNode.children).indexOf(slideElement)); + }, + prevButton: { + [':class']() { + return this.active == 0 ? 'opacity-40' : ''; + } + }, + nextButton: { + [':class']() { + return this.active == this.slides.length - 1 ? 'opacity-40' : ''; + } }, - init() { - } }; } diff --git a/assets/eventregistration_old.js b/assets/eventregistration_old.js new file mode 100644 index 0000000..149be4f --- /dev/null +++ b/assets/eventregistration_old.js @@ -0,0 +1,187 @@ +import scrollToElement from './scrollToElement.js'; + +var toastedOptions = { + position: 'top-right', + duration: 3000, + fitToScreen: true, + fullWidth: true, + theme: 'material', +}; + +export default function (toasted) { + var toasted = new toasted(toastedOptions); + + return { + data: { + event_id: null, + firstname: '', + lastname: '', + address: '', + zip: '', + location: '', + courses: [], + fcourses: [], + food_preferences: [], + activity: 'Teilnehmer*in', + gender: '', + email: '', + birthday: '', + agegroup: '', + group: '', + agegroup_leader: '', + emergency_phone: '', + phone: '', + misc: '', + foto: false, + parent: false, + vorteam: null, + }, + finished: false, + submitRequest: null, + errorFields: [], + active: 0, + slides: [ + 'Persönliches', + 'Veranstaltung', + 'Sonstiges' + ], + activities: [ + {"id": "Orga", "name": "Orga"}, + {"id": "Teilnehmer*in", "name": "Teilnehmer*in"}, + ], + genders: [ + {"id": "Männlich", "name": "Männlich"}, + {"id": "Weiblich", "name": "Weiblich"}, + {"id": "Divers", "name": "Divers"}, + ], + fcourses: [ + {"id": "Ich bin Samstags beim Abendprogramm dabei", "name": "Ich bin Samstags beim Abendprogramm dabei"}, + {"id": "Ich esse sonntag Mittag mit", "name": "Ich esse sonntag Mittag mit"}, + ], + groups: [ + {"id": "Gallier", "name": "Gallier (Wuppertal)"}, + {"id": "Gandalf", "name": "Gandalf (SG-Mangenberg)"}, + {"id": "Gravenrode", "name": "Gravenrode (SG-Gräfrath)"}, + {"id": "Lennep", "name": "Lennep (RS-Lennep)"}, + {"id": "Silva", "name": "Silva (SG-Wald)"}, + {"id": "Sugambrer", "name": "Sugambrer (SG-Höhscheid)"}, + {"id": "Tenkterer", "name": "Tenkterer (SG-Löhdorf)"}, + {"id": "von Berg", "name": "von Berg (SG-Ohligs)"}, + ], + agegroups: [ + {"id": "Biber", "name": "Biber"}, + {"id": "Wölfling", "name": "Wölfling"}, + {"id": "Jungpfadfinder", "name": "Jungpfadfinder"}, + {"id": "Pfadfinder", "name": "Pfadfinder"}, + {"id": "Rover", "name": "Rover"}, + {"id": "Leiter*in", "name": "Leiter*in"}, + ], + agegroupsroverleiter: [ + {"id": "Rover", "name": "Rover"}, + {"id": "Leiter*in", "name": "Leiter*in"}, + ], + agegroups_leaders: [ + {"id": "Biber", "name": "Biber"}, + {"id": "Wölfling", "name": "Wölfling"}, + {"id": "Jungpfadfinder", "name": "Jungpfadfinder"}, + {"id": "Pfadfinder", "name": "Pfadfinder"}, + {"id": "Rover", "name": "Rover"}, + ], + boolean: [ + {"id": "Ja", "name": "Ja"}, + {"id": "Nein", "name": "Nein"}, + ], + foodPreferences: [ + {"id": "Fleisch", "name": "Ich esse Fleisch"}, + {"id": "Vegan", "name": "Ich ernähre mich vegan"}, + {"id": "Glutenfrei", "name": "Ich vertrage kein Gluten"}, + {"id": "Laktosefrei", "name": "Ich vertrage keine Laktose"}, + ], + foodPreferencesVeg: [ + {"id": "Vegan", "name": "Ich ernähre mich vegan"}, + {"id": "Glutenfrei", "name": "Ich vertrage kein Gluten"}, + {"id": "Laktosefrei", "name": "Ich vertrage keine Laktose"}, + ], + get courses() { + return this.data.agegroup === 'Rover' ? [ + {"id": "Schritt 2", "name": "Schritt 2"}, + ] : [ + {"id": "Baustein 2a", "name": "Baustein 2a"}, + {"id": "Baustein 2c", "name": "Baustein 2c"}, + {"id": "Baustein 3c", "name": "Baustein 3c"}, + {"id": "Schritt 2", "name": "Schritt 2"}, + ]; + }, + slideTo(e, index) { + if (e !== null) { + e.preventDefault(); + } + if (index < 0 || index > this.slides.length-1) { + return; + } + this.scrollForm(this.$refs.form); + this.active = index; + this.$refs.slider.scrollLeft = this.$refs.slider.scrollWidth / this.slides.length * index; + this.$refs.mobileSlider.scrollLeft = this.$refs.mobileSlider.scrollWidth / this.slides.length * index; + }, + scrollForm(el) { + var margin = window.getComputedStyle(el).marginTop.replace('px', ''); + scrollToElement(el, 300, (margin?margin:0) * -1); + }, + submit() { + var _self = this; + var promise = fetch(window.location.href, { + method: 'POST', + headers: { + 'Content-Type': 'application/json', + 'Accept': 'application/json', + 'X-WINTER-REQUEST-HANDLER': this.submitRequest, + 'X-WINTER-REQUEST-PARTIALS': [], + 'X-Requested-With': 'XMLHttpRequest', + }, + body: JSON.stringify(this.data), + }); + + promise.then(function(response) { + if (response.status === 422) { + response.json().then((errors) => { + _self.scrollToFirstError(errors); + Object.keys(errors).forEach((field) => { + toasted.error(errors[field].join('
')); + }); + }); + } + if (response.status === 201) { + _self.finished = true; + _self.scrollForm(_self.$refs.form); + } + }); + }, + scrollToFirstError(errors) { + if (Object.keys(errors).length === 0) { + return; + } + + var firstField = Object.keys(errors)[0]; + var field = this.$refs.form.querySelector('[name="'+firstField+'"]'); + + if (field === null) { + return; + } + + var slideElement = field.closest('.slider-element'); + this.slideTo(null, Array.from(slideElement.parentNode.children).indexOf(slideElement)); + }, + prevButton: { + [':class']() { + return this.active == 0 ? 'opacity-40' : ''; + } + }, + nextButton: { + [':class']() { + return this.active == this.slides.length - 1 ? 'opacity-40' : ''; + } + }, + }; +} + diff --git a/classes/Jsonfile.php b/classes/Jsonfile.php new file mode 100644 index 0000000..ec77374 --- /dev/null +++ b/classes/Jsonfile.php @@ -0,0 +1,39 @@ +content, true); + } + + public function getVar(string $var) + { + return array_get($this->markup(), $var); + } +} diff --git a/components/EventForm.php b/components/EventForm.php index f36f3e3..cab83cd 100644 --- a/components/EventForm.php +++ b/components/EventForm.php @@ -40,32 +40,15 @@ class EventForm extends ComponentBase public function onRender() { $this->customInit($this->property('event_id')); + + return $this->renderPartial('@'.$this->event->slug.'.htm'); } public function onSubmit(): JsonResponse { $this->customInit(Input::get('event_id')); - $rules = [ - 'activity' => 'required|max:255', - 'gender' => 'required|max:255', - 'firstname' => 'required|max:255', - 'lastname' => 'required|max:255', - 'birthday' => 'required|date|before_or_equal:'.now()->format('Y-m-d'), - 'address' => 'required|max:255', - 'zip' => 'required|numeric', - 'location' => 'required|max:255', - 'phone' => 'required|max:255', - 'email' => 'required|max:255|email', - 'agegroup' => 'required|max:255', - 'group' => 'nullable|max:255', - 'agegroup_leader' => 'nullable|max:255', - 'emergency_phone' => 'required|max:255', - 'food_preferences' => 'array', - 'misc' => '', - 'foto' => '', - 'parent' => 'boolean|accepted', - ]; + $rules = $this->event->loadConfig('validator'); if ('Orga' === Input::get('activity')) { $rules['vorteam'] = 'in:Ja,Nein'; @@ -80,13 +63,15 @@ class EventForm extends ComponentBase return response()->json($validator->errors(), 422); } - $participant = Participant::create(array_merge($validator->validated(), [ - 'vorteam' => 'Ja' === Input::get('vorteam'), + $participant = Participant::create([ + 'firstname' => Input::get('firstname'), + 'lastname' => Input::get('lastname'), + 'email' => Input::get('email'), 'event_id' => $this->event->id, - ])); - Mail::send('zoomyboy.event::mail.confirm', ['data' => $participant, 'until' => '1.9.2023', 'iban' => 'XXX', 'birthday' => $participant->birthday->format('d.m.Y')], function ($message) use ($participant) { + 'payload' => Input::all(), + ]); + Mail::send('confirm_'.$this->event->slug, ['data' => Input::all()], function ($message) use ($participant) { $message->to($participant->email, $participant->firstname.' '.$participant->lastname); - $message->subject('Deine Anmeldung fürs Bezirkslager'); }); return response()->json([], 201); diff --git a/components/eventform/navigation.htm b/components/eventform/navigation.htm index 39ef30f..33b9759 100644 --- a/components/eventform/navigation.htm +++ b/components/eventform/navigation.htm @@ -1,11 +1,11 @@
{% if not first %} -
+
Zurück
{% endif %} {% if not last %} -
+
Weiter
{% else %} diff --git a/models/Event.php b/models/Event.php index 2240eb5..5a06769 100644 --- a/models/Event.php +++ b/models/Event.php @@ -2,7 +2,9 @@ namespace Zoomyboy\Event\Models; +use Exception; use Model; +use Zoomyboy\Event\Classes\Jsonfile; /** * Event Model. @@ -77,8 +79,16 @@ class Event extends Model public $attachOne = []; public $attachMany = []; - public static function getOptions(): array + public static function getOptions() { return static::pluck('name', 'id')->toArray(); } + + public function loadConfig($v) + { + $file = $this->slug.'.json'; + throw_unless(Jsonfile::find($file), Exception::class, 'Datei '.$file.' nicht gefunden.'); + + return Jsonfile::find($file)->getVar($v); + } } diff --git a/models/Participant.php b/models/Participant.php index 536955a..493b5fc 100644 --- a/models/Participant.php +++ b/models/Participant.php @@ -39,7 +39,7 @@ class Participant extends Model /** * @var array Attributes to be cast to JSON */ - protected $jsonable = ['food_preferences']; + protected $jsonable = ['payload']; /** * @var array Attributes to be appended to the API representation of the model (ex. toArray()) diff --git a/models/event/columns.yaml b/models/event/columns.yaml index bd66d03..6d2446f 100644 --- a/models/event/columns.yaml +++ b/models/event/columns.yaml @@ -6,3 +6,6 @@ columns: name: label: Name searchable: true + slug: + label: Slug + searchable: true diff --git a/updates/create_events_table.php b/updates/create_events_table.php index 1f2baf0..7942c20 100644 --- a/updates/create_events_table.php +++ b/updates/create_events_table.php @@ -24,10 +24,13 @@ class CreateEventsTable extends Migration public function down() { - Schema::dropIfExists('zoomyboy_event_events'); + if (Schema::hasTable('zoomyboy_event_participants')) { + Schema::table('zoomyboy_event_participants', function (Blueprint $table) { + $table->dropForeign(['event_id']); + $table->dropColumn('event_id'); + }); + } - Schema::create('zoomyboy_event_participants', function (Blueprint $table) { - $table->dropColumn('event_id'); - }); + Schema::dropIfExists('zoomyboy_event_events'); } } diff --git a/updates/create_participants_table.php b/updates/create_participants_table.php index ae0e6f1..261708c 100644 --- a/updates/create_participants_table.php +++ b/updates/create_participants_table.php @@ -12,26 +12,10 @@ class CreateParticipantsTable extends Migration { Schema::create('zoomyboy_event_participants', function (Blueprint $table) { $table->id(); - $table->string('gender'); $table->string('firstname'); $table->string('lastname'); - $table->date('birthday'); $table->string('email'); - $table->string('group')->nullable(); - $table->string('agegroup'); - $table->string('agegroup_leader'); - $table->boolean('vorteam')->default(false); - $table->boolean('foto'); - $table->boolean('parent'); - $table->string('emergency_phone'); - $table->string('address'); - $table->string('zip'); - $table->string('location'); - $table->string('phone'); - $table->string('activity'); - $table->json('food_preferences'); - $table->string('further_food_preferences')->nullable(); - $table->text('misc')->nullable(); + $table->json('payload'); $table->timestamps(); }); } diff --git a/views/macros.htm b/views/macros.htm new file mode 100644 index 0000000..abcec61 --- /dev/null +++ b/views/macros.htm @@ -0,0 +1,88 @@ +{% macro field(context, name, label, required, type) %} + +{% endmacro %} +{% macro textarea(context, name, label, required, type) %} + +{% endmacro %} +{% macro select(context, name, label, required, options) %} + +{% endmacro %} +{% macro radio(context, name, label, required, options) %} +
+ {{label}} {% if required %} * {% endif %} +
+ +
+
+{% endmacro %} +{% macro yesno(context, name, label, required) %} +
+
+ +
+
+{% endmacro %} +{% macro checkboxes(context, name, label, required, options) %} +
+ {{label}} {% if required %} * {% endif %} +
+ +
+
+{% endmacro %}