feat(calendar): preview PDF programări in modal iframe

Same Alpine.js overlay pattern as the WO dashboard Docs tab: click
"🖨 PDF programări" opens a centered modal with the PDF iframed at
90vh, plus "Descarcă" and "Deschide în tab nou" fallbacks in the
header and Esc/click-outside to close. iframe src only binds when
the modal is open, so PDF generation doesn't happen on page load.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-08-12 05:35:20 +00:00
parent 74f5693fec
commit 293373f4ac
@@ -164,8 +164,28 @@
$_from = $_days[0]['date'] ?? today()->toDateString(); $_from = $_days[0]['date'] ?? today()->toDateString();
$_to = end($_days)['date'] ?? today()->toDateString(); $_to = end($_days)['date'] ?? today()->toDateString();
$_pdfUrl = url('/app/appointments/pdf?from=' . $_from . '&to=' . $_to); $_pdfUrl = url('/app/appointments/pdf?from=' . $_from . '&to=' . $_to);
$_pdfDl = $_pdfUrl . '&download=1';
@endphp @endphp
<a class="cv-btn" href="{{ $_pdfUrl }}" target="_blank">{{ __('🖨 PDF programări') }}</a> <div x-data="{ pdfOpen: false }" style="display:inline-block;">
<button type="button" class="cv-btn" @click="pdfOpen = true">{{ __('🖨 PDF programări') }}</button>
<div x-show="pdfOpen" x-cloak
style="position:fixed;inset:0;background:rgba(0,0,0,0.6);z-index:9999;display:flex;align-items:center;justify-content:center;padding:24px;"
@click.self="pdfOpen = false"
@keydown.escape.window="pdfOpen = false">
<div style="background:#fff;border-radius:8px;width:100%;max-width:1000px;height:90vh;display:flex;flex-direction:column;overflow:hidden;">
<div style="display:flex;align-items:center;justify-content:space-between;padding:10px 14px;border-bottom:1px solid #e5e7eb;">
<b style="font-size:14px;">{{ __('Programări') }} {{ $_from }} {{ $_to }}</b>
<div style="display:flex;gap:12px;align-items:center;">
<a href="{{ $_pdfDl }}" style="font-size:13px;color:#2563eb;text-decoration:none;">⬇️ {{ __('Descarcă') }}</a>
<a href="{{ $_pdfUrl }}" target="_blank" style="font-size:13px;color:#2563eb;text-decoration:none;">↗️ {{ __('Deschide în tab nou') }}</a>
<button type="button" @click="pdfOpen = false" style="background:none;border:none;font-size:20px;cursor:pointer;color:#6b7280;"></button>
</div>
</div>
<iframe x-bind:src="pdfOpen ? '{{ $_pdfUrl }}#toolbar=1&navpanes=0' : ''"
style="flex:1;width:100%;border:none;" title="PDF"></iframe>
</div>
</div>
</div>
<button class="cv-btn" wire:click="openNewPostForm">{{ __('+ Pod nou') }}</button> <button class="cv-btn" wire:click="openNewPostForm">{{ __('+ Pod nou') }}</button>
<button class="cv-btn cv-btn-primary" wire:click="openNewForm">{{ __('+ Programare nouă') }}</button> <button class="cv-btn cv-btn-primary" wire:click="openNewForm">{{ __('+ Programare nouă') }}</button>
</div> </div>