<commit_before>$('#newBarcode').modal('hide');
source_field = $('#trigger-field-id').val();

// Clear out the fields, capturing the quantity and item_id
item_id = $('#barcode_item_barcodeable_id').val();
quantity = $('#barcode_item_quantity').val();
$('#barcode_item_quantity').val('');
$('#barcode_item_barcodeable_id').val('');
$('#barcode_item_value').val('');
$('#trigger-field-id').val('');

// Notify the user
toastr.success("Barcode Added to Inventory");

// Locate the row where the barcode was entered from
line_item = $('#' + source_field).closest('.nested-fields');
// Set the values in the form. This is replicating some logic from barcode_items.js.erb
$(line_item).find('input[type=number]').val(quantity);
$(line_item).find('[value="' + item_id + '"]').attr("selected", true);
$(line_item).parent().find('.nested-fields:last-child input.__barcode_item_lookup').focus();<commit_msg>Adds new line item after a new Barcode is created<commit_after>$('#newBarcode').modal('hide');
source_field = $('#trigger-field-id').val();

// Clear out the fields, capturing the quantity and item_id
item_id = $('#barcode_item_barcodeable_id').val();
quantity = $('#barcode_item_quantity').val();
$('#barcode_item_quantity').val('');
$('#barcode_item_barcodeable_id').val('');
$('#barcode_item_value').val('');
$('#trigger-field-id').val('');

// Notify the user
toastr.success("Barcode Added to Inventory");

// Locate the row where the barcode was entered from
line_item = $('#' + source_field).closest('.nested-fields');
// Set the values in the form. This is replicating some logic from barcode_items.js.erb
$(line_item).find('input[type=number]').val(quantity);
$(line_item).find('[value="' + item_id + '"]').attr("selected", true);
$('#__add_line_item').trigger('click');
$(line_item).parent().find('.nested-fields:last-child input.__barcode_item_lookup').focus();
{'fraction_non_alphanumeric': 0.2132904608788853, 'fraction_numerical': 0.0, 'mean_word_length': 7.047413793103448, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '805572', 'n_tokens_mistral': 599, 'n_tokens_neox': 596, 'n_words': 125}