toggle difference s book and partner; remove sport froma larm filter
This commit is contained in:
1 parent
7c0fd2b7a0
commit
4e64f2f318
12 files changed
+84
-90
No files matched your search
@@ -28,7 +28,9 @@ class BettypeToggle extends Component
|
||||
$this->bettype_toggles = [];
|
||||
|
||||
$this->countBookmaker();
|
||||
|
||||
$this->countPartner();
|
||||
|
||||
$this->setDifferences();
|
||||
|
||||
$res = BettypeUser::with('multiline_setting')
|
||||
@@ -62,6 +64,7 @@ class BettypeToggle extends Component
|
||||
public function toggleBettype($multiline_setting_id)
|
||||
{
|
||||
BettypeUser::where('multiline_setting_id', $multiline_setting_id)->update(['is_active' => DB::raw('!is_active')]);
|
||||
|
||||
$this->dispatch('refreshBettypeMenu');
|
||||
}
|
||||
|
||||
@@ -136,8 +139,7 @@ class BettypeToggle extends Component
|
||||
|
||||
public function setAllOnlyNone($value)
|
||||
{
|
||||
|
||||
$user = User::where('id', auth()->user()->id)->update(['all_only_none' => $value]);
|
||||
User::where('id', auth()->user()->id)->update(['all_only_none' => $value]);
|
||||
|
||||
$this->dispatch('refreshBettypeMenu');
|
||||
}
|
||||
@@ -156,8 +158,26 @@ class BettypeToggle extends Component
|
||||
->count();
|
||||
}
|
||||
|
||||
public function toggleBookmakerPartnerDiffrences()
|
||||
{
|
||||
User::where('id', auth()->user()->id)->update(['bookmaker_partner_differences' => DB::raw('!bookmaker_partner_differences')]);
|
||||
|
||||
$this->dispatch('updateCompareDifferences');
|
||||
|
||||
$this->dispatch('refreshBettypeMenu');
|
||||
|
||||
}
|
||||
|
||||
public function setDifferences()
|
||||
{
|
||||
$this->bookmakerPartnerDiffrences = abs($this->bookmakerCount - $this->partnerCount);
|
||||
$a = EventBookmaker::where('bookmaker_id', auth()->user()->bookmaker_id)
|
||||
->where('sport_id', auth()->user()->sport_id)
|
||||
->pluck('event_id')->toArray();
|
||||
$b = EventBookmaker::where('bookmaker_id', auth()->user()->partner_bookmaker_id)
|
||||
->where('sport_id', auth()->user()->sport_id)
|
||||
->pluck('event_id')->toArray();
|
||||
$result = array_diff($a, $b);
|
||||
|
||||
$this->bookmakerPartnerDiffrences = \count($result);
|
||||
}
|
||||
}
|
||||
@@ -5,15 +5,12 @@ namespace App\Livewire;
|
||||
use App\Filament\Tables\Columns\BookmakerIcon;
|
||||
use App\Models\Bookmaker;
|
||||
use App\Models\PersonalNotification;
|
||||
use App\Models\Sport;
|
||||
use Filament\Actions\Action;
|
||||
use Filament\Actions\Concerns\InteractsWithActions;
|
||||
use Filament\Actions\Contracts\HasActions;
|
||||
use Filament\Schemas\Concerns\InteractsWithSchemas;
|
||||
use Filament\Schemas\Contracts\HasSchemas;
|
||||
use Filament\Support\Enums\FontWeight;
|
||||
use Filament\Support\Enums\IconSize;
|
||||
use Filament\Tables\Columns\IconColumn;
|
||||
use Filament\Tables\Columns\TextColumn;
|
||||
use Filament\Tables\Concerns\InteractsWithTable;
|
||||
use Filament\Tables\Contracts\HasTable;
|
||||
@@ -36,14 +33,8 @@ class PersonalNotificationTable extends Component implements HasActions, HasSche
|
||||
->description('Send a notification when favorit enters an alarm level.')
|
||||
->striped()
|
||||
->columns([
|
||||
// TextColumn::make('sport.name'),
|
||||
BookmakerIcon::make('bookmaker.icon')
|
||||
->label('Bookmaker')->size('lg'),
|
||||
// IconColumn::make('sport.icon')
|
||||
// ->label('')
|
||||
// ->color(fn ($record) => $record->sport->color)
|
||||
// ->icon(fn ($record) => $record->sport->icon)
|
||||
// ->size(IconSize::ExtraLarge),
|
||||
TextColumn::make('alarm_level.name')
|
||||
->color(fn ($record) => $record->alarm_level->color)
|
||||
->weight(FontWeight::Black)
|
||||
@@ -60,12 +51,6 @@ class PersonalNotificationTable extends Component implements HasActions, HasSche
|
||||
->selectablePlaceholder(false)
|
||||
->options(Bookmaker::options([auth()->user()->partner_bookmaker_id, auth()->user()->bookmaker_id]))
|
||||
->preload(),
|
||||
SelectFilter::make('sport_id')
|
||||
->label('Sport')
|
||||
->default(1)
|
||||
->selectablePlaceholder(false)
|
||||
->options(Sport::getSportForClient(auth()->user()->client_id))
|
||||
->preload(),
|
||||
], FiltersLayout::AboveContent)
|
||||
->filtersFormColumns(3)
|
||||
->hiddenFilterIndicators()
|
||||
@@ -87,7 +72,6 @@ class PersonalNotificationTable extends Component implements HasActions, HasSche
|
||||
PersonalNotification::where('id', $record->id)->update(['notify_by_email' => ! $record->notify_by_email]);
|
||||
}),
|
||||
]);
|
||||
|
||||
}
|
||||
|
||||
public function render(): View
|
||||
|
||||
Reference in new issue
Block a user