Przeglądaj źródła

Merge branch 'chemi_branch' of SML/pos-boutique into master

Jose Miguel Ledon 6 lat temu
rodzic
commit
83e7e33470

+ 1 - 1
app/controllers/cash_registers_moves_controller.rb

@@ -69,7 +69,7 @@ class CashRegistersMovesController < ApplicationController
         elsif @sale.reserved?
           @cash_registers_move.status = :inactive
           @cash_registers_move.choose_concept_when_reserved
-          @cash_registers_move.open_cash_register_id = session[:open_cash_register_id]
+          @cash_registers_move.open_cash_register_id = current_user.usertype == 'C' ? session[:open_cash_register_id] : current_user.pointsale.get_open_cash_register.id
         end
 
         message = "movimiento de efectivo por venta con folio #{@cash_registers_move.sale.sale_code}"

+ 7 - 0
app/controllers/sales_controller.rb

@@ -21,6 +21,13 @@ class SalesController < ApplicationController
   def sales_reserved
     beg_of_month = Date.current.beginning_of_month
     end_of_month = Date.current.end_of_month
+    @has_open_cash_register =  if current_user.usertype == 'C'
+                                session[:open_cash_register_id].present?
+                              elsif current_user.usertype == 'G'
+                                current_user.pointsale.get_open_cash_register.present?
+                              elsif current_user.usertype == 'A'
+                                false
+                              end
     @sales = current_user.usertype == "A" || current_user.usertype == "SS" ? Sale.where(saletype: 2).order(" created_at DESC ") : Pointsale.find(current_user.pointsale_id).sales.where(saletype: 2).order(" created_at DESC")
   end
 

+ 3 - 3
app/views/cash_registers_moves/add_quick_payment.js.erb

@@ -12,7 +12,7 @@ $('#dialog').modal({ closeOnEscape: false });
 $('#dialog').modal("show");
 // Set focus to the first element
 $('#dialog').on('shown.bs.modal', function () {
-      $('.first_input').focus();
-      $('select').select2();
-
+	$("#customer_id").select2({
+		dropdownParent: $("#dialog")
+	});
  })

+ 1 - 1
app/views/sales/sales_reserved.html.erb

@@ -139,7 +139,7 @@
                             <% end %>
                           <% end %>
                           <!-- liquidar traspaso -->
-                          <% if (can? :liquidate_reserve, Sale) && !sale.cancelled_by_expiration? && sale.parcial? %>
+                          <% if (can? :liquidate_reserve, Sale) && !sale.cancelled_by_expiration? && sale.parcial? && @has_open_cash_register%>
                             <%= link_to sale_liquidate_reserve_path(sale), :remote => true, class: "btn btn-icon-only green-dark", title: "Liquidar apartado" do %>
                               <i class="fa fa-dollar"></i>
                             <% end %>