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
This commit is contained in:
@@ -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,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<Cliente> Idclientes { get; set; } = new List<Cliente>();
|
||||
|
||||
public virtual ICollection<Permiso> Idpermisos { get; set; } = new List<Permiso>();
|
||||
|
||||
@@ -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<Permiso[]>([]);
|
||||
type Grupo = {
|
||||
id: number;
|
||||
nombre: string;
|
||||
idpermisos: Permiso[];
|
||||
};
|
||||
|
||||
const permisos = writable<Grupo[]>([]);
|
||||
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();
|
||||
})
|
||||
|
||||
|
||||
</script>
|
||||
|
||||
<Navbar container="xxl" expand="md" color="dark-subtle">
|
||||
<NavbarBrand href="/">
|
||||
AlquilaFacil
|
||||
</NavbarBrand>
|
||||
<div class="card">
|
||||
<div class="badge">
|
||||
<a href="/Menu">
|
||||
<img src="/home.svg" alt="Volver al Menú"/>
|
||||
</a>
|
||||
@@ -55,9 +61,20 @@
|
||||
<Collapse isOpen={isOpen} navbar expand="md">
|
||||
<Nav class="ms-auto" navbar>
|
||||
{#each $permisos as item }
|
||||
<NavItem>
|
||||
<NavLink href="/accion/{item.id}">{item.descripcion}</NavLink>
|
||||
</NavItem>
|
||||
<div class="dropdown">
|
||||
<div class="btn-group" style="margin-left: 3px; margin-top: 3px">
|
||||
<button class="btn btn-secondary">{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}
|
||||
</Nav>
|
||||
</Collapse>
|
||||
|
||||
38
Front/src/lib/css/popup.css
Normal file
38
Front/src/lib/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;
|
||||
}
|
||||
@@ -4,7 +4,7 @@ using Microsoft.EntityFrameworkCore;
|
||||
|
||||
namespace Modelo;
|
||||
public class RepositorioPermisos: RepositorioBase<RepositorioPermisos> {
|
||||
public IQueryable<Permiso>? 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<RepositorioPermisos> {
|
||||
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;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user