fix swop for mapper
This commit is contained in:
1 parent
dce543604f
commit
60b524012d
5 files changed
+44
-37
No files matched your search
@@ -18,7 +18,7 @@ class StoreMapped
|
|||||||
|
|
||||||
$mapper = Mapper::where('event_id', $arguments['event_id'])->first();
|
$mapper = Mapper::where('event_id', $arguments['event_id'])->first();
|
||||||
|
|
||||||
// dd($mapper);
|
dd($mapper, $arguments, $swopped);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
EVENT
|
EVENT
|
||||||
|
|||||||
@@ -30,6 +30,7 @@ use Filament\Tables\Filters\Filter;
|
|||||||
use Filament\Tables\Filters\Indicator;
|
use Filament\Tables\Filters\Indicator;
|
||||||
use Filament\Tables\Table;
|
use Filament\Tables\Table;
|
||||||
use Illuminate\Database\Eloquent\Builder;
|
use Illuminate\Database\Eloquent\Builder;
|
||||||
|
use Illuminate\Support\Facades\Auth;
|
||||||
use Livewire\Attributes\On;
|
use Livewire\Attributes\On;
|
||||||
use Livewire\Component;
|
use Livewire\Component;
|
||||||
|
|
||||||
@@ -51,6 +52,11 @@ class MapperLeft extends Component implements HasActions, HasSchemas, HasTable
|
|||||||
|
|
||||||
public function isRemovingAllFilters() {}
|
public function isRemovingAllFilters() {}
|
||||||
|
|
||||||
|
public function swop_elements()
|
||||||
|
{
|
||||||
|
$this->elements_swopped = ! $this->elements_swopped;
|
||||||
|
}
|
||||||
|
|
||||||
public function removeTableFilter(string $filterName, ?string $field = null, bool $shouldTriggerUpdatedFiltersHook = true): void
|
public function removeTableFilter(string $filterName, ?string $field = null, bool $shouldTriggerUpdatedFiltersHook = true): void
|
||||||
{
|
{
|
||||||
if (($key = array_search($field, $this->search_values)) !== false) {
|
if (($key = array_search($field, $this->search_values)) !== false) {
|
||||||
@@ -99,12 +105,12 @@ class MapperLeft extends Component implements HasActions, HasSchemas, HasTable
|
|||||||
->schema([
|
->schema([
|
||||||
Select::make('country_id')
|
Select::make('country_id')
|
||||||
->placeholder('Country')
|
->placeholder('Country')
|
||||||
->visible(fn () => auth()->user()->sport_id != 5)
|
->visible(fn () => Auth::user()->sport_id != 5)
|
||||||
->hiddenLabel()
|
->hiddenLabel()
|
||||||
->searchable()
|
->searchable()
|
||||||
->preload()
|
->preload()
|
||||||
->options(function (Get $get) {
|
->options(function (Get $get) {
|
||||||
$query = Event::query()->where('sport_id', auth()->user()->sport_id)->where('betradar_id', 0)->groupBy('country_id');
|
$query = Event::query()->where('sport_id', Auth::user()->sport_id)->where('betradar_id', 0)->groupBy('country_id');
|
||||||
|
|
||||||
$timeframe = $get('starttime_period') ?? [];
|
$timeframe = $get('starttime_period') ?? [];
|
||||||
|
|
||||||
@@ -140,7 +146,7 @@ class MapperLeft extends Component implements HasActions, HasSchemas, HasTable
|
|||||||
->searchable()
|
->searchable()
|
||||||
->options(function (Get $get) {
|
->options(function (Get $get) {
|
||||||
|
|
||||||
$query = CompetitionGroup::where('sport_id', auth()->user()->sport_id)
|
$query = CompetitionGroup::where('sport_id', Auth::user()->sport_id)
|
||||||
->whereHas('event', function ($query) {
|
->whereHas('event', function ($query) {
|
||||||
$query->where('betradar_id', 0);
|
$query->where('betradar_id', 0);
|
||||||
});
|
});
|
||||||
@@ -169,7 +175,7 @@ class MapperLeft extends Component implements HasActions, HasSchemas, HasTable
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
if (auth()->user()->sport_id != 5) {
|
if (Auth::user()->sport_id != 5) {
|
||||||
$res = $query->groupBy('country_id')->get();
|
$res = $query->groupBy('country_id')->get();
|
||||||
} else {
|
} else {
|
||||||
$res = $query->get();
|
$res = $query->get();
|
||||||
@@ -271,11 +277,6 @@ class MapperLeft extends Component implements HasActions, HasSchemas, HasTable
|
|||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function toggle()
|
|
||||||
{
|
|
||||||
$this->elements_swopped = ! $this->elements_swopped;
|
|
||||||
}
|
|
||||||
|
|
||||||
#[On('search_left')]
|
#[On('search_left')]
|
||||||
public function searchLeft($string)
|
public function searchLeft($string)
|
||||||
{
|
{
|
||||||
@@ -328,6 +329,7 @@ class MapperLeft extends Component implements HasActions, HasSchemas, HasTable
|
|||||||
|
|
||||||
public function render()
|
public function render()
|
||||||
{
|
{
|
||||||
|
|
||||||
return view('livewire.mapper-left');
|
return view('livewire.mapper-left');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -31,6 +31,7 @@ use Filament\Tables\Filters\Indicator;
|
|||||||
use Filament\Tables\Table;
|
use Filament\Tables\Table;
|
||||||
use Illuminate\Database\Eloquent\Builder;
|
use Illuminate\Database\Eloquent\Builder;
|
||||||
use Illuminate\Support\Carbon;
|
use Illuminate\Support\Carbon;
|
||||||
|
use Illuminate\Support\Facades\Auth;
|
||||||
use Livewire\Attributes\On;
|
use Livewire\Attributes\On;
|
||||||
use Livewire\Component;
|
use Livewire\Component;
|
||||||
|
|
||||||
@@ -50,6 +51,11 @@ class MapperRight extends Component implements HasActions, HasSchemas, HasTable
|
|||||||
'refreshMapperRight' => '$refresh',
|
'refreshMapperRight' => '$refresh',
|
||||||
];
|
];
|
||||||
|
|
||||||
|
public function swop_elements()
|
||||||
|
{
|
||||||
|
$this->elements_swopped = ! $this->elements_swopped;
|
||||||
|
}
|
||||||
|
|
||||||
public function removeTableFilter(string $filterName, ?string $field = null, bool $shouldTriggerUpdatedFiltersHook = true): void
|
public function removeTableFilter(string $filterName, ?string $field = null, bool $shouldTriggerUpdatedFiltersHook = true): void
|
||||||
{
|
{
|
||||||
if (($key = array_search($field, $this->search_values)) !== false) {
|
if (($key = array_search($field, $this->search_values)) !== false) {
|
||||||
@@ -84,9 +90,9 @@ class MapperRight extends Component implements HasActions, HasSchemas, HasTable
|
|||||||
IconColumn::make('country_magloo.icon')
|
IconColumn::make('country_magloo.icon')
|
||||||
->label('')
|
->label('')
|
||||||
->icon(fn (string $state): string => $state)
|
->icon(fn (string $state): string => $state)
|
||||||
->visible(fn () => in_array(auth()->user()->provider_id, [3, 4])),
|
->visible(fn () => in_array(Auth::user()->provider_id, [3, 4])),
|
||||||
IconColumn::make('group_cc')
|
IconColumn::make('group_cc')
|
||||||
->visible(fn () => auth()->user()->provider_id == 2)
|
->visible(fn () => Auth::user()->provider_id == 2)
|
||||||
->icon(fn (string $state): string => 'flag-country-'.$state)->label(''),
|
->icon(fn (string $state): string => 'flag-country-'.$state)->label(''),
|
||||||
IconColumn::make('sport.icon')
|
IconColumn::make('sport.icon')
|
||||||
->label('')
|
->label('')
|
||||||
@@ -99,7 +105,7 @@ class MapperRight extends Component implements HasActions, HasSchemas, HasTable
|
|||||||
Filter::make('events')
|
Filter::make('events')
|
||||||
->schema([
|
->schema([
|
||||||
Select::make('country_id')
|
Select::make('country_id')
|
||||||
->visible(fn () => in_array(auth()->user()->provider_id, [3, 4]) && auth()->user()->sport_id != 5)
|
->visible(fn () => in_array(Auth::user()->provider_id, [3, 4]) && Auth::user()->sport_id != 5)
|
||||||
->placeholder('Country')
|
->placeholder('Country')
|
||||||
->hiddenLabel()
|
->hiddenLabel()
|
||||||
->label('')
|
->label('')
|
||||||
@@ -107,7 +113,7 @@ class MapperRight extends Component implements HasActions, HasSchemas, HasTable
|
|||||||
->preload()
|
->preload()
|
||||||
->live()
|
->live()
|
||||||
->options(function (Get $get) {
|
->options(function (Get $get) {
|
||||||
$query = Mapper::query()->where('sport_id', auth()->user()->sport_id)->where('provider_id', auth()->user()->provider_id)->groupBy('country_id')->orderBy('country');
|
$query = Mapper::query()->where('sport_id', Auth::user()->sport_id)->where('provider_id', Auth::user()->provider_id)->groupBy('country_id')->orderBy('country');
|
||||||
|
|
||||||
$timeframe = $get('starttime_period') ?? [];
|
$timeframe = $get('starttime_period') ?? [];
|
||||||
if ($timeframe['start'] || $timeframe['end']) {
|
if ($timeframe['start'] || $timeframe['end']) {
|
||||||
@@ -134,7 +140,7 @@ class MapperRight extends Component implements HasActions, HasSchemas, HasTable
|
|||||||
})
|
})
|
||||||
->placeholder('Country'),
|
->placeholder('Country'),
|
||||||
Select::make('group_cc')
|
Select::make('group_cc')
|
||||||
->visible(fn () => auth()->user()->provider_id == 2)
|
->visible(fn () => Auth::user()->provider_id == 2)
|
||||||
->placeholder('Country')
|
->placeholder('Country')
|
||||||
->hiddenLabel()
|
->hiddenLabel()
|
||||||
->label('')
|
->label('')
|
||||||
@@ -142,7 +148,7 @@ class MapperRight extends Component implements HasActions, HasSchemas, HasTable
|
|||||||
->preload()
|
->preload()
|
||||||
->live()
|
->live()
|
||||||
->options(function (Get $get) {
|
->options(function (Get $get) {
|
||||||
$query = Mapper::query()->where('sport_id', auth()->user()->sport_id)->where('provider_id', auth()->user()->provider_id)->groupBy('group_cc');
|
$query = Mapper::query()->where('sport_id', Auth::user()->sport_id)->where('provider_id', Auth::user()->provider_id)->groupBy('group_cc');
|
||||||
|
|
||||||
$timeframe = $get('starttime_period') ?? [];
|
$timeframe = $get('starttime_period') ?? [];
|
||||||
|
|
||||||
@@ -184,11 +190,11 @@ class MapperRight extends Component implements HasActions, HasSchemas, HasTable
|
|||||||
->preload()
|
->preload()
|
||||||
->options(function (Get $get) {
|
->options(function (Get $get) {
|
||||||
if ($get('country_id')) {
|
if ($get('country_id')) {
|
||||||
$query = Mapper::query()->where('sport_id', auth()->user()->sport_id)->where('provider_id', auth()->user()->provider_id)->where('country_id', $get('country_id'))->groupBy('group_id');
|
$query = Mapper::query()->where('sport_id', Auth::user()->sport_id)->where('provider_id', Auth::user()->provider_id)->where('country_id', $get('country_id'))->groupBy('group_id');
|
||||||
} elseif ($get('group_cc')) {
|
} elseif ($get('group_cc')) {
|
||||||
$query = Mapper::query()->where('sport_id', auth()->user()->sport_id)->where('provider_id', auth()->user()->provider_id)->where('group_cc', $get('group_cc'))->groupBy('group_id');
|
$query = Mapper::query()->where('sport_id', Auth::user()->sport_id)->where('provider_id', Auth::user()->provider_id)->where('group_cc', $get('group_cc'))->groupBy('group_id');
|
||||||
} else {
|
} else {
|
||||||
$query = Mapper::query()->where('sport_id', auth()->user()->sport_id)->where('provider_id', auth()->user()->provider_id)->groupBy('group_id');
|
$query = Mapper::query()->where('sport_id', Auth::user()->sport_id)->where('provider_id', Auth::user()->provider_id)->groupBy('group_id');
|
||||||
}
|
}
|
||||||
|
|
||||||
$timeframe = $get('starttime_period') ?? [];
|
$timeframe = $get('starttime_period') ?? [];
|
||||||
@@ -310,7 +316,7 @@ class MapperRight extends Component implements HasActions, HasSchemas, HasTable
|
|||||||
->requiresConfirmation()
|
->requiresConfirmation()
|
||||||
->action(function (Component $livewire) {
|
->action(function (Component $livewire) {
|
||||||
|
|
||||||
Mapper::query()->where('sport_id', auth()->user()->sport_id)->where('provider_id', auth()->user()->provider_id)->delete();
|
Mapper::query()->where('sport_id', Auth::user()->sport_id)->where('provider_id', Auth::user()->provider_id)->delete();
|
||||||
|
|
||||||
$this->search_values = [];
|
$this->search_values = [];
|
||||||
$this->tableSearch = ''; // Clears the main search bar
|
$this->tableSearch = ''; // Clears the main search bar
|
||||||
@@ -321,16 +327,11 @@ class MapperRight extends Component implements HasActions, HasSchemas, HasTable
|
|||||||
Notification::make()
|
Notification::make()
|
||||||
->success()
|
->success()
|
||||||
->title('Events deleted')
|
->title('Events deleted')
|
||||||
->body('All events for '.Sport::query()->where('id', auth()->user()->sport_id)->value('name').' has been deleted successfully. It will take up to 5 minutes to reload'),
|
->body('All events for '.Sport::query()->where('id', Auth::user()->sport_id)->value('name').' has been deleted successfully. It will take up to 5 minutes to reload'),
|
||||||
),
|
),
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function toggle()
|
|
||||||
{
|
|
||||||
$this->elements_swopped = ! $this->elements_swopped;
|
|
||||||
}
|
|
||||||
|
|
||||||
#[On('search_right')]
|
#[On('search_right')]
|
||||||
public function searchRight($string)
|
public function searchRight($string)
|
||||||
{
|
{
|
||||||
@@ -381,6 +382,7 @@ class MapperRight extends Component implements HasActions, HasSchemas, HasTable
|
|||||||
|
|
||||||
public function render()
|
public function render()
|
||||||
{
|
{
|
||||||
|
|
||||||
return view('livewire.mapper-right');
|
return view('livewire.mapper-right');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
<x-filament-panels::page>
|
<x-filament-panels::page>
|
||||||
<div class="absolute top-25 left-30 ">
|
<div class="inline-block absolute top-22 ">
|
||||||
@switch(auth()->user()->provider_id)
|
@switch(auth()->user()->provider_id)
|
||||||
@case(5)
|
@case(5)
|
||||||
<x-bkm-logifuture-nigeria class="h-5" />
|
<x-bkm-logifuture-nigeria class="h-5" />
|
||||||
|
|||||||
@@ -49,18 +49,21 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="pt-2 font-bold text-right">{{ $event->home->name }}</div>
|
<div class="pt-2 font-bold text-right">{{ $event->home->name }}</div>
|
||||||
|
{{-- @click="swop()" --}}
|
||||||
|
|
||||||
<div class="row-span-2 text-center py-auto">
|
<div class="row-span-2 text-center py-auto">
|
||||||
<div x-data="{ elements_swopped: false, toggle() { this.elements_swopped = !this.elements_swopped } }" x-init="elements_swopped = true">
|
<div x-data="{ elements_swopped: false, toggle_icon() { this.elements_swopped = !this.elements_swopped } }" x-init="elements_swopped = true">
|
||||||
<x-filament::button color="gray" outlined @click="toggle()" wire:click="toggle()"
|
<span wire:click="toggle_icon()">
|
||||||
onkeydown="return event.key != 'Enter';">
|
<x-filament::button color="gray" outlined wire:click="swop_elements"
|
||||||
<div x-show="elements_swopped">
|
onkeydown="return event.key != 'Enter';">
|
||||||
<x-icon-paralell class="h-14 w-14 mx-auto" />
|
<div x-show="elements_swopped">
|
||||||
</div>
|
<x-icon-paralell class="h-14 w-14 mx-auto" />
|
||||||
<div x-show="!elements_swopped">
|
</div>
|
||||||
<x-icon-crossed class="h-14 w-14 mx-auto" />
|
<div x-show="!elements_swopped">
|
||||||
</div>
|
<x-icon-crossed class="h-14 w-14 mx-auto" />
|
||||||
</x-filament::button>
|
</div>
|
||||||
|
</x-filament::button>
|
||||||
|
</span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user