@extends('index')

@section('title', 'Pacientes - Listar')

@section('main')
    <div class="content-wrapper">
        <!-- Content Header (Page header) -->
        <section class="content-header">
            <h1>
                Pacientes
                <small>Listar</small>
            </h1>
            <ol class="breadcrumb">
                <li><a href="#"><i class="fa fa-dashboard"></i> Pacientes</a></li>
                <li class="active">Listar</li>
            </ol>
        </section>

        <section class="content">
            <div class="row">
                <div class="col-xs-12 col-md-12">
                    <div class="box">
                        <table class="table table-bordered table-hover dataTable">
                            <thead>
                            <tr>
                                <th>Nome</th>
                                <th>Email</th>
                                <th>Mãe</th>
                                <th>Pai</th>
                                <th>Sexo</th>
                                <th>Ações</th>
                            </tr>
                            </thead>
                            <tbody>
                            @foreach($pacientes as $paciente)

                                <?php
                                $sexo = 'Masculino';
                                if ($paciente->sexo == 1) {
                                    $sexo = 'Feminino';
                                } else if ($paciente->sexo == 2) {
                                    $sexo = 'Outro';
                                }
                                ?>

                                <tr>
                                    <td>{{ $paciente->nome }}</td>
                                    <td>{{ $paciente->email }}</td>
                                    <td>{{ $paciente->nome_mae }}</td>
                                    <td>{{ $paciente->nome_pai }}</td>
                                    <td>{{ $sexo }}</td>
                                    <td>
                                        <a href="{{ base_url() }}index.php/paciente/deletar/{{ $paciente->id_paciente }}">
                                            <button class="btn btn-danger">Deletar</button>
                                        </a>
                                        <button class="btn btn-info">Alterar</button>
                                    </td>
                                </tr>
                            @endforeach
                            </tbody>
                        </table>
                    </div>
                </div>
            </div>
        </section>
    </div>
@endsection