<div ng-controller="documentosController">

    <div class="modal-header">
        <h3>Documentos</h3>
        <nav class="navbar navbar-default" role="navigation">
            <div class="container-fluid">
                <form class="navbar-form navbar-right" role="navigation">
                    <div class="form-group">
                        <input type="text" class="form-control" placeholder="Procurar..." ng-model="procurar" ng-change="selectedRow=null">
                    </div>

                    <button popover-placement="top"
                            popover-trigger="mouseenter"
                            data-popover="Remover"
                            ng-click="confirmarApagarDocumento(selectedRow)"
                            type="button"
                            ng-show="documentos.length>0 && selectedRow!=null"
                            ng-disabled="selected.item.perm.PApagar==false"
                            class="btn btn-default">
                        <span class="glyphicon glyphicon-remove"></span>
                    </button>
                    <button popover-placement="top"
                            popover-trigger="mouseenter"
                            data-popover="Novo Documento"
                            onclick="document.getElementById('btUpload').click()"
                            type="button"
                            ng-disabled="selected.item.perm.PCriar==false"
                            class="btn btn-default">
                        <span class="glyphicon glyphicon-plus"></span>
                    </button>
                   
                </form>
            </div>
        </nav>

    </div>

    <div class="modal-body" ng-init="carregarDocumentos(selected.item)">
        <input type="hidden" ng-model="myDocFile">
        <input id="btUpload" type="file"
               
               ng-file-select="onFileSelect($files,selected.item)" style="display:none">
        <div style="height:210px; overflow:auto">
            <div class="list-group">
                
                <a ng-click="selDocumento(doc);"
                   href="javascript:void(0)"
                   ng-repeat="doc in documentos | filter:procurar"
                   class="list-group-item"
                   ng-selected="ativarLinha(doc,selected.item)"
                   ng-class="{active:selectedRow.Pk_Documento==doc.Pk_Documento}">
                    {{doc.NomeDocumento}}
                </a>
            </div>
        </div>
        <div ng-show="uploadprogress>=0 && uploadprogress<100">

            <progressbar class="progress-striped active" max="100" value=uploadprogress><i>{{uploadprogress}}</i></progressbar>
            <p align="right"><button class="btn btn-primary btn-xs" ng-click="upload.abort()">Cancelar</button></p>
        </div>
    </div>
    <div class="modal-footer">
        
        <button class="btn btn-primary"
                ng-show="documentos.length>0 && selectedRow!=null" 
                ng-click="downloadFicheiro(selectedRow)">Abrir</button>
        <button class="btn btn-warning" ng-click="cancel()">Fechar</button>
    </div>

</div>
<script language="javaScript">
    
   

</script>

