first commit
This commit is contained in:
19
RS_system/Views/Shared/Components/Menu/Default.cshtml
Normal file
19
RS_system/Views/Shared/Components/Menu/Default.cshtml
Normal file
@@ -0,0 +1,19 @@
|
||||
@model Rs_system.Models.ViewModels.MenuViewModel
|
||||
|
||||
@{
|
||||
var currentController = ViewContext.RouteData.Values["controller"]?.ToString();
|
||||
var currentAction = ViewContext.RouteData.Values["action"]?.ToString();
|
||||
var currentUrl = $"/{currentController}/{currentAction}";
|
||||
ViewData["CurrentUrl"] = currentUrl;
|
||||
}
|
||||
|
||||
<nav class="nav flex-column">
|
||||
<a class="nav-link-custom @(currentController == "Home" ? "active" : "")" asp-controller="Home" asp-action="Index">
|
||||
<i class="bi bi-house-door"></i> Inicio
|
||||
</a>
|
||||
|
||||
@foreach (var item in Model.Items)
|
||||
{
|
||||
<partial name="Components/Menu/_MenuItem" model="item" view-data="ViewData" />
|
||||
}
|
||||
</nav>
|
||||
46
RS_system/Views/Shared/Components/Menu/_MenuItem.cshtml
Normal file
46
RS_system/Views/Shared/Components/Menu/_MenuItem.cshtml
Normal file
@@ -0,0 +1,46 @@
|
||||
@using Rs_system.Models.ViewModels
|
||||
@model MenuItem
|
||||
|
||||
@{
|
||||
var currentUrl = ViewData["CurrentUrl"] as string ?? "";
|
||||
var collapseId = "menu-" + Guid.NewGuid().ToString("N");
|
||||
|
||||
// Helper function to check active state recursively
|
||||
bool IsItemOrChildActive(MenuItem item, string url)
|
||||
{
|
||||
if (!item.IsGroup && !string.IsNullOrEmpty(item.Url))
|
||||
{
|
||||
return url.StartsWith(item.Url, StringComparison.OrdinalIgnoreCase);
|
||||
}
|
||||
return item.Children.Any(c => IsItemOrChildActive(c, url));
|
||||
}
|
||||
|
||||
bool isExpanded = Model.IsGroup && IsItemOrChildActive(Model, currentUrl);
|
||||
}
|
||||
|
||||
@if (Model.IsGroup)
|
||||
{
|
||||
<div class="nav-section-title mt-3" data-bs-toggle="collapse" data-bs-target="#@collapseId" aria-expanded="@isExpanded.ToString().ToLower()" style="cursor:pointer">
|
||||
@if (!string.IsNullOrEmpty(Model.Icon))
|
||||
{
|
||||
<i class="bi @Model.Icon me-1"></i>
|
||||
}
|
||||
@Model.Title
|
||||
<i class="bi bi-chevron-down float-end small"></i>
|
||||
</div>
|
||||
<div class="collapse @(isExpanded ? "show" : "")" id="@collapseId">
|
||||
<div class="ms-3 border-start ps-2">
|
||||
@foreach (var child in Model.Children)
|
||||
{
|
||||
<partial name="Components/Menu/_MenuItem" model="child" view-data="ViewData" />
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
}
|
||||
else
|
||||
{
|
||||
var isActive = !string.IsNullOrEmpty(Model.Url) && currentUrl.StartsWith(Model.Url, StringComparison.OrdinalIgnoreCase);
|
||||
<a class="nav-link-custom @(isActive ? "active" : "")" href="@Model.Url">
|
||||
<i class="bi @Model.Icon"></i> @Model.Title
|
||||
</a>
|
||||
}
|
||||
25
RS_system/Views/Shared/Error.cshtml
Normal file
25
RS_system/Views/Shared/Error.cshtml
Normal file
@@ -0,0 +1,25 @@
|
||||
@model ErrorViewModel
|
||||
@{
|
||||
ViewData["Title"] = "Error";
|
||||
}
|
||||
|
||||
<h1 class="text-danger">Error.</h1>
|
||||
<h2 class="text-danger">An error occurred while processing your request.</h2>
|
||||
|
||||
@if (Model.ShowRequestId)
|
||||
{
|
||||
<p>
|
||||
<strong>Request ID:</strong> <code>@Model.RequestId</code>
|
||||
</p>
|
||||
}
|
||||
|
||||
<h3>Development Mode</h3>
|
||||
<p>
|
||||
Swapping to <strong>Development</strong> environment will display more detailed information about the error that occurred.
|
||||
</p>
|
||||
<p>
|
||||
<strong>The Development environment shouldn't be enabled for deployed applications.</strong>
|
||||
It can result in displaying sensitive information from exceptions to end users.
|
||||
For local debugging, enable the <strong>Development</strong> environment by setting the <strong>ASPNETCORE_ENVIRONMENT</strong> environment variable to <strong>Development</strong>
|
||||
and restarting the app.
|
||||
</p>
|
||||
93
RS_system/Views/Shared/_Layout.cshtml
Normal file
93
RS_system/Views/Shared/_Layout.cshtml
Normal file
@@ -0,0 +1,93 @@
|
||||
@inject Rs_system.Services.IConfiguracionService ConfigService
|
||||
@{
|
||||
var logoUrl = await ConfigService.GetValorOrDefaultAsync("LOGO_FOUNDATION", "/assets/home.png");
|
||||
var nameShort = await ConfigService.GetValorOrDefaultAsync("NAME_FOUNDATION_SHORT", "Rs_system");
|
||||
var nameFoundation = await ConfigService.GetValorOrDefaultAsync("NAME_FOUNDATION", "Rs_system");
|
||||
var descriptionShort = await ConfigService.GetValorOrDefaultAsync("DESCRIPTION_SHORT", "Fundacion sin fines de lucro");
|
||||
var version = await ConfigService.GetValorOrDefaultAsync("VERSION_SYSTEM", "1.0.0");
|
||||
}
|
||||
<!DOCTYPE html>
|
||||
<html lang="es">
|
||||
<head>
|
||||
<meta charset="utf-8"/>
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0"/>
|
||||
<title>@ViewData["Title"] - @nameShort</title>
|
||||
<link rel="stylesheet" href="~/lib/bootstrap/dist/css/bootstrap.min.css"/>
|
||||
<link rel="stylesheet" href="~/css/bootstrap-icons.min.css">
|
||||
<link rel="stylesheet" href="~/css/all.min.css">
|
||||
<link rel="stylesheet" href="~/css/toastr.min.css">
|
||||
<link rel="stylesheet" href="~/css/sweetalert2.min.css">
|
||||
<link rel="stylesheet" href="~/css/inter.css" asp-append-version="true" />
|
||||
<link rel="stylesheet" href="~/css/site.css" asp-append-version="true"/>
|
||||
<!--<link rel="stylesheet" href="~/Rs_system.styles.css" asp-append-version="true"/>-->
|
||||
<link rel="manifest" href="~/manifest.json">
|
||||
<meta name="theme-color" content="#1e293b">
|
||||
@RenderSection("Styles", required: false)
|
||||
</head>
|
||||
<body>
|
||||
<div class="app-wrapper">
|
||||
<div class="sidebar-overlay" id="sidebarOverlay"></div>
|
||||
<!-- Sidebar -->
|
||||
<aside class="sidebar">
|
||||
<div class="sidebar-header">
|
||||
<a class="sidebar-brand d-flex align-items-center" asp-controller="Home" asp-action="Index">
|
||||
<img src="@logoUrl" alt="Logo" class="me-2" style="height: 32px; width: auto; object-fit: contain;" />
|
||||
<span>@nameShort</span>
|
||||
</a>
|
||||
</div>
|
||||
<nav class="sidebar-nav p-3">
|
||||
@await Component.InvokeAsync("Menu")
|
||||
</nav>
|
||||
<div class="sidebar-footer p-3 border-top border-secondary">
|
||||
<small class="text-muted">v @version © 2026</small>
|
||||
</div>
|
||||
</aside>
|
||||
|
||||
<!-- Main Content -->
|
||||
<main class="main-content">
|
||||
<header class="top-header">
|
||||
<div class="header-left d-flex align-items-center">
|
||||
<button id="sidebarToggle" class="btn btn-link text-dark p-0 me-3">
|
||||
<i class="bi bi-list fs-4"></i>
|
||||
</button>
|
||||
<h5 class="mb-0 fw-semibold">@ViewData["Title"]</h5>
|
||||
</div>
|
||||
<div class="header-right">
|
||||
<partial name="_LoginPartial"/>
|
||||
</div>
|
||||
</header>
|
||||
|
||||
<div class="page-container">
|
||||
@RenderBody()
|
||||
</div>
|
||||
|
||||
<footer class="footer">
|
||||
<div class="container-fluid">
|
||||
<div class="d-flex justify-content-between align-items-center">
|
||||
<span class="text-muted small">@nameFoundation © 2026 - @descriptionShort.</span>
|
||||
<div class="small text-muted">
|
||||
<i class="bi bi-shield-check me-1"></i> Sistema Seguro
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</footer>
|
||||
</main>
|
||||
</div>
|
||||
|
||||
<script src="~/lib/jquery/dist/jquery.min.js"></script>
|
||||
<script src="~/lib/bootstrap/dist/js/bootstrap.bundle.min.js"></script>
|
||||
<script src="~/js/toastr.min.js"></script>
|
||||
<script src="~/js/sweetalert.js"></script>
|
||||
<script src="~/js/site.js" asp-append-version="true"></script>
|
||||
@await RenderSectionAsync("Scripts", required: false)
|
||||
<script>
|
||||
if ('serviceWorker' in navigator) {
|
||||
window.addEventListener('load', () => {
|
||||
navigator.serviceWorker.register('/sw.js')
|
||||
.then(reg => console.log('Service Worker registrado', reg))
|
||||
.catch(err => console.log('Error registrando Service Worker', err));
|
||||
});
|
||||
}
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
48
RS_system/Views/Shared/_Layout.cshtml.css
Normal file
48
RS_system/Views/Shared/_Layout.cshtml.css
Normal file
@@ -0,0 +1,48 @@
|
||||
/* Please see documentation at https://learn.microsoft.com/aspnet/core/client-side/bundling-and-minification
|
||||
for details on configuring this project to bundle and minify static web assets. */
|
||||
|
||||
a.navbar-brand {
|
||||
white-space: normal;
|
||||
text-align: center;
|
||||
word-break: break-all;
|
||||
}
|
||||
|
||||
a {
|
||||
color: #0077cc;
|
||||
}
|
||||
|
||||
.btn-primary {
|
||||
color: #fff;
|
||||
background-color: #1b6ec2;
|
||||
border-color: #1861ac;
|
||||
}
|
||||
|
||||
.nav-pills .nav-link.active, .nav-pills .show > .nav-link {
|
||||
color: #fff;
|
||||
background-color: #1b6ec2;
|
||||
border-color: #1861ac;
|
||||
}
|
||||
|
||||
.border-top {
|
||||
border-top: 1px solid #e5e5e5;
|
||||
}
|
||||
.border-bottom {
|
||||
border-bottom: 1px solid #e5e5e5;
|
||||
}
|
||||
|
||||
.box-shadow {
|
||||
box-shadow: 0 .25rem .75rem rgba(0, 0, 0, .05);
|
||||
}
|
||||
|
||||
button.accept-policy {
|
||||
font-size: 1rem;
|
||||
line-height: inherit;
|
||||
}
|
||||
|
||||
.footer {
|
||||
position: relative;
|
||||
bottom: 0;
|
||||
width: 100%;
|
||||
white-space: nowrap;
|
||||
line-height: 60px;
|
||||
}
|
||||
33
RS_system/Views/Shared/_LoginPartial.cshtml
Normal file
33
RS_system/Views/Shared/_LoginPartial.cshtml
Normal file
@@ -0,0 +1,33 @@
|
||||
@using System.Security.Claims
|
||||
|
||||
<ul class="navbar-nav">
|
||||
@if (User.Identity?.IsAuthenticated == true)
|
||||
{
|
||||
var fullName = User.FindFirstValue("FullName") ?? User.Identity.Name;
|
||||
<li class="nav-item dropdown">
|
||||
<a class="nav-link dropdown-toggle text-dark" href="#" role="button" data-bs-toggle="dropdown" aria-expanded="false">
|
||||
<span class="user-welcome">Hola, @fullName</span>
|
||||
</a>
|
||||
<ul class="dropdown-menu dropdown-menu-end">
|
||||
<li><h6 class="dropdown-header">@User.Identity.Name</h6></li>
|
||||
<li><hr class="dropdown-divider"></li>
|
||||
<li>
|
||||
<form asp-controller="Account" asp-action="Logout" method="post">
|
||||
<button type="submit" class="dropdown-item">
|
||||
<i class="bi bi-box-arrow-right me-2"></i>Cerrar Sesión
|
||||
</button>
|
||||
</form>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
}
|
||||
else
|
||||
{
|
||||
<li class="nav-item">
|
||||
<a class="nav-link text-dark" asp-controller="Account" asp-action="Register">Registrarse</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link text-dark" asp-controller="Account" asp-action="Login">Iniciar Sesión</a>
|
||||
</li>
|
||||
}
|
||||
</ul>
|
||||
2
RS_system/Views/Shared/_ValidationScriptsPartial.cshtml
Normal file
2
RS_system/Views/Shared/_ValidationScriptsPartial.cshtml
Normal file
@@ -0,0 +1,2 @@
|
||||
<script src="~/lib/jquery-validation/dist/jquery.validate.min.js"></script>
|
||||
<script src="~/lib/jquery-validation-unobtrusive/dist/jquery.validate.unobtrusive.min.js"></script>
|
||||
Reference in New Issue
Block a user