wip
This commit is contained in:
parent
3f0fbf8222
commit
93850de7e3
23
app/Http/Controllers/Staff/ReportController.php
Normal file
23
app/Http/Controllers/Staff/ReportController.php
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Http\Controllers\Staff;
|
||||||
|
|
||||||
|
use App\Domain\ACL\Permission;
|
||||||
|
use App\Http\Controllers\HashidControllerBase;
|
||||||
|
use App\Models\Study;
|
||||||
|
|
||||||
|
class ReportController extends HashidControllerBase
|
||||||
|
{
|
||||||
|
public function popup()
|
||||||
|
{
|
||||||
|
abort_unless(me()->may([Permission::ReportEdit, Permission::ReportDictate, Permission::ReportDownload]), 403);
|
||||||
|
$this->decodeKeys();
|
||||||
|
$study = Study::with('reports')->findOrFail($this->key);
|
||||||
|
if (me()->isRadiologist()) {
|
||||||
|
abort_unless($study->isAssignedTo(), 403);
|
||||||
|
}
|
||||||
|
$reports = $study->reports->sortByDesc('created_at');
|
||||||
|
|
||||||
|
return view('staff.reports.popup', compact('study', 'reports'));
|
||||||
|
}
|
||||||
|
}
|
@ -9,6 +9,7 @@
|
|||||||
use App\Models\Traits\HashableId;
|
use App\Models\Traits\HashableId;
|
||||||
use App\Services\Pacs\PacsUrlGen;
|
use App\Services\Pacs\PacsUrlGen;
|
||||||
use Carbon\Carbon;
|
use Carbon\Carbon;
|
||||||
|
use Illuminate\Database\Eloquent\Concerns\HasTimestamps;
|
||||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||||
use Illuminate\Database\Eloquent\Relations\HasMany;
|
use Illuminate\Database\Eloquent\Relations\HasMany;
|
||||||
use Illuminate\Database\Eloquent\Relations\HasOne;
|
use Illuminate\Database\Eloquent\Relations\HasOne;
|
||||||
@ -20,6 +21,7 @@
|
|||||||
class Study extends BaseModel implements HasMedia
|
class Study extends BaseModel implements HasMedia
|
||||||
{
|
{
|
||||||
use HashableId;
|
use HashableId;
|
||||||
|
use HasTimestamps;
|
||||||
use InteractsWithMedia;
|
use InteractsWithMedia;
|
||||||
|
|
||||||
public const string MEDIA_COLLECTION = 'attachments';
|
public const string MEDIA_COLLECTION = 'attachments';
|
||||||
@ -312,6 +314,7 @@ public function unlockStudy(): void
|
|||||||
{
|
{
|
||||||
$this->update(
|
$this->update(
|
||||||
[
|
[
|
||||||
|
'locking_physician_id' => null,
|
||||||
'locked_at' => null,
|
'locked_at' => null,
|
||||||
]
|
]
|
||||||
);
|
);
|
||||||
|
@ -90,6 +90,14 @@ public function isAdmin(): bool
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function isRadiologist(): bool
|
||||||
|
{
|
||||||
|
return cache()->remember('user.is_rad:' . $this->id,
|
||||||
|
5 * 60,
|
||||||
|
fn () => $this->hasRole(Role::Radiologist)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
public function isTech(): bool
|
public function isTech(): bool
|
||||||
{
|
{
|
||||||
return cache()->remember('user.is_tech:' . $this->id,
|
return cache()->remember('user.is_tech:' . $this->id,
|
||||||
|
0
resources/views/staff/reports/popup.blade.php
Normal file
0
resources/views/staff/reports/popup.blade.php
Normal file
Loading…
Reference in New Issue
Block a user