<commit_before>- item ||= f.object
%tbody.nested-fields{ data: { trade_item: "purchase" } }
  %tr
    %td.annotable
      = f.referenced_association(:variant, wrapper: :nested, source: {scope: :purchaseables}, input_html: {data: {variant_of_deal_item: {url: detail_backend_product_nature_variant_path("RECORD_ID", mode: :last_purchase_item)}}})
      - if f.object.annotation.blank?
        = link_to("#", data: {annotate: ".annotate", use_closest: "tbody"}, title: :add_annotation.tl) do
          %i
    %td= f.object.parcel_items.map(&:parcel).map { |i| i.reference_number.blank? ? i.number : i.reference_number }.to_sentence
    %td.decimal= f.input(:quantity, wrapper: :nested, input_html: {size: 7, data: {trade_component: "quantity"}})
    %td= f.input(:unit_pretax_amount, wrapper: :nested, input_html: {data: {trade_component: "unit_pretax_amount"}})
    %td.decimal= f.select(:tax_id, Tax.current.collect{|t| [t.short_label, t.id, {'data-rate' => ((100 + t.usable_amount)/100)}]}, {}, data: {value: 'rate', trade_component: "tax"})
    %td= f.input(:reduction_percentage, wrapper: :nested, input_html: {data: {trade_component: "reduction_percentage"}})
    %td.decimal= f.input(:pretax_amount, wrapper: :nested, input_html: {class: "pta", data: {trade_component: "pretax_amount"}})
    %td.decimal= f.input(:amount, wrapper: :nested, input_html: {class: "wta", data: {trade_component: "amount"}})
    %td.currency= f.object.purchase_currency
    %td.action= link_to_remove_association(content_tag(:i) + h(:destroy.ta), f, 'data-no-turbolink' => true, class: 'remove-item')

  %tr.tr-add-on
    %td{ colspan: 5 }
      - attrs = {}
      - attrs[:style] = 'display: none' if item.annotation.blank?
      .annotate{attrs}= f.input(:annotation, wrapper: :nested, input_html: { class: 'annotation' })
      - attrs[:style] = 'display: none' unless item && item.variant && item.variant.depreciable?
      .fixed-asset{attrs}
        = f.input :fixed, :show => :assets
        - attrs = {style: 'display: none;'} if item.fixed
        #assets{attrs}
          = f.referenced_association(:fixed_asset)
      - if Preference[:distribute_sales_and_purchases_on_activities] && current_user.can?(:read, :activities) && ActivityBudget.opened.any?
        = f.referenced_association(:activity_budget, new: false)
      - if Preference[:distribute_sales_and_purchases_on_teams] && current_user.can?(:read, :teams)
        = f.referenced_association(:team)<commit_msg>Changed colspan of latter row so it matched the first one.<commit_after>- item ||= f.object
%tbody.nested-fields{ data: { trade_item: "purchase" } }
  %tr
    %td.annotable
      = f.referenced_association(:variant, wrapper: :nested, source: {scope: :purchaseables}, input_html: {data: {variant_of_deal_item: {url: detail_backend_product_nature_variant_path("RECORD_ID", mode: :last_purchase_item)}}})
      - if f.object.annotation.blank?
        = link_to("#", data: {annotate: ".annotate", use_closest: "tbody"}, title: :add_annotation.tl) do
          %i
    %td= f.object.parcel_items.map(&:parcel).map { |i| i.reference_number.blank? ? i.number : i.reference_number }.to_sentence
    %td.decimal= f.input(:quantity, wrapper: :nested, input_html: {size: 7, data: {trade_component: "quantity"}})
    %td= f.input(:unit_pretax_amount, wrapper: :nested, input_html: {data: {trade_component: "unit_pretax_amount"}})
    %td.decimal= f.select(:tax_id, Tax.current.collect{|t| [t.short_label, t.id, {'data-rate' => ((100 + t.usable_amount)/100)}]}, {}, data: {value: 'rate', trade_component: "tax"})
    %td= f.input(:reduction_percentage, wrapper: :nested, input_html: {data: {trade_component: "reduction_percentage"}})
    %td.decimal= f.input(:pretax_amount, wrapper: :nested, input_html: {class: "pta", data: {trade_component: "pretax_amount"}})
    %td.decimal= f.input(:amount, wrapper: :nested, input_html: {class: "wta", data: {trade_component: "amount"}})
    %td.currency= f.object.purchase_currency
    %td.action= link_to_remove_association(content_tag(:i) + h(:destroy.ta), f, 'data-no-turbolink' => true, class: 'remove-item')

  %tr.tr-add-on
    %td{ colspan: 10 }
      - attrs = {}
      - attrs[:style] = 'display: none' if item.annotation.blank?
      .annotate{attrs}= f.input(:annotation, wrapper: :nested, input_html: { class: 'annotation' })
      - attrs[:style] = 'display: none' unless item && item.variant && item.variant.depreciable?
      .fixed-asset{attrs}
        = f.input :fixed, :show => :assets
        - attrs = {style: 'display: none;'} if item.fixed
        #assets{attrs}
          = f.referenced_association(:fixed_asset)
      - if Preference[:distribute_sales_and_purchases_on_activities] && current_user.can?(:read, :activities) && ActivityBudget.opened.any?
        = f.referenced_association(:activity_budget, new: false)
      - if Preference[:distribute_sales_and_purchases_on_teams] && current_user.can?(:read, :teams)
        = f.referenced_association(:team)
{'fraction_non_alphanumeric': 0.16954947707160098, 'fraction_numerical': 0.003419147224456959, 'mean_word_length': 4.550223214285714, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 9, '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': '929021', 'n_tokens_mistral': 1763, 'n_tokens_neox': 1707, 'n_words': 329}