{% extends "baseAdmin.html" %}
{% load static %}
{% block titulo %}
  .::Saldo de Oficinas
{% endblock titulo %}
{% block content1 %} 
      <script type="text/javascript">
        $("#navCOS").attr('class','dropdown active');
        $("#navsaldooficinas").attr('class','active');
      </script>
        <div class="row">
          <div class="col-md-12 col-sm-12" >
              <div class="card">
                <div class="card-header bgm-bluegray text-center" > <h2>SALDO DE OFICINAS</h2></div>
                <div class="card-body">
                <p></p>
                  <div class="row">
                    <div class="col-md-2 col-md-offset-1">
                      <button type="button" class="btn btn-block btn-info waves-effect" id="btnRefrescar">Actualizar</button>
                    </div>
                  </div>
                  <div class="row">
                    <br>
                    <p class="bg-success">
                      &nbsp;
                      <div class="col-md-10 col-md-offset-1">
                          <div class="table-responsive">
                            <table class="table table-bordered">
                                <thead>
                                  <tr>
                                    <th>Nro</th>
                                    <th>Oficina</th>
                                    <th>Saldo Soles</th>
                                    <th>Saldo Dolares</th>
                                  </tr>
                                </thead>
                                <tbody id="listaR">
                                    
                                </tbody>
                            </table>
                          </div>
                      </div>
                    </p>
                  </div>
                </div>
              </div>
          </div>
        </div> 
     <script type="text/javascript">
                            $(document).ready(function () {
                              ajax_saldo_oficinas();
                              $("#btnRefrescar").click(function(){
                                ajax_saldo_oficinas();
                              });
                              function ajax_saldo_oficinas(){
                                $.ajax({
                                  url:'/ver_saldo_oficinas_admin_ajax/',
                                  type:'GET',
                                  dataType:'json',
                                  success: function(data){
                                    Aux = data;
                                    var html ="" ,html1="",id_oficinaCentral="";
                                    for(var i=0;i<data.length;i++){
                                        html += '<tr ><th scope="row">'+(i+1)+'</th><td>'+data[i].of+'</td><td>'+data[i].saldos+'</td><td>'+data[i].saldod+'</td></tr>';

                                    }                        
                                    $('#listaR').html(html);
                                  }
                                });
                              }
                            });
                          </script>
{% endblock content1 %}