<div class="collapse collapse-plus bg-base-200 overflow-visible">
  <input type="checkbox">
  <div class="collapse-title text-xl font-medium capitalize">
    <div>
      <%= t('completed_notification_email') %>
    </div>
  </div>
  <div class="collapse-content">
    <%= form_for AccountConfigs.find_or_initialize_for_key(current_account, AccountConfig::SUBMITTER_COMPLETED_EMAIL_KEY), url: settings_personalization_path, method: :post, html: { autocomplete: 'off', class: 'space-y-4' } do |f| %>
      <%= f.hidden_field :key %>
      <%= f.fields_for :value, Struct.new(:subject, :body, :attach_audit_log, :attach_documents).new(*f.object.value.values_at('subject', 'body', 'attach_audit_log', 'attach_documents')) do |ff| %>
        <div class="form-control">
          <div class="flex items-center">
            <%= ff.label :subject, t('subject'), class: 'label' %>
            <span class="tooltip" data-tip="<%= t('use_following_placeholders_text_') %> <%= AccountConfig::EMAIL_VARIABLES[AccountConfig::SUBMITTER_COMPLETED_EMAIL_KEY].map { |v| "{#{v}}" }.join(', ') %>">
              <%= svg_icon('info_circle', class: 'w-4 h-4') %>
            </span>
          </div>
          <%= ff.text_field :subject, required: true, class: 'base-input', dir: 'auto' %>
        </div>
        <%= render 'personalization_settings/email_body_field', ff:, config: f.object %>
        <div class="flex items-center justify-between pt-2.5 mx-1">
          <span>
            <%= t('attach_documents') %>
          </span>
          <%= ff.check_box :attach_documents, { checked: ff.object.attach_documents != false, class: 'toggle' }, 'true', 'false' %>
        </div>
        <div class="flex items-center justify-between pb-2.5 mx-1">
          <span>
            <%= t('attach_audit_log_pdf') %>
          </span>
          <%= ff.check_box :attach_audit_log, { checked: ff.object.attach_audit_log != false, class: 'toggle' }, 'true', 'false' %>
        </div>
      <% end %>
      <div class="form-control pt-2">
        <%= f.button button_title(title: t('save'), disabled_with: t('saving')), class: 'base-button' %>
      </div>
    <% end %>
  </div>
</div>
