wip
This commit is contained in:
1 parent
8a5db5d6da
commit
368af4b565
16 files changed
+97
-281
No files matched your search
@@ -9,7 +9,6 @@ use App\Models\CompetitionGroup;
|
||||
use App\Models\Country;
|
||||
use App\Models\Event;
|
||||
use App\Models\Mapper;
|
||||
use App\Models\User;
|
||||
use Carbon\Carbon;
|
||||
use Filament\Actions\Action;
|
||||
use Filament\Actions\Concerns\InteractsWithActions;
|
||||
@@ -42,8 +41,6 @@ class MapperLeft extends Component implements HasActions, HasSchemas, HasTable
|
||||
|
||||
public $search_left = false;
|
||||
|
||||
public $user;
|
||||
|
||||
protected $listeners = [
|
||||
'refreshMapperLeft' => '$refresh',
|
||||
];
|
||||
@@ -65,12 +62,11 @@ class MapperLeft extends Component implements HasActions, HasSchemas, HasTable
|
||||
$this->dispatch('refreshMapperLeft');
|
||||
}
|
||||
|
||||
#[Lazy]
|
||||
public function table(Table $table): Table
|
||||
{
|
||||
$this->user = User::getUser();
|
||||
|
||||
return $table
|
||||
->query(LoadEvents::load($this->search_left, $this->user->sport_id))
|
||||
->query(LoadEvents::load($this->search_left, auth()->user()->sport_id))
|
||||
->columns([
|
||||
MapperLeftColumn::make('left')->label(''),
|
||||
])
|
||||
@@ -82,14 +78,14 @@ class MapperLeft extends Component implements HasActions, HasSchemas, HasTable
|
||||
Select::make('country_id')
|
||||
->placeholder('Country')
|
||||
->hiddenLabel()
|
||||
->multiple()
|
||||
// ->multiple()
|
||||
->columnSpan(2)
|
||||
->searchable()
|
||||
->preload()
|
||||
->options(function () {
|
||||
$res = Event::query()->where('sport_id', $this->user->sport_id)->where('betradar_id', 0)->where('starttime', '>', Carbon::now())->groupBy('country_id')->pluck('country_id')->toArray();
|
||||
$res = Event::query()->where('sport_id', auth()->user()->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');
|
||||
return Country::query()->where('id', $res)->orderBy('name')->pluck('name', 'id');
|
||||
})
|
||||
->live()
|
||||
->reactive()
|
||||
@@ -105,12 +101,12 @@ class MapperLeft extends Component implements HasActions, HasSchemas, HasTable
|
||||
->searchable()
|
||||
->options(function (Get $get) {
|
||||
if ($get('country_id')) {
|
||||
$res = Event::query()->where('sport_id', $this->user->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();
|
||||
$res = Event::query()->where('sport_id', auth()->user()->sport_id)->where('betradar_id', 0)->where('starttime', '>', Carbon::now())->where('country_id', $get('country_id'))->groupBy('competition_group_id')->pluck('competition_group_id')->toArray();
|
||||
} else {
|
||||
$res = Event::query()->where('sport_id', $this->user->sport_id)->where('betradar_id', 0)->where('starttime', '>', Carbon::now())->groupBy('competition_group_id')->pluck('competition_group_id')->toArray();
|
||||
$res = Event::query()->where('sport_id', auth()->user()->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();
|
||||
$comps = CompetitionGroup::with('country')->where('id', $res)->get();
|
||||
|
||||
$arr = [];
|
||||
foreach ($comps as $val) {
|
||||
@@ -155,7 +151,6 @@ class MapperLeft extends Component implements HasActions, HasSchemas, HasTable
|
||||
Action::make('refreshMapperLeft')
|
||||
->hiddenLabel()
|
||||
->icon('phosphor-x')
|
||||
->color('danger')
|
||||
->size(Size::Small)
|
||||
->action(function (Component $livewire) {
|
||||
$this->search_left = '';
|
||||
|
||||
Reference in new issue
Block a user