1
0
Fork 0
mirror of https://github.com/maybe-finance/maybe.git synced 2025-08-05 13:35:21 +02:00

Add Property Details View (#1116)

* Add backend for property account details

* Rubocop updates

* Add property form with details

* Revert "Rubocop updates"

This reverts commit 05b0b8f3a4.

* Bump brakeman to latest version

* Add overview section to property view

* Lint fixes
This commit is contained in:
Zach Gollwitzer 2024-08-23 08:47:08 -04:00 committed by GitHub
parent 4433488562
commit e856691c86
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
30 changed files with 547 additions and 81 deletions

View file

@ -0,0 +1,34 @@
<%# locals: (f:) %>
<div>
<hr class="my-4">
<div class="space-y-2">
<%= f.fields_for :accountable do |af| %>
<div class="flex gap-2">
<%= af.number_field :year_built, label: t(".year_built"), placeholder: 2005 %>
<%= af.number_field :area_value, label: t(".area_value"), placeholder: 2000 %>
<%= af.select :area_unit,
[["Square feet", "sqft"], ["Square meters", "sqm"]],
{ label: t(".area_unit") } %>
</div>
<%= af.fields_for :address do |address_form| %>
<div class="flex gap-2">
<%= address_form.text_field :line1, label: t(".line1"), placeholder: "123 Main St", required: true %>
<%= address_form.text_field :line2, label: t(".line2"), placeholder: "Apt 1" %>
</div>
<div class="flex gap-2">
<%= address_form.text_field :locality, label: t(".city"), placeholder: "Sacramento", required: true %>
<%= address_form.text_field :region, label: t(".state"), placeholder: "CA", required: true %>
</div>
<div class="flex gap-2">
<%= address_form.text_field :postal_code, label: t(".postal_code"), placeholder: "95814" %>
<%= address_form.text_field :country, label: t(".country"), placeholder: "USA", required: true %>
</div>
<% end %>
<% end %>
</div>
</div>

View file

@ -0,0 +1,40 @@
<%# locals: (account:) %>
<div class="grid grid-cols-3 gap-2">
<div class="rounded-xl bg-white shadow-xs border border-alpha-black-25 p-4">
<h4 class="text-gray-500 text-sm"><%= t(".market_value") %></h4>
<p class="text-xl font-medium text-gray-900"><%= format_money(account.balance_money) %></p>
</div>
<div class="rounded-xl bg-white shadow-xs border border-alpha-black-25 p-4">
<h4 class="text-gray-500 text-sm"><%= t(".purchase_price") %></h4>
<p class="text-xl font-medium text-gray-900">
<%= account.property.purchase_price ? format_money(account.property.purchase_price) : t(".unknown") %>
</p>
</div>
<div class="rounded-xl bg-white shadow-xs border border-alpha-black-25 p-4">
<h4 class="text-gray-500 text-sm flex items-center gap-1"><%= t(".trend") %></h4>
<div class="flex items-center gap-1" style="color: <%= account.property.trend.color %>">
<p class="text-xl font-medium">
<%= account.property.trend.value %>
</p>
<p>(<%= account.property.trend.percent %>%)</p>
</div>
</div>
<div class="rounded-xl bg-white shadow-xs border border-alpha-black-25 p-4">
<h4 class="text-gray-500 text-sm"><%= t(".year_built") %></h4>
<p class="text-xl font-medium text-gray-900">
<%= account.property.year_built || t(".unknown") %>
</p>
</div>
<div class="rounded-xl bg-white shadow-xs border border-alpha-black-25 p-4">
<h4 class="text-gray-500 text-sm"><%= t(".living_area") %></h4>
<p class="text-xl font-medium text-gray-900">
<%= account.property.area || t(".unknown") %>
</p>
</div>
</div>