add color to history
This commit is contained in:
1 parent
c0b8b7439c
commit
7dea3ce335
4 files changed
+55
-14
No files matched your search
@@ -63,6 +63,8 @@ class EventResource extends Resource
|
||||
->with('country')
|
||||
->with('home')
|
||||
->with('away')
|
||||
->with('home_betsapi')
|
||||
->with('away_betsapi')
|
||||
->with('event_bookmaker')
|
||||
->with('event_user_star')
|
||||
->with('event_user_note')
|
||||
|
||||
@@ -10,6 +10,7 @@ use Filament\Schemas\Components\Tabs\Tab;
|
||||
use Filament\Schemas\Concerns\InteractsWithSchemas;
|
||||
use Filament\Schemas\Contracts\HasSchemas;
|
||||
use Filament\Schemas\Schema;
|
||||
use Filament\Support\Enums\FontWeight;
|
||||
use Illuminate\Support\Carbon;
|
||||
use Illuminate\Support\Facades\Http;
|
||||
use Livewire\Attributes\Lazy;
|
||||
@@ -44,16 +45,24 @@ class EncounterHistory extends Component implements HasSchemas
|
||||
TableColumn::make('Date'),
|
||||
TableColumn::make('Home'),
|
||||
TableColumn::make('Away'),
|
||||
TableColumn::make('Result'),
|
||||
TableColumn::make('Result')->alignCenter(),
|
||||
])
|
||||
->schema([
|
||||
TextEntry::make('league.name'),
|
||||
TextEntry::make('time')->formatStateUsing(function ($state) {
|
||||
return Carbon::createFromTimestamp($state)->format('d. m. Y H:i');
|
||||
}),
|
||||
TextEntry::make('home.name'),
|
||||
TextEntry::make('away.name'),
|
||||
TextEntry::make('ss'),
|
||||
TextEntry::make('home.name')->color(fn (string $state): string => match ($state) {
|
||||
$this->home => 'primary',
|
||||
$this->away => 'success',
|
||||
default => 'gray',
|
||||
}),
|
||||
TextEntry::make('away.name')->color(fn (string $state): string => match ($state) {
|
||||
$this->home => 'primary',
|
||||
$this->away => 'success',
|
||||
default => 'gray',
|
||||
}),
|
||||
TextEntry::make('ss')->alignCenter()->weight(FontWeight::Bold),
|
||||
]),
|
||||
]),
|
||||
Tab::make($this->home)
|
||||
@@ -65,16 +74,24 @@ class EncounterHistory extends Component implements HasSchemas
|
||||
TableColumn::make('Date'),
|
||||
TableColumn::make('Home'),
|
||||
TableColumn::make('Away'),
|
||||
TableColumn::make('Result'),
|
||||
TableColumn::make('Result')->alignCenter(),
|
||||
])
|
||||
->schema([
|
||||
TextEntry::make('league.name'),
|
||||
TextEntry::make('time')->formatStateUsing(function ($state) {
|
||||
return Carbon::createFromTimestamp($state)->format('d. m. Y H:i');
|
||||
}),
|
||||
TextEntry::make('home.name'),
|
||||
TextEntry::make('away.name'),
|
||||
TextEntry::make('ss'),
|
||||
TextEntry::make('home.name')->color(fn (string $state): string => match ($state) {
|
||||
$this->home => 'primary',
|
||||
$this->away => 'success',
|
||||
default => 'gray',
|
||||
}),
|
||||
TextEntry::make('away.name')->color(fn (string $state): string => match ($state) {
|
||||
$this->home => 'primary',
|
||||
$this->away => 'success',
|
||||
default => 'gray',
|
||||
}),
|
||||
TextEntry::make('ss')->alignCenter()->weight(FontWeight::Bold),
|
||||
]),
|
||||
]),
|
||||
Tab::make($this->away)
|
||||
@@ -86,16 +103,24 @@ class EncounterHistory extends Component implements HasSchemas
|
||||
TableColumn::make('Date'),
|
||||
TableColumn::make('Home'),
|
||||
TableColumn::make('Away'),
|
||||
TableColumn::make('Result'),
|
||||
TableColumn::make('Result')->alignCenter(),
|
||||
])
|
||||
->schema([
|
||||
TextEntry::make('league.name'),
|
||||
TextEntry::make('time')->formatStateUsing(function ($state) {
|
||||
return Carbon::createFromTimestamp($state)->format('d. m. Y H:i');
|
||||
}),
|
||||
TextEntry::make('home.name'),
|
||||
TextEntry::make('away.name'),
|
||||
TextEntry::make('ss'),
|
||||
TextEntry::make('home.name')->color(fn (string $state): string => match ($state) {
|
||||
$this->home => 'primary',
|
||||
$this->away => 'success',
|
||||
default => 'gray',
|
||||
}),
|
||||
TextEntry::make('away.name')->color(fn (string $state): string => match ($state) {
|
||||
$this->home => 'primary',
|
||||
$this->away => 'success',
|
||||
default => 'gray',
|
||||
}),
|
||||
TextEntry::make('ss')->alignCenter()->weight(FontWeight::Bold),
|
||||
]),
|
||||
]),
|
||||
]),
|
||||
|
||||
@@ -63,6 +63,16 @@ class Event extends Model
|
||||
return $this->belongsTo(Element::class);
|
||||
}
|
||||
|
||||
public function home_betsapi()
|
||||
{
|
||||
return $this->belongsTo(ElementProvider::class, 'home_id', 'element_id')->where('provider_id', 2);
|
||||
}
|
||||
|
||||
public function away_betsapi()
|
||||
{
|
||||
return $this->belongsTo(ElementProvider::class, 'away_id', 'element_id')->where('provider_id', 2);
|
||||
}
|
||||
|
||||
public function odds_2ways()
|
||||
{
|
||||
return $this->hasMany(Odds2way::class);
|
||||
|
||||
Reference in new issue
Block a user