<commit_before>%ul.nav.nav-tabs
  %li.active
    %a{:href => '#required', :data =>{:toggle => 'tab'}}
      Required Fields
  %li
    %a{:href => '#recommended', :data =>{:toggle => 'tab'}}
      Recommended Fields

= simple_form_for(@asset,
  :as => :asset,
  :url => inventory_index_path,
  :method => 'post',
  :html => {:class => 'form-vertical'},
  :wrapper => :vertical_form,
  :wrapper_mappings => {:check_boxes => :vertical_radio_and_checkboxes,
    :radio_buttons => :vertical_radio_and_checkboxes,
    :file => :vertical_file_input,
    :boolean => :vertical_boolean}) do |f|

  .tab-content.form-section
    .tab-pane.fade.in.active#required
      .col-sm-6
        
        %h2.form-section-header
          Organization

        = f.association :organization, collection: TransitOperator.where(id: @asset.organization_id)

        
        %h2.form-section-header
          Service Status

        = f.simple_fields_for :service_status_updates, @asset.service_status_updates.build do |update_event|
          = update_event.input :service_status_type_id, collection: ServiceStatusType.active, label: 'Service Status'


        %h2.form-section-header
          Funding

        .form-row-group.clearfix

          .form-group.required.radio-buttons-inline.col-xs-6.left-col.row-col
            %label.required.control-label
              %abbr{title: 'required'} *
              = " Direct Capital Responsibility"
            %span.radio
              %label
                = radio_button_tag :direct_capital_responsibility, 'yes', @asset.direct_capital_responsibility
                Yes
            %span.radio
              %label
                = radio_button_tag :direct_capital_responsibility, 'no', !@asset.direct_capital_responsibility
                No

          = f.input :pcnt_capital_responsibility, :required => @asset.direct_capital_responsibility, :wrapper => :vertical_append, wrapper_class: "col-xs-6 right-col row-col" , :label => "Percent Capital Responsibility" do
            = f.input_field :pcnt_capital_responsibility, :class => 'form-control', :required => @asset.direct_capital_responsibility, :disabled => !@asset.direct_capital_responsibility, :min => 1
            %span.input-group-addon %

        = f.association :shared_capital_responsibility_organization, collection: Organization.all, label: 'Organization with Shared Capital Responsibility', required: true



        %h2.form-section-header
          Operations

        .form-row-group.clearfix

          = f.input :max_permissible_speed, label: 'Maximum Permissible Speed', required: true, wrapper_class: "form-group col-xs-6 left-col row-col"

          = f.input :max_permissible_speed_unit, label: 'Unit', required: true, wrapper_class: "form-group col-xs-6 right-col row-col"

        .form-row-group.clearfix

          = f.input :primary_fta_mode_type_id, collection: FtaModeType.active, label: 'Primary Mode', required: true, wrapper_class: "form-group col-xs-6 left-col row-col"
          
          = f.input :primary_fta_service_type_id, collection: FtaServiceType.active, label: 'Service Type (Primary Mode)', required: true, wrapper_class: "form-group col-xs-6 right-col row-col"

      .col-sm-6

        %h2.form-section-header
          Identification & Classification

        = f.input :asset_tag, label: 'Asset/Segment ID'

        = f.input :description, label: 'Description/Segment Name'

        .form-row-group.clearfix

          .col-md-5.row-col.left-col.clearfix.add-colon-parent

            = f.input :from_line, required: true, label: 'Line', wrapper_class: 'form-group col-xs-4 row-col left-col'

            = f.input :from_segment, required: true, label: 'From', wrapper_class: 'form-group col-xs-8 row-col right-col add-colon'

          .col-md-5.row-col.middle-col.clearfix

            = f.input :to_line, required: true, label: 'Line', wrapper_class: 'form-group col-xs-4 row-col left-col'

            = f.input :to_segment, required: true, label: 'To', wrapper_class: 'form-group col-xs-8 row-col right-col'

          .col-md-2.row-col.right-col.clearfix

            = f.input :segment_unit, required: true, label: 'Unit', wrapper_class: 'form-group row-col'

        .form-row-group.clearfix.add-colon-parent

          .col-md-6.row-col.left-col.add-colon

            = f.input :from_location_name, required: true, label: 'From (Location Name)'

          .col-md-6.row-col.right-col

            = f.input :to_location_name, required: true, label: 'To (Location Name)'

        .form-group.required.radio-buttons-inline
          %label.required.control-label
            %abbr{title: 'required'} *
            = " Segment Unit"
          %span.radio
            %label
              = radio_button_tag :infrastructure_segment_unit_type, '1', @asset.infrastructure_segment_unit_type
              Marker Posts
          %span.radio
            %label
              = radio_button_tag :infrastructure_segment_unit_type, '2', @asset.infrastructure_segment_unit_type
              Lat/Long
          %span.radio
            %label
              = radio_button_tag :infrastructure_segment_unit_type, '3', @asset.infrastructure_segment_unit_type
              Chaining

        .form-row-group.clearfix

          .col-md-3.row-col.left-col

            = f.association :fta_asset_class, collection: FtaAssetClass.where(id: @asset.fta_asset_class_id), label: 'Class'

          .col-md-9.row-col.right-col
          
            = f.input :global_fta_type, :collection => FtaVehicleType.all.map{|f| [ f.to_s, f.to_global_id ]}, label: 'Type', required: true, wrapper_class: 'form-group col-xs-6 row-col left-col'
        
            = f.association :asset_subtype, label: 'Subtype', wrapper_class: 'form-group col-xs-6 row-col right-col'

        .form-row-group.clearfix

          = f.association :infrastructure_segment_type, collection: InfrastructureSegmentType.active.where(fta_asset_class: @asset.fta_asset_class), label: 'Segment Type', wrapper_class: 'form-group col-xs-6 row-col left-col' # need to add JS to hide based on subtype selected

          = f.association :infrastructure_division, collection: InfrastructureDivision.active.where(organization_id: @asset.organization_id), label: 'Main Line/Division', wrapper_class: 'form-group col-xs-6 row-col right-col'

        .form-row-group.clearfix

          = f.association :infrastructure_subdivision, collection: InfrastructureSubdivision.active.where(organization_id: @asset.organization_id), label: 'Branch/Subdivision', wrapper_class: 'form-group col-xs-6 row-col left-col'
          
          = f.input :num_tracks, label: 'Track', required: 'true', wrapper_class: 'form-group col-xs-6 row-col right-col'

    .tab-pane.fade.in.no-divide#recommended
        
      %h2.form-section-header
        Condition

      = f.simple_fields_for :condition_updates, @asset.condition_updates.build do |update_event|
        = update_event.input :assessed_rating, label: 'TERM Condition'

      %h2.form-section-header
        Characteristics

      %h3.form-section-subheader
        Components

      %ul.nav.nav-tabs
        - ComponentType.where(fta_asset_category: @asset.fta_asset_class.fta_asset_category, fta_asset_class: @asset.fta_asset_class).each do |component_type|
          %li
            %a{:href => "##{"component-" + component_type.id.to_s}", :data =>{:toggle => 'tab'}}
              = component_type


      .tab-content
        - ComponentType.where(fta_asset_category: @asset.fta_asset_class.fta_asset_category, fta_asset_class: @asset.fta_asset_class).each do |component_type|
          .tab-pane.fade{id: "component-" + component_type.id.to_s}
            .tab-content
              - component_element_types = ComponentElementType.where(component_type: component_type)
              - if component_element_types.count > 0
                - component_element_types.each do |component_element_type|
                  %fieldset
                    %legend= component_element_type
                    - nested_id = "component_element_type_#{component_element_type.id}"
                    %div{id: nested_id}
                      = f.simple_fields_for :infrastructure_components, InfrastructureComponent.where(component_type: component_type, component_element_type: component_element_type, parent_id: f.object.id) do |component|
                        = render "transit_assets/track/component_new_fields", f: component, component_type: component_element_type
                      .links
                        = link_to_add_association '+', f, :infrastructure_components, partial: "transit_assets/track/component_new_fields",render_options:  {locals: { component_type: component_element_type }}
              - else
                - nested_id = "component_type_#{component_type.id}"
                %div{id: nested_id}
                  = f.simple_fields_for :infrastructure_components, InfrastructureComponent.where(component_type: component_type, parent_id: f.object.id) do |component|
                    = render "transit_assets/track/component_new_fields", f: component, component_type: component_type
                  .links
                    = link_to_add_association 'add', f, :infrastructure_components, partial: "transit_assets/track/component_new_fields",render_options:  {locals: { component_type: component_type }}


  .form-actions.form-section
    = f.button :submit, '+ Add Asset & Go to New Record', :class => 'btn btn-primary'


  %hr

  = f.input :fta_asset_category_id, as: :hidden, input_html: {value: @asset.fta_asset_class.fta_asset_category_id}
  = f.association :fta_asset_class

  = f.input :from_line
  = f.input :from_segment
  = f.input :to_line
  = f.input :to_segment
  = f.input :segment_unit
  = f.association :infrastructure_segment_unit_type, collection: InfrastructureSegmentUnitType.active
  = f.association :infrastructure_chain_type, collection: InfrastructureChainType.active
  = f.input :from_location_name
  = f.input :to_location_name<commit_msg>Track gets all of the tweaks and updates i made to Guideway<commit_after>%ul.nav.nav-tabs
  %li.active
    %a{:href => '#required', :data =>{:toggle => 'tab'}}
      Required Fields
  %li
    %a{:href => '#recommended', :data =>{:toggle => 'tab'}}
      Recommended Fields

