From 30c94735e23a1f930817730e8588cb92a8a5efab Mon Sep 17 00:00:00 2001 From: Marco Glietsch Date: Sun, 18 Apr 2021 19:52:27 +0200 Subject: [PATCH] =?UTF-8?q?Hinzugef=C3=BCgt?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Anmeldeformular für Corona-Schutzimpfung --- app/Http/Controllers/ContactController.php | 67 +++++++- app/Models/SubscribeVaccinate.php | 29 ++++ ...12047_create_subscribe_vaccinate_table.php | 39 +++++ .../inc/contact/subscribeVaccinate.blade.php | 151 ++++++++++++++++++ .../subscribeVaccinateDouble.blade.php | 27 ++++ .../subscribeVaccinateSuccess.blade.php | 31 ++++ routes/web.php | 4 +- 7 files changed, 345 insertions(+), 3 deletions(-) create mode 100755 app/Models/SubscribeVaccinate.php create mode 100644 database/migrations/2021_04_18_212047_create_subscribe_vaccinate_table.php create mode 100644 resources/views/inc/contact/subscribeVaccinate.blade.php create mode 100644 resources/views/inc/contact/subscribeVaccinateDouble.blade.php create mode 100644 resources/views/inc/contact/subscribeVaccinateSuccess.blade.php diff --git a/app/Http/Controllers/ContactController.php b/app/Http/Controllers/ContactController.php index 582154d7..ba731d25 100644 --- a/app/Http/Controllers/ContactController.php +++ b/app/Http/Controllers/ContactController.php @@ -12,6 +12,7 @@ use Illuminate\Http\Request; use Illuminate\Support\Facades\Auth; use Illuminate\Support\Facades\DB; use App\Models\SubscribeChild; +use App\Models\SubscribeVaccinate; use App\Helpers\AccessHelper as Access; use \Carbon\Carbon; use Response; @@ -22,7 +23,7 @@ class ContactController extends ExtendedController { public function __construct() { - $this->middleware(['auth' => 'contactPermissions'])->except('subscribe', 'subscribeSave', 'count'); + $this->middleware(['auth' => 'contactPermissions'])->except('subscribe', 'subscribeSave', 'count', 'subscribeVaccinate', 'subscribeVaccinateSave'); parent::__construct(); } @@ -93,6 +94,70 @@ class ContactController extends ExtendedController } + return $view; + } + + public function subscribeVaccinate(Request $request) + { + $formdata = new SubscribeVaccinate(); + $view = view("inc.contact.subscribeVaccinate"); + $view->with('url', $this->route); + $view->with('formdata', $formdata); + $view->with('expired', false); + + return $view; + } + + public function subscribeVaccinateSave(Request $request) + { + $request->request->add(['city' => $request->city[0]]); + $formdata = $request->validate([ + 'firstname' => 'required|min:3', + 'lastname' => 'required|min:3', + 'birthday' => 'required|date_format:d.m.Y', + 'street' => 'required|min:3', + 'streetnumber' => 'required', + 'city' => 'required', + 'department' => 'required', + ], + [ + 'firstname.required' => 'Pflichtfeld', + 'firstname.min' => 'Mindestens :min Zeichen', + 'lastname.required' => 'Pflichtfeld', + 'lastname.min' => 'Mindestens :min Zeichen', + 'birthday.required' => 'Pflichtfeld', + 'birthday.date_format' => 'Das Datum muss im Format tt.mm.jjjj (tag.monat.jahr) eingegeben werden', + 'street.required' => 'Pflichtfeld', + 'street.min' => 'Mindestens :min Zeichen', + 'streetnumber.required' => 'Pflichtfeld', + 'streetnumber.min' => 'Mindestens :min Zeichen', + 'city.required' => 'Pflichtfeld', + 'department.required' => 'Pflichtfeld', + ]); + + $checkmodel = SubscribeVaccinate::where('lastname', $request->lastname) + ->where('firstname', $request->firstname) + ->get(); + + $view = null; + if($checkmodel->count()) + { + $view = view("inc.contact.subscribeVaccinateDouble"); + $view->with('firstname', $request->firstname); + $view->with('lastname', $request->lastname); + } + else + { + $model = new SubscribeVaccinate(); + $model->fill($request->all()); + $model->birthday = Carbon::createFromFormat('d.m.Y', $request->birthday); + $model->department = $request->department[0]; + $model->save(); + + $view = view("inc.contact.subscribeVaccinateSuccess"); + } + + return $view; } } \ No newline at end of file diff --git a/app/Models/SubscribeVaccinate.php b/app/Models/SubscribeVaccinate.php new file mode 100755 index 00000000..d0a933c6 --- /dev/null +++ b/app/Models/SubscribeVaccinate.php @@ -0,0 +1,29 @@ +increments('id'); + $table->string('lastname', 50); + $table->string('firstname', 50); + $table->date('birthday'); + $table->string('street', 50); + $table->string('streetnumber', 5); + $table->string('city', 20); + $table->string('department', 20); + $table->timestamps(); + $table->softDeletes(); + }); + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + Schema::dropIfExists('subscribe_vaccinate'); + } +} diff --git a/resources/views/inc/contact/subscribeVaccinate.blade.php b/resources/views/inc/contact/subscribeVaccinate.blade.php new file mode 100644 index 00000000..50869257 --- /dev/null +++ b/resources/views/inc/contact/subscribeVaccinate.blade.php @@ -0,0 +1,151 @@ +@extends('layouts.app') + +@section('social_media') + + +@endsection + +@section('content') +
+
+

