diff --git a/app/Actions/MultilineGenerator.php b/app/Actions/MultilineGenerator.php new file mode 100644 index 00000000..f3986796 --- /dev/null +++ b/app/Actions/MultilineGenerator.php @@ -0,0 +1,44 @@ + [1, 16, 3, 4, 5], + ]; + + $multilines = Multiline::where('client_id', auth()->user()->client_id)->get(); + dd($multilines); + + foreach ($slots as $id => $slot) { + $open = true; + foreach ($data as $item) { + if ($slot->bookmaker_id == $item->bookmaker_id) { + $multilines[$id] = $item; + $open = false; + } + } + if ($open) { + $multilines[$id] = $slot; + } + } + + return $multilines; + } +} diff --git a/app/Filament/Resources/Events/EventResource.php b/app/Filament/Resources/Events/EventResource.php index 73b76af4..a1821cef 100644 --- a/app/Filament/Resources/Events/EventResource.php +++ b/app/Filament/Resources/Events/EventResource.php @@ -20,11 +20,11 @@ class EventResource extends Resource protected static ?string $navigationLabel = 'Monitor'; - protected static ?string $modelLabel = 'Monitor'; + protected static ?string $modelLabel = ''; - protected static ?string $title = 'Monitor'; + protected static ?string $title = ''; - protected static ?string $pluralModelLabel = 'Monitor'; + protected static ?string $pluralModelLabel = ''; public static function form(Schema $schema): Schema { diff --git a/app/Filament/Resources/Events/Tables/EventsTable.php b/app/Filament/Resources/Events/Tables/EventsTable.php index 441d4cd9..935366b1 100644 --- a/app/Filament/Resources/Events/Tables/EventsTable.php +++ b/app/Filament/Resources/Events/Tables/EventsTable.php @@ -12,7 +12,10 @@ use Filament\Support\Enums\FontWeight; use Filament\Support\Enums\IconSize; use Filament\Tables\Columns\IconColumn; use Filament\Tables\Columns\TextColumn; +use Filament\Tables\Enums\FiltersLayout; +use Filament\Tables\Filters\SelectFilter; use Filament\Tables\Table; +use Illuminate\Database\Eloquent\Builder; class EventsTable { @@ -28,7 +31,7 @@ class EventsTable ->size(IconSize::ExtraLarge) ->icon(fn ($record) => $record->sport->icon) ->tooltip(fn ($record) => $record->id), - TextColumn::make('txodds_id')->searchable()->label('Match Id')->badge()->copyable(), + TextColumn::make('txodds_id')->label('Match Id')->badge()->copyable(), TextColumn::make('starttime') ->label('Start') ->alignCenter() @@ -40,14 +43,23 @@ class EventsTable ->label('Event') ->icon(fn ($record) => $record->country->icon) ->description(fn ($record) => $record->competition_group->name), - TextColumn::make('home.name')->alignRight()->searchable(), - TextColumn::make('away.name')->searchable(), + TextColumn::make('home.name')->alignRight(), + TextColumn::make('away.name'), Odds3Way::make('odds_3way.bookmaker')->label('1X2'), ]) - ->filters([ - // - ]) + ->defaultSort('starttime', 'ASC') + // ->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() ->recordActions([ // EditAction::make(), DeleteAction::make()->iconButton(), diff --git a/app/Filament/Resources/Multilines/Tables/MultilinesTable.php b/app/Filament/Resources/Multilines/Tables/MultilinesTable.php index dcc4af11..c30d2759 100644 --- a/app/Filament/Resources/Multilines/Tables/MultilinesTable.php +++ b/app/Filament/Resources/Multilines/Tables/MultilinesTable.php @@ -2,9 +2,9 @@ namespace App\Filament\Resources\Multilines\Tables; +use App\Actions\MultilineGenerator; use App\Filament\Tables\Columns\BookmakerIcon; use Filament\Actions\Action; -use Filament\Actions\EditAction; use Filament\Tables\Columns\IconColumn; use Filament\Tables\Columns\TextColumn; use Filament\Tables\Enums\FiltersLayout; @@ -53,13 +53,9 @@ class MultilinesTable ->headerActions([ Action::make('generate') ->icon('phosphor-gear-fine') - ->requiresConfirmation(), - // EditAction::make() - // ->mutateDataUsing(function (array $data): array { - // $data['client_id'] = auth()->user()->client_id; - - // return $data; - // }), + ->action(function () { + MultilineGenerator::run(); + }), ]); } } diff --git a/app/Providers/AppServiceProvider.php b/app/Providers/AppServiceProvider.php index 002d0784..d8b41dd9 100644 --- a/app/Providers/AppServiceProvider.php +++ b/app/Providers/AppServiceProvider.php @@ -2,10 +2,14 @@ namespace App\Providers; +use App\Filament\Resources\Events\Pages\ListEvents; use Carbon\Carbon; use Filament\Support\Colors\Color; use Filament\Support\Facades\FilamentColor; +use Filament\Support\Facades\FilamentView; +use Filament\View\PanelsRenderHook; use Illuminate\Support\ServiceProvider; +use Illuminate\View\View; class AppServiceProvider extends ServiceProvider { @@ -22,6 +26,14 @@ class AppServiceProvider extends ServiceProvider */ public function boot(): void { + FilamentView::registerRenderHook( + PanelsRenderHook::RESOURCE_PAGES_LIST_RECORDS_TABLE_BEFORE, + fn (): View => view('filament.hooks.table-bettype-filters'), + scopes: [ + ListEvents::class, + ] + ); + Carbon::setLocale(app()->getLocale()); FilamentColor::register([ diff --git a/app/Providers/Filament/AdminPanelProvider.php b/app/Providers/Filament/AdminPanelProvider.php index ff5a986a..ad5a7aee 100644 --- a/app/Providers/Filament/AdminPanelProvider.php +++ b/app/Providers/Filament/AdminPanelProvider.php @@ -2,7 +2,6 @@ namespace App\Providers\Filament; -use App\Filament\Resources\Events\Pages\ListEvents; use Awcodes\LightSwitch\Enums\Alignment; use Awcodes\LightSwitch\LightSwitchPlugin; use Filament\Actions\Action; @@ -17,10 +16,8 @@ use Filament\Pages\Dashboard; use Filament\Panel; use Filament\PanelProvider; use Filament\Support\Enums\Width; -use Filament\Tables\View\TablesRenderHook; use Filament\Widgets\AccountWidget; use Filament\Widgets\FilamentInfoWidget; -use Illuminate\Contracts\View\View; use Illuminate\Cookie\Middleware\AddQueuedCookiesToResponse; use Illuminate\Cookie\Middleware\EncryptCookies; use Illuminate\Foundation\Http\Middleware\VerifyCsrfToken; @@ -47,13 +44,6 @@ class AdminPanelProvider extends PanelProvider ->databaseNotifications() ->profile(isSimple: false) ->default() - ->renderHook( - TablesRenderHook::TOOLBAR_START, - fn (): View => view('filament.mapper.sport-menu'), - ListEvents::class - ) - // ->brandLogo(asset('images/nuh-combined.svg')) - // ->darkModeBrandLogo(asset('images/nuh-combined-d.svg')) ->brandLogo(asset('images/nuh-odds.svg')) ->darkModeBrandLogo(asset('images/nuh-odds-d.svg')) ->favicon(asset('images/nuh.svg')) diff --git a/resources/css/filament/admin/theme.css b/resources/css/filament/admin/theme.css index dd193b02..9b60e7c2 100644 --- a/resources/css/filament/admin/theme.css +++ b/resources/css/filament/admin/theme.css @@ -5,6 +5,7 @@ @source '../../../../resources/views/filament/pages/**/*'; @source '../../../../vendor/awcodes/light-switch/resources/**/*.blade.php'; +.fi-ta-filters-heading, button[wire\:click="resetTableFiltersForm"] { display: none; } diff --git a/resources/views/filament/hooks/table-bettype-filters.blade.php b/resources/views/filament/hooks/table-bettype-filters.blade.php new file mode 100644 index 00000000..3d5d245c --- /dev/null +++ b/resources/views/filament/hooks/table-bettype-filters.blade.php @@ -0,0 +1,38 @@ +
+ + + + + + + + + + +
+ + + 1X2 + + + + OVER/UNDER + + + + TO QUALIFY + + + + DOUBLE CHANCE + + + + GOAL NOGOAL + +
+
diff --git a/resources/views/filament/mapper/sport-menu.blade.php b/resources/views/filament/mapper/sport-menu.blade.php deleted file mode 100644 index f3f18ceb..00000000 --- a/resources/views/filament/mapper/sport-menu.blade.php +++ /dev/null @@ -1,96 +0,0 @@ - - - - - - - - - - {{ __('Light') }} - - - - - {{ __('Dark') }} - - - - - {{ __('System') }} - - - - - -{{-- - - - - - - - - --}} - -{{-- - - - - - - --}} -{{--
- - Soccer - - - Basketball - - - Ice Hockey - - - Tennis - -
--}}