feat(insights): make sidebar sticky

This commit is contained in:
Herculino Trotta
2025-02-18 21:04:09 -03:00
parent 835316d0f3
commit beeb0579ce
+67 -58
View File
@@ -4,11 +4,12 @@
{% block content %} {% block content %}
<div class="container-fluid"> <div class="container-fluid">
<div class="row my-3"> <div class="row my-3 h-100">
<div class="col-lg-2 col-md-3 mb-3 mb-md-0"> <div class="col-lg-2 col-md-3 mb-3 mb-md-0">
<div class=""> <div class="position-sticky tw-top-3">
<div class="mb-2 w-100 d-lg-inline-flex d-grid gap-2 flex-wrap justify-content-lg-center" role="group" <div class="">
_="on change <div class="mb-2 w-100 d-lg-inline-flex d-grid gap-2 flex-wrap justify-content-lg-center" role="group"
_="on change
set type to event.target.value set type to event.target.value
add .tw-hidden to <#picker-form > div:not(.tw-hidden)/> add .tw-hidden to <#picker-form > div:not(.tw-hidden)/>
@@ -28,65 +29,73 @@
remove .tw-hidden from #date-range-form remove .tw-hidden from #date-range-form
end end
then trigger updated" then trigger updated"
id="picker-type"> id="picker-type">
<input type="radio" class="btn-check" name="type" value="month" id="monthradio" autocomplete="off" checked> <input type="radio" class="btn-check" name="type" value="month" id="monthradio" autocomplete="off"
<label class="btn btn-sm btn-outline-primary flex-grow-1" for="monthradio">{% translate 'Month' %}</label> checked>
<label class="btn btn-sm btn-outline-primary flex-grow-1" for="monthradio">{% translate 'Month' %}</label>
<input type="radio" class="btn-check" name="type" value="year" id="yearradio" autocomplete="off"> <input type="radio" class="btn-check" name="type" value="year" id="yearradio" autocomplete="off">
<label class="btn btn-sm btn-outline-primary flex-grow-1" for="yearradio">{% translate 'Year' %}</label> <label class="btn btn-sm btn-outline-primary flex-grow-1" for="yearradio">{% translate 'Year' %}</label>
<input type="radio" class="btn-check" name="type" value="month-range" id="monthrangeradio" autocomplete="off"> <input type="radio" class="btn-check" name="type" value="month-range" id="monthrangeradio"
<label class="btn btn-sm btn-outline-primary flex-grow-1" for="monthrangeradio">{% translate 'Month Range' %}</label> autocomplete="off">
<label class="btn btn-sm btn-outline-primary flex-grow-1"
for="monthrangeradio">{% translate 'Month Range' %}</label>
<input type="radio" class="btn-check" name="type" value="year-range" id="yearrangeradio" autocomplete="off"> <input type="radio" class="btn-check" name="type" value="year-range" id="yearrangeradio"
<label class="btn btn-sm btn-outline-primary flex-grow-1" for="yearrangeradio">{% translate 'Year Range' %}</label> autocomplete="off">
<label class="btn btn-sm btn-outline-primary flex-grow-1"
for="yearrangeradio">{% translate 'Year Range' %}</label>
<input type="radio" class="btn-check" name="type" value="date-range" id="daterangeradio" autocomplete="off"> <input type="radio" class="btn-check" name="type" value="date-range" id="daterangeradio"
<label class="btn btn-sm btn-outline-primary flex-grow-1" for="daterangeradio">{% translate 'Date Range' %}</label> autocomplete="off">
</div> <label class="btn btn-sm btn-outline-primary flex-grow-1"
<form id="picker-form" for="daterangeradio">{% translate 'Date Range' %}</label>
_="install init_datepicker </div>
<form id="picker-form"
_="install init_datepicker
on change trigger updated"> on change trigger updated">
<div id="month-form" class=""> <div id="month-form" class="">
{% crispy month_form %} {% crispy month_form %}
</div> </div>
<div id="year-form" class="tw-hidden"> <div id="year-form" class="tw-hidden">
{% crispy year_form %} {% crispy year_form %}
</div> </div>
<div id="month-range-form" class="tw-hidden"> <div id="month-range-form" class="tw-hidden">
{% crispy month_range_form %} {% crispy month_range_form %}
</div> </div>
<div id="year-range-form" class="tw-hidden"> <div id="year-range-form" class="tw-hidden">
{% crispy year_range_form %} {% crispy year_range_form %}
</div> </div>
<div id="date-range-form" class="tw-hidden"> <div id="date-range-form" class="tw-hidden">
{% crispy date_range_form %} {% crispy date_range_form %}
</div> </div>
</form> </form>
</div> </div>
<hr class="mt-0"> <hr class="mt-0">
<div class="nav flex-column nav-pills" id="v-pills-tab" role="tablist" <div class="nav flex-column nav-pills" id="v-pills-tab" role="tablist"
aria-orientation="vertical"> aria-orientation="vertical">
<button class="nav-link" id="v-pills-tab" data-bs-toggle="pill" data-bs-target="#v-pills-content" <button class="nav-link" id="v-pills-tab" data-bs-toggle="pill" data-bs-target="#v-pills-content"
type="button" role="tab" aria-controls="v-pills-content" aria-selected="false" type="button" role="tab" aria-controls="v-pills-content" aria-selected="false"
hx-get="{% url 'insights_sankey_by_account' %}" hx-include="#picker-form, #picker-type" hx-get="{% url 'insights_sankey_by_account' %}" hx-include="#picker-form, #picker-type"
hx-indicator="#tab-content" hx-indicator="#tab-content"
hx-target="#tab-content">{% trans 'Account Flow' %} hx-target="#tab-content">{% trans 'Account Flow' %}
</button> </button>
<button class="nav-link" id="v-pills-tab" data-bs-toggle="pill" data-bs-target="#v-pills-content" <button class="nav-link" id="v-pills-tab" data-bs-toggle="pill" data-bs-target="#v-pills-content"
type="button" role="tab" aria-controls="v-pills-content" aria-selected="false" type="button" role="tab" aria-controls="v-pills-content" aria-selected="false"
hx-get="{% url 'insights_sankey_by_currency' %}" hx-get="{% url 'insights_sankey_by_currency' %}"
hx-include="#picker-form, #picker-type" hx-include="#picker-form, #picker-type"
hx-indicator="#tab-content" hx-indicator="#tab-content"
hx-target="#tab-content">{% trans 'Currency Flow' %} hx-target="#tab-content">{% trans 'Currency Flow' %}
</button> </button>
<button class="nav-link" id="v-pills-tab" data-bs-toggle="pill" data-bs-target="#v-pills-content" <button class="nav-link" id="v-pills-tab" data-bs-toggle="pill" data-bs-target="#v-pills-content"
type="button" role="tab" aria-controls="v-pills-content" aria-selected="false" type="button" role="tab" aria-controls="v-pills-content" aria-selected="false"
hx-get="{% url 'category_explorer_index' %}" hx-get="{% url 'category_explorer_index' %}"
hx-include="#picker-form, #picker-type" hx-include="#picker-form, #picker-type"
hx-indicator="#tab-content" hx-indicator="#tab-content"
hx-target="#tab-content">{% trans 'Category Explorer' %} hx-target="#tab-content">{% trans 'Category Explorer' %}
</button> </button>
</div>
</div> </div>
</div> </div>
<div class="col-md-9 col-lg-10"> <div class="col-md-9 col-lg-10">