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/invocaServicio.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 | <script type="module" src="lib/js/confirmaEliminar.js"></script> |
16 | |
17 | <script> |
18 | |
19 | const params = new URL(location.href).searchParams |
20 | </script> |
21 | |
22 | </head> |
23 | |
24 | <body onload="if (params.size > 0) { |
25 | invocaServicio('srv/srvDetalleDeVentaBusca.php?' + params) |
26 | .then(modelo => muestraObjeto(document, modelo.body)) |
27 | .catch(muestraError) |
28 | }"> |
29 | |
30 | <form onsubmit="submitForm('srv/srvDetalleDeVentaModifica.php', event) |
31 | .then(modelo => location.href = 'carrito.html') |
32 | .catch(muestraError)"> |
33 | |
34 | <h1>Modificar</h1> |
35 | |
36 | <p><a href="carrito.html">Cancelar</a></p> |
37 | |
38 | <input type="hidden" name="prodId"> |
39 | |
40 | <p> |
41 | <label> |
42 | Producto |
43 | <output name="prodNombre"> |
44 | <progress max="100">Cargando…</progress> |
45 | </output> |
46 | </label> |
47 | </p> |
48 | |
49 | <p> |
50 | <label> |
51 | Precio |
52 | <output name="precio"> |
53 | <progress max="100">Cargando…</progress> |
54 | </output> |
55 | </label> |
56 | </p> |
57 | |
58 | <p> |
59 | <label> |
60 | Cantidad * |
61 | <input name="cantidad" type="number" min="0" step="0.01"> |
62 | </label> |
63 | </p> |
64 | |
65 | <p>* Obligatorio</p> |
66 | |
67 | <p> |
68 | |
69 | <button type="submit">Guardar</button> |
70 | |
71 | <button type="button" onclick="if (params.size > 0 && confirmaEliminar()) { |
72 | invocaServicio('srv/srvDetalleDeVentaElimina.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> |