avanzando
This commit is contained in:
51
Front/src/Componentes/ModalRestablecerContra.svelte
Normal file
51
Front/src/Componentes/ModalRestablecerContra.svelte
Normal file
@@ -0,0 +1,51 @@
|
||||
<script lang="ts">
|
||||
let {
|
||||
close,
|
||||
submit,
|
||||
}: { close: () => void; submit: (e: Event, pass: string) => void } =
|
||||
$props();
|
||||
</script>
|
||||
|
||||
<div
|
||||
class="modal fade show d-block"
|
||||
tabindex="-1"
|
||||
style="background-color: rgba(0,0,0,0.5);"
|
||||
>
|
||||
<div class="modal-dialog">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<h5 class="modal-title">Restablecer Contraseña</h5>
|
||||
<button
|
||||
type="button"
|
||||
class="btn-close"
|
||||
aria-label="Close"
|
||||
onclick={close}
|
||||
></button>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<form onsubmit={submit}>
|
||||
<!--
|
||||
|
||||
<div class="mb-3">
|
||||
<label for="nombre" class="form-label">Nombre</label>
|
||||
<input type="text" id="nombre" class="form-control" bind:value={cli.nombre} required />
|
||||
</div>
|
||||
<div class="mb-3">
|
||||
<label for="apellido" class="form-label">Apellido</label>
|
||||
<input type="text" id="apellido" class="form-control" bind:value={cli.apellido} required />
|
||||
</div>
|
||||
<div class="mb-3">
|
||||
<label for="domicilio" class="form-label">Domicilio</label>
|
||||
<input type="text" id="domicilio" class="form-control" bind:value={cli.domicilio} required />
|
||||
</div>
|
||||
<div class="mb-3">
|
||||
<label for="celular" class="form-label">Celular</label>
|
||||
<input type="tel" id="celular" class="form-control" bind:value={cli.celular} required />
|
||||
</div>
|
||||
<button type="submit" class="btn btn-primary" onclick={(e)=>handleConfirm(e)}>Guardar</button>
|
||||
-->
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -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