Enter Round report (display for regular players still pending)
This commit is contained in:
parent
30248ae4ef
commit
09b75172d8
4 changed files with 80 additions and 31 deletions
|
|
@ -9,6 +9,7 @@ use App\Game;
|
||||||
use App\User;
|
use App\User;
|
||||||
use DB;
|
use DB;
|
||||||
use Auth;
|
use Auth;
|
||||||
|
use Log;
|
||||||
|
|
||||||
class RoundsController extends Controller
|
class RoundsController extends Controller
|
||||||
{
|
{
|
||||||
|
|
@ -107,6 +108,34 @@ class RoundsController extends Controller
|
||||||
return redirect('/rounds');
|
return redirect('/rounds');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function store_report() {
|
||||||
|
if (Auth::guest()) { return redirect("/"); }
|
||||||
|
if (!Auth::user()->admin) { return redirect("/"); }
|
||||||
|
|
||||||
|
// Validate form
|
||||||
|
$this->validate(request(), [
|
||||||
|
'round_id' => 'required',
|
||||||
|
'report' => 'required'
|
||||||
|
]);
|
||||||
|
|
||||||
|
$seasonId = Season::getCurrent()->id;
|
||||||
|
|
||||||
|
$round = Round::where('id','=',request('round_id'))->first();
|
||||||
|
|
||||||
|
//Log::info("Report = ".request("report"));
|
||||||
|
|
||||||
|
|
||||||
|
$round->report = request("report");
|
||||||
|
$round->save();
|
||||||
|
|
||||||
|
|
||||||
|
// Redirect to the home page
|
||||||
|
return redirect('/rounds');
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public function editname($round_id)
|
public function editname($round_id)
|
||||||
{
|
{
|
||||||
$round = Round::where('id', $round_id)->first();
|
$round = Round::where('id', $round_id)->first();
|
||||||
|
|
|
||||||
|
|
@ -17,6 +17,7 @@ class CreateRoundsTable extends Migration
|
||||||
$table->increments('id');
|
$table->increments('id');
|
||||||
$table->string('name',64);
|
$table->string('name',64);
|
||||||
$table->integer('season_id');
|
$table->integer('season_id');
|
||||||
|
$table->string('report',16000)->default('');
|
||||||
$table->timestamps();
|
$table->timestamps();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -4,42 +4,60 @@
|
||||||
<section class="jumbotron text-center">
|
<section class="jumbotron text-center">
|
||||||
<div class="container">
|
<div class="container">
|
||||||
|
|
||||||
|
|
||||||
<label>Saison:{{ $activeSeason->name }}</label>
|
<label>Saison:{{ $activeSeason->name }}</label>
|
||||||
|
|
||||||
<div class="lead">Runden</div>
|
<div class="lead" style="font-size: 42px;">Runden</div>
|
||||||
<div><a href="/rounds/create" class="btn btn-primary">Runde hinzufügen</a></div>
|
<div><a href="/rounds/create" class="btn btn-primary" >Runde hinzufügen</a></div>
|
||||||
<p> </p>
|
<p> </p>
|
||||||
|
|
||||||
<div>
|
|
||||||
@foreach($rounds->reverse() as $round)
|
|
||||||
<div><a class="text lead" href="/rounds/editname/{{ $round->id }}">{{ $round->name }} </a></div>
|
|
||||||
|
|
||||||
<table class="table-bordered">
|
|
||||||
<tr class="table-bordered">
|
|
||||||
<td class="table-bordered">Spiel</td>
|
|
||||||
<td class="table-bordered">Anstoss</td>
|
|
||||||
<td class="table-bordered">Ergebnis</td>
|
|
||||||
</tr>
|
|
||||||
<p> </p>
|
|
||||||
|
|
||||||
@foreach($round->games as $game)
|
|
||||||
<tr class="table-bordered">
|
|
||||||
<td> {{$game->team1 . " : " . $game->team2}} </td>
|
|
||||||
<td> {{App\User::toGermanDate($game->kickoff)}} </td>
|
|
||||||
<td><a href="/games/edit/{{$game->id}}">{{ App\Game::resultString( $game->id ) }} </a></td>
|
|
||||||
</tr>
|
|
||||||
@endforeach
|
|
||||||
|
|
||||||
</table>
|
|
||||||
<p> </p>
|
|
||||||
@endforeach
|
|
||||||
|
|
||||||
</div>
|
|
||||||
|
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div class="container">
|
||||||
|
<!-- Start Runden-Loop-->
|
||||||
|
@foreach($rounds->reverse() as $round)
|
||||||
|
<div><a class="text lead" style="font-size: 38px" href="/rounds/editname/{{ $round->id }}">{{ $round->name }} </a></div>
|
||||||
|
|
||||||
|
<table class="table-bordered">
|
||||||
|
<tr class="table-bordered">
|
||||||
|
<td class="table-bordered">Spiel</td>
|
||||||
|
<td class="table-bordered">Anstoss</td>
|
||||||
|
<td class="table-bordered">Ergebnis</td>
|
||||||
|
</tr>
|
||||||
|
<p> </p>
|
||||||
|
@foreach($round->games as $game)
|
||||||
|
<tr class="table-bordered">
|
||||||
|
<td> {{$game->team1 . " : " . $game->team2}} </td>
|
||||||
|
<td> {{App\User::toGermanDate($game->kickoff)}} </td>
|
||||||
|
<td><a href="/games/edit/{{$game->id}}">{{ App\Game::resultString( $game->id ) }} </a></td>
|
||||||
|
</tr>
|
||||||
|
@endforeach
|
||||||
|
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
<div class="container-fluid" style="width:800px;">
|
||||||
|
<p>! </p>
|
||||||
|
|
||||||
|
|
||||||
|
<p>Berichterstattung</p>
|
||||||
|
|
||||||
|
|
||||||
|
<form method="POST" action="/rounds/store_report" class="text-center">
|
||||||
|
{{ csrf_field() }}
|
||||||
|
|
||||||
|
<textarea name="report" class="form-control" style="min-height:150px;height:auto;">{{ $round->report }}</textarea>
|
||||||
|
<input type="hidden" name="round_id" value="{{ $round->id }}">
|
||||||
|
|
||||||
|
<p></p>
|
||||||
|
<div class="form-group">
|
||||||
|
<button type="submit" class="btn btn-primary">Ok</button>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
|
||||||
|
<p> </p>
|
||||||
|
@endforeach
|
||||||
|
</div>
|
||||||
|
|
||||||
</section>
|
</section>
|
||||||
@endsection
|
@endsection
|
||||||
|
|
|
||||||
|
|
@ -30,6 +30,7 @@ Route::get('/seasons/setcurrent/{new_season_id}','SeasonsController@setcurrent')
|
||||||
Route::get('/rounds','RoundsController@index');
|
Route::get('/rounds','RoundsController@index');
|
||||||
Route::get('/rounds/create','RoundsController@create');
|
Route::get('/rounds/create','RoundsController@create');
|
||||||
Route::post('/rounds/store','RoundsController@store');
|
Route::post('/rounds/store','RoundsController@store');
|
||||||
|
Route::post('/rounds/store_report','RoundsController@store_report');
|
||||||
|
|
||||||
Route::get('/rounds/editname/{round_id}','RoundsController@editname');
|
Route::get('/rounds/editname/{round_id}','RoundsController@editname');
|
||||||
Route::post('/rounds/storename', 'RoundsController@storename');
|
Route::post('/rounds/storename', 'RoundsController@storename');
|
||||||
|
|
@ -46,4 +47,4 @@ Route::get('/users/ranking/{round_id}','UsersController@ranking');
|
||||||
|
|
||||||
Route::get('/tipps','TippsController@index');
|
Route::get('/tipps','TippsController@index');
|
||||||
Route::get('/tipps/edit/{tipp_id}','TippsController@edit');
|
Route::get('/tipps/edit/{tipp_id}','TippsController@edit');
|
||||||
Route::post('/tipps/store','TippsController@store');
|
Route::post('/tipps/store','TippsController@store');
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue