J. carrito.html

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 type="module" src="js/lib/manejaErrores.js"></script>
12
13
</head>
14
15
<body>
16
17
 <h1>Carrito</h1>
18
19
 <p>
20
21
  <a href="index.html">Productos</a>
22
23
  <button id="botonProcesar" type='button'>
24
   Procesar compra
25
  </button>
26
27
 </p>
28
29
 <p>
30
  <label>
31
   Folio
32
   <output id="folio">
33
    <progress max="100">Cargando…</progress>
34
   </output>
35
  </label>
36
 </p>
37
38
 <fieldset>
39
40
  <legend>Detalle</legend>
41
42
  <dl id="detalles">
43
   <dt>Cargando…</dt>
44
   <dd><progress max="100">Cargando…</progress></dd>
45
  </dl>
46
47
 </fieldset>
48
49
 <script type="module">
50
51
  import { descargaVista } from "./js/lib/descargaVista.js"
52
  import { consume } from "./js/lib/consume.js"
53
  import { recibeJson } from "./js/lib/recibeJson.js"
54
55
  const params = new URL(location.href).searchParams
56
  descargaDatos()
57
58
  async function descargaDatos() {
59
   await descargaVista("php/vista-carrito.php")
60
   botonProcesar.addEventListener("click", procesa)
61
  }
62
63
  async function procesa() {
64
   if (confirm('Confirma procesar')) {
65
    await consume(recibeJson('php/venta-en-captura-procesa.php'))
66
    location.href = 'index.html'
67
   }
68
  }
69
70
 </script>
71
72
</body>
73
74
</html>
skip_previous skip_next