<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=ads" method="POST" class="mt-4">
                @csrf
                <div class="space-y-4">
                    @php
                        $textareas = [
                            ['label' => 'Home Top Ad', 'name' => 'home_top_ad'],
                            ['label' => 'Dashboard Top Ad', 'name' => 'dashboard_top_ad'],
                            ['label' => 'Dashboard Middle Ad', 'name' => 'dashboard_middle_ad'],
                            ['label' => 'Dashboard Bottom Ad', 'name' => 'dashboard_bottom_ad'],
                            ['label' => 'Faucet Top Ad', 'name' => 'faucet_top_ad'],
                            ['label' => 'Faucet Middle Ad', 'name' => 'faucet_middle_ad'],
                            ['label' => 'Faucet Bottom Ad', 'name' => 'faucet_bottom_ad'],
                            ['label' => 'PTC Top Ad', 'name' => 'ptc_top_ad'],
                            ['label' => 'PTC Bottom Ad', 'name' => 'ptc_bottom_ad'],
                            ['label' => 'PTC Redirect Top Ad', 'name' => 'ptcred_top_ad'],
                            ['label' => 'PTC Redirect Bottom Ad', 'name' => 'ptcred_bottom_ad'],
                            ['label' => 'Shortlink Top Ad', 'name' => 'link_top_ad'],
                            ['label' => 'Shortlink Bottom Ad', 'name' => 'link_bottom_ad'],
                            ['label' => 'Shortlink Redirect Top Ad', 'name' => 'linkred_top_ad'],
                            ['label' => 'Shortlink Redirect Bottom Ad', 'name' => 'linkred_bottom_ad'],
                            ['label' => 'Offerwalls Top Ad', 'name' => 'offer_top_ad'],
                            ['label' => 'Offerwalls Bottom Ad', 'name' => 'offer_bottom_ad'],
                        ];
                    @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>
