Skip to content

armgit / sure

Public Imported from GitHub
0

The personal finance app for everyone (by everyone)

Ruby
1.6 KB
Raw Blame
<%= render DS::Dialog.new do |dialog| %>
  <% dialog.with_header(title: t(".title")) %>
  <% dialog.with_body do %>
    <div class="flex flex-col md:flex-row gap-4">
      <%= render "properties/form_tabs", account: @account, active_tab: "value" %>

      <!-- Right content area with form -->
      <div class="flex-1">
        <%= styled_form_with model: @account, url: update_balances_property_path(@account), method: :patch do |form| %>
          <div class="flex flex-col gap-4 min-h-[320px]">
            <%= render "properties/form_alert", notice: @success_message, error: @error_message %>

            <%= form.money_field :balance,
                label: @account.draft? ? t("vehicles.form.purchase_price") : t(".market_value_label"),
                label_tooltip: (t(".market_value_tooltip") unless @account.draft?),
                value: (purchase_value.price if @account.draft? && !@submitted_balance),
                placeholder: "0" %>

            <% if @account.draft? %>
              <%= form.date_field :purchase_date,
                  label: t(".purchase_date_label"),
                  value: purchase_value.field_date,
                  min: Entry.min_supported_date + 1,
                  max: Date.current %>
            <% end %>
          </div>

          <!-- Next button -->
          <div class="flex justify-end mt-4">
            <%= render DS::Button.new(
              text: @account.active? ? t(".save") : t(".next"),
              variant: "primary",
              type: :submit,
            ) %>
          </div>
        <% end %>
      </div>
    </div>
  <% end %>
<% end %>