<commit_before><%#encoding: UTF-8%>
// variant autocompletion

$(document).ready(function() {
  if ($('#variant_autocomplete_template').length > 0) {
    window.variantTemplate = Handlebars.compile($('#variant_autocomplete_template').text());
    window.variantStockTemplate = Handlebars.compile($('#variant_autocomplete_stock_template').text());

    // handle variant selection, show stock level.
    $('#add_variant_id').change(function(){
      var variant_id = $(this).val();

      var variant = _.find(window.variants, function(variant){
        return variant.id == variant_id
      })
      $('#stock_details').html(variantStockTemplate({variant: variant}));
      $('#stock_details').show();

      $('button.add_variant').click(addVariantFromStockLocation);

    });

    //handle edit click
    $('a.edit-item').click(toggleItemEdit);

    //handle cancel click
    $('a.cancel-item').click(toggleItemEdit);

    //handle save click
    $('a.save-item').click(function(){
      var save = $(this);
      var shipment_number = save.data('shipment-number');
      var variant_id = save.data('variant-id');

      var quantity = $('input.line_item_quantity').val();
<commit_msg>Select correct input when multiple are present<commit_after><%#encoding: UTF-8%>
// variant autocompletion

$(document).ready(function() {
  if ($('#variant_autocomplete_template').length > 0) {
    window.variantTemplate = Handlebars.compile($('#variant_autocomplete_template').text());
    window.variantStockTemplate = Handlebars.compile($('#variant_autocomplete_stock_template').text());

    // handle variant selection, show stock level.
    $('#add_variant_id').change(function(){
      var variant_id = $(this).val();

      var variant = _.find(window.variants, function(variant){
        return variant.id == variant_id
      })
      $('#stock_details').html(variantStockTemplate({variant: variant}));
      $('#stock_details').show();

      $('button.add_variant').click(addVariantFromStockLocation);

    });

    //handle edit click
    $('a.edit-item').click(toggleItemEdit);

    //handle cancel click
    $('a.cancel-item').click(toggleItemEdit);

    //handle save click
    $('a.save-item').click(function(){
      var save = $(this);
      var shipment_number = save.data('shipment-number');
      var variant_id = save.data('variant-id');

      var quantity = parseInt(save.parents('tr').find('input.line_item_quantity').val());

{'fraction_non_alphanumeric': 0.17261172611726117, 'fraction_numerical': 0.0016400164001640015, 'mean_word_length': 3.9897750511247443, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 7, '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': '5011634', 'n_tokens_mistral': 715, 'n_tokens_neox': 684, 'n_words': 120}