reset tab
This commit is contained in:
1 parent
9b8bbefa5e
commit
e665bb183d
2 files changed
+15
-4
No files matched your search
@@ -132,10 +132,11 @@ class Statistic extends BaseDashboard
|
||||
// ->options(fn(Get $get) => SofaScoreTournament::with('sofascore_category')->where('sofa_score_category_id', $get('sofascore_category_id'))->pluck('name', 'tournament_id'))
|
||||
->options(fn(Get $get) => LoadStatisticFixturesLeaguesOptions::load($get('sofascore_category_id')))
|
||||
->placeholder('League')
|
||||
->afterStateUpdated(function (callable $set, $state) {
|
||||
->afterStateUpdated(function (callable $set) {
|
||||
$set('match_id', null);
|
||||
$set('team_id', null);
|
||||
$set('ss_player_id', null);
|
||||
$this->dispatch('reset-tab');
|
||||
}),
|
||||
Select::make('match_id')
|
||||
->live()
|
||||
@@ -148,6 +149,7 @@ class Statistic extends BaseDashboard
|
||||
->afterStateUpdated(function (callable $set) {
|
||||
$set('team_id', null);
|
||||
$set('ss_player_id', null);
|
||||
$this->dispatch('reset-tab');
|
||||
})
|
||||
->placeholder('Events'),
|
||||
|
||||
@@ -180,6 +182,7 @@ class Statistic extends BaseDashboard
|
||||
})
|
||||
->afterStateUpdated(function (callable $set) {
|
||||
$set('ss_player_id', null);
|
||||
$this->dispatch('reset-tab');
|
||||
})
|
||||
->placeholder('Team'),
|
||||
|
||||
@@ -202,7 +205,6 @@ class Statistic extends BaseDashboard
|
||||
'home' => 'Home',
|
||||
'away' => 'Away',
|
||||
])->afterStateUpdated(function (callable $set) {
|
||||
// $set('team_id', null);
|
||||
$set('ss_player_id', null);
|
||||
}),
|
||||
]),
|
||||
@@ -258,9 +260,9 @@ class Statistic extends BaseDashboard
|
||||
->default('none')
|
||||
->selectablePlaceholder(false)
|
||||
->afterStateUpdated(function (callable $set) {
|
||||
// $set('team_id', null);
|
||||
$set('ss_player_id', null);
|
||||
$set('team_position', null);
|
||||
$this->dispatch('reset-tab');
|
||||
})
|
||||
->options([
|
||||
'none' => 'None',
|
||||
|
||||
@@ -5,11 +5,20 @@
|
||||
@endphp
|
||||
<x-filament-panels::page>
|
||||
|
||||
<script>
|
||||
window.addEventListener('reset-tab', () => {
|
||||
if (Alpine.$data(document.querySelector('#charttabs')).activeTab == 'tab3' ||
|
||||
Alpine.$data(document.querySelector('#charttabs')).activeTab == 'tab4') {
|
||||
Alpine.$data(document.querySelector('#charttabs')).activeTab = 'tab1';
|
||||
}
|
||||
});
|
||||
</script>
|
||||
|
||||
{{ $this->filtersForm }}
|
||||
|
||||
@livewire(\App\Filament\Widgets\StatsMedianAverage::class, ['filters' => $this->filters])
|
||||
|
||||
<div x-data="{ activeTab: 'tab1' }">
|
||||
<div x-data="{ activeTab: 'tab1' }" id="charttabs">
|
||||
<!-- Tab Navigation -->
|
||||
<x-filament::tabs label="Statistics" class="mb-4 justify-center rounded-lg grid grid-cols-2 md:grid-cols-4">
|
||||
<x-filament::tabs.item x-on:click="activeTab = 'tab1'" :alpine-active="'activeTab === \'' . 'tab1' . '\''" icon="phosphor-trophy">
|
||||
|
||||
Reference in new issue
Block a user