<x-admin-layout>
@section('title', $page . ' | ' . get_setting('site_name'))
<div class="mt-4 grid grid-cols-12 gap-4 sm:mt-5 sm:gap-5 lg:mt-6 lg:gap-6">
    <div class="col-span-12">
        <div class="card px-4 pb-4 sm:px-5">
            <div class="space-y-4">
                <h2 class="text-2xl font-semibold text-slate-600 dark:text-navy-100 mt-4 mb-4">
                    {{ $page }}
                </h2>

                @if(session('success'))
                    <div class="alert flex items-center overflow-hidden rounded-lg border border-success text-success">
                        <div class="px-4 py-3 sm:px-5">
                            <strong>{{ session('success') }}</strong>
                        </div>
                    </div>
                @endif

                @if(session('error'))
                    <div class="alert flex items-center overflow-hidden rounded-lg border border-error text-error">
                        <div class="px-4 py-3 sm:px-5">
                            <strong>{{ session('error') }}</strong>
                        </div>
                    </div>
                @endif
            </div>

            <form action="/admin/settings/update?route=pagecode" method="POST" class="mt-4">
                @csrf
                <div class="space-y-4">
                    @php
                        $textareas = [
                            ['label' => 'User Head Code', 'name' => 'user_head_code'],
                            ['label' => 'User Footer Code', 'name' => 'user_footer_code'],
                            ['label' => 'Home Head Code', 'name' => 'home_head_code'],
                            ['label' => 'Home Footer Code', 'name' => 'home_footer_code'],
                        ];
                    @endphp

                    @foreach($textareas as $textarea)
                        <div>
                            <label class="block text-sm font-medium py-3">{{ $textarea['label'] }}:</label>
                            <textarea id="{{ $textarea['name'] }}" name="{{ $textarea['name'] }}" class="form-input peer w-full rounded-lg border border-slate-300 bg-transparent px-3 py-2 pl-4 placeholder:text-slate-400/70 hover:border-slate-400 focus:border-primary dark:border-navy-450 dark:hover:border-navy-400 dark:focus:border-accent">{{ get_setting($textarea['name']) }}</textarea>
                        </div>
                    @endforeach

                    <button type="submit" class="btn space-x-2 bg-primary font-medium text-white hover:bg-primary-focus focus:bg-primary-focus active:bg-primary-focus/90 dark:bg-accent dark:hover:bg-accent-focus dark:focus:bg-accent-focus dark:active:bg-accent/90">
                        Save
                    </button>
                </div>
            </form>

        </div>
    </div>
</div>
</x-admin-layout>
