
<div ng-include="'views/pageHeader.html'"></div>
<div class="container" style="">
       <div ng-controller="cadastroController" ng-init="carregarCadastro()">
        <div class="">
            <div class="col-xs-6 col-md-6" style="padding:0">
                <label style="color:#333366; font-size:14pt; margin-right:10pt">CADASTRO</label>
                
                <span ng-controller="alertasController" ng-init="carregarAlertas()">
                    <button class="btn btn-warning btn-xs"
                            popover-placement="right"
                            popover-trigger="mouseenter"
                            data-popover="Notificações"
                            ng-click="mostrarAlertas()"
                            ng-show="lstItems.length>0 && showAlertas==true">
                        <span class="glyphicon glyphicon-warning-sign"></span>
                        <span class="badge">{{lstItems.length}}</span>
                    </button>
                    <button class="btn btn-default btn-xs"
                            popover-placement="right"
                            popover-trigger="mouseenter"
                            data-popover="Notificações"
                            ng-click="mostrarAlertas()"
                            ng-show="lstItems.length==0 && showAlertas==true">
                        <span class="badge">{{lstItems.length}}</span>
                    </button>
               </span>
                
            </div>
            <div class="col-xs-6 col-md-6" style="text-align:right; padding:0px">
                <button type="button" class="btn btn-success btn-md" ng-click="updateCadastro(selectedCadastro)"
                        ng-disabled="mnuDados.PEditar==false || selectedCadastro.PodeMexer==false"
                        ng-show="(items.length>0 && selectedCadastro!=null)">
                    <span class="glyphicon glyphicon-ok"></span> Guardar
                </button>
                <div class="btn-group" style="text-align:left">
                    <button type="button"
                            ng-disabled="selectedCadastro==null"
                            class="btn btn-default btn-md dropdown-toggle"
                            data-toggle="dropdown">
                        <span class="glyphicon glyphicon-cog"></span><span class="caret"></span>
                    </button>
                    <ul class="dropdown-menu" role="menu" style="right: 0; left: auto;">
                        <li ng-click="openModalAlterarDatas(selectedCadastro)">
                            <a href="">Alterar Data do(s) Bem(s)</a>
                        </li>
                        <li ng-click="modalImportarImagens()">
                            <a href="">Importar Imagens</a>
                        </li>
                        <li ng-click="corrigirDuplicacoesAnos()" ng-show="tipout=='Inovar'">
                            <a href="">Erros nos Anos Civis</a>
                        </li>
                        <li ng-click="corrigirLocalizacaoBens()" ng-show="tipout=='Inovar'">
                            <a href="">Corrigir localização de bens</a>
                        </li>
                        <li ng-click="associaAmortizacaoInventario()" ng-show="tipout=='Inovar'">
                            <a href="">Relacionar Bens com Amortizações</a>
                        </li>
                        <li ng-click="corrigirDuplicacoesCentroCustos()" ng-show="tipout=='Inovar'">
                            <a href="">Corrigir centro de custos repetidos</a>
                        </li>
                        <li ng-click="corrigirAlteraContaPatrimonial()" ng-show="tipout=='Inovar'">
                            <a href="">Alterar Conta Patrimonial</a>
                        </li>
                        <li ng-click="abrirAuxCentroCustos()" ng-show="tipout=='Inovar'">
                            <a href="">Corrigir centro de custos</a>
                        </li>
                        <li ng-click="criarEquivSNC()" ng-show="tipout=='Inovar'">
                            <a href="">Criar equivalências SNC</a>
                        </li>
                        <li ng-click="validarF3CBL()" ng-show="tipout=='Inovar'">
                            <a href="">Validar F3 com Movimentos Contab.</a>
                        </li>
                        <li ng-click="confirmaRecalcularTodasAmortizacoesInovar()" ng-show="tipout=='Inovar'">
                            <a href="">Recalcular e gravar amortizações (Todos deste o inicio)</a>
                        </li>
                        <li ng-click="verificaAmortizacoesGravadas()" ng-show="tipout=='Inovar'">
                            <a href="">Verifica gravação das amortizações</a>
                        </li>
                        <li ng-click="openModalRecalcularAmortizacoes()" ng-show="root_podeMexerDadosDoBem===true">
                            <a href="">Recalcular amortizações</a>
                        </li>
                        <li ng-click="confirmaRecalcularVidaUtil()" ng-show="tipout=='Inovar'">
                            <a href="">Recalcular vida util</a>
                        </li>
                        <li ng-click="openModalAmortizacoesInovarPorExcel()" ng-show="tipout=='Inovar'">
                            <a href="">Recalcular vida util e amortizações por Excel</a>
                        </li>
                        <li ng-click="escolheAnoMesExportarSIC()" ng-show="tipout=='Inovar'">
                            <a href="">Exportar SIC Estrutura Dados</a>
                        </li>
                        <li ng-click="openModalValidarAmortizacoes()" ng-show="tipout=='Inovar'">
                            <a href="">Validar erros relacionados com abates</a>
                        </li>
                        <li ng-click="openModalAbaterBensPorExcel()" ng-show="tipout=='Inovar'">
                            <a href="">Abater 'Bens' por ficheiro Excel</a>
                        </li>
                        
                    </ul>
                </div>

            </div>
            <br/>
            <br/>
        </div>


        <div class="col-md-4" style="padding:3px; min-width:300px">
            <div>
                <div class="input-group">
                    <input type="text"
                           class="form-control"
                           placeholder="Procurar..."
                           ng-model="nome_inv"
                           ng-change="iniciarProcura(nome_inv)"
                           ng-debounce
                           style="">
                    <span class="input-group-addon apontar"
                          popover-placement="bottom"
                          popover-trigger="mouseenter"
                          data-popover="{{getFiltroActual()}}"
                          ng-click="openModalPesquisaAvancada()">
                        Pesquisa avançada <span class="glyphicon glyphicon-search"></span>
                    </span>

                </div>
            </div>

            <div class="table-responsive margem">
                <table class="table" style="margin:0">
                    <thead>
                        <tr>
                            <th style="width:100px">Nº Inv</th>
                            <th>Designação</th>
                            <th></th>
                        </tr>
                    </thead>
                </table>
                <div class="sep1" id="tabCadastro" style="border-top:1px solid #EEE; height:468px">
                    <table class="table table-hover table-striped">
                        <tbody>
                            <tr ng-repeat="item in items" ng-click="selCadastro(item)" class="apontar" ng-class="{info:item.Pk_Inventario==selectedCadastro.Pk_Inventario}">

                                <td ng-style="verificaCorAbateBloqueio(item)" style="width:100px">
                                    {{item.NumInventario}}
                                    <span class="glyphicon glyphicon-exclamation-sign" aria-hidden="true" ng-show="item.TemAbate" popover-placement="top" popover-trigger="mouseenter" data-popover="Abatido"></span>
                                </td>
                                <td><input type="text" onfocus="this.blur()" readonly="readonly" ng-model="item.Nome" class="input_tab readonly" /></td>
                                <td>
                                    <span class="glyphicon glyphicon-lock" aria-hidden="true" ng-show="item.PodeMexer===false"></span>
                                </td>
                            </tr>
                        </tbody>

                    </table>

                </div>
            </div>
            <div>

                <div class="btn-group dropup">
                    <button type="button"
                            class="btn btn-primary btn-md dropdown-toggle"
                            ng-disabled="mnuDados.PCriar==false"
                            data-toggle="dropdown">
                        <span class="glyphicon glyphicon-plus"></span> <span class="caret"></span>
                    </button>
                    <ul class="dropdown-menu" role="menu">
                        <li ng-click="openModalNovoCadastro()">
                            <a href="">Adicionar</a>
                        </li>
                        <li><a href="#local">Adicionar Por Local</a></li>

                        <li class="divider"></li>
                        <li ng-click="confirmarDuplicarCadastro(selectedCadastro)" ng-show="root_podeMexerDadosDoBem===true"><a href="">Duplicar Inventário</a></li>
                    </ul>
                </div>
                <button ng-click="carregarMaisCadastroPos(nome_inv)" type="button"
                        ng-disabled="itemsLoaded==false || totalLoaded==0"
                        class="btn btn-primary btn-md">
                    <span class="glyphicon glyphicon-forward"></span> Ver mais
                </button>
                <img src="images/preloader.gif" width="32" ng-hide="itemsLoaded==true || items.length==0" style="margin-left:10px; margin-right:10px" />
                
                <div class="btn-group dropup" ng-show="root_podeMexerDadosDoBem===true">
                    <button type="button"
                            class="btn btn-warning btn-md dropdown-toggle"
                            ng-show="items.length>0 && selectedCadastro!=null"
                            ng-disabled="mnuDados.PApagar==false"
                            data-toggle="dropdown">
                        <span class="glyphicon glyphicon-remove"></span> <span class="caret"></span>
                    </button>
                    <ul class="dropdown-menu" role="menu">
                        <li ng-click="confirmarApagarCadastro(selectedCadastro)">
                            <a href="">Apagar</a>
                        </li>
                        <li class="divider"></li>
                        <li ng-click="escolherIntervaloNumInv()">
                            <a href="">Apagar por intervalo de números</a>
                        </li>
                    </ul>
                </div>
                <div class="btn-group dropup" style="text-align:left">
                    <button type="button"
                            ng-disabled="selectedCadastro==null"
                            class="btn btn-default btn-md" ng-click="abrirMapas()">
                        <span class="glyphicon glyphicon-print"></span> Mapas
                    </button>
                </div>
            </div>

        </div>
        <div class="col-md-8" style="padding:3px">

            <ul class="nav nav-tabs">
                <li ng-class="{active:tabshow[0]}" ng-click="changeTab(0)"><a href="">Dados</a></li>
                <li ng-class="{active:tabshow[1]}" ng-click="changeTab(1)"><a href="">Aquisição</a></li>
                <li ng-class="{active:tabshow[2]}" ng-click="changeTab(2)"><a href="">Amortização</a></li>
                <li ng-class="{active:tabshow[3]}" ng-click="changeTab(3)"><a href="">Abate</a></li>
                <li ng-class="{active:tabshow[5]}" ng-click="changeTab(5);"><a href="">Manutenção</a></li>
                <li ng-class="{active:tabshow[6]}" ng-click="changeTab(6);"><a href="">Ocorrências</a></li>
                <li ng-class="{active:tabshow[4]}" ng-click="changeTab(4);"><a href="">Outros</a></li>
            </ul>


            <form name="frm1" class="sep" style="min-height:500px">

                <div ng-show="items.length>0">

                    <div class="container-fluid" ng-show="tabshow[0]">
                        
                        <div class="col-md-4">
                            <div class="input-group">
                                <span class="input-group-addon">Nº Inv</span>
                                <input type="text" class="form-control" placeholder="Nº Inventário" ng-model="selectedCadastro.NumInventario" ng-disabled="selectedCadastro.Bloqueado==true" numbers-only>
                            </div>
                            <br/>
                            <span class="control-label">Nº Inventário Inicial</span>
                            <input class="form-control"
                                   ng-model="selectedCadastro.NumInvInicial"
                                   maxlength="20" />
                            <br />
                            <span class="control-label">Designação</span>
                            <input class="form-control"
                                   ng-change="dadosModificados(true)"
                                   ng-model="selectedCadastro.Nome"
                                   maxlength="100" />
                            <br />
                            <span>Gestor</span>
                            <br />
                            <input type="hidden" ng-model="selectedCadastro.Fk_Responsavel" />
                            <div class="input-group apontar"
                                 ng-click="mostrarResponsavelLocal(selectedCadastro);">
                                <input type="text" placeholder="Procurar"
                                       class="form-control readonly"
                                       readonly="readonly"
                                       ng-model="selectedCadastro.NomeResponsavel">
                                <span class="input-group-addon">
                                    <span class="glyphicon glyphicon-search"></span>
                                </span>
                            </div>
                            <br />
                            <span>Data</span>
                            <br />
                            <div class="input-group">
                                <input type="text" id="txtDataBem"
                                       placeholder="____-__-__"
                                       ng-model="selectedCadastro.Data"
                                       datepicker-popup="yyyy-MM-dd"
                                       is-open="data_opened"
                                       ng-change="dadosModificados(true)"
                                       class="date form-control readonly simple-field-data-mask"
                                       data-mask="0000-00-00"

                                       ng-required="false" close-text="Fechar" clear-text="Limpar" current-text="Hoje" ng-disabled="selectedCadastro.Bloqueado==true" />
                                <span class="input-group-btn" ng-show="selectedCadastro.Bloqueado==false">
                                    <button class="btn btn-default" ng-click="opendate($event)"><i class="glyphicon glyphicon-calendar"></i></button>
                                </span>
                                <span class="input-group-btn" ng-show="selectedCadastro.Bloqueado==true">
                                    <button class="btn btn-default" ng-disabled="selectedCadastro.Bloqueado==true"><i class="glyphicon glyphicon-lock"></i></button>
                                </span>
                            </div>

                            <br />
                            <span>Nº Requisição Oficial</span>
                            <br />
                            <input class="form-control"
                                   ng-model="selectedCadastro.NumRequisicaoOficial"
                                   ng-change="dadosModificados(true)"
                                   maxlength="50" />

                            <br />
                        </div>
                        <div class="col-md-4">
                            <div class="input-group apontar" ng-click="mostrarClassificacoes(selectedCadastro)">
                                    <input type="text" placeholder="Classificação" class="form-control readonly" readonly="readonly" ng-model="selectedCadastro.Classificacao">
                                    <span class="input-group-addon">
                                        <span class="glyphicon glyphicon-search" ng-show="selectedCadastro.Bloqueado==false"></span>
                                        <span class="glyphicon glyphicon-lock" ng-show="selectedCadastro.Bloqueado==true"></span>
                                    </span>
                            </div>
                            <br />
                                                        
                            <span>Ref. Marca</span>
                            <br />
                            <input class="form-control"
                                   ng-model="selectedCadastro.RefMarca"
                                   ng-change="dadosModificados(true)"
                                   maxlength="100" />
                            <br />
                            <span>Modelo</span>
                            <br />
                            <input class="form-control"
                                   ng-model="selectedCadastro.Modelo"
                                   ng-change="dadosModificados(true)"
                                   maxlength="100" />
                            <br />
                            <span>Cor</span>
                            <br />
                            <input class="form-control"
                                   ng-model="selectedCadastro.Cor"
                                   ng-change="dadosModificados(true)"
                                   maxlength="100" />
                            <br />
                            <span>(Comp., Largura, Altura)</span>
                            <br />
                            <div class="btn-group btn-group-justified" role="group" aria-label="...">
                                <div class="btn-group" role="group">
                                    <input class="form-control"
                                           ng-model="selectedCadastro.Comprimento"
                                           ng-change="dadosModificados(true)"
                                           number-input maxlength="10" />
                                </div>
                                <div class="btn-group" role="group">
                                    <input class="form-control"
                                           ng-model="selectedCadastro.Largura"
                                           ng-change="dadosModificados(true)"
                                           number-input maxlength="10" />
                                </div>
                                <div class="btn-group" role="group">
                                    <input class="form-control"
                                           ng-model="selectedCadastro.Altura"
                                           ng-change="dadosModificados(true)"
                                           number-input maxlength="10" />
                                </div>
                            </div>
                            <br/>
                            
                            <span>RDF</span>
                            <br />
                            <input class="form-control"
                                   ng-model="selectedCadastro.RDF"
                                   ng-change="dadosModificados(true)"
                                   maxlength="100" />
                            <br />
                        </div>
                        <div class="col-md-4">
                            
                            <div class="input-group apontar"
                                 ng-click="mostrarPlanoSNC(selectedCadastro)">
                                <input type="text" placeholder="SNC-AP" class="form-control readonly" readonly="readonly"
                                       ng-model="selectedCadastro.ContaSNC">
                                <span class="input-group-addon">
                                    SNC
                                    <span class="glyphicon glyphicon-search" ng-show="selectedCadastro.Bloqueado==false"></span>
                                    <span class="glyphicon glyphicon-lock" ng-show="selectedCadastro.Bloqueado==true"></span>
                                </span>

                            </div>
                            <br />
                            <span>C. Económica</span>
                            <br />

                            <div class="input-group apontar"
                                 ng-click="mostrarClassificacaoEconomica(selectedCadastro)">
                                <input type="text" placeholder="Classificação" class="form-control readonly" readonly="readonly"
                                       ng-model="selectedCadastro.Ceconomica">
                                <span class="input-group-addon">
                                    <span class="glyphicon glyphicon-search" ng-show="selectedCadastro.Bloqueado==false"></span>
                                    <span class="glyphicon glyphicon-lock" ng-show="selectedCadastro.Bloqueado==true"></span>
                                </span>

                            </div>
                            <br />
                            <div ng-show="daVisibilidadeClassPat(selectedCadastro)">
                                <span>C. Patrimonial</span>
                                <br />
                                <div class="input-group apontar"
                                     ng-click="mostrarClassificacaoPatri(selectedCadastro)">
                                    <input type="text" placeholder="Classificação" class="form-control readonly" readonly="readonly"
                                           ng-model="selectedCadastro.Cpatrimonial">
                                    <span class="input-group-addon">
                                        <span class="glyphicon glyphicon-search" ng-show="selectedCadastro.Bloqueado==false"></span>
                                        <span class="glyphicon glyphicon-lock" ng-show="selectedCadastro.Bloqueado==true"></span>
                                    </span>

                                </div>
                                <br />
                            </div>
                            
                            <span>C. Funcional</span>
                            <br />
                            <div class="input-group apontar"
                                 ng-click="mostrarClassificacaoFuncional(selectedCadastro)">
                                <input type="text" placeholder="Classificação" class="form-control readonly" readonly="readonly"
                                       ng-model="selectedCadastro.Cfuncional">
                                <span class="input-group-addon">
                                    <span class="glyphicon glyphicon-search" ng-show="selectedCadastro.Bloqueado==false"></span>
                                    <span class="glyphicon glyphicon-lock" ng-show="selectedCadastro.Bloqueado==true"></span>
                                </span>

                            </div>
                            <br />
                            <span>Fornecedor</span>
                            <br />
                            <input type="hidden" ng-model="selectedCadastro.Fk_Fornecedor" />
                            <div class="input-group apontar"
                                 ng-click="mostrarFornecedores(selectedCadastro)">
                                <input type="text" placeholder="Procurar" class="form-control readonly" readonly="readonly" ng-model="selectedCadastro.NomeFornecedor">
                                <span class="input-group-addon">
                                    <span class="glyphicon glyphicon-search"></span>
                                </span>

                            </div>
                            <br />
                            <span>Atividade</span>
                            <br />
                            <select class="form-control" ng-init="carregarActividades()"
                                    ng-change="dadosModificados(true); selAtividade(selectedAtividade);"
                                    ng-model="selectedAtividade"
                                    ng-options="e.Actividade for e in itemsAtividades"></select>
                            <br />

                            <span>Nº Série</span>
                            <br />
                            <input class="form-control"
                                   ng-model="selectedCadastro.NSerie"
                                   ng-change="dadosModificados(true)"
                                   maxlength="50" />
                            <br />

                        </div>
                        
                        <div class="col-md-8">
                            <span>Localização</span>
                            <br />
                            <div class="input-group apontar"
                                 ng-click="mostrarLocalizacoes(selectedCadastro)">
                                <input type="text" placeholder="Procurar" class="form-control readonly" readonly="readonly" ng-model="selectedCadastro.Localizacao">
                                <span class="input-group-addon">
                                    <span class="glyphicon glyphicon-search"></span>
                                </span>

                            </div>
                        </div>
                        <div class="col-md-4">
                            <span></span>
                            <br />
                            <button class="btn btn-primary col-md-12" ng-click="abrirCentroCustos()">
                                Centro de Custos
                            </button>
                        </div>
                    </div>
                    <div class="container-fluid" ng-show="tabshow[1]">
                        <div class="col-md-6">
                            Tipo
                            <br />
                            <select class="form-control" ng-init="carregarCodAquisicao()"
                                    ng-change="dadosModificados(true); selCodAquisicao(selectedCodAquisicao)"
                                    ng-model="selectedCodAquisicao"
                                    ng-disabled="selectedCadastro.Bloqueado==true"
                                    ng-options="e.Codigo+' - '+ e.Designacao for e in codAquisicao"></select>
                            
                            <br />
                            Tipo Despesa
                            <br />
                            <select class="form-control" ng-init="carregarTipoDespesa()"
                                    ng-change="dadosModificados(true); selTipoDespesa(selectedTipoDespesa)"
                                    ng-model="selectedTipoDespesa"
                                    ng-options="e.Descricao for e in itemsDesp"></select>
                            <br />
                            Valor <span class="glyphicon glyphicon-lock" ng-show="selectedCadastro.Bloqueado==true"></span>
                            <br />
                            <input class="form-control"
                                   ng-model="selectedCadastro.Aquisicao.Valor"
                                   ng-change="dadosModificados(true)"
                                   number-input maxlength="20" ng-disabled="selectedCadastro.Bloqueado==true"/>
                            <br />
                            Nº Fatura
                            <br />
                            <input class="form-control" ng-change="dadosModificados(true)" maxlength="50" ng-model="selectedCadastro.NumFactura"/>
                            <br />
                            Documento
                            <br />
                            <div class="input-group apontar">
                                <input type="text" placeholder="Procurar" class="form-control readonly" readonly="readonly">
                                <span class="input-group-addon" ng-click="openModalDocumentos(selectedCadastro,'Aquisicao')">
                                    <span class="glyphicon glyphicon-search"></span>
                                </span>
                            </div>
                            <br />
                            Valor Contrato
                            <br />
                            <input class="form-control"
                                   ng-model="selectedCadastro.Aquisicao.ValorContrato"
                                   ng-change="dadosModificados(true)"
                                   number-input maxlength="20" />
                            <br />
                        </div>
                        <div class="col-md-6">
                            Nº Rendas
                            <br />
                            <input class="form-control"
                                   ng-model="selectedCadastro.Aquisicao.NumeroRendas"
                                   ng-change="dadosModificados(true)"
                                   numbers-only maxlength="10" />
                            <br />
                            Inicio
                            <br />
                            <div class="input-group">
                                <input type="text" id="txtDataAquisicaoInicio"
                                       class="date form-control readonly simple-field-data-mask"
                                       data-mask="0000-00-00"
                                       ng-model="selectedCadastro.Aquisicao.DataInicio"
                                       datepicker-popup="yyyy-MM-dd"
                                       is-open="dataInicial_opened"
                                       ng-change="dadosModificados(true);"
                                       placeholder="____-__-__"
                                       ng-required="false" close-text="Fechar" clear-text="Limpar" current-text="Hoje" />
                                <span class="input-group-btn">
                                    <button class="btn btn-default" ng-click="opendate_dataInicial($event)"><i class="glyphicon glyphicon-calendar"></i></button>
                                </span>
                            </div>
                            <br />
                            Termo
                            <br />
                            <div class="input-group">
                                <input type="text" id="txtDataAquisicaoTermo"
                                       class="date form-control readonly simple-field-data-mask"
                                       data-mask="0000-00-00"
                                       placeholder="____-__-__"
                                       ng-model="selectedCadastro.Aquisicao.DataTermo"
                                       datepicker-popup="yyyy-MM-dd"
                                       is-open="dataTermo_opened"
                                       ng-change="dadosModificados(true)"
                                       ng-required="false" close-text="Fechar" clear-text="Limpar" current-text="Hoje" />
                                <span class="input-group-btn">
                                    <button class="btn btn-default" ng-click="opendate_dataTermo($event)"><i class="glyphicon glyphicon-calendar"></i></button>
                                </span>
                            </div>
                            <br />
                            Valor Renda
                            <br />
                            <input class="form-control"
                                   ng-model="selectedCadastro.Aquisicao.ValorRenda"
                                   ng-change="dadosModificados(true)"
                                   number-input maxlength="20" />
                            <br />
                            Valor Residual
                            <br />
                            <input class="form-control"
                                   ng-model="selectedCadastro.Aquisicao.ValorResidual"
                                   ng-change="dadosModificados(true)"
                                   number-input maxlength="20" />
                            <br />
                            Opção Compra
                            <br />
                            <label class="checkbox">
                                <input type="checkbox"
                                       ng-change="dadosModificados(true)"
                                       ng-model="selectedCadastro.Aquisicao.OpcaoCompra" /> Sim
                            </label>

                        </div>


                    </div>

                    <div ng-show="tabshow[2]">
                        <div ng-include="'views/cadastroAmortizacao.html'"></div>
                    </div>
                    <div ng-show="tabshow[3]">
                        <div class="col-md-12" style="text-align:right; padding-bottom:5px">
                            <button type="button"
                                    class="btn btn-success btn-sm"
                                    ng-disabled="mnuValorizacao.PEditar==false || root_podeMexerDadosDoBem===false"
                                    ng-show="selectedCadastro.BloqueadoAbate==false"
                                    ng-click="actualizarInventarioAbate(selectedCadastro.Abate)">
                                <span class="glyphicon glyphicon-ok"></span> Abater
                            </button>

                        </div>
                        <div class="col-md-6">
                            Tipo
                            <br />
                            <select class="form-control" ng-init="carregarAbates()"
                                    ng-change="dadosModificados(true); selAbate(selectedAbate);"
                                    ng-model="selectedAbate"
                                    ng-disabled="selectedCadastro.BloqueadoAbate==true"
                                    ng-options="e.Codigo+' - '+e.Designacao for e in abateitems">
                               
                            </select>
                            <br />
                            Data
                            <br />
                            <div class="input-group">
                                <input type="text" id="txtDataAbate"
                                       class="date form-control readonly simple-field-data-mask"
                                       data-mask="0000-00-00"
                                       ng-model="selectedCadastro.Abate.Data"
                                       datepicker-popup="yyyy-MM-dd"
                                       is-open="dataAbate_opened"
                                       ng-required="false"
                                       close-text="Fechar" clear-text="Limpar" current-text="Hoje"
                                       ng-change="dadosModificados(true)"
                                       placeholder="____-__-__" ng-disabled="selectedCadastro.BloqueadoAbate==true" />
                                <span class="input-group-btn">
                                    <button class="btn btn-default" ng-show="selectedCadastro.BloqueadoAbate==false"
                                            ng-click="opendate_dataAbate($event)">
                                        <i class="glyphicon glyphicon-calendar"></i>
                                    </button>
                                    <button class="btn btn-default" ng-show="selectedCadastro.BloqueadoAbate==true" ng-disabled="selectedCadastro.BloqueadoAbate==true">
                                        <i class="glyphicon glyphicon-lock"></i>
                                    </button>
                                </span>
                            </div>
                            <br />
                            Motivo do Abate
                            <br />
                            <select class="form-control" ng-init="carregarMotivoAbates()"
                                    ng-change="dadosModificados(true); selMotivoAbate(selectedMotivoAbate);"
                                    ng-model="selectedMotivoAbate"
                                    ng-disabled="selectedCadastro.BloqueadoAbate==true"
                                    ng-options="e.Descricao for e in motivoAbateitems">
                                <option value="0">Nenhum</option>
                            </select>
                            <br />
                        </div>
                        <div class="col-md-6">
                            Receita
                            <br />
                            <input class="form-control"
                                   ng-model="selectedCadastro.Abate.Receita"
                                   ng-change="dadosModificados(true)"
                                   number-input
                                   maxlength="20" ng-disabled="selectedCadastro.BloqueadoAbate==true" />
                            <br />
                            C. Receita
                            <br />
                            <input class="form-control"
                                   ng-model="selectedCadastro.Abate.ClassificacaoReceita"
                                   ng-change="dadosModificados(true)"
                                   ng-disabled="selectedCadastro.BloqueadoAbate==true"
                                   maxlength="100" />
                            <br />
                            Documento
                            <br />
                            <div class="input-group apontar">
                                <input type="text" placeholder="Procurar" class="form-control readonly" readonly="readonly" ng-disabled="selectedCadastro.BloqueadoAbate==true" />
                                <span class="input-group-addon" ng-click="openModalDocumentos(selectedCadastro,'Abate')" ng-show="selectedCadastro.BloqueadoAbate==false">
                                    <span class="glyphicon glyphicon-search"></span>
                                </span>
                                <span class="input-group-addon" ng-show="selectedCadastro.BloqueadoAbate==true">
                                    <span class="glyphicon glyphicon-lock"></span>
                                </span>
                            </div>
                            <br />

                            <br />
                        </div>
                    </div>
                    <div ng-show="tabshow[4]">
                        <p align="right">
                            <img ng-src="{{mySelFile}}"
                                 ng-click="openModalUpload(selectedCadastro)"
                                 popover-placement="bottom"
                                 popover-trigger="mouseenter"
                                 data-popover="Alterar"
                                 width="180"
                                 class="apontar"
                                 style="border:1px solid #DDD" />
                        </p>
                        <!--<h5>Outros Elementos</h5>
                        <textarea class="form-control tarea"
                                  ng-model="selectedCadastro.OutrosElementos"
                                  ng-change="dadosModificados(true)"
                                  maxlength="250" style="min-height:50px; height:50px"></textarea>-->
                        <h5>Notas Adicionais</h5>
                        <textarea class="form-control tarea"
                                  ng-model="selectedCadastro.NotasAdicionais"
                                  ng-change="dadosModificados(true)"
                                  maxlength="250" style="min-height:50px; height:75px"></textarea>
                        <h5>Observações</h5>
                        <textarea class="form-control tarea"
                                  ng-model="selectedCadastro.Observacao"
                                  ng-change="dadosModificados(true)"
                                  maxlength="250" style="min-height:50px; height:75px"></textarea>
                    </div>
                    <div ng-show="tabshow[5]" style="height:460px; overflow:auto">
                        <div ng-include="templatePlanoManutencao.url"></div>
                    </div>
                    <div ng-show="tabshow[6]" style="height:460px; overflow:auto">
                        <div ng-include="templateOcorrencias.url"></div>
                    </div>
                </div>

            </form>
            <div style="text-align:right">
                
            </div>
        </div>
    </div>


</div>

<script>
    $(document).ready(function () {
        $('.date').mask('0000-00-00');

    });
</script>













