This commit is contained in:
Masroor Ehsan 2025-01-07 17:42:26 +06:00
parent ebda878e1f
commit a4cf3015dd
4 changed files with 11 additions and 3 deletions

View File

@ -13,7 +13,7 @@ enum Permission: string
case StudyDownload = 'study_download'; case StudyDownload = 'study_download';
case StudyDelete = 'study_delete'; case StudyDelete = 'study_delete';
case StudyArchive = 'study_archive'; case StudyArchive = 'study_archive';
case ReportCreate = 'report_create'; case ReportEdit = 'report_edit';
case ReportDictate = 'report_dictate'; case ReportDictate = 'report_dictate';
case ReportDownload = 'report_download'; case ReportDownload = 'report_download';
case StudyNotesCreate = 'study_notes_create'; case StudyNotesCreate = 'study_notes_create';

View File

@ -82,5 +82,13 @@ public function canReportDownload(): bool
return $this->activeStudy(fn () => $this->study->report_status >= ReportStatus::Finalized); return $this->activeStudy(fn () => $this->study->report_status >= ReportStatus::Finalized);
} }
public function canReportEdit(): bool
{
return $this->activeStudy(fn () => $this->study->is_locked === false &&
$this->study->report_status <= ReportStatus::Preliminary &&
$this->study->assigned_physician_id === $this->user->id
);
}
public function __construct(private readonly Study $study) {} public function __construct(private readonly Study $study) {}
} }

View File

@ -25,7 +25,7 @@ public function run(): void
} }
$rad->givePermissionTo([ $rad->givePermissionTo([
Permission::ReportCreate, Permission::ReportEdit,
Permission::ReportDownload, Permission::ReportDownload,
Permission::StudyDownload, Permission::StudyDownload,
Permission::StudyMetadataView, Permission::StudyMetadataView,

View File

@ -144,7 +144,7 @@ class="d-flex justify-content-between align-items-start border-end pb-4 pb-sm-0
<span class="badge bg-success">Reported</span> <span class="badge bg-success">Reported</span>
@can(\App\Domain\ACL\Permission::ReportCreate) @can(\App\Domain\ACL\Permission::ReportEdit)
<a target="_blank" class="btn" <a target="_blank" class="btn"
href="{{ route('radiologist.report-write', $study->id) }}">TXT</a> href="{{ route('radiologist.report-write', $study->id) }}">TXT</a>
@endcan @endcan