wip
This commit is contained in:
1 parent
eec5840a6b
commit
f9712cbd25
15 files changed
+247
-22
No files matched your search
@@ -33,11 +33,11 @@ class AlarmBookmaker extends Component implements HasActions, HasSchemas, HasTab
|
||||
'refreshAlarmBookmaker' => '$refresh',
|
||||
];
|
||||
|
||||
public static $default_filter;
|
||||
public static int $default_filter;
|
||||
|
||||
public static function load_filter($sport_id)
|
||||
public static function load_filter(int $sport_id)
|
||||
{
|
||||
self::$default_filter = MultilineSetting::where('sport_id', $sport_id)
|
||||
self::$default_filter = MultilineSetting::where('sport_id', (int) $sport_id)
|
||||
->orderBy('id')->pluck('id')->first();
|
||||
}
|
||||
|
||||
@@ -64,7 +64,7 @@ class AlarmBookmaker extends Component implements HasActions, HasSchemas, HasTab
|
||||
// }),
|
||||
// TextColumn::make('sport.name'),
|
||||
TextColumn::make('alarm_level.name')
|
||||
->color(fn ($record) => $record->alarm_level->color)
|
||||
->color(fn($record) => $record->alarm_level->color)
|
||||
->weight(FontWeight::Black),
|
||||
TextInputColumn::make('alarm_threshold')
|
||||
->tooltip('Between 0.01 - 2.00')
|
||||
@@ -88,13 +88,13 @@ class AlarmBookmaker extends Component implements HasActions, HasSchemas, HasTab
|
||||
->default(self::$default_filter)
|
||||
->columnSpanFull()
|
||||
->hiddenLabel()
|
||||
->options(fn () => MultilineSetting::where('sport_id', auth()->user()->sport_id)->orderBy('name')->pluck('name', 'id')),
|
||||
->options(fn() => MultilineSetting::where('sport_id', auth()->user()->sport_id)->orderBy('name')->pluck('name', 'id')),
|
||||
])
|
||||
->query(function (Builder $query, array $data): Builder {
|
||||
return $query
|
||||
->when(
|
||||
$data['multiline_setting_id'],
|
||||
fn (Builder $query, $multiline_setting_id): Builder => $query->where('multiline_setting_id', $multiline_setting_id),
|
||||
fn(Builder $query, $multiline_setting_id): Builder => $query->where('multiline_setting_id', $multiline_setting_id),
|
||||
);
|
||||
})
|
||||
->columns(6)->columnSpan(6),
|
||||
|
||||
@@ -0,0 +1,58 @@
|
||||
<?php
|
||||
|
||||
namespace App\Livewire\Mapper;
|
||||
|
||||
class LoadPositions
|
||||
{
|
||||
|
||||
public static function load()
|
||||
{
|
||||
$arr = [];
|
||||
|
||||
$arr[] = 0;
|
||||
$arr[] = 0;
|
||||
$arr[] = 'SW';
|
||||
$arr[] = 0;
|
||||
$arr[] = 0;
|
||||
|
||||
$arr[] = 'DR';
|
||||
$arr[] = 'DC';
|
||||
$arr[] = 'DC';
|
||||
$arr[] = 'DC';
|
||||
$arr[] = 'DL';
|
||||
|
||||
$arr[] = 0;
|
||||
$arr[] = 'DM';
|
||||
$arr[] = 'DM';
|
||||
$arr[] = 'DM';
|
||||
$arr[] = 0;
|
||||
|
||||
$arr[] = 'MR';
|
||||
$arr[] = 'MC';
|
||||
$arr[] = 'MC';
|
||||
$arr[] = 'MC';
|
||||
$arr[] = 'ML';
|
||||
|
||||
$arr[] = 0;
|
||||
$arr[] = 'AM';
|
||||
$arr[] = 'AM';
|
||||
$arr[] = 'AM';
|
||||
$arr[] = 0;
|
||||
|
||||
$arr[] = 'RW';
|
||||
$arr[] = 0;
|
||||
$arr[] = 'SM';
|
||||
$arr[] = 0;
|
||||
$arr[] = 'LW';
|
||||
|
||||
$arr[] = 0;
|
||||
$arr[] = 0;
|
||||
$arr[] = 'ST';
|
||||
$arr[] = 0;
|
||||
$arr[] = 0;
|
||||
|
||||
$arr = array_reverse($arr);
|
||||
|
||||
return $arr;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
<?php
|
||||
|
||||
namespace App\Livewire;
|
||||
|
||||
use App\Filament\Pages\Selections\LoadPlayer;
|
||||
use App\Livewire\Mapper\LoadPositions;
|
||||
use Filament\Widgets\Concerns\InteractsWithPageFilters;
|
||||
use Livewire\Component;
|
||||
|
||||
class PlayerCalculator extends Component
|
||||
{
|
||||
use InteractsWithPageFilters;
|
||||
public $player = [];
|
||||
public $positions = [];
|
||||
|
||||
public function mount(array $filters)
|
||||
{
|
||||
$this->positions = LoadPositions::load();
|
||||
$team_position = $filters['team_position'];
|
||||
$sofascore_category_id = $filters['sofascore_category_id'];
|
||||
$season = $filters['season'];
|
||||
$seasonmode = $filters['seasonmode'];
|
||||
$team_id = $filters['team_id'];
|
||||
$this->player = LoadPlayer::load($team_id, $team_position, $sofascore_category_id, $season, $seasonmode);
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user