fix(calendar): PDF programări via HTTP route, not Livewire wire:click
wire:click="exportPdf" attempted to return a binary Response through Livewire's JSON channel — it re-encoded the PDF bytes as JSON and triggered "Malformed UTF-8 characters, possibly incorrectly encoded". Added GET /app/appointments/pdf?from=...&to=... that streams the PDF with Content-Disposition: inline (or attachment when ?download=1) and switched the calendar button to a plain <a target="_blank"> pointing at that URL. The button now includes the currently visible period via query params. The old exportPdf() method is retained (still returns a plain PDF Response) because CalendarEnhancementsTest asserts against it — it's just no longer wired to the UI. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -159,7 +159,13 @@
|
||||
<h1>{{ __('Calendar vizual') }}</h1>
|
||||
</div>
|
||||
<div class="cv-btn-group">
|
||||
<button class="cv-btn" wire:click="exportPdf">{{ __('🖨 PDF programări') }}</button>
|
||||
@php
|
||||
$_days = $this->getDays();
|
||||
$_from = $_days[0]['date'] ?? today()->toDateString();
|
||||
$_to = end($_days)['date'] ?? today()->toDateString();
|
||||
$_pdfUrl = url('/app/appointments/pdf?from=' . $_from . '&to=' . $_to);
|
||||
@endphp
|
||||
<a class="cv-btn" href="{{ $_pdfUrl }}" target="_blank">{{ __('🖨 PDF programări') }}</a>
|
||||
<button class="cv-btn" wire:click="openNewPostForm">{{ __('+ Pod nou') }}</button>
|
||||
<button class="cv-btn cv-btn-primary" wire:click="openNewForm">{{ __('+ Programare nouă') }}</button>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user