<div ng-controller="CollapseGeralCtrl">
    <div ng-controller="ocorrenciasController">
        <div class="modal-header">
            <h3>Encaminhamentos</h3>
            <div class="form-group">
                <input type="text" class="form-control" placeholder="Procurar..." ng-model="procurar_p" ng-change="selectedEncaminhamento=null">
            </div>
        </div>

        <div class="modal-body" style="height:400px">
            <div style="height:300px; overflow:auto" ng-init="carregarLstEncaminhamentos()" collapse="isCollapsed">

                <div class="table-responsive">
                    <table class="table table-hover table-striped">
                        <tr>
                            <th>Gestor</th>
                            <th>Encaminhado para</th>
                            <th>Inicio</th>
                            <th>Fim</th>
                            <th style="width:80px; text-align:right">
                                <button type="button"
                                        class="btn btn-primary btn-sm"
                                        ng-click="openModalEditarEncaminhamentos(null,selectedEncaminhamento.FkResponsavel)">
                                    <span class="glyphicon glyphicon-plus"></span>
                                </button>
                            </th>
                        </tr>

                        <tr class="apontar" ng-click="selEncaminhamento(item)"
                            ng-repeat="item in lstEncaminhamentos | filter:procurar_p"
                            ng-class="{info:item.PkEncaminhamento==selectedEncaminhamento.PkEncaminhamento}">
                            <td>{{item.NomeResponsavel}}</td>
                            <td>{{item.NomeRespDestino}}</td>
                            <td>{{item.DataInicioStr}}</td>
                            <td>{{item.DataFimStr}}</td>
                            <td style="width:80px; text-align:right">

                                <button popover-placement="left"
                                        popover-trigger="mouseenter"
                                        data-popover="Editar"
                                        ng-click="openModalEditarEncaminhamentos(item,item.FkResponsavel)"
                                        type="button" class="btn btn-default btn-xs">
                                    <span class="glyphicon glyphicon-pencil"></span>
                                </button>
                                <button popover-placement="left"
                                        popover-trigger="mouseenter"
                                        data-popover="Remover"
                                        ng-click="confirmarApagarEncaminhamento(item)"
                                        type="button" class="btn btn-warning btn-xs">
                                    <span class="glyphicon glyphicon-remove"></span>
                                </button>
                            </td>
                        </tr>
                    </table>
                </div>
            </div>

        </div>
        <div class="modal-footer">
            <!--<button class="btn btn-primary"
                    ng-click="selected.item.IdResponsavel=selectedResponsavel.Pk_Responsavel; ok();"
                    ng-disabled="selected.item.perm.PEditar==false || selected.item.perm.PCriar==false"
                    ng-show="responsaveis.length>0 && selectedResponsavel!=null">
                Aplicar Responsável
            </button>-->
            <button class="btn btn-warning" ng-click="cancel()">Sair</button>
        </div>

    </div>
</div>