commit
1e0c62ce92
@ -337,6 +337,11 @@ private function filterStatus(QueryBuilder $query, ?string $status): void
|
|||||||
case 'orphan':
|
case 'orphan':
|
||||||
$query->whereNull('assigned_at');
|
$query->whereNull('assigned_at');
|
||||||
break;
|
break;
|
||||||
|
case 'bookmark':
|
||||||
|
$query->whereHas('bookmarkedByUsers', function ($q) {
|
||||||
|
$q->where('user_id', auth()->id());
|
||||||
|
});
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -609,6 +614,27 @@ private function generateActionButtons(Study $study): string
|
|||||||
case WorklistButton::Audit:
|
case WorklistButton::Audit:
|
||||||
$btns[] = $this->renderImageLink($study->hash, 'audit.png', 'show-audit', 'Audit Trail');
|
$btns[] = $this->renderImageLink($study->hash, 'audit.png', 'show-audit', 'Audit Trail');
|
||||||
break;
|
break;
|
||||||
|
case WorklistButton::Bookmark:
|
||||||
|
if ($study->isBookmarkedBy()) {
|
||||||
|
$btns[] = Blade::render('staff.worklist.partials.bookmarks._delete',
|
||||||
|
[
|
||||||
|
'study_id' => $study->id,
|
||||||
|
'user_id' => me()->id,
|
||||||
|
'url' => route('staff.bookmark.delete'),
|
||||||
|
'img' => asset('imgs/bookmark-delete.png'),
|
||||||
|
'tip' => 'Remove bookmark',
|
||||||
|
]);
|
||||||
|
} else {
|
||||||
|
$btns[] = Blade::render('staff.worklist.partials.bookmarks._create',
|
||||||
|
[
|
||||||
|
'study_id' => $study->id,
|
||||||
|
'user_id' => me()->id,
|
||||||
|
'url' => route('staff.bookmark.create'),
|
||||||
|
'img' => asset('imgs/bookmark.png'),
|
||||||
|
'tip' => 'Bookmark study',
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -26,4 +26,5 @@ enum Permission: string
|
|||||||
case UnassignRadiologist = 'unassign_radiologist';
|
case UnassignRadiologist = 'unassign_radiologist';
|
||||||
case AccessAllWorklists = 'access_all_worklists';
|
case AccessAllWorklists = 'access_all_worklists';
|
||||||
case AuditLogView = 'audit_log_view';
|
case AuditLogView = 'audit_log_view';
|
||||||
|
case BookmarkCreate = 'bookmark_create';
|
||||||
}
|
}
|
||||||
|
30
app/Http/Controllers/Staff/BookmarkController.php
Normal file
30
app/Http/Controllers/Staff/BookmarkController.php
Normal file
@ -0,0 +1,30 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Http\Controllers\Staff;
|
||||||
|
|
||||||
|
use App\Http\Controllers\Controller;
|
||||||
|
use App\Http\Requests\BookmarkCrudRequest;
|
||||||
|
use App\Models\StudyBookmark;
|
||||||
|
use App\Services\AuditTrail\Activity;
|
||||||
|
|
||||||
|
class BookmarkController extends Controller
|
||||||
|
{
|
||||||
|
public function create(BookmarkCrudRequest $request)
|
||||||
|
{
|
||||||
|
StudyBookmark::create($request->validated());
|
||||||
|
|
||||||
|
audit()->did(Activity::Study_Bookmark)->on($request->study_id)->log();
|
||||||
|
|
||||||
|
return redirect()->route('staff.worklist.index');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function delete(BookmarkCrudRequest $request)
|
||||||
|
{
|
||||||
|
$studyBookmark = StudyBookmark::where($request->validated())->firstOrFail();
|
||||||
|
$studyBookmark->delete();
|
||||||
|
|
||||||
|
audit()->did(Activity::Study_Unmark)->on($request->study_id)->log();
|
||||||
|
|
||||||
|
return redirect()->route('staff.worklist.index');
|
||||||
|
}
|
||||||
|
}
|
@ -1,38 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
namespace App\Http\Controllers;
|
|
||||||
|
|
||||||
use App\Http\Requests\BookmarkCrudRequest;
|
|
||||||
use App\Models\StudyBookmark;
|
|
||||||
|
|
||||||
class StudyBookmarkController extends Controller
|
|
||||||
{
|
|
||||||
public function index()
|
|
||||||
{
|
|
||||||
return StudyBookmark::all();
|
|
||||||
}
|
|
||||||
|
|
||||||
public function store(BookmarkCrudRequest $request)
|
|
||||||
{
|
|
||||||
return StudyBookmark::create($request->validated());
|
|
||||||
}
|
|
||||||
|
|
||||||
public function show(StudyBookmark $studyBookmark)
|
|
||||||
{
|
|
||||||
return $studyBookmark;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function update(BookmarkCrudRequest $request, StudyBookmark $studyBookmark)
|
|
||||||
{
|
|
||||||
$studyBookmark->update($request->validated());
|
|
||||||
|
|
||||||
return $studyBookmark;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function destroy(StudyBookmark $studyBookmark)
|
|
||||||
{
|
|
||||||
$studyBookmark->delete();
|
|
||||||
|
|
||||||
return response()->json();
|
|
||||||
}
|
|
||||||
}
|
|
@ -9,8 +9,8 @@ class BookmarkCrudRequest extends FormRequest
|
|||||||
public function rules(): array
|
public function rules(): array
|
||||||
{
|
{
|
||||||
return [
|
return [
|
||||||
'study_id' => ['required', 'exists:studies'],
|
'study_id' => ['required', 'exists:studies,id'],
|
||||||
'user_id' => ['required', 'exists:users'],
|
'user_id' => ['required', 'exists:users,id'],
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -443,6 +443,11 @@ public function isReadBy(User|int|null $user = null): bool
|
|||||||
return $this->reading_physician_id === me($user)->id;
|
return $this->reading_physician_id === me($user)->id;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function isBookmarkedBy(User|int|null $user = null): bool
|
||||||
|
{
|
||||||
|
return $this->bookmarkedByUsers()->where('user_id', me($user)->id)->exists();
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns true if study has been locked by the given user or is unlocked. Returns false if the study was locked by another user.
|
* Returns true if study has been locked by the given user or is unlocked. Returns false if the study was locked by another user.
|
||||||
*/
|
*/
|
||||||
|
@ -11,4 +11,5 @@ enum WorklistButton: string
|
|||||||
case Assign = 'assign';
|
case Assign = 'assign';
|
||||||
case Report = 'report';
|
case Report = 'report';
|
||||||
case Audit = 'audit';
|
case Audit = 'audit';
|
||||||
|
case Bookmark = 'bookmark';
|
||||||
}
|
}
|
||||||
|
@ -58,6 +58,7 @@ public static function worklistButtons(Study $study, User|int|null $usr = null):
|
|||||||
WorklistButton::StudyMetadata,
|
WorklistButton::StudyMetadata,
|
||||||
WorklistButton::Notes,
|
WorklistButton::Notes,
|
||||||
// WorklistButton::Audit,
|
// WorklistButton::Audit,
|
||||||
|
WorklistButton::Bookmark,
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -75,6 +76,10 @@ public static function worklistButtons(Study $study, User|int|null $usr = null):
|
|||||||
$buttons->push(WorklistButton::Audit);
|
$buttons->push(WorklistButton::Audit);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (may(Permission::BookmarkCreate)) {
|
||||||
|
$buttons->push(WorklistButton::Bookmark);
|
||||||
|
}
|
||||||
|
|
||||||
return $buttons;
|
return $buttons;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -28,6 +28,8 @@ enum Activity: int
|
|||||||
case Attachment_Upload = 112;
|
case Attachment_Upload = 112;
|
||||||
case Attachment_Download = 113;
|
case Attachment_Download = 113;
|
||||||
case Attachment_Delete = 114;
|
case Attachment_Delete = 114;
|
||||||
|
case Study_Bookmark = 115;
|
||||||
|
case Study_Unmark = 116;
|
||||||
|
|
||||||
// image
|
// image
|
||||||
case Image_Download = 150;
|
case Image_Download = 150;
|
||||||
|
@ -2,6 +2,8 @@
|
|||||||
|
|
||||||
use App\Models\Study;
|
use App\Models\Study;
|
||||||
use App\Models\User;
|
use App\Models\User;
|
||||||
|
use Illuminate\Database\Migrations\Migration;
|
||||||
|
use Illuminate\Database\Schema\Blueprint;
|
||||||
|
|
||||||
return new class extends Migration
|
return new class extends Migration
|
||||||
{
|
{
|
||||||
|
@ -34,6 +34,7 @@ public function run(): void
|
|||||||
Permission::StudyNotesCreate,
|
Permission::StudyNotesCreate,
|
||||||
Permission::StudyNotesView,
|
Permission::StudyNotesView,
|
||||||
Permission::AttachmentDownload,
|
Permission::AttachmentDownload,
|
||||||
|
Permission::BookmarkCreate,
|
||||||
]);
|
]);
|
||||||
|
|
||||||
$tech->givePermissionTo([
|
$tech->givePermissionTo([
|
||||||
@ -49,6 +50,7 @@ public function run(): void
|
|||||||
Permission::StudyArchive,
|
Permission::StudyArchive,
|
||||||
Permission::ReportDownload,
|
Permission::ReportDownload,
|
||||||
Permission::AuditLogView,
|
Permission::AuditLogView,
|
||||||
|
Permission::BookmarkCreate,
|
||||||
]);
|
]);
|
||||||
|
|
||||||
$adm->givePermissionTo(SpatiePermission::all());
|
$adm->givePermissionTo(SpatiePermission::all());
|
||||||
|
BIN
resources/imgs/bookmark-delete.png
Normal file
BIN
resources/imgs/bookmark-delete.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 822 B |
BIN
resources/imgs/bookmark.png
Normal file
BIN
resources/imgs/bookmark.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.1 KiB |
@ -7,6 +7,7 @@
|
|||||||
@include('staff.worklist.partials._nav-item', ['id' => 'nav__orphan', 'text' => 'Unassigned', 'active' => '', 'icon' => 'price-tag-3-line', 'tip' => 'Unassigned studies'])
|
@include('staff.worklist.partials._nav-item', ['id' => 'nav__orphan', 'text' => 'Unassigned', 'active' => '', 'icon' => 'price-tag-3-line', 'tip' => 'Unassigned studies'])
|
||||||
@include('staff.worklist.partials._nav-item', ['id' => 'nav__assigned', 'text' => 'Assigned', 'active' => '', 'icon' => 'team-line', 'tip' => 'Studies assigned to radiologists'])
|
@include('staff.worklist.partials._nav-item', ['id' => 'nav__assigned', 'text' => 'Assigned', 'active' => '', 'icon' => 'team-line', 'tip' => 'Studies assigned to radiologists'])
|
||||||
@endif
|
@endif
|
||||||
|
@include('staff.worklist.partials._nav-item', ['id' => 'nav__bookmark', 'text' => 'Bookmarked', 'active' => '', 'icon' => 'bookmark-line', 'tip' => 'Bookmarked studies'])
|
||||||
@include('staff.worklist.partials._nav-item', ['id' => 'nav__all', 'text' => 'All', 'active' => '', 'icon' => 'stack-line', 'tip' => 'All studies'])
|
@include('staff.worklist.partials._nav-item', ['id' => 'nav__all', 'text' => 'All', 'active' => '', 'icon' => 'stack-line', 'tip' => 'All studies'])
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
|
@ -0,0 +1,7 @@
|
|||||||
|
@php
|
||||||
|
$form_id = 'bm-creat-' . $study_id;
|
||||||
|
@endphp
|
||||||
|
<a href="#" onclick="document.getElementById('{{ $form_id }}').submit(); return false;">
|
||||||
|
@include('_partials._img-tooltip', ['src' => $img, 'class' => $class ?? 'msg-icon', 'tip' => $tip])
|
||||||
|
@include('staff.worklist.partials.bookmarks._form', ['form_id' => $form_id, 'url' => $url, 'study_id' => $study_id, 'user_id' => $user_id, 'delete' => false])
|
||||||
|
</a>
|
@ -0,0 +1,7 @@
|
|||||||
|
@php
|
||||||
|
$form_id = 'bm-del_' . $study_id;
|
||||||
|
@endphp
|
||||||
|
<a href="#" onclick="document.getElementById('{{ $form_id }}').submit(); return false;">
|
||||||
|
@include('_partials._img-tooltip', ['src' => $img, 'class' => $class ?? 'msg-icon', 'tip' => $tip])
|
||||||
|
@include('staff.worklist.partials.bookmarks._form', ['form_id' => $form_id, 'url' => $url, 'study_id' => $study_id, 'user_id' => $user_id, 'delete' => true])
|
||||||
|
</a>
|
@ -0,0 +1,8 @@
|
|||||||
|
<form id="{{ $form_id }}" action="{{ $url }}" method="POST" style="display:none;">
|
||||||
|
@csrf
|
||||||
|
@if ($delete)
|
||||||
|
@method('DELETE')
|
||||||
|
@endif
|
||||||
|
<input type="hidden" name="study_id" value="{{ $study_id }}">
|
||||||
|
<input type="hidden" name="user_id" value="{{ $user_id }}">
|
||||||
|
</form>
|
@ -6,6 +6,7 @@
|
|||||||
use App\Http\Controllers\Staff\AssignmentController;
|
use App\Http\Controllers\Staff\AssignmentController;
|
||||||
use App\Http\Controllers\Staff\AttachmentController;
|
use App\Http\Controllers\Staff\AttachmentController;
|
||||||
use App\Http\Controllers\Staff\AuditLogController;
|
use App\Http\Controllers\Staff\AuditLogController;
|
||||||
|
use App\Http\Controllers\Staff\BookmarkController;
|
||||||
use App\Http\Controllers\Staff\DicomViewerController;
|
use App\Http\Controllers\Staff\DicomViewerController;
|
||||||
use App\Http\Controllers\Staff\HistoryController;
|
use App\Http\Controllers\Staff\HistoryController;
|
||||||
use App\Http\Controllers\Staff\MetadataController;
|
use App\Http\Controllers\Staff\MetadataController;
|
||||||
@ -85,6 +86,11 @@
|
|||||||
Route::group(['prefix' => 'audit', 'as' => 'audit.'], function () {
|
Route::group(['prefix' => 'audit', 'as' => 'audit.'], function () {
|
||||||
Route::get('popup', [AuditLogController::class, 'popup'])->name('popup');
|
Route::get('popup', [AuditLogController::class, 'popup'])->name('popup');
|
||||||
});
|
});
|
||||||
|
|
||||||
|
Route::group(['prefix' => 'bookmark', 'as' => 'bookmark.'], function () {
|
||||||
|
Route::post('/', [BookmarkController::class, 'create'])->name('create');
|
||||||
|
Route::delete('/', [BookmarkController::class, 'delete'])->name('delete');
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
});
|
});
|
||||||
|
Loading…
Reference in New Issue
Block a user