Added Pokal and Playoff Data Input + Page

This commit is contained in:
Torsten 2024-01-11 18:03:25 +01:00
parent 498804f3e0
commit 950fbe1755
8 changed files with 193 additions and 4 deletions

View file

@ -801,10 +801,6 @@ class UsersController extends Controller
}
}
$rankingDisplay = Tipp::gshirt_table();
$usernames = User::getNames();
$roundnames = array();
@ -819,4 +815,82 @@ class UsersController extends Controller
public function no_payment() {
return view ('users.no_payment');
}
public function playoff_report() {
if (Auth::guest()) { return redirect("/"); }
$season=Season::getCurrent();
$seasonId=$season->id;
$sql="select playoff_report from seasons where id=$seasonId";
$result = DB::select($sql);
$playoff_report = $result[0]->playoff_report ?? 'Playoff Daten: Noch keine.';
return view ('users.playoff_report', compact('playoff_report'));
}
public function playoff_report_edit() {
if (!Auth::user()->admin) { return redirect("/"); }
$season=Season::getCurrent();
$seasonId=$season->id;
$sql="select playoff_report from seasons where id=$seasonId";
$result = DB::select($sql);
$playoff_report = $result[0]->playoff_report ?? 'Playoff Daten: Noch keine.';
return view ('users.playoff_report_edit', compact('playoff_report'));
}
public function store_playoff() {
$playoff_report = str_replace("'", "", request('playoff'));
$season=Season::getCurrent();
$seasonId=$season->id;
DB::update("UPDATE seasons SET playoff_report='$playoff_report' WHERE id=$seasonId;");
return redirect("/users/playoff");
}
public function pokal_report() {
if (Auth::guest()) { return redirect("/"); }
$season=Season::getCurrent();
$seasonId=$season->id;
$sql="select pokal_report from seasons where id=$seasonId";
$result = DB::select($sql);
$pokal_report = $result[0]->pokal_report ?? 'Pokal Daten: Noch keine.';
return view ('users.pokal_report', compact('pokal_report'));
}
public function pokal_report_edit() {
if (!Auth::user()->admin) { return redirect("/"); }
$season=Season::getCurrent();
$seasonId=$season->id;
$sql="select pokal_report from seasons where id=$seasonId";
$result = DB::select($sql);
$pokal_report = $result[0]->pokal_report ?? 'Pokal Daten: Noch keine.';
return view ('users.pokal_report_edit', compact('pokal_report'));
}
public function store_pokal() {
$pokal_report = str_replace("'", "", request('pokal'));
$season=Season::getCurrent();
$seasonId=$season->id;
DB::update("UPDATE seasons SET pokal_report='$pokal_report' WHERE id=$seasonId;");
//return view('users.pokal_report', compact('pokal_report'));
return redirect("/users/pokal");
}
}

View file

@ -0,0 +1,33 @@
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class AddPlayoffPokalToSeason extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('season', function (Blueprint $table) {
$table->text('pokal_report',15000);
$table->text('playoff_report',15000);
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('season', function (Blueprint $table) {
//
});
}
}

View file

@ -38,6 +38,8 @@
@if (App\Season::hasGreenShirtGame())
<a style="font-weight:normal; font-color: blue; font-size: 22px;" href="/users/gshirt_ranking">Grünes Trikot</a> &nbsp;
@endif
<a style="font-weight:normal; font-color: blue; font-size: 22px;" href="/users/pokal">Pokal</a> &nbsp;
<a style="font-weight:normal; font-color: blue; font-size: 22px;" href="/users/playoff">Play-Off</a> &nbsp;
</div>
</label>
&nbsp;

View file

@ -0,0 +1,16 @@
@extends('layouts.layout')
@section('content')
<section class="text-center">
<div class="container">
<h1>PLAY-OFF</h1>
<textarea readonly name="playoff" class="form-control" style="min-height:650px;height:auto;">{{ $playoff_report }}</textarea>
</div>
@if (Auth::user()->admin)
<a style="font-weight:normal; font-color: blue; font-size: 22px;" href="/users/playoff_edit">Bearbeiten</a>
@endif
</section>
@endsection

View file

@ -0,0 +1,20 @@
@extends('layouts.layout')
@section('content')
<section class="text-center">
<div class="container">
<h1>PLAY-OFF</h1>
<form method="POST" action="/users/store_playoff" class="text-center">
{{ csrf_field() }}
<textarea name="playoff" class="form-control" style="min-height:650px;height:auto;">{{ $playoff_report }}</textarea>
<div class="form-group">
<button type="submit" class="btn btn-primary">Ok</button>
</div>
</form>
</div>
</section>
@endsection

View file

@ -0,0 +1,17 @@
@extends('layouts.layout')
@section('content')
<section class="text-center">
<div class="container">
<h1>POKAL</h1>
<textarea readonly name="pokal" class="form-control" style="min-height:650px;height:auto;">{{ $pokal_report }}</textarea>
</div>
@if (Auth::user()->admin)
<a style="font-weight:normal; font-color: blue; font-size: 22px;" href="/users/pokal_edit">Bearbeiten</a>
@endif
</section>
@endsection

View file

@ -0,0 +1,21 @@
@extends('layouts.layout')
@section('content')
<section class="text-center">
<div class="container">
<h1>POKAL</h1>
<form method="POST" action="/users/store_pokal" class="text-center">
{{ csrf_field() }}
<textarea name="pokal" class="form-control" style="min-height:650px;height:auto;">{{ $pokal_report }}</textarea>
<div class="form-group">
<button type="submit" class="btn btn-primary">Ok</button>
</div>
</form>
</div>
</section>
@endsection

View file

@ -55,6 +55,12 @@ Route::get('/users/payout','UsersController@money_ranking');
Route::get('/users/payout_with_iban','UsersController@money_ranking_with_iban');
Route::get('/users/payout/{user_id}','UsersController@money_ranking_detail');
Route::get('/users/restore/{user_id}','UsersController@restore');
Route::get('/users/playoff','UsersController@playoff_report');
Route::get('/users/pokal','UsersController@pokal_report');
Route::get('/users/playoff_edit','UsersController@playoff_report_edit');
Route::post('/users/store_playoff','UsersController@store_playoff');
Route::get('/users/pokal_edit','UsersController@pokal_report_edit');
Route::post('/users/store_pokal','UsersController@store_pokal');
Route::get('/tipps','TippsController@index');
Route::get('/tipps/joker_impossible','TippsController@joker_impossible');