<div id="ModalCorrecaoNota" class="bg-modal" ng-if="showPendingInvoices && !state.asked && state.notasPendentes.length > 0 && $parent.config.UsaPOS">
    <div class="form" style="width: 90%">
        <h1 class="header text-center">
            NOTAS FISCAIS PENDENTES
            <span class="pull-right">
                <a href="" ng-show="!state.reenviandoNotasPendentes" ng-click="closePendingInvoices()">
                    <i class="material-icons">close</i>
                </a>
            </span>
        </h1>

        <div class="loading" ng-show="state.carregandoNotasPendentes">
            <p>Obtendo notas fiscais pendentes, aguarde...</p>
            <i class="material-icons md-32 spin">data_usage</i>
        </div>

        <div class="loading" ng-show="state.reenviandoNotasPendentes">
            <p>Reenviando as notas selecionadas, aguarde...</p>
            <i class="material-icons md-32 spin">data_usage</i>
        </div>

        <div ng-show="!state.carregandoNotasPendentes && !state.reenviandoNotasPendentes">

            <div class="card">
                <div class="col-md-4">
                    <div class="form-group">
                        <div class="input-group">
                            <span class="input-group-addon"><i class="material-icons">search</i></span>
                            <input class="form-control" type="text" style="width: 100%" ng-model="state.notasSearchKey" placeholder="Pesquise aqui o número da nota" />
                        </div>
                    </div>
                </div>

                <div class="col-md-4">
                    <div class="form-group">
                        <div class="input-group">
                            <span class="input-group-addon"><i class="material-icons">assignment_turned_in</i></span>
                            <select class="form-control" ng-model="state.statusSearch">
                                <option value="">Todos</option>
                                <option value="1">Não enviada</option>
                                <option value="2">Aguardando Envio</option>
                                <option value="3">Contigência</option>
                                <option value="4">Rejeitada</option>
                            </select>
                        </div>
                    </div>
                </div>
            </div>

            <form ng-submit="reenviarNotasSelecionadas()">
                <div class="wrapper">
                    <div class="card p-8 mark-nota-fiscal">
                        <div ng-if="state.notasPendentes && state.notasPendentes.length > 0" class="table-responsive table-nowrap">
                            <table class="table table-condensed m-0">
                                <thead>
                                    <tr>
                                        <th>
                                            <input type="checkbox" ng-model="state.reenviarTodasNotas" ng-change="checkNotas()" />
                                        </th>
                                        <th>Status NFE</th>
                                        <th>Obs</th>
                                        <th>Número/Série</th>
                                        <th>Mod.Fiscal</th>
                                        <th>Terminal</th>
                                        <th>Natureza</th>
                                        <th>Filial/Terceiro</th>
                                        <th class="text-center">Consumidor</th>
                                        <th>Emissão</th>
                                        <th>Mov.</th>
                                        <th class="text-right">Qtde.</th>
                                        <th class="text-right">Total</th>
                                    </tr>
                                </thead>
                                <tbody>
                                    <tr ng-repeat="item in state.notasPendentes | filter:  { Numero: state.notasSearchKey }  | filter:  {NFE:{Status: state.statusSearch}}">
                                        <td>
                                            <input type="checkbox" ng-model="item.Checado" />
                                        </td>
                                        <td ng-switch="item.NFE.Status">
                                            <label class="label label-warning" ng-switch-when="1">Não enviada</label>
                                            <label class="label label-warning" ng-switch-when="2">Aguardando envio</label>
                                            <label class="label label-warning" ng-switch-when="3">Contingencia</label>
                                            <label class="label label-danger" ng-switch-when="4">Rejeitada</label>
                                            <label class="label label-success" ng-switch-when="5">Autorizada</label>
                                            <label class="label label-default" ng-switch-when="52">Ag. env. inutilização</label>
                                            <label class="label label-default" ng-switch-when="59">Inutilizado</label>
                                            <label class="label label-default" ng-switch-when="42">Ag. env. cancelamento</label>
                                            <label class="label label-default" ng-switch-when="49">Nota cancelada</label>
                                            <label class="label label-default" ng-switch-when="70">Nota denegada</label>
                                        </td>
                                        <td>
                                            <a href="" ng-click="showNotaObs(item)"><i class="material-icons">receipt</i></a>
                                        </td>
                                        <td>
                                            <a ng-click="redirect(item)" title="Clique para visualizar a nota" href="">
                                                <div class="media">
                                                    <div class="media-left">
                                                        <div class="icon-24">
                                                            <i class="material-icons">memory</i>
                                                        </div>
                                                    </div>
                                                    <div class="media-body">
                                                        {{item.Numero}} - {{item.Serie.Codigo}}
                                                    </div>
                                                </div>
                                            </a>
                                        </td>
                                        <td>{{item.NumeroModeloFiscal}} {{item.Serie.Especie.Nome}}</td>
                                        <td>{{item.Terminal.Codigo}}</td>
                                        <td>{{item.NaturezaOperacao.Nome}}</td>
                                        <td>{{item.Filial.Nome}}{{item.Terceiro.Nome}}</td>
                                        <td class="text-center"><input type="checkbox" ng-model="item.IndicaConsumidor" disabled /></td>
                                        <td>{{item.Emissao | date : 'dd/MM/yyyy'}}</td>
                                        <td>{{item.DataMovimentacao | date : 'dd/MM/yyyy'}}</td>
                                        <td class="text-right">{{item.Quantidade}}</td>
                                        <td class="text-right">{{item.Valor | currency : 'R$ ': 2}}</td>
                                    </tr>
                                </tbody>
                            </table>
                        </div>
                    </div>
                </div>
                <div class="footer">
                    <div class="pull-left">
                        <input type="button" class="btn btn-link" value="Cancelar" ng-click="closePendingInvoices()" />
                    </div>
                    <div class="input-group-btn">
                        <input type="submit" ng-disabled="!hasNotasSelecionadas()" class="btn btn-success" value="Reenviar Nota(s)" />
                    </div>
                </div>
            </form>
        </div>
    </div>

    <div id="modalObs" class="bg-modal" ng-if="state.showObs">
        <div class="form">
            <h1 class="header text-center">
                OBSERVAÇÕES DA NOTA {{state.notaSelecionada.Numero}} - {{state.notaSelecionada.Serie.Codigo}}
                <span class="pull-right">
                    <a href="" ng-click="toogleModalObs()">
                        <i class="material-icons">close</i>
                    </a>
                </span>
            </h1>
            <div class="wrapper">
                <textarea class="form-control"
                          style="height: 85% !important; resize: none; background-color: #eee;"
                          readonly="readonly"
                          ng-model="state.notaSelecionada.Notas"></textarea>
            </div>
            <div class="footer">
                <div class="input-group-btn">
                    <input type="button" class="btn btn-link" value="Fechar Obs" ng-click="toogleModalObs()" />
                </div>
            </div>
        </div>
    </div>

    <div id="modalLogReenvio" class="bg-modal" ng-if="state.showReenvioLog">
        <div class="form">
            <h1 class="header text-center">
                LOG DE REENVIO
                <span class="pull-right">
                    <a href="" ng-click="toogleModalReenvioLog()">
                        <i class="material-icons">close</i>
                    </a>
                </span>
            </h1>
            <div class="wrapper">
                <textarea class="form-control"
                          style="height: 85% !important; resize: none; background-color: #eee;"
                          readonly="readonly"
                          ng-model="state.reenvioLog"></textarea>
            </div>
            <div class="footer">
                <div class="input-group-btn">
                    <input type="button" class="btn btn-link" value="Fechar Log" ng-click="toogleModalReenvioLog()" />
                </div>
            </div>
        </div>
    </div>

</div>