Browse Source

make save sale disabled when submit is clicked

Jose Miguel Ledon Nieblas 8 years ago
parent
commit
ae36898321
1 changed files with 4 additions and 0 deletions
  1. 4 0
      app/views/sales/_form.html.erb

+ 4 - 0
app/views/sales/_form.html.erb

@@ -279,6 +279,9 @@
 			calculateTotals();
 		});
 
+		$('form#sale_form').bind('ajax:complete', function() {
+			$('#save_sale').attr('disabled', false);
+		});
 
 		$('#sale_customer_id').on('change', function() {
 			$(this).attr('disabled', true);
@@ -512,6 +515,7 @@
 			if ($form[0].checkValidity()) {
 				if(table.fnGetData().length > 0) {
 					$('#sale_form').submit();
+					$('#save_sale').attr('disabled', true);
 				} else {
 					toastr["error"]("Error, Se debe agregar al menos un producto.");
 				}