* Enhance cash flow dashboard with new cash flow period handling and improved Sankey diagram rendering. Update D3 and related dependencies for better performance and features. * Fix Rubocop offenses * Refactor Sankey chart controller to use Number.parseFloat for value formatting and improve code readability by restructuring conditional logic for node shapes.
24 lines
1.0 KiB
Plaintext
24 lines
1.0 KiB
Plaintext
<%# locals: (sankey_data:, period:) %>
|
|
<div id="cashflow-sankey-chart">
|
|
<div class="flex justify-between items-center gap-4 px-4 mb-4">
|
|
<h2 class="text-lg font-medium inline-flex items-center gap-1.5">
|
|
Cashflow
|
|
</h2>
|
|
|
|
<%= form_with url: root_path, method: :get, data: { controller: "auto-submit-form", turbo_frame: "cashflow_sankey_section" } do |form| %>
|
|
<%= form.select :cashflow_period,
|
|
Period.as_options,
|
|
{ selected: period.key },
|
|
data: { "auto-submit-form-target": "auto" },
|
|
class: "bg-container border border-secondary font-medium rounded-lg px-3 py-2 text-sm pr-7 cursor-pointer text-primary focus:outline-hidden focus:ring-0" %>
|
|
<% end %>
|
|
</div>
|
|
|
|
<div class="w-full h-96">
|
|
<div
|
|
data-controller="sankey-chart"
|
|
data-sankey-chart-data-value="<%= sankey_data.to_json %>"
|
|
data-sankey-chart-currency-symbol-value="<%= sankey_data[:currency_symbol] %>"
|
|
class="w-full h-full"></div>
|
|
</div>
|
|
</div> |