diff --git a/components/EventForm.php b/components/EventForm.php index cab83cd..b4c0c44 100644 --- a/components/EventForm.php +++ b/components/EventForm.php @@ -68,9 +68,9 @@ class EventForm extends ComponentBase 'lastname' => Input::get('lastname'), 'email' => Input::get('email'), 'event_id' => $this->event->id, - 'payload' => Input::all(), + 'payload' => $this->event->transformInputs(Input::all()), ]); - Mail::send('confirm_'.$this->event->slug, ['data' => Input::all()], function ($message) use ($participant) { + Mail::send('confirm_'.$this->event->slug, ['data' => $participant->payload], function ($message) use ($participant) { $message->to($participant->email, $participant->firstname.' '.$participant->lastname); }); diff --git a/models/Event.php b/models/Event.php index 5a06769..2d0bef6 100644 --- a/models/Event.php +++ b/models/Event.php @@ -91,4 +91,30 @@ class Event extends Model return Jsonfile::find($file)->getVar($v); } + + public function transformInputs($input) + { + $konto = [ + 'Gallier' => 'DE62 3305 0000 0000 7550 82', + 'Gandalf' => 'DE47 3706 0193 0034 4200 17', + 'Gravenrode' => 'DE13 3425 0000 0000 4010 83', + 'Lennep' => 'DE58 3706 0193 0031 2770 19', + 'Silva' => 'DE40 3425 0000 0000 2145 51', + 'Sugambrer' => 'DE49 3425 0000 0000 0316 41', + 'Tenkterer' => 'DE61 3425 0000 0000 7076 12', + 'von Berg' => 'DE32 3425 0000 0001 9209 25', + ]; + + if ('bela' === $this->slug) { + $input['konto'] = data_get($input, 'group') && data_get($konto, $input['group']) + ? data_get($konto, $input['group']) + : 'Das Bezirkskonto'; + $input['zweck'] = 'Bezirkslager '.data_get($input, 'firstname').' '.data_get($input, 'lastname'); + $input['betrag'] = '160,00 €'; + + return $input; + } + + return $input; + } }