This commit is contained in:
salam committed 2026-01-27 09:07:31 +01:00
1 parent 0742b6c19f
commit ec6d4863a9
3 files changed
+30 -36

No files matched your search

+24 -15
View File
@@ -4,6 +4,7 @@ namespace App\Filament\Tables\Columns;
use App\Utilities\BkmIconMap;
use Filament\Tables\Columns\Column;
use Illuminate\Support\Carbon;
class TooltipOdds extends Column
{
@@ -143,12 +144,18 @@ class TooltipOdds extends Column
public function makeTooltip()
{
foreach ($this->data as $k => $value) {
$this->pop .= $this->getIcon($value);
$this->getIcon($value);
foreach ($this->oddnames as $oddname) {
$this->pop .= $this->getOdd($value[$oddname], $oddname);
$this->getOdd($value[$oddname], $oddname);
}
$this->pop .= $this->getMargin($value->margin);
$this->pop .= $this->getFlags($value->flags);
$this->getMargin($value->margin);
$this->getUpdatedAt($value->updated_at);
$this->getFlags($value->flags);
if ($k % 2 == 0 && $this->size > $this->two_cols_break) {
$this->pop .= '<div></div>';
}
@@ -163,9 +170,7 @@ class TooltipOdds extends Column
public function getOdd($odd, $name)
{
if (in_array($name, ['handicap', 'total'])) {
$str = '<div class="mb-0.5 ml-0.5">';
} elseif ($odd == $this->max[$name]) {
if ($odd == $this->max[$name]) {
$str = '<div class="mb-0.5 ml-0.5 bg-green-600/25 rounded shadow">';
} elseif ($odd == $this->min[$name]) {
$str = '<div class="mb-0.5 ml-0.5 bg-blue-600/25 rounded shadow">';
@@ -177,19 +182,23 @@ class TooltipOdds extends Column
public function getMargin($odd)
{
$str = '<div class="mb-0.5 ml-0.5">';
$this->pop .= $str.number_format($odd, 1).'</div>';
$this->pop .= '<div class="mb-0.5 ml-0.5">'.number_format($odd, 1).'</div>';
}
public function getFlags($flags)
{
if ($flags) {
$this->pop .= '<div></div>';
$this->pop .= '<div class="pb-0.5 text-green-600">&check;</div>';
} else {
$this->pop .= '<div><x-filament::icon-button icon="heroicon-m-exclamation-triangle" color="info" /></div>';
$this->pop .= '<div class="pb-0.5 text-info-600">&#9888;</div>';
}
}
public function getUpdatedAt($updated_at)
{
$this->pop .= '<div class="text-xs text-nowrap">'.Carbon::createFromDate($updated_at)->format('H:i').'</div>';
}
public function makeHeader()
{
@@ -244,15 +253,15 @@ class TooltipOdds extends Column
if ($this->size > $this->two_cols_break) {
if ($columns == 6) {
$this->pop = '<div class="grid grid-cols-13 gap-2 m-5 z-100 text-xs text-center">';
$this->pop = '<div class="grid grid-cols-14 gap-2 m-5 z-100 text-xs text-center">';
} else {
$this->pop = '<div class="grid grid-cols-11 gap-2 m-5 z-100 text-xs text-center">';
$this->pop = '<div class="grid grid-cols-12 gap-2 m-5 z-100 text-xs text-center">';
}
} else {
if ($columns == 6) {
$this->pop = '<div class="grid grid-cols-6 gap-2 m-5 z-100 text-xs text-center">';
$this->pop = '<div class="grid grid-cols-7 gap-2 m-5 z-100 text-xs text-center">';
} else {
$this->pop = '<div class="grid grid-cols-5 gap-2 m-5 z-100 text-xs text-center">';
$this->pop = '<div class="grid grid-cols-6 gap-2 m-5 z-100 text-xs text-center">';
}
}
$this->pop .= '<div class="col-span-full text-center text-md font-bold mb-2">'.$title.'</div>';