diff --git a/app/Actions/AlarmStatistic.php b/app/Actions/AlarmStatistic.php index 5791e360..c8496afc 100644 --- a/app/Actions/AlarmStatistic.php +++ b/app/Actions/AlarmStatistic.php @@ -3,7 +3,6 @@ namespace App\Actions; use App\Models\Event; -use App\Models\EventBookmaker; use App\Models\OddsTable; class AlarmStatistic @@ -16,19 +15,21 @@ class AlarmStatistic $fields[$value->name] = explode(',', $value->fieldnames); } - $event_ids = Event::where('sport_id', auth()->user()->sport_id)->where('starttime', '>=', now())->pluck('id')->toArray(); - - $res = EventBookmaker::select('alarm_2w_h2w', 'alarm_2w_a2w', 'alarm_2ws1_h2w', 'alarm_2ws1_a2w', 'alarm_3w_h3w', 'alarm_3w_d3w', 'alarm_3w_a3w', 'alarm_3wht_h3w', 'alarm_3wht_d3w', 'alarm_3wht_a3w', 'alarm_dc_dc1x', 'alarm_dc_dc12', 'alarm_dc_dcx2', 'alarm_dbn_dnb1', 'alarm_dbn_dnb2', 'alarm_ggng_gg', 'alarm_ggng_ng', 'alarm_po_home', 'alarm_po_away', 'alarm_poht_home', 'alarm_poht_away', 'alarm_poq1_home', 'alarm_poq1_away', 'alarm_to_over', 'alarm_to_under', 'alarm_toht_over', 'alarm_toht_under', 'alarm_toq1_over', 'alarm_toq1_under', 'alarm_tq_htq', 'alarm_tq_atq') - ->whereIn('event_id', $event_ids) - ->where('bookmaker_id', auth()->user()->bookmaker_id) - ->get() - ->toArray(); + $events = Event::with('event_bookmaker') + ->where('sport_id', auth()->user()->sport_id) + ->where('starttime', '>=', now()) + ->whereHas('event_bookmaker', function ($query) { + $query->where('bookmaker_id', auth()->user()->bookmaker_id); + }) + ->get(); $arr = []; - foreach ($res as $value) { + foreach ($events as $event) { + $row = $event->event_bookmaker; + // $row = get_object_vars($event->toArray()); foreach ($fields as $table => $names) { foreach ($names as $name) { - $val = (int) $value[$name]; + $val = (int) $row[$name]; if ($val) { if (isset($arr[$table][$val])) { $arr[$table][$val]++; @@ -37,7 +38,6 @@ class AlarmStatistic } } } - } } diff --git a/app/Filament/Resources/Events/EventResource.php b/app/Filament/Resources/Events/EventResource.php index 541453c7..24468473 100644 --- a/app/Filament/Resources/Events/EventResource.php +++ b/app/Filament/Resources/Events/EventResource.php @@ -3,9 +3,6 @@ namespace App\Filament\Resources\Events; use App\Filament\Resources\Events\Pages\ListEvents; -use App\Filament\Resources\Events\RelationManagers\BettypesRelationManager; -use App\Filament\Resources\Events\RelationManagers\CountriesRelationManager; -use App\Filament\Resources\Events\RelationManagers\UserNoteRelationManager; use App\Filament\Resources\Events\Schemas\EventForm; use App\Filament\Resources\Events\Tables\EventsTable; use App\Filament\Resources\Events\Tables\Tools\LoadPartnerDifferences; @@ -46,15 +43,6 @@ class EventResource extends Resource ]; } - public static function getRelations(): array - { - return [ - UserNoteRelationManager::class, - CountriesRelationManager::class, - BettypesRelationManager::class, - ]; - } - public static function getNavigationBadge(): ?string { return parent::getEloquentQuery() @@ -70,16 +58,25 @@ class EventResource extends Resource ->with('country') ->with('home') ->with('away') - ->with('event_user_star') ->with('event_bookmaker') - ->with('user_notes') + ->with('event_user_star') + ->with('event_user_note') + ->with('event_user_notification') ->where('sport_id', auth()->user()->sport_id) ->where('starttime', '>=', now()); - if (auth()->user()->stars) { + 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: @@ -96,47 +93,49 @@ class EventResource extends Resource $query->whereIn('id', $event_ids); } - if (in_array('odds_2ways', EventsTable::$bettype_settings)) { - $query->with('odds_2ways.bookmaker'); - } - if (in_array('odds_2ways_s1', EventsTable::$bettype_settings)) { - $query->with('odds_2ways_s1.bookmaker'); - } - if (in_array('odds_3ways', EventsTable::$bettype_settings)) { - $query->with('odds_3ways.bookmaker'); - } - if (in_array('odds_3ways_ht', EventsTable::$bettype_settings)) { - $query->with('odds_3ways_ht.bookmaker'); - } - if (in_array('odds_dc', EventsTable::$bettype_settings)) { - $query->with('odds_dc.bookmaker'); - } - if (in_array('odds_dnb', EventsTable::$bettype_settings)) { - $query->with('odds_dnb.bookmaker'); - } - if (in_array('odds_ggng', EventsTable::$bettype_settings)) { - $query->with('odds_ggng.bookmaker'); - } - if (in_array('odds_points', EventsTable::$bettype_settings)) { - $query->with('odds_points.bookmaker'); - } - if (in_array('odds_points_ht', EventsTable::$bettype_settings)) { - $query->with('odds_points_ht.bookmaker'); - } - if (in_array('odds_points_q1', EventsTable::$bettype_settings)) { - $query->with('odds_points_q1.bookmaker'); - } - if (in_array('odds_totals', EventsTable::$bettype_settings)) { - $query->with('odds_totals.bookmaker'); - } - if (in_array('odds_totals_ht', EventsTable::$bettype_settings)) { - $query->with('odds_totals_ht.bookmaker'); - } - if (in_array('odds_totals_q1', EventsTable::$bettype_settings)) { - $query->with('odds_totals_q1.bookmaker'); - } - if (in_array('odds_tq', EventsTable::$bettype_settings)) { - $query->with('odds_tq.bookmaker'); + if (isset((EventsTable::$bettype_settings))) { + if (in_array('odds_2ways', EventsTable::$bettype_settings)) { + $query->with('odds_2ways.bookmaker'); + } + if (in_array('odds_2ways_s1', EventsTable::$bettype_settings)) { + $query->with('odds_2ways_s1.bookmaker'); + } + if (in_array('odds_3ways', EventsTable::$bettype_settings)) { + $query->with('odds_3ways.bookmaker'); + } + if (in_array('odds_3ways_ht', EventsTable::$bettype_settings)) { + $query->with('odds_3ways_ht.bookmaker'); + } + if (in_array('odds_dc', EventsTable::$bettype_settings)) { + $query->with('odds_dc.bookmaker'); + } + if (in_array('odds_dnb', EventsTable::$bettype_settings)) { + $query->with('odds_dnb.bookmaker'); + } + if (in_array('odds_ggng', EventsTable::$bettype_settings)) { + $query->with('odds_ggng.bookmaker'); + } + if (in_array('odds_points', EventsTable::$bettype_settings)) { + $query->with('odds_points.bookmaker'); + } + if (in_array('odds_points_ht', EventsTable::$bettype_settings)) { + $query->with('odds_points_ht.bookmaker'); + } + if (in_array('odds_points_q1', EventsTable::$bettype_settings)) { + $query->with('odds_points_q1.bookmaker'); + } + if (in_array('odds_totals', EventsTable::$bettype_settings)) { + $query->with('odds_totals.bookmaker'); + } + if (in_array('odds_totals_ht', EventsTable::$bettype_settings)) { + $query->with('odds_totals_ht.bookmaker'); + } + if (in_array('odds_totals_q1', EventsTable::$bettype_settings)) { + $query->with('odds_totals_q1.bookmaker'); + } + if (in_array('odds_tq', EventsTable::$bettype_settings)) { + $query->with('odds_tq.bookmaker'); + } } return $query; diff --git a/app/Filament/Resources/Events/RelationManagers/BettypesRelationManager.php b/app/Filament/Resources/Events/RelationManagers/BettypesRelationManager.php deleted file mode 100644 index 92569735..00000000 --- a/app/Filament/Resources/Events/RelationManagers/BettypesRelationManager.php +++ /dev/null @@ -1,60 +0,0 @@ -components([ - TextInput::make('name') - ->required() - ->maxLength(255), - ]); - } - - public function table(Table $table): Table - { - return $table - ->recordTitleAttribute('name') - ->columns([ - TextColumn::make('name') - ->searchable(), - ]) - ->filters([ - // - ]) - ->headerActions([ - CreateAction::make(), - AssociateAction::make(), - ]) - ->recordActions([ - EditAction::make(), - DissociateAction::make(), - DeleteAction::make(), - ]) - ->toolbarActions([ - BulkActionGroup::make([ - DissociateBulkAction::make(), - DeleteBulkAction::make(), - ]), - ]); - } -} diff --git a/app/Filament/Resources/Events/RelationManagers/CountriesRelationManager.php b/app/Filament/Resources/Events/RelationManagers/CountriesRelationManager.php deleted file mode 100644 index f0a82f37..00000000 --- a/app/Filament/Resources/Events/RelationManagers/CountriesRelationManager.php +++ /dev/null @@ -1,60 +0,0 @@ -components([ - TextInput::make('name') - ->required() - ->maxLength(255), - ]); - } - - public function table(Table $table): Table - { - return $table - ->recordTitleAttribute('name') - ->columns([ - TextColumn::make('name') - ->searchable(), - ]) - ->filters([ - // - ]) - ->headerActions([ - CreateAction::make(), - AssociateAction::make(), - ]) - ->recordActions([ - EditAction::make(), - DissociateAction::make(), - DeleteAction::make(), - ]) - ->toolbarActions([ - BulkActionGroup::make([ - DissociateBulkAction::make(), - DeleteBulkAction::make(), - ]), - ]); - } -} diff --git a/app/Filament/Resources/Events/RelationManagers/UserNoteRelationManager.php b/app/Filament/Resources/Events/RelationManagers/UserNoteRelationManager.php deleted file mode 100644 index 2ba024c5..00000000 --- a/app/Filament/Resources/Events/RelationManagers/UserNoteRelationManager.php +++ /dev/null @@ -1,55 +0,0 @@ -components([ - TextInput::make('event_id') - ->required() - ->maxLength(255), - ]); - } - - public function table(Table $table): Table - { - return $table - ->recordTitleAttribute('event_id') - ->columns([ - TextColumn::make('event_id') - ->searchable(), - ]) - ->filters([ - // - ]) - ->headerActions([ - CreateAction::make(), - ]) - ->recordActions([ - EditAction::make(), - DeleteAction::make(), - ]); - } -} diff --git a/app/Filament/Resources/Events/Schemas/EventForm.php b/app/Filament/Resources/Events/Schemas/EventForm.php index 3b770744..845d9cba 100644 --- a/app/Filament/Resources/Events/Schemas/EventForm.php +++ b/app/Filament/Resources/Events/Schemas/EventForm.php @@ -12,9 +12,9 @@ class EventForm return $schema ->components([ - TextInput::make('provider_id') - ->numeric() - ->default(0), + // TextInput::make('provider_id') + // ->numeric() + // ->default(0), ]); } } diff --git a/app/Filament/Resources/Events/Tables/EventsTable.php b/app/Filament/Resources/Events/Tables/EventsTable.php index 21c09599..9bf2632a 100644 --- a/app/Filament/Resources/Events/Tables/EventsTable.php +++ b/app/Filament/Resources/Events/Tables/EventsTable.php @@ -14,6 +14,8 @@ use App\Models\CompetitionGroup; use App\Models\Country; use App\Models\Event; use App\Models\EventBookmaker; +use App\Models\EventUserNote; +use App\Models\EventUserNotification; use App\Models\EventUserStar; use App\Models\Group; use App\Models\OddsTable; @@ -23,14 +25,15 @@ use Filament\Actions\ActionGroup; use Filament\Actions\BulkActionGroup; use Filament\Actions\DeleteAction; use Filament\Actions\DeleteBulkAction; -use Filament\Actions\EditAction; -use Filament\Actions\ViewAction; use Filament\Forms\Components\Hidden; +use Filament\Forms\Components\Radio; use Filament\Forms\Components\Select; use Filament\Forms\Components\TextInput; +use Filament\Forms\Components\Toggle; use Filament\Schemas\Components\Utilities\Get; use Filament\Support\Enums\FontWeight; use Filament\Support\Enums\VerticalAlignment; +use Filament\Support\Enums\Width; use Filament\Tables\Columns\IconColumn; use Filament\Tables\Columns\TextColumn; use Filament\Tables\Enums\FiltersLayout; @@ -61,9 +64,9 @@ class EventsTable return $table ->striped() - ->poll('5s') + ->poll('10s') ->deferLoading() - ->defaultPaginationPageOption(50) + ->defaultPaginationPageOption(5) ->paginated([5, 10, 15]) ->columns([ IconColumn::make('sport.icon') @@ -168,7 +171,8 @@ class EventsTable ->visible(fn () => \in_array('odds_dnb', self::$bettype_settings)) ->verticalAlignment(VerticalAlignment::Start) ->label('Draw No Bet'), - ])->searchable(['id', 'home.name', 'away.name', 'betsapi_id', 'betradar_id', 'bet365_id', 'bwin_id', 'event_bookmaker.event_id']) + ]) + ->searchable(['id', 'home.name', 'away.name', 'betsapi_id', 'betradar_id', 'bet365_id', 'bwin_id', 'event_bookmaker.event_id']) ->defaultSort('starttime', 'ASC') ->extremePaginationLinks() ->filters([ @@ -479,9 +483,9 @@ class EventsTable } } - if ($data['stars_status'] ?? null) { - $indicators[] = Indicator::make('Favorits')->removeField('stars_status')->color('info'); - } + // 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']); @@ -539,8 +543,126 @@ class EventsTable EventUserStar::insert(['event_id' => $record->id, 'user_id' => auth()->user()->id]); } }), - EditAction::make()->iconButton()->color(fn ($record) => $record->user_notes->isEmpty() ? 'gray' : 'info')->icon('phosphor-note-pencil'), - ViewAction::make()->iconButton()->color('gray')->icon('phosphor-note-pencil'), + Action::make('event_note') + ->modalIcon('phosphor-note') + ->modalWidth(Width::Large) + ->modalSubmitActionLabel('Save') + ->extraModalFooterActions(fn (Action $action): array => [ + $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) { + return [ + 'event_user_note_id' => $value->id, + 'message' => $value->message, + ]; + } + } + + return ['event_user_note_id' => '']; + }) + ->schema([ + Hidden::make('event_user_note_id'), + TextInput::make('message')->prefixIcon('phosphor-note-pencil')->hiddenLabel()->live() + ->extraInputAttributes(['onClick' => 'this.select()']), + ]) + ->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']) { + if (! $data['message']) { + EventUserNote::where('id', $data['event_user_note_id'])->delete(); + } else { + EventUserNote::where('id', $data['event_user_note_id'])->update(['message' => $data['message']]); + } + } else { + EventUserNote::updateOrCreate([ + 'event_id' => $record->id, + 'user_id' => auth()->user()->id, + 'client_id' => auth()->user()->client_id, + 'bookmaker_id' => auth()->user()->bookmaker_id, + ], [ + 'message' => $data['message'], + ]); + } + }) + ->color(fn ($record) => $record->event_user_note->isEmpty() ? 'gray' : 'info'), + Action::make('event_notification') + ->modalWidth(Width::Large) + ->modalSubmitActionLabel('Save') + ->extraModalFooterActions(fn (Action $action): array => [ + $action->makeModalSubmitAction('Delete', arguments: ['delete' => true])->color('danger'), + ]) + ->modalIcon('phosphor-bell') + ->fillForm(data: function ($record) { + foreach ($record->event_user_notification as $value) { + if ($value->user_id == auth()->user()->id && $value->bookmaker_id == auth()->user()->bookmaker_id) { + return [ + 'event_user_notification_id' => $value->id, + 'odds_table_id' => $value->odds_table_id, + 'alarm_level_id' => $value->alarm_level_id, + 'is_notified' => $value->is_notified, + 'notify_by_email' => $value->notify_by_email, + ]; + } + } + + return ['event_user_notification_id' => '']; + }) + ->schema([ + Hidden::make('event_user_notification_id'), + Toggle::make('is_notified')->label('Monitoring') + ->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') + ->required() + ->prefixIcon('phosphor-dots-three-outline-vertical') + ->native(false) + ->options(fn ($record) => OddsTable::options_sport()), + Radio::make('alarm_level_id') + ->label('Alarm level') + ->required() + ->inline() + ->belowContent('If favorit enters alarm level a notification will be send.') + ->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') + ->onColor('info') + ->offColor('gray'), + ]) + ->icon('phosphor-bell') + ->iconButton() + ->action(function ($record, array $data) { + if ($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'], + 'notify_by_email' => $data['notify_by_email'], + 'is_notified' => $data['is_notified'], + ]); + } else { + EventUserNotification::updateOrCreate([ + 'event_id' => $record->id, + 'bookmaker_id' => auth()->user()->bookmaker_id, + 'user_id' => auth()->user()->id, + ], [ + 'odds_table_id' => $data['odds_table_id'], + 'alarm_level_id' => $data['alarm_level_id'], + 'notify_by_email' => $data['notify_by_email'], + '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') diff --git a/app/Filament/Resources/Events/Widgets/AlarmWidget.php b/app/Filament/Resources/Events/Widgets/AlarmWidget.php index 2aae6bd4..01154642 100644 --- a/app/Filament/Resources/Events/Widgets/AlarmWidget.php +++ b/app/Filament/Resources/Events/Widgets/AlarmWidget.php @@ -15,7 +15,7 @@ class AlarmWidget extends StatsOverviewWidget 'refreshAlarmWidget' => '$refresh', ]; - protected ?string $pollingInterval = '10s'; + protected ?string $pollingInterval = '15s'; public array $filters = []; diff --git a/app/Livewire/BettypeToggle.php b/app/Livewire/BettypeToggle.php index fca7e7c9..00ecf3fb 100644 --- a/app/Livewire/BettypeToggle.php +++ b/app/Livewire/BettypeToggle.php @@ -49,7 +49,23 @@ class BettypeToggle extends Component public function toggleStar() { - User::where('id', auth()->user()->id)->update(['stars' => DB::raw('!stars')]); + User::where('id', auth()->user()->id)->update(['filter_stars' => DB::raw('!filter_stars')]); + + $this->dispatch('filterClearFilter'); + $this->dispatch('refreshBettypeMenu'); + } + + 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'); diff --git a/app/Models/Event.php b/app/Models/Event.php index d99430d0..497992da 100644 --- a/app/Models/Event.php +++ b/app/Models/Event.php @@ -53,11 +53,6 @@ class Event extends Model return $this->belongsTo(Group::class); } - public function user_notes() - { - return $this->hasMany(UserNote::class, 'event_id', 'id'); - } - public function competition_group() { return $this->belongsTo(CompetitionGroup::class); @@ -148,6 +143,16 @@ class Event extends Model return $this->hasOne(EventUserStar::class, 'event_id', 'id'); } + public function event_user_note() + { + return $this->hasMany(EventUserNote::class, 'event_id', 'id'); + } + + public function event_user_notification() + { + return $this->hasMany(EventUserNotification::class, 'event_id', 'id'); + } + public function event_bookmaker() { return $this->hasOne(EventBookmaker::class, 'event_id', 'id')->where('bookmaker_id', auth()->user()->bookmaker_id); diff --git a/app/Models/UserNote.php b/app/Models/EventUserNote.php similarity index 92% rename from app/Models/UserNote.php rename to app/Models/EventUserNote.php index 9f30d228..7e604f8e 100644 --- a/app/Models/UserNote.php +++ b/app/Models/EventUserNote.php @@ -5,10 +5,9 @@ namespace App\Models; use App\Models\Scopes\ClientScope; use Illuminate\Database\Eloquent\Model; -class UserNote extends Model +class EventUserNote extends Model { protected $fillable = [ - 'user_messageid', 'event_id', 'bookmaker_id', 'user_id', diff --git a/app/Models/UserNotification.php b/app/Models/EventUserNotification.php similarity index 76% rename from app/Models/UserNotification.php rename to app/Models/EventUserNotification.php index dbf743b2..a669939a 100644 --- a/app/Models/UserNotification.php +++ b/app/Models/EventUserNotification.php @@ -4,13 +4,16 @@ namespace App\Models; use Illuminate\Database\Eloquent\Model; -class UserNotification extends Model +class EventUserNotification extends Model { protected $fillable = [ 'event_id', 'bookmaker_id', 'user_id', - 'message', + 'odds_table_id', + 'alarm_level_id', + 'notify_by_email', + 'is_notified', 'deleted', ]; diff --git a/app/Models/OddsTable.php b/app/Models/OddsTable.php index 2b2fb75a..b9b2733f 100644 --- a/app/Models/OddsTable.php +++ b/app/Models/OddsTable.php @@ -30,4 +30,21 @@ class OddsTable extends Model return $arr; } + + public static function options_sport() + { + switch (auth()->user()->sport_id) { + case 1: + return OddsTable::where('soccer', 1)->pluck('fulltitle', 'id'); + case 2: + return OddsTable::where('icehockey', 1)->pluck('fulltitle', 'id'); + case 3: + return OddsTable::where('basketball', 1)->pluck('fulltitle', 'id'); + case 5: + return OddsTable::where('tennis', 1)->pluck('fulltitle', 'id'); + } + + return []; + + } } diff --git a/app/Models/User.php b/app/Models/User.php index 35d1191f..2e23f87e 100644 --- a/app/Models/User.php +++ b/app/Models/User.php @@ -34,7 +34,9 @@ class User extends Authenticatable implements FilamentUser, HasAppAuthentication 'app_verified_at', 'client_id', 'sport_id', - 'star', + 'filter_stars', + 'filter_notes', + 'filter_notification', 'is_multiline_direct', 'all_only_none', 'partner_show', diff --git a/composer.json b/composer.json index 3731be77..33929bd5 100644 --- a/composer.json +++ b/composer.json @@ -16,6 +16,7 @@ "codeat3/blade-phosphor-icons": "^2.0", "codewithkyrian/filament-date-range": "^2.0", "filament/filament": "^4.0", + "guava/filament-modal-relation-managers": "^2.0", "joaopaulolndev/filament-edit-profile": "^2.0", "laravel/framework": "^12.0", "laravel/tinker": "^2.10.1", diff --git a/composer.lock b/composer.lock index 2d6bbe99..f1a7b8e7 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "0bd98d9bb528f0b49e7f2b921f2b62c9", + "content-hash": "fbdcd8c04f0bcdcc155c4356c15965e6", "packages": [ { "name": "agencetwogether/hookshelper", @@ -2047,6 +2047,87 @@ ], "time": "2025-12-27T19:43:20+00:00" }, + { + "name": "guava/filament-modal-relation-managers", + "version": "2.0.0", + "source": { + "type": "git", + "url": "https://github.com/GuavaCZ/filament-modal-relation-managers.git", + "reference": "f1e8290ede9856a7b5ab3f95db2b9cd6ef17b767" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/GuavaCZ/filament-modal-relation-managers/zipball/f1e8290ede9856a7b5ab3f95db2b9cd6ef17b767", + "reference": "f1e8290ede9856a7b5ab3f95db2b9cd6ef17b767", + "shasum": "" + }, + "require": { + "filament/filament": "^4.0", + "illuminate/contracts": "^10.0|^11.0|^12.0", + "php": "^8.1", + "spatie/laravel-package-tools": "^1.14.0" + }, + "require-dev": { + "laravel/pint": "^1.0", + "nunomaduro/collision": "^7.8|^8.1", + "nunomaduro/larastan": "^2.0.1", + "orchestra/testbench": "^8.8|^9.0|^10.0", + "pestphp/pest": "^2.0", + "pestphp/pest-plugin-arch": "^2.0", + "pestphp/pest-plugin-laravel": "^2.0", + "phpstan/extension-installer": "^1.1", + "phpstan/phpstan-deprecation-rules": "^1.0", + "phpstan/phpstan-phpunit": "^1.0" + }, + "type": "library", + "extra": { + "laravel": { + "aliases": { + "FilamentModalRelationManagers": "Guava\\FilamentModalRelationManagers\\Facades\\FilamentModalRelationManagers" + }, + "providers": [ + "Guava\\FilamentModalRelationManagers\\FilamentModalRelationManagersServiceProvider" + ] + } + }, + "autoload": { + "psr-4": { + "Guava\\FilamentModalRelationManagers\\": "src/", + "Guava\\FilamentModalRelationManagers\\Database\\Factories\\": "database/factories/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Lukas Frey", + "email": "lukas.frey@guava.cz", + "role": "Developer" + } + ], + "description": "Allows you to embed relation managers inside filament modals.", + "homepage": "https://github.com/guavaCZ/filament-modal-relation-managers", + "keywords": [ + "Guava", + "filament", + "filament-modal-relation-managers", + "filamentphp", + "laravel" + ], + "support": { + "issues": "https://github.com/GuavaCZ/filament-modal-relation-managers/issues", + "source": "https://github.com/GuavaCZ/filament-modal-relation-managers/tree/2.0.0" + }, + "funding": [ + { + "url": "https://github.com/GuavaCZ", + "type": "github" + } + ], + "time": "2025-08-20T06:55:09+00:00" + }, { "name": "guzzlehttp/guzzle", "version": "7.10.0", @@ -12814,12 +12895,12 @@ ], "aliases": [], "minimum-stability": "stable", - "stability-flags": [], + "stability-flags": {}, "prefer-stable": true, "prefer-lowest": false, "platform": { "php": "^8.3" }, - "platform-dev": [], - "plugin-api-version": "2.6.0" + "platform-dev": {}, + "plugin-api-version": "2.9.0" } diff --git a/database/migrations/0001_01_01_000000_create_users_table.php b/database/migrations/0001_01_01_000000_create_users_table.php index 85ae09da..237d0047 100644 --- a/database/migrations/0001_01_01_000000_create_users_table.php +++ b/database/migrations/0001_01_01_000000_create_users_table.php @@ -26,7 +26,9 @@ return new class extends Migration $table->text('app_authentication_secret')->nullable(); $table->text('app_authentication_recovery_codes')->nullable(); $table->boolean('has_email_authentication')->default(false); - $table->boolean('stars')->default(false); + $table->boolean('filter_stars')->default(false); + $table->boolean('filter_notes')->default(false); + $table->boolean('filter_notification')->default(false); $table->boolean('is_multiline_direct')->default(false); $table->boolean('all_only_none')->default(false); $table->boolean('partner_show')->default(false); diff --git a/database/migrations/2026_01_27_132542_create_odds_tables_table.php b/database/migrations/2026_01_27_132542_create_odds_tables_table.php index 0278e632..0f4ebb2b 100644 --- a/database/migrations/2026_01_27_132542_create_odds_tables_table.php +++ b/database/migrations/2026_01_27_132542_create_odds_tables_table.php @@ -15,6 +15,7 @@ return new class extends Migration $table->id(); $table->string('name'); $table->string('title'); + $table->string('fulltitle'); $table->boolean(column: 'has_active_spread')->default(0); $table->string('oddnames'); $table->string('fieldnames'); diff --git a/database/migrations/2026_01_30_102545_create_user_notifications_table.php b/database/migrations/2026_01_30_102545_create_user_notifications_table.php index d9aced95..813112a1 100644 --- a/database/migrations/2026_01_30_102545_create_user_notifications_table.php +++ b/database/migrations/2026_01_30_102545_create_user_notifications_table.php @@ -11,15 +11,16 @@ return new class extends Migration */ public function up(): void { - Schema::create('user_notifications', function (Blueprint $table) { + Schema::create('event_user_notifications', function (Blueprint $table) { $table->id(); $table->foreignId('event_id')->index()->constrained()->cascadeOnDelete()->references('id')->on('events'); $table->integer('bookmaker_id')->default(0); $table->integer('user_id')->index()->references('id')->on('users'); $table->integer('odds_table_id')->index()->references('id')->on('odds_tables'); $table->integer('alarm_level_id')->default(0); - $table->string('message'); - $table->integer('deleted')->default(0); + $table->boolean('notify_by_email')->default(false); + $table->boolean('deleted')->default(false); + $table->boolean('is_notified')->default(false); $table->timestamps(); }); } @@ -29,6 +30,6 @@ return new class extends Migration */ public function down(): void { - Schema::dropIfExists('user_notifications'); + Schema::dropIfExists('event_user_notifications'); } }; diff --git a/database/migrations/2026_01_30_101858_create_user_note_table.php b/database/migrations/2026_02_01_071510_create_event_user_notes_table.php similarity index 72% rename from database/migrations/2026_01_30_101858_create_user_note_table.php rename to database/migrations/2026_02_01_071510_create_event_user_notes_table.php index c4b33c01..7ca473dd 100644 --- a/database/migrations/2026_01_30_101858_create_user_note_table.php +++ b/database/migrations/2026_02_01_071510_create_event_user_notes_table.php @@ -11,9 +11,9 @@ return new class extends Migration */ public function up(): void { - Schema::create('user_notes', function (Blueprint $table) { + Schema::create('event_user_notes', function (Blueprint $table) { $table->id(); - $table->foreignId('event_id')->index()->constrained()->cascadeOnDelete()->references('id')->on('events'); + $table->foreignId('event_id')->constrained()->cascadeOnDelete(); $table->integer('bookmaker_id')->default(0); $table->integer('user_id')->index()->references('id')->on('users'); $table->integer('client_id')->default(0); @@ -28,6 +28,8 @@ return new class extends Migration */ public function down(): void { - Schema::dropIfExists('user_notes'); + Schema::dropIfExists('event_user_notes'); } }; + +// a make:filament-relation-manager CategoryResource posts title diff --git a/database/seeders/OddsTableSeeder.php b/database/seeders/OddsTableSeeder.php index 96e1ca8d..d871f929 100644 --- a/database/seeders/OddsTableSeeder.php +++ b/database/seeders/OddsTableSeeder.php @@ -12,22 +12,22 @@ class OddsTableSeeder extends Seeder /** * Provoider */ - $sql = "INSERT INTO `odds_tables` (`id`, `name`, `title`, `oddnames`, `fieldnames`, `has_active_spread`, `soccer`, `icehockey`, `basketball`, `tennis`, `created_at`, `updated_at`) + $sql = "INSERT INTO `odds_tables` (`id`, `name`, `title`, `fulltitle`, `has_active_spread`, `oddnames`, `fieldnames`, `soccer`, `icehockey`, `basketball`, `tennis`, `created_at`, `updated_at`) VALUES - (1, 'odds_2ways', 'ML', 'h2w,a2w', 'alarm_2w_h2w,alarm_2w_a2w', 0, 0, 1, 1, 1, NULL, NULL), - (2, 'odds_2ways_s1', 'ML S1', 'h2w,a2w', 'alarm_2ws1_h2w,alarm_2ws1_a2w', 0, 0, 0, 0, 1, NULL, NULL), - (3, 'odds_3ways', '1X2', 'h3w,d3w,a3w', 'alarm_3w_h3w,alarm_3w_d3w,alarm_3w_a3w', 0, 1, 1, 0, 0, NULL, NULL), - (4, 'odds_3ways_ht', '1X2 HT', 'h3w,d3w,a3w', 'alarm_3wht_h3w,alarm_3wht_d3w,alarm_3wht_a3w', 0, 1, 0, 0, 0, NULL, NULL), - (5, 'odds_dc', 'DC', 'dc1x,dc12,dcx2', 'alarm_dc_dc1x,alarm_dc_dc12,alarm_dc_dcx2', 0, 1, 0, 0, 0, NULL, NULL), - (6, 'odds_dnb', 'DNB', 'dnb1,dnb2', 'alarm_dbn_dnb1,alarm_dbn_dnb2', 0, 1, 0, 0, 0, NULL, NULL), - (7, 'odds_ggng', 'GGNG', 'gg,ng', 'alarm_ggng_gg,alarm_ggng_ng', 0, 1, 0, 0, 0, NULL, NULL), - (8, 'odds_points', 'PO', 'home,away', 'alarm_po_home,alarm_po_away', 1, 0, 1, 1, 1, NULL, NULL), - (9, 'odds_points_ht', 'PO HT', 'home,away', 'alarm_poht_home,alarm_poht_away', 1, 0, 0, 1, 0, NULL, NULL), - (10, 'odds_points_q1', 'PO Q1', 'home,away', 'alarm_poq1_home,alarm_poq1_away', 1, 0, 1, 1, 0, NULL, NULL), - (11, 'odds_totals', 'TO', 'over,under', 'alarm_to_over,alarm_to_under', 1, 1, 1, 1, 1, NULL, NULL), - (12, 'odds_totals_ht', 'TO HT', 'over,under', 'alarm_toht_over,alarm_toht_under', 1, 1, 0, 1, 0, NULL, NULL), - (13, 'odds_totals_q1', 'TO Q1', 'over,under', 'alarm_toq1_over,alarm_toq1_under', 1, 0, 1, 1, 0, NULL, NULL), - (14, 'odds_tq', 'TQ', 'htq,atq', 'alarm_tq_htq,alarm_tq_atq', 1, 1, 0, 0, 0, NULL, NULL); + (1, 'odds_2ways', 'ML', 'Money Line', 0, 'h2w,a2w', 'alarm_2w_h2w,alarm_2w_a2w', 0, 1, 1, 1, NULL, NULL), + (2, 'odds_2ways_s1', 'ML S1', 'Money Line Set1', 0, 'h2w,a2w', 'alarm_2ws1_h2w,alarm_2ws1_a2w', 0, 0, 0, 1, NULL, NULL), + (3, 'odds_3ways', '1X2', '1X2', 0, 'h3w,d3w,a3w', 'alarm_3w_h3w,alarm_3w_d3w,alarm_3w_a3w', 1, 1, 0, 0, NULL, NULL), + (4, 'odds_3ways_ht', '1X2 HT', '1X2 Halftime', 0, 'h3w,d3w,a3w', 'alarm_3wht_h3w,alarm_3wht_d3w,alarm_3wht_a3w', 1, 0, 0, 0, NULL, NULL), + (5, 'odds_dc', 'DC', 'Double Chance', 0, 'dc1x,dc12,dcx2', 'alarm_dc_dc1x,alarm_dc_dc12,alarm_dc_dcx2', 1, 0, 0, 0, NULL, NULL), + (6, 'odds_dnb', 'DNB', 'Draw no bet', 0, 'dnb1,dnb2', 'alarm_dbn_dnb1,alarm_dbn_dnb2', 1, 0, 0, 0, NULL, NULL), + (7, 'odds_ggng', 'GGNG', 'Goal No Goal', 0, 'gg,ng', 'alarm_ggng_gg,alarm_ggng_ng', 1, 0, 0, 0, NULL, NULL), + (8, 'odds_points', 'PO', 'Points', 1, 'home,away', 'alarm_po_home,alarm_po_away', 0, 1, 1, 1, NULL, NULL), + (9, 'odds_points_ht', 'PO HT', 'Points Halftime', 1, 'home,away', 'alarm_poht_home,alarm_poht_away', 0, 0, 1, 0, NULL, NULL), + (10, 'odds_points_q1', 'PO Q1', 'Points First Quarter', 1, 'home,away', 'alarm_poq1_home,alarm_poq1_away', 0, 1, 1, 0, NULL, NULL), + (11, 'odds_totals', 'TO', 'Totals', 1, 'over,under', 'alarm_to_over,alarm_to_under', 1, 1, 1, 1, NULL, NULL), + (12, 'odds_totals_ht', 'TO HT', 'Totals Halftime', 1, 'over,under', 'alarm_toht_over,alarm_toht_under', 1, 0, 1, 0, NULL, NULL), + (13, 'odds_totals_q1', 'TO Q1', 'Totals First Quarter', 1, 'over,under', 'alarm_toq1_over,alarm_toq1_under', 0, 1, 1, 0, NULL, NULL), + (14, 'odds_tq', 'TQ', 'To Qualify', 1, 'htq,atq', 'alarm_tq_htq,alarm_tq_atq', 1, 0, 0, 0, NULL, NULL); "; DB::unprepared($sql); diff --git a/database/seeders/SportSeeder.php b/database/seeders/SportSeeder.php index d8975bba..d24a813b 100644 --- a/database/seeders/SportSeeder.php +++ b/database/seeders/SportSeeder.php @@ -11,11 +11,11 @@ class SportSeeder extends Seeder { $sql = "INSERT INTO `sports` (`id`, `name`, `code`, `icon`, `color`, `bapi`, `bwin`, `b365`, `logi`, `magl`, `is_active`, `created_at`, `updated_at`) VALUES - (1, 'Soccer', 'so', 'icon-soccerball', 'primary', 1, 4, 1, 1, 1, 1, NULL, NULL), + (1, 'Soccer', 'so', 'icon-soccerball', 'info', 1, 4, 1, 1, 1, 1, NULL, NULL), (2, 'Ice Hockey', 'ic', 'icon-icehockey', 'black', 17, 12, 17, 4, 19, 1, NULL, NULL), - (3, 'Basketball', 'ba', 'icon-basketball', 'warning', 18, 7, 18, 2, 2, 1, NULL, NULL), + (3, 'Basketball', 'ba', 'icon-basketball', 'danger', 18, 7, 18, 2, 2, 1, NULL, NULL), (4, 'Rugby', 'rg', 'icon-rugby', NULL, 8, 32, 8, 12, 22, 0, NULL, NULL), - (5, 'Tennis', 'te', 'icon-tennisball', 'gray', 13, 5, 13, 5, 15, 1, NULL, NULL), + (5, 'Tennis', 'te', 'icon-tennisball', 'warning', 13, 5, 13, 5, 15, 1, NULL, NULL), (6, 'American Football', 'af', 'icon-amercanfootball', NULL, 12, 11, 12, 70, 25, 0, NULL, NULL), (7, 'Baseball', 'bs', 'icon-baseball', NULL, 16, 23, 16, 3, 3, 0, NULL, NULL), (8, 'Handball', 'ha', 'icon-handball', NULL, 78, 16, 78, 6, 20, 0, NULL, NULL), diff --git a/resources/css/filament/admin/theme.css b/resources/css/filament/admin/theme.css index de0b8419..ec58c4bb 100644 --- a/resources/css/filament/admin/theme.css +++ b/resources/css/filament/admin/theme.css @@ -5,6 +5,7 @@ @source '../../../../resources/views/filament/**/*'; @source '../../../../resources/views/components/**/*'; @source '../../../../vendor/awcodes/light-switch/resources/**/*.blade.php'; +@source '../../../../vendor/guava/filament-modal-relation-managers/resources/**/*'; /* hide reset link in filters */ .fi-ta-filters-heading, diff --git a/resources/views/filament/resources/events/tooltip/event-user-note-tooltip.blade.php b/resources/views/filament/resources/events/tooltip/event-user-note-tooltip.blade.php new file mode 100644 index 00000000..ca9d39df --- /dev/null +++ b/resources/views/filament/resources/events/tooltip/event-user-note-tooltip.blade.php @@ -0,0 +1,16 @@ +