icons all to phosphor
This commit is contained in:
1 parent
1c766f0ee6
commit
b31f3ec005
6 files changed
+59
-35
No files matched your search
@@ -3,8 +3,9 @@
|
||||
namespace App\Livewire;
|
||||
|
||||
use App\Filament\Tables\Columns\BookmakerIcon;
|
||||
use App\Models\Bookmaker;
|
||||
use App\Models\BookmakerSport;
|
||||
use App\Models\MultilineClient;
|
||||
use App\Models\MultilineSetting;
|
||||
use Filament\Actions\Concerns\InteractsWithActions;
|
||||
use Filament\Actions\Contracts\HasActions;
|
||||
use Filament\Forms\Components\Radio;
|
||||
@@ -17,7 +18,6 @@ use Filament\Tables\Concerns\InteractsWithTable;
|
||||
use Filament\Tables\Contracts\HasTable;
|
||||
use Filament\Tables\Enums\FiltersLayout;
|
||||
use Filament\Tables\Filters\Filter;
|
||||
use Filament\Tables\Filters\SelectFilter;
|
||||
use Filament\Tables\Table;
|
||||
use Illuminate\Contracts\View\View;
|
||||
use Illuminate\Database\Eloquent\Builder;
|
||||
@@ -29,8 +29,17 @@ class MultilineBookmaker extends Component implements HasActions, HasSchemas, Ha
|
||||
use InteractsWithSchemas;
|
||||
use InteractsWithTable;
|
||||
|
||||
public static $default_filter;
|
||||
|
||||
public static function load_filter()
|
||||
{
|
||||
self::$default_filter = MultilineSetting::where('sport_id', auth()->user()->sport_id)->orderBy('id')->pluck('id')->first();
|
||||
}
|
||||
|
||||
public function table(Table $table): Table
|
||||
{
|
||||
self::load_filter();
|
||||
|
||||
return $table
|
||||
->query(MultilineClient::query()->where('sport_id', auth()->user()->sport_id))
|
||||
->paginated(false)
|
||||
@@ -43,42 +52,45 @@ class MultilineBookmaker extends Component implements HasActions, HasSchemas, Ha
|
||||
}),
|
||||
TextColumn::make('sport.name'),
|
||||
TextColumn::make('multiline_setting.name')->label('Bettype'),
|
||||
BookmakerIcon::make('bookmaker.icon')->label('Icon'),
|
||||
BookmakerIcon::make('bookmaker.icon')->size('xl')->label('Icon'),
|
||||
SelectColumn::make('bookmaker_id')
|
||||
->label('Bookmaker')
|
||||
->width('2rem')
|
||||
->options(function () {
|
||||
$books = Bookmaker::where('is_active', 1)->orderBy('name')->pluck('name', 'id');
|
||||
foreach ($books as $key => $value) {
|
||||
$books[$key] = $key.' - '.$value;
|
||||
}
|
||||
|
||||
return $books;
|
||||
$res = BookmakerSport::with('bookmaker')
|
||||
->where('sport_id', auth()->user()->sport_id)
|
||||
->get();
|
||||
$arr = [];
|
||||
foreach ($res as $value) {
|
||||
$arr[$value->bookmaker_id] = $value->bookmaker->name;
|
||||
}
|
||||
asort($arr);
|
||||
|
||||
return $arr;
|
||||
}),
|
||||
])
|
||||
->defaultSort('sort')
|
||||
->deferFilters(false)
|
||||
->filters([
|
||||
Filter::make('created_at')
|
||||
Filter::make('multiline_setting_id')
|
||||
->schema([
|
||||
Radio::make('multiline_setting_id')
|
||||
->inline()
|
||||
->options([
|
||||
'draft' => 'Draft',
|
||||
'scheduled' => 'Scheduled',
|
||||
'published' => 'Published',
|
||||
]),
|
||||
->default(self::$default_filter)
|
||||
->columnSpan(6)
|
||||
->columnSpanFull()
|
||||
->hiddenLabel()
|
||||
->options(fn () => MultilineSetting::where('sport_id', auth()->user()->sport_id)->orderBy('name')->pluck('name', 'id')),
|
||||
])
|
||||
->query(function (Builder $query, array $data): Builder {
|
||||
return $query
|
||||
->when(
|
||||
$data['multiline_setting_id'],
|
||||
fn (Builder $query, $date): Builder => $query->whereDate('created_at', '<=', $date),
|
||||
fn (Builder $query, $multiline_setting_id): Builder => $query->where('multiline_setting_id', $multiline_setting_id),
|
||||
);
|
||||
}),
|
||||
// SelectFilter::make('multiline_setting_id')
|
||||
// ->label('Bettype')
|
||||
// ->relationship('multiline_setting', 'name'),
|
||||
})
|
||||
->columns(6)->columnSpan(6),
|
||||
], layout: FiltersLayout::AboveContent)
|
||||
->hiddenFilterIndicators();
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user