bookmaker logo svg wip
This commit is contained in:
1 parent
399b9d43a7
commit
ceb59c940a
79 files changed
+641
-155
No files matched your search
@@ -0,0 +1,47 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources\Bookmakers;
|
||||
|
||||
use App\Filament\Clusters\Maintenance\MaintenanceCluster;
|
||||
use App\Filament\Resources\Bookmakers\Pages\ListBookmakers;
|
||||
use App\Filament\Resources\Bookmakers\Schemas\BookmakerForm;
|
||||
use App\Filament\Resources\Bookmakers\Tables\BookmakersTable;
|
||||
use App\Models\Bookmaker;
|
||||
use BackedEnum;
|
||||
use Filament\Resources\Resource;
|
||||
use Filament\Schemas\Schema;
|
||||
use Filament\Tables\Table;
|
||||
use UnitEnum;
|
||||
|
||||
class BookmakerResource extends Resource
|
||||
{
|
||||
protected static ?string $model = Bookmaker::class;
|
||||
|
||||
protected static string|BackedEnum|null $navigationIcon = 'lucide-notebook-pen';
|
||||
|
||||
protected static ?string $cluster = MaintenanceCluster::class;
|
||||
|
||||
protected static string|UnitEnum|null $navigationGroup = 'Administration';
|
||||
|
||||
public static function form(Schema $schema): Schema
|
||||
{
|
||||
return BookmakerForm::configure($schema);
|
||||
}
|
||||
|
||||
public static function table(Table $table): Table
|
||||
{
|
||||
return BookmakersTable::configure($table);
|
||||
}
|
||||
|
||||
public static function getPages(): array
|
||||
{
|
||||
return [
|
||||
'index' => ListBookmakers::route('/'),
|
||||
];
|
||||
}
|
||||
|
||||
public static function getNavigationBadge(): ?string
|
||||
{
|
||||
return parent::getEloquentQuery()->count();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources\Bookmakers\Pages;
|
||||
|
||||
use App\Filament\Resources\Bookmakers\BookmakerResource;
|
||||
use Filament\Resources\Pages\CreateRecord;
|
||||
|
||||
class CreateBookmaker extends CreateRecord
|
||||
{
|
||||
protected static string $resource = BookmakerResource::class;
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources\Bookmakers\Pages;
|
||||
|
||||
use App\Filament\Resources\Bookmakers\BookmakerResource;
|
||||
use Filament\Actions\DeleteAction;
|
||||
use Filament\Resources\Pages\EditRecord;
|
||||
|
||||
class EditBookmaker extends EditRecord
|
||||
{
|
||||
protected static string $resource = BookmakerResource::class;
|
||||
|
||||
protected function getHeaderActions(): array
|
||||
{
|
||||
return [
|
||||
DeleteAction::make(),
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources\Bookmakers\Pages;
|
||||
|
||||
use App\Filament\Resources\Bookmakers\BookmakerResource;
|
||||
use Filament\Actions\CreateAction;
|
||||
use Filament\Resources\Pages\ListRecords;
|
||||
|
||||
class ListBookmakers extends ListRecords
|
||||
{
|
||||
protected static string $resource = BookmakerResource::class;
|
||||
|
||||
protected function getHeaderActions(): array
|
||||
{
|
||||
return [
|
||||
CreateAction::make(),
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources\Bookmakers\Schemas;
|
||||
|
||||
use Filament\Forms\Components\FileUpload;
|
||||
use Filament\Forms\Components\TextInput;
|
||||
use Filament\Schemas\Schema;
|
||||
|
||||
class BookmakerForm
|
||||
{
|
||||
public static function configure(Schema $schema): Schema
|
||||
{
|
||||
return $schema
|
||||
->components([
|
||||
TextInput::make('name')
|
||||
->required(),
|
||||
TextInput::make('icon')
|
||||
->required(),
|
||||
FileUpload::make('image')
|
||||
->default(null),
|
||||
TextInput::make('baid')
|
||||
->numeric()
|
||||
->default(0),
|
||||
TextInput::make('txid')
|
||||
->numeric()
|
||||
->default(0),
|
||||
]);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,57 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources\Bookmakers\Tables;
|
||||
|
||||
use Filament\Actions\BulkActionGroup;
|
||||
use Filament\Actions\DeleteBulkAction;
|
||||
use Filament\Actions\EditAction;
|
||||
use Filament\Tables\Columns\IconColumn;
|
||||
use Filament\Tables\Columns\ImageColumn;
|
||||
use Filament\Tables\Columns\TextColumn;
|
||||
use Filament\Tables\Columns\ToggleColumn;
|
||||
use Filament\Tables\Filters\TernaryFilter;
|
||||
use Filament\Tables\Table;
|
||||
|
||||
class BookmakersTable
|
||||
{
|
||||
public static function configure(Table $table): Table
|
||||
{
|
||||
return $table
|
||||
->columns([
|
||||
TextColumn::make('name')
|
||||
->searchable(),
|
||||
IconColumn::make('icon')
|
||||
->size('2xl')
|
||||
->icon(function ($record): string {
|
||||
return 'bkm-'.$record->icon;
|
||||
}),
|
||||
ImageColumn::make('image'),
|
||||
TextColumn::make('baid')
|
||||
->numeric()
|
||||
->sortable(),
|
||||
TextColumn::make('txid')
|
||||
->numeric()
|
||||
->sortable(),
|
||||
ToggleColumn::make('txso')->offColor('gray'),
|
||||
ToggleColumn::make('txot')->offColor('gray'),
|
||||
ToggleColumn::make('betsapi')->offColor('gray'),
|
||||
ToggleColumn::make('direct')->offColor('gray'),
|
||||
ToggleColumn::make('is_active')->offColor('gray'),
|
||||
])
|
||||
->filters([
|
||||
TernaryFilter::make('txso'),
|
||||
TernaryFilter::make('txot'),
|
||||
TernaryFilter::make('betsapi'),
|
||||
TernaryFilter::make('direct'),
|
||||
TernaryFilter::make('is_active'),
|
||||
])
|
||||
->recordActions([
|
||||
EditAction::make(),
|
||||
])
|
||||
->toolbarActions([
|
||||
BulkActionGroup::make([
|
||||
DeleteBulkAction::make(),
|
||||
]),
|
||||
]);
|
||||
}
|
||||
}
|
||||
@@ -3,6 +3,8 @@
|
||||
namespace App\Filament\Resources\Clients;
|
||||
|
||||
use App\Filament\Clusters\Maintenance\MaintenanceCluster;
|
||||
use App\Filament\Resources\Clients\Pages\CreateClient;
|
||||
use App\Filament\Resources\Clients\Pages\EditClient;
|
||||
use App\Filament\Resources\Clients\Pages\ListClients;
|
||||
use App\Filament\Resources\Clients\Schemas\ClientForm;
|
||||
use App\Filament\Resources\Clients\Tables\ClientsTable;
|
||||
@@ -17,16 +19,14 @@ class ClientResource extends Resource
|
||||
{
|
||||
protected static ?string $model = Client::class;
|
||||
|
||||
protected static ?int $navigationSort = 30;
|
||||
|
||||
protected static string|BackedEnum|null $navigationIcon = 'lucide-square-user';
|
||||
|
||||
protected static ?string $recordTitleAttribute = 'name';
|
||||
protected static ?string $cluster = MaintenanceCluster::class;
|
||||
|
||||
protected static ?int $navigationSort = 30;
|
||||
|
||||
protected static string|UnitEnum|null $navigationGroup = 'User Management';
|
||||
|
||||
protected static ?string $cluster = MaintenanceCluster::class;
|
||||
|
||||
public static function form(Schema $schema): Schema
|
||||
{
|
||||
return ClientForm::configure($schema);
|
||||
@@ -48,6 +48,8 @@ class ClientResource extends Resource
|
||||
{
|
||||
return [
|
||||
'index' => ListClients::route('/'),
|
||||
'create' => CreateClient::route('/create'),
|
||||
'edit' => EditClient::route('/{record}/edit'),
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,23 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources\Clients\RelationManagers;
|
||||
|
||||
use App\Filament\Resources\Clients\ClientResource;
|
||||
use Filament\Actions\CreateAction;
|
||||
use Filament\Resources\RelationManagers\RelationManager;
|
||||
use Filament\Tables\Table;
|
||||
|
||||
class BookmakerRelationManager extends RelationManager
|
||||
{
|
||||
protected static string $relationship = 'bookmaker';
|
||||
|
||||
protected static ?string $relatedResource = ClientResource::class;
|
||||
|
||||
public function table(Table $table): Table
|
||||
{
|
||||
return $table
|
||||
->headerActions([
|
||||
CreateAction::make(),
|
||||
]);
|
||||
}
|
||||
}
|
||||
@@ -2,7 +2,6 @@
|
||||
|
||||
namespace App\Filament\Resources\Clients\Schemas;
|
||||
|
||||
use Filament\Forms\Components\Select;
|
||||
use Filament\Forms\Components\TextInput;
|
||||
use Filament\Schemas\Schema;
|
||||
|
||||
@@ -14,12 +13,10 @@ class ClientForm
|
||||
->components([
|
||||
TextInput::make('name')
|
||||
->required(),
|
||||
TextInput::make('icon'),
|
||||
Select::make('bookmaker')
|
||||
->relationship('bookmaker', 'name')
|
||||
->multiple()
|
||||
->preload()
|
||||
->searchable(),
|
||||
TextInput::make('icon')
|
||||
->default(null),
|
||||
TextInput::make('homepage')
|
||||
->default(null),
|
||||
]);
|
||||
}
|
||||
}
|
||||
@@ -5,6 +5,7 @@ namespace App\Filament\Resources\Clients\Tables;
|
||||
use Filament\Actions\BulkActionGroup;
|
||||
use Filament\Actions\DeleteBulkAction;
|
||||
use Filament\Actions\EditAction;
|
||||
use Filament\Tables\Columns\TextColumn;
|
||||
use Filament\Tables\Table;
|
||||
|
||||
class ClientsTable
|
||||
@@ -13,7 +14,20 @@ class ClientsTable
|
||||
{
|
||||
return $table
|
||||
->columns([
|
||||
//
|
||||
TextColumn::make('name')
|
||||
->searchable(),
|
||||
TextColumn::make('icon')
|
||||
->searchable(),
|
||||
TextColumn::make('homepage')
|
||||
->searchable(),
|
||||
TextColumn::make('created_at')
|
||||
->dateTime()
|
||||
->sortable()
|
||||
->toggleable(isToggledHiddenByDefault: true),
|
||||
TextColumn::make('updated_at')
|
||||
->dateTime()
|
||||
->sortable()
|
||||
->toggleable(isToggledHiddenByDefault: true),
|
||||
])
|
||||
->filters([
|
||||
//
|
||||
|
||||
@@ -6,5 +6,15 @@ use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class Bookmaker extends Model
|
||||
{
|
||||
//
|
||||
protected $fillable = [
|
||||
'name',
|
||||
'icon',
|
||||
'baid',
|
||||
'txid',
|
||||
'txso',
|
||||
'txot',
|
||||
'betsapi',
|
||||
'direct',
|
||||
'is_active',
|
||||
];
|
||||
}
|
||||
@@ -12,7 +12,7 @@ class ClientBookmaker extends Model
|
||||
'is_active',
|
||||
];
|
||||
|
||||
public function customer()
|
||||
public function client()
|
||||
{
|
||||
return $this->belongsTo(Client::class);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,24 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class ClientSport extends Model
|
||||
{
|
||||
protected $fillable = [
|
||||
'client_id',
|
||||
'sport_id',
|
||||
'is_active',
|
||||
];
|
||||
|
||||
public function client()
|
||||
{
|
||||
return $this->belongsTo(Client::class);
|
||||
}
|
||||
|
||||
public function sport()
|
||||
{
|
||||
return $this->belongsTo(Sport::class);
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user