This commit is contained in:
Dr Masroor Ehsan 2025-01-11 15:45:59 +06:00
parent 06be5f576f
commit 8c3c948b26
5 changed files with 106 additions and 44 deletions

View File

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

View File

@ -79,6 +79,39 @@ public function getContent(): ?string
return Storage::disk('public')->get($this->file_path);
}
public function eligibleForExport(): bool
{
return $this->report_status->value >= ReportStatus::Finalized->value;
}
public function canRemove(User|int|null $user = null): bool
{
if ($this->report_status->value < ReportStatus::Finalized->value) {
if ($this->read_by_id === me($user)->id) {
return true;
}
/*
if ($this->approved_by_id === me($user)->id) {
return true;
}
*/
}
return false;
}
public function canEdit(User|int|null $user = null): bool
{
if ($this->study->canEditReport() &&
$this->report_status->value < ReportStatus::Finalized->value) {
if ($this->read_by_id === me($user)->id) {
return true;
}
}
return false;
}
/**
* @return array<string, string>
*/

View File

@ -10,6 +10,7 @@
</td>
<td>{{ $report->radiologist?->name }}</td>
<td class="align-content-end">
@if ($report->eligibleForExport())
<a class="btn btn-facebook btn-xs me-1 fs-xsmall fw-light" target="_blank"
href="{{ $report->wordDownloadUrl() }}">
<img class="me-1" src="{{ asset('imgs/docx.png') }}" alt="DOCX download">doc
@ -22,6 +23,14 @@
href="{{ $report->htmlDownloadUrl() }}">
<img class="me-1" src="{{ asset('imgs/html.png') }}" alt="HTML download">htm
</a>
@else
@if ($report->canEdit())
edit_button
@endif
@if ($report->canRemove())
remove_button
@endif
@endif
</td>
</tr>
@endforeach

View File

@ -1,36 +1,52 @@
@extends('staff.reports.viewer.layout')
@section('content')
<table class="table table-bordered table-sm border-dark mb-4">
<header class="py-4">
<div class="container">
<div class="p-2 p-lg-2 bg-light rounded-3">
<div class="m-2 m-lg-3">
<table class="table table-bordered border-gray">
<tr>
<td class="fw-semibold text-bg-light">Patient Name</td>
<td>{{ $report->study->patient_name }}</td>
<td class="fw-semibold text-bg-light">Patient ID</td>
<td>{{ $report->study->patient_id }}</td>
<td class="text-muted">Patient Name</td>
<td class="fw-semibold">{{ $report->study->patient_name }}</td>
<td class="text-muted">Patient ID</td>
<td class="fw-semibold">{{ $report->study->patient_id }}</td>
</tr>
<tr>
<td class="fw-semibold text-bg-light">Accession No</td>
<td>{{ $report->study->accession_number }}</td>
<td class="fw-semibold text-bg-light">Age/Gender</td>
<td>{{ $report->study->sexAge() }}</td>
<td class="text-muted">Age/Gender</td>
<td class="fw-semibold">{{ $report->study->sexAge() }}</td>
<td class="text-muted">Accession No</td>
<td class="fw-semibold">{{ $report->study->accession_number }}</td>
</tr>
<tr>
<td class="fw-semibold text-bg-light">Referred By</td>
<td>{{ $report->study->referring_physician_name }}</td>
<td class="fw-semibold text-bg-light">Date</td>
<td>{{ $report->created_at->format('d-M-Y') }}</td>
<td class="text-muted">Referred By</td>
<td class="fw-semibold">{{ $report->study->referring_physician_name }}</td>
<td class="text-muted">Date</td>
<td class="fw-semibold">{{ $report->created_at->format('d-M-Y') }}</td>
</tr>
</table>
<h6 style="text-align: center">
{{ $report->study->modality }} REPORT
<div class="text-center">
<h6 class="text-muted">
{{ $report->study->modality }} Report
</h6>
<h3 style="text-align: center">
<h3>
{{ $report->study->study_description }}
</h3>
</div>
</div>
</div>
</div>
</header>
<section class="pt-4" name="report">
<div class="container px-lg-3">
<div class="border-dark mb-8">
{!! $report->getContent() !!}
</div>
</div>
</section>
@endsection

View File

@ -7,7 +7,7 @@
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/css/bootstrap.min.css" crossorigin="anonymous">
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=Inter:opsz,wght@14..32,400..900&display=swap" rel="stylesheet">
<link href="https://fonts.googleapis.com/css2?family=Inter:opsz,wght@14..32,100..700&display=swap" rel="stylesheet">
<title>{{ $title }}</title>
<style>
body {
@ -20,9 +20,13 @@
@stack('header')
</head>
<body>
<div class="container py-4 px-3 mx-auto">
@yield('content')
<nav class="navbar navbar-light bg-light">
<div class="container px-lg-3">
<a class="navbar-brand fw-semibold" href="#">{{ config('app.name') }}</a>
</div>
</nav>
@yield('content')
@stack('footer')
</body>