181 lines
6.2 KiB
PHP
181 lines
6.2 KiB
PHP
<!DOCTYPE html>
|
|
<html lang="it">
|
|
<head>
|
|
<meta charset="utf-8">
|
|
<meta name="viewport" content="width=device-width, initial-scale=1">
|
|
<title>Territorio {{ $assignment->territorio?->numero }}</title>
|
|
<style>
|
|
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
|
|
|
|
body {
|
|
font-family: system-ui, -apple-system, sans-serif;
|
|
background: #f1f5f9;
|
|
min-height: 100dvh;
|
|
display: flex;
|
|
flex-direction: column;
|
|
}
|
|
|
|
header {
|
|
background: #fff;
|
|
border-bottom: 1px solid #e2e8f0;
|
|
padding: 14px 20px;
|
|
display: flex;
|
|
flex-wrap: wrap;
|
|
align-items: center;
|
|
gap: 12px 24px;
|
|
}
|
|
|
|
.logo {
|
|
font-size: 15px;
|
|
font-weight: 700;
|
|
color: #4f46e5;
|
|
letter-spacing: -.3px;
|
|
flex: none;
|
|
}
|
|
|
|
.info {
|
|
display: flex;
|
|
flex-wrap: wrap;
|
|
gap: 6px 20px;
|
|
flex: 1;
|
|
}
|
|
|
|
.chip {
|
|
display: inline-flex;
|
|
align-items: center;
|
|
gap: 5px;
|
|
background: #f1f5f9;
|
|
border: 1px solid #e2e8f0;
|
|
border-radius: 8px;
|
|
padding: 4px 10px;
|
|
font-size: 13px;
|
|
color: #374151;
|
|
}
|
|
|
|
.chip .label {
|
|
font-size: 11px;
|
|
color: #94a3b8;
|
|
font-weight: 500;
|
|
text-transform: uppercase;
|
|
letter-spacing: .4px;
|
|
}
|
|
|
|
.chip .value {
|
|
font-weight: 600;
|
|
color: #1e293b;
|
|
}
|
|
|
|
.open-btn {
|
|
display: inline-flex;
|
|
align-items: center;
|
|
gap: 6px;
|
|
background: #4f46e5;
|
|
color: #fff;
|
|
text-decoration: none;
|
|
font-size: 13px;
|
|
font-weight: 600;
|
|
padding: 7px 14px;
|
|
border-radius: 8px;
|
|
flex: none;
|
|
transition: background .15s;
|
|
}
|
|
.open-btn:hover { background: #4338ca; }
|
|
|
|
.pdf-area {
|
|
flex: 1;
|
|
display: flex;
|
|
flex-direction: column;
|
|
padding: 16px;
|
|
gap: 12px;
|
|
}
|
|
|
|
.pdf-embed {
|
|
flex: 1;
|
|
min-height: 60vh;
|
|
border-radius: 12px;
|
|
overflow: hidden;
|
|
box-shadow: 0 4px 24px rgba(0,0,0,.08);
|
|
background: #fff;
|
|
}
|
|
|
|
.pdf-embed embed,
|
|
.pdf-embed iframe {
|
|
width: 100%;
|
|
height: 100%;
|
|
min-height: 60vh;
|
|
border: 0;
|
|
display: block;
|
|
}
|
|
|
|
.fallback-notice {
|
|
background: #fef9c3;
|
|
border: 1px solid #fde047;
|
|
border-radius: 10px;
|
|
padding: 12px 16px;
|
|
font-size: 13px;
|
|
color: #854d0e;
|
|
display: none;
|
|
}
|
|
|
|
@media (max-width: 480px) {
|
|
header { padding: 10px 14px; }
|
|
.chip { font-size: 12px; padding: 3px 8px; }
|
|
}
|
|
</style>
|
|
</head>
|
|
<body>
|
|
<header>
|
|
<span class="logo">TerManager2</span>
|
|
|
|
<div class="info">
|
|
<div class="chip">
|
|
<span class="label">Territorio</span>
|
|
<span class="value">N° {{ $assignment->territorio?->numero }}</span>
|
|
</div>
|
|
<div class="chip">
|
|
<span class="label">Assegnato a</span>
|
|
<span class="value">{{ $assignment->proclamatore?->nome_completo ?? '—' }}</span>
|
|
</div>
|
|
<div class="chip">
|
|
<span class="label">Data</span>
|
|
<span class="value">{{ $assignment->assigned_at->format('d/m/Y') }}</span>
|
|
</div>
|
|
</div>
|
|
|
|
<a href="{{ $pdfUrl }}" download class="open-btn">
|
|
<svg width="14" height="14" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2"><path stroke-linecap="round" stroke-linejoin="round" d="M4 16v2a2 2 0 002 2h12a2 2 0 002-2v-2M7 10l5 5m0 0l5-5m-5 5V4"/></svg>
|
|
Scarica PDF
|
|
</a>
|
|
</header>
|
|
|
|
<div class="pdf-area">
|
|
<div class="pdf-embed" id="pdfContainer">
|
|
<embed src="{{ $pdfUrl }}" type="application/pdf" id="pdfEmbed">
|
|
</div>
|
|
<div class="fallback-notice" id="fallbackNotice">
|
|
Il tuo dispositivo non supporta la visualizzazione del PDF nel browser.
|
|
<a href="{{ $pdfUrl }}" download style="color:#4f46e5;font-weight:600;margin-left:6px;">Scarica il file PDF</a>
|
|
</div>
|
|
</div>
|
|
|
|
<script>
|
|
// Detect if embed loaded - fallback for mobile devices that don't support PDF embed
|
|
var embed = document.getElementById('pdfEmbed');
|
|
var notice = document.getElementById('fallbackNotice');
|
|
embed.onerror = function() {
|
|
notice.style.display = 'block';
|
|
};
|
|
// iOS Safari: embed always renders but PDF viewer doesn't work - show download link anyway
|
|
var ua = navigator.userAgent;
|
|
if (/iP(hone|ad|od)/i.test(ua) || (/Macintosh/i.test(ua) && 'ontouchend' in document)) {
|
|
document.getElementById('pdfContainer').innerHTML =
|
|
'<div style="display:flex;align-items:center;justify-content:center;height:100%;min-height:60vh;flex-direction:column;gap:16px;padding:24px;text-align:center;">' +
|
|
'<svg width="48" height="48" fill="none" viewBox="0 0 24 24" stroke="#94a3b8" stroke-width="1.5"><path stroke-linecap="round" stroke-linejoin="round" d="M19.5 14.25v-2.625a3.375 3.375 0 00-3.375-3.375h-1.5A1.125 1.125 0 0113.5 7.125v-1.5a3.375 3.375 0 00-3.375-3.375H8.25m0 12.75h7.5m-7.5 3H12M10.5 2.25H5.625c-.621 0-1.125.504-1.125 1.125v17.25c0 .621.504 1.125 1.125 1.125h12.75c.621 0 1.125-.504 1.125-1.125V11.25a9 9 0 00-9-9z"/></svg>' +
|
|
'<p style="font-size:14px;color:#64748b;max-width:240px">Safari su iOS non supporta la visualizzazione PDF nel browser.</p>' +
|
|
'<a href="{{ $pdfUrl }}" download style="background:#4f46e5;color:#fff;text-decoration:none;font-weight:600;font-size:14px;padding:10px 20px;border-radius:8px;">Scarica PDF</a>' +
|
|
'</div>';
|
|
}
|
|
</script>
|
|
</body>
|
|
</html>
|