move all into clusters
This commit is contained in:
1 parent
7ff3fbadb6
commit
a980ea92ce
91 files changed
+300
-262
No files matched your search
+90
@@ -0,0 +1,90 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Clusters\DynamicData\Resources\ElementProviders\Tables;
|
||||
|
||||
use App\Models\AddByMethod;
|
||||
use App\Models\Country;
|
||||
use App\Models\Provider;
|
||||
use App\Models\Sport;
|
||||
use Filament\Actions\BulkActionGroup;
|
||||
use Filament\Actions\DeleteAction;
|
||||
use Filament\Actions\DeleteBulkAction;
|
||||
use Filament\Actions\EditAction;
|
||||
use Filament\Notifications\Notification;
|
||||
use Filament\Tables\Columns\IconColumn;
|
||||
use Filament\Tables\Columns\TextColumn;
|
||||
use Filament\Tables\Enums\FiltersLayout;
|
||||
use Filament\Tables\Filters\SelectFilter;
|
||||
use Filament\Tables\Table;
|
||||
use Illuminate\Contracts\Database\Eloquent\Builder;
|
||||
|
||||
class ElementProvidersTable
|
||||
{
|
||||
public static function configure(Table $table): Table
|
||||
{
|
||||
return $table
|
||||
->columns([
|
||||
IconColumn::make('sport.icon')
|
||||
->label('')
|
||||
->grow(false)
|
||||
->color('primary')
|
||||
->width(30)
|
||||
->icon(fn ($record) => $record->sport->icon)
|
||||
->tooltip(fn ($record) => $record->id)
|
||||
->visibleFrom('lg'),
|
||||
TextColumn::make('provider.name')->color(fn ($record) => $record->provider->color),
|
||||
TextColumn::make('element.country.name')
|
||||
->wrap()
|
||||
->color('gray')
|
||||
->icon(fn ($record) => $record->element->country->icon),
|
||||
TextColumn::make('id')->label('TxId')->alignCenter(),
|
||||
TextColumn::make('provider_element_id')->label('PrId')->alignCenter(),
|
||||
TextColumn::make('element_group.competition_group.name'),
|
||||
TextColumn::make('element.name')->label('TXOdds Name'),
|
||||
TextColumn::make('name')->label('Client Name'),
|
||||
TextColumn::make('add_by_method.name')
|
||||
->color(fn ($record) => $record->add_by_method->color)
|
||||
->icon(fn ($record) => $record->add_by_method->icon)
|
||||
->label('Add By'),
|
||||
])->filters([
|
||||
SelectFilter::make('provider_id')
|
||||
->label('Provider')
|
||||
->options(Provider::where('bookmaker_id', '>', 0)->pluck('name', 'id')),
|
||||
SelectFilter::make('sport_id')
|
||||
->label('Sport')
|
||||
->options(Sport::where('is_active', 1)->pluck('name', 'id')),
|
||||
SelectFilter::make('country_id')
|
||||
->searchable()
|
||||
->label('Country')
|
||||
->options(Country::orderBy('name')->pluck('name', 'id'))
|
||||
->query(function (Builder $query, array $data) {
|
||||
if (blank($data['value'])) {
|
||||
return $query;
|
||||
}
|
||||
|
||||
return $query->whereHas('element', function (Builder $query) use ($data) {
|
||||
return $query->where('country_id', $data['value']);
|
||||
});
|
||||
}),
|
||||
SelectFilter::make('add_by_method_id')
|
||||
->label('Add By')
|
||||
->options(AddByMethod::pluck('name', 'id')),
|
||||
], layout: FiltersLayout::AboveContent)
|
||||
->deferFilters(false)
|
||||
->recordActions([
|
||||
EditAction::make(),
|
||||
DeleteAction::make()
|
||||
->successNotification(
|
||||
Notification::make()
|
||||
->success()
|
||||
->title('Element deleted')
|
||||
->body('The provider element has been deleted successfully.'),
|
||||
),
|
||||
])
|
||||
->toolbarActions([
|
||||
BulkActionGroup::make([
|
||||
DeleteBulkAction::make(),
|
||||
]),
|
||||
]);
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user