wip
This commit is contained in:
1 parent
155177045b
commit
51a195e657
6 files changed
+70
-36
No files matched your search
@@ -65,18 +65,6 @@ class EventResource extends Resource
|
||||
->where('sport_id', auth()->user()->sport_id)
|
||||
->where('starttime', '>=', now());
|
||||
|
||||
if (auth()->user()->filter_stars) {
|
||||
$query->whereHas('event_user_star');
|
||||
}
|
||||
|
||||
if (auth()->user()->filter_notes) {
|
||||
$query->whereHas('event_user_note');
|
||||
}
|
||||
|
||||
if (auth()->user()->filter_notification) {
|
||||
$query->whereHas('event_user_notification');
|
||||
}
|
||||
|
||||
if (auth()->user()->all_only_none > 0) {
|
||||
switch (auth()->user()->all_only_none) {
|
||||
case 1:
|
||||
|
||||
@@ -15,11 +15,14 @@ class ListEvents extends ListRecords
|
||||
|
||||
protected $listeners = [
|
||||
'refreshBettypeMenu' => '$refresh',
|
||||
'filterClearFilter' => 'clearFilters',
|
||||
'filterUpdateGreen' => 'updateTableFiltersGreen',
|
||||
'filterUpdateYellow' => 'updateTableFiltersYellow',
|
||||
'filterUpdateRed' => 'updateTableFiltersRed',
|
||||
'filterUpdatePeriode' => 'updateTablePeriode',
|
||||
'filterClearFilter' => 'clearFilters',
|
||||
'filterStarFilter' => 'updateStar',
|
||||
'filterNoteFilter' => 'updateNote',
|
||||
'filterNotificationFilter' => 'updateNotification',
|
||||
];
|
||||
|
||||
protected function getHeaderWidgets(): array
|
||||
@@ -34,6 +37,21 @@ class ListEvents extends ListRecords
|
||||
$this->removeTableFilters();
|
||||
}
|
||||
|
||||
// public function updateStar(): void
|
||||
// {
|
||||
// $this->tableFilters['events']['filter_stars'] = auth()->user()->filter_stars;
|
||||
// }
|
||||
|
||||
// public function updateNote(): void
|
||||
// {
|
||||
// $this->tableFilters['events']['filter_notes'] = auth()->user()->filter_notes;
|
||||
// }
|
||||
|
||||
// public function updateNotification(): void
|
||||
// {
|
||||
// $this->tableFilters['events']['filter_notification'] = auth()->user()->filter_notification;
|
||||
// }
|
||||
|
||||
public function updateTablePeriode(string $filter): void
|
||||
{
|
||||
$filter = json_decode($filter, true);
|
||||
|
||||
@@ -182,6 +182,9 @@ class EventsTable
|
||||
Hidden::make('filter_alarm_green'),
|
||||
Hidden::make('filter_alarm_yellow'),
|
||||
Hidden::make('filter_alarm_red'),
|
||||
Hidden::make('filter_stars'),
|
||||
Hidden::make('filter_notes'),
|
||||
Hidden::make('filter_notification'),
|
||||
Select::make(name: 'country_id')
|
||||
->hidden(fn () => auth()->user()->sport_id == 5)
|
||||
->placeholder('Country')
|
||||
@@ -378,6 +381,21 @@ class EventsTable
|
||||
$query->whereIn('id', $event_ids);
|
||||
}
|
||||
|
||||
)->when(
|
||||
$data['filter_stars'],
|
||||
function (Builder $query, $filter_stars) {
|
||||
$query->whereHas('event_user_star');
|
||||
}
|
||||
)->when(
|
||||
$data['filter_notes'],
|
||||
function (Builder $query, $filter_notes) {
|
||||
$query->whereHas('event_user_note');
|
||||
}
|
||||
)->when(
|
||||
$data['filter_notification'],
|
||||
function (Builder $query, $filter_notification) {
|
||||
$query->whereHas('event_user_notification');
|
||||
}
|
||||
)->when(
|
||||
$data['favorit_threshold'],
|
||||
function (Builder $query, $favorit_threshold) {
|
||||
@@ -427,6 +445,18 @@ class EventsTable
|
||||
}
|
||||
}
|
||||
|
||||
if ($data['filter_stars'] ?? null) {
|
||||
$indicators[] = Indicator::make('Filter Favorits')->removeField('filter_stars')->color('success');
|
||||
}
|
||||
|
||||
if ($data['filter_notes'] ?? null) {
|
||||
$indicators[] = Indicator::make('Filter Notes')->removeField('filter_notes')->color('success');
|
||||
}
|
||||
|
||||
if ($data['filter_notification'] ?? null) {
|
||||
$indicators[] = Indicator::make('Filter Notifications')->removeField('filter_notification')->color('success');
|
||||
}
|
||||
|
||||
if ($data['filter_alarm_green'] ?? null) {
|
||||
$title = OddsTable::where('name', $data['filter_alarm_green'])->value('title');
|
||||
$indicators[] = Indicator::make('Alarms: '.$title)->removeField('filter_alarm_green')->color('success');
|
||||
|
||||
@@ -43,33 +43,26 @@ class BettypeToggle extends Component
|
||||
public function toggleBettype($multiline_setting_id)
|
||||
{
|
||||
BettypeUser::where('multiline_setting_id', $multiline_setting_id)->update(['is_active' => DB::raw('!is_active')]);
|
||||
|
||||
$this->dispatch('refreshBettypeMenu');
|
||||
}
|
||||
|
||||
public function toggleStar()
|
||||
{
|
||||
User::where('id', auth()->user()->id)->update(['filter_stars' => DB::raw('!filter_stars')]);
|
||||
// public function toggleStar()
|
||||
// {
|
||||
// User::where('id', auth()->user()->id)->update(['filter_stars' => DB::raw('!filter_stars')]);
|
||||
// $this->dispatch('filterStarFilter');
|
||||
// }
|
||||
|
||||
$this->dispatch('filterClearFilter');
|
||||
$this->dispatch('refreshBettypeMenu');
|
||||
}
|
||||
// public function toggleNote()
|
||||
// {
|
||||
// User::where('id', auth()->user()->id)->update(['filter_notes' => DB::raw('!filter_notes')]);
|
||||
// $this->dispatch('filterNotificationFilter');
|
||||
// }
|
||||
|
||||
public function toggleNote()
|
||||
{
|
||||
User::where('id', auth()->user()->id)->update(['filter_notes' => DB::raw('!filter_notes')]);
|
||||
|
||||
$this->dispatch('filterClearFilter');
|
||||
$this->dispatch('refreshBettypeMenu');
|
||||
}
|
||||
|
||||
public function toggleNotification()
|
||||
{
|
||||
User::where('id', auth()->user()->id)->update(['filter_notification' => DB::raw('!filter_notification')]);
|
||||
|
||||
$this->dispatch('filterClearFilter');
|
||||
$this->dispatch('refreshBettypeMenu');
|
||||
}
|
||||
// public function toggleNotification()
|
||||
// {
|
||||
// User::where('id', auth()->user()->id)->update(['filter_notification' => DB::raw('!filter_notification')]);
|
||||
// $this->dispatch('filterStarFilter');
|
||||
// }
|
||||
|
||||
public function toggleShowPartner()
|
||||
{
|
||||
|
||||
@@ -39,6 +39,7 @@ class AppServiceProvider extends ServiceProvider
|
||||
ListEvents::class,
|
||||
]
|
||||
);
|
||||
// PanelsRenderHook::RESOURCE_PAGES_LIST_RECORDS_TABLE_BEFORE,
|
||||
FilamentView::registerRenderHook(
|
||||
TablesRenderHook::TOOLBAR_SEARCH_AFTER,
|
||||
fn (): string => Blade::render('@livewire(\'bettype-toggle\')'),
|
||||
|
||||
@@ -50,10 +50,14 @@
|
||||
:icon="auth()->user()->is_multiline_direct ? 'phosphor-not-equals' : 'phosphor-equals'">
|
||||
</x-filament::button>
|
||||
|
||||
<x-filament::button size="xs" tooltip="Filter favorits" wire:click="toggleStar" :color="auth()->user()->filter_stars ? 'info' : 'gray'"
|
||||
<x-filament::button color="gray" outlined x-on:click="$wire.set('tableFilters', {'filter_stars': {'value': '1'}})"
|
||||
:icon="auth()->user()->filter_stars ? 'phosphor-star-fill' : 'phosphor-star'">
|
||||
</x-filament::button>
|
||||
|
||||
{{-- <x-filament::button size="xs" tooltip="Filter favorits" wire:click="toggleStar" :color="auth()->user()->filter_stars ? 'info' : 'gray'"
|
||||
:icon="auth()->user()->filter_stars ? 'phosphor-star-fill' : 'phosphor-star'">
|
||||
</x-filament::button> --}}
|
||||
|
||||
<x-filament::button size="xs" tooltip="Filter notes" wire:click="toggleNote" :color="auth()->user()->filter_notes ? 'info' : 'gray'"
|
||||
:icon="auth()->user()->filter_notes ? 'phosphor-note-fill' : 'phosphor-note'">
|
||||
</x-filament::button>
|
||||
|
||||
Reference in new issue
Block a user