<% row.import.column_keys.each_with_index do |key, idx| %>
<%= turbo_frame_tag dom_id(row, key), title: row.valid? ? nil : row.errors.full_messages.join(", ") do %>
<%= form_with(
model: [row.import, row],
scope: :import_row,
url: import_row_path(row.import, row),
method: :patch,
data: {
controller: "auto-submit-form mobile-cell-interaction",
auto_submit_form_trigger_value: "blur",
mobile_cell_interaction_error_value: !cell_is_valid?(row, key) ? row.errors[key].join(", ") : "",
}
) do |form| %>
<%= form.text_field key,
"data-auto-submit-form-target": "auto",
"data-action": "focus->mobile-cell-interaction#highlightCell blur->mobile-cell-interaction#unhighlightCell touchstart->mobile-cell-interaction#handleCellTouch",
"data-mobile-cell-interaction-target": "field",
class: [
cell_class(row, key),
idx == 0 ? "group-first:rounded-tl-lg group-last:rounded-bl-lg" : "",
idx == row.import.column_keys.count - 1 ? "group-first:rounded-tr-lg group-last:rounded-br-lg" : "",
"focus:outline-none focus:z-10 relative",
],
disabled: row.import.complete? %>
<% if !cell_is_valid?(row, key) %>
<%= icon "alert-circle", size: "sm", color: "destructive" %>
<%= row.errors[key].join(", ") %>
<% end %>
<% end %>
<% end %>
<% end %>