{% import '_tree_table.html' as tree_table with context %}

{% set root_tree = g.filtered.root_tree %}
{% set options = ledger.options %}
{% set invert = ledger.fava_options.invert_income_liabilities_equity %}

<svelte-component type="charts"><script type="application/json">{{
  [
    chart_api.interval_totals(g.interval, (options['name_income'], options['name_expenses']), label=_('Net Profit'), invert=invert),
    chart_api.interval_totals(g.interval, options['name_income'], label=_('Income'), invert=invert),
    chart_api.interval_totals(g.interval, options['name_expenses'], label=_('Expenses')),
    chart_api.hierarchy(options['name_income']),
    chart_api.hierarchy(options['name_expenses']),
  ]|tojson
}}</script></svelte-component>

<div class="row">
  <div class="column">
    {{ tree_table.tree(root_tree.get(options['name_income']), invert=invert) }}
  </div>
  <div class="column">
    {{ tree_table.tree(root_tree.get(options['name_expenses'])) }}
  </div>
  <div class="column">
    {{ tree_table.tree(root_tree.net_profit(options, _('Net Profit')), invert=invert) }}
  </div>
</div>
