matab-panel/resources/views/prints/surgery-admission.blade.php

274 lines
8.0 KiB
PHP

<!DOCTYPE html>
<html dir="rtl" lang="fa">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>نسخه پذیرش جراحی - {{ $patient->full_name }}</title>
<style>
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
body {
font-family: Tahoma, Arial, sans-serif;
direction: rtl;
background: #e0e0e0;
margin: 0;
padding: 0;
}
.print-toolbar {
background: #1f2937;
color: #fff;
padding: 10px 20px;
display: flex;
align-items: center;
gap: 10px;
flex-wrap: wrap;
direction: rtl;
}
.print-toolbar span {
font-size: 14px;
color: #9ca3af;
margin-left: 6px;
}
.toolbar-btn {
display: inline-flex;
align-items: center;
gap: 6px;
padding: 7px 16px;
border-radius: 6px;
font-size: 13px;
font-family: Tahoma, Arial, sans-serif;
font-weight: bold;
cursor: pointer;
text-decoration: none;
border: none;
}
.btn-print { background: #2563eb; color: #fff; }
.btn-active { background: #16a34a; color: #fff; cursor: default; }
.btn-back { background: #374151; color: #d1d5db; }
.toolbar-divider { flex: 1; }
.page-body {
padding: 20px;
display: flex;
justify-content: center;
align-items: center;
min-height: calc(100vh - 52px);
}
.prescription-container {
width: 210mm;
height: 148mm;
position: relative;
margin: 0 auto;
background: white;
box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
overflow: hidden;
}
.prescription-bg {
width: 100%;
height: 100%;
object-fit: cover;
}
.content-overlay {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
pointer-events: none;
}
.patient-name {
position: absolute;
top: 39%;
right: 82%;
font-size: 12pt;
font-weight: bold;
color: #000;
direction: rtl;
white-space: nowrap;
text-align: right;
}
.patient-name.long-name { font-size: 9pt; }
.patient-name.very-long-name { font-size: 7pt; }
.patient-date {
position: absolute;
top: 45.5%;
left: 5%;
font-size: 15px;
font-weight: bold;
color: #000;
direction: rtl;
}
.surgery-text {
position: absolute;
top: 37.9%;
right: 15%;
font-size: 12pt;
font-weight: bold;
color: #000;
direction: rtl;
white-space: nowrap;
}
.surgery-text.long-name { font-size: 9pt; }
.surgery-text.very-long-name { font-size: 7pt; }
.surgery-type {
position: absolute;
top: 37.5%;
right: 48%;
font-size: 13pt;
font-weight: bold;
color: #000;
direction: rtl;
}
.surgery-center {
position: absolute;
top: 23.5%;
right: 22%;
font-size: 14pt;
font-weight: bold;
color: #000;
direction: rtl;
}
.surgery-date-center {
position: absolute;
top: 45%;
right: 19%;
font-size: 15px;
font-weight: bold;
color: #000;
direction: rtl;
}
@media print {
.print-toolbar { display: none !important; }
.page-body { padding: 0 !important; min-height: unset !important; }
@page {
size: A5 landscape;
margin: 0;
}
* {
margin: 0 !important;
padding: 0 !important;
-webkit-print-color-adjust: exact !important;
print-color-adjust: exact !important;
}
html, body {
width: 210mm !important;
height: 148mm !important;
overflow: hidden !important;
background: white !important;
display: block !important;
}
.prescription-container {
width: 210mm !important;
height: 148mm !important;
position: fixed !important;
top: 0 !important;
left: 0 !important;
margin: 0 !important;
box-shadow: none !important;
}
.prescription-bg {
width: 210mm !important;
height: 148mm !important;
object-fit: fill !important;
display: block !important;
-webkit-print-color-adjust: exact !important;
print-color-adjust: exact !important;
}
.content-overlay {
width: 210mm !important;
height: 148mm !important;
}
}
</style>
</head>
<body>
<div class="print-toolbar">
<span>نسخه پذیرش جراحی:</span>
<span class="toolbar-btn btn-active">{{ $patient->full_name }}</span>
<div class="toolbar-divider"></div>
<button class="toolbar-btn btn-print" onclick="window.print()">🖨 پرینت</button>
<a class="toolbar-btn btn-back" href="{{ route('filament.admin.resources.patients.index') }}">
بازگشت به لیست
</a>
</div>
<div class="page-body">
<div class="prescription-container">
<img src="{{ asset('images/prescription_admission_bg.jpg') }}" alt="نسخه پذیرش" class="prescription-bg">
<div class="content-overlay">
@php
$patientName = $patient->full_name;
$nameLength = mb_strlen($patientName, 'UTF-8');
$nameClass = 'patient-name';
if ($nameLength > 20) {
$nameClass .= ' very-long-name';
} elseif ($nameLength > 14) {
$nameClass .= ' long-name';
}
$surgeryTextClass = 'surgery-text';
if ($nameLength > 20) {
$surgeryTextClass .= ' very-long-name';
} elseif ($nameLength > 14) {
$surgeryTextClass .= ' long-name';
}
@endphp
<div class="{{ $nameClass }}">{{ $patientName }}</div>
<div class="patient-date">{{ $surgeryDate }}</div>
<div class="{{ $surgeryTextClass }}">{{ $patientName }}</div>
<div class="surgery-type">سپتورینوپلاستی</div>
<div class="surgery-date-center">{{ $surgeryDate }}</div>
<div class="surgery-center">{{ $centerName }}</div>
</div>
</div>
</div>
<script>
window.onload = function () {
const userConfirmed = confirm(
'لطفاً تنظیمات پرینت را به این صورت انجام دهید:\n\n' +
'✅ Paper size: A5\n' +
'✅ Orientation: Landscape (افقی)\n' +
'✅ Margins: None (بدون حاشیه)\n' +
'✅ Scale: 100%\n' +
'✅ Background graphics: ON (فعال)\n\n' +
'آیا آماده پرینت هستید؟'
);
if (userConfirmed) {
window.print();
}
};
</script>
</body>
</html>