event filter wip
This commit is contained in:
1 parent
abfe5882cb
commit
988a148850
9 files changed
+120
-123
No files matched your search
@@ -0,0 +1,44 @@
|
||||
<?php
|
||||
|
||||
namespace App\Actions;
|
||||
|
||||
use App\Models\Multiline;
|
||||
|
||||
class MultilineGenerator
|
||||
{
|
||||
public static function run()
|
||||
{
|
||||
|
||||
// odds_2ways
|
||||
// odds_3ways
|
||||
// odds_dc
|
||||
// odds_dnb
|
||||
// odds_ggng
|
||||
// odds_handicaps
|
||||
// odds_qualify
|
||||
// odds_totals
|
||||
|
||||
$default = [];
|
||||
$default[1] = [
|
||||
'bettypes' => [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;
|
||||
}
|
||||
}
|
||||
@@ -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
|
||||
{
|
||||
|
||||
@@ -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(),
|
||||
|
||||
@@ -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();
|
||||
}),
|
||||
]);
|
||||
}
|
||||
}
|
||||
@@ -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([
|
||||
|
||||
@@ -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'))
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,38 @@
|
||||
<div class="w-full flex justify-between">
|
||||
|
||||
<x-filament::input.wrapper prefix-icon="icon-soccerball" prefix-icon-color="primary">
|
||||
<x-filament::input.select wire:model="status">
|
||||
<option value="draft">Soccer</option>
|
||||
<option value="reviewing">Basketball</option>
|
||||
<option value="published">Ice Hockey</option>
|
||||
<option value="published">Tennis</option>
|
||||
</x-filament::input.select>
|
||||
</x-filament::input.wrapper>
|
||||
|
||||
<div class="flex gap-2">
|
||||
|
||||
<x-filament::button color="gray" outlined x-on:click="$wire.call('removeTableFilters')">
|
||||
1X2
|
||||
</x-filament::button>
|
||||
|
||||
<x-filament::button color="gray" outlined
|
||||
x-on:click="$wire.set('tableFilters', {'published_at': {'value': '1'}})">
|
||||
OVER/UNDER
|
||||
</x-filament::button>
|
||||
|
||||
<x-filament::button color="gray" outlined
|
||||
x-on:click="$wire.set('tableFilters', {'published_at': {'value': '0'}})">
|
||||
TO QUALIFY
|
||||
</x-filament::button>
|
||||
|
||||
<x-filament::button color="gray" outlined
|
||||
x-on:click="$wire.set('tableFilters', {'published_at': {'value': '0'}})">
|
||||
DOUBLE CHANCE
|
||||
</x-filament::button>
|
||||
|
||||
<x-filament::button color="gray" outlined
|
||||
x-on:click="$wire.set('tableFilters', {'published_at': {'value': '0'}})">
|
||||
GOAL NOGOAL
|
||||
</x-filament::button>
|
||||
</div>
|
||||
</div>
|
||||
@@ -1,96 +0,0 @@
|
||||
<x-filament::dropdown>
|
||||
<x-slot name="trigger">
|
||||
<template x-if="theme === 'light'">
|
||||
<x-filament::button size="lg" icon="icon-soccerball" color="white" icon-size="md" x-ref="trigger">
|
||||
Soccer
|
||||
</x-filament::button>
|
||||
</template>
|
||||
<template x-if="theme === 'dark'">
|
||||
<x-filament::icon-button size="lg" color="white" icon="heroicon-o-moon" icon-size="md"
|
||||
icon-position="before" x-ref="trigger" />
|
||||
</template>
|
||||
<template x-if="theme === 'system'">
|
||||
<x-filament::icon-button size="lg" color="white" icon="heroicon-o-computer-desktop" icon-size="md"
|
||||
icon-position="before" x-ref="trigger" />
|
||||
</template>
|
||||
</x-slot>
|
||||
<x-filament::dropdown.list class="flex flex-col gap-y-1" x-data="{ theme: null }" x-init="$watch('theme', () => {
|
||||
$dispatch('theme-changed', theme)
|
||||
})
|
||||
theme = localStorage.getItem('theme') || 'system';">
|
||||
<x-filament::dropdown.list.item icon="heroicon-o-sun" icon-size="md" icon-color="white" icon-position="before"
|
||||
class="font-medium" x-on:click="(theme = 'light') && close()"
|
||||
x-bind:class="theme === 'light'
|
||||
?
|
||||
'bg-gray-50 text-primary-500 dark:bg-white/5 dark:text-primary-400' :
|
||||
'text-gray-400 hover:text-gray-500 focus-visible:text-gray-500 dark:text-gray-500 dark:hover:text-gray-400 dark:focus-visible:text-gray-400'">
|
||||
<span
|
||||
x-bind:class="theme === 'light'
|
||||
?
|
||||
'text-primary-500 dark:text-primary-400' :
|
||||
'text-gray-950 dark:text-white'">
|
||||
{{ __('Light') }}
|
||||
</span>
|
||||
</x-filament::dropdown.list.item>
|
||||
<x-filament::dropdown.list.item icon="heroicon-o-moon" icon-size="md" icon-color="white" icon-position="before"
|
||||
class="font-medium" x-on:click="(theme = 'dark') && close()"
|
||||
x-bind:class="theme === 'dark'
|
||||
?
|
||||
'bg-gray-50 text-primary-500 dark:bg-white/5 dark:text-primary-400' :
|
||||
'text-gray-400 hover:text-gray-500 focus-visible:text-gray-500 dark:text-gray-500 dark:hover:text-gray-400 dark:focus-visible:text-gray-400'">
|
||||
<span
|
||||
x-bind:class="theme === 'dark'
|
||||
?
|
||||
'text-primary-500 dark:text-primary-400' :
|
||||
'text-gray-950 dark:text-white'">
|
||||
{{ __('Dark') }}
|
||||
</span>
|
||||
</x-filament::dropdown.list.item>
|
||||
<x-filament::dropdown.list.item icon="heroicon-o-computer-desktop" icon-size="md" icon-color="white"
|
||||
icon-position="before" class="font-medium" x-on:click="(theme = 'system') && close()"
|
||||
x-bind:class="theme === 'system'
|
||||
?
|
||||
'bg-gray-50 text-primary-500 dark:bg-white/5 dark:text-primary-400' :
|
||||
'text-gray-400 hover:text-gray-500 focus-visible:text-gray-500 dark:text-gray-500 dark:hover:text-gray-400 dark:focus-visible:text-gray-400'">
|
||||
<span
|
||||
x-bind:class="theme === 'system'
|
||||
?
|
||||
'text-primary-500 dark:text-primary-400' :
|
||||
'text-gray-950 dark:text-white'">
|
||||
{{ __('System') }}
|
||||
</span>
|
||||
</x-filament::dropdown.list.item>
|
||||
</x-filament::dropdown.list>
|
||||
</x-filament::dropdown>
|
||||
|
||||
{{-- <x-filament::input.wrapper>
|
||||
<x-filament::input.select wire:model="status">
|
||||
<option value="1">Soccer</option>
|
||||
<option value="2">Basketball</option>
|
||||
<option value="3">Ice Hockey</option>
|
||||
<option value="5">Tennis</option>
|
||||
</x-filament::input.select>
|
||||
</x-filament::input.wrapper>
|
||||
--}}
|
||||
|
||||
{{-- <x-filament::input.wrapper prefix-icon="icon-soccerball">
|
||||
<x-filament::input.select wire:model="status">
|
||||
<option value="draft">Soccer</option>
|
||||
<option value="reviewing">Reviewing</option>
|
||||
<option value="published">Published</option>
|
||||
</x-filament::input.select>
|
||||
</x-filament::input.wrapper> --}}
|
||||
{{-- <div class="flex">
|
||||
<x-filament::button icon="icon-soccerball">
|
||||
Soccer
|
||||
</x-filament::button>
|
||||
<x-filament::button icon="icon-basketball" color="gray">
|
||||
Basketball
|
||||
</x-filament::button>
|
||||
<x-filament::button icon="icon-icehockey" color="gray">
|
||||
Ice Hockey
|
||||
</x-filament::button>
|
||||
<x-filament::button icon="icon-tennisball" color="gray">
|
||||
Tennis
|
||||
</x-filament::button>
|
||||
</div> --}}
|
||||
Reference in new issue
Block a user