Files
sprpcb-exportpdf-func/templates_reports/bm_pdf_report.html
2026-08-08 21:25:24 -04:00

367 lines
29 KiB
HTML

<!-- mi_proyecto/templates/reports/bm_pdf_report.html -->
{% load template_tags %}
{% for resource in resources %}
{% with resource_data=resource.resource %}
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<style>
:root {--oscuro: #242424; --carbon: #4c4c4c; --ceniza: #999; --claro: #fafafa; --resaltado: #d1a21c;}
html { color: var(carbon); font-family: 'Helvetica', sans-serif; font-size: 9pt; font-weight: 300; line-height: 1.2;}
body { margin: 0;}
h1 { color: var(--resaltado); font-size: 13pt; text-align: center; width: 100%;}
h2, h3, h4 { color: black; font-weight: 400;}
h2 { break-before: always; font-size: 12pt;}
h3 { font-size: 12pt;}
h4 { font-size: 11pt;}
a { font-size:.85em;}
.flex-container { display: flex; flex-wrap: wrap; gap: 0 4px; margin-top: 5px;}
.flex-item {flex: 0 0 calc(50% - 5px); box-sizing: border-box;}
.tiles-grid-grp { display: grid; grid-template-columns: 1fr 1fr; grid-template-rows: auto auto; gap: 2px;}
.tiles-grid-grp-col { grid-column: 2; contain: size;}
.tile-block { border: 1px solid var(--ceniza); border-radius: 4px; padding: 2px; margin: 2px 0; background-color: var(--claro);}
.tile-title { font-size: 11pt; font-weight: bold; color: var(--oscuro); border-bottom: 1px solid var(--ceniza); padding-bottom: 2px; margin-bottom: 5px;}
.data-row { display: flex; padding: 2px 0; border-bottom: 1px solid var(--claro);}
.data-label { font-weight: 600; letter-spacing: -0.05em; width: 40%; color: var(--oscuro);}
.data-value { width: 60%; font-size:.9em; word-wrap: break-word;}
.no-data { color: var(--ceniza); font-style: italic;}
.tiles-grid-grp-col .tile-block img { object-fit: cover; width: 330px; max-height: 300px;}
.gallery { display: grid; grid-template-columns: repeat(2, 340px); grid-auto-rows: 272px; gap: 5px; justify-content: center; }
.gallery-item { overflow: hidden; border-radius: 5px; background-color: var(--ceniza); position: relative;}
.gallery-item img { width: 100%; height: 100%; object-fit: cover;}
.gallery-item a {position: absolute; bottom: 6px; left: 6px; color: var(--carbon); text-decoration: none; background-color: rgb(255 255 255 / 50%); font-size: .75em;}
@page {
@top-left { background: var(--resaltado); content: counter(page); height: 1cm; text-align: center; width: 1cm;}
@top-center { background: var(--resaltado); content: ''; display: block; height: .05cm; opacity: .5; width: 100%;}
@top-right { content: '{{ resource.grafo }} \A UUID: {{ resource.resourceinstanceid }}'; white-space: pre-line; color: var(--ceniza); font-size: 8pt; height: 1cm; vertical-align: middle; width: 100%;}
@bottom-center { background: var(--resaltado); content: ''; display: block; height: .05cm; opacity: .5; width: 100%;}
@bottom-left { content: 'Sistema Plurinacional de Registro de Patrimonio Cultural Boliviano\ASPRPCB - {{ resource.eta_group }}'; white-space: pre-line; color: var(--ceniza); font-size: 8pt; height: 1cm; vertical-align: middle; width: 100%;}
@bottom-right { content: '{{ resource.fecha }} \A BOLIVIA'; white-space: pre-line; color: var(--ceniza); font-size: 8pt; height: 1cm; vertical-align: middle; width: 100%;}
size: Letter;
margin-top: 1.5cm; margin-bottom: 1.8cm; margin-left: 2cm; margin-right: 1.5cm;
}
</style>
<title>{{ resource.grafo }} ID de sistema: {{ resource.resourceinstanceid }}</title>
<meta name="description" content="Ficha PDF">
</head>
<body>
{% if resource_data %}
<h1>{{ resource.displayname|truncatewords:10 }}</h1>
<div class="tiles-grid-grp">
<div class="tile-block" >
<div class="tile-title">Identificación</div>
{% if resource_data|has_key:"Identificación" %}
<div class="data-row">
<span class="data-label">Ámbito / subámbito: </span>
<span class="data-value">{{ resource_data|val_from_key:"Identificación"|val_from_key:'Ámbito / subámbito' }}</span>
</div>
<div class="data-row">
<span class="data-label">Código principal: </span>
<span class="data-value">{{ resource_data|val_from_key:"Identificación"|val_from_key:"Código principal" }}</span>
</div>
{% if resource_data|val_from_key:"Identificación"|has_key:"Código institucional" %}
<span class="data-label">Código alternativo: </span>
{% for cod in resource_data|val_from_key:"Identificación"|val_from_key:"Código institucional" %}
<div class="data-row" style="margin-left: 20px;">
<span class="data-label">{{ cod|val_from_key:"Tipo de código" }}: </span>
<span class="data-value">{{ cod|val_from_key:"@value" }}</span>
</div>
{% endfor %}
{% endif %}
<div class="data-row">
<span class="data-label">Denominación : </span>
<span class="data-value">{{ resource_data|val_from_key:"Identificación"|val_from_key:'Denominación'|val_from_key:"@value" }}</span>
</div>
<div class="data-row" style="margin-left: 15px;">
<span class="data-value" style="width: 100%;"><b>Tipo de Bien mueble : </b>{{ resource_data|val_from_key:"Identificación"|val_from_key:'Denominación'|val_from_key:"Tipo de nombre" }}</span>
</div>
{% if resource_data|val_from_key:"Identificación"|has_key:"Bienes muebles histórico-artístico" %}
<span class="data-label" style="width: 100%;">Bienes muebles histórico-artístico : </span>
<div class="data-row" style="margin-left: 15px;">
<span class="data-value" style="width: 100%;"><b>Época : </b>{{ resource_data|val_from_key:"Identificación"|val_from_key:'Bienes muebles histórico-artístico'|val_from_key:"Época"|val_from_key:"@value" }}</span>
</div>
<div class="data-row" style="margin-left: 15px;">
<span class="data-value" style="width: 100%;"><b>Otra época : </b>{{ resource_data|val_from_key:"Identificación"|val_from_key:'Bienes muebles histórico-artístico'|val_from_key:"Época"|val_from_key:"Otra época" }}</span>
</div>
<div class="data-row" style="margin-left: 15px;">
<span class="data-value" style="width: 100%;"><b>Estilo : </b>{{ resource_data|val_from_key:"Identificación"|val_from_key:'Bienes muebles histórico-artístico'|val_from_key:"Estilo"|val_from_key:"@value" }}</span>
</div>
<div class="data-row" style="margin-left: 15px;">
<span class="data-value" style="width: 100%;"><b>Otros estilos : </b>{{ resource_data|val_from_key:"Identificación"|val_from_key:'Bienes muebles histórico-artístico'|val_from_key:"Estilo"|val_from_key:"Otros estilos" }}</span>
</div>
<div class="data-row" style="margin-left: 15px;">
<span class="data-value" style="width: 100%;"><b>Escuela : </b>{{ resource_data|val_from_key:"Identificación"|val_from_key:'Bienes muebles histórico-artístico'|val_from_key:"Escuela"|val_from_key:"@value" }}</span>
</div>
<div class="data-row" style="margin-left: 15px;">
<span class="data-value" style="width: 100%;"><b>Otra escuela : </b>{{ resource_data|val_from_key:"Identificación"|val_from_key:'Bienes muebles histórico-artístico'|val_from_key:"Escuela"|val_from_key:"Otra escuela" }}</span>
</div>
<div class="data-row" style="margin-left: 15px;">
<span class="data-value" style="width: 100%;"><b>Autor / atribución : </b>{{ resource_data|val_from_key:"Identificación"|val_from_key:'Bienes muebles histórico-artístico'|val_from_key:"Autor / atribución" }}</span>
</div>
<div class="data-row" style="margin-left: 15px;">
<span class="data-value" style="width: 100%;"><b>Origen o procedencia : </b>{{ resource_data|val_from_key:"Identificación"|val_from_key:'Bienes muebles histórico-artístico'|val_from_key:"Origen o procedencia" }}</span>
</div>
{% endif %}
{% if resource_data|val_from_key:"Identificación"|has_key:"Bienes muebles arqueológicos" %}
<span class="data-label" style="width: 100%;">Bienes muebles arqueológicos: </span>
<div class="data-row" style="margin-left: 15px;">
<span class="data-value" style="width: 100%;"><b>Periodo : </b>{{ resource_data|val_from_key:"Identificación"|val_from_key:'Bienes muebles arqueológicos'|val_from_key:"Periodo" }}</span>
</div>
<div class="data-row" style="margin-left: 15px;">
<span class="data-value" style="width: 100%;"><b>Filiación cultural : </b>{{ resource_data|val_from_key:"Identificación"|val_from_key:'Bienes muebles arqueológicos'|val_from_key:"Filiación cultural" }}</span>
</div>
<div class="data-row" style="margin-left: 15px;">
<span class="data-value" style="width: 100%;"><b>Material asociado : </b>{{ resource_data|val_from_key:"Identificación"|val_from_key:'Bienes muebles arqueológicos'|val_from_key:"Material asociado" }}</span>
</div>
{% endif %}
{% endif %}
</div>
<div class="tiles-grid-grp-col">
<div class="tile-block">
<div class="tile-title">Imagen de referencia</div>
{% if resource_data|val_from_key:"Identificación"|has_key:"Imagen principal" %}
<img src="{{resource.sprpcb_url}}{{ resource_data|val_from_key:"Identificación"|val_from_key:"Imagen principal" }}" alt="Medio no encontrado o formato no soportado">
{% endif %}
</div>
</div>
</div>
{% if resource_data|val_from_key:"Identificación"|has_key:"Bienes muebles arqueológicos" %}
<div class="tile-block">
<span class="tile-title">Cronología : </span>
<div class="data-row">
<span class="data-value" style="width: 100%;">{{ resource_data|val_from_key:"Identificación"|val_from_key:'Bienes muebles arqueológicos'|val_from_key:"Cronología"|safe|cut:"<p>&nbsp;</p>" }}</span>
</div>
</div>
{% endif %}
<div class="tiles-grid-grp">
<div class="tile-block">
<div class="tile-title">Ubicación</div>
{% if resource_data|has_key:"Localización" %}
<div class="data-row">
<span class="data-label">Localidad: </span>
<span class="data-value">{{ resource_data|val_from_key:"Localización"|val_from_key:"Departamento / Localidad" }}</span>
</div>
<div class="data-row">
<span class="data-label">Departamento: </span>
<span class="data-value">{{ resource_data|val_from_key:"Localización"|val_from_key:"Ubicación extendida" }}</span>
</div>
<div class="data-row">
<span class="data-label">Espacio: </span>
<span class="data-value">{{ resource_data|val_from_key:"Localización"|val_from_key:"Espacio" }}</span>
</div>
{% if resource.print_ubic %}
<div class="data-row">
<span class="data-label">Inmueble: </span>
<span class="data-value">{{ resource_data|val_from_key:"Localización"|val_from_key:"Inmueble" }}</span>
</div>
<div class="data-row">
<span class="data-label">Colección: </span>
<span class="data-value">{{ resource_data|val_from_key:"Localización"|val_from_key:"Colección" }}</span>
</div>
{% endif %}
{% if resource_data|val_from_key:"Localización"|has_key:"Ubicación" and resource.print_ubic %}
<div class="data-row" style="margin-left: 15px;">
<span class="data-value" style="width: 100%;"><b>Ambiente : </b> {{resource_data|val_from_key:"Localización"|val_from_key:"Ubicación"|val_from_key:"Ambiente" }}</span>
</div>
<div class="data-row" style="margin-left: 15px;">
<span class="data-value" style="width: 100%;"><b>N° de ambiente : </b> {{resource_data|val_from_key:"Localización"|val_from_key:"Ubicación"|val_from_key:"N° de ambiente" }}</span>
</div>
<div class="data-row" style="margin-left: 15px;">
<span class="data-value" style="width: 100%;"><b>N° de bandeja : </b> {{resource_data|val_from_key:"Localización"|val_from_key:"Ubicación"|val_from_key:"N° de bandeja" }}</span>
</div>
<div class="data-row" style="margin-left: 15px;">
<span class="data-value" style="width: 100%;"><b>N° de caja : </b> {{resource_data|val_from_key:"Localización"|val_from_key:"Ubicación"|val_from_key:"N° de caja" }}</span>
</div>
<div class="data-row">
<span class="data-value" style="width: 100%;"><b>Ubicación actual : </b> {{resource_data|val_from_key:"Localización"|val_from_key:"Ubicación"|val_from_key:"Ubicación actual" }}</span>
</div>
{% endif %}
<div class="data-row">
<span class="data-label" style="width: 100%;">Coordenadas / Geometría: </span>
</div>
{% if resource_data|val_from_key:"Localización"|has_key:"Coordenadas / Geometría" and resource.print_ubic %}
{% with gis_vector=resource_data|val_from_key:"Localización"|val_from_key:"Coordenadas / Geometría"|val_from_key:"@value"|json_to_obj %}
{% for gis in gis_vector.features %}
<div class="data-row">
<span class="data-value" style="width: 100%; font-size: .72em;">{{ gis.geometry|truncatewords:24 }}</span>
</div>
{% endfor %}
{% endwith %}
<div class="data-row">
<span class="data-value" style="width: 100%;"><b>Geometría principal : </b>{{ resource_data|val_from_key:"Localización"|val_from_key:"Coordenadas / Geometría"|val_from_key:"Tipo de geometría" }}</span>
</div>
{% endif %}
{% endif %}
</div>
<div class="tiles-grid-grp-col">
<div class="tile-block">
<div class="tile-title">Mapa de referencia</div>
<img src="data:image/png;base64,{{ resource.map_img }}">
</div>
</div>
</div>
<div class="tile-block">
<div class="tile-title">Marco legal</div>
{% if resource_data|has_key:"Marco Legal" %}
<div class="tiles-grid-grp">
<div class="tile-block">
<div class="data-row">
<span class="data-value" style="width: 100%;"><b>Reconocimiento Internacional : </b>{{ resource_data|val_from_key:"Marco Legal"|val_from_key:" Reconocimiento Internacional" }}</span>
</div>
<div class="data-row">
<span class="data-value" style="width: 100%;"><b>Patrimonio Cultural Departamental : </b>{{ resource_data|val_from_key:"Marco Legal"|val_from_key:"Patrimonio Cultural Departamental" }}</span>
</div>
<div class="data-row">
<span class="data-value" style="width: 100%;"><b>Patrimonio Cultural Nacional : </b>{{ resource_data|val_from_key:"Marco Legal"|val_from_key:"Patrimonio Cultural Nacional" }}</span>
</div>
<div class="data-row">
<span class="data-value" style="width: 100%;"><b>Patrimonio Cultural Municipal : </b>{{ resource_data|val_from_key:"Marco Legal"|val_from_key:"Patrimonio Cultural Municipal" }}</span>
</div>
</div>
<div class="tiles-grid-grp-col">
<div class="tile-block">
{% if resource_data|val_from_key:"Marco Legal"|has_key:"Forma de ingreso" %}
{% if resource_data|val_from_key:"Marco Legal"|val_from_key:"Forma de ingreso"|has_key:"Ingreso" %}
<div class="data-row">
<span class="data-value" style="width: 100%;"><b>Forma de ingreso : </b>{{ resource_data|val_from_key:"Marco Legal"|val_from_key:"Forma de ingreso"|val_from_key:"Ingreso"|val_from_key:"@value" }}</span>
</div>
{% if resource_data|val_from_key:"Marco Legal"|val_from_key:"Forma de ingreso"|val_from_key:"Ingreso"|has_key:"Otros" %}
<div class="data-row">
<span class="data-value" style="width: 100%;"><b>Otra forma de ingreso : </b>{{ resource_data|val_from_key:"Marco Legal"|val_from_key:"Forma de ingreso"|val_from_key:"Ingreso"|val_from_key:"Otros"|val_from_key:"@value" }}</span>
</div>
<div class="data-row">
<span class="data-value" style="width: 100%;"><b>Tipo de documento : </b>{{ resource_data|val_from_key:"Marco Legal"|val_from_key:"Forma de ingreso"|val_from_key:"Ingreso"|val_from_key:"Otros"|val_from_key:"Tipo de documento de entrega" }}</span>
</div>
{% endif %}
{% endif %}
{% endif %}
</div>
</div>
</div>
{% endif %}
</div>
<div class="tile-block">
<div class="tile-title">Características</div>
{% if resource_data|has_key:"Características" %}
{% for desc in resource_data|val_from_key:"Características" %}
{% if desc == "Principales transformaciones de la expresión Cultural" or desc == "Riesgos y amenazas" %}
<div class="data-row">
<span class="data-label" style="width: 100%;">{{ desc }} : </span>
</div>
<div class="data-row" style="margin-left: 15px;">
<span class="data-value" style="width: 100%;">{{ resource_data|val_from_key:"Características"|val_from_key:desc|safe|cut:"<p>&nbsp;</p>" }}</span>
</div>
{% elif desc == "Medidas de la pieza" %}
<div class="data-row">
<span class="data-label" style="width: 100%;">{{ desc }} (cm. y gr.) : </span>
</div>
{% if resource_data|val_from_key:"Características"|val_from_key:desc|has_key:"Medidas" %}
{% for item in resource_data|val_from_key:"Características"|val_from_key:desc|val_from_key:"Medidas" %}
<div class="data-row" style="margin-left: 15px;">
<span class="data-value" style="width: 100%;"><b>{{item.Medida}} : </b>Medida mínima: {{ item|val_from_key:"Medida mínima" }} | Medida máxima : {{ item|val_from_key:"Medida máxima" }}</span>
</div>
{% endfor %}
<div class="data-row" style="margin-left: 15px;">
<span class="data-value" style="width: 100%;"><b>Observaciones : </b>{{ resource_data|val_from_key:"Características"|val_from_key:desc|val_from_key:"Observaciones a las medidas"|safe|cut:"<p>&nbsp;</p>" }}</span>
</div>
{% endif %}
{% elif desc == "Estado de conservación" %}
<div class="data-row">
<span class="data-value" style="width: 100%;"><b>Estado de conservación : </b>{{ resource_data|val_from_key:"Características"|val_from_key:desc|val_from_key:"@value"|safe|cut:"<p>&nbsp;</p>" }} </span>
</div>
<div class="data-row" style="margin-left: 15px;">
<span class="data-value" style="width: 100%;"><b>Observaciones : </b>{{ resource_data|val_from_key:"Características"|val_from_key:desc|val_from_key:"Observaciones"|safe|cut:"<p>&nbsp;</p>" }}</span>
</div>
{% elif desc == "Uso Actual" or desc == "Nivel de integridad" %}
<div class="data-row">
<span class="data-value" style="width: 100%;"><b>{{ desc }} : </b>{{ resource_data|val_from_key:"Características"|val_from_key:desc }}</span>
</div>
{% elif desc == "Intervenciones" %}
<div class="data-row">
<span class="data-label" style="width: 100%;">{{ desc }} : </span>
</div>
<div class="data-row" style="margin-left: 15px;">
<span class="data-value" style="width: 100%;"><b>Tiene intervenciones : </b>{{resource_data|val_from_key:"Características"|val_from_key:"Intervenciones"|val_from_key:"Sin intervención"|yesno:"Si,No"}}</span>
</div>
{% if resource_data|val_from_key:"Características"|val_from_key:desc|has_key:"Intervenciónes" %}
{% for item in resource_data|val_from_key:"Características"|val_from_key:desc|val_from_key:"Intervenciónes" %}
<div class="data-row" style="margin-left: 15px;">
<span class="data-value" style="width: 100%;"><b>Intervención : </b>{{ item }}</span>
</div>
{% endfor %}
{% endif %}
{% elif desc == "Características Iconográficas/ornamentales" %}
<div class="data-row">
<span class="data-label" style="width: 100%;">{{ desc }} : </span>
</div>
{% for item in resource_data|val_from_key:"Características"|val_from_key:desc %}
<div class="data-row" style="margin-left: 15px;">
<span class="data-value" style="width: 100%;">{{ item|safe|cut:"<p>&nbsp;</p>" }}</span>
</div>
{% endfor %}
{% endif %}
{% endfor %}
<div class="data-row">
<span class="data-value" style="width: 100%;"><b>Condiciones de seguridad : </b>{{ resource_data|val_from_key:"Características"|val_from_key:"Condiciones de seguridad" }} </span>
</div>
{% endif %}
</div>
<div class="tile-block">
<div class="tile-title">Medios adjuntos</div>
{% if resource_data|has_key:"Recursos adjuntos" %}
<div class="tiles-grid-grp">
{% for medio in resource_data|val_from_key:'Recursos adjuntos'|val_from_key:'Medio de información' %}
<div class="data-row" style="margin-left: 15px; padding: 0;">
<a href={{resource.sprpcb_url}}{{ medio.url }} >{{ medio.tipo }} : {{ medio|val_from_key:'@value' }} ({{ medio.formato|slice:"-4:" }})</a>
</div>
{% endfor %}
</div>
{% endif %}
</div>
<div class="tile-block">
<div class="tile-title">Observaciones</div>
{% if resource_data|has_key:"Observaciones" %}
<div class="data-row" style="margin-left: 15px;">
<span class="data-value" style="width: 100%;"><b>{{ resource_data|val_from_key:"Observaciones"|val_from_key:"Tipo de descripción" }} : </b>{{ resource_data|val_from_key:"Observaciones"|val_from_key:"Descripción"|safe|cut:"<p>&nbsp;</p>" }} </span>
</div>
{% endif %}
</div>
<div class="tile-block">
<div class="tile-title">Responsables</div>
{% if resource_data|has_key:"Responsables" %}
<div class="data-row" style="margin-left: 15px;">
<span class="data-value" style="width: 100%;"><b>Entidad administrativa : </b>{{ resource_data|val_from_key:"Responsables"|val_from_key:"Entidad administrativa" }} </span>
</div>
{% if resource_data|val_from_key:"Responsables"|has_key:"Responsable" %}
{% for item in resource_data|val_from_key:"Responsables"|val_from_key:"Responsable" %}
<div class="data-row" style="margin-left: 15px;">
<span class="data-value" style="width: 100%;"><b>{{ item|val_from_key:"Rol" }} ({{ item|val_from_key:"Fecha" }}) : </b>{{ item|val_from_key:"@value" }}</span>
</div>
{% endfor %}
{% endif %}
{% endif %}
</div>
{% if resource_data|has_key:"Recursos adjuntos" and resource.print_imgs %}
<h2>Anexo de imágenes</h2>
<div class="gallery">
{% for medio in resource_data|val_from_key:'Recursos adjuntos'|val_from_key:'Medio de información' %}
{% if medio.formato in "image/bmp, image/gif, image/jpg, image/jpeg, image/png, image/tif, image/tiff" %}
<div class="gallery-item">
<img src="{{resource.sprpcb_url}}{{ medio.url }}" alt="{{medio.file}}">
<a href="{{resource.sprpcb_url}}{{ medio.url }}">&nbsp; {{ medio.tipo }} : {{ medio|val_from_key:'@value' }}&nbsp; </a>
</div>
{% endif %}
{% endfor %}
</div>
{% endif %}
{% else %}
<p class="no-data">El recurso no tiene información.</p>
{% endif %}
</body>
{% endwith %}
{% endfor %}
</html>