= simple_form_for(@asset,
  :as => :asset,
  :url => inventory_index_path,
  :method => 'post',
  :html => {:class => 'form-vertical'},
  :wrapper => :vertical_form,
  :wrapper_mappings => {:check_boxes => :vertical_radio_and_checkboxes,
    :radio_buttons => :vertical_radio_and_checkboxes,
    :file => :vertical_file_input,
    :boolean => :vertical_boolean}) do |f|

  .tab-content.form-section
    .tab-pane.fade.in.active#required
      .col-sm-6
        
        %h2.form-section-header
          Organization

        = f.association :organization, collection: TransitOperator.where(id: @asset.organization_id)

        
        %h2.form-section-header
          Service Status

        = f.simple_fields_for :service_status_updates, @asset.service_status_updates.build do |update_event|
          = update_event.input :service_status_type_id, collection: ServiceStatusType.active, label: 'Service Status'


        %h2.form-section-header
          Funding

        .form-row-group.clearfix

          .form-group.required.radio-buttons-inline.col-xs-6.left-col.row-col
            %label.required.control-label
              %abbr{title: 'required'} *
              = " Direct Capital Responsibility"
            %span.radio
              %label
                = radio_button_tag :direct_capital_responsibility, 'yes', @asset.direct_capital_responsibility
                Yes
            %span.radio
              %label
                = radio_button_tag :direct_capital_responsibility, 'no', !@asset.direct_capital_responsibility
                No

          = f.input :pcnt_capital_responsibility, :required => @asset.direct_capital_responsibility, :wrapper => :vertical_append, wrapper_class: "col-xs-6 right-col row-col" , :label => "Percent Capital Responsibility" do
            = f.input_field :pcnt_capital_responsibility, :class => 'form-control', :required => @asset.direct_capital_responsibility, :disabled => !@asset.direct_capital_responsibility, :min => 1
            %span.input-group-addon %

        = f.association :shared_capital_responsibility_organization, collection: Organization.all, label: 'Organization with Shared Capital Responsibility', required: true



        %h2.form-section-header
          Operations

        .form-row-group.clearfix

          = f.input :max_permissible_speed, label: 'Maximum Permissible Speed', required: true, wrapper_class: "form-group col-xs-6 left-col row-col"

          = f.input :max_permissible_speed_unit, label: 'Unit', required: true, wrapper_class: "form-group col-xs-6 right-col row-col"

        .form-row-group.clearfix

          = f.input :primary_fta_mode_type_id, collection: FtaModeType.active, label: 'Primary Mode', required: true, wrapper_class: "form-group col-xs-6 left-col row-col"
          
          = f.input :primary_fta_service_type_id, collection: FtaServiceType.active, label: 'Service Type (Primary Mode)', required: true, wrapper_class: "form-group col-xs-6 right-col row-col"

      .col-sm-6

        %h2.form-section-header
          Identification & Classification

        = f.input :asset_tag, label: 'Asset/Segment ID'

        = f.input :description, label: 'Description/Segment Name'

        = f.input :fta_asset_category_id, as: :hidden, input_html: {value: @asset.fta_asset_class.fta_asset_category_id}

        .form-row-group.clearfix

          .col-md-5.row-col.left-col.clearfix.add-colon

            = f.input :from_line, required: true, label: 'Line', wrapper_class: 'form-group col-xs-4 row-col left-col'

            = f.input :from_segment, required: true, label: 'From', wrapper_class: 'form-group col-xs-8 row-col right-col'

          .col-md-5.row-col.middle-col.clearfix

            = f.input :to_line, required: true, label: 'Line', wrapper_class: 'form-group col-xs-4 row-col left-col'

            = f.input :to_segment, required: true, label: 'To', wrapper_class: 'form-group col-xs-8 row-col right-col'

          .col-md-2.row-col.right-col.clearfix

            = f.input :segment_unit, required: true, label: 'Unit', wrapper_class: 'form-group row-col'

        .form-row-group.clearfix

          .col-md-6.row-col.left-col.add-colon

            = f.input :from_location_name, required: true, label: 'From (Location Name)'

          .col-md-6.row-col.right-col

            = f.input :to_location_name, required: true, label: 'To (Location Name)'

        .form-group.required.radio-buttons-inline
          %label.required.control-label
            %abbr{title: 'required'} *
            = " Segment Unit"
          %span.radio
            %label
              = radio_button_tag :infrastructure_segment_unit_type, '1', @asset.infrastructure_segment_unit_type
              Marker Posts
          %span.radio
            %label
              = radio_button_tag :infrastructure_segment_unit_type, '2', @asset.infrastructure_segment_unit_type
              Lat/Long
          %span.radio
            %label
              = radio_button_tag :infrastructure_segment_unit_type, '3', @asset.infrastructure_segment_unit_type
              Chaining

        .form-row-group.clearfix

          .col-md-3.row-col.left-col

            = f.association :fta_asset_class, collection: FtaAssetClass.where(id: @asset.fta_asset_class_id), label: 'Class'

          .col-md-9.row-col.right-col
          
            = f.input :global_fta_type, :collection => FtaVehicleType.all.map{|f| [ f.to_s, f.to_global_id ]}, label: 'Type', required: true, wrapper_class: 'form-group col-xs-6 row-col left-col'
        
            = f.association :asset_subtype, label: 'Subtype', wrapper_class: 'form-group col-xs-6 row-col right-col'

        .form-row-group.clearfix

          = f.association :infrastructure_segment_type, collection: InfrastructureSegmentType.active.where(fta_asset_class: @asset.fta_asset_class), label: 'Segment Type', wrapper_class: 'form-group col-xs-6 row-col left-col' # need to add JS to hide based on subtype selected

          = f.association :infrastructure_division, collection: InfrastructureDivision.active.where(organization_id: @asset.organization_id), label: 'Main Line/Division', wrapper_class: 'form-group col-xs-6 row-col right-col'

        .form-row-group.clearfix

          = f.association :infrastructure_subdivision, collection: InfrastructureSubdivision.active.where(organization_id: @asset.organization_id), label: 'Branch/Subdivision', wrapper_class: 'form-group col-xs-6 row-col left-col'
          
          = f.input :num_tracks, label: 'Track', required: 'true', wrapper_class: 'form-group col-xs-6 row-col right-col'

    .tab-pane.fade.in.no-divide#recommended
        
      %h2.form-section-header
        Condition

      = f.simple_fields_for :condition_updates, @asset.condition_updates.build do |update_event|
        = update_event.input :assessed_rating, label: 'TERM Condition'

      %h2.form-section-header
        Characteristics

      %h3.form-section-subheader
        Components

      %ul.nav.nav-tabs
        - ComponentType.where(fta_asset_category: @asset.fta_asset_class.fta_asset_category, fta_asset_class: @asset.fta_asset_class).each do |component_type|
          %li
            %a{:href => "##{"component-" + component_type.id.to_s}", :data =>{:toggle => 'tab'}}
              = component_type


      .tab-content.sub-tabs
        - ComponentType.where(fta_asset_category: @asset.fta_asset_class.fta_asset_category, fta_asset_class: @asset.fta_asset_class).each do |component_type|
          .tab-pane.fade{id: "component-" + component_type.id.to_s}
            .tab-content
              - component_element_types = ComponentElementType.where(component_type: component_type)
              - if component_element_types.count > 0
                - component_element_types.each do |component_element_type|
                  .nested-fields-elements
                    - nested_id = "component_element_type_#{component_element_type.id}"
                    %div{id: nested_id}
                      = f.simple_fields_for :infrastructure_components, InfrastructureComponent.where(component_type: component_type, component_element_type: component_element_type, parent_id: f.object.id) do |component|
                        = render "transit_assets/track/component_new_fields", f: component, component_type: component_element_type
                      .links
                        = link_to_add_association "+ Add #{component_element_type}", f, :infrastructure_components, partial: "transit_assets/track/component_new_fields",render_options:  {locals: { component_type: component_element_type }}
              - else
                - nested_id = "component_type_#{component_type.id}"
                %div{id: nested_id}
                  = f.simple_fields_for :infrastructure_components, InfrastructureComponent.where(component_type: component_type, parent_id: f.object.id) do |component|
                    = render "transit_assets/track/component_new_fields", f: component, component_type: component_type
                  .links
                    = link_to_add_association '+Add', f, :infrastructure_components, partial: "transit_assets/track/component_new_fields",render_options:  {locals: { component_type: component_type }}


  .form-actions.form-section
    = f.button :submit, '+ Add Asset & Go to New Record', :class => 'btn btn-primary'


  %hr

  = f.input :fta_asset_category_id, as: :hidden, input_html: {value: @asset.fta_asset_class.fta_asset_category_id}
  = f.association :fta_asset_class

  = f.input :from_line
  = f.input :from_segment
  = f.input :to_line
  = f.input :to_segment
  = f.input :segment_unit
  = f.association :infrastructure_segment_unit_type, collection: InfrastructureSegmentUnitType.active
  = f.association :infrastructure_chain_type, collection: InfrastructureChainType.active
  = f.input :from_location_name
  = f.input :to_location_name
{'fraction_non_alphanumeric': 0.11308698236576184, 'fraction_numerical': 0.003764612641172974, 'mean_word_length': 2.8171677065607867, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 63, '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': '1784205', 'n_tokens_mistral': 6327, 'n_tokens_neox': 6059, 'n_words': 1128}