comentados botones imprimir y descomentado comprobar que solo funcione de la url de cacoa
This commit is contained in:
@@ -39,22 +39,22 @@
|
||||
|
||||
@code{
|
||||
|
||||
// protected override void OnAfterRender(bool firstRender)
|
||||
// {
|
||||
// if (firstRender)
|
||||
// {
|
||||
// string? urlAnterior = HttpContextAccessor.HttpContext?.Request.Headers["Referer"].ToString();
|
||||
// string rutaActual = Navigation.ToBaseRelativePath(Navigation.Uri);
|
||||
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);
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
if (rutaActual != "Denegado")
|
||||
{
|
||||
if (string.IsNullOrEmpty(urlAnterior) || urlAnterior.Contains("cacoa.es"))
|
||||
{
|
||||
Navigation.NavigateTo("/Denegado", true);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -52,7 +52,7 @@
|
||||
<InputText @bind-Value="casa.NombreSimulacion" class="form-control inputForm formatoMoneda inputTabla " style="text-align:left;font-weight:bold;"></InputText>
|
||||
</div>
|
||||
<div class="d-flex ml-auto impriManual">
|
||||
<button @onclick="imprimir" class="btnBlue d-flex align-items-center ms-1" style="background-color: #65b7c3 !important;"> <i class="fas fa-print pe-2"></i>Imprimir</button>
|
||||
@* <button @onclick="imprimir" class="btnBlue d-flex align-items-center ms-1" style="background-color: #65b7c3 !important;"> <i class="fas fa-print pe-2"></i>Imprimir</button> *@
|
||||
<button @onclick="VerManual" class="btnBlue d-flex align-items-center ms-1" style="background-color: #65b7c3 !important;"> <i class="fas fa-book pe-2"></i>Manual</button>
|
||||
</div>
|
||||
</div>
|
||||
@@ -377,23 +377,27 @@
|
||||
public async Task imprimir()
|
||||
{
|
||||
|
||||
// var cssPath = Path.Combine(Environment.CurrentDirectory, "wwwroot", "Content", "Site.css");
|
||||
// var cssContent = await File.ReadAllTextAsync(cssPath);
|
||||
var cssPath = Path.Combine(Environment.CurrentDirectory, "wwwroot", "Content", "Site.css");
|
||||
var cssContent = await File.ReadAllTextAsync(cssPath);
|
||||
|
||||
var contenidoHtml = await JSA.InvokeAsync<string>("obtenerPDFImprimir", "DespachoImprimir");
|
||||
var fullHtml = $@"
|
||||
<html>
|
||||
<head>
|
||||
<meta charset='UTF-8'>
|
||||
<style>{cssContent}</style>
|
||||
<link href='https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/css/bootstrap.min.css' rel='stylesheet' integrity='sha384-T3c6CoIi6uLrA9TneNEoa7RxnatzjcDSCmG1MXxSR1GAsXEV/Dwwykc2MPK8M2HN' crossorigin='anonymous'>
|
||||
</head>
|
||||
<body>
|
||||
{contenidoHtml}
|
||||
</body>
|
||||
</html>";
|
||||
|
||||
// var arrayPDF = PdfService.HtmlToPdfWithSiteCss(fullHtml, Path.Combine(Environment.CurrentDirectory, "wwwroot", "Content", "Site.css"));
|
||||
|
||||
var arrayPDF = PdfService.GenerarPdf(fullHtml);
|
||||
|
||||
string base64Pdf = Convert.ToBase64String(arrayPDF);
|
||||
|
||||
await JSA.InvokeVoidAsync("descargarPdf", "prueba", base64Pdf);
|
||||
await JSA.InvokeVoidAsync("descargarPdf", "SimulacionHerramientaCASA_"+ DateTime.Now , base64Pdf);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -9,6 +9,8 @@
|
||||
@using Microsoft.AspNetCore.Components.Server.ProtectedBrowserStorage
|
||||
@inject ProtectedLocalStorage ProtectedLocalStore
|
||||
@inject IJSRuntime JS
|
||||
@inject ServicioPDF PdfService
|
||||
|
||||
|
||||
@rendermode InteractiveServer
|
||||
@inject NavigationManager Navigation
|
||||
@@ -350,4 +352,30 @@
|
||||
// await JS.InvokeVoidAsync("mostrarPdf", Convert.ToBase64String(pdfBytes));
|
||||
// }
|
||||
|
||||
public async Task imprimir()
|
||||
{
|
||||
|
||||
var cssPath = Path.Combine(Environment.CurrentDirectory, "wwwroot", "Content", "Site.css");
|
||||
var cssContent = await File.ReadAllTextAsync(cssPath);
|
||||
|
||||
var contenidoHtml = await JS.InvokeAsync<string>("obtenerPDFImprimir", "DespachoURBANImprimir");
|
||||
var fullHtml = $@"
|
||||
<html>
|
||||
<head>
|
||||
<meta charset='UTF-8'>
|
||||
<style>{cssContent}</style>
|
||||
<link href='https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/css/bootstrap.min.css' rel='stylesheet' integrity='sha384-T3c6CoIi6uLrA9TneNEoa7RxnatzjcDSCmG1MXxSR1GAsXEV/Dwwykc2MPK8M2HN' crossorigin='anonymous'>
|
||||
</head>
|
||||
<body>
|
||||
{contenidoHtml}
|
||||
</body>
|
||||
</html>";
|
||||
|
||||
|
||||
var arrayPDF = PdfService.GenerarPdf(fullHtml);
|
||||
|
||||
string base64Pdf = Convert.ToBase64String(arrayPDF);
|
||||
|
||||
await JS.InvokeVoidAsync("descargarPdf", "SimulacionHerramientaUrbanismo_" + DateTime.Now, base64Pdf);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
@msTextoEncabezado
|
||||
</p>
|
||||
|
||||
<div class="mt-3">
|
||||
<div class="mt-3">
|
||||
<label>Simulación: <span class="NombreSimulacionImprimir">@objetoCASA.NombreSimulacion</span></label>
|
||||
<br />
|
||||
<label>Fecha de creación: <span class="NombreSimulacionImprimir">@DateTime.Now</span></label>
|
||||
@@ -14,19 +14,7 @@
|
||||
</div>
|
||||
|
||||
@* TABLA COSTE HORA DESPACHO PROFESIONAL *@
|
||||
<table>
|
||||
<tr style="border-color: red !important;
|
||||
border-width: 1px !important;
|
||||
BORDER-STYLE: SOLID !important;
|
||||
background-color:blue !important;
|
||||
color:white !important;
|
||||
">
|
||||
<td>
|
||||
hola
|
||||
</td>
|
||||
<td>adios</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<div class="col-8 mx-auto" style="align-items: flex-end; margin-bottom:30px;">
|
||||
<div class="TituloTablaImprimir">
|
||||
<b>Coste hora de los trabajos realizados por el despacho profesional</b>
|
||||
@@ -37,12 +25,7 @@ color:white !important;
|
||||
<table class="TablaImprimir mb-0" style="width:100%;">
|
||||
|
||||
<thead>
|
||||
<tr style="border-color: red;
|
||||
border-width: 1px;
|
||||
BORDER-STYLE: SOLID;
|
||||
background-color:blue;
|
||||
color:white;
|
||||
">
|
||||
<tr>
|
||||
<th>Tipo de costes</th>
|
||||
<th>Coste/hora</th>
|
||||
</tr>
|
||||
|
||||
@@ -7,6 +7,8 @@
|
||||
@using Microsoft.AspNetCore.Components.Server.ProtectedBrowserStorage
|
||||
@inject ProtectedLocalStorage ProtectedLocalStore
|
||||
@inject IJSRuntime JS
|
||||
@inject ServicioPDF PdfService
|
||||
|
||||
|
||||
@page "/LicitacionCASA"
|
||||
@page "/LicitacionCASA/{idSimulador}"
|
||||
@@ -516,4 +518,32 @@
|
||||
string urlManual = bd.enumeraciones.FirstOrDefault(x => x.Codigo.Contains("MANUAL.LICITACIONCASA")).ValorAlfabeticoLargo;
|
||||
await JS.InvokeVoidAsync("abrirManual", urlManual);
|
||||
}
|
||||
|
||||
|
||||
public async Task imprimir()
|
||||
{
|
||||
|
||||
var cssPath = Path.Combine(Environment.CurrentDirectory, "wwwroot", "Content", "Site.css");
|
||||
var cssContent = await File.ReadAllTextAsync(cssPath);
|
||||
|
||||
var contenidoHtml = await JS.InvokeAsync<string>("obtenerPDFImprimir", "LicitacionesCASAImprimir");
|
||||
var fullHtml = $@"
|
||||
<html>
|
||||
<head>
|
||||
<meta charset='UTF-8'>
|
||||
<style>{cssContent}</style>
|
||||
<link href='https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/css/bootstrap.min.css' rel='stylesheet' integrity='sha384-T3c6CoIi6uLrA9TneNEoa7RxnatzjcDSCmG1MXxSR1GAsXEV/Dwwykc2MPK8M2HN' crossorigin='anonymous'>
|
||||
</head>
|
||||
<body>
|
||||
{contenidoHtml}
|
||||
</body>
|
||||
</html>";
|
||||
|
||||
|
||||
var arrayPDF = PdfService.GenerarPdf(fullHtml);
|
||||
|
||||
string base64Pdf = Convert.ToBase64String(arrayPDF);
|
||||
|
||||
await JS.InvokeVoidAsync("descargarPdf", "SimulacionLicitacionCASA_" + DateTime.Now, base64Pdf);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
@using bdHerramientaCACOA.db
|
||||
@using Microsoft.AspNetCore.Components.Server.ProtectedBrowserStorage
|
||||
@inject IJSRuntime JS
|
||||
@inject ServicioPDF PdfService
|
||||
|
||||
@inject ProtectedLocalStorage ProtectedLocalStore
|
||||
|
||||
@@ -588,4 +589,32 @@
|
||||
|
||||
objetoLicitacionUrban.EsPorUsos = guardarSeleccion;
|
||||
}
|
||||
|
||||
|
||||
public async Task imprimir()
|
||||
{
|
||||
|
||||
var cssPath = Path.Combine(Environment.CurrentDirectory, "wwwroot", "Content", "Site.css");
|
||||
var cssContent = await File.ReadAllTextAsync(cssPath);
|
||||
|
||||
var contenidoHtml = await JS.InvokeAsync<string>("obtenerPDFImprimir", "LiciURBANImprimir");
|
||||
var fullHtml = $@"
|
||||
<html>
|
||||
<head>
|
||||
<meta charset='UTF-8'>
|
||||
<style>{cssContent}</style>
|
||||
<link href='https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/css/bootstrap.min.css' rel='stylesheet' integrity='sha384-T3c6CoIi6uLrA9TneNEoa7RxnatzjcDSCmG1MXxSR1GAsXEV/Dwwykc2MPK8M2HN' crossorigin='anonymous'>
|
||||
</head>
|
||||
<body>
|
||||
{contenidoHtml}
|
||||
</body>
|
||||
</html>";
|
||||
|
||||
|
||||
var arrayPDF = PdfService.GenerarPdf(fullHtml);
|
||||
|
||||
string base64Pdf = Convert.ToBase64String(arrayPDF);
|
||||
|
||||
await JS.InvokeVoidAsync("descargarPdf", "SimulacionLicitacionUrbanismo_" + DateTime.Now, base64Pdf);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -22,8 +22,7 @@ namespace HerramientaCASA
|
||||
},
|
||||
Objects = {
|
||||
new ObjectSettings() {
|
||||
HtmlContent = html,
|
||||
WebSettings = { DefaultEncoding = "utf-8", UserStyleSheet = Path.Combine(Environment.CurrentDirectory, "wwwroot", "Content", "Site.css") }
|
||||
HtmlContent = html
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user