71 lines
2.4 KiB
PHP
71 lines
2.4 KiB
PHP
<?php
|
|
|
|
namespace App\Livewire;
|
|
|
|
use App\Models\ComparingBookmaker;
|
|
use Filament\Actions\Action;
|
|
use Filament\Actions\Concerns\InteractsWithActions;
|
|
use Filament\Actions\Contracts\HasActions;
|
|
use Filament\Schemas\Concerns\InteractsWithSchemas;
|
|
use Filament\Schemas\Contracts\HasSchemas;
|
|
use Filament\Tables\Columns\TextColumn;
|
|
use Filament\Tables\Concerns\InteractsWithTable;
|
|
use Filament\Tables\Contracts\HasTable;
|
|
use Filament\Tables\Table;
|
|
use Illuminate\Contracts\View\View;
|
|
use Livewire\Component;
|
|
|
|
class ComparingBookmakerMenu extends Component implements HasActions, HasSchemas, HasTable
|
|
{
|
|
use InteractsWithActions;
|
|
use InteractsWithSchemas;
|
|
use InteractsWithTable;
|
|
|
|
public $active_methode = 1;
|
|
|
|
public function table(Table $table): Table
|
|
{
|
|
return $table
|
|
->description('Bookmaker higher up will be used first.')
|
|
->headerActions([
|
|
Action::make('top')
|
|
->color(fn () => $this->active_methode == 1 ? 'primary' : 'gray')
|
|
->icon('phosphor-cell-signal-full')
|
|
->action(function ($livewire) {
|
|
$this->active_methode = 1;
|
|
$livewire->getTableRecords()->fresh();
|
|
}),
|
|
Action::make('middle')->action(fn () => $this->active_methode = 2)
|
|
->color(fn () => $this->active_methode == 2 ? 'primary' : 'gray')
|
|
->icon('phosphor-cell-signal-high'),
|
|
Action::make('low')->action(fn () => $this->active_methode = 3)
|
|
->color(fn () => $this->active_methode == 3 ? 'primary' : 'gray')
|
|
->icon('phosphor-cell-signal-medium'),
|
|
|
|
])
|
|
->query(ComparingBookmaker::query()
|
|
->where('is_hidden', 0)
|
|
->where('sport_id', auth()->user()->sport_id)
|
|
->where('client_bookmaker_id', auth()->user()->bookmaker_id)
|
|
->where('method_id', $this->active_methode))
|
|
->columns([
|
|
TextColumn::make('id'),
|
|
])
|
|
->paginated(false)
|
|
->filters([
|
|
// ...
|
|
])
|
|
->recordActions([
|
|
// ...
|
|
])
|
|
->toolbarActions([
|
|
// ...
|
|
]);
|
|
}
|
|
|
|
public function render(): View
|
|
{
|
|
return view('livewire.comparing-bookmaker-menu');
|
|
}
|
|
}
|