diff --git a/app/Http/Controllers/ContactController.php b/app/Http/Controllers/ContactController.php index 7894e017..fa1572cd 100644 --- a/app/Http/Controllers/ContactController.php +++ b/app/Http/Controllers/ContactController.php @@ -14,6 +14,7 @@ use Illuminate\Support\Facades\DB; use App\Models\SubscribeChild; use App\Models\SubscribeVaccinate; use App\Models\SubscribeYouthFireFighter; +use App\Models\SubscribeHelperParty; use App\Helpers\AccessHelper as Access; use \Carbon\Carbon; use Response; @@ -24,7 +25,16 @@ class ContactController extends ExtendedController { public function __construct() { - $this->middleware(['auth' => 'contactPermissions'])->except('subscribe', 'subscribeSave', 'count', 'subscribeVaccinate', 'subscribeVaccinateSave', 'subscribeYouthFireFighter', 'subscribeYouthFireFighterSave'); + $this->middleware(['auth' => 'contactPermissions'])->except( + 'subscribe', + 'subscribeSave', + 'count', + 'subscribeVaccinate', + 'subscribeVaccinateSave', + 'subscribeYouthFireFighter', + 'subscribeYouthFireFighterSave', + 'subscribeHelperParty', + 'subscribeHelperPartySave'); parent::__construct(); } @@ -245,4 +255,65 @@ class ContactController extends ExtendedController return $view; } + + + /****************************/ + /* Anmeldung zum Helferfest */ + /****************************/ + public function subscribeHelperParty(Request $request) + { + $formdata = new SubscribeYouthFireFighter(); + $view = view("inc.contact.subscribeHelperParty"); + $view->with('url', $this->route); + $view->with('formdata', $formdata); + $view->with('expired', false); + + return $view; + } + + public function subscribeHelperPartySave(Request $request) + { + $formdata = $request->validate([ + 'firstname' => 'required|min:3', + 'lastname' => 'required|min:3', + 'countMatures' => 'integer', + 'countChildren' => 'integer' + ], + [ + 'firstname.required' => 'Pflichtfeld', + 'firstname.min' => 'Mindestens :min Zeichen', + 'lastname.required' => 'Pflichtfeld', + 'lastname.min' => 'Mindestens :min Zeichen', + 'countMatures.integer' => 'Es sind nur Zahlen erlaubt', + 'countChildren.integer' => 'Es sind nur Zahlen erlaubt', + ]); + + $model = SubscribeHelperParty::where('lastname', $request->lastname) + ->where('firstname', $request->firstname) + ->get(); + + $view = null; + $view = view("inc.contact.subscribeHelperPartySuccess"); + if($model->count()) + { + $model = $model->first(); + $model->fill($request->all()); + $model->save(); + $view->with('exist', true); + } + else + { + $model = new SubscribeHelperParty(); + $model->fill($request->all()); + $model->save(); + + } + $view->with('firstname', $request->firstname); + $view->with('lastname', $request->lastname); + $view->with('countMatures', $request->countMatures); + $view->with('countChildren', $request->countChildren); + + + return $view; + } } \ No newline at end of file diff --git a/app/Models/SubscribeHelperParty.php b/app/Models/SubscribeHelperParty.php new file mode 100644 index 00000000..88d458ad --- /dev/null +++ b/app/Models/SubscribeHelperParty.php @@ -0,0 +1,25 @@ +increments('id'); - $table->string('lastnameParent', 50); - $table->string('firstnameParent', 50); - $table->string('firstnameChild', 50); - $table->string('street', 50); - $table->string('streetnumber', 5); - $table->string('city', 20); - $table->string('phone', 50); - $table->date('birthday'); - $table->string('email', 100); - $table->timestamps(); - $table->softDeletes(); - }); - } - - /** - * Reverse the migrations. - * - * @return void - */ - public function down() - { - Schema::dropIfExists('subscribe_child'); - } -} diff --git a/database/migrations/2022_10_19_210900_create_subscribe_helper_party_table.php b/database/migrations/2022_10_19_210900_create_subscribe_helper_party_table.php new file mode 100644 index 00000000..3fbb0654 --- /dev/null +++ b/database/migrations/2022_10_19_210900_create_subscribe_helper_party_table.php @@ -0,0 +1,36 @@ +increments('id'); + $table->string('lastname', 50); + $table->string('firstname', 50); + $table->integer('countMatures'); + $table->integer('countChildren'); + $table->timestamps(); + $table->softDeletes(); + }); + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + Schema::dropIfExists('subscribe_helper_party'); + } +} diff --git a/resources/views/inc/contact/subscribeHelperParty.blade.php b/resources/views/inc/contact/subscribeHelperParty.blade.php new file mode 100644 index 00000000..4ebe3126 --- /dev/null +++ b/resources/views/inc/contact/subscribeHelperParty.blade.php @@ -0,0 +1,94 @@ +@extends('layouts.app') + +@section('social_media') + + +@endsection + +@section('content') +
+
+

