From 71a7f453ee97585ab32ddbc4b90a43114ba9c206 Mon Sep 17 00:00:00 2001 From: Perea Date: Tue, 30 Sep 2025 09:12:05 +0200 Subject: [PATCH] arreglado los pdfs de herramienta y licitacion casa, y herramienta urban, falta licitacion urban --- HerramientaCASA/Components/App.razor | 2 +- .../Components/Layout/LoginLayout.razor | 56 ++++------- .../Components/Layout/MainLayout.razor | 2 +- .../Components/Pages/HerramientaCASAS.razor | 4 +- .../Components/Pages/HerramientaURBAN.razor | 2 +- .../Imprimir/HerramientaCASAImprimir.razor | 17 +++- .../Imprimir/HerramientaURBANImprimir.razor | 64 ++++++++++-- .../Imprimir/LicitacionesCASAImprimir.razor | 23 +++-- .../Components/Pages/Licitaciones.razor | 2 +- .../Components/Pages/Login/Denegado.razor | 17 ++++ .../Components/Pages/Login/Login.razor | 99 ++++++++++++------- HerramientaCASA/ServicioPDF.cs | 13 ++- HerramientaCASA/appsettings.json | 2 +- HerramientaCASA/wwwroot/Content/Site.css | 15 +++ .../wwwroot/Imprimir/HeaderImprimir.html | 21 ++++ HerramientaCASA/wwwroot/Scripts/Util.js | 9 ++ 16 files changed, 248 insertions(+), 100 deletions(-) create mode 100644 HerramientaCASA/wwwroot/Imprimir/HeaderImprimir.html diff --git a/HerramientaCASA/Components/App.razor b/HerramientaCASA/Components/App.razor index 0744c68..5ea3cf7 100644 --- a/HerramientaCASA/Components/App.razor +++ b/HerramientaCASA/Components/App.razor @@ -18,8 +18,8 @@ integrity="sha384-C6RzsynM9kWDrMNeT87bh95OGNyZPhcTNXj1NW7RuBCsyN/o0jlpcV8Qyq46cDfL" crossorigin="anonymous"> - + diff --git a/HerramientaCASA/Components/Layout/LoginLayout.razor b/HerramientaCASA/Components/Layout/LoginLayout.razor index e822446..ed79adf 100644 --- a/HerramientaCASA/Components/Layout/LoginLayout.razor +++ b/HerramientaCASA/Components/Layout/LoginLayout.razor @@ -8,25 +8,25 @@ - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + @@ -38,23 +38,7 @@ @code{ - - protected override void OnAfterRender(bool firstRender) - { - if (firstRender) - { - string? urlAnterior = HttpContextAccessor.HttpContext?.Request.Headers["Referer"].ToString(); - string rutaActual = Navigation.ToBaseRelativePath(Navigation.Uri); - - if (rutaActual != "Denegado") - { - if (string.IsNullOrEmpty(urlAnterior) || urlAnterior.Contains("cacoa.es")) - { - Navigation.NavigateTo("/Denegado", true); - } - } - } - } + } diff --git a/HerramientaCASA/Components/Layout/MainLayout.razor b/HerramientaCASA/Components/Layout/MainLayout.razor index e48ecc7..a6457ff 100644 --- a/HerramientaCASA/Components/Layout/MainLayout.razor +++ b/HerramientaCASA/Components/Layout/MainLayout.razor @@ -13,7 +13,7 @@ - + diff --git a/HerramientaCASA/Components/Pages/HerramientaCASAS.razor b/HerramientaCASA/Components/Pages/HerramientaCASAS.razor index d045a28..51e59d2 100644 --- a/HerramientaCASA/Components/Pages/HerramientaCASAS.razor +++ b/HerramientaCASA/Components/Pages/HerramientaCASAS.razor @@ -52,7 +52,7 @@
- @* *@ +
@@ -384,7 +384,7 @@ var fullHtml = $@" - + diff --git a/HerramientaCASA/Components/Pages/HerramientaURBAN.razor b/HerramientaCASA/Components/Pages/HerramientaURBAN.razor index 1c95574..1fe294f 100644 --- a/HerramientaCASA/Components/Pages/HerramientaURBAN.razor +++ b/HerramientaCASA/Components/Pages/HerramientaURBAN.razor @@ -54,7 +54,7 @@
- @* *@ +
diff --git a/HerramientaCASA/Components/Pages/Imprimir/HerramientaCASAImprimir.razor b/HerramientaCASA/Components/Pages/Imprimir/HerramientaCASAImprimir.razor index 38764ba..1e7e3ea 100644 --- a/HerramientaCASA/Components/Pages/Imprimir/HerramientaCASAImprimir.razor +++ b/HerramientaCASA/Components/Pages/Imprimir/HerramientaCASAImprimir.razor @@ -149,7 +149,7 @@ -
+
Trabajo profesional @@ -208,15 +208,20 @@
-
+
@* TABLA COSTES ASOCIADOS A LOS SEVICIOS DE ARQUITECTURA *@ -
+
- Costes Asociados a los Servicios de Arquitectura
- +
+

