Hinzugefügt
Umfrage zum Impfstatus
This commit is contained in:
parent
b370fc7133
commit
0940b264f7
@ -11,7 +11,7 @@ namespace App\Http\Controllers;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use App\Models\SurveyCoronaState;
|
||||
use App\Models\SurveyVaccinationState;
|
||||
use App\Helpers\AccessHelper as Access;
|
||||
use \Carbon\Carbon;
|
||||
use Response;
|
||||
@ -22,44 +22,62 @@ class SurveyController extends ExtendedController
|
||||
{
|
||||
public function __construct()
|
||||
{
|
||||
$this->middleware(['auth' => 'surveyPermissions'])->except('surveyCoronaState', 'surveyCoronaStateSave');
|
||||
$this->middleware(['auth' => 'surveyPermissions'])->except('surveyVaccinationState', 'surveyVaccinationStateSave');
|
||||
parent::__construct();
|
||||
}
|
||||
|
||||
|
||||
public function surveyCoronaState(Request $request)
|
||||
public function surveyVaccinationState(Request $request)
|
||||
{
|
||||
$formdata = new SurveyCoronaState();
|
||||
$view = view("inc.survey.coronaState");
|
||||
$formdata = new SurveyVaccinationState();
|
||||
$view = view("inc.survey.vaccinationState");
|
||||
$view->with('url', $this->route);
|
||||
$view->with('formdata', $formdata);
|
||||
$view->with('expired', false);
|
||||
|
||||
return $view;
|
||||
}
|
||||
|
||||
public function surveyCoronaStateSave(Request $request)
|
||||
public function surveyVaccinationStateSave(Request $request)
|
||||
{
|
||||
$request->request->add(['city' => $request->city[0]]);
|
||||
$formdata = $request->validate([
|
||||
$request->request->add(['state' => $request->state[0]]);
|
||||
$request->request->add(['age' => $request->age[0]]);
|
||||
|
||||
$validationData = [
|
||||
'department' => 'required',
|
||||
'state' => 'required|min:3',
|
||||
'expiration_date' => 'date_format:d.m.Y',
|
||||
],
|
||||
'age' => 'required',
|
||||
];
|
||||
if(strtolower($request->state) == 'geimpft' or strtolower($request->state) == 'genesen')
|
||||
{
|
||||
$validationData['expiration_date'] = 'date_format:d.m.Y|after:today';
|
||||
}
|
||||
|
||||
$formdata = $request->validate(
|
||||
$validationData,
|
||||
[
|
||||
'department.required' => 'Pflichtfeld',
|
||||
'age.required' => 'Pflichtfeld',
|
||||
'state.required' => 'Pflichtfeld',
|
||||
'state.min' => 'Mindestens :min Zeichen',
|
||||
'birthday.date_format' => 'Das Datum muss im Format tt.mm.jjjj (tag.monat.jahr) eingegeben werden',
|
||||
'expiration_date.date_format' => 'Das Datum muss im Format tt.mm.jjjj (tag.monat.jahr) eingegeben werden',
|
||||
'expiration_date.after' => 'Das Datum muss in der Zukunft liegen',
|
||||
]);
|
||||
|
||||
$model = new SurveyCoronaState();
|
||||
$expiration_date = Carbon::createFromDate(1900, 1, 1);
|
||||
if(strtolower($request->state) == 'geimpft' or strtolower($request->state) == 'genesen')
|
||||
{
|
||||
$expiration_date = Carbon::createFromFormat('d.m.Y', $request->expiration_date);
|
||||
}
|
||||
|
||||
$model = new SurveyVaccinationState();
|
||||
$model->fill($request->all());
|
||||
$model->expiration_date = Carbon::createFromFormat('d.m.Y', $request->birthday);
|
||||
$model->expiration_date = $expiration_date;
|
||||
$model->department = $request->department[0];
|
||||
$model->survey_id = 1;
|
||||
$model->save();
|
||||
|
||||
$view = view("inc.contact.surveyCoronaStateSuccess");
|
||||
$view = view("inc.survey.vaccinationStateSuccess");
|
||||
|
||||
|
||||
return $view;
|
||||
|
||||
@ -13,14 +13,15 @@ use Carbon\Carbon;
|
||||
use App\Helpers\PostHelper;
|
||||
use App\Http\Controllers\ServiceController;
|
||||
|
||||
class SurveyCoronaState extends ExtendedModel
|
||||
class SurveyVaccinationState extends ExtendedModel
|
||||
{
|
||||
protected $fillable = [
|
||||
'survey_id',
|
||||
'department',
|
||||
'state',
|
||||
'expiration_date',
|
||||
'age'
|
||||
];
|
||||
|
||||
protected $table = 'survey_corona_state';
|
||||
protected $table = 'survey_vaccination_state';
|
||||
}
|
||||
@ -4,7 +4,7 @@ use Illuminate\Support\Facades\Schema;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
|
||||
class CreateSurveyCoronaStateTable extends Migration
|
||||
class CreateSurveyVaccinationStateTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
@ -13,12 +13,13 @@ class CreateSurveyCoronaStateTable extends Migration
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('survey_corona_state', function (Blueprint $table) {
|
||||
Schema::create('survey_vaccination_state', function (Blueprint $table) {
|
||||
$table->increments('id');
|
||||
$table->integer('survey_id');
|
||||
$table->string('department', 20);
|
||||
$table->string('state', 50);
|
||||
$table->date('expiration_date');
|
||||
$table->string('age');
|
||||
$table->timestamps();
|
||||
$table->softDeletes();
|
||||
});
|
||||
@ -31,6 +32,6 @@ class CreateSurveyCoronaStateTable extends Migration
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('subscribe_vaccinate');
|
||||
Schema::dropIfExists('survey_vaccination_state');
|
||||
}
|
||||
}
|
||||
126
resources/views/inc/survey/vaccinationState.blade.php
Normal file
126
resources/views/inc/survey/vaccinationState.blade.php
Normal file
@ -0,0 +1,126 @@
|
||||
@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">
|
||||
Anonyme Abfrage des Impfstatus für Feuerwehrangehörige der Freiwilligen Feuerwehr Eppingen - Gesamtwehr
|
||||
</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 Zeitraum für die Statusabfrage ist abgelaufen.
|
||||
</div>
|
||||
</div>
|
||||
@else
|
||||
<div class="row">
|
||||
<div class="row">
|
||||
<div class="col">
|
||||
Um die Einsatzbereitschaft besser abschätzen zu können bitten wir alle aktiven Angehörigen der Freiwilligen Feuerwehr Eppingen - Gesamtwehr an dieser Umfrage teilzunehmen.
|
||||
Die Umfrage findet absolut anonym statt.
|
||||
Es werden lediglich die Daten aus dem untenstehenden Formular gespeichert.
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-lg-12 card-content">
|
||||
<form action="{{ config('app.url') . '/umfrage/impfstatus/abschliessen' }}" method="POST">
|
||||
<input type="hidden" value="{{ csrf_token() }}" name="_token" />
|
||||
@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']
|
||||
]
|
||||
])
|
||||
@include('inc.forms.inputSelect', [
|
||||
'name' => 'age',
|
||||
'label' => 'Alter *',
|
||||
'placeholder' => '',
|
||||
'selected' => old('age'),
|
||||
'modelValue' => 'age',
|
||||
'modelLabel' => 'age',
|
||||
'models' => [
|
||||
(object)['age' => ''],
|
||||
(object)['age' => '18-25'],
|
||||
(object)['age' => '26-35'],
|
||||
(object)['age' => '36-45'],
|
||||
(object)['age' => '46-55'],
|
||||
(object)['age' => '56-65'],
|
||||
]
|
||||
])
|
||||
@include('inc.forms.inputSelect', [
|
||||
'name' => 'state',
|
||||
'label' => 'Impf-/Genesenenstatus *',
|
||||
'placeholder' => '',
|
||||
'selected' => old('state'),
|
||||
'modelValue' => 'state',
|
||||
'modelLabel' => 'state',
|
||||
'models' => [
|
||||
(object)['state' => ''],
|
||||
(object)['state' => 'Geimpft'],
|
||||
(object)['state' => 'Genesen'],
|
||||
(object)['state' => 'Ich möchte mich vorerst nicht impfen lassen'],
|
||||
]
|
||||
])
|
||||
@include('inc.forms.inputText', [
|
||||
'name' => 'expiration_date',
|
||||
'label' => 'Impf-/Genesenenstatus gültig bis',
|
||||
'placeholder' => 'tt.mm.jjjj',
|
||||
'value' => $formdata->expiration_date
|
||||
])
|
||||
|
||||
<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
|
||||
31
resources/views/inc/survey/vaccinationStateSuccess.blade.php
Normal file
31
resources/views/inc/survey/vaccinationStateSuccess.blade.php
Normal 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">
|
||||
Teilnahmebestätigung
|
||||
</h1>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-lg-12">
|
||||
<hr>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col">
|
||||
Vielen Dank für die Teilnahme.<br/>
|
||||
<br/>
|
||||
Eure Feuerwehr Eppingen
|
||||
<br/>
|
||||
<br/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</article>
|
||||
@endsection
|
||||
@ -95,6 +95,17 @@ Route::post("anmeldung/abschliessen", [
|
||||
'middleware' => 'auth', function (){}
|
||||
]);
|
||||
|
||||
Route::get("umfrage/impfstatus", [
|
||||
"uses" => "SurveyController@surveyVaccinationState",
|
||||
], [
|
||||
'middleware' => 'auth', function (){}
|
||||
]);
|
||||
|
||||
Route::post("umfrage/impfstatus/abschliessen", [
|
||||
"uses" => "SurveyController@surveyVaccinationStateSave",
|
||||
], [
|
||||
'middleware' => 'auth', function (){}
|
||||
]);
|
||||
|
||||
/****************************************/
|
||||
/* Standard Routen für den User-Bereich */
|
||||
|
||||
Loading…
Reference in New Issue
Block a user