wip starttime

This commit is contained in:
salam committed 2026-02-25 11:50:03 +01:00
1 parent 34c0cb4ba4
commit e48365cd9b
7 files changed
+125 -47

No files matched your search

+1 -1
View File
@@ -77,7 +77,7 @@ class Logifuture
'event_id' => $event['id'],
'sport_id' => $sport_id,
'bookmaker_id' => Nuh::$options['bookmaker_id'],
], ['in_feed' => 1, 'bmoid' => $event['id'], 'startime' => $event['starttime']]);
], ['in_feed' => 1, 'bmoid' => $event['id'], 'starttime' => $event['starttime']]);
}, 5);
switch ($sport_id) {
@@ -7,6 +7,7 @@ use App\Filament\Resources\Events\Tables\Tools\LoadBettypeSettings;
use App\Filament\Resources\Events\Tables\Tools\LoadCompareDifferences;
use App\Filament\Resources\Events\Tables\Tools\LoadMultiline;
use App\Filament\Tables\Columns\ColumnOdds;
use App\Filament\Tables\Columns\ColumnStarttime;
use App\Filament\Tables\Columns\EventColumn;
use App\Filament\Tables\Columns\MatchIds;
use App\Filament\Tables\Columns\TooltipOdds;
@@ -31,7 +32,6 @@ use Filament\Forms\Components\Textarea;
use Filament\Forms\Components\TextInput;
use Filament\Schemas\Components\FusedGroup;
use Filament\Schemas\Components\Utilities\Get;
use Filament\Support\Enums\FontWeight;
use Filament\Support\Enums\VerticalAlignment;
use Filament\Support\Enums\Width;
use Filament\Tables\Columns\IconColumn;
@@ -43,7 +43,6 @@ use Filament\Tables\Table;
use Illuminate\Database\Eloquent\Builder;
use Illuminate\Support\Carbon;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\HtmlString;
class EventsTable
{
@@ -80,24 +79,24 @@ class EventsTable
MatchIds::make('ids')->grow(false)->visibleFrom('xl')
->visible(fn () => auth()->user()->hasRole('super_admin')),
TextColumn::make('event_bookmaker.starttime')
->timezone('CET')
->label('Start')
->alignCenter()
->dateTime('H:i')
->weight(FontWeight::Bold)
->color(function ($record) {
$bkm = $record->event_bookmaker?->starttime ?? null;
if ($bkm) {
return $bkm != $record->starttime ? 'danger' : 'info';
}
ColumnStarttime::make('starttime')->label('Start'),
return 'gray';
})
->state(function ($record) {
return $record->event_bookmaker->starttime ?? $record->starttime;
})
->description(fn ($record): string => Carbon::createFromDate($record->event_bookmaker->starttime ?? $record->starttime)->format('d. M')),
// TextColumn::make('event_bookmaker.starttime')
// ->timezone('CET')
// ->label('Start')
// ->alignCenter()
// ->dateTime('H:i')
// ->color(function ($record) {
// $bkm = $record->event_bookmaker?->starttime ?? null;
// if ($bkm) {
// return $bkm != $record->starttime ? 'danger' : 'info';
// }
// return 'gray';
// })
// ->state(function ($record) {
// return $record->event_bookmaker->starttime ?? $record->starttime;
// }),
TextColumn::make('country.name')
->wrap()
@@ -212,7 +211,6 @@ class EventsTable
->prefixIcon('phosphor-flag')
->hiddenLabel()
->label('')
->multiple()
->searchable()
->preload()
->options(function () {
@@ -235,7 +233,7 @@ class EventsTable
->searchable()
->options(function (Get $get) {
if ($get('country_id')) {
$res = Event::where('has_markets', 1)->where('sport_id', auth()->user()->sport_id)->with('country')->with('competition_group')->where('country_id', $get('country_id'))->whereDate('starttime', '>', Carbon::now())->groupBy('competition_group_id')->get();
$res = Event::where('has_markets', 1)->where('sport_id', auth()->user()->sport_id)->with('country')->with('competition_group')->where('country_id', $get('country_id'))->groupBy('competition_group_id')->get();
} else {
$res = Event::where('has_markets', 1)->where('sport_id', auth()->user()->sport_id)->with('country')->with('competition_group')->whereDate('starttime', '>', Carbon::now())->groupBy('competition_group_id')->get();
}
@@ -466,12 +464,8 @@ class EventsTable
})->indicateUsing(function (array $data): array {
$indicators = [];
if ($data['country_id'] ?? null) {
$countries = Country::whereIn('id', $data['country_id'])->pluck('name')->toArray();
if (count($countries) > 1) {
$indicators[] = Indicator::make('Countries: '.implode(', ', $countries))->removeField('country_id')->color('warning');
} else {
$indicators[] = Indicator::make('Country: '.$countries[0])->removeField('country_id')->color('warning');
}
$countries = Country::where('id', $data['country_id'])->pluck('name')->toArray();
$indicators[] = Indicator::make('Countries: '.implode(', ', $countries))->removeField('country_id')->color('warning');
}
if ($data['group_id'] ?? null) {
@@ -699,10 +693,10 @@ class EventsTable
])->iconButton()
->icon('phosphor-dots-three-vertical'),
// ])->toolbarActions([
// BulkActionGroup::make([
// DeleteBulkAction::make()->visible(fn () => auth()->user()->hasRole('super_admin')),
// ]),
])->toolbarActions([
BulkActionGroup::make([
DeleteBulkAction::make()->visible(fn () => auth()->user()->hasRole('super_admin')),
]),
]);
}
}
@@ -0,0 +1,47 @@
<?php
namespace App\Filament\Tables\Columns;
use Filament\Tables\Columns\Column;
use Illuminate\Support\Carbon;
class ColumnStarttime extends Column
{
protected string $view = 'filament.tables.columns.column-starttime';
protected $starttime;
protected $tx;
protected $cl;
protected $color;
public function setTime($record)
{
$this->tx = Carbon::createFromTimestamp(strtotime($record->starttime));
if ($record->event_bookmaker?->starttime) {
$this->cl = Carbon::createFromTimestamp(strtotime($record->event_bookmaker?->starttime));
$this->starttime = Carbon::createFromTimestamp(strtotime($record->event_bookmaker?->starttime));
if ($this->tx == $this->cl) {
$this->color = 'text-green-600';
} else {
$this->color = 'text-orange-600';
}
} else {
$this->color = 'text-blue-600';
$this->starttime = Carbon::createFromTimestamp(strtotime($record->starttime));
}
}
public function getColor()
{
return $this->color;
}
public function getStarttime()
{
return $this->starttime;
}
}