2024-07-16 14:08:24 -04:00
|
|
|
<%= styled_form_with model: @entry, url: transactions_path, class: "space-y-4", data: { turbo_frame: "_top" } do |f| %>
|
2024-04-16 12:44:31 -06:00
|
|
|
<section>
|
|
|
|
<fieldset class="bg-gray-50 rounded-lg p-1 grid grid-flow-col justify-stretch gap-x-2">
|
2024-06-19 06:52:08 -04:00
|
|
|
<%= radio_tab_tag form: f, name: :nature, value: :expense, label: t(".expense"), icon: "minus-circle", checked: params[:nature] == "expense" || params[:nature].nil? %>
|
|
|
|
<%= radio_tab_tag form: f, name: :nature, value: :income, label: t(".income"), icon: "plus-circle", checked: params[:nature] == "income" %>
|
2024-06-20 13:32:44 -04:00
|
|
|
<%= link_to new_account_transfer_path, data: { turbo_frame: :modal }, class: "flex px-4 py-1 rounded-lg items-center space-x-2 justify-center text-gray-400 group-has-[:checked]:bg-white group-has-[:checked]:text-gray-800 group-has-[:checked]:shadow-sm" do %>
|
2024-06-19 06:52:08 -04:00
|
|
|
<%= lucide_icon "arrow-right-left", class: "w-5 h-5" %>
|
|
|
|
<%= tag.span t(".transfer") %>
|
|
|
|
<% end %>
|
2024-04-16 12:44:31 -06:00
|
|
|
</fieldset>
|
|
|
|
</section>
|
|
|
|
|
|
|
|
<section class="space-y-2">
|
|
|
|
<%= f.text_field :name, label: t(".description"), placeholder: t(".description_placeholder"), required: true %>
|
|
|
|
<%= f.collection_select :account_id, Current.family.accounts.alphabetically, :id, :name, { prompt: t(".account_prompt"), label: t(".account") }, required: true %>
|
2024-09-20 08:38:19 -04:00
|
|
|
<%= f.money_field :amount, :currency, label: t(".amount"), required: true %>
|
2024-07-01 10:49:43 -04:00
|
|
|
<%= f.hidden_field :entryable_type, value: "Account::Transaction" %>
|
|
|
|
<%= f.fields_for :entryable do |ef| %>
|
|
|
|
<%= ef.collection_select :category_id, Current.family.categories.alphabetically, :id, :name, { prompt: t(".category_prompt"), label: t(".category") } %>
|
|
|
|
<% end %>
|
2024-07-26 10:47:27 -04:00
|
|
|
<%= f.date_field :date, label: t(".date"), required: true, min: Account::Entry.min_supported_date, max: Date.today %>
|
2024-04-16 12:44:31 -06:00
|
|
|
</section>
|
|
|
|
|
|
|
|
<section>
|
|
|
|
<%= f.submit t(".submit") %>
|
|
|
|
</section>
|
2024-02-23 21:34:33 -05:00
|
|
|
<% end %>
|