This commit is contained in:
Dr Masroor Ehsan 2025-01-18 14:51:24 +06:00
parent b493f2742b
commit 2365ac1ca7
3 changed files with 72 additions and 19 deletions

View File

@ -209,11 +209,6 @@ public function getColumns(): array
return $columns; return $columns;
} }
private function columTitle(string $str): string
{
return Str::of($str)->slug()->replace('-', ' ')->title()->toString();
}
/** /**
* Get the filename for export. * Get the filename for export.
*/ */
@ -228,12 +223,17 @@ protected function filename(): string
return Str::slug(implode(' ', $parts), '_'); return Str::slug(implode(' ', $parts), '_');
} }
private function columTitle(string $str): string
{
return Str::of($str)->slug()->replace('-', ' ')->title()->toString();
}
private function physicianColumn(Study $study): ?string private function physicianColumn(Study $study): ?string
{ {
$user = $study->readingPhysician; $user = $study->readingPhysician;
if ($user === null) { if ($user === null) {
if ($study->assigned_at !== null) { if ($study->assigned_at !== null) {
return '<img src="' . asset('imgs/checklist.png') . '" data-bs-toggle="tooltip" data-bs-placement="right" title="Assigned at ' . $study->assigned_at->format(self::DATE_FORMAT_LONG) . '">'; return '<img src="' . asset('imgs/checklist.png') . '" data-bs-toggle="tooltip" data-bs-placement="right" title="Assigned on ' . $study->assigned_at->format(self::DATE_FORMAT_LONG) . '">';
} }
return null; return null;

View File

@ -83,15 +83,17 @@ public function view(string $uuid)
$manager = ReportManager::fromReport($uuid); $manager = ReportManager::fromReport($uuid);
$title = 'Report Quick View ' . $manager->getStudy()->getPatientDemographic(); $title = 'Report Quick View ' . $manager->getStudy()->getPatientDemographic();
$report = $manager->getReport(); $report = $manager->getReport();
$copy_button = false;
if ($report->isFinalized()) { if ($report->isFinalized()) {
$stamper = new StampService($report->read_by_id); $stamper = new StampService($report->read_by_id);
$signature = $stamper->hasSignatureImage() ? $stamper->signatureImageUrl() : null; $signature = $stamper->hasSignatureImage() ? $stamper->signatureImageUrl() : null;
$notice = null; $notice = null;
$copy_button = true;
} else { } else {
$signature = null; $signature = null;
$notice = 'This is a preliminary radiology interpretation that has not been finalized or approved by a radiologist. It is not intended for diagnostic purposes.'; $notice = 'This is a preliminary radiology interpretation that has not been finalized or approved by a radiologist. It is not intended for diagnostic purposes.';
} }
return view('staff.reports.viewer.html-report', compact('report', 'title', 'signature', 'notice')); return view('staff.reports.viewer.html-report', compact('report', 'title', 'signature', 'notice', 'copy_button'));
} }
} }

View File

@ -1,5 +1,10 @@
@extends('staff.reports.viewer.layout') @extends('staff.reports.viewer.layout')
@push('header')
<link rel="stylesheet" href="//cdnjs.cloudflare.com/ajax/libs/toastr.js/2.1.4/toastr.min.css"
crossorigin="anonymous" referrerpolicy="no-referrer"/>
@endpush
@section('content') @section('content')
<div class="container container-main"> <div class="container container-main">
@ -58,9 +63,10 @@ class="fa-solid fs-4 fa-circle-radiation me-2"></i></span>Notice
</div> </div>
</header> </header>
<div id="report_content">
<section class="pt-4" name="report"> <section class="pt-4" name="report">
<div class="px-lg-3"> <div class="px-lg-3">
<div class="border-dark mb-8"> <div class="mb-8">
{!! $report->getContent() !!} {!! $report->getContent() !!}
</div> </div>
</div> </div>
@ -74,6 +80,15 @@ class="fa-solid fs-4 fa-circle-radiation me-2"></i></span>Notice
</section> </section>
@endisset @endisset
</div> </div>
@if ($copy_button)
<div class="d-flex justify-content-end">
<button class="btn btn-outline-primary btn-sm" onclick="copyToClipboard('report_content')">
<i class="fa-regular fa-copy"></i> Copy to Clipboard
</button>
</div>
@endif
</div>
@endsection @endsection
@push('footer') @push('footer')
@ -84,4 +99,40 @@ class="fa-solid fs-4 fa-circle-radiation me-2"></i></span>Notice
</span> </span>
</div> </div>
</footer> </footer>
<script src="//cdnjs.cloudflare.com/ajax/libs/jquery/3.7.1/jquery.min.js" crossorigin="anonymous"
referrerpolicy="no-referrer"></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/toastr.js/2.1.4/toastr.min.js" crossorigin="anonymous"
referrerpolicy="no-referrer"></script>
<script>
function copyToClipboard(div_id) {
const content_div = document.getElementById(div_id);
const range = document.createRange();
range.selectNode(content_div);
window.getSelection().removeAllRanges();
window.getSelection().addRange(range);
try {
if (navigator.clipboard && window.isSecureContext) {
navigator.clipboard.writeText(content_div.innerText)
.then(() => {
toastr.info('Report copied to clipboard');
})
.catch(() => {
toastr.warning("Failed to copy report");
});
} else {
const success = document.execCommand("copy");
if (success) {
toastr.info('Report copied to clipboard')
} else {
toastr.warning("Failed to copy report");
}
}
} finally {
window.getSelection().removeAllRanges();
}
}
</script>
@endpush @endpush