Fix bug for printing one-off product labels
This commit is contained in:
		
							parent
							
								
									d090338ba5
								
							
						
					
					
						commit
						242d37c95d
					
				
					 2 changed files with 3 additions and 2 deletions
				
			
		| 
						 | 
					@ -28,6 +28,7 @@
 | 
				
			||||||
    </div>
 | 
					    </div>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    ${h.form(request.current_route_url())}
 | 
					    ${h.form(request.current_route_url())}
 | 
				
			||||||
 | 
					    ${h.csrf_token(request)}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    % for name, display in printer.required_settings.iteritems():
 | 
					    % for name, display in printer.required_settings.iteritems():
 | 
				
			||||||
        <div class="field-wrapper">
 | 
					        <div class="field-wrapper">
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -44,6 +44,7 @@
 | 
				
			||||||
          $('.newgrid-wrapper .grid-header .tools select').selectmenu();
 | 
					          $('.newgrid-wrapper .grid-header .tools select').selectmenu();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
          $('.newgrid-wrapper').on('click', 'a.print_label', function() {
 | 
					          $('.newgrid-wrapper').on('click', 'a.print_label', function() {
 | 
				
			||||||
 | 
					              var tr = $(this).parents('tr:first');
 | 
				
			||||||
              var quantity = $('table.label-printing #label-quantity');
 | 
					              var quantity = $('table.label-printing #label-quantity');
 | 
				
			||||||
              if (isNaN(quantity.val())) {
 | 
					              if (isNaN(quantity.val())) {
 | 
				
			||||||
                  alert("You must provide a valid label quantity.");
 | 
					                  alert("You must provide a valid label quantity.");
 | 
				
			||||||
| 
						 | 
					@ -52,11 +53,10 @@
 | 
				
			||||||
              } else {
 | 
					              } else {
 | 
				
			||||||
                  quantity = quantity.val();
 | 
					                  quantity = quantity.val();
 | 
				
			||||||
                  var data = {
 | 
					                  var data = {
 | 
				
			||||||
                      product: get_uuid(this),
 | 
					                      product: tr.data('uuid'),
 | 
				
			||||||
                      profile: $('#label-profile').val(),
 | 
					                      profile: $('#label-profile').val(),
 | 
				
			||||||
                      quantity: quantity
 | 
					                      quantity: quantity
 | 
				
			||||||
                  };
 | 
					                  };
 | 
				
			||||||
                  console.log(data);
 | 
					 | 
				
			||||||
                  $.get('${url('products.print_labels')}', data, function(data) {
 | 
					                  $.get('${url('products.print_labels')}', data, function(data) {
 | 
				
			||||||
                      if (data.error) {
 | 
					                      if (data.error) {
 | 
				
			||||||
                          alert("An error occurred while attempting to print:\n\n" + data.error);
 | 
					                          alert("An error occurred while attempting to print:\n\n" + data.error);
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue