mirror of
https://github.com/maybe-finance/maybe.git
synced 2025-08-05 13:35:21 +02:00
Account Activity View + Account Forms (#1406)
* Remove balance mode, sketch out refactor * Activity view checkpoint * Entry partials, checkpoint * Finish txn partial * Give entries context when editing for different turbo responses * Calculate change of balance for each entry * Account tabs consolidation * Translations, linting, brakeman updates * Account actions concern * Finalize forms, get account system tests passing * Get tests passing * Lint, rubocop, schema updates * Improve routing and stream responses * Fix broken routes * Add import option for adding accounts * Fix system test * Fix test specificity * Fix sparklines * Improve account redirects
This commit is contained in:
parent
12e4f1067d
commit
65db49273c
216 changed files with 2043 additions and 1620 deletions
33
app/views/vehicles/_form.html.erb
Normal file
33
app/views/vehicles/_form.html.erb
Normal file
|
@ -0,0 +1,33 @@
|
|||
<%# locals: (account:, url:) %>
|
||||
|
||||
<%= render "accounts/form", account: account, url: url do |form| %>
|
||||
<hr class="my-4">
|
||||
|
||||
<div class="space-y-2">
|
||||
<%= form.fields_for :accountable do |vehicle_form| %>
|
||||
<div class="flex items-center gap-2">
|
||||
<%= vehicle_form.text_field :make,
|
||||
label: t("vehicles.form.make"),
|
||||
placeholder: t("vehicles.form.make_placeholder") %>
|
||||
<%= vehicle_form.text_field :model,
|
||||
label: t("vehicles.form.model"),
|
||||
placeholder: t("vehicles.form.model_placeholder") %>
|
||||
</div>
|
||||
|
||||
<div class="flex items-center gap-2">
|
||||
<%= vehicle_form.number_field :year,
|
||||
label: t("vehicles.form.year"),
|
||||
placeholder: t("vehicles.form.year_placeholder"),
|
||||
min: 1900,
|
||||
max: Time.current.year + 1 %>
|
||||
<%= vehicle_form.number_field :mileage_value,
|
||||
label: t("vehicles.form.mileage"),
|
||||
placeholder: t("vehicles.form.mileage_placeholder"),
|
||||
min: 0 %>
|
||||
<%= vehicle_form.select :mileage_unit,
|
||||
[["Miles", "mi"], ["Kilometers", "km"]],
|
||||
{ label: t("vehicles.form.mileage_unit") } %>
|
||||
</div>
|
||||
<% end %>
|
||||
</div>
|
||||
<% end %>
|
37
app/views/vehicles/_overview.html.erb
Normal file
37
app/views/vehicles/_overview.html.erb
Normal file
|
@ -0,0 +1,37 @@
|
|||
<%# locals: (account:) %>
|
||||
|
||||
<div class="grid grid-cols-3 gap-2">
|
||||
<%= summary_card title: t(".make_model") do %>
|
||||
<%= [account.vehicle.make, account.vehicle.model].compact.join(" ").presence || t(".unknown") %>
|
||||
<% end %>
|
||||
|
||||
<%= summary_card title: t(".year") do %>
|
||||
<%= account.vehicle.year || t(".unknown") %>
|
||||
<% end %>
|
||||
|
||||
<%= summary_card title: t(".mileage") do %>
|
||||
<%= account.vehicle.mileage || t(".unknown") %>
|
||||
<% end %>
|
||||
|
||||
<%= summary_card title: t(".purchase_price") do %>
|
||||
<%= format_money account.vehicle.purchase_price %>
|
||||
<% end %>
|
||||
|
||||
<%= summary_card title: t(".current_price") do %>
|
||||
<%= format_money account.balance_money %>
|
||||
<% end %>
|
||||
|
||||
<%= summary_card title: t(".trend") do %>
|
||||
<div class="flex items-center gap-1" style="color: <%= account.vehicle.trend.color %>">
|
||||
<p class="text-xl font-medium">
|
||||
<%= account.vehicle.trend.value %>
|
||||
</p>
|
||||
|
||||
<p>(<%= account.vehicle.trend.percent %>%)</p>
|
||||
</div>
|
||||
<% end %>
|
||||
</div>
|
||||
|
||||
<div class="flex justify-center py-8">
|
||||
<%= link_to "Edit account details", edit_vehicle_path(account), class: "btn btn--ghost", data: { turbo_frame: :modal } %>
|
||||
</div>
|
3
app/views/vehicles/edit.html.erb
Normal file
3
app/views/vehicles/edit.html.erb
Normal file
|
@ -0,0 +1,3 @@
|
|||
<%= modal_form_wrapper title: t(".edit", account: @account.name) do %>
|
||||
<%= render "form", account: @account, url: vehicle_path(@account) %>
|
||||
<% end %>
|
3
app/views/vehicles/new.html.erb
Normal file
3
app/views/vehicles/new.html.erb
Normal file
|
@ -0,0 +1,3 @@
|
|||
<%= modal_form_wrapper title: t(".title") do %>
|
||||
<%= render "vehicles/form", account: @account, url: vehicles_path(return_to: params[:return_to]) %>
|
||||
<% end %>
|
6
app/views/vehicles/show.html.erb
Normal file
6
app/views/vehicles/show.html.erb
Normal file
|
@ -0,0 +1,6 @@
|
|||
<%= render "accounts/show/template",
|
||||
account: @account,
|
||||
tabs: render("accounts/show/tabs", account: @account, tabs: [
|
||||
{ key: "overview", contents: render("vehicles/overview", account: @account) },
|
||||
{ key: "activity", contents: render("accounts/show/activity", account: @account) }
|
||||
]) %>
|
Loading…
Add table
Add a link
Reference in a new issue