+ Costes Asociados a los Servicios de Arquitectura +

+
+ +
@@ -324,6 +329,7 @@ public tsHerramientasCACOA bd; + public string estiloTrabajos = ""; MarkupString msTextoEncabezado => (MarkupString)textoEncabezado; @@ -339,6 +345,7 @@ bd = tsHerramientasCACOA.NuevoContexto(SoloLectura: false); totalUsos = objetoCASA.TrabajoProfesional.Usos.Count; + estiloTrabajos = objetoCASA.TrabajoProfesional.Usos.Count != 0 ? "align-items: flex-end; margin-top:50px;" : "align-items: flex-end; margin-top:150px;"; textoEncabezado = bd.enumeraciones.First(x => x.Codigo.Contains("PDFCASA")).ValorAlfabeticoLargo; diff --git a/HerramientaCASA/Components/Pages/Imprimir/HerramientaURBANImprimir.razor b/HerramientaCASA/Components/Pages/Imprimir/HerramientaURBANImprimir.razor index bcf4ba8..7cb4f5b 100644 --- a/HerramientaCASA/Components/Pages/Imprimir/HerramientaURBANImprimir.razor +++ b/HerramientaCASA/Components/Pages/Imprimir/HerramientaURBANImprimir.razor @@ -12,10 +12,12 @@
+
+ @* COSTE HORA DE LOS TRABAJOS *@
Coste hora de los trabajos realizados por el despacho profesional @@ -59,6 +61,7 @@
+ @* COSTE HORA EXTERNALIZACION *@
@@ -97,8 +100,10 @@ @* TRABAJAO PROFESIONAL *@
-
-
+
+ +
+ @*
@if (objetoURBAN.TrabajoProfesional.idTipoDocumentacion != 0) { @@ -119,10 +124,47 @@ { } -
+
*@ + +
COSTES DE PRODUCCIÓN DEL TRABAJO PROFESIONAL:
+ + + + + + + + + + + + + + + +
Tipo de Documento:Documento:
+ @if (objetoURBAN.TrabajoProfesional.idTipoDocumentacion != 0) + { + + } + else + { + + } + + @if (objetoURBAN.TrabajoProfesional.idTipoDocumentacion != 0) + { + + } + else + { + + } +
+
@* TABLAS DE DATOS MINIMOS Y OPCIONALES *@ -
+
@* TABLA DE DATOS MINIMOS *@
@@ -158,7 +200,10 @@ @* TABLA DE DATOS OPCIONALES *@ -
+
+ +
+
Documentación Opcional:
@@ -299,7 +344,10 @@ @* INNOVACIÓN INSTRUMENTOS*@
-
Innovacion de los instrumentos
+
+
+ +
Innovacion de los instrumentos

@@ -324,7 +372,7 @@
} -
+
@@ -336,7 +384,7 @@
-
+
Trabajo profesional
diff --git a/HerramientaCASA/Components/Pages/Imprimir/LicitacionesCASAImprimir.razor b/HerramientaCASA/Components/Pages/Imprimir/LicitacionesCASAImprimir.razor index b5e7961..45f21b1 100644 --- a/HerramientaCASA/Components/Pages/Imprimir/LicitacionesCASAImprimir.razor +++ b/HerramientaCASA/Components/Pages/Imprimir/LicitacionesCASAImprimir.razor @@ -1,27 +1,29 @@ 
-
+
@* ENCABEZADO DE LA PAGINA *@ -
+ @* A esta se le pone un margin bottom diferente para que cuando los usos esten vacios que entre en una sola página *@ +

