This commit is contained in:
Dr Masroor Ehsan 2025-01-30 00:28:48 +06:00
parent 60f32a6468
commit 7a28b892f3
3 changed files with 28 additions and 15 deletions

View File

@ -3,12 +3,14 @@
namespace App\Filament\Resources; namespace App\Filament\Resources;
use App\Filament\Resources\DicomServerResource\Pages; use App\Filament\Resources\DicomServerResource\Pages;
use App\Models\Department;
use App\Models\DicomServer; use App\Models\DicomServer;
use App\Services\GeoLocation; use App\Services\GeoLocation;
use Filament\Forms\Components\Select; use Filament\Forms\Components\Select;
use Filament\Forms\Components\TextInput; use Filament\Forms\Components\TextInput;
use Filament\Forms\Components\Toggle; use Filament\Forms\Components\Toggle;
use Filament\Forms\Form; use Filament\Forms\Form;
use Filament\Forms\Get;
use Filament\Resources\Resource; use Filament\Resources\Resource;
use Filament\Tables; use Filament\Tables;
use Filament\Tables\Columns\IconColumn; use Filament\Tables\Columns\IconColumn;
@ -30,6 +32,7 @@ public static function form(Form $form): Form
->required(), ->required(),
TextInput::make('server_name') TextInput::make('server_name')
->required() ->required()
->unique(ignoreRecord: true)
->maxLength(255), ->maxLength(255),
Select::make('geo_code') Select::make('geo_code')
->required() ->required()
@ -48,12 +51,11 @@ public static function form(Form $form): Form
->required() ->required()
->maxLength(255), ->maxLength(255),
TextInput::make('ae_title') TextInput::make('ae_title')
->maxLength(255), ->maxLength(24),
TextInput::make('username') TextInput::make('username')
->maxLength(255), ->maxLength(40),
TextInput::make('password') TextInput::make('password')
->password() ->maxLength(40),
->maxLength(255),
TextInput::make('wado_path') TextInput::make('wado_path')
->maxLength(255), ->maxLength(255),
TextInput::make('stone_viewer_path') TextInput::make('stone_viewer_path')
@ -62,10 +64,21 @@ public static function form(Form $form): Form
->maxLength(255), ->maxLength(255),
TextInput::make('meddream_viewer_path') TextInput::make('meddream_viewer_path')
->maxLength(255), ->maxLength(255),
TextInput::make('organization_id') Select::make('organization_id')
->numeric(), ->label('Organization')
TextInput::make('department_id') ->live()
->numeric(), ->relationship('organization', 'name'),
Select::make('department_id')
->label('Department')
->options(function (Get $get) {
$organization_id = $get('organization_id');
$result = [];
if ($organization_id != null) {
$result = Department::active()->organization($organization_id)->pluck('name', 'id')->toArray();
}
return $result;
}),
]); ]);
} }
@ -88,12 +101,13 @@ public static function table(Table $table): Table
->label('WADO'), ->label('WADO'),
TextColumn::make('dicom_port') TextColumn::make('dicom_port')
->label('DICOM'), ->label('DICOM'),
TextColumn::make('rest_api_endpoint')
->label('REST')
->searchable(),
TextColumn::make('ae_title') TextColumn::make('ae_title')
->label('AET') ->label('AET')
->searchable(), ->searchable(),
TextColumn::make('rest_api_endpoint')
->label('REST')
->url(fn (DicomServer $srv) => $srv->rest_api_endpoint, shouldOpenInNewTab: true)
->searchable(),
TextColumn::make('created_at') TextColumn::make('created_at')
->dateTime() ->dateTime()
->sortable() ->sortable()

View File

@ -4,9 +4,8 @@
use App\Models\Traits\Active; use App\Models\Traits\Active;
use App\Models\Traits\HasOrganization; use App\Models\Traits\HasOrganization;
use Illuminate\Database\Eloquent\Model;
class Department extends Model class Department extends BaseModel
{ {
use Active; use Active;
use HasOrganization; use HasOrganization;

View File

@ -10,12 +10,12 @@ class DicomServer extends BaseModel
{ {
use Active; use Active;
public function institute(): BelongsTo public function organization(): BelongsTo
{ {
return $this->belongsTo(Organization::class); return $this->belongsTo(Organization::class);
} }
public function facility(): BelongsTo public function department(): BelongsTo
{ {
return $this->belongsTo(Department::class); return $this->belongsTo(Department::class);
} }