I. agrega.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>Agregar</title>
10
11
 <script type="module" src="js/lib/manejaErrores.js"></script>
12
</head>
13
14
<body>
15
16
 <form id="formulario">
17
18
  <h1>Agregar</h1>
19
20
  <p><a href="index.html">Cancelar</a></p>
21
22
  <input type="hidden" name="id">
23
24
  <p>
25
   <label>
26
    Producto
27
    <output name="producto">
28
     <progress max="100">Cargando…</progress>
29
    </output>
30
   </label>
31
  </p>
32
33
  <p>
34
   <label>
35
    Precio
36
    <output name="precio">
37
     <progress max="100">Cargando…</progress>
38
    </output>
39
   </label>
40
  </p>
41
42
  <p>
43
   <label>
44
    Cantidad *
45
    <input name="cantidad" type="number" min="0" step="0.01">
46
   </label>
47
  </p>
48
49
  <p>* Obligatorio</p>
50
51
  <p><button type="submit">Agregar</button></p>
52
53
 </form>
54
55
 <script type="module">
56
57
  import { descargaVista } from "./js/lib/descargaVista.js"
58
  import { submitAccion } from "./js/lib/submitAccion.js"
59
60
  const params = new URL(location.href).searchParams
61
  descargaDatos()
62
63
  async function descargaDatos() {
64
65
   if (params.size > 0) {
66
67
    await descargaVista("php/vista-agrega.php?" + params)
68
69
    formulario.addEventListener(
70
     "submit",
71
     event => submitAccion(
72
      event, "php/det-venta-agrega.php", formulario, "index.html"
73
     )
74
    )
75
76
   }
77
78
  }
79
80
 </script>
81
82
</body>
83
84
</html>
skip_previous skip_next