2025-03-07 20:35:54 +05:30
|
|
|
<% series = @account.balance_series(period: @period) %>
|
2024-11-27 16:01:50 -05:00
|
|
|
<% trend = series.trend %>
|
|
|
|
|
|
|
|
<%= turbo_frame_tag dom_id(@account, :chart_details) do %>
|
|
|
|
<div class="px-4">
|
|
|
|
<% if trend.direction.flat? %>
|
2025-02-13 11:31:07 -05:00
|
|
|
<%= tag.span t(".no_change"), class: "text-secondary" %>
|
2024-11-27 16:01:50 -05:00
|
|
|
<% else %>
|
|
|
|
<%= tag.span "#{trend.value.positive? ? "+" : ""}#{format_money(trend.value)}", style: "color: #{trend.color}" %>
|
|
|
|
<% unless trend.percent.infinite? %>
|
|
|
|
<%= tag.span "(#{trend.percent}%)", style: "color: #{trend.color}" %>
|
|
|
|
<% end %>
|
|
|
|
<% end %>
|
|
|
|
|
2025-03-07 20:35:54 +05:30
|
|
|
<%= tag.span @period.comparison_label, class: "text-secondary" %>
|
2024-11-27 16:01:50 -05:00
|
|
|
</div>
|
|
|
|
|
2025-02-25 17:28:40 -05:00
|
|
|
<div class="h-64 pb-4">
|
2025-02-21 11:57:59 -05:00
|
|
|
<% if series.any? %>
|
2024-11-27 16:01:50 -05:00
|
|
|
<div
|
|
|
|
id="lineChart"
|
|
|
|
class="w-full h-full"
|
|
|
|
data-controller="time-series-chart"
|
|
|
|
data-time-series-chart-data-value="<%= series.to_json %>"></div>
|
|
|
|
<% else %>
|
|
|
|
<div class="w-full h-full flex items-center justify-center">
|
2025-02-21 11:57:59 -05:00
|
|
|
<p class="text-secondary text-sm">No data available for the selected period.</p>
|
2024-11-27 16:01:50 -05:00
|
|
|
</div>
|
|
|
|
<% end %>
|
|
|
|
</div>
|
|
|
|
<% end %>
|