@extends('admin.layout')

@section('title', 'Parametres du site')

@section('content')
    <h1>Parametres du site</h1>
    <p class="muted">Liens de contact essentiels uniquement : WhatsApp, email affiche et Calendly.</p>

    <div class="card">
        <form method="post" action="{{ route('admin.settings.update') }}">
            @csrf
            @method('PUT')

            @foreach($fields as $key => $field)
                <label for="set_{{ $key }}">{{ $field['label'] }}</label>
                @if(str_ends_with($key, '_text') || str_ends_with($key, '_sub'))
                    <textarea id="set_{{ $key }}" name="{{ $key }}" rows="3">{{ old($key, $field['value']) }}</textarea>
                @else
                    <input id="set_{{ $key }}" type="text" name="{{ $key }}" value="{{ old($key, $field['value']) }}" maxlength="2048">
                @endif
            @endforeach

            <button type="submit" class="btn">Enregistrer</button>
        </form>
    </div>
@endsection
