<%= render 'shared/turbo_modal_large', title: t('edit_values') do %>
<%= form_for '', url: submitter_edit_value_path(@submitter), method: :patch, html: { autocomplete: 'off' }, data: { turbo_frame: :_top } do |f| %> <% if @fields.empty? %>

No editable text fields found for this submitter.

<% else %> <% field_counters = Hash.new { 0 } %> <% @fields.each do |field| %> <% field_counters[field['type']] += 1 %> <% current_value = @submitter.values[field['uuid']] %>
<% if field['type'] == 'select' && field['options'].present? %> <%= select_tag "values[#{field['uuid']}]", options_for_select(field['options'], current_value), include_blank: true, class: 'select select-bordered w-full' %> <% elsif field['type'] == 'checkbox' %>
class="checkbox checkbox-primary" /> Checked
<% elsif field['type'] == 'radio' && field['options'].present? %>
<% field['options'].each do |opt| %> <% end %>
<% else %> <%= text_field_tag "values[#{field['uuid']}]", current_value.to_s, class: 'base-input w-full', dir: 'auto', placeholder: field['name'].presence || field['type'] %> <% end %>
<% end %> <% end %>
<%= f.button button_title(title: t('save_and_regenerate'), disabled_with: t('saving')), class: 'base-button', disabled: @fields.empty? %>
<% end %>
<% end %>