Commit ecdaefbf authored by Mahmoud Aglan's avatar Mahmoud Aglan

Fix invoice print for tablets/phones: open dedicated print page instead of window.print()

- Registration wizard now opens /invoices/{uuid}/print in new tab instead of printing whole page
- Print view redesigned: mobile-responsive layout, touch-friendly 48px buttons, proper viewport
- Share button (Web Share API) shows on mobile devices that support it
- Print-receipt-button component changed from window.open popup to target=_blank link
- Added min-height 48px to all action buttons for touch accessibility
Co-Authored-By: 's avatarClaude Opus 4.6 <noreply@anthropic.com>
parent 4cb2acc4
@props(['route', 'size' => 'md'])
@props(['route', 'size' => 'md', 'label' => null])
@php
$sizeClasses = match($size) {
'sm' => 'px-3 py-2 text-sm gap-1.5',
'lg' => 'px-6 py-3 text-base gap-2.5',
default => 'px-4 py-2.5 text-sm gap-2',
'sm' => 'px-3 py-2 text-sm gap-1.5 min-h-[36px]',
'lg' => 'px-6 py-3 text-base gap-2.5 min-h-[48px]',
default => 'px-4 py-2.5 text-sm gap-2 min-h-[44px]',
};
@endphp
<button
type="button"
x-data
@click="
const win = window.open('{{ $route }}', '_blank', 'width=350,height=600,scrollbars=yes,resizable=yes');
if (win) {
win.focus();
}
"
{{ $attributes->merge(['class' => "inline-flex items-center justify-center {$sizeClasses} bg-green-600 text-white rounded-lg font-medium hover:bg-green-700 active:bg-green-800 active:scale-[0.97] focus:outline-none focus:ring-2 focus:ring-green-500 focus:ring-offset-2 transition-all"]) }}
<a
href="{{ $route }}"
target="_blank"
{{ $attributes->merge(['class' => "inline-flex items-center justify-center {$sizeClasses} bg-green-600 text-white rounded-lg font-medium hover:bg-green-700 active:bg-green-800 active:scale-[0.97] focus:outline-none focus:ring-2 focus:ring-green-500 focus:ring-offset-2 transition-all no-underline"]) }}
>
<svg class="w-5 h-5" fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M17 17h2a2 2 0 002-2v-4a2 2 0 00-2-2H5a2 2 0 00-2 2v4a2 2 0 002 2h2m2 4h6a2 2 0 002-2v-4a2 2 0 00-2-2H9a2 2 0 00-2 2v4a2 2 0 002 2zm8-12V5a2 2 0 00-2-2H9a2 2 0 00-2 2v4h10z"/>
</svg>
{{ __('طباعة الإيصال') }}
</button>
{{ $label ?? __('طباعة الإيصال') }}
</a>
<div>
<style>
@media print {
nav, aside, .sidebar, header, [data-topbar], .print\:hidden { display: none !important; }
main { margin: 0 !important; padding: 0 !important; width: 100% !important; }
body { background: white !important; }
#printable-invoice { border: none !important; box-shadow: none !important; border-radius: 0 !important; padding: 0 !important; max-width: 100% !important; }
}
</style>
{{-- Header --}}
<div class="flex items-center justify-between mb-6 print:hidden">
......@@ -946,20 +938,20 @@ class="inline-flex items-center gap-2 px-8 py-3 min-h-16 bg-green-600 text-white
</div>
{{-- Actions --}}
<div class="flex items-center justify-center gap-4 mt-6 print:hidden">
<button onclick="window.print()"
class="inline-flex items-center gap-2 px-6 py-3 bg-gray-800 text-white rounded-lg hover:bg-gray-900 text-base font-medium transition-colors">
<div class="flex flex-col sm:flex-row items-stretch sm:items-center justify-center gap-3 mt-6 print:hidden">
<a href="{{ route('invoices.print', $invoice_uuid) }}" target="_blank"
class="inline-flex items-center justify-center gap-2 px-6 py-3 min-h-[48px] bg-gray-800 text-white rounded-lg hover:bg-gray-900 active:bg-gray-950 text-base font-medium transition-colors">
<svg class="w-5 h-5" fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M17 17h2a2 2 0 002-2v-4a2 2 0 00-2-2H5a2 2 0 00-2 2v4a2 2 0 002 2h2m2 4h6a2 2 0 002-2v-4a2 2 0 00-2-2H9a2 2 0 00-2 2v4a2 2 0 002 2zm8-12V5a2 2 0 00-2-2H9a2 2 0 00-2 2v4h10z"/>
</svg>
{{ __('طباعة الفاتورة') }}
</button>
</a>
<a href="{{ route('receptionist.new-registration') }}" wire:navigate
class="inline-flex items-center gap-2 px-6 py-3 bg-blue-600 text-white rounded-lg hover:bg-blue-700 text-base font-medium transition-colors">
class="inline-flex items-center justify-center gap-2 px-6 py-3 min-h-[48px] bg-blue-600 text-white rounded-lg hover:bg-blue-700 active:bg-blue-800 text-base font-medium transition-colors">
{{ __('تسجيل آخر') }}
</a>
<a href="{{ route('receptionist.dashboard') }}" wire:navigate
class="inline-flex items-center gap-2 px-6 py-3 bg-gray-100 text-gray-700 rounded-lg hover:bg-gray-200 text-base font-medium transition-colors">
class="inline-flex items-center justify-center gap-2 px-6 py-3 min-h-[48px] bg-gray-100 text-gray-700 rounded-lg hover:bg-gray-200 active:bg-gray-300 text-base font-medium transition-colors">
{{ __('العودة للاستقبال') }}
</a>
</div>
......
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment