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:
2026-08-12 05:25:42 +00:00
parent 29e5481fc3
commit 74f5693fec
3 changed files with 39 additions and 2 deletions
+7 -1
View File
@@ -419,7 +419,13 @@ class CalendarBoard extends Page
Notification::make()->title(__('Post actualizat'))->success()->send();
}
/** Generate PDF for all appointments in the visible period. */
/**
* PDF for the visible period is now served by the plain HTTP route
* /app/appointments/pdf?from=...&to=... the button in the Blade
* view links to it directly, so Livewire never has to serialize a
* binary response (which caused "Malformed UTF-8" JSON errors).
* This method stays for the CalendarEnhancementsTest.
*/
public function exportPdf()
{
$days = $this->getDays();