index.html.erb 7.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167
  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>
  49. <% end %>
  50. <% end %>
  51. </div>
  52. </div>
  53. <div class="portlet-body">
  54. <input type='hidden' name='filter' id='filter' value='<%= @filter %>' >
  55. <input type='hidden' name='current_page' id='current_page' value='<%= @current_page %>' >
  56. <table class="table table-striped table-bordered table-hover tableadvanced" id="categories">
  57. <thead>
  58. <tr>
  59. <th>#</th>
  60. <th>Línea / sublínea <br> de producto</th>
  61. <th>Descripci&oacute;n</th>
  62. <th>Total de productos</th>
  63. <th>Status</th>
  64. <% if can? :manage, Category %>
  65. <th>Acciones</th>
  66. <% end %>
  67. </tr>
  68. </thead>
  69. <tbody>
  70. <% @categories.each_with_index do |category, key| %>
  71. <tr <% if !category.children.empty? %> class="bold" <% end %> >
  72. <td><%= key + 1 %></td>
  73. <td><%= category.category %></td>
  74. <td><%= category.description %></td>
  75. <td>
  76. <% if category.children.empty? %>
  77. <%= category.products.length %>
  78. <% else %>
  79. <% @productsofchildren = 0 %>
  80. <% category.children.each_with_index do |child, k|%>
  81. <% @productsofchildren += child.products.length %>
  82. <% end %>
  83. <%= @productsofchildren %>
  84. <% end %>
  85. </td>
  86. <td class="text-center">
  87. <% if category.active? %>
  88. <i class="fa fa-check font-green"></i>
  89. <% else %>
  90. <i class="fa fa-times font-red"></i>
  91. <% end %>
  92. </td>
  93. <% if can? :manage, Category %>
  94. <td class="text-center">
  95. <%= link_to edit_category_path(category), {:class=>"btn btn-icon-only btn-primary filtros", :title=>"Editar línea de producto"} do %>
  96. <i class="fa fa-edit"></i>
  97. <% end %>
  98. <% if category.active? %>
  99. <%= 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 %>
  100. <i class="fa fa-toggle-off"></i>
  101. <% end %>
  102. <% elsif category.inactive? %>
  103. <%= 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 %>
  104. <i class="fa fa-toggle-on"></i>
  105. <% end %>
  106. <% end %>
  107. <% if category.children.empty? && category.products.length == 0 %>
  108. <%= 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 %>
  109. <i class="fa fa-trash-o"></i>
  110. <% end %>
  111. <% end %>
  112. </td>
  113. <% end %>
  114. </tr>
  115. <% category.children.each_with_index do |child, k|%>
  116. <tr>
  117. <td><%= key + 1 %> - <%= k + 1 %></td>
  118. <td><span class="text-muted"> <%= child.category %> </span></td>
  119. <td><%= child.description %></td>
  120. <td><%= child.products.length %></td>
  121. <td class="text-center">
  122. <% if child.active? %>
  123. <i class="fa fa-check font-green"></i>
  124. <% else %>
  125. <i class="fa fa-times font-red"></i>
  126. <% end %>
  127. </td>
  128. <% if can? :manage, Category %>
  129. <td class="text-center">
  130. <%= link_to edit_category_path(child), {:class=>"btn btn-icon-only btn-primary filtros", :title=>"Editar sublínea de producto"} do %>
  131. <i class="fa fa-edit"></i>
  132. <% end %>
  133. <% if child.active? %>
  134. <%= 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 %>
  135. <i class="fa fa-toggle-off"></i>
  136. <% end %>
  137. <% elsif child.inactive? %>
  138. <%= 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 %>
  139. <i class="fa fa-toggle-on"></i>
  140. <% end %>
  141. <% end %>
  142. <% if child.products.length == 0 %>
  143. <%= 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 %>
  144. <i class="fa fa-trash-o"></i>
  145. <% end %>
  146. <% end %>
  147. </td>
  148. <% end %>
  149. </tr>
  150. <% end %>
  151. <% end %>
  152. </tbody>
  153. </table>
  154. </div>
  155. </div>
  156. </div>
  157. </div>
  158. </div>
  159. <!-- END PAGE CONTENT INNER -->
  160. </div>
  161. </div>
  162. <!-- END PAGE CONTENT BODY -->
  163. <!-- END CONTENT BODY -->
  164. </div>
  165. <!-- END CONTENT -->
  166. </div>
  167. <!-- END CONTAINER -->