38815-vm/scan.php
2026-02-28 22:33:39 +00:00

83 lines
3.8 KiB
PHP

<?php
session_start();
require 'db/config.php';
if (!isset($_SESSION['user_id'])) {
header('Location: index.php');
exit;
}
$role = $_SESSION['role'];
?>
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<title>M-TRACK | Scan QR/Barcode</title>
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/css/bootstrap.min.css" rel="stylesheet">
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.10.0/font/bootstrap-icons.css">
<link href="https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap" rel="stylesheet">
<style>
:root {
--bg: #f8fafc;
--card-bg: #ffffff;
--primary: #1e293b;
--accent: #3b82f6;
--text: #334155;
--sidebar-w: 260px;
}
body { font-family: 'Inter', sans-serif; background-color: var(--bg); color: var(--text); }
.sidebar { width: var(--sidebar-w); position: fixed; top: 0; bottom: 0; left: 0; background: var(--card-bg); border-right: 1px solid #e2e8f0; padding: 2rem 1.5rem; }
.main-content { margin-left: var(--sidebar-w); padding: 2rem; display: flex; flex-direction: column; align-items: center; justify-content: center; min-height: 100vh; }
.scanner-box { width: 100%; max-width: 500px; background: white; border-radius: 16px; padding: 2rem; text-align: center; box-shadow: 0 10px 15px -3px rgba(0,0,0,0.1); }
.camera-placeholder { width: 100%; height: 300px; background: #0f172a; border-radius: 12px; position: relative; overflow: hidden; display: flex; align-items: center; justify-content: center; margin-bottom: 1.5rem; }
.scan-line { width: 100%; height: 2px; background: #22c55e; position: absolute; top: 50%; box-shadow: 0 0 10px 2px #22c55e; animation: scan 2s infinite linear; }
@keyframes scan { 0% { top: 0; } 50% { top: 100%; } 100% { top: 0; } }
</style>
</head>
<body>
<div class="sidebar">
<h4 class="fw-bold mb-5" style="color: var(--primary);"><i class="bi bi-cpu me-2"></i>M-TRACK</h4>
<nav class="nav nav-pills flex-column">
<a class="nav-link" href="dashboard.php"><i class="bi bi-grid-fill me-2"></i> Dashboard</a>
<?php if ($role === 'admin'): ?>
<a class="nav-link" href="jobs.php"><i class="bi bi-briefcase me-2"></i> Jobs</a>
<a class="nav-link" href="shop_floor.php"><i class="bi bi-kanban me-2"></i> Shop Floor</a>
<a class="nav-link" href="inventory.php"><i class="bi bi-boxes me-2"></i> Inventory</a>
<a class="nav-link" href="users.php"><i class="bi bi-people me-2"></i> Users</a>
<?php else: ?>
<a class="nav-link" href="dashboard.php"><i class="bi bi-list-task me-2"></i> My Queue</a>
<a class="nav-link" href="shop_floor.php"><i class="bi bi-kanban me-2"></i> Board View</a>
<?php endif; ?>
<a class="nav-link active" href="scan.php"><i class="bi bi-upc-scan me-2"></i> Scan</a>
<hr class="my-4 border-secondary opacity-25">
<a class="nav-link text-danger" href="logout.php"><i class="bi bi-box-arrow-right me-2"></i> Logout</a>
</nav>
</div>
<div class="main-content">
<div class="scanner-box">
<h3 class="fw-bold mb-3">Scan Kanban Card</h3>
<p class="text-muted mb-4">Position the QR or Barcode within the frame to trigger a reorder or update job status.</p>
<div class="camera-placeholder">
<span class="text-white-50"><i class="bi bi-camera-video me-2"></i> Camera Feed Active</span>
<div class="scan-line"></div>
</div>
<button class="btn btn-primary w-100 btn-lg rounded-pill" onclick="simulateScan()">
<i class="bi bi-upc-scan me-2"></i> Simulate Scan
</button>
</div>
</div>
<script>
function simulateScan() {
alert("Scanned! (This is a simulation). In a real environment, this would parse the QR code payload and trigger an API call to update inventory or job status.");
}
</script>
</body>
</html>