-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.html
More file actions
281 lines (233 loc) · 11.8 KB
/
index.html
File metadata and controls
281 lines (233 loc) · 11.8 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
<!DOCTYPE html>
<html lang="es">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>SUSHIMEX | Premium Sushi Fusion</title>
<link href="https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@300;400;700&family=Syncopate:wght@700&display=swap" rel="stylesheet">
<style>
:root { --primary: #ff003c; --bg: #000; --card: #111; --text: #fff; }
* { box-sizing: border-box; transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1); }
body {
background: var(--bg); color: var(--text);
font-family: 'Plus Jakarta Sans', sans-serif; margin: 0; padding-bottom: 80px;
}
header { text-align: center; padding: 60px 20px; }
.logo { width: 140px; filter: drop-shadow(0 0 15px rgba(255,0,60,0.4)); cursor: pointer; }
.logo:hover { transform: scale(1.1) rotate(5deg); }
h1 { font-family: 'Syncopate', sans-serif; font-size: 1rem; letter-spacing: 8px; color: var(--primary); margin-top: 20px; }
.container { max-width: 1100px; margin: auto; padding: 20px; }
/* Grid de Productos */
.menu-grid {
display: grid;
grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
gap: 30px;
}
.product-card {
background: var(--card); border-radius: 30px; overflow: hidden;
border: 1px solid #222; position: relative;
}
.product-card:hover {
transform: translateY(-10px); border-color: var(--primary);
box-shadow: 0 15px 35px rgba(255,0,60,0.25);
}
.product-img {
width: 100%; height: 220px; object-fit: cover;
filter: brightness(0.8);
}
.product-card:hover .product-img { filter: brightness(1); scale: 1.05; }
.product-info { padding: 25px; }
.product-info h3 { margin: 0 0 8px 0; font-size: 1.5rem; font-weight: 700; }
.product-info p { color: #666; font-size: 0.9rem; margin-bottom: 20px; line-height: 1.4; }
.price-tag { font-size: 1.6rem; font-weight: 800; color: var(--primary); }
.btn-add {
background: var(--primary); color: #fff; border: none;
padding: 12px 25px; border-radius: 15px; font-weight: 700;
cursor: pointer; float: right; box-shadow: 0 4px 15px rgba(255,0,60,0.3);
}
.btn-add:active { transform: scale(0.9); }
/* Carrito y Formulario */
#checkout {
margin-top: 80px; background: linear-gradient(145deg, #0a0a0a, #111);
padding: 40px; border-radius: 40px; border: 1px solid #222;
}
.cart-item {
display: flex; justify-content: space-between; align-items: center;
padding: 20px 0; border-bottom: 1px solid #222;
}
.qty-control { display: flex; align-items: center; gap: 15px; }
.qty-btn { background: #333; color: #fff; border: none; width: 30px; height: 30px; border-radius: 50%; cursor: pointer; }
input, select {
width: 100%; padding: 18px; margin: 12px 0;
background: #1a1a1a; border: 1px solid #333;
border-radius: 16px; color: #fff; font-size: 1rem;
}
input:focus { border-color: var(--primary); outline: none; }
.btn-confirm {
width: 100%; padding: 22px; background: var(--primary);
color: #fff; border: none; border-radius: 20px;
font-size: 1.2rem; font-weight: 800; cursor: pointer;
margin-top: 30px; letter-spacing: 2px;
}
.address-box {
background: rgba(255,0,60,0.1); border-left: 5px solid var(--primary);
padding: 20px; border-radius: 15px; margin: 15px 0; font-size: 0.95rem;
}
.hidden { display: none; }
/* Notificación */
#notif {
position: fixed; top: 20px; right: 20px; background: #00ff88; color: #000;
padding: 15px 30px; border-radius: 50px; font-weight: 800; display: none; z-index: 99;
}
</style>
</head>
<body>
<div id="notif">🍣 ¡AGREGADO!</div>
<audio id="cashSound" src="https://www.myinstants.com/media/sounds/cha-ching.mp3"></audio>
<header>
<img src="logo.png" alt="SUSHIMEX" class="logo">
<h1>SUSHIMEX</h1>
</header>
<div class="container">
<div class="menu-grid" id="menu-container"></div>
<section id="checkout">
<h2 style="text-align: center; letter-spacing: 3px;">TU ORDEN</h2>
<div id="cart-content">
<p style="text-align: center; color: #444;">El carrito está vacío</p>
</div>
<div style="display: flex; justify-content: space-between; margin: 40px 0; font-size: 2rem; font-weight: 900;">
<span>TOTAL:</span>
<span id="total-price" style="color: var(--primary);">$0</span>
</div>
<div id="form-user">
<input type="text" id="nombre" placeholder="¿A qué nombre sale la orden?">
<input type="tel" id="telefono" placeholder="Tu WhatsApp (10 dígitos)">
<select id="metodo" onchange="toggleDireccion()">
<option value="Pickup">Pasar a recoger</option>
<option value="Envio">Envío a domicilio</option>
</select>
<div id="info-pickup" class="address-box">
📍 <strong>Recoger en:</strong> Aldana 11, Torre 17, dep 505.
</div>
<div id="info-envio" class="hidden">
<input type="text" id="direccion" placeholder="Calle, número, colonia y referencias">
</div>
<button class="btn-confirm" onclick="enviarPedido()" id="btn-main">CONFIRMAR PEDIDO 🍣</button>
</div>
</section>
</div>
<script>
const API_URL = "https://script.google.com/macros/s/AKfycbzlHjBfBDuhnzRC-WsXdFzKO4w6ae8tlWJzK-nP3S-2D_cZexDCJZiTmt4jtbjAQpHn4Q/exec";
// PRODUCTOS CON SUS IMÁGENES Y NOMBRES SOLICITADOS
const PRODUCTOS = [
{ id: 1, nombre: "California Mex", precio: 145, img: "https://images.unsplash.com/photo-1579871494447-9811cf80d66c?auto=format&fit=crop&w=600&q=80" },
{ id: 2, nombre: "Tampico", precio: 155, img: "https://images.unsplash.com/photo-1583623025817-d180a2221d0a?auto=format&fit=crop&w=600&q=80" },
{ id: 3, nombre: "Mango Roll", precio: 165, img: "https://images.unsplash.com/photo-1617196034183-421b4917c92d?auto=format&fit=crop&w=600&q=80" },
{ id: 4, nombre: "Mex Roll", precio: 175, img: "https://images.unsplash.com/photo-1553621042-f6e147245754?auto=format&fit=crop&w=600&q=80" },
{ id: 5, nombre: "Roll Mex", precio: 185, img: "https://images.unsplash.com/photo-1611143669185-af224c5e3252?auto=format&fit=crop&w=600&q=80" }
];
let carrito = {};
function cargarMenu() {
const container = document.getElementById('menu-container');
container.innerHTML = PRODUCTOS.map(p => `
<div class="product-card">
<img src="${p.img}" class="product-img" alt="${p.nombre}">
<div class="product-info">
<h3>${p.nombre}</h3>
<p>Descripción por definir.</p>
<div style="display:flex; justify-content:space-between; align-items:center;">
<span class="price-tag">$${p.precio}</span>
<button class="btn-add" onclick="agregar(${p.id})">Añadir</button>
</div>
</div>
</div>
`).join('');
}
function agregar(id) {
// Sonido de caja registradora
const sound = document.getElementById('cashSound');
sound.currentTime = 0;
sound.play();
// Notificación visual
const notif = document.getElementById('notif');
notif.style.display = 'block';
setTimeout(() => notif.style.display = 'none', 1500);
// Lógica de carrito
if(carrito[id]) carrito[id].cant++;
else carrito[id] = { ...PRODUCTOS.find(p => p.id === id), cant: 1 };
actualizarCarrito();
}
function cambiarCant(id, delta) {
carrito[id].cant += delta;
if(carrito[id].cant <= 0) delete carrito[id];
actualizarCarrito();
}
function actualizarCarrito() {
const content = document.getElementById('cart-content');
const ids = Object.keys(carrito);
let total = 0;
if(ids.length === 0) {
content.innerHTML = '<p style="text-align: center; color: #444;">El carrito está vacío</p>';
document.getElementById('total-price').innerText = "$0";
return;
}
content.innerHTML = ids.map(id => {
const item = carrito[id];
total += item.precio * item.cant;
return `
<div class="cart-item">
<div>
<strong>${item.nombre}</strong><br>
<span style="color:#666;">$${item.precio} c/u</span>
</div>
<div class="qty-control">
<button class="qty-btn" onclick="cambiarCant(${id}, -1)">-</button>
<span>${item.cant}</span>
<button class="qty-btn" onclick="cambiarCant(${id}, 1)">+</button>
</div>
</div>
`;
}).join('');
document.getElementById('total-price').innerText = `$${total}`;
}
function toggleDireccion() {
const val = document.getElementById('metodo').value;
document.getElementById('info-pickup').classList.toggle('hidden', val === 'Envio');
document.getElementById('info-envio').classList.toggle('hidden', val === 'Pickup');
}
async function enviarPedido() {
const btn = document.getElementById('btn-main');
const nombre = document.getElementById('nombre').value;
const tel = document.getElementById('telefono').value;
const metodo = document.getElementById('metodo').value;
const dir = document.getElementById('direccion').value;
if(!nombre || !tel || Object.keys(carrito).length === 0) return alert("⚠️ Por favor completa tus datos y añade productos.");
const pedidoTxt = Object.values(carrito).map(i => `${i.cant}x ${i.nombre}`).join(", ");
const data = {
nombre: nombre,
telefono: tel,
tipo: metodo,
direccion: metodo === 'Envio' ? dir : "PASARÁ A RECOGER (Aldana 11)",
items: pedidoTxt,
total: document.getElementById('total-price').innerText
};
btn.disabled = true;
btn.innerText = "ENVIANDO A COCINA...";
try {
await fetch(API_URL, { method: 'POST', mode: 'no-cors', body: JSON.stringify(data) });
alert("🍣 ¡PEDIDO CONFIRMADO! Ya lo estamos preparando.");
carrito = {};
actualizarCarrito();
document.getElementById('nombre').value = "";
document.getElementById('telefono').value = "";
} catch (e) {
alert("Error al enviar el pedido. Inténtalo de nuevo.");
} finally {
btn.disabled = false;
btn.innerText = "CONFIRMAR PEDIDO 🍣";
}
}
cargarMenu();
</script>
</body>
</html>