1
0
Fork 0
mirror of https://github.com/maybe-finance/maybe.git synced 2025-08-07 22:45:20 +02:00

Add transaction modal flow (#633)

* Add transaction modal flow

* Preserve decimals when creating transactions
This commit is contained in:
Jose Farias 2024-04-16 12:44:31 -06:00 committed by GitHub
parent a22c7a0e9c
commit cd8d741fe1
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
12 changed files with 137 additions and 22 deletions

View file

@ -1,7 +1,21 @@
<%= form_with model: @transaction do |f| %>
<%= f.collection_select :account_id, Current.family.accounts, :id, :name, { prompt: "Select an Account", label: "Account" } %>
<%= f.date_field :date, label: "Date" %>
<%= f.text_field :name, label: "Name", placeholder: "Groceries" %>
<%= f.money_field :amount_money, label: "Amount" %>
<%= f.submit %>
<%= form_with model: @transaction, data: { turbo: false } do |f| %>
<section>
<fieldset class="bg-gray-50 rounded-lg p-1 grid grid-flow-col justify-stretch gap-x-2">
<%= radio_tab_tag form: f, name: :nature, value: :expense, label: t(".expense"), icon: "minus-circle", checked: true %>
<%= radio_tab_tag form: f, name: :nature, value: :income, label: t(".income"), icon: "plus-circle" %>
<%= radio_tab_tag form: f, name: :nature, value: :transfer, label: t(".transfer"), icon: "arrow-right-left", disabled: true %>
</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 %>
<%= f.money_field :amount_money, label: t(".amount"), required: true %>
<%= f.collection_select :category_id, Current.family.transaction_categories.alphabetically, :id, :name, { prompt: t(".category_prompt"), label: t(".category") }, required: true %>
<%= f.date_field :date, label: t(".date"), required: true %>
</section>
<section>
<%= f.submit t(".submit") %>
</section>
<% end %>