toggle bettypes
This commit is contained in:
1 parent
21575d799f
commit
739222718a
15 files changed
+132
-78
No files matched your search
@@ -10,6 +10,8 @@ class ListEvents extends ListRecords
|
||||
{
|
||||
protected static string $resource = EventResource::class;
|
||||
|
||||
protected $listeners = ['refreshBettypeMenu' => '$refresh'];
|
||||
|
||||
protected function getHeaderActions(): array
|
||||
{
|
||||
return [
|
||||
|
||||
@@ -2,7 +2,8 @@
|
||||
|
||||
namespace App\Filament\Resources\Events\Tables;
|
||||
|
||||
use App\Filament\Tables\Columns\Columns3way;
|
||||
use App\Filament\Tables\Columns\Column3way;
|
||||
use App\Filament\Tables\Columns\ColumnDc;
|
||||
use App\Filament\Tables\Columns\MatchIds;
|
||||
use App\Models\BettypeUser;
|
||||
use App\Models\Country;
|
||||
@@ -68,7 +69,8 @@ class EventsTable
|
||||
->alignRight(),
|
||||
TextColumn::make('away.name')
|
||||
->searchable(),
|
||||
Columns3way::make('odds3way')->label(fn () => view('filament.tables.columns.multiline.labels')),
|
||||
Column3way::make('odds3way')->visible(fn () => in_array(1, self::$bettype_settings))->width(280)->label(fn () => view('filament.tables.columns.multiline.labels', ['menu' => '1x2'])),
|
||||
ColumnDc::make('oddsdc')->visible(fn () => in_array(2, self::$bettype_settings))->width(280)->label(fn () => view('filament.tables.columns.multiline.labels', ['menu' => 'dc'])),
|
||||
])
|
||||
->poll('10s')
|
||||
->defaultSort('starttime', 'ASC')
|
||||
|
||||
+2
-2
@@ -5,9 +5,9 @@ namespace App\Filament\Tables\Columns;
|
||||
use App\Models\Odds3way;
|
||||
use Filament\Tables\Columns\Column;
|
||||
|
||||
class Columns3way extends Column
|
||||
class Column3way extends Column
|
||||
{
|
||||
protected string $view = 'filament.tables.columns.columns_3way';
|
||||
protected string $view = 'filament.tables.columns.column_3way';
|
||||
|
||||
protected ?array $multiline;
|
||||
|
||||
@@ -0,0 +1,54 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Tables\Columns;
|
||||
|
||||
use App\Models\OddsDc;
|
||||
use Filament\Tables\Columns\Column;
|
||||
|
||||
class ColumnDc extends Column
|
||||
{
|
||||
protected string $view = 'filament.tables.columns.column-dc';
|
||||
|
||||
protected ?array $multiline;
|
||||
|
||||
protected ?array $fumetto;
|
||||
|
||||
protected ?bool $has_odds;
|
||||
|
||||
public function loadData($record, $multiline_client)
|
||||
{
|
||||
|
||||
$res = OddsDc::with('bookmaker')->where('event_id', $record->id)->get();
|
||||
|
||||
$this->fumetto = [];
|
||||
|
||||
$this->multiline = [];
|
||||
|
||||
foreach ($res as $item) {
|
||||
|
||||
$this->fumetto[] = $item;
|
||||
foreach ($multiline_client as $slot => $bookmaker) {
|
||||
if ($item->bookmaker_id == $bookmaker->bookmaker_id) {
|
||||
$this->multiline[$slot] = $item;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$this->has_odds = count($this->multiline) ? true : false;
|
||||
}
|
||||
|
||||
public function getMultilines(): ?array
|
||||
{
|
||||
return $this->multiline;
|
||||
}
|
||||
|
||||
public function getFumetto()
|
||||
{
|
||||
return $this->fumetto;
|
||||
}
|
||||
|
||||
public function hasodds()
|
||||
{
|
||||
return $this->has_odds;
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user