basic comparatore completed
This commit is contained in:
1 parent
cbdc6aff47
commit
16cc214db6
80 files changed
+2413
-2794
No files matched your search
@@ -23,11 +23,6 @@ class BettypeResource extends Resource
|
||||
|
||||
protected static string|\UnitEnum|null $navigationGroup = 'Static Data';
|
||||
|
||||
public static function canViewAny(): bool
|
||||
{
|
||||
return auth()->user()->super_admin == 1;
|
||||
}
|
||||
|
||||
public static function form(Schema $schema): Schema
|
||||
{
|
||||
return BettypeForm::configure($schema);
|
||||
|
||||
@@ -24,11 +24,6 @@ class BookmakerResource extends Resource
|
||||
|
||||
protected static string|\UnitEnum|null $navigationGroup = 'Static Data';
|
||||
|
||||
public static function canViewAny(): bool
|
||||
{
|
||||
return auth()->user()->super_admin == 1;
|
||||
}
|
||||
|
||||
public static function form(Schema $schema): Schema
|
||||
{
|
||||
return BookmakerForm::configure($schema);
|
||||
|
||||
@@ -23,11 +23,6 @@ class ClientResource extends Resource
|
||||
|
||||
protected static string|\UnitEnum|null $navigationGroup = 'User';
|
||||
|
||||
public static function canViewAny(): bool
|
||||
{
|
||||
return auth()->user()->super_admin == 1;
|
||||
}
|
||||
|
||||
public static function form(Schema $schema): Schema
|
||||
{
|
||||
return ClientForm::configure($schema);
|
||||
|
||||
@@ -36,11 +36,6 @@ class CompetitionGroupFilterResource extends Resource
|
||||
|
||||
protected static ?string $pluralModelLabel = 'Comp Groups';
|
||||
|
||||
public static function canViewAny(): bool
|
||||
{
|
||||
return auth()->user()->super_admin == 1;
|
||||
}
|
||||
|
||||
public static function form(Schema $schema): Schema
|
||||
{
|
||||
return CompetitionGroupFilterForm::configure($schema);
|
||||
|
||||
@@ -30,11 +30,6 @@ class CountryResource extends Resource
|
||||
|
||||
protected static string|\UnitEnum|null $navigationGroup = 'Static Data';
|
||||
|
||||
public static function canViewAny(): bool
|
||||
{
|
||||
return auth()->user()->super_admin == 1;
|
||||
}
|
||||
|
||||
public static function form(Schema $schema): Schema
|
||||
{
|
||||
return $schema
|
||||
|
||||
@@ -36,11 +36,6 @@ class ElementFilterResource extends Resource
|
||||
|
||||
protected static ?string $pluralModelLabel = 'Elements';
|
||||
|
||||
public static function canViewAny(): bool
|
||||
{
|
||||
return auth()->user()->super_admin == 1;
|
||||
}
|
||||
|
||||
public static function form(Schema $schema): Schema
|
||||
{
|
||||
return ElementFilterForm::configure($schema);
|
||||
|
||||
@@ -7,10 +7,12 @@ use App\Filament\Tables\Columns\ColumnDc;
|
||||
use App\Filament\Tables\Columns\ColumnDnb;
|
||||
use App\Filament\Tables\Columns\ColumnGgng;
|
||||
use App\Filament\Tables\Columns\ColumnTotal;
|
||||
use App\Filament\Tables\Columns\ColumnTq;
|
||||
use App\Filament\Tables\Columns\MatchIds;
|
||||
use App\Models\BettypeUser;
|
||||
use App\Models\Country;
|
||||
use App\Models\Event;
|
||||
use App\Models\MultilineClient;
|
||||
use Carbon\Carbon;
|
||||
use Filament\Actions\Action;
|
||||
use Filament\Actions\ActionGroup;
|
||||
@@ -19,8 +21,8 @@ use Filament\Actions\EditAction;
|
||||
use Filament\Forms\Components\Select;
|
||||
use Filament\Schemas\Components\Utilities\Get;
|
||||
use Filament\Support\Enums\FontWeight;
|
||||
use Filament\Support\Enums\VerticalAlignment;
|
||||
use Filament\Tables\Columns\IconColumn;
|
||||
use Filament\Tables\Columns\Layout\View;
|
||||
use Filament\Tables\Columns\TextColumn;
|
||||
use Filament\Tables\Enums\FiltersLayout;
|
||||
use Filament\Tables\Filters\Filter;
|
||||
@@ -31,6 +33,81 @@ class EventsTable
|
||||
{
|
||||
public static $bettype_settings = [];
|
||||
|
||||
public static $multiline_bookmaker = [];
|
||||
|
||||
public static $odds_3ways = [];
|
||||
|
||||
public static $odds_totals = [];
|
||||
|
||||
public static $odds_totals_q1 = [];
|
||||
|
||||
public static $odds_dc = [];
|
||||
|
||||
public static $odds_dnb = [];
|
||||
|
||||
public static $odds_ggng = [];
|
||||
|
||||
public static $odds_handicaps = [];
|
||||
|
||||
public static $odds_handicaps_q1 = [];
|
||||
|
||||
public static $odds_2ways = [];
|
||||
|
||||
public static $odds_2ways_s1 = [];
|
||||
|
||||
public static $odds_tq = [];
|
||||
|
||||
public static function load_multiline_bookmaker()
|
||||
{
|
||||
$res = MultilineClient::where('client_id', auth()->user()->client_id)->where('sport_id', auth()->user()->sport_id)->select('bookmaker_id', 'multiline_setting_id')->orderBy('multiline_setting_id')->orderBy('sort')->get();
|
||||
|
||||
foreach ($res as $value) {
|
||||
switch ($value->multiline_setting_id) {
|
||||
case 1:
|
||||
case 13:
|
||||
self::$odds_3ways[] = $value->bookmaker_id;
|
||||
break;
|
||||
case 2:
|
||||
self::$odds_dc[] = $value->bookmaker_id;
|
||||
break;
|
||||
case 3:
|
||||
self::$odds_dnb[] = $value->bookmaker_id;
|
||||
break;
|
||||
case 4:
|
||||
self::$odds_ggng[] = $value->bookmaker_id;
|
||||
break;
|
||||
case 5:
|
||||
self::$odds_tq[] = $value->bookmaker_id;
|
||||
break;
|
||||
case 8:
|
||||
case 14:
|
||||
self::$odds_handicaps[] = $value->bookmaker_id;
|
||||
break;
|
||||
case 9:
|
||||
self::$odds_handicaps_q1[] = $value->bookmaker_id;
|
||||
break;
|
||||
case 7:
|
||||
case 12:
|
||||
case 16:
|
||||
self::$odds_2ways[] = $value->bookmaker_id;
|
||||
break;
|
||||
case 17:
|
||||
self::$odds_2ways_s1[] = $value->bookmaker_id;
|
||||
break;
|
||||
case 6:
|
||||
case 10:
|
||||
case 15:
|
||||
case 18:
|
||||
self::$odds_totals[] = $value->bookmaker_id;
|
||||
break;
|
||||
case 11:
|
||||
self::$odds_totals_q1[] = $value->bookmaker_id;
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public static function load_bettype_settings()
|
||||
{
|
||||
self::$bettype_settings = BettypeUser::where('user_id', auth()->user()->id)->where('sport_id', auth()->user()->sport_id)->where('is_active', 1)->pluck('multiline_setting_id')->toArray();
|
||||
@@ -40,6 +117,8 @@ class EventsTable
|
||||
{
|
||||
self::load_bettype_settings();
|
||||
|
||||
self::load_multiline_bookmaker();
|
||||
|
||||
return $table
|
||||
->striped()
|
||||
->columns([
|
||||
@@ -49,55 +128,86 @@ class EventsTable
|
||||
->color('primary')
|
||||
->width(30)
|
||||
->icon(fn ($record) => $record->sport->icon)
|
||||
->tooltip(fn ($record) => $record->id),
|
||||
// MatchIds::make('match_ids')
|
||||
// ->grow(false),
|
||||
TextColumn::make('id')->hidden()->searchable(),
|
||||
TextColumn::make('betsapi_id')->hidden()->searchable(),
|
||||
TextColumn::make('betradar_id')->hidden()->searchable(),
|
||||
TextColumn::make('bet365_id')->hidden()->searchable(),
|
||||
TextColumn::make('bwin_id')->hidden()->searchable(),
|
||||
->tooltip(fn ($record) => $record->id)
|
||||
->visibleFrom('lg'),
|
||||
|
||||
// MatchIds::make('match_ids')->grow(false)->visibleFrom('xl'),
|
||||
|
||||
TextColumn::make('starttime')
|
||||
->label('Start')
|
||||
->alignCenter()
|
||||
->dateTime('H:i')
|
||||
->weight(FontWeight::Bold)
|
||||
->description(fn ($state): string => Carbon::createFromDate($state)->format('d. M')),
|
||||
|
||||
TextColumn::make('country.name')
|
||||
->width('20rem')
|
||||
->searchable()
|
||||
->wrap()
|
||||
->color('gray')
|
||||
->label('Event')
|
||||
->icon(fn ($record) => $record->country->icon)
|
||||
->description(fn ($record) => $record->competition_group->name),
|
||||
|
||||
TextColumn::make('home.name')
|
||||
->wrap()
|
||||
->searchable()
|
||||
->alignRight(),
|
||||
|
||||
TextColumn::make('away.name')
|
||||
->wrap()
|
||||
->searchable(),
|
||||
Column3way::make('odds3way')->visible(fn () => in_array(1, self::$bettype_settings))->width(225)->label('1 X 2'),
|
||||
ColumnDc::make('oddsdc')->visible(fn () => in_array(2, self::$bettype_settings))->width(225)->label('Double Chance'),
|
||||
ColumnDnb::make('oddsdnb')->visible(fn () => in_array(3, self::$bettype_settings))->width(190)->label('Draw No Bet'),
|
||||
ColumnGgng::make('oddsggng')->visible(fn () => in_array(4, self::$bettype_settings))->width(190)->label('Goal No Goal'),
|
||||
ColumnGgng::make('oddstq')->visible(fn () => in_array(5, self::$bettype_settings))->width(190)->label('To Qualify'),
|
||||
ColumnTotal::make('oddstotal')->visible(fn () => in_array(6, self::$bettype_settings))->width(225)->label('Totals'),
|
||||
|
||||
// Column3way::make('odds3way')->visible(fn () => in_array(1, self::$bettype_settings))->width(225)->label(fn () => view('filament.tables.columns.multiline.labels', ['menu' => '1x2'])),
|
||||
// ColumnDc::make('oddsdc')->visible(fn () => in_array(2, self::$bettype_settings))->width(225)->label(fn () => view('filament.tables.columns.multiline.labels', ['menu' => 'dc'])),
|
||||
// ColumnDnb::make('oddsdnb')->visible(fn () => in_array(3, self::$bettype_settings))->width(190)->label(fn () => view('filament.tables.columns.multiline.labels', ['menu' => 'dnb'])),
|
||||
// ColumnGgng::make('oddsggng')->visible(fn () => in_array(4, self::$bettype_settings))->width(190)->label(fn () => view('filament.tables.columns.multiline.labels', ['menu' => 'gg'])),
|
||||
// ColumnGgng::make('oddstq')->visible(fn () => in_array(5, self::$bettype_settings))->width(190)->label(fn () => view('filament.tables.columns.multiline.labels', ['menu' => 'tq'])),
|
||||
// ColumnTotal::make('oddstotal')->visible(fn () => in_array(6, self::$bettype_settings))->width(225)->label(fn () => view('filament.tables.columns.multiline.labels', ['menu' => 'ou'])),
|
||||
])
|
||||
Column3way::make('odds3way')->bookmakers(self::$odds_3ways)
|
||||
->visible(fn () => in_array(1, self::$bettype_settings))
|
||||
->verticalAlignment(VerticalAlignment::Start)
|
||||
->width(225)
|
||||
->label('1 X 2')
|
||||
->extraCellAttributes(['class' => 'border-l border-gray-200 dark:border-gray-800']),
|
||||
|
||||
ColumnDc::make('oddsdc')->bookmakers(self::$odds_dc)
|
||||
->visible(fn () => in_array(2, self::$bettype_settings))
|
||||
->verticalAlignment(VerticalAlignment::Start)
|
||||
->width(225)
|
||||
->label('Double Chance')
|
||||
->extraCellAttributes(['class' => 'border-l border-gray-200 dark:border-gray-800']),
|
||||
|
||||
ColumnDnb::make('oddsdnb')->bookmakers(self::$odds_dnb)
|
||||
->visible(fn () => in_array(3, self::$bettype_settings))
|
||||
->verticalAlignment(VerticalAlignment::Start)
|
||||
->width(190)
|
||||
->label('Draw No Bet')
|
||||
->extraCellAttributes(['class' => 'border-l border-gray-200 dark:border-gray-800']),
|
||||
|
||||
ColumnGgng::make('oddsggng')->bookmakers(self::$odds_ggng)
|
||||
->visible(fn () => in_array(4, self::$bettype_settings))
|
||||
->verticalAlignment(VerticalAlignment::Start)
|
||||
->width(190)
|
||||
->label('Goal No Goal')
|
||||
->extraCellAttributes(['class' => 'border-l border-gray-200 dark:border-gray-800']),
|
||||
|
||||
ColumnTq::make('oddstq')->bookmakers(self::$odds_tq)
|
||||
->visible(fn () => in_array(5, self::$bettype_settings))
|
||||
->verticalAlignment(VerticalAlignment::Start)
|
||||
->width(190)
|
||||
->label('To Qualify')
|
||||
->extraCellAttributes(['class' => 'border-l border-gray-200 dark:border-gray-800']),
|
||||
|
||||
ColumnTotal::make('oddstotal')->bookmakers(self::$odds_totals)
|
||||
->visible(fn () => in_array(6, self::$bettype_settings))
|
||||
->verticalAlignment(VerticalAlignment::Start)
|
||||
->width(225)
|
||||
->label('Totals')
|
||||
->extraCellAttributes(['class' => 'border-l border-gray-200 dark:border-gray-800']),
|
||||
])->searchable(['id', 'betsapi_id', 'betradar_id', 'bet365_id', 'bwin_id'])
|
||||
->poll('10s')
|
||||
->defaultSort('starttime', 'ASC')
|
||||
->filters([
|
||||
Filter::make('events')
|
||||
->schema([
|
||||
Select::make('country_id')
|
||||
->label('Country')
|
||||
->placeholder('Country')
|
||||
->hiddenLabel()
|
||||
->label('')
|
||||
->searchable()
|
||||
->preload()
|
||||
->options(function () {
|
||||
@@ -111,7 +221,9 @@ class EventsTable
|
||||
$set('competition_group_id', null);
|
||||
}),
|
||||
Select::make('competition_group_id')
|
||||
->label('League')
|
||||
->placeholder('League')
|
||||
->hiddenLabel()
|
||||
->label('')
|
||||
->multiple()
|
||||
->columnSpan(2)
|
||||
->searchable()
|
||||
@@ -149,10 +261,10 @@ class EventsTable
|
||||
->recordActions([
|
||||
ActionGroup::make([
|
||||
// EditAction::make(),
|
||||
// DeleteAction::make(),
|
||||
DeleteAction::make()->visible(fn () => auth()->user()->hasRole('super_admin')),
|
||||
Action::make('txodds_odds')
|
||||
->label('TxOdds')
|
||||
->disabled(fn () => ! auth()->user()->super_admin)
|
||||
->disabled(fn () => ! auth()->user()->hasRole('super_admin'))
|
||||
->icon('heroicon-o-arrow-top-right-on-square')
|
||||
->url(fn ($record): string => route('txodds_odds', ['sportid' => $record->sport_id, 'txoddsid' => $record->id]))
|
||||
->openUrlInNewTab(),
|
||||
|
||||
@@ -33,11 +33,6 @@ class GroupFilterResource extends Resource
|
||||
|
||||
protected static ?string $pluralModelLabel = 'Groups';
|
||||
|
||||
public static function canViewAny(): bool
|
||||
{
|
||||
return auth()->user()->super_admin == 1;
|
||||
}
|
||||
|
||||
public static function form(Schema $schema): Schema
|
||||
{
|
||||
return GroupFilterForm::configure($schema);
|
||||
|
||||
@@ -13,9 +13,7 @@ class ListMultilineClients extends ListRecords
|
||||
protected function getHeaderActions(): array
|
||||
{
|
||||
return [
|
||||
// CreateAction::make()
|
||||
// ->createAnother(false)
|
||||
// ->hidden(! auth()->user()->super_admin),
|
||||
// CreateAction::make()->createAnother(false),
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -27,11 +27,6 @@ class ProviderResource extends Resource
|
||||
|
||||
protected static string|UnitEnum|null $navigationGroup = 'Grapper';
|
||||
|
||||
public static function canViewAny(): bool
|
||||
{
|
||||
return auth()->user()->super_admin == 1;
|
||||
}
|
||||
|
||||
public static function form(Schema $schema): Schema
|
||||
{
|
||||
return ProviderForm::configure($schema);
|
||||
|
||||
@@ -28,11 +28,6 @@ class SportResource extends Resource
|
||||
|
||||
protected static string|\UnitEnum|null $navigationGroup = 'Static Data';
|
||||
|
||||
public static function canViewAny(): bool
|
||||
{
|
||||
return auth()->user()->super_admin == 1;
|
||||
}
|
||||
|
||||
public static function form(Schema $schema): Schema
|
||||
{
|
||||
return $schema
|
||||
|
||||
@@ -23,11 +23,6 @@ class SupervisorResource extends Resource
|
||||
|
||||
protected static string|\UnitEnum|null $navigationGroup = 'Grapper';
|
||||
|
||||
public static function canViewAny(): bool
|
||||
{
|
||||
return auth()->user()->super_admin == 1;
|
||||
}
|
||||
|
||||
public static function form(Schema $schema): Schema
|
||||
{
|
||||
return SupervisorForm::configure($schema);
|
||||
|
||||
@@ -2,7 +2,8 @@
|
||||
|
||||
namespace App\Filament\Resources\Users\Schemas;
|
||||
|
||||
use Filament\Forms\Components\DateTimePicker;
|
||||
use App\Models\Bookmaker;
|
||||
use App\Models\Client;
|
||||
use Filament\Forms\Components\Select;
|
||||
use Filament\Forms\Components\TextInput;
|
||||
use Filament\Schemas\Schema;
|
||||
@@ -19,14 +20,22 @@ class UserForm
|
||||
->label('Email address')
|
||||
->email()
|
||||
->required(),
|
||||
// DateTimePicker::make('email_verified_at'),
|
||||
// TextInput::make('password')
|
||||
// ->password()
|
||||
// ->required(),
|
||||
Select::make('client_id')
|
||||
->relationship('client', 'name')
|
||||
->preload(),
|
||||
Select::make('bookmaker_id')
|
||||
->label('Active Bookmaker')
|
||||
->options(function () {
|
||||
$bookmaker = Client::where('id', auth()->user()->client_id)->value('bookmaker');
|
||||
|
||||
return Bookmaker::query()->whereIn('id', $bookmaker)->pluck('name', 'id');
|
||||
})
|
||||
->preload(),
|
||||
Select::make('roles')
|
||||
->label('Rollen')
|
||||
->prefixIcon('phosphor-gear')
|
||||
->aboveContent('Only visible for super_admin')
|
||||
->visible(fn () => auth()->user()->hasRole('super_admin'))
|
||||
->relationship('roles', 'name')
|
||||
->multiple()
|
||||
->preload()
|
||||
|
||||
@@ -20,6 +20,8 @@ class UsersTable
|
||||
->label('Email address')
|
||||
->searchable(),
|
||||
TextColumn::make('client.name')->badge(),
|
||||
TextColumn::make('roles.name')->badge()->color('success')->wrap(),
|
||||
TextColumn::make('bookmaker.name')->badge()->color('warning'),
|
||||
TextColumn::make('created_at')
|
||||
->dateTime()
|
||||
->sortable()
|
||||
|
||||
@@ -25,11 +25,6 @@ class UserResource extends Resource
|
||||
|
||||
protected static string|\UnitEnum|null $navigationGroup = 'User';
|
||||
|
||||
public static function canViewAny(): bool
|
||||
{
|
||||
return auth()->user()->super_admin == 1;
|
||||
}
|
||||
|
||||
public static function form(Schema $schema): Schema
|
||||
{
|
||||
return UserForm::configure($schema);
|
||||
|
||||
Reference in new issue
Block a user