feat: listar propiedades y baja propiedad
Signed-off-by: fede <federico.nicolas.polidoro@gmail.com>
This commit is contained in:
50
Front/src/Componentes/RowPropiedad.svelte
Normal file
50
Front/src/Componentes/RowPropiedad.svelte
Normal file
@@ -0,0 +1,50 @@
|
||||
<script lang="ts">
|
||||
import type {PropiedadDto} from "../types"
|
||||
import ModalEstatico from "./ModalEstatico.svelte";
|
||||
let { id, ubicacion, tipo, letra, piso }: PropiedadDto = $props();
|
||||
|
||||
let modal: boolean = $state(false)
|
||||
let modalpayload: string = $state("")
|
||||
|
||||
async function BajaPropiedad(){
|
||||
modal = false;
|
||||
try {
|
||||
const responce = await fetch("http://localhost:5007/api/propiedad?id="+id, {
|
||||
method: "DELETE",
|
||||
headers:{
|
||||
'Auth' : String(sessionStorage.getItem("token")),
|
||||
'Email' : String(localStorage.getItem("email"))
|
||||
},
|
||||
});
|
||||
|
||||
if (responce.ok){
|
||||
const json = await responce.json();
|
||||
modalpayload = json.message;
|
||||
modal = true;
|
||||
}
|
||||
|
||||
if (!responce.ok) {
|
||||
const json = await responce.json();
|
||||
modalpayload = json.message;
|
||||
modal = true;
|
||||
}
|
||||
}catch (e){
|
||||
console.error(e);
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<tr>
|
||||
<td>{id}</td>
|
||||
<td>{ubicacion}</td>
|
||||
<td>{letra}</td>
|
||||
<td>{piso}</td>
|
||||
<td>{tipo}</td>
|
||||
<td class="text-end">
|
||||
<button class="btn btn-outline-secondary">Modificar</button>
|
||||
<button class="btn btn-outline-danger" onclick={()=> BajaPropiedad()}>Baja</button>
|
||||
</td>
|
||||
</tr>
|
||||
{#if modal}
|
||||
<ModalEstatico payload={modalpayload}/>
|
||||
{/if}
|
||||
Reference in New Issue
Block a user