Files
2026-09-16 23:20:08 +07:00

76 lines
3.8 KiB
PHP

<?php
// views/lab_image.php
require_once("../core/auth.php");
require_once("../config/db.php");
require_once("../core/utils.php");
$ln_enc = $_GET['ln'] ?? '';
$ln = decrypt_param($ln_enc);
if (empty($ln)) {
die("Invalid or missing lab order number.");
}
$sqlLn = "SELECT image1, image2, image3 FROM lab_order_image WHERE lab_order_number=?";
$stmt = $conn1->prepare($sqlLn);
$stmt->bind_param("s", $ln);
$stmt->execute();
$resultLn = $stmt->get_result();
$rowLn = $resultLn->fetch_assoc();
$stmt->close();
?>
<!DOCTYPE html>
<html lang="th">
<head>
<?php
$page_title = "ภาพผลการตรวจทางห้องปฏิบัติการ (Lab Image)";
require_once("../components/head.php");
?>
</head>
<body class="bg-gradient-to-br from-emerald-50 to-emerald-100 text-slate-800 font-sans antialiased min-h-screen flex flex-col">
<main class="flex-1 p-4 lg:p-8 flex items-center justify-center overflow-y-auto">
<div class="max-w-4xl w-full mx-auto">
<div class="glass-card animate-enter overflow-hidden">
<div class="px-6 py-4 border-b border-white/50 bg-white/60 flex justify-between items-center sticky top-0 z-10 backdrop-blur-xl">
<h2 class="text-xl font-bold flex items-center gap-3 text-emerald-800">
<svg class="w-6 h-6 text-emerald-600" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M4 16l4.586-4.586a2 2 0 012.828 0L16 16m-2-2l1.586-1.586a2 2 0 012.828 0L20 14m-6-6h.01M6 20h12a2 2 0 002-2V6a2 2 0 00-2-2H6a2 2 0 00-2 2v12a2 2 0 002 2z"></path></svg>
ภาพผลแล็บ (Lab Number: <?php echo htmlspecialchars($ln); ?>)
</h2>
<button onclick="window.close()" class="btn-outline !py-2 !px-4 text-sm bg-white/50">
ปิดหน้าต่าง
</button>
</div>
<div class="p-8 flex flex-col gap-8 items-center bg-slate-50/50">
<?php
$has_image = false;
if ($rowLn) {
for ($i = 1; $i <= 3; $i++) {
$img_col = "image$i";
if (!empty($rowLn[$img_col])) {
$has_image = true;
echo '<div class="w-full bg-white p-2 rounded-xl shadow-sm border border-slate-200 overflow-hidden">';
echo '<img src="data:image/jpeg;base64,' . base64_encode($rowLn[$img_col]) . '" alt="Lab Image ' . $i . '" class="w-full h-auto object-contain rounded-lg hover:scale-[1.02] transition-transform duration-300"/>';
echo '</div>';
}
}
}
if (!$has_image) {
echo '<div class="py-16 text-center text-slate-500 w-full flex flex-col items-center">
<svg class="w-16 h-16 mb-4 text-slate-300" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M4 16l4.586-4.586a2 2 0 012.828 0L16 16m-2-2l1.586-1.586a2 2 0 012.828 0L20 14m-6-6h.01M6 20h12a2 2 0 002-2V6a2 2 0 00-2-2H6a2 2 0 00-2 2v12a2 2 0 002 2z"></path></svg>
<p class="text-lg">ไม่พบรูปภาพประกอบสำหรับผลแล็บนี้</p>
</div>';
}
?>
</div>
</div>
</div>
<?php require_once("../components/layout_footer.php"); ?>
</main>
<script src="../assets/js/micro-interactions.js"></script>
</body>
</html>