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/rol-checkboxes.php') |
25 | .then(async checkBoxes => { |
26 | const modelo = await consumeJson('srv/usuario.php?' + params) |
27 | await muestraObjeto(document, checkBoxes.body) |
28 | await muestraObjeto(document, modelo.body) |
29 | }) |
30 | .catch(muestraError) |
31 | }"> |
32 | |
33 | <form onsubmit="submitForm('srv/usuario-modifica.php', event) |
34 | .then(modelo => location.href = 'index.html') |
35 | .catch(muestraError)"> |
36 | |
37 | <h1>Modificar</h1> |
38 | |
39 | <p><a href="index.html">Cancelar</a></p> |
40 | |
41 | <input type="hidden" name="id"> |
42 | |
43 | <p> |
44 | <label> |
45 | |
46 | Cue * |
47 | <input name="cue" value="Cargando…"> |
48 | </label> |
49 | </p> |
50 | |
51 | <fieldset> |
52 | <legend>Roles</legend> |
53 | |
54 | <div id="roles"> |
55 | <progress max="100">Cargando…</progress> |
56 | </div> |
57 | |
58 | </fieldset> |
59 | |
60 | <p>* Obligatorio</p> |
61 | |
62 | <p> |
63 | |
64 | <button type="submit">Guardar</button> |
65 | |
66 | <button type="button" onclick=" |
67 | if (params.size > 0 && confirm('Confirma la eliminación')) { |
68 | consumeJson('srv/usuario-elimina.php?' + params) |
69 | .then(() => location.href = 'index.html') |
70 | .catch(muestraError) |
71 | }"> |
72 | Eliminar |
73 | </button> |
74 | |
75 | </p> |
76 | |
77 | </form> |
78 | |
79 | </body> |
80 | |
81 | </html> |