añadido tema oscuro, y programada la funcion de busqueda
This commit is contained in:
@@ -6,8 +6,11 @@
|
||||
import { onMount } from "svelte";
|
||||
import { fade } from "svelte/transition";
|
||||
import {urlG} from "../stores/urlStore"
|
||||
|
||||
import type { PropiedadDto } from "../types";
|
||||
|
||||
|
||||
let showButton = $state(false);
|
||||
let propiedades: PropiedadDto[] = $state([]);
|
||||
|
||||
let token = sessionStorage.getItem("token");
|
||||
|
||||
@@ -16,18 +19,50 @@
|
||||
};
|
||||
|
||||
onMount(() => {
|
||||
checkparametros()?
|
||||
busqueda():
|
||||
cargaPropiedades();
|
||||
|
||||
window.addEventListener("scroll", handleScroll);
|
||||
return () => window.removeEventListener("scroll", handleScroll);
|
||||
});
|
||||
|
||||
function checkparametros(){
|
||||
const params = new URLSearchParams(window.location.search);
|
||||
|
||||
function cargaPropiedades(e:Event){
|
||||
e.preventDefault();
|
||||
const response = fetch(String($urlG)+"/api/busqueda", {
|
||||
if (params.has('cantidadHabitaciones') && params.has('tipoPropiedad')
|
||||
&& params.has('servicios') ) {
|
||||
return true;
|
||||
}
|
||||
return false
|
||||
}
|
||||
async function cargaPropiedades(){
|
||||
const response = await fetch(String($urlG)+"/api/propiedades", {
|
||||
method: "GET",
|
||||
headers: {
|
||||
"Auth": String(token),
|
||||
}
|
||||
});
|
||||
if (response.ok){
|
||||
propiedades = await response.json();
|
||||
}
|
||||
}
|
||||
async function busqueda(){
|
||||
const params = new URLSearchParams(window.location.search);
|
||||
let hab = params.get('cantidadHabitaciones');
|
||||
let tipo = params.get('tipoPropiedad');
|
||||
let serv = params.get('servicios');
|
||||
|
||||
const response = await fetch(String($urlG)+"/api/busqueda"+"?cantidadHabitaciones="+hab+
|
||||
"&tipoPropiedad="+tipo+"&servicios="+serv, {
|
||||
method: "GET",
|
||||
headers: {
|
||||
"Auth": String(token),
|
||||
}
|
||||
});
|
||||
if (response.ok){
|
||||
propiedades = await response.json();
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
@@ -36,34 +71,10 @@
|
||||
<div class="container mt-4">
|
||||
<div class="row">
|
||||
<div class="col col-md-8 order-2">
|
||||
<PublicacionPropiedad ubicacion="test" servicios="test" />
|
||||
<br>
|
||||
<PublicacionPropiedad ubicacion="test" servicios="test" />
|
||||
<br>
|
||||
<PublicacionPropiedad ubicacion="test" servicios="test" />
|
||||
<br>
|
||||
<PublicacionPropiedad ubicacion="test" servicios="test" />
|
||||
<br>
|
||||
<PublicacionPropiedad ubicacion="test" servicios="test" />
|
||||
<br>
|
||||
<PublicacionPropiedad ubicacion="test" servicios="test" />
|
||||
<br>
|
||||
<PublicacionPropiedad ubicacion="test" servicios="test" />
|
||||
<br>
|
||||
<PublicacionPropiedad ubicacion="test" servicios="test" />
|
||||
<br>
|
||||
<PublicacionPropiedad ubicacion="test" servicios="test" />
|
||||
<br>
|
||||
<PublicacionPropiedad ubicacion="test" servicios="test" />
|
||||
<br>
|
||||
<PublicacionPropiedad ubicacion="test" servicios="test" />
|
||||
<br>
|
||||
<PublicacionPropiedad ubicacion="test" servicios="test" />
|
||||
<br>
|
||||
<PublicacionPropiedad ubicacion="test" servicios="test" />
|
||||
<br>
|
||||
<PublicacionPropiedad ubicacion="test" servicios="test" />
|
||||
{#each propiedades as item}
|
||||
<PublicacionPropiedad prop={item} />
|
||||
<br>
|
||||
{/each}
|
||||
</div>
|
||||
<div class="col-md-4 order-1">
|
||||
<PanelBusqueda/>
|
||||
|
||||
@@ -39,7 +39,10 @@
|
||||
</script>
|
||||
|
||||
<NavBarAutocompletable/>
|
||||
<div class="container table-responsive">
|
||||
<h1 class="text-center">
|
||||
Propiedades de Alta
|
||||
</h1>
|
||||
<div class="container table-responsive border border-success">
|
||||
<table class="table-responsive table table-striped">
|
||||
<thead>
|
||||
<tr>
|
||||
|
||||
@@ -39,7 +39,10 @@
|
||||
</script>
|
||||
|
||||
<NavBarAutocompletable/>
|
||||
<div class="container table-responsive">
|
||||
<h1 class="text-center">
|
||||
Propiedades de Baja
|
||||
</h1>
|
||||
<div class="container table-responsive border border-success">
|
||||
<table class="table-responsive table table-striped">
|
||||
<thead>
|
||||
<tr>
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<script lang="ts">
|
||||
import Login from "../Componentes/login.svelte"
|
||||
import Login from "../Componentes/LoginPanel.svelte"
|
||||
import Navbar from "../Componentes/NavBarLogin.svelte";
|
||||
</script>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user