@extends('header_nuevo_generico')

@section('main')
<div class="container">
    <div class="row">
        <h1 class="text-center text-fidelitas mt-5 pt-5">Inflación</h1>
    </div>
    <div class="row justify-content-end">
        <div class="col-1">
            <button class="btn btn-fidelitas" id="btn-modal-nuevo-año">Nuevo registro</button>
        </div>
    </div>
    <div class="row mt-1 justify-content-center">
        @if(empty($data))
            <h2 class="text-center">No hay datos disponibles.</h2>
        @else
            <table class="table" id="tabla-inflacion">
                <thead>
                    <tr class="bg-fidelitas">
                        <th>Año</th>
                        <th>Porcentaje</th>
                        <th>Fecha de creación</th>
                        <th>acciones</th>
                    </tr>
                </thead>
                <tbody>
                    @foreach($data as $registro)
                        <tr>
                            <td>{{$registro->anio}}</td>
                            <td>{{$registro->porcentaje}}</td>
                            <td>{{$registro->created}}</td>
                            <td><button id="btn-editar-año" data-id="{{$registro->id_inflacion}}" data-anio="{{$registro->anio}}" data-porcentaje="{{$registro->porcentaje}}" class="btn btn-fidelitas">Editar</button></td>
                        </tr>
                    @endforeach
                </tbody>
            </table>
        @endif
    </div>
</div>

@include('abm-inflacion/modales_inflacion')

@endsection

@section('funcionesJS')
<script src="/js/inflacionABM/inflacion.js?v={{rand()}}"></script>
@endsection

