renewd grapper wip
This commit is contained in:
1 parent
8f1aeafe46
commit
4afe60a957
55 files changed
+1389
-823
No files matched your search
@@ -25,6 +25,7 @@ use App\Models\EventUserStar;
|
||||
use App\Models\Group;
|
||||
use App\Models\MultilineClient;
|
||||
use App\Models\Sport;
|
||||
use App\Models\User;
|
||||
use CodeWithKyrian\FilamentDateRange\Forms\Components\DateRangePicker;
|
||||
use Filament\Actions\Action;
|
||||
use Filament\Actions\ActionGroup;
|
||||
@@ -33,7 +34,6 @@ use Filament\Actions\DeleteAction;
|
||||
use Filament\Actions\DeleteBulkAction;
|
||||
use Filament\Actions\EditAction;
|
||||
use Filament\Forms\Components\Select;
|
||||
use Filament\Schemas\Components\Icon;
|
||||
use Filament\Schemas\Components\Utilities\Get;
|
||||
use Filament\Support\Enums\FontWeight;
|
||||
use Filament\Support\Enums\VerticalAlignment;
|
||||
@@ -54,10 +54,6 @@ class EventsTable
|
||||
|
||||
public static $multiline_gettype = [];
|
||||
|
||||
protected $listeners = [
|
||||
'example' => '$refresh',
|
||||
];
|
||||
|
||||
public static function load_multiline_bookmaker()
|
||||
{
|
||||
$res = MultilineClient::with('multiline_setting')
|
||||
@@ -100,7 +96,6 @@ class EventsTable
|
||||
IconColumn::make('sport.icon')
|
||||
->label('')
|
||||
->grow(false)
|
||||
->color('primary')
|
||||
->width(30)
|
||||
->icon(fn ($record) => $record->sport->icon)
|
||||
->tooltip(fn ($record) => $record->id)
|
||||
@@ -222,22 +217,26 @@ class EventsTable
|
||||
->columns(9)->columnSpan(9)
|
||||
->schema([
|
||||
Select::make(name: 'sport_id')
|
||||
->beforeContent(Icon::make(fn () => auth()->user()->sport->icon))
|
||||
->placeholder('Sport')
|
||||
->default(auth()->user()->id)
|
||||
->prefixIcon(auth()->user()->sport->icon)
|
||||
->selectablePlaceholder(false)
|
||||
->hiddenLabel()
|
||||
->label('')
|
||||
->multiple()
|
||||
->searchable()
|
||||
->preload()
|
||||
->options(function () {
|
||||
return Sport::query()->where('is_active', 1)->pluck('name', 'id');
|
||||
})
|
||||
->live()
|
||||
->reactive()
|
||||
->afterStateUpdated(function (callable $set) {
|
||||
->afterStateUpdated(function (callable $set, $state, $livewire) {
|
||||
|
||||
User::where('id', auth()->user()->id)->update(['sport_id' => $state]);
|
||||
|
||||
$livewire->dispatch('refreshBettypeMenu');
|
||||
|
||||
$set('country_id', null);
|
||||
$set('competition_group_id', null);
|
||||
$set('group_id', null);
|
||||
|
||||
}),
|
||||
Select::make(name: 'country_id')
|
||||
->columnSpan(2)
|
||||
@@ -248,8 +247,8 @@ class EventsTable
|
||||
->multiple()
|
||||
->searchable()
|
||||
->preload()
|
||||
->options(function () {
|
||||
$res = Event::query()->where('starttime', '>', Carbon::now())->groupBy('country_id')->pluck('country_id')->toArray();
|
||||
->options(function (Get $get) {
|
||||
$res = Event::where('sport_id', $get('sport_id'))->where('starttime', '>', Carbon::now())->groupBy('country_id')->pluck('country_id')->toArray();
|
||||
|
||||
return Country::query()->whereIn('id', $res)->pluck('name', 'id');
|
||||
})
|
||||
@@ -268,9 +267,9 @@ class EventsTable
|
||||
->searchable()
|
||||
->options(function (Get $get) {
|
||||
if ($get('country_id')) {
|
||||
$res = Event::with('country')->with('competition_group')->where('country_id', $get('country_id'))->where('starttime', '>', Carbon::now())->groupBy('competition_group_id')->get();
|
||||
$res = Event::where('sport_id', $get('sport_id'))->with('country')->with('competition_group')->where('country_id', $get('country_id'))->where('starttime', '>', Carbon::now())->groupBy('competition_group_id')->get();
|
||||
} else {
|
||||
$res = Event::with('country')->with('competition_group')->where('starttime', '>', Carbon::now())->groupBy('competition_group_id')->get();
|
||||
$res = Event::where('sport_id', $get('sport_id'))->with('country')->with('competition_group')->where('starttime', '>', Carbon::now())->groupBy('competition_group_id')->get();
|
||||
}
|
||||
$arr = [];
|
||||
foreach ($res as $val) {
|
||||
@@ -318,6 +317,10 @@ class EventsTable
|
||||
auth()->user()->stars,
|
||||
fn (Builder $query) => $query->whereHas('event_user_star')
|
||||
)
|
||||
->when(
|
||||
$data['sport_id'],
|
||||
fn (Builder $query, $sport_id) => $query->where('sport_id', $sport_id)
|
||||
)
|
||||
->when(
|
||||
$data['country_id'],
|
||||
fn (Builder $query, $country_id) => $query->where('country_id', $country_id)
|
||||
|
||||
Reference in new issue
Block a user