This commit is contained in:
Dr Masroor Ehsan 2025-01-11 13:25:33 +06:00
parent 5b9b4cad8d
commit 727d706a97
5 changed files with 37 additions and 22 deletions

View File

@ -279,11 +279,9 @@ private function renderCustomColumns(): array
private function generateReportingButtons(Study $study): string private function generateReportingButtons(Study $study): string
{ {
if (me()->isRadiologist()) { if (me()->isRadiologist() && $study->canEditReport() && ! $study->hasReports()) {
if (! $study->hasReports() && $study->canEditReport()) { // fresh untouched study, can edit report: take the rad directly to the edit page
// fresh untouched study, can edit report: take the rad directly to the edit page return '<a href="' . route('staff.report.create', $study->hash) . '" target="_blank" class="btn btn-sm btn-outline-light"><i class="fa-light fa-edit"></i></a>';
return '<a href="' . route('staff.report.create', $study->hash) . '" target="_blank" class="btn btn-sm btn-outline-light"><i class="fa-light fa-edit"></i></a>';
}
} }
return $this->renderButton($study->hash, 'fa-eye', 'show-reports btn-outline', 'R'); return $this->renderButton($study->hash, 'fa-eye', 'show-reports btn-outline', 'R');

View File

@ -15,9 +15,10 @@ public function popup()
{ {
abort_unless(me()->may([Permission::ReportEdit, Permission::ReportDictate, Permission::ReportApprove, Permission::ReportDownload]), 403); abort_unless(me()->may([Permission::ReportEdit, Permission::ReportDictate, Permission::ReportApprove, Permission::ReportDownload]), 403);
$this->decodeKeys(); $this->decodeKeys();
$study = Study::with(['reports.radiologist', 'readingPhysician'])->findOrFail($this->key); $study = Study::with(['reports.radiologist', 'assignedPhysicians'])->findOrFail($this->key);
if (me()->isRadiologist()) { if (me()->isRadiologist()) {
abort_unless($study->isAssigned(), 403); // abort_unless($study->isAssigned(), 403);
abort_unless($study->isUserInStudyAssignmentsOrReadingPhysician(), 403);
} }
$reports = $study->reports->sortByDesc('created_at'); $reports = $study->reports->sortByDesc('created_at');

View File

@ -27,6 +27,7 @@ public function run(): void
$rad->givePermissionTo([ $rad->givePermissionTo([
Permission::ReportEdit, Permission::ReportEdit,
Permission::ReportDownload, Permission::ReportDownload,
Permission::ReportApprove,
Permission::StudyDownload, Permission::StudyDownload,
Permission::StudyMetadataView, Permission::StudyMetadataView,
Permission::StudyHistoryView, Permission::StudyHistoryView,

View File

@ -35,25 +35,40 @@ public function run(): void
$chevron = Institute::where('name', 'Chevron')->first(); $chevron = Institute::where('name', 'Chevron')->first();
$cmch = Institute::where('name', 'CMCH')->first(); $cmch = Institute::where('name', 'CMCH')->first();
User::factory(2)->create([ User::factory(4)
'institute_id' => $chevron->id, ->create([
]) 'institute_id' => $chevron->id,
->each(function ($u) { ])
$u->assignRole(Role::Technician); ->each(function ($u, $key) {
});
User::factory(2)->create([
'institute_id' => $cmch->id,
])
->each(function ($u) {
$u->assignRole(Role::Technician); $u->assignRole(Role::Technician);
$u->update([
'username' => sprintf('tech%d', $key + 1),
]);
}); });
User::factory(8)->create() User::factory(4)
->each(function ($u) { ->create([
'institute_id' => $cmch->id,
])
->each(function ($u, $key) {
$u->assignRole(Role::Technician);
$u->update([
'username' => sprintf('cmctech%d', $key + 1),
]);
});
User::factory(8)
->create()
->each(function ($u, $key) {
$u->assignRole(Role::Radiologist); $u->assignRole(Role::Radiologist);
$u->update([
'display_name' => sprintf('Dr. %s', $u->first_name),
'username' => sprintf('rad%d', $key + 1),
]);
}); });
User::factory(3)->create() User::factory(3)
->create()
->each(function ($u) { ->each(function ($u) {
$u->assignRole(Role::Guest); $u->assignRole(Role::Guest);
}); });

View File

@ -27,7 +27,7 @@
@endforeach @endforeach
</table> </table>
<a class="btn btn-secondary btn-xs" href="{{ route('staff.report.create', $study->hash) }}"> <a class="btn btn-primary btn-xs" target="_blank" href="{{ route('staff.report.create', $study->hash) }}">
Create Create New
</a> </a>