bettypes switch comparatore
This commit is contained in:
1 parent
bb71c4b406
commit
3fb481afd0
11 files changed
+278
-53
No files matched your search
@@ -53,6 +53,7 @@ class EventResource extends Resource
|
|||||||
|
|
||||||
public static function getEloquentQuery(): Builder
|
public static function getEloquentQuery(): Builder
|
||||||
{
|
{
|
||||||
|
|
||||||
return parent::getEloquentQuery()
|
return parent::getEloquentQuery()
|
||||||
->where('starttime', '>', Carbon::now())
|
->where('starttime', '>', Carbon::now())
|
||||||
->where('sport_id', auth()->user()->sport_id);
|
->where('sport_id', auth()->user()->sport_id);
|
||||||
|
|||||||
@@ -3,28 +3,36 @@
|
|||||||
namespace App\Filament\Resources\Events\Tables;
|
namespace App\Filament\Resources\Events\Tables;
|
||||||
|
|
||||||
use App\Filament\Tables\Columns\Odds3Way;
|
use App\Filament\Tables\Columns\Odds3Way;
|
||||||
|
use App\Models\Client;
|
||||||
|
use App\Models\CompetitionGroup;
|
||||||
|
use App\Models\Sport;
|
||||||
|
use App\Models\User;
|
||||||
use Carbon\Carbon;
|
use Carbon\Carbon;
|
||||||
use Filament\Actions\BulkActionGroup;
|
use Filament\Actions\BulkActionGroup;
|
||||||
use Filament\Actions\DeleteAction;
|
use Filament\Actions\DeleteAction;
|
||||||
use Filament\Actions\DeleteBulkAction;
|
use Filament\Actions\DeleteBulkAction;
|
||||||
use Filament\Actions\EditAction;
|
use Filament\Actions\EditAction;
|
||||||
|
use Filament\Forms\Components\Select;
|
||||||
|
use Filament\Schemas\Components\Utilities\Get;
|
||||||
use Filament\Support\Enums\FontWeight;
|
use Filament\Support\Enums\FontWeight;
|
||||||
use Filament\Support\Enums\IconSize;
|
use Filament\Support\Enums\IconSize;
|
||||||
use Filament\Tables\Columns\IconColumn;
|
use Filament\Tables\Columns\IconColumn;
|
||||||
use Filament\Tables\Columns\TextColumn;
|
use Filament\Tables\Columns\TextColumn;
|
||||||
use Filament\Tables\Enums\FiltersLayout;
|
use Filament\Tables\Enums\FiltersLayout;
|
||||||
use Filament\Tables\Filters\SelectFilter;
|
use Filament\Tables\Filters\Filter;
|
||||||
use Filament\Tables\Table;
|
use Filament\Tables\Table;
|
||||||
use Illuminate\Database\Eloquent\Builder;
|
use Illuminate\Database\Eloquent\Builder;
|
||||||
|
|
||||||
class EventsTable
|
class EventsTable
|
||||||
{
|
{
|
||||||
public static $bettype = '1x2';
|
protected $listeners = [
|
||||||
|
'bettypeswitch' => '$refresh',
|
||||||
|
];
|
||||||
|
|
||||||
public static function configure(Table $table): Table
|
public static function configure(Table $table): Table
|
||||||
{
|
{
|
||||||
return $table
|
return $table
|
||||||
->poll('10s')
|
// ->poll('10s')
|
||||||
->striped()
|
->striped()
|
||||||
->columns([
|
->columns([
|
||||||
IconColumn::make('sport.icon')
|
IconColumn::make('sport.icon')
|
||||||
@@ -53,18 +61,41 @@ class EventsTable
|
|||||||
->defaultSort('starttime', 'ASC')
|
->defaultSort('starttime', 'ASC')
|
||||||
->deferFilters(false)
|
->deferFilters(false)
|
||||||
->filters([
|
->filters([
|
||||||
SelectFilter::make('sport_id')
|
Filter::make('event')
|
||||||
->label('Sport')
|
->form([
|
||||||
->default(1)
|
Select::make('sport_id')
|
||||||
->selectablePlaceholder(false)
|
->label('Sport')
|
||||||
->relationship('sport', 'name', fn (Builder $query) => $query->where('is_active', 1))
|
->default(1)
|
||||||
->preload(),
|
->options(function () {
|
||||||
// SelectFilter::make('competition_group_id')
|
$sports = Client::where('id', auth()->user()->client_id)->pluck('sport')->first();
|
||||||
// ->label('Tornament')
|
|
||||||
// ->options(fn () => Event::where('is_active', 1)->pluck('sport', 'id')
|
return Sport::query()->whereIn('id', $sports)->pluck('name', 'id');
|
||||||
// ->relationship('sport', 'name', fn (Builder $query) => $query->where('is_active', 1))
|
})
|
||||||
// ->preload(),
|
->afterStateUpdated(function ($state) {
|
||||||
], FiltersLayout::AboveContent)
|
|
||||||
|
User::where('id', auth()->user()->id)->update(['sport_id' => $state]);
|
||||||
|
}),
|
||||||
|
Select::make('competition_group_id')
|
||||||
|
->label('League')
|
||||||
|
->default(1)
|
||||||
|
->options(function (Get $get) {
|
||||||
|
return CompetitionGroup::where('sport_id', $get('sport_id'))->pluck('name', 'id');
|
||||||
|
})
|
||||||
|
->live(),
|
||||||
|
])
|
||||||
|
->query(function (Builder $query, array $data): Builder {
|
||||||
|
|
||||||
|
return $query
|
||||||
|
->when(
|
||||||
|
$data['sport_id'],
|
||||||
|
fn (Builder $query, $sport_id) => $query->where('sport_id', $sport_id)
|
||||||
|
)->when(
|
||||||
|
$data['competition_group_id'],
|
||||||
|
fn (Builder $query, $competition_group_id) => $query->where('competition_group_id', $competition_group_id)
|
||||||
|
);
|
||||||
|
})
|
||||||
|
->columns(3)->columnSpan(3),
|
||||||
|
], layout: FiltersLayout::AboveContent)
|
||||||
->hiddenFilterIndicators(false)
|
->hiddenFilterIndicators(false)
|
||||||
->persistFiltersInSession()
|
->persistFiltersInSession()
|
||||||
->recordActions([
|
->recordActions([
|
||||||
|
|||||||
@@ -47,7 +47,7 @@ class MultilineClientsTable
|
|||||||
->defaultSort('sort')
|
->defaultSort('sort')
|
||||||
->deferFilters(false)
|
->deferFilters(false)
|
||||||
->filters([
|
->filters([
|
||||||
Filter::make('ligafilter')
|
Filter::make('multilineclient')
|
||||||
->form([
|
->form([
|
||||||
Select::make('sport_id')
|
Select::make('sport_id')
|
||||||
->label('Sport')
|
->label('Sport')
|
||||||
|
|||||||
@@ -0,0 +1,53 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Livewire;
|
||||||
|
|
||||||
|
use App\Models\MultilineSetting;
|
||||||
|
use App\Models\MultilineUser;
|
||||||
|
use Livewire\Component;
|
||||||
|
|
||||||
|
class MonitorBettypeSwitch extends Component
|
||||||
|
{
|
||||||
|
public $multilines = [];
|
||||||
|
|
||||||
|
public function mount()
|
||||||
|
{
|
||||||
|
$settings = MultilineSetting::where('sport_id', auth()->user()->sport_id)->get();
|
||||||
|
|
||||||
|
$multiline_setting_id = MultilineUser::where('user_id', auth()->user()->id)->where('sport_id', auth()->user()->sport_id)->pluck('multiline_setting_id')->first();
|
||||||
|
|
||||||
|
if (! $multiline_setting_id) {
|
||||||
|
$multiline_setting_id = MultilineSetting::where('sport_id', auth()->user()->sport_id)->pluck('id')->first();
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->multilines = [];
|
||||||
|
|
||||||
|
foreach ($settings as $setting) {
|
||||||
|
|
||||||
|
$this->multilines[] = [
|
||||||
|
'id' => $setting->id,
|
||||||
|
'sport_id' => $setting->sport_id,
|
||||||
|
'name' => $setting->name,
|
||||||
|
'short' => $setting->short,
|
||||||
|
'table' => $setting->table,
|
||||||
|
'is_active' => $setting->id == $multiline_setting_id ? 1 : 0,
|
||||||
|
];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public function render()
|
||||||
|
{
|
||||||
|
return view('livewire.monitor-bettype-switch');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function swop($multiline_setting_id)
|
||||||
|
{
|
||||||
|
|
||||||
|
MultilineUser::updateOrCreate(
|
||||||
|
['user_id' => auth()->user()->id, 'sport_id' => auth()->user()->sport_id],
|
||||||
|
['multiline_setting_id' => $multiline_setting_id]
|
||||||
|
);
|
||||||
|
|
||||||
|
$this->js('window.location.reload()');
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -50,11 +50,6 @@ class User extends Authenticatable implements FilamentUser, HasAppAuthentication
|
|||||||
'app_authentication_recovery_codes',
|
'app_authentication_recovery_codes',
|
||||||
];
|
];
|
||||||
|
|
||||||
public function multiline_user()
|
|
||||||
{
|
|
||||||
return $this->belongsTo(MultilineUser::class);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the attributes that should be cast.
|
* Get the attributes that should be cast.
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -11,7 +11,6 @@ use Filament\Tables\View\TablesRenderHook;
|
|||||||
use Filament\View\PanelsRenderHook;
|
use Filament\View\PanelsRenderHook;
|
||||||
use Illuminate\Support\Facades\Blade;
|
use Illuminate\Support\Facades\Blade;
|
||||||
use Illuminate\Support\ServiceProvider;
|
use Illuminate\Support\ServiceProvider;
|
||||||
use Illuminate\View\View;
|
|
||||||
|
|
||||||
class AppServiceProvider extends ServiceProvider
|
class AppServiceProvider extends ServiceProvider
|
||||||
{
|
{
|
||||||
@@ -30,7 +29,7 @@ class AppServiceProvider extends ServiceProvider
|
|||||||
{
|
{
|
||||||
FilamentView::registerRenderHook(
|
FilamentView::registerRenderHook(
|
||||||
TablesRenderHook::TOOLBAR_SEARCH_AFTER,
|
TablesRenderHook::TOOLBAR_SEARCH_AFTER,
|
||||||
fn (): View => view('filament.hooks.table-bettype-filters'),
|
fn (): string => Blade::render('@livewire(\'monitor-bettype-switch\')'),
|
||||||
scopes: [
|
scopes: [
|
||||||
ListEvents::class,
|
ListEvents::class,
|
||||||
]
|
]
|
||||||
|
|||||||
@@ -21,6 +21,7 @@
|
|||||||
"swisnl/filament-backgrounds": "^2.0"
|
"swisnl/filament-backgrounds": "^2.0"
|
||||||
},
|
},
|
||||||
"require-dev": {
|
"require-dev": {
|
||||||
|
"barryvdh/laravel-debugbar": "^3.16",
|
||||||
"fakerphp/faker": "^1.23",
|
"fakerphp/faker": "^1.23",
|
||||||
"filament/upgrade": "^4.0",
|
"filament/upgrade": "^4.0",
|
||||||
"laravel/pail": "^1.2.2",
|
"laravel/pail": "^1.2.2",
|
||||||
|
|||||||
Generated
+159
-1
@@ -4,7 +4,7 @@
|
|||||||
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
|
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
|
||||||
"This file is @generated automatically"
|
"This file is @generated automatically"
|
||||||
],
|
],
|
||||||
"content-hash": "a0295c6180844fb41e7aa201bd8e3cb1",
|
"content-hash": "45deaaab620ed1b3c5cfc7c74d900c94",
|
||||||
"packages": [
|
"packages": [
|
||||||
{
|
{
|
||||||
"name": "anourvalar/eloquent-serialize",
|
"name": "anourvalar/eloquent-serialize",
|
||||||
@@ -8884,6 +8884,91 @@
|
|||||||
}
|
}
|
||||||
],
|
],
|
||||||
"packages-dev": [
|
"packages-dev": [
|
||||||
|
{
|
||||||
|
"name": "barryvdh/laravel-debugbar",
|
||||||
|
"version": "v3.16.1",
|
||||||
|
"source": {
|
||||||
|
"type": "git",
|
||||||
|
"url": "https://github.com/barryvdh/laravel-debugbar.git",
|
||||||
|
"reference": "21b2c6fce05453efd4bceb34f9fddaa1cdb44090"
|
||||||
|
},
|
||||||
|
"dist": {
|
||||||
|
"type": "zip",
|
||||||
|
"url": "https://api.github.com/repos/barryvdh/laravel-debugbar/zipball/21b2c6fce05453efd4bceb34f9fddaa1cdb44090",
|
||||||
|
"reference": "21b2c6fce05453efd4bceb34f9fddaa1cdb44090",
|
||||||
|
"shasum": ""
|
||||||
|
},
|
||||||
|
"require": {
|
||||||
|
"illuminate/routing": "^10|^11|^12",
|
||||||
|
"illuminate/session": "^10|^11|^12",
|
||||||
|
"illuminate/support": "^10|^11|^12",
|
||||||
|
"php": "^8.1",
|
||||||
|
"php-debugbar/php-debugbar": "^2.2.4",
|
||||||
|
"symfony/finder": "^6|^7"
|
||||||
|
},
|
||||||
|
"require-dev": {
|
||||||
|
"mockery/mockery": "^1.3.3",
|
||||||
|
"orchestra/testbench-dusk": "^7|^8|^9|^10",
|
||||||
|
"phpunit/phpunit": "^9.5.10|^10|^11",
|
||||||
|
"squizlabs/php_codesniffer": "^3.5"
|
||||||
|
},
|
||||||
|
"type": "library",
|
||||||
|
"extra": {
|
||||||
|
"laravel": {
|
||||||
|
"aliases": {
|
||||||
|
"Debugbar": "Barryvdh\\Debugbar\\Facades\\Debugbar"
|
||||||
|
},
|
||||||
|
"providers": [
|
||||||
|
"Barryvdh\\Debugbar\\ServiceProvider"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"branch-alias": {
|
||||||
|
"dev-master": "3.16-dev"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"autoload": {
|
||||||
|
"files": [
|
||||||
|
"src/helpers.php"
|
||||||
|
],
|
||||||
|
"psr-4": {
|
||||||
|
"Barryvdh\\Debugbar\\": "src/"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"notification-url": "https://packagist.org/downloads/",
|
||||||
|
"license": [
|
||||||
|
"MIT"
|
||||||
|
],
|
||||||
|
"authors": [
|
||||||
|
{
|
||||||
|
"name": "Barry vd. Heuvel",
|
||||||
|
"email": "barryvdh@gmail.com"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"description": "PHP Debugbar integration for Laravel",
|
||||||
|
"keywords": [
|
||||||
|
"debug",
|
||||||
|
"debugbar",
|
||||||
|
"dev",
|
||||||
|
"laravel",
|
||||||
|
"profiler",
|
||||||
|
"webprofiler"
|
||||||
|
],
|
||||||
|
"support": {
|
||||||
|
"issues": "https://github.com/barryvdh/laravel-debugbar/issues",
|
||||||
|
"source": "https://github.com/barryvdh/laravel-debugbar/tree/v3.16.1"
|
||||||
|
},
|
||||||
|
"funding": [
|
||||||
|
{
|
||||||
|
"url": "https://fruitcake.nl",
|
||||||
|
"type": "custom"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"url": "https://github.com/barryvdh",
|
||||||
|
"type": "github"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"time": "2025-11-19T08:31:25+00:00"
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"name": "brianium/paratest",
|
"name": "brianium/paratest",
|
||||||
"version": "v7.8.4",
|
"version": "v7.8.4",
|
||||||
@@ -10345,6 +10430,79 @@
|
|||||||
},
|
},
|
||||||
"time": "2022-02-21T01:04:05+00:00"
|
"time": "2022-02-21T01:04:05+00:00"
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"name": "php-debugbar/php-debugbar",
|
||||||
|
"version": "v2.2.4",
|
||||||
|
"source": {
|
||||||
|
"type": "git",
|
||||||
|
"url": "https://github.com/php-debugbar/php-debugbar.git",
|
||||||
|
"reference": "3146d04671f51f69ffec2a4207ac3bdcf13a9f35"
|
||||||
|
},
|
||||||
|
"dist": {
|
||||||
|
"type": "zip",
|
||||||
|
"url": "https://api.github.com/repos/php-debugbar/php-debugbar/zipball/3146d04671f51f69ffec2a4207ac3bdcf13a9f35",
|
||||||
|
"reference": "3146d04671f51f69ffec2a4207ac3bdcf13a9f35",
|
||||||
|
"shasum": ""
|
||||||
|
},
|
||||||
|
"require": {
|
||||||
|
"php": "^8",
|
||||||
|
"psr/log": "^1|^2|^3",
|
||||||
|
"symfony/var-dumper": "^4|^5|^6|^7"
|
||||||
|
},
|
||||||
|
"replace": {
|
||||||
|
"maximebf/debugbar": "self.version"
|
||||||
|
},
|
||||||
|
"require-dev": {
|
||||||
|
"dbrekelmans/bdi": "^1",
|
||||||
|
"phpunit/phpunit": "^8|^9",
|
||||||
|
"symfony/panther": "^1|^2.1",
|
||||||
|
"twig/twig": "^1.38|^2.7|^3.0"
|
||||||
|
},
|
||||||
|
"suggest": {
|
||||||
|
"kriswallsmith/assetic": "The best way to manage assets",
|
||||||
|
"monolog/monolog": "Log using Monolog",
|
||||||
|
"predis/predis": "Redis storage"
|
||||||
|
},
|
||||||
|
"type": "library",
|
||||||
|
"extra": {
|
||||||
|
"branch-alias": {
|
||||||
|
"dev-master": "2.1-dev"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"autoload": {
|
||||||
|
"psr-4": {
|
||||||
|
"DebugBar\\": "src/DebugBar/"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"notification-url": "https://packagist.org/downloads/",
|
||||||
|
"license": [
|
||||||
|
"MIT"
|
||||||
|
],
|
||||||
|
"authors": [
|
||||||
|
{
|
||||||
|
"name": "Maxime Bouroumeau-Fuseau",
|
||||||
|
"email": "maxime.bouroumeau@gmail.com",
|
||||||
|
"homepage": "http://maximebf.com"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Barry vd. Heuvel",
|
||||||
|
"email": "barryvdh@gmail.com"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"description": "Debug bar in the browser for php application",
|
||||||
|
"homepage": "https://github.com/php-debugbar/php-debugbar",
|
||||||
|
"keywords": [
|
||||||
|
"debug",
|
||||||
|
"debug bar",
|
||||||
|
"debugbar",
|
||||||
|
"dev"
|
||||||
|
],
|
||||||
|
"support": {
|
||||||
|
"issues": "https://github.com/php-debugbar/php-debugbar/issues",
|
||||||
|
"source": "https://github.com/php-debugbar/php-debugbar/tree/v2.2.4"
|
||||||
|
},
|
||||||
|
"time": "2025-07-22T14:01:30+00:00"
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"name": "phpdocumentor/reflection-common",
|
"name": "phpdocumentor/reflection-common",
|
||||||
"version": "2.2.0",
|
"version": "2.2.0",
|
||||||
|
|||||||
@@ -1,29 +0,0 @@
|
|||||||
<div class="w-full flex gap-2 justify-end">
|
|
||||||
<div class="flex gap-2">
|
|
||||||
|
|
||||||
<x-filament::button color="gray" outlined x-on:click="$wire.call('removeTableFilters')">
|
|
||||||
1X2
|
|
||||||
</x-filament::button>
|
|
||||||
|
|
||||||
<x-filament::button color="gray" outlined tooltip="OVER/UNDER"
|
|
||||||
x-on:click="$wire.set('tableFilters', {'published_at': {'value': '1'}})">
|
|
||||||
OU
|
|
||||||
</x-filament::button>
|
|
||||||
|
|
||||||
<x-filament::button color="gray" outlined tooltip="TO QUALIFY"
|
|
||||||
x-on:click="$wire.set('tableFilters', {'published_at': {'value': '0'}})">
|
|
||||||
TQ
|
|
||||||
</x-filament::button>
|
|
||||||
|
|
||||||
<x-filament::button color="gray" outlined tooltip="DRAW NO BET"
|
|
||||||
x-on:click="$wire.set('tableFilters', {'published_at': {'value': '0'}})">
|
|
||||||
DNB
|
|
||||||
</x-filament::button>
|
|
||||||
|
|
||||||
<x-filament::button color="gray" outlined tooltip="GOAL NOGOAL"
|
|
||||||
x-on:click="$wire.set('tableFilters', {'published_at': {'value': '0'}})">
|
|
||||||
GG
|
|
||||||
</x-filament::button>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
@@ -0,0 +1,14 @@
|
|||||||
|
<div class="flex">
|
||||||
|
@foreach ($multilines as $multiline)
|
||||||
|
<div class="w-5"></div>
|
||||||
|
@if ($multiline['is_active'] == 1)
|
||||||
|
<x-filament::button>
|
||||||
|
{{ $multiline['name'] }}
|
||||||
|
</x-filament::button>
|
||||||
|
@else
|
||||||
|
<x-filament::button outlined color="gray" wire:click="swop({{ $multiline['id'] }})">
|
||||||
|
{{ $multiline['name'] }}
|
||||||
|
</x-filament::button>
|
||||||
|
@endif
|
||||||
|
@endforeach
|
||||||
|
</div>
|
||||||
@@ -0,0 +1,2 @@
|
|||||||
|
*
|
||||||
|
!.gitignore
|
||||||
Reference in new issue
Block a user