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
|
||||
{
|
||||
|
||||
return parent::getEloquentQuery()
|
||||
->where('starttime', '>', Carbon::now())
|
||||
->where('sport_id', auth()->user()->sport_id);
|
||||
|
||||
@@ -3,28 +3,36 @@
|
||||
namespace App\Filament\Resources\Events\Tables;
|
||||
|
||||
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 Filament\Actions\BulkActionGroup;
|
||||
use Filament\Actions\DeleteAction;
|
||||
use Filament\Actions\DeleteBulkAction;
|
||||
use Filament\Actions\EditAction;
|
||||
use Filament\Forms\Components\Select;
|
||||
use Filament\Schemas\Components\Utilities\Get;
|
||||
use Filament\Support\Enums\FontWeight;
|
||||
use Filament\Support\Enums\IconSize;
|
||||
use Filament\Tables\Columns\IconColumn;
|
||||
use Filament\Tables\Columns\TextColumn;
|
||||
use Filament\Tables\Enums\FiltersLayout;
|
||||
use Filament\Tables\Filters\SelectFilter;
|
||||
use Filament\Tables\Filters\Filter;
|
||||
use Filament\Tables\Table;
|
||||
use Illuminate\Database\Eloquent\Builder;
|
||||
|
||||
class EventsTable
|
||||
{
|
||||
public static $bettype = '1x2';
|
||||
protected $listeners = [
|
||||
'bettypeswitch' => '$refresh',
|
||||
];
|
||||
|
||||
public static function configure(Table $table): Table
|
||||
{
|
||||
return $table
|
||||
->poll('10s')
|
||||
// ->poll('10s')
|
||||
->striped()
|
||||
->columns([
|
||||
IconColumn::make('sport.icon')
|
||||
@@ -53,18 +61,41 @@ class EventsTable
|
||||
->defaultSort('starttime', 'ASC')
|
||||
->deferFilters(false)
|
||||
->filters([
|
||||
SelectFilter::make('sport_id')
|
||||
->label('Sport')
|
||||
->default(1)
|
||||
->selectablePlaceholder(false)
|
||||
->relationship('sport', 'name', fn (Builder $query) => $query->where('is_active', 1))
|
||||
->preload(),
|
||||
// SelectFilter::make('competition_group_id')
|
||||
// ->label('Tornament')
|
||||
// ->options(fn () => Event::where('is_active', 1)->pluck('sport', 'id')
|
||||
// ->relationship('sport', 'name', fn (Builder $query) => $query->where('is_active', 1))
|
||||
// ->preload(),
|
||||
], FiltersLayout::AboveContent)
|
||||
Filter::make('event')
|
||||
->form([
|
||||
Select::make('sport_id')
|
||||
->label('Sport')
|
||||
->default(1)
|
||||
->options(function () {
|
||||
$sports = Client::where('id', auth()->user()->client_id)->pluck('sport')->first();
|
||||
|
||||
return Sport::query()->whereIn('id', $sports)->pluck('name', 'id');
|
||||
})
|
||||
->afterStateUpdated(function ($state) {
|
||||
|
||||
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)
|
||||
->persistFiltersInSession()
|
||||
->recordActions([
|
||||
|
||||
@@ -47,7 +47,7 @@ class MultilineClientsTable
|
||||
->defaultSort('sort')
|
||||
->deferFilters(false)
|
||||
->filters([
|
||||
Filter::make('ligafilter')
|
||||
Filter::make('multilineclient')
|
||||
->form([
|
||||
Select::make('sport_id')
|
||||
->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',
|
||||
];
|
||||
|
||||
public function multiline_user()
|
||||
{
|
||||
return $this->belongsTo(MultilineUser::class);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the attributes that should be cast.
|
||||
*
|
||||
|
||||
@@ -11,7 +11,6 @@ use Filament\Tables\View\TablesRenderHook;
|
||||
use Filament\View\PanelsRenderHook;
|
||||
use Illuminate\Support\Facades\Blade;
|
||||
use Illuminate\Support\ServiceProvider;
|
||||
use Illuminate\View\View;
|
||||
|
||||
class AppServiceProvider extends ServiceProvider
|
||||
{
|
||||
@@ -30,7 +29,7 @@ class AppServiceProvider extends ServiceProvider
|
||||
{
|
||||
FilamentView::registerRenderHook(
|
||||
TablesRenderHook::TOOLBAR_SEARCH_AFTER,
|
||||
fn (): View => view('filament.hooks.table-bettype-filters'),
|
||||
fn (): string => Blade::render('@livewire(\'monitor-bettype-switch\')'),
|
||||
scopes: [
|
||||
ListEvents::class,
|
||||
]
|
||||
|
||||
@@ -21,6 +21,7 @@
|
||||
"swisnl/filament-backgrounds": "^2.0"
|
||||
},
|
||||
"require-dev": {
|
||||
"barryvdh/laravel-debugbar": "^3.16",
|
||||
"fakerphp/faker": "^1.23",
|
||||
"filament/upgrade": "^4.0",
|
||||
"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",
|
||||
"This file is @generated automatically"
|
||||
],
|
||||
"content-hash": "a0295c6180844fb41e7aa201bd8e3cb1",
|
||||
"content-hash": "45deaaab620ed1b3c5cfc7c74d900c94",
|
||||
"packages": [
|
||||
{
|
||||
"name": "anourvalar/eloquent-serialize",
|
||||
@@ -8884,6 +8884,91 @@
|
||||
}
|
||||
],
|
||||
"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",
|
||||
"version": "v7.8.4",
|
||||
@@ -10345,6 +10430,79 @@
|
||||
},
|
||||
"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",
|
||||
"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