

<x-filament::page>
    <form wire:submit.prevent="create" class="space-y-6 mt-4"> <!-- Added mt-4 (16px) -->
        <div class="filament-page-header space-y-2 mb-6">
            {{-- Breadcrumbs --}}
            <div class="filament-breadcrumbs flex items-center gap-2 text-sm">
                <a href="{{ route('filament.admin.resources.pallet-validations.index') }}"
                   class="text-primary-500 hover:underline">
                    Pallet Validations
                </a>
                <span class="text-gray-500"> > </span>
                <span class="text-gray-600">Create</span>
            </div>
            <h1 class="text-3xl font-bold tracking-tight">Scan Pallet</h1>
        </div>

        <div class="filament-form space-y-6">
            {{ $this->form }}
        </div>

        <div class="bg-white shadow rounded-xl p-4">
            <livewire:pallet-data-table />
        </div>

        <div class="filament-actions mt-6">
            <x-filament::actions>
                @foreach ($this->getFormActions() as $action)
                    {{ $action }}
                @endforeach
            </x-filament::actions>
        </div>
    </form>

    @push('scripts')
    <script>
        window.addEventListener('open-pdf', event => {
            const url = event.detail.url;
            const win = window.open(url, '_blank');
            if (!win || win.closed || typeof win.closed == 'undefined') {
                alert('Popup blocked. Please allow popups for this site.');
            }
        });
    </script>
    @endpush
</x-filament::page>
