<commit_before>.row
  .col-lg-8.col-md-8.col-sm-10.col-xs-12.col-lg-offset-2.col-md-offset-2.col-sm-offset-1
    %fieldset
      %legend New Asset
      .col-sm-6.col-xs-12
        = form_tag new_inventory_path, :id => 'asset_subtype_form', :method => "get", :class => 'form-vertical', :role => 'form' do

          - if current_user.organizations.count > 1
            .form-group
              %label.control-label.string.required
                * Organization

              = select_tag(:organization_id, options_from_collection_for_select(current_user.organizations, :id, :coded_name), :class => 'form-control string required', :prompt => 'Select organization...')

          .form-group
            %label.control-label.string.required
              * Asset Type
            = select_tag(:asset_subtype, option_groups_from_collection_for_select(@asset_types, :asset_subtypes, :name, :id, :name), :class => 'form-control string required', :prompt => 'Select asset type...', :id => 'asset_subtype_filter')

          = submit_tag 'Create New Asset', :class => "btn btn-primary", :id => "submit_button"

      .col-sm-6.col-xs-12#subtype_details
        = render 'subtype_details'

:javascript

  var ajax_url = '#{details_inventory_index_path}';

  $(document).ready(function() {
    // Disable the submit button
    $('#submit_button').attr("disabled", "disabled");
    // Add an event listener on the selector
    $('#asset_subtype_filter').change(function() {
      var val = $('#asset_subtype_filter').val();
      if (val) {
        $('#submit_button').removeAttr("disabled");
          var url = ajax_url + '?asset_subtype=' + val;
          transam.ajax_render_action(url, 'get');
        } else {
          $('#submit_button').attr("disabled", "disabled");
          $('#subtype_details').html("");
        }
    });
  });<commit_msg>add org validation to new_asset form<commit_after>.row
  .col-lg-8.col-md-8.col-sm-10.col-xs-12.col-lg-offset-2.col-md-offset-2.col-sm-offset-1
    %fieldset
      %legend New Asset
      .col-sm-6.col-xs-12
        = form_tag new_inventory_path, :id => 'asset_subtype_form', :method => "get", :class => 'form-vertical', :role => 'form' do

          - if current_user.organizations.count > 1
            .form-group
              %label.control-label.string.required
                * Organization

              = select_tag(:organization_id, options_from_collection_for_select(current_user.organizations, :id, :coded_name), :class => 'form-control string required', :prompt => 'Select organization...')

          .form-group
            %label.control-label.string.required
              * Asset Type
            = select_tag(:asset_subtype, option_groups_from_collection_for_select(@asset_types, :asset_subtypes, :name, :id, :name), :class => 'form-control string required', :prompt => 'Select asset type...', :id => 'asset_subtype_filter')

          = submit_tag 'Create New Asset', :class => "btn btn-primary", :id => "submit_button"

      .col-sm-6.col-xs-12#subtype_details
        = render 'subtype_details'

:javascript

  var ajax_url = '#{details_inventory_index_path}';

  $(document).ready(function() {
    // Disable the submit button
    $('#submit_button').attr("disabled", "disabled");

    // Add an event listener on the org selector
    $('#organization_id').change(function() {
      var org = $('#organization_id').val();
      var val = $('#asset_subtype_filter').val();
      if (org && val) {
        $('#submit_button').removeAttr("disabled");
      } else {
        $('#submit_button').attr("disabled", "disabled");
      }
    });

    // Add an event listener on the subtype selector
    $('#asset_subtype_filter').change(function() {
      var org = $('#organization_id').val();
      var val = $('#asset_subtype_filter').val();
      if (val) {
        if (org) {
          $('#submit_button').removeAttr("disabled");
        }
        var url = ajax_url + '?asset_subtype=' + val;
        transam.ajax_render_action(url, 'get');
      } else {
        $('#submit_button').attr("disabled", "disabled");
        $('#subtype_details').html("");
      }
    });
  });
{'fraction_non_alphanumeric': 0.16449589966232514, 'fraction_numerical': 0.007718282682103232, 'mean_word_length': 2.773430391264786, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 27, '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': '1195234', 'n_tokens_mistral': 1297, 'n_tokens_neox': 1259, 'n_words': 239}