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;
use App\Filament\Resources\DicomServerResource\Pages;
use App\Models\Department;
use App\Models\DicomServer;
use App\Services\GeoLocation;
use Filament\Forms\Components\Select;
use Filament\Forms\Components\TextInput;
use Filament\Forms\Components\Toggle;
use Filament\Forms\Form;
use Filament\Forms\Get;
use Filament\Resources\Resource;
use Filament\Tables;
use Filament\Tables\Columns\IconColumn;
@ -30,6 +32,7 @@ public static function form(Form $form): Form
->required(),
TextInput::make('server_name')
->required()
->unique(ignoreRecord: true)
->maxLength(255),
Select::make('geo_code')
->required()
@ -48,12 +51,11 @@ public static function form(Form $form): Form
->required()
->maxLength(255),
TextInput::make('ae_title')
->maxLength(255),
->maxLength(24),
TextInput::make('username')
->maxLength(255),
->maxLength(40),
TextInput::make('password')
->password()
->maxLength(255),
->maxLength(40),
TextInput::make('wado_path')
->maxLength(255),
TextInput::make('stone_viewer_path')
@ -62,10 +64,21 @@ public static function form(Form $form): Form
->maxLength(255),
TextInput::make('meddream_viewer_path')
->maxLength(255),
TextInput::make('organization_id')
->numeric(),
TextInput::make('department_id')
->numeric(),
Select::make('organization_id')
->label('Organization')
->live()
->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'),
TextColumn::make('dicom_port')
->label('DICOM'),
TextColumn::make('rest_api_endpoint')
->label('REST')
->searchable(),
TextColumn::make('ae_title')
->label('AET')
->searchable(),
TextColumn::make('rest_api_endpoint')
->label('REST')
->url(fn (DicomServer $srv) => $srv->rest_api_endpoint, shouldOpenInNewTab: true)
->searchable(),
TextColumn::make('created_at')
->dateTime()
->sortable()

View File

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

View File

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