Skip to content

armgit / sure

Public Imported from GitHub
0

The personal finance app for everyone (by everyone)

Ruby
2.0 KB
Raw Blame
<% 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 "wallet", class: "text-primary" %>
      <span class="text-primary"><%= t(".subtitle") %></span>
    </div>
  <% end %>

  <% dialog.with_body do %>
    <div class="space-y-6">
      <% if @wise_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>
        <%= render DS::Link.new(text: t(".done"), variant: "primary", href: accounts_path) %>
      <% else %>
        <p class="text-sm text-secondary"><%= t(".description") %></p>

        <div class="space-y-3">
          <% @wise_accounts.each do |wise_account| %>
            <div class="border border-primary rounded-lg p-4 flex items-center justify-between gap-4">
              <div>
                <p class="font-medium text-primary text-sm"><%= wise_account.name %></p>
                <p class="text-xs text-secondary mt-0.5">
                  <%= format_money(Money.new(wise_account.current_balance || 0, wise_account.currency)) %>
                  &nbsp;·&nbsp;
                  <%= wise_account.currency %>
                </p>
              </div>
              <%= render DS::Button.new(
                text: t(".create_account"),
                icon: "plus",
                variant: :outline,
                size: :sm,
                href: complete_account_setup_wise_item_path(@wise_item),
                method: :post,
                params: { wise_account_id: wise_account.id },
                frame: "_top"
              ) %>
            </div>
          <% end %>
        </div>

        <%= render DS::Link.new(text: t(".done"), variant: "secondary", href: accounts_path) %>
      <% end %>
    </div>
  <% end %>
<% end %>