@extends('layouts.app')

@section('content')
<div class="container">
    <div class="row justify-content-center">
        <div class="col-lg-8">
            <div class="card shadow-sm">
                <div class="card-header bg-dark text-white d-flex justify-content-between align-items-center">
                    <span>Crear membresia</span>
                    <a href="{{ route('admin_fit.membership.index') }}" class="btn btn-sm btn-secondary">
                     <i class="bi bi-chevron-left"></i>
                    Volver</a>
                </div>
                <div class="card-body bg-white">
                    @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 method="POST" action="{{ route('admin_fit.membership.store') }}">
                        @csrf

                        <div class="row g-3">
                            <div class="col-md-8">
                                <label for="name" class="form-label">Nombre</label>
                                <input type="text" id="name" name="name" class="form-control" value="{{ old('name') }}" required maxlength="120">
                            </div>

                            <div class="col-md-4">
                                <label for="days" class="form-label">Dias</label>
                                <input type="number" id="days" name="days" class="form-control" value="{{ old('days', 30) }}" min="1" step="1" required>
                            </div>

                            <div class="col-md-4">
                                <label for="price" class="form-label">Precio</label>
                                <input type="number" id="price" name="price" class="form-control" value="{{ old('price', 0) }}" min="0" step="0.01" required>
                            </div>

                            <div class="col-md-8">
                                <label for="description" class="form-label">Descripcion</label>
                                <textarea id="description" name="description" class="form-control" rows="3" maxlength="1000">{{ old('description') }}</textarea>
                            </div>

                            <div class="col-12">
                                <div class="form-check">
                                    <input class="form-check-input" type="checkbox" id="is_active" name="is_active" value="1" {{ old('is_active', 1) ? 'checked' : '' }}>
                                    <label class="form-check-label" for="is_active">Activa</label>
                                </div>
                            </div>
                        </div>

                        <div class="d-flex justify-content-end mt-4">
                            <button type="submit" class="btn btn-success">Guardar</button>
                        </div>
                    </form>
                </div>
            </div>
        </div>
    </div>
</div>
@endsection
