avanzando
This commit is contained in:
@@ -8,6 +8,7 @@
|
||||
import { fade, fly } from "svelte/transition";
|
||||
import ModalModificarPropietarios from "../Componentes/ModalModificarPropietarios.svelte";
|
||||
import { CardLink } from "@sveltestrap/sveltestrap";
|
||||
import ModalRestablecerContra from "../Componentes/ModalRestablecerContra.svelte";
|
||||
|
||||
let Clientes: Cliente[] = $state([]);
|
||||
let Grupos: any[] = $state([]);
|
||||
@@ -241,6 +242,35 @@
|
||||
modaldata = "Falla la conexion al servidor";
|
||||
}
|
||||
}
|
||||
|
||||
let restablecercontracli: Cliente | null = $state(null);
|
||||
let showmodalrestablecercontra: boolean = $state(false);
|
||||
async function handleRestablecerContraseña(e: Event, pass: string) {
|
||||
e.preventDefault();
|
||||
try {
|
||||
const req = await fetch($urlG + "", {
|
||||
method: "POST",
|
||||
headers: {
|
||||
Auth: token || "",
|
||||
"Content-Type": "application/json",
|
||||
},
|
||||
body: JSON.stringify({
|
||||
Dni: restablecercontracli?.dni,
|
||||
Pass: pass,
|
||||
}),
|
||||
});
|
||||
//WIP
|
||||
if (req.ok) {
|
||||
}
|
||||
} catch {
|
||||
modaldata = "Falla la conexion al servidor";
|
||||
}
|
||||
}
|
||||
|
||||
function triggermodalcontra(cli: Cliente) {
|
||||
restablecercontracli = cli;
|
||||
showmodalrestablecercontra = true;
|
||||
}
|
||||
</script>
|
||||
|
||||
<NavBarAutocompletable />
|
||||
@@ -257,6 +287,13 @@
|
||||
/>
|
||||
{/if}
|
||||
|
||||
{#if showmodalrestablecercontra}
|
||||
<ModalRestablecerContra
|
||||
close={() => (showmodalrestablecercontra = false)}
|
||||
submit={handleRestablecerContraseña}
|
||||
/>
|
||||
{/if}
|
||||
|
||||
<div class="content-fluid align-items-start">
|
||||
<div class="row">
|
||||
<div class="col ms-2">
|
||||
@@ -301,7 +338,15 @@
|
||||
onclick={(e) =>
|
||||
abrirModalModificarCliente(e, cli)}
|
||||
>
|
||||
Modificar
|
||||
<img src="/edit.svg" alt="Editar" />
|
||||
</button>
|
||||
<button
|
||||
class="btn btn-info"
|
||||
onclick={() => triggermodalcontra(cli)}
|
||||
><img
|
||||
src="/key.svg"
|
||||
alt="RestablecerContraseña"
|
||||
/>
|
||||
</button>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
Reference in New Issue
Block a user