wip
This commit is contained in:
1 parent
d316d486b9
commit
c6c5cdc1b1
21 files changed
+620
-34
No files matched your search
+11
@@ -0,0 +1,11 @@
|
||||
<?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
@@ -0,0 +1,19 @@
|
||||
<?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
@@ -0,0 +1,19 @@
|
||||
<?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
@@ -0,0 +1,29 @@
|
||||
<?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
@@ -0,0 +1,53 @@
|
||||
<?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 = 'Countries';
|
||||
|
||||
protected static ?string $navigationLabel = 'Countries';
|
||||
|
||||
protected static ?string $modelLabel = '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
@@ -0,0 +1,49 @@
|
||||
<?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(),
|
||||
]);
|
||||
}
|
||||
}
|
||||
+1
-1
@@ -22,7 +22,7 @@ class SofaScoreRosasTable
|
||||
->columns([
|
||||
TextColumn::make('ss_team_id')->label('SSId')->badge()->width('1rem')
|
||||
->sortable(),
|
||||
TextColumn::make('country.name')->label('Country')
|
||||
TextColumn::make('sofascore_category.name')->label('Country')
|
||||
->sortable(),
|
||||
TextColumn::make('tournament_rosa.tournament.name')->label('Tournament')
|
||||
->sortable(),
|
||||
|
||||
+2
-2
@@ -41,7 +41,7 @@ class SofaScoreTournamentsTable
|
||||
->searchable(),
|
||||
TextColumn::make('sofascore_category.name')
|
||||
->label('Country')
|
||||
->icon(fn($record) => $record->sofascore_category->country->icon)
|
||||
->icon(fn($record) => $record->sofascore_category->flag)
|
||||
->sortable(),
|
||||
TextColumn::make('name')->searchable()->sortable(),
|
||||
ToggleColumn::make('enabled')
|
||||
@@ -76,7 +76,7 @@ class SofaScoreTournamentsTable
|
||||
return SofaScoreCategory::query()->whereIn('id', $res)->orderBy('name')->pluck('name', 'id');
|
||||
})
|
||||
->live(),
|
||||
Toggle::make('enabled')->label('In Statistiko'),
|
||||
Toggle::make('enabled')->label('In Statistiko')->default(1),
|
||||
])
|
||||
->query(function (Builder $query, array $data): Builder {
|
||||
return $query->when(
|
||||
|
||||
+6
@@ -31,8 +31,14 @@ class StatisticFixturesTable
|
||||
'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(
|
||||
|
||||
+8
@@ -38,15 +38,23 @@ class StatistikoEventsTable
|
||||
->searchable(
|
||||
query: fn($query, $search) => $query->orWhere('match_id', (int) $search)
|
||||
),
|
||||
IconColumn::make('league.sofascore_category.flag')
|
||||
->label('')
|
||||
->icon(function ($state): string {
|
||||
return $state;
|
||||
}),
|
||||
TextColumn::make('league.name')
|
||||
->tooltip(fn($record) => $record->league_id)
|
||||
->sortable(
|
||||
query: fn(Builder $query) => $query->orderBy('name')
|
||||
)
|
||||
->searchable(),
|
||||
TextColumn::make('home.ss_team_name')->color('info')
|
||||
->tooltip(fn($record) => $record->home_id)
|
||||
->sortable()
|
||||
->searchable(),
|
||||
TextColumn::make('away.ss_team_name')->color('success')
|
||||
->tooltip(fn($record) => $record->away_id)
|
||||
->sortable()
|
||||
->searchable(),
|
||||
TextColumn::make('starttime')->dateTime('Y-m-d H:i')
|
||||
|
||||
Reference in new issue
Block a user