Ver código fonte

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

Jose Miguel Ledon 7 anos atrás
pai
commit
304d365a51

+ 9 - 6
Gemfile.lock

@@ -58,6 +58,7 @@ GEM
     autoprefixer-rails (6.3.2)
       execjs
       json
+    barby (0.6.5)
     bcrypt (3.1.10)
     binding_of_caller (0.7.2)
       debug_inspector (>= 0.0.1)
@@ -84,6 +85,7 @@ GEM
     childprocess (0.5.9)
       ffi (~> 1.0, >= 1.0.11)
     choice (0.2.0)
+    chunky_png (1.3.10)
     climate_control (0.0.3)
       activesupport (>= 3.0)
     cocaine (0.5.7)
@@ -158,6 +160,9 @@ GEM
       mimemagic (= 0.3.0)
     parser (2.3.3.1)
       ast (~> 2.2)
+    pdfjs_viewer-rails (0.0.9)
+      rails (> 4.2.0)
+      sass-rails (~> 5.0)
     pg (0.18.3)
     powerpack (0.1.1)
     pry (0.10.4)
@@ -204,7 +209,6 @@ GEM
       thor (>= 0.18.1, < 2.0)
     rainbow (2.1.0)
     rake (10.4.2)
-    rdoc (4.2.0)
     remotipart (1.2.1)
     responders (2.1.1)
       railties (>= 4.2.0, < 5.1)
@@ -223,9 +227,6 @@ GEM
       sprockets (>= 2.8, < 4.0)
       sprockets-rails (>= 2.0, < 4.0)
       tilt (>= 1.1, < 3)
-    sdoc (0.4.1)
-      json (~> 1.7, >= 1.7.7)
-      rdoc (~> 4.0)
     select2-rails (4.0.1)
       thor (~> 0.14)
     simple-line-icons-rails (0.0.1)
@@ -277,6 +278,7 @@ PLATFORMS
 DEPENDENCIES
   acts-as-taggable-on (~> 3.4)
   audited-activerecord (~> 4.0)
+  barby
   bootbox-rails (~> 0.4)
   bootstrap-multiselect-rails
   bootstrap-sass
@@ -288,6 +290,7 @@ DEPENDENCIES
   byebug
   cancan
   carrierwave (>= 1.0.0.rc, < 2.0)
+  chunky_png
   coffee-rails (~> 4.1.0)
   devise
   devise_security_extension
@@ -305,6 +308,7 @@ DEPENDENCIES
   nokogiri
   overcommit
   paperclip
+  pdfjs_viewer-rails
   pg
   pry-rails
   rails (= 4.2.4)
@@ -314,7 +318,6 @@ DEPENDENCIES
   responders
   rubocop (~> 0.46.0)
   sass-rails (~> 5.0)
-  sdoc (~> 0.4.0)
   select2-rails
   simple-line-icons-rails
   simple_navigation_renderers
@@ -331,4 +334,4 @@ DEPENDENCIES
   wkhtmltopdf-binary
 
 BUNDLED WITH
-   1.13.6
+   1.16.3

+ 1 - 1
app/models/ability.rb

@@ -40,7 +40,7 @@ class Ability
       can [:opened_cash_registers, :find_cash_outs_by_date, :print_receipt], CashOut
       can :sales_reserved, Sale
       cannot [:delete, :liquidate_reserve], Sale
-      cannot :create, [ProductWaste, Purchase, Sale]
+      cannot :create, [ProductWaste, Sale]
       cannot [:debtors, :customer_sales], Customer
     elsif user.usertype == "G"
       # Cajas registradoras

+ 11 - 19
app/views/products/_form.html.erb

@@ -32,7 +32,7 @@
 								<i class="fa fa-barcode"></i>
 								<%= f.text_field :barcode, {:class=>"form-control input-medium", :readonly => true } %>
 							</div>
-							<span class="help-block">Si el codigo de barras ya existe escaneelo, si desea generarlo clickee el switch. </span>
+							<span class="help-block">Si el codigo de barras ya existe escaneelo, si no, se generará automaticamente. </span>
 						</div>
 					</div>
 					<div class="form-group">
@@ -300,14 +300,6 @@
   $(document).on('page:change', function() {
     App.init();
     $('.fileinput').fileinput();
-    <% if @product.barcode.blank? %>
-      $('body').barcodeListener().on('barcode.valid', function(e, code) {
-        if($('#product_barcode').length > 0) {
-          $('#product_barcode').val(code);
-          validateBarcode(code);
-        }
-      });
-    <% end %>
 
     presentaciones();
     // < % if @product.children.present? %>
@@ -321,16 +313,16 @@
     });
   });
 
-		<% if @product.barcode.blank? %>
-			// $('#product_barcode').codeScanner({       // SE ESTA TRIGGEREANDO AL ESCRIBIR TEXTO
-			// 	maxEntryTime: 500, // milliseconds
-			// 	minEntryChars: 5,  // characters
-			// 	onScan: function ($element, code) {
-			// 		$('#product_barcode').val(code);
-			// 		validateBarcode(code);
-			// 	}
-			// });
-		<% end %>
+	<% if @product.barcode.blank? %>
+		$('#product_barcode').codeScanner({
+			maxEntryTime: 100, // milliseconds
+			minEntryChars: 7,  // characters
+			onScan: function ($element, code) {
+				$('#product_barcode').val(code);
+				validateBarcode(code);
+			}
+		});
+	<% end %>
 
   $('#product_size_list').on('change', function(event) { getVariants(); });
   $('#product_color_list').on('change', function(event) { getVariants(); });

+ 5 - 3
app/views/products/_form_remote.html.erb

@@ -37,7 +37,7 @@
 				        <span class="input-group-addon"><i class="fa fa-barcode"></i></span>
 				        <%= f.text_field :barcode, {:class=>"form-control input-medium", :readonly => true} %>
 				      </div>
-				       <span class="help-block">Para indicar el codigo de barras, debe de escanearlo. </span>
+				       <span class="help-block">Si el codigo de barras ya existe escaneelo, si no, se generará automaticamente. </span>
 			      </div>
 			    </div>
 				<div class="form-group">
@@ -329,8 +329,10 @@
 		$('.fileinput').fileinput();
 
 		<% if @product.barcode.blank? %>
-			$('body').barcodeListener().on('barcode.valid', function(e, code) {
-				if($('#product_barcode').length > 0) {
+			$('#product_barcode').codeScanner({
+				maxEntryTime: 100, // milliseconds
+				minEntryChars: 7,  // characters
+				onScan: function ($element, code) {
 					$('#product_barcode').val(code);
 					validateBarcode(code);
 				}