@use('Illuminate\Support\Facades\Storage')
<x-filament-panels::page>
    <div class="flex flex-col items-center justify-center text-center" style="min-height: calc(100vh - 8rem);">
        <p class="text-gray-500 dark:text-gray-400 mb-8">
            Din bild och information har sparats.
        </p>
        <br>

        @if($record)
            @if(!empty($record['image_path']))
                <img
                    src="{{ Storage::disk('public')->url($record['image_path']) }}"
                    alt="{{ $record['title'] ?? '' }}"
                    class="mb-6 rounded-xl shadow-lg max-h-72 object-cover"
                    style="height: 300px; width: auto;"
                >
                <br>
            @endif

            <dl class="mb-10 text-left grid grid-cols-[auto_1fr] gap-x-6 gap-y-3 text-sm w-full max-w-md">
                @if(!empty($record['title']))
                    <dt style="font-weight: bold;" class="font-bold">Titel</dt>
                    <dd class="text-gray-900 dark:text-white">{{ $record['title'] }}</dd>
                    <br>
                @endif
                @if(!empty($record['uploaded_by']))
                    <dt style="font-weight: bold;" class="font-bold">Uppladdad av</dt>
                    <dd class="text-gray-900 dark:text-white">{{ $record['uploaded_by'] }}</dd>
                    <br>
                @endif
                @if(!empty($record['captured_at']))
                    <dt style="font-weight: bold;" class="font-bold">Bild tagen</dt>
                    <dd class="text-gray-900 dark:text-white">{{ $record['captured_at'] }}</dd>
                    <br>
                @endif
                @if(!empty($record['lat']) && !empty($record['lng']))
                    <dt style="font-weight: bold;" class="font-bold">Plats</dt>
                    <dd class="text-gray-900 dark:text-white">{{ $record['lat'] }}, {{ $record['lng'] }}</dd>
                    <br>
                @endif
                @if(!empty($record['desc']))
                    <dt style="font-weight: bold;" class="font-bold">Kort beskrivning</dt>
                    <dd class="text-gray-900 dark:text-white">{{ $record['desc'] }}</dd>
                    <br>
                @endif
                @if(!empty($record['story']))
                    <dt style="font-weight: bold;" class="font-bold">Berättelse</dt>
                    <dd class="text-gray-900 dark:text-white">{{ $record['story'] }}</dd>
                    <br>
                @endif
            </dl>
        @endif

        <x-filament::button
            tag="a"
            :href="App\Filament\Resources\PhotoGeoData\PhotoGeoDataResource::getUrl('create')"
            size="lg"
        >
            Lägg till en till bild
        </x-filament::button>
    </div>
</x-filament-panels::page>
