@extends('theme.default')
@section('title', 'Alunos')
@section('title.page', 'Alunos')
@section('title.page1', 'CAE')
@section('title.page2', 'Alunos')
@section('title.page3', 'Lista de alunos')
@section('content')
    <div class="row">
        <div class="col-sm-12">
            <div class="card">
                <div class="card-block row">
                    <div class="col-sm-12 col-lg-12 col-xl-12">
                        <div class="table-responsive">
                            <table class="table">
                                <thead class="bg-primary">
                                    <tr>
                                        <th scope="col">#</th>
                                        <th scope="col">Nome</th>
                                        <th scope="col">CPF</th>
                                        <th scope="col">Escola</th>
                                        <th scope="col">Turma</th>
                                        <th></th>
                                    </tr>
                                </thead>
                                <tbody>
                                        @foreach ($alunos as $aluno)
                                            <tr>
                                                <th scope="row">{{ $aluno->id }}</th>
                                                <td>{{ $aluno->nome }}</td>
                                                <td>{{ $aluno->cpf }}</td>
                                                <td>{{ $aluno->turma->escola->nome }}</td>
                                                <td>{{ $aluno->turma->nome }}</td>
                                                <td>
                                                    <div class="dropdown">
                                                        <button class="btn btn-link p-0 gear-btn" type="button"
                                                            data-bs-toggle="dropdown" aria-expanded="false">
                                                            <i data-feather="settings" class="gear-icon bg-primary"></i>
                                                        </button>

                                                        <ul class="dropdown-menu dropdown-menu-end">
                                                            <li>
                                                                <form action="editar.php" method="post">
                                                                    <input type="hidden" name="id" value="123">
                                                                    <button type="submit" class="dropdown-item">
                                                                        Editar
                                                                    </button>
                                                                </form>
                                                            </li>

                                                            <li>
                                                                <form action="excluir.php" method="post"
                                                                    onsubmit="return confirm('Tem certeza que deseja excluir?')">
                                                                    <input type="hidden" name="id" value="123">
                                                                    <button type="submit" class="dropdown-item text-danger">
                                                                        Excluir
                                                                    </button>
                                                                </form>
                                                            </li>
                                                        </ul>
                                                    </div>

                                                </td>
                                            </tr>
                                        @endforeach
                                </tbody>
                            </table>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>

@endsection