+ Anmeldung zur Corona-Schutzimpfung für Feuerwehrangehörige der Freiwilligen Feuerwehr Eppingen +

+
+
+
+
+
+
+ + @if($expired) +
+
+ Es tut uns Leid, aber der Anmeldezeitraum für die Corona-Impfung ist abgelaufen. + Sobald wieder Kontingente zur Verfügung stehen, werden wir das Formular wieder freischalten. +
+
+ @else +
+
+
    +
  • + Wann: Mittwoch, 21.04.2021, 13:30 - 21 Uhr. Die genaue Uhrzeit ist nicht frei wählbar und wird noch mitgeteilt. +
  • +
  • + Wo: Kreisimpfzentrum Ilsfeld +
  • +
  • + Impfstoff: AstraZeneca +
  • +
+
+
+
+ Aufgrund des begrenzten Kontingents an Impfstoff kann nicht garantiert werden, dass jeder angemeldete Feuerwehrangehörige auch einen tatsächlichen Impftermin erhält. +
+
+
+
+
+
+ + @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' => 'birthday', + 'label' => 'Geburtstag *', + 'placeholder' => 'tt.mm.jjjj', + 'value' => $formdata->birthday + ]) + @include('inc.forms.inputText', [ + 'name' => 'street', + 'label' => 'Straße *', + 'placeholder' => 'Straße', + 'value' => $formdata->street + ]) + @include('inc.forms.inputText', [ + 'name' => 'streetnumber', + 'label' => 'Hausnummer *', + 'placeholder' => 'Hausnummer', + 'value' => $formdata->streetnumber + ]) + {{ $formdata->streetnumber }} + @include('inc.forms.inputSelect', [ + 'name' => 'city', + 'label' => 'Wohnort *', + 'placeholder' => 'Wohnort', + 'selected' => old('city.0'), + 'modelValue' => 'city', + 'modelLabel' => 'city', + 'models' => [ + (object)['city' => ''], + (object)['city' => 'Adelshofen'], + (object)['city' => 'Elsenz'], + (object)['city' => 'Eppingen'], + (object)['city' => 'Kleingartach'], + (object)['city' => 'Mühlbach'], + (object)['city' => 'Richen'], + (object)['city' => 'Rohrbach'] + ] + ]) + @include('inc.forms.inputSelect', [ + 'name' => 'department', + 'label' => 'Abteilung *', + 'placeholder' => 'Abteilung', + 'selected' => old('department.0'), + 'modelValue' => 'department', + 'modelLabel' => 'department', + 'models' => [ + (object)['department' => ''], + (object)['department' => 'Adelshofen'], + (object)['department' => 'Elsenz'], + (object)['department' => 'Eppingen'], + (object)['department' => 'Kleingartach'], + (object)['department' => 'Mühlbach'], + (object)['department' => 'Richen'], + (object)['department' => 'Rohrbach'] + ] + ]) + +
+ * Pflichtfeld +
+
+ +
+
+
+
+ @endif +
+ +
+
+@endsection \ No newline at end of file diff --git a/resources/views/inc/contact/subscribeVaccinateDouble.blade.php b/resources/views/inc/contact/subscribeVaccinateDouble.blade.php new file mode 100644 index 00000000..a986bee2 --- /dev/null +++ b/resources/views/inc/contact/subscribeVaccinateDouble.blade.php @@ -0,0 +1,27 @@ +@extends('layouts.app') + +@section('content') +
+
+

+ Anmeldung bereits erfolgt +

+
+
+
+
+
+
+
+
+ Eine Anmeldung für {{ $firstname }} {{ $lastname }} existiert bereits.
+
+
+ Eure Feuerwehr Eppingen +
+
+
+
+ +
+@endsection \ No newline at end of file diff --git a/resources/views/inc/contact/subscribeVaccinateSuccess.blade.php b/resources/views/inc/contact/subscribeVaccinateSuccess.blade.php new file mode 100644 index 00000000..828ea616 --- /dev/null +++ b/resources/views/inc/contact/subscribeVaccinateSuccess.blade.php @@ -0,0 +1,31 @@ +@extends('layouts.app') + +@section('social_media') + + +@endsection + +@section('content') +
+
+

+ Anmeldebestätigung +

+
+
+
+
+
+
+
+
+ Die Anmeldung zur Corona-Schutzimpfung wurde erfolgreich abgeschlossen.
+
+ Eure Feuerwehr Eppingen +
+
+
+
+ +
+@endsection \ No newline at end of file diff --git a/routes/web.php b/routes/web.php index a4abb416..e9e9749f 100755 --- a/routes/web.php +++ b/routes/web.php @@ -85,12 +85,12 @@ Route::get('admin/benutzer/wechseln/stop', 'UserController@user_switch_stop'); /* Kontaktformulare */ /********************/ Route::get("anmeldung", [ - "uses" => "ContactController@subscribe", + "uses" => "ContactController@subscribeVaccinate", ], [ 'middleware' => 'auth', function (){} ]); Route::post("anmeldung/abschliessen", [ - "uses" => "ContactController@subscribeSave", + "uses" => "ContactController@subscribeVaccinateSave", ], [ 'middleware' => 'auth', function (){} ]);