You've already forked Atomcms-edit
Initial commit
This commit is contained in:
@@ -0,0 +1,23 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace App\Filament\Resources\RadioHistory\Pages;
|
||||
|
||||
use App\Filament\Resources\RadioHistory\RadioHistoryResource;
|
||||
use Filament\Actions\CreateAction;
|
||||
use Filament\Resources\Pages\ManageRecords;
|
||||
|
||||
class ManageRadioHistory extends ManageRecords
|
||||
{
|
||||
#[\Override]
|
||||
protected static string $resource = RadioHistoryResource::class;
|
||||
|
||||
#[\Override]
|
||||
protected function getHeaderActions(): array
|
||||
{
|
||||
return [
|
||||
CreateAction::make(),
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,134 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace App\Filament\Resources\RadioHistory;
|
||||
|
||||
use App\Filament\Resources\RadioHistory\Pages\ManageRadioHistory;
|
||||
use App\Models\RadioHistory;
|
||||
use Filament\Actions\DeleteAction;
|
||||
use Filament\Actions\DeleteBulkAction;
|
||||
use Filament\Actions\EditAction;
|
||||
use Filament\Forms\Components\DateTimePicker;
|
||||
use Filament\Forms\Components\Select;
|
||||
use Filament\Forms\Components\Textarea;
|
||||
use Filament\Forms\Components\TextInput;
|
||||
use Filament\Resources\Resource;
|
||||
use Filament\Schemas\Components\Section;
|
||||
use Filament\Schemas\Schema;
|
||||
use Filament\Tables\Columns\TextColumn;
|
||||
use Filament\Tables\Table;
|
||||
|
||||
class RadioHistoryResource extends Resource
|
||||
{
|
||||
#[\Override]
|
||||
protected static ?string $model = RadioHistory::class;
|
||||
|
||||
#[\Override]
|
||||
protected static string|\BackedEnum|null $navigationIcon = 'heroicon-o-clock';
|
||||
|
||||
#[\Override]
|
||||
protected static string|\UnitEnum|null $navigationGroup = 'Radio';
|
||||
|
||||
#[\Override]
|
||||
protected static ?string $slug = 'radio/history';
|
||||
|
||||
#[\Override]
|
||||
public static function getNavigationLabel(): string
|
||||
{
|
||||
return 'DJ Geschiedenis';
|
||||
}
|
||||
|
||||
#[\Override]
|
||||
public static function getModelLabel(): string
|
||||
{
|
||||
return 'DJ Sessie';
|
||||
}
|
||||
|
||||
#[\Override]
|
||||
public static function getPluralModelLabel(): string
|
||||
{
|
||||
return 'DJ Geschiedenis';
|
||||
}
|
||||
|
||||
#[\Override]
|
||||
public static function form(Schema $schema): Schema
|
||||
{
|
||||
return $schema
|
||||
->components([
|
||||
Section::make()
|
||||
->schema([
|
||||
Select::make('user_id')
|
||||
->relationship('user', 'username')
|
||||
->required()
|
||||
->searchable()
|
||||
->label('DJ'),
|
||||
|
||||
TextInput::make('show_name')
|
||||
->label('Show Naam')
|
||||
->maxLength(255),
|
||||
|
||||
DateTimePicker::make('started_at')
|
||||
->required()
|
||||
->label('Start Tijd'),
|
||||
|
||||
DateTimePicker::make('ended_at')
|
||||
->label('Eind Tijd'),
|
||||
|
||||
TextInput::make('listeners_count')
|
||||
->label('Aantal Luisteraars')
|
||||
->numeric()
|
||||
->default(0),
|
||||
|
||||
Textarea::make('notes')
|
||||
->label('Notities')
|
||||
->rows(3),
|
||||
]),
|
||||
]);
|
||||
}
|
||||
|
||||
#[\Override]
|
||||
public static function table(Table $table): Table
|
||||
{
|
||||
return $table
|
||||
->defaultSort('started_at', 'desc')
|
||||
->columns([
|
||||
TextColumn::make('user.username')
|
||||
->label('DJ')
|
||||
->searchable(),
|
||||
|
||||
TextColumn::make('show_name')
|
||||
->label('Show')
|
||||
->searchable(),
|
||||
|
||||
TextColumn::make('started_at')
|
||||
->label('Gestart')
|
||||
->dateTime('d-m-Y H:i'),
|
||||
|
||||
TextColumn::make('ended_at')
|
||||
->label('Gestopt')
|
||||
->dateTime('d-m-Y H:i'),
|
||||
|
||||
TextColumn::make('duration')
|
||||
->label('Duur'),
|
||||
|
||||
TextColumn::make('listeners_count')
|
||||
->label('Luisteraars'),
|
||||
])
|
||||
->recordActions([
|
||||
EditAction::make(),
|
||||
DeleteAction::make(),
|
||||
])
|
||||
->toolbarActions([
|
||||
DeleteBulkAction::make(),
|
||||
]);
|
||||
}
|
||||
|
||||
#[\Override]
|
||||
public static function getPages(): array
|
||||
{
|
||||
return [
|
||||
'index' => ManageRadioHistory::route('/'),
|
||||
];
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user