funcionalidad terminada
This commit is contained in:
@@ -121,4 +121,38 @@ public class NotificacionesController: ControllerBase {
|
|||||||
return ret?
|
return ret?
|
||||||
Ok(new { message = "se envio el aviso" }):BadRequest(new { message = "Fallo al intentar enviar el aviso" });
|
Ok(new { message = "se envio el aviso" }):BadRequest(new { message = "Fallo al intentar enviar el aviso" });
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[HttpPost("api/notificar/ConsultaCompra")]
|
||||||
|
public IActionResult EnviarConsultaCompra([FromHeader(Name ="Auth")]string Auth, AltaNotificacionDto dto) {
|
||||||
|
if (String.IsNullOrWhiteSpace(Auth)) return Unauthorized();
|
||||||
|
var validacion1 = RepositorioGrupos.Singleton.CheckGrupos(Auth, "Propietario");
|
||||||
|
if (validacion1 == false){
|
||||||
|
validacion1 = RepositorioGrupos.Singleton.CheckGrupos(Auth, "Inquilino");
|
||||||
|
if (validacion1 == false) {
|
||||||
|
return Unauthorized();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (dto.Accion == "") return BadRequest(new{message = "El campo Accion esta vacio"});
|
||||||
|
if (dto.Mensaje == "") return BadRequest(new {message = "El campo Mensaje esta vacio"});
|
||||||
|
|
||||||
|
Cliente?cli = RepositorioUsuarios.Singleton.ObtenerClientePorToken(Auth);
|
||||||
|
|
||||||
|
Propiedade? prop = RepositorioPropiedades.Singleton.ObtenerPropiedadPorId(dto.Propiedad);
|
||||||
|
if (prop == null) return BadRequest(new { message = "No hay una propiedad con id 0 o menor"});
|
||||||
|
|
||||||
|
var n = new NotificacioneBuilder()
|
||||||
|
.SetAccion("Consulta Compra")
|
||||||
|
.SetMensaje(dto.Mensaje)
|
||||||
|
.SetLeido(false)
|
||||||
|
.SetDnicliente(prop.Dnipropietario??0)
|
||||||
|
.SetDniremitente(cli.Dni)
|
||||||
|
.SetIdpropiedad(prop.Id)
|
||||||
|
.SetFecha(DateTime.Now)
|
||||||
|
.Build();
|
||||||
|
var ret2= RepositorioNotificaciones.Singleton.AltaNotificacion(n, cli.Dni);
|
||||||
|
return ret2?
|
||||||
|
Ok(new { message = "se envio el aviso" }):BadRequest(new { message = "Fallo al intentar enviar el aviso" });
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -55,7 +55,10 @@ public class PropiedadesController: ControllerBase {
|
|||||||
};
|
};
|
||||||
l.Add(p);
|
l.Add(p);
|
||||||
}
|
}
|
||||||
return Ok(l);
|
|
||||||
|
int cantpag = RepositorioPropiedades.Singleton.ObtenerPaginasDePropiedadesEnVenta();
|
||||||
|
|
||||||
|
return Ok(new { propiedades = l, cantpaginas = cantpag});
|
||||||
}
|
}
|
||||||
|
|
||||||
[HttpGet("api/propiedades/Venta/Propietario")]
|
[HttpGet("api/propiedades/Venta/Propietario")]
|
||||||
|
|||||||
@@ -14,6 +14,82 @@ namespace AlquilaFacil.Controllers;
|
|||||||
[ApiController]
|
[ApiController]
|
||||||
public class VentaController:ControllerBase {
|
public class VentaController:ControllerBase {
|
||||||
|
|
||||||
|
[HttpPost("api/venta/AceptarConsultaVenta")]
|
||||||
|
public IActionResult AceptarConsultaVenta([FromHeader(Name="Auth")]string Auth, NotificacionMarcarLeidoDto dto) {
|
||||||
|
var validacion1 = RepositorioGrupos.Singleton.CheckGrupos(Auth, "Propietario");
|
||||||
|
if (validacion1 == false) {
|
||||||
|
return Unauthorized();
|
||||||
|
}
|
||||||
|
if (dto.Email == "") return BadRequest(new { message = "Falta dato Email"});
|
||||||
|
|
||||||
|
Cliente? cli = RepositorioUsuarios.Singleton.ObtenerClientePorToken(Auth);
|
||||||
|
if (cli == null) Unauthorized();
|
||||||
|
if (cli.Email != dto.Email) return BadRequest(new {message = "El token de autorizacion no corresponde a tu usuario"});
|
||||||
|
RepositorioNotificaciones.Singleton.MarcarComoLeido(cli.Dni, dto.Fecha);
|
||||||
|
|
||||||
|
Notificacione? n = RepositorioNotificaciones.Singleton.ObtenerNotificacionPorKeys(cli.Dni, dto.Fecha);
|
||||||
|
if (n == null) return BadRequest(new { message = "No se encuentra la notificacion"});
|
||||||
|
|
||||||
|
Propiedade? prop = RepositorioPropiedades.Singleton.ObtenerPropiedadPorId(n.Idpropiedad);
|
||||||
|
if (prop == null) return BadRequest(new { message = "No se encuentra una propiedad por ese id"});
|
||||||
|
Venta? v = new Venta{
|
||||||
|
Fechainicio = DateTime.Now,
|
||||||
|
IdVendedor = prop.Dnipropietario,
|
||||||
|
IdComprador = n.Dniremitente,
|
||||||
|
Monto = prop.Monto,
|
||||||
|
Idpropiedad = prop.Id,
|
||||||
|
Iddivisa = prop.Iddivisa,
|
||||||
|
Idestado = 2,
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
bool ret = RepositorioVentas.Singleton.IniciarVenta(v, cli.Dni);
|
||||||
|
if (ret){
|
||||||
|
var noti = new NotificacioneBuilder()
|
||||||
|
.SetAccion("Notificacion")
|
||||||
|
.SetMensaje("Debe Realizar el pago para que se registre el traspaso de la propiedad")
|
||||||
|
.SetLeido(false)
|
||||||
|
.SetDnicliente(n.Dniremitente)
|
||||||
|
.SetDniremitente(n.Dnicliente)
|
||||||
|
.SetIdpropiedad(n.Idpropiedad)
|
||||||
|
.SetFecha(DateTime.Now)
|
||||||
|
.Build();
|
||||||
|
ret = RepositorioNotificaciones.Singleton.AltaNotificacion(noti);
|
||||||
|
}
|
||||||
|
return ret?
|
||||||
|
Ok(new { message = "Se inicio la venta"}):BadRequest(new { message ="fallo al iniciar la venta"});
|
||||||
|
}
|
||||||
|
|
||||||
|
[HttpPost("api/venta/CancelarConsultaVenta")]
|
||||||
|
public IActionResult CancelarConsultaVenta([FromHeader(Name="Auth")]string Auth, NotificacionMarcarLeidoDto dto) {
|
||||||
|
var validacion1 = RepositorioGrupos.Singleton.CheckGrupos(Auth, "Propietario");
|
||||||
|
if (validacion1 == false) {
|
||||||
|
return Unauthorized();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (dto.Email == "") return BadRequest(new { message = "Falta dato Email"});
|
||||||
|
|
||||||
|
Cliente? cli = RepositorioUsuarios.Singleton.ObtenerClientePorToken(Auth);
|
||||||
|
if (cli == null) Unauthorized();
|
||||||
|
if (cli.Email != dto.Email) return BadRequest(new {message = "El token de autorizacion no corresponde a tu usuario"});
|
||||||
|
|
||||||
|
RepositorioNotificaciones.Singleton.MarcarComoLeido(cli.Dni, dto.Fecha);
|
||||||
|
Notificacione? n = RepositorioNotificaciones.Singleton.ObtenerNotificacionPorKeys(cli.Dni, dto.Fecha);
|
||||||
|
var noti = new NotificacioneBuilder()
|
||||||
|
.SetAccion("Notificacion")
|
||||||
|
.SetMensaje("El propietario no quiere vender")
|
||||||
|
.SetLeido(false)
|
||||||
|
.SetDnicliente(n.Dniremitente)
|
||||||
|
.SetDniremitente(n.Dnicliente)
|
||||||
|
.SetIdpropiedad(n.Idpropiedad)
|
||||||
|
.SetFecha(DateTime.Now)
|
||||||
|
.Build();
|
||||||
|
|
||||||
|
var ret = RepositorioNotificaciones.Singleton.AltaNotificacion(noti);
|
||||||
|
return ret ?
|
||||||
|
Ok(new{message = "Se Envio una notificacion"}):BadRequest(new{message = "Fallo al Descartar Consulta"});
|
||||||
|
}
|
||||||
|
|
||||||
[HttpGet("/api/propiedad/EstaALaVenta")]
|
[HttpGet("/api/propiedad/EstaALaVenta")]
|
||||||
public IActionResult EstaALaVenta([FromHeader(Name="Auth")]string Auth, int idprop=0) {
|
public IActionResult EstaALaVenta([FromHeader(Name="Auth")]string Auth, int idprop=0) {
|
||||||
var validacion1 = RepositorioGrupos.Singleton.CheckGrupos(Auth, "Propietario");
|
var validacion1 = RepositorioGrupos.Singleton.CheckGrupos(Auth, "Propietario");
|
||||||
|
|||||||
@@ -12,7 +12,7 @@
|
|||||||
let array = $derived.by(()=> Array.from({ length: cantpag }, (_, i) => i + 1));
|
let array = $derived.by(()=> Array.from({ length: cantpag }, (_, i) => i + 1));
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
{#if cantpag>1}
|
{#if cantpag>0}
|
||||||
<nav aria-label="Page navigation example">
|
<nav aria-label="Page navigation example">
|
||||||
<ul class="pagination">
|
<ul class="pagination">
|
||||||
{#each array as num }
|
{#each array as num }
|
||||||
|
|||||||
@@ -1,14 +1,148 @@
|
|||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import { text } from "@sveltejs/kit";
|
import { onMount } from "svelte";
|
||||||
import BarraHorizontalConTexto from "../Componentes/BarraHorizontalConTexto.svelte";
|
import BarraHorizontalConTexto from "../Componentes/BarraHorizontalConTexto.svelte";
|
||||||
import NavBarAutocompletable from "../Componentes/NavBarAutocompletable.svelte";
|
import NavBarAutocompletable from "../Componentes/NavBarAutocompletable.svelte";
|
||||||
|
import type { PropiedadDto, PropiedadVentaDto } from "../types";
|
||||||
|
import { urlG } from "../stores/urlStore";
|
||||||
|
import BotonVolverArriba from "../Componentes/BotonVolverArriba.svelte";
|
||||||
|
import { fade } from "svelte/transition";
|
||||||
|
import ModalConfirm from "../Componentes/ModalConfirm.svelte";
|
||||||
|
import PaginacionStepper from "../Componentes/PaginacionStepper.svelte";
|
||||||
|
|
||||||
|
let token = sessionStorage.getItem("token")||"";
|
||||||
|
|
||||||
|
let propiedades:PropiedadVentaDto[]|null = $state(null);
|
||||||
|
let pag:number = $state(1);
|
||||||
|
let cantpag:number = $state(0);
|
||||||
|
let message:string = "Esto le enviará una notificacion al propietario";
|
||||||
|
let show:boolean = $state(false);
|
||||||
|
|
||||||
|
|
||||||
|
let showButton:boolean = $state(false);
|
||||||
|
let modaldata:string = $state("");
|
||||||
|
|
||||||
|
|
||||||
|
onMount(()=>{
|
||||||
|
obtenerpropiedades();
|
||||||
|
|
||||||
|
window.addEventListener("scroll", handleScroll);
|
||||||
|
return () => window.removeEventListener("scroll", handleScroll);
|
||||||
|
});
|
||||||
|
|
||||||
|
const handleScroll = () => {
|
||||||
|
showButton = window.scrollY > 100;
|
||||||
|
};
|
||||||
|
|
||||||
|
async function obtenerpropiedades() {
|
||||||
|
try {
|
||||||
|
const r = await fetch($urlG+"/api/propiedades/Venta?pag="+pag, {
|
||||||
|
method:"GET",
|
||||||
|
headers: {
|
||||||
|
"Auth": token
|
||||||
|
}
|
||||||
|
});
|
||||||
|
let data = await r.json();
|
||||||
|
if(r.ok){
|
||||||
|
propiedades = data.propiedades;
|
||||||
|
cantpag = data.cantpaginas;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
modaldata = data.message;
|
||||||
|
} catch {
|
||||||
|
modaldata = "Fallo al hacer la request";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
let selp: PropiedadVentaDto|any = $state();
|
||||||
|
function Consultar(p:PropiedadVentaDto) {
|
||||||
|
selp = p;
|
||||||
|
show = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
async function handleConfirm() {
|
||||||
|
const remitente = localStorage.getItem("email");
|
||||||
|
const accion = "Consulta Compra";
|
||||||
|
let mensaje = "el usuario con email: "+remitente+" quiere comprar la propiedad situada en: "+selp.ubicacion;
|
||||||
|
const propiedad = selp.id;
|
||||||
|
try {
|
||||||
|
const responce = await fetch($urlG+"/api/notificar/ConsultaCompra", {
|
||||||
|
method: "POST",
|
||||||
|
headers: {
|
||||||
|
"Auth": token,
|
||||||
|
"Content-Type": "application/json"
|
||||||
|
},
|
||||||
|
body : JSON.stringify({remitente, accion, mensaje, propiedad})
|
||||||
|
});
|
||||||
|
let data = await responce.json();
|
||||||
|
modaldata = data.message;
|
||||||
|
|
||||||
|
} catch {
|
||||||
|
modaldata = "Fallo al hacer la request";
|
||||||
|
}
|
||||||
|
|
||||||
|
show=!show;
|
||||||
|
}
|
||||||
|
|
||||||
|
async function queryPag(a:number) {
|
||||||
|
pag= a;
|
||||||
|
obtenerpropiedades();
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<NavBarAutocompletable/>
|
<NavBarAutocompletable/>
|
||||||
|
|
||||||
<div class="container-fluid mt-2">
|
<div class="container-fluid mt-2">
|
||||||
<BarraHorizontalConTexto text="Venta Propiedades"/>
|
<BarraHorizontalConTexto text="Venta Propiedades"/>
|
||||||
|
<div class="row">
|
||||||
</div>
|
{#if propiedades == null}
|
||||||
|
<div class="position-absolute start-50 top-50">
|
||||||
|
<div class="spinner-border" role="status">
|
||||||
|
</div>
|
||||||
|
Cargando...
|
||||||
|
</div>
|
||||||
|
{:else if propiedades.length <= 0}
|
||||||
|
<div class="card">
|
||||||
|
<div class="card-body">
|
||||||
|
No hay Propiedades a la Venta.
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
{:else}
|
||||||
|
{#each propiedades as p}
|
||||||
|
<div class="col-12 col-md-6 mb-3">
|
||||||
|
<ModalConfirm {show} {message} title="Consulta" onConfirm={handleConfirm} onCancel={()=>show=false}/>
|
||||||
|
<div class="card text-center border shadow-sm">
|
||||||
|
<div class="card-header bg-primary text-white">
|
||||||
|
<h5 class="mb-0">{p.tipo}</h5>
|
||||||
|
</div>
|
||||||
|
<div class="card-body">
|
||||||
|
<div class="card-img-top mb-3">
|
||||||
|
<i class="bi bi-building" style="font-size: 3rem;"></i>
|
||||||
|
</div>
|
||||||
|
<h6 class="card-title">{p.ubicacion}</h6>
|
||||||
|
<p class="card-text">
|
||||||
|
<strong>Habitaciones:</strong> {p.canthabitaciones}<br>
|
||||||
|
<strong>Piso:</strong> {p.piso || "N/A"}<br>
|
||||||
|
<strong>Letra:</strong> {p.letra || "N/A"}<br>
|
||||||
|
<strong>Servicios:</strong> {p.servicios || "Sin servicios especificados"}<br>
|
||||||
|
<strong>Monto:</strong>
|
||||||
|
{p.divisa} {p.monto}<br>
|
||||||
|
</p>
|
||||||
|
<button class="btn btn-primary" onclick={()=>Consultar(p)}>Consultar Compra</button>
|
||||||
|
</div>
|
||||||
|
<div class="card-footer text-muted">
|
||||||
|
ID Propiedad: {p.id}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
{/each}
|
||||||
|
<div class="d-flex justify-content-center">
|
||||||
|
<PaginacionStepper currentPag={pag} {cantpag} {queryPag}/>
|
||||||
|
</div>
|
||||||
|
{/if}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
{#if showButton }
|
||||||
|
<div transition:fade={{duration:100}}>
|
||||||
|
<BotonVolverArriba/>
|
||||||
|
</div>
|
||||||
|
{/if}
|
||||||
@@ -74,10 +74,6 @@
|
|||||||
console.error(e);
|
console.error(e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function BajaPropiedad(): any {
|
|
||||||
throw new Error("Function not implemented.");
|
|
||||||
}
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<NavBarAutocompletable/>
|
<NavBarAutocompletable/>
|
||||||
|
|||||||
@@ -13,6 +13,7 @@
|
|||||||
import ModalVeryAceptarContrato from "../Componentes/ModalVeryAceptarContrato.svelte";
|
import ModalVeryAceptarContrato from "../Componentes/ModalVeryAceptarContrato.svelte";
|
||||||
import { getRequest } from "@sveltejs/kit/node";
|
import { getRequest } from "@sveltejs/kit/node";
|
||||||
import { json } from "@sveltejs/kit";
|
import { json } from "@sveltejs/kit";
|
||||||
|
import { Accordion } from "@sveltestrap/sveltestrap";
|
||||||
|
|
||||||
const token = sessionStorage.getItem("token");
|
const token = sessionStorage.getItem("token");
|
||||||
let mensajes: MensajeDto[] = $state([]);
|
let mensajes: MensajeDto[] = $state([]);
|
||||||
@@ -135,6 +136,18 @@
|
|||||||
Selmens = {...mensaje};
|
Selmens = {...mensaje};
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (mensaje.accion === "Consulta Compra") {
|
||||||
|
Selmens = {...mensaje};
|
||||||
|
showConsultaCompra = true;
|
||||||
|
messageConsultaCompra = mensaje.mensaje+". Al darle aceptar se baja la propiedad de la pagina de busqueda para venta, y dandole a Cancelar se envia una notificacion al potencial comprador de que no esta a la venta";
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (mensaje.accion === "Notificacion") {
|
||||||
|
Selmens = {...mensaje};
|
||||||
|
return;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
async function obtenerListaGarantes(idcontrato: number) {
|
async function obtenerListaGarantes(idcontrato: number) {
|
||||||
@@ -414,6 +427,50 @@
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
let showConsultaCompra:boolean = $state(false);
|
||||||
|
let messageConsultaCompra:string = $state("");
|
||||||
|
async function handleAceptarConsultaVenta() {
|
||||||
|
try{
|
||||||
|
const r = await fetch($urlG+"/api/venta/AceptarConsultaVenta", {
|
||||||
|
method: "POST",
|
||||||
|
headers: {
|
||||||
|
"Auth": token||"",
|
||||||
|
"Content-Type": "application/json",
|
||||||
|
},
|
||||||
|
body: JSON.stringify({fecha: Selmens.fecha, email: localStorage.getItem("email")||""})
|
||||||
|
});
|
||||||
|
let data = await r.json();
|
||||||
|
modaldata = data.message;
|
||||||
|
if (r.ok){
|
||||||
|
SinLeer();
|
||||||
|
}
|
||||||
|
}catch{
|
||||||
|
modaldata= "Fallo al hacer la request";
|
||||||
|
}
|
||||||
|
showConsultaCompra = false; Selmens.accion = "";
|
||||||
|
|
||||||
|
}
|
||||||
|
async function handleCancepConsultaVenta() {
|
||||||
|
try{
|
||||||
|
const r = await fetch($urlG+"/api/venta/CancelarConsultaVenta", {
|
||||||
|
method: "POST",
|
||||||
|
headers: {
|
||||||
|
"Auth": token||"",
|
||||||
|
"Content-Type": "application/json",
|
||||||
|
},
|
||||||
|
body: JSON.stringify({fecha: Selmens.fecha, email: localStorage.getItem("email")||""})
|
||||||
|
});
|
||||||
|
let data = await r.json();
|
||||||
|
modaldata = data.message;
|
||||||
|
if (r.ok){
|
||||||
|
SinLeer();
|
||||||
|
}
|
||||||
|
}catch{
|
||||||
|
modaldata= "Fallo al hacer la request";
|
||||||
|
}
|
||||||
|
showConsultaCompra = false; Selmens.accion = "";
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<NavBarAutocompletable/>
|
<NavBarAutocompletable/>
|
||||||
@@ -430,8 +487,11 @@
|
|||||||
<ModalCheckYContrato {garantes} men={Selmens} onCancel={handleCancelPrecontrato} onClose={() => (Selmens.accion = "")} onConfirm={handleEnviarmensaje4}/>
|
<ModalCheckYContrato {garantes} men={Selmens} onCancel={handleCancelPrecontrato} onClose={() => (Selmens.accion = "")} onConfirm={handleEnviarmensaje4}/>
|
||||||
{:else if Selmens.accion == "Aceptar Contrato"}
|
{:else if Selmens.accion == "Aceptar Contrato"}
|
||||||
<ModalVeryAceptarContrato onClose={() => (Selmens.accion = "")} onConfirm={handleAceptarContrato} onCancel={handlerechazarcontrato} getContrato={ObtenerContrato} men={Selmens}/>
|
<ModalVeryAceptarContrato onClose={() => (Selmens.accion = "")} onConfirm={handleAceptarContrato} onCancel={handlerechazarcontrato} getContrato={ObtenerContrato} men={Selmens}/>
|
||||||
{:else if Selmens.accion == "Notificacion Inquilino"}
|
{:else if Selmens.accion == "Notificacion Inquilino" || Selmens.accion == "Notificacion"}
|
||||||
<ModalEstatico payload={Selmens.mensaje} close={()=> !!(Selmens.accion = "") }/>
|
<ModalEstatico payload={Selmens.mensaje} close={()=> !!(Selmens.accion = "") }/>
|
||||||
|
{:else if Selmens.accion == "Consulta Compra"}
|
||||||
|
<ModalConfirm title="Potencial Comprador Consulta si Vendes la propiedad" show={showConsultaCompra} message={messageConsultaCompra} onConfirm={handleAceptarConsultaVenta}
|
||||||
|
onCancel={handleCancepConsultaVenta} />
|
||||||
{/if}
|
{/if}
|
||||||
|
|
||||||
<div class="container-fluid">
|
<div class="container-fluid">
|
||||||
@@ -493,7 +553,7 @@
|
|||||||
</button>
|
</button>
|
||||||
{/if}
|
{/if}
|
||||||
{#if (men.accion === "ContratoCancelado" || men.accion === "Rechazo Contrato" ||
|
{#if (men.accion === "ContratoCancelado" || men.accion === "Rechazo Contrato" ||
|
||||||
men.accion === "Aceptado Contrato" || men.accion === "Notificacion Inquilino"
|
men.accion === "Aceptado Contrato" || men.accion === "Notificacion Inquilino" || men.accion == "Notificacion"
|
||||||
) && mostrarleidos == false}
|
) && mostrarleidos == false}
|
||||||
<button
|
<button
|
||||||
class="btn btn-outline-danger btn-sm"
|
class="btn btn-outline-danger btn-sm"
|
||||||
|
|||||||
12
Front/src/types.d.ts
vendored
12
Front/src/types.d.ts
vendored
@@ -10,6 +10,18 @@ export type PropiedadDto = {
|
|||||||
iddivisa: number
|
iddivisa: number
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export type PropiedadVentaDto = {
|
||||||
|
id: number,
|
||||||
|
ubicacion: string,
|
||||||
|
tipo: string,
|
||||||
|
piso: string | null,
|
||||||
|
letra: string | null,
|
||||||
|
canthabitaciones: number,
|
||||||
|
servicios: string,
|
||||||
|
monto: number,
|
||||||
|
divisa: string
|
||||||
|
}
|
||||||
|
|
||||||
export type AdminParametrosBusqueda = {
|
export type AdminParametrosBusqueda = {
|
||||||
cantidadhabitaciones: number=0,
|
cantidadhabitaciones: number=0,
|
||||||
tipopropiedad: number=0,
|
tipopropiedad: number=0,
|
||||||
|
|||||||
@@ -46,4 +46,10 @@ public class RepositorioNotificaciones : RepositorioBase<RepositorioNotificacion
|
|||||||
bool hay = con.Notificaciones.Where(x=>x.Leido == false && x.Dnicliente == dni).Any();
|
bool hay = con.Notificaciones.Where(x=>x.Leido == false && x.Dnicliente == dni).Any();
|
||||||
return hay;
|
return hay;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Notificacione? ObtenerNotificacionPorKeys(long dni, DateTime? fecha) {
|
||||||
|
var con = Context;
|
||||||
|
var n = con.Notificaciones.FirstOrDefault(x => x.Dnicliente ==dni && x.Fecha == fecha);
|
||||||
|
return n;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -617,9 +617,16 @@ public class RepositorioPropiedades: RepositorioBase<RepositorioPropiedades> {
|
|||||||
|
|
||||||
var props = con.Propiedades.Include(x=>x.IdServicios).Include(x=>x.IddivisaNavigation)
|
var props = con.Propiedades.Include(x=>x.IdServicios).Include(x=>x.IddivisaNavigation)
|
||||||
.Include(c=>c.IdtipropiedadNavigation)
|
.Include(c=>c.IdtipropiedadNavigation)
|
||||||
.Where(x=>x.Idestado ==4).Skip(pag*10).Take(10);
|
.Where(x=>x.Idestado ==4 && !x.Venta.Any(x=>x.Idestado ==2))
|
||||||
|
.Skip(pag*10).Take(10);
|
||||||
return props;
|
return props;
|
||||||
}
|
}
|
||||||
|
public int ObtenerPaginasDePropiedadesEnVenta(){
|
||||||
|
var con = Context;
|
||||||
|
|
||||||
|
var props = con.Propiedades.Where(x=>x.Idestado ==4 && !x.Venta.Any(x=>x.Idestado ==2)).Count();
|
||||||
|
return (int)Math.Ceiling((double)props / 10);
|
||||||
|
}
|
||||||
|
|
||||||
public IQueryable<Propiedade> ObtenerPropiedadesAVentaPorDni(long dni) {
|
public IQueryable<Propiedade> ObtenerPropiedadesAVentaPorDni(long dni) {
|
||||||
var con = Context;
|
var con = Context;
|
||||||
|
|||||||
@@ -16,6 +16,15 @@ public class RepositorioVentas: RepositorioBase<RepositorioVentas> {
|
|||||||
return Guardar(con);
|
return Guardar(con);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public bool IniciarVenta(Venta v, long dni) {
|
||||||
|
var con = Context;
|
||||||
|
v.Id = (con.Ventas.Any()?con.Ventas.Count():0)+1;
|
||||||
|
|
||||||
|
con.Ventas.Add(v);
|
||||||
|
GenerarLog(con, dni, "Alta Venta espera recibo");
|
||||||
|
return Guardar(con);
|
||||||
|
}
|
||||||
|
|
||||||
public Contrato? ObtenerVentaPorContrato(long idcontrato) {
|
public Contrato? ObtenerVentaPorContrato(long idcontrato) {
|
||||||
var con = Context;
|
var con = Context;
|
||||||
var c = con.Contratos.Include(x=>x.Idcanons).Include(x=>x.IdventaNavigation).ThenInclude(x=>x.IddivisaNavigation)
|
var c = con.Contratos.Include(x=>x.Idcanons).Include(x=>x.IdventaNavigation).ThenInclude(x=>x.IddivisaNavigation)
|
||||||
@@ -93,7 +102,7 @@ public class RepositorioVentas: RepositorioBase<RepositorioVentas> {
|
|||||||
if (cont==null) return false;
|
if (cont==null) return false;
|
||||||
if (cont.Idestado != 4) return false;
|
if (cont.Idestado != 4) return false;
|
||||||
if (cont.Contratos.Any(x=>x.Habilitado == 1 && x.Cancelado == 0)) return false;
|
if (cont.Contratos.Any(x=>x.Habilitado == 1 && x.Cancelado == 0)) return false;
|
||||||
if (cont.Venta.Any(x=>x.Idestado != 3)) return false;
|
if (cont.Venta.Any(x=>x.Idestado == 2)) return false;
|
||||||
|
|
||||||
cont.Monto = monto;
|
cont.Monto = monto;
|
||||||
cont.Iddivisa = iddivisa;
|
cont.Iddivisa = iddivisa;
|
||||||
|
|||||||
Reference in New Issue
Block a user