Account for renamed variable.

This commit is contained in:
James Cole
2025-03-23 15:04:38 +01:00
parent 5e1ecb2b11
commit a46f8430df
10 changed files with 111 additions and 108 deletions

View File

@@ -39,12 +39,12 @@ export default () => ({
loading: false,
loadingAccounts: false,
accountList: [],
autoConversion: false,
autoConversionAvailable: false,
convertToNative: false,
convertToNativeAvailable: false,
chartOptions: null,
switchAutoConversion() {
this.autoConversion = !this.autoConversion;
setVariable('autoConversion', this.autoConversion);
switchconvertToNative() {
this.convertToNative = !this.convertToNative;
setVariable('convertToNative', this.convertToNative);
},
localCacheKey(type) {
return 'ds_accounts_' + type;
@@ -90,13 +90,13 @@ export default () => ({
dataset.label = current.label;
// use the "native" currency code and use the "native_entries" as array
if (this.autoConversion) {
if (this.convertToNative) {
currencies.push(current.native_currency_code);
dataset.currency_code = current.native_currency_code;
collection = Object.values(current.native_entries);
yAxis = 'y' + current.native_currency_code;
}
if (!this.autoConversion) {
if (!this.convertToNative) {
yAxis = 'y' + current.currency_code;
dataset.currency_code = current.currency_code;
currencies.push(current.currency_code);
@@ -266,12 +266,12 @@ export default () => ({
init() {
// console.log('accounts init');
Promise.all([getVariable('viewRange', '1M'), getVariable('autoConversion', false), getVariable('language', 'en_US'),
Promise.all([getVariable('viewRange', '1M'), getVariable('convertToNative', false), getVariable('language', 'en_US'),
getConfiguration('cer.enabled', false)
]).then((values) => {
//console.log('accounts after promises');
this.autoConversion = values[1] && values[3];
this.autoConversionAvailable = values[3];
this.convertToNative = values[1] && values[3];
this.convertToNativeAvailable = values[3];
afterPromises = true;
// main dashboard chart:
@@ -289,11 +289,11 @@ export default () => ({
this.loadChart();
this.loadAccounts();
});
window.store.observe('autoConversion', () => {
window.store.observe('convertToNative', () => {
if (!afterPromises) {
return;
}
// console.log('accounts observe autoconversion');
// console.log('accounts observe convertToNative');
this.loadChart();
this.loadAccounts();
});

View File

@@ -31,7 +31,7 @@ export default () => ({
billBox: {paid: [], unpaid: []},
leftBox: {left: [], perDay: []},
netBox: {net: []},
autoConversion: false,
convertToNative: false,
loading: false,
boxData: null,
boxOptions: null,
@@ -42,8 +42,9 @@ export default () => ({
const boxesCacheKey = getCacheKey('ds_boxes_data', {start: start, end: end});
cleanupCache();
const cacheValid = window.store.get('cacheValid');
//const cacheValid = window.store.get('cacheValid');
let cachedData = window.store.get(boxesCacheKey);
const cacheValid = false; // force refresh
if (cacheValid && typeof cachedData !== 'undefined') {
this.boxData = cachedData;
@@ -76,7 +77,8 @@ export default () => ({
}
let key = current.key;
// native (auto conversion):
if (this.autoConversion) {
if (this.convertToNative) {
console.error('convertToNative does not work in boxes.');
if (key.startsWith('balance-in-native')) {
this.balanceBox.amounts.push(formatMoney(current.value, current.currency_code));
// prep subtitles (for later)
@@ -132,9 +134,10 @@ export default () => ({
}
}
// not native
if (!this.autoConversion && !key.endsWith('native')) {
if (!this.convertToNative && !key.endsWith('native')) {
console.log('NOT NATIVE');
if (key.startsWith('balance-in-')) {
this.balanceBox.amounts.push(formatMoney(current.value, current.currency_code));
this.balanceBox.amounts.push(formatMoney(current.monetary_value , current.currency_code));
continue;
}
// spent info is used in subtitle:
@@ -146,7 +149,7 @@ export default () => ({
// append the amount spent.
subtitles[current.currency_code] =
subtitles[current.currency_code] +
formatMoney(current.value, current.currency_code);
formatMoney(current.monetary_value , current.currency_code);
continue;
}
// earned info is used in subtitle:
@@ -157,30 +160,30 @@ export default () => ({
}
// prepend the amount earned.
subtitles[current.currency_code] =
formatMoney(current.value, current.currency_code) + ' + ' +
formatMoney(current.monetary_value , current.currency_code) + ' + ' +
subtitles[current.currency_code];
continue;
}
if (key.startsWith('bills-unpaid-in-')) {
this.billBox.unpaid.push(formatMoney(current.value, current.currency_code));
this.billBox.unpaid.push(formatMoney(current.monetary_value , current.currency_code));
continue;
}
if (key.startsWith('bills-paid-in-')) {
this.billBox.paid.push(formatMoney(current.value, current.currency_code));
this.billBox.paid.push(formatMoney(current.monetary_value , current.currency_code));
continue;
}
if (key.startsWith('left-to-spend-in-')) {
this.leftBox.left.push(formatMoney(current.value, current.currency_code));
this.leftBox.left.push(formatMoney(current.monetary_value , current.currency_code));
continue;
}
if (key.startsWith('left-per-day-to-spend-in-')) {
this.leftBox.perDay.push(formatMoney(current.value, current.currency_code));
this.leftBox.perDay.push(formatMoney(current.monetary_value , current.currency_code));
continue;
}
if (key.startsWith('net-worth-in-')) {
this.netBox.net.push(formatMoney(current.value, current.currency_code));
this.netBox.net.push(formatMoney(current.monetary_value , current.currency_code));
}
}
@@ -210,10 +213,10 @@ export default () => ({
init() {
// console.log('boxes init');
// TODO can be replaced by "getVariables"
Promise.all([getVariable('viewRange'), getVariable('autoConversion', false)]).then((values) => {
Promise.all([getVariable('viewRange'), getVariable('convertToNative', false)]).then((values) => {
// console.log('boxes after promises');
afterPromises = true;
this.autoConversion = values[1];
this.convertToNative = values[1];
this.loadBoxes();
});
window.store.observe('end', () => {
@@ -224,12 +227,12 @@ export default () => ({
this.boxData = null;
this.loadBoxes();
});
window.store.observe('autoConversion', (newValue) => {
window.store.observe('convertToNative', (newValue) => {
if (!afterPromises) {
return;
}
// console.log('boxes observe autoConversion');
this.autoConversion = newValue;
// console.log('boxes observe convertToNative');
this.convertToNative = newValue;
this.loadBoxes();
});
},

View File

@@ -34,7 +34,7 @@ let afterPromises = false;
export default () => ({
loading: false,
autoConversion: false,
convertToNative: false,
loadChart() {
if (true === this.loading) {
return;
@@ -134,7 +134,7 @@ export default () => ({
// // convert to EUR yes no?
let label = current.label + ' (' + current.currency_code + ')';
options.data.labels.push(label);
if (this.autoConversion) {
if (this.convertToNative) {
currencies.push(current.native_currency_code);
// series 0: spent
options.data.datasets[0].data.push(parseFloat(current.native_entries.spent) * -1);
@@ -143,7 +143,7 @@ export default () => ({
// series 2: overspent
options.data.datasets[2].data.push(parseFloat(current.native_entries.overspent));
}
if (!this.autoConversion) {
if (!this.convertToNative) {
currencies.push(current.currency_code);
// series 0: spent
options.data.datasets[0].data.push(parseFloat(current.entries.spent) * -1);
@@ -172,8 +172,8 @@ export default () => ({
init() {
Promise.all([getVariable('autoConversion', false)]).then((values) => {
this.autoConversion = values[0];
Promise.all([getVariable('convertToNative', false)]).then((values) => {
this.convertToNative = values[0];
afterPromises = true;
if (false === this.loading) {
this.loadChart();
@@ -189,12 +189,12 @@ export default () => ({
this.loadChart();
}
});
window.store.observe('autoConversion', (newValue) => {
window.store.observe('convertToNative', (newValue) => {
if (!afterPromises) {
return;
}
// console.log('boxes observe autoConversion');
this.autoConversion = newValue;
// console.log('boxes observe convertToNative');
this.convertToNative = newValue;
if (false === this.loading) {
this.loadChart();
}

View File

@@ -32,7 +32,7 @@ let afterPromises = false;
export default () => ({
loading: false,
autoConversion: false,
convertToNative: false,
generateOptions(data) {
currencies = [];
let options = getDefaultChartSettings('column');
@@ -44,7 +44,7 @@ export default () => ({
let current = data[i];
let code = current.currency_code;
// only use native code when doing auto conversion.
if (this.autoConversion) {
if (this.convertToNative) {
code = current.native_currency_code;
}
@@ -65,7 +65,7 @@ export default () => ({
let yAxis = 'y';
let current = data[i];
let code = current.currency_code;
if (this.autoConversion) {
if (this.convertToNative) {
code = current.native_currency_code;
}
@@ -77,7 +77,7 @@ export default () => ({
// this series' currency matches this column's currency.
amount = parseFloat(current.amount);
yAxis = 'y' + current.currency_code;
if (this.autoConversion) {
if (this.convertToNative) {
amount = parseFloat(current.native_amount);
yAxis = 'y' + current.native_currency_code;
}
@@ -183,8 +183,8 @@ export default () => ({
},
init() {
// console.log('categories init');
Promise.all([getVariable('autoConversion', false),]).then((values) => {
this.autoConversion = values[0];
Promise.all([getVariable('convertToNative', false),]).then((values) => {
this.convertToNative = values[0];
afterPromises = true;
this.loadChart();
});
@@ -195,11 +195,11 @@ export default () => ({
this.chartData = null;
this.loadChart();
});
window.store.observe('autoConversion', (newValue) => {
window.store.observe('convertToNative', (newValue) => {
if (!afterPromises) {
return;
}
this.autoConversion = newValue;
this.convertToNative = newValue;
this.loadChart();
});
},

View File

@@ -29,7 +29,7 @@ const PIGGY_CACHE_KEY = 'ds_pg_data';
export default () => ({
loading: false,
autoConversion: false,
convertToNative: false,
sankeyGrouping: 'account',
piggies: [],
getFreshData() {
@@ -96,14 +96,14 @@ export default () => ({
id: current.id,
name: current.attributes.name,
percentage: parseInt(current.attributes.percentage),
amount: this.autoConversion ? current.attributes.native_current_amount : current.attributes.current_amount,
amount: this.convertToNative ? current.attributes.native_current_amount : current.attributes.current_amount,
// left to save
left_to_save: this.autoConversion ? current.attributes.native_left_to_save : current.attributes.left_to_save,
left_to_save: this.convertToNative ? current.attributes.native_left_to_save : current.attributes.left_to_save,
// target amount
target_amount: this.autoConversion ? current.attributes.native_target_amount : current.attributes.target_amount,
target_amount: this.convertToNative ? current.attributes.native_target_amount : current.attributes.target_amount,
// save per month
save_per_month: this.autoConversion ? current.attributes.native_save_per_month : current.attributes.save_per_month,
currency_code: this.autoConversion ? current.attributes.native_currency_code : current.attributes.currency_code,
save_per_month: this.convertToNative ? current.attributes.native_save_per_month : current.attributes.save_per_month,
currency_code: this.convertToNative ? current.attributes.native_currency_code : current.attributes.currency_code,
};
dataSet[groupName].piggies.push(piggy);
@@ -129,10 +129,10 @@ export default () => ({
init() {
// console.log('piggies init');
apiData = [];
Promise.all([getVariable('autoConversion', false)]).then((values) => {
Promise.all([getVariable('convertToNative', false)]).then((values) => {
afterPromises = true;
this.autoConversion = values[0];
this.convertToNative = values[0];
this.loadPiggyBanks();
});
@@ -144,12 +144,12 @@ export default () => ({
apiData = [];
this.loadPiggyBanks();
});
window.store.observe('autoConversion', (newValue) => {
window.store.observe('convertToNative', (newValue) => {
if (!afterPromises) {
return;
}
// console.log('piggies observe autoConversion');
this.autoConversion = newValue;
// console.log('piggies observe convertToNative');
this.convertToNative = newValue;
this.loadPiggyBanks();
});
},

View File

@@ -33,7 +33,7 @@ let currencies = [];
let afterPromises = false;
let chart = null;
let transactions = [];
let autoConversion = false;
let convertToNative = false;
let translations = {
category: null,
unknown_category: null,
@@ -83,37 +83,37 @@ function getObjectName(type, name, direction, code) {
// category 4x
if ('category' === type && null !== name && 'in' === direction) {
return translations.category + ' "' + name + '" (' + translations.in + (autoConversion ? ', ' + code + ')' : ')');
return translations.category + ' "' + name + '" (' + translations.in + (convertToNative ? ', ' + code + ')' : ')');
}
if ('category' === type && null === name && 'in' === direction) {
return translations.unknown_category + ' (' + translations.in + (autoConversion ? ', ' + code + ')' : ')');
return translations.unknown_category + ' (' + translations.in + (convertToNative ? ', ' + code + ')' : ')');
}
if ('category' === type && null !== name && 'out' === direction) {
return translations.category + ' "' + name + '" (' + translations.out + (autoConversion ? ', ' + code + ')' : ')');
return translations.category + ' "' + name + '" (' + translations.out + (convertToNative ? ', ' + code + ')' : ')');
}
if ('category' === type && null === name && 'out' === direction) {
return translations.unknown_category + ' (' + translations.out + (autoConversion ? ', ' + code + ')' : ')');
return translations.unknown_category + ' (' + translations.out + (convertToNative ? ', ' + code + ')' : ')');
}
// account 4x
if ('account' === type && null === name && 'in' === direction) {
return translations.unknown_source + (autoConversion ? ' (' + code + ')' : '');
return translations.unknown_source + (convertToNative ? ' (' + code + ')' : '');
}
if ('account' === type && null !== name && 'in' === direction) {
return translations.revenue_account + '"' + name + '"' + (autoConversion ? ' (' + code + ')' : '');
return translations.revenue_account + '"' + name + '"' + (convertToNative ? ' (' + code + ')' : '');
}
if ('account' === type && null === name && 'out' === direction) {
return translations.unknown_dest + (autoConversion ? ' (' + code + ')' : '');
return translations.unknown_dest + (convertToNative ? ' (' + code + ')' : '');
}
if ('account' === type && null !== name && 'out' === direction) {
return translations.expense_account + ' "' + name + '"' + (autoConversion ? ' (' + code + ')' : '');
return translations.expense_account + ' "' + name + '"' + (convertToNative ? ' (' + code + ')' : '');
}
// budget 2x
if ('budget' === type && null !== name) {
return translations.budget + ' "' + name + '"' + (autoConversion ? ' (' + code + ')' : '');
return translations.budget + ' "' + name + '"' + (convertToNative ? ' (' + code + ')' : '');
}
if ('budget' === type && null === name) {
return translations.unknown_budget + (autoConversion ? ' (' + code + ')' : '');
return translations.unknown_budget + (convertToNative ? ' (' + code + ')' : '');
}
console.error('Cannot handle: type:"' + type + '", dir: "' + direction + '"');
}
@@ -121,25 +121,25 @@ function getObjectName(type, name, direction, code) {
function getLabelName(type, name, code) {
// category
if ('category' === type && null !== name) {
return translations.category + ' "' + name + '"' + (autoConversion ? ' (' + code + ')' : '');
return translations.category + ' "' + name + '"' + (convertToNative ? ' (' + code + ')' : '');
}
if ('category' === type && null === name) {
return translations.unknown_category + (autoConversion ? ' (' + code + ')' : '');
return translations.unknown_category + (convertToNative ? ' (' + code + ')' : '');
}
// account
if ('account' === type && null === name) {
return translations.unknown_account + (autoConversion ? ' (' + code + ')' : '');
return translations.unknown_account + (convertToNative ? ' (' + code + ')' : '');
}
if ('account' === type && null !== name) {
return name + (autoConversion ? ' (' + code + ')' : '');
return name + (convertToNative ? ' (' + code + ')' : '');
}
// budget 2x
if ('budget' === type && null !== name) {
return translations.budget + ' "' + name + '"' + (autoConversion ? ' (' + code + ')' : '');
return translations.budget + ' "' + name + '"' + (convertToNative ? ' (' + code + ')' : '');
}
if ('budget' === type && null === name) {
return translations.unknown_budget + (autoConversion ? ' (' + code + ')' : '');
return translations.unknown_budget + (convertToNative ? ' (' + code + ')' : '');
}
console.error('Cannot handle: type:"' + type + '"');
}
@@ -147,7 +147,7 @@ function getLabelName(type, name, code) {
export default () => ({
loading: false,
autoConversion: false,
convertToNative: false,
generateOptions() {
let options = getDefaultChartSettings('sankey');
@@ -164,8 +164,8 @@ export default () => ({
if (group.attributes.transactions.hasOwnProperty(ii)) {
// properties of the transaction, used in the generation of the chart:
let transaction = group.attributes.transactions[ii];
let currencyCode = this.autoConversion ? transaction.native_currency_code : transaction.currency_code;
let amount = this.autoConversion ? parseFloat(transaction.native_amount) : parseFloat(transaction.amount);
let currencyCode = this.convertToNative ? transaction.native_currency_code : transaction.currency_code;
let amount = this.convertToNative ? parseFloat(transaction.native_amount) : parseFloat(transaction.amount);
let flowKey;
/*
@@ -194,7 +194,7 @@ export default () => ({
if (!amounts.hasOwnProperty(flowKey)) {
amounts[flowKey] = {
from: category,
to: translations.all_money + (this.autoConversion ? ' (' + currencyCode + ')' : ''),
to: translations.all_money + (this.convertToNative ? ' (' + currencyCode + ')' : ''),
amount: 0
};
}
@@ -214,7 +214,7 @@ export default () => ({
if (!amounts.hasOwnProperty(flowKey)) {
amounts[flowKey] = {
from: translations.all_money + (this.autoConversion ? ' (' + currencyCode + ')' : ''),
from: translations.all_money + (this.convertToNative ? ' (' + currencyCode + ')' : ''),
to: budget,
amount: 0
};
@@ -348,9 +348,9 @@ export default () => ({
init() {
// console.log('sankey init');
transactions = [];
Promise.all([getVariable('autoConversion', false)]).then((values) => {
this.autoConversion = values[0];
autoConversion = values[0];
Promise.all([getVariable('convertToNative', false)]).then((values) => {
this.convertToNative = values[0];
convertToNative = values[0];
// some translations:
translations.all_money = i18next.t('firefly.all_money');
translations.category = i18next.t('firefly.category');
@@ -378,12 +378,12 @@ export default () => ({
this.transactions = [];
this.loadChart();
});
window.store.observe('autoConversion', (newValue) => {
window.store.observe('convertToNative', (newValue) => {
if (!afterPromises) {
return;
}
// console.log('sankey observe autoConversion');
this.autoConversion = newValue;
// console.log('sankey observe convertToNative');
this.convertToNative = newValue;
this.loadChart();
});
},

View File

@@ -79,7 +79,7 @@ function downloadSubscriptions(params) {
paid: current.attributes.paid_dates.length > 0,
};
// set variables
bill.expected_amount = params.autoConversion ? formatMoney(bill.native_amount, bill.native_currency_code) :
bill.expected_amount = params.convertToNative ? formatMoney(bill.native_amount, bill.native_currency_code) :
formatMoney(bill.amount, bill.currency_code);
bill.expected_times = i18next.t('firefly.subscr_expected_x_times', {
times: current.attributes.pay_dates.length,
@@ -92,22 +92,22 @@ function downloadSubscriptions(params) {
const currentPayment = current.attributes.paid_dates[iii];
let percentage = 100;
// math: -100+(paid/expected)*100
if (params.autoConversion) {
if (params.convertToNative) {
percentage = Math.round(-100 + ((parseFloat(currentPayment.native_amount) * -1) / parseFloat(bill.native_amount)) * 100);
}
if (!params.autoConversion) {
if (!params.convertToNative) {
percentage = Math.round(-100 + ((parseFloat(currentPayment.amount) * -1) / parseFloat(bill.amount)) * 100);
}
let currentTransaction = {
amount: params.autoConversion ? formatMoney(currentPayment.native_amount, currentPayment.native_currency_code) : formatMoney(currentPayment.amount, currentPayment.currency_code),
amount: params.convertToNative ? formatMoney(currentPayment.native_amount, currentPayment.native_currency_code) : formatMoney(currentPayment.amount, currentPayment.currency_code),
percentage: percentage,
date: format(new Date(currentPayment.date), 'PP'),
foreign_amount: null,
};
if (null !== currentPayment.foreign_currency_code) {
currentTransaction.foreign_amount = params.autoConversion ? currentPayment.foreign_native_amount : currentPayment.foreign_amount;
currentTransaction.foreign_currency_code = params.autoConversion ? currentPayment.native_currency_code : currentPayment.foreign_currency_code;
currentTransaction.foreign_amount = params.convertToNative ? currentPayment.foreign_native_amount : currentPayment.foreign_amount;
currentTransaction.foreign_currency_code = params.convertToNative ? currentPayment.native_currency_code : currentPayment.foreign_currency_code;
}
bill.transactions.push(currentTransaction);
@@ -178,7 +178,7 @@ function downloadSubscriptions(params) {
export default () => ({
loading: false,
autoConversion: false,
convertToNative: false,
subscriptions: [],
startSubscriptions() {
this.loading = true;
@@ -198,7 +198,7 @@ export default () => ({
let params = {
start: format(start, 'y-MM-dd'),
end: format(end, 'y-MM-dd'),
autoConversion: this.autoConversion,
convertToNative: this.convertToNative,
page: 1
};
downloadSubscriptions(params).then(() => {
@@ -226,9 +226,9 @@ export default () => ({
drawPieChart(groupId, groupTitle, data) {
let id = '#pie_' + groupId + '_' + data.currency_code;
//console.log(data);
const unpaidAmount = this.autoConversion ? data.native_unpaid : data.unpaid;
const paidAmount = this.autoConversion ? data.native_paid : data.paid;
const currencyCode = this.autoConversion ? data.native_currency_code : data.currency_code;
const unpaidAmount = this.convertToNative ? data.native_unpaid : data.unpaid;
const paidAmount = this.convertToNative ? data.native_paid : data.paid;
const currencyCode = this.convertToNative ? data.native_currency_code : data.currency_code;
const chartData = {
labels: [
i18next.t('firefly.paid'),
@@ -267,8 +267,8 @@ export default () => ({
},
init() {
Promise.all([getVariable('autoConversion', false)]).then((values) => {
this.autoConversion = values[0];
Promise.all([getVariable('convertToNative', false)]).then((values) => {
this.convertToNative = values[0];
afterPromises = true;
if (false === this.loading) {
@@ -285,11 +285,11 @@ export default () => ({
this.startSubscriptions();
}
});
window.store.observe('autoConversion', (newValue) => {
window.store.observe('convertToNative', (newValue) => {
if (!afterPromises) {
return;
}
this.autoConversion = newValue;
this.convertToNative = newValue;
if (false === this.loading) {
this.startSubscriptions();
}

View File

@@ -9,17 +9,17 @@
<div class="card-body p-0" style="position: relative;height:400px;">
<canvas id="account-chart"></canvas>
</div>
<template x-if="autoConversionAvailable">
<template x-if="convertToNativeAvailable">
<div class="card-footer text-end">
<template x-if="autoConversion">
<button type="button" @click="switchAutoConversion"
<template x-if="convertToNative">
<button type="button" @click="switchconvertToNative"
class="btn btn-outline-info btm-sm">
<span
class="fa-solid fa-comments-dollar"></span> {{ __('firefly.disable_auto_convert') }}
</button>
</template>
<template x-if="!autoConversion">
<button type="button" @click="switchAutoConversion"
<template x-if="!convertToNative">
<button type="button" @click="switchconvertToNative"
class="btn btn-outline-info btm-sm">
<span
class="fa-solid fa-comments-dollar"></span> {{ __('firefly.enable_auto_convert') }}

View File

@@ -75,7 +75,7 @@
<ul class="list-unstyled list-no-margin">
<template x-for="transaction in group.transactions">
<li>
@include('partials.elements.amount', ['autoConversion' => true,'type' => 'transaction.type','amount' => 'transaction.amount','native' => 'transaction.native_amount'])
@include('partials.elements.amount', ['convertToNative' => true,'type' => 'transaction.type','amount' => 'transaction.amount','native' => 'transaction.native_amount'])
</li>
</template>
</ul>

View File

@@ -1,5 +1,5 @@
@if($autoConversion)
<template x-if="autoConversion">
@if($convertToNative)
<template x-if="convertToNative">
<span>
<template x-if="{{ $native }}_raw < 0">
<span class="text-danger">
@@ -20,7 +20,7 @@
</template>
</span>
</template>
<template x-if="!autoConversion">
<template x-if="!convertToNative">
<span>
<template x-if="{{ $amount }}_raw < 0">