wip del err
This commit is contained in:
1 parent
812736ca9a
commit
9bcd4432c6
1210 files changed
-220941
No files matched your search
@@ -1,31 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Tables\Columns;
|
||||
|
||||
use Filament\Tables\Columns\Column;
|
||||
|
||||
class BookmakerIcon extends Column
|
||||
{
|
||||
protected string $view = 'filament.tables.columns.bookmaker-icon';
|
||||
|
||||
protected ?string $size = null;
|
||||
|
||||
public function size(?string $size): static
|
||||
{
|
||||
$this->size = $size;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getSize(): ?string
|
||||
{
|
||||
switch ($this->size) {
|
||||
case 'xl':
|
||||
return 'h-6 w-30';
|
||||
case 'lg':
|
||||
return 'h-5 w-24';
|
||||
default:
|
||||
return 'h-4 w-18';
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,481 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Tables\Columns;
|
||||
|
||||
use App\Filament\Resources\Events\Tables\EventsTable;
|
||||
use App\Models\Bookmaker;
|
||||
use Filament\Tables\Columns\Column;
|
||||
|
||||
class ColumnOdds extends Column
|
||||
{
|
||||
protected string $view = 'filament.tables.columns.column-odds';
|
||||
|
||||
public $data;
|
||||
|
||||
protected $filter;
|
||||
|
||||
protected $bettype;
|
||||
|
||||
public $slots;
|
||||
|
||||
public $empty_slots_icons;
|
||||
|
||||
public $bookmaker;
|
||||
|
||||
protected $max;
|
||||
|
||||
protected $min;
|
||||
|
||||
protected $columns;
|
||||
|
||||
protected $client;
|
||||
|
||||
protected $filter_compare_bookmaker;
|
||||
|
||||
protected $compare_bookmaker_id;
|
||||
|
||||
protected $filter_compare_mode;
|
||||
|
||||
protected $favorits = [];
|
||||
|
||||
public $compare;
|
||||
|
||||
public $partner;
|
||||
|
||||
protected ?array $odds_labels;
|
||||
|
||||
protected bool $state = true;
|
||||
|
||||
public function loadData($record)
|
||||
{
|
||||
$this->getData($record);
|
||||
|
||||
$this->setCompareDifferences();
|
||||
$this->favorits = ['h2w' => 0, 'a2w' => 0, 'h3w' => 0, 'd3w' => 0, 'a3w' => 0, 'home' => 0, 'away' => 0, 'margin' => 0];
|
||||
if ($this->filter_compare_bookmaker) {
|
||||
if ($this->filter_compare_mode == 'Favorit') {
|
||||
$this->setFavorits($record);
|
||||
} elseif ($this->filter_compare_mode == 'X') {
|
||||
$this->favorits = ['h2w' => 0, 'a2w' => 0, 'h3w' => 0, 'd3w' => 1, 'a3w' => 0, 'home' => 0, 'away' => 0, 'margin' => 0];
|
||||
} elseif ($this->filter_compare_mode == 'Margin') {
|
||||
$this->favorits = ['h2w' => 0, 'a2w' => 0, 'h3w' => 0, 'd3w' => 0, 'a3w' => 0, 'home' => 0, 'away' => 0, 'margin' => 1];
|
||||
}
|
||||
}
|
||||
|
||||
if (! $this->data) {
|
||||
$this->state = false;
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
$this->setSlots();
|
||||
|
||||
$this->has_data = count($this->data);
|
||||
|
||||
$this->compare_bookmaker_id = 0;
|
||||
|
||||
$order = $this->bookmaker;
|
||||
$this->data = $this->data->sortBy(function ($model) use ($order) {
|
||||
return array_search($model->bookmaker_id, $order);
|
||||
});
|
||||
|
||||
$this->setCompare($record);
|
||||
|
||||
return $this->data;
|
||||
}
|
||||
|
||||
/*******************************
|
||||
* PARENT
|
||||
*******************************/
|
||||
public function bettype(string $bettype): static
|
||||
{
|
||||
$this->bettype = $bettype;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function setCompareDifferences()
|
||||
{
|
||||
$filters = $this->getTable()->getFilters();
|
||||
$filters = [$filters];
|
||||
foreach ($filters as $value) {
|
||||
$filter = $value['events']->getState();
|
||||
}
|
||||
if ($filter['filter_compare_differences'] != '') {
|
||||
$tmp = explode('-', $filter['filter_compare_differences']);
|
||||
$this->filter_compare_bookmaker = (int) $tmp[2];
|
||||
$this->filter_compare_mode = $tmp[0];
|
||||
} else {
|
||||
$this->filter_compare_bookmaker = 0;
|
||||
}
|
||||
}
|
||||
|
||||
/*******************************
|
||||
* GETTER
|
||||
*******************************/
|
||||
|
||||
public function getCompareBookmaker()
|
||||
{
|
||||
return $this->filter_compare_bookmaker;
|
||||
}
|
||||
|
||||
public function getBettype()
|
||||
{
|
||||
return $this->bettype;
|
||||
}
|
||||
|
||||
public function getColumns()
|
||||
{
|
||||
return $this->columns;
|
||||
}
|
||||
|
||||
public function getSlots()
|
||||
{
|
||||
if (auth()->user()->is_multiline_direct) {
|
||||
return $this->bookmaker;
|
||||
} else {
|
||||
return $this->slots;
|
||||
}
|
||||
}
|
||||
|
||||
public function getState(): bool
|
||||
{
|
||||
return $this->state;
|
||||
}
|
||||
|
||||
public function getClient()
|
||||
{
|
||||
return $this->client;
|
||||
}
|
||||
|
||||
public function getCompare()
|
||||
{
|
||||
return $this->compare;
|
||||
}
|
||||
|
||||
public function getPartner()
|
||||
{
|
||||
return $this->partner;
|
||||
}
|
||||
|
||||
public function getMax()
|
||||
{
|
||||
return $this->max;
|
||||
}
|
||||
|
||||
public function getMin()
|
||||
{
|
||||
return $this->min;
|
||||
}
|
||||
|
||||
public function getFavorits()
|
||||
{
|
||||
return $this->favorits;
|
||||
}
|
||||
|
||||
public function getCompareBookmakerId()
|
||||
{
|
||||
return $this->compare_bookmaker_id;
|
||||
}
|
||||
|
||||
public function getData($record)
|
||||
{
|
||||
$this->client = null;
|
||||
$this->partner = null;
|
||||
$this->data = null;
|
||||
switch ($this->bettype) {
|
||||
case 'odds_2ways':
|
||||
$this->data = $record->odds_2ways;
|
||||
$this->client = $record->odds_2ways->where('bookmaker_id', auth()->user()->bookmaker_id)->first();
|
||||
$this->partner = $record->odds_2ways->where('bookmaker_id', auth()->user()->partner_bookmaker_id)->first();
|
||||
break;
|
||||
|
||||
case 'odds_2ways_s1':
|
||||
$this->data = $record->odds_2ways_s1;
|
||||
$this->client = $record->odds_2ways_s1->where('bookmaker_id', auth()->user()->bookmaker_id)->first();
|
||||
$this->partner = $record->odds_2ways_s1->where('bookmaker_id', auth()->user()->partner_bookmaker_id)->first();
|
||||
break;
|
||||
|
||||
case 'odds_3ways':
|
||||
$this->data = $record->odds_3ways;
|
||||
$this->client = $record->odds_3ways->where('bookmaker_id', auth()->user()->bookmaker_id)->first();
|
||||
$this->partner = $record->odds_3ways->where('bookmaker_id', auth()->user()->partner_bookmaker_id)->first();
|
||||
break;
|
||||
|
||||
case 'odds_3ways_ht':
|
||||
$this->data = $record->odds_3ways_ht;
|
||||
$this->client = $record->odds_3ways_ht->where('bookmaker_id', auth()->user()->bookmaker_id)->first();
|
||||
$this->partner = $record->odds_3ways_ht->where('bookmaker_id', auth()->user()->partner_bookmaker_id)->first();
|
||||
break;
|
||||
|
||||
case 'odds_dc':
|
||||
$this->data = $record->odds_dc;
|
||||
$this->client = $record->odds_dc->where('bookmaker_id', auth()->user()->bookmaker_id)->first();
|
||||
$this->partner = $record->odds_dc->where('bookmaker_id', auth()->user()->partner_bookmaker_id)->first();
|
||||
break;
|
||||
|
||||
case 'odds_dnb':
|
||||
$this->data = $record->odds_dnb;
|
||||
$this->client = $record->odds_dnb->where('bookmaker_id', auth()->user()->bookmaker_id)->first();
|
||||
$this->partner = $record->odds_dnb->where('bookmaker_id', auth()->user()->partner_bookmaker_id)->first();
|
||||
break;
|
||||
|
||||
case 'odds_ggng':
|
||||
$this->data = $record->odds_ggng;
|
||||
$this->client = $record->odds_ggng->where('bookmaker_id', auth()->user()->bookmaker_id)->first();
|
||||
$this->partner = $record->odds_ggng->where('bookmaker_id', auth()->user()->partner_bookmaker_id)->first();
|
||||
break;
|
||||
|
||||
case 'odds_points':
|
||||
$this->data = $record->odds_points;
|
||||
$this->client = $record->odds_points->where('bookmaker_id', auth()->user()->bookmaker_id)->first();
|
||||
$this->partner = $record->odds_points->where('bookmaker_id', auth()->user()->partner_bookmaker_id)->first();
|
||||
break;
|
||||
|
||||
case 'odds_points_ht':
|
||||
$this->data = $record->odds_points_ht;
|
||||
$this->client = $record->odds_points_ht->where('bookmaker_id', auth()->user()->bookmaker_id)->first();
|
||||
$this->partner = $record->odds_points_ht->where('bookmaker_id', auth()->user()->partner_bookmaker_id)->first();
|
||||
break;
|
||||
|
||||
case 'odds_points_q1':
|
||||
$this->data = $record->odds_points_q1;
|
||||
$this->client = $record->odds_points_q1->where('bookmaker_id', auth()->user()->bookmaker_id)->first();
|
||||
$this->partner = $record->odds_points_q1->where('bookmaker_id', auth()->user()->partner_bookmaker_id)->first();
|
||||
break;
|
||||
|
||||
case 'odds_totals':
|
||||
$this->data = $record->odds_totals;
|
||||
$this->client = $record->odds_totals->where('bookmaker_id', auth()->user()->bookmaker_id)->first();
|
||||
$this->partner = $record->odds_totals->where('bookmaker_id', auth()->user()->partner_bookmaker_id)->first();
|
||||
break;
|
||||
|
||||
case 'odds_totals_ht':
|
||||
$this->data = $record->odds_totals_ht;
|
||||
$this->client = $record->odds_totals_ht->where('bookmaker_id', auth()->user()->bookmaker_id)->first();
|
||||
$this->partner = $record->odds_totals_ht->where('bookmaker_id', auth()->user()->partner_bookmaker_id)->first();
|
||||
break;
|
||||
|
||||
case 'odds_totals_q1':
|
||||
$this->data = $record->odds_totals_q1;
|
||||
$this->client = $record->odds_totals_q1->where('bookmaker_id', auth()->user()->bookmaker_id)->first();
|
||||
$this->partner = $record->odds_totals_q1->where('bookmaker_id', auth()->user()->partner_bookmaker_id)->first();
|
||||
break;
|
||||
|
||||
case 'odds_tq':
|
||||
$this->data = $record->odds_tq;
|
||||
$this->client = $record->odds_tq->where('bookmaker_id', auth()->user()->bookmaker_id)->first();
|
||||
$this->partner = $record->odds_tq->where('bookmaker_id', auth()->user()->partner_bookmaker_id)->first();
|
||||
break;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public function getOddsLabels()
|
||||
{
|
||||
switch ($this->bettype) {
|
||||
case 'odds_tq':
|
||||
case 'odds_2ways':
|
||||
case 'odds_2ways_s1':
|
||||
case 'odds_dnb':
|
||||
$this->columns = 2;
|
||||
$this->odds_labels = ['1', '2'];
|
||||
break;
|
||||
|
||||
case 'odds_3ways':
|
||||
case 'odds_3ways_ht':
|
||||
$this->columns = 3;
|
||||
$this->odds_labels = ['1', 'X', '2'];
|
||||
break;
|
||||
|
||||
case 'odds_dc':
|
||||
$this->columns = 3;
|
||||
$this->odds_labels = ['1X', '12', 'X2'];
|
||||
break;
|
||||
|
||||
case 'odds_ggng':
|
||||
$this->columns = 2;
|
||||
$this->odds_labels = ['GG', 'NG'];
|
||||
break;
|
||||
|
||||
case 'odds_points':
|
||||
case 'odds_points_ht':
|
||||
case 'odds_points_q1':
|
||||
$this->columns = 3;
|
||||
$this->odds_labels = ['H', 'A', 'HC'];
|
||||
break;
|
||||
|
||||
case 'odds_totals':
|
||||
case 'odds_totals_ht':
|
||||
case 'odds_totals_q1':
|
||||
$this->columns = 3;
|
||||
$this->odds_labels = ['O', 'U', 'T'];
|
||||
break;
|
||||
}
|
||||
|
||||
return $this->odds_labels;
|
||||
}
|
||||
|
||||
/*******************************
|
||||
* SETTER
|
||||
*******************************/
|
||||
|
||||
public function setFavorits($record)
|
||||
{
|
||||
if ($this->filter_compare_bookmaker) {
|
||||
switch ($this->bettype) {
|
||||
case 'odds_2ways':
|
||||
$tmp = $record->odds_2ways->where('bookmaker_id', $this->filter_compare_bookmaker)->first();
|
||||
if ($tmp->h2w < $tmp->a2w) {
|
||||
$this->favorits['h2w'] = 1;
|
||||
} else {
|
||||
$this->favorits['a2w'] = 1;
|
||||
}
|
||||
break;
|
||||
|
||||
case 'odds_3ways':
|
||||
$tmp = $record->odds_3ways->where('bookmaker_id', $this->filter_compare_bookmaker)->first();
|
||||
if ($tmp->h3w < $tmp->d3w && $tmp->h3w < $tmp->a3w) {
|
||||
$this->favorits['h3w'] = 1;
|
||||
} elseif ($tmp->d3w < $tmp->a3w) {
|
||||
$this->favorits['d3w'] = 1;
|
||||
} else {
|
||||
$this->favorits['a3w'] = 1;
|
||||
}
|
||||
break;
|
||||
|
||||
case 'odds_points':
|
||||
$tmp = $record->odds_points->where('bookmaker_id', $this->filter_compare_bookmaker)->first();
|
||||
if ($tmp->home < $tmp->away) {
|
||||
$this->favorits['home'] = 1;
|
||||
} else {
|
||||
$this->favorits['away'] = 1;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public function setMinMax($record)
|
||||
{
|
||||
switch ($this->bettype) {
|
||||
case 'odds_2ways':
|
||||
case 'odds_2ways_s1':
|
||||
$this->max['h2w'] = $record->odds_2ways->max('h2w');
|
||||
$this->max['a2w'] = $record->odds_2ways->max('a2w');
|
||||
$this->min['h2w'] = $record->odds_2ways->min('h2w');
|
||||
$this->min['h2w'] = $record->odds_2ways->min('h2w');
|
||||
break;
|
||||
|
||||
case 'odds_3ways':
|
||||
case 'odds_3ways_ht':
|
||||
$this->max['h3w'] = $record->odds_3ways_ht->max('h3w');
|
||||
$this->max['d3w'] = $record->odds_3ways_ht->max('d3w');
|
||||
$this->max['a3w'] = $record->odds_3ways_ht->max('a3w');
|
||||
$this->min['h3w'] = $record->odds_3ways_ht->min('h3w');
|
||||
$this->min['d3w'] = $record->odds_3ways_ht->min('d3w');
|
||||
$this->min['a3w'] = $record->odds_3ways_ht->min('a3w');
|
||||
break;
|
||||
|
||||
case 'odds_dc':
|
||||
$this->max['dc1x'] = $record->odds_dc->max('dc1x');
|
||||
$this->max['dc12'] = $record->odds_dc->max('dc12');
|
||||
$this->max['dcx2'] = $record->odds_dc->max('dcx2');
|
||||
$this->min['dc1x'] = $record->odds_dc->min('dc1x');
|
||||
$this->min['dc12'] = $record->odds_dc->min('dc12');
|
||||
$this->min['dcx2'] = $record->odds_dc->min('dcx2');
|
||||
break;
|
||||
case 'odds_dnb':
|
||||
$this->max['dnb1'] = $record->odds_dnb->max('dnb1');
|
||||
$this->max['dnb2'] = $record->odds_dnb->max('dnb2');
|
||||
$this->min['dnb1'] = $record->odds_dnb->min('dnb1');
|
||||
$this->min['dnb2'] = $record->odds_dnb->min('dnb2');
|
||||
break;
|
||||
|
||||
case 'odds_ggng':
|
||||
$this->max['gg'] = $record->odds_ggng->max('gg');
|
||||
$this->max['ng'] = $record->odds_ggng->max('ng');
|
||||
$this->min['gg'] = $record->odds_ggng->min('gg');
|
||||
$this->min['ng'] = $record->odds_ggng->min('ng');
|
||||
break;
|
||||
case 'odds_points':
|
||||
case 'odds_points_ht':
|
||||
case 'odds_points_q1':
|
||||
$this->max['home'] = $record->odds_points->max('home');
|
||||
$this->max['away'] = $record->odds_points->max('away');
|
||||
$this->min['home'] = $record->odds_points->min('home');
|
||||
$this->min['away'] = $record->odds_points->min('away');
|
||||
break;
|
||||
|
||||
case 'odds_totals':
|
||||
case 'odds_totals_ht':
|
||||
case 'odds_totals_q1':
|
||||
$this->max['over'] = $record->odds_totals->max('over');
|
||||
$this->max['under'] = $record->odds_totals->max('under');
|
||||
$this->min['over'] = $record->odds_totals->min('over');
|
||||
$this->min['under'] = $record->odds_totals->min('under');
|
||||
break;
|
||||
|
||||
case 'odds_tq':
|
||||
$this->max['htq'] = $record->odds_tq->max('htq');
|
||||
$this->max['atq'] = $record->odds_tq->max('atq');
|
||||
$this->min['htq'] = $record->odds_tq->min('htq');
|
||||
$this->min['atq'] = $record->odds_tq->min('atq');
|
||||
break;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public function setCompare($record)
|
||||
{
|
||||
$this->compare = null;
|
||||
|
||||
$this->data->filter(function ($model) {
|
||||
|
||||
if ($model->flags == 1 && $model->bookmaker_id != auth()->user()->bookmaker_id) {
|
||||
|
||||
$filter = $this->filter[$model->bookmaker_id] ?? 0;
|
||||
|
||||
if ($filter) {
|
||||
if ($this->bettype == 'odds_dc') {
|
||||
if ($model->margin <= $filter['margin'] * 2) {
|
||||
$this->compare = $this->data->where('bookmaker_id', $model->bookmaker_id)->first();
|
||||
$this->compare_bookmaker_id = $model->bookmaker_id;
|
||||
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
if ($model->margin <= $filter['margin']) {
|
||||
$this->compare = $this->data->where('bookmaker_id', $model->bookmaker_id)->first();
|
||||
$this->compare_bookmaker_id = $model->bookmaker_id;
|
||||
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public function getBookmakerIcon($bookmaker_id)
|
||||
{
|
||||
return $this->empty_slots_icons[$bookmaker_id];
|
||||
}
|
||||
|
||||
public function setPartnerIcon()
|
||||
{
|
||||
$this->partner_icon = Bookmaker::where('id', auth()->user()->partner_bookmaker_id)->value('icon');
|
||||
}
|
||||
|
||||
public function setSlots()
|
||||
{
|
||||
$this->slots = EventsTable::$slots[$this->bettype];
|
||||
|
||||
$this->empty_slots_icons = Bookmaker::pluck('icon', 'id')->all();
|
||||
|
||||
$this->bookmaker = EventsTable::$bookmaker[$this->bettype];
|
||||
|
||||
$this->filter = EventsTable::$filter[$this->bettype];
|
||||
}
|
||||
}
|
||||
@@ -1,85 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Tables\Columns;
|
||||
|
||||
use App\Models\EventBookmaker;
|
||||
use Filament\Support\Components\Contracts\HasEmbeddedView;
|
||||
use Filament\Tables\Columns\Column;
|
||||
use Illuminate\Support\Carbon;
|
||||
|
||||
class ColumnStarttime extends Column implements HasEmbeddedView
|
||||
{
|
||||
public function toEmbeddedHtml(): string
|
||||
{
|
||||
$record = $this->getRecord();
|
||||
|
||||
$bookmaker_starttimes = EventBookmaker::where('event_id', $record->id)
|
||||
->join('bookmakers', 'bookmakers.id', '=', 'event_bookmakers.bookmaker_id')
|
||||
->select('bookmaker_id', 'starttime')
|
||||
->orderBy('bookmakers.name')
|
||||
->get();
|
||||
|
||||
$pop = '<div class="grid grid-cols-2 gap-1 text-xs m-2">';
|
||||
$pop .= '<div class="fi-color fi-color-success fi-text-color-600 dark:fi-text-color-400 fi-ta-text-item">TxOdds</div>';
|
||||
$txstarttime = Carbon::createFromTimestamp(strtotime($record->starttime))->timezone('CET');
|
||||
$pop .= '<div class="text-right fi-color fi-color-success fi-text-color-600 dark:fi-text-color-400 fi-ta-text-item">'.$txstarttime->format('H:i').'</div>';
|
||||
foreach ($bookmaker_starttimes as $value) {
|
||||
|
||||
$starttime = Carbon::createFromTimestamp(strtotime($value->starttime))->timezone('CET');
|
||||
|
||||
if ($value->bookmaker->name == auth()->user()->bookmaker->name) {
|
||||
$pop .= '<div class="fi-color fi-color-info fi-text-color-600 dark:fi-text-color-400 fi-ta-text-item">'.$value->bookmaker->name.'</div>';
|
||||
$pop .= '<div class="text-right fi-color fi-color-info fi-text-color-600 dark:fi-text-color-400 fi-ta-text-item">'.$starttime->format('H:i').'</div>';
|
||||
} else {
|
||||
$pop .= '<div>'.$value->bookmaker->name.'</div>';
|
||||
$pop .= '<div class="text-right">'.$starttime->format('H:i').'</div>';
|
||||
}
|
||||
}
|
||||
$pop .= '<div>';
|
||||
|
||||
$client_starttime = $record->event_bookmaker->starttime ?? null;
|
||||
$txodds_starttime = $record->starttime ?? null;
|
||||
|
||||
if ($client_starttime) {
|
||||
if ($client_starttime == $txodds_starttime) {
|
||||
$color = 'fi-color fi-color-info fi-text-color-600 dark:fi-text-color-400 fi-ta-text-item';
|
||||
} else {
|
||||
$color = 'fi-color fi-color-warning fi-text-color-600 dark:fi-text-color-400 fi-ta-text-item';
|
||||
}
|
||||
$starttime = Carbon::createFromTimestamp(strtotime($client_starttime))->timezone('CET');
|
||||
} else {
|
||||
$color = 'fi-color fi-color-success fi-text-color-600 dark:fi-text-color-400 fi-ta-text-item';
|
||||
$starttime = Carbon::createFromTimestamp(strtotime($txodds_starttime))->timezone('CET');
|
||||
}
|
||||
|
||||
ob_start(); ?>
|
||||
<div x-data="{ pop: '<?= e($pop) ?>' }" class="my-auto flex flex-col gap-4 cursor-pointer">
|
||||
<template x-ref="template">
|
||||
<p x-html="pop"></p>
|
||||
</template>
|
||||
<div class="mx-auto grid grid-cols-1 gap-0 justify-center"
|
||||
x-tooltip.html="{ content: () =>
|
||||
$refs.template.innerHTML,
|
||||
placement: 'auto',
|
||||
allowHTML: true,
|
||||
theme: $store.theme,
|
||||
class: 'tooltip',
|
||||
appendTo: $root,
|
||||
strategy: 'fixed',
|
||||
interactive: false,
|
||||
zIndex: 99999,
|
||||
popperOptions: {
|
||||
strategy: 'fixed',
|
||||
},
|
||||
}">
|
||||
<div class="text-center <?= e($color) ?>">
|
||||
<?= e($starttime->format('H:i')) ?>
|
||||
</div>
|
||||
<div class="text-center fi-color fi-color-gray fi-text-color-500 dark:fi-text-color-400 fi-size-xs fi-ta-text-item">
|
||||
<?= e($starttime->format('d. M')) ?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<?php return ob_get_clean();
|
||||
}
|
||||
}
|
||||
@@ -1,10 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Tables\Columns;
|
||||
|
||||
use Filament\Tables\Columns\Column;
|
||||
|
||||
class EventColumn extends Column
|
||||
{
|
||||
protected string $view = 'filament.tables.columns.event-column';
|
||||
}
|
||||
@@ -1,10 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Tables\Columns;
|
||||
|
||||
use Filament\Tables\Columns\Column;
|
||||
|
||||
class MapperLeftColumn extends Column
|
||||
{
|
||||
protected string $view = 'filament.tables.columns.mapper-left-column';
|
||||
}
|
||||
@@ -1,10 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Tables\Columns;
|
||||
|
||||
use Filament\Tables\Columns\Column;
|
||||
|
||||
class MapperRightColumn extends Column
|
||||
{
|
||||
protected string $view = 'filament.tables.columns.mapper-right-column';
|
||||
}
|
||||
@@ -1,10 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Tables\Columns;
|
||||
|
||||
use Filament\Tables\Columns\Column;
|
||||
|
||||
class MatchIds extends Column
|
||||
{
|
||||
protected string $view = 'filament.tables.columns.match-ids';
|
||||
}
|
||||
@@ -1,10 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Tables\Columns;
|
||||
|
||||
use Filament\Tables\Columns\Column;
|
||||
|
||||
class StatistikEventColumn extends Column
|
||||
{
|
||||
protected string $view = 'filament.tables.columns.statistik-event-column';
|
||||
}
|
||||
@@ -1,298 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Tables\Columns;
|
||||
|
||||
use App\Utilities\BkmIconMap;
|
||||
use Filament\Tables\Columns\Column;
|
||||
use Illuminate\Support\Carbon;
|
||||
|
||||
class TooltipOdds extends Column
|
||||
{
|
||||
protected string $view = 'filament.tables.columns.tooltip-odds';
|
||||
|
||||
protected $bettype;
|
||||
|
||||
protected $two_cols_break = 9;
|
||||
|
||||
protected $pop;
|
||||
|
||||
protected $oddnames = [];
|
||||
|
||||
protected $data;
|
||||
|
||||
protected $max;
|
||||
|
||||
protected $min;
|
||||
|
||||
protected $size;
|
||||
|
||||
public function bettype($bettype): static
|
||||
{
|
||||
$this->bettype = $bettype;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getPop()
|
||||
{
|
||||
return $this->pop;
|
||||
}
|
||||
|
||||
public function getSize()
|
||||
{
|
||||
return $this->size;
|
||||
}
|
||||
|
||||
public function loadData($record)
|
||||
{
|
||||
$this->pop = null;
|
||||
|
||||
switch ($this->bettype) {
|
||||
case 'odds_3ways':
|
||||
$this->oddnames = ['h3w', 'd3w', 'a3w'];
|
||||
|
||||
$this->data = $record->odds_3ways;
|
||||
break;
|
||||
case 'odds_3ways_ht':
|
||||
$this->oddnames = ['h3w', 'd3w', 'a3w'];
|
||||
|
||||
$this->data = $record->odds_3ways_ht;
|
||||
break;
|
||||
case 'odds_2ways':
|
||||
$this->oddnames = ['h2w', 'a2w'];
|
||||
|
||||
$this->data = $record->odds_2ways;
|
||||
break;
|
||||
case 'odds_2ways_s1':
|
||||
$this->oddnames = ['h2w', 'a2w'];
|
||||
|
||||
$this->data = $record->odds_2ways_s1;
|
||||
break;
|
||||
case 'odds_dc':
|
||||
$this->oddnames = ['dc1x', 'dc12', 'dcx2'];
|
||||
|
||||
$this->data = $record->odds_dc;
|
||||
break;
|
||||
case 'odds_ggng':
|
||||
$this->oddnames = ['gg', 'ng'];
|
||||
|
||||
$this->data = $record->odds_ggng;
|
||||
break;
|
||||
case 'odds_dnb':
|
||||
$this->oddnames = ['dnb1', 'dnb2'];
|
||||
|
||||
$this->data = $record->odds_dnb;
|
||||
break;
|
||||
case 'odds_tq':
|
||||
$this->oddnames = ['htq', 'atq'];
|
||||
|
||||
$this->data = $record->odds_tq;
|
||||
break;
|
||||
case 'odds_totals':
|
||||
$this->oddnames = ['over', 'under', 'total'];
|
||||
|
||||
$this->data = $record->odds_totals;
|
||||
break;
|
||||
case 'odds_totals_ht':
|
||||
$this->oddnames = ['over', 'under', 'total'];
|
||||
|
||||
$this->data = $record->odds_totals_ht;
|
||||
break;
|
||||
case 'odds_totals_q1':
|
||||
$this->oddnames = ['over', 'under', 'total'];
|
||||
|
||||
$this->data = $record->odds_totals_q1;
|
||||
break;
|
||||
|
||||
case 'odds_points':
|
||||
$this->oddnames = ['home', 'away', 'handicap'];
|
||||
|
||||
$this->data = $record->odds_points;
|
||||
break;
|
||||
case 'odds_points_q1':
|
||||
$this->oddnames = ['home', 'away', 'handicap'];
|
||||
|
||||
$this->data = $record->odds_points_q1;
|
||||
break;
|
||||
|
||||
}
|
||||
|
||||
if (! $this->data) {
|
||||
return;
|
||||
}
|
||||
$this->size = \count($this->data);
|
||||
|
||||
$this->setMinMax();
|
||||
|
||||
$this->makeTooltip();
|
||||
|
||||
}
|
||||
|
||||
public function setMinMax()
|
||||
{
|
||||
foreach ($this->oddnames as $oddname) {
|
||||
if ($this->bettype == 'odds_dc') {
|
||||
$this->max[$oddname] = $this->data->where('margin', '<', 250)->max($oddname);
|
||||
$this->min[$oddname] = $this->data->where($oddname, '>', 1)->where('margin', '<', 250)->min($oddname);
|
||||
} else {
|
||||
$this->max[$oddname] = $this->data->where('margin', '<', 150)->max($oddname);
|
||||
$this->min[$oddname] = $this->data->where($oddname, '>', 1)->where('margin', '<', 150)->min($oddname);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public function makeTooltip()
|
||||
{
|
||||
$html = $this->legend();
|
||||
|
||||
$html .= $this->makeHeader();
|
||||
|
||||
foreach ($this->data as $k => $value) {
|
||||
|
||||
$html .= $this->getIcon($value);
|
||||
|
||||
foreach ($this->oddnames as $oddname) {
|
||||
$html .= $this->getOdd($value[$oddname], $oddname);
|
||||
}
|
||||
|
||||
$html .= $this->getMargin($value->margin);
|
||||
|
||||
$html .= $this->getUpdatedAt($value->updated_at);
|
||||
|
||||
$html .= $this->getFlags($value->flags);
|
||||
|
||||
if ($k % 2 == 0 && $this->size > $this->two_cols_break) {
|
||||
$html .= '<div></div>';
|
||||
}
|
||||
}
|
||||
|
||||
$this->pop .= $html.'</div>';
|
||||
}
|
||||
|
||||
public function getIcon($value)
|
||||
{
|
||||
return '<div class="h-3 m-0 bg-cover bg-center bg-no-repeat my-auto dark:opacity-80" title="'.$value->bookmaker_id.'" style="background-image: url('.BkmIconMap::get($value->bookmaker->icon).')"></div>';
|
||||
}
|
||||
|
||||
public function getOdd($odd, $name)
|
||||
{
|
||||
if ($odd == $this->max[$name] && ! in_array($name, ['total', 'handicap'])) {
|
||||
$str = '<div class="mb-0.5 ml-0.5 bg-green-600/25 rounded shadow">';
|
||||
} elseif ($odd == $this->min[$name] && ! in_array($name, ['total', 'handicap'])) {
|
||||
$str = '<div class="mb-0.5 ml-0.5 bg-blue-600/25 rounded shadow">';
|
||||
} else {
|
||||
$str = '<div class="mb-0.5 ml-0.5">';
|
||||
}
|
||||
|
||||
return $str.number_format($odd, 2).'</div>';
|
||||
}
|
||||
|
||||
public function getMargin($odd)
|
||||
{
|
||||
return '<div class="mb-0.5 ml-0.5">'.number_format($odd, 1).'</div>';
|
||||
}
|
||||
|
||||
public function getFlags($flags)
|
||||
{
|
||||
if ($flags) {
|
||||
return '<div class="pb-0.5 text-md font-bold text-green-600">✓</div>';
|
||||
} else {
|
||||
return '<div class="pb-0.5 text-md font-bold text-info-600">⚠</div>';
|
||||
}
|
||||
}
|
||||
|
||||
public function getUpdatedAt($updated_at)
|
||||
{
|
||||
return '<div class="text-xs text-nowrap">'.Carbon::createFromDate($updated_at)->format('H:i').'</div>';
|
||||
}
|
||||
|
||||
public function legend()
|
||||
{
|
||||
$part = '<div class="col-span-full font-normal flex justify-end gap-2 text-xs">';
|
||||
$part .= '<div class="bg-green-600/25 rounded py-0.5 px-2 w-16 text-center">Highest</div>';
|
||||
$part .= '<div class="bg-blue-600/25 rounded py-0.5 px-2 w-16 text-center">Lowest</div>';
|
||||
$part .= '</div>';
|
||||
|
||||
return $part;
|
||||
}
|
||||
|
||||
public function makeHeader()
|
||||
{
|
||||
|
||||
switch ($this->bettype) {
|
||||
case 'odds_3ways':
|
||||
case 'odds_3ways_ht':
|
||||
$title = '1X2';
|
||||
$labels = ['Book', '1', 'X', '2', 'Margin', 'Changed', 'Status'];
|
||||
$columns = 6;
|
||||
break;
|
||||
case 'odds_dc':
|
||||
$title = 'Double Chance';
|
||||
$labels = ['Book', '1X', '12', 'X2', 'Margin', 'Changed', 'Status'];
|
||||
$columns = 6;
|
||||
break;
|
||||
case 'odds_ggng':
|
||||
$title = 'Goal No Goal';
|
||||
$labels = ['Book', 'GG', 'NG', 'Margin', 'Changed', 'Status'];
|
||||
$columns = 5;
|
||||
break;
|
||||
case 'odds_dnb':
|
||||
$title = 'Draw No Bet';
|
||||
$labels = ['Book', 'Home', 'Away', 'Margin', 'Changed', 'Status'];
|
||||
$columns = 5;
|
||||
break;
|
||||
case 'odds_tq':
|
||||
$title = 'To Qualify';
|
||||
$labels = ['Book', 'Home', 'Away', 'Margin', 'Changed', 'Status'];
|
||||
$columns = 5;
|
||||
break;
|
||||
case 'odds_totals':
|
||||
case 'odds_totals_ht':
|
||||
case 'odds_totals_q1':
|
||||
$title = 'Totals';
|
||||
$labels = ['Book', 'Over', 'Under', 'Total', 'Margin', 'Changed', 'Status'];
|
||||
$columns = 6;
|
||||
break;
|
||||
case 'odds_2ways':
|
||||
case 'odds_2ways_s1':
|
||||
$title = 'Money Line';
|
||||
$labels = ['Book', 'Home', 'Away', 'Margin', 'Changed', 'Status'];
|
||||
$columns = 5;
|
||||
break;
|
||||
case 'odds_points':
|
||||
case 'odds_points_q1':
|
||||
$title = 'Points';
|
||||
$labels = ['Book', 'Home', 'Away', 'Handicap', 'Margin', 'Changed', 'Status'];
|
||||
$columns = 6;
|
||||
break;
|
||||
|
||||
}
|
||||
|
||||
if ($this->size > $this->two_cols_break) {
|
||||
if ($columns == 6) {
|
||||
$part = '<div class="grid grid-cols-15 gap-2 m-5 mt-1 z-100 text-xs text-center">';
|
||||
} else {
|
||||
$part = '<div class="grid grid-cols-13 gap-2 m-5 mt-1 z-100 text-xs text-center">';
|
||||
}
|
||||
} else {
|
||||
if ($columns == 6) {
|
||||
$part = '<div class="grid grid-cols-7 gap-2 m-5 mt-1 z-100 text-xs text-center">';
|
||||
} else {
|
||||
$part = '<div class="grid grid-cols-6 gap-2 m-5 mt-1 z-100 text-xs text-center">';
|
||||
}
|
||||
}
|
||||
$part .= '<div class="col-span-full text-center text-md font-bold mb-2">'.$title.'</div>';
|
||||
|
||||
foreach ($labels as $label) {
|
||||
$part .= '<div>'.$label.'</div>';
|
||||
}
|
||||
if ($this->size > $this->two_cols_break) {
|
||||
$part .= '<div></div>';
|
||||
foreach ($labels as $label) {
|
||||
$part .= '<div>'.$label.'</div>';
|
||||
}
|
||||
}
|
||||
|
||||
return $part;
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user