{% extends 'frontend/base.html.twig' %}
{% block body %}
<main>
<div class="pt-4 pb-5 mb-4">
<div class="container">
<div class="pt-2 mb-5">
<div class="row">
<div class="col-lg-5 pt-0">
<div class="mb-0">
{% for dok in dokumen %}
<figure class="mb-0 mt-4">
{% set hasPoster = dok.path ? "uploads/" ~ dok.path : "frontend/img/poster-placeholder.png" %}
{% set extensi = hasPoster|split('.') %}
{% set ext = extensi|last %}
{% if ext == 'pdf' %}
<div class="text-light">
<a class="btn btn-secondary btn-sm d-flex align-items-center" href="{{ path('infografik_preview', {id: dok.id, info: infografik.id}) }}">
<i class="bi-file-pdf"></i>
Preview PDF
</a>
</div>
<img src="{{ asset('frontend/img/pdf.png') }}" class="img-infografis" style="object-fit: contain;" alt="img-grafis" style="width:1px; height:1px;"/>
{% else %}
<img src="{{ asset(hasPoster) }}" class="img-infografis" style="object-fit: contain;" alt="img-grafis"/>
{% endif %}
</figure>
{% endfor %}
</div>
</div>
<div class="col-lg-7 pt-0">
<h2 class="title-detail-infografis">{{ infografik.judul }}</h2>
<div class="info d-flex">
<div class="mr-3">
<i class="fa fa-calendar mr-1"></i>
{{ infografik.releaseDate | date('d F Y') }}
</div>
<div class="mr-3">
<i class="fa fa-eye mr-1"></i>
{{ infografik.view }}
</div>
<div class="d-flex align-items-center">
<div class="mr-2">Bagikan:</div>
<a href="https://www.facebook.com/sharer/sharer.php?u={{app.request.getSchemeAndHttpHost()}}{{ path('detail_publikasii', {id: infografik.id}) }}" target="_blank">
<i class="fa fa-facebook-square mr-2"></i>
</a>
<a href="https://twitter.com/intent/tweet?text={{ infografik.judul }}&url={{app.request.getSchemeAndHttpHost()}}{{ path('detail_publikasii', {id: infografik.id}) }}" target="_blank">
<i class="fa fa-twitter-square mr-2"></i>
</a>
<a href="whatsapp://send?text={{ infografik.judul }} {{app.request.getSchemeAndHttpHost()}}{{ path('detail_publikasii', {id: infografik.id}) }}" target="_blank">
<i class="fa fa-whatsapp"></i>
</a>
</div>
</div>
<div class="border-top my-3"></div>
<p class="mt-2">
{{ infografik.deskripsi | raw }}
</p>
<table class="table table-bordered">
<tbody>
<tr>
<th class="bg-light">Kategori</th>
<td>
{% for kat in kategori %}
{{ kat.urusan }}
<br>
{% else %}
<i class="fa fa-minus mr-1"></i>
{% endfor %}
</td>
</tr>
<tr>
<th class="bg-light">Sumber Data</th>
<td>
{{ infografik.sumber }}
</td>
</tr>
</tbody>
</table>
<div class="mt-2 mb-3 ml-auto">
<a href="{{ path('publikasii') }}" class="btn btn-outline-dark btn-sm d-flex align-items-center" style="width: 35%;">
<i class="bi-arrow-left mr-1"></i>
Kembali Daftar Publikasi
</a>
</div>
{% if dokumen_pdf is not empty %}
<a href="/uploads/publikasi/{{ dokumen_pdf.path }}" style="background-color: #9e0a0a;" class="btn btn-primary" target="_blank">
<i class="fa fa-eye mr-1" style="font-size: 13px;"></i>Lihat
</a>
<a href="/uploads/publikasi/{{ dokumen_pdf.path }}" style="background-color: #9e0a0a;" class="btn btn-primary" download>
<i class="fa fa-download mr-1" style="font-size: 13px;"></i>Unduh
</a>
{% endif %}
{# <button onclick="dropDown()" class="dropbtn text-light" style="background-color: #9e0a0a;">
<i class="fa fa-download mr-1" style="font-size: 13px;"></i>Unduh</button>
<div id="myDropdown" class="dropdown-content">
<a href="{{ path('publikasi_download', {id: infografik.id}) }}">
<i class="fas fa-file-image mr-1" style="font-size: 13px;"></i>Gambar (Zip)</a>
<a href="{{ path('publikasi_pdf', {id: infografik.id}) }}">
<i class="fas fa-file-pdf mr-1" style="font-size: 13px;"></i>Pdf</a>
</div> #}
</div>
</div>
</div>
</div>
</div>
</main>
{% endblock %}