multiline wip
This commit is contained in:
1 parent
988a148850
commit
245255756c
84 files changed
+663
-94
No files matched your search
@@ -0,0 +1,12 @@
|
||||
<?php
|
||||
|
||||
namespace App\Actions;
|
||||
|
||||
class AlarmGenerator
|
||||
{
|
||||
public static function run($record)
|
||||
{
|
||||
dd($record);
|
||||
|
||||
}
|
||||
}
|
||||
@@ -3,42 +3,38 @@
|
||||
namespace App\Actions;
|
||||
|
||||
use App\Models\Multiline;
|
||||
use App\Models\MultilineSetting;
|
||||
use Filament\Notifications\Notification;
|
||||
|
||||
class MultilineGenerator
|
||||
{
|
||||
public static function run()
|
||||
public static function run($record)
|
||||
{
|
||||
$client_id = $record->id;
|
||||
|
||||
// odds_2ways
|
||||
// odds_3ways
|
||||
// odds_dc
|
||||
// odds_dnb
|
||||
// odds_ggng
|
||||
// odds_handicaps
|
||||
// odds_qualify
|
||||
// odds_totals
|
||||
Multiline::where('client_id', $client_id)->update(['disabled' => 1]);
|
||||
|
||||
$default = [];
|
||||
$default[1] = [
|
||||
'bettypes' => [1, 16, 3, 4, 5],
|
||||
];
|
||||
foreach ($record->sport as $sportid) {
|
||||
|
||||
$multilines = Multiline::where('client_id', auth()->user()->client_id)->get();
|
||||
dd($multilines);
|
||||
$multilines = MultilineSetting::where('sport_id', $sportid)->get();
|
||||
|
||||
foreach ($slots as $id => $slot) {
|
||||
$open = true;
|
||||
foreach ($data as $item) {
|
||||
if ($slot->bookmaker_id == $item->bookmaker_id) {
|
||||
$multilines[$id] = $item;
|
||||
$open = false;
|
||||
foreach ($multilines as $multiline) {
|
||||
|
||||
for ($i = 1; $i <= $multiline->rows; $i++) {
|
||||
|
||||
Multiline::updateOrCreate(
|
||||
['client_id' => $client_id, 'sport_id' => $sportid],
|
||||
['name' => $multiline->name, 'table' => $multiline->table, 'sort' => $i, 'disabled' => 0]
|
||||
);
|
||||
}
|
||||
}
|
||||
if ($open) {
|
||||
$multilines[$id] = $slot;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return $multilines;
|
||||
Notification::make()
|
||||
->title('Multiline generated successfully')
|
||||
->success()
|
||||
->send();
|
||||
|
||||
}
|
||||
}
|
||||
@@ -44,7 +44,7 @@ class SupervisorDb
|
||||
$tmp['command'] = $process->process.$sport->code;
|
||||
$tmp['sport_id'] = $sport->id;
|
||||
$tmp['description'] = $process->description.' '.$sport->sport;
|
||||
$flight = Supervisor::updateOrCreate(
|
||||
Supervisor::updateOrCreate(
|
||||
['code' => $process->command.$sport->code, 'sport_id' => $sport->id],
|
||||
['command' => $process->process.$sport->code, 'description' => $process->description]
|
||||
);
|
||||
|
||||
@@ -2,10 +2,11 @@
|
||||
|
||||
namespace App\Filament\Resources\Clients\Tables;
|
||||
|
||||
use App\Actions\AlarmGenerator;
|
||||
use App\Actions\MultilineGenerator;
|
||||
use App\Models\Bookmaker;
|
||||
use App\Models\Sport;
|
||||
use Filament\Actions\BulkActionGroup;
|
||||
use Filament\Actions\DeleteBulkAction;
|
||||
use Filament\Actions\Action;
|
||||
use Filament\Actions\EditAction;
|
||||
use Filament\Tables\Columns\TextColumn;
|
||||
use Filament\Tables\Table;
|
||||
@@ -23,7 +24,7 @@ class ClientsTable
|
||||
->formatStateUsing(fn (string $state): string => Bookmaker::where('id', $state)->pluck('name')->first()),
|
||||
TextColumn::make('sport')
|
||||
->badge()
|
||||
->color('secondary')
|
||||
->color('warning')
|
||||
->formatStateUsing(fn (string $state): string => Sport::where('id', $state)->pluck('name')->first()),
|
||||
TextColumn::make('created_at')
|
||||
->dateTime()
|
||||
@@ -35,12 +36,19 @@ class ClientsTable
|
||||
->toggleable(isToggledHiddenByDefault: true),
|
||||
])
|
||||
->recordActions([
|
||||
Action::make('multiline')
|
||||
->icon('phosphor-gear-fine')
|
||||
->tooltip('Generates basic alarm configuration for client')
|
||||
->action(function ($record) {
|
||||
MultilineGenerator::run($record);
|
||||
}),
|
||||
Action::make('alarm')
|
||||
->icon('phosphor-gear-fine')
|
||||
->tooltip('Generates basic multiline configuration for client')
|
||||
->action(function ($record) {
|
||||
AlarmGenerator::run($record);
|
||||
}),
|
||||
EditAction::make(),
|
||||
])
|
||||
->toolbarActions([
|
||||
BulkActionGroup::make([
|
||||
DeleteBulkAction::make(),
|
||||
]),
|
||||
]);
|
||||
}
|
||||
}
|
||||
@@ -43,22 +43,27 @@ class EventsTable
|
||||
->label('Event')
|
||||
->icon(fn ($record) => $record->country->icon)
|
||||
->description(fn ($record) => $record->competition_group->name),
|
||||
TextColumn::make('home.name')->alignRight(),
|
||||
TextColumn::make('away.name'),
|
||||
TextColumn::make('home.name')->alignRight()->searchable(),
|
||||
TextColumn::make('away.name')->searchable(),
|
||||
|
||||
Odds3Way::make('odds_3way.bookmaker')->label('1X2'),
|
||||
])
|
||||
->defaultSort('starttime', 'ASC')
|
||||
// ->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()
|
||||
->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(),
|
||||
// SelectFilter::make('competition_group_id')
|
||||
// ->label('Tornament')
|
||||
// ->options(fn () => Event::where('is_active', 1)->pluck('sport', 'id')
|
||||
// ->relationship('sport', 'name', fn (Builder $query) => $query->where('is_active', 1))
|
||||
// ->preload(),
|
||||
], FiltersLayout::AboveContent)
|
||||
->hiddenFilterIndicators(false)
|
||||
->persistFiltersInSession()
|
||||
->recordActions([
|
||||
// EditAction::make(),
|
||||
|
||||
@@ -0,0 +1,55 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources\MultilineSettings;
|
||||
|
||||
use App\Filament\Clusters\Administrator\AdministratorCluster;
|
||||
use App\Filament\Resources\MultilineSettings\Pages\ListMultilineSettings;
|
||||
use App\Filament\Resources\MultilineSettings\Schemas\MultilineSettingForm;
|
||||
use App\Filament\Resources\MultilineSettings\Tables\MultilineSettingsTable;
|
||||
use App\Models\MultilineSetting;
|
||||
use BackedEnum;
|
||||
use Filament\Resources\Resource;
|
||||
use Filament\Schemas\Schema;
|
||||
use Filament\Support\Icons\Heroicon;
|
||||
use Filament\Tables\Table;
|
||||
|
||||
class MultilineSettingResource extends Resource
|
||||
{
|
||||
protected static ?string $model = MultilineSetting::class;
|
||||
|
||||
protected static string|BackedEnum|null $navigationIcon = Heroicon::Bars3;
|
||||
|
||||
protected static ?string $cluster = AdministratorCluster::class;
|
||||
|
||||
protected static string|\UnitEnum|null $navigationGroup = 'Static Data';
|
||||
|
||||
protected static ?string $navigationLabel = 'Multiline';
|
||||
|
||||
// protected static ?string $modelLabel = 'Group';
|
||||
|
||||
// protected static ?string $title = 'Group';
|
||||
|
||||
// protected static ?string $pluralModelLabel = 'Groups';
|
||||
|
||||
public static function form(Schema $schema): Schema
|
||||
{
|
||||
return MultilineSettingForm::configure($schema);
|
||||
}
|
||||
|
||||
public static function table(Table $table): Table
|
||||
{
|
||||
return MultilineSettingsTable::configure($table);
|
||||
}
|
||||
|
||||
public static function getPages(): array
|
||||
{
|
||||
return [
|
||||
'index' => ListMultilineSettings::route('/'),
|
||||
];
|
||||
}
|
||||
|
||||
public static function getNavigationBadge(): ?string
|
||||
{
|
||||
return parent::getEloquentQuery()->count();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources\MultilineSettings\Pages;
|
||||
|
||||
use App\Filament\Resources\MultilineSettings\MultilineSettingResource;
|
||||
use Filament\Resources\Pages\CreateRecord;
|
||||
|
||||
class CreateMultilineSetting extends CreateRecord
|
||||
{
|
||||
protected static string $resource = MultilineSettingResource::class;
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources\MultilineSettings\Pages;
|
||||
|
||||
use App\Filament\Resources\MultilineSettings\MultilineSettingResource;
|
||||
use Filament\Actions\DeleteAction;
|
||||
use Filament\Resources\Pages\EditRecord;
|
||||
|
||||
class EditMultilineSetting extends EditRecord
|
||||
{
|
||||
protected static string $resource = MultilineSettingResource::class;
|
||||
|
||||
protected function getHeaderActions(): array
|
||||
{
|
||||
return [
|
||||
DeleteAction::make(),
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources\MultilineSettings\Pages;
|
||||
|
||||
use App\Filament\Resources\MultilineSettings\MultilineSettingResource;
|
||||
use Filament\Actions\CreateAction;
|
||||
use Filament\Resources\Pages\ListRecords;
|
||||
|
||||
class ListMultilineSettings extends ListRecords
|
||||
{
|
||||
protected static string $resource = MultilineSettingResource::class;
|
||||
|
||||
protected function getHeaderActions(): array
|
||||
{
|
||||
return [
|
||||
CreateAction::make(),
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources\MultilineSettings\Schemas;
|
||||
|
||||
use App\Models\Sport;
|
||||
use Filament\Forms\Components\Select;
|
||||
use Filament\Forms\Components\TextInput;
|
||||
use Filament\Schemas\Schema;
|
||||
|
||||
class MultilineSettingForm
|
||||
{
|
||||
public static function configure(Schema $schema): Schema
|
||||
{
|
||||
return $schema
|
||||
->components([
|
||||
TextInput::make('name')->required(),
|
||||
TextInput::make('short')->required(),
|
||||
TextInput::make('table')->required(),
|
||||
Select::make('sport_id')
|
||||
->required()
|
||||
->label('Sport')
|
||||
->options(fn () => Sport::where('is_active', 1)->pluck('name', 'id')
|
||||
->toArray()),
|
||||
]);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,52 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources\MultilineSettings\Tables;
|
||||
|
||||
use Filament\Actions\BulkActionGroup;
|
||||
use Filament\Actions\DeleteBulkAction;
|
||||
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 MultilineSettingsTable
|
||||
{
|
||||
public static function configure(Table $table): Table
|
||||
{
|
||||
return $table
|
||||
->columns([
|
||||
IconColumn::make('sport.icon')
|
||||
->label('')
|
||||
->width('1rem')
|
||||
->icon(function ($record): string {
|
||||
return $record->sport->icon;
|
||||
}),
|
||||
TextColumn::make('sport.name'),
|
||||
TextColumn::make('name'),
|
||||
TextColumn::make('short'),
|
||||
TextColumn::make('table'),
|
||||
TextColumn::make('rows'),
|
||||
])
|
||||
->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()
|
||||
->recordActions([
|
||||
EditAction::make(),
|
||||
])
|
||||
->toolbarActions([
|
||||
BulkActionGroup::make([
|
||||
DeleteBulkAction::make(),
|
||||
]),
|
||||
]);
|
||||
}
|
||||
}
|
||||
@@ -2,7 +2,6 @@
|
||||
|
||||
namespace App\Filament\Resources\Multilines\Tables;
|
||||
|
||||
use App\Actions\MultilineGenerator;
|
||||
use App\Filament\Tables\Columns\BookmakerIcon;
|
||||
use Filament\Actions\Action;
|
||||
use Filament\Tables\Columns\IconColumn;
|
||||
@@ -24,7 +23,7 @@ class MultilinesTable
|
||||
->label($isReordering ? 'Disable reordering' : 'Enable reordering'),
|
||||
)
|
||||
->reorderable('sort')
|
||||
->defaultGroup('bettype.name')
|
||||
->defaultGroup('name')
|
||||
->columns([
|
||||
IconColumn::make('sport.icon')
|
||||
->label('')
|
||||
@@ -32,9 +31,8 @@ class MultilinesTable
|
||||
->icon(function ($record): string {
|
||||
return $record->sport->icon;
|
||||
}),
|
||||
TextColumn::make('sport.name'),
|
||||
TextColumn::make('matchpart.name'),
|
||||
TextColumn::make('bettype.name'),
|
||||
// TextColumn::make('sport.name'),
|
||||
TextColumn::make('name'),
|
||||
TextColumn::make('bookmaker.name'),
|
||||
BookmakerIcon::make('bookmaker.icon')->label('Icon'),
|
||||
])
|
||||
@@ -49,13 +47,6 @@ class MultilinesTable
|
||||
->preload(),
|
||||
], FiltersLayout::AboveContent)
|
||||
->hiddenFilterIndicators()
|
||||
->persistFiltersInSession()
|
||||
->headerActions([
|
||||
Action::make('generate')
|
||||
->icon('phosphor-gear-fine')
|
||||
->action(function () {
|
||||
MultilineGenerator::run();
|
||||
}),
|
||||
]);
|
||||
->persistFiltersInSession();
|
||||
}
|
||||
}
|
||||
@@ -10,8 +10,9 @@ class Multiline extends Model
|
||||
protected $fillable = [
|
||||
'client_id',
|
||||
'sport_id',
|
||||
'bettype_id',
|
||||
'matchpart_id',
|
||||
'table',
|
||||
'name',
|
||||
'disabled',
|
||||
'bookmaker_id',
|
||||
'sort',
|
||||
];
|
||||
@@ -21,16 +22,6 @@ class Multiline extends Model
|
||||
return $this->belongsTo(Sport::class);
|
||||
}
|
||||
|
||||
public function matchpart()
|
||||
{
|
||||
return $this->belongsTo(Matchpart::class);
|
||||
}
|
||||
|
||||
public function bettype()
|
||||
{
|
||||
return $this->belongsTo(Bettype::class);
|
||||
}
|
||||
|
||||
public function bookmaker()
|
||||
{
|
||||
return $this->belongsTo(Bookmaker::class, 'bookmaker_id', 'txid');
|
||||
|
||||
@@ -0,0 +1,21 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class MultilineSetting extends Model
|
||||
{
|
||||
protected $fillable = [
|
||||
'id',
|
||||
'sport_id',
|
||||
'name',
|
||||
'short',
|
||||
'table',
|
||||
];
|
||||
|
||||
public function sport()
|
||||
{
|
||||
return $this->belongsTo(Sport::class);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,49 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class Odds2wayS1 extends Model
|
||||
{
|
||||
protected $table = 'odds_2ways_s1';
|
||||
|
||||
protected $fillable = [
|
||||
'id',
|
||||
'event_id',
|
||||
'sport_id',
|
||||
'bookmaker_id',
|
||||
'provider_id',
|
||||
'offer_id',
|
||||
'bmoid',
|
||||
'h2w',
|
||||
'a2w',
|
||||
'margin',
|
||||
'flag',
|
||||
'nuh_check',
|
||||
'last_check_at',
|
||||
'source_updated_at',
|
||||
'add_time',
|
||||
'updated_at',
|
||||
];
|
||||
|
||||
public function sport()
|
||||
{
|
||||
return $this->belongsTo(Sport::class);
|
||||
}
|
||||
|
||||
public function bookmaker()
|
||||
{
|
||||
return $this->belongsTo(Bookmaker::class);
|
||||
}
|
||||
|
||||
public function event()
|
||||
{
|
||||
return $this->belongsTo(Event::class);
|
||||
}
|
||||
|
||||
public function provider()
|
||||
{
|
||||
return $this->belongsTo(Provider::class);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,50 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class OddsHandicapQ1 extends Model
|
||||
{
|
||||
protected $table = 'odds_handicaps_q1';
|
||||
|
||||
protected $fillable = [
|
||||
'id',
|
||||
'event_id',
|
||||
'sport_id',
|
||||
'bookmaker_id',
|
||||
'provider_id',
|
||||
'offer_id',
|
||||
'bmoid',
|
||||
'home',
|
||||
'away',
|
||||
'handicap',
|
||||
'margin',
|
||||
'flag',
|
||||
'nuh_check',
|
||||
'last_check_at',
|
||||
'source_updated_at',
|
||||
'add_time',
|
||||
'updated_at',
|
||||
];
|
||||
|
||||
public function sport()
|
||||
{
|
||||
return $this->belongsTo(Sport::class);
|
||||
}
|
||||
|
||||
public function bookmaker()
|
||||
{
|
||||
return $this->belongsTo(Bookmaker::class);
|
||||
}
|
||||
|
||||
public function event()
|
||||
{
|
||||
return $this->belongsTo(Event::class);
|
||||
}
|
||||
|
||||
public function provider()
|
||||
{
|
||||
return $this->belongsTo(Provider::class);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,50 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class OddsTotalQ1 extends Model
|
||||
{
|
||||
protected $table = 'odds_totals_q1';
|
||||
|
||||
protected $fillable = [
|
||||
'id',
|
||||
'event_id',
|
||||
'sport_id',
|
||||
'bookmaker_id',
|
||||
'provider_id',
|
||||
'offer_id',
|
||||
'bmoid',
|
||||
'over',
|
||||
'under',
|
||||
'spread',
|
||||
'margin',
|
||||
'flag',
|
||||
'nuh_check',
|
||||
'last_check_at',
|
||||
'source_updated_at',
|
||||
'add_time',
|
||||
'updated_at',
|
||||
];
|
||||
|
||||
public function sport()
|
||||
{
|
||||
return $this->belongsTo(Sport::class);
|
||||
}
|
||||
|
||||
public function bookmaker()
|
||||
{
|
||||
return $this->belongsTo(Bookmaker::class);
|
||||
}
|
||||
|
||||
public function event()
|
||||
{
|
||||
return $this->belongsTo(Event::class);
|
||||
}
|
||||
|
||||
public function provider()
|
||||
{
|
||||
return $this->belongsTo(Provider::class);
|
||||
}
|
||||
}
|
||||
@@ -7,6 +7,7 @@ use Carbon\Carbon;
|
||||
use Filament\Support\Colors\Color;
|
||||
use Filament\Support\Facades\FilamentColor;
|
||||
use Filament\Support\Facades\FilamentView;
|
||||
use Filament\Tables\View\TablesRenderHook;
|
||||
use Filament\View\PanelsRenderHook;
|
||||
use Illuminate\Support\ServiceProvider;
|
||||
use Illuminate\View\View;
|
||||
@@ -27,7 +28,8 @@ class AppServiceProvider extends ServiceProvider
|
||||
public function boot(): void
|
||||
{
|
||||
FilamentView::registerRenderHook(
|
||||
PanelsRenderHook::RESOURCE_PAGES_LIST_RECORDS_TABLE_BEFORE,
|
||||
// PanelsRenderHook::RESOURCE_PAGES_LIST_RECORDS_TABS_END,
|
||||
TablesRenderHook::TOOLBAR_SEARCH_AFTER,
|
||||
fn (): View => view('filament.hooks.table-bettype-filters'),
|
||||
scopes: [
|
||||
ListEvents::class,
|
||||
|
||||
Reference in new issue
Block a user