@extends('admin.layouts.layout')

@section('content')
    <div class="row match-height">
        <div class="col-md-12 col-12">
            <div class="card">
                <div class="card-header">
                    <h4 class="card-title text-primary">Assinantes da NewsLetter</h4>
                    <span>Cadastro de Assinante no Sistema</span>
                </div>
                <div class="card">
                    <div class="card-body">
                        <!-- Table -->
                        <div class="table-responsive">
                            <table class="table table-sm table-hover">
                                <thead>
                                    <tr>
                                        <th>Id</th>
                                        <th>E-mail</th>
                                        <th>Data da Assinatura</th>
                                        <th>Ativo</th>
                                        <th>Ações</th>
                                    </tr>
                                </thead>
                                @foreach ($assinantes as $assinante)
                                    <tbody>
                                        <tr>
                                            <td>{{ $assinante->id }}</td>
                                            <td>{{ $assinante->assinante_email }}</td>
                                            <td>{{ date('d/m/Y', strtotime($assinante->assinante_data_hora)) }}</td>
                                            <td>{{ $assinante->assinante_situacao }}</td>
                                            <td>
                                                <a href="{{ route('assinantes.edit', $assinante->id) }}"
                                                    class="btn btn-sm btn-outline-warning">Editar</a>
                                                <form class="d-inline" method="POST"
                                                    action="{{ route('assinantes.destroy', $assinante->id) }}"
                                                    onSubmit="return confirm('Tem certeza que deseja excluir?')">
                                                    @method('DELETE')
                                                    @csrf
                                                    <button class="btn btn-sm btn-outline-danger">Exluir</button>
                                                </form>
                                            </td>
                                        </tr>
                                    </tbody>
                                @endforeach
                            </table>
                        </div>
                    </div>
                    {{ $assinantes->links() }}
                </div>
            </div>
        </div>
    </div>
@endsection