@msTextoEncabezado

+
@* TABLA USOS TIPOLOGIAS *@ -
+
Usos/Tipologías
-
+
- +
@@ -53,7 +55,7 @@ @@ -84,8 +86,8 @@ { -
Superficie (m²)
-
+
Total superficie: @objetoLicitaciones.Usos.Sum(x => x.superficie).MilesYDecimales() m²
@fase.Denominacion -
+
+
@fase.Porcentaje @if (fase.Seleccionado) { @@ -138,7 +140,7 @@
@* TABLA COSTES DE PRODUCCION *@ -
+
Costes de producción
@@ -196,7 +198,8 @@
-
+ @* A esta se le pone un margin top diferente para que cuando los usos esten vacios que entre en una sola página *@ +

@mspie1

diff --git a/HerramientaCASA/Components/Pages/Licitaciones.razor b/HerramientaCASA/Components/Pages/Licitaciones.razor index 0d42e8b..632f8b9 100644 --- a/HerramientaCASA/Components/Pages/Licitaciones.razor +++ b/HerramientaCASA/Components/Pages/Licitaciones.razor @@ -54,7 +54,7 @@
- @* *@ +
diff --git a/HerramientaCASA/Components/Pages/Login/Denegado.razor b/HerramientaCASA/Components/Pages/Login/Denegado.razor index e9fbd0c..fc12209 100644 --- a/HerramientaCASA/Components/Pages/Login/Denegado.razor +++ b/HerramientaCASA/Components/Pages/Login/Denegado.razor @@ -23,10 +23,27 @@

Ir a la web del CACOA + + + + + @code { + + + string? urlAnterior = ""; + string? rutaActual = ""; + + + + protected override async Task OnInitializedAsync() + { + urlAnterior = HttpContextAccessor.HttpContext?.Request.Headers["Referer"].ToString(); + rutaActual = Navigation.ToBaseRelativePath(Navigation.Uri); + } } diff --git a/HerramientaCASA/Components/Pages/Login/Login.razor b/HerramientaCASA/Components/Pages/Login/Login.razor index 5138037..adbc88e 100644 --- a/HerramientaCASA/Components/Pages/Login/Login.razor +++ b/HerramientaCASA/Components/Pages/Login/Login.razor @@ -7,47 +7,54 @@ @inject IHttpContextAccessor HttpContextAccessor @inject NavigationManager Navigation @inject UserState UserState +@inject IJSRuntime JS
-
-
-
- -

Acceso a la Herramienta

-
- - + @if (urlVaida) + { +
+
+
+ +

Acceso a la Herramienta

+
+ + -
- - - -
-
- -
- +
+ + + +
+
+ +
+ +
+ +
+
+ @* *@ + + +
+
+ Si es la primera vez que utiliza la herramienta, cree una nueva clave de acceso
- -
-
- @* *@ - - -
-
- Si es la primera vez que utiliza la herramienta, cree una nueva clave de acceso -
-
-

@mensajeError

-
- - +
+

@mensajeError

+
+ + +
-
+ } + + +
@code { @@ -56,10 +63,36 @@ private string mensajeError = ""; private bool recuerda = false; + string? urlAnterior = ""; + + bool urlVaida = true; + + private bool jsCargado = false; + + // protected override async Task OnAfterRenderAsync(bool firstRender) + // { + // if (firstRender && !jsCargado) + // { + // if (string.IsNullOrEmpty(urlAnterior)) + // { + // urlAnterior = await JS.InvokeAsync("eval", "document.referer"); + // } + // // Actualiza la UI + // StateHasChanged(); + // } + // } + protected override async Task OnInitializedAsync() { bd = tsHerramientasCACOA.NuevoContexto(SoloLectura: false); + // if (string.IsNullOrEmpty(urlAnterior)) + // { + // urlAnterior = await JS.InvokeAsync("eval", "document.referer"); + // } + + // StateHasChanged(); + await ProtectedLocalStore.SetAsync("idUsuario", 0); await ProtectedLocalStore.SetAsync("EsAdmin", false); diff --git a/HerramientaCASA/ServicioPDF.cs b/HerramientaCASA/ServicioPDF.cs index 3aad5d7..ee11694 100644 --- a/HerramientaCASA/ServicioPDF.cs +++ b/HerramientaCASA/ServicioPDF.cs @@ -19,10 +19,21 @@ namespace HerramientaCASA GlobalSettings = { PaperSize = PaperKind.A4, Orientation = Orientation.Portrait, + Margins= new MarginSettings + { + Top = 11.8, + Left = 0, + Right = 0, + Bottom = 10 + }, }, Objects = { new ObjectSettings() { - HtmlContent = html + HtmlContent = html, + HeaderSettings = new HeaderSettings + { + HtmUrl = Path.Combine(Environment.CurrentDirectory, "wwwroot", "Imprimir", "HeaderImprimir.html") + } } } }; diff --git a/HerramientaCASA/appsettings.json b/HerramientaCASA/appsettings.json index 57019bf..38cf559 100644 --- a/HerramientaCASA/appsettings.json +++ b/HerramientaCASA/appsettings.json @@ -7,7 +7,7 @@ }, "ConnectionStrings": { //"WriteConnection": "Server=localhost;Port=22222;Database=herramientascacoa;User Id=cacoa;Password=cacoa2018-;", - //"ReadOnlyConnection": "Server=localhost;Port=22222;Database=herramientascacoa;User Id=cacoa;Password=cacoa2018-;", + //"ReadOnlyConnection": "Server=localhost;Port=22222;Database=herramientascacoa;User Id=cacoa;Password=cacoa2018-;" "WriteConnection": "Server=77.229.174.85;Port=22222;Database=herramientascacoa;User Id=cacoa;Password=cacoa2018-;", "ReadOnlyConnection": "Server=77.229.174.85;Port=22222;Database=herramientascacoa;User Id=cacoa;Password=cacoa2018-;" }, diff --git a/HerramientaCASA/wwwroot/Content/Site.css b/HerramientaCASA/wwwroot/Content/Site.css index 13c2a2c..e3a9896 100644 --- a/HerramientaCASA/wwwroot/Content/Site.css +++ b/HerramientaCASA/wwwroot/Content/Site.css @@ -4,6 +4,15 @@ body { padding-bottom: 0px; } +.header { + position: fixed; + top: 0; + left: 0; + right: 0; + color: white; + text-align: center; +} + .logoCacoa { border-radius: 10px !important; } @@ -885,4 +894,10 @@ div.content { } .espacioTablas { margin: 20px; +} + +.centrarChecksImprimir { + align-items: center; + justify-content: flex-end; + display: flex; } \ No newline at end of file diff --git a/HerramientaCASA/wwwroot/Imprimir/HeaderImprimir.html b/HerramientaCASA/wwwroot/Imprimir/HeaderImprimir.html new file mode 100644 index 0000000..ef4c241 --- /dev/null +++ b/HerramientaCASA/wwwroot/Imprimir/HeaderImprimir.html @@ -0,0 +1,21 @@ + + + + + + + +
+ + + + + +
+ Image + + Costes Asociados a los Servicios de Arquitectura - CASA +
+
+ + \ No newline at end of file diff --git a/HerramientaCASA/wwwroot/Scripts/Util.js b/HerramientaCASA/wwwroot/Scripts/Util.js index 82142c7..cc49f0e 100644 --- a/HerramientaCASA/wwwroot/Scripts/Util.js +++ b/HerramientaCASA/wwwroot/Scripts/Util.js @@ -32,4 +32,13 @@ window.descargarPdf = function (fileName, base64Data) { link.href = 'data:application/pdf;base64,' + base64Data; link.download = fileName; link.click(); +}; + + +window.verRutaReferrer = function () { + try { + return window.parent.location.href; + } catch (e) { + return document.referrer; + } }; \ No newline at end of file