2025-04-14 11:40:34 -04:00
|
|
|
<%= styled_form_with model: @entry, url: transactions_path, class: "space-y-4" do |f| %>
|
2024-11-27 16:01:50 -05:00
|
|
|
|
|
|
|
<% if entry.errors.any? %>
|
|
|
|
<%= render "shared/form_errors", model: entry %>
|
|
|
|
<% end %>
|
|
|
|
|
2024-04-16 12:44:31 -06:00
|
|
|
<section>
|
2025-04-18 18:53:10 +05:30
|
|
|
<fieldset class="bg-gray-50 rounded-lg p-1 grid grid-flow-col justify-stretch gap-x-1 md:gap-x-2">
|
|
|
|
<%= radio_tab_tag form: f, name: :nature, value: :outflow, label: t(".expense"), icon: "minus-circle", checked: params[:nature] == "outflow" || params[:nature].nil?, class: "text-xs md:text-sm" %>
|
|
|
|
<%= radio_tab_tag form: f, name: :nature, value: :inflow, label: t(".income"), icon: "plus-circle", checked: params[:nature] == "inflow", class: "text-xs md:text-sm" %>
|
|
|
|
<%= link_to new_transfer_path, data: { turbo_frame: :modal }, class: "flex px-4 py-1 rounded-lg items-center space-x-2 justify-center text-subdued text-sm md:text-normal group-has-checked:bg-container group-has-checked:text-gray-800 group-has-checked:shadow-sm group-has-checked:text-sm" do %>
|
|
|
|
<%= lucide_icon "arrow-right-left", class: "w-4 h-4 md:w-5 md:h-5" %>
|
2024-06-19 06:52:08 -04:00
|
|
|
<%= tag.span t(".transfer") %>
|
|
|
|
<% end %>
|
2024-04-16 12:44:31 -06:00
|
|
|
</fieldset>
|
|
|
|
</section>
|
|
|
|
|
2024-11-07 15:42:51 +01:00
|
|
|
<section class="space-y-2 overflow-hidden">
|
2024-04-16 12:44:31 -06:00
|
|
|
<%= f.text_field :name, label: t(".description"), placeholder: t(".description_placeholder"), required: true %>
|
2024-11-27 16:01:50 -05:00
|
|
|
|
2025-04-14 11:40:34 -04:00
|
|
|
<%= f.hidden_field :entryable_type, value: "Transaction" %>
|
|
|
|
|
2024-11-27 16:01:50 -05:00
|
|
|
<% if @entry.account_id %>
|
|
|
|
<%= f.hidden_field :account_id %>
|
|
|
|
<% else %>
|
|
|
|
<%= f.collection_select :account_id, Current.family.accounts.manual.alphabetically, :id, :name, { prompt: t(".account_prompt"), label: t(".account") }, required: true, class: "form-field__input text-ellipsis" %>
|
|
|
|
<% end %>
|
|
|
|
|
2024-10-09 14:59:18 -04:00
|
|
|
<%= f.money_field :amount, label: t(".amount"), required: true %>
|
2024-07-01 10:49:43 -04:00
|
|
|
<%= 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 %>
|
2025-04-14 11:40:34 -04:00
|
|
|
<%= f.date_field :date, label: t(".date"), required: true, min: Entry.min_supported_date, max: Date.current, value: Date.current %>
|
2024-04-16 12:44:31 -06:00
|
|
|
</section>
|
|
|
|
|
2025-04-11 18:14:21 +02:00
|
|
|
<%= disclosure t(".details"), default_open: false do %>
|
|
|
|
<%= f.fields_for :entryable do |ef| %>
|
|
|
|
<%= ef.select :tag_ids,
|
|
|
|
Current.family.tags.alphabetically.pluck(:name, :id),
|
|
|
|
{
|
|
|
|
include_blank: t(".none"),
|
|
|
|
multiple: true,
|
|
|
|
label: t(".tags_label"),
|
|
|
|
container_class: "h-40"
|
|
|
|
}%>
|
|
|
|
<% end %>
|
|
|
|
<%= f.text_area :notes,
|
|
|
|
label: t(".note_label"),
|
|
|
|
placeholder: t(".note_placeholder"),
|
|
|
|
rows: 5,
|
|
|
|
"data-auto-submit-form-target": "auto" %>
|
|
|
|
<% end %>
|
|
|
|
|
2024-04-16 12:44:31 -06:00
|
|
|
<section>
|
|
|
|
<%= f.submit t(".submit") %>
|
|
|
|
</section>
|
2024-02-23 21:34:33 -05:00
|
|
|
<% end %>
|