mirror of
https://github.com/maybe-finance/maybe.git
synced 2025-08-07 14:35:23 +02:00
22 lines
1.3 KiB
Text
22 lines
1.3 KiB
Text
|
<%# 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.collection_select :institution_id, Current.family.institutions.alphabetically, :id, :name, { include_blank: t(".ungrouped"), label: t(".institution") } %>
|
||
|
<%= money_with_currency_field f, :balance_money, label: t(".balance"), required: "required", 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 %>
|