@extends('layouts.app')

@section('title', 'Reporte — Recibos Anulados')

@section('content')
<div class="bg-body-light">
    <div class="content content-full">
        <div class="d-flex flex-column flex-sm-row justify-content-sm-between align-items-sm-center py-2">
            <div class="flex-grow-1">
                <h1 class="h3 fw-bold mb-2">
                    <i class="fa fa-receipt text-primary me-2"></i>Recibos Anulados
                </h1>
                <h2 class="fs-base lh-base fw-medium text-muted mb-0">
                    Listado detallado de comprobantes anulados y movimientos revertidos.
                </h2>
            </div>
            <div class="mt-3 mt-sm-0 ms-sm-3">
                <a href="{{ route('dashboard') }}" class="btn btn-sm btn-alt-secondary">
                    <i class="fa fa-home me-1"></i> Inicio
                </a>
            </div>
        </div>
    </div>
</div>

<div class="content">
    <div class="row justify-content-center">
        <div class="col-md-8 col-lg-6">

            <form method="POST" action="{{ route('reportes.recibos-anulados.pdf') }}" target="_blank">
                @csrf

                <div class="block block-rounded block-bordered shadow-sm">
                    <div class="block-header block-header-default">
                        <h3 class="block-title">Criterios de Fecha</h3>
                    </div>
                    <div class="block-content">

                        @if($errors->any())
                            <div class="alert alert-danger d-flex align-items-center mb-4" role="alert">
                                <div class="flex-shrink-0"><i class="fa fa-fw fa-times-circle"></i></div>
                                <div class="flex-grow-1 ms-3">
                                    <ul class="mb-0 fs-sm">
                                        @foreach($errors->all() as $e)<li>{{ $e }}</li>@endforeach
                                    </ul>
                                </div>
                            </div>
                        @endif

                        <div class="row g-3 mb-4">
                            <div class="col-md-6">
                                <label class="form-label text-muted fs-xs fw-bold text-uppercase" for="fechaini">Fecha Inicial <span class="text-danger">*</span></label>
                                <div class="input-group">
                                    <span class="input-group-text"><i class="fa fa-calendar-minus"></i></span>
                                    <input type="date" name="fechaini" id="fechaini" 
                                           class="form-control @error('fechaini') is-invalid @enderror" 
                                           value="{{ old('fechaini', $hoy) }}" 
                                           required>
                                </div>
                            </div>
                            <div class="col-md-6">
                                <label class="form-label text-muted fs-xs fw-bold text-uppercase" for="fechafin">Fecha Final <span class="text-danger">*</span></label>
                                <div class="input-group">
                                    <span class="input-group-text"><i class="fa fa-calendar-check"></i></span>
                                    <input type="date" name="fechafin" id="fechafin" 
                                           class="form-control @error('fechafin') is-invalid @enderror" 
                                           value="{{ old('fechafin', $hoy) }}" 
                                           required>
                                </div>
                            </div>
                        </div>

                    </div>
                    <div class="block-content block-content-full block-content-sm bg-body-light border-top text-end">
                        <button type="reset" class="btn btn-alt-secondary me-1">
                            <i class="fa fa-sync-alt me-1"></i> Limpiar
                        </button>
                        <button type="submit" class="btn btn-danger">
                            <i class="fa fa-file-pdf me-1"></i> Generar Reporte PDF
                        </button>
                    </div>
                </div>
            </form>

            <div class="block block-rounded block-bordered bg-body-extra-light mt-4">
                <div class="block-content py-3">
                    <div class="d-flex">
                        <div class="flex-shrink-0 me-3">
                            <i class="fa fa-exclamation-triangle text-warning fa-2x"></i>
                        </div>
                        <div class="flex-grow-1">
                            <p class="fs-sm fw-bold mb-1 text-uppercase text-dark">Información de Control:</p>
                            <p class="fs-sm text-muted mb-0">
                                Este reporte es de uso administrativo y contable. Detalla los recibos sin valor legal, especificando 
                                <strong>montos en moneda nacional y extranjera</strong>, además del motivo registrado para la anulación.
                            </p>
                        </div>
                    </div>
                </div>
            </div>

        </div>
    </div>
</div>
@endsection