<% @pointsales.each_with_index do |pointsale, key| %>
<tr>
    <td><%= key + 1 %></td>
    <td><%= pointsale.name %></td>
    <td><%= pointsale.prefix %></td>
    <td><%= pointsale.address %></td>
    <td class="text-center"><% if pointsale.products.count > 0 %>
            <i class="fa fa-check font-green"></i>
            <% else %>
            <i class="fa fa-times font-red"></i>
        <% end %></td>
    <td class="text-center">
        <% if pointsale.total_products(pointsale.id) > 0 %>
            <i class="fa fa-check font-green"></i>
            <% else %>
            <i class="fa fa-times font-red"></i>
        <% end %></td>
    <td class="text-center"><% if pointsale.status == "active" %>
            <i class="fa fa-check font-green"></i>
            <% else %>
            <i class="fa fa-times font-red"></i>
            <% end %></td>
    <td >
        <%= link_to edit_pointsale_path(pointsale, :todo => "products"), {:class=>"btn btn-icon-only default", :title=>"Actualizar productos disponibles"} do %>
             <i class="fa fa-object-group"></i>
        <% end %>
        <%= link_to edit_pointsale_path(pointsale), {:class=>"btn btn-icon-only btn-primary", :title=>"Editar punto de venta"} do %>
             <i class="fa fa-edit"></i>
        <% end %>
        <% if pointsale.active? && pointsale.open_cash_registers.where("open_cash_registers.status = 0").count == 0 %>
            <%= link_to pointsale_update_status_path(pointsale), :class=>"btn btn-icon-only default", :title=>"Desactivar punto de venta", data: { confirm: '¿Esta seguro de desactivar el punto de venta?', method: 'post'}  do %>
                <i class="fa fa-toggle-off"></i>
            <% end %>
        <% elsif pointsale.inactive? %>
            <%= link_to pointsale_update_status_path(pointsale), :class=>"btn btn-icon-only green-jungle", :title=>"Activar punto de venta", data: { confirm: '¿Esta seguro de activar el punto de venta?', method: 'post'}  do %>
                <i class="fa fa-toggle-on"></i>
            <% end %>
        <% end %>


    </td>
</tr>
<% end %>
