@extends('layouts.app')

@section('content')
<div class="container">
    <h1 class="h3 mb-3">Reportes</h1>

    <div class="row">
        <div class="col-md-6 mb-3">
            <div class="card h-100">
                <div class="card-header">Libro de ventas (Excel)</div>
                <div class="card-body">
                    <form action="{{ route('reportes.ventas') }}" method="POST" class="row g-2 align-items-end">
                        @csrf
                        <div class="col-6">
                            <label class="form-label">Mes</label>
                            <select name="mes" class="form-select">
                                @foreach (range(1, 12) as $m)
                                    <option value="{{ $m }}" @selected($m == now()->month)>{{ $m }}</option>
                                @endforeach
                            </select>
                        </div>
                        <div class="col-6">
                            <label class="form-label">Año</label>
                            <input type="number" name="anio" class="form-control" value="{{ now()->year }}">
                        </div>
                        <div class="col-12">
                            <button type="submit" class="btn btn-primary w-100">Descargar</button>
                        </div>
                    </form>
                </div>
            </div>
        </div>

        <div class="col-md-6 mb-3">
            <div class="card h-100">
                <div class="card-header">Compras / entradas de inventario (Excel)</div>
                <div class="card-body">
                    <form action="{{ route('reportes.compras') }}" method="POST" class="row g-2 align-items-end">
                        @csrf
                        <div class="col-6">
                            <label class="form-label">Mes</label>
                            <select name="mes" class="form-select">
                                @foreach (range(1, 12) as $m)
                                    <option value="{{ $m }}" @selected($m == now()->month)>{{ $m }}</option>
                                @endforeach
                            </select>
                        </div>
                        <div class="col-6">
                            <label class="form-label">Año</label>
                            <input type="number" name="anio" class="form-control" value="{{ now()->year }}">
                        </div>
                        <div class="col-12">
                            <button type="submit" class="btn btn-primary w-100">Descargar</button>
                        </div>
                    </form>
                </div>
            </div>
        </div>

        <div class="col-md-6 mb-3">
            <div class="card h-100">
                <div class="card-header">Inventario (Excel)</div>
                <div class="card-body">
                    <p class="text-muted">Listado completo de productos con stock y precios.</p>
                    <a href="{{ route('reportes.inventario') }}" class="btn btn-primary">Descargar</a>
                </div>
            </div>
        </div>

        <div class="col-md-6 mb-3">
            <div class="card h-100">
                <div class="card-header">Estadísticas de facturación</div>
                <div class="card-body">
                    <p class="text-muted">Gráfico de facturación mensual.</p>
                    <a href="{{ route('reportes.estadisticas') }}" class="btn btn-primary">Ver estadísticas</a>
                </div>
            </div>
        </div>
    </div>
</div>
@endsection
