| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166 |
- <!-- BEGIN CONTAINER -->
- <div class="page-container">
- <!-- BEGIN CONTENT -->
- <div class="page-content-wrapper">
- <!-- BEGIN CONTENT BODY -->
- <!-- BEGIN PAGE HEAD-->
- <div class="page-head">
- <div class="container-fluid">
- <!-- BEGIN PAGE TITLE -->
- <div class="page-title">
- <h1>Líneas de producto </h1>
- </div>
- <!-- END PAGE TITLE -->
- </div>
- </div>
- <!-- END PAGE HEAD-->
- <!-- BEGIN PAGE CONTENT BODY -->
- <div class="page-content">
- <div class="container-fluid">
- <!-- BEGIN PAGE BREADCRUMBS -->
- <ul class="page-breadcrumb breadcrumb">
- <%= render_breadcrumbs :tag => :li, :separator => ' <i class="fa fa-circle"></i> ' %>
- </ul>
- <!-- END PAGE BREADCRUMBS -->
- <!-- BEGIN PAGE CONTENT INNER -->
- <div class="page-content-inner">
- <div id="notice">
- <% if success %>
- <div class="alert alert-success">
- <p><%= success %></p>
- </div>
- <% elsif warning %>
- <div class="alert alert-warning">
- <p><%= warning %></p>
- </div>
- <% end %>
- </div>
- <div class="row">
- <div class="col-md-12">
- <div class="portlet light ">
- <div class="portlet-title">
- <div class="caption">
- <i class="fa fa-list "></i>
- <span class="caption-subject bold uppercase">Lista de líneas de productos</span>
- </div>
- <div class="actions">
- <% if can? :create, Category %>
- <%= link_to new_category_path, {:class=>"btn bold green pull-right filtros"} do %> Nueva Línea de producto <i class="fa fa-plus"></i><% end %>
- <% end %>
- </div>
- </div>
- <div class="portlet-body">
- <input type='hidden' name='filter' id='filter' value='<%= @filter %>' >
- <input type='hidden' name='current_page' id='current_page' value='<%= @current_page %>' >
- <table class="table table-striped table-bordered table-hover tableadvanced" id="categories">
- <thead>
- <tr>
- <th>#</th>
- <th>Línea / sublínea <br> de producto</th>
- <th>Descripción</th>
- <th>Total de productos</th>
- <th>Status</th>
- <% if can? :manage, Category %>
- <th>Acciones</th>
- <% end %>
- </tr>
- </thead>
- <tbody>
- <% @categories.each_with_index do |category, key| %>
- <tr <% if category.parent_id.zero? %> class="bold" <% end %> >
- <td><%= key + 1 %></td>
- <td><%= category.category %></td>
- <td><%= category.description %></td>
- <td>
- <% total_products = category.products.length %>
- <% if !category.children.empty? %>
- <% productsofchildren = 0 %>
- <% category.children.each_with_index do |child, k|%>
- <% productsofchildren += child.products.length %>
- <% end %>
- <% total_products += productsofchildren %>
- <% end %>
- <%= total_products %>
- </td>
- <td class="text-center">
- <% if category.active? %>
- <i class="fa fa-check font-green"></i>
- <% else %>
- <i class="fa fa-times font-red"></i>
- <% end %>
- </td>
- <% if can? :manage, Category %>
- <td class="text-center">
- <%= link_to edit_category_path(category), {:class=>"btn btn-icon-only btn-primary filtros", :title=>"Editar línea de producto"} do %>
- <i class="fa fa-edit"></i>
- <% end %>
- <% if category.active? %>
- <%= link_to category_update_status_path(category), :class=>"btn btn-icon-only default", :title=>"Desactivar línea de producto", data: { confirm: '¿Esta seguro de desactivar la línea de producto?', method: 'post'} do %>
- <i class="fa fa-toggle-off"></i>
- <% end %>
- <% elsif category.inactive? %>
- <%= link_to category_update_status_path(category), :class=>"btn btn-icon-only green-jungle", :title=>"Activar línea de producto", data: { confirm: '¿Esta seguro de activar la línea de producto?', method: 'post'} do %>
- <i class="fa fa-toggle-on"></i>
- <% end %>
- <% end %>
- <% if category.children.empty? && category.products.length == 0 %>
- <%= link_to category_path(category), method: :delete, :class => "btn btn-icon-only btn-danger", :title=>"Eliminar línea de producto", data: { confirm: '¿Esta seguro de eliminar la línea de producto?'} do %>
- <i class="fa fa-trash-o"></i>
- <% end %>
- <% end %>
- </td>
- <% end %>
- </tr>
- <% category.children.each_with_index do |child, k| %>
- <tr>
- <td><%= key + 1 %> - <%= k + 1 %></td>
- <td><span class="text-muted"> <%= child.category %> </span></td>
- <td><%= child.description %></td>
- <td><%= child.products.length %></td>
- <td class="text-center">
- <% if child.active? %>
- <i class="fa fa-check font-green"></i>
- <% else %>
- <i class="fa fa-times font-red"></i>
- <% end %>
- </td>
- <% if can? :manage, Category %>
- <td class="text-center">
- <%= link_to edit_category_path(child), {:class=>"btn btn-icon-only btn-primary filtros", :title=>"Editar sublínea de producto"} do %>
- <i class="fa fa-edit"></i>
- <% end %>
- <% if child.active? %>
- <%= link_to category_update_status_path(child), :class=>"btn btn-icon-only default", :title=>"Desactivar sublínea de producto", data: { confirm: '¿Esta seguro de desactivar la sublínea de producto?', method: 'post'} do %>
- <i class="fa fa-toggle-off"></i>
- <% end %>
- <% elsif child.inactive? %>
- <%= link_to category_update_status_path(child), :class=>"btn btn-icon-only green-jungle", :title=>"Activar sublínea de producto", data: { confirm: '¿Esta seguro de activar la sublínea de producto?', method: 'post'} do %>
- <i class="fa fa-toggle-on"></i>
- <% end %>
- <% end %>
- <% if child.products.length == 0 %>
- <%= link_to category_path(child), method: :delete, :class => "btn btn-icon-only btn-danger", :title=>"Eliminar sublínea de producto", data: { confirm: '¿Esta seguro de eliminar la sublínea de producto?'} do %>
- <i class="fa fa-trash-o"></i>
- <% end %>
- <% end %>
- </td>
- <% end %>
- </tr>
- <% end %>
- <% end %>
- </tbody>
- </table>
- </div>
- </div>
- </div>
- </div>
- </div>
- <!-- END PAGE CONTENT INNER -->
- </div>
- </div>
- <!-- END PAGE CONTENT BODY -->
- <!-- END CONTENT BODY -->
- </div>
- <!-- END CONTENT -->
- </div>
- <!-- END CONTAINER -->
|