removed shield use superadmin
This commit is contained in:
1 parent
7fd7f706bc
commit
419148cd18
60 files changed
+611
-2363
No files matched your search
@@ -2,13 +2,10 @@
|
||||
|
||||
namespace App\Filament\Resources\Supervisors\Schemas;
|
||||
|
||||
use App\Models\Bookmaker;
|
||||
use App\Models\Sport;
|
||||
use Filament\Forms\Components\Select;
|
||||
use Filament\Forms\Components\TextInput;
|
||||
use Filament\Forms\Components\Toggle;
|
||||
use Filament\Schemas\Components\Fieldset;
|
||||
use Filament\Schemas\Components\Utilities\Get;
|
||||
use Filament\Schemas\Schema;
|
||||
|
||||
class SupervisorForm
|
||||
@@ -17,24 +14,10 @@ class SupervisorForm
|
||||
{
|
||||
return $schema
|
||||
->components([
|
||||
Toggle::make('is_cron')->columns(2),
|
||||
TextInput::make('name')
|
||||
->required()
|
||||
->columnSpan(2),
|
||||
Select::make('type')
|
||||
->options([
|
||||
'Grapper' => 'Grapper',
|
||||
'Comparatore' => 'Comparatore',
|
||||
])
|
||||
->default('Grapper')
|
||||
->selectablePlaceholder(false),
|
||||
Select::make('filetype')
|
||||
->label('File Type')
|
||||
->options([
|
||||
'json' => 'json',
|
||||
'xml' => 'xml',
|
||||
])
|
||||
->default('json')
|
||||
->selectablePlaceholder(false),
|
||||
Select::make('provider_id')
|
||||
->relationship('provider', 'name')
|
||||
->required()
|
||||
@@ -42,18 +25,9 @@ class SupervisorForm
|
||||
Select::make('sport_id')
|
||||
->options(Sport::query()->where('is_active', 1)->pluck('name', 'id'))
|
||||
->nullable(),
|
||||
Select::make('bookmaker_id')
|
||||
->options(Bookmaker::query()->where('is_active', 1)->pluck('name', 'id'))
|
||||
->selectablePlaceholder(true),
|
||||
Fieldset::make('Supervisor or Cron Toggle')
|
||||
->schema([
|
||||
Toggle::make('is_cron')->live(),
|
||||
TextInput::make('sleep')
|
||||
->label('Sleep between loops')
|
||||
->hidden(fn (Get $get): bool => $get('is_cron'))
|
||||
->numeric()
|
||||
->default(30),
|
||||
])->columnSpan(2),
|
||||
|
||||
TextInput::make('sleep'),
|
||||
TextInput::make('maxsconds')->label('Seconds till throwing an error'),
|
||||
]);
|
||||
}
|
||||
}
|
||||
@@ -2,6 +2,7 @@
|
||||
|
||||
namespace App\Filament\Resources\Supervisors;
|
||||
|
||||
use App\Filament\Clusters\Administrator\AdministratorCluster;
|
||||
use App\Filament\Resources\Supervisors\Pages\ListSupervisors;
|
||||
use App\Filament\Resources\Supervisors\Schemas\SupervisorForm;
|
||||
use App\Filament\Resources\Supervisors\Tables\SupervisorsTable;
|
||||
@@ -16,9 +17,16 @@ class SupervisorResource extends Resource
|
||||
|
||||
protected static string|\BackedEnum|null $navigationIcon = 'lucide-sliders-vertical';
|
||||
|
||||
protected static ?string $cluster = AdministratorCluster::class;
|
||||
|
||||
protected static ?int $navigationSort = 20;
|
||||
|
||||
protected static string|\UnitEnum|null $navigationGroup = 'Administration';
|
||||
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
|
||||
{
|
||||
|
||||
@@ -2,11 +2,9 @@
|
||||
|
||||
namespace App\Filament\Resources\Supervisors\Tables;
|
||||
|
||||
use App\Models\Bookmaker;
|
||||
use Filament\Actions\BulkActionGroup;
|
||||
use Filament\Actions\DeleteBulkAction;
|
||||
use Filament\Actions\EditAction;
|
||||
use Filament\Tables\Columns\IconColumn;
|
||||
use Filament\Tables\Columns\TextColumn;
|
||||
use Filament\Tables\Columns\ToggleColumn;
|
||||
use Filament\Tables\Table;
|
||||
@@ -19,35 +17,13 @@ class SupervisorsTable
|
||||
->columns([
|
||||
TextColumn::make('id')->badge(),
|
||||
TextColumn::make('name')->searchable(),
|
||||
TextColumn::make('type')->badge(),
|
||||
TextColumn::make('provider.name')
|
||||
->badge()->color(fn (string $state): string => match ($state) {
|
||||
'txodds' => 'danger',
|
||||
'bestapi' => 'success',
|
||||
'direct' => 'primary',
|
||||
default => 'warning',
|
||||
}),
|
||||
TextColumn::make('provider.name')->badge(),
|
||||
TextColumn::make('sport.name')->label('Sport'),
|
||||
IconColumn::make('bookmaker_id')
|
||||
->label('Book')
|
||||
->icon(function ($state): string {
|
||||
if ($state) {
|
||||
return 'bkm-'.Bookmaker::where('id', $state)->pluck('icon')->first();
|
||||
}
|
||||
}),
|
||||
TextColumn::make('sleep')->numeric(),
|
||||
TextColumn::make('runtime'),
|
||||
TextColumn::make('runtime')->label('Run Time'),
|
||||
TextColumn::make('maxsconds')->label('Max Time'),
|
||||
TextColumn::make('lastcall'),
|
||||
IconColumn::make('is_cron')->boolean()->label('Cron')->falseColor('gray'),
|
||||
TextColumn::make('filetype')->badge()->alignCenter(),
|
||||
TextColumn::make('created_at')
|
||||
->dateTime()
|
||||
->sortable()
|
||||
->toggleable(isToggledHiddenByDefault: true),
|
||||
TextColumn::make('updated_at')
|
||||
->dateTime()
|
||||
->sortable()
|
||||
->toggleable(isToggledHiddenByDefault: true),
|
||||
ToggleColumn::make('is_cron')->label('Cron'),
|
||||
ToggleColumn::make('is_active')->label('On/Off'),
|
||||
])
|
||||
->filters([
|
||||
|
||||
Reference in new issue
Block a user