diff --git a/app/Livewire/EncounterHistory.php b/app/Livewire/EncounterHistory.php new file mode 100644 index 00000000..280a09be --- /dev/null +++ b/app/Livewire/EncounterHistory.php @@ -0,0 +1,117 @@ +record($this->data) + ->components([ + Tabs::make('Tabs') + ->tabs([ + Tab::make($this->home.' vs '.$this->away) + ->schema([ + RepeatableEntry::make('results.h2h') + ->label('Direct ecounters') + ->table([ + TableColumn::make('League'), + TableColumn::make('Date'), + TableColumn::make('Home'), + TableColumn::make('Away'), + TableColumn::make('Result'), + ]) + ->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')->color(fn ($state) => $state == $this->home ? 'primary' : 'warning'), + TextEntry::make('away.name')->color(fn ($state) => $state == $this->away ? 'warning' : 'primary'), + TextEntry::make('ss'), + ]), + ]), + Tab::make($this->home) + ->schema([ + RepeatableEntry::make('results.home') + ->label($this->home) + ->table([ + TableColumn::make('League'), + TableColumn::make('Date'), + TableColumn::make('Home'), + TableColumn::make('Away'), + TableColumn::make('Result'), + ]) + ->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')->color(fn ($state) => $state == $this->home ? 'primary' : 'gray'), + TextEntry::make('away.name')->color(fn ($state) => $state == $this->home ? 'primary' : 'gray'), + TextEntry::make('ss'), + ]), + ]), + Tab::make($this->away) + ->schema([ + RepeatableEntry::make('results.away') + ->label($this->away) + ->table([ + TableColumn::make('League'), + TableColumn::make('Date'), + TableColumn::make('Home'), + TableColumn::make('Away'), + TableColumn::make('Result'), + ]) + ->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')->color(fn ($state) => $state == $this->away ? 'warning' : 'gray'), + TextEntry::make('away.name')->color(fn ($state) => $state == $this->away ? 'warning' : 'gray'), + TextEntry::make('ss'), + ]), + ]), + ]), + ]); + } + + public function mount($betsapi_id) + { + $this->data = Http::get('https://api.b365api.com/v1/event/history?token='.config('env.betsapi_token').'&event_id='.$betsapi_id)->json(); + $this->home = $this->data['results']['h2h']['0']['home']['name']; + $this->away = $this->data['results']['h2h']['0']['away']['name']; + } + + public function getHome() + { + return $this->home; + } + + public function getAway() + { + return $this->away; + } +} diff --git a/app/Livewire/EncounterHistroy.php b/app/Livewire/EncounterHistroy.php deleted file mode 100644 index 3988c310..00000000 --- a/app/Livewire/EncounterHistroy.php +++ /dev/null @@ -1,65 +0,0 @@ -record = $record; - - $this->record = Http::get('https://api.b365api.com/v1/event/history?token='.config('env.betsapi_token').'&event_id='.$record->betsapi_id)->json(); - } - - public function eventInfolist(Schema $schema): Schema - { - return $schema - ->record($this->record) - ->components([ - RepeatableEntry::make('comments') - ->schema([ - TextEntry::make('results'), - ]) - ->columns(2), - // Tabs::make('Tabs') - // ->tabs([ - // Tab::make($this->record->home->name.' vs '.$this->record->away->name) - // ->schema([ - // TextEntry::make('home.name'), - // ]), - // Tab::make($this->record->home->name) - // ->schema([ - // TextEntry::make($this->history->result->h2h->name), - // ]), - // Tab::make($this->record->away->name) - // ->schema([ - // // ... - // ]), - // ])->vertical(), - ]); - } - - public function render() - { - return view('livewire.encounter-histroy'); - } -} diff --git a/composer.lock b/composer.lock index 80737b48..f8e4875b 100644 --- a/composer.lock +++ b/composer.lock @@ -9607,16 +9607,16 @@ "packages-dev": [ { "name": "barryvdh/laravel-debugbar", - "version": "v4.1.0", + "version": "v4.1.1", "source": { "type": "git", "url": "https://github.com/fruitcake/laravel-debugbar.git", - "reference": "5cbe5fc76054723ab9501917b7d252cdafb5ad5d" + "reference": "048876cf8ffdd8af2b82306289e2c0453fa0b059" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/fruitcake/laravel-debugbar/zipball/5cbe5fc76054723ab9501917b7d252cdafb5ad5d", - "reference": "5cbe5fc76054723ab9501917b7d252cdafb5ad5d", + "url": "https://api.github.com/repos/fruitcake/laravel-debugbar/zipball/048876cf8ffdd8af2b82306289e2c0453fa0b059", + "reference": "048876cf8ffdd8af2b82306289e2c0453fa0b059", "shasum": "" }, "require": { @@ -9690,7 +9690,7 @@ ], "support": { "issues": "https://github.com/fruitcake/laravel-debugbar/issues", - "source": "https://github.com/fruitcake/laravel-debugbar/tree/v4.1.0" + "source": "https://github.com/fruitcake/laravel-debugbar/tree/v4.1.1" }, "funding": [ { @@ -9702,7 +9702,7 @@ "type": "github" } ], - "time": "2026-03-07T19:01:10+00:00" + "time": "2026-03-08T08:20:19+00:00" }, { "name": "brianium/paratest", @@ -13404,12 +13404,12 @@ ], "aliases": [], "minimum-stability": "stable", - "stability-flags": {}, + "stability-flags": [], "prefer-stable": true, "prefer-lowest": false, "platform": { "php": "^8.3" }, - "platform-dev": {}, - "plugin-api-version": "2.9.0" + "platform-dev": [], + "plugin-api-version": "2.6.0" } diff --git a/resources/views/filament/tables/columns/event-column.blade.php b/resources/views/filament/tables/columns/event-column.blade.php index aa3013e4..e213f420 100644 --- a/resources/views/filament/tables/columns/event-column.blade.php +++ b/resources/views/filament/tables/columns/event-column.blade.php @@ -14,7 +14,6 @@ @endif
{{ $record->home?->name }}
- {{--
{{ $record->group?->name }}
--}} @else
@@ -34,15 +33,16 @@ {{ $record->away?->name }}
- {{--
{{ $record->group?->name }}
--}} @endif - - - - - - @livewire('encounter-histroy', ['record' => $record]) - + @if ($record->betsapi_id) + + + + + @livewire('encounter-history', ['betsapi_id' => $record->betsapi_id]) + + @endif diff --git a/resources/views/livewire/encounter-history.blade.php b/resources/views/livewire/encounter-history.blade.php new file mode 100644 index 00000000..d7a584b9 --- /dev/null +++ b/resources/views/livewire/encounter-history.blade.php @@ -0,0 +1,3 @@ +
+ {{ $this->eventsInfolist }} +
diff --git a/resources/views/livewire/encounter-histroy.blade.php b/resources/views/livewire/encounter-histroy.blade.php deleted file mode 100644 index c1dcb1cd..00000000 --- a/resources/views/livewire/encounter-histroy.blade.php +++ /dev/null @@ -1,3 +0,0 @@ -
- {{ $this->eventInfolist }} -