Przeglądaj źródła

added validation when there is no open cash, we dont allow to make a new products return

Jose Miguel Ledon Nieblas 9 lat temu
rodzic
commit
c4427e95cf
1 zmienionych plików z 5 dodań i 3 usunięć
  1. 5 3
      app/views/products_returns/index.html.erb

+ 5 - 3
app/views/products_returns/index.html.erb

@@ -44,10 +44,12 @@
                     <span class="caption-subject bold uppercase">Lista de devoluciones</span>
                   </div>
                   <div class="actions">
-
-                    <% if can? :create, ProductsReturn %>
-                      <%= link_to new_products_return_path, :class=>"btn bold green pull-right" do %> Nueva devolución <i class="fa fa-plus"></i>
+                    <% if session[:open_cash_register_id].present?%>
+                      <% if can? :create, ProductsReturn %>
+                        <%= link_to new_products_return_path, :class=>"btn bold green pull-right" do %> Nueva devolución <i class="fa fa-plus"></i><% end %>
                       <% end %>
+                    <% else %>
+                      <div class="alert alert-warning pull-right">Para agregar una devolucion se necesita una caja abierta. </div>
                     <% end %>
                   </div>
                 </div>