Files
sure/app/views/akahu_items/setup_accounts.html.erb
T
William Wei MingandCursor d2eab1c9c7 fix(ds): resolve remaining DS Drift Patrol findings (#2157) (#2977)
* fix(ds): resolve remaining DS Drift Patrol findings from #2157

Migrate leftover hand-rolled UI and i18n defaults to DS primitives and
locale entries so missing keys raise in development again.

Closes #2157

Co-authored-by: Cursor <cursoragent@cursor.com>

* fix(a11y): name PDF import account select via aria-labelledby

Wire the existing localized heading to the select so label: false
does not leave the control unlabeled for assistive tech.

Co-authored-by: Cursor <cursoragent@cursor.com>

* fix(akahu): use scoped form.select for account type fields

Replace the unusual bracketed method name on a scope-less builder with
scope: :account_types and form.select(account.id), and assert the label
for= matches the generated select id.

Co-authored-by: Cursor <cursoragent@cursor.com>

* Add German translation for shared.dot_separator

Keeps I18nTest German coverage green after merging main's completed de locale.

Co-authored-by: Cursor <cursoragent@cursor.com>

* fix(ds): resolve remaining DS Drift Patrol findings from #2157

Migrate leftover hand-rolled UI and i18n defaults to DS primitives and
locale entries so missing keys raise in development again.

Closes #2157

Co-authored-by: Cursor <cursoragent@cursor.com>

* fix(a11y): name PDF import account select via aria-labelledby

Wire the existing localized heading to the select so label: false
does not leave the control unlabeled for assistive tech.

Co-authored-by: Cursor <cursoragent@cursor.com>

* fix(akahu): use scoped form.select for account type fields

Replace the unusual bracketed method name on a scope-less builder with
scope: :account_types and form.select(account.id), and assert the label
for= matches the generated select id.

Co-authored-by: Cursor <cursoragent@cursor.com>

* Add German translation for shared.dot_separator

Keeps I18nTest German coverage green after merging main's completed de locale.

Co-authored-by: Cursor <cursoragent@cursor.com>

* fix(ds): address tag select review feedback

Use the canonical focus-ring-within wrapper and preserve full width for
embedded tag search. Add the shared separator key to every shipped locale
and document the intentional unknown PDF document-type fallback.

Co-authored-by: Cursor <cursoragent@cursor.com>

---------

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-08-16 07:09:01 +02:00

75 lines
3.0 KiB
ERB

<% content_for :title, t(".title") %>
<%= render DS::Dialog.new do |dialog| %>
<% dialog.with_header(title: t(".title")) do %>
<div class="flex items-center gap-2">
<%= icon "landmark", class: "text-primary" %>
<span class="text-primary"><%= t(".subtitle") %></span>
</div>
<% end %>
<% dialog.with_body do %>
<%= styled_form_with url: complete_account_setup_akahu_item_path(@akahu_item),
method: :post,
scope: :account_types,
local: true,
data: { turbo_frame: "_top" },
class: "space-y-6" do |form| %>
<div class="space-y-4">
<% if @api_error.present? %>
<div class="p-8 flex flex-col gap-3 items-center justify-center text-center">
<%= icon "alert-circle", size: "lg", class: "text-destructive" %>
<p class="text-primary font-medium"><%= t(".fetch_failed") %></p>
<p class="text-destructive text-sm"><%= @api_error %></p>
</div>
<% elsif @akahu_accounts.empty? %>
<div class="p-8 flex flex-col gap-3 items-center justify-center text-center">
<%= icon "check-circle", size: "lg", class: "text-success" %>
<p class="text-primary font-medium"><%= t(".no_accounts_to_setup") %></p>
<p class="text-secondary text-sm"><%= t(".all_accounts_linked") %></p>
</div>
<% else %>
<div class="bg-surface border border-primary p-4 rounded-lg">
<p class="text-sm text-primary"><strong><%= t(".choose_account_type") %></strong></p>
<p class="text-xs text-secondary mt-1"><%= t(".choose_account_type_description") %></p>
</div>
<% @akahu_accounts.each do |akahu_account| %>
<div class="border border-primary rounded-lg p-4">
<div class="mb-3">
<h3 class="font-medium text-primary"><%= akahu_account.name %></h3>
<p class="text-xs text-secondary">
<%= [akahu_account.formatted_account, akahu_account.currency, akahu_account.account_type].compact.join(" · ") %>
</p>
</div>
<%= form.select akahu_account.id,
@account_type_options,
{
label: t(".account_type_label"),
selected: @akahu_account_type_suggestions.fetch(akahu_account.id, "skip")
} %>
</div>
<% end %>
<% end %>
</div>
<div class="flex gap-3">
<%= render DS::Button.new(
text: t(".create_accounts"),
variant: "primary",
icon: "plus",
type: "submit",
class: "flex-1",
disabled: @api_error.present? || @akahu_accounts.empty?
) %>
<%= render DS::Link.new(
text: t(".cancel"),
variant: "secondary",
href: accounts_path
) %>
</div>
<% end %>
<% end %>
<% end %>