diff --git a/app/Http/Controllers/StudyMetadataController.php b/app/Http/Controllers/StudyMetadataController.php
new file mode 100644
index 0000000..0d760f7
--- /dev/null
+++ b/app/Http/Controllers/StudyMetadataController.php
@@ -0,0 +1,40 @@
+user()->may(Permission::StudyMetadataView), 403);
+ $this->decodeKeys();
+ $study = Study::find($this->key);
+
+ return view('staff.meta.view', compact('study'));
+ }
+
+ public function edit()
+ {
+ abort_unless(auth()->user()->may(Permission::StudyMetadataEdit), 403);
+ $this->decodeKeys();
+ $study = Study::find($this->key);
+
+ return view('staff.meta.edit', compact('study'));
+ }
+
+ public function save(StudyMetadataUpdateRequest $request)
+ {
+ abort_unless(auth()->user()->may(Permission::StudyMetadataEdit), 403);
+ $this->decodeKeys();
+ $study = Study::find($this->key);
+ $payload = array_trim_strings($request->validated());
+ $study->update($payload);
+
+ // return redirect()->route('staff.history.view', _h($this->key));
+ return redirect()->route('staff.meta.view', $study->hash);
+ }
+}
diff --git a/app/Http/Requests/StudyMetadataUpdateRequest.php b/app/Http/Requests/StudyMetadataUpdateRequest.php
new file mode 100644
index 0000000..dfdd1e6
--- /dev/null
+++ b/app/Http/Requests/StudyMetadataUpdateRequest.php
@@ -0,0 +1,39 @@
+ ['nullable'],
+ 'patient_name' => ['required'],
+ 'patient_sex' => ['nullable'],
+ 'patient_birthdate' => ['nullable', 'date'],
+ 'study_id' => ['nullable'],
+ 'accession_number' => ['nullable'],
+ 'study_description' => ['nullable'],
+ 'body_part_examined' => ['nullable'],
+ 'station_name' => ['nullable'],
+ 'operators_name' => ['nullable'],
+ 'manufacturer' => ['nullable'],
+ 'manufacturer_model_name' => ['nullable'],
+ 'referring_physician_name' => ['nullable'],
+ 'study_modality' => ['nullable'],
+ 'study_date' => ['required', 'date'],
+ 'receive_date' => ['required', 'date'],
+ 'assigned_physician_id' => ['nullable', 'exists:users,id'],
+ 'referring_physician_id' => ['nullable', 'exists:users,id'],
+ 'access_flags' => ['required', 'integer'],
+ 'access_password' => ['nullable'],
+ ];
+ }
+
+ public function authorize(): bool
+ {
+ return true;
+ }
+}
diff --git a/app/Models/Study.php b/app/Models/Study.php
index 5b322b8..2b62289 100644
--- a/app/Models/Study.php
+++ b/app/Models/Study.php
@@ -75,4 +75,19 @@ public function getHistoryLink(): string
return '#';
}
+
+ public function getMetadataLink(): string
+ {
+ $user = auth()->user();
+
+ if ($user->may(Permission::StudyMetadataEdit)) {
+ return route('staff.meta.edit', $this->hash);
+ }
+
+ if ($user->may(Permission::StudyMetadataView)) {
+ return route('staff.meta.view', $this->hash);
+ }
+
+ return '#';
+ }
}
diff --git a/resources/views/staff/meta/edit.blade.php b/resources/views/staff/meta/edit.blade.php
new file mode 100644
index 0000000..3431abe
--- /dev/null
+++ b/resources/views/staff/meta/edit.blade.php
@@ -0,0 +1,28 @@
+
+ {{ __('Metadata View') }}
+
+ Clinical Information
+
+ patient_name
+
+ {{ __('Metadata View') }}
+
+ Clinical Information
+
+ patient_name
+