2024-07-25 12:51:50 -04:00
|
|
|
<%= turbo_stream_from @account %>
|
|
|
|
|
2024-07-25 16:46:04 -04:00
|
|
|
<%= tag.div id: dom_id(@account), class: "space-y-4" do %>
|
2024-08-23 08:47:08 -04:00
|
|
|
<header class="flex justify-between items-center">
|
2024-02-14 13:02:11 -05:00
|
|
|
<div class="flex items-center gap-3">
|
2024-04-25 15:32:45 +01:00
|
|
|
<%= image_tag account_logo_url(@account), class: "w-8 h-8" %>
|
2024-08-23 08:47:08 -04:00
|
|
|
<div>
|
|
|
|
<h2 class="font-medium text-xl"><%= @account.name %></h2>
|
|
|
|
|
2024-10-09 17:20:38 -04:00
|
|
|
<% if @account.property? && @account.property.address&.line1.present? %>
|
2024-08-23 08:47:08 -04:00
|
|
|
<p class="text-gray-500"><%= @account.property.address %></p>
|
|
|
|
<% end %>
|
|
|
|
</div>
|
2024-02-14 13:02:11 -05:00
|
|
|
</div>
|
|
|
|
<div class="flex items-center gap-3">
|
2024-03-21 13:39:10 -04:00
|
|
|
<%= button_to sync_account_path(@account), method: :post, class: "flex items-center gap-2", title: "Sync Account" do %>
|
2024-10-07 20:23:33 -04:00
|
|
|
<%= lucide_icon "refresh-cw", class: "w-4 h-4 text-gray-500 hover:text-gray-400" %>
|
2024-03-21 13:39:10 -04:00
|
|
|
<% end %>
|
2024-06-11 18:47:38 -04:00
|
|
|
|
|
|
|
<%= contextual_menu do %>
|
|
|
|
<div class="w-48 p-1 text-sm leading-6 text-gray-900 bg-white shadow-lg shrink rounded-xl ring-1 ring-gray-900/5">
|
2024-06-13 14:37:27 -04:00
|
|
|
<%= link_to edit_account_path(@account),
|
|
|
|
data: { turbo_frame: :modal },
|
|
|
|
class: "block w-full py-2 px-3 space-x-2 text-gray-900 hover:bg-gray-50 flex items-center rounded-lg" do %>
|
|
|
|
<%= lucide_icon "pencil-line", class: "w-5 h-5 text-gray-500" %>
|
|
|
|
|
|
|
|
<span><%= t(".edit") %></span>
|
|
|
|
<% end %>
|
|
|
|
|
2024-10-09 15:22:08 -04:00
|
|
|
<%= link_to new_import_path,
|
2024-06-11 18:47:38 -04:00
|
|
|
class: "block w-full py-2 px-3 space-x-2 text-gray-900 hover:bg-gray-50 flex items-center rounded-lg" do %>
|
|
|
|
<%= lucide_icon "download", class: "w-5 h-5 text-gray-500" %>
|
|
|
|
|
|
|
|
<span><%= t(".import") %></span>
|
|
|
|
<% end %>
|
|
|
|
|
|
|
|
<%= button_to account_path(@account),
|
|
|
|
method: :delete,
|
|
|
|
class: "block w-full py-2 px-3 space-x-2 text-red-600 hover:bg-red-50 flex items-center rounded-lg",
|
|
|
|
data: {
|
|
|
|
turbo_confirm: {
|
|
|
|
title: t(".confirm_title"),
|
|
|
|
body: t(".confirm_body_html"),
|
|
|
|
accept: t(".confirm_accept", name: @account.name)
|
|
|
|
}
|
|
|
|
} do %>
|
|
|
|
<%= lucide_icon("trash-2", class: "w-5 h-5 mr-2") %> Delete account
|
|
|
|
<% end %>
|
2024-03-31 23:36:54 +02:00
|
|
|
</div>
|
2024-06-11 18:47:38 -04:00
|
|
|
<% end %>
|
2024-02-14 13:02:11 -05:00
|
|
|
</div>
|
2024-08-23 08:47:08 -04:00
|
|
|
</header>
|
2024-07-12 13:47:39 -04:00
|
|
|
|
2024-08-16 12:13:48 -04:00
|
|
|
<% if @account.highest_priority_issue %>
|
|
|
|
<%= render partial: "issues/issue", locals: { issue: @account.highest_priority_issue } %>
|
2024-05-27 18:10:28 +02:00
|
|
|
<% end %>
|
2024-07-10 11:22:59 -04:00
|
|
|
|
2024-02-14 13:02:11 -05:00
|
|
|
<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">
|
2024-08-08 12:53:27 +02:00
|
|
|
<div class="flex items-center gap-1">
|
|
|
|
<div>
|
2024-10-08 17:16:37 -04:00
|
|
|
<% if @account.asset? %>
|
|
|
|
<%= tag.p t(".total_value"), class: "text-sm font-medium text-gray-500" %>
|
|
|
|
<% else %>
|
|
|
|
<%= tag.p t(".total_owed"), class: "text-sm font-medium text-gray-500" %>
|
|
|
|
<% end %>
|
2024-08-08 12:53:27 +02:00
|
|
|
</div>
|
|
|
|
<%= render "tooltip", account: @account if @account.investment? %>
|
|
|
|
</div>
|
2024-08-02 17:09:25 -04:00
|
|
|
<%= tag.p format_money(@account.value, precision: 0), class: "text-gray-900 text-3xl font-medium" %>
|
2024-07-12 13:47:39 -04:00
|
|
|
<div>
|
2024-08-02 17:09:25 -04:00
|
|
|
<% if @series.trend.direction.flat? %>
|
2024-07-12 13:47:39 -04:00
|
|
|
<%= tag.span t(".no_change"), class: "text-gray-500" %>
|
|
|
|
<% else %>
|
2024-08-02 17:09:25 -04:00
|
|
|
<%= tag.span format_money(@series.trend.value), style: "color: #{@trend.color}" %>
|
|
|
|
<%= tag.span "(#{@trend.percent}%)", style: "color: #{@trend.color}" %>
|
2024-07-12 13:47:39 -04:00
|
|
|
<% end %>
|
|
|
|
|
|
|
|
<%= tag.span period_label(@period), class: "text-gray-500" %>
|
|
|
|
</div>
|
2024-02-14 13:02:11 -05:00
|
|
|
</div>
|
2024-07-16 14:08:24 -04:00
|
|
|
<%= form_with url: account_path(@account), method: :get, data: { controller: "auto-submit-form" } do |form| %>
|
|
|
|
<%= period_select form: form, selected: @period.name %>
|
2024-04-03 17:32:27 -04:00
|
|
|
<% end %>
|
2024-02-14 13:02:11 -05:00
|
|
|
</div>
|
|
|
|
<div class="h-96 flex items-center justify-center text-2xl font-bold">
|
2024-08-02 17:09:25 -04:00
|
|
|
<%= render partial: "shared/line_chart", locals: { series: @series } %>
|
2024-02-14 13:02:11 -05:00
|
|
|
</div>
|
|
|
|
</div>
|
2024-06-21 16:23:28 -04:00
|
|
|
|
2024-08-23 08:47:08 -04:00
|
|
|
<% selected_tab = selected_account_tab(@account) %>
|
|
|
|
<% selected_tab_key = selected_tab[:key] %>
|
|
|
|
<% selected_tab_partial_path = selected_tab[:partial_path] %>
|
|
|
|
<% selected_tab_route = selected_tab[:route] %>
|
2024-06-24 11:58:39 -04:00
|
|
|
|
2024-07-12 13:47:39 -04:00
|
|
|
<div class="flex gap-2 text-sm text-gray-900 font-medium mb-4">
|
2024-07-25 16:46:04 -04:00
|
|
|
<% account_tabs(@account).each do |tab| %>
|
|
|
|
<%= link_to tab[:label], tab[:path], class: ["px-2 py-1.5 rounded-md border border-transparent", "bg-white shadow-xs border-alpha-black-50": selected_tab_key == tab[:key]] %>
|
|
|
|
<% end %>
|
2024-06-24 11:58:39 -04:00
|
|
|
</div>
|
|
|
|
|
|
|
|
<div class="min-h-[800px]">
|
2024-08-23 08:47:08 -04:00
|
|
|
<% if selected_tab_route.present? %>
|
|
|
|
<%= turbo_frame_tag dom_id(@account, selected_tab_key), src: selected_tab_route do %>
|
|
|
|
<%= render "account/entries/loading" %>
|
|
|
|
<% end %>
|
|
|
|
<% else %>
|
|
|
|
<%= render selected_tab_partial_path, account: @account %>
|
2024-06-24 11:58:39 -04:00
|
|
|
<% end %>
|
2024-02-14 13:02:11 -05:00
|
|
|
</div>
|
2024-07-25 16:46:04 -04:00
|
|
|
<% end %>
|