| 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 src="dompurify/purify.min.js"></script> |
| 12 | <script type="module" src="libclienteweb/manejaErrores.js"></script> |
| 13 | |
| 14 | </head> |
| 15 | |
| 16 | <body> |
| 17 | |
| 18 | <form id="formulario"> |
| 19 | |
| 20 | <h1>Modificar</h1> |
| 21 | |
| 22 | <p><a href="carrito.html">Cancelar</a></p> |
| 23 | |
| 24 | <input type="hidden" name="prodId"> |
| 25 | |
| 26 | <p> |
| 27 | <label> |
| 28 | Producto |
| 29 | <output name="prodNombre"> |
| 30 | <progress max="100">Cargando…</progress> |
| 31 | </output> |
| 32 | </label> |
| 33 | </p> |
| 34 | |
| 35 | <p> |
| 36 | <label> |
| 37 | Precio |
| 38 | <output name="precio"> |
| 39 | <progress max="100">Cargando…</progress> |
| 40 | </output> |
| 41 | </label> |
| 42 | </p> |
| 43 | |
| 44 | <p> |
| 45 | <label> |
| 46 | Cantidad * |
| 47 | <input name="cantidad" type="number" min="0" step="0.01"> |
| 48 | </label> |
| 49 | </p> |
| 50 | |
| 51 | <p>* Obligatorio</p> |
| 52 | |
| 53 | <p> |
| 54 | |
| 55 | <button type="submit">Guardar</button> |
| 56 | |
| 57 | <button id="botonEliminar" type="button"> |
| 58 | Eliminar |
| 59 | </button> |
| 60 | |
| 61 | </p> |
| 62 | |
| 63 | </form> |
| 64 | |
| 65 | <script type="module"> |
| 66 | |
| 67 | import { descargaVista } from "./libclienteweb/descargaVista.js" |
| 68 | import { |
| 69 | configuraSubmitAccion |
| 70 | } from "./libclienteweb/configuraSubmitAccion.js" |
| 71 | import { |
| 72 | configuraAccionElimina |
| 73 | } from "./libclienteweb/configuraAccionElimina.js" |
| 74 | |
| 75 | const params = new URLSearchParams(location.search) |
| 76 | descargaDatos() |
| 77 | |
| 78 | async function descargaDatos() { |
| 79 | if (params.size > 0) { |
| 80 | await descargaVista("api/vista-modifica.php?" + params) |
| 81 | configuraSubmitAccion( |
| 82 | "api/det-venta-modifica.php", formulario, "carrito.html" |
| 83 | ) |
| 84 | configuraAccionElimina( |
| 85 | botonEliminar, "Confirma la eliminación", "api/det-venta-elimina.php", |
| 86 | formulario, "carrito.html" |
| 87 | ) |
| 88 | |
| 89 | } |
| 90 | } |
| 91 | |
| 92 | </script> |
| 93 | |
| 94 | </body> |
| 95 | |
| 96 | </html> |