mapper wip
This commit is contained in:
1 parent
d635ebe563
commit
e04b12726d
8 files changed
+66
-7
No files matched your search
@@ -62,13 +62,13 @@ class Fixtures
|
|||||||
'starttime' => Carbon::createFromTimestamp((string) $row['time'])->toDateTimeString(),
|
'starttime' => Carbon::createFromTimestamp((string) $row['time'])->toDateTimeString(),
|
||||||
'home' => $row['home']['name'] ?? '',
|
'home' => $row['home']['name'] ?? '',
|
||||||
'home_id' => (int) $row['home']['id'],
|
'home_id' => (int) $row['home']['id'],
|
||||||
'home_cc' => $row['home']['cc'] ?? '',
|
'home_cc' => strtoupper($row['home']['cc']) ?? '',
|
||||||
'away' => $row['away']['name'] ?? '',
|
'away' => $row['away']['name'] ?? '',
|
||||||
'away_id' => (int) $row['away']['id'],
|
'away_id' => (int) $row['away']['id'],
|
||||||
'away_cc' => $row['away']['cc'] ?? '',
|
'away_cc' => strtoupper($row['away']['cc']) ?? '',
|
||||||
'group' => $row['league']['name'] ?? '',
|
'group' => $row['league']['name'] ?? '',
|
||||||
'group_id' => (int) $row['league']['id'] ?? 0,
|
'group_id' => (int) $row['league']['id'] ?? 0,
|
||||||
'group_cc' => $row['league']['cc'] ?? '',
|
'group_cc' => strtoupper($row['league']['cc']) ?? '',
|
||||||
];
|
];
|
||||||
|
|
||||||
Mapper::updateOrCreate(['event_id' => (int) $row['id']], $event);
|
Mapper::updateOrCreate(['event_id' => (int) $row['id']], $event);
|
||||||
|
|||||||
@@ -0,0 +1,10 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Filament\Tables\Columns;
|
||||||
|
|
||||||
|
use Filament\Tables\Columns\Column;
|
||||||
|
|
||||||
|
class MapperLeftColumn extends Column
|
||||||
|
{
|
||||||
|
protected string $view = 'filament.tables.columns.mapper-left-column';
|
||||||
|
}
|
||||||
@@ -0,0 +1,10 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Filament\Tables\Columns;
|
||||||
|
|
||||||
|
use Filament\Tables\Columns\Column;
|
||||||
|
|
||||||
|
class MapperRightColumn extends Column
|
||||||
|
{
|
||||||
|
protected string $view = 'filament.tables.columns.mapper-right-column';
|
||||||
|
}
|
||||||
@@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
namespace App\Livewire;
|
namespace App\Livewire;
|
||||||
|
|
||||||
|
use App\Filament\Tables\Columns\MapperLeftColumn;
|
||||||
use App\Models\Event;
|
use App\Models\Event;
|
||||||
use Filament\Actions\Concerns\InteractsWithActions;
|
use Filament\Actions\Concerns\InteractsWithActions;
|
||||||
use Filament\Actions\Contracts\HasActions;
|
use Filament\Actions\Contracts\HasActions;
|
||||||
@@ -24,8 +25,14 @@ class MapperLeft extends Component implements HasActions, HasSchemas, HasTable
|
|||||||
return $table
|
return $table
|
||||||
->query(Event::query())
|
->query(Event::query())
|
||||||
->columns([
|
->columns([
|
||||||
TextColumn::make('home.name')->alignRight(),
|
TextColumn::make('country.name')
|
||||||
TextColumn::make('away.name'),
|
->searchable()
|
||||||
|
->wrap()
|
||||||
|
->color('gray')
|
||||||
|
->label('Event')
|
||||||
|
->icon(fn ($record) => $record->country->icon)
|
||||||
|
->description(fn ($record) => $record->competition_group->name),
|
||||||
|
MapperLeftColumn::make('left')->label('NUH Events'),
|
||||||
])
|
])
|
||||||
->filters([
|
->filters([
|
||||||
// ...
|
// ...
|
||||||
|
|||||||
@@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
namespace App\Livewire;
|
namespace App\Livewire;
|
||||||
|
|
||||||
|
use App\Filament\Tables\Columns\MapperRightColumn;
|
||||||
use App\Models\Mapper;
|
use App\Models\Mapper;
|
||||||
use Filament\Actions\Concerns\InteractsWithActions;
|
use Filament\Actions\Concerns\InteractsWithActions;
|
||||||
use Filament\Actions\Contracts\HasActions;
|
use Filament\Actions\Contracts\HasActions;
|
||||||
@@ -24,8 +25,14 @@ class MapperRight extends Component implements HasActions, HasSchemas, HasTable
|
|||||||
return $table
|
return $table
|
||||||
->query(Mapper::query())
|
->query(Mapper::query())
|
||||||
->columns([
|
->columns([
|
||||||
TextColumn::make('home')->alignRight(),
|
MapperRightColumn::make('right'),
|
||||||
TextColumn::make('away'),
|
// TextColumn::make('country_betsapi.name')
|
||||||
|
// ->searchable()
|
||||||
|
// ->wrap()
|
||||||
|
// ->color('gray')
|
||||||
|
// ->label('Event')
|
||||||
|
// ->icon(fn ($record) => $record->country_betsapi->icon)
|
||||||
|
// ->description(fn ($record) => $record->group),
|
||||||
])
|
])
|
||||||
->filters([
|
->filters([
|
||||||
// ...
|
// ...
|
||||||
|
|||||||
@@ -22,4 +22,9 @@ class Mapper extends Model
|
|||||||
'away_id',
|
'away_id',
|
||||||
'away_cc',
|
'away_cc',
|
||||||
];
|
];
|
||||||
|
|
||||||
|
public function country_betsapi()
|
||||||
|
{
|
||||||
|
return $this->belongsTo(Country::class, 'group_cc', 'iso2');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -0,0 +1,8 @@
|
|||||||
|
<div x-data="{}" x-sortable.x-on:end="console.log('Dropped!', $event.detail)" class="w-full">
|
||||||
|
<div x-sortable-handle x-sortable-item class="bg-white p-4 cursor-grab flex flex-row flex justify-between">
|
||||||
|
<div class="basis-9/20 text-right">{{ $record->home->name }}</div>
|
||||||
|
<div class="basis-1/20 text-center">-</div>
|
||||||
|
<div class="basis-9/20">{{ $record->away->name }}</div>
|
||||||
|
<div class="basis-1/20"> <x-filament::icon-button icon="heroicon-o-arrows-pointing-out" /></div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
@@ -0,0 +1,12 @@
|
|||||||
|
<div x-data="{}" x-sortable.x-on:end="console.log('Dropped!', $event.detail)" class="w-full">
|
||||||
|
<div x-sortable-handle x-sortable-item class="bg-white p-2 cursor-grab grid grid-cols-10 grid-rows-2 gap-1">
|
||||||
|
<div class="row-span-2 text-left"> <x-filament::icon-button icon="heroicon-o-arrows-pointing-out"
|
||||||
|
class="my-auto" /></div>
|
||||||
|
<div class="col-span-4 text-right">{{ $record->home }}</div>
|
||||||
|
<div class="text-center">-</div>
|
||||||
|
<div class="col-span-4">{{ $record->away }}</div>
|
||||||
|
<div><x-flag-country-at class="h5 w-5" /></div>
|
||||||
|
<div class="col-span-8">{{ $record->country_betsapi?->name }}
|
||||||
|
{{ $record->group }}</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
Reference in new issue
Block a user