statistic on separate page wip
This commit is contained in:
1 parent
ad36ba555f
commit
422681df01
34 files changed
+660
-734
No files matched your search
+11
@@ -0,0 +1,11 @@
|
||||
<?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
@@ -0,0 +1,19 @@
|
||||
<?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(),
|
||||
];
|
||||
}
|
||||
}
|
||||
+26
@@ -0,0 +1,26 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Clusters\StaticData\Resources\StatisticFixtures\Pages;
|
||||
|
||||
use App\Filament\Clusters\StaticData\Resources\StatisticFixtures\StatisticFixturesResource;
|
||||
use App\Models\StatistikoEvent;
|
||||
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('delete_played')
|
||||
->icon('phosphor-trash')
|
||||
->requiresConfirmation()
|
||||
->color('danger')
|
||||
->action(function () {
|
||||
StatistikoEvent::where('starttime', '<', now()->subHour())->delete();
|
||||
}),
|
||||
];
|
||||
}
|
||||
}
|
||||
+18
@@ -0,0 +1,18 @@
|
||||
<?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
@@ -0,0 +1,50 @@
|
||||
<?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 = 2;
|
||||
|
||||
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();
|
||||
}
|
||||
}
|
||||
+69
@@ -0,0 +1,69 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Clusters\StaticData\Resources\StatisticFixtures\Tables;
|
||||
|
||||
use App\Models\CompetitionGroup;
|
||||
use App\Models\StatisticFixtures;
|
||||
use Filament\Actions\BulkActionGroup;
|
||||
use Filament\Actions\DeleteAction;
|
||||
use Filament\Actions\DeleteBulkAction;
|
||||
use Filament\Actions\EditAction;
|
||||
use Filament\Tables\Columns\IconColumn;
|
||||
use Filament\Tables\Columns\TextColumn;
|
||||
use Filament\Tables\Enums\FiltersLayout;
|
||||
use Filament\Tables\Filters\SelectFilter;
|
||||
use Filament\Tables\Table;
|
||||
|
||||
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',
|
||||
}),
|
||||
TextColumn::make('league.name')
|
||||
->label('League')
|
||||
->searchable()
|
||||
->wrap()
|
||||
->hidden(fn () => auth()->user()->sport_id == 5)
|
||||
->description(fn ($record) => ucwords($record->league?->country->name)),
|
||||
TextColumn::make('starttime')->dateTime('M j, Y')->label('Date'),
|
||||
TextColumn::make('home.name')->color('primary')->searchable(),
|
||||
TextColumn::make('away.name')->color('success')->searchable(),
|
||||
// TextColumn::make('exp_home')->alignCenter()->numeric(),
|
||||
// TextColumn::make('exp_away')->alignCenter()->numeric(),
|
||||
TextColumn::make('updated_at')->alignCenter()->date(),
|
||||
])
|
||||
->filters([
|
||||
SelectFilter::make('league_id')
|
||||
->options(function () {
|
||||
$res = StatisticFixtures::where('sport_id', 1)
|
||||
->groupBy('league_id')
|
||||
->pluck('league_id')->toArray();
|
||||
|
||||
return CompetitionGroup::query()->whereIn('id', $res)->orderBy('name')->pluck('name', 'id');
|
||||
})
|
||||
->preload()
|
||||
->searchable()
|
||||
->columnSpan(2)
|
||||
->label('League'),
|
||||
], layout: FiltersLayout::AboveContent)
|
||||
->deferFilters(false)
|
||||
->recordActions([
|
||||
EditAction::make()->iconButton(),
|
||||
DeleteAction::make()->iconButton(),
|
||||
])
|
||||
->toolbarActions([
|
||||
BulkActionGroup::make([
|
||||
DeleteBulkAction::make(),
|
||||
]),
|
||||
]);
|
||||
}
|
||||
}
|
||||
-9
@@ -3,7 +3,6 @@
|
||||
namespace App\Filament\Clusters\StaticData\Resources\StatistikoEvents\Pages;
|
||||
|
||||
use App\Filament\Clusters\StaticData\Resources\StatistikoEvents\StatistikoEventsResource;
|
||||
// use App\Filament\Imports\StatistikoEventImporter;
|
||||
use App\Models\StatistikoEvent;
|
||||
use Filament\Actions\Action;
|
||||
use Filament\Actions\CreateAction;
|
||||
@@ -27,14 +26,6 @@ class ListStatistikoEvents extends ListRecords
|
||||
CreateAction::make()
|
||||
->label('New')
|
||||
->icon('phosphor-plus'),
|
||||
// ImportAction::make('importEvents')
|
||||
// ->maxRows(200000)
|
||||
// ->color('success')
|
||||
// ->chunkSize(250)
|
||||
// ->icon('phosphor-upload')
|
||||
// ->label('Import')
|
||||
// ->modalDescription('Max 20k rows per import, column separator: ";"')
|
||||
// ->importer(StatistikoEventImporter::class),
|
||||
];
|
||||
}
|
||||
}
|
||||
-5
@@ -47,9 +47,4 @@ class StatistikoEventsResource extends Resource
|
||||
{
|
||||
return parent::getEloquentQuery()->count();
|
||||
}
|
||||
|
||||
public static function getNavigationBadgeColor(): ?string
|
||||
{
|
||||
return 'success';
|
||||
}
|
||||
}
|
||||
-1
@@ -2,7 +2,6 @@
|
||||
|
||||
namespace App\Filament\Clusters\StaticData\Resources\StatistikoEvents\Tables;
|
||||
|
||||
use App\Models\Sport;
|
||||
use Filament\Actions\BulkActionGroup;
|
||||
use Filament\Actions\DeleteBulkAction;
|
||||
use Filament\Actions\EditAction;
|
||||
|
||||
+5
-3
@@ -20,10 +20,12 @@ class StatistikoImportForm
|
||||
->options(Sport::where('is_active', 1)->pluck('name', 'id')),
|
||||
Select::make('data_type')
|
||||
->required()
|
||||
->allowHtml()
|
||||
->options([
|
||||
'player' => 'Player',
|
||||
'events' => 'Events',
|
||||
'events_player' => 'Events & Player',
|
||||
'player' => '<span class="text-blue-500">Player</span>',
|
||||
'events' => '<span class="text-green-500">Events</span>',
|
||||
'fixtures' => '<span class="text-orange-500">Fixtures</span>',
|
||||
'events_player' => '<span class="text-pink-600">Events & Player</span>',
|
||||
]),
|
||||
|
||||
FileUpload::make('file_name')
|
||||
|
||||
+1
-1
@@ -34,11 +34,11 @@ class StatistikoImportsTable
|
||||
->options([
|
||||
'player' => '<span class="text-blue-500">Player</span>',
|
||||
'events' => '<span class="text-green-500">Events</span>',
|
||||
'fixtures' => '<span class="text-orange-500">Fixtures</span>',
|
||||
'events_player' => '<span class="text-amber-500">Events & Player</span>',
|
||||
]),
|
||||
TextColumn::make('file_name_original')
|
||||
->searchable()
|
||||
->color('primary')
|
||||
->label('Name'),
|
||||
IconColumn::make('has_run')
|
||||
->label('Import')
|
||||
|
||||
-10
@@ -3,11 +3,9 @@
|
||||
namespace App\Filament\Clusters\StaticData\Resources\StatistikoPlayers\Pages;
|
||||
|
||||
use App\Filament\Clusters\StaticData\Resources\StatistikoPlayers\StatistikoPlayerResource;
|
||||
// use App\Filament\Imports\StatistikoPlayerImporter;
|
||||
use App\Models\StatistikoPlayer;
|
||||
use Filament\Actions\Action;
|
||||
use Filament\Actions\CreateAction;
|
||||
// use Filament\Actions\ImportAction;
|
||||
use Filament\Resources\Pages\ListRecords;
|
||||
|
||||
class ListStatistikoPlayers extends ListRecords
|
||||
@@ -27,14 +25,6 @@ class ListStatistikoPlayers extends ListRecords
|
||||
CreateAction::make()
|
||||
->label('New')
|
||||
->icon('phosphor-plus'),
|
||||
// ImportAction::make('importPlayer')
|
||||
// ->maxRows(200000)
|
||||
// ->color('success')
|
||||
// ->chunkSize(250)
|
||||
// ->icon('phosphor-upload')
|
||||
// ->label('Import')
|
||||
// ->modalDescription('Max 20k rows per import, column separator ";"')
|
||||
// ->importer(StatistikoPlayerImporter::class),
|
||||
];
|
||||
}
|
||||
}
|
||||
+1
-6
@@ -24,7 +24,7 @@ class StatistikoPlayerResource extends Resource
|
||||
|
||||
protected static ?string $cluster = StaticDataCluster::class;
|
||||
|
||||
protected static ?int $navigationSort = 2;
|
||||
protected static ?int $navigationSort = 4;
|
||||
|
||||
protected static ?string $recordTitleAttribute = 'giocatore';
|
||||
|
||||
@@ -49,9 +49,4 @@ class StatistikoPlayerResource extends Resource
|
||||
{
|
||||
return parent::getEloquentQuery()->count();
|
||||
}
|
||||
|
||||
public static function getNavigationBadgeColor(): ?string
|
||||
{
|
||||
return 'success';
|
||||
}
|
||||
}
|
||||
-11
@@ -1,11 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Clusters\Statistic\Resources\StatisticEvents\Pages;
|
||||
|
||||
use App\Filament\Clusters\Statistic\Resources\StatisticEvents\StatisticEventsResource;
|
||||
use Filament\Resources\Pages\CreateRecord;
|
||||
|
||||
class CreateStatisticEvents extends CreateRecord
|
||||
{
|
||||
protected static string $resource = StatisticEventsResource::class;
|
||||
}
|
||||
-19
@@ -1,19 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Clusters\Statistic\Resources\StatisticEvents\Pages;
|
||||
|
||||
use App\Filament\Clusters\Statistic\Resources\StatisticEvents\StatisticEventsResource;
|
||||
// use Filament\Actions\DeleteAction;
|
||||
use Filament\Resources\Pages\EditRecord;
|
||||
|
||||
class EditStatisticEvents extends EditRecord
|
||||
{
|
||||
protected static string $resource = StatisticEventsResource::class;
|
||||
|
||||
// protected function getHeaderActions(): array
|
||||
// {
|
||||
// return [
|
||||
// DeleteAction::make(),
|
||||
// ];
|
||||
// }
|
||||
}
|
||||
-19
@@ -1,19 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Clusters\Statistic\Resources\StatisticEvents\Pages;
|
||||
|
||||
use App\Filament\Clusters\Statistic\Resources\StatisticEvents\StatisticEventsResource;
|
||||
// use Filament\Actions\CreateAction;
|
||||
use Filament\Resources\Pages\ListRecords;
|
||||
|
||||
class ListStatisticEvents extends ListRecords
|
||||
{
|
||||
protected static string $resource = StatisticEventsResource::class;
|
||||
|
||||
// protected function getHeaderActions(): array
|
||||
// {
|
||||
// return [
|
||||
// CreateAction::make(),
|
||||
// ];
|
||||
// }
|
||||
}
|
||||
-16
@@ -1,16 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Clusters\Statistic\Resources\StatisticEvents\Schemas;
|
||||
|
||||
use Filament\Schemas\Schema;
|
||||
|
||||
class StatisticEventsForm
|
||||
{
|
||||
public static function configure(Schema $schema): Schema
|
||||
{
|
||||
return $schema
|
||||
->components([
|
||||
//
|
||||
]);
|
||||
}
|
||||
}
|
||||
@@ -1,47 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Clusters\Statistic\Resources\StatisticEvents;
|
||||
|
||||
use App\Filament\Clusters\Statistic\Resources\StatisticEvents\Pages\ListStatisticEvents;
|
||||
use App\Filament\Clusters\Statistic\Resources\StatisticEvents\Schemas\StatisticEventsForm;
|
||||
use App\Filament\Clusters\Statistic\Resources\StatisticEvents\Tables\StatisticEventsTable;
|
||||
use App\Filament\Clusters\Statistic\StatisticCluster;
|
||||
use App\Models\StatistikoEvent;
|
||||
use BackedEnum;
|
||||
use Filament\Resources\Resource;
|
||||
use Filament\Schemas\Schema;
|
||||
use Filament\Tables\Table;
|
||||
|
||||
class StatisticEventsResource extends Resource
|
||||
{
|
||||
protected static ?string $model = StatistikoEvent::class;
|
||||
|
||||
protected static string|BackedEnum|null $navigationIcon = 'phosphor-chart-line-up';
|
||||
|
||||
protected static ?string $navigationLabel = 'Statistic Events';
|
||||
|
||||
protected static ?string $modelLabel = 'Statistic Events';
|
||||
|
||||
protected static ?int $navigationSort = 1;
|
||||
|
||||
protected static string|\UnitEnum|null $navigationGroup = 'Events';
|
||||
|
||||
protected static ?string $cluster = StatisticCluster::class;
|
||||
|
||||
public static function form(Schema $schema): Schema
|
||||
{
|
||||
return StatisticEventsForm::configure($schema);
|
||||
}
|
||||
|
||||
public static function table(Table $table): Table
|
||||
{
|
||||
return StatisticEventsTable::configure($table);
|
||||
}
|
||||
|
||||
public static function getPages(): array
|
||||
{
|
||||
return [
|
||||
'index' => ListStatisticEvents::route('/'),
|
||||
];
|
||||
}
|
||||
}
|
||||
-189
@@ -1,189 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Clusters\Statistic\Resources\StatisticEvents\Tables;
|
||||
|
||||
use App\Models\Country;
|
||||
use App\Models\Event;
|
||||
use App\Models\Sport;
|
||||
use Filament\Actions\BulkActionGroup;
|
||||
use Filament\Actions\DeleteBulkAction;
|
||||
use Filament\Actions\EditAction;
|
||||
use Filament\Forms\Components\DatePicker;
|
||||
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\Filters\Indicator;
|
||||
use Filament\Tables\Table;
|
||||
use Illuminate\Database\Eloquent\Builder;
|
||||
use Illuminate\Support\Carbon;
|
||||
use Illuminate\Support\HtmlString;
|
||||
|
||||
class StatisticEventsTable
|
||||
{
|
||||
public static function configure(Table $table): Table
|
||||
{
|
||||
return $table
|
||||
->striped()
|
||||
->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',
|
||||
}),
|
||||
TextColumn::make('league.name')->searchable(),
|
||||
TextColumn::make('starttime')->dateTime('M j, Y')->label('Date'),
|
||||
TextColumn::make('home.name')->color('primary')->searchable(),
|
||||
TextColumn::make('away.name')->color('success')->searchable(),
|
||||
])
|
||||
->filters([
|
||||
Filter::make('events')
|
||||
->columns(5)->columnSpan(5)
|
||||
->schema([
|
||||
Select::make('sport_id')
|
||||
->default(1)
|
||||
->hiddenLabel()
|
||||
->options(Sport::whereIn('id', [1, 2, 3, 5])->pluck('name', 'id')),
|
||||
Select::make(name: 'country_id')
|
||||
->hidden(fn (Get $get) => $get('sport_id') == 5)
|
||||
->placeholder('Country')
|
||||
->prefixIcon('phosphor-flag')
|
||||
->hiddenLabel()
|
||||
->searchable()
|
||||
->options(function (Get $get) {
|
||||
$res = Event::where('has_markets', 1)
|
||||
->where('sport_id', $get('sport_id'))
|
||||
->groupBy('country_id')
|
||||
->pluck('country_id')->toArray();
|
||||
|
||||
return Country::query()->whereIn('id', $res)->orderBy('name')->pluck('name', 'id');
|
||||
})
|
||||
->live()
|
||||
->reactive()
|
||||
->afterStateUpdated(function (callable $set) {
|
||||
$set('competition_group_id', null);
|
||||
}),
|
||||
Select::make('competition_group_id')
|
||||
->placeholder(fn (Get $get) => $get('sport_id') == 5 ? 'Tournament' : 'League')
|
||||
->prefixIcon('phosphor-trophy')
|
||||
->hiddenLabel()
|
||||
// ->multiple()
|
||||
->searchable()
|
||||
->options(function (Get $get) {
|
||||
$country_id = $get('country_id') ?? 0;
|
||||
$res = Event::with('country')
|
||||
->with('competition_group')
|
||||
->where('sport_id', $get('sport_id'))
|
||||
->when($country_id, function ($query, $country_id) {
|
||||
$query->where('country_id', $country_id);
|
||||
})->groupBy('competition_group_id')->get();
|
||||
|
||||
$arr = [];
|
||||
foreach ($res as $val) {
|
||||
$arr[(int) $val->competition_group_id] = $val->country?->name.' '.$val->competition_group?->name;
|
||||
}
|
||||
|
||||
asort($arr);
|
||||
|
||||
return $arr;
|
||||
})
|
||||
->live(),
|
||||
DatePicker::make('starttime_from')
|
||||
->prefix(fn () => new HtmlString('<string class="text-info-500">From</string>'))
|
||||
->displayFormat('d M Y')
|
||||
->hiddenLabel()
|
||||
->label(''),
|
||||
DatePicker::make('starttime_to')
|
||||
->prefix(fn () => new HtmlString('<string class="text-success-500">To:</string>'))
|
||||
->displayFormat('d M Y')
|
||||
->hiddenLabel()
|
||||
->label(''),
|
||||
])
|
||||
->query(function (Builder $query, array $data): Builder {
|
||||
return $query->when(
|
||||
$data['sport_id'],
|
||||
function (Builder $query, $sport_id) {
|
||||
$query->where('sport_id', (int) $sport_id);
|
||||
}
|
||||
)->when(
|
||||
$data['competition_group_id'],
|
||||
function (Builder $query, $competition_group_id) {
|
||||
// dd($competition_group_id);
|
||||
$query->where('league_id', (int) $competition_group_id);
|
||||
}
|
||||
)->when(
|
||||
$data['starttime_from'],
|
||||
function (Builder $query, $starttime_from) {
|
||||
if (isset($starttime_from)) {
|
||||
$from = Carbon::createFromDate($starttime_from);
|
||||
|
||||
return $query->where('starttime', '>=', $starttime_from);
|
||||
}
|
||||
}
|
||||
)->when(
|
||||
$data['starttime_to'],
|
||||
function (Builder $query, $starttime_to) {
|
||||
if (isset($starttime_to)) {
|
||||
$to = Carbon::createFromDate($starttime_to);
|
||||
|
||||
return $query->where('starttime', '<=', $starttime_to);
|
||||
}
|
||||
}
|
||||
);
|
||||
})->indicateUsing(function (array $data): array {
|
||||
$indicators = [];
|
||||
|
||||
if ($data['starttime_from'] ?? null) {
|
||||
$starttime_from = $data['starttime_from'];
|
||||
if ($starttime_from ?? null) {
|
||||
$text = Carbon::parse($starttime_from)->format('d. M. Y');
|
||||
$indicators[] = Indicator::make('From: '.$text)->removeField('starttime_from')->color('info');
|
||||
}
|
||||
}
|
||||
if ($data['starttime_to'] ?? null) {
|
||||
$starttime_to = $data['starttime_to'];
|
||||
if ($starttime_to ?? null) {
|
||||
$text = Carbon::parse($starttime_to)->format('d. M. Y');
|
||||
$indicators[] = Indicator::make('To: '.$text)->removeField('starttime_to')->color('success');
|
||||
}
|
||||
}
|
||||
|
||||
if ($data['country_id'] ?? null) {
|
||||
$country_id = $data['country_id'];
|
||||
if ($country_id ?? null) {
|
||||
$text = Country::where('id', $country_id)->value('name');
|
||||
$indicators[] = Indicator::make('Country: '.$text)->removeField('country_id');
|
||||
}
|
||||
}
|
||||
|
||||
// if ($data['competition_group_id'] ?? null) {
|
||||
// $competition_groups = CompetitionGroup::whereIn('id', $data['competition_group_id'])->pluck('name')->toArray();
|
||||
// if (count($competition_groups) > 1) {
|
||||
// $indicators[] = Indicator::make(implode(', ', $competition_groups))->removeField('competition_group_id')->color('info');
|
||||
// } else {
|
||||
// $indicators[] = Indicator::make($competition_groups[0])->removeField('competition_group_id')->color('info')->color('info');
|
||||
// }
|
||||
// }
|
||||
|
||||
return $indicators;
|
||||
}),
|
||||
|
||||
], layout: FiltersLayout::AboveContent)
|
||||
->deferFilters(false)
|
||||
->hiddenFilterIndicators(false)
|
||||
->persistFiltersInSession()
|
||||
->recordActions([
|
||||
EditAction::make(),
|
||||
])
|
||||
->toolbarActions([
|
||||
BulkActionGroup::make([
|
||||
DeleteBulkAction::make(),
|
||||
]),
|
||||
]);
|
||||
}
|
||||
}
|
||||
@@ -1,16 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Clusters\Statistic;
|
||||
|
||||
use BackedEnum;
|
||||
use Filament\Clusters\Cluster;
|
||||
use Filament\Pages\Enums\SubNavigationPosition;
|
||||
|
||||
class StatisticCluster extends Cluster
|
||||
{
|
||||
protected static string|BackedEnum|null $navigationIcon = 'phosphor-chart-line-up';
|
||||
|
||||
protected static ?SubNavigationPosition $subNavigationPosition = SubNavigationPosition::Top;
|
||||
|
||||
protected static ?int $navigationSort = 2;
|
||||
}
|
||||
Reference in new issue
Block a user