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>Modificar</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/muestraError.js"></script> |
14 | <script type="module" src="lib/js/muestraObjeto.js"></script> |
15 | |
16 | <script> |
17 | |
18 | const params = new URL(location.href).searchParams |
19 | </script> |
20 | |
21 | </head> |
22 | |
23 | <body onload="if (params.size > 0) { |
24 | consumeJson('srv/det-venta.php?' + params) |
25 | .then(modelo => muestraObjeto(document, modelo.body)) |
26 | .catch(muestraError) |
27 | }"> |
28 | |
29 | <form onsubmit="submitForm('srv/det-venta-modifica.php', event) |
30 | .then(modelo => location.href = 'carrito.html') |
31 | .catch(muestraError)"> |
32 | |
33 | <h1>Modificar</h1> |
34 | |
35 | <p><a href="carrito.html">Cancelar</a></p> |
36 | |
37 | <input type="hidden" name="prodId"> |
38 | |
39 | <p> |
40 | <label> |
41 | Producto |
42 | <output name="prodNombre"> |
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> |
67 | |
68 | <button type="submit">Guardar</button> |
69 | |
70 | <button type="button" onclick=" |
71 | if (params.size > 0 && confirm('Confirma la eliminación')) { |
72 | consumeJson('srv/det-venta-elimina.php?' + params) |
73 | .then(() => location.href = 'carrito.html') |
74 | .catch(muestraError) |
75 | }"> |
76 | Eliminar |
77 | </button> |
78 | |
79 | </p> |
80 | |
81 | </form> |
82 | |
83 | </body> |
84 | |
85 | </html> |