@extends('modelo.modelo')

@section('content')
    <script src="https://code.jquery.com/jquery-3.6.0.js" integrity="sha256-H+K7U5CnXl1h5ywQfKtSj8PCmoN9aaq30gDh27Xc0jk=" crossorigin="anonymous"></script>
    <script type="text/javascript" src="{{asset('js/acompanhamento.js')}}"></script>
    <div class="container">
        <div class="row">
            <div class="col-md-12">
                <div class="card">
                    <div class="h3">Protocolo {{ $protocolo->id }}</div>
                    <div class="card-body">

                        <a href="{{ url('funcionario/index') }}" title="Back"><button class="btn btn-warning  btn-hero btn-sm"><i class="fa fa-arrow-left" aria-hidden="true"></i> Voltar</button></a>
                        <!--a href="{{-- url('protocolo/'.$protocolo->id.'/edit') --}}" title="Edit Protocolo"><button class="btn btn-primary btn-sm"><i class="fa fa-pencil-square-o" aria-hidden="true"></i> Edit</button></a-->

                        <!--form method="POST" action="{{-- url('/protocolo'.'/'.$protocolo->id) --}}" accept-charset="UTF-8" style="display:inline">
                            {{-- method_field('DELETE') --}}
                            {{-- csrf_field() --}}
                            <button type="submit" class="btn btn-danger btn-sm" title="Delete Protocolo" onclick="return confirm(&quot;Confirm delete?&quot;)"><i class="fa fa-trash-o" aria-hidden="true"></i> Delete</button>
                        </form-->
                        <br />
                        <br />

                        <div class="table-responsive">
                            <table class="table">
                                <tbody>
                                    <tr>
                                        <th> Tipo </th>
                                        <td style="text-transform: capitalize;"> {{ $protocolo->tipo }} </td>
                                    </tr>
                                    <tr>
                                        <th> Status </th>
                                        <td style="text-transform: capitalize;"> {{ $protocolo->status }} </td>
                                    </tr>
                                    <tr>
                                        <th> Codigo </th>
                                        <td style="text-transform: capitalize;"> {{ $protocolo->codigo }} </td>
                                    </tr>

                                    <tr>
                                        <th> Data de Criação </th>
                                        <td> {{ date_format(date_create($protocolo->created_at),"d/m/Y") }} </td>
                                    </tr>

                                    <tr>
                                        <th> Descrição </th>
                                        <td style="text-transform: capitalize;"> {{ $protocolo->descricao }} </td>
                                    </tr>

                                    <tr>

                                        <td>  </td>
                                    </tr>


                                </tbody>
                            </table>
                        </div>

                    </div>
                </div>
            </div>
        </div>
    </div>
    <div class="row">
        @isset($acompanhamentos)
            @foreach ($acompanhamentos as $indice => $acompanhamento)
                <div class="col-lg-1"></div>
                <div class="col-lg-10 alert @if($nivel[$indice] == 1  || $nivel[$indice] == 2) {{ 'alert-primary'  }} @else {{ 'alert-secondary'}} @endif mb-15">
                    <b>Por&nbsp;
                        {{ $acompanhamento->idUsuario }}
                    </b>
                    em
                    <b>
                        {{ date_format(date_create($acompanhamento->created_at), 'd/m/Y H:i') }}
                    </b>
                    <br>
                    <p>{{ $acompanhamento->descricao }}</p>
                </div>
                <div class="col-lg-1"></div>
            @endforeach
        @endisset
    </div>
    <div class="row">
        <div class="col-lg-1"></div>
        <div class="col-lg-10" id="novoAcompanhamento">
        </div>
        <div class="col-lg-1"></div>
    </div>
    <div class="row" id="responder">
        <div class="col-lg-1"></div>
        <div class="col-lg-11">
            <a class="btn btn-info text-white" onclick="mostraForm({{Auth::user()->id.', \''.url('acompanhamento/armazena').'\', '.$protocolo->id.', \''.csrf_token().'\'' }})">Responder</a>
        </div>
    </div>

@endsection
