Hinzugefügt

Anmeldeformular für Corona-Schutzimpfung
This commit is contained in:
Marco Glietsch 2021-04-18 19:52:27 +02:00
parent 4a9052a90a
commit 30c94735e2
7 changed files with 345 additions and 3 deletions

View File

@ -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;
}
}

View File

@ -0,0 +1,29 @@
<?php
namespace App\Models;
use App\Models\Traits\FullTextSearch;
use App\Models\Traits\Documents;
use Illuminate\Database\Eloquent\Model;
use OwenIt\Auditing\Contracts\Auditable;
use Illuminate\Support\Arr;
use Cviebrock\EloquentSluggable\Sluggable;
use App\Helpers\TagHelper;
use Carbon\Carbon;
use App\Helpers\PostHelper;
use App\Http\Controllers\ServiceController;
class SubscribeVaccinate extends ExtendedModel
{
protected $fillable = [
'lastname',
'firstname',
'birthday',
'street',
'streetnumber',
'city',
'department',
];
protected $table = 'subscribe_vaccinate';
}

View File

@ -0,0 +1,39 @@
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class CreateSubscribeVaccinateTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('subscribe_vaccinate', function (Blueprint $table) {
$table->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');
}
}

View File

@ -0,0 +1,151 @@
@extends('layouts.app')
@section('social_media')
<meta property="fb:app_id" content="{{ config('social-media-manager.facebook.app_id') }}"/>
<meta property="og:type" content="website"/>
@endsection
@section('content')
<article class="post-item card pt-3 pb-3 mb-lg-5 shadow-sm">
<div class="row">
<h1 class="col-lg-12 card-title">
Anmeldung zur Corona-Schutzimpfung für Feuerwehrangehörige der Freiwilligen Feuerwehr Eppingen
</h1>
</div>
<div class="row">
<div class="col-lg-12">
<hr>
</div>
</div>
<!-- -- >
<div class="row">
<div class="col-lg-6">
Links
</div>
<div class="col-lg-6 text-right">
Rechts
</div>
</div>
<div class="row">
<div class="col-lg-12">
<hr>
</div>
</div>
<!-- -->
@if($expired)
<div class="row">
<div class="col">
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.
</div>
</div>
@else
<div class="row">
<div class="col">
<ul>
<li>
Wann: Mittwoch, 21.04.2021, 13:30 - 21 Uhr. Die genaue Uhrzeit ist nicht frei wählbar und wird noch mitgeteilt.
</li>
<li>
Wo: Kreisimpfzentrum Ilsfeld
</li>
<li>
Impfstoff: AstraZeneca
</li>
</ul>
</div>
<div class="row">
<div class="col">
Aufgrund des begrenzten Kontingents an Impfstoff kann nicht garantiert werden, dass jeder angemeldete Feuerwehrangehörige auch einen tatsächlichen Impftermin erhält.
</div>
</div>
</div>
<div class="row">
<div class="col-lg-12 card-content">
<form action="{{ config('app.url') . '/anmeldung/abschliessen' }}" method="POST">
<input type="hidden" value="{{ csrf_token() }}" name="_token" />
@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']
]
])
<div class="form-group">
* Pflichtfeld
</div>
<div class="form-group">
<button class="btn btn-primary">Anmelden</button>
</div>
</form>
</div>
</div>
@endif
<div class="row mt-3">
<div class="col-lg-12 social-share">
@include('inc.social_media.facebook.likeShare')
</div>
</div>
</article>
@endsection

View File

@ -0,0 +1,27 @@
@extends('layouts.app')
@section('content')
<article class="post-item card pt-3 pb-3 mb-lg-5 shadow-sm">
<div class="row">
<h1 class="col-lg-12 card-title">
Anmeldung bereits erfolgt
</h1>
</div>
<div class="row">
<div class="col-lg-12">
<hr>
</div>
</div>
<div class="row">
<div class="col">
Eine Anmeldung für <span class="font-weight-bold">{{ $firstname }} {{ $lastname }} </span> existiert bereits.<br/>
<br/>
<br/>
Eure Feuerwehr Eppingen
<br/>
<br/>
</div>
</div>
</article>
@endsection

View File

@ -0,0 +1,31 @@
@extends('layouts.app')
@section('social_media')
<meta property="fb:app_id" content="{{ config('social-media-manager.facebook.app_id') }}"/>
<meta property="og:type" content="website"/>
@endsection
@section('content')
<article class="post-item card pt-3 pb-3 mb-lg-5 shadow-sm">
<div class="row">
<h1 class="col-lg-12 card-title">
Anmeldebestätigung
</h1>
</div>
<div class="row">
<div class="col-lg-12">
<hr>
</div>
</div>
<div class="row">
<div class="col">
Die Anmeldung zur Corona-Schutzimpfung wurde erfolgreich abgeschlossen.<br/>
<br/>
Eure Feuerwehr Eppingen
<br/>
<br/>
</div>
</div>
</article>
@endsection

View File

@ -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 (){}
]);