index.html 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386
  1. <!DOCTYPE html>
  2. <html lang="es">
  3. <head>
  4. <meta charset="UTF-8" />
  5. <title>Biergarten Klein</title>
  6. <meta name="viewport" content="width=device-width, initial-scale=1.0">
  7. <!-- Fuentes + Tailwind -->
  8. <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
  9. <link rel="stylesheet" as="style" onload="this.rel='stylesheet'"
  10. href="https://fonts.googleapis.com/css2?display=swap&family=Noto+Sans:wght@400;500;700;900&family=Spline+Sans:wght@400;500;700">
  11. <script src="https://cdn.tailwindcss.com?plugins=forms,container-queries"></script>
  12. <link rel="stylesheet" href="express/animations.css">
  13. <!--Tailwind-->
  14. <script>
  15. tailwind.config = {
  16. theme: {
  17. extend: {
  18. colors: {
  19. 'custom-dark': '#101419',
  20. 'custom-dark-hover': '#37404a',
  21. 'gray-50': '#f9fafb',
  22. 'gray-100': '#f3f4f6',
  23. }
  24. }
  25. }
  26. }
  27. </script>
  28. <!-- Markdown -->
  29. <script src="https://cdn.jsdelivr.net/npm/marked/marked.min.js"></script>
  30. <script src="express/js/app.js" type="module"></script>
  31. <link rel="stylesheet" href="express/styles.css">
  32. </head>
  33. <body class="h-[100dvh] max-h-[100dvh] flex flex-col bg-gray-50 overflow-x-hidden"
  34. style='font-family:"Spline Sans","Noto Sans",sans-serif;'>
  35. <!-- ---------- HEADER ---------- -->
  36. <header class="flex-col top-0 inset-x-0 z-10 bg-gray-50 p-2 flex justify-center items-center border-b border-gray-200">
  37. <h1 id="mainTitle" class="text-[26px] font-bold text-[#101419] tracking-tight">
  38. Biergarten Klein
  39. </h1>
  40. </header>
  41. <!-- ---------- MAIN ---------- -->
  42. <main class="relative flex-1 flex flex-col min-h-0 overflow-x-hidden">
  43. <!-- ===== MENÚ tab ===== -->
  44. <section id="menuTab" data-index="0" class=" min-h-0 overflow-y-auto h-full" data-tab>
  45. <div class="pt-4 pb-3 ">
  46. <h2 class="text-[19px] mx-4 font-bold text-[#101419]">
  47. Pide tu shop express 🍺
  48. </h2>
  49. <p class="product-type mx-4 text-[#58728d] text-sm pb-4 mb-4 border-b border-gray-200">*solo lo más vendido</p>
  50. </div>
  51. <div class="px-4 overflow-y-auto">
  52. <ul id="productList" class="space-y-6"></ul>
  53. </div>
  54. <template id="product-card-template">
  55. <li class="flex items-stretch justify-between gap-4 rounded-xl">
  56. <div class="flex flex-[2_2_0px] flex-col gap-4">
  57. <div class="flex flex-col gap-1">
  58. <p class="product-type text-[#58728d] text-sm"></p>
  59. <p class="product-name text-[#101419] text-base font-bold leading-tight"></p>
  60. <p class="product-description text-[#58728d] text-sm"></p>
  61. </div>
  62. <!-- Botón Añadir -->
  63. <div class="flex items-center gap-3">
  64. <button class="add-to-cart-btn flex items-center gap-1 w-fit h-8 px-3
  65. rounded-full bg-[#101419] hover:bg-[#37404a] text-white text-sm font-medium">
  66. <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="16" height="16" fill="currentColor">
  67. <path d="M12 5v14m7-7H5" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
  68. </svg>
  69. Añadir
  70. </button>
  71. <!-- Precio -->
  72. <span class="product-price text-sm font-semibold text-[#101419]"></span>
  73. </div>
  74. </div>
  75. <div class="product-image flex-1 aspect-video bg-cover bg-center rounded-xl"></div>
  76. </li>
  77. </template>
  78. </section>
  79. <!-- ===== CHAT ===== -->
  80. <section id="chatTab" data-index="2" data-tab class="flex hidden flex-col flex-1 min-h-0">
  81. <!-- Contenedor de mensajes que puede crecer y hacer scroll -->
  82. <div id="chatMessages" class="flex-1 overflow-y-auto px-5 md:px-8 py-4 flex flex-col gap-4">
  83. <!-- Sugerencias y Bajada -->
  84. <div class="text-center text-gray-600 px-5 text-sm leading-relaxed max-w-full">
  85. <h2 class="text-md text-gray-500 mt-5">Conversa con nuestro asistente IA: descubre nuestras cervezas 🍻 y sugiere mejoras para nuestra app ✨<span class="mx-0.5">🍻</span></h2>
  86. <!-- Ideas de mensajes -->
  87. <div id="chatSuggestions" class="grid grid-cols-1 gap-3 max-w-2xl mx-auto mt-5">
  88. <div class="bg-white border border-gray-200 rounded-xl p-4 cursor-pointer hover:border-gray-300 hover:shadow-sm transition-all duration-200 text-left flex items-center gap-4">
  89. <div class="text-lg mb-1">🍺</div>
  90. <div class="chat-suggestion text-gray-400 font-medium text-xs">¿Que me puedes contar de la burlesque?</div>
  91. </div>
  92. <div class="bg-white border border-gray-200 rounded-xl p-4 cursor-pointer hover:border-gray-300 hover:shadow-sm transition-all duration-200 text-left flex items-center gap-4">
  93. <div class="text-lg mb-1">⁉️</div>
  94. <div class="chat-suggestion text-gray-400 font-medium text-xs">Mi sugerencia para la aplicacion es...</div>
  95. </div>
  96. <div class="bg-white border border-gray-200 rounded-xl p-4 cursor-pointer hover:border-gray-300 hover:shadow-sm transition-all duration-200 text-left flex items-center gap-4">
  97. <div class="text-lg mb-1">🍕</div>
  98. <div class="chat-suggestion text-gray-400 font-medium text-xs">¿Qué pizza queda bien con la hoppy mosh?</div>
  99. </div>
  100. <div class="bg-white border border-gray-200 rounded-xl p-4 cursor-pointer hover:border-gray-300 hover:shadow-sm transition-all duration-200 text-left flex items-center gap-4">
  101. <div class="text-lg mb-1">📱</div>
  102. <div class="chat-suggestion text-gray-400 font-medium text-xs">La orden no se envio bien</div>
  103. </div>
  104. </div>
  105. </div>
  106. </div>
  107. <!-- Indicador de carga - FIJO arriba del input -->
  108. <div id="aiLoadingIndicator" class="hidden flex px-5 py-3 text-left text-sm text-gray-500 italic flex-shrink-0">
  109. Pensando
  110. </div>
  111. <!-- Input del chat - FIJO en la parte inferior -->
  112. <div class="px-4 py-4 md:px-5 md:py-5 bg-white border-t border-gray-200 flex-shrink-0">
  113. <form id="chatForm" class="flex items-center bg-gray-50 border border-gray-300 rounded-3xl px-5 py-1 transition-colors focus-within:border-gray-400">
  114. <input
  115. id="chatInput"
  116. class="flex-1 sticky flex-shrink-0 bg-transparent border-none outline-none text-gray-900 text-sm py-3 placeholder-gray-500"
  117. autocomplete="off"
  118. placeholder="Pregunta lo que quieras"
  119. maxlength="2000"
  120. >
  121. <button id="sendChatButton" type="submit" class="bg-custom-dark hover:bg-custom-dark-hover text-white border-none rounded-2xl px-4 py-2.5 text-sm transition-colors ml-2 disabled:bg-gray-400 disabled:cursor-not-allowed">
  122. Enviar
  123. </button>
  124. </form>
  125. </div>
  126. </section>
  127. <!-- ===== CARRITO ===== -->
  128. <section id="cartTab" data-tab data-index="1" class="flex flex-col hidden flex-1 min-h-0">
  129. <header class="p-4 border-b border-gray-200">
  130. <h3 class="text-lg font-bold text-[#101419]">Tu pedido</h3>
  131. </header>
  132. <div id="cartItems" class="flex-1 overflow-y-auto p-4 space-y-2"></div>
  133. <p id="emptyCartText" class="hidden text-center text-gray-400 mt-4">Tu carrito está vacío.</p>
  134. <footer class="p-4 border-t border-gray-200 space-y-3">
  135. <div class="flex justify-between text-base">
  136. <span>Total:</span>
  137. <span id="cartTotal">$0</span>
  138. </div>
  139. <button id="checkoutButton"
  140. class="w-full bg-[#101419] hover:bg-[#37404a] disabled:opacity-50 text-white py-2 rounded-md"
  141. disabled>
  142. Envia tu orden
  143. </button>
  144. </footer>
  145. <div class="max-w-4xl mx-auto bg-white rounded-xl shadow-sm border border-gray-200 overflow-hidden">
  146. <!-- Header con nombre de usuario -->
  147. <div class="bg-gray-50 px-6 py-4 border-b border-gray-200">
  148. <h2 id="usernameTable" class="text-[19px] font-bold text-[#101419]">Pedido de Juan Pérez</h2>
  149. </div>
  150. <div class="overflow-x-auto">
  151. <table id="historyTable" class="w-full">
  152. <thead class="bg-gray-50 border-b border-gray-200">
  153. <tr>
  154. <th class="px-6 py-3 text-left text-sm font-bold text-[#101419]">Cantidad</th>
  155. <th class="px-6 py-3 text-left text-sm font-bold text-[#101419]">Producto</th>
  156. <th class="px-6 py-3 text-right text-sm font-bold text-[#101419]">Precio</th>
  157. </tr>
  158. </thead>
  159. <tbody class="divide-y divide-gray-200">
  160. <template id="historyRowTemplate">
  161. <tr class="hover:bg-gray-50 transition-colors">
  162. <td class="list-element-quantity px-6 py-4 text-sm text-[#58728d]">1</td>
  163. <td class="px-6 py-4">
  164. <div class="flex flex-col">
  165. <span class="list-element-name text-sm font-medium text-[#101419]">Klein Lager</span>
  166. <span class="list-element-desc text-xs text-[#58728d]">Cerveza rubia refrescante</span>
  167. </div>
  168. </td>
  169. <td class="list-element-price px-6 py-4 text-sm font-semibold text-[#101419] text-right">$6.000</td>
  170. </tr>
  171. </template>
  172. </tbody>
  173. <!-- Total -->
  174. <tfoot class="bg-gray-50 border-t border-gray-200">
  175. <tr>
  176. <td colspan="2" class="px-6 py-4 text-base font-bold text-[#101419] text-right">
  177. Total General:
  178. </td>
  179. <td id="cartHistoryTotal" class="px-6 py-4 text-lg font-bold text-[#101419] text-right">
  180. $0
  181. </td>
  182. </tr>
  183. </tfoot>
  184. </table>
  185. </div>
  186. </div>
  187. </section>
  188. </main>
  189. <!-- ---------- NAVBAR ---------- -->
  190. <footer class="inset-x-0 z-10 border-t border-gray-200 bg-gray-50 px-4 py-2">
  191. <nav class="flex gap-2">
  192. <button data-target="menuTab" data-title="Biergarten Klein" class="active tab-btn flex-1 flex flex-col items-center text-[#58728d]">
  193. <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="h-8"><path stroke="none" d="M0 0h24v24H0z" fill="none"/><path d="M5 12l-2 0l9 -9l9 9l-2 0" /><path d="M5 12v7a2 2 0 0 0 2 2h10a2 2 0 0 0 2 -2v-7" /><path d="M9 21v-6a2 2 0 0 1 2 -2h2a2 2 0 0 1 2 2v6" /></svg><span class="text-xs font-medium">Inicio</span>
  194. </button>
  195. <button data-target="cartTab" data-title="Carrito Klein" class="tab-btn flex-1 flex flex-col items-center text-[#58728d]">
  196. <div id="cartIcon">
  197. <span id="cartCount">0</span>
  198. <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="currentColor"
  199. viewBox="0 0 256 256" class="h-8">
  200. <path
  201. d="M222.14,58.87A8,8,0,0,0,216,56H54.68L49.79,29.14A16,16,0,0,0,34.05,16H16a8,8,0,0,0,0,16h18L59.56,172.29a24,24,0,0,0,5.33,11.27,28,28,0,1,0,44.4,8.44h45.42A27.75,27.75,0,0,0,152,204a28,28,0,1,0,28-28H83.17a8,8,0,0,1-7.87-6.57L72.13,152h116a24,24,0,0,0,23.61-19.71l12.16-66.86A8,8,0,0,0,222.14,58.87ZM96,204a12,12,0,1,1-12-12A12,12,0,0,1,96,204Zm96,0a12,12,0,1,1-12-12A12,12,0,0,1,192,204Zm4-74.57A8,8,0,0,1,188.1,136H69.22L57.59,72H206.41Z" />
  202. </svg>
  203. </div>
  204. <span class="text-xs font-medium">Carrito</span>
  205. </button>
  206. <button data-target="chatTab" data-title="KleinBot" class="tab-btn flex-1 flex flex-col items-center text-[#58728d]">
  207. <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="h-8"><path stroke="none" d="M0 0h24v24H0z" fill="none"/><path d="M8 9h8" /><path d="M8 13h6" /><path d="M18 4a3 3 0 0 1 3 3v8a3 3 0 0 1 -3 3h-5l-5 3v-3h-2a3 3 0 0 1 -3 -3v-8a3 3 0 0 1 3 -3h12z" /></svg>
  208. <span class="text-xs font-medium">Chat IA</span>
  209. </button>
  210. </nav>
  211. </footer>
  212. <!-- ---------- TOAST ---------- -->
  213. <div id="toastCart"
  214. class="fixed top-4 left-1/2 -translate-x-1/2 bg-[#101419] text-white text-sm
  215. rounded-md px-4 py-2 shadow-lg opacity-0 pointer-events-none z-50
  216. origin-left">
  217. </div>
  218. <!-- === MODAL INICIO DE SESIÓN === -->
  219. <div id="sessionModal"
  220. class="fixed hidden inset-0 bg-black/70 flex items-center justify-center z-50 p-4">
  221. <form id="loginForm" class="bg-white w-full max-w-md p-8 rounded-xl shadow-xl space-y-6">
  222. <div class="text-center">
  223. <h2 class="text-2xl font-bold text-gray-900">¡Bienvenido!</h2>
  224. <p id="loginMessage" class="text-sm text-gray-600 mt-2">
  225. Ingresa tus datos para comenzar tu pedido
  226. </p>
  227. </div>
  228. <div class="space-y-4">
  229. <div>
  230. <label for="emailInput" class="block text-sm font-medium text-gray-700 mb-2">
  231. Correo electrónico
  232. </label>
  233. <input id="emailInput"
  234. name="email"
  235. type="email"
  236. class="w-full border border-gray-300 px-4 py-3 rounded-lg focus:ring-2 focus:ring-[#101419] focus:border-transparent outline-none transition-all"
  237. placeholder="tu@email.com"
  238. required />
  239. </div>
  240. <div>
  241. <label for="pinInput" class="block text-sm font-medium text-gray-700 mb-2">
  242. PIN de 4 dígitos
  243. </label>
  244. <input id="pinInput"
  245. name="pin"
  246. type="password"
  247. maxlength="4"
  248. pattern="[0-9]{4}"
  249. class="w-full border border-gray-300 px-4 py-3 rounded-lg focus:ring-2 focus:ring-[#101419] focus:border-transparent outline-none transition-all"
  250. placeholder="••••"
  251. required />
  252. </div>
  253. <div>
  254. <label for="tableInput" class="block text-sm font-medium text-gray-700 mb-2">
  255. Número de mesa
  256. </label>
  257. <input id="tableInput"
  258. name="table"
  259. type="number"
  260. min="1"
  261. max="99"
  262. class="w-full border border-gray-300 px-4 py-3 rounded-lg focus:ring-2 focus:ring-[#101419] focus:border-transparent outline-none transition-all"
  263. placeholder="Ej: 5"
  264. required />
  265. </div>
  266. </div>
  267. <span id="ErrorLogin" class="hidden text-red-500 text-sm">Todo cago, perdon</span>
  268. <button id="sessionAcceptBtn"
  269. type="submit"
  270. class="w-full bg-[#101419] hover:bg-[#37404a] text-white py-3 rounded-lg font-medium transition-colors duration-200 focus:ring-2 focus:ring-offset-2 focus:ring-[#101419]">
  271. Comenzar pedido
  272. </button>
  273. </form>
  274. </div>
  275. <!-- ---------- JS: conmutar tabs + toast ---------- -->
  276. <script>
  277. const animation_time = 200
  278. let transitioning = false;
  279. // conmutar pestañas
  280. const buttons = document.querySelectorAll('.tab-btn')
  281. buttons.forEach(btn => {
  282. btn.addEventListener('click', () => {
  283. const target = btn.dataset.target;
  284. const active = document.querySelector(':not(.hidden)[data-tab]');
  285. const activeIndex = active.dataset.index;
  286. const to = document.querySelector(`#${target}[data-tab]`);
  287. const toIndex = to.dataset.index;
  288. const height = to.offsetHeight;
  289. if (activeIndex === toIndex || transitioning) return;
  290. buttons.forEach(button => {
  291. button.classList.remove('active')
  292. })
  293. btn.classList.add('active')
  294. active.style.height = "100%";
  295. active.style.width = "100vw"
  296. to.style.height = "100%";
  297. to.style.width = "100vw"
  298. to.style.zIndex = "1";
  299. active.style.zIndex = "0";
  300. transitioning = true;
  301. const otherTabs = document.querySelectorAll('[data-tab]');
  302. otherTabs.forEach(tab => {
  303. if (tab !== active && tab !== to) {
  304. tab.classList.add('hidden');
  305. tab.classList.remove(`animate-[slideLeft_${animation_time}ms_ease-out]`, `animate-[slideRight_${animation_time}ms_ease-out]`);
  306. tab.classList.remove(`animate-[slideLeftIn_${animation_time}ms_ease-out]`, `animate-[slideRightIn_${animation_time}ms_ease-out]`);
  307. }
  308. });
  309. to.classList.remove('hidden');
  310. // Animate tab transition
  311. if (activeIndex < toIndex) {
  312. // Slide left
  313. active.classList.add(`animate-[slideLeft_${animation_time}ms_ease-out]`);
  314. to.classList.add(`animate-[slideRightIn_${animation_time}ms_ease-out]`);
  315. } else if (activeIndex > toIndex) {
  316. // Slide right
  317. active.classList.add(`animate-[slideRight_${animation_time}ms_ease-out]`);
  318. to.classList.add(`animate-[slideLeftIn_${animation_time}ms_ease-out]`);
  319. }
  320. setTimeout(() => {
  321. active.classList.remove(`animate-[slideLeft_${animation_time}ms_ease-out]`, `animate-[slideRight_${animation_time}ms_ease-out]`);
  322. active.classList.add('hidden');
  323. to.classList.remove(`animate-[slideLeftIn_${animation_time}ms_ease-out]`, `animate-[slideRightIn_${animation_time}ms_ease-out]`);
  324. transitioning = false;
  325. }, animation_time);
  326. // Update header title if needed
  327. const title = btn.dataset.title;
  328. if (title) {
  329. document.getElementById('mainTitle').textContent = title;
  330. }
  331. });
  332. });
  333. // toast simple
  334. window.showToast = (msg) => {
  335. const toast = document.getElementById('toastCart');
  336. toast.textContent = msg;
  337. toast.style.animation = 'none'; // reset
  338. void toast.offsetWidth; // reflow
  339. toast.style.opacity = '1';
  340. toast.style.animation = 'popup 1s ease-out';
  341. toast.addEventListener('animationend', () => {
  342. toast.style.animation = 'none';
  343. toast.style.opacity = '0';
  344. });
  345. };
  346. </script>
  347. </body>
  348. </html>