multilines wip
This commit is contained in:
1 parent
218c1e6e1c
commit
825a8d430c
19 files changed
+145
-78
No files matched your search
@@ -1,8 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Actions;
|
||||
|
||||
class MultilineGenerator
|
||||
{
|
||||
public static function run() {}
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
<?php
|
||||
|
||||
namespace App\Actions;
|
||||
|
||||
use App\Models\Multiline;
|
||||
|
||||
class MultilineSlots
|
||||
{
|
||||
public static function addSlots(&$data, $bettype_id, $matchpart_id)
|
||||
{
|
||||
$slots = Multiline::where('sport_id', auth()->user()->sport_id)
|
||||
->where('client_id', auth()->user()->client_id)
|
||||
->where('bettype_id', $bettype_id)
|
||||
->where('matchpart_id', $matchpart_id)
|
||||
->with('bookmaker')
|
||||
->orderBy('sort')
|
||||
->get();
|
||||
|
||||
$multilines = [];
|
||||
foreach ($slots as $id => $slot) {
|
||||
$open = true;
|
||||
foreach ($data as $item) {
|
||||
if ($slot->bookmaker_id == $item->bookmaker_id) {
|
||||
$multilines[$id] = $item;
|
||||
$open = false;
|
||||
}
|
||||
}
|
||||
if ($open) {
|
||||
$multilines[$id] = $slot;
|
||||
}
|
||||
}
|
||||
|
||||
return $multilines;
|
||||
}
|
||||
}
|
||||
@@ -6,7 +6,6 @@ use App\Filament\Resources\Events\Pages\ListEvents;
|
||||
use App\Filament\Resources\Events\Schemas\EventForm;
|
||||
use App\Filament\Resources\Events\Tables\EventsTable;
|
||||
use App\Models\Event;
|
||||
use App\Models\Multiline;
|
||||
use Carbon\Carbon;
|
||||
use Filament\Resources\Resource;
|
||||
use Filament\Schemas\Schema;
|
||||
@@ -27,11 +26,6 @@ class EventResource extends Resource
|
||||
|
||||
protected static ?string $pluralModelLabel = 'Monitor';
|
||||
|
||||
public static function getPluralModelLabel(): string
|
||||
{
|
||||
return '';
|
||||
}
|
||||
|
||||
public static function form(Schema $schema): Schema
|
||||
{
|
||||
return EventForm::configure($schema);
|
||||
@@ -42,13 +36,6 @@ class EventResource extends Resource
|
||||
return EventsTable::configure($table);
|
||||
}
|
||||
|
||||
public static function getRelations(): array
|
||||
{
|
||||
return [
|
||||
//
|
||||
];
|
||||
}
|
||||
|
||||
public static function getPages(): array
|
||||
{
|
||||
return [
|
||||
@@ -66,15 +53,7 @@ class EventResource extends Resource
|
||||
|
||||
public static function getEloquentQuery(): Builder
|
||||
{
|
||||
// $_bookmaker = Multiline::where('sport_id', auth()->user()->sport_id)
|
||||
// ->where('client_id', auth()->user()->client_id)
|
||||
// ->where('bettype_id', 1)
|
||||
// ->where('matchpart_id', 1)
|
||||
// ->pluck('bookmaker_id')
|
||||
// ->toArray();
|
||||
|
||||
return parent::getEloquentQuery()
|
||||
// ->join('odds_3ways', 'odds_3ways.event_id', '=', 'events.id')
|
||||
->where('starttime', '>', Carbon::now())
|
||||
->where('sport_id', auth()->user()->sport_id);
|
||||
}
|
||||
|
||||
@@ -5,6 +5,7 @@ namespace App\Filament\Resources\Events\Tables;
|
||||
use App\Filament\Tables\Columns\Odds3Way;
|
||||
use Carbon\Carbon;
|
||||
use Filament\Actions\BulkActionGroup;
|
||||
use Filament\Actions\DeleteAction;
|
||||
use Filament\Actions\DeleteBulkAction;
|
||||
use Filament\Actions\EditAction;
|
||||
use Filament\Support\Enums\FontWeight;
|
||||
@@ -42,13 +43,14 @@ class EventsTable
|
||||
TextColumn::make('home.name')->alignRight()->searchable(),
|
||||
TextColumn::make('away.name')->searchable(),
|
||||
|
||||
Odds3Way::make('odds_3way')->label('Market 1X2'),
|
||||
Odds3Way::make('odds_3way.bookmaker')->label('1X2'),
|
||||
])
|
||||
->filters([
|
||||
//
|
||||
])
|
||||
->recordActions([
|
||||
// EditAction::make(),
|
||||
DeleteAction::make()->iconButton(),
|
||||
])
|
||||
->toolbarActions([
|
||||
BulkActionGroup::make([
|
||||
|
||||
@@ -13,7 +13,7 @@ class EditMultiline extends EditRecord
|
||||
protected function getHeaderActions(): array
|
||||
{
|
||||
return [
|
||||
DeleteAction::make(),
|
||||
// DeleteAction::make(),
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -13,9 +13,9 @@ class ListMultilines extends ListRecords
|
||||
protected function getHeaderActions(): array
|
||||
{
|
||||
return [
|
||||
CreateAction::make()
|
||||
->createAnother(false)
|
||||
->hidden(! auth()->user()->super_admin),
|
||||
// CreateAction::make()
|
||||
// ->createAnother(false)
|
||||
// ->hidden(! auth()->user()->super_admin),
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -7,7 +7,10 @@ use Filament\Actions\Action;
|
||||
use Filament\Actions\EditAction;
|
||||
use Filament\Tables\Columns\IconColumn;
|
||||
use Filament\Tables\Columns\TextColumn;
|
||||
use Filament\Tables\Enums\FiltersLayout;
|
||||
use Filament\Tables\Filters\SelectFilter;
|
||||
use Filament\Tables\Table;
|
||||
use Illuminate\Database\Eloquent\Builder;
|
||||
|
||||
class MultilinesTable
|
||||
{
|
||||
@@ -20,6 +23,7 @@ class MultilinesTable
|
||||
->label($isReordering ? 'Disable reordering' : 'Enable reordering'),
|
||||
)
|
||||
->reorderable('sort')
|
||||
->defaultGroup('bettype.name')
|
||||
->columns([
|
||||
IconColumn::make('sport.icon')
|
||||
->label('')
|
||||
@@ -33,16 +37,25 @@ class MultilinesTable
|
||||
TextColumn::make('bookmaker.name'),
|
||||
BookmakerIcon::make('bookmaker.icon')->label('Icon'),
|
||||
])
|
||||
->defaultSort('sort')
|
||||
->deferFilters(false)
|
||||
->filters([
|
||||
//
|
||||
])
|
||||
SelectFilter::make('sport_id')
|
||||
->label('Sport')
|
||||
->default(1)
|
||||
->selectablePlaceholder(false)
|
||||
->relationship('sport', 'name', fn (Builder $query) => $query->where('is_active', 1))
|
||||
->preload(),
|
||||
], FiltersLayout::AboveContent)
|
||||
->hiddenFilterIndicators()
|
||||
->persistFiltersInSession()
|
||||
->recordActions([
|
||||
EditAction::make()
|
||||
->mutateDataUsing(function (array $data): array {
|
||||
$data['client_id'] = auth()->user()->client_id;
|
||||
// EditAction::make()
|
||||
// ->mutateDataUsing(function (array $data): array {
|
||||
// $data['client_id'] = auth()->user()->client_id;
|
||||
|
||||
return $data;
|
||||
}),
|
||||
// return $data;
|
||||
// }),
|
||||
]);
|
||||
}
|
||||
}
|
||||
@@ -2,9 +2,22 @@
|
||||
|
||||
namespace App\Filament\Tables\Columns;
|
||||
|
||||
use App\Actions\MultilineSlots;
|
||||
use Filament\Tables\Columns\Column;
|
||||
|
||||
class Odds3Way extends Column
|
||||
{
|
||||
protected string $view = 'filament.tables.columns.odds3-way';
|
||||
|
||||
protected ?array $multiline;
|
||||
|
||||
public function loadMultiline(&$data)
|
||||
{
|
||||
$this->multiline = MultilineSlots::addSlots($data, 1, 1);
|
||||
}
|
||||
|
||||
public function getMultiline(): ?array
|
||||
{
|
||||
return $this->multiline;
|
||||
}
|
||||
}
|
||||
+1
-10
@@ -52,15 +52,6 @@ class Event extends Model
|
||||
|
||||
public function odds_3way()
|
||||
{
|
||||
$_bookmaker = Multiline::where('sport_id', auth()->user()->sport_id)
|
||||
->where('client_id', auth()->user()->client_id)
|
||||
->where('bettype_id', 1)
|
||||
->where('matchpart_id', 1)
|
||||
->pluck('bookmaker_id');
|
||||
|
||||
return $this->hasMany(Odds3way::class, 'event_id', 'id')
|
||||
->join('multilines', 'multilines.bookmaker_id', 'odds_3ways.bookmaker_id')
|
||||
->orderBy('multilines.sort');
|
||||
// return $this->hasMany(Odds3way::class, 'event_id', 'id')->whereIn('bookmaker_id', $_bookmaker);
|
||||
return $this->hasMany(Odds3way::class, 'event_id', 'id')->with('bookmaker');
|
||||
}
|
||||
}
|
||||
@@ -2,6 +2,7 @@
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use App\Models\Scopes\ClientScope;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class Multiline extends Model
|
||||
@@ -34,4 +35,9 @@ class Multiline extends Model
|
||||
{
|
||||
return $this->belongsTo(Bookmaker::class, 'bookmaker_id', 'txid');
|
||||
}
|
||||
|
||||
protected static function booted(): void
|
||||
{
|
||||
static::addGlobalScope(new ClientScope);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models\Scopes;
|
||||
|
||||
use Illuminate\Database\Eloquent\Builder;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Scope;
|
||||
|
||||
class ClientScope implements Scope
|
||||
{
|
||||
/**
|
||||
* Apply the scope to a given Eloquent query builder.
|
||||
*/
|
||||
public function apply(Builder $builder, Model $model): void
|
||||
{
|
||||
if (auth()->hasUser()) {
|
||||
$builder->where('client_id', auth()->user()->client_id);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -4,10 +4,10 @@ namespace App\Utilities;
|
||||
|
||||
class BkmIconMap
|
||||
{
|
||||
public static function get($bookmaker)
|
||||
public static function get($image)
|
||||
{
|
||||
if ($bookmaker) {
|
||||
return asset("storage/bookmaker-icons/$bookmaker->icon.png");
|
||||
if ($image) {
|
||||
return asset("storage/bookmaker-icons/$image.png");
|
||||
} else {
|
||||
return asset('storage/bookmaker-icons/missing.png');
|
||||
}
|
||||
|
||||
@@ -0,0 +1,13 @@
|
||||
<?php
|
||||
|
||||
namespace App\Utilities;
|
||||
|
||||
class OddsFormatting
|
||||
{
|
||||
public static function get($odd, $stellen = 2)
|
||||
{
|
||||
if ($odd != 0) {
|
||||
return number_format($odd, $stellen);
|
||||
}
|
||||
}
|
||||
}
|
||||
Vendored
+9
-9
@@ -551,7 +551,7 @@ app('router')->setCompiledRoutes(
|
||||
array (
|
||||
0 =>
|
||||
array (
|
||||
'_route' => 'generated::utvoDsmittGErgFU',
|
||||
'_route' => 'generated::9qxzN4LxsImcAiTa',
|
||||
),
|
||||
1 => NULL,
|
||||
2 =>
|
||||
@@ -571,7 +571,7 @@ app('router')->setCompiledRoutes(
|
||||
array (
|
||||
0 =>
|
||||
array (
|
||||
'_route' => 'generated::UKTOkgCt6yIOAG79',
|
||||
'_route' => 'generated::YrE3dbXP33LwuSFL',
|
||||
),
|
||||
1 => NULL,
|
||||
2 =>
|
||||
@@ -610,7 +610,7 @@ app('router')->setCompiledRoutes(
|
||||
array (
|
||||
0 =>
|
||||
array (
|
||||
'_route' => 'generated::qXNgDXoLuA95HjrL',
|
||||
'_route' => 'generated::uI3Rq0Z4wGl7G9CC',
|
||||
),
|
||||
1 => NULL,
|
||||
2 =>
|
||||
@@ -2600,7 +2600,7 @@ app('router')->setCompiledRoutes(
|
||||
'waitSeconds' => NULL,
|
||||
'withTrashed' => false,
|
||||
),
|
||||
'generated::utvoDsmittGErgFU' =>
|
||||
'generated::9qxzN4LxsImcAiTa' =>
|
||||
array (
|
||||
'methods' =>
|
||||
array (
|
||||
@@ -2612,7 +2612,7 @@ app('router')->setCompiledRoutes(
|
||||
array (
|
||||
'uses' => 'Livewire\\Mechanisms\\FrontendAssets\\FrontendAssets@returnJavaScriptAsFile',
|
||||
'controller' => 'Livewire\\Mechanisms\\FrontendAssets\\FrontendAssets@returnJavaScriptAsFile',
|
||||
'as' => 'generated::utvoDsmittGErgFU',
|
||||
'as' => 'generated::9qxzN4LxsImcAiTa',
|
||||
),
|
||||
'fallback' => false,
|
||||
'defaults' =>
|
||||
@@ -2628,7 +2628,7 @@ app('router')->setCompiledRoutes(
|
||||
'waitSeconds' => NULL,
|
||||
'withTrashed' => false,
|
||||
),
|
||||
'generated::UKTOkgCt6yIOAG79' =>
|
||||
'generated::YrE3dbXP33LwuSFL' =>
|
||||
array (
|
||||
'methods' =>
|
||||
array (
|
||||
@@ -2640,7 +2640,7 @@ app('router')->setCompiledRoutes(
|
||||
array (
|
||||
'uses' => 'Livewire\\Mechanisms\\FrontendAssets\\FrontendAssets@maps',
|
||||
'controller' => 'Livewire\\Mechanisms\\FrontendAssets\\FrontendAssets@maps',
|
||||
'as' => 'generated::UKTOkgCt6yIOAG79',
|
||||
'as' => 'generated::YrE3dbXP33LwuSFL',
|
||||
),
|
||||
'fallback' => false,
|
||||
'defaults' =>
|
||||
@@ -2711,7 +2711,7 @@ app('router')->setCompiledRoutes(
|
||||
'waitSeconds' => NULL,
|
||||
'withTrashed' => false,
|
||||
),
|
||||
'generated::qXNgDXoLuA95HjrL' =>
|
||||
'generated::uI3Rq0Z4wGl7G9CC' =>
|
||||
array (
|
||||
'methods' =>
|
||||
array (
|
||||
@@ -2740,7 +2740,7 @@ app('router')->setCompiledRoutes(
|
||||
\'exception\' => $exception,
|
||||
]), status: $exception ? 500 : 200);
|
||||
}";s:5:"scope";s:54:"Illuminate\\Foundation\\Configuration\\ApplicationBuilder";s:4:"this";N;s:4:"self";s:32:"0000000000000e030000000000000000";}}',
|
||||
'as' => 'generated::qXNgDXoLuA95HjrL',
|
||||
'as' => 'generated::uI3Rq0Z4wGl7G9CC',
|
||||
),
|
||||
'fallback' => false,
|
||||
'defaults' =>
|
||||
|
||||
@@ -5,6 +5,10 @@
|
||||
@source '../../../../resources/views/filament/pages/**/*';
|
||||
@source '../../../../vendor/awcodes/light-switch/resources/**/*.blade.php';
|
||||
|
||||
button[wire\:click="resetTableFiltersForm"] {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.oddsbox .bl {
|
||||
border-left: 1px solid #e4e4e7;
|
||||
}
|
||||
@@ -56,10 +60,3 @@
|
||||
color: #90a1b9;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
BOOKMAKER ICONS
|
||||
*/
|
||||
.b30 {
|
||||
background-image: url('../book-icons/bet365.png');
|
||||
}
|
||||
@@ -1,17 +1,23 @@
|
||||
<?php
|
||||
use App\Utilities\BkmIconMap;
|
||||
use App\Utilities\OddsFormatting;
|
||||
?>
|
||||
|
||||
<div {{ $getExtraAttributeBag() }} class="grid grid-cols-5 grid-rows-5 oddsbox">
|
||||
|
||||
@foreach ($record->odds_3way as $row)
|
||||
<div class="bg-contain bg-center bg-no-repeat dark:opacity-85" title="{{ $row->bookmaker->txid }}"
|
||||
style="background-image: url('{{ BkmIconMap::get($row->bookmaker) }}')">
|
||||
</div>
|
||||
<div class="br bb">{{ number_format($row->h3w, 2) }}</div>
|
||||
<div class="br bb">{{ number_format($row->d3w, 2) }}</div>
|
||||
<div class="br bb">{{ number_format($row->a3w, 2) }}</div>
|
||||
<div class="br bb">{{ $row->margin }}</div>
|
||||
|
||||
{{ $loadMultiline($record->odds_3way) }}
|
||||
|
||||
@foreach ($getMultiline() as $row)
|
||||
@if (isset($row->bookmaker))
|
||||
<div class="bg-contain bg-center bg-no-repeat dark:opacity-90" title="{{ $row->bookmaker->txid }}"
|
||||
style="background-image: url('{{ BkmIconMap::get($row->bookmaker?->icon) }}')">
|
||||
</div>
|
||||
<div class="br bb">{{ OddsFormatting::get($row->h3w, 2) }} </div>
|
||||
<div class="br bb">{{ OddsFormatting::get($row->d3w, 2) }} </div>
|
||||
<div class="br bb">{{ OddsFormatting::get($row->a3w, 2) }} </div>
|
||||
<div class="br bb">{{ OddsFormatting::get($row->margin, 1) }} </div>
|
||||
@endif
|
||||
@endforeach
|
||||
|
||||
</div>
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 85 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 85 KiB After Width: | Height: | Size: 21 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 31 KiB After Width: | Height: | Size: 28 KiB |
Reference in new issue
Block a user