{"id":200,"date":"2026-05-08T02:46:06","date_gmt":"2026-05-08T02:46:06","guid":{"rendered":"https:\/\/adane-bitaniya.yeneserg.com\/?page_id=200"},"modified":"2026-05-23T09:24:14","modified_gmt":"2026-05-23T09:24:14","slug":"scanner","status":"publish","type":"page","link":"https:\/\/adane-bitaniya.yeneserg.com\/am\/scanner\/","title":{"rendered":"Scanner"},"content":{"rendered":"<div data-elementor-type=\"wp-page\" data-elementor-id=\"200\" class=\"elementor elementor-200\">\n\t\t\t\t<div class=\"elementor-element elementor-element-f2b6133 e-flex e-con-boxed wpr-particle-no wpr-jarallax-no wpr-parallax-no wpr-sticky-section-no wpr-column-slider-no wpr-equal-height-no e-con e-parent\" data-id=\"f2b6133\" data-element_type=\"container\" data-e-type=\"container\">\n\t\t\t\t\t<div class=\"e-con-inner\">\n\t\t\t\t<div class=\"elementor-element elementor-element-bdcddeb elementor-widget elementor-widget-html\" data-id=\"bdcddeb\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"html.default\">\n\t\t\t\t\t<!-- Load the QR Scanner Library -->\r\n<script src=\"https:\/\/unpkg.com\/html5-qrcode\"><\/script>\r\n<link href=\"https:\/\/fonts.googleapis.com\/css2?family=Montserrat:wght@400;600&display=swap\" rel=\"stylesheet\">\r\n\r\n<div class=\"scanner-container\">\r\n  <style>\r\n    .scanner-container {\r\n      font-family: 'Montserrat', sans-serif;\r\n      max-width: 500px;\r\n      margin: 0 auto;\r\n      text-align: center;\r\n      background: #1a1a1a;\r\n      padding: 20px;\r\n      border-radius: 20px;\r\n      color: white;\r\n    }\r\n    #reader {\r\n      width: 100%;\r\n      border-radius: 15px;\r\n      overflow: hidden;\r\n      border: 2px solid #fff !important;\r\n      background: #000;\r\n      min-height: 250px;\r\n    }\r\n    #result-display {\r\n      margin-top: 20px;\r\n      padding: 15px;\r\n      border-radius: 10px;\r\n      display: none;\r\n      font-weight: 600;\r\n      white-space: pre-line;\r\n    }\r\n    .success { background: #2ecc71; color: white; }\r\n    .error { background: #e74c3c; color: white; }\r\n    .warning { background: #f1c40f; color: black; }\r\n    \r\n    .scan-btn {\r\n      background: #fff;\r\n      color: black;\r\n      border: none;\r\n      padding: 15px 30px;\r\n      border-radius: 50px;\r\n      font-weight: 600;\r\n      cursor: pointer;\r\n      margin-top: 15px;\r\n    }\r\n  <\/style>\r\n\r\n  <h2 style=\"color: #fff;\">Staff Check-In<\/h2>\r\n  \r\n  <!-- Viewfinder placeholder -->\r\n  <div id=\"reader\"><\/div>\r\n  \r\n  <div id=\"result-display\"><\/div>\r\n  \r\n  <button id=\"restartBtn\" class=\"scan-btn\" style=\"display:none;\" onclick=\"resumeCameraScanning()\">Scan Next Guest<\/button>\r\n<\/div>\r\n\r\n<script>\r\n  const WEBAPP_URL = \"https:\/\/script.google.com\/macros\/s\/AKfycbw0cRtnhKoVRvAp-S85Kri5hYLOE5tvzZ24QTFF5ltop3S5be41kyMWmqf8X3b_WZ2VXw\/exec\";\r\n\r\n  const html5QrCode = new Html5Qrcode(\"reader\");\r\n  const resultDiv = document.getElementById(\"result-display\");\r\n  const restartBtn = document.getElementById(\"restartBtn\");\r\n  const qrConfig = { fps: 10, qrbox: { width: 250, height: 250 } };\r\n\r\n  \/\/ Track state so we don't try to double-initialize hardware\r\n  let isCameraEngineRunning = false;\r\n\r\n  function initCameraSequence() {\r\n    if (isCameraEngineRunning) return; \/\/ Prevent re-asking if already live\r\n\r\n    resultDiv.style.display = \"none\";\r\n    restartBtn.style.display = \"none\";\r\n\r\n    html5QrCode.start(\r\n      { facingMode: \"environment\" }, \r\n      qrConfig, \r\n      onScanSuccess\r\n    ).then(() => {\r\n      isCameraEngineRunning = true;\r\n    }).catch(err => {\r\n      handleCameraError(err);\r\n    });\r\n  }\r\n\r\n  function onScanSuccess(decodedText) {\r\n    if (navigator.vibrate) navigator.vibrate(100);\r\n    \r\n    \/\/ FIXED: Instead of stopping the hardware, we pause tracking logic.\r\n    \/\/ This keeps the camera feed awake without breaking permissions.\r\n    if (html5QrCode.isScanning) {\r\n      html5QrCode.pause(true); \/\/ true = pauses the underlying video processing pipeline\r\n    }\r\n    \r\n    processCheckIn(decodedText);\r\n  }\r\n\r\n  function resumeCameraScanning() {\r\n    resultDiv.style.display = \"none\";\r\n    restartBtn.style.display = \"none\";\r\n    \r\n    \/\/ FIXED: Resume seamlessly without restarting the camera feed engine\r\n    try {\r\n      html5QrCode.resume();\r\n    } catch (e) {\r\n      \/\/ Emergency fallback if browser dropped the background canvas feed context\r\n      console.warn(\"Soft resume failed, clearing context structure...\", e);\r\n      isCameraEngineRunning = false;\r\n      initCameraSequence();\r\n    }\r\n  }\r\n\r\n  function handleCameraError(err) {\r\n    resultDiv.innerHTML = `<strong>Camera Error:<\/strong> Please ensure:<br>\r\n    1. Your URL starts with <strong>https:\/\/<\/strong><br>\r\n    2. You granted camera permissions to this browser site.`;\r\n    resultDiv.className = \"error\";\r\n    resultDiv.style.display = \"block\";\r\n    restartBtn.style.display = \"inline-block\";\r\n    restartBtn.innerText = \"Retry Camera Request\";\r\n    console.error(err);\r\n  }\r\n\r\n  function processCheckIn(scannedValue) {\r\n    resultDiv.innerHTML = \"Processing Ticket...\";\r\n    resultDiv.className = \"warning\";\r\n    resultDiv.style.display = \"block\";\r\n    restartBtn.innerText = \"Scan Next Guest\";\r\n\r\n    fetch(`${WEBAPP_URL}?action=checkin&value=${encodeURIComponent(scannedValue)}`)\r\n      .then(response => response.text())\r\n      .then(data => {\r\n        resultDiv.innerText = data;\r\n        if (data.includes(\"\u2705\")) {\r\n          resultDiv.className = \"success\";\r\n        } else if (data.includes(\"\u274c\") || data.includes(\"\u2753\")) {\r\n          resultDiv.className = \"error\";\r\n        } else {\r\n          resultDiv.className = \"warning\";\r\n        }\r\n        restartBtn.style.display = \"inline-block\";\r\n      })\r\n      .catch(error => {\r\n        resultDiv.innerText = \"Network\/System Error: \" + error;\r\n        resultDiv.className = \"error\";\r\n        restartBtn.style.display = \"inline-block\";\r\n      });\r\n  }\r\n\r\n  \/\/ Auto-boot sequence\r\n  window.addEventListener(\"load\", () => {\r\n    setTimeout(initCameraSequence, 800);\r\n  });\r\n<\/script>\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<\/div>","protected":false},"excerpt":{"rendered":"<p>Staff Check-In Scan Next Guest<\/p>","protected":false},"author":1,"featured_media":0,"parent":0,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"elementor_canvas","meta":{"_kad_post_transparent":"","_kad_post_title":"hide","_kad_post_layout":"fullwidth","_kad_post_sidebar_id":"","_kad_post_content_style":"unboxed","_kad_post_vertical_padding":"hide","_kad_post_feature":"hide","_kad_post_feature_position":"","_kad_post_header":false,"_kad_post_footer":false,"_kad_post_classname":"","footnotes":""},"class_list":["post-200","page","type-page","status-publish","hentry"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v28.9 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Scanner %<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/adane-bitaniya.yeneserg.com\/am\/scanner\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Scanner %\" \/>\n<meta property=\"og:description\" content=\"Staff Check-In Scan Next Guest\" \/>\n<meta property=\"og:url\" content=\"https:\/\/adane-bitaniya.yeneserg.com\/am\/scanner\/\" \/>\n<meta property=\"og:site_name\" content=\"Adane and Bitaniya Wedding Invitation\" \/>\n<meta property=\"article:modified_time\" content=\"2026-05-23T09:24:14+00:00\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data1\" content=\"2 \u12f0\u1242\u1243\u12ce\u127d\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/adane-bitaniya.yeneserg.com\\\/scanner\\\/\",\"url\":\"https:\\\/\\\/adane-bitaniya.yeneserg.com\\\/scanner\\\/\",\"name\":\"Scanner %\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/adane-bitaniya.yeneserg.com\\\/#website\"},\"datePublished\":\"2026-05-08T02:46:06+00:00\",\"dateModified\":\"2026-05-23T09:24:14+00:00\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/adane-bitaniya.yeneserg.com\\\/scanner\\\/#breadcrumb\"},\"inLanguage\":\"am\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/adane-bitaniya.yeneserg.com\\\/scanner\\\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/adane-bitaniya.yeneserg.com\\\/scanner\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/adane-bitaniya.yeneserg.com\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Scanner\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/adane-bitaniya.yeneserg.com\\\/#website\",\"url\":\"https:\\\/\\\/adane-bitaniya.yeneserg.com\\\/\",\"name\":\"Adane and Bitaniya Wedding Invitation\",\"description\":\"Digital\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/adane-bitaniya.yeneserg.com\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"am\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Scanner %","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/adane-bitaniya.yeneserg.com\/am\/scanner\/","og_locale":"en_US","og_type":"article","og_title":"Scanner %","og_description":"Staff Check-In Scan Next Guest","og_url":"https:\/\/adane-bitaniya.yeneserg.com\/am\/scanner\/","og_site_name":"Adane and Bitaniya Wedding Invitation","article_modified_time":"2026-05-23T09:24:14+00:00","twitter_card":"summary_large_image","twitter_misc":{"Est. reading time":"2 \u12f0\u1242\u1243\u12ce\u127d"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/adane-bitaniya.yeneserg.com\/scanner\/","url":"https:\/\/adane-bitaniya.yeneserg.com\/scanner\/","name":"Scanner %","isPartOf":{"@id":"https:\/\/adane-bitaniya.yeneserg.com\/#website"},"datePublished":"2026-05-08T02:46:06+00:00","dateModified":"2026-05-23T09:24:14+00:00","breadcrumb":{"@id":"https:\/\/adane-bitaniya.yeneserg.com\/scanner\/#breadcrumb"},"inLanguage":"am","potentialAction":[{"@type":"ReadAction","target":["https:\/\/adane-bitaniya.yeneserg.com\/scanner\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/adane-bitaniya.yeneserg.com\/scanner\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/adane-bitaniya.yeneserg.com\/"},{"@type":"ListItem","position":2,"name":"Scanner"}]},{"@type":"WebSite","@id":"https:\/\/adane-bitaniya.yeneserg.com\/#website","url":"https:\/\/adane-bitaniya.yeneserg.com\/","name":"Adane and Bitaniya Wedding Invitation","description":"Digital","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/adane-bitaniya.yeneserg.com\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"am"}]}},"_links":{"self":[{"href":"https:\/\/adane-bitaniya.yeneserg.com\/am\/wp-json\/wp\/v2\/pages\/200","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/adane-bitaniya.yeneserg.com\/am\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/adane-bitaniya.yeneserg.com\/am\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/adane-bitaniya.yeneserg.com\/am\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/adane-bitaniya.yeneserg.com\/am\/wp-json\/wp\/v2\/comments?post=200"}],"version-history":[{"count":28,"href":"https:\/\/adane-bitaniya.yeneserg.com\/am\/wp-json\/wp\/v2\/pages\/200\/revisions"}],"predecessor-version":[{"id":681,"href":"https:\/\/adane-bitaniya.yeneserg.com\/am\/wp-json\/wp\/v2\/pages\/200\/revisions\/681"}],"wp:attachment":[{"href":"https:\/\/adane-bitaniya.yeneserg.com\/am\/wp-json\/wp\/v2\/media?parent=200"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}