This commit is contained in:
salam committed 2026-02-02 09:02:39 +01:00
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');