+ Anmeldung zum Helferfest am 10.12.2022 +

+
+
+
+
+
+
+ + @if($expired) +
+
+ Es tut uns Leid, aber der Anmeldezeitraum ist abgelaufen. +
+
+ @else + +
+
+

+ Hiermit melde ich mich zum Helferfest am 10.12.2022 an. +

+
+
+
+
+
+ {{ csrf_field() }} + @include('inc.forms.inputText', [ + 'name' => 'lastname', + 'label' => 'Nachname *', + 'placeholder' => 'Nachname', + 'value' => $formdata->firstname + ]) + @include('inc.forms.inputText', [ + 'name' => 'firstname', + 'label' => 'Vorname*', + 'placeholder' => 'Vorname', + 'value' => $formdata->lastname + ]) + @include('inc.forms.inputText', [ + 'name' => 'countMatures', + 'label' => 'Anzahl Erwachsener', + 'placeholder' => '', + 'value' => $formdata->countMatures + ]) + @include('inc.forms.inputText', [ + 'name' => 'countChildren', + 'label' => 'Anzahl Kinder', + 'placeholder' => '', + 'value' => $formdata->countChildren + ]) +
+ * Pflichtfeld +
+
+ +
+
+
+
+ @endif +
+ +
+
+@endsection \ No newline at end of file diff --git a/resources/views/inc/contact/subscribeHelperPartySuccess.blade.php b/resources/views/inc/contact/subscribeHelperPartySuccess.blade.php new file mode 100644 index 00000000..a212230c --- /dev/null +++ b/resources/views/inc/contact/subscribeHelperPartySuccess.blade.php @@ -0,0 +1,48 @@ +@extends('layouts.app') + +@section('social_media') + + +@endsection + +@section('content') +
+
+

+ Anmeldebestätigung +

+
+
+
+
+
+
+
+
+ @if(isset($exist)) + Du bist bereits angemeldet. Deine geänderten Anmeldedaten wurden gespeichert. + @else + Vielen Dank für die Anmeldung zum Helferfest.
+ @endif +
+
Name:
+
{{ $firstname }} {{ $lastname }}
+
+
+
Anzahl Erwachsener:
+
{{ $countMatures }}
+
+
+
Anzahl Kinder:
+
{{ $countChildren }}
+
+ +
+ Deine Feuerwehr Eppingen +
+
+
+
+ +
+@endsection \ No newline at end of file diff --git a/routes/web.php b/routes/web.php index 78f43c94..0f158644 100755 --- a/routes/web.php +++ b/routes/web.php @@ -118,6 +118,17 @@ Route::post("anmeldung-kinderfeuerwehr/abschliessen", [ 'middleware' => 'auth', function (){} ]); +Route::get("anmeldung/helferfest", [ + "uses" => "ContactController@subscribeHelperParty", +], [ + 'middleware' => 'auth', function (){} +]); +Route::post("anmeldung/helferfest/abschliessen", [ + "uses" => "ContactController@subscribeHelperPartySave", +], [ + 'middleware' => 'auth', function (){} +]); + /****************************************/