wip change bettype in events monitor
This commit is contained in:
1 parent
245255756c
commit
c6fd66189b
15 files changed
+255
-279
No files matched your search
@@ -3,11 +3,18 @@
|
||||
namespace App\Filament\Resources\Multilines\Tables;
|
||||
|
||||
use App\Filament\Tables\Columns\BookmakerIcon;
|
||||
use App\Models\Bookmaker;
|
||||
use App\Models\Client;
|
||||
use App\Models\Multiline;
|
||||
use App\Models\Sport;
|
||||
use Filament\Actions\Action;
|
||||
use Filament\Forms\Components\Select;
|
||||
use Filament\Schemas\Components\Utilities\Get;
|
||||
use Filament\Tables\Columns\IconColumn;
|
||||
use Filament\Tables\Columns\SelectColumn;
|
||||
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;
|
||||
|
||||
@@ -23,7 +30,6 @@ class MultilinesTable
|
||||
->label($isReordering ? 'Disable reordering' : 'Enable reordering'),
|
||||
)
|
||||
->reorderable('sort')
|
||||
->defaultGroup('name')
|
||||
->columns([
|
||||
IconColumn::make('sport.icon')
|
||||
->label('')
|
||||
@@ -31,22 +37,48 @@ class MultilinesTable
|
||||
->icon(function ($record): string {
|
||||
return $record->sport->icon;
|
||||
}),
|
||||
// TextColumn::make('sport.name'),
|
||||
TextColumn::make('sport.name'),
|
||||
TextColumn::make('name'),
|
||||
TextColumn::make('bookmaker.name'),
|
||||
BookmakerIcon::make('bookmaker.icon')->label('Icon'),
|
||||
SelectColumn::make('bookmaker_id')
|
||||
->width('2rem')
|
||||
->options(Bookmaker::where('is_active', 1)->pluck('name', 'txid')),
|
||||
])
|
||||
->defaultSort('sort')
|
||||
->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(),
|
||||
], FiltersLayout::AboveContent)
|
||||
->hiddenFilterIndicators()
|
||||
->persistFiltersInSession();
|
||||
Filter::make('ligafilter')
|
||||
->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');
|
||||
})
|
||||
->live(),
|
||||
Select::make('name')
|
||||
->default('1X2')
|
||||
->label('Bettype')
|
||||
->options(function (Builder $query, Get $get) {
|
||||
return Multiline::where('sport_id', $get('sport_id'))->pluck('name', 'name');
|
||||
})
|
||||
->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['name'],
|
||||
fn (Builder $query, $name) => $query->where('name', $name)
|
||||
);
|
||||
})
|
||||
->columns(3)->columnSpan(3),
|
||||
], layout: FiltersLayout::AboveContent)
|
||||
|
||||
->hiddenFilterIndicators();
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user