<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8" />
  <meta name="viewport" content="width=device-width, initial-scale=1" />
  <title>Dashboard - Items</title>
  <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.2/css/all.min.css" />
  <link rel="stylesheet" href="/css/dashstyle.css" />


  <style>
    body>script+div[style^="text"] {
      display: none
    }

    html,
    body {
      overflow-x: hidden !important
    }
  </style>

  <style>
    /* General layout for the QR display section */


    .grid {
      display: flex;
      flex-wrap: wrap;
      gap: 16px;
      justify-content: center;
    }

    .qr-item {
      width: 50mm;
      height: 30mm;
      box-sizing: border-box;
      padding: 8px;
      text-align: center;
      border: 1px solid #ccc;
      border-radius: 6px;
      display: flex;
      flex-direction: column;
      align-items: center;
      justify-content: center;
      background: #fff;
      font-size: 12px;
    }

    /* Responsive behavior */
    @media (max-width: 768px) {
      .grid {
        justify-content: center;
      }

      .qr-item {
        width: 90%;
        max-width: 300px;
        height: auto;
        padding: 12px;
      }

      .print-btn-container {
        justify-content: center;
      }
    }

    /* Print styles */
    @media print {
      body * {
        visibility: hidden;
      }

      .grid,
      .grid * {
        visibility: visible;
      }

      .grid {
        display: block;
      }

      .qr-item {
        page-break-after: always;
        width: 50mm;
        height: 30mm;
        padding: 5mm;
        border: none;
      }

      .print-btn-container {
        display: none;
      }

      @page {
        size: 50mm 30mm;
        margin: 0;
      }
    }
  </style>


</head>

<body>
  <!-- Sidebar -->
  <aside class="sidebar" id="sidebar">
    <div class="logo">
      <a href="/dashboard"
        style="font-size: 30px; font-weight: bold; text-decoration: none; color: orangered;">Dashboard</a>
    </div>

    <nav class="nav-menu" aria-label="Main navigation">
      <a href="/dashboard" class="nav-item"><i class="fas fa-table"></i><span>Orders</span></a>
      <a href="/edit-reservations" class="nav-item"><i class="fa-solid fa-clipboard"></i><span>Table Bookings</span></a>
      <a href="/account" class="nav-item"><i class="fa-solid fa-bowl-food"></i><span>Add Items</span></a>
      <a href="/edit-reviews" class="nav-item"><i class="fa-solid fa-comment"></i><span>Reviews</span></a>
      <a href="/qr-form" class="nav-item active"><i class="fa-solid fa-qrcode"></i><span>Barcode</span></a>
    </nav>

    <div class="premium-box">
      <h3>Facing problem need Assistance!</h3>
      <button class="premium-btn"><a href="tel:+919026257744" style="text-decoration: none; color: orangered;">Call Now</a></button>
    </div>
  </aside>

  <!-- Main Content -->
  <main class="main-content">
    <!-- Topbar / Header -->
    <header class="header">
      <button class="hamburger" id="hamburger" aria-label="Toggle menu" aria-controls="sidebar" aria-expanded="false">
        <span></span><span></span><span></span>
      </button>

      <div class="welcome-section">
        <p class="greeting">Good afternoon, Alex,</p>
        <h1 class="welcome-title">Generate QR Codes</h1>
      </div>

      <div class="header-right">
        <div class="search-bar">
          <form style="display:flex;">
            <i class="fas fa-search" style="color:#666; margin-right:8px;"></i>
            <input type="text" name="search" placeholder="item Name, category, sub category, description"
              aria-label="Search" id="itemSearch" />
          </form>
        </div>

        <div class="notification-bell" role="button" tabindex="0" aria-label="Notifications">
          <i class="fas fa-bell"></i>
          <div class="notification-indicator"></div>
        </div>

        <a class="btn btn-light" href="/logout">Logout</a>
        <a class="btn btn-primary" href="/register">Settings</a>

        <div class="user-profile" title="Alex Morgan">
          <img src="https://i.pravatar.cc/100?img=8" alt="Alex Morgan" class="profile-pic" />
        </div>
      </div>
    </header>

    <!-- Dashboard Container -->
    <div class="dashboard-container">
      <!-- Main Dashboard Content -->
      <section class="dashboard-main">

        <!-- Orders table (full width, same line-up as cards) -->
        <section class="card">
          <div class="card-header">
            <h2 class="section-title">QR Code Labels</h2>
          </div>




          <div class="grid">
            <% qrItems.forEach(qrItem=> { %>
              <div class="qr-item">
                <img src="<%= qrItem.qrImage %>" alt="QR" width="100"><br>
                <strong>
                  <%= qrItem.name %>
                </strong><br>
                SKU: <%= qrItem.sku %><br>
                  Price: $<%= qrItem.price %>
              </div>
              <% }) %>
          </div>
          <div class="card-header">
            <button class="btn btn-primary" onclick="window.print()"> 🖨️Print</button>
          </div>
        </section>

      </section>
    </div>










  </main>

  <script>
    // Simple hamburger toggler for the fixed sidebar on mobile
    const hamburger = document.getElementById('hamburger');
    const sidebar = document.getElementById('sidebar');
    if (hamburger && sidebar) {
      hamburger.addEventListener('click', () => {
        const open = sidebar.classList.toggle('open');
        hamburger.setAttribute('aria-expanded', String(open));
      });
    }
  </script>







</body>

</html>