filter finised

This commit is contained in:
salam committed 2026-02-02 18:33:32 +01:00
1 parent ff43f231f0
commit f684d61a61
15 files changed
+376 -136

No files matched your search

@@ -26,8 +26,8 @@ use Filament\Actions\BulkActionGroup;
use Filament\Actions\DeleteAction;
use Filament\Actions\DeleteBulkAction;
use Filament\Forms\Components\Hidden;
use Filament\Forms\Components\Radio;
use Filament\Forms\Components\Select;
use Filament\Forms\Components\Textarea;
use Filament\Forms\Components\TextInput;
use Filament\Forms\Components\Toggle;
use Filament\Schemas\Components\Utilities\Get;
@@ -43,6 +43,7 @@ use Filament\Tables\Table;
use Illuminate\Database\Eloquent\Builder;
use Illuminate\Support\Carbon;
use Illuminate\Support\Facades\DB;
use JaOcero\RadioDeck\Forms\Components\RadioDeck;
class EventsTable
{
@@ -105,7 +106,8 @@ class EventsTable
->label('ML S1'),
TooltipOdds::make('1x2')->bettype('odds_3ways')->label('')->visible(fn () => in_array('odds_3ways', self::$bettype_settings)),
ColumnOdds::make('odds_3ways')->bettype('odds_3ways')
ColumnOdds::make('odds_3ways')
->bettype('odds_3ways')
->visible(fn () => in_array('odds_3ways', self::$bettype_settings))
->verticalAlignment(VerticalAlignment::Start)
->label('1X2'),
@@ -446,15 +448,15 @@ class EventsTable
}
if ($data['filter_stars'] ?? null) {
$indicators[] = Indicator::make('Filter Favorits')->removeField('filter_stars')->color('success');
$indicators[] = Indicator::make('Filter Favorits')->removeField('filter_stars')->color('info');
}
if ($data['filter_notes'] ?? null) {
$indicators[] = Indicator::make('Filter Notes')->removeField('filter_notes')->color('success');
$indicators[] = Indicator::make('Filter Notes')->removeField('filter_notes')->color('info');
}
if ($data['filter_notification'] ?? null) {
$indicators[] = Indicator::make('Filter Notifications')->removeField('filter_notification')->color('success');
$indicators[] = Indicator::make('Filter Notifications')->removeField('filter_notification')->color('info');
}
if ($data['filter_alarm_green'] ?? null) {
@@ -513,10 +515,6 @@ class EventsTable
}
}
// if ($data['stars_filter'] ?? null) {
// $indicators[] = Indicator::make('Favorits')->removeField('stars_filter')->color('info');
// }
if ($data['filter_compare_differences'] ?? null) {
$opt = explode('-', $data['filter_compare_differences']);
$title = $opt[0];
@@ -577,9 +575,7 @@ class EventsTable
->modalIcon('phosphor-note')
->modalWidth(Width::Large)
->modalSubmitActionLabel('Save')
->extraModalFooterActions(fn (Action $action): array => [
$action->makeModalSubmitAction('Delete', arguments: ['delete' => true])->color('danger'),
])
->extraModalFooterActions(fn (Action $action, $record) => $record->event_user_note->isEmpty() ? [] : [$action->makeModalSubmitAction('Delete', arguments: ['delete' => true])->color('danger')])
->fillForm(data: function ($record) {
foreach ($record->event_user_note as $value) {
if ($value->user_id == auth()->user()->id && $value->bookmaker_id == auth()->user()->bookmaker_id) {
@@ -594,14 +590,17 @@ class EventsTable
})
->schema([
Hidden::make('event_user_note_id'),
TextInput::make('message')->prefixIcon('phosphor-note-pencil')->hiddenLabel()->live()
->extraInputAttributes(['onClick' => 'this.select()']),
Textarea::make('message')
->rows(2)
->hiddenLabel(),
])
->icon('phosphor-note-pencil')
->iconButton()
->tooltip(fn ($record) => view('filament.resources.events.tooltip.event-user-note-tooltip', ['notes' => $record->event_user_note]))
->action(function ($record, array $data) {
if ($data['event_user_note_id']) {
->action(function ($record, array $data, $arguments = []) {
if ($arguments) {
EventUserNote::where('id', $data['event_user_note_id'])->delete();
} elseif ($data['event_user_note_id']) {
if (! $data['message']) {
EventUserNote::where('id', $data['event_user_note_id'])->delete();
} else {
@@ -622,9 +621,7 @@ class EventsTable
Action::make('event_notification')
->modalWidth(Width::Large)
->modalSubmitActionLabel('Save')
->extraModalFooterActions(fn (Action $action): array => [
$action->makeModalSubmitAction('Delete', arguments: ['delete' => true])->color('danger'),
])
->extraModalFooterActions(fn (Action $action, $record) => $record->event_user_notification->isEmpty() ? [] : [$action->makeModalSubmitAction('Delete', arguments: ['delete' => true])->color('danger')])
->modalIcon('phosphor-bell')
->fillForm(data: function ($record) {
foreach ($record->event_user_notification as $value) {
@@ -643,36 +640,44 @@ class EventsTable
})
->schema([
Hidden::make('event_user_notification_id'),
Toggle::make('is_notified')->label('Monitoring')
->aboveContent('If a notification has been send "Monitoring" will be off')
Toggle::make('is_notified')->label('Monitoring Favorit')
// ->aboveContent('If a notification has been send "Monitoring" will be off')
->onColor('gray')
->offColor('info'),
Select::make('odds_table_id')
->label('Monitor Bettype Favorit')
->belowContent('Favorit is compared with bookmaker favorit filtert by method')
RadioDeck::make('odds_table_id')
->label('Bettype')
->columns(3)
->colors('info')
->required()
->prefixIcon('phosphor-dots-three-outline-vertical')
->native(false)
->extraCardsAttributes([ // Extra attributes for card elements
'class' => 'dark:bg-gray-900!',
])
->options(fn ($record) => OddsTable::options_sport()),
Radio::make('alarm_level_id')
RadioDeck::make('alarm_level_id')
->label('Alarm level')
->colors('info')
->columns(3)
->required()
->inline()
->belowContent('If favorit enters alarm level a notification will be send.')
->extraCardsAttributes([ // Extra attributes for card elements
'class' => 'dark:bg-gray-900!',
])
->options([
'1' => 'Level 1',
'2' => 'Level 2',
'3' => 'Level 3',
]),
Toggle::make('notify_by_email')->label('E-Mail')
->belowContent('Notify me also by e-mail')
Toggle::make('notify_by_email')->label('Send also E-Mail')
// ->belowContent('Notify me also by e-mail')
->onColor('info')
->offColor('gray'),
])
->icon('phosphor-bell')
->iconButton()
->action(function ($record, array $data) {
if ($data['event_user_notification_id']) {
->color(fn ($record) => $record?->event_user_notification->isEmpty() ? 'gray' : 'info')
->action(function ($record, array $data, $arguments = []) {
if ($arguments) {
EventUserNotification::where('id', $data['event_user_notification_id'])->delete();
} elseif ($data['event_user_notification_id']) {
EventUserNotification::where('id', $data['event_user_notification_id'])->update([
'odds_table_id' => $data['odds_table_id'],
'alarm_level_id' => $data['alarm_level_id'],
@@ -691,8 +696,7 @@ class EventsTable
'is_notified' => $data['is_notified'],
]);
}
})
->color(fn ($record) => $record->event_user_notification->isEmpty() ? 'gray' : 'info'),
}),
ActionGroup::make([
DeleteAction::make()->visible(fn () => auth()->user()->hasRole('super_admin')),
Action::make('txodds_odds')