@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">Secretarias</h4>
                    <p class="text-muted">Cadastro de Secretarias no Sistema</p>
                    <a class="btn btn-outline-primary btn-block d-grid gap-2" type="button"
                        href="{{ route('secretarias.create') }}" role="button">Nova Secretaria</a>
                </div>

                <div class="card">
                    <div class="card-body">

                        <!-- Table -->
                        <div class="table-responsive">
                            <table class="table table-sm table-hover">
                                <thead>
                                    <tr>
                                        <th scope="col">Código</th>
                                        <th scope="col">Nome</th>
                                        <th scope="col">Sigla</th>
                                        <th scope="col">Fone</th>
                                        <th scope="col">Celular</th>
                                        <th scope="col">E-Mail</th>
                                        <th scope="col">Ações</th>
                                    </tr>
                                </thead>
                                <tbody>
                                    @foreach ($secretarias as $secretaria)
                                        <tr>
                                            <td scope="row">{{ $secretaria->id }}</td>
                                            <td scope="row">{{ $secretaria->nome }}</td>
                                            <td scope="row">{{ $secretaria->sigla }}</td>
                                            <td scope="row">{{ $secretaria->fixo }}</td>
                                            <td scope="row">{{ $secretaria->celular }}</td>
                                            <td scope="row">{{ $secretaria->email }}</td>
                                            <td>
                                                <a href="{{ route('secretarias.edit', $secretaria->id) }}"
                                                    class="btn btn-sm btn-outline-warning">Editar</a>
                                                <form class="d-inline" method="POST"
                                                    action="{{ route('secretarias.destroy', $secretaria->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>
                                    @endforeach

                                </tbody>
                            </table>
                        </div>
                        {{ $secretarias->links() }}
                    </div>
                </div>
            </div>
        </div>
    @endsection
