Update script.js
Browse files182 unmodified lines18318418518618718818921 unmodified lines2112122132142152162175 unmodified lines223224225226227228229230231182 unmodified lines// Generación del PDF con jsPDFfunction generarTicket(index, total) {const mesa = mesas[index];// Crear un nuevo documento PDFconst doc = new jsPDF();21 unmodified linesqrContainer.className = 'text-center';app.appendChild(qrContainer);const qrContent = `Mesa ${mesa.numero}\n${mesa.pedidos.map(p => `${p.item} (${p.opcion || ''}) x${p.cantidad} - €${(p.precio * p.cantidad).toFixed(2)}`).join('\n')}\nTotal: €${total.toFixed(2)}`;const qrUrl = `https://api.qrserver.com/v1/create-qr-code/?data=${encodeURIComponent(qrContent)}&size=256x256`;const qrImage = document.createElement('img');5 unmodified linesconst volverButton = document.createElement('button');volverButton.textContent = '← Volver';volverButton.className = 'btn btn-outline-danger btn-block';volverButton.onclick = () => render();app.appendChild(volverButton);}// Inicializar la aplicaciónrender();182 unmodified lines18318418518618718818919019121 unmodified lines2132142152162172182192205 unmodified lines226227228229230231232233234182 unmodified lines// Generación del PDF con jsPDFfunction generarTicket(index, total) {// Almacenar el index de la mesaconst mesaIndex = index;const mesa = mesas[mesaIndex];// Crear un nuevo documento PDFconst doc = new jsPDF();21 unmodified linesqrContainer.className = 'text-center';app.appendChild(qrContainer);// Usar mesaIndex para acceder a la mesa correctaconst qrContent = `Mesa ${mesas[mesaIndex].numero}\n${mesas[mesaIndex].pedidos.map(p => `${p.item} (${p.opcion || ''}) x${p.cantidad} - €${(p.precio * p.cantidad).toFixed(2)}`).join('\n')}\nTotal: €${total.toFixed(2)}`;const qrUrl = `https://api.qrserver.com/v1/create-qr-code/?data=${encodeURIComponent(qrContent)}&size=256x256`;const qrImage = document.createElement('img');5 unmodified linesconst volverButton = document.createElement('button');volverButton.textContent = '← Volver';volverButton.className = 'btn btn-outline-danger btn-block';volverButton.onclick = () => render(); // Volver a renderizar la UI principalapp.appendChild(volverButton);}// Inicializar la aplicaciónrender();
script.js+7-4