diff --git a/pfosten/app/Http/Controllers/RoundmailController.php b/pfosten/app/Http/Controllers/RoundmailController.php index 14f97ded..8f800869 100644 --- a/pfosten/app/Http/Controllers/RoundmailController.php +++ b/pfosten/app/Http/Controllers/RoundmailController.php @@ -4,6 +4,7 @@ namespace App\Http\Controllers; use App\Roundmail; use App\User; +use App\Round; use Illuminate\Http\Request; use App\Mail\RoundmailMailer; @@ -98,7 +99,7 @@ class RoundmailController extends Controller $missingJokerMailList = implode(",",$missingJokerMailList); $adminMailList = implode(",",$adminMailList); - + $tippSpielLink="http://hoschis-tippspiel.de/tipps#".Round::getFirstTippableRound()->id; $topic=""; $mail_message=""; @@ -118,7 +119,7 @@ class RoundmailController extends Controller - return view('roundmails.show',compact('mail_id','activeMailList','inactiveMailList','missingTippMailList','missingJokerMailList','adminMailList','send_date','user_id','topic', 'mail_message', 'recipients', 'sender_name','viewmode')); + return view('roundmails.show',compact('mail_id','activeMailList','inactiveMailList','missingTippMailList','missingJokerMailList','adminMailList','send_date','user_id','topic', 'mail_message', 'recipients', 'sender_name','viewmode','tippSpielLink')); } @@ -189,4 +190,7 @@ class RoundmailController extends Controller } + public function checkReminder() { + Log::info("RoundmailController::checkReminder was triggered"); + } } diff --git a/pfosten/app/Http/Controllers/TippsController.php b/pfosten/app/Http/Controllers/TippsController.php index bb3f1141..ed9ba8d7 100755 --- a/pfosten/app/Http/Controllers/TippsController.php +++ b/pfosten/app/Http/Controllers/TippsController.php @@ -23,7 +23,6 @@ class TippsController extends Controller $rounds = Round::all()->where('season_id', '=', $activeSeason->id); foreach($rounds as $round) { - $games=Game::all()->where('round_id','=',$round->id); foreach($games as $game) { @@ -74,14 +73,9 @@ class TippsController extends Controller TippsController::createTipps($user->id); // ggfs. fehlender Tipp Eintraege einfügen + $lastLockedRoundId=Round::getLastLockedRoundId(); - if ($activeSeason) { - $activeSeasonId = Season::getCurrent()->id; - $rounds = Round::all()->where('season_id', '=', $activeSeasonId); - } - - - Log::info("REDIRECTING to TIPPS index"); + $rounds = Round::where('season_id', '=', $activeSeason->id)->get(); return view('tipps.index', compact('rounds', 'activeSeason', 'user')); } diff --git a/pfosten/app/Http/Controllers/UsersController.php b/pfosten/app/Http/Controllers/UsersController.php index 7b2c9a42..5d1f64ec 100755 --- a/pfosten/app/Http/Controllers/UsersController.php +++ b/pfosten/app/Http/Controllers/UsersController.php @@ -18,8 +18,6 @@ use Illuminate\Contracts\Auth\Guard; use Illuminate\Foundation\Auth\ResetsPasswords; use Illuminate\Auth\Passwords\PasswordBroker; - - use DB; use Auth; use Log; @@ -53,8 +51,9 @@ class UsersController extends Controller } else {Log::info("No current season");} $nextRoundName=""; - $nextRoundId = Round::getFirstIncompleteRound(); - if ($nextRoundId>-1) { $nextRoundName = Round::where('id','=',$nextRoundId)->first()->name; } + $nextRound = Round::getFirstTippableRound(); + + if ($nextRound) { $nextRoundName = $nextRound->name; } $user=Auth::user(); $message_text_tipps=""; @@ -134,10 +133,7 @@ class UsersController extends Controller $paid_date_str=""; $val=User::payment_date($user_id, $season_id); - Log::info("UserController:edit => payment_date=".$val); - if ($val) { $paid_date_str=User::toGermanDate($val);} - Log::info("German Date=".$paid_date_str); return view ('users.edit', compact('user','paid_date_str')); } @@ -489,4 +485,22 @@ class UsersController extends Controller ); } + //route: useredit => useredit view + public function useredit($user_id) { + if (Auth::guest()) { return redirect("/"); } + + $user=Auth::user(); + + $paid_date_str=""; + $val=User::payment_date($user_id, Season::getCurrent()->id); + if ($val) { $paid_date_str=User::toGermanDate($val);} + + return view ('users.useredit', compact('user','paid_date_str')); + } + + public function send_reset_links_from_settings() { + if (Auth::guest()) { return redirect("/"); } + $this->sendResetLink(Auth::user()); + } + } diff --git a/pfosten/app/Round.php b/pfosten/app/Round.php index a1e200b0..46930678 100755 --- a/pfosten/app/Round.php +++ b/pfosten/app/Round.php @@ -66,6 +66,8 @@ class Round extends Model return -1; } + + public static function getLastLockedRoundId() { $season = Season::getCurrent(); $rounds=Round::where('season_id','=',$season->id)->orderBy('id')->get(); @@ -78,6 +80,18 @@ class Round extends Model return $lastLockedRoundId; } + public static function getFirstTippableRound() { + $season = Season::getCurrent(); + $rounds=Round::where('season_id','=',$season->id)->orderBy('id')->get(); + $locked = false; + foreach ($rounds as $round) { + if (!Round::hasLockedGame($round->id) ) { + return $round; + } + } + return null; + } + public static function getClosestRoundToNow() { $sql="select round_id,DATEDIFF(NOW(),kickoff) from games order by 2 desc limit 1;"; $result=DB::select($sql); diff --git a/pfosten/app/Tipp.php b/pfosten/app/Tipp.php index ca6926ed..0aef870c 100755 --- a/pfosten/app/Tipp.php +++ b/pfosten/app/Tipp.php @@ -191,7 +191,6 @@ class Tipp extends Model ['user_id','=',$user_id]] )->first(); if (! $tipp) { - Log::info('Creating missing tip: game_id=' . $game->id . ", user_id=" . $user->id); $tipp=Tipp::create([ 'user_id' => $user_id, 'game_id'=> $game->id, diff --git a/pfosten/app/User.php b/pfosten/app/User.php index bf8dabff..3f5cdfee 100644 --- a/pfosten/app/User.php +++ b/pfosten/app/User.php @@ -131,7 +131,7 @@ class User extends Authenticatable } public static function hasMissingTipp($user_id) { - $round_id = Round::getFirstIncompleteRound(); + $round_id = Round::getFirstTippableRound()->id; $games = Game::where('round_id','=',$round_id)->get(); foreach ($games as $game) { @@ -146,8 +146,7 @@ class User extends Authenticatable } public static function hasMissingJoker($user_id) { - $round_id = Round::getFirstIncompleteRound(); - //Log::info("round_id for jokercheck=".$round_id); + $round_id = Round::getFirstTippableRound()->id; $games = Game::where('round_id','=',$round_id." user_id=".$user_id)->get(); $joker=0; foreach ($games as $game) { diff --git a/pfosten/config/mail.php b/pfosten/config/mail.php index 13b67247..7e6c082c 100644 --- a/pfosten/config/mail.php +++ b/pfosten/config/mail.php @@ -16,8 +16,8 @@ return [ | */ - //'driver' => env('MAIL_DRIVER', 'smtp'), - 'driver' => env('MAIL_DRIVER', 'log'), + 'driver' => env('MAIL_DRIVER', 'smtp'), + //'driver' => env('MAIL_DRIVER', 'log'), diff --git a/pfosten/resources/views/layouts/nav.blade.php b/pfosten/resources/views/layouts/nav.blade.php index 53641f8e..8b26b03e 100644 --- a/pfosten/resources/views/layouts/nav.blade.php +++ b/pfosten/resources/views/layouts/nav.blade.php @@ -13,10 +13,10 @@ Rundmail @endif Quoten - Tipps + Tipps Rangliste - (abmelden) + (abmelden) @endif diff --git a/pfosten/resources/views/roundmails/show.blade.php b/pfosten/resources/views/roundmails/show.blade.php index cce62216..a9e95d3c 100644 --- a/pfosten/resources/views/roundmails/show.blade.php +++ b/pfosten/resources/views/roundmails/show.blade.php @@ -43,13 +43,14 @@ - - - - - - - +
@@ -96,6 +97,11 @@ var elem = document.getElementById("recipients"); elem.innerHTML = "{{ $missingJokerMailList }}"; } + function setTippLink() + { + var elem = document.getElementById("message"); + elem.innerHTML += "Link zur Tippseite: {{ $tippSpielLink }}"; + } diff --git a/pfosten/resources/views/sessions/create.blade.php b/pfosten/resources/views/sessions/create.blade.php index 7afabf49..95b3e492 100644 --- a/pfosten/resources/views/sessions/create.blade.php +++ b/pfosten/resources/views/sessions/create.blade.php @@ -21,6 +21,9 @@