mapper new
This commit is contained in:
1 parent
3a289dd776
commit
c5118a4fd0
12 files changed
+94
-119
No files matched your search
+11
-57
@@ -19,7 +19,6 @@ use Filament\Schemas\Components\Utilities\Get;
|
||||
use Filament\Schemas\Concerns\InteractsWithSchemas;
|
||||
use Filament\Schemas\Contracts\HasSchemas;
|
||||
use Filament\Support\Enums\Alignment;
|
||||
use Filament\Support\Enums\FontWeight;
|
||||
use Filament\Support\Enums\Size;
|
||||
use Filament\Tables\Columns\IconColumn;
|
||||
use Filament\Tables\Columns\TextColumn;
|
||||
@@ -72,11 +71,6 @@ class MapperLeft extends Component implements HasActions, HasSchemas, HasTable
|
||||
return $table
|
||||
->query(LoadEvents::load($this->search_left, auth()->user()->sport_id))
|
||||
->columns([
|
||||
TextColumn::make('starttime')
|
||||
->sortable()
|
||||
->time('H:i')
|
||||
->alignCenter()
|
||||
->description(fn ($record): string => Carbon::parse($record->starttime)->format('d. M. y')),
|
||||
IconColumn::make('country.icon')->icon(fn (string $state): string => $state)->label(''),
|
||||
TextColumn::make('competition_group.name')->label('Group')
|
||||
->wrap()
|
||||
@@ -88,54 +82,12 @@ class MapperLeft extends Component implements HasActions, HasSchemas, HasTable
|
||||
$this->dispatch('refreshMapperRight');
|
||||
}
|
||||
}),
|
||||
TextColumn::make('home.name')
|
||||
->label('Home')
|
||||
->color('home')
|
||||
->weight(FontWeight::Bold)
|
||||
->alignRight(),
|
||||
IconColumn::make('id')->icon('phosphor-minus')->label('')->color('black'),
|
||||
TextColumn::make('away.name')
|
||||
->color('away')
|
||||
->label('Away')
|
||||
->weight(FontWeight::Bold),
|
||||
TextColumn::make('starttime')
|
||||
->sortable()
|
||||
->time('H:i')
|
||||
->alignCenter()
|
||||
->description(fn ($record): string => Carbon::parse($record->starttime)->format('d. M. y')),
|
||||
MapperLeftColumn::make('left')->label(''),
|
||||
])->recordActions([
|
||||
Action::make('search_home')
|
||||
->iconButton()
|
||||
->icon('phosphor-magnifying-glass')
|
||||
->color('home')
|
||||
->action(function ($record) {
|
||||
$this->dispatch('search_right', $record->home->name);
|
||||
}),
|
||||
Action::make('search_away')
|
||||
->icon('phosphor-magnifying-glass')
|
||||
->iconButton()
|
||||
->color('away')
|
||||
->action(function ($record) {
|
||||
$this->dispatch('search_right', $record->away->name);
|
||||
}),
|
||||
// Action::make('drag_left')
|
||||
// ->icon('phosphor-arrows-out')
|
||||
// ->iconButton()
|
||||
// ->extraAttributes([
|
||||
// 'x-data' => '{ moveoverleft: false }',
|
||||
// 'x-on' => '{
|
||||
// dragstart = {
|
||||
// self: dragging = true;
|
||||
// event.dataTransfer.effectAllowed = "move;
|
||||
// event.dataTransfer.setData("text/plain", event.target.id)
|
||||
// },
|
||||
// dragover = {
|
||||
// prevent: "moveoverleft = true"
|
||||
// },
|
||||
// dragleave = {
|
||||
// prevent: "moveoverleft = false"
|
||||
// }
|
||||
// }',
|
||||
// ])
|
||||
// ->action(function ($record) {
|
||||
// $this->dispatch('search_right', $record->away->name);
|
||||
// }),
|
||||
])
|
||||
->defaultSort('starttime')
|
||||
->searchable(['home.name', 'away.name'])
|
||||
@@ -146,7 +98,6 @@ class MapperLeft extends Component implements HasActions, HasSchemas, HasTable
|
||||
Select::make('country_id')
|
||||
->placeholder('Country')
|
||||
->hiddenLabel()
|
||||
// ->multiple()
|
||||
->searchable()
|
||||
->preload()
|
||||
->options(function () {
|
||||
@@ -225,7 +176,7 @@ class MapperLeft extends Component implements HasActions, HasSchemas, HasTable
|
||||
if ($this->search_left) {
|
||||
$searchValues = preg_split('/\s+/', $this->search_left, -1, PREG_SPLIT_NO_EMPTY);
|
||||
foreach ($searchValues as $value) {
|
||||
$indicators[] = Indicator::make($value)->removeField($value);
|
||||
$indicators[] = Indicator::make($value)->removeField($value)->color('info');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -287,12 +238,15 @@ class MapperLeft extends Component implements HasActions, HasSchemas, HasTable
|
||||
})
|
||||
->closeModalByEscaping(false)
|
||||
->modalCloseButton(false)
|
||||
->modalCancelAction(fn (Action $action) => $action->keyBindings(['c'])->tooltip('keyboard: "c"'))
|
||||
->closeModalByClickingAway(false)
|
||||
->modalAlignment(Alignment::Center)
|
||||
->modalFooterActionsAlignment(Alignment::Center)
|
||||
->modalWidth('2xl')
|
||||
->modalSubmitActionLabel('Confirm')
|
||||
->modalSubmitAction();
|
||||
->modalSubmitActionLabel('Save')
|
||||
->modalSubmitAction(
|
||||
fn (Action $action) => $action->keyBindings(['return'])->tooltip('keyboard: "return"')
|
||||
);
|
||||
}
|
||||
|
||||
public function render()
|
||||
|
||||
@@ -17,14 +17,12 @@ use Filament\Schemas\Components\Utilities\Get;
|
||||
use Filament\Schemas\Concerns\InteractsWithSchemas;
|
||||
use Filament\Schemas\Contracts\HasSchemas;
|
||||
use Filament\Support\Enums\Alignment;
|
||||
use Filament\Support\Enums\FontWeight;
|
||||
use Filament\Support\Enums\Size;
|
||||
use Filament\Tables\Columns\IconColumn;
|
||||
use Filament\Tables\Columns\TextColumn;
|
||||
use Filament\Tables\Concerns\InteractsWithTable;
|
||||
use Filament\Tables\Contracts\HasTable;
|
||||
use Filament\Tables\Enums\FiltersLayout;
|
||||
use Filament\Tables\Enums\RecordActionsPosition;
|
||||
use Filament\Tables\Filters\Filter;
|
||||
use Filament\Tables\Filters\Indicator;
|
||||
use Filament\Tables\Table;
|
||||
@@ -72,14 +70,11 @@ class MapperRight extends Component implements HasActions, HasSchemas, HasTable
|
||||
->query(LoadProvider::load($this->search_right, auth()->user()))
|
||||
->columns([
|
||||
MapperRightColumn::make('right')->label(''),
|
||||
TextColumn::make('home')
|
||||
->color('home')
|
||||
->weight(FontWeight::Bold)
|
||||
->alignRight(),
|
||||
IconColumn::make('id')->icon('phosphor-minus')->label('')->color('black'),
|
||||
TextColumn::make('away')
|
||||
->color('away')
|
||||
->weight(FontWeight::Bold),
|
||||
TextColumn::make('starttime')
|
||||
->sortable()
|
||||
->time('H:i')
|
||||
->alignCenter()
|
||||
->description(fn ($record): string => Carbon::parse($record->starttime)->format('d. M. y')),
|
||||
TextColumn::make('group')
|
||||
->wrap()
|
||||
->tooltip('Click to filter by this group')
|
||||
@@ -91,28 +86,7 @@ class MapperRight extends Component implements HasActions, HasSchemas, HasTable
|
||||
}
|
||||
}),
|
||||
IconColumn::make('group_cc')->icon(fn (string $state): string => 'flag-country-'.$state)->label(''),
|
||||
TextColumn::make('starttime')
|
||||
->sortable()
|
||||
->time('H:i')
|
||||
->alignCenter()
|
||||
->description(fn ($record): string => Carbon::parse($record->starttime)->format('d. M. y')),
|
||||
])->searchable(['home', 'away'])
|
||||
->recordActions([
|
||||
Action::make('search_home')
|
||||
->iconButton()
|
||||
->icon('phosphor-magnifying-glass')
|
||||
->color('home')
|
||||
->action(function ($record) {
|
||||
$this->dispatch('search_left', $record->home);
|
||||
}),
|
||||
Action::make('search_away')
|
||||
->icon('phosphor-magnifying-glass')
|
||||
->iconButton()
|
||||
->color('away')
|
||||
->action(function ($record) {
|
||||
$this->dispatch('search_left', $record->away);
|
||||
}),
|
||||
], position: RecordActionsPosition::BeforeColumns)
|
||||
->filters([
|
||||
Filter::make('events')
|
||||
->schema([
|
||||
@@ -223,7 +197,7 @@ class MapperRight extends Component implements HasActions, HasSchemas, HasTable
|
||||
if ($this->search_right) {
|
||||
$searchValues = preg_split('/\s+/', $this->search_right, -1, PREG_SPLIT_NO_EMPTY);
|
||||
foreach ($searchValues as $value) {
|
||||
$indicators[] = Indicator::make($value)->removeField($value);
|
||||
$indicators[] = Indicator::make($value)->removeField($value)->color('info');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -273,6 +247,7 @@ class MapperRight extends Component implements HasActions, HasSchemas, HasTable
|
||||
{
|
||||
return Action::make('right')
|
||||
->modalHeading('Event Mapper')
|
||||
->modalDescription('Keyboard: "enter" Save, "c" Close')
|
||||
->modalContent(function (array $arguments) {
|
||||
|
||||
$event = Event::where('id', $arguments['id'])->first();
|
||||
@@ -289,12 +264,16 @@ class MapperRight extends Component implements HasActions, HasSchemas, HasTable
|
||||
})
|
||||
->closeModalByEscaping(false)
|
||||
->modalCloseButton(false)
|
||||
->modalCancelAction(fn (Action $action) => $action->keyBindings(['c'])->tooltip('keyboard: "c"'))
|
||||
->closeModalByClickingAway(false)
|
||||
->modalAlignment(Alignment::Center)
|
||||
->modalFooterActionsAlignment(Alignment::Center)
|
||||
->modalWidth('2xl')
|
||||
->modalSubmitActionLabel('Confirm')
|
||||
->modalSubmitAction();
|
||||
->modalSubmitActionLabel('Save')
|
||||
->modalSubmitAction()
|
||||
->modalSubmitAction(
|
||||
fn (Action $action) => $action->keyBindings(['return'])->tooltip('keyboard: "return"')
|
||||
);
|
||||
}
|
||||
|
||||
public function render()
|
||||
|
||||
@@ -43,19 +43,19 @@ class SportSwitcher extends Component
|
||||
|
||||
$this->iconcolor = Sport::where('id', $this->sport_id)->pluck('color')->first();
|
||||
|
||||
// $this->js('window.location.reload()');
|
||||
|
||||
$this->dispatch('filterClearFilter');
|
||||
|
||||
$this->dispatch('refreshSportSwitcher');
|
||||
$this->js('window.location.reload()');
|
||||
|
||||
$this->dispatch('refreshBettypeMenu');
|
||||
// $this->dispatch('refreshSportSwitcher');
|
||||
|
||||
$this->dispatch('refreshMultilineBookmaker');
|
||||
// $this->dispatch('refreshBettypeMenu');
|
||||
|
||||
$this->dispatch('refreshComparingBookmakerMenu');
|
||||
// $this->dispatch('refreshMultilineBookmaker');
|
||||
|
||||
$this->dispatch('refreshAlarmBookmaker');
|
||||
// $this->dispatch('refreshComparingBookmakerMenu');
|
||||
|
||||
// $this->dispatch('refreshAlarmBookmaker');
|
||||
|
||||
}
|
||||
|
||||
|
||||
Generated
+3
-3
@@ -12982,12 +12982,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.9.0"
|
||||
"platform-dev": [],
|
||||
"plugin-api-version": "2.6.0"
|
||||
}
|
||||
@@ -30,6 +30,12 @@ button[wire\:click="resetTableFiltersForm"] {
|
||||
}
|
||||
}
|
||||
|
||||
.drag-and-drop__item:active {
|
||||
@apply rounded;
|
||||
background-color: rgba(43, 127, 255, 0.1);
|
||||
}
|
||||
|
||||
|
||||
/* .fi-ta-header-toolbar {
|
||||
@apply flex-row-reverse;
|
||||
} */
|
||||
|
||||
@@ -1,17 +1,32 @@
|
||||
<li class="cursor-grab drag-and-drop__item" x-data="{ moveoverleft: false }" id={{ $record->id }}
|
||||
<li class="cursor-grab drag-and-drop__item p-3 flex flex-1 justify-between w-full gap-3"
|
||||
id="{{ $record->id }}"
|
||||
x-data="{ moveoverleft: false }"
|
||||
x-on:dragstart.self="
|
||||
dragging = true;
|
||||
event.dataTransfer.effectAllowed = 'move';
|
||||
event.dataTransfer.setData('text/plain', event.target.id);"
|
||||
x-on:dragover.prevent="moveoverleft = true" x-on:dragleave.prevent="moveoverleft = false"
|
||||
x-on:drop="moveoverleft = false" :class="moveoverleft ? 'bg-primary-500/20!' : ''"
|
||||
x-on:dragover.prevent="moveoverleft = true"
|
||||
x-on:dragleave.prevent="moveoverleft = false"
|
||||
x-on:drop="moveoverleft = false" :class="moveoverleft ? 'bg-blue-600/20! rounded':''"
|
||||
x-on:drop.prevent="
|
||||
const id = event.dataTransfer.getData('text/plain');
|
||||
const target = event.target.closest('div');
|
||||
const target = event.target.closest('li');
|
||||
if(document.getElementById(id).getAttribute('mapper') !=target.getAttribute('mapper'))
|
||||
$wire.mountAction('left', { event_id: id, id: target.id });"
|
||||
draggable="true" mapper="left">
|
||||
$wire.mountAction('left', { event_id: id, id: target.id, mover:'left' });"
|
||||
draggable="true"
|
||||
mapper="left">
|
||||
|
||||
<div class="flex justify-center gap-4 w-full my-calendar">
|
||||
<div class="text-lime-500 text-wrap text-right">{{ $record->home->name }}</div>
|
||||
<div>-</div>
|
||||
<div class="text-sky-500 text-wrap">{{ $record->away->name }}</div>
|
||||
</div>
|
||||
|
||||
@include('filament.tables.columns.parts.move-botton')
|
||||
<div class="grid grid-cols-3 gap-4">
|
||||
@include('filament.tables.columns.parts.search-left', ['find' => $record->home->name, 'color' => 'away'])
|
||||
|
||||
@include('filament.tables.columns.parts.search-left', ['find' => $record->away->name, 'color' => 'home'])
|
||||
|
||||
@include('filament.tables.columns.parts.move-botton')
|
||||
</div>
|
||||
</li>
|
||||
@@ -1,16 +1,32 @@
|
||||
<li class="cursor-grab drag-and-drop__item" x-data="{ moveoverright: false }" id={{ $record->event_id }}
|
||||
<li class="cursor-grab drag-and-drop__item p-3 flex flex-1 gap-3 justify-between"
|
||||
id="{{ $record->event_id }}"
|
||||
x-data="{ moveoverright: false }"
|
||||
x-on:dragstart.self="
|
||||
dragging = true;
|
||||
event.dataTransfer.effectAllowed = 'move';
|
||||
event.dataTransfer.setData('text/plain', event.target.id);"
|
||||
x-on:dragover.prevent="moveoverright = true" x-on:dragleave.prevent="moveoverright = false"
|
||||
x-on:drop="moveoverright = false" :class="moveoverright ? 'bg-primary-500/20!' : ''"
|
||||
x-on:dragover.prevent="moveoverright = true"
|
||||
x-on:dragleave.prevent="moveoverright = false"
|
||||
x-on:drop="moveoverright = false" :class="moveoverright ? 'bg-blue-600/20! rounded':''"
|
||||
x-on:drop.prevent="
|
||||
const id = event.dataTransfer.getData('text/plain');
|
||||
const target = event.target.closest('li');
|
||||
if(document.getElementById(id).getAttribute('mapper') !=target.getAttribute('mapper'))
|
||||
$wire.mountAction('right', { id: id, event_id: target.id });"
|
||||
draggable="true" mapper="right">
|
||||
$wire.mountAction('right', { id: id, event_id: target.id, mover:'right' });"
|
||||
draggable="true"
|
||||
mapper="right">
|
||||
|
||||
@include('filament.tables.columns.parts.move-botton')
|
||||
<div class="grid grid-cols-3 gap-4">
|
||||
@include('filament.tables.columns.parts.move-botton')
|
||||
|
||||
@include('filament.tables.columns.parts.search-right', ['find' => $record->away, 'color' => 'home'])
|
||||
|
||||
@include('filament.tables.columns.parts.search-right', ['find' => $record->home, 'color' => 'away'])
|
||||
</div>
|
||||
|
||||
<div class="flex justify-center gap-4 w-full">
|
||||
<div class="text-sky-500 text-wrap text-right">{{ $record->home }}</div>
|
||||
<div>-</div>
|
||||
<div class="text-lime-500 text-wrap">{{ $record->away }}</div>
|
||||
</div>
|
||||
</li>
|
||||
@@ -1,3 +1,4 @@
|
||||
<div class="my-auto">
|
||||
<x-filament::button icon="phosphor-arrows-out" color="gray" size="xs" />
|
||||
{{-- <x-filament::icon-button icon="phosphor-arrows-out" size="xs" outlined/> --}}
|
||||
<x-phosphor-arrows-out class="h-4" color="gray"></x-phosphor-arrows-out>
|
||||
</div>
|
||||
@@ -0,0 +1,3 @@
|
||||
<div class="my-auto">
|
||||
<x-filament::icon-button icon="phosphor-magnifying-glass" color="{{ $color }}" outlined size="xs" x-on:click="search_right='{{ $find }}';" />
|
||||
</div>
|
||||
@@ -0,0 +1,3 @@
|
||||
<div class="my-auto">
|
||||
<x-filament::icon-button icon="phosphor-magnifying-glass" color="{{ $color }}" outlined size="xs" x-on:click="search_left='{{ $find }}'; " />
|
||||
</div>
|
||||
@@ -1,8 +1,6 @@
|
||||
@php
|
||||
use Illuminate\Support\Carbon;
|
||||
|
||||
dd($event, $mapper);
|
||||
|
||||
$e = Carbon::parse($event->starttime);
|
||||
|
||||
$m = Carbon::parse($mapper->starttime);
|
||||
@@ -54,7 +52,7 @@
|
||||
|
||||
<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">
|
||||
<x-filament::button color="gray" outlined @click="toggle()" wire:click="toggle()">
|
||||
<x-filament::button color="gray" outlined @click="toggle()" wire:click="toggle()" onkeydown="return event.key != 'Enter';">
|
||||
<div x-show="elements_swopped">
|
||||
<x-icon-paralell class="h-14 w-14 mx-auto" />
|
||||
</div>
|
||||
|
||||
@@ -70,7 +70,7 @@
|
||||
</x-slot>
|
||||
|
||||
<x-slot name="heading">
|
||||
<div class="flex justify-between items-center w-5xl">
|
||||
<div class="flex justify-between items-center w-screen pr-24">
|
||||
<x-sport-header>
|
||||
{{ auth()->user()->sport->name }} Event Mapper
|
||||
</x-sport-header>
|
||||
|
||||
Reference in new issue
Block a user