@extends('adminlte::page')

@section('title', 'Pesquisa de Agendamentos')

@section('content_header')
    {{-- <a href="{{ route('agendamentos.create') }}" class="btn btn-success">Agendar</a>
    --}}
@endsection
{{-- @extends('admin.layouts.app')

@section('title', 'Pesquisa de Agendamentos')
--}}
@section('content')
    <div class="card card-outline card-success">
        <div class="card-body">
            <form action="{{ route('agendamentos.search') }}" class="form form-inline" method="POST">
                @csrf
                <input type="text" name="filter" placeholder="Filtrar:" class="form-control"
                    value="{{ $filters['filter'] ?? '' }}">
                <button type="submit" class="btn btn-info">Pesquisar</button>
            </form>
        </div>
    </div>
    <div class="card card-outline card-success">
        <div class="card-header">
            <h3 class="card-title"><b>Listagem dos Agendamentos</b></h3>
        </div>
        <!-- /.card-header -->
        <div class="card-body">
            <table class="table table-striped">
                <thead>
                    <tr>
                        <th>ID</th>
                        <th>NOME</th>
                        <th>CPF</th>
                        <th>TELEFONE</th>
                        <th>SERVIÇO</th>
                        <th>DATA</th>
                        <th width="100">AÇÕES</th>
                    </tr>
                </thead>
                <tbody>
                    @foreach ($agendamentos as $agendamento)
                        <tr>
                            <td>{{ $agendamento->id }}</td>
                            <td>{{ $agendamento->nome }}</td>
                            <td>{{ $agendamento->cpf }}</td>
                            <td>{{ $agendamento->telefone }}</td>
                            <td>{{ $agendamento->servico }}</td>
                            <td>{{ $agendamento->data }}</td>

                            <td>
                                <a href="{{ route('agendamentos.edit', $agendamento->id) }}"
                                    class="badge bg-green">Editar</a>
                                <a href="{{ route('agendamentos.show', $agendamento->id) }}"
                                    class="badge bg-green">Detalhes</a>
                            </td>
                        </tr>

                    @endforeach
                </tbody>
            </table>
        </div>
        <!-- /.card-body -->
        <div class="card-footer">
            The footer of the card
        </div>
        <!-- /.card-footer -->
    </div>
    <!-- /.card -->

    {{-- <a href="{{ route('agendamentos.create') }}" class="btn btn-primary">Cadastrar</a>
    <hr>
    <form action="{{ route('agendamentos.search') }}" class="form form-inline" method="POST">
        @csrf
        <input type="text" name="filter" placeholder="Filtrar:" class="form-control" value="{{ $filters['filter'] ?? '' }}">
        <button type="submit" class="btn btn-info">Pesquisar</button>
    </form>

    <table class="table table-striped">
        <thead>
            <tr>
                <th>ID</th>
                <th>NOME</th>
                <th>CPF</th>
                <th>TELEFONE</th>
                <th>SERVIÇO</th>
                <th>DATA</th>
                <th width="100">AÇÕES</th>
            </tr>
        </thead>
        <tbody>
            @foreach ($agendamentos as $agendamento)
                <tr>
                    <td>{{ $agendamento->id }}</td>
                    <td>{{ $agendamento->nome }}</td>
                    <td>{{ $agendamento->cpf }}</td>
                    <td>{{ $agendamento->telefone }}</td>
                    <td>{{ $agendamento->servico }}</td>
                    <td>{{ $agendamento->data }}</td>

                    <td>
                        <a href="{{ route('agendamentos.edit', $agendamento->id) }}">Editar</a>
                        <a href="{{ route('agendamentos.show', $agendamento->id) }}">Detalhes</a>
                    </td>
                </tr>

            @endforeach
        </tbody>
    </table> --}}

    @if (isset($filters))
        {!! $agendamentos->appends($filters)->links() !!}
    @endif
    {!! $agendamentos->links() !!}

@endsection
