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/srvPasatiempoOptions.php') |
26 | .then(async options => { |
27 | const modelo = await invocaServicio('srv/srvAmigoBusca.php?' + params) |
28 | await muestraObjeto(document, options.body) |
29 | await muestraObjeto(document, modelo.body) |
30 | }) |
31 | .catch(muestraError) |
32 | }"> |
33 | |
34 | <form onsubmit="submitForm('srv/srvAmigoModifica.php', event) |
35 | .then(modelo => location.href = 'index.html') |
36 | .catch(muestraError)"> |
37 | |
38 | <h1>Modificar</h1> |
39 | |
40 | <p><a href="index.html">Cancelar</a></p> |
41 | |
42 | <input type="hidden" name="id"> |
43 | |
44 | <p> |
45 | <label> |
46 | Nombre * |
47 | <input name="nombre" value="Cargando…"> |
48 | </label> |
49 | </p> |
50 | |
51 | <p> |
52 | <label> |
53 | Pasatiempo |
54 | <select name="pasId"> |
55 | <option value="">Cargando…</option> |
56 | </select> |
57 | </label> |
58 | </p> |
59 | |
60 | <p>* Obligatorio</p> |
61 | |
62 | <p> |
63 | |
64 | <button type="submit">Guardar</button> |
65 | |
66 | <button type="button" onclick="if (params.size > 0 && confirmaEliminar()) { |
67 | invocaServicio('srv/srvAmigoElimina.php?' + params) |
68 | .then(() => location.href = 'index.html') |
69 | .catch(muestraError) |
70 | }"> |
71 | Eliminar |
72 | </button> |
73 | |
74 | </p> |
75 | |
76 | </form> |
77 | |
78 | </body> |
79 | |
80 | </html> |