diff --git a/app/Console/Commands/Services/Tasks/GenerateDefaultSetting.php b/app/Console/Commands/Services/Tasks/GenerateDefaultSetting.php index 0896584c..91c4a79c 100644 --- a/app/Console/Commands/Services/Tasks/GenerateDefaultSetting.php +++ b/app/Console/Commands/Services/Tasks/GenerateDefaultSetting.php @@ -25,25 +25,25 @@ class GenerateDefaultSetting Notice::note('1) multiline bookmaker slots for client', 'p'); } - $sports = Sport::where('is_active', 1)->get(); + $sports = Sport::where('is_active', 1)->pluck('id'); - $bookmaker = [0, 6, 30, 649, 117]; + $bookmaker_slots = [1 => 6, 2 => 30, 3 => 649, 4 => 126]; - $clients = Client::get(); + $clients = Client::get()->pluck('id'); - foreach ($clients as $client) { + foreach ($clients as $client_id) { - foreach ($sports as $sport) { + foreach ($sports as $sport_id) { - $multilines = MultilineSetting::where('sport_id', $sport->id)->get(); + $multilines = MultilineSetting::where('sport_id', $sport_id)->get()->pluck('id'); - foreach ($multilines as $multiline) { + foreach ($multilines as $multiline_id) { - for ($slot = 1; $slot <= 4; $slot++) { + foreach ($bookmaker_slots as $slot => $bookmaker_id) { - MultilineClient::updateOrInsert( - ['client_id' => $client->id, 'sport_id' => $client->id, 'multiline_setting_id' => $multiline->id, 'position' => $slot], - ['bookmaker_id' => $bookmaker[$slot], 'sort' => $slot, 'disabled' => 0] + MultilineClient::firstOrCreate( + ['client_id' => $client_id, 'sport_id' => $sport_id, 'multiline_setting_id' => $multiline_id, 'position' => $slot], + ['bookmaker_id' => $bookmaker_id, 'sort' => $slot, 'disabled' => 0] ); } } diff --git a/app/Filament/Resources/Events/Tables/EventsTable.php b/app/Filament/Resources/Events/Tables/EventsTable.php index 43d6db2b..2aaaf80e 100644 --- a/app/Filament/Resources/Events/Tables/EventsTable.php +++ b/app/Filament/Resources/Events/Tables/EventsTable.php @@ -57,14 +57,13 @@ class EventsTable public static function load_multiline_bookmaker() { $res = MultilineClient::with('multiline_setting') - ->where('client_id', auth()->user()->client_id) - ->where('sport_id', auth()->user()->sport_id) ->select('bookmaker_id', 'multiline_setting_id') ->orderBy('sort') ->get(); foreach ($res as $value) { - self::$multiline_gettype[$value->multiline_setting->table][] = $value->bookmaker_id; + $table = $value->multiline_setting->table; + self::$multiline_gettype[$table][] = (int) $value->bookmaker_id; } } @@ -214,10 +213,10 @@ class EventsTable ->extremePaginationLinks() ->filters([ Filter::make('events') - ->columns(9)->columnSpan(9) + ->columns(5)->columnSpan(5) ->schema([ Select::make(name: 'sport_id') - ->default(auth()->user()->id) + ->default(auth()->user()->sport_id) ->prefixIcon(auth()->user()->sport->icon) ->selectablePlaceholder(false) ->hiddenLabel() @@ -239,7 +238,6 @@ class EventsTable }), Select::make(name: 'country_id') - ->columnSpan(2) ->hidden(fn () => auth()->user()->sport_id == 5) ->placeholder('Country') ->hiddenLabel() @@ -259,7 +257,6 @@ class EventsTable }), Select::make('competition_group_id') ->hidden(fn () => auth()->user()->sport_id == 5) - ->columnSpan(2) ->placeholder('League') ->hiddenLabel() ->label('') @@ -281,7 +278,6 @@ class EventsTable }) ->live(), Select::make('group_id') - ->columnSpan(2) ->visible(fn () => auth()->user()->sport_id == 5) ->placeholder('Tournament') ->hiddenLabel() @@ -304,7 +300,7 @@ class EventsTable }) ->live(), DateRangePicker::make('starttime_period') - ->columnSpan(4) + ->columnSpan(2) ->displayFormat('d M Y') ->minDate(now()) ->hiddenLabel() diff --git a/app/Livewire/Mapper/LoadEvents.php b/app/Livewire/Mapper/LoadEvents.php index 1f74d4e5..ac1ba061 100644 --- a/app/Livewire/Mapper/LoadEvents.php +++ b/app/Livewire/Mapper/LoadEvents.php @@ -21,12 +21,9 @@ class LoadEvents } })->pluck('id')->toArray(); - // dd(Auth::user()->sport_id); - $query = Event::query() ->with('home') ->with('away') - ->where('sport_id', Auth::user()->sport_id) ->where('starttime', '>', Carbon::now()) ->where(function ($query) use ($element_ids) { $query->orWhereIn('home_id', $element_ids)->orWhereIn('away_id', $element_ids); @@ -37,7 +34,6 @@ class LoadEvents ->with('home') ->with('away') ->where('betradar_id', 0) - ->where('sport_id', Auth::user()->sport_id) ->where('starttime', '>', Carbon::now()); } diff --git a/app/Livewire/Mapper/LoadProvider.php b/app/Livewire/Mapper/LoadProvider.php index 50003e39..52c6e30c 100644 --- a/app/Livewire/Mapper/LoadProvider.php +++ b/app/Livewire/Mapper/LoadProvider.php @@ -4,7 +4,6 @@ namespace App\Livewire\Mapper; use App\Models\Mapper; use Illuminate\Support\Carbon; -use Illuminate\Support\Facades\Auth; class LoadProvider { @@ -15,9 +14,8 @@ class LoadProvider $searchValues = preg_split('/\s+/', $search_right, -1, PREG_SPLIT_NO_EMPTY); return Mapper::query() - ->where('sport_id', Auth::user()->sport_id) ->where('starttime', '>', Carbon::now()) - ->where('provider_id', Auth::user()->provider_id) + ->where('provider_id', auth()->user()->provider_id) ->where(function ($query) use ($searchValues) { foreach ($searchValues as $value) { $query->orWhere('home', 'LIKE', '%'.$value.'%') @@ -26,9 +24,8 @@ class LoadProvider }); } else { return Mapper::query() - ->where('sport_id', Auth::user()->sport_id) ->where('starttime', '>', Carbon::now()) - ->where('provider_id', Auth::user()->provider_id); + ->where('provider_id', auth()->user()->provider_id); } } } diff --git a/app/Livewire/MapperLeft.php b/app/Livewire/MapperLeft.php index e4877ccb..441879e8 100644 --- a/app/Livewire/MapperLeft.php +++ b/app/Livewire/MapperLeft.php @@ -9,6 +9,7 @@ use App\Models\CompetitionGroup; use App\Models\Country; use App\Models\Event; use App\Models\Mapper; +use App\Models\Sport; use Carbon\Carbon; use Filament\Actions\Action; use Filament\Actions\Concerns\InteractsWithActions; @@ -74,24 +75,44 @@ class MapperLeft extends Component implements HasActions, HasSchemas, HasTable ->filters([ Filter::make('events') ->schema([ - Select::make('country_id') - ->placeholder('Country') + Select::make(name: 'sport_id') + ->default(auth()->user()->sport_id) + ->prefixIcon(auth()->user()->sport->icon) + ->selectablePlaceholder(false) ->hiddenLabel() - ->multiple() - ->label('') ->columnSpan(2) - ->searchable() ->preload() ->options(function () { - $res = Event::query()->where('betradar_id', 0)->where('starttime', '>', Carbon::now())->groupBy('country_id')->pluck('country_id')->toArray(); - - return Country::query()->whereIn('id', $res)->pluck('name', 'id'); + return Sport::query()->where('is_active', 1)->pluck('name', 'id'); }) ->live() ->reactive() - ->afterStateUpdated(function (callable $set) { + ->afterStateUpdated(function (callable $set, $livewire) { + + $livewire->dispatch('reload_data_left'); + $livewire->dispatch('reload_data_right'); + + $set('country_id', null); $set('competition_group_id', null); + }), + // Select::make('country_id') + // ->placeholder('Country') + // ->hiddenLabel() + // ->multiple() + // ->columnSpan(2) + // ->searchable() + // ->preload() + // ->options(function (Get $get) { + // $res = Event::query()->where('sport_id', $get('sport_id'))->where('betradar_id', 0)->where('starttime', '>', Carbon::now())->groupBy('country_id')->pluck('country_id')->toArray(); + + // return Country::query()->whereIn('id', $res)->pluck('name', 'id'); + // }) + // ->live() + // ->reactive() + // ->afterStateUpdated(function (callable $set) { + // $set('competition_group_id', null); + // }), Select::make('competition_group_id') ->placeholder('League') ->hiddenLabel() @@ -100,11 +121,11 @@ class MapperLeft extends Component implements HasActions, HasSchemas, HasTable ->multiple() ->searchable() ->options(function (Get $get) { - if ($get('country_id')) { - $res = Event::query()->where('betradar_id', 0)->where('starttime', '>', Carbon::now())->whereIn('country_id', $get('country_id'))->groupBy('competition_group_id')->pluck('competition_group_id')->toArray(); - } else { - $res = Event::query()->where('betradar_id', 0)->where('starttime', '>', Carbon::now())->groupBy('competition_group_id')->pluck('competition_group_id')->toArray(); - } + // if ($get('country_id')) { + // $res = Event::query()->where('sport_id', $get('sport_id'))->where('betradar_id', 0)->where('starttime', '>', Carbon::now())->whereIn('country_id', $get('country_id'))->groupBy('competition_group_id')->pluck('competition_group_id')->toArray(); + // } else { + // } + $res = Event::query()->where('sport_id', $get('sport_id'))->where('betradar_id', 0)->where('starttime', '>', Carbon::now())->groupBy('competition_group_id')->pluck('competition_group_id')->toArray(); $comps = CompetitionGroup::with('country')->whereIn('id', $res)->get(); @@ -125,8 +146,11 @@ class MapperLeft extends Component implements HasActions, HasSchemas, HasTable ->query(function (Builder $query, array $data): Builder { return $query ->when( - $data['country_id'], - fn (Builder $query, $country_id) => $query->where('country_id', $country_id) + $data['sport_id'], + fn (Builder $query, $sport_id) => $query->where('sport_id', $sport_id) + // )->when( + // $data['country_id'], + // fn (Builder $query, $country_id) => $query->where('country_id', $country_id) )->when( $data['competition_group_id'], fn (Builder $query, $competition_group_id) => $query->whereIn('competition_group_id', $competition_group_id) diff --git a/app/Livewire/MapperRight.php b/app/Livewire/MapperRight.php index 3d8440ef..e8ed9fde 100644 --- a/app/Livewire/MapperRight.php +++ b/app/Livewire/MapperRight.php @@ -8,6 +8,7 @@ use App\Livewire\Mapper\StoreMapped; use App\Models\Country; use App\Models\Event; use App\Models\Mapper; +use App\Models\Sport; use Filament\Actions\Action; use Filament\Actions\Concerns\InteractsWithActions; use Filament\Actions\Contracts\HasActions; @@ -73,44 +74,66 @@ class MapperRight extends Component implements HasActions, HasSchemas, HasTable ->filters([ Filter::make('events') ->schema([ - Select::make('country_id') - ->visible(fn () => in_array(Auth()->user()->provider_id, [3, 4])) - ->placeholder('Country') + Select::make(name: 'sport_id') + ->default(auth()->user()->sport_id) + ->prefixIcon(auth()->user()->sport->icon) + ->selectablePlaceholder(false) ->hiddenLabel() - ->label('') - ->searchable() - ->preload() - ->multiple() ->columnSpan(2) - ->live() + ->preload() ->options(function () { - return Mapper::query()->where('sport_id', Auth::user()->sport_id)->where('provider_id', Auth::user()->provider_id)->where('starttime', '>', Carbon::now())->groupBy('country_id')->pluck('country', 'country_id')->toArray(); + return Sport::query()->where('is_active', 1)->pluck('name', 'id'); }) + ->live() ->reactive() - ->afterStateUpdated(function (callable $set) { - $set('group_id', null); - }) - ->placeholder('Country'), - Select::make('group_cc') - ->visible(fn () => Auth()->user()->provider_id == 2) - ->placeholder('Country') - ->hiddenLabel() - ->label('') - ->searchable() - ->preload() - ->multiple() - ->columnSpan(2) - ->live() - ->options(function () { - $res = Mapper::query()->where('sport_id', Auth::user()->sport_id)->where('provider_id', Auth::user()->provider_id)->where('starttime', '>', Carbon::now())->groupBy('group_cc')->pluck('group_cc')->toArray(); + ->afterStateUpdated(function (callable $set, $livewire) { - return Country::query()->whereIn('iso2', $res)->pluck('name', 'iso2'); - }) - ->reactive() - ->afterStateUpdated(function (callable $set) { + $livewire->dispatch('reload_data_left'); + $livewire->dispatch('reload_data_right'); + + // $set('country_id', null); + // $set('group_cc', null); $set('group_id', null); - }) - ->placeholder('Country'), + + }), + // Select::make('country_id') + // ->visible(fn () => in_array(Auth()->user()->provider_id, [3, 4])) + // ->placeholder('Country') + // ->hiddenLabel() + // ->label('') + // ->searchable() + // ->preload() + // ->multiple() + // ->columnSpan(2) + // ->live() + // ->options(function (Get $get) { + // return Mapper::query()->where('sport_id', $get('sport_id'))->where('provider_id', Auth::user()->provider_id)->where('starttime', '>', Carbon::now())->groupBy('country_id')->pluck('country', 'country_id')->toArray(); + // }) + // ->reactive() + // ->afterStateUpdated(function (callable $set) { + // $set('group_id', null); + // }) + // ->placeholder('Country'), + // Select::make('group_cc') + // ->visible(fn () => Auth()->user()->provider_id == 2) + // ->placeholder('Country') + // ->hiddenLabel() + // ->label('') + // ->searchable() + // ->preload() + // ->multiple() + // ->columnSpan(2) + // ->live() + // ->options(function () { + // $res = Mapper::query()->where('sport_id', Auth::user()->sport_id)->where('provider_id', Auth::user()->provider_id)->where('starttime', '>', Carbon::now())->groupBy('group_cc')->pluck('group_cc')->toArray(); + + // return Country::query()->whereIn('iso2', $res)->pluck('name', 'iso2'); + // }) + // ->reactive() + // ->afterStateUpdated(function (callable $set) { + // $set('group_id', null); + // }) + // ->placeholder('Country'), Select::make('group_id') ->placeholder('League') ->label('Leagues') @@ -121,24 +144,28 @@ class MapperRight extends Component implements HasActions, HasSchemas, HasTable ->preload() ->multiple() ->options(function (Get $get) { - if ($get('country_id')) { - return Mapper::query()->where('sport_id', Auth::user()->sport_id)->where('provider_id', Auth::user()->provider_id)->where('starttime', '>', Carbon::now())->whereIn('country_id', $get('country_id'))->groupBy('group_id')->pluck('group', 'group_id')->toArray(); - } elseif ($get('group_cc')) { - return Mapper::query()->where('sport_id', Auth::user()->sport_id)->where('provider_id', Auth::user()->provider_id)->where('starttime', '>', Carbon::now())->whereIn('group_cc', $get('group_cc'))->groupBy('group_id')->pluck('group', 'group_id')->toArray(); - } else { - return Mapper::query()->where('sport_id', Auth::user()->sport_id)->where('provider_id', Auth::user()->provider_id)->where('starttime', '>', Carbon::now())->groupBy('group_id')->pluck('group', 'group_id')->toArray(); - } + // if ($get('country_id')) { + // return Mapper::query()->where('sport_id', $get('sport_id'))->where('provider_id', Auth::user()->provider_id)->where('starttime', '>', Carbon::now())->whereIn('country_id', $get('country_id'))->groupBy('group_id')->pluck('group', 'group_id')->toArray(); + // } else + // if ($get('group_cc')) { + // return Mapper::query()->where('sport_id', $get('sport_id'))->where('provider_id', Auth::user()->provider_id)->where('starttime', '>', Carbon::now())->whereIn('group_cc', $get('group_cc'))->groupBy('group_id')->pluck('group', 'group_id')->toArray(); + // } else { + // } + return Mapper::query()->where('sport_id', $get('sport_id'))->where('provider_id', Auth::user()->provider_id)->where('starttime', '>', Carbon::now())->groupBy('group_id')->pluck('group', 'group_id')->toArray(); }) ->live(), ]) ->query(function (Builder $query, array $data): Builder { return $query ->when( - $data['country_id'], - fn (Builder $query, $country_id) => $query->whereIn('country_id', $country_id) - )->when( - $data['group_cc'], - fn (Builder $query, $group_cc) => $query->whereIn('group_cc', $group_cc) + $data['sport_id'], + fn (Builder $query, $sport_id) => $query->where('sport_id', $sport_id) + // )->when( + // $data['country_id'], + // fn (Builder $query, $country_id) => $query->whereIn('country_id', $country_id) + // )->when( + // $data['group_cc'], + // fn (Builder $query, $group_cc) => $query->whereIn('group_cc', $group_cc) )->when( $data['group_id'], fn (Builder $query, $group_id) => $query->whereIn('group_id', $group_id) diff --git a/app/Models/MultilineClient.php b/app/Models/MultilineClient.php index bbc44080..6ec2c826 100644 --- a/app/Models/MultilineClient.php +++ b/app/Models/MultilineClient.php @@ -25,7 +25,7 @@ class MultilineClient extends Model public function multiline_setting() { - return $this->belongsTo(MultilineSetting::class)->where('sport_id', auth()->user()->sport_id); + return $this->belongsTo(MultilineSetting::class); } public function bookmaker() diff --git a/resources/css/filament/admin/theme.css b/resources/css/filament/admin/theme.css index f9933dc2..ec864d09 100644 --- a/resources/css/filament/admin/theme.css +++ b/resources/css/filament/admin/theme.css @@ -63,4 +63,14 @@ button[wire\:click="resetTableFiltersForm"] { .striped div:nth-child(even) { @apply bg-gray-100 } +} + +#mapper_right .fi-ta-filter-indicators button, +#mapper_left .fi-ta-filter-indicators button { + display: none; +} + +#mapper_right .fi-ta-filter-indicators div button, +#mapper_left .fi-ta-filter-indicators div button { + display: block; } \ No newline at end of file diff --git a/resources/views/livewire/mapper-left.blade.php b/resources/views/livewire/mapper-left.blade.php index 3e6b6cd5..12e3b59a 100644 --- a/resources/views/livewire/mapper-left.blade.php +++ b/resources/views/livewire/mapper-left.blade.php @@ -1,4 +1,4 @@ -
+
diff --git a/resources/views/livewire/mapper-right.blade.php b/resources/views/livewire/mapper-right.blade.php index 3e6b6cd5..206ba644 100644 --- a/resources/views/livewire/mapper-right.blade.php +++ b/resources/views/livewire/mapper-right.blade.php @@ -1,4 +1,4 @@ -
+
    {{ $this->table }}
