query(PersonalNotification::query()->with('bookmaker')->where('user_id', auth()->user()->id)) ->description('Send a notification when favorit enters an alarm level.') ->striped() ->columns([ BookmakerIcon::make('bookmaker.icon') ->label('Bookmaker')->size('lg'), TextColumn::make('alarm_level.name') ->color(fn ($record) => $record->alarm_level->color) ->weight(FontWeight::Black) ->extraCellAttributes(['class' => 'alarm-level-style']), ]) ->defaultSort('alarm_level_id', 'desc') ->deferFilters(false) ->deferFilters(false) ->filters([ SelectFilter::make('bookmaker_id') ->label('Bookmaker') ->visible(fn () => auth()->user()->partner_bookmaker_id) ->default(auth()->user()->bookmaker->id) ->selectablePlaceholder(false) ->options(Bookmaker::options([auth()->user()->partner_bookmaker_id, auth()->user()->bookmaker_id])) ->preload(), ], FiltersLayout::AboveContent) ->filtersFormColumns(3) ->hiddenFilterIndicators() ->recordActions([ Action::make('notify_by_system') ->button() ->label('Send Notification') ->color(fn ($record) => $record->notify_by_system ? 'primary' : 'gray') ->icon('phosphor-bell-duotone') ->action(function ($record) { PersonalNotification::where('id', $record->id)->update(['notify_by_system' => ! $record->notify_by_system]); }), Action::make('notify_by_email') ->label('Send E-Mail') ->button() ->color(fn ($record) => $record->notify_by_email ? 'primary' : 'gray') ->icon('phosphor-envelope-duotone') ->action(function ($record) { PersonalNotification::where('id', $record->id)->update(['notify_by_email' => ! $record->notify_by_email]); }), ]); } public function render(): View { return view('livewire.personal-notification-table'); } }