wip change bettype in events monitor
This commit is contained in:
1 parent
245255756c
commit
c6fd66189b
15 files changed
+255
-279
No files matched your search
@@ -23,8 +23,16 @@ class MultilineGenerator
|
||||
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]
|
||||
[
|
||||
'client_id' => $client_id,
|
||||
'sport_id' => $sportid,
|
||||
'name' => $multiline->name,
|
||||
'table' => $multiline->table,
|
||||
'sort' => $i,
|
||||
],
|
||||
[
|
||||
'disabled' => 0,
|
||||
]
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -10,8 +10,8 @@ class MultilineSlots
|
||||
{
|
||||
$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)
|
||||
// ->where('bettype_id', $bettype_id)
|
||||
// ->where('matchpart_id', $matchpart_id)
|
||||
->with('bookmaker')
|
||||
->orderBy('sort')
|
||||
->get();
|
||||
|
||||
@@ -2,7 +2,6 @@
|
||||
|
||||
namespace App\Filament\Resources\Bookmakers\Schemas;
|
||||
|
||||
use Filament\Forms\Components\FileUpload;
|
||||
use Filament\Forms\Components\TextInput;
|
||||
use Filament\Schemas\Schema;
|
||||
|
||||
@@ -16,10 +15,6 @@ class BookmakerForm
|
||||
->required(),
|
||||
TextInput::make('icon')
|
||||
->required(),
|
||||
FileUpload::make('image')
|
||||
->preserveFilenames()
|
||||
->columnSpan(2)
|
||||
->default(null),
|
||||
TextInput::make('baid')
|
||||
->numeric()
|
||||
->default(0),
|
||||
|
||||
@@ -2,9 +2,8 @@
|
||||
|
||||
namespace App\Filament\Resources\Bookmakers\Tables;
|
||||
|
||||
use App\Filament\Tables\Columns\BookmakerIcon;
|
||||
use Filament\Actions\EditAction;
|
||||
use Filament\Tables\Columns\IconColumn;
|
||||
use Filament\Tables\Columns\ImageColumn;
|
||||
use Filament\Tables\Columns\TextColumn;
|
||||
use Filament\Tables\Columns\ToggleColumn;
|
||||
use Filament\Tables\Filters\TernaryFilter;
|
||||
@@ -19,19 +18,13 @@ class BookmakersTable
|
||||
->columns([
|
||||
TextColumn::make('name')
|
||||
->searchable(),
|
||||
IconColumn::make('icon')
|
||||
->trueColor('black')
|
||||
->size('2xl')
|
||||
->icon(function ($record): string {
|
||||
return 'bkm-'.$record->icon;
|
||||
}),
|
||||
ImageColumn::make('image')
|
||||
->imageHeight(30)
|
||||
->imageWidth(110),
|
||||
BookmakerIcon::make('icon')->label('Icon'),
|
||||
TextColumn::make('baid')
|
||||
->label('BAID')
|
||||
->numeric()
|
||||
->sortable(),
|
||||
TextColumn::make('txid')
|
||||
->label('TXID')
|
||||
->numeric()
|
||||
->sortable(),
|
||||
ToggleColumn::make('txso')->offColor('gray'),
|
||||
|
||||
@@ -19,6 +19,8 @@ use Illuminate\Database\Eloquent\Builder;
|
||||
|
||||
class EventsTable
|
||||
{
|
||||
public static $bettype = '1x2';
|
||||
|
||||
public static function configure(Table $table): Table
|
||||
{
|
||||
return $table
|
||||
|
||||
@@ -3,11 +3,18 @@
|
||||
namespace App\Filament\Resources\Multilines\Tables;
|
||||
|
||||
use App\Filament\Tables\Columns\BookmakerIcon;
|
||||
use App\Models\Bookmaker;
|
||||
use App\Models\Client;
|
||||
use App\Models\Multiline;
|
||||
use App\Models\Sport;
|
||||
use Filament\Actions\Action;
|
||||
use Filament\Forms\Components\Select;
|
||||
use Filament\Schemas\Components\Utilities\Get;
|
||||
use Filament\Tables\Columns\IconColumn;
|
||||
use Filament\Tables\Columns\SelectColumn;
|
||||
use Filament\Tables\Columns\TextColumn;
|
||||
use Filament\Tables\Enums\FiltersLayout;
|
||||
use Filament\Tables\Filters\SelectFilter;
|
||||
use Filament\Tables\Filters\Filter;
|
||||
use Filament\Tables\Table;
|
||||
use Illuminate\Database\Eloquent\Builder;
|
||||
|
||||
@@ -23,7 +30,6 @@ class MultilinesTable
|
||||
->label($isReordering ? 'Disable reordering' : 'Enable reordering'),
|
||||
)
|
||||
->reorderable('sort')
|
||||
->defaultGroup('name')
|
||||
->columns([
|
||||
IconColumn::make('sport.icon')
|
||||
->label('')
|
||||
@@ -31,22 +37,48 @@ class MultilinesTable
|
||||
->icon(function ($record): string {
|
||||
return $record->sport->icon;
|
||||
}),
|
||||
// TextColumn::make('sport.name'),
|
||||
TextColumn::make('sport.name'),
|
||||
TextColumn::make('name'),
|
||||
TextColumn::make('bookmaker.name'),
|
||||
BookmakerIcon::make('bookmaker.icon')->label('Icon'),
|
||||
SelectColumn::make('bookmaker_id')
|
||||
->width('2rem')
|
||||
->options(Bookmaker::where('is_active', 1)->pluck('name', 'txid')),
|
||||
])
|
||||
->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();
|
||||
Filter::make('ligafilter')
|
||||
->form([
|
||||
Select::make('sport_id')
|
||||
->label('Sport')
|
||||
->default(1)
|
||||
->options(function () {
|
||||
$sports = Client::where('id', auth()->user()->client_id)->pluck('sport')->first();
|
||||
|
||||
return Sport::query()->whereIn('id', $sports)->pluck('name', 'id');
|
||||
})
|
||||
->live(),
|
||||
Select::make('name')
|
||||
->default('1X2')
|
||||
->label('Bettype')
|
||||
->options(function (Builder $query, Get $get) {
|
||||
return Multiline::where('sport_id', $get('sport_id'))->pluck('name', 'name');
|
||||
})
|
||||
->live(),
|
||||
])
|
||||
->query(function (Builder $query, array $data): Builder {
|
||||
return $query
|
||||
->when(
|
||||
$data['sport_id'],
|
||||
fn (Builder $query, $sport_id) => $query->where('sport_id', $sport_id)
|
||||
)->when(
|
||||
$data['name'],
|
||||
fn (Builder $query, $name) => $query->where('name', $name)
|
||||
);
|
||||
})
|
||||
->columns(3)->columnSpan(3),
|
||||
], layout: FiltersLayout::AboveContent)
|
||||
|
||||
->hiddenFilterIndicators();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
<?php
|
||||
|
||||
namespace App\Livewire;
|
||||
|
||||
use App\Models\Client;
|
||||
use App\Models\User;
|
||||
use Livewire\Component;
|
||||
|
||||
class ClientSwitch extends Component
|
||||
{
|
||||
public $clients = [];
|
||||
|
||||
public ?string $client = '';
|
||||
|
||||
public function mount()
|
||||
{
|
||||
$this->clients = Client::pluck('name', 'id')->all();
|
||||
|
||||
$this->client = Client::where('id', auth()->user()->client_id)->pluck('name')->first();
|
||||
}
|
||||
|
||||
public function render()
|
||||
{
|
||||
return view('livewire.client-switch');
|
||||
}
|
||||
|
||||
public function swop($client_id)
|
||||
{
|
||||
User::where('id', auth()->user()->id)->update(['client_id' => $client_id]);
|
||||
|
||||
$this->js('window.location.reload()');
|
||||
}
|
||||
}
|
||||
@@ -9,6 +9,7 @@ use Filament\Support\Facades\FilamentColor;
|
||||
use Filament\Support\Facades\FilamentView;
|
||||
use Filament\Tables\View\TablesRenderHook;
|
||||
use Filament\View\PanelsRenderHook;
|
||||
use Illuminate\Support\Facades\Blade;
|
||||
use Illuminate\Support\ServiceProvider;
|
||||
use Illuminate\View\View;
|
||||
|
||||
@@ -28,7 +29,6 @@ class AppServiceProvider extends ServiceProvider
|
||||
public function boot(): void
|
||||
{
|
||||
FilamentView::registerRenderHook(
|
||||
// PanelsRenderHook::RESOURCE_PAGES_LIST_RECORDS_TABS_END,
|
||||
TablesRenderHook::TOOLBAR_SEARCH_AFTER,
|
||||
fn (): View => view('filament.hooks.table-bettype-filters'),
|
||||
scopes: [
|
||||
@@ -36,6 +36,12 @@ class AppServiceProvider extends ServiceProvider
|
||||
]
|
||||
);
|
||||
|
||||
FilamentView::registerRenderHook(
|
||||
PanelsRenderHook::GLOBAL_SEARCH_BEFORE,
|
||||
fn (): string => Blade::render('@livewire(\'client-switch\')')
|
||||
// fn (): string => auth()->user()->hasRole('konto_switch') ? Blade::render('@livewire(\'konto-switch\')') : false
|
||||
);
|
||||
|
||||
Carbon::setLocale(app()->getLocale());
|
||||
|
||||
FilamentColor::register([
|
||||
@@ -44,7 +50,7 @@ class AppServiceProvider extends ServiceProvider
|
||||
'primary' => Color::Blue,
|
||||
'success' => Color::Green,
|
||||
'warning' => Color::Yellow,
|
||||
'info' => Color::Indigo,
|
||||
'info' => Color::Fuchsia,
|
||||
]);
|
||||
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user