wip
This commit is contained in:
1 parent
200f2be3e2
commit
60379bcab8
7 files changed
+33
-15
No files matched your search
@@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
namespace App\Filament\Resources\Events\Tables;
|
namespace App\Filament\Resources\Events\Tables;
|
||||||
|
|
||||||
use App\Filament\Tables\Columns\MultilineClient;
|
use App\Filament\Tables\Columns\MultilineColumn;
|
||||||
use App\Models\Event;
|
use App\Models\Event;
|
||||||
use Carbon\Carbon;
|
use Carbon\Carbon;
|
||||||
use Filament\Actions\DeleteAction;
|
use Filament\Actions\DeleteAction;
|
||||||
@@ -43,9 +43,9 @@ class EventsTable
|
|||||||
TextColumn::make('home.name')->alignRight()->searchable(),
|
TextColumn::make('home.name')->alignRight()->searchable(),
|
||||||
TextColumn::make('away.name')->searchable(),
|
TextColumn::make('away.name')->searchable(),
|
||||||
|
|
||||||
MultilineClient::make('id')
|
MultilineColumn::make('id')
|
||||||
->searchable()
|
->searchable()
|
||||||
->label(fn () => view('filament.tables.columns.multiline-labels')),
|
->label(fn () => view('filament.tables.columns.multiline.label')),
|
||||||
|
|
||||||
])
|
])
|
||||||
->poll('10s')
|
->poll('10s')
|
||||||
|
|||||||
+8
-8
@@ -2,25 +2,25 @@
|
|||||||
|
|
||||||
namespace App\Filament\Tables\Columns;
|
namespace App\Filament\Tables\Columns;
|
||||||
|
|
||||||
use App\Models\MultilineSetting;
|
|
||||||
use Filament\Tables\Columns\Column;
|
use Filament\Tables\Columns\Column;
|
||||||
use Illuminate\Support\Facades\DB;
|
use Illuminate\Support\Facades\DB;
|
||||||
use stdClass;
|
use stdClass;
|
||||||
|
|
||||||
class MultilineClient extends Column
|
class MultilineColumn extends Column
|
||||||
{
|
{
|
||||||
protected string $view = 'filament.tables.columns.multiline-client';
|
protected string $view = 'filament.tables.columns.multiline.main';
|
||||||
|
|
||||||
protected ?array $slots;
|
protected ?array $slots;
|
||||||
|
|
||||||
protected ?array $settings;
|
protected $settings;
|
||||||
|
|
||||||
public function loadSlots($event_id, $bookmakers)
|
public function loadSlots($event_id, $bookmakers)
|
||||||
{
|
{
|
||||||
|
|
||||||
$this->settings = MultilineSetting::where('id', auth()->user()->multiline_setting_id)->select('table', 'has_3_columns')->first()->toArray();
|
$systemSettings = app('systemSettings');
|
||||||
|
$this->settings = $systemSettings[auth()->user()->multiline_setting_id];
|
||||||
|
|
||||||
$odds = DB::table($this->settings['table'])->where('event_id', $event_id)->get();
|
$odds = DB::table($this->settings->table)->where('event_id', $event_id)->get();
|
||||||
|
|
||||||
$this->makeSlots($odds, $bookmakers);
|
$this->makeSlots($odds, $bookmakers);
|
||||||
|
|
||||||
@@ -28,7 +28,7 @@ class MultilineClient extends Column
|
|||||||
|
|
||||||
public function has3Columns(): ?int
|
public function has3Columns(): ?int
|
||||||
{
|
{
|
||||||
return $this->settings['has_3_columns'];
|
return $this->settings->has_3_columns;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getSlots(): ?array
|
public function getSlots(): ?array
|
||||||
@@ -49,7 +49,7 @@ class MultilineClient extends Column
|
|||||||
if ($item->bookmaker_id == $bookmaker->bookmaker_id) {
|
if ($item->bookmaker_id == $bookmaker->bookmaker_id) {
|
||||||
$item->icon = $bookmaker->bookmaker->icon;
|
$item->icon = $bookmaker->bookmaker->icon;
|
||||||
$item->table = $this->settings['table'];
|
$item->table = $this->settings['table'];
|
||||||
switch ($this->settings['table']) {
|
switch ($this->settings->table) {
|
||||||
case 'odds_2ways':
|
case 'odds_2ways':
|
||||||
case 'odds_2ways_s1':
|
case 'odds_2ways_s1':
|
||||||
$item->a = $item->h3w;
|
$item->a = $item->h3w;
|
||||||
@@ -3,6 +3,7 @@
|
|||||||
namespace App\Providers;
|
namespace App\Providers;
|
||||||
|
|
||||||
use App\Filament\Resources\Events\Pages\ListEvents;
|
use App\Filament\Resources\Events\Pages\ListEvents;
|
||||||
|
use App\Utilities\Settings;
|
||||||
use Carbon\Carbon;
|
use Carbon\Carbon;
|
||||||
use Filament\Support\Colors\Color;
|
use Filament\Support\Colors\Color;
|
||||||
use Filament\Support\Facades\FilamentColor;
|
use Filament\Support\Facades\FilamentColor;
|
||||||
@@ -27,6 +28,10 @@ class AppServiceProvider extends ServiceProvider
|
|||||||
*/
|
*/
|
||||||
public function boot(): void
|
public function boot(): void
|
||||||
{
|
{
|
||||||
|
$this->app->singleton('systemSettings', function () {
|
||||||
|
return Settings::get();
|
||||||
|
});
|
||||||
|
|
||||||
FilamentView::registerRenderHook(
|
FilamentView::registerRenderHook(
|
||||||
TablesRenderHook::TOOLBAR_SEARCH_AFTER,
|
TablesRenderHook::TOOLBAR_SEARCH_AFTER,
|
||||||
fn (): string => Blade::render('@livewire(\'monitor-bettype-switch\')'),
|
fn (): string => Blade::render('@livewire(\'monitor-bettype-switch\')'),
|
||||||
|
|||||||
@@ -0,0 +1,13 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Utilities;
|
||||||
|
|
||||||
|
use App\Models\MultilineSetting;
|
||||||
|
|
||||||
|
class Settings
|
||||||
|
{
|
||||||
|
public static function get()
|
||||||
|
{
|
||||||
|
return MultilineSetting::select('id', 'name', 'short', 'table', 'has_3_columns')->get()->keyBy('id');
|
||||||
|
}
|
||||||
|
}
|
||||||
File renamed without changes.
+4
-4
@@ -14,14 +14,14 @@
|
|||||||
<div class="bg-contain bg-center bg-no-repeat dark:opacity-90" title="{{ $row->bookmaker_id }}"
|
<div class="bg-contain bg-center bg-no-repeat dark:opacity-90" title="{{ $row->bookmaker_id }}"
|
||||||
style="background-image: url('{{ BkmIconMap::get($row->icon) }}')">
|
style="background-image: url('{{ BkmIconMap::get($row->icon) }}')">
|
||||||
</div>
|
</div>
|
||||||
@include('filament.tables.columns.odds', ['odd' => $row->a, 'decimal' => 2])
|
@include('filament.tables.columns.multiline.odds', ['odd' => $row->a, 'decimal' => 2])
|
||||||
|
|
||||||
@if ($has3Columns())
|
@if ($has3Columns())
|
||||||
@include('filament.tables.columns.odds', ['odd' => $row->b, 'decimal' => 2])
|
@include('filament.tables.columns.multiline.odds', ['odd' => $row->b, 'decimal' => 2])
|
||||||
@endif
|
@endif
|
||||||
|
|
||||||
@include('filament.tables.columns.odds', ['odd' => $row->c, 'decimal' => 2])
|
@include('filament.tables.columns.multiline.odds', ['odd' => $row->c, 'decimal' => 2])
|
||||||
|
|
||||||
@include('filament.tables.columns.odds', ['odd' => $row->margin, 'decimal' => 1])
|
@include('filament.tables.columns.multiline.odds', ['odd' => $row->margin, 'decimal' => 1])
|
||||||
@endforeach
|
@endforeach
|
||||||
</div>
|
</div>
|
||||||
Reference in new issue
Block a user