Final Roundmail system, show users with missing tips/jokers in playerlist as well.

This commit is contained in:
Torsten 2017-08-24 11:47:16 +02:00
parent 6d7ee1a47c
commit 70e28110cb
19 changed files with 3700 additions and 66 deletions

View file

@ -10,7 +10,7 @@ use App\Round;
use App\Game;
use App\Tipp;
use App\Quota;
use App\Mail\Roundmail;
use App\Mail\RoundmailMailer;
use DB;
use Auth;
@ -24,6 +24,9 @@ class UsersController extends Controller
$roundname="";
$report="";
$result=User::hasMissingJoker(1);
Log::info("!!! =>".$result);
if (!$result) { Log::info("Joker is missing");}
$currentSeason=Season::getCurrent();
$display_rounds=array();
@ -51,19 +54,42 @@ class UsersController extends Controller
if (Auth::guest()) { return redirect("/"); }
if (!Auth::user()->admin) { return redirect("/"); }
$currentSeason=Season::getCurrent();
$active_user_count = sizeof( DB::table('payments')->where('season_id',$currentSeason->id)->whereNotNull('paid_date')->get() );
$total_user_count = sizeof( DB::table('payments')->where('season_id',$currentSeason->id)->get() );
$users = DB::table('users')->where('deleted',null)->orderBy('lastname')->get();
foreach($users as $user) {
Log::info($user->id);
foreach($users as $key => $user) {
// Log::info($users[0]->id);
// Log::info($key);
// Log::info($user->id);
//
// Log::info("------------------------------");
if (User::hasMissingTipp($user->id)) {
$users[$key]->missingTippText="Tipps fehlen";
$users[$key]->tippStyling="red";
} else {
$users[$key]->missingTippText="Runde getippt";
$users[$key]->tippStyling="green";
}
if (User::hasMissingJoker($user->id)) {
$users[$key]->missingJokerText="Joker fehlt";
$users[$key]->jokerStyling="red";
} else {
$users[$key]->missingJokerText="Joker gesetzt";
$users[$key]->jokerStyling="green";
}
}
return view('users.index', compact('users','active_user_count'));
return view('users.index', compact('users','active_user_count','total_user_count'));
}
/*
public function showUsers() {
@ -124,6 +150,8 @@ class UsersController extends Controller
Payment::set_payment_date(request('id'), $season_id, request('paid'));
Tipp::createAllTips();
return redirect('/users');
}
@ -406,12 +434,12 @@ class UsersController extends Controller
public function mailtest() {
// Works:
// $user = User::where('id','=',1)->first();
// \Mail::to($user)->send(new Roundmail);
// \Mail::to($user)->send(new RoundmailMailer);
$users = User::whereIn('id',array(1,2,7,57))->get();
$users = User::whereIn('id',array(1))->get();
foreach($users as $user) {
Log::info("Sending Roundmail to: ".$user->name);
\Mail::to($user)->send(new Roundmail);
Log::info("Sending RoundmailMailer to: ".$user->name);
\Mail::to($user)->send(new RoundmailMailer);
}
}