diff --git a/resources/views/livewire/top-menu-items.blade.php b/resources/views/livewire/top-menu-items.blade.php index 20500ec4..bf95b954 100644 --- a/resources/views/livewire/top-menu-items.blade.php +++ b/resources/views/livewire/top-menu-items.blade.php @@ -62,11 +62,11 @@ {{-- Event Mapper --}} - - + @@ -157,9 +157,11 @@ {{-- Multiline --}} - + - + @@ -172,7 +174,8 @@ - + @@ -187,7 +190,8 @@ - + @@ -196,7 +200,7 @@ @livewire('comparing-method') - + @endif
diff --git a/setup.sh b/setup.sh index 448a5c38..890d2458 100755 --- a/setup.sh +++ b/setup.sh @@ -46,29 +46,47 @@ case "$1" in php artisan nuh --d --t --f 1 php artisan nuh --d --t --f 2 php artisan nuh --d --t --f 3 + php artisan nuh --d --t --f 20 + php artisan nuh --d --t --f 21 + php artisan nuh --d --t --f 22 php artisan nuh --d --f 4 php artisan nuh --d --f 5 php artisan nuh --d --f 6 - php artisan nuh --d --f 8 - php artisan nuh --d --f 9 - php artisan nuh --d --f 10 - php artisan nuh --d --f 11 - php artisan nuh --d --f 12 - php artisan nuh --d --f 16 + php artisan nuh --d --f 8 + php artisan nuh --d --f 9 + php artisan nuh --d --f 10 + php artisan nuh --d --f 11 + php artisan nuh --d --f 12 + php artisan nuh --d --f 13 + php artisan nuh --d --f 14 + php artisan nuh --d --f 15 + php artisan nuh --d --f 16 + php artisan nuh --d --f 17 + php artisan nuh --d --f 18 + php artisan nuh --d --f 19 ;; "10") php artisan nuh --d --t --f 1 php artisan nuh --d --t --f 2 php artisan nuh --d --t --f 3 + php artisan nuh --d --t --f 20 + php artisan nuh --d --t --f 21 + php artisan nuh --d --t --f 22 php artisan nuh --d --f 4 php artisan nuh --d --f 5 php artisan nuh --d --f 6 - php artisan nuh --d --f 8 - php artisan nuh --d --f 9 + php artisan nuh --d --f --p 8 + php artisan nuh --d --f --p 9 php artisan nuh --d --f --p 10 php artisan nuh --d --f --p 11 php artisan nuh --d --f --p 12 + php artisan nuh --d --f --p 13 + php artisan nuh --d --f --p 14 + php artisan nuh --d --f --p 15 php artisan nuh --d --f --p 16 + php artisan nuh --d --f --p 17 + php artisan nuh --d --f --p 18 + php artisan nuh --d --f --p 19 ;; *) echo ""