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);
|
||||
|
||||
@@ -38,13 +38,17 @@
|
||||
</div>
|
||||
@endif
|
||||
|
||||
@if ($record->betsapi_id)
|
||||
@if ($record->betsapi_id && $record->home_betsapi && $record->away_betsapi)
|
||||
<x-filament::modal width="5xl">
|
||||
<x-slot name="trigger">
|
||||
<x-filament::icon-button icon="phosphor-info" color="gray" size="sm"
|
||||
tooltip="Encounter History" />
|
||||
</x-slot>
|
||||
@livewire('encounter-history', ['betsapi_id' => $record->betsapi_id, 'home' => $record->home->name, 'away' => $record->away->name])
|
||||
@livewire('encounter-history', [
|
||||
'betsapi_id' => $record->betsapi_id,
|
||||
'home' => $record->home_betsapi->name,
|
||||
'away' => $record->away_betsapi->name,
|
||||
])
|
||||
</x-filament::modal>
|
||||
@endif
|
||||
</div>
|
||||
Reference in new issue
Block a user