<commit_before>= simple_form_for(@letter) do |f|
  = f.error_notification
  = f.hidden_field :author_id
  %table
    %tr
      %td
        - if @letter.status < 5 and can? :create, @letter
          = f.collection_radio_buttons :in_out, [[1, 'Входящее'], [2, 'Исходящее']], :first, :last
        - else
          = f.hidden_field :in_out
          = LETTER_DIRECTION.key(@letter.in_out)
        = f.input :number
        - if @letter.date
          = f.input :date, as: :string, input_html: {class: 'datepicker', value: @letter.date.strftime("%d.%m.%Y")}
        - else
          = f.input :date, as: :string, input_html: { class: 'datepicker', value: Time.current.strftime("%d.%m.%Y")}

        - if can? :create, @letter
          - if !@letter.id.blank?
            = f.input :regnumber
            = f.input :regdate, as: :string, input_html: { class: 'datepicker'}
        - else
          Зарегистрирован: #{@letter.in_out == 1?'Вх.№': 'Исх.№'}
          %b #{@letter.regnumber}
          - if @letter.regdate
            от
            %b= @letter.regdate.strftime("%d.%m.%Y")
      %td
        = f.input :sender, as: :text
    %tr
      %td
        = f.input :subject, as: :text
      %td
        &nbsp;
    %tr
      %td
        = f.input :body, as: :text
      %td
        = f.input :source
    %tr
      %td
        = f.input :duedate, :as => :string, input_html: { class: 'datepicker'}
        = f.hidden_field :status
      %td
        = f.label :Статус
        = f.select :status_name, LETTER_STATUS.keys
  = f.hidden_field :result
  = f.hidden_field :completion_date
  = f.hidden_field :letter_id
  - if @letter.id
    %h3 Результат исполнения:
    = f.input :action, as: :text
  = simple_format(@letter.result, {}, {})

  %p
  = f.button :submit<commit_msg>add letter icon to edit form<commit_after>= simple_form_for(@letter) do |f|
  = f.error_notification
  = f.hidden_field :author_id
  %table
    %tr
      %td
        - if @letter.status < 5 and can? :create, @letter
          = f.collection_radio_buttons :in_out, [[1, 'Входящее'], [2, 'Исходящее']], :first, :last
        - else
          = f.hidden_field :in_out
        = f.input :number
        - if @letter.date
          = f.input :date, as: :string, input_html: {class: 'datepicker', value: @letter.date.strftime("%d.%m.%Y")}
        - else
          = f.input :date, as: :string, input_html: { class: 'datepicker', value: Time.current.strftime("%d.%m.%Y")}

        - if can? :create, @letter
          - if !@letter.id.blank?
            = f.input :regnumber
            = f.input :regdate, as: :string, input_html: { class: 'datepicker'}
        - else
          Зарегистрирован: #{@letter.in_out == 1?'Вх.№': 'Исх.№'}
          %b #{@letter.regnumber}
          - if @letter.regdate
            от
            %b= @letter.regdate.strftime("%d.%m.%Y")
      %td
        - label = 'Контрагент'
        - if @letter.status >= 5 && request.parameters[:action] != 'new'
          .image_inline_left
            - if @letter.in_out != 1 # Исходящее
              - label = 'Получатель'
              =image_tag 'out_mail.png', size: "64x64", alt: "#{LETTER_DIRECTION.key(@letter.in_out)}"
            - else
              - label = 'Отправитель'
              =image_tag 'in_mail.png', size: "64x64", alt: "#{LETTER_DIRECTION.key(@letter.in_out)}"

        = f.input :sender, as: :text, label: label
    %tr
      %td
        = f.input :subject, as: :text
      %td
        &nbsp;
    %tr
      %td
        = f.input :body, as: :text
      %td
        = f.input :source
    %tr
      %td
        = f.input :duedate, :as => :string, input_html: { class: 'datepicker'}
        = f.hidden_field :status
      %td
        = f.label :Статус
        = f.select :status_name, LETTER_STATUS.keys
  = f.hidden_field :result
  = f.hidden_field :completion_date
  = f.hidden_field :letter_id
  - if @letter.id
    %h3 Результат исполнения:
    = f.input :action, as: :text
  = simple_format(@letter.result, {}, {})

  %p
  = f.button :submit
{'fraction_non_alphanumeric': 0.156936127744511, 'fraction_numerical': 0.00499001996007984, 'mean_word_length': 1.9740356083086052, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 6, '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': '798451', 'n_tokens_mistral': 1459, 'n_tokens_neox': 1436, 'n_words': 308}