supervisor resource wip
This commit is contained in:
1 parent
769fbc242c
commit
944aa736b2
8 files changed
+45
-92
No files matched your search
@@ -26,10 +26,6 @@ class CountryResource extends Resource
|
||||
|
||||
protected static ?string $recordTitleAttribute = 'name';
|
||||
|
||||
protected static ?string $navigationLabel = 'Countries';
|
||||
|
||||
protected static ?string $pluralLabel = 'Countries';
|
||||
|
||||
protected static string|UnitEnum|null $navigationGroup = 'Administration';
|
||||
|
||||
protected static ?string $cluster = MaintenanceCluster::class;
|
||||
|
||||
@@ -23,10 +23,6 @@ class ProviderResource extends Resource
|
||||
|
||||
protected static ?string $recordTitleAttribute = 'name';
|
||||
|
||||
protected static ?string $navigationLabel = 'Provider';
|
||||
|
||||
protected static ?string $pluralLabel = 'Providers';
|
||||
|
||||
protected static string|UnitEnum|null $navigationGroup = 'Administration';
|
||||
|
||||
protected static ?string $cluster = MaintenanceCluster::class;
|
||||
|
||||
@@ -2,8 +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\Schema;
|
||||
|
||||
class SupervisorForm
|
||||
@@ -13,41 +15,26 @@ class SupervisorForm
|
||||
return $schema
|
||||
->components([
|
||||
TextInput::make('name')
|
||||
->required()
|
||||
->default(null),
|
||||
TextInput::make('provider_id')
|
||||
Select::make('provider_id')
|
||||
->relationship('provider', 'name')
|
||||
->required()
|
||||
->numeric()
|
||||
->default(0),
|
||||
TextInput::make('sport_id')
|
||||
->required()
|
||||
->numeric()
|
||||
->default(0),
|
||||
TextInput::make('bookmaker_id')
|
||||
->required()
|
||||
->numeric()
|
||||
->default(0),
|
||||
->preload(),
|
||||
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'))
|
||||
->nullable(),
|
||||
TextInput::make('sleep')
|
||||
->required()
|
||||
->numeric()
|
||||
->default(10),
|
||||
->default(30),
|
||||
TextInput::make('limit')
|
||||
->required()
|
||||
->numeric()
|
||||
->default(0),
|
||||
TextInput::make('runtime')
|
||||
->default(null),
|
||||
TextInput::make('events')
|
||||
->required()
|
||||
->numeric()
|
||||
->default(0),
|
||||
TextInput::make('lastcall')
|
||||
->required()
|
||||
->numeric()
|
||||
->default(0),
|
||||
Toggle::make('is_cron')
|
||||
->required(),
|
||||
Toggle::make('is_active')
|
||||
->required(),
|
||||
]);
|
||||
}
|
||||
}
|
||||
@@ -3,8 +3,6 @@
|
||||
namespace App\Filament\Resources\Supervisors;
|
||||
|
||||
use App\Filament\Clusters\Maintenance\MaintenanceCluster;
|
||||
use App\Filament\Resources\Supervisors\Pages\CreateSupervisor;
|
||||
use App\Filament\Resources\Supervisors\Pages\EditSupervisor;
|
||||
use App\Filament\Resources\Supervisors\Pages\ListSupervisors;
|
||||
use App\Filament\Resources\Supervisors\Schemas\SupervisorForm;
|
||||
use App\Filament\Resources\Supervisors\Tables\SupervisorsTable;
|
||||
@@ -48,8 +46,6 @@ class SupervisorResource extends Resource
|
||||
{
|
||||
return [
|
||||
'index' => ListSupervisors::route('/'),
|
||||
'create' => CreateSupervisor::route('/create'),
|
||||
'edit' => EditSupervisor::route('/{record}/edit'),
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
@@ -5,8 +5,8 @@ namespace App\Filament\Resources\Supervisors\Tables;
|
||||
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;
|
||||
|
||||
class SupervisorsTable
|
||||
@@ -15,35 +15,25 @@ class SupervisorsTable
|
||||
{
|
||||
return $table
|
||||
->columns([
|
||||
TextColumn::make('id')->badge(),
|
||||
TextColumn::make('name')
|
||||
->searchable(),
|
||||
TextColumn::make('provider_id')
|
||||
->numeric()
|
||||
->sortable(),
|
||||
TextColumn::make('sport_id')
|
||||
->numeric()
|
||||
->sortable(),
|
||||
TextColumn::make('bookmaker_id')
|
||||
->numeric()
|
||||
->sortable(),
|
||||
TextColumn::make('sleep')
|
||||
->numeric()
|
||||
->sortable(),
|
||||
TextColumn::make('limit')
|
||||
->numeric()
|
||||
->sortable(),
|
||||
TextColumn::make('runtime')
|
||||
->searchable(),
|
||||
TextColumn::make('events')
|
||||
->numeric()
|
||||
->sortable(),
|
||||
TextColumn::make('lastcall')
|
||||
->numeric()
|
||||
->sortable(),
|
||||
IconColumn::make('is_cron')
|
||||
->boolean(),
|
||||
IconColumn::make('is_active')
|
||||
->boolean(),
|
||||
TextColumn::make('provider.name')
|
||||
->badge()->color(fn (string $state): string => match ($state) {
|
||||
'txodds' => 'danger',
|
||||
'bestapi' => 'success',
|
||||
'direct' => 'primary',
|
||||
default => 'warning',
|
||||
}),
|
||||
TextColumn::make('sport_id')->label('Sport'),
|
||||
TextColumn::make('bookmaker_id')->label('Book'),
|
||||
TextColumn::make('sleep')->numeric(),
|
||||
TextColumn::make('limit')->numeric(),
|
||||
TextColumn::make('runtime')->label('Duration'),
|
||||
TextColumn::make('events')->numeric(),
|
||||
TextColumn::make('lastcall'),
|
||||
ToggleColumn::make('is_cron')->label('Cron'),
|
||||
ToggleColumn::make('is_active')->label('Status'),
|
||||
TextColumn::make('created_at')
|
||||
->dateTime()
|
||||
->sortable()
|
||||
|
||||
+12
-11
@@ -7,21 +7,17 @@ use Illuminate\Database\Eloquent\Model;
|
||||
class Supervisor extends Model
|
||||
{
|
||||
protected $fillable = [
|
||||
'code',
|
||||
'command',
|
||||
'process',
|
||||
'description',
|
||||
'name',
|
||||
'provider_id',
|
||||
'sport_id',
|
||||
'client_id',
|
||||
'bookmaker_id',
|
||||
'is_active',
|
||||
'has_log',
|
||||
'sleep',
|
||||
'limit',
|
||||
'multi',
|
||||
'command',
|
||||
'runtime',
|
||||
'events',
|
||||
'lastcall',
|
||||
'is_cron',
|
||||
'is_active',
|
||||
];
|
||||
|
||||
public function sport()
|
||||
@@ -31,11 +27,16 @@ class Supervisor extends Model
|
||||
|
||||
public function bookmaker()
|
||||
{
|
||||
return $this->belongsTo(Bookmaker::class, 'bookmaker_id');
|
||||
return $this->belongsTo(Bookmaker::class);
|
||||
}
|
||||
|
||||
public function customer()
|
||||
{
|
||||
return $this->belongsTo(Customer::class, 'client_id');
|
||||
return $this->belongsTo(Customer::class);
|
||||
}
|
||||
|
||||
public function provider()
|
||||
{
|
||||
return $this->belongsTo(Provider::class);
|
||||
}
|
||||
}
|
||||
@@ -1,13 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class SupervisorProcess extends Model
|
||||
{
|
||||
protected $fillable = [
|
||||
'command',
|
||||
'process',
|
||||
];
|
||||
}
|
||||
Reference in new issue
Block a user