From feb4db86c062e336457d34dabca18cabfad650c8 Mon Sep 17 00:00:00 2001 From: fede Date: Sun, 24 Nov 2024 12:59:39 -0300 Subject: [PATCH] Fix: botones se salen de la pantalla modified: Entidades/Grupo.cs modified: Front/src/lib/NavBarAutocompletable.svelte new file: Front/src/lib/css/popup.css modified: Modelo/RepositorioPermisos.cs --- Aspnet/Aspnet.sln | 25 -------------- Entidades/Grupo.cs | 2 ++ Front/src/lib/NavBarAutocompletable.svelte | 37 +++++++++++++++------ Front/src/lib/css/popup.css | 38 ++++++++++++++++++++++ Modelo/RepositorioPermisos.cs | 6 ++-- 5 files changed, 70 insertions(+), 38 deletions(-) delete mode 100644 Aspnet/Aspnet.sln create mode 100644 Front/src/lib/css/popup.css diff --git a/Aspnet/Aspnet.sln b/Aspnet/Aspnet.sln deleted file mode 100644 index baec485..0000000 --- a/Aspnet/Aspnet.sln +++ /dev/null @@ -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 diff --git a/Entidades/Grupo.cs b/Entidades/Grupo.cs index 8a1a624..420bc05 100644 --- a/Entidades/Grupo.cs +++ b/Entidades/Grupo.cs @@ -1,5 +1,6 @@ using System; using System.Collections.Generic; +using System.Text.Json.Serialization; namespace Entidades; @@ -9,6 +10,7 @@ public partial class Grupo public string Nombre { get; set; } = null!; + [JsonIgnore] public virtual ICollection Idclientes { get; set; } = new List(); public virtual ICollection Idpermisos { get; set; } = new List(); diff --git a/Front/src/lib/NavBarAutocompletable.svelte b/Front/src/lib/NavBarAutocompletable.svelte index f5b0cb8..7ba3452 100644 --- a/Front/src/lib/NavBarAutocompletable.svelte +++ b/Front/src/lib/NavBarAutocompletable.svelte @@ -2,19 +2,24 @@ import { Navbar, NavbarBrand, NavbarToggler, NavItem, Nav, NavLink, Collapse } from "@sveltestrap/sveltestrap"; import { onMount } from "svelte"; import { writable } from 'svelte/store'; - + import './css/popup.css'; let isOpen: boolean = $state(false); - interface Permiso { + type Permiso = { id: number; descripcion: string; - } + }; - const permisos = writable([]); + type Grupo = { + id: number; + nombre: string; + idpermisos: Permiso[]; + }; + + const permisos = writable([]); const email = localStorage.getItem('email'); const token = sessionStorage.getItem('token'); - async function obtenerPermisos(){ try { const response = await fetch("http://localhost:5007/api/acciones",{ @@ -36,17 +41,18 @@ } } - $inspect(permisos); onMount( () => { obtenerPermisos(); }) + + AlquilaFacil -
+
Volver al Menú @@ -55,9 +61,20 @@ diff --git a/Front/src/lib/css/popup.css b/Front/src/lib/css/popup.css new file mode 100644 index 0000000..0fcdcf2 --- /dev/null +++ b/Front/src/lib/css/popup.css @@ -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; +} \ No newline at end of file diff --git a/Modelo/RepositorioPermisos.cs b/Modelo/RepositorioPermisos.cs index 06b51a1..e53fb40 100644 --- a/Modelo/RepositorioPermisos.cs +++ b/Modelo/RepositorioPermisos.cs @@ -4,7 +4,7 @@ using Microsoft.EntityFrameworkCore; namespace Modelo; public class RepositorioPermisos: RepositorioBase { - public IQueryable? ListarPermisos(string email) { + public object? ListarPermisos(string email) { var con = Context; Cliente? cli = con.Clientes.Include(x => x.Idgrupos).FirstOrDefault(c => c.Email == email); if (cli == null) return null; @@ -12,8 +12,8 @@ public class RepositorioPermisos: RepositorioBase { var list = con.Clientes .Where(c => c.Dni == cli.Dni) .SelectMany(c => c.Idgrupos) - .SelectMany(g => g.Idpermisos) - .Distinct(); + .Include(x=> x.Idpermisos); + return list; }