Update script.js
Browse files
script.js
CHANGED
|
@@ -157,13 +157,13 @@ function gestionarMesa(index) {
|
|
| 157 |
|
| 158 |
const atrasButton = document.createElement('button');
|
| 159 |
atrasButton.textContent = '← Atrás';
|
| 160 |
-
atrasButton.className = 'btn btn-outline-
|
| 161 |
atrasButton.onclick = () => render();
|
| 162 |
app.appendChild(atrasButton);
|
| 163 |
|
| 164 |
const finalizarButton = document.createElement('button');
|
| 165 |
finalizarButton.textContent = 'Finalizar';
|
| 166 |
-
finalizarButton.className = 'btn btn-
|
| 167 |
finalizarButton.onclick = () => {
|
| 168 |
const total = mesa.pedidos.reduce((sum, p) => sum + p.precio * p.cantidad, 0);
|
| 169 |
if (total > 0) {
|
|
@@ -178,7 +178,7 @@ function gestionarMesa(index) {
|
|
| 178 |
// Generación del QR y ticket
|
| 179 |
function generarTicket(index, total) {
|
| 180 |
const mesa = mesas[index];
|
| 181 |
-
|
| 182 |
mesa.pedidos.forEach(pedido => {
|
| 183 |
qrContent += `${pedido.item} (${pedido.opcion || ''}) x${pedido.cantidad} - €${(pedido.precio * pedido.cantidad).toFixed(2)}\n`;
|
| 184 |
});
|
|
@@ -186,7 +186,7 @@ function generarTicket(index, total) {
|
|
| 186 |
const qrContainer = document.createElement('div');
|
| 187 |
qrContainer.className = 'text-center';
|
| 188 |
app.appendChild(qrContainer);
|
| 189 |
-
|
| 190 |
new QRCode(qrContainer, {
|
| 191 |
text: qrContent,
|
| 192 |
width: 256,
|
|
@@ -207,3 +207,4 @@ function generarTicket(index, total) {
|
|
| 207 |
render();
|
| 208 |
|
| 209 |
|
|
|
|
|
|
| 157 |
|
| 158 |
const atrasButton = document.createElement('button');
|
| 159 |
atrasButton.textContent = '← Atrás';
|
| 160 |
+
atrasButton.className = 'btn btn-outline-primary btn-block';
|
| 161 |
atrasButton.onclick = () => render();
|
| 162 |
app.appendChild(atrasButton);
|
| 163 |
|
| 164 |
const finalizarButton = document.createElement('button');
|
| 165 |
finalizarButton.textContent = 'Finalizar';
|
| 166 |
+
finalizarButton.className = 'btn btn-danger btn-block';
|
| 167 |
finalizarButton.onclick = () => {
|
| 168 |
const total = mesa.pedidos.reduce((sum, p) => sum + p.precio * p.cantidad, 0);
|
| 169 |
if (total > 0) {
|
|
|
|
| 178 |
// Generación del QR y ticket
|
| 179 |
function generarTicket(index, total) {
|
| 180 |
const mesa = mesas[index];
|
| 181 |
+
let qrContent = `Mesa ${mesa.numero} Total: €${total.toFixed(2)}\n`;
|
| 182 |
mesa.pedidos.forEach(pedido => {
|
| 183 |
qrContent += `${pedido.item} (${pedido.opcion || ''}) x${pedido.cantidad} - €${(pedido.precio * pedido.cantidad).toFixed(2)}\n`;
|
| 184 |
});
|
|
|
|
| 186 |
const qrContainer = document.createElement('div');
|
| 187 |
qrContainer.className = 'text-center';
|
| 188 |
app.appendChild(qrContainer);
|
| 189 |
+
|
| 190 |
new QRCode(qrContainer, {
|
| 191 |
text: qrContent,
|
| 192 |
width: 256,
|
|
|
|
| 207 |
render();
|
| 208 |
|
| 209 |
|
| 210 |
+
|