mapper new

This commit is contained in:
salam committed 2026-02-04 17:09:03 +01:00
1 parent 3a289dd776
commit c5118a4fd0
12 files changed
+94 -119

No files matched your search

+11 -57
View File
@@ -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()