mirror of
https://github.com/eitchtee/WYGIWYH.git
synced 2026-04-27 19:17:12 +02:00
Compare commits
10 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
7816d6c55d | ||
|
|
6e3fdae4fe | ||
|
|
e2da996217 | ||
|
|
cc2e2293ed | ||
|
|
7060f07ccd | ||
|
|
0adb991879 | ||
|
|
20e03df661 | ||
|
|
71f59bfd68 | ||
|
|
6c76535f91 | ||
|
|
5c8fbc9278 |
@@ -56,65 +56,43 @@
|
|||||||
<i class="fa-solid fa-trash text-danger"></i>
|
<i class="fa-solid fa-trash text-danger"></i>
|
||||||
</button>
|
</button>
|
||||||
<div class="vr mx-3 tw-align-middle"></div>
|
<div class="vr mx-3 tw-align-middle"></div>
|
||||||
{# <span _="on selected_transactions_updated from #actions-bar#}
|
|
||||||
{# set realTotal to 0.0#}
|
|
||||||
{# set flatTotal to 0.0#}
|
|
||||||
{# for transaction in <.transaction:has(input[name='transactions']:checked)/>#}
|
|
||||||
{# set amt to first <.main-amount .amount/> in transaction#}
|
|
||||||
{# set amountValue to parseFloat(amt.getAttribute('data-amount'))#}
|
|
||||||
{# if not isNaN(amountValue)#}
|
|
||||||
{# set flatTotal to flatTotal + (amountValue * 100)#}
|
|
||||||
{##}
|
|
||||||
{# if transaction match .income#}
|
|
||||||
{# set realTotal to realTotal + (amountValue * 100)#}
|
|
||||||
{# else#}
|
|
||||||
{# set realTotal to realTotal - (amountValue * 100)#}
|
|
||||||
{# end#}
|
|
||||||
{# end#}
|
|
||||||
{# end#}
|
|
||||||
{# set realTotal to realTotal / 100#}
|
|
||||||
{# put realTotal.toLocaleString(undefined, {minimumFractionDigits: 0, maximumFractionDigits: 40}) into me#}
|
|
||||||
{# end#}
|
|
||||||
{# on click#}
|
|
||||||
{# set original_value to my innerText#}
|
|
||||||
{# writeText(my innerText) on navigator.clipboard#}
|
|
||||||
{# put '{% translate "copied!" %}' into me#}
|
|
||||||
{# wait 1s#}
|
|
||||||
{# put original_value into me#}
|
|
||||||
{# end"#}
|
|
||||||
{# class="" role="button"></span>#}
|
|
||||||
<div class="btn-group"
|
<div class="btn-group"
|
||||||
_="on selected_transactions_updated from #actions-bar
|
_="on selected_transactions_updated from #actions-bar
|
||||||
set realTotal to 0.0
|
set realTotal to math.bignumber(0)
|
||||||
set flatTotal to 0.0
|
set flatTotal to math.bignumber(0)
|
||||||
set transactions to <.transaction:has(input[name='transactions']:checked)/>
|
set transactions to <.transaction:has(input[name='transactions']:checked)/>
|
||||||
set amountValues to []
|
set flatAmountValues to []
|
||||||
|
set realAmountValues to []
|
||||||
|
|
||||||
for transaction in transactions
|
for transaction in transactions
|
||||||
set amt to first <.main-amount .amount/> in transaction
|
set amt to first <.main-amount .amount/> in transaction
|
||||||
set amountValue to parseFloat(amt.getAttribute('data-amount'))
|
set amountValue to parseFloat(amt.getAttribute('data-amount'))
|
||||||
append amountValue to amountValues
|
append amountValue to flatAmountValues
|
||||||
|
|
||||||
if not isNaN(amountValue)
|
if not isNaN(amountValue)
|
||||||
set flatTotal to flatTotal + (amountValue * 100)
|
set flatTotal to math.chain(flatTotal).add(amountValue)
|
||||||
|
|
||||||
if transaction match .income
|
if transaction match .income
|
||||||
set realTotal to realTotal + (amountValue * 100)
|
append amountValue to realAmountValues
|
||||||
|
set realTotal to math.chain(realTotal).add(amountValue)
|
||||||
else
|
else
|
||||||
set realTotal to realTotal - (amountValue * 100)
|
append -amountValue to realAmountValues
|
||||||
|
set realTotal to math.chain(realTotal).subtract(amountValue)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
set realTotal to realTotal / 100
|
set mean to flatTotal.divide(flatAmountValues.length).done().toNumber()
|
||||||
|
set realTotal to realTotal.done().toNumber()
|
||||||
|
set flatTotal to flatTotal.done().toNumber()
|
||||||
|
|
||||||
put realTotal.toLocaleString(undefined, {minimumFractionDigits: 0, maximumFractionDigits: 40}) into #real-total-front's innerText
|
put realTotal.toLocaleString(undefined, {minimumFractionDigits: 0, maximumFractionDigits: 40}) into #real-total-front's innerText
|
||||||
put realTotal.toLocaleString(undefined, {minimumFractionDigits: 0, maximumFractionDigits: 40}) into #calc-menu-real-total's innerText
|
put realTotal.toLocaleString(undefined, {minimumFractionDigits: 0, maximumFractionDigits: 40}) into #calc-menu-real-total's innerText
|
||||||
set flatTotal to flatTotal / 100
|
|
||||||
put flatTotal.toLocaleString(undefined, {minimumFractionDigits: 0, maximumFractionDigits: 40}) into #calc-menu-flat-total's innerText
|
put flatTotal.toLocaleString(undefined, {minimumFractionDigits: 0, maximumFractionDigits: 40}) into #calc-menu-flat-total's innerText
|
||||||
put Math.max.apply(Math, amountValues).toLocaleString(undefined, {minimumFractionDigits: 0, maximumFractionDigits: 40}) into #calc-menu-max's innerText
|
put Math.max.apply(Math, realAmountValues).toLocaleString(undefined, {minimumFractionDigits: 0, maximumFractionDigits: 40}) into #calc-menu-max's innerText
|
||||||
put Math.min.apply(Math, amountValues).toLocaleString(undefined, {minimumFractionDigits: 0, maximumFractionDigits: 40}) into #calc-menu-min's innerText
|
put Math.min.apply(Math, realAmountValues).toLocaleString(undefined, {minimumFractionDigits: 0, maximumFractionDigits: 40}) into #calc-menu-min's innerText
|
||||||
put (flatTotal / amountValues.length).toLocaleString(undefined, {minimumFractionDigits: 0, maximumFractionDigits: 40}) into #calc-menu-mean's innerText
|
put mean.toLocaleString(undefined, {minimumFractionDigits: 0, maximumFractionDigits: 40}) into #calc-menu-mean's innerText
|
||||||
put amountValues.length.toLocaleString(undefined, {minimumFractionDigits: 0, maximumFractionDigits: 40}) into #calc-menu-count's innerText
|
put flatAmountValues.length.toLocaleString(undefined, {minimumFractionDigits: 0, maximumFractionDigits: 40}) into #calc-menu-count's innerText
|
||||||
end"
|
end"
|
||||||
>
|
>
|
||||||
<button class="btn btn-secondary btn-sm" _="on click
|
<button class="btn btn-secondary btn-sm" _="on click
|
||||||
|
|||||||
@@ -69,8 +69,7 @@
|
|||||||
then call math.evaluate(expr)
|
then call math.evaluate(expr)
|
||||||
if result exists and result is a Number
|
if result exists and result is a Number
|
||||||
js(result)
|
js(result)
|
||||||
return result.toString().replace(new RegExp(',|\\.', 'g'),
|
return result.toLocaleString(undefined, {minimumFractionDigits: 0, maximumFractionDigits: 40})
|
||||||
match => match === '.' ? window.decimalSeparator : window.argSeparator)
|
|
||||||
end
|
end
|
||||||
then set localizedResult to it
|
then set localizedResult to it
|
||||||
set #calculator-result.innerText to localizedResult
|
set #calculator-result.innerText to localizedResult
|
||||||
|
|||||||
@@ -9,7 +9,7 @@
|
|||||||
{% block title %}{% if type == "current" %}{% translate 'Current Net Worth' %}{% else %}{% translate 'Projected Net Worth' %}{% endif %}{% endblock %}
|
{% block title %}{% if type == "current" %}{% translate 'Current Net Worth' %}{% else %}{% translate 'Projected Net Worth' %}{% endif %}{% endblock %}
|
||||||
|
|
||||||
{% block content %}
|
{% block content %}
|
||||||
<div class="container px-md-3 py-3" _="on load call initializeAccountChart() then initializeCurrencyChart()">
|
<div class="container px-md-3 py-3" _="init call initializeAccountChart() then initializeCurrencyChart() end">
|
||||||
<div class="row gx-xl-4 gy-3 mb-4">
|
<div class="row gx-xl-4 gy-3 mb-4">
|
||||||
<div class="col-12 col-xl-5">
|
<div class="col-12 col-xl-5">
|
||||||
<div class="row row-cols-1 g-4">
|
<div class="row row-cols-1 g-4">
|
||||||
|
|||||||
Reference in New Issue
Block a user