wip
This commit is contained in:
1 parent
8a5db5d6da
commit
368af4b565
16 files changed
+97
-281
No files matched your search
@@ -35,6 +35,10 @@ class ListEvents extends ListRecords
|
||||
public function clearFilters(): void
|
||||
{
|
||||
$this->removeTableFilters();
|
||||
|
||||
// $this->dispatch('refreshMapperLeft');
|
||||
|
||||
// $this->dispatch('refreshMapperRight');
|
||||
}
|
||||
|
||||
public function updateStar(): void
|
||||
|
||||
@@ -26,6 +26,7 @@ use Filament\Actions\BulkActionGroup;
|
||||
use Filament\Actions\DeleteAction;
|
||||
use Filament\Actions\DeleteBulkAction;
|
||||
use Filament\Forms\Components\Hidden;
|
||||
use Filament\Forms\Components\Radio;
|
||||
use Filament\Forms\Components\Select;
|
||||
use Filament\Forms\Components\Textarea;
|
||||
use Filament\Forms\Components\TextInput;
|
||||
@@ -43,7 +44,6 @@ use Filament\Tables\Table;
|
||||
use Illuminate\Database\Eloquent\Builder;
|
||||
use Illuminate\Support\Carbon;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use JaOcero\RadioDeck\Forms\Components\RadioDeck;
|
||||
|
||||
class EventsTable
|
||||
{
|
||||
@@ -65,7 +65,7 @@ class EventsTable
|
||||
|
||||
return $table
|
||||
->striped()
|
||||
->poll('10s')
|
||||
// ->poll('10s')
|
||||
->deferLoading()
|
||||
->defaultPaginationPageOption(5)
|
||||
->paginated([5, 10, 15])
|
||||
@@ -619,6 +619,7 @@ class EventsTable
|
||||
->color(fn ($record) => $record->event_user_note->isEmpty() ? 'gray' : 'info'),
|
||||
Action::make('event_notification')
|
||||
->modalWidth(Width::Large)
|
||||
->modalDescription('Monitoring favorit and if condition is matchted the system will emit a notification')
|
||||
->modalSubmitActionLabel('Save')
|
||||
->extraModalFooterActions(fn (Action $action, $record) => $record->event_user_notification->isEmpty() ? [] : [$action->makeModalSubmitAction('Delete', arguments: ['delete' => true])->color('danger')])
|
||||
->modalIcon('phosphor-bell')
|
||||
@@ -639,27 +640,18 @@ class EventsTable
|
||||
})
|
||||
->schema([
|
||||
Hidden::make('event_user_notification_id'),
|
||||
Toggle::make('is_notified')->label('Monitoring Favorit')
|
||||
// ->aboveContent('If a notification has been send "Monitoring" will be off')
|
||||
Toggle::make('is_notified')->label('On/Off')
|
||||
->onColor('gray')
|
||||
->offColor('info'),
|
||||
RadioDeck::make('odds_table_id')
|
||||
Radio::make('odds_table_id')
|
||||
->label('Bettype')
|
||||
->columns(3)
|
||||
->colors('info')
|
||||
->required()
|
||||
->extraCardsAttributes([ // Extra attributes for card elements
|
||||
'class' => 'dark:bg-gray-900!',
|
||||
])
|
||||
->options(fn ($record) => OddsTable::options_sport()),
|
||||
RadioDeck::make('alarm_level_id')
|
||||
Radio::make('alarm_level_id')
|
||||
->label('Alarm level')
|
||||
->colors('info')
|
||||
->columns(3)
|
||||
->required()
|
||||
->extraCardsAttributes([ // Extra attributes for card elements
|
||||
'class' => 'dark:bg-gray-900!',
|
||||
])
|
||||
->options([
|
||||
'1' => 'Level 1',
|
||||
'2' => 'Level 2',
|
||||
|
||||
@@ -74,10 +74,7 @@ class AlarmBookmaker extends Component implements HasActions, HasSchemas, HasTab
|
||||
->width('2rem')
|
||||
->prefix('Threshold:')
|
||||
->rules(['required', 'decimal:2', 'between:0,2']),
|
||||
ToggleColumn::make('disabled')
|
||||
->label('Status')
|
||||
->offColor('success')
|
||||
->onColor('danger'),
|
||||
ToggleColumn::make('disabled'),
|
||||
])
|
||||
->defaultSort('level_id')
|
||||
->deferFilters(false)
|
||||
|
||||
@@ -56,6 +56,8 @@ class ComparingBookmakerMenu extends Component implements HasActions, HasSchemas
|
||||
->where('client_bookmaker_id', $this->user->bookmaker_id)
|
||||
->orderBy('sorting')
|
||||
)
|
||||
->defaultPaginationPageOption(10)
|
||||
->paginated([5, 10, 15, 30, 50])
|
||||
->columns([
|
||||
TextColumn::make('Position')
|
||||
->alignCenter()
|
||||
@@ -73,7 +75,7 @@ class ComparingBookmakerMenu extends Component implements HasActions, HasSchemas
|
||||
->rules(['required', 'integer', 'between:100,200']),
|
||||
// ToggleColumn::make('is_active'),
|
||||
])
|
||||
->searchable(['bookmaker.name'])
|
||||
->searchable(['bookmaker_id', 'bookmaker.name'])
|
||||
// ->filters([
|
||||
// TernaryFilter::make('is_active')
|
||||
// ->columnSpan(2)
|
||||
|
||||
@@ -9,7 +9,6 @@ use App\Models\CompetitionGroup;
|
||||
use App\Models\Country;
|
||||
use App\Models\Event;
|
||||
use App\Models\Mapper;
|
||||
use App\Models\User;
|
||||
use Carbon\Carbon;
|
||||
use Filament\Actions\Action;
|
||||
use Filament\Actions\Concerns\InteractsWithActions;
|
||||
@@ -42,8 +41,6 @@ class MapperLeft extends Component implements HasActions, HasSchemas, HasTable
|
||||
|
||||
public $search_left = false;
|
||||
|
||||
public $user;
|
||||
|
||||
protected $listeners = [
|
||||
'refreshMapperLeft' => '$refresh',
|
||||
];
|
||||
@@ -65,12 +62,11 @@ class MapperLeft extends Component implements HasActions, HasSchemas, HasTable
|
||||
$this->dispatch('refreshMapperLeft');
|
||||
}
|
||||
|
||||
#[Lazy]
|
||||
public function table(Table $table): Table
|
||||
{
|
||||
$this->user = User::getUser();
|
||||
|
||||
return $table
|
||||
->query(LoadEvents::load($this->search_left, $this->user->sport_id))
|
||||
->query(LoadEvents::load($this->search_left, auth()->user()->sport_id))
|
||||
->columns([
|
||||
MapperLeftColumn::make('left')->label(''),
|
||||
])
|
||||
@@ -82,14 +78,14 @@ class MapperLeft extends Component implements HasActions, HasSchemas, HasTable
|
||||
Select::make('country_id')
|
||||
->placeholder('Country')
|
||||
->hiddenLabel()
|
||||
->multiple()
|
||||
// ->multiple()
|
||||
->columnSpan(2)
|
||||
->searchable()
|
||||
->preload()
|
||||
->options(function () {
|
||||
$res = Event::query()->where('sport_id', $this->user->sport_id)->where('betradar_id', 0)->where('starttime', '>', Carbon::now())->groupBy('country_id')->pluck('country_id')->toArray();
|
||||
$res = Event::query()->where('sport_id', auth()->user()->sport_id)->where('betradar_id', 0)->where('starttime', '>', Carbon::now())->groupBy('country_id')->pluck('country_id')->toArray();
|
||||
|
||||
return Country::query()->whereIn('id', $res)->pluck('name', 'id');
|
||||
return Country::query()->where('id', $res)->orderBy('name')->pluck('name', 'id');
|
||||
})
|
||||
->live()
|
||||
->reactive()
|
||||
@@ -105,12 +101,12 @@ class MapperLeft extends Component implements HasActions, HasSchemas, HasTable
|
||||
->searchable()
|
||||
->options(function (Get $get) {
|
||||
if ($get('country_id')) {
|
||||
$res = Event::query()->where('sport_id', $this->user->sport_id)->where('betradar_id', 0)->where('starttime', '>', Carbon::now())->whereIn('country_id', $get('country_id'))->groupBy('competition_group_id')->pluck('competition_group_id')->toArray();
|
||||
$res = Event::query()->where('sport_id', auth()->user()->sport_id)->where('betradar_id', 0)->where('starttime', '>', Carbon::now())->where('country_id', $get('country_id'))->groupBy('competition_group_id')->pluck('competition_group_id')->toArray();
|
||||
} else {
|
||||
$res = Event::query()->where('sport_id', $this->user->sport_id)->where('betradar_id', 0)->where('starttime', '>', Carbon::now())->groupBy('competition_group_id')->pluck('competition_group_id')->toArray();
|
||||
$res = Event::query()->where('sport_id', auth()->user()->sport_id)->where('betradar_id', 0)->where('starttime', '>', Carbon::now())->groupBy('competition_group_id')->pluck('competition_group_id')->toArray();
|
||||
}
|
||||
|
||||
$comps = CompetitionGroup::with('country')->whereIn('id', $res)->get();
|
||||
$comps = CompetitionGroup::with('country')->where('id', $res)->get();
|
||||
|
||||
$arr = [];
|
||||
foreach ($comps as $val) {
|
||||
@@ -155,7 +151,6 @@ class MapperLeft extends Component implements HasActions, HasSchemas, HasTable
|
||||
Action::make('refreshMapperLeft')
|
||||
->hiddenLabel()
|
||||
->icon('phosphor-x')
|
||||
->color('danger')
|
||||
->size(Size::Small)
|
||||
->action(function (Component $livewire) {
|
||||
$this->search_left = '';
|
||||
|
||||
@@ -8,7 +8,6 @@ use App\Livewire\Mapper\StoreMapped;
|
||||
use App\Models\Country;
|
||||
use App\Models\Event;
|
||||
use App\Models\Mapper;
|
||||
use App\Models\User;
|
||||
use Filament\Actions\Action;
|
||||
use Filament\Actions\Concerns\InteractsWithActions;
|
||||
use Filament\Actions\Contracts\HasActions;
|
||||
@@ -45,8 +44,6 @@ class MapperRight extends Component implements HasActions, HasSchemas, HasTable
|
||||
'refreshMapperRight' => '$refresh',
|
||||
];
|
||||
|
||||
public $user;
|
||||
|
||||
public function removeTableFilter(string $filterName, ?string $field = null, bool $shouldTriggerUpdatedFiltersHook = true): void
|
||||
{
|
||||
$searchValues = preg_split('/\s+/', $this->search_right, -1, PREG_SPLIT_NO_EMPTY);
|
||||
@@ -66,10 +63,8 @@ class MapperRight extends Component implements HasActions, HasSchemas, HasTable
|
||||
|
||||
public function table(Table $table): Table
|
||||
{
|
||||
$this->user = User::getUser();
|
||||
|
||||
return $table
|
||||
->query(LoadProvider::load($this->search_right, $this->user))
|
||||
->query(LoadProvider::load($this->search_right, auth()->user()))
|
||||
->columns([
|
||||
MapperRightColumn::make('right')->label(''),
|
||||
])->searchable(['home', 'away'])
|
||||
@@ -78,17 +73,17 @@ class MapperRight extends Component implements HasActions, HasSchemas, HasTable
|
||||
Filter::make('events')
|
||||
->schema([
|
||||
Select::make('country_id')
|
||||
->visible(fn () => in_array($this->user->provider_id, [3, 4]))
|
||||
->visible(fn () => in_array(auth()->user()->provider_id, [3, 4]))
|
||||
->placeholder('Country')
|
||||
->hiddenLabel()
|
||||
->label('')
|
||||
->searchable()
|
||||
->preload()
|
||||
->multiple()
|
||||
// ->multiple()
|
||||
->columnSpan(2)
|
||||
->live()
|
||||
->options(function (Get $get) {
|
||||
return Mapper::query()->where('sport_id', $this->user->sport_id)->where('provider_id', $this->user->provider_id)->where('starttime', '>', Carbon::now())->groupBy('country_id')->pluck('country', 'country_id')->toArray();
|
||||
return Mapper::query()->where('sport_id', auth()->user()->sport_id)->where('provider_id', auth()->user()->provider_id)->where('starttime', '>', Carbon::now())->groupBy('country_id')->pluck('country', 'country_id')->toArray();
|
||||
})
|
||||
->reactive()
|
||||
->afterStateUpdated(function (callable $set) {
|
||||
@@ -96,17 +91,17 @@ class MapperRight extends Component implements HasActions, HasSchemas, HasTable
|
||||
})
|
||||
->placeholder('Country'),
|
||||
Select::make('group_cc')
|
||||
->visible(fn () => $this->user->provider_id == 2)
|
||||
->visible(fn () => auth()->user()->provider_id == 2)
|
||||
->placeholder('Country')
|
||||
->hiddenLabel()
|
||||
->label('')
|
||||
->searchable()
|
||||
->preload()
|
||||
->multiple()
|
||||
// ->multiple()
|
||||
->columnSpan(2)
|
||||
->live()
|
||||
->options(function () {
|
||||
$res = Mapper::query()->where('sport_id', $this->user->sport_id)->where('provider_id', $this->user->provider_id)->where('starttime', '>', Carbon::now())->groupBy('group_cc')->pluck('group_cc')->toArray();
|
||||
$res = Mapper::query()->where('sport_id', auth()->user()->sport_id)->where('provider_id', auth()->user()->provider_id)->where('starttime', '>', Carbon::now())->groupBy('group_cc')->pluck('group_cc')->toArray();
|
||||
|
||||
return Country::query()->whereIn('iso2', $res)->pluck('name', 'iso2');
|
||||
})
|
||||
@@ -126,11 +121,11 @@ class MapperRight extends Component implements HasActions, HasSchemas, HasTable
|
||||
->multiple()
|
||||
->options(function (Get $get) {
|
||||
if ($get('country_id')) {
|
||||
return Mapper::query()->where('sport_id', $this->user->sport_id)->where('provider_id', $this->user->provider_id)->where('starttime', '>', Carbon::now())->whereIn('country_id', $get('country_id'))->groupBy('group_id')->pluck('group', 'group_id')->toArray();
|
||||
return Mapper::query()->where('sport_id', auth()->user()->sport_id)->where('provider_id', auth()->user()->provider_id)->where('starttime', '>', Carbon::now())->where('country_id', $get('country'))->groupBy('group_id')->pluck('group', 'group_id')->toArray();
|
||||
} elseif ($get('group_cc')) {
|
||||
return Mapper::query()->where('sport_id', $this->user->sport_id)->where('provider_id', $this->user->provider_id)->where('starttime', '>', Carbon::now())->whereIn('group_cc', $get('group_cc'))->groupBy('group_id')->pluck('group', 'group_id')->toArray();
|
||||
return Mapper::query()->where('sport_id', auth()->user()->sport_id)->where('provider_id', auth()->user()->provider_id)->where('starttime', '>', Carbon::now())->where('group_cc', $get('group_cc'))->groupBy('group_id')->pluck('group', 'group_id')->toArray();
|
||||
} else {
|
||||
return Mapper::query()->where('sport_id', $this->user->sport_id)->where('provider_id', $this->user->provider_id)->where('starttime', '>', Carbon::now())->groupBy('group_id')->pluck('group', 'group_id')->toArray();
|
||||
return Mapper::query()->where('sport_id', auth()->user()->sport_id)->where('provider_id', auth()->user()->provider_id)->where('starttime', '>', Carbon::now())->groupBy('group_id')->pluck('group', 'group_id')->toArray();
|
||||
}
|
||||
})
|
||||
->live(),
|
||||
@@ -139,10 +134,10 @@ class MapperRight extends Component implements HasActions, HasSchemas, HasTable
|
||||
return $query
|
||||
->when(
|
||||
$data['country_id'],
|
||||
fn (Builder $query, $country_id) => $query->whereIn('country_id', $country_id)
|
||||
fn (Builder $query, $country_id) => $query->where('country_id', $country_id)
|
||||
)->when(
|
||||
$data['group_cc'],
|
||||
fn (Builder $query, $group_cc) => $query->whereIn('group_cc', $group_cc)
|
||||
fn (Builder $query, $group_cc) => $query->where('group_cc', $group_cc)
|
||||
)->when(
|
||||
$data['group_id'],
|
||||
fn (Builder $query, $group_id) => $query->whereIn('group_id', $group_id)
|
||||
@@ -168,7 +163,6 @@ class MapperRight extends Component implements HasActions, HasSchemas, HasTable
|
||||
Action::make('refreshMapperRight')
|
||||
->hiddenLabel()
|
||||
->icon('phosphor-x')
|
||||
->color('danger')
|
||||
->size(Size::Small)
|
||||
->action(function (Component $livewire) {
|
||||
$this->search_right = '';
|
||||
|
||||
@@ -21,7 +21,6 @@ use Filament\Tables\Filters\Filter;
|
||||
use Filament\Tables\Table;
|
||||
use Illuminate\Contracts\View\View;
|
||||
use Illuminate\Database\Eloquent\Builder;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Livewire\Component;
|
||||
|
||||
class MultilineBookmaker extends Component implements HasActions, HasSchemas, HasTable
|
||||
@@ -52,21 +51,12 @@ class MultilineBookmaker extends Component implements HasActions, HasSchemas, Ha
|
||||
SelectColumn::make('bookmaker_id')
|
||||
->label('Bookmaker')
|
||||
->width('2rem')
|
||||
->options(function ($livewire, $record) {
|
||||
$table = MultilineSetting::where('id', $livewire->tableFilters['multiline_setting_id'])->value('table');
|
||||
|
||||
$bookies = DB::table($table)
|
||||
->where('sport_id', auth()->user()->sport_id)
|
||||
->groupBy('bookmaker_id')->pluck('bookmaker_id');
|
||||
|
||||
$res = Bookmaker::whereIn('id', $bookies)->pluck('name', 'id');
|
||||
$arr = [];
|
||||
foreach ($res as $id => $name) {
|
||||
$arr[$id] = $name;
|
||||
->options(function () {
|
||||
if (auth()->user()->sport_id == 1) {
|
||||
Bookmaker::where('in_soccer', 1)->pluck('name', 'id');
|
||||
} else {
|
||||
Bookmaker::where('in_other', 1)->pluck('name', 'id');
|
||||
}
|
||||
asort($arr);
|
||||
|
||||
return $arr;
|
||||
}),
|
||||
])
|
||||
->defaultSort('sort')
|
||||
@@ -77,7 +67,7 @@ class MultilineBookmaker extends Component implements HasActions, HasSchemas, Ha
|
||||
Radio::make('multiline_setting_id')
|
||||
->extraAttributes(['id' => 'multiline_setting'])
|
||||
->inline()
|
||||
->default(fn ($record) => MultilineSetting::where('sport_id', auth()->user()->sport_id)->pluck('id')->first())
|
||||
->default(-1)
|
||||
->columnSpan(6)
|
||||
->columnSpanFull()
|
||||
->hiddenLabel()
|
||||
|
||||
@@ -53,10 +53,6 @@ class SportSwitcher extends Component
|
||||
|
||||
$this->dispatch('refreshComparingBookmakerMenu');
|
||||
|
||||
$this->dispatch('refreshMapperLeft');
|
||||
|
||||
$this->dispatch('refreshMapperRight');
|
||||
|
||||
$this->dispatch('refreshlarmBookmaker');
|
||||
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user