127 lines
4.1 KiB
PHP
127 lines
4.1 KiB
PHP
<?php
|
|
|
|
namespace App\Filament\Resources;
|
|
|
|
use App\DAL\Radiologists;
|
|
use App\Filament\Resources\DicomRoutingRuleResource\Pages;
|
|
use App\Models\DicomRoutingRule;
|
|
use Filament\Forms\Components\Select;
|
|
use Filament\Forms\Components\Textarea;
|
|
use Filament\Forms\Components\TextInput;
|
|
use Filament\Forms\Components\Toggle;
|
|
use Filament\Forms\Form;
|
|
use Filament\Resources\Resource;
|
|
use Filament\Tables;
|
|
use Filament\Tables\Columns\IconColumn;
|
|
use Filament\Tables\Columns\TextColumn;
|
|
use Filament\Tables\Table;
|
|
|
|
class DicomRoutingRuleResource extends Resource
|
|
{
|
|
protected static ?string $model = DicomRoutingRule::class;
|
|
|
|
protected static ?string $navigationIcon = 'heroicon-o-academic-cap';
|
|
|
|
public static function form(Form $form): Form
|
|
{
|
|
return $form
|
|
->schema([
|
|
Toggle::make('is_active')
|
|
->required(),
|
|
Select::make('organization_id')
|
|
->label('Organization')
|
|
->relationship('organization', 'name')
|
|
->required(),
|
|
Select::make('department_id')
|
|
->label('Department')
|
|
->relationship('department', 'name'),
|
|
Select::make('user_id')
|
|
->label('Radiologist')
|
|
->relationship('radiologist', 'display_name')
|
|
->options(Radiologists::activeRads()),
|
|
Select::make('assignment_panel_id')
|
|
->label('Panel')
|
|
->relationship('panel', 'name'),
|
|
TextInput::make('name')
|
|
->maxLength(255),
|
|
Textarea::make('condition')
|
|
->columnSpanFull()
|
|
->required(),
|
|
TextInput::make('priority')
|
|
->required()
|
|
->numeric()
|
|
->default(0),
|
|
]);
|
|
}
|
|
|
|
public static function table(Table $table): Table
|
|
{
|
|
return $table
|
|
->columns([
|
|
IconColumn::make('is_active')
|
|
->label('')
|
|
->boolean(),
|
|
TextColumn::make('name')
|
|
->searchable(),
|
|
TextColumn::make('condition')
|
|
->label('Rule')
|
|
->limit(20)
|
|
->searchable(),
|
|
TextColumn::make('priority')
|
|
->numeric()
|
|
->sortable(),
|
|
TextColumn::make('organization.name')
|
|
->label('Org')
|
|
->numeric()
|
|
->sortable(),
|
|
TextColumn::make('department.name')
|
|
->label('Dept')
|
|
->numeric()
|
|
->sortable(),
|
|
TextColumn::make('user_id')
|
|
->label('Rad')
|
|
->numeric()
|
|
->sortable(),
|
|
TextColumn::make('assignment_panel_id')
|
|
->label('Panel')
|
|
->numeric()
|
|
->sortable(),
|
|
TextColumn::make('created_at')
|
|
->dateTime()
|
|
->sortable()
|
|
->toggleable(isToggledHiddenByDefault: true),
|
|
TextColumn::make('updated_at')
|
|
->dateTime()
|
|
->sortable()
|
|
->toggleable(isToggledHiddenByDefault: true),
|
|
])
|
|
->filters([
|
|
//
|
|
])
|
|
->actions([
|
|
Tables\Actions\EditAction::make(),
|
|
])
|
|
->bulkActions([
|
|
Tables\Actions\BulkActionGroup::make([
|
|
Tables\Actions\DeleteBulkAction::make(),
|
|
]),
|
|
]);
|
|
}
|
|
|
|
public static function getRelations(): array
|
|
{
|
|
return [
|
|
//
|
|
];
|
|
}
|
|
|
|
public static function getPages(): array
|
|
{
|
|
return [
|
|
'index' => Pages\ListDicomRoutingRules::route('/'),
|
|
'create' => Pages\CreateDicomRoutingRule::route('/create'),
|
|
'edit' => Pages\EditDicomRoutingRule::route('/{record}/edit'),
|
|
];
|
|
}
|
|
}
|