Harden ticket gestione attachment modal blade
This commit is contained in:
parent
2ceb5e29f7
commit
684b71e2ff
|
|
@ -586,7 +586,28 @@
|
|||
</div>
|
||||
|
||||
@if($attachmentPreview)
|
||||
<div class="fixed inset-0 z-50 flex items-center justify-center bg-black/60 p-4" x-data="{ zoom: 1, pdfPage: 1, iframeKey: 0, refreshPdf() { this.iframeKey++; }, zoomIn() { this.zoom = Math.min(this.zoom + 0.2, 4); }, zoomOut() { this.zoom = Math.max(this.zoom - 0.2, 0.5); }, resetZoom() { this.zoom = 1; }, nextPage() { this.pdfPage = this.pdfPage + 1; this.refreshPdf(); }, prevPage() { this.pdfPage = Math.max(this.pdfPage - 1, 1); this.refreshPdf(); }, printPdf() { const frame = this.$refs.pdfFrame; if (frame?.contentWindow) { frame.contentWindow.focus(); frame.contentWindow.print(); } else { window.open(@js($attachmentPreview['url']), '_blank'); } } }">
|
||||
@php($attachmentPreviewUrl = (string) ($attachmentPreview['url'] ?? ''))
|
||||
<div class="fixed inset-0 z-50 flex items-center justify-center bg-black/60 p-4" x-data='{
|
||||
zoom: 1,
|
||||
pdfPage: 1,
|
||||
iframeKey: 0,
|
||||
pdfUrl: @js($attachmentPreviewUrl),
|
||||
refreshPdf() { this.iframeKey++; },
|
||||
zoomIn() { this.zoom = Math.min(this.zoom + 0.2, 4); },
|
||||
zoomOut() { this.zoom = Math.max(this.zoom - 0.2, 0.5); },
|
||||
resetZoom() { this.zoom = 1; },
|
||||
nextPage() { this.pdfPage = this.pdfPage + 1; this.refreshPdf(); },
|
||||
prevPage() { this.pdfPage = Math.max(this.pdfPage - 1, 1); this.refreshPdf(); },
|
||||
printPdf() {
|
||||
const frame = this.$refs.pdfFrame;
|
||||
if (frame?.contentWindow) {
|
||||
frame.contentWindow.focus();
|
||||
frame.contentWindow.print();
|
||||
} else if (this.pdfUrl) {
|
||||
window.open(this.pdfUrl, "_blank");
|
||||
}
|
||||
}
|
||||
}'>
|
||||
<div class="h-[92vh] w-full max-w-[96vw] rounded-xl bg-white shadow-2xl">
|
||||
<div class="flex items-center justify-between border-b px-4 py-3">
|
||||
<div>
|
||||
|
|
@ -641,7 +662,7 @@
|
|||
</div>
|
||||
</div>
|
||||
@elseif($attachmentPreview['is_pdf'] ?? false)
|
||||
<iframe x-ref="pdfFrame" x-bind:key="iframeKey" x-bind:src="@js($attachmentPreview['url']) + '#toolbar=1&navpanes=0&scrollbar=1&view=FitH&zoom=page-width&page=' + pdfPage" class="h-[84vh] w-full rounded border"></iframe>
|
||||
<iframe x-ref="pdfFrame" x-bind:key="iframeKey" x-bind:src="pdfUrl + '#toolbar=1&navpanes=0&scrollbar=1&view=FitH&zoom=page-width&page=' + pdfPage" class="h-[84vh] w-full rounded border"></iframe>
|
||||
@else
|
||||
<div class="rounded-md border bg-gray-50 p-4 text-sm text-gray-700">
|
||||
Anteprima non disponibile per questo formato. Scarica o apri il file:
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user