Inicio del desarrollo del sistema de notificaciones
This commit is contained in:
@@ -33,6 +33,8 @@ public partial class AlquilaFacilContext : DbContext
|
|||||||
|
|
||||||
public virtual DbSet<Grupo> Grupos { get; set; }
|
public virtual DbSet<Grupo> Grupos { get; set; }
|
||||||
|
|
||||||
|
public virtual DbSet<Notificacione> Notificaciones { get; set; }
|
||||||
|
|
||||||
public virtual DbSet<Permiso> Permisos { get; set; }
|
public virtual DbSet<Permiso> Permisos { get; set; }
|
||||||
|
|
||||||
public virtual DbSet<Propiedade> Propiedades { get; set; }
|
public virtual DbSet<Propiedade> Propiedades { get; set; }
|
||||||
@@ -371,6 +373,49 @@ public partial class AlquilaFacilContext : DbContext
|
|||||||
.HasColumnName("nombre");
|
.HasColumnName("nombre");
|
||||||
});
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity<Notificacione>(entity =>
|
||||||
|
{
|
||||||
|
entity.HasKey(e => e.Dnicliente).HasName("PRIMARY");
|
||||||
|
|
||||||
|
entity.HasIndex(e => e.Idpropiedad, "FK_NOTPROP");
|
||||||
|
|
||||||
|
entity.HasIndex(e => e.Dniremitente, "FK_NOTREM");
|
||||||
|
|
||||||
|
entity.Property(e => e.Dnicliente)
|
||||||
|
.HasColumnType("bigint(20)")
|
||||||
|
.HasColumnName("dnicliente");
|
||||||
|
entity.Property(e => e.Accion)
|
||||||
|
.HasMaxLength(15)
|
||||||
|
.HasColumnName("accion");
|
||||||
|
entity.Property(e => e.Dniremitente)
|
||||||
|
.HasColumnType("bigint(20)")
|
||||||
|
.HasColumnName("dniremitente");
|
||||||
|
entity.Property(e => e.Fecha)
|
||||||
|
.HasColumnType("date")
|
||||||
|
.HasColumnName("fecha");
|
||||||
|
entity.Property(e => e.Idpropiedad)
|
||||||
|
.HasColumnType("int(11)")
|
||||||
|
.HasColumnName("idpropiedad");
|
||||||
|
entity.Property(e => e.Mensaje)
|
||||||
|
.HasMaxLength(255)
|
||||||
|
.HasColumnName("mensaje");
|
||||||
|
|
||||||
|
entity.HasOne(d => d.DniclienteNavigation).WithOne(p => p.NotificacioneDniclienteNavigation)
|
||||||
|
.HasForeignKey<Notificacione>(d => d.Dnicliente)
|
||||||
|
.OnDelete(DeleteBehavior.Restrict)
|
||||||
|
.HasConstraintName("FK_NOTCLI");
|
||||||
|
|
||||||
|
entity.HasOne(d => d.DniremitenteNavigation).WithMany(p => p.NotificacioneDniremitenteNavigations)
|
||||||
|
.HasForeignKey(d => d.Dniremitente)
|
||||||
|
.OnDelete(DeleteBehavior.Restrict)
|
||||||
|
.HasConstraintName("FK_NOTREM");
|
||||||
|
|
||||||
|
entity.HasOne(d => d.IdpropiedadNavigation).WithMany(p => p.Notificaciones)
|
||||||
|
.HasForeignKey(d => d.Idpropiedad)
|
||||||
|
.OnDelete(DeleteBehavior.Restrict)
|
||||||
|
.HasConstraintName("FK_NOTPROP");
|
||||||
|
});
|
||||||
|
|
||||||
modelBuilder.Entity<Permiso>(entity =>
|
modelBuilder.Entity<Permiso>(entity =>
|
||||||
{
|
{
|
||||||
entity.HasKey(e => e.Id).HasName("PRIMARY");
|
entity.HasKey(e => e.Id).HasName("PRIMARY");
|
||||||
|
|||||||
@@ -27,6 +27,10 @@ public partial class Cliente
|
|||||||
|
|
||||||
public virtual ICollection<Contrato> ContratoDnipropietarioNavigations { get; set; } = new List<Contrato>();
|
public virtual ICollection<Contrato> ContratoDnipropietarioNavigations { get; set; } = new List<Contrato>();
|
||||||
|
|
||||||
|
public virtual Notificacione? NotificacioneDniclienteNavigation { get; set; }
|
||||||
|
|
||||||
|
public virtual ICollection<Notificacione> NotificacioneDniremitenteNavigations { get; set; } = new List<Notificacione>();
|
||||||
|
|
||||||
public virtual ICollection<Propiedade> Propiedades { get; set; } = new List<Propiedade>();
|
public virtual ICollection<Propiedade> Propiedades { get; set; } = new List<Propiedade>();
|
||||||
|
|
||||||
public virtual ICollection<Venta> VentaIdCompradorNavigations { get; set; } = new List<Venta>();
|
public virtual ICollection<Venta> VentaIdCompradorNavigations { get; set; } = new List<Venta>();
|
||||||
|
|||||||
25
Entidades/Notificacione.cs
Normal file
25
Entidades/Notificacione.cs
Normal file
@@ -0,0 +1,25 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
|
||||||
|
namespace Entidades;
|
||||||
|
|
||||||
|
public partial class Notificacione
|
||||||
|
{
|
||||||
|
public long Dnicliente { get; set; }
|
||||||
|
|
||||||
|
public long Dniremitente { get; set; }
|
||||||
|
|
||||||
|
public DateTime Fecha { get; set; }
|
||||||
|
|
||||||
|
public string Mensaje { get; set; } = null!;
|
||||||
|
|
||||||
|
public string Accion { get; set; } = null!;
|
||||||
|
|
||||||
|
public int Idpropiedad { get; set; }
|
||||||
|
|
||||||
|
public virtual Cliente DniclienteNavigation { get; set; } = null!;
|
||||||
|
|
||||||
|
public virtual Cliente DniremitenteNavigation { get; set; } = null!;
|
||||||
|
|
||||||
|
public virtual Propiedade IdpropiedadNavigation { get; set; } = null!;
|
||||||
|
}
|
||||||
@@ -31,6 +31,8 @@ public partial class Propiedade
|
|||||||
|
|
||||||
public virtual TipoPropiedad IdtipropiedadNavigation { get; set; } = null!;
|
public virtual TipoPropiedad IdtipropiedadNavigation { get; set; } = null!;
|
||||||
|
|
||||||
|
public virtual ICollection<Notificacione> Notificaciones { get; set; } = new List<Notificacione>();
|
||||||
|
|
||||||
public virtual ICollection<Venta> Venta { get; set; } = new List<Venta>();
|
public virtual ICollection<Venta> Venta { get; set; } = new List<Venta>();
|
||||||
|
|
||||||
public virtual ICollection<Servicio> IdServicios { get; set; } = new List<Servicio>();
|
public virtual ICollection<Servicio> IdServicios { get; set; } = new List<Servicio>();
|
||||||
|
|||||||
@@ -1,7 +1,75 @@
|
|||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
|
import { onMount } from "svelte";
|
||||||
import NavBarAutocompletable from "../Componentes/NavBarAutocompletable.svelte";
|
import NavBarAutocompletable from "../Componentes/NavBarAutocompletable.svelte";
|
||||||
|
import type { MensajeDto } from "../types";
|
||||||
|
import ModalEstatico from "../Componentes/ModalEstatico.svelte";
|
||||||
|
|
||||||
|
const token = sessionStorage.getItem("token");
|
||||||
|
let mensajes: MensajeDto[] = $state([]);
|
||||||
|
let showspinner:boolean =$state(false);
|
||||||
|
let mostrarleidos: boolean = $state(false);
|
||||||
|
let modaldata:string =$state("");
|
||||||
|
|
||||||
|
onMount(async () => {
|
||||||
|
showspinner = true;
|
||||||
|
SinLeer();
|
||||||
|
})
|
||||||
|
|
||||||
|
async function SinLeer() {
|
||||||
|
mostrarleidos = false;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
async function Leidos() {
|
||||||
|
mostrarleidos = true;
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<NavBarAutocompletable/>
|
<NavBarAutocompletable/>
|
||||||
|
|
||||||
|
{#if modaldata}
|
||||||
|
<ModalEstatico payload={modaldata} close={()=>!!(modaldata = "")} />
|
||||||
|
{/if}
|
||||||
|
|
||||||
|
<div class="container">
|
||||||
|
<br>
|
||||||
|
|
||||||
|
<div class="btn-group">
|
||||||
|
<button class="btn btn-primary" class:active={mostrarleidos==false} onclick={SinLeer} >Sin Leer</button>
|
||||||
|
<button class="btn btn-primary" class:active={mostrarleidos==true} onclick={Leidos} >Leidos</button>
|
||||||
|
</div>
|
||||||
|
<br>
|
||||||
|
<div class="container-fluid" style="margin-top: 1cm;">
|
||||||
|
{#if showspinner}
|
||||||
|
<div class=" justify-content-center position-absolute top-50 start-50">
|
||||||
|
<div class="spinner-border" role="status"></div>
|
||||||
|
Cargando...
|
||||||
|
|
||||||
|
</div>
|
||||||
|
{:else}
|
||||||
|
<table class="table table-responsive table-striped table-hover">
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th>Remitente</th>
|
||||||
|
<th>Accion</th>
|
||||||
|
<th>Mensaje</th>
|
||||||
|
<th>Fecha</th>
|
||||||
|
<th>Propiedad</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
|
||||||
|
<tbody>
|
||||||
|
{#each mensajes as men }
|
||||||
|
<tr>
|
||||||
|
<td>men.remitente</td>
|
||||||
|
<td>men.accion</td>
|
||||||
|
<td>men.mensaje</td>
|
||||||
|
<td>men.fecha</td>
|
||||||
|
<td>men.propiedad</td>
|
||||||
|
</tr>
|
||||||
|
{/each}
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
{/if}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
9
Front/src/types.d.ts
vendored
9
Front/src/types.d.ts
vendored
@@ -54,3 +54,12 @@ export type Propiedad = {
|
|||||||
idtipropiedad: number,
|
idtipropiedad: number,
|
||||||
monto: number
|
monto: number
|
||||||
};
|
};
|
||||||
|
|
||||||
|
export type MensajeDto = {
|
||||||
|
remitente: string,
|
||||||
|
accion: string,
|
||||||
|
mensaje: string,
|
||||||
|
fecha: Date,
|
||||||
|
propiedad: string,
|
||||||
|
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user