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('sport_id', auth()->user()->sport_id)
|
||||||
->where('starttime', '>=', now());
|
->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) {
|
if (auth()->user()->all_only_none > 0) {
|
||||||
switch (auth()->user()->all_only_none) {
|
switch (auth()->user()->all_only_none) {
|
||||||
case 1:
|
case 1:
|
||||||
|
|||||||
@@ -15,11 +15,14 @@ class ListEvents extends ListRecords
|
|||||||
|
|
||||||
protected $listeners = [
|
protected $listeners = [
|
||||||
'refreshBettypeMenu' => '$refresh',
|
'refreshBettypeMenu' => '$refresh',
|
||||||
|
'filterClearFilter' => 'clearFilters',
|
||||||
'filterUpdateGreen' => 'updateTableFiltersGreen',
|
'filterUpdateGreen' => 'updateTableFiltersGreen',
|
||||||
'filterUpdateYellow' => 'updateTableFiltersYellow',
|
'filterUpdateYellow' => 'updateTableFiltersYellow',
|
||||||
'filterUpdateRed' => 'updateTableFiltersRed',
|
'filterUpdateRed' => 'updateTableFiltersRed',
|
||||||
'filterUpdatePeriode' => 'updateTablePeriode',
|
'filterUpdatePeriode' => 'updateTablePeriode',
|
||||||
'filterClearFilter' => 'clearFilters',
|
'filterStarFilter' => 'updateStar',
|
||||||
|
'filterNoteFilter' => 'updateNote',
|
||||||
|
'filterNotificationFilter' => 'updateNotification',
|
||||||
];
|
];
|
||||||
|
|
||||||
protected function getHeaderWidgets(): array
|
protected function getHeaderWidgets(): array
|
||||||
@@ -34,6 +37,21 @@ class ListEvents extends ListRecords
|
|||||||
$this->removeTableFilters();
|
$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
|
public function updateTablePeriode(string $filter): void
|
||||||
{
|
{
|
||||||
$filter = json_decode($filter, true);
|
$filter = json_decode($filter, true);
|
||||||
|
|||||||
@@ -182,6 +182,9 @@ class EventsTable
|
|||||||
Hidden::make('filter_alarm_green'),
|
Hidden::make('filter_alarm_green'),
|
||||||
Hidden::make('filter_alarm_yellow'),
|
Hidden::make('filter_alarm_yellow'),
|
||||||
Hidden::make('filter_alarm_red'),
|
Hidden::make('filter_alarm_red'),
|
||||||
|
Hidden::make('filter_stars'),
|
||||||
|
Hidden::make('filter_notes'),
|
||||||
|
Hidden::make('filter_notification'),
|
||||||
Select::make(name: 'country_id')
|
Select::make(name: 'country_id')
|
||||||
->hidden(fn () => auth()->user()->sport_id == 5)
|
->hidden(fn () => auth()->user()->sport_id == 5)
|
||||||
->placeholder('Country')
|
->placeholder('Country')
|
||||||
@@ -378,6 +381,21 @@ class EventsTable
|
|||||||
$query->whereIn('id', $event_ids);
|
$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(
|
)->when(
|
||||||
$data['favorit_threshold'],
|
$data['favorit_threshold'],
|
||||||
function (Builder $query, $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) {
|
if ($data['filter_alarm_green'] ?? null) {
|
||||||
$title = OddsTable::where('name', $data['filter_alarm_green'])->value('title');
|
$title = OddsTable::where('name', $data['filter_alarm_green'])->value('title');
|
||||||
$indicators[] = Indicator::make('Alarms: '.$title)->removeField('filter_alarm_green')->color('success');
|
$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)
|
public function toggleBettype($multiline_setting_id)
|
||||||
{
|
{
|
||||||
BettypeUser::where('multiline_setting_id', $multiline_setting_id)->update(['is_active' => DB::raw('!is_active')]);
|
BettypeUser::where('multiline_setting_id', $multiline_setting_id)->update(['is_active' => DB::raw('!is_active')]);
|
||||||
|
|
||||||
$this->dispatch('refreshBettypeMenu');
|
$this->dispatch('refreshBettypeMenu');
|
||||||
}
|
}
|
||||||
|
|
||||||
public function toggleStar()
|
// public function toggleStar()
|
||||||
{
|
// {
|
||||||
User::where('id', auth()->user()->id)->update(['filter_stars' => DB::raw('!filter_stars')]);
|
// User::where('id', auth()->user()->id)->update(['filter_stars' => DB::raw('!filter_stars')]);
|
||||||
|
// $this->dispatch('filterStarFilter');
|
||||||
|
// }
|
||||||
|
|
||||||
$this->dispatch('filterClearFilter');
|
// public function toggleNote()
|
||||||
$this->dispatch('refreshBettypeMenu');
|
// {
|
||||||
}
|
// User::where('id', auth()->user()->id)->update(['filter_notes' => DB::raw('!filter_notes')]);
|
||||||
|
// $this->dispatch('filterNotificationFilter');
|
||||||
|
// }
|
||||||
|
|
||||||
public function toggleNote()
|
// public function toggleNotification()
|
||||||
{
|
// {
|
||||||
User::where('id', auth()->user()->id)->update(['filter_notes' => DB::raw('!filter_notes')]);
|
// User::where('id', auth()->user()->id)->update(['filter_notification' => DB::raw('!filter_notification')]);
|
||||||
|
// $this->dispatch('filterStarFilter');
|
||||||
$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 toggleShowPartner()
|
public function toggleShowPartner()
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -39,6 +39,7 @@ class AppServiceProvider extends ServiceProvider
|
|||||||
ListEvents::class,
|
ListEvents::class,
|
||||||
]
|
]
|
||||||
);
|
);
|
||||||
|
// PanelsRenderHook::RESOURCE_PAGES_LIST_RECORDS_TABLE_BEFORE,
|
||||||
FilamentView::registerRenderHook(
|
FilamentView::registerRenderHook(
|
||||||
TablesRenderHook::TOOLBAR_SEARCH_AFTER,
|
TablesRenderHook::TOOLBAR_SEARCH_AFTER,
|
||||||
fn (): string => Blade::render('@livewire(\'bettype-toggle\')'),
|
fn (): string => Blade::render('@livewire(\'bettype-toggle\')'),
|
||||||
|
|||||||
@@ -50,10 +50,14 @@
|
|||||||
:icon="auth()->user()->is_multiline_direct ? 'phosphor-not-equals' : 'phosphor-equals'">
|
:icon="auth()->user()->is_multiline_direct ? 'phosphor-not-equals' : 'phosphor-equals'">
|
||||||
</x-filament::button>
|
</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'">
|
:icon="auth()->user()->filter_stars ? 'phosphor-star-fill' : 'phosphor-star'">
|
||||||
</x-filament::button>
|
</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'"
|
<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'">
|
:icon="auth()->user()->filter_notes ? 'phosphor-note-fill' : 'phosphor-note'">
|
||||||
</x-filament::button>
|
</x-filament::button>
|
||||||
|
|||||||
Reference in new issue
Block a user