@extends('layouts.app')

@section('title', 'Add Your Business — iiSHEEG')

@section('content')
<section class="bg-navy text-white py-5">
    <div class="container">
        <h1 class="h3 mb-1">Add your business</h1>
        <p class="text-light-muted mb-0">List your business in the iiSHEEG directory — submissions are reviewed before going live.</p>
    </div>
</section>

<section class="container py-5">
    <div class="row justify-content-center">
        <div class="col-lg-8">
            @if ($errors->any())
                <div class="alert alert-danger">
                    <ul class="mb-0">
                        @foreach ($errors->all() as $error)
                            <li>{{ $error }}</li>
                        @endforeach
                    </ul>
                </div>
            @endif

            <form action="{{ route('business.store') }}" method="POST" enctype="multipart/form-data" class="card border-0 shadow-sm p-4">
                @csrf
                <div class="mb-3">
                    <label for="name" class="form-label fw-semibold text-navy">Business name</label>
                    <input type="text" name="name" id="name" class="form-control" value="{{ old('name') }}" required>
                </div>

                <div class="row">
                    <div class="col-md-6 mb-3">
                        <label for="category_id" class="form-label fw-semibold text-navy">Category</label>
                        <select name="category_id" id="category_id" class="form-select" required>
                            <option value="">Select a category</option>
                            @foreach ($categories as $category)
                                <option value="{{ $category->id }}" @selected(old('category_id') == $category->id)>{{ $category->name }}</option>
                            @endforeach
                        </select>
                    </div>
                    <div class="col-md-6 mb-3">
                        <label for="city_id" class="form-label fw-semibold text-navy">City</label>
                        <select name="city_id" id="city_id" class="form-select" required>
                            <option value="">Select a city</option>
                            @foreach ($cities as $city)
                                <option value="{{ $city->id }}" @selected(old('city_id') == $city->id)>{{ $city->name }}, {{ $city->country }}</option>
                            @endforeach
                        </select>
                    </div>
                </div>

                <div class="mb-3">
                    <label for="description" class="form-label fw-semibold text-navy">Description</label>
                    <textarea name="description" id="description" class="form-control" rows="4">{{ old('description') }}</textarea>
                </div>

                <div class="row">
                    <div class="col-md-6 mb-3">
                        <label for="phone" class="form-label fw-semibold text-navy">Phone</label>
                        <input type="text" name="phone" id="phone" class="form-control" value="{{ old('phone') }}">
                    </div>
                    <div class="col-md-6 mb-3">
                        <label for="website" class="form-label fw-semibold text-navy">Website</label>
                        <input type="url" name="website" id="website" class="form-control" placeholder="https://" value="{{ old('website') }}">
                    </div>
                </div>

                <div class="mb-4">
                    <label for="logo" class="form-label fw-semibold text-navy">Logo</label>
                    <input type="file" name="logo" id="logo" class="form-control" accept="image/*">
                    <div class="form-text">PNG or JPG, max 2MB.</div>
                </div>

                <button type="submit" class="btn btn-teal w-100">
                    <i class="bi bi-send me-1"></i> Submit for review
                </button>
            </form>
        </div>
    </div>
</section>
@endsection
