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')
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
|
||||
namespace App\Filament\Pages;
|
||||
|
||||
use App\Actions\LoadSofaScoreCategory;
|
||||
use App\Actions\LoadStatisticFixturesLeaguesOptions;
|
||||
use App\Actions\LoadStatisticFixturesMatchOptions;
|
||||
use App\Filament\Pages\Selections\LoadPlayer;
|
||||
@@ -15,7 +16,6 @@ use Filament\Forms\Components\DatePicker;
|
||||
use Filament\Forms\Components\Radio;
|
||||
use Filament\Forms\Components\Select;
|
||||
use Filament\Forms\Components\Slider;
|
||||
use Filament\Forms\Components\ToggleButtons;
|
||||
use Filament\Pages\Dashboard as BaseDashboard;
|
||||
use Filament\Pages\Dashboard\Concerns\HasFiltersForm;
|
||||
use Filament\Schemas\Components\Grid;
|
||||
@@ -79,17 +79,33 @@ class Statistic extends BaseDashboard
|
||||
Grid::make([
|
||||
'default' => 1,
|
||||
'sm' => 3,
|
||||
'md' => 4,
|
||||
'md' => 5,
|
||||
])
|
||||
->columnSpanFull()
|
||||
->schema([
|
||||
Select::make('sofascore_category_id')
|
||||
->live()
|
||||
->searchable()
|
||||
->prefixIconColor(fn(Get $get): string => $get('sofascore_category_id') ? 'success' : 'danger')
|
||||
->prefixIcon('phosphor-globe-fill')
|
||||
->hiddenLabel()
|
||||
->options(fn() => LoadSofaScoreCategory::load())
|
||||
->placeholder('Country')
|
||||
->afterStateUpdated(function (callable $set) {
|
||||
$set('league_id', null);
|
||||
$set('match_id', null);
|
||||
$set('team_id', null);
|
||||
$set('ss_player_id', null);
|
||||
$set('season', null);
|
||||
}),
|
||||
Select::make('league_id')
|
||||
->live()
|
||||
->searchable()
|
||||
->prefixIconColor(fn(Get $get): string => $get('league_id') ? 'success' : 'danger')
|
||||
->prefixIcon('phosphor-trophy-fill')
|
||||
->hiddenLabel()
|
||||
->options(fn() => LoadStatisticFixturesLeaguesOptions::load(1))
|
||||
// ->options(fn(Get $get) => SofaScoreTournament::with('sofascore_category')->where('sofa_score_category_id', $get('sofascore_category_id'))->pluck('name', 'tournament_id'))
|
||||
->options(fn(Get $get) => LoadStatisticFixturesLeaguesOptions::load($get('sofascore_category_id')))
|
||||
->placeholder('League')
|
||||
->afterStateUpdated(function (callable $set, $state) {
|
||||
$set('match_id', null);
|
||||
|
||||
@@ -248,7 +248,7 @@ class LoadEvents
|
||||
$dataset_away2[] = (int) $value['val_home'];
|
||||
}
|
||||
}
|
||||
$n = max(count($dataset_home), count($dataset_home2));
|
||||
$n = min(count($dataset_home), count($dataset_home2));
|
||||
$f = array_first($labels);
|
||||
$step = round($f / $n);
|
||||
$labels = [];
|
||||
|
||||
@@ -86,7 +86,8 @@ class LoadEventsQuery
|
||||
* STATTISTIC DATA
|
||||
*/
|
||||
|
||||
$res = StatistikoEvent::with('home')->with('away')->where('league_id', 18)
|
||||
// dd($league_id, $home_id, $away_id);
|
||||
$res = StatistikoEvent::with('home')->with('away')
|
||||
->where(function ($query) use ($league_id, $similar_past_matches) {
|
||||
switch ($similar_past_matches) {
|
||||
case 'none':
|
||||
|
||||
Reference in new issue
Block a user