<div class="row">
  <div class="col-md-2 col-sm-3 col-xs-3">
    <ul class="nav nav-tabs tabs-left">
      <li class="active">
          <a href="#puntosdeventa" data-toggle="tab"> Puntos de venta </a>
      </li>
      <li>
          <a href="#generales" data-toggle="tab"> Generales </a>
      </li>
    </ul>
  </div>
  <div class="col-md-10 col-sm-9 col-xs-9">
    <div class="tab-content">
      <div class="tab-pane active" id="puntosdeventa">
        <div class="row">
          <div class="col-md-12">
            <table class="table table-striped table-bordered table-hover tableadvanced">
              <thead>
                <tr>
                  <th>#</th>
                  <th>Código de egreso</th>
                  <th>Concepto de egreso</th>
                  <th>Punto de venta</th>
                  <th>Caja registradora</th>
                  <th>Fecha</th>
                  <th>Cantidad</th>
                  <th>Observaciones</th>
                  <th>Status</th>
                  <th width="15%">Acciones</th>
                </tr>
              </thead>
              <tbody>
                <% @from_pointsale.each_with_index do |expense, key| %>
                <tr>
                  <td><%= expense.id %></td>
                  <td><%= expense.expense_code %></td>
                  <td><%= expense.expensesconcept.name %></td>
                  <td><%= expense.open_cash_register.cash_register.pointsale.name %></td>
                  <td><%= expense.open_cash_register.cash_register.name %></td>
                  <td><%= l(expense.created_at, :format => '%d/%B/%Y') %> </td>
                  <td><%= number_to_currency(expense.quantity, precision: 2) %> </td>
                  <td><%= expense.observations %> </td>
                  <td>
                    <% case expense.status %>
                    <% when "active"%>
                      <span class="label label-sm label-warning"> <i class="fa fa-clock-o"></i> Caja abierta </span>
                    <% when "canceled"%>
                       <span class="label label-sm label-danger"> <i class="fa fa-close"></i> Cancelada </span>
                    <% when "registered"%>
                       <span class="label label-sm label-success"><i class="fa fa-check"></i>  Caja cerrada </span>
                    <% end %>
                  </td>
                  <td class="text-center">
                    <% if expense.status == "active" %>
                      <%= link_to expense, method: :delete, :class => "btn btn-icon-only btn-danger", :title=>"Cancelar egreso", data: { confirm: '¿Está seguro que desea cancelar el egreso?' } do %> <i class="fa fa-ban"></i><% end %>
                    <% end %>
                  </td>
                </tr>
                <% end %>
              </tbody>
            </table>
          </div>
        </div>
      </div>
      <div class="tab-pane fade" id="generales">
        <div class="row">
          <div class="col-md-12">
            <table class="table table-striped table-bordered table-hover tableadvanced">
              <thead>
                <tr>
                  <th>#</th>
                  <th>Código de egreso</th>
                  <th>Concepto de gasto</th>
                  <th>Fecha</th>
                  <th>Cantidad</th>
                  <th>Observaciones</th>
                  <th>Status</th>
                  <th width="15%">Acciones</th>
                </tr>
              </thead>
              <tbody>
                <% @general_expenses.each_with_index do |expense, key| %>
                <tr>
                  <td><%= expense.id %></td>
                  <td><%= expense.expense_code %></td>
                  <td><%= expense.expensesconcept.name %></td>
                  <td><%= l(expense.expense_date, :format => '%d/%B/%Y') %> </td>
                  <td><%= number_to_currency(expense.quantity, precision: 2) %> </td>
                  <td><%= expense.observations %> </td>
                  <td>
                    <% case expense.status %>
                    <% when "active"%>
                      <span class="label label-sm label-success"> <i class="fa fa-check"></i> Activo </span>
                    <% when "canceled"%>
                       <span class="label label-sm label-danger"> <i class="fa fa-close"></i> Cancelado </span>
                    <% end %>
                  </td>
                  <td class="text-center">
                    <% if expense.active? %>
                      <%= link_to expense, method: :delete, :class => "btn btn-icon-only btn-danger", :title=>"Cancelar egreso", data: { confirm: '¿Está seguro que desea cancelar el egreso?' } do %> <i class="fa fa-ban"></i><% end %>
                    <% end %>
                  </td>
                </tr>
                <% end %>
              </tbody>
            </table>
          </div>
        </div>
      </div>
    </div>
  </div>
</div>
