mirror of
https://github.com/maybe-finance/maybe.git
synced 2025-07-24 15:49:39 +02:00
Make balance editing easier (#976)
* Make balance editing easier * Translations * Fix money input option * Fix balance sync logic * Rework balance update flow
This commit is contained in:
parent
b002a41b35
commit
34e03c2d6a
9 changed files with 91 additions and 23 deletions
|
@ -6,7 +6,8 @@
|
|||
</header>
|
||||
|
||||
<%= form_with model: @account, data: { turbo_frame: "_top" } do |f| %>
|
||||
<%= f.text_field :name, label: "Name" %>
|
||||
<%= f.text_field :name, label: t(".name") %>
|
||||
<%= f.money_field :balance_money, label: t(".balance"), readonly_currency: true %>
|
||||
|
||||
<div class="relative">
|
||||
<%= f.collection_select :institution_id, Current.family.institutions.alphabetically, :id, :name, { include_blank: t(".ungrouped"), label: t(".institution") } %>
|
||||
|
|
|
@ -44,6 +44,7 @@
|
|||
<% end %>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<%= turbo_frame_tag "sync_message" do %>
|
||||
<%= render partial: "accounts/sync_message", locals: { is_syncing: @account.syncing? } %>
|
||||
<% end %>
|
||||
|
@ -55,12 +56,18 @@
|
|||
<div class="bg-white shadow-xs rounded-xl border border-alpha-black-25 rounded-lg">
|
||||
<div class="p-4 flex justify-between">
|
||||
<div class="space-y-2">
|
||||
<%= render partial: "shared/value_heading", locals: {
|
||||
label: "Total Value",
|
||||
period: @period,
|
||||
value: @account.balance_money,
|
||||
trend: @balance_series.trend
|
||||
} %>
|
||||
<%= tag.p t(".total_value"), class: "text-sm font-medium text-gray-500" %>
|
||||
<%= tag.p format_money(@account.balance_money, precision: 0), class: "text-gray-900 text-3xl font-medium" %>
|
||||
<div>
|
||||
<% if @balance_series.trend.direction.flat? %>
|
||||
<%= tag.span t(".no_change"), class: "text-gray-500" %>
|
||||
<% else %>
|
||||
<%= tag.span format_money(@balance_series.trend.value), style: "color: #{@balance_series.trend.color}" %>
|
||||
<%= tag.span "(#{@balance_series.trend.percent}%)", style: "color: #{@balance_series.trend.color}" %>
|
||||
<% end %>
|
||||
|
||||
<%= tag.span period_label(@period), class: "text-gray-500" %>
|
||||
</div>
|
||||
</div>
|
||||
<%= form_with url: account_path(@account), method: :get, class: "flex items-center gap-4", data: { controller: "auto-submit-form" } do %>
|
||||
<%= render partial: "shared/period_select", locals: { value: @period.name } %>
|
||||
|
@ -71,11 +78,11 @@
|
|||
</div>
|
||||
</div>
|
||||
|
||||
<% selected_tab = params[:tab] || "history" %>
|
||||
<% selected_tab = params[:tab] || "value" %>
|
||||
|
||||
<div class="flex gap-1 text-sm text-gray-900 font-medium mb-4">
|
||||
<%= link_to "History", account_path(tab: "history"), class: ["p-2 rounded-lg", "bg-gray-100": selected_tab == "history"] %>
|
||||
<%= link_to "Transactions", account_path(tab: "transactions"), class: ["p-2 rounded-lg", "bg-gray-100": selected_tab == "transactions"] %>
|
||||
<div class="flex gap-2 text-sm text-gray-900 font-medium mb-4">
|
||||
<%= link_to t(".value"), account_path(tab: "value"), class: ["px-2 py-1.5 rounded-md border border-transparent", "bg-white shadow-xs border-alpha-black-50": selected_tab == "value"] %>
|
||||
<%= link_to t(".transactions"), account_path(tab: "transactions"), class: ["px-2 py-1.5 rounded-md border border-transparent", "bg-white shadow-xs border-alpha-black-50": selected_tab == "transactions"] %>
|
||||
</div>
|
||||
|
||||
<div class="min-h-[800px]">
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue