Es gibt nun task collections und vordefinierte tasks für alle. Onboarding verfeinert und webseite-carousel gefixt (logging später entfernen!)
93 lines
2.9 KiB
PHP
93 lines
2.9 KiB
PHP
<?php
|
|
|
|
namespace App\Filament\Resources;
|
|
|
|
use App\Filament\Resources\TenantPackageResource\Pages;
|
|
use App\Models\TenantPackage;
|
|
use BackedEnum;
|
|
use Filament\Actions\ActionGroup;
|
|
use Filament\Actions\BulkActionGroup;
|
|
use Filament\Actions\CreateAction;
|
|
use Filament\Actions\DeleteAction;
|
|
use Filament\Actions\DeleteBulkAction;
|
|
use Filament\Actions\EditAction;
|
|
use Filament\Actions\ViewAction;
|
|
use Filament\Forms\Components\DateTimePicker;
|
|
use Filament\Forms\Components\Select;
|
|
use Filament\Forms\Components\Toggle;
|
|
use Filament\Forms\Form;
|
|
use Filament\Resources\Resource;
|
|
use Filament\Schemas\Schema;
|
|
use Filament\Tables;
|
|
use Filament\Tables\Columns\IconColumn;
|
|
use Filament\Tables\Columns\TextColumn;
|
|
use Filament\Tables\Table;
|
|
use UnitEnum;
|
|
|
|
class TenantPackageResource extends Resource
|
|
{
|
|
protected static ?string $model = TenantPackage::class;
|
|
|
|
protected static BackedEnum|string|null $navigationIcon = 'heroicon-o-shopping-bag';
|
|
|
|
protected static ?string $slug = 'tenant-packages';
|
|
|
|
public static function form(Schema $form): Schema
|
|
{
|
|
return $form
|
|
->schema([
|
|
Select::make('tenant_id')
|
|
->relationship('tenant', 'name')
|
|
->required()
|
|
->searchable(),
|
|
Select::make('package_id')
|
|
->relationship('package', 'name')
|
|
->required()
|
|
->searchable(),
|
|
DateTimePicker::make('purchased_at'),
|
|
DateTimePicker::make('expires_at'),
|
|
Toggle::make('active')->default(true),
|
|
]);
|
|
}
|
|
|
|
public static function table(Table $table): Table
|
|
{
|
|
return $table
|
|
->columns([
|
|
TextColumn::make('tenant.name')->searchable()->sortable(),
|
|
TextColumn::make('package.name')->badge()->color('success'),
|
|
TextColumn::make('purchased_at')->dateTime()->sortable(),
|
|
TextColumn::make('expires_at')->dateTime()->sortable(),
|
|
IconColumn::make('active')->boolean(),
|
|
])
|
|
->filters([])
|
|
->actions([
|
|
ActionGroup::make([
|
|
ViewAction::make(),
|
|
EditAction::make(),
|
|
DeleteAction::make(),
|
|
]),
|
|
])
|
|
->bulkActions([
|
|
BulkActionGroup::make([
|
|
DeleteBulkAction::make(),
|
|
]),
|
|
]);
|
|
}
|
|
|
|
public static function getRelations(): array
|
|
{
|
|
return [];
|
|
}
|
|
|
|
public static function getPages(): array
|
|
{
|
|
return [
|
|
'index' => Pages\ListTenantPackages::route('/'),
|
|
'create' => Pages\CreateTenantPackage::route('/create'),
|
|
'view' => Pages\ViewTenantPackage::route('/{record}'),
|
|
'edit' => Pages\EditTenantPackage::route('/{record}/edit'),
|
|
];
|
|
}
|
|
}
|