wip del err
This commit is contained in:
1 parent
812736ca9a
commit
9bcd4432c6
1210 files changed
-220941
No files matched your search
@@ -1,13 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Clusters\Grapper;
|
||||
|
||||
use BackedEnum;
|
||||
use Filament\Clusters\Cluster;
|
||||
|
||||
class GrapperCluster extends Cluster
|
||||
{
|
||||
protected static string|BackedEnum|null $navigationIcon = 'phosphor-rss';
|
||||
|
||||
protected static ?int $navigationSort = 5;
|
||||
}
|
||||
@@ -1,53 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Clusters\Grapper\Resources\Bookmakers;
|
||||
|
||||
use App\Filament\Clusters\Grapper\GrapperCluster;
|
||||
use App\Filament\Clusters\Grapper\Resources\Bookmakers\Pages\ListBookmakers;
|
||||
use App\Filament\Clusters\Grapper\Resources\Bookmakers\Schemas\BookmakerForm;
|
||||
use App\Filament\Clusters\Grapper\Resources\Bookmakers\Tables\BookmakersTable;
|
||||
use App\Models\Bookmaker;
|
||||
use Filament\Resources\Resource;
|
||||
use Filament\Schemas\Schema;
|
||||
use Filament\Tables\Table;
|
||||
use Illuminate\Database\Eloquent\Builder;
|
||||
|
||||
class BookmakerResource extends Resource
|
||||
{
|
||||
protected static ?string $model = Bookmaker::class;
|
||||
|
||||
protected static ?int $navigationSort = 21;
|
||||
|
||||
protected static string|\BackedEnum|null $navigationIcon = 'phosphor-bookmarks-simple';
|
||||
|
||||
protected static ?string $cluster = GrapperCluster::class;
|
||||
|
||||
protected static string|\UnitEnum|null $navigationGroup = 'Grapper';
|
||||
|
||||
public static function form(Schema $schema): Schema
|
||||
{
|
||||
return BookmakerForm::configure($schema);
|
||||
}
|
||||
|
||||
public static function table(Table $table): Table
|
||||
{
|
||||
return BookmakersTable::configure($table);
|
||||
}
|
||||
|
||||
public static function getPages(): array
|
||||
{
|
||||
return [
|
||||
'index' => ListBookmakers::route('/'),
|
||||
];
|
||||
}
|
||||
|
||||
public static function getNavigationBadge(): ?string
|
||||
{
|
||||
return parent::getEloquentQuery()->count();
|
||||
}
|
||||
|
||||
public static function getEloquentQuery(): Builder
|
||||
{
|
||||
return parent::getEloquentQuery()->where('deleted', false);
|
||||
}
|
||||
}
|
||||
@@ -1,11 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Clusters\Grapper\Resources\Bookmakers\Pages;
|
||||
|
||||
use App\Filament\Clusters\Grapper\Resources\Bookmakers\BookmakerResource;
|
||||
use Filament\Resources\Pages\CreateRecord;
|
||||
|
||||
class CreateBookmaker extends CreateRecord
|
||||
{
|
||||
protected static string $resource = BookmakerResource::class;
|
||||
}
|
||||
@@ -1,19 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Clusters\Grapper\Resources\Bookmakers\Pages;
|
||||
|
||||
use App\Filament\Clusters\Grapper\Resources\Bookmakers\BookmakerResource;
|
||||
use Filament\Actions\DeleteAction;
|
||||
use Filament\Resources\Pages\EditRecord;
|
||||
|
||||
class EditBookmaker extends EditRecord
|
||||
{
|
||||
protected static string $resource = BookmakerResource::class;
|
||||
|
||||
protected function getHeaderActions(): array
|
||||
{
|
||||
return [
|
||||
DeleteAction::make(),
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -1,19 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Clusters\Grapper\Resources\Bookmakers\Pages;
|
||||
|
||||
use App\Filament\Clusters\Grapper\Resources\Bookmakers\BookmakerResource;
|
||||
use Filament\Actions\CreateAction;
|
||||
use Filament\Resources\Pages\ListRecords;
|
||||
|
||||
class ListBookmakers extends ListRecords
|
||||
{
|
||||
protected static string $resource = BookmakerResource::class;
|
||||
|
||||
protected function getHeaderActions(): array
|
||||
{
|
||||
return [
|
||||
CreateAction::make(),
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -1,23 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Clusters\Grapper\Resources\Bookmakers\Schemas;
|
||||
|
||||
use Filament\Forms\Components\TextInput;
|
||||
use Filament\Schemas\Schema;
|
||||
|
||||
class BookmakerForm
|
||||
{
|
||||
public static function configure(Schema $schema): Schema
|
||||
{
|
||||
return $schema
|
||||
->components([
|
||||
TextInput::make('name')
|
||||
->required(),
|
||||
TextInput::make('icon')
|
||||
->required(),
|
||||
TextInput::make('baid')
|
||||
->numeric()
|
||||
->default(0),
|
||||
]);
|
||||
}
|
||||
}
|
||||
@@ -1,49 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Clusters\Grapper\Resources\Bookmakers\Tables;
|
||||
|
||||
use App\Filament\Tables\Columns\BookmakerIcon;
|
||||
use Filament\Actions\EditAction;
|
||||
use Filament\Tables\Columns\TextColumn;
|
||||
use Filament\Tables\Columns\ToggleColumn;
|
||||
use Filament\Tables\Enums\FiltersLayout;
|
||||
use Filament\Tables\Filters\TernaryFilter;
|
||||
use Filament\Tables\Table;
|
||||
|
||||
class BookmakersTable
|
||||
{
|
||||
public static function configure(Table $table): Table
|
||||
{
|
||||
return $table
|
||||
->striped()
|
||||
->defaultPaginationPageOption(5)
|
||||
->columns([
|
||||
TextColumn::make('id')->searchable(),
|
||||
TextColumn::make('name')->searchable(),
|
||||
BookmakerIcon::make('icon')->label('Icon')->size('lg'),
|
||||
ToggleColumn::make('in_soccer')->onColor('success'),
|
||||
ToggleColumn::make('in_other')->onColor('success'),
|
||||
ToggleColumn::make('txso'),
|
||||
ToggleColumn::make('txot'),
|
||||
ToggleColumn::make('betsapi'),
|
||||
ToggleColumn::make('direct'),
|
||||
ToggleColumn::make('is_active')->onColor('success'),
|
||||
ToggleColumn::make('need_check')->onColor('danger'),
|
||||
])
|
||||
->defaultSort('id')
|
||||
->filters([
|
||||
TernaryFilter::make('in_soccer'),
|
||||
TernaryFilter::make('in_other'),
|
||||
TernaryFilter::make('txso'),
|
||||
TernaryFilter::make('txot'),
|
||||
TernaryFilter::make('betsapi'),
|
||||
TernaryFilter::make('direct'),
|
||||
TernaryFilter::make('is_active')->default(true),
|
||||
TernaryFilter::make('need_check'),
|
||||
], FiltersLayout::AboveContent)
|
||||
->deferFilters(false)
|
||||
->recordActions([
|
||||
EditAction::make()->hiddenLabel(),
|
||||
]);
|
||||
}
|
||||
}
|
||||
@@ -1,11 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Clusters\Grapper\Resources\Providers\Pages;
|
||||
|
||||
use App\Filament\Clusters\Grapper\Resources\Providers\ProviderResource;
|
||||
use Filament\Resources\Pages\CreateRecord;
|
||||
|
||||
class CreateProvider extends CreateRecord
|
||||
{
|
||||
protected static string $resource = ProviderResource::class;
|
||||
}
|
||||
@@ -1,19 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Clusters\Grapper\Resources\Providers\Pages;
|
||||
|
||||
use App\Filament\Clusters\Grapper\Resources\Providers\ProviderResource;
|
||||
use Filament\Actions\DeleteAction;
|
||||
use Filament\Resources\Pages\EditRecord;
|
||||
|
||||
class EditProvider extends EditRecord
|
||||
{
|
||||
protected static string $resource = ProviderResource::class;
|
||||
|
||||
protected function getHeaderActions(): array
|
||||
{
|
||||
return [
|
||||
DeleteAction::make(),
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -1,19 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Clusters\Grapper\Resources\Providers\Pages;
|
||||
|
||||
use App\Filament\Clusters\Grapper\Resources\Providers\ProviderResource;
|
||||
use Filament\Actions\CreateAction;
|
||||
use Filament\Resources\Pages\ListRecords;
|
||||
|
||||
class ListProviders extends ListRecords
|
||||
{
|
||||
protected static string $resource = ProviderResource::class;
|
||||
|
||||
protected function getHeaderActions(): array
|
||||
{
|
||||
return [
|
||||
CreateAction::make(),
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -1,50 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Clusters\Grapper\Resources\Providers;
|
||||
|
||||
use App\Filament\Clusters\Grapper\GrapperCluster;
|
||||
use App\Filament\Clusters\Grapper\Resources\Providers\Pages\ListProviders;
|
||||
use App\Filament\Clusters\Grapper\Resources\Providers\Schemas\ProviderForm;
|
||||
use App\Filament\Clusters\Grapper\Resources\Providers\Tables\ProvidersTable;
|
||||
use App\Models\Provider;
|
||||
use BackedEnum;
|
||||
use Filament\Resources\Resource;
|
||||
use Filament\Schemas\Schema;
|
||||
use Filament\Tables\Table;
|
||||
|
||||
class ProviderResource extends Resource
|
||||
{
|
||||
protected static ?string $model = Provider::class;
|
||||
|
||||
protected static ?int $navigationSort = 2;
|
||||
|
||||
protected static string|BackedEnum|null $navigationIcon = 'phosphor-books';
|
||||
|
||||
protected static ?string $recordTitleAttribute = 'name';
|
||||
|
||||
protected static ?string $cluster = GrapperCluster::class;
|
||||
|
||||
protected static string|\UnitEnum|null $navigationGroup = 'Grapper';
|
||||
|
||||
public static function form(Schema $schema): Schema
|
||||
{
|
||||
return ProviderForm::configure($schema);
|
||||
}
|
||||
|
||||
public static function table(Table $table): Table
|
||||
{
|
||||
return ProvidersTable::configure($table);
|
||||
}
|
||||
|
||||
public static function getPages(): array
|
||||
{
|
||||
return [
|
||||
'index' => ListProviders::route('/'),
|
||||
];
|
||||
}
|
||||
|
||||
public static function getNavigationBadge(): ?string
|
||||
{
|
||||
return parent::getEloquentQuery()->count();
|
||||
}
|
||||
}
|
||||
@@ -1,18 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Clusters\Grapper\Resources\Providers\Schemas;
|
||||
|
||||
use Filament\Forms\Components\TextInput;
|
||||
use Filament\Schemas\Schema;
|
||||
|
||||
class ProviderForm
|
||||
{
|
||||
public static function configure(Schema $schema): Schema
|
||||
{
|
||||
return $schema
|
||||
->components([
|
||||
TextInput::make('name')
|
||||
->required(),
|
||||
]);
|
||||
}
|
||||
}
|
||||
@@ -1,24 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Clusters\Grapper\Resources\Providers\Tables;
|
||||
|
||||
use Filament\Actions\EditAction;
|
||||
use Filament\Tables\Columns\TextColumn;
|
||||
use Filament\Tables\Table;
|
||||
|
||||
class ProvidersTable
|
||||
{
|
||||
public static function configure(Table $table): Table
|
||||
{
|
||||
return $table
|
||||
->striped()
|
||||
->recordAction(null)
|
||||
->columns([
|
||||
TextColumn::make('id')->alignCenter()->badge(),
|
||||
TextColumn::make('name'),
|
||||
])
|
||||
->recordActions([
|
||||
EditAction::make()->hiddenLabel(),
|
||||
]);
|
||||
}
|
||||
}
|
||||
@@ -1,11 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Clusters\Grapper\Resources\Supervisors\Pages;
|
||||
|
||||
use App\Filament\Clusters\Grapper\Resources\Supervisors\SupervisorResource;
|
||||
use Filament\Resources\Pages\CreateRecord;
|
||||
|
||||
class CreateSupervisor extends CreateRecord
|
||||
{
|
||||
protected static string $resource = SupervisorResource::class;
|
||||
}
|
||||
@@ -1,19 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Clusters\Grapper\Resources\Supervisors\Pages;
|
||||
|
||||
use App\Filament\Clusters\Grapper\Resources\Supervisors\SupervisorResource;
|
||||
use Filament\Actions\DeleteAction;
|
||||
use Filament\Resources\Pages\EditRecord;
|
||||
|
||||
class EditSupervisor extends EditRecord
|
||||
{
|
||||
protected static string $resource = SupervisorResource::class;
|
||||
|
||||
protected function getHeaderActions(): array
|
||||
{
|
||||
return [
|
||||
DeleteAction::make(),
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -1,27 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Clusters\Grapper\Resources\Supervisors\Pages;
|
||||
|
||||
use App\Actions\SupervisorStatus;
|
||||
use App\Filament\Clusters\Grapper\Resources\Supervisors\SupervisorResource;
|
||||
use Filament\Actions\Action;
|
||||
use Filament\Actions\CreateAction;
|
||||
use Filament\Resources\Pages\ListRecords;
|
||||
|
||||
class ListSupervisors extends ListRecords
|
||||
{
|
||||
protected static string $resource = SupervisorResource::class;
|
||||
|
||||
protected function getHeaderActions(): array
|
||||
{
|
||||
return [
|
||||
CreateAction::make()->label('New')->icon('phosphor-plus'),
|
||||
Action::make('stop_all')->icon('phosphor-prohibit')->action(function (): void {
|
||||
SupervisorStatus::set(0);
|
||||
}),
|
||||
Action::make('start_all')->icon('phosphor-play')->action(function (): void {
|
||||
SupervisorStatus::set(1);
|
||||
}),
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -1,32 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Clusters\Grapper\Resources\Supervisors\Schemas;
|
||||
|
||||
use Filament\Forms\Components\Select;
|
||||
use Filament\Schemas\Schema;
|
||||
|
||||
class SupervisorForm
|
||||
{
|
||||
public static function configure(Schema $schema): Schema
|
||||
{
|
||||
return $schema
|
||||
->components([
|
||||
Select::make('provider_id')
|
||||
->relationship('provider', 'name')
|
||||
->required()
|
||||
->preload(),
|
||||
Select::make('sport_id')
|
||||
->relationship('sport', 'name')
|
||||
->nullable(),
|
||||
|
||||
// TextInput::make('sleep')->default(30),
|
||||
// TextInput::make('maxsconds')->label('Seconds till throwing an error')->default(1800),
|
||||
// Section::make('Run processes paralell for speed')
|
||||
// ->description('Set start and end days if more processes grap the same data')
|
||||
// ->schema([
|
||||
// TextInput::make('days_from')->columns(1)->default(0),
|
||||
// TextInput::make('days_to')->columns(1)->default(1),
|
||||
// ])->columns(2)->columnSpanFull(),
|
||||
]);
|
||||
}
|
||||
}
|
||||
@@ -1,47 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Clusters\Grapper\Resources\Supervisors;
|
||||
|
||||
use App\Filament\Clusters\Grapper\GrapperCluster;
|
||||
use App\Filament\Clusters\Grapper\Resources\Supervisors\Pages\ListSupervisors;
|
||||
use App\Filament\Clusters\Grapper\Resources\Supervisors\Schemas\SupervisorForm;
|
||||
use App\Filament\Clusters\Grapper\Resources\Supervisors\Tables\SupervisorsTable;
|
||||
use App\Models\Supervisor;
|
||||
use Filament\Resources\Resource;
|
||||
use Filament\Schemas\Schema;
|
||||
use Filament\Tables\Table;
|
||||
|
||||
class SupervisorResource extends Resource
|
||||
{
|
||||
protected static ?string $model = Supervisor::class;
|
||||
|
||||
protected static string|\BackedEnum|null $navigationIcon = 'phosphor-network';
|
||||
|
||||
protected static ?string $cluster = GrapperCluster::class;
|
||||
|
||||
protected static ?int $navigationSort = 1;
|
||||
|
||||
protected static string|\UnitEnum|null $navigationGroup = 'Grapper';
|
||||
|
||||
public static function form(Schema $schema): Schema
|
||||
{
|
||||
return SupervisorForm::configure($schema);
|
||||
}
|
||||
|
||||
public static function table(Table $table): Table
|
||||
{
|
||||
return SupervisorsTable::configure($table);
|
||||
}
|
||||
|
||||
public static function getPages(): array
|
||||
{
|
||||
return [
|
||||
'index' => ListSupervisors::route('/'),
|
||||
];
|
||||
}
|
||||
|
||||
public static function getNavigationBadge(): ?string
|
||||
{
|
||||
return parent::getEloquentQuery()->count();
|
||||
}
|
||||
}
|
||||
@@ -1,261 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Clusters\Grapper\Resources\Supervisors\Tables;
|
||||
|
||||
use App\Filament\Clusters\Grapper\Resources\Supervisors\Pages\ListSupervisors;
|
||||
use App\Models\Sport;
|
||||
use App\Models\Supervisor;
|
||||
use App\Models\TxoddsMarket;
|
||||
use Filament\Actions\BulkAction;
|
||||
use Filament\Actions\BulkActionGroup;
|
||||
use Filament\Actions\DeleteAction;
|
||||
use Filament\Actions\DeleteBulkAction;
|
||||
use Filament\Actions\EditAction;
|
||||
use Filament\Forms\Components\TextInput;
|
||||
use Filament\Support\Enums\FontWeight;
|
||||
use Filament\Support\Enums\TextSize;
|
||||
use Filament\Tables\Columns\Layout\Split;
|
||||
use Filament\Tables\Columns\Layout\Stack;
|
||||
use Filament\Tables\Columns\SelectColumn;
|
||||
use Filament\Tables\Columns\TextColumn;
|
||||
use Filament\Tables\Columns\TextInputColumn;
|
||||
use Filament\Tables\Columns\ToggleColumn;
|
||||
use Filament\Tables\Enums\FiltersLayout;
|
||||
use Filament\Tables\Filters\SelectFilter;
|
||||
use Filament\Tables\Filters\TernaryFilter;
|
||||
use Filament\Tables\Table;
|
||||
use Illuminate\Support\Collection;
|
||||
|
||||
class SupervisorsTable
|
||||
{
|
||||
public static function configure(Table $table): Table
|
||||
{
|
||||
return $table
|
||||
->striped()
|
||||
->recordAction(null)
|
||||
->poll('15s')
|
||||
->columns([
|
||||
Split::make([
|
||||
TextColumn::make('id')->badge()->alignCenter()
|
||||
->color('black ')
|
||||
->weight(FontWeight::Black)
|
||||
->size(TextSize::Large),
|
||||
TextColumn::make('provider.name')
|
||||
->color(fn ($record): string => match ($record->provider_id) {
|
||||
1 => 'danger',
|
||||
8 => 'danger',
|
||||
2 => 'success',
|
||||
11 => 'info',
|
||||
default => 'warning',
|
||||
}),
|
||||
Stack::make([
|
||||
SelectColumn::make('name')
|
||||
->selectablePlaceholder(true)
|
||||
->hidden(function (ListSupervisors $livewire) {
|
||||
return (bool) in_array($livewire->tableFilters['provider_id']['value'], [8,12]);
|
||||
})
|
||||
->options(function ($record) {
|
||||
switch ($record->provider_id) {
|
||||
case 1:
|
||||
case 3:
|
||||
case 4:
|
||||
case 5:
|
||||
case 6:
|
||||
return [
|
||||
'Fixtures' => 'Fixtures',
|
||||
'Odds' => 'Odds',
|
||||
'Countries' => 'Countries',
|
||||
'Groups' => 'Groups',
|
||||
'Major Groups' => 'Major Groups',
|
||||
];
|
||||
case 2:
|
||||
return [
|
||||
'Fixtures' => 'Fixtures',
|
||||
'Odds' => 'Odds',
|
||||
'Willhill' => 'Willhill',
|
||||
'Bwin' => 'Bwin',
|
||||
'Bet365' => 'Bet365',
|
||||
'Betfair' => 'Betfair',
|
||||
'Element Icons' => 'Element Icons',
|
||||
];
|
||||
case 7:
|
||||
/**
|
||||
* functions for services
|
||||
*/
|
||||
return [
|
||||
'Txodds Markets' => 'Txodds Markets',
|
||||
'Txodds Flags' => 'Txodds Flags',
|
||||
'DB Mapper' => 'DB Mapper',
|
||||
'Generate Setting' => 'Generate Setting',
|
||||
'Generate Alarms' => 'Generate Alarms',
|
||||
'Notify Alarms' => 'Notify Alarms',
|
||||
];
|
||||
case 9:
|
||||
case 10:
|
||||
return [
|
||||
'GRAPPER DIRCET' => 'GRAPPER DIRCET',
|
||||
];
|
||||
case 11:
|
||||
return [
|
||||
'Bet365' => 'Bet365',
|
||||
'MAGLOO KENIA' => 'MAGLOO KENIA',
|
||||
'MAGLOO NIGERIA' => 'MAGLOO NIGERIA',
|
||||
'LOGIFUTURE NIGERA' => 'LOGIFUTURE NIGERA',
|
||||
'LOGIFUTURE COLOMBIA' => 'LOGIFUTURE COLOMBIA',
|
||||
];
|
||||
case 12:
|
||||
return [
|
||||
'TOURNAMENTS' => 'TOURNAMENTS',
|
||||
'EVENTS' => 'EVENTS Comandline',
|
||||
'EVENTSDB' => 'EVENTS Database',
|
||||
'SPECIAL' => 'SPECIAL',
|
||||
];
|
||||
default:
|
||||
return [];
|
||||
}
|
||||
}),
|
||||
SelectColumn::make('sport_id')
|
||||
->hidden(function (ListSupervisors $livewire) {
|
||||
return in_array($livewire->tableFilters['provider_id']['value'], [11, 12]);
|
||||
})
|
||||
->options(fn () => Sport::where('is_active', 1)->pluck('name', 'id'))
|
||||
->placeholder('All'),
|
||||
SelectColumn::make('txodds_market_id')
|
||||
->visible(function (ListSupervisors $livewire) {
|
||||
return $livewire->tableFilters['provider_id']['value'] == 8;
|
||||
})
|
||||
->options(function ($record) {
|
||||
switch ($record->sport_id) {
|
||||
case 1:
|
||||
return TxoddsMarket::where('soccer', 1)->pluck('name', 'market_id');
|
||||
case 2:
|
||||
return TxoddsMarket::where('ice_hockey', 1)->pluck('name', 'market_id');
|
||||
case 3:
|
||||
return TxoddsMarket::where('basketball', 1)->pluck('name', 'market_id');
|
||||
case 5:
|
||||
return TxoddsMarket::where('tennis', 1)->pluck('name', 'market_id');
|
||||
}
|
||||
})
|
||||
->placeholder('All Markets'),
|
||||
])->space(3),
|
||||
|
||||
Stack::make([
|
||||
TextInputColumn::make('days_from')->prefix('Days Fr')
|
||||
->hidden(function (ListSupervisors $livewire) {
|
||||
return in_array($livewire->tableFilters['provider_id']['value'], [7, 8, 11, 12]);
|
||||
}),
|
||||
TextInputColumn::make('days_to')->prefix('Days To')
|
||||
->hidden(function (ListSupervisors $livewire) {
|
||||
return in_array($livewire->tableFilters['provider_id']['value'], [7, 8, 11, 12]);
|
||||
}),
|
||||
])->space(3),
|
||||
Stack::make([
|
||||
TextColumn::make('lastcall')
|
||||
->prefix('Lastcall: ')
|
||||
->badge()
|
||||
->color(fn ($state): string => ($state > 0 && $state > time() - 300) ? 'success' : 'danger')
|
||||
->dateTime()
|
||||
->visible(function (ListSupervisors $livewire) {
|
||||
return $livewire->tableFilters['provider_id']['value'] == 8;
|
||||
}),
|
||||
TextInputColumn::make('sleep')->prefix('Seep')
|
||||
->hidden(function (ListSupervisors $livewire) {
|
||||
return in_array($livewire->tableFilters['provider_id']['value'], [8, 12]);
|
||||
}),
|
||||
TextInputColumn::make('commandline_options')->prefix('Bash')
|
||||
->tooltip('command used in supervisor script')
|
||||
->hidden(function (ListSupervisors $livewire) {
|
||||
return in_array($livewire->tableFilters['provider_id']['value'], [8, 12]);
|
||||
}),
|
||||
])->space(3),
|
||||
SelectColumn::make('is_supervisor')
|
||||
->allowOptionsHtml()
|
||||
->native(false)
|
||||
->options([
|
||||
'0' => '<span class="text-amber-600">Cronjob</span>',
|
||||
'1' => '<span class="text-blue-600">Supervisor</span>',
|
||||
'2' => '<span class="text-green-600">LaunchAgents</span>',
|
||||
]),
|
||||
ToggleColumn::make('is_active')->label('Active')->tooltip(('On/Off'))->onColor('success')->offColor('danger'),
|
||||
TextColumn::make('runtime')->badge()->prefix('Runtime: '),
|
||||
]),
|
||||
])
|
||||
->filters([
|
||||
SelectFilter::make('provider_id')
|
||||
->selectablePlaceholder(false)
|
||||
->relationship('provider', 'name')
|
||||
->label('Provider'),
|
||||
SelectFilter::make('sport_id')
|
||||
->relationship('sport', 'name')
|
||||
->label('Sport'),
|
||||
TernaryFilter::make('is_supervisor')->label('Run by supervisor'),
|
||||
TernaryFilter::make('is_active'),
|
||||
], layout: FiltersLayout::AboveContent)
|
||||
->deferFilters(false)
|
||||
->persistFiltersInSession()
|
||||
->recordActions([
|
||||
EditAction::make()->hiddenLabel(),
|
||||
DeleteAction::make()->hiddenLabel(),
|
||||
])
|
||||
->toolbarActions([
|
||||
BulkActionGroup::make([
|
||||
BulkAction::make('sleep')
|
||||
->label('Sleep')
|
||||
->icon('phosphor-timer')
|
||||
->action(function (Collection $records, array $data): void {
|
||||
foreach ($records as $record) {
|
||||
Supervisor::where('id', '=', $record->id)
|
||||
->update(
|
||||
['sleep' => $data['sleep']]
|
||||
);
|
||||
}
|
||||
})
|
||||
->form([
|
||||
TextInput::make('sleep')->hiddenLabel()->prefix('Sleep'),
|
||||
]),
|
||||
BulkAction::make('Switch On')
|
||||
->icon('phosphor-play')
|
||||
->action(function (Collection $records): void {
|
||||
foreach ($records as $record) {
|
||||
Supervisor::where('id', '=', $record->id)
|
||||
->update(
|
||||
['is_active' => 1]
|
||||
);
|
||||
}
|
||||
}),
|
||||
BulkAction::make('Switch Off')
|
||||
->icon('phosphor-stop')
|
||||
->action(function (Collection $records): void {
|
||||
foreach ($records as $record) {
|
||||
Supervisor::where('id', '=', $record->id)
|
||||
->update(
|
||||
['is_active' => 0]
|
||||
);
|
||||
}
|
||||
}),
|
||||
BulkAction::make('As supervisor')
|
||||
->icon('phosphor-play')
|
||||
->action(function (Collection $records): void {
|
||||
foreach ($records as $record) {
|
||||
Supervisor::where('id', '=', $record->id)
|
||||
->update(
|
||||
['is_supervisor' => 1]
|
||||
);
|
||||
}
|
||||
}),
|
||||
BulkAction::make('Not as supervisor')
|
||||
->icon('phosphor-stop')
|
||||
->action(function (Collection $records): void {
|
||||
foreach ($records as $record) {
|
||||
Supervisor::where('id', '=', $record->id)
|
||||
->update(
|
||||
['is_supervisor' => 0]
|
||||
);
|
||||
}
|
||||
}),
|
||||
|
||||
DeleteBulkAction::make(),
|
||||
]),
|
||||
]);
|
||||
}
|
||||
}
|
||||
@@ -1,49 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Clusters\StaticData\Resources\Bettypes;
|
||||
|
||||
use App\Filament\Clusters\StaticData\Resources\Bettypes\Pages\ListBettypes;
|
||||
use App\Filament\Clusters\StaticData\Resources\Bettypes\Schemas\BettypeForm;
|
||||
use App\Filament\Clusters\StaticData\Resources\Bettypes\Tables\BettypesTable;
|
||||
use App\Filament\Clusters\StaticData\StaticDataCluster;
|
||||
use App\Models\Bettype;
|
||||
use Filament\Resources\Resource;
|
||||
use Filament\Schemas\Schema;
|
||||
use Filament\Tables\Table;
|
||||
|
||||
class BettypeResource extends Resource
|
||||
{
|
||||
protected static ?string $model = Bettype::class;
|
||||
|
||||
protected static ?string $cluster = StaticDataCluster::class;
|
||||
|
||||
protected static ?string $navigationLabel = 'NuhOdds Markets';
|
||||
|
||||
protected static ?string $modelLabel = 'NuhOdds Markets';
|
||||
|
||||
protected static ?int $navigationSort = 31;
|
||||
|
||||
protected static string|\UnitEnum|null $navigationGroup = 'Markets';
|
||||
|
||||
public static function form(Schema $schema): Schema
|
||||
{
|
||||
return BettypeForm::configure($schema);
|
||||
}
|
||||
|
||||
public static function table(Table $table): Table
|
||||
{
|
||||
return BettypesTable::configure($table);
|
||||
}
|
||||
|
||||
public static function getPages(): array
|
||||
{
|
||||
return [
|
||||
'index' => ListBettypes::route('/'),
|
||||
];
|
||||
}
|
||||
|
||||
public static function getNavigationBadge(): ?string
|
||||
{
|
||||
return parent::getEloquentQuery()->count();
|
||||
}
|
||||
}
|
||||
@@ -1,11 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Clusters\StaticData\Resources\Bettypes\Pages;
|
||||
|
||||
use App\Filament\Clusters\StaticData\Resources\Bettypes\BettypeResource;
|
||||
use Filament\Resources\Pages\CreateRecord;
|
||||
|
||||
class CreateBettype extends CreateRecord
|
||||
{
|
||||
protected static string $resource = BettypeResource::class;
|
||||
}
|
||||
@@ -1,19 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Clusters\StaticData\Resources\Bettypes\Pages;
|
||||
|
||||
use App\Filament\Clusters\StaticData\Resources\Bettypes\BettypeResource;
|
||||
use Filament\Actions\DeleteAction;
|
||||
use Filament\Resources\Pages\EditRecord;
|
||||
|
||||
class EditBettype extends EditRecord
|
||||
{
|
||||
protected static string $resource = BettypeResource::class;
|
||||
|
||||
protected function getHeaderActions(): array
|
||||
{
|
||||
return [
|
||||
DeleteAction::make(),
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -1,11 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Clusters\StaticData\Resources\Bettypes\Pages;
|
||||
|
||||
use App\Filament\Clusters\StaticData\Resources\Bettypes\BettypeResource;
|
||||
use Filament\Resources\Pages\ListRecords;
|
||||
|
||||
class ListBettypes extends ListRecords
|
||||
{
|
||||
protected static string $resource = BettypeResource::class;
|
||||
}
|
||||
@@ -1,16 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Clusters\StaticData\Resources\Bettypes\Schemas;
|
||||
|
||||
use Filament\Schemas\Schema;
|
||||
|
||||
class BettypeForm
|
||||
{
|
||||
public static function configure(Schema $schema): Schema
|
||||
{
|
||||
return $schema
|
||||
->components([
|
||||
//
|
||||
]);
|
||||
}
|
||||
}
|
||||
@@ -1,70 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Clusters\StaticData\Resources\Bettypes\Tables;
|
||||
|
||||
use App\Models\Sport;
|
||||
use Filament\Actions\EditAction;
|
||||
use Filament\Forms\Components\Select;
|
||||
use Filament\Tables\Columns\IconColumn;
|
||||
use Filament\Tables\Columns\TextColumn;
|
||||
use Filament\Tables\Enums\FiltersLayout;
|
||||
use Filament\Tables\Filters\Filter;
|
||||
use Filament\Tables\Filters\SelectFilter;
|
||||
use Filament\Tables\Table;
|
||||
use Illuminate\Database\Eloquent\Builder;
|
||||
|
||||
class BettypesTable
|
||||
{
|
||||
public static function configure(Table $table): Table
|
||||
{
|
||||
return $table
|
||||
->striped()
|
||||
->recordAction(null)
|
||||
->columns([
|
||||
TextColumn::make('bettype_id')
|
||||
->width('1rem')
|
||||
->searchable()->label('Id'),
|
||||
IconColumn::make('sport.icon')
|
||||
->label('')
|
||||
->width('1rem')
|
||||
->icon(function ($record): string {
|
||||
return $record->sport->icon;
|
||||
}),
|
||||
TextColumn::make('sport.name'),
|
||||
TextColumn::make('name')->searchable(),
|
||||
IconColumn::make('ft')->boolean()->trueIcon('phosphor-check-circle-fill')->falseIcon('phosphor-circle')->falseColor('gray'),
|
||||
IconColumn::make('ht')->boolean()->trueIcon('phosphor-check-circle-fill')->falseIcon('phosphor-circle')->falseColor('gray'),
|
||||
IconColumn::make('h2')->boolean()->trueIcon('phosphor-check-circle-fill')->falseIcon('phosphor-circle')->falseColor('gray'),
|
||||
IconColumn::make('co')->boolean()->trueIcon('phosphor-check-circle-fill')->falseIcon('phosphor-circle')->falseColor('gray'),
|
||||
IconColumn::make('q1')->boolean()->trueIcon('phosphor-check-circle-fill')->falseIcon('phosphor-circle')->falseColor('gray'),
|
||||
IconColumn::make('p1')->boolean()->trueIcon('phosphor-check-circle-fill')->falseIcon('phosphor-circle')->falseColor('gray'),
|
||||
IconColumn::make('q1')->boolean()->trueIcon('phosphor-check-circle-fill')->falseIcon('phosphor-circle')->falseColor('gray'),
|
||||
])
|
||||
->filters([
|
||||
Filter::make('sport_id')
|
||||
->schema([
|
||||
Select::make(name: 'sport_id')
|
||||
->placeholder('Filter Sport')
|
||||
->hiddenLabel()
|
||||
->preload()
|
||||
->options(fn () => Sport::where('is_active', 1)->pluck('name', 'id'))
|
||||
->live(),
|
||||
])
|
||||
->query(function (Builder $query, array $data): Builder {
|
||||
return $query
|
||||
->when(
|
||||
$data['sport_id'],
|
||||
fn (Builder $query, $sport_id) => $query->where('sport_id', $sport_id)
|
||||
);
|
||||
}),
|
||||
// SelectFilter::make('sport_id')
|
||||
// ->label('')
|
||||
// ->options(fn () => Sport::where('is_active', 1)->pluck('name', 'id')
|
||||
// ->toArray()),
|
||||
], layout: FiltersLayout::AboveContent)
|
||||
->deferFilters(false)
|
||||
->recordActions([
|
||||
EditAction::make()->hiddenLabel(),
|
||||
]);
|
||||
}
|
||||
}
|
||||
-52
@@ -1,52 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Clusters\StaticData\Resources\CompetitionGroups;
|
||||
|
||||
use App\Filament\Clusters\StaticData\Resources\CompetitionGroups\Pages\ListCompetitionGroups;
|
||||
use App\Filament\Clusters\StaticData\Resources\CompetitionGroups\Schemas\CompetitionGroupForm;
|
||||
use App\Filament\Clusters\StaticData\Resources\CompetitionGroups\Tables\CompetitionGroupsTable;
|
||||
use App\Filament\Clusters\StaticData\StaticDataCluster;
|
||||
use App\Models\CompetitionGroup;
|
||||
use Filament\Resources\Resource;
|
||||
use Filament\Schemas\Schema;
|
||||
use Filament\Tables\Table;
|
||||
use UnitEnum;
|
||||
|
||||
class CompetitionGroupResource extends Resource
|
||||
{
|
||||
protected static ?string $model = CompetitionGroup::class;
|
||||
|
||||
protected static ?string $recordTitleAttribute = 'name';
|
||||
|
||||
protected static ?string $cluster = StaticDataCluster::class;
|
||||
|
||||
protected static string|UnitEnum|null $navigationGroup = 'TxOdds';
|
||||
|
||||
protected static ?string $modelLabel = 'Leagues';
|
||||
|
||||
protected static ?int $navigationSort = 11;
|
||||
|
||||
protected static ?string $navigationLabel = 'Leagues';
|
||||
|
||||
public static function form(Schema $schema): Schema
|
||||
{
|
||||
return CompetitionGroupForm::configure($schema);
|
||||
}
|
||||
|
||||
public static function table(Table $table): Table
|
||||
{
|
||||
return CompetitionGroupsTable::configure($table);
|
||||
}
|
||||
|
||||
public static function getPages(): array
|
||||
{
|
||||
return [
|
||||
'index' => ListCompetitionGroups::route('/'),
|
||||
];
|
||||
}
|
||||
|
||||
public static function getNavigationBadge(): ?string
|
||||
{
|
||||
return parent::getEloquentQuery()->count();
|
||||
}
|
||||
}
|
||||
-11
@@ -1,11 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Clusters\StaticData\Resources\CompetitionGroups\Pages;
|
||||
|
||||
use App\Filament\Clusters\StaticData\Resources\CompetitionGroups\CompetitionGroupResource;
|
||||
use Filament\Resources\Pages\CreateRecord;
|
||||
|
||||
class CreateCompetitionGroup extends CreateRecord
|
||||
{
|
||||
protected static string $resource = CompetitionGroupResource::class;
|
||||
}
|
||||
-11
@@ -1,11 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Clusters\StaticData\Resources\CompetitionGroups\Pages;
|
||||
|
||||
use App\Filament\Clusters\StaticData\Resources\CompetitionGroups\CompetitionGroupResource;
|
||||
use Filament\Resources\Pages\EditRecord;
|
||||
|
||||
class EditCompetitionGroup extends EditRecord
|
||||
{
|
||||
protected static string $resource = CompetitionGroupResource::class;
|
||||
}
|
||||
-11
@@ -1,11 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Clusters\StaticData\Resources\CompetitionGroups\Pages;
|
||||
|
||||
use App\Filament\Clusters\StaticData\Resources\CompetitionGroups\CompetitionGroupResource;
|
||||
use Filament\Resources\Pages\ListRecords;
|
||||
|
||||
class ListCompetitionGroups extends ListRecords
|
||||
{
|
||||
protected static string $resource = CompetitionGroupResource::class;
|
||||
}
|
||||
-18
@@ -1,18 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Clusters\StaticData\Resources\CompetitionGroups\Schemas;
|
||||
|
||||
use Filament\Forms\Components\TextInput;
|
||||
use Filament\Schemas\Schema;
|
||||
|
||||
class CompetitionGroupForm
|
||||
{
|
||||
public static function configure(Schema $schema): Schema
|
||||
{
|
||||
return $schema
|
||||
->components([
|
||||
TextInput::make('name')
|
||||
->required(),
|
||||
]);
|
||||
}
|
||||
}
|
||||
-115
@@ -1,115 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Clusters\StaticData\Resources\CompetitionGroups\Tables;
|
||||
|
||||
use App\Filament\Exports\CompetitionGroupExporter;
|
||||
use App\Models\CompetitionGroupProvider;
|
||||
use App\Models\Country;
|
||||
use App\Models\ElementGroup;
|
||||
use App\Models\Event;
|
||||
use App\Models\Group;
|
||||
use App\Models\Sport;
|
||||
use Filament\Actions\ActionGroup;
|
||||
use Filament\Actions\BulkActionGroup;
|
||||
use Filament\Actions\DeleteAction;
|
||||
use Filament\Actions\DeleteBulkAction;
|
||||
use Filament\Actions\EditAction;
|
||||
use Filament\Actions\ExportAction;
|
||||
use Filament\Actions\Exports\Enums\ExportFormat;
|
||||
use Filament\Notifications\Notification;
|
||||
use Filament\Tables\Columns\IconColumn;
|
||||
use Filament\Tables\Columns\SelectColumn;
|
||||
use Filament\Tables\Columns\TextColumn;
|
||||
use Filament\Tables\Enums\FiltersLayout;
|
||||
use Filament\Tables\Filters\SelectFilter;
|
||||
use Filament\Tables\Table;
|
||||
|
||||
class CompetitionGroupsTable
|
||||
{
|
||||
public static function configure(Table $table): Table
|
||||
{
|
||||
return $table
|
||||
->striped()
|
||||
->columns([
|
||||
IconColumn::make('sport.icon')
|
||||
->label('')
|
||||
->grow(false)
|
||||
->color('primary')
|
||||
->width(30)
|
||||
->icon(fn($record) => $record->sport->icon)
|
||||
->tooltip(fn($record) => $record->id)
|
||||
->visibleFrom('lg'),
|
||||
TextColumn::make('id')->copyable()->alignCenter()->tooltip('Click to copy')
|
||||
->sortable(),
|
||||
TextColumn::make('name')
|
||||
->sortable()
|
||||
->color('primary')
|
||||
->searchable(),
|
||||
TextColumn::make('country.name')
|
||||
->wrap()
|
||||
->sortable()
|
||||
->color('gray')
|
||||
->label('Country')
|
||||
->icon(fn($record) => $record->country->icon),
|
||||
SelectColumn::make('level')
|
||||
->sortable()
|
||||
->width(30)
|
||||
->options([
|
||||
'TOP' => 'TOP',
|
||||
'MEDIUM' => 'MEDIUM',
|
||||
'LOW' => 'LOW',
|
||||
]),
|
||||
])->filters([
|
||||
SelectFilter::make('sport_id')
|
||||
->label('Sport')
|
||||
->default(1)
|
||||
->selectablePlaceholder(false)
|
||||
->options(fn() => Sport::where('is_active', 1)->pluck('name', 'id')->toArray()),
|
||||
SelectFilter::make('country_id')
|
||||
->searchable()
|
||||
->label('Countries')
|
||||
->options(fn() => Country::orderBy('name')->pluck('name', 'id')->toArray()),
|
||||
], layout: FiltersLayout::AboveContent)
|
||||
->deferFilters(false)
|
||||
->recordActions([
|
||||
ActionGroup::make([
|
||||
EditAction::make(),
|
||||
DeleteAction::make()
|
||||
->tooltip('All elements connected to this group, including active events, will be deleted')
|
||||
->before(function ($record) {
|
||||
Group::where('competition_group_id', $record->id)->delete();
|
||||
Event::where('competition_group_id', $record->id)->delete();
|
||||
ElementGroup::where('competition_group_id', $record->id)->delete();
|
||||
CompetitionGroupProvider::where('competition_group_id', $record->id)->delete();
|
||||
})
|
||||
->successNotification(
|
||||
Notification::make()
|
||||
->success()
|
||||
->title('Group deleted')
|
||||
->body('The group and all relations has been deleted successfully.'),
|
||||
),
|
||||
])->iconButton()
|
||||
->icon('phosphor-dots-three-vertical'),
|
||||
])
|
||||
->headerActions([
|
||||
ExportAction::make()
|
||||
->modalHeading('Download Tournaments')
|
||||
->color('warning')
|
||||
->label('Export')
|
||||
->icon('phosphor-download')
|
||||
->modalDescription('This will download the TxOdds tournaments with "sport_id" and "country_id" for the sport selected.')
|
||||
->modalIcon('phosphor-microsoft-excel-logo')
|
||||
->exporter(CompetitionGroupExporter::class)
|
||||
->columnMapping(false)
|
||||
->formats([
|
||||
ExportFormat::Xlsx,
|
||||
ExportFormat::Csv,
|
||||
]),
|
||||
])
|
||||
->toolbarActions([
|
||||
BulkActionGroup::make([
|
||||
DeleteBulkAction::make(),
|
||||
]),
|
||||
]);
|
||||
}
|
||||
}
|
||||
-52
@@ -1,52 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Clusters\StaticData\Resources\CompetitonGroupProviders;
|
||||
|
||||
use App\Filament\Clusters\StaticData\Resources\CompetitonGroupProviders\Pages\ListCompetitonGroupProviders;
|
||||
use App\Filament\Clusters\StaticData\Resources\CompetitonGroupProviders\Schemas\CompetitonGroupProviderForm;
|
||||
use App\Filament\Clusters\StaticData\Resources\CompetitonGroupProviders\Tables\CompetitonGroupProvidersTable;
|
||||
use App\Filament\Clusters\StaticData\StaticDataCluster;
|
||||
use App\Models\CompetitionGroupProvider;
|
||||
use Filament\Resources\Resource;
|
||||
use Filament\Schemas\Schema;
|
||||
use Filament\Tables\Table;
|
||||
use UnitEnum;
|
||||
|
||||
class CompetitonGroupProviderResource extends Resource
|
||||
{
|
||||
protected static ?string $model = CompetitionGroupProvider::class;
|
||||
|
||||
protected static ?string $recordTitleAttribute = 'name';
|
||||
|
||||
protected static ?string $modelLabel = 'Provider Groups';
|
||||
|
||||
protected static ?string $cluster = StaticDataCluster::class;
|
||||
|
||||
protected static ?int $navigationSort = 22;
|
||||
|
||||
protected static string|UnitEnum|null $navigationGroup = 'Provider Relations';
|
||||
|
||||
protected static ?string $navigationLabel = 'Provider Groups';
|
||||
|
||||
public static function form(Schema $schema): Schema
|
||||
{
|
||||
return CompetitonGroupProviderForm::configure($schema);
|
||||
}
|
||||
|
||||
public static function table(Table $table): Table
|
||||
{
|
||||
return CompetitonGroupProvidersTable::configure($table);
|
||||
}
|
||||
|
||||
public static function getPages(): array
|
||||
{
|
||||
return [
|
||||
'index' => ListCompetitonGroupProviders::route('/'),
|
||||
];
|
||||
}
|
||||
|
||||
public static function getNavigationBadge(): ?string
|
||||
{
|
||||
return parent::getEloquentQuery()->count();
|
||||
}
|
||||
}
|
||||
-11
@@ -1,11 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Clusters\StaticData\Resources\CompetitonGroupProviders\Pages;
|
||||
|
||||
use App\Filament\Clusters\StaticData\Resources\CompetitonGroupProviders\CompetitonGroupProviderResource;
|
||||
use Filament\Resources\Pages\CreateRecord;
|
||||
|
||||
class CreateCompetitonGroupProvider extends CreateRecord
|
||||
{
|
||||
protected static string $resource = CompetitonGroupProviderResource::class;
|
||||
}
|
||||
-19
@@ -1,19 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Clusters\StaticData\Resources\CompetitonGroupProviders\Pages;
|
||||
|
||||
use App\Filament\Clusters\StaticData\Resources\CompetitonGroupProviders\CompetitonGroupProviderResource;
|
||||
use Filament\Actions\DeleteAction;
|
||||
use Filament\Resources\Pages\EditRecord;
|
||||
|
||||
class EditCompetitonGroupProvider extends EditRecord
|
||||
{
|
||||
protected static string $resource = CompetitonGroupProviderResource::class;
|
||||
|
||||
protected function getHeaderActions(): array
|
||||
{
|
||||
return [
|
||||
DeleteAction::make(),
|
||||
];
|
||||
}
|
||||
}
|
||||
-11
@@ -1,11 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Clusters\StaticData\Resources\CompetitonGroupProviders\Pages;
|
||||
|
||||
use App\Filament\Clusters\StaticData\Resources\CompetitonGroupProviders\CompetitonGroupProviderResource;
|
||||
use Filament\Resources\Pages\ListRecords;
|
||||
|
||||
class ListCompetitonGroupProviders extends ListRecords
|
||||
{
|
||||
protected static string $resource = CompetitonGroupProviderResource::class;
|
||||
}
|
||||
-18
@@ -1,18 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Clusters\StaticData\Resources\CompetitonGroupProviders\Schemas;
|
||||
|
||||
use Filament\Forms\Components\TextInput;
|
||||
use Filament\Schemas\Schema;
|
||||
|
||||
class CompetitonGroupProviderForm
|
||||
{
|
||||
public static function configure(Schema $schema): Schema
|
||||
{
|
||||
return $schema
|
||||
->components([
|
||||
TextInput::make('name')
|
||||
->required(),
|
||||
]);
|
||||
}
|
||||
}
|
||||
-98
@@ -1,98 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Clusters\StaticData\Resources\CompetitonGroupProviders\Tables;
|
||||
|
||||
use App\Models\AddByMethod;
|
||||
use App\Models\Country;
|
||||
use App\Models\Provider;
|
||||
use App\Models\Sport;
|
||||
use Filament\Actions\ActionGroup;
|
||||
use Filament\Actions\BulkActionGroup;
|
||||
use Filament\Actions\DeleteAction;
|
||||
use Filament\Actions\DeleteBulkAction;
|
||||
use Filament\Actions\EditAction;
|
||||
use Filament\Notifications\Notification;
|
||||
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 CompetitonGroupProvidersTable
|
||||
{
|
||||
public static function configure(Table $table): Table
|
||||
{
|
||||
return $table
|
||||
->striped()
|
||||
->columns([
|
||||
IconColumn::make('sport.icon')
|
||||
->label('')
|
||||
->grow(false)
|
||||
->color('primary')
|
||||
->width(30)
|
||||
->icon(fn ($record) => $record->sport->icon)
|
||||
->tooltip(fn ($record) => $record->id)
|
||||
->visibleFrom('lg'),
|
||||
TextColumn::make('provider.name')->color(fn ($record) => $record->provider->color),
|
||||
TextColumn::make('competition_group.country.name')
|
||||
->wrap()
|
||||
->color('gray')
|
||||
->label('Country')
|
||||
->icon(fn ($record) => $record->competition_group->country->icon),
|
||||
TextColumn::make('competition_group.name')
|
||||
->label('Provider')
|
||||
->searchable(),
|
||||
TextColumn::make('provider_group_id')->label('PrId')->alignCenter(),
|
||||
TextColumn::make('id')->label('TxId')->alignCenter(),
|
||||
TextColumn::make('name')
|
||||
->label('TxOdds')
|
||||
->searchable(),
|
||||
TextColumn::make('add_by_method.name')
|
||||
->color(fn ($record) => $record->add_by_method->color)
|
||||
->label('Add By'),
|
||||
])->filters([
|
||||
SelectFilter::make('sport_id')
|
||||
->label('Sport')
|
||||
->options(Sport::where('is_active', 1)->pluck('name', 'id')),
|
||||
SelectFilter::make('country_id')
|
||||
->searchable()
|
||||
->label('Country')
|
||||
->options(Country::orderBy('name')->pluck('name', 'id'))
|
||||
->query(function (Builder $query, array $data) {
|
||||
if (blank($data['value'])) {
|
||||
return $query;
|
||||
}
|
||||
|
||||
return $query->whereHas('competition_group', function (Builder $query) use ($data) {
|
||||
return $query->where('country_id', $data['value']);
|
||||
});
|
||||
}),
|
||||
SelectFilter::make('provider_id')
|
||||
->label('Provider')
|
||||
->options(Provider::where('color', '!=', null)->pluck('name', 'id')),
|
||||
SelectFilter::make('add_by_method_id')
|
||||
->label('Provider')
|
||||
->options(AddByMethod::pluck('name', 'id')),
|
||||
], layout: FiltersLayout::AboveContent)
|
||||
->deferFilters(false)
|
||||
->recordActions([
|
||||
ActionGroup::make([
|
||||
EditAction::make(),
|
||||
DeleteAction::make()
|
||||
->successNotification(
|
||||
Notification::make()
|
||||
->success()
|
||||
->title('Group deleted')
|
||||
->body('The provider group has been deleted successfully.'),
|
||||
),
|
||||
])->iconButton()
|
||||
->icon('phosphor-dots-three-vertical'),
|
||||
])
|
||||
->toolbarActions([
|
||||
BulkActionGroup::make([
|
||||
DeleteBulkAction::make(),
|
||||
]),
|
||||
]);
|
||||
}
|
||||
}
|
||||
@@ -1,163 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Clusters\StaticData\Resources\Countries;
|
||||
|
||||
use App\Filament\Clusters\StaticData\Resources\Countries\Pages\ManageCountries;
|
||||
use App\Filament\Clusters\StaticData\StaticDataCluster;
|
||||
use App\Filament\Exports\CountryExporter;
|
||||
use App\Models\Country;
|
||||
use Filament\Actions\BulkAction;
|
||||
use Filament\Actions\BulkActionGroup;
|
||||
use Filament\Actions\EditAction;
|
||||
use Filament\Actions\ExportAction;
|
||||
use Filament\Actions\Exports\Enums\ExportFormat;
|
||||
use Filament\Forms\Components\Select;
|
||||
use Filament\Forms\Components\TextInput;
|
||||
use Filament\Forms\Components\Toggle;
|
||||
use Filament\Resources\Resource;
|
||||
use Filament\Schemas\Schema;
|
||||
use Filament\Support\Enums\IconSize;
|
||||
use Filament\Tables\Columns\IconColumn;
|
||||
use Filament\Tables\Columns\TextColumn;
|
||||
use Filament\Tables\Enums\FiltersLayout;
|
||||
use Filament\Tables\Filters\Filter;
|
||||
use Filament\Tables\Filters\TernaryFilter;
|
||||
use Filament\Tables\Table;
|
||||
use Illuminate\Database\Eloquent\Builder;
|
||||
use Illuminate\Database\Eloquent\Collection;
|
||||
|
||||
class CountryResource extends Resource
|
||||
{
|
||||
protected static ?string $model = Country::class;
|
||||
|
||||
protected static ?int $navigationSort = 13;
|
||||
|
||||
protected static ?string $cluster = StaticDataCluster::class;
|
||||
|
||||
protected static string|\UnitEnum|null $navigationGroup = 'TxOdds';
|
||||
|
||||
public static function form(Schema $schema): Schema
|
||||
{
|
||||
return $schema
|
||||
->components([
|
||||
TextInput::make('name')->required(),
|
||||
TextInput::make('icon'),
|
||||
TextInput::make('iso2')->maxLength(2),
|
||||
TextInput::make('iso3')->maxLength(3),
|
||||
TextInput::make('cc'),
|
||||
TextInput::make('numeric'),
|
||||
Toggle::make('is_country'),
|
||||
Toggle::make('disabled')->label('Disable')->aboveLabel(['Hide in this table']),
|
||||
Select::make('season_mode')
|
||||
->options([
|
||||
'halfyear' => 'Half Year (25/26)',
|
||||
'fullyear' => 'Full Year (2026)',
|
||||
])
|
||||
]);
|
||||
}
|
||||
|
||||
public static function table(Table $table): Table
|
||||
{
|
||||
return $table
|
||||
->striped()
|
||||
->recordAction(null)
|
||||
->recordTitleAttribute('name')
|
||||
->columns([
|
||||
TextColumn::make('id')->searchable()
|
||||
->sortable()
|
||||
->alignCenter()->tooltip('Click to copy'),
|
||||
TextColumn::make('name')
|
||||
->searchable()
|
||||
->sortable()
|
||||
->color('primary')
|
||||
->copyable(),
|
||||
TextColumn::make('season_mode')
|
||||
->sortable()
|
||||
->badge()
|
||||
->formatStateUsing(fn(string $state): string => strtoupper($state))
|
||||
->color(fn(string $state): string => match ($state) {
|
||||
'halfyear' => 'warning',
|
||||
'fullyear' => 'success',
|
||||
}),
|
||||
IconColumn::make('icon')
|
||||
->sortable()
|
||||
->icon(function ($state): string {
|
||||
return $state;
|
||||
})->label('Flags')->size(IconSize::TwoExtraLarge),
|
||||
TextColumn::make('iso3')
|
||||
->sortable(),
|
||||
TextColumn::make('cc')
|
||||
->sortable(),
|
||||
TextColumn::make('numeric')
|
||||
->sortable(),
|
||||
IconColumn::make('is_country')->alignCenter()->boolean()
|
||||
->sortable(),
|
||||
|
||||
])
|
||||
->defaultSort('name', direction: 'asc')
|
||||
->filters([
|
||||
TernaryFilter::make('is_country'),
|
||||
|
||||
Filter::make('icon')
|
||||
->label('Missing Icons')
|
||||
->query(fn(Builder $query): Builder => $query->whereNull('icon')),
|
||||
], layout: FiltersLayout::AboveContent)
|
||||
->deferFilters(false)
|
||||
->headerActions([
|
||||
ExportAction::make()
|
||||
->modalHeading('Download Countries')
|
||||
->label('Export')
|
||||
->color('warning')
|
||||
->icon('phosphor-download')
|
||||
->modalDescription('This will download the Countries (id, name) from TxOdds.')
|
||||
->modalIcon('phosphor-microsoft-excel-logo')
|
||||
->exporter(CountryExporter::class)
|
||||
->columnMapping(false)
|
||||
->modifyQueryUsing(fn(Builder $query) => $query->where('is_country', true))
|
||||
->formats([
|
||||
ExportFormat::Xlsx,
|
||||
ExportFormat::Csv,
|
||||
]),
|
||||
])
|
||||
->recordActions([
|
||||
EditAction::make()->hiddenLabel(),
|
||||
])->toolbarActions([
|
||||
BulkActionGroup::make([
|
||||
BulkAction::make('season_mode')
|
||||
->icon('phosphor-calendar')
|
||||
->action(function (Collection $records, array $data): void {
|
||||
foreach ($records as $record) {
|
||||
Country::where('id', '=', $record->id)
|
||||
->update(
|
||||
['season_mode' => $data['season_mode']]
|
||||
);
|
||||
}
|
||||
})
|
||||
->schema([
|
||||
Select::make('season_mode')
|
||||
->options([
|
||||
'halfyear' => 'Half Year (25/26)',
|
||||
'fullyear' => 'Full Year (2026)',
|
||||
])
|
||||
]),
|
||||
]),
|
||||
]);
|
||||
}
|
||||
|
||||
public static function getNavigationBadge(): ?string
|
||||
{
|
||||
return parent::getEloquentQuery()->where('disabled', false)->count();
|
||||
}
|
||||
|
||||
public static function getEloquentQuery(): Builder
|
||||
{
|
||||
return parent::getEloquentQuery()->where('disabled', false);
|
||||
}
|
||||
|
||||
public static function getPages(): array
|
||||
{
|
||||
return [
|
||||
'index' => ManageCountries::route('/'),
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -1,11 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Clusters\StaticData\Resources\Countries\Pages;
|
||||
|
||||
use App\Filament\Clusters\StaticData\Resources\Countries\CountryResource;
|
||||
use Filament\Resources\Pages\ManageRecords;
|
||||
|
||||
class ManageCountries extends ManageRecords
|
||||
{
|
||||
protected static string $resource = CountryResource::class;
|
||||
}
|
||||
-50
@@ -1,50 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Clusters\StaticData\Resources\ElementProviders;
|
||||
|
||||
use App\Filament\Clusters\StaticData\Resources\ElementProviders\Pages\ListElementProviders;
|
||||
use App\Filament\Clusters\StaticData\Resources\ElementProviders\Schemas\ElementProviderForm;
|
||||
use App\Filament\Clusters\StaticData\Resources\ElementProviders\Tables\ElementProvidersTable;
|
||||
use App\Filament\Clusters\StaticData\StaticDataCluster;
|
||||
use App\Models\ElementProvider;
|
||||
use Filament\Resources\Resource;
|
||||
use Filament\Schemas\Schema;
|
||||
use Filament\Tables\Table;
|
||||
use UnitEnum;
|
||||
|
||||
class ElementProviderResource extends Resource
|
||||
{
|
||||
protected static ?string $model = ElementProvider::class;
|
||||
|
||||
protected static ?string $recordTitleAttribute = 'name';
|
||||
|
||||
protected static ?int $navigationSort = 21;
|
||||
|
||||
protected static ?string $cluster = StaticDataCluster::class;
|
||||
|
||||
protected static string|UnitEnum|null $navigationGroup = 'Provider Relations';
|
||||
|
||||
protected static ?string $navigationLabel = 'Provider Elements';
|
||||
|
||||
public static function form(Schema $schema): Schema
|
||||
{
|
||||
return ElementProviderForm::configure($schema);
|
||||
}
|
||||
|
||||
public static function table(Table $table): Table
|
||||
{
|
||||
return ElementProvidersTable::configure($table);
|
||||
}
|
||||
|
||||
public static function getPages(): array
|
||||
{
|
||||
return [
|
||||
'index' => ListElementProviders::route('/'),
|
||||
];
|
||||
}
|
||||
|
||||
public static function getNavigationBadge(): ?string
|
||||
{
|
||||
return parent::getEloquentQuery()->count();
|
||||
}
|
||||
}
|
||||
-11
@@ -1,11 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Clusters\StaticData\Resources\ElementProviders\Pages;
|
||||
|
||||
use App\Filament\Clusters\StaticData\Resources\ElementProviders\ElementProviderResource;
|
||||
use Filament\Resources\Pages\CreateRecord;
|
||||
|
||||
class CreateElementProvider extends CreateRecord
|
||||
{
|
||||
protected static string $resource = ElementProviderResource::class;
|
||||
}
|
||||
-19
@@ -1,19 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Clusters\StaticData\Resources\ElementProviders\Pages;
|
||||
|
||||
use App\Filament\Clusters\StaticData\Resources\ElementProviders\ElementProviderResource;
|
||||
use Filament\Actions\DeleteAction;
|
||||
use Filament\Resources\Pages\EditRecord;
|
||||
|
||||
class EditElementProvider extends EditRecord
|
||||
{
|
||||
protected static string $resource = ElementProviderResource::class;
|
||||
|
||||
protected function getHeaderActions(): array
|
||||
{
|
||||
return [
|
||||
DeleteAction::make(),
|
||||
];
|
||||
}
|
||||
}
|
||||
-11
@@ -1,11 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Clusters\StaticData\Resources\ElementProviders\Pages;
|
||||
|
||||
use App\Filament\Clusters\StaticData\Resources\ElementProviders\ElementProviderResource;
|
||||
use Filament\Resources\Pages\ListRecords;
|
||||
|
||||
class ListElementProviders extends ListRecords
|
||||
{
|
||||
protected static string $resource = ElementProviderResource::class;
|
||||
}
|
||||
-19
@@ -1,19 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Clusters\StaticData\Resources\ElementProviders\Schemas;
|
||||
|
||||
use Filament\Forms\Components\TextInput;
|
||||
use Filament\Schemas\Schema;
|
||||
|
||||
class ElementProviderForm
|
||||
{
|
||||
public static function configure(Schema $schema): Schema
|
||||
{
|
||||
return $schema
|
||||
->components([
|
||||
TextInput::make('name')
|
||||
->label('Client Name')
|
||||
->required(),
|
||||
]);
|
||||
}
|
||||
}
|
||||
-94
@@ -1,94 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Clusters\StaticData\Resources\ElementProviders\Tables;
|
||||
|
||||
use App\Models\AddByMethod;
|
||||
use App\Models\Country;
|
||||
use App\Models\Provider;
|
||||
use App\Models\Sport;
|
||||
use Filament\Actions\ActionGroup;
|
||||
use Filament\Actions\BulkActionGroup;
|
||||
use Filament\Actions\DeleteAction;
|
||||
use Filament\Actions\DeleteBulkAction;
|
||||
use Filament\Actions\EditAction;
|
||||
use Filament\Notifications\Notification;
|
||||
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\Contracts\Database\Eloquent\Builder;
|
||||
|
||||
class ElementProvidersTable
|
||||
{
|
||||
public static function configure(Table $table): Table
|
||||
{
|
||||
return $table
|
||||
->striped()
|
||||
->columns([
|
||||
IconColumn::make('sport.icon')
|
||||
->label('')
|
||||
->grow(false)
|
||||
->color('primary')
|
||||
->width(30)
|
||||
->icon(fn ($record) => $record->sport->icon)
|
||||
->tooltip(fn ($record) => $record->id)
|
||||
->visibleFrom('lg'),
|
||||
TextColumn::make('provider.name')->color(fn ($record) => $record->provider->color),
|
||||
TextColumn::make('element.country.name')
|
||||
->wrap()
|
||||
->color('gray')
|
||||
->icon(fn ($record) => $record->element->country->icon),
|
||||
TextColumn::make('id')->label('TxId')->alignCenter(),
|
||||
TextColumn::make('provider_element_id')->label('PrId')->alignCenter(),
|
||||
TextColumn::make('element_group.competition_group.name')->label('Group'),
|
||||
TextColumn::make('element.name')->label('TxOdds'),
|
||||
TextColumn::make('name')->label('Client')->searchable(),
|
||||
TextColumn::make('add_by_method.name')
|
||||
->color(fn ($record) => $record->add_by_method->color)
|
||||
->label('Add By'),
|
||||
])->filters([
|
||||
SelectFilter::make('provider_id')
|
||||
->label('Provider')
|
||||
->options(Provider::where('bookmaker_id', '>', 0)->pluck('name', 'id')),
|
||||
SelectFilter::make('sport_id')
|
||||
->label('Sport')
|
||||
->options(Sport::where('is_active', 1)->pluck('name', 'id')),
|
||||
SelectFilter::make('country_id')
|
||||
->searchable()
|
||||
->label('Country')
|
||||
->options(Country::orderBy('name')->pluck('name', 'id'))
|
||||
->query(function (Builder $query, array $data) {
|
||||
if (blank($data['value'])) {
|
||||
return $query;
|
||||
}
|
||||
|
||||
return $query->whereHas('element', function (Builder $query) use ($data) {
|
||||
return $query->where('country_id', $data['value']);
|
||||
});
|
||||
}),
|
||||
SelectFilter::make('add_by_method_id')
|
||||
->label('Add By')
|
||||
->options(AddByMethod::pluck('name', 'id')),
|
||||
], layout: FiltersLayout::AboveContent)
|
||||
->deferFilters(false)
|
||||
->recordActions([
|
||||
ActionGroup::make([
|
||||
EditAction::make(),
|
||||
DeleteAction::make()
|
||||
->successNotification(
|
||||
Notification::make()
|
||||
->success()
|
||||
->title('Element deleted')
|
||||
->body('The provider element has been deleted successfully.'),
|
||||
),
|
||||
])->iconButton()
|
||||
->icon('phosphor-dots-three-vertical'),
|
||||
])
|
||||
->toolbarActions([
|
||||
BulkActionGroup::make([
|
||||
DeleteBulkAction::make(),
|
||||
]),
|
||||
]);
|
||||
}
|
||||
}
|
||||
@@ -1,48 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Clusters\StaticData\Resources\Elements;
|
||||
|
||||
use App\Filament\Clusters\StaticData\Resources\Elements\Pages\ListElements;
|
||||
use App\Filament\Clusters\StaticData\Resources\Elements\Schemas\ElementForm;
|
||||
use App\Filament\Clusters\StaticData\Resources\Elements\Tables\ElementsTable;
|
||||
use App\Filament\Clusters\StaticData\StaticDataCluster;
|
||||
use App\Models\Element;
|
||||
use Filament\Resources\Resource;
|
||||
use Filament\Schemas\Schema;
|
||||
use Filament\Tables\Table;
|
||||
use UnitEnum;
|
||||
|
||||
class ElementResource extends Resource
|
||||
{
|
||||
protected static ?string $model = Element::class;
|
||||
|
||||
protected static ?string $recordTitleAttribute = 'name';
|
||||
|
||||
protected static ?string $cluster = StaticDataCluster::class;
|
||||
|
||||
protected static string|UnitEnum|null $navigationGroup = 'TxOdds';
|
||||
|
||||
protected static ?int $navigationSort = 11;
|
||||
|
||||
public static function form(Schema $schema): Schema
|
||||
{
|
||||
return ElementForm::configure($schema);
|
||||
}
|
||||
|
||||
public static function table(Table $table): Table
|
||||
{
|
||||
return ElementsTable::configure($table);
|
||||
}
|
||||
|
||||
public static function getPages(): array
|
||||
{
|
||||
return [
|
||||
'index' => ListElements::route('/'),
|
||||
];
|
||||
}
|
||||
|
||||
public static function getNavigationBadge(): ?string
|
||||
{
|
||||
return parent::getEloquentQuery()->count();
|
||||
}
|
||||
}
|
||||
@@ -1,11 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Clusters\StaticData\Resources\Elements\Pages;
|
||||
|
||||
use App\Filament\Clusters\StaticData\Resources\Elements\ElementResource;
|
||||
use Filament\Resources\Pages\CreateRecord;
|
||||
|
||||
class CreateElement extends CreateRecord
|
||||
{
|
||||
protected static string $resource = ElementResource::class;
|
||||
}
|
||||
@@ -1,19 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Clusters\StaticData\Resources\Elements\Pages;
|
||||
|
||||
use App\Filament\Clusters\StaticData\Resources\Elements\ElementResource;
|
||||
use Filament\Actions\DeleteAction;
|
||||
use Filament\Resources\Pages\EditRecord;
|
||||
|
||||
class EditElement extends EditRecord
|
||||
{
|
||||
protected static string $resource = ElementResource::class;
|
||||
|
||||
protected function getHeaderActions(): array
|
||||
{
|
||||
return [
|
||||
DeleteAction::make(),
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -1,11 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Clusters\StaticData\Resources\Elements\Pages;
|
||||
|
||||
use App\Filament\Clusters\StaticData\Resources\Elements\ElementResource;
|
||||
use Filament\Resources\Pages\ListRecords;
|
||||
|
||||
class ListElements extends ListRecords
|
||||
{
|
||||
protected static string $resource = ElementResource::class;
|
||||
}
|
||||
@@ -1,18 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Clusters\StaticData\Resources\Elements\Schemas;
|
||||
|
||||
use Filament\Forms\Components\TextInput;
|
||||
use Filament\Schemas\Schema;
|
||||
|
||||
class ElementForm
|
||||
{
|
||||
public static function configure(Schema $schema): Schema
|
||||
{
|
||||
return $schema
|
||||
->components([
|
||||
TextInput::make('name')
|
||||
->required(),
|
||||
]);
|
||||
}
|
||||
}
|
||||
@@ -1,151 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Clusters\StaticData\Resources\Elements\Tables;
|
||||
|
||||
use App\Filament\Exports\ElementExporter;
|
||||
use App\Models\CompetitionGroup;
|
||||
use App\Models\Country;
|
||||
use App\Models\ElementGroup;
|
||||
use App\Models\ElementProvider;
|
||||
use App\Models\Event;
|
||||
use App\Models\Sport;
|
||||
use Filament\Actions\ActionGroup;
|
||||
use Filament\Actions\BulkActionGroup;
|
||||
use Filament\Actions\DeleteAction;
|
||||
use Filament\Actions\DeleteBulkAction;
|
||||
use Filament\Actions\EditAction;
|
||||
use Filament\Actions\ExportAction;
|
||||
use Filament\Actions\Exports\Enums\ExportFormat;
|
||||
use Filament\Forms\Components\Select;
|
||||
use Filament\Notifications\Notification;
|
||||
use Filament\Schemas\Components\Utilities\Get;
|
||||
use Filament\Tables\Columns\IconColumn;
|
||||
use Filament\Tables\Columns\ImageColumn;
|
||||
use Filament\Tables\Columns\TextColumn;
|
||||
use Filament\Tables\Enums\FiltersLayout;
|
||||
use Filament\Tables\Filters\Filter;
|
||||
use Filament\Tables\Filters\SelectFilter;
|
||||
use Filament\Tables\Table;
|
||||
use Illuminate\Database\Eloquent\Builder;
|
||||
|
||||
class ElementsTable
|
||||
{
|
||||
public static function configure(Table $table): Table
|
||||
{
|
||||
return $table
|
||||
->striped()
|
||||
->columns([
|
||||
IconColumn::make('sport.icon')
|
||||
->sortable()
|
||||
->label('')
|
||||
->grow(false)
|
||||
->width(30)
|
||||
->icon(fn($record) => $record->sport->icon)
|
||||
->tooltip(fn($record) => $record->id)
|
||||
->visibleFrom('lg'),
|
||||
TextColumn::make('id')
|
||||
->sortable()
|
||||
->tooltip('click to copy')
|
||||
->alignCenter()
|
||||
->copyable(),
|
||||
TextColumn::make('name')
|
||||
->sortable()
|
||||
->sortable()
|
||||
->searchable()
|
||||
->color('primary'),
|
||||
TextColumn::make('country.name')
|
||||
->wrap()
|
||||
->sortable()
|
||||
->color('gray')
|
||||
->icon(fn($record) => $record->country->icon),
|
||||
TextColumn::make('element_group.competition_group_id')->label('Group Id')
|
||||
->sortable()
|
||||
->alignCenter()
|
||||
->tooltip('click to copy')
|
||||
->copyable(),
|
||||
TextColumn::make('element_group.competition_group.name')->label('Group')
|
||||
->sortable(),
|
||||
// TextColumn::make('element_group.group.name')->label('Group'),
|
||||
ImageColumn::make('betsapi_image_id')
|
||||
->label('Logo')
|
||||
->defaultImageUrl(fn($state) => url('https://assets.b365api.com/images/team/m/' . $state . '.png')),
|
||||
])->filters([
|
||||
SelectFilter::make('sport_id')
|
||||
->label('Sport')
|
||||
->options(Sport::where('is_active', 1)->pluck('name', 'id')),
|
||||
Filter::make('competition_group')
|
||||
->columns(3)->columnSpan(3)
|
||||
->schema([
|
||||
Select::make('country_id')
|
||||
->searchable()
|
||||
->label('Country')
|
||||
->options(Country::orderBy('name')->pluck('name', 'id'))
|
||||
->live(),
|
||||
Select::make('competition_group_id')
|
||||
->searchable()
|
||||
->label('Competition Group')
|
||||
->options(function (Get $get) {
|
||||
if ($get('country_id')) {
|
||||
return CompetitionGroup::where('country_id', $get('country_id'))->orderBy('name')->pluck('name', 'id');
|
||||
} else {
|
||||
return CompetitionGroup::orderBy('name')->pluck('name', 'id');
|
||||
}
|
||||
}),
|
||||
])
|
||||
->query(function (Builder $query, array $data): Builder {
|
||||
return $query->when(
|
||||
$data['country_id'],
|
||||
fn(Builder $query, $country_id) => $query->where('country_id', $country_id)
|
||||
)->when(
|
||||
$data['competition_group_id'],
|
||||
function (Builder $query, $competition_group_id) {
|
||||
return $query->whereHas('element_group', function (Builder $query) use ($competition_group_id) {
|
||||
return $query->where('competition_group_id', $competition_group_id);
|
||||
});
|
||||
}
|
||||
);
|
||||
}),
|
||||
], layout: FiltersLayout::AboveContent)
|
||||
->deferFilters(false)
|
||||
->recordActions([
|
||||
ActionGroup::make([
|
||||
EditAction::make(),
|
||||
DeleteAction::make()
|
||||
->tooltip('All elements connected to this group, including active events, will be deleted')
|
||||
->before(function ($record) {
|
||||
Event::where('home_id', $record->id)->delete();
|
||||
Event::where('away_id', $record->id)->delete();
|
||||
ElementProvider::where('element_id', $record->id)->delete();
|
||||
ElementGroup::where('element_id', $record->id)->delete();
|
||||
})
|
||||
->successNotification(
|
||||
Notification::make()
|
||||
->success()
|
||||
->title('Element deleted')
|
||||
->body('The element with all relations in other tables has been deleted successfully.'),
|
||||
),
|
||||
])->iconButton()
|
||||
->icon('phosphor-dots-three-vertical'),
|
||||
])
|
||||
->headerActions([
|
||||
ExportAction::make()
|
||||
->modalHeading('Download Teams/Player')
|
||||
->color('warning')
|
||||
->label('Export')
|
||||
->icon('phosphor-download')
|
||||
->modalDescription('This will download the TxOdds Teams/Player with "sport_id" and "country_id" for the sport selected.')
|
||||
->modalIcon('phosphor-microsoft-excel-logo')
|
||||
->exporter(ElementExporter::class)
|
||||
->columnMapping(false)
|
||||
->formats([
|
||||
ExportFormat::Xlsx,
|
||||
ExportFormat::Csv,
|
||||
]),
|
||||
])
|
||||
->toolbarActions([
|
||||
BulkActionGroup::make([
|
||||
DeleteBulkAction::make(),
|
||||
]),
|
||||
]);
|
||||
}
|
||||
}
|
||||
-11
@@ -1,11 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Clusters\StaticData\Resources\SofaScoreCategories\Pages;
|
||||
|
||||
use App\Filament\Clusters\StaticData\Resources\SofaScoreCategories\SofaScoreCategoryResource;
|
||||
use Filament\Resources\Pages\CreateRecord;
|
||||
|
||||
class CreateSofaScoreCategory extends CreateRecord
|
||||
{
|
||||
protected static string $resource = SofaScoreCategoryResource::class;
|
||||
}
|
||||
-19
@@ -1,19 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Clusters\StaticData\Resources\SofaScoreCategories\Pages;
|
||||
|
||||
use App\Filament\Clusters\StaticData\Resources\SofaScoreCategories\SofaScoreCategoryResource;
|
||||
use Filament\Actions\DeleteAction;
|
||||
use Filament\Resources\Pages\EditRecord;
|
||||
|
||||
class EditSofaScoreCategory extends EditRecord
|
||||
{
|
||||
protected static string $resource = SofaScoreCategoryResource::class;
|
||||
|
||||
protected function getHeaderActions(): array
|
||||
{
|
||||
return [
|
||||
DeleteAction::make(),
|
||||
];
|
||||
}
|
||||
}
|
||||
-19
@@ -1,19 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Clusters\StaticData\Resources\SofaScoreCategories\Pages;
|
||||
|
||||
use App\Filament\Clusters\StaticData\Resources\SofaScoreCategories\SofaScoreCategoryResource;
|
||||
use Filament\Actions\CreateAction;
|
||||
use Filament\Resources\Pages\ListRecords;
|
||||
|
||||
class ListSofaScoreCategories extends ListRecords
|
||||
{
|
||||
protected static string $resource = SofaScoreCategoryResource::class;
|
||||
|
||||
protected function getHeaderActions(): array
|
||||
{
|
||||
return [
|
||||
CreateAction::make(),
|
||||
];
|
||||
}
|
||||
}
|
||||
-29
@@ -1,29 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Clusters\StaticData\Resources\SofaScoreCategories\Schemas;
|
||||
|
||||
use Filament\Forms\Components\TextInput;
|
||||
use Filament\Forms\Components\Toggle;
|
||||
use Filament\Schemas\Schema;
|
||||
|
||||
class SofaScoreCategoryForm
|
||||
{
|
||||
public static function configure(Schema $schema): Schema
|
||||
{
|
||||
return $schema
|
||||
->components([
|
||||
TextInput::make('name')
|
||||
->required(),
|
||||
TextInput::make('slug')
|
||||
->required(),
|
||||
TextInput::make('season_mode')
|
||||
->default(null),
|
||||
TextInput::make('flag')
|
||||
->default(null),
|
||||
Toggle::make('in_soccer'),
|
||||
TextInput::make('country_id')
|
||||
->numeric()
|
||||
->default(null),
|
||||
]);
|
||||
}
|
||||
}
|
||||
-53
@@ -1,53 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Clusters\StaticData\Resources\SofaScoreCategories;
|
||||
|
||||
use App\Filament\Clusters\StaticData\Resources\SofaScoreCategories\Pages\CreateSofaScoreCategory;
|
||||
use App\Filament\Clusters\StaticData\Resources\SofaScoreCategories\Pages\EditSofaScoreCategory;
|
||||
use App\Filament\Clusters\StaticData\Resources\SofaScoreCategories\Pages\ListSofaScoreCategories;
|
||||
use App\Filament\Clusters\StaticData\Resources\SofaScoreCategories\Schemas\SofaScoreCategoryForm;
|
||||
use App\Filament\Clusters\StaticData\Resources\SofaScoreCategories\Tables\SofaScoreCategoriesTable;
|
||||
use App\Filament\Clusters\StaticData\StaticDataCluster;
|
||||
use App\Models\SofaScoreCategory;
|
||||
use Filament\Resources\Resource;
|
||||
use Filament\Schemas\Schema;
|
||||
use Filament\Tables\Table;
|
||||
use UnitEnum;
|
||||
|
||||
class SofaScoreCategoryResource extends Resource
|
||||
{
|
||||
protected static ?string $model = SofaScoreCategory::class;
|
||||
|
||||
protected static ?string $cluster = StaticDataCluster::class;
|
||||
|
||||
protected static ?int $navigationSort = 13;
|
||||
|
||||
protected static string|UnitEnum|null $navigationGroup = 'Statistiko';
|
||||
protected static ?string $recordTitleAttribute = 'SS Countries';
|
||||
|
||||
protected static ?string $navigationLabel = 'SS Countries';
|
||||
|
||||
protected static ?string $modelLabel = 'SS Countries';
|
||||
|
||||
public static function form(Schema $schema): Schema
|
||||
{
|
||||
return SofaScoreCategoryForm::configure($schema);
|
||||
}
|
||||
|
||||
public static function table(Table $table): Table
|
||||
{
|
||||
return SofaScoreCategoriesTable::configure($table);
|
||||
}
|
||||
|
||||
public static function getPages(): array
|
||||
{
|
||||
return [
|
||||
'index' => ListSofaScoreCategories::route('/'),
|
||||
];
|
||||
}
|
||||
|
||||
public static function getNavigationBadge(): ?string
|
||||
{
|
||||
return parent::getEloquentQuery()->count();
|
||||
}
|
||||
}
|
||||
-49
@@ -1,49 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Clusters\StaticData\Resources\SofaScoreCategories\Tables;
|
||||
|
||||
use Filament\Actions\BulkActionGroup;
|
||||
use Filament\Actions\DeleteBulkAction;
|
||||
use Filament\Actions\EditAction;
|
||||
use Filament\Support\Enums\IconSize;
|
||||
use Filament\Tables\Columns\IconColumn;
|
||||
use Filament\Tables\Columns\TextColumn;
|
||||
use Filament\Tables\Filters\TernaryFilter;
|
||||
use Filament\Tables\Table;
|
||||
|
||||
class SofaScoreCategoriesTable
|
||||
{
|
||||
public static function configure(Table $table): Table
|
||||
{
|
||||
return $table
|
||||
->columns([
|
||||
IconColumn::make('flag')
|
||||
->sortable()
|
||||
->icon(function ($state): string {
|
||||
return $state;
|
||||
})->label('Flags'),
|
||||
TextColumn::make('name')
|
||||
->searchable(),
|
||||
TextColumn::make('season_mode')
|
||||
->sortable()
|
||||
->badge()
|
||||
->formatStateUsing(fn(string $state): string => strtoupper($state))
|
||||
->color(fn(string $state): string => match ($state) {
|
||||
'halfyear' => 'warning',
|
||||
'fullyear' => 'success',
|
||||
default => ''
|
||||
}),
|
||||
IconColumn::make('in_soccer')
|
||||
->boolean(),
|
||||
TextColumn::make('country_id')
|
||||
->numeric()
|
||||
->sortable(),
|
||||
])
|
||||
->filters([
|
||||
TernaryFilter::make('in_soccer')->default(1)
|
||||
])
|
||||
->recordActions([
|
||||
EditAction::make(),
|
||||
]);
|
||||
}
|
||||
}
|
||||
-11
@@ -1,11 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Clusters\StaticData\Resources\SofaScoreRosas\Pages;
|
||||
|
||||
use App\Filament\Clusters\StaticData\Resources\SofaScoreRosas\SofaScoreRosaResource;
|
||||
use Filament\Resources\Pages\CreateRecord;
|
||||
|
||||
class CreateSofaScoreRosa extends CreateRecord
|
||||
{
|
||||
protected static string $resource = SofaScoreRosaResource::class;
|
||||
}
|
||||
@@ -1,19 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Clusters\StaticData\Resources\SofaScoreRosas\Pages;
|
||||
|
||||
use App\Filament\Clusters\StaticData\Resources\SofaScoreRosas\SofaScoreRosaResource;
|
||||
use Filament\Actions\DeleteAction;
|
||||
use Filament\Resources\Pages\EditRecord;
|
||||
|
||||
class EditSofaScoreRosa extends EditRecord
|
||||
{
|
||||
protected static string $resource = SofaScoreRosaResource::class;
|
||||
|
||||
protected function getHeaderActions(): array
|
||||
{
|
||||
return [
|
||||
// DeleteAction::make(),
|
||||
];
|
||||
}
|
||||
}
|
||||
-11
@@ -1,11 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Clusters\StaticData\Resources\SofaScoreRosas\Pages;
|
||||
|
||||
use App\Filament\Clusters\StaticData\Resources\SofaScoreRosas\SofaScoreRosaResource;
|
||||
use Filament\Resources\Pages\ListRecords;
|
||||
|
||||
class ListSofaScoreRosas extends ListRecords
|
||||
{
|
||||
protected static string $resource = SofaScoreRosaResource::class;
|
||||
}
|
||||
-16
@@ -1,16 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Clusters\StaticData\Resources\SofaScoreRosas\Schemas;
|
||||
|
||||
use Filament\Schemas\Schema;
|
||||
|
||||
class SofaScoreRosaForm
|
||||
{
|
||||
public static function configure(Schema $schema): Schema
|
||||
{
|
||||
return $schema
|
||||
->components([
|
||||
//
|
||||
]);
|
||||
}
|
||||
}
|
||||
@@ -1,52 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Clusters\StaticData\Resources\SofaScoreRosas;
|
||||
|
||||
use App\Filament\Clusters\StaticData\Resources\SofaScoreRosas\Pages\ListSofaScoreRosas;
|
||||
use App\Filament\Clusters\StaticData\Resources\SofaScoreRosas\Schemas\SofaScoreRosaForm;
|
||||
use App\Filament\Clusters\StaticData\Resources\SofaScoreRosas\Tables\SofaScoreRosasTable;
|
||||
use App\Filament\Clusters\StaticData\StaticDataCluster;
|
||||
use App\Models\SofaScoreRosa;
|
||||
use Filament\Resources\Resource;
|
||||
use Filament\Schemas\Schema;
|
||||
use Filament\Tables\Table;
|
||||
use UnitEnum;
|
||||
|
||||
class SofaScoreRosaResource extends Resource
|
||||
{
|
||||
protected static ?string $model = SofaScoreRosa::class;
|
||||
|
||||
protected static ?string $cluster = StaticDataCluster::class;
|
||||
|
||||
protected static ?int $navigationSort = 3;
|
||||
|
||||
protected static ?string $recordTitleAttribute = 'name';
|
||||
|
||||
protected static ?string $navigationLabel = 'Teams';
|
||||
|
||||
protected static ?string $modelLabel = 'Teams';
|
||||
|
||||
protected static string|UnitEnum|null $navigationGroup = 'Statistiko';
|
||||
|
||||
public static function form(Schema $schema): Schema
|
||||
{
|
||||
return SofaScoreRosaForm::configure($schema);
|
||||
}
|
||||
|
||||
public static function table(Table $table): Table
|
||||
{
|
||||
return SofaScoreRosasTable::configure($table);
|
||||
}
|
||||
|
||||
public static function getPages(): array
|
||||
{
|
||||
return [
|
||||
'index' => ListSofaScoreRosas::route('/'),
|
||||
];
|
||||
}
|
||||
|
||||
public static function getNavigationBadge(): ?string
|
||||
{
|
||||
return parent::getEloquentQuery()->count();
|
||||
}
|
||||
}
|
||||
-81
@@ -1,81 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Clusters\StaticData\Resources\SofaScoreRosas\Tables;
|
||||
|
||||
use App\Models\SofaScoreRosaTournament;
|
||||
use App\Models\SofaScoreTournament;
|
||||
use App\Models\Sport;
|
||||
use Filament\Forms\Components\Select;
|
||||
use Filament\Schemas\Components\Utilities\Get;
|
||||
use Filament\Tables\Columns\TextColumn;
|
||||
use Filament\Tables\Enums\FiltersLayout;
|
||||
use Filament\Tables\Filters\Filter;
|
||||
use Filament\Tables\Table;
|
||||
use Illuminate\Database\Eloquent\Builder;
|
||||
|
||||
class SofaScoreRosasTable
|
||||
{
|
||||
public static function configure(Table $table): Table
|
||||
{
|
||||
return $table
|
||||
->defaultPaginationPageOption(50)
|
||||
->columns([
|
||||
TextColumn::make('ss_team_id')->label('SSId')->badge()->width('1rem')
|
||||
->sortable(),
|
||||
TextColumn::make('sofascore_category.name')->label('Country')
|
||||
->sortable(),
|
||||
TextColumn::make('tournament_rosa.tournament.name')->label('Tournament')
|
||||
->sortable(),
|
||||
TextColumn::make('ss_team_name')->label('Name')
|
||||
->searchable()
|
||||
->sortable(),
|
||||
TextColumn::make('updated_at')->dateTime('Y-m-d H:i:s')
|
||||
->sortable()
|
||||
|
||||
])
|
||||
->filters([
|
||||
Filter::make('filters')
|
||||
->columns(3)->columnSpan(3)
|
||||
->schema([
|
||||
Select::make('sport_id')
|
||||
->default(1)
|
||||
->selectablePlaceholder(false)
|
||||
->label('Sport')
|
||||
->options(Sport::where('is_active', 1)->pluck('name', 'id'))
|
||||
->afterStateUpdated(function (callable $set) {
|
||||
$set('ss_tournament_id', null);
|
||||
})
|
||||
->live(),
|
||||
Select::make('ss_tournament_id')
|
||||
// ->default(23)
|
||||
->label('Tournament')
|
||||
->selectablePlaceholder(true)
|
||||
->options(function (Get $get) {
|
||||
$res = SofaScoreTournament::with('sofascore_category')->where('enabled', 1)->where('sport_id', $get('sport_id'))->get();
|
||||
$return = [];
|
||||
foreach ($res as $value) {
|
||||
$return[$value->tournament_id] = $value->sofascore_category->name . ' - ' . $value->name;
|
||||
}
|
||||
asort($return);
|
||||
|
||||
return $return;
|
||||
})
|
||||
->live(),
|
||||
])
|
||||
->query(function (Builder $query, array $data): Builder {
|
||||
return $query->when(
|
||||
$data['sport_id'],
|
||||
fn(Builder $query, $sport_id) => $query->where('sport_id', $sport_id)
|
||||
)->when(
|
||||
$data['ss_tournament_id'],
|
||||
function (Builder $query, $ss_tournament_id) {
|
||||
$ss_team_ids = SofaScoreRosaTournament::where('ss_tournament_id', $ss_tournament_id)->pluck('ss_team_id')->toArray();
|
||||
|
||||
$query->whereIn('ss_team_id', $ss_team_ids);
|
||||
}
|
||||
);
|
||||
}),
|
||||
], layout: FiltersLayout::AboveContent)
|
||||
->deferFilters(false);
|
||||
}
|
||||
}
|
||||
-11
@@ -1,11 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Clusters\StaticData\Resources\SofaScoreTasks\Pages;
|
||||
|
||||
use App\Filament\Clusters\StaticData\Resources\SofaScoreTasks\SofaScoreTaskResource;
|
||||
use Filament\Resources\Pages\CreateRecord;
|
||||
|
||||
class CreateSofaScoreTask extends CreateRecord
|
||||
{
|
||||
protected static string $resource = SofaScoreTaskResource::class;
|
||||
}
|
||||
@@ -1,19 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Clusters\StaticData\Resources\SofaScoreTasks\Pages;
|
||||
|
||||
use App\Filament\Clusters\StaticData\Resources\SofaScoreTasks\SofaScoreTaskResource;
|
||||
use Filament\Resources\Pages\EditRecord;
|
||||
|
||||
class EditSofaScoreTask extends EditRecord
|
||||
{
|
||||
protected static string $resource = SofaScoreTaskResource::class;
|
||||
|
||||
protected function getFormActions(): array
|
||||
{
|
||||
return [
|
||||
$this->getSaveFormAction(),
|
||||
$this->getCancelFormAction()->label('Close Task Manager'), // Renames the button
|
||||
];
|
||||
}
|
||||
}
|
||||
-11
@@ -1,11 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Clusters\StaticData\Resources\SofaScoreTasks\Pages;
|
||||
|
||||
use App\Filament\Clusters\StaticData\Resources\SofaScoreTasks\SofaScoreTaskResource;
|
||||
use Filament\Resources\Pages\ListRecords;
|
||||
|
||||
class ListSofaScoreTasks extends ListRecords
|
||||
{
|
||||
protected static string $resource = SofaScoreTaskResource::class;
|
||||
}
|
||||
-144
@@ -1,144 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Clusters\StaticData\Resources\SofaScoreTasks\RelationManagers;
|
||||
|
||||
use App\Models\SofaScoreCategory;
|
||||
use App\Models\SofaScoreTaskTournament;
|
||||
use App\Models\SofaScoreTournament;
|
||||
use Filament\Actions\Action;
|
||||
use Filament\Actions\BulkAction;
|
||||
use Filament\Actions\BulkActionGroup;
|
||||
use Filament\Actions\CreateAction;
|
||||
use Filament\Actions\DeleteAction;
|
||||
use Filament\Actions\EditAction;
|
||||
use Filament\Forms\Components\Select;
|
||||
use Filament\Resources\RelationManagers\RelationManager;
|
||||
use Filament\Schemas\Components\Utilities\Get;
|
||||
use Filament\Schemas\Schema;
|
||||
use Filament\Support\Enums\FontWeight;
|
||||
use Filament\Tables\Columns\TextColumn;
|
||||
use Filament\Tables\Columns\ToggleColumn;
|
||||
use Filament\Tables\Enums\FiltersLayout;
|
||||
use Filament\Tables\Filters\SelectFilter;
|
||||
use Filament\Tables\Filters\TernaryFilter;
|
||||
use Filament\Tables\Table;
|
||||
use Illuminate\Support\Collection;
|
||||
|
||||
class SofaScoreTaskTournamentsRelationManager extends RelationManager
|
||||
{
|
||||
protected static string $relationship = 'sofa_score_task_tournaments';
|
||||
|
||||
protected static ?string $title = 'Tournaments';
|
||||
|
||||
protected static ?string $navigationLabel = 'Tournaments';
|
||||
|
||||
protected static ?string $modelLabel = 'Tournament';
|
||||
|
||||
protected static ?string $pluralModelLabel = 'Tournaments';
|
||||
|
||||
public function form(Schema $schema): Schema
|
||||
{
|
||||
return $schema
|
||||
->components([
|
||||
Select::make('sofa_score_category_id')
|
||||
->searchable()
|
||||
->label('Category')
|
||||
->options(function () {
|
||||
$res = SofaScoreTournament::where('sport_id', $this->getOwnerRecord()['sport_id'])
|
||||
->groupBy('sofa_score_category_id')
|
||||
->pluck('sofa_score_category_id')
|
||||
->toArray();
|
||||
return SofaScoreCategory::query()->whereIn('id', $res)->orderBy('name')->pluck('name', 'id');
|
||||
})
|
||||
->live(),
|
||||
Select::make('sofa_score_tournament_id')
|
||||
->searchable()
|
||||
->label('Tournament')
|
||||
->placeholder('Select a categorie first.')
|
||||
->noOptionsMessage('Select a categorie first.')
|
||||
->disabled(fn(Get $get): bool => (bool) $get('sofa_score_category_id') ? false : true)
|
||||
->options(fn(Get $get) => SofaScoreTournament::where('sport_id', $this->getOwnerRecord()['sport_id'])
|
||||
->where('disabled', 0)
|
||||
->where('sofa_score_category_id', $get('sofa_score_category_id'))
|
||||
->orderBY('name')
|
||||
->pluck('name', 'tournament_id')),
|
||||
]);
|
||||
}
|
||||
|
||||
public function table(Table $table): Table
|
||||
{
|
||||
return $table
|
||||
->columns([
|
||||
TextColumn::make('category.name')
|
||||
->label('Category')
|
||||
->searchable(),
|
||||
TextColumn::make('tournament.tournament_id'),
|
||||
TextColumn::make('tournament.name')
|
||||
->weight(FontWeight::Bold)
|
||||
->searchable(),
|
||||
ToggleColumn::make('disabled')
|
||||
->onColor('danger')
|
||||
->alignCenter(),
|
||||
])
|
||||
->filters([
|
||||
SelectFilter::make('sofa_score_category_id')
|
||||
->searchable()
|
||||
->label('Categorie')
|
||||
->options(function () {
|
||||
$res = SofaScoreTaskTournament::where('sofa_score_task_id', $this->getOwnerRecord()['id'])
|
||||
->groupBy('sofa_score_category_id')
|
||||
->pluck('sofa_score_category_id')
|
||||
->toArray();
|
||||
return SofaScoreCategory::query()->whereIn('id', $res)->orderBy('name')->pluck('name', 'id');
|
||||
}),
|
||||
TernaryFilter::make('disabled'),
|
||||
], layout: FiltersLayout::AboveContent)
|
||||
->deferFilters(false)
|
||||
->headerActions([
|
||||
Action::make('all_on')
|
||||
->icon('phosphor-toggle-right-fill')
|
||||
->action(function (): void {
|
||||
SofaScoreTaskTournament::where('sofa_score_task_id', $this->getOwnerRecord()['id'])->update(['disabled' => 0]);
|
||||
}),
|
||||
Action::make('all_off')
|
||||
->icon('phosphor-toggle-left-fill')
|
||||
->color('danger')
|
||||
->action(function (): void {
|
||||
SofaScoreTaskTournament::where('sofa_score_task_id', $this->getOwnerRecord()['id'])->update(['disabled' => 1]);
|
||||
}),
|
||||
CreateAction::make()
|
||||
->icon('phosphor-plus')
|
||||
->label('Tournament'),
|
||||
])
|
||||
->recordActions([
|
||||
EditAction::make()->iconButton(),
|
||||
DeleteAction::make()->iconButton(),
|
||||
])
|
||||
->toolbarActions([
|
||||
BulkActionGroup::make([
|
||||
BulkAction::make('Disable selected')
|
||||
->icon('phosphor-toggle-left-fill')
|
||||
->color('danger')
|
||||
->action(function (Collection $records): void {
|
||||
foreach ($records as $record) {
|
||||
SofaScoreTaskTournament::where('id', '=', $record->id)
|
||||
->update(
|
||||
['disabled' => 1]
|
||||
);
|
||||
}
|
||||
}),
|
||||
BulkAction::make('Enable selected')
|
||||
->icon('phosphor-toggle-right-fill')
|
||||
->action(function (Collection $records): void {
|
||||
foreach ($records as $record) {
|
||||
SofaScoreTaskTournament::where('id', '=', $record->id)
|
||||
->update(
|
||||
['disabled' => 0]
|
||||
);
|
||||
}
|
||||
}),
|
||||
// DeleteBulkAction::make(),
|
||||
]),
|
||||
]);
|
||||
}
|
||||
}
|
||||
-48
@@ -1,48 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Clusters\StaticData\Resources\SofaScoreTasks\Schemas;
|
||||
|
||||
use App\Models\Sport;
|
||||
use Filament\Forms\Components\DatePicker;
|
||||
use Filament\Forms\Components\Select;
|
||||
use Filament\Forms\Components\TextInput;
|
||||
use Filament\Schemas\Components\Utilities\Get;
|
||||
use Filament\Schemas\Schema;
|
||||
|
||||
class SofaScoreTaskForm
|
||||
{
|
||||
public static function configure(Schema $schema): Schema
|
||||
{
|
||||
return $schema
|
||||
->components([
|
||||
TextInput::make('name')
|
||||
->required(),
|
||||
Select::make('sport_id')
|
||||
->default(1)
|
||||
->selectablePlaceholder(false)
|
||||
->label('Sport')
|
||||
->options(Sport::where('is_active', 1)->pluck('name', 'id')),
|
||||
Select::make('mode')
|
||||
->live()
|
||||
->native()
|
||||
->allowHtml()
|
||||
->required()
|
||||
->options([
|
||||
'daily' => '<span class="text-green-600">Daily</span>',
|
||||
'date' => '<span class="text-blue-600">Grap a date</span>',
|
||||
'range' => '<span class="text-amber-600">Grap a date range</span>',
|
||||
'excel' => '<span class="text-rose-600">Excel</span>',
|
||||
]),
|
||||
DatePicker::make('day_from')
|
||||
->belowLabel('Full: 01.01 - Half: 01.07')
|
||||
->required()
|
||||
->native()
|
||||
->visible(fn(Get $get): bool => in_array($get('mode'), ['date', 'range'])),
|
||||
DatePicker::make('day_to')
|
||||
->belowLabel('Full: 31.12 - Half: 30.06')
|
||||
->required()
|
||||
->native()
|
||||
->visible(fn(Get $get): bool => $get('mode') === 'range'),
|
||||
]);
|
||||
}
|
||||
}
|
||||
@@ -1,66 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Clusters\StaticData\Resources\SofaScoreTasks;
|
||||
|
||||
use App\Filament\Clusters\StaticData\Resources\SofaScoreTasks\Pages\EditSofaScoreTask;
|
||||
use App\Filament\Clusters\StaticData\Resources\SofaScoreTasks\Pages\ListSofaScoreTasks;
|
||||
use App\Filament\Clusters\StaticData\Resources\SofaScoreTasks\RelationManagers\SofaScoreTaskTournamentsRelationManager;
|
||||
use App\Filament\Clusters\StaticData\Resources\SofaScoreTasks\Schemas\SofaScoreTaskForm;
|
||||
use App\Filament\Clusters\StaticData\Resources\SofaScoreTasks\Tables\SofaScoreTasksTable;
|
||||
use App\Filament\Clusters\StaticData\StaticDataCluster;
|
||||
use App\Models\SofaScoreTask;
|
||||
use Filament\Resources\Resource;
|
||||
use Filament\Schemas\Schema;
|
||||
use Filament\Tables\Table;
|
||||
use UnitEnum;
|
||||
|
||||
class SofaScoreTaskResource extends Resource
|
||||
{
|
||||
protected static ?string $model = SofaScoreTask::class;
|
||||
|
||||
protected static ?string $cluster = StaticDataCluster::class;
|
||||
|
||||
protected static ?string $navigationLabel = 'Tasks';
|
||||
|
||||
protected static ?string $modelLabel = 'Tasks';
|
||||
|
||||
protected static ?int $navigationSort = 2;
|
||||
|
||||
protected static string|UnitEnum|null $navigationGroup = 'Statistiko';
|
||||
|
||||
protected function isReadOnly(): bool
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
public static function form(Schema $schema): Schema
|
||||
{
|
||||
return SofaScoreTaskForm::configure($schema);
|
||||
}
|
||||
|
||||
public static function table(Table $table): Table
|
||||
{
|
||||
return SofaScoreTasksTable::configure($table);
|
||||
}
|
||||
|
||||
public static function getNavigationBadge(): ?string
|
||||
{
|
||||
return parent::getEloquentQuery()->count();
|
||||
}
|
||||
|
||||
public static function getPages(): array
|
||||
{
|
||||
return [
|
||||
'index' => ListSofaScoreTasks::route('/'),
|
||||
'edit' => EditSofaScoreTask::route('/{record}/edit'),
|
||||
];
|
||||
}
|
||||
|
||||
public static function getRelations(): array
|
||||
{
|
||||
return [
|
||||
SofaScoreTaskTournamentsRelationManager::class,
|
||||
];
|
||||
}
|
||||
}
|
||||
-46
@@ -1,46 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Clusters\StaticData\Resources\SofaScoreTasks\Tables;
|
||||
|
||||
use Filament\Actions\EditAction;
|
||||
use Filament\Tables\Columns\IconColumn;
|
||||
use Filament\Tables\Columns\TextColumn;
|
||||
use Filament\Tables\Table;
|
||||
|
||||
class SofaScoreTasksTable
|
||||
{
|
||||
public static function configure(Table $table): Table
|
||||
{
|
||||
return $table
|
||||
->columns([
|
||||
IconColumn::make('id')->alignCenter()->width('1rem')
|
||||
->sortable()->color(fn (string $state): string => match ($state) {
|
||||
'1' => 'info',
|
||||
'3' => 'success',
|
||||
})->icon(fn (string $state): string => match ($state) {
|
||||
'1' => 'phosphor-calendar',
|
||||
'3' => 'phosphor-calendar-dots',
|
||||
}),
|
||||
TextColumn::make('mode')
|
||||
->badge()
|
||||
->color(fn ($record): string => match ($record->id) {
|
||||
1 => 'info',
|
||||
3 => 'success',
|
||||
}),
|
||||
TextColumn::make('name'),
|
||||
IconColumn::make('sport.icon')
|
||||
->label('')
|
||||
->grow(false)
|
||||
->width(30)
|
||||
->icon(fn ($record) => $record->sport->icon),
|
||||
TextColumn::make('sport.name'),
|
||||
TextColumn::make('day_from'),
|
||||
TextColumn::make('day_to'),
|
||||
])
|
||||
->paginated(false)
|
||||
->recordActions([
|
||||
EditAction::make()->iconButton()
|
||||
->icon('phosphor-pen-fill'),
|
||||
]);
|
||||
}
|
||||
}
|
||||
-11
@@ -1,11 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Clusters\StaticData\Resources\SofaScoreTournaments\Pages;
|
||||
|
||||
use App\Filament\Clusters\StaticData\Resources\SofaScoreTournaments\SofaScoreTournamentResource;
|
||||
use Filament\Resources\Pages\CreateRecord;
|
||||
|
||||
class CreateSofaScoreTournament extends CreateRecord
|
||||
{
|
||||
protected static string $resource = SofaScoreTournamentResource::class;
|
||||
}
|
||||
-19
@@ -1,19 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Clusters\StaticData\Resources\SofaScoreTournaments\Pages;
|
||||
|
||||
use App\Filament\Clusters\StaticData\Resources\SofaScoreTournaments\SofaScoreTournamentResource;
|
||||
use Filament\Actions\DeleteAction;
|
||||
use Filament\Resources\Pages\EditRecord;
|
||||
|
||||
class EditSofaScoreTournament extends EditRecord
|
||||
{
|
||||
protected static string $resource = SofaScoreTournamentResource::class;
|
||||
|
||||
protected function getHeaderActions(): array
|
||||
{
|
||||
return [
|
||||
DeleteAction::make(),
|
||||
];
|
||||
}
|
||||
}
|
||||
-19
@@ -1,19 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Clusters\StaticData\Resources\SofaScoreTournaments\Pages;
|
||||
|
||||
use App\Filament\Clusters\StaticData\Resources\SofaScoreTournaments\SofaScoreTournamentResource;
|
||||
use Filament\Actions\CreateAction;
|
||||
use Filament\Resources\Pages\ListRecords;
|
||||
|
||||
class ListSofaScoreTournaments extends ListRecords
|
||||
{
|
||||
protected static string $resource = SofaScoreTournamentResource::class;
|
||||
|
||||
protected function getHeaderActions(): array
|
||||
{
|
||||
return [
|
||||
// CreateAction::make(),
|
||||
];
|
||||
}
|
||||
}
|
||||
-16
@@ -1,16 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Clusters\StaticData\Resources\SofaScoreTournaments\Schemas;
|
||||
|
||||
use Filament\Schemas\Schema;
|
||||
|
||||
class SofaScoreTournamentForm
|
||||
{
|
||||
public static function configure(Schema $schema): Schema
|
||||
{
|
||||
return $schema
|
||||
->components([
|
||||
//
|
||||
]);
|
||||
}
|
||||
}
|
||||
-64
@@ -1,64 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Clusters\StaticData\Resources\SofaScoreTournaments;
|
||||
|
||||
use App\Filament\Clusters\StaticData\Resources\SofaScoreTournaments\Pages\ListSofaScoreTournaments;
|
||||
use App\Filament\Clusters\StaticData\Resources\SofaScoreTournaments\Schemas\SofaScoreTournamentForm;
|
||||
use App\Filament\Clusters\StaticData\Resources\SofaScoreTournaments\Tables\SofaScoreTournamentsTable;
|
||||
use App\Filament\Clusters\StaticData\StaticDataCluster;
|
||||
use App\Models\SofaScoreTournament;
|
||||
use Filament\Resources\Resource;
|
||||
use Filament\Schemas\Schema;
|
||||
use Filament\Tables\Table;
|
||||
use Livewire\Livewire;
|
||||
use UnitEnum;
|
||||
|
||||
class SofaScoreTournamentResource extends Resource
|
||||
{
|
||||
protected static ?string $model = SofaScoreTournament::class;
|
||||
|
||||
protected static string|UnitEnum|null $navigationGroup = 'Statistiko';
|
||||
|
||||
protected static ?string $cluster = StaticDataCluster::class;
|
||||
|
||||
protected static ?string $recordTitleAttribute = 'Tournaments';
|
||||
|
||||
protected static ?string $navigationLabel = 'Tournaments';
|
||||
|
||||
protected static ?int $navigationSort = 2;
|
||||
|
||||
public static function form(Schema $schema): Schema
|
||||
{
|
||||
return SofaScoreTournamentForm::configure($schema);
|
||||
}
|
||||
|
||||
public static function table(Table $table): Table
|
||||
{
|
||||
return SofaScoreTournamentsTable::configure($table);
|
||||
}
|
||||
|
||||
public static function getNavigationBadge(): ?string
|
||||
{
|
||||
// return parent::getEloquentQuery()->count();
|
||||
// Ensure we are on the list page
|
||||
if (! class_exists(Livewire::class) || Livewire::current() === null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
$livewire = Livewire::current();
|
||||
|
||||
// Check if the current component has the table filtering traits
|
||||
if (method_exists($livewire, 'getFilteredTableQuery')) {
|
||||
return (string) $livewire->getFilteredTableQuery()->count();
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public static function getPages(): array
|
||||
{
|
||||
return [
|
||||
'index' => ListSofaScoreTournaments::route('/'),
|
||||
];
|
||||
}
|
||||
}
|
||||
-176
@@ -1,176 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Clusters\StaticData\Resources\SofaScoreTournaments\Tables;
|
||||
|
||||
use App\Models\SofaScoreCategory;
|
||||
use App\Models\SofaScoreTournament;
|
||||
use App\Models\Sport;
|
||||
use Filament\Forms\Components\Select;
|
||||
use Filament\Forms\Components\Toggle;
|
||||
use Filament\Schemas\Components\Utilities\Get;
|
||||
use Filament\Support\Enums\IconSize;
|
||||
use Filament\Tables\Columns\IconColumn;
|
||||
use Filament\Tables\Columns\TextColumn;
|
||||
use Filament\Tables\Columns\ToggleColumn;
|
||||
use Filament\Tables\Enums\FiltersLayout;
|
||||
use Filament\Tables\Filters\Filter;
|
||||
use Filament\Tables\Table;
|
||||
use Illuminate\Database\Eloquent\Builder;
|
||||
// use Illuminate\Database\Eloquent\Collection;
|
||||
|
||||
class SofaScoreTournamentsTable
|
||||
{
|
||||
public static function configure(Table $table): Table
|
||||
{
|
||||
return $table
|
||||
->columns([
|
||||
IconColumn::make('sport.icon')
|
||||
->label('')
|
||||
->grow(false)
|
||||
->width(30)
|
||||
->color(fn($record) => $record->sport->color)
|
||||
->icon(fn($record) => $record->sport->icon)
|
||||
->size(IconSize::Medium)
|
||||
->tooltip(fn($record) => $record->id)
|
||||
->visibleFrom('lg'),
|
||||
TextColumn::make('sport.name')
|
||||
->sortable(),
|
||||
TextColumn::make('tournament_id')
|
||||
->label('Id')
|
||||
->sortable()
|
||||
->searchable(),
|
||||
TextColumn::make('sofascore_category.name')
|
||||
->label('Country')
|
||||
->icon(fn($record) => $record->sofascore_category->flag)
|
||||
->sortable(),
|
||||
TextColumn::make('name')->searchable()->sortable(),
|
||||
ToggleColumn::make('enabled')
|
||||
->label('In Statistiko')
|
||||
->alignCenter()
|
||||
->sortable(),
|
||||
])
|
||||
->filters([
|
||||
Filter::make('filters')
|
||||
->columns(7)->columnSpan(7)
|
||||
->schema([
|
||||
Select::make('sport_id')
|
||||
->default(1)
|
||||
->selectablePlaceholder(false)
|
||||
->label('Sport')
|
||||
->options(Sport::where('is_active', 1)->pluck('name', 'id'))
|
||||
->afterStateUpdated(function (callable $set) {
|
||||
$set('sofa_score_category_id', null);
|
||||
})
|
||||
->live(),
|
||||
Select::make('sofa_score_category_id')
|
||||
->searchable()
|
||||
->multiple()
|
||||
->columnSpan(2)
|
||||
->label('Categorie')
|
||||
->options(function (Get $get) {
|
||||
$res = SofaScoreTournament::where('sport_id', $get('sport_id'))
|
||||
->groupBy('sofa_score_category_id')
|
||||
->pluck('sofa_score_category_id')
|
||||
->toArray();
|
||||
|
||||
return SofaScoreCategory::query()->whereIn('id', $res)->orderBy('name')->pluck('name', 'id');
|
||||
})
|
||||
->live(),
|
||||
Toggle::make('enabled')->label('In Statistiko')->default(1),
|
||||
])
|
||||
->query(function (Builder $query, array $data): Builder {
|
||||
return $query->when(
|
||||
$data['sport_id'],
|
||||
fn(Builder $query, $sport_id) => $query->where('sport_id', $sport_id)
|
||||
)->when(
|
||||
$data['enabled'],
|
||||
fn(Builder $query, $enabled) => $query->where('enabled', $enabled)
|
||||
)->when(
|
||||
$data['sofa_score_category_id'],
|
||||
function (Builder $query, $sofa_score_category_id) {
|
||||
if (is_array($sofa_score_category_id)) {
|
||||
$query->whereIn('sofa_score_category_id', $sofa_score_category_id);
|
||||
} else {
|
||||
$query->where('sofa_score_category_id', $sofa_score_category_id);
|
||||
}
|
||||
}
|
||||
// )->when(
|
||||
// $data['filter-grapping'],
|
||||
// function (Builder $query, $filtergrapping) {
|
||||
// switch ($filtergrapping) {
|
||||
// case 'active':
|
||||
// $query->where('enabled', 1);
|
||||
// break;
|
||||
// case 'disabled':
|
||||
// $query->where('enabled', 0);
|
||||
// break;
|
||||
// }
|
||||
// }
|
||||
// )->when(
|
||||
// $data['filter-disabled'],
|
||||
// function (Builder $query, $filterdisabled) {
|
||||
// switch ($filterdisabled) {
|
||||
// case 'enabled':
|
||||
// $query->where('enabled', 1);
|
||||
// break;
|
||||
// case 'hidden':
|
||||
// $query->where('disabled', 1);
|
||||
// break;
|
||||
// }
|
||||
// }
|
||||
);
|
||||
}),
|
||||
], layout: FiltersLayout::AboveContent)
|
||||
->deferFilters(false);
|
||||
// ->toolbarActions([
|
||||
// BulkActionGroup::make([
|
||||
// BulkAction::make('Enable selected')
|
||||
// ->icon('phosphor-toggle-right-fill')
|
||||
// ->color('primary')
|
||||
// ->action(function (Collection $records): void {
|
||||
// foreach ($records as $record) {
|
||||
// SofaScoreTournament::where('id', '=', $record->id)
|
||||
// ->update(
|
||||
// ['enabled' => 1]
|
||||
// );
|
||||
// }
|
||||
// }),
|
||||
// BulkAction::make('Disable selected')
|
||||
// ->icon('phosphor-toggle-left-fill')
|
||||
// ->color('gray')
|
||||
// ->action(function (Collection $records): void {
|
||||
// foreach ($records as $record) {
|
||||
// SofaScoreTournament::where('id', '=', $record->id)
|
||||
// ->update(
|
||||
// ['enabled' => 0]
|
||||
// );
|
||||
// }
|
||||
// }),
|
||||
// ])->label('Grapping'),
|
||||
// BulkActionGroup::make([
|
||||
// BulkAction::make('Hide selected')
|
||||
// ->icon('phosphor-toggle-right-fill')
|
||||
// ->color('primary')
|
||||
// ->action(function (Collection $records): void {
|
||||
// foreach ($records as $record) {
|
||||
// SofaScoreTournament::where('id', '=', $record->id)
|
||||
// ->update(
|
||||
// ['disabled' => 1]
|
||||
// );
|
||||
// }
|
||||
// }),
|
||||
// BulkAction::make('Show selected')
|
||||
// ->icon('phosphor-toggle-left-fill')
|
||||
// ->color('gray')
|
||||
// ->action(function (Collection $records): void {
|
||||
// foreach ($records as $record) {
|
||||
// SofaScoreTournament::where('id', '=', $record->id)
|
||||
// ->update(
|
||||
// ['disabled' => 0]
|
||||
// );
|
||||
// }
|
||||
// }),
|
||||
// ])->label('Hidden'),
|
||||
// ]);
|
||||
}
|
||||
}
|
||||
@@ -1,11 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Clusters\StaticData\Resources\Sports\Pages;
|
||||
|
||||
use App\Filament\Clusters\StaticData\Resources\Sports\SportResource;
|
||||
use Filament\Resources\Pages\ManageRecords;
|
||||
|
||||
class ManageSports extends ManageRecords
|
||||
{
|
||||
protected static string $resource = SportResource::class;
|
||||
}
|
||||
@@ -1,69 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Clusters\StaticData\Resources\Sports;
|
||||
|
||||
use App\Filament\Clusters\StaticData\Resources\Sports\Pages\ManageSports;
|
||||
use App\Filament\Clusters\StaticData\StaticDataCluster;
|
||||
use App\Models\Sport;
|
||||
use Filament\Resources\Resource;
|
||||
use Filament\Support\Enums\IconSize;
|
||||
use Filament\Tables\Columns\IconColumn;
|
||||
use Filament\Tables\Columns\TextColumn;
|
||||
use Filament\Tables\Columns\TextInputColumn;
|
||||
use Filament\Tables\Columns\ToggleColumn;
|
||||
use Filament\Tables\Filters\TernaryFilter;
|
||||
use Filament\Tables\Table;
|
||||
|
||||
class SportResource extends Resource
|
||||
{
|
||||
protected static ?string $model = Sport::class;
|
||||
|
||||
protected static ?int $navigationSort = 13;
|
||||
|
||||
protected static ?string $recordTitleAttribute = 'name';
|
||||
|
||||
protected static ?string $cluster = StaticDataCluster::class;
|
||||
|
||||
protected static string|\UnitEnum|null $navigationGroup = 'TxOdds';
|
||||
|
||||
public static function table(Table $table): Table
|
||||
{
|
||||
return $table
|
||||
->striped()
|
||||
->columns([
|
||||
IconColumn::make('icon')
|
||||
->label('')
|
||||
->size(IconSize::TwoExtraLarge)
|
||||
->icon(function ($record): string {
|
||||
return $record->icon;
|
||||
}),
|
||||
TextColumn::make('name'),
|
||||
TextColumn::make('bapi')->alignCenter()->label('Betsapi'),
|
||||
TextColumn::make('bwin')->alignCenter()->label('Bwin'),
|
||||
TextColumn::make('b365')->alignCenter()->label('Bet365'),
|
||||
TextColumn::make('logi')->alignCenter()->label('Logifuture'),
|
||||
TextColumn::make('magl')->alignCenter()->label('Magloo'),
|
||||
TextInputColumn::make('ss_grap_years')
|
||||
->rules(['required', 'numeric', 'min:1', 'max:20'])
|
||||
->width('1rem')
|
||||
->alignCenter()
|
||||
->label('Grap Years SS'),
|
||||
ToggleColumn::make('is_active'),
|
||||
])
|
||||
->filters([
|
||||
TernaryFilter::make('is_active')->default(true),
|
||||
]);
|
||||
}
|
||||
|
||||
public static function getPages(): array
|
||||
{
|
||||
return [
|
||||
'index' => ManageSports::route('/'),
|
||||
];
|
||||
}
|
||||
|
||||
public static function getNavigationBadge(): ?string
|
||||
{
|
||||
return parent::getEloquentQuery()->count();
|
||||
}
|
||||
}
|
||||
-11
@@ -1,11 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Clusters\StaticData\Resources\StatisticFixtures\Pages;
|
||||
|
||||
use App\Filament\Clusters\StaticData\Resources\StatisticFixtures\StatisticFixturesResource;
|
||||
use Filament\Resources\Pages\CreateRecord;
|
||||
|
||||
class CreateStatisticFixtures extends CreateRecord
|
||||
{
|
||||
protected static string $resource = StatisticFixturesResource::class;
|
||||
}
|
||||
-19
@@ -1,19 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Clusters\StaticData\Resources\StatisticFixtures\Pages;
|
||||
|
||||
use App\Filament\Clusters\StaticData\Resources\StatisticFixtures\StatisticFixturesResource;
|
||||
use Filament\Actions\DeleteAction;
|
||||
use Filament\Resources\Pages\EditRecord;
|
||||
|
||||
class EditStatisticFixtures extends EditRecord
|
||||
{
|
||||
protected static string $resource = StatisticFixturesResource::class;
|
||||
|
||||
protected function getHeaderActions(): array
|
||||
{
|
||||
return [
|
||||
DeleteAction::make(),
|
||||
];
|
||||
}
|
||||
}
|
||||
-45
@@ -1,45 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Clusters\StaticData\Resources\StatisticFixtures\Pages;
|
||||
|
||||
use App\Filament\Clusters\StaticData\Resources\StatisticFixtures\StatisticFixturesResource;
|
||||
use App\Models\StatisticFixtures;
|
||||
use DateTime;
|
||||
use Filament\Actions\Action;
|
||||
use Filament\Resources\Pages\ListRecords;
|
||||
|
||||
class ListStatisticFixtures extends ListRecords
|
||||
{
|
||||
protected static string $resource = StatisticFixturesResource::class;
|
||||
|
||||
protected function getHeaderActions(): array
|
||||
{
|
||||
return [
|
||||
Action::make('starttime')
|
||||
->color('gray')
|
||||
->tooltip('Find events with wrong starttime')
|
||||
->icon('phosphor-magnifying-glass')
|
||||
->modalSubmitAction(false)
|
||||
->modalContent(function () {
|
||||
$events = StatisticFixtures::with('league')->with('home')->with('away')->where('starttime', '<', new DateTime('-10 years'))->get();
|
||||
return view('filament.pages.list-fixtures-starttime', ['events' => $events]);
|
||||
}),
|
||||
Action::make('truncate')
|
||||
->icon('phosphor-trash')
|
||||
->tooltip('Delete all events')
|
||||
->requiresConfirmation()
|
||||
->color('danger')
|
||||
->action(function () {
|
||||
StatisticFixtures::truncate();
|
||||
}),
|
||||
Action::make('remove_started')
|
||||
->icon('phosphor-trash')
|
||||
->tooltip('Delete events already started')
|
||||
->requiresConfirmation()
|
||||
->color('info')
|
||||
->action(function () {
|
||||
StatisticFixtures::where('starttime', '<', now())->delete();
|
||||
}),
|
||||
];
|
||||
}
|
||||
}
|
||||
-18
@@ -1,18 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Clusters\StaticData\Resources\StatisticFixtures\Schemas;
|
||||
|
||||
use Filament\Forms\Components\TextInput;
|
||||
use Filament\Schemas\Schema;
|
||||
|
||||
class StatisticFixturesForm
|
||||
{
|
||||
public static function configure(Schema $schema): Schema
|
||||
{
|
||||
return $schema
|
||||
->components([
|
||||
TextInput::make('exp_home')->required(),
|
||||
TextInput::make('exp_away')->required(),
|
||||
]);
|
||||
}
|
||||
}
|
||||
-50
@@ -1,50 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Clusters\StaticData\Resources\StatisticFixtures;
|
||||
|
||||
use App\Filament\Clusters\StaticData\Resources\StatisticFixtures\Pages\ListStatisticFixtures;
|
||||
use App\Filament\Clusters\StaticData\Resources\StatisticFixtures\Schemas\StatisticFixturesForm;
|
||||
use App\Filament\Clusters\StaticData\Resources\StatisticFixtures\Tables\StatisticFixturesTable;
|
||||
use App\Filament\Clusters\StaticData\StaticDataCluster;
|
||||
use App\Models\StatisticFixtures;
|
||||
use Filament\Resources\Resource;
|
||||
use Filament\Schemas\Schema;
|
||||
use Filament\Tables\Table;
|
||||
use UnitEnum;
|
||||
|
||||
class StatisticFixturesResource extends Resource
|
||||
{
|
||||
protected static ?string $model = StatisticFixtures::class;
|
||||
|
||||
protected static ?string $navigationLabel = 'Fixtures';
|
||||
|
||||
protected static ?string $modelLabel = 'Fixtures';
|
||||
|
||||
protected static string|UnitEnum|null $navigationGroup = 'Statistiko';
|
||||
|
||||
protected static ?int $navigationSort = 5;
|
||||
|
||||
protected static ?string $cluster = StaticDataCluster::class;
|
||||
|
||||
public static function form(Schema $schema): Schema
|
||||
{
|
||||
return StatisticFixturesForm::configure($schema);
|
||||
}
|
||||
|
||||
public static function table(Table $table): Table
|
||||
{
|
||||
return StatisticFixturesTable::configure($table);
|
||||
}
|
||||
|
||||
public static function getPages(): array
|
||||
{
|
||||
return [
|
||||
'index' => ListStatisticFixtures::route('/'),
|
||||
];
|
||||
}
|
||||
|
||||
public static function getNavigationBadge(): ?string
|
||||
{
|
||||
return parent::getEloquentQuery()->count();
|
||||
}
|
||||
}
|
||||
-104
@@ -1,104 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Clusters\StaticData\Resources\StatisticFixtures\Tables;
|
||||
|
||||
use App\Actions\LoadStatisticFixturesLeaguesOptions;
|
||||
use App\Models\Sport;
|
||||
use Filament\Actions\BulkActionGroup;
|
||||
use Filament\Actions\DeleteAction;
|
||||
use Filament\Actions\DeleteBulkAction;
|
||||
use Filament\Actions\EditAction;
|
||||
use Filament\Forms\Components\Select;
|
||||
use Filament\Schemas\Components\Utilities\Get;
|
||||
use Filament\Tables\Columns\IconColumn;
|
||||
use Filament\Tables\Columns\TextColumn;
|
||||
use Filament\Tables\Enums\FiltersLayout;
|
||||
use Filament\Tables\Filters\Filter;
|
||||
use Filament\Tables\Table;
|
||||
use Illuminate\Database\Eloquent\Builder;
|
||||
|
||||
class StatisticFixturesTable
|
||||
{
|
||||
public static function configure(Table $table): Table
|
||||
{
|
||||
return $table
|
||||
->columns([
|
||||
IconColumn::make('sport_id')
|
||||
->label('')
|
||||
->icon(fn(string $state): string => match ($state) {
|
||||
'1' => 'icon-soccerball',
|
||||
'2' => 'icon-icehockey',
|
||||
'3' => 'icon-basketball',
|
||||
'5' => 'icon-tennisball',
|
||||
}),
|
||||
IconColumn::make('league.sofascore_category.flag')
|
||||
->label('')
|
||||
->icon(function ($state): string {
|
||||
return $state;
|
||||
}),
|
||||
TextColumn::make('league.name')
|
||||
->label('League')
|
||||
->tooltip(fn($record) => $record->league_id)
|
||||
->sortable()
|
||||
->searchable()
|
||||
->description(
|
||||
fn($record) => $record->league->sofascore_category->name
|
||||
),
|
||||
TextColumn::make('starttime')->dateTime('Y-m-d H:i')
|
||||
->sortable(),
|
||||
TextColumn::make('home.ss_team_name')
|
||||
->tooltip(fn($record) => $record->home_id)
|
||||
->color('primary')
|
||||
->sortable()
|
||||
->searchable(),
|
||||
TextColumn::make('away.ss_team_name')
|
||||
->tooltip(fn($record) => $record->away_id)
|
||||
->color('success')
|
||||
->sortable()
|
||||
->searchable(),
|
||||
TextColumn::make('updated_at')->alignCenter()->date(),
|
||||
])
|
||||
->filters([
|
||||
Filter::make('fixture_filters')
|
||||
->columns(3)
|
||||
->columnSpan(3)
|
||||
->schema([
|
||||
Select::make('sport_id')
|
||||
->default(1)
|
||||
->options(fn() => Sport::query()->where('is_active', 1)->pluck('name', 'id'))
|
||||
->selectablePlaceholder(false)
|
||||
->label('Sport')
|
||||
->live(),
|
||||
Select::make('league_id')
|
||||
->options(fn(Get $get) => LoadStatisticFixturesLeaguesOptions::load($get('sport_id')))
|
||||
->preload()
|
||||
->searchable()
|
||||
->columnSpan(2)
|
||||
->label('League'),
|
||||
])->query(function (Builder $query, array $data): Builder {
|
||||
return $query->when(
|
||||
$data['league_id'],
|
||||
function (Builder $query, $league_id) {
|
||||
$query->where('league_id', $league_id)->orderBy('league_id');
|
||||
}
|
||||
)->when(
|
||||
$data['sport_id'],
|
||||
function (Builder $query, $away_id) {
|
||||
$query->where('sport_id', (int) $away_id);
|
||||
}
|
||||
);
|
||||
}),
|
||||
|
||||
], layout: FiltersLayout::AboveContent)
|
||||
->deferFilters(false)
|
||||
->recordActions([
|
||||
EditAction::make()->iconButton(),
|
||||
DeleteAction::make()->iconButton(),
|
||||
])
|
||||
->toolbarActions([
|
||||
BulkActionGroup::make([
|
||||
DeleteBulkAction::make(),
|
||||
]),
|
||||
]);
|
||||
}
|
||||
}
|
||||
-11
@@ -1,11 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Clusters\StaticData\Resources\StatistikoConfigs\Pages;
|
||||
|
||||
use App\Filament\Clusters\StaticData\Resources\StatistikoConfigs\StatistikoConfigResource;
|
||||
use Filament\Resources\Pages\CreateRecord;
|
||||
|
||||
class CreateStatistikoConfig extends CreateRecord
|
||||
{
|
||||
protected static string $resource = StatistikoConfigResource::class;
|
||||
}
|
||||
-19
@@ -1,19 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Clusters\StaticData\Resources\StatistikoConfigs\Pages;
|
||||
|
||||
use App\Filament\Clusters\StaticData\Resources\StatistikoConfigs\StatistikoConfigResource;
|
||||
use Filament\Actions\DeleteAction;
|
||||
use Filament\Resources\Pages\EditRecord;
|
||||
|
||||
class EditStatistikoConfig extends EditRecord
|
||||
{
|
||||
protected static string $resource = StatistikoConfigResource::class;
|
||||
|
||||
protected function getHeaderActions(): array
|
||||
{
|
||||
return [
|
||||
DeleteAction::make(),
|
||||
];
|
||||
}
|
||||
}
|
||||
-12
@@ -1,12 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Clusters\StaticData\Resources\StatistikoConfigs\Pages;
|
||||
|
||||
use App\Filament\Clusters\StaticData\Resources\StatistikoConfigs\StatistikoConfigResource;
|
||||
use Filament\Actions\CreateAction;
|
||||
use Filament\Resources\Pages\ListRecords;
|
||||
|
||||
class ListStatistikoConfigs extends ListRecords
|
||||
{
|
||||
protected static string $resource = StatistikoConfigResource::class;
|
||||
}
|
||||
-26
@@ -1,26 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Clusters\StaticData\Resources\StatistikoConfigs\Schemas;
|
||||
|
||||
use Filament\Forms\Components\TextInput;
|
||||
use Filament\Schemas\Schema;
|
||||
|
||||
class StatistikoConfigForm
|
||||
{
|
||||
public static function configure(Schema $schema): Schema
|
||||
{
|
||||
return $schema
|
||||
->components([
|
||||
TextInput::make('group')
|
||||
->required(),
|
||||
TextInput::make('varname')
|
||||
->required(),
|
||||
TextInput::make('team')
|
||||
->required(),
|
||||
TextInput::make('name')
|
||||
->required(),
|
||||
TextInput::make('value')
|
||||
->required(),
|
||||
]);
|
||||
}
|
||||
}
|
||||
-49
@@ -1,49 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Clusters\StaticData\Resources\StatistikoConfigs;
|
||||
|
||||
use App\Filament\Clusters\StaticData\Resources\StatistikoConfigs\Pages\ListStatistikoConfigs;
|
||||
use App\Filament\Clusters\StaticData\Resources\StatistikoConfigs\Schemas\StatistikoConfigForm;
|
||||
use App\Filament\Clusters\StaticData\Resources\StatistikoConfigs\Tables\StatistikoConfigsTable;
|
||||
use App\Filament\Clusters\StaticData\StaticDataCluster;
|
||||
use App\Models\StatistikoConfig;
|
||||
use Filament\Resources\Resource;
|
||||
use Filament\Schemas\Schema;
|
||||
use Filament\Tables\Table;
|
||||
use UnitEnum;
|
||||
|
||||
class StatistikoConfigResource extends Resource
|
||||
{
|
||||
protected static ?string $model = StatistikoConfig::class;
|
||||
|
||||
protected static string|UnitEnum|null $navigationGroup = 'Statistiko';
|
||||
|
||||
protected static ?string $cluster = StaticDataCluster::class;
|
||||
|
||||
protected static ?string $navigationLabel = 'Configurations';
|
||||
|
||||
protected static ?string $modelLabel = 'Configurations';
|
||||
|
||||
protected static ?int $navigationSort = 15;
|
||||
|
||||
public static function form(Schema $schema): Schema
|
||||
{
|
||||
return StatistikoConfigForm::configure($schema);
|
||||
}
|
||||
|
||||
public static function table(Table $table): Table
|
||||
{
|
||||
return StatistikoConfigsTable::configure($table);
|
||||
}
|
||||
|
||||
public static function getPages(): array
|
||||
{
|
||||
return [
|
||||
'index' => ListStatistikoConfigs::route('/'),
|
||||
];
|
||||
}
|
||||
public static function getNavigationBadge(): ?string
|
||||
{
|
||||
return parent::getEloquentQuery()->count();
|
||||
}
|
||||
}
|
||||
-57
@@ -1,57 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Clusters\StaticData\Resources\StatistikoConfigs\Tables;
|
||||
|
||||
use Filament\Tables\Columns\TextColumn;
|
||||
use Filament\Tables\Columns\TextInputColumn;
|
||||
use Filament\Tables\Enums\FiltersLayout;
|
||||
use Filament\Tables\Filters\SelectFilter;
|
||||
use Filament\Tables\Table;
|
||||
|
||||
class StatistikoConfigsTable
|
||||
{
|
||||
public static function configure(Table $table): Table
|
||||
{
|
||||
return $table
|
||||
->columns([
|
||||
TextColumn::make('group')->formatStateUsing(fn(string $state): string => match ($state) {
|
||||
'gls' => 'Goals',
|
||||
'crn' => 'Corner',
|
||||
'fls' => 'Fouls',
|
||||
'ofs' => 'Offside',
|
||||
'crd' => 'Cards',
|
||||
'snt' => 'Shots On Target',
|
||||
'tsh' => 'Total Shots',
|
||||
}),
|
||||
TextColumn::make('team')->badge()
|
||||
->color(fn(string $state): string => match ($state) {
|
||||
'home' => 'info',
|
||||
'away' => 'warning',
|
||||
}),
|
||||
TextColumn::make('varname')
|
||||
->formatStateUsing(fn(string $state): string => strtoupper($state)),
|
||||
TextInputColumn::make('value')
|
||||
->prefix('xx.x')
|
||||
->type('number')
|
||||
->rules(['required', 'decimal:0.1,10']),
|
||||
])
|
||||
->filters([
|
||||
SelectFilter::make('group')
|
||||
->options([
|
||||
'gls' => 'Goals',
|
||||
'crn' => 'Corner',
|
||||
'fls' => 'Fouls Commited',
|
||||
'ofs' => 'Offside',
|
||||
'crd' => 'Cards',
|
||||
'snt' => 'Shots On Target',
|
||||
'tsh' => 'Total Shots',
|
||||
]),
|
||||
SelectFilter::make('team')
|
||||
->options([
|
||||
'home' => 'Home',
|
||||
'away' => 'Away',
|
||||
])
|
||||
], layout: FiltersLayout::AboveContent)
|
||||
->deferFilters(false);
|
||||
}
|
||||
}
|
||||
-11
@@ -1,11 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Clusters\StaticData\Resources\StatistikoDetails\Pages;
|
||||
|
||||
use App\Filament\Clusters\StaticData\Resources\StatistikoDetails\StatistikoDetailResource;
|
||||
use Filament\Resources\Pages\CreateRecord;
|
||||
|
||||
class CreateStatistikoDetail extends CreateRecord
|
||||
{
|
||||
protected static string $resource = StatistikoDetailResource::class;
|
||||
}
|
||||
-19
@@ -1,19 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Clusters\StaticData\Resources\StatistikoDetails\Pages;
|
||||
|
||||
use App\Filament\Clusters\StaticData\Resources\StatistikoDetails\StatistikoDetailResource;
|
||||
use Filament\Actions\DeleteAction;
|
||||
use Filament\Resources\Pages\EditRecord;
|
||||
|
||||
class EditStatistikoDetails extends EditRecord
|
||||
{
|
||||
protected static string $resource = StatistikoDetailResource::class;
|
||||
|
||||
protected function getHeaderActions(): array
|
||||
{
|
||||
return [
|
||||
DeleteAction::make(),
|
||||
];
|
||||
}
|
||||
}
|
||||
-48
@@ -1,48 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Clusters\StaticData\Resources\StatistikoDetails\Pages;
|
||||
|
||||
use App\Filament\Clusters\StaticData\Resources\StatistikoDetails\StatistikoDetailResource;
|
||||
use App\Filament\Exports\DetailsExporter;
|
||||
use App\Models\StatistikoDetail;
|
||||
use Filament\Actions\Action;
|
||||
use Filament\Actions\CreateAction;
|
||||
use Filament\Actions\ExportAction;
|
||||
use Filament\Actions\Exports\Models\Export;
|
||||
use Filament\Resources\Pages\ListRecords;
|
||||
|
||||
class ListStatistikoDetails extends ListRecords
|
||||
{
|
||||
protected static string $resource = StatistikoDetailResource::class;
|
||||
|
||||
protected function getHeaderActions(): array
|
||||
{
|
||||
return [
|
||||
ExportAction::make('download_all')
|
||||
->columnMapping(false)
|
||||
->exporter(DetailsExporter::class)
|
||||
->chunkSize(1000)
|
||||
->label('Download')
|
||||
->fileName(fn(Export $export): string => 'details-' . date('d.m.Y-H.i') . "-{$export->getKey()}")
|
||||
->icon('phosphor-download'),
|
||||
Action::make('is_active')
|
||||
->label('Disable All')
|
||||
->icon('phosphor-pause')
|
||||
->requiresConfirmation()
|
||||
->color('gray')
|
||||
->action(function () {
|
||||
StatistikoDetail::query()->update(['is_active' => 0]);
|
||||
}),
|
||||
Action::make('truncate')
|
||||
->icon('phosphor-trash')
|
||||
->requiresConfirmation()
|
||||
->color('danger')
|
||||
->action(function () {
|
||||
StatistikoDetail::truncate();
|
||||
}),
|
||||
CreateAction::make()
|
||||
->label('New')
|
||||
->icon('phosphor-plus'),
|
||||
];
|
||||
}
|
||||
}
|
||||
-34
@@ -1,34 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Clusters\StaticData\Resources\StatistikoDetails\Schemas;
|
||||
|
||||
use Filament\Forms\Components\DatePicker;
|
||||
use Filament\Forms\Components\TextInput;
|
||||
use Filament\Schemas\Components\Grid;
|
||||
use Filament\Schemas\Schema;
|
||||
|
||||
class StatistikoDetailForm
|
||||
{
|
||||
public static function configure(Schema $schema): Schema
|
||||
{
|
||||
return $schema
|
||||
->components([
|
||||
Grid::make([
|
||||
'default' => 2,
|
||||
'xl' => 4,
|
||||
])->schema([
|
||||
TextInput::make('ss_player_id')->required(),
|
||||
TextInput::make('ss_team_id')->required(),
|
||||
TextInput::make('tx_team_id'),
|
||||
TextInput::make('player_name')->required(),
|
||||
DatePicker::make('ss_national_team_id'),
|
||||
DatePicker::make('birthdate'),
|
||||
TextInput::make('height'),
|
||||
TextInput::make('nationality'),
|
||||
TextInput::make('position'),
|
||||
TextInput::make('preferred_foot'),
|
||||
DatePicker::make('last_update'),
|
||||
]),
|
||||
])->columns(1);
|
||||
}
|
||||
}
|
||||
-52
@@ -1,52 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Clusters\StaticData\Resources\StatistikoDetails;
|
||||
|
||||
use App\Filament\Clusters\StaticData\Resources\StatistikoDetails\Pages\ListStatistikoDetails;
|
||||
use App\Filament\Clusters\StaticData\Resources\StatistikoDetails\Schemas\StatistikoDetailForm;
|
||||
use App\Filament\Clusters\StaticData\Resources\StatistikoDetails\Tables\StatistikoDetailsTable;
|
||||
use App\Filament\Clusters\StaticData\StaticDataCluster;
|
||||
use App\Models\StatistikoDetail;
|
||||
use Filament\Resources\Resource;
|
||||
use Filament\Schemas\Schema;
|
||||
use Filament\Tables\Table;
|
||||
use UnitEnum;
|
||||
|
||||
class StatistikoDetailResource extends Resource
|
||||
{
|
||||
protected static ?string $model = StatistikoDetail::class;
|
||||
|
||||
protected static ?string $navigationLabel = 'Details';
|
||||
|
||||
protected static ?string $modelLabel = 'Details';
|
||||
|
||||
protected static string|UnitEnum|null $navigationGroup = 'Statistiko';
|
||||
|
||||
protected static ?string $cluster = StaticDataCluster::class;
|
||||
|
||||
protected static ?int $navigationSort = 9;
|
||||
|
||||
protected static ?string $recordTitleAttribute = 'player_name';
|
||||
|
||||
public static function form(Schema $schema): Schema
|
||||
{
|
||||
return StatistikoDetailForm::configure($schema);
|
||||
}
|
||||
|
||||
public static function table(Table $table): Table
|
||||
{
|
||||
return StatistikoDetailsTable::configure($table);
|
||||
}
|
||||
|
||||
public static function getPages(): array
|
||||
{
|
||||
return [
|
||||
'index' => ListStatistikoDetails::route('/'),
|
||||
];
|
||||
}
|
||||
|
||||
public static function getNavigationBadge(): ?string
|
||||
{
|
||||
return parent::getEloquentQuery()->count();
|
||||
}
|
||||
}
|
||||
-81
@@ -1,81 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Clusters\StaticData\Resources\StatistikoDetails\Tables;
|
||||
|
||||
use App\Models\StatistikoDetail;
|
||||
use Filament\Actions\DeleteAction;
|
||||
use Filament\Actions\EditAction;
|
||||
use Filament\Forms\Components\Checkbox;
|
||||
use Filament\Tables\Columns\Layout\Stack;
|
||||
use Filament\Tables\Columns\TextColumn;
|
||||
use Filament\Tables\Columns\ToggleColumn;
|
||||
use Filament\Tables\Enums\FiltersLayout;
|
||||
use Filament\Tables\Filters\Filter;
|
||||
use Filament\Tables\Table;
|
||||
use Illuminate\Database\Eloquent\Builder;
|
||||
|
||||
class StatistikoDetailsTable
|
||||
{
|
||||
public static function configure(Table $table): Table
|
||||
{
|
||||
return $table
|
||||
->poll('15s')
|
||||
->striped()
|
||||
->defaultPaginationPageOption(8)
|
||||
->paginationPageOptions([8, 16, 24, 36])
|
||||
->columns([
|
||||
Stack::make([
|
||||
ToggleColumn::make('is_active'),
|
||||
TextColumn::make('player_name')->color('primary')->icon('phosphor-copy')->copyable()->searchable(),
|
||||
TextColumn::make('ss_player_id')
|
||||
->color('success')->icon('phosphor-copy')->copyable()
|
||||
->searchable(
|
||||
query: fn($query, $search) => $query->orWhere('ss_player_id', (int) $search)
|
||||
),
|
||||
TextColumn::make('positions.name')->badge()->color('warning')
|
||||
->sortable(),
|
||||
TextColumn::make('team.ss_team_name')->prefix('Team: ')->color('teal'),
|
||||
TextColumn::make('team.country.name')->prefix('Country: ')->color('teal'),
|
||||
TextColumn::make('birthdate')->prefix('Birthdate: '),
|
||||
TextColumn::make('height')->prefix('Height: ')->suffix(' cm'),
|
||||
TextColumn::make('nationality')->prefix('Nationality: '),
|
||||
TextColumn::make('preferred_foot')->prefix('Preferred Foot: '),
|
||||
TextColumn::make('last_update')->date()->prefix('Last Update: '),
|
||||
]),
|
||||
])
|
||||
->emptyStateHeading('No double player in details')
|
||||
->contentGrid([
|
||||
'md' => 2,
|
||||
'xl' => 4,
|
||||
])
|
||||
->filters([
|
||||
Filter::make('player_filters')
|
||||
->schema([
|
||||
Checkbox::make('find_double'),
|
||||
])->query(function (Builder $query, array $data): Builder {
|
||||
return $query->when(
|
||||
$data['find_double'],
|
||||
function (Builder $query) {
|
||||
$pDetails = StatistikoDetail::pluck('ss_player_id')->toArray();
|
||||
$doublpDetails = array_diff_assoc(
|
||||
$pDetails,
|
||||
array_unique($pDetails)
|
||||
);
|
||||
$query->whereIn('ss_player_id', $doublpDetails)->orderBy('ss_player_id');
|
||||
}
|
||||
);
|
||||
})->indicateUsing(function (array $data): ?string {
|
||||
if (! $data['find_double']) {
|
||||
return null;
|
||||
}
|
||||
return 'Find Double';
|
||||
}),
|
||||
|
||||
], layout: FiltersLayout::AboveContent)
|
||||
->deferFilters(false)
|
||||
->recordActions([
|
||||
EditAction::make()->iconButton(),
|
||||
DeleteAction::make()->iconButton(),
|
||||
]);
|
||||
}
|
||||
}
|
||||
-11
@@ -1,11 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Clusters\StaticData\Resources\StatistikoEvents\Pages;
|
||||
|
||||
use App\Filament\Clusters\StaticData\Resources\StatistikoEvents\StatistikoEventsResource;
|
||||
use Filament\Resources\Pages\CreateRecord;
|
||||
|
||||
class CreateStatistikoEvents extends CreateRecord
|
||||
{
|
||||
protected static string $resource = StatistikoEventsResource::class;
|
||||
}
|
||||
-19
@@ -1,19 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Clusters\StaticData\Resources\StatistikoEvents\Pages;
|
||||
|
||||
use App\Filament\Clusters\StaticData\Resources\StatistikoEvents\StatistikoEventsResource;
|
||||
use Filament\Actions\DeleteAction;
|
||||
use Filament\Resources\Pages\EditRecord;
|
||||
|
||||
class EditStatistikoEvents extends EditRecord
|
||||
{
|
||||
protected static string $resource = StatistikoEventsResource::class;
|
||||
|
||||
protected function getHeaderActions(): array
|
||||
{
|
||||
return [
|
||||
DeleteAction::make(),
|
||||
];
|
||||
}
|
||||
}
|
||||
-57
@@ -1,57 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Clusters\StaticData\Resources\StatistikoEvents\Pages;
|
||||
|
||||
use App\Filament\Clusters\StaticData\Resources\StatistikoEvents\StatistikoEventsResource;
|
||||
use App\Filament\Exports\EventsHistoryExporter;
|
||||
use App\Models\StatistikoEvent;
|
||||
use DateTime;
|
||||
use Filament\Actions\Action;
|
||||
use Filament\Actions\CreateAction;
|
||||
use Filament\Actions\ExportAction;
|
||||
use Filament\Actions\Exports\Models\Export;
|
||||
use Filament\Resources\Pages\ListRecords;
|
||||
|
||||
class ListStatistikoEvents extends ListRecords
|
||||
{
|
||||
protected static string $resource = StatistikoEventsResource::class;
|
||||
|
||||
protected function getHeaderActions(): array
|
||||
{
|
||||
return [
|
||||
ExportAction::make('download_all')
|
||||
->columnMapping(false)
|
||||
->exporter(EventsHistoryExporter::class)
|
||||
->label('Download')
|
||||
->fileName(fn(Export $export): string => 'events-history-' . date('d.m.Y-H.i') . "-{$export->getKey()}")
|
||||
->icon('phosphor-download'),
|
||||
Action::make('starttime')
|
||||
->color('gray')
|
||||
->tooltip('Find events with wrong starttime')
|
||||
->icon('phosphor-magnifying-glass')
|
||||
->modalSubmitAction(fn(Action $action) => $action->label('Delete all')
|
||||
->color('danger')
|
||||
->icon('heroicon-o-trash'))
|
||||
->modalContent(function () {
|
||||
$events = StatistikoEvent::with('league')->with('home')->with('away')->where('starttime', '<', new DateTime('-10 years'))->get();
|
||||
|
||||
return view('filament.pages.list-fixtures-starttime', ['events' => $events]);
|
||||
})->action(function () {
|
||||
$events = StatistikoEvent::with('league')->with('home')->with('away')->where('starttime', '<', new DateTime('-10 years'))->get();
|
||||
foreach ($events as $value) {
|
||||
StatistikoEvent::where('match_id', $value->match_id)->delete();
|
||||
}
|
||||
}),
|
||||
Action::make('truncate')
|
||||
->icon('phosphor-trash')
|
||||
->requiresConfirmation()
|
||||
->color('danger')
|
||||
->action(function () {
|
||||
StatistikoEvent::truncate();
|
||||
}),
|
||||
CreateAction::make()
|
||||
->label('New')
|
||||
->icon('phosphor-plus'),
|
||||
];
|
||||
}
|
||||
}
|
||||
-37
@@ -1,37 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Clusters\StaticData\Resources\StatistikoEvents\Schemas;
|
||||
|
||||
use Filament\Forms\Components\DateTimePicker;
|
||||
use Filament\Forms\Components\TextInput;
|
||||
use Filament\Schemas\Schema;
|
||||
|
||||
class StatistikoEventsForm
|
||||
{
|
||||
public static function configure(Schema $schema): Schema
|
||||
{
|
||||
return $schema
|
||||
->components([
|
||||
DateTimePicker::make('starttime')->native(false),
|
||||
TextInput::make('season'),
|
||||
TextInput::make('gls_h'),
|
||||
TextInput::make('gls_a'),
|
||||
TextInput::make('crn_h'),
|
||||
TextInput::make('fls_h'),
|
||||
TextInput::make('ofs_h'),
|
||||
TextInput::make('snt_h'),
|
||||
TextInput::make('tsh_h'),
|
||||
TextInput::make('crd_h'),
|
||||
TextInput::make('crn_a'),
|
||||
TextInput::make('fls_a'),
|
||||
TextInput::make('ofs_a'),
|
||||
TextInput::make('snt_a'),
|
||||
TextInput::make('tsh_a'),
|
||||
TextInput::make('crd_a'),
|
||||
TextInput::make('exp_home'),
|
||||
TextInput::make('exp_away'),
|
||||
TextInput::make('exp_handicap'),
|
||||
TextInput::make('exp_total'),
|
||||
])->columns(4);
|
||||
}
|
||||
}
|
||||
Loaded 100 of 1210 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user