WIP: primer avance con la Busqueda de Propiedades
Signed-off-by: fede <federico.nicolas.polidoro@gmail.com>
This commit is contained in:
19
Aspnet/Controllers/BusquedaControler.cs
Normal file
19
Aspnet/Controllers/BusquedaControler.cs
Normal file
@@ -0,0 +1,19 @@
|
||||
using Entidades.Dto;
|
||||
using Modelo;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
|
||||
namespace AlquilaFacil.Controllers;
|
||||
|
||||
[ApiController]
|
||||
public class BusquedaController: ControllerBase {
|
||||
[HttpGet("api/busqueda")]
|
||||
public IActionResult FiltroPropiedades([FromHeader(Name = "Auth")]string Auth, int cantidadHabitaciones, int tipoPropiedad, [FromQuery]string servicios) {
|
||||
if (String.IsNullOrEmpty(Auth)) return Unauthorized();
|
||||
var validacion1 = RepositorioPermisos.Singleton.CheckPermisos(Auth, 3);
|
||||
if (validacion1 == false) return Unauthorized();
|
||||
|
||||
var propiedades = RepositorioPropiedades.Singleton.ObtenerPropiedesPorHabitaciones_Tipo_Servicios();
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
3
Entidades/Dto/BusquedaDto.cs
Normal file
3
Entidades/Dto/BusquedaDto.cs
Normal file
@@ -0,0 +1,3 @@
|
||||
namespace Entidades.Dto;
|
||||
|
||||
public record BusquedaDto(int Id, string Ubicacion, string Servicios);
|
||||
19
Front/public/zoom.svg
Normal file
19
Front/public/zoom.svg
Normal file
@@ -0,0 +1,19 @@
|
||||
<!--
|
||||
tags: [find, magnifier, magnifying glass]
|
||||
version: "1.0"
|
||||
unicode: "fdaa"
|
||||
-->
|
||||
<svg
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
width="24"
|
||||
height="24"
|
||||
viewBox="0 0 24 24"
|
||||
fill="none"
|
||||
stroke="white"
|
||||
stroke-width="2"
|
||||
stroke-linecap="round"
|
||||
stroke-linejoin="round"
|
||||
>
|
||||
<path d="M10 10m-7 0a7 7 0 1 0 14 0a7 7 0 1 0 -14 0" />
|
||||
<path d="M21 21l-6 -6" />
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 369 B |
14
Front/src/Componentes/BotonVolverArriba.svelte
Normal file
14
Front/src/Componentes/BotonVolverArriba.svelte
Normal file
@@ -0,0 +1,14 @@
|
||||
<script lang="ts">
|
||||
const scrollToTop = () => {
|
||||
window.scrollTo({ top: 0, behavior: "smooth" });
|
||||
};
|
||||
</script>
|
||||
|
||||
<button
|
||||
class="btn btn-primary position-fixed bottom-0 end-0 mb-4 me-4 p-3"
|
||||
on:click={scrollToTop}
|
||||
title="Ir arriba"
|
||||
style="z-index: 1000; "
|
||||
>
|
||||
↑
|
||||
</button>
|
||||
60
Front/src/Componentes/PanelBusqueda.svelte
Normal file
60
Front/src/Componentes/PanelBusqueda.svelte
Normal file
@@ -0,0 +1,60 @@
|
||||
|
||||
<script>
|
||||
let canthabitaciones = 0;
|
||||
let servicios = ["Gas", "Internet", "Telefono", "Luz"];
|
||||
let serviciosSel = [];
|
||||
let tipo = 0;
|
||||
</script>
|
||||
|
||||
<form class="card p-3" style="border: 1px solid black">
|
||||
|
||||
<p>Busqueda Filtrada</p>
|
||||
|
||||
<div class="form-floating mb-3">
|
||||
<input
|
||||
type="number"
|
||||
id="canthabitaciones"
|
||||
class="form-control"
|
||||
bind:value={canthabitaciones}
|
||||
min="1"
|
||||
placeholder="Cantidad de Habitaciones"
|
||||
required
|
||||
/>
|
||||
<label for="canthabitaciones">Cantidad de Habitaciones</label>
|
||||
</div>
|
||||
|
||||
<div class="mb-3">
|
||||
<h6 class="form-floating form-label">Servicios</h6>
|
||||
{#each servicios as servicio}
|
||||
<div class="form-check">
|
||||
<input
|
||||
type="checkbox"
|
||||
class="form-check-input"
|
||||
bind:group={serviciosSel}
|
||||
value={servicio}
|
||||
id={`servicio-${servicio}`}
|
||||
/>
|
||||
<label class="form-check-label" for={`servicio-${servicio}`}>
|
||||
{servicio}
|
||||
</label>
|
||||
</div>
|
||||
{/each}
|
||||
</div>
|
||||
|
||||
<div class="form-floating mb-3">
|
||||
<select id="idtipo" class="form-select" bind:value={tipo} required>
|
||||
<option value="1">Casa</option>
|
||||
<option value="2">Piso</option>
|
||||
<option value="3">Departamento</option>
|
||||
<option value="4">Galpon</option>
|
||||
<option value="5">LocalComercial</option>
|
||||
<option value="6">Oficina</option>
|
||||
</select>
|
||||
<label for="idtipopropiedad">Tipo de propiedad</label>
|
||||
</div>
|
||||
|
||||
<button type="submit" class="btn btn-primary w-100 d-flex align-items-center justify-content-center">
|
||||
Buscar
|
||||
<img src="/zoom.svg" alt="" class="ms-2" style="height: 1.2em;" />
|
||||
</button>
|
||||
</form>
|
||||
13
Front/src/Componentes/PublicacionPropiedad.svelte
Normal file
13
Front/src/Componentes/PublicacionPropiedad.svelte
Normal file
@@ -0,0 +1,13 @@
|
||||
<script>
|
||||
let {ubicacion, servicios} = $props();
|
||||
</script>
|
||||
|
||||
<div class="card text-center" style="border:1px solid black">
|
||||
<div class="card-body">
|
||||
<div class="card-img-top">
|
||||
<i class="bi bi-flower3" style="font-size: 3rem;"></i>
|
||||
</div>
|
||||
<p class="card-text mt-3">{ubicacion} - {servicios}</p>
|
||||
<button class="btn btn-primary">Consultar</button>
|
||||
</div>
|
||||
</div>
|
||||
@@ -1,5 +1,78 @@
|
||||
<script lang="ts">
|
||||
import NavBarAutocompletable from "../Componentes/NavBarAutocompletable.svelte";
|
||||
import PublicacionPropiedad from "../Componentes/PublicacionPropiedad.svelte";
|
||||
import PanelBusqueda from "../Componentes/PanelBusqueda.svelte";
|
||||
import VolverArriba from "../Componentes/BotonVolverArriba.svelte";
|
||||
import { onMount } from "svelte";
|
||||
import { fade } from "svelte/transition";
|
||||
import {urlG} from "../stores/urlStore"
|
||||
|
||||
let showButton = $state(false);
|
||||
|
||||
let token = sessionStorage.getItem("token");
|
||||
|
||||
const handleScroll = () => {
|
||||
showButton = window.scrollY > 100;
|
||||
};
|
||||
|
||||
onMount(() => {
|
||||
window.addEventListener("scroll", handleScroll);
|
||||
return () => window.removeEventListener("scroll", handleScroll);
|
||||
});
|
||||
|
||||
function cargaPropiedades(e:Event){
|
||||
e.preventDefault();
|
||||
const response = fetch(String($urlG)+"/api/busqueda", {
|
||||
method: "GET",
|
||||
headers: {
|
||||
"Auth": String(token),
|
||||
}
|
||||
});
|
||||
}
|
||||
</script>
|
||||
|
||||
<NavBarAutocompletable/>
|
||||
|
||||
<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" />
|
||||
<br>
|
||||
</div>
|
||||
<div class="col-md-4 order-1">
|
||||
<PanelBusqueda/>
|
||||
<br>
|
||||
</div>
|
||||
</div>
|
||||
{#if showButton }
|
||||
<div transition:fade={{duration:100}}>
|
||||
<VolverArriba/>
|
||||
</div>
|
||||
{/if}
|
||||
</div>
|
||||
|
||||
@@ -170,5 +170,10 @@ public bool AñadirPropiedad(Propiedade? prop) {
|
||||
}
|
||||
|
||||
return Guardar(con);
|
||||
}
|
||||
}
|
||||
|
||||
public IQueryable<BusquedaDto> ObtenerPropiedesPorHabitaciones_Tipo_Servicios(int habitaciones, int tipo, string servicios) {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user