1
0
Fork 0
mirror of https://github.com/maybe-finance/maybe.git synced 2025-08-05 05:25:24 +02:00
Maybe/app/views/accounts/_form.html.erb

21 lines
1.1 KiB
Text
Raw Normal View History

<%# locals: (account:, url:) %>
<%= styled_form_with model: account, url: url, scope: :account, class: "flex flex-col gap-4 justify-between grow", data: { turbo: false } do |f| %>
<div class="grow space-y-2">
<%= f.hidden_field :accountable_type %>
<%= f.text_field :name, placeholder: t(".name_placeholder"), required: "required", label: t(".name_label"), autofocus: true %>
<%= f.money_field :balance, label: t(".balance"), required: true, default_currency: Current.family.currency %>
<% if account.new_record? %>
<div class="flex items-center gap-2 mt-3 mb-6">
<div class="w-1/2"><%= f.date_field :start_date, label: t(".start_date"), max: Date.yesterday, min: Account::Entry.min_supported_date %></div>
<div class="w-1/2"><%= f.number_field :start_balance, label: t(".start_balance"), placeholder: 90 %></div>
</div>
<% end %>
<%= render "accounts/accountables/#{permitted_accountable_partial(account.accountable_type)}", f: f %>
</div>
<%= f.submit "#{account.new_record? ? "Add" : "Update"} #{account.accountable.model_name.human.downcase}" %>
<% end %>