Compare commits
4 Commits
acciones_a
...
fixbotones
| Author | SHA1 | Date | |
|---|---|---|---|
| 50bb59e15f | |||
| d2a7368dee | |||
| feb4db86c0 | |||
| 80c778d91a |
@@ -1,25 +0,0 @@
|
|||||||
|
|
||||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
|
||||||
# Visual Studio Version 17
|
|
||||||
VisualStudioVersion = 17.5.002.0
|
|
||||||
MinimumVisualStudioVersion = 10.0.40219.1
|
|
||||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "AlquilaFacil", "AlquilaFacil.csproj", "{76BA8B31-BAD3-49CD-B8B8-BE22D8AEA281}"
|
|
||||||
EndProject
|
|
||||||
Global
|
|
||||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
|
||||||
Debug|Any CPU = Debug|Any CPU
|
|
||||||
Release|Any CPU = Release|Any CPU
|
|
||||||
EndGlobalSection
|
|
||||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
|
||||||
{76BA8B31-BAD3-49CD-B8B8-BE22D8AEA281}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
|
||||||
{76BA8B31-BAD3-49CD-B8B8-BE22D8AEA281}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
|
||||||
{76BA8B31-BAD3-49CD-B8B8-BE22D8AEA281}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
|
||||||
{76BA8B31-BAD3-49CD-B8B8-BE22D8AEA281}.Release|Any CPU.Build.0 = Release|Any CPU
|
|
||||||
EndGlobalSection
|
|
||||||
GlobalSection(SolutionProperties) = preSolution
|
|
||||||
HideSolutionNode = FALSE
|
|
||||||
EndGlobalSection
|
|
||||||
GlobalSection(ExtensibilityGlobals) = postSolution
|
|
||||||
SolutionGuid = {CF93AFAC-32EF-4993-84A2-CA2EB32F58FF}
|
|
||||||
EndGlobalSection
|
|
||||||
EndGlobal
|
|
||||||
@@ -1,24 +1,40 @@
|
|||||||
|
using System.ComponentModel.DataAnnotations;
|
||||||
using Entidades.Dto;
|
using Entidades.Dto;
|
||||||
using Microsoft.AspNetCore.Mvc;
|
using Microsoft.AspNetCore.Mvc;
|
||||||
using Modelo;
|
using Modelo;
|
||||||
|
using System.Text.Json;
|
||||||
|
|
||||||
|
|
||||||
namespace AlquilaFacil.Controllers;
|
namespace AlquilaFacil.Controllers;
|
||||||
|
|
||||||
[ApiController]
|
[ApiController]
|
||||||
public class AccionesController: ControllerBase {
|
public class AccionesController: ControllerBase {
|
||||||
|
|
||||||
//Reutilizo el loginDto pero no lleno el campo de contraseña
|
[HttpGet("api/acciones")]
|
||||||
[HttpPost("api/acciones")]
|
public IActionResult ListarAccionesPorUsuario([FromHeader(Name ="Email")] string Email, [FromHeader(Name = "Auth")] string Auth) {
|
||||||
public IActionResult ListarAccionesPorUsuario([FromBody] LoginDto email, [FromHeader(Name = "Auth")] string Auth) {
|
if (Email == "" || Email == null) return BadRequest();
|
||||||
if (email.Email == "" || email.Email == null) return BadRequest();
|
|
||||||
|
|
||||||
if (Auth == "") return Unauthorized(new { esValido = false});
|
if (Auth == "") return Unauthorized(new { esValido = false});
|
||||||
|
|
||||||
bool esValido = RepositorioUsuarios.Singleton.CheckToken(email.Email, Auth);
|
bool esValido = RepositorioUsuarios.Singleton.CheckToken(Email, Auth);
|
||||||
if (!esValido) return Unauthorized();
|
if (!esValido) return Unauthorized();
|
||||||
|
|
||||||
var Permisos = RepositorioPermisos.Singleton.ListarPermisos(email.Email);
|
var Permisos = RepositorioPermisos.Singleton.ListarPermisos(Email);
|
||||||
Response.Headers["Content-Type"] = "application/json";
|
Response.Headers["Content-Type"] = "application/json";
|
||||||
return Ok(Permisos);
|
return Ok(Permisos);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[HttpPost("api/acciones/grupo")]
|
||||||
|
public IActionResult ListarAccionesPorGrupo([FromHeader(Name = "Auth")] string Auth,
|
||||||
|
[FromBody] AccionesPorGrupoDto req) {
|
||||||
|
if (string.IsNullOrEmpty(Auth)) return BadRequest();
|
||||||
|
bool esValido = RepositorioUsuarios.Singleton.CheckToken(req.Email, Auth);
|
||||||
|
if (esValido == false) return BadRequest(esValido);
|
||||||
|
|
||||||
|
bool tieneGrupo = RepositorioUsuarios.Singleton.CheckGrupo(req.Email, req.Grupo);
|
||||||
|
if (tieneGrupo == false) return Unauthorized();
|
||||||
|
|
||||||
|
var permisos = RepositorioGrupos.Singleton.ListarPermisosDeGrupo(req.Grupo);
|
||||||
|
return Ok(permisos);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -16,11 +16,6 @@ public class GruposController: ControllerBase {
|
|||||||
bool ret = RepositorioGrupos.Singleton.CrearGrupo(grupo.descripcion);
|
bool ret = RepositorioGrupos.Singleton.CrearGrupo(grupo.descripcion);
|
||||||
return (ret) ? Ok(ret) : BadRequest();
|
return (ret) ? Ok(ret) : BadRequest();
|
||||||
}
|
}
|
||||||
|
|
||||||
[HttpGet("api/admin/grupos")]
|
|
||||||
public IActionResult ListarGrupo(){
|
|
||||||
return Ok(RepositorioGrupos.Singleton.Listar());
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public record AdminGrupo(string descripcion);
|
public record AdminGrupo(string descripcion);
|
||||||
|
|||||||
2
Entidades/Dto/AccionesDeGrupo.cs
Normal file
2
Entidades/Dto/AccionesDeGrupo.cs
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
namespace Entidades.Dto;
|
||||||
|
public record AccionesPorGrupoDto(string Email, string Grupo);
|
||||||
@@ -1,5 +1,6 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using System.Text.Json.Serialization;
|
||||||
|
|
||||||
namespace Entidades;
|
namespace Entidades;
|
||||||
|
|
||||||
@@ -9,6 +10,7 @@ public partial class Grupo
|
|||||||
|
|
||||||
public string Nombre { get; set; } = null!;
|
public string Nombre { get; set; } = null!;
|
||||||
|
|
||||||
|
[JsonIgnore]
|
||||||
public virtual ICollection<Cliente> Idclientes { get; set; } = new List<Cliente>();
|
public virtual ICollection<Cliente> Idclientes { get; set; } = new List<Cliente>();
|
||||||
|
|
||||||
public virtual ICollection<Permiso> Idpermisos { get; set; } = new List<Permiso>();
|
public virtual ICollection<Permiso> Idpermisos { get; set; } = new List<Permiso>();
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
<html lang="en">
|
<html lang="en">
|
||||||
<head>
|
<head>
|
||||||
<meta charset="UTF-8" />
|
<meta charset="UTF-8" />
|
||||||
<link rel="icon" type="image/png" href="/favicon.png" />
|
<link rel="icon" type="image/png" href="/favicon.svg" />
|
||||||
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/css/bootstrap.min.css"/>
|
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/css/bootstrap.min.css"/>
|
||||||
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/js/bootstrap.bundle.min.js"></script>
|
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/js/bootstrap.bundle.min.js"></script>
|
||||||
|
|
||||||
|
|||||||
Binary file not shown.
|
Before Width: | Height: | Size: 41 KiB |
4
Front/public/favicon.svg
Normal file
4
Front/public/favicon.svg
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="white" class="size-6">
|
||||||
|
<path fill-rule="evenodd" d="M4.125 3C3.089 3 2.25 3.84 2.25 4.875V18a3 3 0 0 0 3 3h15a3 3 0 0 1-3-3V4.875C17.25 3.839 16.41 3 15.375 3H4.125ZM12 9.75a.75.75 0 0 0 0 1.5h1.5a.75.75 0 0 0 0-1.5H12Zm-.75-2.25a.75.75 0 0 1 .75-.75h1.5a.75.75 0 0 1 0 1.5H12a.75.75 0 0 1-.75-.75ZM6 12.75a.75.75 0 0 0 0 1.5h7.5a.75.75 0 0 0 0-1.5H6Zm-.75 3.75a.75.75 0 0 1 .75-.75h7.5a.75.75 0 0 1 0 1.5H6a.75.75 0 0 1-.75-.75ZM6 6.75a.75.75 0 0 0-.75.75v3c0 .414.336.75.75.75h3a.75.75 0 0 0 .75-.75v-3A.75.75 0 0 0 9 6.75H6Z" clip-rule="evenodd" />
|
||||||
|
<path d="M18.75 6.75h1.875c.621 0 1.125.504 1.125 1.125V18a1.5 1.5 0 0 1-3 0V6.75Z" />
|
||||||
|
</svg>
|
||||||
|
After Width: | Height: | Size: 715 B |
@@ -1,25 +1,38 @@
|
|||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import Login from "./login/loginPage.svelte";
|
import Login from "./paginas/login.svelte";
|
||||||
import { Router, Route, link } from 'svelte-routing';
|
import { Router, Route, link } from 'svelte-routing';
|
||||||
import MenuPage from './Menu/page.svelte';
|
import MenuPage from './paginas/menu.svelte';
|
||||||
import ProteRoute from './lib/RutaProtegida.svelte';
|
import ProteRoute from './Componentes/RutaProtegida.svelte';
|
||||||
import InfoPage from './Info/page.svelte';
|
import InfoPage from './paginas/info.svelte';
|
||||||
import InqPage from "./Inquilino/page.svelte";
|
import InqPage from "./paginas/inquilino.svelte";
|
||||||
import PropPage from "./Propietario/page.svelte";
|
import PropPage from "./paginas/propietario.svelte";
|
||||||
|
import FrontAdmin from "./paginas/grupos/AdminG.svelte";
|
||||||
|
import FrontEstadistica from "./paginas/grupos/EstadisticaG.svelte";
|
||||||
|
import FrontInquilino from "./paginas/grupos/InquilinoG.svelte";
|
||||||
|
import FrontPropietario from "./paginas/grupos/PropietarioG.svelte";
|
||||||
|
import PublicarPropiedad from "./paginas/PublicarPropiedad.svelte";
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<Router>
|
<Router>
|
||||||
|
<!-- Plantilla path
|
||||||
|
<Route path="">
|
||||||
|
<ProteRoute componente={}/>
|
||||||
|
</Route>
|
||||||
|
-->
|
||||||
|
|
||||||
<Route path="/" component={Login} />
|
<Route path="/" component={Login} />
|
||||||
<Route path="/Info" component={InfoPage} />
|
<Route path="/Info" component={InfoPage} />
|
||||||
|
|
||||||
<Route path="/inqtest" component={InqPage} />
|
|
||||||
|
|
||||||
|
|
||||||
<Route path="/Menu">
|
<Route path="/Menu">
|
||||||
<ProteRoute componente={MenuPage} />
|
<ProteRoute componente={MenuPage} />
|
||||||
</Route>
|
</Route>
|
||||||
|
|
||||||
|
<!--Publicar Propiedad-->
|
||||||
|
<Route path="/accion/1">
|
||||||
|
<ProteRoute componente={PublicarPropiedad}/>
|
||||||
|
</Route>
|
||||||
|
|
||||||
<!--Crear Cuenta Inquilino-->
|
<!--Crear Cuenta Inquilino-->
|
||||||
<Route path="/accion/4">
|
<Route path="/accion/4">
|
||||||
<ProteRoute componente={InqPage}/>
|
<ProteRoute componente={InqPage}/>
|
||||||
@@ -29,5 +42,19 @@
|
|||||||
<Route path="/accion/5">
|
<Route path="/accion/5">
|
||||||
<ProteRoute componente={PropPage}/>
|
<ProteRoute componente={PropPage}/>
|
||||||
</Route>
|
</Route>
|
||||||
|
|
||||||
|
<Route path="/grupo/Inquilino">
|
||||||
|
<ProteRoute componente={FrontInquilino}/>
|
||||||
|
</Route>
|
||||||
|
<Route path="/grupo/Propietario">
|
||||||
|
<ProteRoute componente={FrontPropietario}/>
|
||||||
|
</Route>
|
||||||
|
<Route path="/grupo/Admin">
|
||||||
|
<ProteRoute componente={FrontAdmin}/>
|
||||||
|
</Route>
|
||||||
|
<Route path="/grupo/Estadistica">
|
||||||
|
<ProteRoute componente={FrontEstadistica}/>
|
||||||
|
</Route>
|
||||||
|
|
||||||
</Router>
|
</Router>
|
||||||
|
|
||||||
|
|||||||
48
Front/src/Componentes/ListaAcciones.svelte
Normal file
48
Front/src/Componentes/ListaAcciones.svelte
Normal file
@@ -0,0 +1,48 @@
|
|||||||
|
<script lang="ts">
|
||||||
|
import { onMount } from "svelte";
|
||||||
|
import { writable } from "svelte/store";
|
||||||
|
|
||||||
|
type Permiso = {
|
||||||
|
id: number;
|
||||||
|
descripcion: string;
|
||||||
|
};
|
||||||
|
|
||||||
|
let permisos = writable<Permiso[]>([]);
|
||||||
|
|
||||||
|
onMount(()=> {
|
||||||
|
HandlePermisos();
|
||||||
|
});
|
||||||
|
|
||||||
|
const email = localStorage.getItem("email");
|
||||||
|
const path = location.pathname;
|
||||||
|
const token = sessionStorage.getItem("token");
|
||||||
|
|
||||||
|
async function HandlePermisos() {
|
||||||
|
const match = path.match(/\/grupo\/(.+)/);
|
||||||
|
const grupo = match ? match[1] : null;
|
||||||
|
try {
|
||||||
|
const response = await fetch("http://localhost:5007/api/acciones/grupo",{
|
||||||
|
method: 'POST',
|
||||||
|
headers: {
|
||||||
|
'Auth' : String(token),
|
||||||
|
'Content-Type' : "application/json"
|
||||||
|
},
|
||||||
|
body: JSON.stringify({email, grupo}),
|
||||||
|
});
|
||||||
|
if (response.ok) {
|
||||||
|
const json = await response.json();
|
||||||
|
permisos.set(json);
|
||||||
|
}
|
||||||
|
} catch (e) {
|
||||||
|
console.error(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<div class="list-group">
|
||||||
|
{#each $permisos as item}
|
||||||
|
<a href="/accion/{item.id}" class="list-group-item list-group-item-action">
|
||||||
|
{item.descripcion}
|
||||||
|
</a>
|
||||||
|
{/each}
|
||||||
|
</div>
|
||||||
@@ -2,28 +2,33 @@
|
|||||||
import { Navbar, NavbarBrand, NavbarToggler, NavItem, Nav, NavLink, Collapse } from "@sveltestrap/sveltestrap";
|
import { Navbar, NavbarBrand, NavbarToggler, NavItem, Nav, NavLink, Collapse } from "@sveltestrap/sveltestrap";
|
||||||
import { onMount } from "svelte";
|
import { onMount } from "svelte";
|
||||||
import { writable } from 'svelte/store';
|
import { writable } from 'svelte/store';
|
||||||
|
import './css/popup.css';
|
||||||
let isOpen: boolean = $state(false);
|
let isOpen: boolean = $state(false);
|
||||||
|
|
||||||
interface Permiso {
|
type Permiso = {
|
||||||
id: number;
|
id: number;
|
||||||
descripcion: string;
|
descripcion: string;
|
||||||
}
|
};
|
||||||
|
|
||||||
const permisos = writable<Permiso[]>([]);
|
type Grupo = {
|
||||||
|
id: number;
|
||||||
|
nombre: string;
|
||||||
|
idpermisos: Permiso[];
|
||||||
|
};
|
||||||
|
|
||||||
|
const permisos = writable<Grupo[]>([]);
|
||||||
const email = localStorage.getItem('email');
|
const email = localStorage.getItem('email');
|
||||||
const token = sessionStorage.getItem('token');
|
const token = sessionStorage.getItem('token');
|
||||||
|
|
||||||
|
|
||||||
async function obtenerPermisos(){
|
async function obtenerPermisos(){
|
||||||
try {
|
try {
|
||||||
const response = await fetch("http://localhost:5007/api/acciones",{
|
const response = await fetch("http://localhost:5007/api/acciones",{
|
||||||
method: 'POST',
|
method: 'GET',
|
||||||
headers: {
|
headers: {
|
||||||
'Auth' : String(token),
|
'Auth' : String(token),
|
||||||
|
'Email' : String(email),
|
||||||
'Content-Type' : "application/json"
|
'Content-Type' : "application/json"
|
||||||
},
|
},
|
||||||
body: JSON.stringify({email})
|
|
||||||
});
|
});
|
||||||
if (response.ok){
|
if (response.ok){
|
||||||
const json = await response.json();
|
const json = await response.json();
|
||||||
@@ -36,17 +41,21 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$inspect(permisos);
|
|
||||||
onMount( () => {
|
onMount( () => {
|
||||||
obtenerPermisos();
|
obtenerPermisos();
|
||||||
})
|
})
|
||||||
|
|
||||||
|
function redirijir(path: string){
|
||||||
|
location.replace(path);
|
||||||
|
}
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<Navbar container="xxl" expand="md" color="dark-subtle">
|
<Navbar container="xxl" expand="md" color="dark-subtle">
|
||||||
<NavbarBrand href="/">
|
<NavbarBrand href="/">
|
||||||
AlquilaFacil
|
AlquilaFacil
|
||||||
</NavbarBrand>
|
</NavbarBrand>
|
||||||
<div class="card">
|
<div class="badge">
|
||||||
<a href="/Menu">
|
<a href="/Menu">
|
||||||
<img src="/home.svg" alt="Volver al Menú"/>
|
<img src="/home.svg" alt="Volver al Menú"/>
|
||||||
</a>
|
</a>
|
||||||
@@ -55,9 +64,20 @@
|
|||||||
<Collapse isOpen={isOpen} navbar expand="md">
|
<Collapse isOpen={isOpen} navbar expand="md">
|
||||||
<Nav class="ms-auto" navbar>
|
<Nav class="ms-auto" navbar>
|
||||||
{#each $permisos as item }
|
{#each $permisos as item }
|
||||||
<NavItem>
|
<div class="dropdown">
|
||||||
<NavLink href="/accion/{item.id}">{item.descripcion}</NavLink>
|
<div class="btn-group" style="margin-left: 3px; margin-top: 3px">
|
||||||
</NavItem>
|
<button class="btn btn-secondary" onclick={() => redirijir("/grupo/"+item.nombre)} >{item.nombre}</button>
|
||||||
|
<button class="btn btn-secondary dropdown-toggle dropdown-toggle-split" type="button" data-bs-toggle="dropdown" aria-expanded="false">
|
||||||
|
<span class="visually-hidden">Toggle Dropdown</span>
|
||||||
|
</button>
|
||||||
|
<ul class="dropdown-menu dropdown-menu-end" >
|
||||||
|
{#each item.idpermisos as perm}
|
||||||
|
<li class="dropdown-item"><a class="link-underline-opacity-0 link-underline" href="/accion/{perm.id}">{perm.descripcion}</a></li>
|
||||||
|
<li><hr class="dropdown-divider"></li>
|
||||||
|
{/each}
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
{/each}
|
{/each}
|
||||||
</Nav>
|
</Nav>
|
||||||
</Collapse>
|
</Collapse>
|
||||||
38
Front/src/Componentes/css/popup.css
Normal file
38
Front/src/Componentes/css/popup.css
Normal file
@@ -0,0 +1,38 @@
|
|||||||
|
@keyframes rollDown {
|
||||||
|
from {
|
||||||
|
opacity: 0;
|
||||||
|
transform: rotateX(-90deg);
|
||||||
|
transform-origin: top;
|
||||||
|
}
|
||||||
|
to {
|
||||||
|
opacity: 1;
|
||||||
|
transform: rotateX(0deg);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@keyframes rollUp {
|
||||||
|
from {
|
||||||
|
opacity: 1;
|
||||||
|
transform: rotateX(0deg);
|
||||||
|
}
|
||||||
|
to {
|
||||||
|
opacity: 0;
|
||||||
|
transform: rotateX(-90deg);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.dropdown-menu {
|
||||||
|
display: none;
|
||||||
|
animation: none;
|
||||||
|
transform-origin: top;
|
||||||
|
}
|
||||||
|
|
||||||
|
.dropdown-menu.show {
|
||||||
|
animation: rollDown 0.5s ease forwards;
|
||||||
|
display: block;
|
||||||
|
}
|
||||||
|
|
||||||
|
.dropdown-menu.hide {
|
||||||
|
animation: rollUp 0.5s ease forwards;
|
||||||
|
display: block;
|
||||||
|
}
|
||||||
@@ -1,6 +0,0 @@
|
|||||||
<script>
|
|
||||||
import NavBarAuto from "../lib/NavBarAutocompletable.svelte";
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<NavBarAuto/>
|
|
||||||
hol
|
|
||||||
@@ -1,10 +0,0 @@
|
|||||||
<script lang="ts">
|
|
||||||
import Login from "../lib/login.svelte"
|
|
||||||
import Navbar from "../lib/NavBarLogin.svelte";
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<Navbar/>
|
|
||||||
<div class="position-relative">
|
|
||||||
<br>
|
|
||||||
<Login/>
|
|
||||||
</div>
|
|
||||||
91
Front/src/paginas/PublicarPropiedad.svelte
Normal file
91
Front/src/paginas/PublicarPropiedad.svelte
Normal file
@@ -0,0 +1,91 @@
|
|||||||
|
<script lang="ts">
|
||||||
|
import NavBarAutocompletable from "../Componentes/NavBarAutocompletable.svelte";
|
||||||
|
type Propiedad = {
|
||||||
|
ubicacion: string,
|
||||||
|
canthabitaciones: number,
|
||||||
|
piso: number,
|
||||||
|
letra: string,
|
||||||
|
email: string,
|
||||||
|
idtipropiedad: number,
|
||||||
|
}
|
||||||
|
let propiedad: Propiedad = {
|
||||||
|
ubicacion: "",
|
||||||
|
canthabitaciones: 1,
|
||||||
|
piso: 0,
|
||||||
|
letra: "",
|
||||||
|
email: "",
|
||||||
|
idtipropiedad: 1,
|
||||||
|
};
|
||||||
|
|
||||||
|
const submitForm = () => {
|
||||||
|
console.log("Formulario enviado:", propiedad);
|
||||||
|
};
|
||||||
|
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<NavBarAutocompletable/>
|
||||||
|
<div class="container mt-4">
|
||||||
|
<h2>Registrar Propiedad</h2>
|
||||||
|
<form on:submit|preventDefault={submitForm}>
|
||||||
|
<div class="form-floating mb-3">
|
||||||
|
<input
|
||||||
|
type="text"
|
||||||
|
id="ubicacion"
|
||||||
|
class="form-control"
|
||||||
|
bind:value={propiedad.ubicacion}
|
||||||
|
placeholder="Ubicación"
|
||||||
|
required
|
||||||
|
/>
|
||||||
|
<label for="ubicacion">Ubicación</label>
|
||||||
|
</div>
|
||||||
|
<div class="form-floating mb-3">
|
||||||
|
<input
|
||||||
|
type="number"
|
||||||
|
id="canthabitaciones"
|
||||||
|
class="form-control"
|
||||||
|
bind:value={propiedad.canthabitaciones}
|
||||||
|
min="1"
|
||||||
|
placeholder="Cantidad de Habitaciones"
|
||||||
|
required
|
||||||
|
/>
|
||||||
|
<label for="canthabitaciones">Cantidad de Habitaciones</label>
|
||||||
|
</div>
|
||||||
|
<div class="form-floating mb-3">
|
||||||
|
<input
|
||||||
|
type="number"
|
||||||
|
id="piso"
|
||||||
|
class="form-control"
|
||||||
|
bind:value={propiedad.piso}
|
||||||
|
min="0"
|
||||||
|
placeholder="Piso"
|
||||||
|
/>
|
||||||
|
<label for="piso">Piso</label>
|
||||||
|
</div>
|
||||||
|
<div class="form-floating mb-3">
|
||||||
|
<input
|
||||||
|
type="text"
|
||||||
|
id="letra"
|
||||||
|
class="form-control"
|
||||||
|
bind:value={propiedad.letra}
|
||||||
|
maxlength="1"
|
||||||
|
placeholder="Letra"
|
||||||
|
/>
|
||||||
|
<label for="letra">Letra</label>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-floating mb-3">
|
||||||
|
<select
|
||||||
|
id="idtipropiedad"
|
||||||
|
class="form-select"
|
||||||
|
bind:value={propiedad.idtipropiedad}
|
||||||
|
required
|
||||||
|
>
|
||||||
|
<option value="1">Casa</option>
|
||||||
|
<option value="2">Departamento</option>
|
||||||
|
<option value="3">Oficina</option>
|
||||||
|
</select>
|
||||||
|
<label for="idtipropiedad">Tipo de Propiedad</label>
|
||||||
|
</div>
|
||||||
|
<button type="submit" class="btn btn-primary">Enviar</button>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
14
Front/src/paginas/grupos/AdminG.svelte
Normal file
14
Front/src/paginas/grupos/AdminG.svelte
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
<script lang="ts">
|
||||||
|
import ListaAcciones from "../../Componentes/ListaAcciones.svelte";
|
||||||
|
import NavBarAutocompletable from "../../Componentes/NavBarAutocompletable.svelte";
|
||||||
|
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<NavBarAutocompletable/>
|
||||||
|
<div class="container mt-5">
|
||||||
|
<div class="text-center mb-4">
|
||||||
|
<h1>Perfil del Administrador</h1>
|
||||||
|
<p>Gestiona las cuentas de usuarios, propiedades y permisos desde aquí.</p>
|
||||||
|
</div>
|
||||||
|
<ListaAcciones/>
|
||||||
|
</div>
|
||||||
5
Front/src/paginas/grupos/EstadisticaG.svelte
Normal file
5
Front/src/paginas/grupos/EstadisticaG.svelte
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
<script lang="ts">
|
||||||
|
import NavBarAutocompletable from "../../Componentes/NavBarAutocompletable.svelte";
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<NavBarAutocompletable/>
|
||||||
14
Front/src/paginas/grupos/InquilinoG.svelte
Normal file
14
Front/src/paginas/grupos/InquilinoG.svelte
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
<script lang="ts">
|
||||||
|
import ListaAcciones from "../../Componentes/ListaAcciones.svelte";
|
||||||
|
import NavBarAutocompletable from "../../Componentes/NavBarAutocompletable.svelte";
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<NavBarAutocompletable/>
|
||||||
|
|
||||||
|
<div class="container mt-5">
|
||||||
|
<div class="text-center mb-4">
|
||||||
|
<h1>Perfil del Inquilino</h1>
|
||||||
|
<p>Gestiona tus Pagos y Busca Propiedades desde aquí.</p>
|
||||||
|
</div>
|
||||||
|
<ListaAcciones/>
|
||||||
|
</div>
|
||||||
13
Front/src/paginas/grupos/PropietarioG.svelte
Normal file
13
Front/src/paginas/grupos/PropietarioG.svelte
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
<script lang="ts">
|
||||||
|
import ListaAcciones from "../../Componentes/ListaAcciones.svelte";
|
||||||
|
import NavBarAutocompletable from "../../Componentes/NavBarAutocompletable.svelte";
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<NavBarAutocompletable/>
|
||||||
|
<div class="container mt-5">
|
||||||
|
<div class="text-center mb-4">
|
||||||
|
<h1>Perfil del Propietario</h1>
|
||||||
|
<p>Gestiona tus propiedades y servicios desde aquí.</p>
|
||||||
|
</div>
|
||||||
|
<ListaAcciones/>
|
||||||
|
</div>
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
<script>
|
<script>
|
||||||
import NavBarLogin from "../lib/NavBarLogin.svelte";
|
import NavBarLogin from "../Componentes/NavBarLogin.svelte";
|
||||||
import BarraTexto from "../lib/BarraHorizontalConTexto.svelte";
|
import BarraTexto from "../Componentes/BarraHorizontalConTexto.svelte";
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<NavBarLogin/><br>
|
<NavBarLogin/><br>
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import FormPostInq from "../lib/FormPostCli.svelte";
|
import FormPostInq from "../Componentes/FormPostCli.svelte";
|
||||||
import NavBarAutocompletable from "../lib/NavBarAutocompletable.svelte";
|
import NavBarAutocompletable from "../Componentes/NavBarAutocompletable.svelte";
|
||||||
import TextBar from "../lib/BarraHorizontalConTexto.svelte";
|
import TextBar from "../Componentes/BarraHorizontalConTexto.svelte";
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<NavBarAutocompletable/>
|
<NavBarAutocompletable/>
|
||||||
10
Front/src/paginas/login.svelte
Normal file
10
Front/src/paginas/login.svelte
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
<script lang="ts">
|
||||||
|
import Login from "../Componentes/login.svelte"
|
||||||
|
import Navbar from "../Componentes/NavBarLogin.svelte";
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<Navbar/>
|
||||||
|
<div class="position-relative">
|
||||||
|
<br>
|
||||||
|
<Login/>
|
||||||
|
</div>
|
||||||
6
Front/src/paginas/menu.svelte
Normal file
6
Front/src/paginas/menu.svelte
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
<script>
|
||||||
|
import NavBarAuto from "../Componentes/NavBarAutocompletable.svelte";
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<NavBarAuto/>
|
||||||
|
hol
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import FormPostInq from "../lib/FormPostCli.svelte";
|
import FormPostInq from "../Componentes/FormPostCli.svelte";
|
||||||
import NavBarAutocompletable from "../lib/NavBarAutocompletable.svelte";
|
import NavBarAutocompletable from "../Componentes/NavBarAutocompletable.svelte";
|
||||||
import TextBar from "../lib/BarraHorizontalConTexto.svelte";
|
import TextBar from "../Componentes/BarraHorizontalConTexto.svelte";
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<NavBarAutocompletable/>
|
<NavBarAutocompletable/>
|
||||||
@@ -19,9 +19,9 @@ public class RepositorioGrupos: RepositorioBase<RepositorioGrupos> {
|
|||||||
return Guardar(con);
|
return Guardar(con);
|
||||||
}
|
}
|
||||||
|
|
||||||
public object? Listar()
|
public IQueryable<Permiso> ListarPermisosDeGrupo(string grupo) {
|
||||||
{
|
var con = Context;
|
||||||
return Context.Grupos.Include(x => x.Idpermisos);
|
return con.Grupos.Where(x=>x.Nombre == grupo).SelectMany(x => x.Idpermisos);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ using Microsoft.EntityFrameworkCore;
|
|||||||
|
|
||||||
namespace Modelo;
|
namespace Modelo;
|
||||||
public class RepositorioPermisos: RepositorioBase<RepositorioPermisos> {
|
public class RepositorioPermisos: RepositorioBase<RepositorioPermisos> {
|
||||||
public IQueryable<Permiso>? ListarPermisos(string email) {
|
public object? ListarPermisos(string email) {
|
||||||
var con = Context;
|
var con = Context;
|
||||||
Cliente? cli = con.Clientes.Include(x => x.Idgrupos).FirstOrDefault(c => c.Email == email);
|
Cliente? cli = con.Clientes.Include(x => x.Idgrupos).FirstOrDefault(c => c.Email == email);
|
||||||
if (cli == null) return null;
|
if (cli == null) return null;
|
||||||
@@ -12,8 +12,8 @@ public class RepositorioPermisos: RepositorioBase<RepositorioPermisos> {
|
|||||||
var list = con.Clientes
|
var list = con.Clientes
|
||||||
.Where(c => c.Dni == cli.Dni)
|
.Where(c => c.Dni == cli.Dni)
|
||||||
.SelectMany(c => c.Idgrupos)
|
.SelectMany(c => c.Idgrupos)
|
||||||
.SelectMany(g => g.Idpermisos)
|
.Include(x=> x.Idpermisos);
|
||||||
.Distinct();
|
|
||||||
return list;
|
return list;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Reflection.Metadata.Ecma335;
|
using System.Reflection.Metadata.Ecma335;
|
||||||
|
using System.Runtime.ConstrainedExecution;
|
||||||
using Entidades;
|
using Entidades;
|
||||||
using Entidades.Dto;
|
using Entidades.Dto;
|
||||||
using Microsoft.EntityFrameworkCore;
|
using Microsoft.EntityFrameworkCore;
|
||||||
@@ -76,7 +77,8 @@ public class RepositorioPropiedades: RepositorioBase<RepositorioPropiedades>
|
|||||||
|
|
||||||
public bool BajaPropiedad(int id) {
|
public bool BajaPropiedad(int id) {
|
||||||
var con = Context;
|
var con = Context;
|
||||||
Propiedade prop = con.Propiedades.Find(id);
|
Propiedade? prop = con.Propiedades.Find(id);
|
||||||
|
if (prop == null) return false;
|
||||||
prop.Idestado = 3;
|
prop.Idestado = 3;
|
||||||
|
|
||||||
return Guardar(con);
|
return Guardar(con);
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ using System.Security.Cryptography;
|
|||||||
using System.Text;
|
using System.Text;
|
||||||
using Entidades.Dto;
|
using Entidades.Dto;
|
||||||
using Entidades;
|
using Entidades;
|
||||||
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
|
||||||
namespace Modelo;
|
namespace Modelo;
|
||||||
|
|
||||||
@@ -102,5 +103,20 @@ public class RepositorioUsuarios: RepositorioBase<RepositorioUsuarios> {
|
|||||||
Guardar(con);
|
Guardar(con);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public bool CheckGrupo(string email, string grupo) {
|
||||||
|
var con = Context;
|
||||||
|
var usu = con.Clientes.Include(x=>x.Idgrupos).FirstOrDefault(x=>x.Email == email);
|
||||||
|
bool ret = false;
|
||||||
|
|
||||||
|
if (usu != null && usu.Idgrupos != null) {
|
||||||
|
Parallel.ForEach(usu.Idgrupos, (idGrupo, state) => {
|
||||||
|
if (idGrupo.Nombre == grupo) {
|
||||||
|
ret = true;
|
||||||
|
state.Break();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user