mapping search wip (stuck)
This commit is contained in:
1 parent
ea91af51fa
commit
b475d78f43
14 files changed
+126
-33
No files matched your search
@@ -47,14 +47,17 @@ class Bwin
|
||||
foreach ($data['results'] as $event) {
|
||||
|
||||
$betsapi_id = $event['our_event_id'] ?? 0;
|
||||
|
||||
$betradar_id = $event['BetRadarId'] ?? 0;
|
||||
|
||||
$bwin_id = $event['Id'] ?? 0;
|
||||
|
||||
if ($debug) {
|
||||
Notice::note(["Betsapi ID : $betsapi_id", "Betradar ID : $betradar_id", "Bwin ID : $bwin_id"]);
|
||||
}
|
||||
if ($betradar_id && $betsapi_id) {
|
||||
|
||||
if ($debug) {
|
||||
Notice::note(["Betsapi ID : $betsapi_id", "Betradar ID : $betradar_id", "Bwin ID : $bwin_id"]);
|
||||
}
|
||||
|
||||
if ($betradar_id) {
|
||||
Event::where('betsapi_id', (int) $betsapi_id)->update(['betradar_id' => $betradar_id, 'bwin_id' => $bwin_id]);
|
||||
|
||||
Mapper::where('event_id', $betsapi_id)->delete();
|
||||
|
||||
@@ -4,6 +4,7 @@ namespace App\Console\Commands\Grapper\Betsapi;
|
||||
|
||||
use App\Console\Commands\Curl;
|
||||
use App\Console\Commands\Nuh;
|
||||
use App\Models\Event;
|
||||
use App\Models\Mapper;
|
||||
use App\Models\Sport;
|
||||
use App\Utilities\Notice;
|
||||
@@ -33,7 +34,7 @@ class Fixtures
|
||||
$total = 1;
|
||||
foreach ($sportmap as $sport_id => $betsapi_sport_id) {
|
||||
|
||||
$sport_url = str_replace('###sport_id###', $sport_id, $base_url);
|
||||
$sport_url = str_replace('###sport_id###', $betsapi_sport_id, $base_url);
|
||||
|
||||
$page = 1;
|
||||
while ($page <= $total) {
|
||||
@@ -71,8 +72,13 @@ class Fixtures
|
||||
'group_id' => (int) $row['league']['id'] ?? 0,
|
||||
'group_cc' => strtoupper($row['league']['cc']) ?? '',
|
||||
];
|
||||
|
||||
Mapper::updateOrCreate(['event_id' => (int) $row['id']], $event);
|
||||
$event_id = (int) $row['id'];
|
||||
$match_id = Event::where('betsapi_id', $event_id)->value('id');
|
||||
if ($match_id) {
|
||||
Mapper::where('event_id', $event_id)->delete();
|
||||
} else {
|
||||
Mapper::updateOrCreate(['event_id' => $event_id], $event);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -28,6 +28,15 @@ class Odds
|
||||
Notice::note('txodd odd sport: '.Nuh::$options['sport_id'], 'b');
|
||||
}
|
||||
|
||||
/**
|
||||
* Delete
|
||||
*/
|
||||
$info = Event::where('starttime', '<', Carbon::now()->toDateTimeString())->delete();
|
||||
|
||||
if ($debug) {
|
||||
Notice::note("Deleted: $info");
|
||||
}
|
||||
|
||||
/*************************************************
|
||||
* SINGLE SOCCER
|
||||
* https://xml2.txodds.com/feed/odds/xml.php?ident=betaid1&passwd=Dy59vpRC&peid=3118930
|
||||
|
||||
@@ -26,19 +26,24 @@ class MapperLeft extends Component implements HasActions, HasSchemas, HasTable
|
||||
use InteractsWithSchemas;
|
||||
use InteractsWithTable;
|
||||
|
||||
protected $listeners = [
|
||||
'reload_data' => '$refresh',
|
||||
];
|
||||
|
||||
public function table(Table $table): Table
|
||||
{
|
||||
return $table
|
||||
->query(Event::query()->where('betradar_id', 0))
|
||||
->columns([
|
||||
MapperLeftColumn::make('left')->label(''),
|
||||
])->searchable(['home.name', 'away.name'])
|
||||
])
|
||||
->searchable(['competition_group.name', 'home.name', 'away.name'])
|
||||
->defaultPaginationPageOption(5)
|
||||
->filters([
|
||||
SelectFilter::make('country_id')
|
||||
->relationship('country', 'name')
|
||||
->options(
|
||||
fn (Builder $query) => $query->whereNotNull('events.country_id')->where('events.betradar_id', 0)->where('events.starttime', '>', Carbon::now())
|
||||
fn (Builder $query) => $query->where('countries.tx_id', 'events.country_id')->where('events.betradar_id', 0)->where('events.starttime', '>', Carbon::now())
|
||||
)
|
||||
->searchable()
|
||||
->preload()
|
||||
@@ -63,11 +68,19 @@ class MapperLeft extends Component implements HasActions, HasSchemas, HasTable
|
||||
->placeholder('League')
|
||||
->label('Leagues'),
|
||||
], layout: FiltersLayout::AboveContent)
|
||||
->hiddenFilterIndicators()
|
||||
// ->hiddenFilterIndicators()
|
||||
->filtersFormColumns(3)
|
||||
->deferFilters(false)
|
||||
->toolbarActions([
|
||||
// ...
|
||||
Action::make('reload_data_left')
|
||||
->hiddenLabel()
|
||||
->color('gray')
|
||||
->icon('phosphor-x')
|
||||
->action(function (Component $livewire) {
|
||||
$livewire->resetTableFiltersForm(); // Clears all filters
|
||||
$livewire->tableSearch = ''; // Clears the main search bar
|
||||
$this->dispatch('reload_data');
|
||||
}),
|
||||
]);
|
||||
}
|
||||
|
||||
|
||||
@@ -24,6 +24,10 @@ class MapperRight extends Component implements HasActions, HasSchemas, HasTable
|
||||
use InteractsWithSchemas;
|
||||
use InteractsWithTable;
|
||||
|
||||
protected $listeners = [
|
||||
'reload_data' => '$refresh',
|
||||
];
|
||||
|
||||
public function table(Table $table): Table
|
||||
{
|
||||
return $table
|
||||
@@ -49,9 +53,20 @@ class MapperRight extends Component implements HasActions, HasSchemas, HasTable
|
||||
->placeholder('League')
|
||||
->label('Leagues'),
|
||||
], layout: FiltersLayout::AboveContent)
|
||||
->hiddenFilterIndicators()
|
||||
// ->hiddenFilterIndicators()
|
||||
->filtersFormColumns(3)
|
||||
->deferFilters(false);
|
||||
->deferFilters(false)
|
||||
->toolbarActions([
|
||||
Action::make('reload_data')
|
||||
->hiddenLabel()
|
||||
->color('gray')
|
||||
->icon('phosphor-x')
|
||||
->action(function (Component $livewire) {
|
||||
$livewire->resetTableFiltersForm(); // Clears all filters
|
||||
$livewire->tableSearch = ''; // Clears the main search bar
|
||||
$this->dispatch('reload_data');
|
||||
}),
|
||||
]);
|
||||
}
|
||||
|
||||
public function rightAction(): Action
|
||||
|
||||
@@ -41,21 +41,21 @@ class Event extends Model
|
||||
|
||||
public function group()
|
||||
{
|
||||
return $this->hasOne(Group::class, 'id', 'group_id');
|
||||
return $this->belongsTo(Group::class);
|
||||
}
|
||||
|
||||
public function competition_group()
|
||||
{
|
||||
return $this->hasOne(CompetitionGroup::class, 'id', 'competition_group_id');
|
||||
return $this->belongsTo(CompetitionGroup::class);
|
||||
}
|
||||
|
||||
public function home()
|
||||
{
|
||||
return $this->hasOne(Element::class, 'id', 'home_id');
|
||||
return $this->belongsTo(Element::class);
|
||||
}
|
||||
|
||||
public function away()
|
||||
{
|
||||
return $this->hasOne(Element::class, 'id', 'away_id');
|
||||
return $this->belongsTo(Element::class);
|
||||
}
|
||||
}
|
||||
@@ -3,6 +3,7 @@
|
||||
namespace App\Models;
|
||||
|
||||
use App\Models\Scopes\ClientScope;
|
||||
use App\Models\Scopes\SportScope;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class MultilineClient extends Model
|
||||
@@ -34,5 +35,8 @@ class MultilineClient extends Model
|
||||
protected static function booted(): void
|
||||
{
|
||||
static::addGlobalScope(new ClientScope);
|
||||
|
||||
static::addGlobalScope(new SportScope);
|
||||
|
||||
}
|
||||
}
|
||||
@@ -31,3 +31,22 @@ button[wire\:click="resetTableFiltersForm"] {
|
||||
.fi-ta-header-cell-id {
|
||||
@apply !text-center
|
||||
}
|
||||
|
||||
|
||||
#mapper {
|
||||
@layer components {
|
||||
.fi-ta-ctn {
|
||||
& .fi-ta-header-toolbar {
|
||||
@apply !flex-row-reverse;
|
||||
flex-wrap: inherit;
|
||||
}
|
||||
}
|
||||
|
||||
.fi-pagination {
|
||||
& .fi-pagination-overview {
|
||||
display: block;
|
||||
font-size: 11px;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,11 +1,11 @@
|
||||
<li class="bg-white dark:bg-gray-900 w-full h-full overflow-hidden p-1 cursor-grab flex space-x-10 drag-and-drop__item"
|
||||
<li class="bg-white dark:bg-gray-900 w-full h-full overflow-hidden p-1 cursor-grab flex space-x-4 drag-and-drop__item"
|
||||
x-data="{ moveoverleft: false }" id={{ $record->id }}
|
||||
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-green-500/10!' : ''"
|
||||
x-on:drop="moveoverleft = false" :class="moveoverleft ? 'bg-primary-500/20!' : ''"
|
||||
x-on:drop.prevent="
|
||||
const id = event.dataTransfer.getData('text/plain');
|
||||
const target = event.target.closest('li');
|
||||
@@ -13,14 +13,19 @@
|
||||
$wire.mountAction('left', { event_id: id, match_id: target.id });"
|
||||
draggable="true" mapper="left">
|
||||
|
||||
<div class="w-6 flex-none mx-auto my-auto">
|
||||
@if ($record->country->iso2)
|
||||
<div class="w-10 flex-none mx-auto my-auto">
|
||||
@if ($record->country?->iso2)
|
||||
<x-icon name="flag-country-{{ $record->country->iso2 }}" class="h5 w-5" />
|
||||
@else
|
||||
@elseif($record->country?->icon)
|
||||
<x-icon name="{{ $record->country->icon }}" class="h5 w-5" />
|
||||
@endif
|
||||
</div>
|
||||
|
||||
@include('filament.tables.columns.parts.search-button', [
|
||||
'target' => 'input-2',
|
||||
'find' => $record->home->name,
|
||||
])
|
||||
|
||||
<div class="flex-1 flex flex-col justify-center space-y-0">
|
||||
<div class="flex justify-around text-gray-600 dark:text-gray-500">
|
||||
<div>{{ $record->starttime }}</div>
|
||||
@@ -38,7 +43,11 @@
|
||||
|
||||
</div>
|
||||
|
||||
<div class="w-6 flex-none my-auto">
|
||||
<x-filament::icon-button icon="heroicon-o-arrows-pointing-out" />
|
||||
</div>
|
||||
@include('filament.tables.columns.parts.search-button', [
|
||||
'target' => 'input-2',
|
||||
'find' => $record->away->name,
|
||||
])
|
||||
|
||||
@include('filament.tables.columns.parts.move-botton')
|
||||
|
||||
</li>
|
||||
@@ -1,24 +1,26 @@
|
||||
<li class="bg-white dark:bg-gray-900 w-full h-full overflow-hidden p-1 cursor-grab flex
|
||||
space-x-10 drag-and-drop__item"
|
||||
space-x-4 drag-and-drop__item"
|
||||
x-data="{ moveoverright: false }" id={{ $record->event_id }}
|
||||
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-blue-500/10!' : ''"
|
||||
x-on:drop="moveoverright = false" :class="moveoverright ? 'bg-primary-500/20!' : ''"
|
||||
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', { match_id: id, event_id: target.id });"
|
||||
draggable="true" mapper="right">
|
||||
{{-- console.log(document.getElementById(id).getAttribute('mapper'), id, target.id, target.getAttribute('mapper'));" --}}
|
||||
{{-- $dispatch('map-checker', { match_id: id, event_id:target.id });" --}}
|
||||
|
||||
<div class="w-6 flex-none my-auto">
|
||||
<x-filament::icon-button icon="heroicon-o-arrows-pointing-out" />
|
||||
</div>
|
||||
@include('filament.tables.columns.parts.move-botton')
|
||||
|
||||
@include('filament.tables.columns.parts.search-button', [
|
||||
'target' => 'input-1',
|
||||
'find' => $record->home,
|
||||
])
|
||||
|
||||
<div class="flex-1 flex flex-col justify-center space-y-0">
|
||||
<div class="flex justify-around text-gray-600 dark:text-gray-500">
|
||||
<div>{{ $record->starttime }}</div>
|
||||
@@ -35,6 +37,11 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@include('filament.tables.columns.parts.search-button', [
|
||||
'target' => 'input-1',
|
||||
'find' => $record->away,
|
||||
])
|
||||
|
||||
<div class="w-6 flex-none mx-auto my-auto">
|
||||
@if ($record->group_cc)
|
||||
<x-icon name="flag-country-{{ $record->group_cc }}" class="h5 w-5" />
|
||||
|
||||
@@ -0,0 +1,3 @@
|
||||
<div class="my-auto">
|
||||
<x-filament::button icon="heroicon-o-arrows-pointing-out" outlined size="xs" />
|
||||
</div>
|
||||
@@ -0,0 +1,5 @@
|
||||
<div class="my-auto">
|
||||
<x-filament::button icon="phosphor-magnifying-glass" color="gray" size="xs"
|
||||
x-on:click="document.getElementById('{{ $target }}').focus();
|
||||
document.getElementById('{{ $target }}').value = '{{ $find }}';" />
|
||||
</div>
|
||||
@@ -31,7 +31,7 @@
|
||||
</div>
|
||||
</x-slot>
|
||||
|
||||
<div class="grid grid-cols-2 gap-4 drag-and-drop text-sm" x-data="{ event_id: 0, match_id: 0, overleftcolumn: false, overrightcolumn: false }">
|
||||
<div id="mapper" class="grid grid-cols-2 gap-4 drag-and-drop text-sm" x-data="{ event_id: 0, match_id: 0, overleftcolumn: false, overrightcolumn: false }">
|
||||
<div>
|
||||
@livewire('mapper-left')
|
||||
</div>
|
||||
|
||||
Whitespace-only changes.
Reference in new issue
Block a user