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');
|
||||
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user