wip
This commit is contained in:
parent
97481e8473
commit
9f60cfb32e
@ -50,4 +50,19 @@ public static function worklist_stats(int $days, int $workflow_level)
|
|||||||
|
|
||||||
return $rows;
|
return $rows;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static function activeRads(): array
|
||||||
|
{
|
||||||
|
return cache()
|
||||||
|
->remember('active_rads',
|
||||||
|
now()->addMinutes(5),
|
||||||
|
fn () => DB::table('users')
|
||||||
|
->join('model_has_roles', 'users.id', '=', 'model_has_roles.model_id')
|
||||||
|
->join('roles', 'model_has_roles.role_id', '=', 'roles.id')
|
||||||
|
->where('roles.name', Role::Radiologist->value)
|
||||||
|
->where('users.is_active', true)
|
||||||
|
->orderBy('users.display_name')
|
||||||
|
->pluck('users.display_name', 'users.id')
|
||||||
|
->toArray());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
126
app/Filament/Resources/DicomRoutingRuleResource.php
Normal file
126
app/Filament/Resources/DicomRoutingRuleResource.php
Normal file
@ -0,0 +1,126 @@
|
|||||||
|
<?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'),
|
||||||
|
];
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,11 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Filament\Resources\DicomRoutingRuleResource\Pages;
|
||||||
|
|
||||||
|
use App\Filament\Resources\DicomRoutingRuleResource;
|
||||||
|
use Filament\Resources\Pages\CreateRecord;
|
||||||
|
|
||||||
|
class CreateDicomRoutingRule extends CreateRecord
|
||||||
|
{
|
||||||
|
protected static string $resource = DicomRoutingRuleResource::class;
|
||||||
|
}
|
@ -0,0 +1,19 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Filament\Resources\DicomRoutingRuleResource\Pages;
|
||||||
|
|
||||||
|
use App\Filament\Resources\DicomRoutingRuleResource;
|
||||||
|
use Filament\Actions;
|
||||||
|
use Filament\Resources\Pages\EditRecord;
|
||||||
|
|
||||||
|
class EditDicomRoutingRule extends EditRecord
|
||||||
|
{
|
||||||
|
protected static string $resource = DicomRoutingRuleResource::class;
|
||||||
|
|
||||||
|
protected function getHeaderActions(): array
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
Actions\DeleteAction::make(),
|
||||||
|
];
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,19 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Filament\Resources\DicomRoutingRuleResource\Pages;
|
||||||
|
|
||||||
|
use App\Filament\Resources\DicomRoutingRuleResource;
|
||||||
|
use Filament\Actions;
|
||||||
|
use Filament\Resources\Pages\ListRecords;
|
||||||
|
|
||||||
|
class ListDicomRoutingRules extends ListRecords
|
||||||
|
{
|
||||||
|
protected static string $resource = DicomRoutingRuleResource::class;
|
||||||
|
|
||||||
|
protected function getHeaderActions(): array
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
Actions\CreateAction::make(),
|
||||||
|
];
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user