<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>Caja registradora</th>
      <th>Fecha</th>
      <th>Cantidad</th>
      <th>Observaciones</th>
      <th>Status</th>
      <th width="15%">Acciones</th>
    </tr>
  </thead>
  <tbody>
    <% @expenses.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.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> Cancelado </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: '¿Esta seguro que desea cancelar el egreso?'}   do %> <i class="fa fa-ban"></i><% end %>
        <% end %>
      </td>
    </tr>
    <% end %>
  </tbody>
</table>
