Skip to content

armgit / sure

Public Imported from GitHub
0

The personal finance app for everyone (by everyone)

Ruby
1.8 KB
Raw Blame
<%= turbo_frame_tag "modal" do %>
  <%= render DS::Dialog.new do |dialog| %>
    <% dialog.with_header(title: t(".title", account_name: @account.name)) %>

    <% dialog.with_body do %>
      <div class="space-y-4">
        <% if @truelayer_accounts.empty? %>
          <p class="text-sm text-secondary"><%= t(".no_accounts") %></p>
        <% else %>
          <p class="text-sm text-secondary"><%= t(".description") %></p>

          <%= form_with url: link_existing_account_truelayer_items_path, method: :post, class: "space-y-4", data: { turbo_frame: "_top" } do %>
            <%= hidden_field_tag :account_id, @account.id %>

            <div class="space-y-2">
              <% @truelayer_accounts.each do |truelayer_account| %>
                <label class="flex items-start gap-3 p-3 border border-primary rounded-lg hover:bg-container-inset-hover cursor-pointer transition-colors">
                  <%= radio_button_tag "truelayer_account_id", truelayer_account.id, false, class: "mt-1", required: true %>
                  <div class="flex-1">
                    <div class="font-medium text-sm text-primary"><%= truelayer_account.name %></div>
                    <div class="text-xs text-secondary mt-1">
                      <%= truelayer_account.truelayer_item.institution_display_name %> • <%= truelayer_account.currency %>
                    </div>
                  </div>
                </label>
              <% end %>
            </div>

            <div class="flex gap-2 justify-end pt-4">
              <%= render DS::Link.new(text: t(".cancel"), variant: :secondary, href: accounts_path, frame: "_top") %>
              <%= render DS::Button.new(text: t(".link_account"), variant: :primary, type: :submit) %>
            </div>
          <% end %>
        <% end %>
      </div>
    <% end %>
  <% end %>
<% end %>