diff --git a/Plugin.php b/Plugin.php index fe93a04..de42150 100644 --- a/Plugin.php +++ b/Plugin.php @@ -89,4 +89,11 @@ class Plugin extends PluginBase ], ]; } + + public function registerMailTemplates() + { + return [ + 'zoomyboy.event::mail.confirm', + ]; + } } diff --git a/assets/eventregistration.js b/assets/eventregistration.js index a8ec7dd..aa0145a 100644 --- a/assets/eventregistration.js +++ b/assets/eventregistration.js @@ -13,22 +13,22 @@ export default function (toasted) { return { data: { - firstname: '', - lastname: '', - address: '', - zip: '', - location: '', + firstname: 'Philipp', + lastname: 'Lang', + address: 'Itterstr 3', + zip: '42719', + location: 'Solingen', food_preferences: [], activity: 'Teilnehmer*in', - gender: '', - email: '', - birthday: '', - agegroup: '', - group: '', - agegroup_leader: '', - emergency_phone: '', - phone: '', - misc: '', + gender: 'Weiblich', + email: 'philipp@aaa.de', + birthday: '1991-06-20', + agegroup: 'Leiter*in', + group: 'Gandalf', + agegroup_leader: 'Wölfling', + emergency_phone: '+49 1756 70342425', + phone: '+49 176 70342420', + misc: 'Lrem ipfrgfg', foto: false, vorteam: null, }, @@ -36,7 +36,7 @@ export default function (toasted) { finished: false, submitRequest: null, errorFields: [], - active: 0, + active: 3, slides: [ 'Persönliches', 'Veranstaltung', @@ -61,7 +61,7 @@ export default function (toasted) { {"id": "Jungpfadfinder", "name": "Jungpfadfinder"}, {"id": "Pfadfinder", "name": "Pfadfinder"}, {"id": "Rover", "name": "Rover"}, - {"id": "Leiter", "name": "Leiter"}, + {"id": "Leiter*in", "name": "Leiter*in"}, ], agegroups_leaders: [ {"id": "Biber", "name": "Biber"}, diff --git a/components/EventForm.php b/components/EventForm.php index a476b95..b70e940 100644 --- a/components/EventForm.php +++ b/components/EventForm.php @@ -5,6 +5,7 @@ namespace Zoomyboy\Event\Components; use Cms\Classes\ComponentBase; use Illuminate\Http\JsonResponse; use Illuminate\Support\Facades\Lang; +use Illuminate\Support\Facades\Mail; use Input; use Winter\Storm\Support\Facades\Validator; use Zoomyboy\Event\Models\Participant; @@ -58,9 +59,13 @@ class EventForm extends ComponentBase return response()->json($validator->errors(), 422); } - Participant::create(array_merge($validator->validated(), [ + $participant = Participant::create(array_merge($validator->validated(), [ 'vorteam' => 'Ja' === Input::get('vorteam'), ])); + 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) { + $message->to($participant->email, $participant->firstname.' '.$participant->lastname); + $message->subject('Deine Anmeldung fürs Bezirkslager'); + }); return response()->json([], 201); } diff --git a/components/eventform/default.htm b/components/eventform/default.htm index d420e50..c57ec28 100644 --- a/components/eventform/default.htm +++ b/components/eventform/default.htm @@ -160,10 +160,10 @@ {{ form.select(_context, 'group', 'Stamm', false, 'groups') }} {{ form.field(_context, 'emergency_phone', 'Notfallkontakt (Tel)', true) }} {{ form.select(_context, 'agegroup', 'Stufe (zum Zeitpunkt des Lagers)', true, 'agegroups') }} -