mirror of
https://github.com/eitchtee/WYGIWYH.git
synced 2026-04-25 18:19:02 +02:00
feat: replace action row with a FAB
This commit is contained in:
@@ -44,14 +44,16 @@
|
||||
</div>
|
||||
{# Action buttons#}
|
||||
<div class="col-12 col-xl-8">
|
||||
<c-ui.quick-transactions-buttons
|
||||
:year="year"
|
||||
:month="month"
|
||||
></c-ui.quick-transactions-buttons>
|
||||
{# <c-ui.quick-transactions-buttons#}
|
||||
{# :year="year"#}
|
||||
{# :month="month"#}
|
||||
{# ></c-ui.quick-transactions-buttons>#}
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="show-loading" hx-get="{% url 'calendar_list' month=month year=year %}" hx-trigger="load, updated from:window, selective_update from:window"></div>
|
||||
<div class="show-loading" hx-get="{% url 'calendar_list' month=month year=year %}"
|
||||
hx-trigger="load, updated from:window, selective_update from:window"></div>
|
||||
</div>
|
||||
</div>
|
||||
<c-ui.transactions_fab></c-ui.transactions_fab>
|
||||
{% endblock %}
|
||||
|
||||
33
app/templates/cotton/components/fab.html
Normal file
33
app/templates/cotton/components/fab.html
Normal file
@@ -0,0 +1,33 @@
|
||||
<div class="tw-min-h-16">
|
||||
<div
|
||||
id="fab-wrapper"
|
||||
class="tw-fixed tw-bottom-5 tw-right-5 tw-ml-auto tw-w-max tw-flex tw-flex-col tw-items-end mt-5">
|
||||
<div
|
||||
id="menu"
|
||||
class="tw-flex tw-flex-col tw-items-end tw-space-y-6 tw-transition-all tw-duration-300 tw-ease-in-out tw-opacity-0 tw-invisible tw-hidden tw-mb-2">
|
||||
|
||||
{{ slot }}
|
||||
</div>
|
||||
|
||||
<button
|
||||
class="btn btn-primary rounded-circle p-0 tw-w-12 tw-h-12 tw-flex tw-items-center tw-justify-center tw-shadow-lg hover:tw-shadow-xl focus:tw-shadow-xl tw-transition-all tw-duration-300 tw-ease-in-out"
|
||||
_="
|
||||
on click or focusout
|
||||
if #menu matches .tw-invisible and event.type === 'click'
|
||||
add .tw-rotate-45 to #fab-icon
|
||||
remove .tw-invisible from #menu
|
||||
remove .tw-hidden from #menu
|
||||
remove .tw-opacity-0 from #menu
|
||||
else
|
||||
wait 0.2s
|
||||
remove .tw-rotate-45 from #fab-icon
|
||||
add .tw-invisible to #menu
|
||||
add .tw-hidden to #menu
|
||||
add .tw-opacity-0 to #menu
|
||||
end
|
||||
"
|
||||
>
|
||||
<i id="fab-icon" class="fa-solid fa-plus tw-text-3xl tw-transition-transform tw-duration-300 tw-ease-in-out"></i>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
11
app/templates/cotton/components/fab_menu_button.html
Normal file
11
app/templates/cotton/components/fab_menu_button.html
Normal file
@@ -0,0 +1,11 @@
|
||||
{% load i18n %}
|
||||
<div class="tw-relative fab-item">
|
||||
<button class="btn btn-sm btn-{{ color }}"
|
||||
hx-get="{{ url }}"
|
||||
hx-trigger="{{ hx_trigger }}"
|
||||
hx-target="{{ hx_target }}"
|
||||
hx-vals='{{ hx_vals }}'>
|
||||
<i class="{{ icon }} me-2"></i>
|
||||
{{ title }}
|
||||
</button>
|
||||
</div>
|
||||
53
app/templates/cotton/ui/transactions_fab.html
Normal file
53
app/templates/cotton/ui/transactions_fab.html
Normal file
@@ -0,0 +1,53 @@
|
||||
{% load i18n %}
|
||||
<c-components.fab>
|
||||
<c-components.fab_menu_button
|
||||
color="success"
|
||||
hx_target="#generic-offcanvas"
|
||||
hx_trigger="click, add_income from:window"
|
||||
hx_vals='{"year": {{ year }}, {% if month %}"month": {{ month }},{% endif %} "type": "IN"}'
|
||||
url="{% url 'transaction_add' %}"
|
||||
icon="fa-solid fa-arrow-right-to-bracket"
|
||||
title="{% translate "Income" %}"></c-components.fab_menu_button>
|
||||
|
||||
<c-components.fab_menu_button
|
||||
color="danger"
|
||||
hx_target="#generic-offcanvas"
|
||||
hx_trigger="click, add_income from:window"
|
||||
hx_vals='{"year": {{ year }}, {% if month %}"month": {{ month }},{% endif %} "type": "EX"}'
|
||||
url="{% url 'transaction_add' %}"
|
||||
icon="fa-solid fa-arrow-right-from-bracket"
|
||||
title="{% translate "Expense" %}"></c-components.fab_menu_button>
|
||||
|
||||
<c-components.fab_menu_button
|
||||
color="warning"
|
||||
hx_target="#generic-offcanvas"
|
||||
hx_trigger="click, installment from:window"
|
||||
url="{% url 'installment_plan_add' %}"
|
||||
icon="fa-solid fa-divide"
|
||||
title="{% translate "Installment" %}"></c-components.fab_menu_button>
|
||||
|
||||
<c-components.fab_menu_button
|
||||
color="warning"
|
||||
hx_target="#generic-offcanvas"
|
||||
hx_trigger="click, recurring from:window"
|
||||
url="{% url 'recurring_transaction_add' %}"
|
||||
icon="fa-solid fa-repeat"
|
||||
title="{% translate "Recurring" %}"></c-components.fab_menu_button>
|
||||
|
||||
<c-components.fab_menu_button
|
||||
color="info"
|
||||
hx_target="#generic-offcanvas"
|
||||
hx_trigger="click, transfer from:window"
|
||||
hx_vals='{"year": {{ year }} {% if month %}, "month": {{ month }}{% endif %}}'
|
||||
url="{% url 'transactions_transfer' %}"
|
||||
icon="fa-solid fa-money-bill-transfer"
|
||||
title="{% translate "Transfer" %}"></c-components.fab_menu_button>
|
||||
|
||||
<c-components.fab_menu_button
|
||||
color="info"
|
||||
hx_target="#generic-offcanvas"
|
||||
hx_trigger="click, balance from:window"
|
||||
url="{% url 'account_reconciliation' %}"
|
||||
icon="fa-solid fa-scale-balanced"
|
||||
title="{% translate "Balance" %}"></c-components.fab_menu_button>
|
||||
</c-components.fab>
|
||||
@@ -1,6 +1,5 @@
|
||||
<div id="toasts">
|
||||
<div class="toast-container position-fixed bottom-0 end-0 p-3" hx-trigger="load, updated from:window, toasts from:window" hx-get="{% url 'toasts' %}" hx-swap="beforeend">
|
||||
<div class="toast-container position-fixed bottom-0 start-50 translate-middle-x p-3" hx-trigger="load, updated from:window, toasts from:window" hx-get="{% url 'toasts' %}" hx-swap="beforeend">
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
@@ -44,12 +44,12 @@
|
||||
</div>
|
||||
</div>
|
||||
{# Action buttons#}
|
||||
<div class="col-12 col-xl-8">
|
||||
<c-ui.quick-transactions-buttons
|
||||
:year="year"
|
||||
:month="month"
|
||||
></c-ui.quick-transactions-buttons>
|
||||
</div>
|
||||
{# <div class="col-12 col-xl-8">#}
|
||||
{# <c-ui.quick-transactions-buttons#}
|
||||
{# :year="year"#}
|
||||
{# :month="month"#}
|
||||
{# ></c-ui.quick-transactions-buttons>#}
|
||||
{# </div>#}
|
||||
</div>
|
||||
{# Monthly summary#}
|
||||
<div class="row gx-xl-4 gy-3">
|
||||
@@ -174,7 +174,8 @@
|
||||
</div>
|
||||
<div id="search" class="my-3">
|
||||
<label class="w-100">
|
||||
<input type="search" class="form-control" placeholder="{% translate 'Search' %}" hx-preserve id="quick-search"
|
||||
<input type="search" class="form-control" placeholder="{% translate 'Search' %}" hx-preserve
|
||||
id="quick-search"
|
||||
_="on input or search or htmx:afterSwap from window
|
||||
if my value is empty
|
||||
trigger toggle on <.transactions-divider-collapse/>
|
||||
@@ -195,4 +196,7 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<c-ui.transactions_fab></c-ui.transactions_fab>
|
||||
|
||||
{% endblock %}
|
||||
|
||||
@@ -39,15 +39,16 @@
|
||||
</div>
|
||||
{# Action buttons#}
|
||||
<div class="col-12 col-xl-10">
|
||||
<c-ui.quick-transactions-buttons
|
||||
:year="year"
|
||||
:month="month"
|
||||
></c-ui.quick-transactions-buttons>
|
||||
{# <c-ui.quick-transactions-buttons#}
|
||||
{# :year="year"#}
|
||||
{# :month="month"#}
|
||||
{# ></c-ui.quick-transactions-buttons>#}
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-lg-2">
|
||||
<div class="nav flex-column nav-pills" id="month-pills" role="tablist" aria-orientation="vertical" hx-indicator="#data-content">
|
||||
<div class="nav flex-column nav-pills" id="month-pills" role="tablist" aria-orientation="vertical"
|
||||
hx-indicator="#data-content">
|
||||
<input type="hidden" name="month" value="">
|
||||
<button class="nav-link active"
|
||||
role="tab"
|
||||
@@ -78,7 +79,8 @@
|
||||
|
||||
<hr class="my-4 d-block d-lg-none">
|
||||
<div class="col-lg-3">
|
||||
<div class="nav flex-column nav-pills" id="currency-pills" role="tablist" aria-orientation="vertical" hx-indicator="#data-content">
|
||||
<div class="nav flex-column nav-pills" id="currency-pills" role="tablist" aria-orientation="vertical"
|
||||
hx-indicator="#data-content">
|
||||
<input type="hidden" name="account" value="">
|
||||
<button class="nav-link active"
|
||||
role="tab"
|
||||
@@ -118,4 +120,5 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<c-ui.transactions_fab></c-ui.transactions_fab>
|
||||
{% endblock %}
|
||||
|
||||
@@ -41,15 +41,16 @@
|
||||
</div>
|
||||
{# Action buttons#}
|
||||
<div class="col-12 col-xl-10">
|
||||
<c-ui.quick-transactions-buttons
|
||||
:year="year"
|
||||
:month="month"
|
||||
></c-ui.quick-transactions-buttons>
|
||||
{# <c-ui.quick-transactions-buttons#}
|
||||
{# :year="year"#}
|
||||
{# :month="month"#}
|
||||
{# ></c-ui.quick-transactions-buttons>#}
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-lg-2">
|
||||
<div class="nav flex-column nav-pills" id="month-pills" role="tablist" aria-orientation="vertical" hx-indicator="#data-content">
|
||||
<div class="nav flex-column nav-pills" id="month-pills" role="tablist" aria-orientation="vertical"
|
||||
hx-indicator="#data-content">
|
||||
<input type="hidden" name="month" value="">
|
||||
<button class="nav-link active"
|
||||
role="tab"
|
||||
@@ -80,7 +81,8 @@
|
||||
|
||||
<hr class="my-4 d-block d-lg-none">
|
||||
<div class="col-lg-3">
|
||||
<div class="nav flex-column nav-pills" id="currency-pills" role="tablist" aria-orientation="vertical" hx-indicator="#data-content">
|
||||
<div class="nav flex-column nav-pills" id="currency-pills" role="tablist" aria-orientation="vertical"
|
||||
hx-indicator="#data-content">
|
||||
<input type="hidden" name="currency" value="">
|
||||
<button class="nav-link active"
|
||||
role="tab"
|
||||
@@ -120,4 +122,5 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<c-ui.transactions_fab></c-ui.transactions_fab>
|
||||
{% endblock %}
|
||||
|
||||
Reference in New Issue
Block a user