popup and grapper wip

This commit is contained in:
salam committed 2025-12-22 15:46:04 +01:00
1 parent a3c9f16550
commit c9588f39b6
18 files changed
+656 -156248

No files matched your search

@@ -0,0 +1,69 @@
<?php
namespace App\Filament\Tables\Columns;
use App\Models\Odds3way;
use Filament\Tables\Columns\Column;
class Columns3way extends Column
{
protected string $view = 'filament.tables.columns.columns_3way';
protected ?array $multiline;
protected ?array $fumetto;
public function loadData($record, $multiline_client)
{
$res = Odds3way::with('bookmaker')->where('event_id', $record->id)->get();
$this->fumetto = [];
$this->multiline = [];
foreach ($res as $item) {
$this->fumetto[] = $item;
foreach ($multiline_client as $slot => $bookmaker) {
if ($item->bookmaker_id == $bookmaker->bookmaker_id) {
$this->multiline[$slot] = $item;
}
}
}
// $this->multiline = [];
// foreach ($multiline_client as $slot => $bookmaker) {
// $open = true;
// foreach ($this->fumetto as $item) {
// if ($item['bookmaker_id'] == $bookmaker->bookmaker_id) {
// $this->multiline[$slot] = $item;
// $open = false;
// }
// }
// if ($open) {
// $item = new stdClass;
// $item['icon'] = $bookmaker->bookmaker->icon;
// $item['h3w'] = 0;
// $item['d3w'] = 0;
// $item['a3w'] = 0;
// $item['margin'] = 0;
// $item['bookmaker_id'] = $bookmaker->bookmaker_id;
// $this->multiline[$slot] = $item;
// }
// }
}
public function getMultilines(): ?array
{
return $this->multiline;
}
public function getFumetto()
{
return $this->fumetto;
}
}
+10
View File
@@ -0,0 +1,10 @@
<?php
namespace App\Filament\Tables\Columns;
use Filament\Tables\Columns\Column;
class MatchIds extends Column
{
protected string $view = 'filament.tables.columns.match-ids';
}
@@ -1,113 +0,0 @@
<?php
namespace App\Filament\Tables\Columns;
use Filament\Tables\Columns\Column;
use Illuminate\Support\Facades\DB;
use stdClass;
class MultilineColumn extends Column
{
protected string $view = 'filament.tables.columns.multiline.main';
protected ?array $slots;
protected $settings;
public function loadSlots($event_id, $bookmakers)
{
$systemSettings = app('systemSettings');
$this->settings = $systemSettings[auth()->user()->multiline_setting_id];
$odds = DB::table($this->settings->table)->where('event_id', $event_id)->get();
$this->makeSlots($odds, $bookmakers);
}
public function has3Columns(): ?int
{
return $this->settings->has_3_columns;
}
public function getSlots(): ?array
{
return $this->slots;
}
public function makeSlots(&$odds, $bookmakers)
{
$multilines = [];
foreach ($bookmakers as $slot => $bookmaker) {
$open = true;
foreach ($odds as $item) {
if ($item->bookmaker_id == $bookmaker->bookmaker_id) {
$item->icon = $bookmaker->bookmaker->icon;
$item->table = $this->settings['table'];
switch ($this->settings->table) {
case 'odds_2ways':
case 'odds_2ways_s1':
$item->a = $item->h3w;
$item->c = $item->a3w;
break;
case 'odds_3ways':
$item->a = $item->h3w;
$item->b = $item->d3w;
$item->c = $item->a3w;
break;
case 'odds_dc':
$item->a = $item->dc1x;
$item->b = $item->dc12;
$item->c = $item->dc2x;
break;
case 'odds_dnb':
$item->a = $item->dnb1;
$item->c = $item->dnb2;
break;
case 'odds_ggng':
$item->a = $item->gg;
$item->c = $item->ng;
break;
case 'odds_handicaps':
case 'odds_handicaps_q1':
$item->a = $item->home;
$item->b = $item->away;
$item->c = $item->handicap;
break;
case 'odds_qualify':
$item->a = $item->htq;
$item->c = $item->atq;
break;
case 'odds_totals':
case 'odds_totals_q1':
$item->a = $item->over;
$item->b = $item->under;
$item->c = $item->total;
break;
default:
// code...
break;
}
$multilines[$slot] = $item;
$open = false;
}
}
if ($open) {
$item = new stdClass;
$item->icon = $bookmaker->bookmaker->icon;
$item->bookmaker_id = $bookmaker->bookmaker_id;
$item->a = 0;
$item->b = 0;
$item->c = 0;
$item->margin = 0;
$multilines[$slot] = $item;
}
}
$this->slots = $multilines;
}
}
@@ -0,0 +1,70 @@
<?php
namespace App\Filament\Tables\Columns;
use App\Models\Odds3way;
use App\Models\OddsDc;
use App\Models\OddsDnb;
use Filament\Tables\Columns\Column;
class MultilineColumn extends Column
{
protected string $view = 'filament.tables.columns.multiline.main';
protected ?array $fumetto;
protected ?array $settings;
public function has3Columns(): ?int
{
return $this->settings->has_3_columns;
}
public function getFumetto()
{
return $this->fumetto;
}
public function laodFumetto($event_id)
{
$systemSettings = app('systemSettings');
$this->settings = $systemSettings[auth()->user()->multiline_setting_id];
switch ($this->settings->table) {
case 'odds_2ways':
$this->fumetto = Odds2way::with('bookmaker')->where('event_id', $event_id)->get();
break;
case 'odds_2ways_s1':
$this->fumetto = Odds2wayS1::with('bookmaker')->where('event_id', $event_id)->get();
break;
case 'odds_3ways':
$this->fumetto = Odds3way::with('bookmaker')->where('event_id', $event_id)->get();
break;
case 'odds_dc':
$this->fumetto = OddsDc::with('bookmaker')->where('event_id', $event_id)->get();
break;
case 'odds_dnb':
$this->fumetto = OddsDnb::with('bookmaker')->where('event_id', $event_id)->get();
break;
case 'odds_ggng':
$this->fumetto = OddsGgng::with('bookmaker')->where('event_id', $event_id)->get();
break;
case 'odds_handicaps':
$this->fumetto = OddsHandicap::with('bookmaker')->where('event_id', $event_id)->get();
break;
case 'odds_handicaps_q1':
$this->fumetto = OddsHandicapQ1::with('bookmaker')->where('event_id', $event_id)->get();
break;
case 'odds_qualify':
$this->fumetto = OddsQualify::with('bookmaker')->where('event_id', $event_id)->get();
break;
case 'odds_totals':
$this->fumetto = OddsTotal::with('bookmaker')->where('event_id', $event_id)->get();
break;
case 'odds_totals_q1':
$this->fumetto = OddsTotalQ1::with('bookmaker')->where('event_id', $event_id)->get();
break;
}
}
}