H. 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="lib/js/consumeJson.js"></script>
12 <script type="module" src="lib/js/submitForm.js"></script>
13 <script type="module" src="lib/js/muestraObjeto.js"></script>
14 <script type="module" src="lib/js/muestraError.js"></script>
15
16 <script>
17 // Obtiene los parámetros de la página.
18 const params = new URL(location.href).searchParams
19 </script>
20
21</head>
22
23<body onload="if (params.size > 0) {
24 consumeJson('srv/producto.php?' + params)
25 .then(producto => muestraObjeto(document, producto.body))
26 .catch(muestraError)
27 }">
28
29 <form onsubmit="submitForm('srv/det-venta-agrega.php', event)
30 .then(modelo => location.href = 'index.html')
31 .catch(muestraError)">
32
33 <h1>Agregar</h1>
34
35 <p><a href="index.html">Cancelar</a></p>
36
37 <input type="hidden" name="id">
38
39 <p>
40 <label>
41 Producto
42 <output name="producto">
43 <progress max="100">Cargando…</progress>
44 </output>
45 </label>
46 </p>
47
48 <p>
49 <label>
50 Precio
51 <output name="precio">
52 <progress max="100">Cargando…</progress>
53 </output>
54 </label>
55 </p>
56
57 <p>
58 <label>
59 Cantidad *
60 <input name="cantidad" type="number" min="0" step="0.01">
61 </label>
62 </p>
63
64 <p>* Obligatorio</p>
65
66 <p><button type="submit">Agregar</button></p>
67
68 </form>
69
70</body>
71
72</html>
skip_previous skip_next