index.html.erb 7.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166
  1. <!-- BEGIN CONTAINER -->
  2. <div class="page-container">
  3. <!-- BEGIN CONTENT -->
  4. <div class="page-content-wrapper">
  5. <!-- BEGIN CONTENT BODY -->
  6. <!-- BEGIN PAGE HEAD-->
  7. <div class="page-head">
  8. <div class="container-fluid">
  9. <!-- BEGIN PAGE TITLE -->
  10. <div class="page-title">
  11. <h1>Líneas de producto </h1>
  12. </div>
  13. <!-- END PAGE TITLE -->
  14. </div>
  15. </div>
  16. <!-- END PAGE HEAD-->
  17. <!-- BEGIN PAGE CONTENT BODY -->
  18. <div class="page-content">
  19. <div class="container-fluid">
  20. <!-- BEGIN PAGE BREADCRUMBS -->
  21. <ul class="page-breadcrumb breadcrumb">
  22. <%= render_breadcrumbs :tag => :li, :separator => ' <i class="fa fa-circle"></i> ' %>
  23. </ul>
  24. <!-- END PAGE BREADCRUMBS -->
  25. <!-- BEGIN PAGE CONTENT INNER -->
  26. <div class="page-content-inner">
  27. <div id="notice">
  28. <% if success %>
  29. <div class="alert alert-success">
  30. <p><%= success %></p>
  31. </div>
  32. <% elsif warning %>
  33. <div class="alert alert-warning">
  34. <p><%= warning %></p>
  35. </div>
  36. <% end %>
  37. </div>
  38. <div class="row">
  39. <div class="col-md-12">
  40. <div class="portlet light ">
  41. <div class="portlet-title">
  42. <div class="caption">
  43. <i class="fa fa-list "></i>
  44. <span class="caption-subject bold uppercase">Lista de líneas de productos</span>
  45. </div>
  46. <div class="actions">
  47. <% if can? :create, Category %>
  48. <%= 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 %>
  49. <% end %>
  50. </div>
  51. </div>
  52. <div class="portlet-body">
  53. <input type='hidden' name='filter' id='filter' value='<%= @filter %>' >
  54. <input type='hidden' name='current_page' id='current_page' value='<%= @current_page %>' >
  55. <table class="table table-striped table-bordered table-hover tableadvanced" id="categories">
  56. <thead>
  57. <tr>
  58. <th>#</th>
  59. <th>Línea / sublínea <br> de producto</th>
  60. <th>Descripci&oacute;n</th>
  61. <th>Total de productos</th>
  62. <th>Status</th>
  63. <% if can? :manage, Category %>
  64. <th>Acciones</th>
  65. <% end %>
  66. </tr>
  67. </thead>
  68. <tbody>
  69. <% @categories.each_with_index do |category, key| %>
  70. <tr <% if category.parent_id.zero? %> class="bold" <% end %> >
  71. <td><%= key + 1 %></td>
  72. <td><%= category.category %></td>
  73. <td><%= category.description %></td>
  74. <td>
  75. <% total_products = category.products.length %>
  76. <% if !category.children.empty? %>
  77. <% productsofchildren = 0 %>
  78. <% category.children.each_with_index do |child, k|%>
  79. <% productsofchildren += child.products.length %>
  80. <% end %>
  81. <% total_products += productsofchildren %>
  82. <% end %>
  83. <%= total_products %>
  84. </td>
  85. <td class="text-center">
  86. <% if category.active? %>
  87. <i class="fa fa-check font-green"></i>
  88. <% else %>
  89. <i class="fa fa-times font-red"></i>
  90. <% end %>
  91. </td>
  92. <% if can? :manage, Category %>
  93. <td class="text-center">
  94. <%= link_to edit_category_path(category), {:class=>"btn btn-icon-only btn-primary filtros", :title=>"Editar línea de producto"} do %>
  95. <i class="fa fa-edit"></i>
  96. <% end %>
  97. <% if category.active? %>
  98. <%= 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 %>
  99. <i class="fa fa-toggle-off"></i>
  100. <% end %>
  101. <% elsif category.inactive? %>
  102. <%= 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 %>
  103. <i class="fa fa-toggle-on"></i>
  104. <% end %>
  105. <% end %>
  106. <% if category.children.empty? && category.products.length == 0 %>
  107. <%= 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 %>
  108. <i class="fa fa-trash-o"></i>
  109. <% end %>
  110. <% end %>
  111. </td>
  112. <% end %>
  113. </tr>
  114. <% category.children.each_with_index do |child, k| %>
  115. <tr>
  116. <td><%= key + 1 %> - <%= k + 1 %></td>
  117. <td><span class="text-muted"> <%= child.category %> </span></td>
  118. <td><%= child.description %></td>
  119. <td><%= child.products.length %></td>
  120. <td class="text-center">
  121. <% if child.active? %>
  122. <i class="fa fa-check font-green"></i>
  123. <% else %>
  124. <i class="fa fa-times font-red"></i>
  125. <% end %>
  126. </td>
  127. <% if can? :manage, Category %>
  128. <td class="text-center">
  129. <%= link_to edit_category_path(child), {:class=>"btn btn-icon-only btn-primary filtros", :title=>"Editar sublínea de producto"} do %>
  130. <i class="fa fa-edit"></i>
  131. <% end %>
  132. <% if child.active? %>
  133. <%= 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 %>
  134. <i class="fa fa-toggle-off"></i>
  135. <% end %>
  136. <% elsif child.inactive? %>
  137. <%= 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 %>
  138. <i class="fa fa-toggle-on"></i>
  139. <% end %>
  140. <% end %>
  141. <% if child.products.length == 0 %>
  142. <%= 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 %>
  143. <i class="fa fa-trash-o"></i>
  144. <% end %>
  145. <% end %>
  146. </td>
  147. <% end %>
  148. </tr>
  149. <% end %>
  150. <% end %>
  151. </tbody>
  152. </table>
  153. </div>
  154. </div>
  155. </div>
  156. </div>
  157. </div>
  158. <!-- END PAGE CONTENT INNER -->
  159. </div>
  160. </div>
  161. <!-- END PAGE CONTENT BODY -->
  162. <!-- END CONTENT BODY -->
  163. </div>
  164. <!-- END CONTENT -->
  165. </div>
  166. <!-- END CONTAINER -->