1
0
Fork 0
mirror of https://github.com/maybe-finance/maybe.git synced 2025-07-19 13:19:39 +02:00

Fix transaction form account pre-filling and form styles

This commit is contained in:
Zach Gollwitzer 2025-05-02 08:45:17 -04:00
parent a1d64d6c2e
commit 752835f492
3 changed files with 9 additions and 9 deletions

View file

@ -330,7 +330,7 @@
} }
.form-field__input { .form-field__input {
@apply border-none bg-transparent text-sm opacity-100 w-full p-0; @apply text-primary border-none bg-transparent text-sm opacity-100 w-full p-0;
@apply focus:opacity-100 focus:outline-hidden focus:ring-0; @apply focus:opacity-100 focus:outline-hidden focus:ring-0;
@apply placeholder-shown:opacity-50; @apply placeholder-shown:opacity-50;
@apply disabled:text-subdued; @apply disabled:text-subdued;

View file

@ -1,23 +1,23 @@
<fieldset class="bg-gray-50 rounded-lg p-1 grid grid-flow-col justify-stretch gap-x-2"> <%# locals: (active_tab:, account_id: nil) %>
<% active_tab = local_assigns[:active_tab] || "expense" %>
<%= link_to new_transaction_path(nature: "outflow"), <fieldset class="bg-surface-inset rounded-lg p-1 grid grid-flow-col justify-stretch gap-x-2">
<%= link_to new_transaction_path(nature: "outflow", account_id: account_id),
data: { turbo_frame: :modal }, data: { turbo_frame: :modal },
class: "flex px-4 py-1 rounded-lg items-center space-x-2 justify-center text-sm md:text-normal text-subdued #{active_tab == 'expense' ? 'bg-container text-gray-800 shadow-sm' : 'hover:bg-container hover:text-gray-800 hover:shadow-sm'}" do %> class: "flex px-4 py-1 rounded-lg items-center space-x-2 justify-center text-sm #{active_tab == 'expense' ? 'bg-container text-primary shadow-sm' : 'hover:bg-container text-subdued hover:text-primary hover:shadow-sm'}" do %>
<%= icon "minus-circle" %> <%= icon "minus-circle" %>
<%= tag.span t("shared.transaction_tabs.expense") %> <%= tag.span t("shared.transaction_tabs.expense") %>
<% end %> <% end %>
<%= link_to new_transaction_path(nature: "inflow"), <%= link_to new_transaction_path(nature: "inflow", account_id: account_id),
data: { turbo_frame: :modal }, data: { turbo_frame: :modal },
class: "flex px-4 py-1 rounded-lg items-center space-x-2 justify-center text-sm md:text-normal text-subdued #{active_tab == 'income' ? 'bg-container text-gray-800 shadow-sm' : 'hover:bg-container hover:text-gray-800 hover:shadow-sm'}" do %> class: "flex px-4 py-1 rounded-lg items-center space-x-2 justify-center text-sm #{active_tab == 'income' ? 'bg-container text-primary shadow-sm' : 'hover:bg-container text-subdued hover:text-primary hover:shadow-sm'}" do %>
<%= icon "plus-circle" %> <%= icon "plus-circle" %>
<%= tag.span t("shared.transaction_tabs.income") %> <%= tag.span t("shared.transaction_tabs.income") %>
<% end %> <% end %>
<%= link_to new_transfer_path, <%= link_to new_transfer_path,
data: { turbo_frame: :modal }, data: { turbo_frame: :modal },
class: "flex px-4 py-1 rounded-lg items-center space-x-2 justify-center text-sm md:text-normal text-subdued #{active_tab == 'transfer' ? 'bg-container text-gray-800 shadow-sm' : 'hover:bg-container hover:text-gray-800 hover:shadow-sm'}" do %> class: "flex px-4 py-1 rounded-lg items-center space-x-2 justify-center text-sm #{active_tab == 'transfer' ? 'bg-container text-primary shadow-sm' : 'hover:bg-container text-subdued hover:text-primary hover:shadow-sm'}" do %>
<%= icon "arrow-right-left" %> <%= icon "arrow-right-left" %>
<%= tag.span t("shared.transaction_tabs.transfer") %> <%= tag.span t("shared.transaction_tabs.transfer") %>
<% end %> <% end %>

View file

@ -6,7 +6,7 @@
<% end %> <% end %>
<section> <section>
<%= render "shared/transaction_type_tabs", active_tab: params[:nature] == "inflow" ? "income" : "expense" %> <%= render "shared/transaction_type_tabs", active_tab: params[:nature] == "inflow" ? "income" : "expense", account_id: params[:account_id] %>
<%= f.hidden_field :nature, value: params[:nature] || "outflow", data: { "transaction-form-target": "natureField" } %> <%= f.hidden_field :nature, value: params[:nature] || "outflow", data: { "transaction-form-target": "natureField" } %>
<%= f.hidden_field :entryable_type, value: "Transaction" %> <%= f.hidden_field :entryable_type, value: "Transaction" %>