| 1 | <!DOCTYPE html> |
| 2 | <html lang="es"> |
| 3 | |
| 4 | <head> |
| 5 | |
| 6 | <meta charset="UTF-8"> |
| 7 | <meta name="viewport" content="width=device-width"> |
| 8 | |
| 9 | <title>Carrito</title> |
| 10 | |
| 11 | <script src="dompurify/purify.min.js"></script> |
| 12 | <script type="module" src="libclienteweb/manejaErrores.js"></script> |
| 13 | |
| 14 | </head> |
| 15 | |
| 16 | <body> |
| 17 | |
| 18 | <h1>Carrito</h1> |
| 19 | |
| 20 | <p> |
| 21 | |
| 22 | <a href="index.html">Productos</a> |
| 23 | |
| 24 | <button id="botonProcesar" type='button'> |
| 25 | Procesar compra |
| 26 | </button> |
| 27 | |
| 28 | </p> |
| 29 | |
| 30 | <p> |
| 31 | <label> |
| 32 | Folio |
| 33 | <output id="folio"> |
| 34 | <progress max="100">Cargando…</progress> |
| 35 | </output> |
| 36 | </label> |
| 37 | </p> |
| 38 | |
| 39 | <fieldset> |
| 40 | |
| 41 | <legend>Detalle</legend> |
| 42 | |
| 43 | <dl id="detalles"> |
| 44 | <dt>Cargando…</dt> |
| 45 | <dd><progress max="100">Cargando…</progress></dd> |
| 46 | </dl> |
| 47 | |
| 48 | </fieldset> |
| 49 | |
| 50 | <script type="module"> |
| 51 | |
| 52 | import { descargaVista } from "./libclienteweb/descargaVista.js" |
| 53 | import { consume } from "./libclienteweb/consume.js" |
| 54 | import { recibeJson } from "./libclienteweb/recibeJson.js" |
| 55 | |
| 56 | descargaDatos() |
| 57 | |
| 58 | async function descargaDatos() { |
| 59 | await descargaVista("api/vista-carrito.php") |
| 60 | botonProcesar.addEventListener("click", procesa) |
| 61 | } |
| 62 | |
| 63 | async function procesa() { |
| 64 | if (confirm('Confirma procesar')) { |
| 65 | await consume(recibeJson('api/venta-en-captura-procesa.php')) |
| 66 | location.href = 'index.html' |
| 67 | } |
| 68 | } |
| 69 | |
| 70 | </script> |
| 71 | |
| 72 | </body> |
| 73 | |
| 74 | </html> |