Skip to content

Firefly III: a personal finances manager

🤖 Auto commit for release 'develop' on 2026-09-12

JC56b13b7420ed5
diff --git a/app/Api/V1/Controllers/Insight/Income/TagController.php b/app/Api/V1/Controllers/Insight/Income/TagController.php
index df99eef909..94be2ae461 100644
--- a/app/Api/V1/Controllers/Insight/Income/TagController.php
+++ b/app/Api/V1/Controllers/Insight/Income/TagController.php
@@ -158,7 +158,10 @@ final class TagController extends Controller
'currency_id' => (string) $foreignCurrencyId,
'currency_code' => $journal['foreign_currency_code'],
];
- $response[$foreignKey]['difference'] = bcadd((string) $response[$foreignKey]['difference'], Steam::positive($journal['foreign_amount']));
+ $response[$foreignKey]['difference'] = bcadd(
+ (string) $response[$foreignKey]['difference'],
+ Steam::positive($journal['foreign_amount'])
+ );
$response[$foreignKey]['difference_float'] = (float) $response[$foreignKey]['difference'];
}
}
diff --git a/app/Api/V1/Controllers/Insight/Transfer/TagController.php b/app/Api/V1/Controllers/Insight/Transfer/TagController.php
index f92a7aa9f0..b7b85fd376 100644
--- a/app/Api/V1/Controllers/Insight/Transfer/TagController.php
+++ b/app/Api/V1/Controllers/Insight/Transfer/TagController.php
@@ -155,7 +155,10 @@ final class TagController extends Controller
'currency_id' => (string) $foreignCurrencyId,
'currency_code' => $journal['foreign_currency_code'],
];
- $response[$foreignKey]['difference'] = bcadd((string) $response[$foreignKey]['difference'], Steam::positive($journal['foreign_amount']));
+ $response[$foreignKey]['difference'] = bcadd(
+ (string) $response[$foreignKey]['difference'],
+ Steam::positive($journal['foreign_amount'])
+ );
$response[$foreignKey]['difference_float'] = (float) $response[$foreignKey]['difference']; // intentional float
}
}
diff --git a/app/Http/Controllers/Budget/BudgetLimitController.php b/app/Http/Controllers/Budget/BudgetLimitController.php
index 2edb4f5531..d461374baa 100644
--- a/app/Http/Controllers/Budget/BudgetLimitController.php
+++ b/app/Http/Controllers/Budget/BudgetLimitController.php
@@ -198,7 +198,13 @@ final class BudgetLimitController extends Controller
if ($request->expectsJson()) {
$array = $limit->toArray();
// add some extra metadata:
- $spentArr = $this->opsRepository->sumExpenses($limit->start_date, $limit->end_date, null, new Collection()->push($budget), $currency);
+ $spentArr = $this->opsRepository->sumExpenses(
+ $limit->start_date,
+ $limit->end_date,
+ null,
+ new Collection()->push($budget),
+ $currency
+ );
$array['spent'] = $spentArr[$currency->id]['sum'] ?? '0';
$array['left_formatted'] = Amount::formatAnything($limit->transactionCurrency, bcadd($array['spent'], (string) $array['amount']));
$array['amount_formatted'] = Amount::formatAnything($limit->transactionCurrency, $limit['amount']);
diff --git a/app/Http/Controllers/Budget/IndexController.php b/app/Http/Controllers/Budget/IndexController.php
index 215ebbd484..d40d4432a3 100644
--- a/app/Http/Controllers/Budget/IndexController.php
+++ b/app/Http/Controllers/Budget/IndexController.php
@@ -284,7 +284,10 @@ final class IndexController extends Controller
if (array_key_exists($currency->id, $spentArr) && array_key_exists('sum', $spentArr[$currency->id])) {
$array['spent'][$currency->id]['spent'] = $spentArr[$currency->id]['sum'];
- $array['spent'][$currency->id]['spent_outside'] = Steam::negative(bcsub($spentInLimits[$currency->id], $spentArr[$currency->id]['sum']));
+ $array['spent'][$currency->id]['spent_outside'] = Steam::negative(bcsub(
+ $spentInLimits[$currency->id],
+ $spentArr[$currency->id]['sum']
+ ));
$array['spent'][$currency->id]['currency_id'] = $currency->id;
$array['spent'][$currency->id]['currency_symbol'] = $currency->symbol;
$array['spent'][$currency->id]['currency_decimal_places'] = $currency->decimal_places;
diff --git a/app/Http/Controllers/Chart/BudgetController.php b/app/Http/Controllers/Chart/BudgetController.php
index ad724137dc..f4b32fe5c5 100644
--- a/app/Http/Controllers/Chart/BudgetController.php
+++ b/app/Http/Controllers/Chart/BudgetController.php
@@ -539,7 +539,13 @@ final class BudgetController extends Controller
}
// get spent amount in this period for this currency.
- $sum = $this->opsRepository->sumExpenses($currentStart, $currentEnd, $accounts, new Collection()->push($budget), $currency);
+ $sum = $this->opsRepository->sumExpenses(
+ $currentStart,
+ $currentEnd,
+ $accounts,
+ new Collection()->push($budget),
+ $currency
+ );
$amount = Steam::positive($sum[$currency->id]['sum'] ?? '0');
$chartData[0]['entries'][$title] = Steam::bcround($amount, $currency->decimal_places);
diff --git a/app/Jobs/CreateAutoBudgetLimits.php b/app/Jobs/CreateAutoBudgetLimits.php
index 476da65ac3..affea656a0 100644
--- a/app/Jobs/CreateAutoBudgetLimits.php
+++ b/app/Jobs/CreateAutoBudgetLimits.php
@@ -132,7 +132,13 @@ class CreateAutoBudgetLimits implements ShouldQueue
// if has one, calculate expenses and use that as a base.
$repository = app(OperationsRepositoryInterface::class);
$repository->setUser($autoBudget->budget->user);
- $spent = $repository->sumExpenses($previousStart, $previousEnd, null, new Collection()->push($autoBudget->budget), $autoBudget->transactionCurrency);
+ $spent = $repository->sumExpenses(
+ $previousStart,
+ $previousEnd,
+ null,
+ new Collection()->push($autoBudget->budget),
+ $autoBudget->transactionCurrency
+ );
$currencyId = $autoBudget->transaction_currency_id;
$spentAmount = $spent[$currencyId]['sum'] ?? '0';
Log::debug(sprintf('Spent in previous budget period (%s-%s) is %s', $previousStart->format('Y-m-d'), $previousEnd->format('Y-m-d'), $spentAmount));
@@ -222,7 +228,13 @@ class CreateAutoBudgetLimits implements ShouldQueue
// if has one, calculate expenses and use that as a base.
$repository = app(OperationsRepositoryInterface::class);
$repository->setUser($autoBudget->budget->user);
- $spent = $repository->sumExpenses($previousStart, $previousEnd, null, new Collection()->push($autoBudget->budget), $autoBudget->transactionCurrency);
+ $spent = $repository->sumExpenses(
+ $previousStart,
+ $previousEnd,
+ null,
+ new Collection()->push($autoBudget->budget),
+ $autoBudget->transactionCurrency
+ );
$currencyId = $autoBudget->transaction_currency_id;
$spentAmount = $spent[$currencyId]['sum'] ?? '0';
Log::debug(sprintf('Spent in previous budget period (%s-%s) is %s', $previousStart->format('Y-m-d'), $previousEnd->format('Y-m-d'), $spentAmount));
diff --git a/app/Support/Http/Controllers/AugumentData.php b/app/Support/Http/Controllers/AugumentData.php
index a3a940b1ba..a507156873 100644
--- a/app/Support/Http/Controllers/AugumentData.php
+++ b/app/Support/Http/Controllers/AugumentData.php
@@ -222,7 +222,14 @@ trait AugumentData
$currentEnd->addMonth();
}
// primary currency amount.
- $expenses = $opsRepository->sumExpenses($currentStart, $currentEnd, null, $budgetCollection, $entry->transactionCurrency, $this->convertToPrimary);
+ $expenses = $opsRepository->sumExpenses(
+ $currentStart,
+ $currentEnd,
+ null,
+ $budgetCollection,
+ $entry->transactionCurrency,
+ $this->convertToPrimary
+ );
$spent = $expenses[$currency->id]['sum'] ?? '0';
$entry->pc_spent = $spent;
diff --git a/app/Support/JsonApi/Enrichments/RecurringEnrichment.php b/app/Support/JsonApi/Enrichments/RecurringEnrichment.php
index d0c09bf027..2428353cb0 100644
--- a/app/Support/JsonApi/Enrichments/RecurringEnrichment.php
+++ b/app/Support/JsonApi/Enrichments/RecurringEnrichment.php
@@ -354,7 +354,11 @@ class RecurringEnrichment implements EnrichmentInterface
/** @var RecurrenceRepetition $repetition */
foreach ($set as $repetition) {
- $recurrence = $this->collection->filter(static fn (Recurrence $item): bool => (int) $item->id === (int) $repetition->recurrence_id)->first();
+ $recurrence = $this->collection->filter(
+ static fn (Recurrence $item): bool => (int) $item->id === (int) $repetition->recurrence_id
+ )
+ ->first()
+ ;
$fromDate = clone ($recurrence->latest_date ?? $recurrence->first_date);
$recurrenceId = (int) $repetition->recurrence_id;
$repId = (int) $repetition->id;
diff --git a/config/firefly.php b/config/firefly.php
index 8d69b61baa..e1dda9c40c 100644
--- a/config/firefly.php
+++ b/config/firefly.php
@@ -78,8 +78,8 @@ return [
'running_balance_column' => (bool)env_default_when_empty(env('USE_RUNNING_BALANCE'), true), // this is only the default value, is not used.
// see cer.php for exchange rates feature flag.
],
-'version' => 'develop/2026-09-11',
-'build_time' => 1789141584,
+'version' => 'develop/2026-09-12',
+'build_time' => 1789204983,
'api_version' => '2.1.0', // field is no longer used.
'db_version' => 28, // field is no longer used.
diff --git a/package-lock.json b/package-lock.json
index 44b250c8c8..bfa6d95554 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -3067,9 +3067,9 @@
}
},
"node_modules/sass": {
- "version": "1.104.0",
- "resolved": "https://registry.npmjs.org/sass/-/sass-1.104.0.tgz",
- "integrity": "sha512-btHMApW2bgolvClhRW8AlQJzgI9lUB3pPSofBQQT+E46GWvf9o0TVQ13SYv5riWZVFyPN+JNz3TKW9XhBlc10w==",
+ "version": "1.104.1",
+ "resolved": "https://registry.npmjs.org/sass/-/sass-1.104.1.tgz",
+ "integrity": "sha512-yDA+1aIG3EHgN4V/BvuhCvu61FF6hEd4e+9DxikUm9U0CAGuvdIZ/UYy7qbOxjhbbWQraoyLlMuzdRGOSV5Bmw==",
"dev": true,
"license": "MIT",
"dependencies": {
@@ -3245,14 +3245,14 @@
"license": "MIT"
},
"node_modules/temporal-polyfill": {
- "version": "1.0.4",
- "resolved": "https://registry.npmjs.org/temporal-polyfill/-/temporal-polyfill-1.0.4.tgz",
- "integrity": "sha512-MLEU0qOD2uXlz24oINNtdLZQl8RgmMxSnRtKEGZGGetTJjlRwQJjk+VsJ4EREaUoiaTb8NJOcUiKtoAiWn9EBg==",
+ "version": "1.0.5",
+ "resolved": "https://registry.npmjs.org/temporal-polyfill/-/temporal-polyfill-1.0.5.tgz",
+ "integrity": "sha512-+H/mmY74i6wXCMcjIhGuSnODcyZnc4eois2myhOyX0UqRAKNXQY5m9iB1en5jQ/n4SXtjLXo1ElBI5bmn8tZwQ==",
"license": "MIT",
"peer": true,
"dependencies": {
"temporal-spec": "1.0.1",
- "temporal-utils": "1.0.2"
+ "temporal-utils": "1.0.3"
}
},
"node_modules/temporal-spec": {
@@ -3263,9 +3263,9 @@
"peer": true
},
"node_modules/temporal-utils": {
- "version": "1.0.2",
- "resolved": "https://registry.npmjs.org/temporal-utils/-/temporal-utils-1.0.2.tgz",
- "integrity": "sha512-1B8Dl4KzrOvsNUlpoWGno2VLQlxroLjDgc5NBjVC9ax9ymdo+ezfyvhyjEMx+IVfhINr6CIG2gcnlP95iRrybQ==",
+ "version": "1.0.3",
+ "resolved": "https://registry.npmjs.org/temporal-utils/-/temporal-utils-1.0.3.tgz",
+ "integrity": "sha512-9jbTSX3HvkOWvDpNpFzwX/d1mkCrgQgwLmVTOEiuocZGKHsrQJtttGZFmybJ2zYP5zCSZuU5ZyeS8+eOEPABiQ==",
"license": "MIT",
"peer": true
},
@@ -3567,9 +3567,9 @@
}
},
"node_modules/yaml": {
- "version": "2.9.0",
- "resolved": "https://registry.npmjs.org/yaml/-/yaml-2.9.0.tgz",
- "integrity": "sha512-2AvhNX3mb8zd6Zy7INTtSpl1F15HW6Wnqj0srWlkKLcpYl/gMIMJiyuGq2KeI2YFxUPjdlB+3Lc10seMLtL4cA==",
+ "version": "2.9.1",
+ "resolved": "https://registry.npmjs.org/yaml/-/yaml-2.9.1.tgz",
+ "integrity": "sha512-3NxN8+78OdzbT7C/WjGsyfPAtJaN3FNDsWxv7Y7mcDsT/oOmgW8BpyQQFFBnvZE3j9Y2Sdz1ULFLezL7Eb2yFw==",
"license": "ISC",
"bin": {
"yaml": "bin.mjs"
diff --git a/resources/assets/v3/js/api/configuration/get.js b/resources/assets/v3/js/api/configuration/get.js
index ab92676d1a..0444bd2f0b 100644
--- a/resources/assets/v3/js/api/configuration/get.js
+++ b/resources/assets/v3/js/api/configuration/get.js
@@ -18,10 +18,10 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
-import {api} from "../../boot/axios";
+import { api } from "../../boot/axios";
export default class Get {
getByName(name) {
- return api.get('/api/v1/configuration/' + name);
+ return api.get("/api/v1/configuration/" + name);
}
}
diff --git a/resources/assets/v3/js/api/model/attachment/post.js b/resources/assets/v3/js/api/model/attachment/post.js
index adfda1042d..f1fa201f81 100644
--- a/resources/assets/v3/js/api/model/attachment/post.js
+++ b/resources/assets/v3/js/api/model/attachment/post.js
@@ -18,16 +18,20 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
-import {api} from "../../../boot/axios";
+import { api } from "../../../boot/axios";
export default class Post {
post(fileName, attachableType, attachableId) {
- let url = '/api/v1/attachments';
- return api.post(url, {filename: fileName, attachable_type: attachableType, attachable_id: attachableId});
+ let url = "/api/v1/attachments";
+ return api.post(url, {
+ filename: fileName,
+ attachable_type: attachableType,
+ attachable_id: attachableId,
+ });
}
upload(id, data) {
- let url = './api/v1/attachments/' + id + '/upload';
+ let url = "./api/v1/attachments/" + id + "/upload";
return api.post(url, data);
}
}
diff --git a/resources/assets/v3/js/api/model/budget/get.js b/resources/assets/v3/js/api/model/budget/get.js
index 2466c46463..0abf61635c 100644
--- a/resources/assets/v3/js/api/model/budget/get.js
+++ b/resources/assets/v3/js/api/model/budget/get.js
@@ -18,16 +18,14 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
-import {api} from "../../../boot/axios";
+import { api } from "../../../boot/axios";
export default class Get {
-
/**
*
* @param params
* @returns {Promise<AxiosResponse<any>>}
*/
list(params) {
- return api.get('/api/v1/budgets', {params: params});
+ return api.get("/api/v1/budgets", { params: params });
}
-
}
diff --git a/resources/assets/v3/js/api/model/currency/get.js b/resources/assets/v3/js/api/model/currency/get.js
index b65d35e0be..6a33079325 100644
--- a/resources/assets/v3/js/api/model/currency/get.js
+++ b/resources/assets/v3/js/api/model/currency/get.js
@@ -18,20 +18,18 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
-import {api} from "../../../boot/axios";
+import { api } from "../../../boot/axios";
export default class Get {
-
/**
*
* @param params
* @returns {Promise<AxiosResponse<any>>}
*/
list(params) {
- return api.get('/api/v1/currencies', {params: params});
+ return api.get("/api/v1/currencies", { params: params });
}
get(code) {
- return api.get('/api/v1/currencies/' + code);
+ return api.get("/api/v1/currencies/" + code);
}
-
}
diff --git a/resources/assets/v3/js/api/model/exchange-rate/delete.js b/resources/assets/v3/js/api/model/exchange-rate/delete.js
index 138e071c2b..b7ae9be500 100644
--- a/resources/assets/v3/js/api/model/exchange-rate/delete.js
+++ b/resources/assets/v3/js/api/model/exchange-rate/delete.js
@@ -18,11 +18,11 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
-import {api} from "../../../boot/axios";
+import { api } from "../../../boot/axios";
export default class Delete {
delete(id) {
- let url = '/api/v1/exchange-rates/' + parseInt(id);
+ let url = "/api/v1/exchange-rates/" + parseInt(id);
return api.delete(url);
}
}
diff --git a/resources/assets/v3/js/api/model/exchange-rate/get.js b/resources/assets/v3/js/api/model/exchange-rate/get.js
index 5d4dddab26..13a7459794 100644
--- a/resources/assets/v3/js/api/model/exchange-rate/get.js
+++ b/resources/assets/v3/js/api/model/exchange-rate/get.js
@@ -18,12 +18,12 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
-import {api} from "../../../boot/axios";
+import { api } from "../../../boot/axios";
export default class Get {
-
get(from, to, params) {
- return api.get('/api/v1/exchange-rates/' + from + '/' + to , {params: params});
+ return api.get("/api/v1/exchange-rates/" + from + "/" + to, {
+ params: params,
+ });
}
-
}
diff --git a/resources/assets/v3/js/api/model/exchange-rate/post.js b/resources/assets/v3/js/api/model/exchange-rate/post.js
index 869dc56044..af59a11578 100644
--- a/resources/assets/v3/js/api/model/exchange-rate/post.js
+++ b/resources/assets/v3/js/api/model/exchange-rate/post.js
@@ -18,11 +18,11 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
-import {api} from "../../../boot/axios";
+import { api } from "../../../boot/axios";
export default class Post {
post(submission) {
- let url = '/api/v1/exchange-rates';
+ let url = "/api/v1/exchange-rates";
return api.post(url, submission);
}
}
diff --git a/resources/assets/v3/js/api/model/exchange-rate/put.js b/resources/assets/v3/js/api/model/exchange-rate/put.js
index ffce80a13d..f08a10cc03 100644
--- a/resources/assets/v3/js/api/model/exchange-rate/put.js
+++ b/resources/assets/v3/js/api/model/exchange-rate/put.js
@@ -18,11 +18,11 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
-import {api} from "../../../boot/axios";
+import { api } from "../../../boot/axios";
export default class Put {
put(submission, params) {
- let url = '/api/v1/exchange-rates/' + parseInt(params.id);
+ let url = "/api/v1/exchange-rates/" + parseInt(params.id);
return api.put(url, submission);
}
}
diff --git a/resources/assets/v3/js/api/model/link-type/get.js b/resources/assets/v3/js/api/model/link-type/get.js
index fb417a8802..c892f22e87 100644
--- a/resources/assets/v3/js/api/model/link-type/get.js
+++ b/resources/assets/v3/js/api/model/link-type/get.js
@@ -18,18 +18,15 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
-
-import {api} from "../../../boot/axios";
+import { api } from "../../../boot/axios";
export default class Get {
-
/**
*
* @param params
* @returns {Promise<AxiosResponse<any>>}
*/
list(params) {
- return api.get('/api/v1/link-types', {params: params});
+ return api.get("/api/v1/link-types", { params: params });
}
-
}
diff --git a/resources/assets/v3/js/api/model/piggy-bank/get.js b/resources/assets/v3/js/api/model/piggy-bank/get.js
index c3df77d321..d0650bbec2 100644
--- a/resources/assets/v3/js/api/model/piggy-bank/get.js
+++ b/resources/assets/v3/js/api/model/piggy-bank/get.js
@@ -18,18 +18,15 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
-
-import {api} from "../../../boot/axios";
+import { api } from "../../../boot/axios";
export default class Get {
-
/**
*
* @param params
* @returns {Promise<AxiosResponse<any>>}
*/
list(params) {
- return api.get('/api/v1/piggy-banks', {params: params});
+ return api.get("/api/v1/piggy-banks", { params: params });
}
-
}
diff --git a/resources/assets/v3/js/api/model/subscription/get.js b/resources/assets/v3/js/api/model/subscription/get.js
index 96088023b6..1929cb14dc 100644
--- a/resources/assets/v3/js/api/model/subscription/get.js
+++ b/resources/assets/v3/js/api/model/subscription/get.js
@@ -18,25 +18,23 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
-
-import {api} from "../../../boot/axios";
+import { api } from "../../../boot/axios";
export default class Get {
-
/**
*
* @param params
* @returns {Promise<AxiosResponse<any>>}
*/
list(params) {
- return api.get('/api/v1/subscriptions', {params: params});
+ return api.get("/api/v1/subscriptions", { params: params });
}
paid(params) {
- return api.get('/api/v1/subscriptions/sum/paid', {params: params});
+ return api.get("/api/v1/subscriptions/sum/paid", { params: params });
}
unpaid(params) {
- return api.get('/api/v1/subscriptions/sum/unpaid', {params: params});
+ return api.get("/api/v1/subscriptions/sum/unpaid", { params: params });
}
}
diff --git a/resources/assets/v3/js/api/model/transaction-link/delete.js b/resources/assets/v3/js/api/model/transaction-link/delete.js
index be6b87a86f..8ad13e5520 100644
--- a/resources/assets/v3/js/api/model/transaction-link/delete.js
+++ b/resources/assets/v3/js/api/model/transaction-link/delete.js
@@ -18,11 +18,11 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
-import {api} from "../../../boot/axios";
+import { api } from "../../../boot/axios";
export default class Delete {
delete(id) {
- let url = '/api/v1/transaction-links/' + parseInt(id);
+ let url = "/api/v1/transaction-links/" + parseInt(id);
return api.delete(url);
}
}
diff --git a/resources/assets/v3/js/api/model/transaction-link/post.js b/resources/assets/v3/js/api/model/transaction-link/post.js
index aebfe86b91..d3c51f0cec 100644
--- a/resources/assets/v3/js/api/model/transaction-link/post.js
+++ b/resources/assets/v3/js/api/model/transaction-link/post.js
@@ -1,17 +1,14 @@
-
-
-import {api} from "../../../boot/axios";
+import { api } from "../../../boot/axios";
export default class Post {
post(linkTypeId, inwardId, outwardId, notes) {
- console.log('POST!');
- let url = '/api/v1/transaction-links';
+ console.log("POST!");
+ let url = "/api/v1/transaction-links";
return api.post(url, {
link_type_id: parseInt(linkTypeId),
inward_id: parseInt(inwardId),
outward_id: parseInt(outwardId),
- notes: notes
+ notes: notes,
});
}
-
}
diff --git a/resources/assets/v3/js/api/model/transaction/delete.js b/resources/assets/v3/js/api/model/transaction/delete.js
index 1a491ead3b..bfc184e101 100644
--- a/resources/assets/v3/js/api/model/transaction/delete.js
+++ b/resources/assets/v3/js/api/model/transaction/delete.js
@@ -18,11 +18,11 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
-import {api} from "../../../boot/axios";
+import { api } from "../../../boot/axios";
export default class Delete {
delete(id) {
- let url = '/api/v1/transactions/' + parseInt(id);
+ let url = "/api/v1/transactions/" + parseInt(id);
return api.delete(url);
}
}
diff --git a/resources/assets/v3/js/api/model/transaction/get.js b/resources/assets/v3/js/api/model/transaction/get.js
index 85dd2a4e87..d5347573b1 100644
--- a/resources/assets/v3/js/api/model/transaction/get.js
+++ b/resources/assets/v3/js/api/model/transaction/get.js
@@ -18,26 +18,31 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
-
-import {api} from "../../../boot/axios";
+import { api } from "../../../boot/axios";
export default class Get {
-
/**
*
* @param params
* @returns {Promise<AxiosResponse<any>>}
*/
list(params) {
- return api.get('/api/v1/transactions', {params: params});
+ return api.get("/api/v1/transactions", { params: params });
}
- show(id, params){
- return api.get('/api/v1/transactions/' + parseInt(id), {params: params});
+ show(id, params) {
+ return api.get("/api/v1/transactions/" + parseInt(id), {
+ params: params,
+ });
}
- showJournal(id, params){
- return api.get('/api/v1/transaction-journals/' + parseInt(id), {params: params});
+ showJournal(id, params) {
+ return api.get("/api/v1/transaction-journals/" + parseInt(id), {
+ params: params,
+ });
}
- transactionLinks(id, params){
- return api.get('/api/v1/transaction-journals/' + parseInt(id) + '/links', {params: params});
+ transactionLinks(id, params) {
+ return api.get(
+ "/api/v1/transaction-journals/" + parseInt(id) + "/links",
+ { params: params },
+ );
}
}
diff --git a/resources/assets/v3/js/api/model/transaction/post.js b/resources/assets/v3/js/api/model/transaction/post.js
index eed5340dc8..590584e44c 100644
--- a/resources/assets/v3/js/api/model/transaction/post.js
+++ b/resources/assets/v3/js/api/model/transaction/post.js
@@ -18,11 +18,11 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
-import {api} from "../../../boot/axios";
+import { api } from "../../../boot/axios";
export default class Post {
post(submission) {
- let url = '/api/v1/transactions';
+ let url = "/api/v1/transactions";
return api.post(url, submission);
}
}
diff --git a/resources/assets/v3/js/api/model/transaction/put.js b/resources/assets/v3/js/api/model/transaction/put.js
index 29885e8539..3455606c56 100644
--- a/resources/assets/v3/js/api/model/transaction/put.js
+++ b/resources/assets/v3/js/api/model/transaction/put.js
@@ -18,11 +18,11 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
-import {api} from "../../../boot/axios";
+import { api } from "../../../boot/axios";
export default class Put {
put(submission, params) {
- let url = '/api/v1/transactions/' + parseInt(params.id);
+ let url = "/api/v1/transactions/" + parseInt(params.id);
return api.put(url, submission);
}
}
diff --git a/resources/assets/v3/js/api/model/webhook/get.js b/resources/assets/v3/js/api/model/webhook/get.js
index 166abc7c74..6d05155756 100644
--- a/resources/assets/v3/js/api/model/webhook/get.js
+++ b/resources/assets/v3/js/api/model/webhook/get.js
@@ -18,24 +18,38 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
-
-import {api} from "../../../boot/axios";
+import { api } from "../../../boot/axios";
export default class Get {
- list(params){
- return api.get('/api/v1/webhooks', {params: params});
+ list(params) {
+ return api.get("/api/v1/webhooks", { params: params });
}
- show(id, params){
- return api.get('/api/v1/webhooks/' + parseInt(id), {params: params});
+ show(id, params) {
+ return api.get("/api/v1/webhooks/" + parseInt(id), { params: params });
}
- messages(id, params){
- return api.get('/api/v1/webhooks/' + parseInt(id) + '/messages', {params: params});
+ messages(id, params) {
+ return api.get("/api/v1/webhooks/" + parseInt(id) + "/messages", {
+ params: params,
+ });
}
- message(webhook, message, params){
- return api.get('/api/v1/webhooks/' + parseInt(webhook) + '/messages/' + parseInt(message), {params: params});
+ message(webhook, message, params) {
+ return api.get(
+ "/api/v1/webhooks/" +
+ parseInt(webhook) +
+ "/messages/" +
+ parseInt(message),
+ { params: params },
+ );
}
- attempts(webhook, message, params){
- return api.get('/api/v1/webhooks/' + parseInt(webhook) + '/messages/' + parseInt(message) + '/attempts', {params: params});
+ attempts(webhook, message, params) {
+ return api.get(
+ "/api/v1/webhooks/" +
+ parseInt(webhook) +
+ "/messages/" +
+ parseInt(message) +
+ "/attempts",
+ { params: params },
+ );
}
}
diff --git a/resources/assets/v3/js/api/model/webhook/post.js b/resources/assets/v3/js/api/model/webhook/post.js
index 6147215b63..903d9ff0d7 100644
--- a/resources/assets/v3/js/api/model/webhook/post.js
+++ b/resources/assets/v3/js/api/model/webhook/post.js
@@ -18,15 +18,21 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
-import {api} from "../../../boot/axios";
+import { api } from "../../../boot/axios";
export default class Post {
triggerTransaction(webhook, transaction) {
- return api.post('./api/v1/webhooks/' + webhook + '/trigger-transaction/' + transaction, {});
+ return api.post(
+ "./api/v1/webhooks/" +
+ webhook +
+ "/trigger-transaction/" +
+ transaction,
+ {},
+ );
}
post(submission) {
- let url = '/api/v1/webhooks/';
+ let url = "/api/v1/webhooks/";
return api.post(url, submission);
}
}
diff --git a/resources/assets/v3/js/api/model/webhook/put.js b/resources/assets/v3/js/api/model/webhook/put.js
index 70b33329d2..8fb0b2e5c5 100644
--- a/resources/assets/v3/js/api/model/webhook/put.js
+++ b/resources/assets/v3/js/api/model/webhook/put.js
@@ -18,11 +18,11 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
-import {api} from "../../../boot/axios";
+import { api } from "../../../boot/axios";
export default class Put {
put(submission, params) {
- let url = '/api/v1/webhooks/' + parseInt(params.id);
+ let url = "/api/v1/webhooks/" + parseInt(params.id);
return api.put(url, submission);
}
}
diff --git a/resources/assets/v3/js/api/preferences/index.js b/resources/assets/v3/js/api/preferences/index.js
index fec8d11f3d..fc00fb7b07 100644
--- a/resources/assets/v3/js/api/preferences/index.js
+++ b/resources/assets/v3/js/api/preferences/index.js
@@ -18,20 +18,20 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
-import {api} from "../../boot/axios";
+import { api } from "../../boot/axios";
export default class Preferences {
getByName(name) {
- return api.get('/api/v1/preferences/' + name);
+ return api.get("/api/v1/preferences/" + name);
}
getList(names) {
- return api.get('/api/v1/preferences-list/' + names);
+ return api.get("/api/v1/preferences-list/" + names);
}
getByNameNow(name) {
- return api.get('/api/v1/preferences/' + name);
+ return api.get("/api/v1/preferences/" + name);
}
postByName(name, value) {
- return api.post('/api/v1/preferences', {name: name, data: value});
+ return api.post("/api/v1/preferences", { name: name, data: value });
}
}
diff --git a/resources/assets/v3/js/api/preferences/post.js b/resources/assets/v3/js/api/preferences/post.js
index fa375c0975..082a735a50 100644
--- a/resources/assets/v3/js/api/preferences/post.js
+++ b/resources/assets/v3/js/api/preferences/post.js
@@ -18,11 +18,11 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
-import {api} from "../../boot/axios";
+import { api } from "../../boot/axios";
export default class Post {
post(name, value) {
- let url = '/api/v1/preferences';
- return api.post(url, {name: name, data: value});
+ let url = "/api/v1/preferences";
+ return api.post(url, { name: name, data: value });
}
}
diff --git a/resources/assets/v3/js/api/summary/index.js b/resources/assets/v3/js/api/summary/index.js
index 0744ce9070..d9053f8fc4 100644
--- a/resources/assets/v3/js/api/summary/index.js
+++ b/resources/assets/v3/js/api/summary/index.js
@@ -18,11 +18,12 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
-
-import {api} from "../../boot/axios.js";
+import { api } from "../../boot/axios.js";
export default class Summary {
get(start, end, code) {
- return api.get('/api/v1/summary/basic', {params: {start: start, end: end, code: code}});
+ return api.get("/api/v1/summary/basic", {
+ params: { start: start, end: end, code: code },
+ });
}
}
diff --git a/resources/assets/v3/js/api/user-group/get.js b/resources/assets/v3/js/api/user-group/get.js
index 9646c52895..76a2b4ed01 100644
--- a/resources/assets/v3/js/api/user-group/get.js
+++ b/resources/assets/v3/js/api/user-group/get.js
@@ -18,15 +18,15 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
-
-import {api} from "../../boot/axios";
+import { api } from "../../boot/axios";
export default class Get {
-
list(params) {
- return api.get('/api/v1/user-groups', {params: params});
+ return api.get("/api/v1/user-groups", { params: params });
}
get(id, params) {
- return api.get('/api/v1/user-groups/' + parseInt(id), {params: params});
+ return api.get("/api/v1/user-groups/" + parseInt(id), {
+ params: params,
+ });
}
}
diff --git a/resources/assets/v3/js/api/user-group/put.js b/resources/assets/v3/js/api/user-group/put.js
index 7b2c249a64..37d2687957 100644
--- a/resources/assets/v3/js/api/user-group/put.js
+++ b/resources/assets/v3/js/api/user-group/put.js
@@ -18,11 +18,11 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
-import {api} from "../../boot/axios";
+import { api } from "../../boot/axios";
export default class Put {
put(submission, params) {
- let url = '/api/v1/user-groups/' + parseInt(params.id);
+ let url = "/api/v1/user-groups/" + parseInt(params.id);
return api.put(url, submission);
}
}
diff --git a/resources/assets/v3/js/boot/axios.js b/resources/assets/v3/js/boot/axios.js
index 0a8687eb40..9f19aa09a5 100644
--- a/resources/assets/v3/js/boot/axios.js
+++ b/resources/assets/v3/js/boot/axios.js
@@ -18,7 +18,7 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
-import axios from 'axios'
+import axios from "axios";
// Be careful when using SSR for cross-request state pollution
// due to creating a Singleton instance here;
@@ -27,14 +27,12 @@ import axios from 'axios'
// "export default () => {}" function below (which runs individually
// for each client)
-
// for use inside Vue files (Options API) through this.$axios and this.$api
-
-const url = '/';
-const api = axios.create({baseURL: url, withCredentials: true});
+const url = "/";
+const api = axios.create({ baseURL: url, withCredentials: true });
axios.defaults.withCredentials = true;
axios.defaults.baseURL = url;
-export {api}
+export { api };
diff --git a/resources/assets/v3/js/boot/blank-bootstrap.js b/resources/assets/v3/js/boot/blank-bootstrap.js
index 3fb8d72a2b..d28e237d8a 100644
--- a/resources/assets/v3/js/boot/blank-bootstrap.js
+++ b/resources/assets/v3/js/boot/blank-bootstrap.js
@@ -19,7 +19,7 @@
*/
// JS
-import "bootstrap"
-import "admin-lte"
+import "bootstrap";
+import "admin-lte";
window.bootstrapped = false;
diff --git a/resources/assets/v3/js/boot/bootstrap.js b/resources/assets/v3/js/boot/bootstrap.js
index 1abccd71c5..9732d0dec4 100644
--- a/resources/assets/v3/js/boot/bootstrap.js
+++ b/resources/assets/v3/js/boot/bootstrap.js
@@ -19,148 +19,148 @@
*/
// JS
-import "bootstrap"
-import "admin-lte"
-import Alpine from 'alpinejs'
+import "bootstrap";
+import "admin-lte";
+import Alpine from "alpinejs";
import store from "../store/store.js";
-import axios from 'axios';
-import Shepherd from 'shepherd.js';
+import axios from "axios";
+import Shepherd from "shepherd.js";
import "cally";
-import {getFreshVariable} from "../store/get-fresh-variable.js";
-import {getVariables} from "../store/get-variables.js";
-import {getViewRange} from "../support/get-viewrange.js";
-import {loadTranslations} from "../support/load-translations.js";
+import { getFreshVariable } from "../store/get-fresh-variable.js";
+import { getVariables } from "../store/get-variables.js";
+import { getViewRange } from "../support/get-viewrange.js";
+import { loadTranslations } from "../support/load-translations.js";
import i18next from "i18next";
window.bootstrapped = false;
window.store = store;
-window.Alpine = Alpine
+window.Alpine = Alpine;
window.axios = axios;
-window.axios.defaults.headers.common['X-Requested-With'] = 'XMLHttpRequest';
+window.axios.defaults.headers.common["X-Requested-With"] = "XMLHttpRequest";
// always grab the preference "marker" from Firefly III.
-getFreshVariable('lastActivity').then((serverValue) => {
- if (null === serverValue) {
- console.log('Server value is null in getFreshVariable.');
- throw new Error('401 in getFreshVariable.');
- }
- const localValue = store.get('lastActivity');
- store.set('cacheValid', localValue === serverValue);
- store.set('lastActivity', serverValue);
- // console.log('Server value = ' + serverValue);
- // console.log('Local value: ' + localValue);
- // console.log('Cache valid: ' + (localValue === serverValue));
-}).then(() => {
- Promise.resolve(
- getVariables(['viewRange','darkMode','locale','language', 'convert_to_primary']),
- ).then((values) => {
- if (!store.get('start') || !store.get('end')) {
- // calculate new start and end, and store them.
- const range = getViewRange(values.viewRange, new Date);
- store.set('start', range.start);
- store.set('end', range.end);
+getFreshVariable("lastActivity")
+ .then((serverValue) => {
+ if (null === serverValue) {
+ console.log("Server value is null in getFreshVariable.");
+ throw new Error("401 in getFreshVariable.");
}
- //
- if('equal' === values.locale) {
- values.locale = values.language;
- }
-
- // save local in window.__ something
- window.__localeId__ = values.locale;
- store.set('language', values.language);
- store.set('locale', values.locale);
- loadTranslations(values.locale).then(() => {
- const event = new Event('firefly-iii-bootstrapped');
- document.dispatchEvent(event);
- window.bootstrapped = true;
- // console.log('Bootstrapped!');
-
- // page may have an introduction necessary to be played.
- if (!window.showTour) {
- return;
+ const localValue = store.get("lastActivity");
+ store.set("cacheValid", localValue === serverValue);
+ store.set("lastActivity", serverValue);
+ // console.log('Server value = ' + serverValue);
+ // console.log('Local value: ' + localValue);
+ // console.log('Cache valid: ' + (localValue === serverValue));
+ })
+ .then(() => {
+ Promise.resolve(
+ getVariables([
+ "viewRange",
+ "darkMode",
+ "locale",
+ "language",
+ "convert_to_primary",
+ ]),
+ ).then((values) => {
+ if (!store.get("start") || !store.get("end")) {
+ // calculate new start and end, and store them.
+ const range = getViewRange(values.viewRange, new Date());
+ store.set("start", range.start);
+ store.set("end", range.end);
+ }
+ //
+ if ("equal" === values.locale) {
+ values.locale = values.language;
}
- const url = '/';
- let site = axios.create({baseURL: url, withCredentials: true});
- axios.defaults.withCredentials = true;
- axios.defaults.baseURL = url;
-
- site.get(window.routeStepsUrl).then(function (data) {
- let hints = data.data;
- const tour = new Shepherd.Tour({
- useModalOverlay: true,
- defaultStepOptions: {
- // classes: 'shadow-md bg-purple-dark',
- scrollTo: true,
- cancelIcon: {
- enabled: true
- },
- }
- });
- // cancel or complete
- tour.on('cancel', () => {
- site.post(window.routeForFinishedTour);
- });
- tour.on('complete', () => {
- site.post(window.routeForFinishedTour);
+ // save local in window.__ something
+ window.__localeId__ = values.locale;
+ store.set("language", values.language);
+ store.set("locale", values.locale);
+ loadTranslations(values.locale).then(() => {
+ const event = new Event("firefly-iii-bootstrapped");
+ document.dispatchEvent(event);
+ window.bootstrapped = true;
+ // console.log('Bootstrapped!');
+
+ // page may have an introduction necessary to be played.
+ if (!window.showTour) {
+ return;
+ }
+ const url = "/";
+ let site = axios.create({
+ baseURL: url,
+ withCredentials: true,
});
-
- for (let i = 0; i < hints.length; i++) {
- if (Object.hasOwn(hints,i)) {
- let hint = hints[i];
-
- let buttons = [];
- if(i > 0) {
- buttons.push(
- {
- text: i18next.t('firefly.intro_prev_label'),
- action: tour.back
- }
- );
- }
- if(i < hints.length - 1) {
- buttons.push(
- {
- text: i18next.t('firefly.intro_next_label'),
- action: tour.next
- }
- );
- }
- if(i === hints.length - 1) {
- console.log('Add complete');
- buttons.push(
- {
- text: i18next.t('firefly.intro_done_label'),
- action: tour.complete
- }
- );
- }
-
- let step = {
- // id: 'example-step',
- text: hint.text,
- buttons: buttons
- };
- if (Object.hasOwn(hint, 'element')) {
- step.attachTo = {
- element: hint.element,
- on: hint.position
+ axios.defaults.withCredentials = true;
+ axios.defaults.baseURL = url;
+
+ site.get(window.routeStepsUrl).then(function (data) {
+ let hints = data.data;
+
+ const tour = new Shepherd.Tour({
+ useModalOverlay: true,
+ defaultStepOptions: {
+ // classes: 'shadow-md bg-purple-dark',
+ scrollTo: true,
+ cancelIcon: {
+ enabled: true,
+ },
+ },
+ });
+ // cancel or complete
+ tour.on("cancel", () => {
+ site.post(window.routeForFinishedTour);
+ });
+ tour.on("complete", () => {
+ site.post(window.routeForFinishedTour);
+ });
+
+ for (let i = 0; i < hints.length; i++) {
+ if (Object.hasOwn(hints, i)) {
+ let hint = hints[i];
+
+ let buttons = [];
+ if (i > 0) {
+ buttons.push({
+ text: i18next.t("firefly.intro_prev_label"),
+ action: tour.back,
+ });
+ }
+ if (i < hints.length - 1) {
+ buttons.push({
+ text: i18next.t("firefly.intro_next_label"),
+ action: tour.next,
+ });
+ }
+ if (i === hints.length - 1) {
+ console.log("Add complete");
+ buttons.push({
+ text: i18next.t("firefly.intro_done_label"),
+ action: tour.complete,
+ });
+ }
+
+ let step = {
+ // id: 'example-step',
+ text: hint.text,
+ buttons: buttons,
};
+ if (Object.hasOwn(hint, "element")) {
+ step.attachTo = {
+ element: hint.element,
+ on: hint.position,
+ };
+ }
+ tour.addStep(step);
}
- tour.addStep(step);
}
- }
- tour.start();
-
-
+ tour.start();
+ });
});
-
});
-
-
+ })
+ .catch((error) => {
+ console.error("Error while bootstrapping: " + error);
});
-}).catch((error) => {
- console.error('Error while bootstrapping: ' + error);
-});
-
diff --git a/resources/assets/v3/js/form/create-autocomplete.js b/resources/assets/v3/js/form/create-autocomplete.js
index 32fb4230d0..c87b49d5be 100644
--- a/resources/assets/v3/js/form/create-autocomplete.js
+++ b/resources/assets/v3/js/form/create-autocomplete.js
@@ -20,25 +20,25 @@
import Autocomplete from "bootstrap5-autocomplete";
-
function createAutocomplete(fieldIdentifier, url) {
- let token = document.querySelector('meta[name="csrf-token"]').getAttribute('content');
- Autocomplete.init('#' + fieldIdentifier, {
-
- server: url + '?_token=' + token,
- labelField: 'name',
- valueField: 'name',
- liveServer: true,
- fetchOptions: {
- method: 'GET',
- credentials: 'include',
- headers: {
- 'Content-Type': 'application/json',
- 'Accept': 'application/json',
- 'X-CSRF-TOKEN': token
- }
- }
- });
+ let token = document
+ .querySelector('meta[name="csrf-token"]')
+ .getAttribute("content");
+ Autocomplete.init("#" + fieldIdentifier, {
+ server: url + "?_token=" + token,
+ labelField: "name",
+ valueField: "name",
+ liveServer: true,
+ fetchOptions: {
+ method: "GET",
+ credentials: "include",
+ headers: {
+ "Content-Type": "application/json",
+ Accept: "application/json",
+ "X-CSRF-TOKEN": token,
+ },
+ },
+ });
}
-export {createAutocomplete}
+export { createAutocomplete };
diff --git a/resources/assets/v3/js/form/create-tag-field.js b/resources/assets/v3/js/form/create-tag-field.js
index ee27599505..3603b03a67 100644
--- a/resources/assets/v3/js/form/create-tag-field.js
+++ b/resources/assets/v3/js/form/create-tag-field.js
@@ -19,26 +19,26 @@
*/
import Tags from "bootstrap5-tags";
function createTagField(fieldIdentifier) {
- let token = document.querySelector('meta[name="csrf-token"]').getAttribute('content');
- Tags.init('#' + fieldIdentifier,
- {
- allowNew: true,
- allowClear: true,
- server: './api/v1/autocomplete/tags?_token=' + token,
- liveServer: true,
- labelField: 'name',
- valueField: 'name',
- fetchOptions: {
- method: 'GET',
- credentials: 'include',
- headers: {
- 'Content-Type': 'application/json',
- 'Accept': 'application/json',
- 'X-CSRF-TOKEN': token
- }
- }
- }
- );
+ let token = document
+ .querySelector('meta[name="csrf-token"]')
+ .getAttribute("content");
+ Tags.init("#" + fieldIdentifier, {
+ allowNew: true,
+ allowClear: true,
+ server: "./api/v1/autocomplete/tags?_token=" + token,
+ liveServer: true,
+ labelField: "name",
+ valueField: "name",
+ fetchOptions: {
+ method: "GET",
+ credentials: "include",
+ headers: {
+ "Content-Type": "application/json",
+ Accept: "application/json",
+ "X-CSRF-TOKEN": token,
+ },
+ },
+ });
}
-export {createTagField};
+export { createTagField };
diff --git a/resources/assets/v3/js/pages/accounts/create.js b/resources/assets/v3/js/pages/accounts/create.js
index a4de558593..21d39cf584 100644
--- a/resources/assets/v3/js/pages/accounts/create.js
+++ b/resources/assets/v3/js/pages/accounts/create.js
@@ -18,53 +18,62 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
-import '../../boot/bootstrap.js';
-import sidebar from '../../pages/shared/sidebar.js';
-import dates from '../shared/dates.js';
+import "../../boot/bootstrap.js";
+import sidebar from "../../pages/shared/sidebar.js";
+import dates from "../shared/dates.js";
import i18next from "i18next";
import Alpine from "alpinejs";
let create = function () {
return {
init() {
- let list = document.querySelectorAll('div.app-content form input[type="text"]:enabled');
- if(list.length > 0) {
+ let list = document.querySelectorAll(
+ 'div.app-content form input[type="text"]:enabled',
+ );
+ if (list.length > 0) {
list[0].focus();
}
- let el = document.getElementById('ffInput_liability_direction');
- if(null !== el) {
- el.addEventListener('change', (event) => {
+ let el = document.getElementById("ffInput_liability_direction");
+ if (null !== el) {
+ el.addEventListener("change", (event) => {
let direction = event.target.value;
- if ('credit' === direction) {
- document.querySelector('label[for="ffInput_opening_balance"]').textContent = i18next.t('firefly.i_am_owed_amount');
+ if ("credit" === direction) {
+ document.querySelector(
+ 'label[for="ffInput_opening_balance"]',
+ ).textContent = i18next.t("firefly.i_am_owed_amount");
}
- if ('debit' === direction) {
- document.querySelector('label[for="ffInput_opening_balance"]').textContent = i18next.t('firefly.i_owe_amount');
+ if ("debit" === direction) {
+ document.querySelector(
+ 'label[for="ffInput_opening_balance"]',
+ ).textContent = i18next.t("firefly.i_owe_amount");
}
});
// also change it the first time around
let direction = el.value;
- if ('credit' === direction) {
- document.querySelector('label[for="ffInput_opening_balance"]').textContent = i18next.t('firefly.i_am_owed_amount');
+ if ("credit" === direction) {
+ document.querySelector(
+ 'label[for="ffInput_opening_balance"]',
+ ).textContent = i18next.t("firefly.i_am_owed_amount");
}
- if ('debit' === direction) {
- document.querySelector('label[for="ffInput_opening_balance"]').textContent = i18next.t('firefly.i_owe_amount');
+ if ("debit" === direction) {
+ document.querySelector(
+ 'label[for="ffInput_opening_balance"]',
+ ).textContent = i18next.t("firefly.i_owe_amount");
}
}
- }
- }
+ },
+ };
};
-
const comps = {
create,
sidebar,
- dates
+ dates,
};
function loadPage(comps) {
// console.log('loadPage');
- Object.keys(comps).forEach(comp => {
+ Object.keys(comps).forEach((comp) => {
let data = comps[comp]();
Alpine.data(comp, () => data);
// console.log(comp);
@@ -73,7 +82,7 @@ function loadPage(comps) {
}
// wait for load until bootstrapped event is received.
-document.addEventListener('firefly-iii-bootstrapped', () => {
+document.addEventListener("firefly-iii-bootstrapped", () => {
// console.log('Loaded through event listener.');
loadPage(comps);
});
diff --git a/resources/assets/v3/js/pages/accounts/edit.js b/resources/assets/v3/js/pages/accounts/edit.js
index fd107db713..41394fffbb 100644
--- a/resources/assets/v3/js/pages/accounts/edit.js
+++ b/resources/assets/v3/js/pages/accounts/edit.js
@@ -18,53 +18,62 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
-import '../../boot/bootstrap.js';
-import sidebar from '../../pages/shared/sidebar.js';
-import dates from '../shared/dates.js';
+import "../../boot/bootstrap.js";
+import sidebar from "../../pages/shared/sidebar.js";
+import dates from "../shared/dates.js";
import i18next from "i18next";
import Alpine from "alpinejs";
let edit = function () {
return {
init() {
- let list = document.querySelectorAll('div.app-content form input[type="text"]:enabled');
- if(list.length > 0) {
+ let list = document.querySelectorAll(
+ 'div.app-content form input[type="text"]:enabled',
+ );
+ if (list.length > 0) {
list[0].focus();
}
- let el = document.getElementById('ffInput_liability_direction');
- if(null !== el) {
- el.addEventListener('change', (event) => {
+ let el = document.getElementById("ffInput_liability_direction");
+ if (null !== el) {
+ el.addEventListener("change", (event) => {
let direction = event.target.value;
- if ('credit' === direction) {
- document.querySelector('label[for="ffInput_opening_balance"]').textContent = i18next.t('firefly.i_am_owed_amount');
+ if ("credit" === direction) {
+ document.querySelector(
+ 'label[for="ffInput_opening_balance"]',
+ ).textContent = i18next.t("firefly.i_am_owed_amount");
}
- if ('debit' === direction) {
- document.querySelector('label[for="ffInput_opening_balance"]').textContent = i18next.t('firefly.i_owe_amount');
+ if ("debit" === direction) {
+ document.querySelector(
+ 'label[for="ffInput_opening_balance"]',
+ ).textContent = i18next.t("firefly.i_owe_amount");
}
});
// also change it the first time around
let direction = el.value;
- if ('credit' === direction) {
- document.querySelector('label[for="ffInput_opening_balance"]').textContent = i18next.t('firefly.i_am_owed_amount');
+ if ("credit" === direction) {
+ document.querySelector(
+ 'label[for="ffInput_opening_balance"]',
+ ).textContent = i18next.t("firefly.i_am_owed_amount");
}
- if ('debit' === direction) {
- document.querySelector('label[for="ffInput_opening_balance"]').textContent = i18next.t('firefly.i_owe_amount');
+ if ("debit" === direction) {
+ document.querySelector(
+ 'label[for="ffInput_opening_balance"]',
+ ).textContent = i18next.t("firefly.i_owe_amount");
}
}
- }
- }
+ },
+ };
};
-
const comps = {
edit,
sidebar,
- dates
+ dates,
};
function loadPage(comps) {
// console.log('loadPage');
- Object.keys(comps).forEach(comp => {
+ Object.keys(comps).forEach((comp) => {
let data = comps[comp]();
Alpine.data(comp, () => data);
// console.log(comp);
@@ -73,7 +82,7 @@ function loadPage(comps) {
}
// wait for load until bootstrapped event is received.
-document.addEventListener('firefly-iii-bootstrapped', () => {
+document.addEventListener("firefly-iii-bootstrapped", () => {
// console.log('Loaded through event listener.');
loadPage(comps);
});
diff --git a/resources/assets/v3/js/pages/administrations/edit.js b/resources/assets/v3/js/pages/administrations/edit.js
index 98b55d0ccd..43fc8782f9 100644
--- a/resources/assets/v3/js/pages/administrations/edit.js
+++ b/resources/assets/v3/js/pages/administrations/edit.js
@@ -18,21 +18,21 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
-import '../../boot/bootstrap.js';
-import sidebar from '../../pages/shared/sidebar.js';
-import dates from '../shared/dates.js';
+import "../../boot/bootstrap.js";
+import sidebar from "../../pages/shared/sidebar.js";
+import dates from "../shared/dates.js";
import i18next from "i18next";
-import Get from '../../api/model/currency/get.js';
-import GetUserGroup from '../../api/user-group/get.js';
-import Put from '../../api/user-group/put.js';
+import Get from "../../api/model/currency/get.js";
+import GetUserGroup from "../../api/user-group/get.js";
+import Put from "../../api/user-group/put.js";
import Alpine from "alpinejs";
let edit = function () {
return {
i18next: null,
- pageTitle: '',
+ pageTitle: "",
administration: {
- title: '',
+ title: "",
currency_id: 0,
},
currencies: [],
@@ -40,29 +40,31 @@ let edit = function () {
title: [],
currency_id: [],
},
- error_message: '',
- success_message: '',
+ error_message: "",
+ success_message: "",
init() {
this.i18next = i18next;
- const page = window.location.href.split('/');
+ const page = window.location.href.split("/");
const administrationId = parseInt(page[page.length - 1]);
this.downloadAdministration(administrationId);
},
downloadAdministration: function (id) {
- (new GetUserGroup).get(id, {}).then((response) => {
+ new GetUserGroup().get(id, {}).then((response) => {
let current = response.data.data;
this.administration = {
id: current.id,
title: current.attributes.title,
- currency_id: parseInt(current.attributes.primary_currency_id),
+ currency_id: parseInt(
+ current.attributes.primary_currency_id,
+ ),
currency_code: current.attributes.primary_currency_code,
currency_name: current.attributes.primary_currency_name,
};
this.pageTitle = this.administration.title;
});
- const params = {page:1, limit:1337};
- (new Get).list(params).then((response => {
+ const params = { page: 1, limit: 1337 };
+ new Get().list(params).then((response) => {
this.currencies = response.data.data.map((currency) => {
return {
id: currency.id,
@@ -70,18 +72,18 @@ let edit = function () {
name: currency.attributes.name,
};
});
- }));
+ });
},
submit: function (e) {
// reset messages
- this.error_message = '';
- this.success_message = '';
+ this.error_message = "";
+ this.success_message = "";
this.errors = {
title: [],
currency_id: [],
};
- document.getElementById('submitButton').disabled = true;
+ document.getElementById("submitButton").disabled = true;
// collect data
let data = {
@@ -90,19 +92,24 @@ let edit = function () {
};
// post!
- (new Put).put(data, {id: this.administration.id}).then((response) => {
- let administrationId = parseInt(response.data.data.id);
- window.location.href = './administrations?user_group_id=' + administrationId + '&message=updated';
- }).catch((error) => {
-
- this.error_message = error.response.data.message;
- this.errors.title = error.response.data.errors.title;
- this.errors.primary_currency_id = error.response.data.errors.primary_currency_id;
-
- // enable button again
- document.getElementById('submitButton').disabled = false;
+ new Put()
+ .put(data, { id: this.administration.id })
+ .then((response) => {
+ let administrationId = parseInt(response.data.data.id);
+ window.location.href =
+ "./administrations?user_group_id=" +
+ administrationId +
+ "&message=updated";
+ })
+ .catch((error) => {
+ this.error_message = error.response.data.message;
+ this.errors.title = error.response.data.errors.title;
+ this.errors.primary_currency_id =
+ error.response.data.errors.primary_currency_id;
- });
+ // enable button again
+ document.getElementById("submitButton").disabled = false;
+ });
if (e) {
e.preventDefault();
}
@@ -111,24 +118,23 @@ let edit = function () {
return this.errors[field].length > 0;
},
clearTitle: function () {
- this.administration.title = '';
+ this.administration.title = "";
},
handleInput() {
// this.$emit('input', this.administration.title);
},
- }
+ };
};
-
const comps = {
edit,
sidebar,
- dates
+ dates,
};
function loadPage(comps) {
- console.log('loadPage');
- Object.keys(comps).forEach(comp => {
+ console.log("loadPage");
+ Object.keys(comps).forEach((comp) => {
let data = comps[comp]();
Alpine.data(comp, () => data);
console.log(comp);
@@ -137,12 +143,12 @@ function loadPage(comps) {
}
// wait for load until bootstrapped event is received.
-document.addEventListener('firefly-iii-bootstrapped', () => {
- console.log('Loaded through event listener.');
+document.addEventListener("firefly-iii-bootstrapped", () => {
+ console.log("Loaded through event listener.");
loadPage(comps);
});
// or is bootstrapped before event is triggered.
if (window.bootstrapped) {
- console.log('Loaded through window variable.');
+ console.log("Loaded through window variable.");
loadPage(comps);
}
diff --git a/resources/assets/v3/js/pages/administrations/index.js b/resources/assets/v3/js/pages/administrations/index.js
index f4452ef8ea..648f658a12 100644
--- a/resources/assets/v3/js/pages/administrations/index.js
+++ b/resources/assets/v3/js/pages/administrations/index.js
@@ -19,10 +19,10 @@
*/
// CSS
-import '../../boot/bootstrap.js';
-import sidebar from '../../pages/shared/sidebar.js';
-import dates from '../shared/dates.js';
-import Get from '../../api/user-group/get.js';
+import "../../boot/bootstrap.js";
+import sidebar from "../../pages/shared/sidebar.js";
+import dates from "../shared/dates.js";
+import Get from "../../api/user-group/get.js";
import Alpine from "alpinejs";
let index = function () {
@@ -37,38 +37,45 @@ let index = function () {
},
downloadAdministrations: function (page) {
- (new Get).list({page: page}).then((response) => {
+ new Get().list({ page: page }).then((response) => {
for (let i in response.data.data) {
if (Object.hasOwn(response.data.data, i)) {
let current = response.data.data[i];
let administration = {
id: current.id,
title: current.attributes.title,
- currency_code: current.attributes.primary_currency_code,
- currency_name: current.attributes.primary_currency_name,
+ currency_code:
+ current.attributes.primary_currency_code,
+ currency_name:
+ current.attributes.primary_currency_name,
};
this.administrations.push(administration);
}
}
- if (response.data.meta.pagination.current_page < response.data.meta.pagination.total_pages) {
- this.downloadAdministrations(parseInt(response.data.meta.pagination.current_page) + 1);
+ if (
+ response.data.meta.pagination.current_page <
+ response.data.meta.pagination.total_pages
+ ) {
+ this.downloadAdministrations(
+ parseInt(response.data.meta.pagination.current_page) +
+ 1,
+ );
}
});
},
- }
+ };
};
-
const comps = {
index,
sidebar,
- dates
+ dates,
};
function loadPage(comps) {
- console.log('loadPage');
- Object.keys(comps).forEach(comp => {
+ console.log("loadPage");
+ Object.keys(comps).forEach((comp) => {
let data = comps[comp]();
Alpine.data(comp, () => data);
console.log(comp);
@@ -77,12 +84,12 @@ function loadPage(comps) {
}
// wait for load until bootstrapped event is received.
-document.addEventListener('firefly-iii-bootstrapped', () => {
- console.log('Loaded through event listener.');
+document.addEventListener("firefly-iii-bootstrapped", () => {
+ console.log("Loaded through event listener.");
loadPage(comps);
});
// or is bootstrapped before event is triggered.
if (window.bootstrapped) {
- console.log('Loaded through window variable.');
+ console.log("Loaded through window variable.");
loadPage(comps);
}
diff --git a/resources/assets/v3/js/pages/blank.js b/resources/assets/v3/js/pages/blank.js
index 90ff2e2ba4..bada338ef7 100644
--- a/resources/assets/v3/js/pages/blank.js
+++ b/resources/assets/v3/js/pages/blank.js
@@ -18,4 +18,4 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
-import '../boot/blank-bootstrap.js';
+import "../boot/blank-bootstrap.js";
diff --git a/resources/assets/v3/js/pages/dashboard/boxes.js b/resources/assets/v3/js/pages/dashboard/boxes.js
index ffb9eddbe0..86a62d5f81 100644
--- a/resources/assets/v3/js/pages/dashboard/boxes.js
+++ b/resources/assets/v3/js/pages/dashboard/boxes.js
@@ -18,46 +18,49 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
-
import Summary from "../../api/summary/index.js";
-import {format} from "date-fns";
-import {getVariables} from "../../store/get-variables.js";
+import { format } from "date-fns";
+import { getVariables } from "../../store/get-variables.js";
import formatMoney from "../../util/format-money.js";
-import {getCacheKey} from "../../support/get-cache-key.js";
-import {cleanupCache} from "../../support/cleanup-cache.js";
+import { getCacheKey } from "../../support/get-cache-key.js";
+import { cleanupCache } from "../../support/cleanup-cache.js";
let afterPromises = false;
export default () => ({
- balanceBox: {amounts: [], subtitles: []},
- billBox: {paid: [], unpaid: []},
- leftBox: {left: [], perDay: []},
- netBox: {net: []},
+ balanceBox: { amounts: [], subtitles: [] },
+ billBox: { paid: [], unpaid: [] },
+ leftBox: { left: [], perDay: [] },
+ netBox: { net: [] },
convertToPrimary: false,
loading: false,
boxData: null,
boxOptions: null,
eventListeners: {
- ['@convert-to-primary.window'](event){
+ ["@convert-to-primary.window"](event) {
this.convertToPrimary = event.detail;
this.accountList = [];
- console.log('I heard that! (dashboard/boxes)');
+ console.log("I heard that! (dashboard/boxes)");
this.boxData = null;
this.loadBoxes();
- }
+ },
},
getFreshData() {
- const start = new Date(window.store.get('start'));
- const end = new Date(window.store.get('end'));
+ const start = new Date(window.store.get("start"));
+ const end = new Date(window.store.get("end"));
// TODO cache key is hard coded, problem?
- const boxesCacheKey = getCacheKey('ds_boxes_data', {convertToPrimary: this.convertToPrimary, start: start, end: end});
+ const boxesCacheKey = getCacheKey("ds_boxes_data", {
+ convertToPrimary: this.convertToPrimary,
+ start: start,
+ end: end,
+ });
cleanupCache();
//const cacheValid = window.store.get('cacheValid');
let cachedData = window.store.get(boxesCacheKey);
const cacheValid = false; // force refresh
- if (cacheValid && typeof cachedData !== 'undefined') {
+ if (cacheValid && typeof cachedData !== "undefined") {
this.boxData = cachedData;
this.generateOptions(this.boxData);
@@ -66,79 +69,117 @@ export default () => ({
// get stuff
let getter = new Summary();
- getter.get(format(start, 'yyyy-MM-dd'), format(end, 'yyyy-MM-dd'), null).then((response) => {
- this.boxData = response.data;
- window.store.set(boxesCacheKey, response.data);
- this.generateOptions(this.boxData);
- }).catch(() => {
- console.error('Request gave error.');
- });
+ getter
+ .get(format(start, "yyyy-MM-dd"), format(end, "yyyy-MM-dd"), null)
+ .then((response) => {
+ this.boxData = response.data;
+ window.store.set(boxesCacheKey, response.data);
+ this.generateOptions(this.boxData);
+ })
+ .catch(() => {
+ console.error("Request gave error.");
+ });
},
generateOptions(data) {
- this.balanceBox = {amounts: [], subtitles: []};
- this.billBox = {paid: [], unpaid: []};
- this.leftBox = {left: [], perDay: []};
- this.netBox = {net: []};
+ this.balanceBox = { amounts: [], subtitles: [] };
+ this.billBox = { paid: [], unpaid: [] };
+ this.leftBox = { left: [], perDay: [] };
+ this.netBox = { net: [] };
let subtitles = {};
// process new content:
for (const i in data) {
if (Object.hasOwn(data, i)) {
const current = data[i];
- if (!Object.hasOwn(current,'key')) {
+ if (!Object.hasOwn(current, "key")) {
continue;
}
let key = current.key;
// console.log('NOT PRIMARY CURRENCY');
- if (key.startsWith('balance-in-')) {
- this.balanceBox.amounts.push(formatMoney(current.monetary_value, current.currency_code));
+ if (key.startsWith("balance-in-")) {
+ this.balanceBox.amounts.push(
+ formatMoney(
+ current.monetary_value,
+ current.currency_code,
+ ),
+ );
continue;
}
// spent info is used in subtitle:
- if (key.startsWith('spent-in-')) {
+ if (key.startsWith("spent-in-")) {
// prep subtitles (for later)
if (!Object.hasOwn(subtitles, current.currency_code)) {
- subtitles[current.currency_code] = '';
+ subtitles[current.currency_code] = "";
}
// append the amount spent.
subtitles[current.currency_code] =
subtitles[current.currency_code] +
- formatMoney(current.monetary_value, current.currency_code);
+ formatMoney(
+ current.monetary_value,
+ current.currency_code,
+ );
continue;
}
// earned info is used in subtitle:
- if (key.startsWith('earned-in-')) {
+ if (key.startsWith("earned-in-")) {
// prep subtitles (for later)
if (!Object.hasOwn(subtitles, current.currency_code)) {
- subtitles[current.currency_code] = '';
+ subtitles[current.currency_code] = "";
}
// prepend the amount earned.
subtitles[current.currency_code] =
- formatMoney(current.monetary_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.monetary_value, current.currency_code));
+ if (key.startsWith("bills-unpaid-in-")) {
+ this.billBox.unpaid.push(
+ formatMoney(
+ current.monetary_value,
+ current.currency_code,
+ ),
+ );
continue;
}
- if (key.startsWith('bills-paid-in-')) {
- this.billBox.paid.push(formatMoney(current.monetary_value, current.currency_code));
+ if (key.startsWith("bills-paid-in-")) {
+ 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.monetary_value, current.currency_code));
+ if (key.startsWith("left-to-spend-in-")) {
+ 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.monetary_value, current.currency_code));
+ if (key.startsWith("left-per-day-to-spend-in-")) {
+ this.leftBox.perDay.push(
+ formatMoney(
+ current.monetary_value,
+ current.currency_code,
+ ),
+ );
continue;
}
- if (key.startsWith('net-worth-in-')) {
- this.netBox.net.push(formatMoney(current.monetary_value, current.currency_code));
-
+ if (key.startsWith("net-worth-in-")) {
+ this.netBox.net.push(
+ formatMoney(
+ current.monetary_value,
+ current.currency_code,
+ ),
+ );
}
}
}
@@ -166,13 +207,13 @@ export default () => ({
init() {
// console.log('boxes init');
// TODO can be replaced by "getVariables"
- getVariables(['convert_to_primary']).then((values) => {
+ getVariables(["convert_to_primary"]).then((values) => {
// console.log('boxes after promises');
afterPromises = true;
this.convertToPrimary = values[0];
this.loadBoxes();
});
- window.store.observe('end', () => {
+ window.store.observe("end", () => {
if (!afterPromises) {
return;
}
@@ -180,7 +221,7 @@ export default () => ({
this.boxData = null;
this.loadBoxes();
});
- window.store.observe('convert_to_primary', (newValue) => {
+ window.store.observe("convert_to_primary", (newValue) => {
if (!afterPromises) {
return;
}
diff --git a/resources/assets/v3/js/pages/dashboard/dashboard.js b/resources/assets/v3/js/pages/dashboard/dashboard.js
index cb9963911c..a68769a946 100644
--- a/resources/assets/v3/js/pages/dashboard/dashboard.js
+++ b/resources/assets/v3/js/pages/dashboard/dashboard.js
@@ -18,31 +18,30 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
-import '../../boot/bootstrap.js';
-import sidebar from '../../pages/shared/sidebar.js';
-import dates from '../shared/dates.js';
-import boxes from './boxes.js';
+import "../../boot/bootstrap.js";
+import sidebar from "../../pages/shared/sidebar.js";
+import dates from "../shared/dates.js";
+import boxes from "./boxes.js";
import Alpine from "alpinejs";
let index = function () {
return {
init() {
- console.log('Dashboard');
- }
- }
+ console.log("Dashboard");
+ },
+ };
};
-
const comps = {
index,
sidebar,
boxes,
- dates
+ dates,
};
function loadPage(comps) {
- console.log('loadPage');
- Object.keys(comps).forEach(comp => {
+ console.log("loadPage");
+ Object.keys(comps).forEach((comp) => {
let data = comps[comp]();
Alpine.data(comp, () => data);
// console.log(comp);
@@ -51,12 +50,12 @@ function loadPage(comps) {
}
// wait for load until bootstrapped event is received.
-document.addEventListener('firefly-iii-bootstrapped', () => {
- console.log('Loaded through event listener.');
+document.addEventListener("firefly-iii-bootstrapped", () => {
+ console.log("Loaded through event listener.");
loadPage(comps);
});
// or is bootstrapped before event is triggered.
if (window.bootstrapped) {
- console.log('Loaded through window variable.');
+ console.log("Loaded through window variable.");
loadPage(comps);
}
diff --git a/resources/assets/v3/js/pages/exchange-rates/index.js b/resources/assets/v3/js/pages/exchange-rates/index.js
index 98f9552e20..13f97d7cdc 100644
--- a/resources/assets/v3/js/pages/exchange-rates/index.js
+++ b/resources/assets/v3/js/pages/exchange-rates/index.js
@@ -19,12 +19,12 @@
*/
// CSS
-import '../../boot/bootstrap.js';
-import sidebar from '../../pages/shared/sidebar.js';
-import dates from '../shared/dates.js';
+import "../../boot/bootstrap.js";
+import sidebar from "../../pages/shared/sidebar.js";
+import dates from "../shared/dates.js";
import i18next from "i18next";
-import Alpine from 'alpinejs';
-import Get from '../../api/model/currency/get.js';
+import Alpine from "alpinejs";
+import Get from "../../api/model/currency/get.js";
let index = function () {
return {
@@ -32,7 +32,7 @@ let index = function () {
page: 1,
i18next: null,
init() {
- this.i18next = i18next;
+ this.i18next = i18next;
this.getCurrencies();
},
getCurrencies: function () {
@@ -41,7 +41,7 @@ let index = function () {
this.downloadCurrencies(1);
},
downloadCurrencies: function (page) {
- (new Get).list({enabled: 1, page: page}).then((response) => {
+ new Get().list({ enabled: 1, page: page }).then((response) => {
for (let i in response.data.data) {
if (Object.hasOwn(response.data.data, i)) {
let current = response.data.data[i];
@@ -56,24 +56,29 @@ let index = function () {
}
}
- if (response.data.meta.pagination.current_page < response.data.meta.pagination.total_pages) {
- this.downloadCurrencies(parseInt(response.data.meta.pagination.current_page) + 1);
+ if (
+ response.data.meta.pagination.current_page <
+ response.data.meta.pagination.total_pages
+ ) {
+ this.downloadCurrencies(
+ parseInt(response.data.meta.pagination.current_page) +
+ 1,
+ );
}
});
},
- }
+ };
};
-
const comps = {
index,
sidebar,
- dates
+ dates,
};
function loadPage(comps) {
- console.log('loadPage');
- Object.keys(comps).forEach(comp => {
+ console.log("loadPage");
+ Object.keys(comps).forEach((comp) => {
let data = comps[comp]();
Alpine.data(comp, () => data);
console.log(comp);
@@ -82,12 +87,12 @@ function loadPage(comps) {
}
// wait for load until bootstrapped event is received.
-document.addEventListener('firefly-iii-bootstrapped', () => {
- console.log('Loaded through event listener.');
+document.addEventListener("firefly-iii-bootstrapped", () => {
+ console.log("Loaded through event listener.");
loadPage(comps);
});
// or is bootstrapped before event is triggered.
if (window.bootstrapped) {
- console.log('Loaded through window variable.');
+ console.log("Loaded through window variable.");
loadPage(comps);
}
diff --git a/resources/assets/v3/js/pages/exchange-rates/rates.js b/resources/assets/v3/js/pages/exchange-rates/rates.js
index 6cc81aa41f..5fd09547e6 100644
--- a/resources/assets/v3/js/pages/exchange-rates/rates.js
+++ b/resources/assets/v3/js/pages/exchange-rates/rates.js
@@ -19,33 +19,33 @@
*/
// CSS
-import '../../boot/bootstrap.js';
-import sidebar from '../../pages/shared/sidebar.js';
-import dates from '../shared/dates.js';
+import "../../boot/bootstrap.js";
+import sidebar from "../../pages/shared/sidebar.js";
+import dates from "../shared/dates.js";
import format from "date-fns/format";
import i18next from "i18next";
-import Post from '../../api/model/exchange-rate/post.js';
-import Put from '../../api/model/exchange-rate/put.js';
-import Delete from '../../api/model/exchange-rate/delete.js';
-import Get from '../../api/model/currency/get.js';
-import GetRate from '../../api/model/exchange-rate/get.js';
-import Alpine from 'alpinejs';
+import Post from "../../api/model/exchange-rate/post.js";
+import Put from "../../api/model/exchange-rate/put.js";
+import Delete from "../../api/model/exchange-rate/delete.js";
+import Get from "../../api/model/currency/get.js";
+import GetRate from "../../api/model/exchange-rate/get.js";
+import Alpine from "alpinejs";
let rates = function () {
return {
- newDate: '',
- newRate: '1.0',
- newError: '',
+ newDate: "",
+ newRate: "1.0",
+ newError: "",
rates: [],
tempRates: {},
- from_code: '',
- to_code: '',
+ from_code: "",
+ to_code: "",
i18next: null,
from: {
- name: ''
+ name: "",
},
to: {
- name: ''
+ name: "",
},
loading: true,
posting: false,
@@ -54,17 +54,19 @@ let rates = function () {
totalPages: 1,
init() {
this.i18next = i18next;
- this.newDate = format(new Date, 'yyyy-MM-dd');
- let parts = window.location.pathname.split('/');
+ this.newDate = format(new Date(), "yyyy-MM-dd");
+ let parts = window.location.pathname.split("/");
this.from_code = parts[parts.length - 2].toUpperCase();
this.to_code = parts[parts.length - 1].toUpperCase();
- const params = new Proxy(new URLSearchParams(window.location.search), {
- get: (searchParams, prop) => searchParams.get(prop),
- });
+ const params = new Proxy(
+ new URLSearchParams(window.location.search),
+ {
+ get: (searchParams, prop) => searchParams.get(prop),
+ },
+ );
this.page = parseInt(params.page ?? 1);
-
this.downloadCurrencies();
this.rates = [];
this.downloadRates(this.page);
@@ -72,76 +74,90 @@ let rates = function () {
submitRate: function (e) {
if (e) e.preventDefault();
this.posting = true;
- (new Post).post({
- from: this.from_code,
- to: this.to_code,
- rate: this.newRate,
- date: this.newDate,
- }).then(() => {
- this.posting = false;
- this.downloadRates(1);
- }).catch((err) => {
- this.posting = false;
- this.newError = err.response.data.message;
- });
-
+ new Post()
+ .post({
+ from: this.from_code,
+ to: this.to_code,
+ rate: this.newRate,
+ date: this.newDate,
+ })
+ .then(() => {
+ this.posting = false;
+ this.downloadRates(1);
+ })
+ .catch((err) => {
+ this.posting = false;
+ this.newError = err.response.data.message;
+ });
return false;
},
saveButtonDisabled: function (index) {
- return ('' === this.rates[index].rate && '' === this.rates[index].inverse) || this.updating;
+ return (
+ ("" === this.rates[index].rate &&
+ "" === this.rates[index].inverse) ||
+ this.updating
+ );
},
updateRate: function (index) {
let parts = this.spliceKey(this.rates[index].key);
if (0 === parts.length) {
return;
}
- console.log('These are the parts', parts);
- if ('' !== this.rates[index].rate) {
+ console.log("These are the parts", parts);
+ if ("" !== this.rates[index].rate) {
//console.log('[a] Rate info is', this.rates[index]);
this.updating = true;
if (0 === parseInt(this.rates[index].rate_id)) {
- console.log('[a] POST, not PUT.');
- (new Post).post(
- {
+ console.log("[a] POST, not PUT.");
+ new Post()
+ .post({
from: this.from_code,
to: this.to_code,
rate: this.rates[index].rate,
- date: this.rates[index].date_field
+ date: this.rates[index].date_field,
})
.then(() => {
this.updating = false;
});
}
if (0 !== parseInt(this.rates[index].rate_id)) {
- console.log('[a] PUT, not POST.');
- (new Put).put({rate: this.rates[index].rate}, {id: this.rates[index].rate_id})
+ console.log("[a] PUT, not POST.");
+ new Put()
+ .put(
+ { rate: this.rates[index].rate },
+ { id: this.rates[index].rate_id },
+ )
.then(() => {
this.updating = false;
});
}
}
- if ('' !== this.rates[index].inverse) {
+ if ("" !== this.rates[index].inverse) {
//console.log('[b] Rate info is', this.rates[index]);
this.updating = true;
if (0 === parseInt(this.rates[index].inverse_id)) {
- console.log('[b] POST, not PUT.');
+ console.log("[b] POST, not PUT.");
// post, not put
- (new Post).post(
- {
+ new Post()
+ .post({
// remember, this is in reverse.
from: this.to_code,
to: this.from_code,
rate: this.rates[index].inverse,
- date: this.rates[index].date_field
+ date: this.rates[index].date_field,
})
.then(() => {
this.updating = false;
});
}
if (0 !== parseInt(this.rates[index].inverse_id)) {
- console.log('[b] PUT, not POST.');
- (new Put).put({rate: this.rates[index].inverse}, {id: this.rates[index].inverse_id})
+ console.log("[b] PUT, not POST.");
+ new Put()
+ .put(
+ { rate: this.rates[index].inverse },
+ { id: this.rates[index].inverse_id },
+ )
.then(() => {
this.updating = false;
});
@@ -159,10 +175,10 @@ let rates = function () {
let inverseId = parseInt(this.rates[index].inverse_id);
// delete A to B
if (rateId > 0) {
- (new Delete).delete(rateId);
+ new Delete().delete(rateId);
}
if (inverseId > 0) {
- (new Delete).delete(inverseId);
+ new Delete().delete(inverseId);
}
this.rates.splice(index, 1);
@@ -172,7 +188,7 @@ let rates = function () {
if (key.length !== 18) {
return [];
}
- let main = key.split('_');
+ let main = key.split("_");
if (3 !== main.length) {
return [];
}
@@ -184,103 +200,139 @@ let rates = function () {
};
},
downloadCurrencies: function () {
- console.log('Now downloading currencies.');
+ console.log("Now downloading currencies.");
this.loading = true;
- (new Get).get(this.from_code).then((response) => {
+ new Get().get(this.from_code).then((response) => {
this.from = {
id: response.data.data.id,
code: response.data.data.attributes.code,
name: response.data.data.attributes.name,
- }
+ };
});
- (new Get).get(this.to_code).then((response) => {
+ new Get().get(this.to_code).then((response) => {
// console.log(response.data.data);
this.to = {
id: response.data.data.id,
code: response.data.data.attributes.code,
name: response.data.data.attributes.name,
- }
+ };
});
},
downloadRates: function (page) {
this.tempRates = {};
this.loading = true;
- console.log('Now downloading rates.', page);
- (new GetRate).get(this.from_code, this.to_code, {page:page}).then((response) => {
- for (let i in response.data.data) {
- if (Object.hasOwn(response.data.data, i)) {
- console.log('Downloaded entry #' + i);
- let current = response.data.data[i];
- let date = new Date(current.attributes.date);
- let from_code = current.attributes.from_currency_code.toUpperCase();
- let to_code = current.attributes.to_currency_code.toUpperCase();
- let rate = current.attributes.rate;
- let inverse = '';
- let rate_id = current.id;
- let inverse_id = '0';
- let key = from_code + '_' + to_code + '_' + format(date, 'yyyy-MM-dd');
- console.log('Key is now "' + key + '"');
+ console.log("Now downloading rates.", page);
+ new GetRate()
+ .get(this.from_code, this.to_code, { page: page })
+ .then((response) => {
+ for (let i in response.data.data) {
+ if (Object.hasOwn(response.data.data, i)) {
+ console.log("Downloaded entry #" + i);
+ let current = response.data.data[i];
+ let date = new Date(current.attributes.date);
+ let from_code =
+ current.attributes.from_currency_code.toUpperCase();
+ let to_code =
+ current.attributes.to_currency_code.toUpperCase();
+ let rate = current.attributes.rate;
+ let inverse = "";
+ let rate_id = current.id;
+ let inverse_id = "0";
+ let key =
+ from_code +
+ "_" +
+ to_code +
+ "_" +
+ format(date, "yyyy-MM-dd");
+ console.log('Key is now "' + key + '"');
- // perhaps the returned rate is actually the inverse rate.
- if (from_code === this.to_code && to_code === this.from_code) {
- // console.log('Inverse rate found!');
- key = to_code + '_' + from_code + '_' + format(date, 'yyyy-MM-dd');
- rate = '';
- // new: set rate id to zero.
- rate_id = '0';
- inverse = current.attributes.rate;
- inverse_id = current.id;
- console.log('Key updated to "' + key + '"');
- }
+ // perhaps the returned rate is actually the inverse rate.
+ if (
+ from_code === this.to_code &&
+ to_code === this.from_code
+ ) {
+ // console.log('Inverse rate found!');
+ key =
+ to_code +
+ "_" +
+ from_code +
+ "_" +
+ format(date, "yyyy-MM-dd");
+ rate = "";
+ // new: set rate id to zero.
+ rate_id = "0";
+ inverse = current.attributes.rate;
+ inverse_id = current.id;
+ console.log('Key updated to "' + key + '"');
+ }
- if (!Object.hasOwn(this.tempRates, key)) {
- console.log('New entry stored');
- this.tempRates[key] = {
- key: key,
- date: date,
- rate_id: rate_id,
- inverse_id: inverse_id,
- date_formatted: format(date, this.i18next.t('config.date_time_fns')),
- date_field: current.attributes.date.substring(0, 10),
- rate: rate,
- inverse: '',
- };
- }
+ if (!Object.hasOwn(this.tempRates, key)) {
+ console.log("New entry stored");
+ this.tempRates[key] = {
+ key: key,
+ date: date,
+ rate_id: rate_id,
+ inverse_id: inverse_id,
+ date_formatted: format(
+ date,
+ this.i18next.t("config.date_time_fns"),
+ ),
+ date_field:
+ current.attributes.date.substring(
+ 0,
+ 10,
+ ),
+ rate: rate,
+ inverse: "",
+ };
+ }
- // inverse is not "" and existing inverse is ""?
- if (Object.hasOwn(this.tempRates, key) && inverse !== '' && this.tempRates[key].inverse === '') {
- this.tempRates[key].inverse = inverse;
- this.tempRates[key].inverse_id = inverse_id;
+ // inverse is not "" and existing inverse is ""?
+ if (
+ Object.hasOwn(this.tempRates, key) &&
+ inverse !== "" &&
+ this.tempRates[key].inverse === ""
+ ) {
+ this.tempRates[key].inverse = inverse;
+ this.tempRates[key].inverse_id = inverse_id;
+ }
+ // rate is not "" and existing rate is ""?
+ if (
+ Object.hasOwn(this.tempRates, key) &&
+ rate !== "" &&
+ this.tempRates[key].rate === ""
+ ) {
+ this.tempRates[key].rate = rate;
+ this.tempRates[key].rate_id = rate_id;
+ }
+ console.log(
+ "Found exchange rate #" +
+ this.tempRates[key].rate_id +
+ " with inverse #" +
+ this.tempRates[key].inverse_id,
+ );
}
- // rate is not "" and existing rate is ""?
- if (Object.hasOwn(this.tempRates, key) && rate !== '' && this.tempRates[key].rate === '') {
- this.tempRates[key].rate = rate;
- this.tempRates[key].rate_id = rate_id;
- }
- console.log('Found exchange rate #' + this.tempRates[key].rate_id + ' with inverse #' + this.tempRates[key].inverse_id);
-
-
}
- }
- this.totalPages = parseInt(response.data.meta.pagination.total_pages);
- this.loading = false;
- this.rates = Object.values(this.tempRates);
- // console.log('Do not download more pages. Now on page ' + this.page + ' of ' + this.totalPages);
- });
- }
- }
+ this.totalPages = parseInt(
+ response.data.meta.pagination.total_pages,
+ );
+ this.loading = false;
+ this.rates = Object.values(this.tempRates);
+ // console.log('Do not download more pages. Now on page ' + this.page + ' of ' + this.totalPages);
+ });
+ },
+ };
};
-
const comps = {
rates,
sidebar,
- dates
+ dates,
};
function loadPage(comps) {
- console.log('loadPage');
- Object.keys(comps).forEach(comp => {
+ console.log("loadPage");
+ Object.keys(comps).forEach((comp) => {
let data = comps[comp]();
Alpine.data(comp, () => data);
console.log(comp);
@@ -289,12 +341,12 @@ function loadPage(comps) {
}
// wait for load until bootstrapped event is received.
-document.addEventListener('firefly-iii-bootstrapped', () => {
- console.log('Loaded through event listener.');
+document.addEventListener("firefly-iii-bootstrapped", () => {
+ console.log("Loaded through event listener.");
loadPage(comps);
});
// or is bootstrapped before event is triggered.
if (window.bootstrapped) {
- console.log('Loaded through window variable.');
+ console.log("Loaded through window variable.");
loadPage(comps);
}
diff --git a/resources/assets/v3/js/pages/flush.js b/resources/assets/v3/js/pages/flush.js
index 9eebc34751..ede46d8110 100644
--- a/resources/assets/v3/js/pages/flush.js
+++ b/resources/assets/v3/js/pages/flush.js
@@ -18,8 +18,8 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
-import '../boot/blank-bootstrap.js';
-window.onload = function(){
+import "../boot/blank-bootstrap.js";
+window.onload = function () {
localStorage.clear();
- window.location = document.getElementsByTagName('base')[0].href;
-}
+ window.location = document.getElementsByTagName("base")[0].href;
+};
diff --git a/resources/assets/v3/js/pages/generic-nodates.js b/resources/assets/v3/js/pages/generic-nodates.js
index 70cbcb55b9..919660de1e 100644
--- a/resources/assets/v3/js/pages/generic-nodates.js
+++ b/resources/assets/v3/js/pages/generic-nodates.js
@@ -18,36 +18,37 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
-import '../boot/bootstrap.js';
-import sidebar from '../pages/shared/sidebar.js';
-import dates from './shared/dates.js';
-import Alpine from 'alpinejs';
+import "../boot/bootstrap.js";
+import sidebar from "../pages/shared/sidebar.js";
+import dates from "./shared/dates.js";
+import Alpine from "alpinejs";
window.enableDates = false;
let index = function () {
return {
init() {
- (function() {
- let list = document.querySelectorAll('div.app-content form input[type="text"]:enabled');
+ (function () {
+ let list = document.querySelectorAll(
+ 'div.app-content form input[type="text"]:enabled',
+ );
if (list.length > 0) {
list[0].focus();
}
})();
- }
- }
+ },
+ };
};
-
const comps = {
index,
sidebar,
- dates
+ dates,
};
function loadPage(comps) {
// console.log('loadPage');
- Object.keys(comps).forEach(comp => {
+ Object.keys(comps).forEach((comp) => {
let data = comps[comp]();
Alpine.data(comp, () => data);
// console.log(comp);
@@ -56,7 +57,7 @@ function loadPage(comps) {
}
// wait for load until bootstrapped event is received.
-document.addEventListener('firefly-iii-bootstrapped', () => {
+document.addEventListener("firefly-iii-bootstrapped", () => {
// console.log('Loaded through event listener.');
loadPage(comps);
});
diff --git a/resources/assets/v3/js/pages/generic.js b/resources/assets/v3/js/pages/generic.js
index e4e4c46aa9..16517c3846 100644
--- a/resources/assets/v3/js/pages/generic.js
+++ b/resources/assets/v3/js/pages/generic.js
@@ -18,36 +18,37 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
-import '../boot/bootstrap.js';
-import sidebar from '../pages/shared/sidebar.js';
-import dates from './shared/dates.js';
-import Alpine from 'alpinejs';
+import "../boot/bootstrap.js";
+import sidebar from "../pages/shared/sidebar.js";
+import dates from "./shared/dates.js";
+import Alpine from "alpinejs";
window.enableDates = true;
let index = function () {
return {
init() {
- (function() {
- let list = document.querySelectorAll('div.app-content form input[type="text"]:enabled');
+ (function () {
+ let list = document.querySelectorAll(
+ 'div.app-content form input[type="text"]:enabled',
+ );
if (list.length > 0) {
list[0].focus();
}
})();
- }
- }
+ },
+ };
};
-
const comps = {
index,
sidebar,
- dates
+ dates,
};
function loadPage(comps) {
// console.log('loadPage');
- Object.keys(comps).forEach(comp => {
+ Object.keys(comps).forEach((comp) => {
let data = comps[comp]();
Alpine.data(comp, () => data);
// console.log(comp);
@@ -56,7 +57,7 @@ function loadPage(comps) {
}
// wait for load until bootstrapped event is received.
-document.addEventListener('firefly-iii-bootstrapped', () => {
+document.addEventListener("firefly-iii-bootstrapped", () => {
// console.log('Loaded through event listener.');
loadPage(comps);
});
diff --git a/resources/assets/v3/js/pages/piggy-banks/show.js b/resources/assets/v3/js/pages/piggy-banks/show.js
index 872d3706af..3bfa7b77e2 100644
--- a/resources/assets/v3/js/pages/piggy-banks/show.js
+++ b/resources/assets/v3/js/pages/piggy-banks/show.js
@@ -18,12 +18,12 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
-import '../../boot/bootstrap.js';
-import sidebar from '../../pages/shared/sidebar.js';
-import dates from '../shared/dates.js';
+import "../../boot/bootstrap.js";
+import sidebar from "../../pages/shared/sidebar.js";
+import dates from "../shared/dates.js";
import i18next from "i18next";
-import {drawSingleCurrencyChart} from '../../shared/draw-chart.js';
-import {getVariable} from "../../store/get-variable.js";
+import { drawSingleCurrencyChart } from "../../shared/draw-chart.js";
+import { getVariable } from "../../store/get-variable.js";
import Alpine from "alpinejs";
window.enableDates = false;
@@ -33,32 +33,35 @@ let show = function () {
init() {
// console.log('Generic JS for page with few features.');
//const ctx = document.getElementById('piggy-bank-history');
- getVariable('anonymous').then((value) => {
- const page = window.location.href.split('/');
+ getVariable("anonymous").then((value) => {
+ const page = window.location.href.split("/");
const piggyBankID = parseInt(page[page.length - 1]);
- drawSingleCurrencyChart('line', 'chart/piggy-bank/' + piggyBankID, 'piggy-bank-history', value);
+ drawSingleCurrencyChart(
+ "line",
+ "chart/piggy-bank/" + piggyBankID,
+ "piggy-bank-history",
+ value,
+ );
});
-
},
confirmHistoryRemoval() {
- if(confirm(i18next.t('firefly.reset_history_confirm'))) {
- document.getElementById('reset-form').submit()
+ if (confirm(i18next.t("firefly.reset_history_confirm"))) {
+ document.getElementById("reset-form").submit();
}
return false;
- }
- }
+ },
+ };
};
-
const comps = {
show,
sidebar,
- dates
+ dates,
};
function loadPage(comps) {
// console.log('loadPage');
- Object.keys(comps).forEach(comp => {
+ Object.keys(comps).forEach((comp) => {
let data = comps[comp]();
Alpine.data(comp, () => data);
// console.log(comp);
@@ -67,7 +70,7 @@ function loadPage(comps) {
}
// wait for load until bootstrapped event is received.
-document.addEventListener('firefly-iii-bootstrapped', () => {
+document.addEventListener("firefly-iii-bootstrapped", () => {
// console.log('Loaded through event listener.');
loadPage(comps);
});
diff --git a/resources/assets/v3/js/pages/profile/oauth.js b/resources/assets/v3/js/pages/profile/oauth.js
index bd1f376fe7..6113ebb19b 100644
--- a/resources/assets/v3/js/pages/profile/oauth.js
+++ b/resources/assets/v3/js/pages/profile/oauth.js
@@ -18,13 +18,13 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
-import '../../boot/bootstrap.js';
-import sidebar from '../../pages/shared/sidebar.js';
-import dates from '../shared/dates.js';
+import "../../boot/bootstrap.js";
+import sidebar from "../../pages/shared/sidebar.js";
+import dates from "../shared/dates.js";
import i18next from "i18next";
-import {api} from "../../boot/axios";
-import {Modal} from 'bootstrap';
-import Alpine from 'alpinejs';
+import { api } from "../../boot/axios";
+import { Modal } from "bootstrap";
+import Alpine from "alpinejs";
let index = function () {
return {
@@ -35,15 +35,15 @@ let index = function () {
createForm: {
errors: [],
- name: '',
- redirect_uris: '',
- confidential: true
+ name: "",
+ redirect_uris: "",
+ confidential: true,
},
editForm: {
errors: [],
- name: '',
- redirect_uris: ''
+ name: "",
+ redirect_uris: "",
},
accessToken: null,
@@ -52,33 +52,39 @@ let index = function () {
scopes: [],
form: {
- name: '',
+ name: "",
scopes: [],
- errors: []
+ errors: [],
},
// showCreateTokenForm
-
init() {
this.i18next = i18next;
this.getClients();
this.getTokens();
- document.getElementById('modal-create-token').addEventListener('shown.bs.modal', () => {
- document.getElementById('create-token-name').focus();
- });
- document.getElementById('modal-create-client').addEventListener('shown.bs.modal', () => {
- document.getElementById('create-client-name').focus();
- });
- document.getElementById('modal-client-secret').addEventListener('shown.bs.modal', () => {
- setTimeout(() => {
- document.getElementById('secret_box').focus();
- }, 100);
-
- });
+ document
+ .getElementById("modal-create-token")
+ .addEventListener("shown.bs.modal", () => {
+ document.getElementById("create-token-name").focus();
+ });
+ document
+ .getElementById("modal-create-client")
+ .addEventListener("shown.bs.modal", () => {
+ document.getElementById("create-client-name").focus();
+ });
+ document
+ .getElementById("modal-client-secret")
+ .addEventListener("shown.bs.modal", () => {
+ setTimeout(() => {
+ document.getElementById("secret_box").focus();
+ }, 100);
+ });
- document.getElementById('modal-edit-client').addEventListener('shown.bs.modal', () => {
- document.getElementById('edit-client-name').focus();
- });
+ document
+ .getElementById("modal-edit-client")
+ .addEventListener("shown.bs.modal", () => {
+ document.getElementById("edit-client-name").focus();
+ });
const textBox = document.getElementById("secret_box");
textBox.onfocus = function () {
textBox.select();
@@ -107,78 +113,83 @@ let index = function () {
* Get all of the personal access tokens for the user.
*/
getTokens() {
- console.log('getTokens()');
- api.get('./oauth/personal-access-tokens')
- .then(response => {
- console.log(response.data);
- this.tokens = response.data;
- });
+ console.log("getTokens()");
+ api.get("./oauth/personal-access-tokens").then((response) => {
+ console.log(response.data);
+ this.tokens = response.data;
+ });
},
/**
* Show the form for creating new tokens.
*/
showCreateTokenForm() {
- console.log('showCreateTokenForm()');
- new Modal(document.getElementById('modal-create-token'), {}).show();
+ console.log("showCreateTokenForm()");
+ new Modal(document.getElementById("modal-create-token"), {}).show();
},
/**
* Create a new personal access token.
*/
storePat() {
- console.log('storePat()');
+ console.log("storePat()");
this.accessToken = null;
this.form.errors = [];
- api.post('./oauth/personal-access-tokens', this.form)
- .then(response => {
- console.log('Successful POST new token, reset form content.');
- this.form.name = '';
+ api.post("./oauth/personal-access-tokens", this.form)
+ .then((response) => {
+ console.log(
+ "Successful POST new token, reset form content.",
+ );
+ this.form.name = "";
this.form.scopes = [];
this.form.errors = [];
this.getTokens();
this.showAccessToken(response.data.accessToken);
-
})
- .catch(error => {
- console.warn('Bad POST new token, show error.', error);
+ .catch((error) => {
+ console.warn("Bad POST new token, show error.", error);
this.form.errors = [];
- if (typeof error.response.data === 'object') {
+ if (typeof error.response.data === "object") {
for (let i in error.response.data.errors) {
if (Object.hasOwn(error.response.data.errors, i)) {
- this.form.errors.push(error.response.data.errors[i]);
+ this.form.errors.push(
+ error.response.data.errors[i],
+ );
}
}
} else {
- this.form.errors = ['Something went wrong. Please try again.'];
+ this.form.errors = [
+ "Something went wrong. Please try again.",
+ ];
}
});
},
-
/**
* Show the given access token to the user.
*/
showAccessToken(accessToken) {
- console.log('showAccessToken');
- new Modal(document.getElementById('modal-create-token'), {}).hide();
+ console.log("showAccessToken");
+ new Modal(document.getElementById("modal-create-token"), {}).hide();
this.accessToken = accessToken;
- new Modal(document.getElementById('modal-access-token'), {}).show();
+ new Modal(document.getElementById("modal-access-token"), {}).show();
},
getClients() {
- api.get('./oauth/clients')
- .then(response => {
- console.log(response.data);
- this.clients = response.data;
- });
+ api.get("./oauth/clients").then((response) => {
+ console.log(response.data);
+ this.clients = response.data;
+ });
},
showCreateClientForm() {
- new Modal(document.getElementById('modal-create-client'), {}).show();
+ new Modal(
+ document.getElementById("modal-create-client"),
+ {},
+ ).show();
},
/**
* Persist the client to storage using the given form.
@@ -187,11 +198,11 @@ let index = function () {
form.errors = [];
api[method](uri, form)
- .then(response => {
+ .then((response) => {
this.getClients();
- form.name = '';
- form.redirect_uris = '';
+ form.name = "";
+ form.redirect_uris = "";
form.errors = [];
new Modal(document.querySelector(modal), {}).hide();
@@ -200,14 +211,18 @@ let index = function () {
this.showClientSecret(response.data.plainSecret);
}
})
- .catch(error => {
- if (typeof error.response.data === 'object') {
- for (const [key, value] of Object.entries(error.response.data.errors)) {
+ .catch((error) => {
+ if (typeof error.response.data === "object") {
+ for (const [key, value] of Object.entries(
+ error.response.data.errors,
+ )) {
console.log(`${key}: ${value}`);
form.errors.push(value);
}
} else {
- form.errors = ['Something went wrong. Please try again.'];
+ form.errors = [
+ "Something went wrong. Please try again.",
+ ];
}
console.log(form.errors);
});
@@ -216,10 +231,11 @@ let index = function () {
* Revoke the given token.
*/
revoke(token) {
- api.delete('./oauth/personal-access-tokens/' + token.id)
- .then(() => {
+ api.delete("./oauth/personal-access-tokens/" + token.id).then(
+ () => {
this.getTokens();
- });
+ },
+ );
},
/**
@@ -227,35 +243,40 @@ let index = function () {
*/
showClientSecret(clientSecret) {
this.clientSecret = clientSecret;
- new Modal(document.getElementById('modal-client-secret'), {}).show();
+ new Modal(
+ document.getElementById("modal-client-secret"),
+ {},
+ ).show();
},
regenerateSecret(client) {
- api.post('./oauth/clients/regenerate/' + client.id)
- .then(response => {
+ api.post("./oauth/clients/regenerate/" + client.id).then(
+ (response) => {
this.clientSecret = response.data.plainSecret;
- new Modal(document.getElementById('modal-client-secret'), {}).show();
- });
-
+ new Modal(
+ document.getElementById("modal-client-secret"),
+ {},
+ ).show();
+ },
+ );
},
/**
* Destroy the given client.
*/
destroy(client) {
- api.delete('./oauth/clients/' + client.id)
- .then(() => {
- this.getClients();
- });
+ api.delete("./oauth/clients/" + client.id).then(() => {
+ this.getClients();
+ });
},
/**
* Create a new OAuth client for the user.
*/
store() {
this.persistClient(
- 'post',
- './oauth/clients',
+ "post",
+ "./oauth/clients",
this.createForm,
- '#modal-create-client'
+ "#modal-create-client",
);
},
/**
@@ -264,9 +285,9 @@ let index = function () {
edit(client) {
this.editForm.id = client.id;
this.editForm.name = client.name;
- this.editForm.redirect_uris = client.redirect_uris.join(',');
+ this.editForm.redirect_uris = client.redirect_uris.join(",");
- new Modal(document.getElementById('modal-edit-client'), {}).show();
+ new Modal(document.getElementById("modal-edit-client"), {}).show();
},
/**
@@ -274,25 +295,24 @@ let index = function () {
*/
update() {
this.persistClient(
- 'put',
- './oauth/clients/' + this.editForm.id,
+ "put",
+ "./oauth/clients/" + this.editForm.id,
this.editForm,
- '#modal-edit-client'
+ "#modal-edit-client",
);
},
- }
+ };
};
-
const comps = {
index,
sidebar,
- dates
+ dates,
};
function loadPage(comps) {
- console.log('loadPage');
- Object.keys(comps).forEach(comp => {
+ console.log("loadPage");
+ Object.keys(comps).forEach((comp) => {
let data = comps[comp]();
Alpine.data(comp, () => data);
console.log(comp);
@@ -301,12 +321,12 @@ function loadPage(comps) {
}
// wait for load until bootstrapped event is received.
-document.addEventListener('firefly-iii-bootstrapped', () => {
- console.log('Loaded through event listener.');
+document.addEventListener("firefly-iii-bootstrapped", () => {
+ console.log("Loaded through event listener.");
loadPage(comps);
});
// or is bootstrapped before event is triggered.
if (window.bootstrapped) {
- console.log('Loaded through window variable.');
+ console.log("Loaded through window variable.");
loadPage(comps);
}
diff --git a/resources/assets/v3/js/pages/recurring/create.js b/resources/assets/v3/js/pages/recurring/create.js
index f79e62ca8a..2021650760 100644
--- a/resources/assets/v3/js/pages/recurring/create.js
+++ b/resources/assets/v3/js/pages/recurring/create.js
@@ -18,67 +18,91 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
-import '../../boot/bootstrap.js';
-import sidebar from '../../pages/shared/sidebar.js';
-import dates from '../shared/dates.js';
+import "../../boot/bootstrap.js";
+import sidebar from "../../pages/shared/sidebar.js";
+import dates from "../shared/dates.js";
-
-import {Calendar} from 'fullcalendar';
-import themePlugin from 'fullcalendar/themes/monarch'; // YOUR THEME
-import dayGridPlugin from 'fullcalendar/daygrid';
-import timeGridPlugin from 'fullcalendar/timegrid';
-import listPlugin from 'fullcalendar/list';
-import {createTagField} from '../../form/create-tag-field.js';
-import {createAutocomplete} from '../../form/create-autocomplete.js';
-import {createButtonSwitcher} from './shared/create-button-switcher.js';
-import {respondToFirstDateChange} from './shared/respond-to-first-date-change.js';
-import {switchTransactionType} from './shared/switch-transaction-type.js';
-import {respondToRepetitionEnd} from './shared/respond-to-repetition-end.js';
+import { Calendar } from "fullcalendar";
+import themePlugin from "fullcalendar/themes/monarch"; // YOUR THEME
+import dayGridPlugin from "fullcalendar/daygrid";
+import timeGridPlugin from "fullcalendar/timegrid";
+import listPlugin from "fullcalendar/list";
+import { createTagField } from "../../form/create-tag-field.js";
+import { createAutocomplete } from "../../form/create-autocomplete.js";
+import { createButtonSwitcher } from "./shared/create-button-switcher.js";
+import { respondToFirstDateChange } from "./shared/respond-to-first-date-change.js";
+import { switchTransactionType } from "./shared/switch-transaction-type.js";
+import { respondToRepetitionEnd } from "./shared/respond-to-repetition-end.js";
// stylesheets
-import 'fullcalendar/skeleton.css'; // ALWAYS NEED SKELETON
-import 'fullcalendar/themes/monarch/theme.css'; // YOUR THEME
-import 'fullcalendar/themes/monarch/palettes/purple.css'; // YOUR THEME'S PALETTE
-import Alpine from 'alpinejs';
+import "fullcalendar/skeleton.css"; // ALWAYS NEED SKELETON
+import "fullcalendar/themes/monarch/theme.css"; // YOUR THEME
+import "fullcalendar/themes/monarch/palettes/purple.css"; // YOUR THEME'S PALETTE
+import Alpine from "alpinejs";
let create = function () {
return {
calendar: null,
eventSource: null,
- repetitionType:null,
+ repetitionType: null,
respondToFirstDateChange: respondToFirstDateChange,
init() {
- createTagField('ffInput_tags');
- createAutocomplete('ffInput_category', './api/v1/autocomplete/categories');
+ createTagField("ffInput_tags");
+ createAutocomplete(
+ "ffInput_category",
+ "./api/v1/autocomplete/categories",
+ );
createButtonSwitcher();
- switchTransactionType('withdrawal');
+ switchTransactionType("withdrawal");
this.respondToFirstDateChange();
respondToRepetitionEnd();
- document.getElementById('ffInput_first_date').addEventListener('change', this.respondToFirstDateChange);
- document.getElementById('ffInput_repetition_end').addEventListener('change', respondToRepetitionEnd.bind(this));
-
+ document
+ .getElementById("ffInput_first_date")
+ .addEventListener("change", this.respondToFirstDateChange);
+ document
+ .getElementById("ffInput_repetition_end")
+ .addEventListener("change", respondToRepetitionEnd.bind(this));
- let calendarEl = document.getElementById('recurring_calendar');
+ let calendarEl = document.getElementById("recurring_calendar");
this.calendar = new Calendar(calendarEl, {
- plugins: [themePlugin, dayGridPlugin, timeGridPlugin, listPlugin],
- initialView: 'dayGridMonth',
+ plugins: [
+ themePlugin,
+ dayGridPlugin,
+ timeGridPlugin,
+ listPlugin,
+ ],
+ initialView: "dayGridMonth",
headerToolbar: {
- left: 'prev,next today',
- center: 'title'
- }
+ left: "prev,next today",
+ center: "title",
+ },
});
this.calendar.render();
- document.getElementById('calendar-link').addEventListener('click', this.showRepCalendar.bind(this));
+ document
+ .getElementById("calendar-link")
+ .addEventListener("click", this.showRepCalendar.bind(this));
},
showRepCalendar() {
- let eventsUrl = document.getElementById('eventsUrl').value;
+ let eventsUrl = document.getElementById("eventsUrl").value;
// pre-append URL with repetition info:
- let newEventsUrl = eventsUrl + '?type=' + document.getElementById('ffInput_repetition_type').value;
- newEventsUrl += '&skip=' + document.getElementById('ffInput_skip').value;
- newEventsUrl += '&ends=' + document.getElementById('ffInput_repetition_end').value;
- newEventsUrl += '&end_date=' + document.getElementById('ffInput_repeat_until').value;
- newEventsUrl += '&reps=' + document.getElementById('ffInput_repetitions').value;
- newEventsUrl += '&first_date=' + document.getElementById('ffInput_first_date').value;
- newEventsUrl += '&weekend=' + document.getElementById('ffInput_weekend').value;
+ let newEventsUrl =
+ eventsUrl +
+ "?type=" +
+ document.getElementById("ffInput_repetition_type").value;
+ newEventsUrl +=
+ "&skip=" + document.getElementById("ffInput_skip").value;
+ newEventsUrl +=
+ "&ends=" +
+ document.getElementById("ffInput_repetition_end").value;
+ newEventsUrl +=
+ "&end_date=" +
+ document.getElementById("ffInput_repeat_until").value;
+ newEventsUrl +=
+ "&reps=" + document.getElementById("ffInput_repetitions").value;
+ newEventsUrl +=
+ "&first_date=" +
+ document.getElementById("ffInput_first_date").value;
+ newEventsUrl +=
+ "&weekend=" + document.getElementById("ffInput_weekend").value;
let eventSource = new EventSource(newEventsUrl);
this.calendar.removeAllEventSources();
@@ -86,20 +110,19 @@ let create = function () {
// $('#calendarModal').modal('show');
return false;
- }
- }
+ },
+ };
};
-
const comps = {
create,
sidebar,
- dates
+ dates,
};
function loadPage(comps) {
// console.log('loadPage');
- Object.keys(comps).forEach(comp => {
+ Object.keys(comps).forEach((comp) => {
let data = comps[comp]();
Alpine.data(comp, () => data);
// console.log(comp);
@@ -108,7 +131,7 @@ function loadPage(comps) {
}
// wait for load until bootstrapped event is received.
-document.addEventListener('firefly-iii-bootstrapped', () => {
+document.addEventListener("firefly-iii-bootstrapped", () => {
// console.log('Loaded through event listener.');
loadPage(comps);
});
diff --git a/resources/assets/v3/js/pages/recurring/edit.js b/resources/assets/v3/js/pages/recurring/edit.js
index 49e06e00ad..47dcb39d7f 100644
--- a/resources/assets/v3/js/pages/recurring/edit.js
+++ b/resources/assets/v3/js/pages/recurring/edit.js
@@ -18,66 +18,93 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
-
-import '../../boot/bootstrap.js';
-import sidebar from '../../pages/shared/sidebar.js';
-import dates from '../shared/dates.js';
-import {createTagField} from "../../form/create-tag-field.js";
-import {createAutocomplete} from "../../form/create-autocomplete.js";
-import {createButtonSwitcher} from "./shared/create-button-switcher.js";
-import {switchTransactionType} from "./shared/switch-transaction-type.js";
-import {respondToFirstDateChange} from './shared/respond-to-first-date-change.js';
-import {respondToRepetitionEnd} from './shared/respond-to-repetition-end.js';
-import {Calendar} from "fullcalendar";
+import "../../boot/bootstrap.js";
+import sidebar from "../../pages/shared/sidebar.js";
+import dates from "../shared/dates.js";
+import { createTagField } from "../../form/create-tag-field.js";
+import { createAutocomplete } from "../../form/create-autocomplete.js";
+import { createButtonSwitcher } from "./shared/create-button-switcher.js";
+import { switchTransactionType } from "./shared/switch-transaction-type.js";
+import { respondToFirstDateChange } from "./shared/respond-to-first-date-change.js";
+import { respondToRepetitionEnd } from "./shared/respond-to-repetition-end.js";
+import { Calendar } from "fullcalendar";
import themePlugin from "fullcalendar/themes/monarch";
import dayGridPlugin from "fullcalendar/daygrid";
import timeGridPlugin from "fullcalendar/timegrid";
import listPlugin from "fullcalendar/list";
-import Alpine from 'alpinejs';
+import Alpine from "alpinejs";
// stylesheets
-import 'fullcalendar/skeleton.css'; // ALWAYS NEED SKELETON
-import 'fullcalendar/themes/monarch/theme.css'; // YOUR THEME
-import 'fullcalendar/themes/monarch/palettes/purple.css'; // YOUR THEME'S PALETTE
+import "fullcalendar/skeleton.css"; // ALWAYS NEED SKELETON
+import "fullcalendar/themes/monarch/theme.css"; // YOUR THEME
+import "fullcalendar/themes/monarch/palettes/purple.css"; // YOUR THEME'S PALETTE
let edit = function () {
return {
type: null,
respondToFirstDateChange: respondToFirstDateChange,
init() {
- createTagField('ffInput_tags');
- createAutocomplete('ffInput_category','./api/v1/autocomplete/categories');
+ createTagField("ffInput_tags");
+ createAutocomplete(
+ "ffInput_category",
+ "./api/v1/autocomplete/categories",
+ );
createButtonSwitcher();
- switchTransactionType(document.getElementsByName('transaction_type')[0].value);
- this.type = document.getElementById('repetitionType').value;
+ switchTransactionType(
+ document.getElementsByName("transaction_type")[0].value,
+ );
+ this.type = document.getElementById("repetitionType").value;
this.respondToFirstDateChange();
respondToRepetitionEnd();
- document.getElementById('ffInput_first_date').addEventListener('change', this.respondToFirstDateChange);
- document.getElementById('ffInput_repetition_end').addEventListener('change', respondToRepetitionEnd.bind(this));
+ document
+ .getElementById("ffInput_first_date")
+ .addEventListener("change", this.respondToFirstDateChange);
+ document
+ .getElementById("ffInput_repetition_end")
+ .addEventListener("change", respondToRepetitionEnd.bind(this));
- let calendarEl = document.getElementById('recurring_calendar');
+ let calendarEl = document.getElementById("recurring_calendar");
this.calendar = new Calendar(calendarEl, {
- plugins: [themePlugin, dayGridPlugin, timeGridPlugin, listPlugin],
- initialView: 'dayGridMonth',
+ plugins: [
+ themePlugin,
+ dayGridPlugin,
+ timeGridPlugin,
+ listPlugin,
+ ],
+ initialView: "dayGridMonth",
headerToolbar: {
- left: 'prev,next today',
- center: 'title'
- }
+ left: "prev,next today",
+ center: "title",
+ },
});
this.calendar.render();
- document.getElementById('calendar-link').addEventListener('click', this.showRepCalendar.bind(this));
+ document
+ .getElementById("calendar-link")
+ .addEventListener("click", this.showRepCalendar.bind(this));
},
showRepCalendar() {
- let eventsUrl = document.getElementById('eventsUrl').value;
+ let eventsUrl = document.getElementById("eventsUrl").value;
// pre-append URL with repetition info:
- let newEventsUrl = eventsUrl + '?type=' + document.getElementById('ffInput_repetition_type').value;
- newEventsUrl += '&skip=' + document.getElementById('ffInput_skip').value;
- newEventsUrl += '&ends=' + document.getElementById('ffInput_repetition_end').value;
- newEventsUrl += '&end_date=' + document.getElementById('ffInput_repeat_until').value;
- newEventsUrl += '&reps=' + document.getElementById('ffInput_repetitions').value;
- newEventsUrl += '&first_date=' + document.getElementById('ffInput_first_date').value;
- newEventsUrl += '&weekend=' + document.getElementById('ffInput_weekend').value;
+ let newEventsUrl =
+ eventsUrl +
+ "?type=" +
+ document.getElementById("ffInput_repetition_type").value;
+ newEventsUrl +=
+ "&skip=" + document.getElementById("ffInput_skip").value;
+ newEventsUrl +=
+ "&ends=" +
+ document.getElementById("ffInput_repetition_end").value;
+ newEventsUrl +=
+ "&end_date=" +
+ document.getElementById("ffInput_repeat_until").value;
+ newEventsUrl +=
+ "&reps=" + document.getElementById("ffInput_repetitions").value;
+ newEventsUrl +=
+ "&first_date=" +
+ document.getElementById("ffInput_first_date").value;
+ newEventsUrl +=
+ "&weekend=" + document.getElementById("ffInput_weekend").value;
let eventSource = new EventSource(newEventsUrl);
this.calendar.removeAllEventSources();
@@ -85,20 +112,19 @@ let edit = function () {
//$('#calendarModal').modal('show');
return false;
- }
- }
+ },
+ };
};
-
const comps = {
edit,
sidebar,
- dates
+ dates,
};
function loadPage(comps) {
// console.log('loadPage');
- Object.keys(comps).forEach(comp => {
+ Object.keys(comps).forEach((comp) => {
let data = comps[comp]();
Alpine.data(comp, () => data);
// console.log(comp);
@@ -107,7 +133,7 @@ function loadPage(comps) {
}
// wait for load until bootstrapped event is received.
-document.addEventListener('firefly-iii-bootstrapped', () => {
+document.addEventListener("firefly-iii-bootstrapped", () => {
// console.log('Loaded through event listener.');
loadPage(comps);
});
diff --git a/resources/assets/v3/js/pages/recurring/shared/create-button-switcher.js b/resources/assets/v3/js/pages/recurring/shared/create-button-switcher.js
index 28564e5f7c..1b53e68a89 100644
--- a/resources/assets/v3/js/pages/recurring/shared/create-button-switcher.js
+++ b/resources/assets/v3/js/pages/recurring/shared/create-button-switcher.js
@@ -18,19 +18,18 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
-import {switchTransactionType} from "./switch-transaction-type.js";
+import { switchTransactionType } from "./switch-transaction-type.js";
function createButtonSwitcher() {
- let list = document.getElementsByClassName('switch-button');
+ let list = document.getElementsByClassName("switch-button");
for (let i = 0; i < list.length; i++) {
-
- list[i].addEventListener('click', (event) => {
+ list[i].addEventListener("click", (event) => {
let transactionType = event.currentTarget.dataset.value;
- console.log('Clicked value is ' + transactionType);
+ console.log("Clicked value is " + transactionType);
switchTransactionType(transactionType);
return false;
});
}
}
-export {createButtonSwitcher};
+export { createButtonSwitcher };
diff --git a/resources/assets/v3/js/pages/recurring/shared/respond-to-first-date-change.js b/resources/assets/v3/js/pages/recurring/shared/respond-to-first-date-change.js
index 0137aefc8b..ac0ae2164f 100644
--- a/resources/assets/v3/js/pages/recurring/shared/respond-to-first-date-change.js
+++ b/resources/assets/v3/js/pages/recurring/shared/respond-to-first-date-change.js
@@ -18,17 +18,19 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
-import {api} from "../../../boot/axios";
+import { api } from "../../../boot/axios";
function parseRepetitionSuggestions(response) {
let data = response.data;
- let select = document.getElementById('ffInput_repetition_type');
- select.innerHTML = '';
+ let select = document.getElementById("ffInput_repetition_type");
+ select.innerHTML = "";
let opt;
for (var k in data) {
if (Object.hasOwn(data, k)) {
- console.log('label: ' + data[k].label + ', selected: ' + data[k].selected);
- opt = document.createElement('option');
+ console.log(
+ "label: " + data[k].label + ", selected: " + data[k].selected,
+ );
+ opt = document.createElement("option");
opt.value = k;
opt.label = data[k].label;
opt.text = data[k].label;
@@ -42,23 +44,27 @@ function parseRepetitionSuggestions(response) {
}
function respondToFirstDateChange() {
- let suggestUrl = './recurring/suggest';
- let obj = document.getElementById('ffInput_first_date');
- let select = document.getElementById('ffInput_repetition_type');
+ let suggestUrl = "./recurring/suggest";
+ let obj = document.getElementById("ffInput_first_date");
+ let select = document.getElementById("ffInput_repetition_type");
let date = obj.value;
select.disabled = true;
// preselected value:
var preSelected = this.type;
- if (preSelected === '') {
+ if (preSelected === "") {
preSelected = select.value;
}
- api.get(suggestUrl, {params: {date: date, pre_select: preSelected, past: 'true'}}).
- then(parseRepetitionSuggestions)
- .catch(function () {
- console.error('Could not load repetition suggestions');
- alert('Could not load repetition suggestions. Please enter a valid date.');
- });
+ api.get(suggestUrl, {
+ params: { date: date, pre_select: preSelected, past: "true" },
+ })
+ .then(parseRepetitionSuggestions)
+ .catch(function () {
+ console.error("Could not load repetition suggestions");
+ alert(
+ "Could not load repetition suggestions. Please enter a valid date.",
+ );
+ });
}
-export {respondToFirstDateChange}
+export { respondToFirstDateChange };
diff --git a/resources/assets/v3/js/pages/recurring/shared/respond-to-repetition-end.js b/resources/assets/v3/js/pages/recurring/shared/respond-to-repetition-end.js
index 0841209c01..4cf562f06e 100644
--- a/resources/assets/v3/js/pages/recurring/shared/respond-to-repetition-end.js
+++ b/resources/assets/v3/js/pages/recurring/shared/respond-to-repetition-end.js
@@ -19,23 +19,29 @@
*/
function respondToRepetitionEnd() {
- var obj = document.getElementById('ffInput_repetition_end');
+ var obj = document.getElementById("ffInput_repetition_end");
var value = obj.value;
switch (value) {
- case 'forever':
- document.getElementById('repeat_until_holder').style.display = 'none';
- document.getElementById('repetitions_holder').style.display = 'none';
+ case "forever":
+ document.getElementById("repeat_until_holder").style.display =
+ "none";
+ document.getElementById("repetitions_holder").style.display =
+ "none";
break;
- case 'until_date':
- document.getElementById('repeat_until_holder').style.display = 'block';
- document.getElementById('repetitions_holder').style.display = 'none';
+ case "until_date":
+ document.getElementById("repeat_until_holder").style.display =
+ "block";
+ document.getElementById("repetitions_holder").style.display =
+ "none";
break;
- case 'times':
- document.getElementById('repeat_until_holder').style.display = 'none';
- document.getElementById('repetitions_holder').style.display = 'block';
+ case "times":
+ document.getElementById("repeat_until_holder").style.display =
+ "none";
+ document.getElementById("repetitions_holder").style.display =
+ "block";
break;
}
}
-export {respondToRepetitionEnd}
+export { respondToRepetitionEnd };
diff --git a/resources/assets/v3/js/pages/recurring/shared/switch-transaction-type.js b/resources/assets/v3/js/pages/recurring/shared/switch-transaction-type.js
index 2e3f74aacd..d0461c98b4 100644
--- a/resources/assets/v3/js/pages/recurring/shared/switch-transaction-type.js
+++ b/resources/assets/v3/js/pages/recurring/shared/switch-transaction-type.js
@@ -19,61 +19,74 @@
*/
function switchTransactionType(transactionType) {
- let list = document.getElementsByClassName('switch-button');
+ let list = document.getElementsByClassName("switch-button");
for (let i = 0; i < list.length; i++) {
let currentType = list[i].dataset.value;
if (currentType === transactionType) {
- list[i].classList.add('btn-primary');
- list[i].classList.remove('btn-secondary');
+ list[i].classList.add("btn-primary");
+ list[i].classList.remove("btn-secondary");
}
if (currentType !== transactionType) {
- list[i].classList.remove('btn-primary');
- list[i].classList.add('btn-secondary');
+ list[i].classList.remove("btn-primary");
+ list[i].classList.add("btn-secondary");
}
}
- document.querySelector('input[type="hidden"][name="transaction_type"]').value = transactionType;
- if ('withdrawal' === transactionType) {
+ document.querySelector(
+ 'input[type="hidden"][name="transaction_type"]',
+ ).value = transactionType;
+ if ("withdrawal" === transactionType) {
// hide source account name:
- document.getElementById('deposit_source_id_holder').style.display = 'none';
+ document.getElementById("deposit_source_id_holder").style.display =
+ "none";
// // show source account ID:
- document.getElementById('source_id_holder').style.display = 'block';
+ document.getElementById("source_id_holder").style.display = "block";
// show destination name:
- document.getElementById('withdrawal_destination_id_holder').style.display = 'block';
+ document.getElementById(
+ "withdrawal_destination_id_holder",
+ ).style.display = "block";
// // hide destination ID:
- document.getElementById('destination_id_holder').style.display = 'none';
+ document.getElementById("destination_id_holder").style.display = "none";
// show budget + bill
- document.getElementById('budget_id_holder').style.display = 'block';
- document.getElementById('bill_id_holder').style.display = 'block';
+ document.getElementById("budget_id_holder").style.display = "block";
+ document.getElementById("bill_id_holder").style.display = "block";
// hide piggy bank:
- document.getElementById('piggy_bank_id_holder').style.display = 'none';
+ document.getElementById("piggy_bank_id_holder").style.display = "none";
}
- if (transactionType === 'deposit') {
- document.getElementById('deposit_source_id_holder').style.display = 'block';
+ if (transactionType === "deposit") {
+ document.getElementById("deposit_source_id_holder").style.display =
+ "block";
- document.getElementById('source_id_holder').style.display = 'none';
+ document.getElementById("source_id_holder").style.display = "none";
- document.getElementById('withdrawal_destination_id_holder').style.display = 'none';
+ document.getElementById(
+ "withdrawal_destination_id_holder",
+ ).style.display = "none";
- document.getElementById('destination_id_holder').style.display = 'block';
- document.getElementById('budget_id_holder').style.display = 'none';
- document.getElementById('bill_id_holder').style.display = 'none';
- document.getElementById('piggy_bank_id_holder').style.display = 'none';
+ document.getElementById("destination_id_holder").style.display =
+ "block";
+ document.getElementById("budget_id_holder").style.display = "none";
+ document.getElementById("bill_id_holder").style.display = "none";
+ document.getElementById("piggy_bank_id_holder").style.display = "none";
}
- if (transactionType === 'transfer') {
- document.getElementById('deposit_source_id_holder').style.display = 'none';
- document.getElementById('source_id_holder').style.display = 'block';
- document.getElementById('withdrawal_destination_id_holder').style.display = 'none';
- document.getElementById('destination_id_holder').style.display = 'block';
- document.getElementById('budget_id_holder').style.display = 'none';
- document.getElementById('bill_id_holder').style.display = 'none';
- document.getElementById('piggy_bank_id_holder').style.display = 'block';
+ if (transactionType === "transfer") {
+ document.getElementById("deposit_source_id_holder").style.display =
+ "none";
+ document.getElementById("source_id_holder").style.display = "block";
+ document.getElementById(
+ "withdrawal_destination_id_holder",
+ ).style.display = "none";
+ document.getElementById("destination_id_holder").style.display =
+ "block";
+ document.getElementById("budget_id_holder").style.display = "none";
+ document.getElementById("bill_id_holder").style.display = "none";
+ document.getElementById("piggy_bank_id_holder").style.display = "block";
}
}
-export {switchTransactionType};
+export { switchTransactionType };
diff --git a/resources/assets/v3/js/pages/shared/dates.js b/resources/assets/v3/js/pages/shared/dates.js
index 8c031b0a2e..373aa1637a 100644
--- a/resources/assets/v3/js/pages/shared/dates.js
+++ b/resources/assets/v3/js/pages/shared/dates.js
@@ -18,12 +18,20 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
-import {addMonths, endOfMonth, startOfMonth, startOfYear, subDays, subMonths} from "date-fns";
-import format from '../../util/format'
+import {
+ addMonths,
+ endOfMonth,
+ startOfMonth,
+ startOfYear,
+ subDays,
+ subMonths,
+} from "date-fns";
+import format from "../../util/format";
export default () => ({
range: {
- start: null, end: null
+ start: null,
+ end: null,
},
eventListeners: {
// ['@CustomEvents.change'](event) {
@@ -31,58 +39,63 @@ export default () => ({
// }
},
updateDates(e) {
- let split = e.originalTarget._props.value.split('/');
- console.log('Start is now ' + split[0]);
- console.log('End is now ' + split[1]);
- window.store.set('start', split[0]);
- window.store.set('end', split[1]);
+ let split = e.originalTarget._props.value.split("/");
+ console.log("Start is now " + split[0]);
+ console.log("End is now " + split[1]);
+ window.store.set("start", split[0]);
+ window.store.set("end", split[1]);
this.submitForm();
-
},
defaultRange: {
- start: null, end: null
+ start: null,
+ end: null,
},
submitForm() {
// console.log('submitForm', format(window.store.get('start'), 'yyyy-MM-dd'), format(window.store.get('end'), 'yyyy-MM-dd'));
// save form and submit for v1.
- document.getElementById('customStart').value = format(window.store.get('start'), 'yyyy-MM-dd');
- document.getElementById('customEnd').value = format(window.store.get('end'), 'yyyy-MM-dd');
- document.getElementById('daterange-form').submit();
+ document.getElementById("customStart").value = format(
+ window.store.get("start"),
+ "yyyy-MM-dd",
+ );
+ document.getElementById("customEnd").value = format(
+ window.store.get("end"),
+ "yyyy-MM-dd",
+ );
+ document.getElementById("daterange-form").submit();
},
- language: 'en_US',
+ language: "en_US",
init() {
- if(false === window.enableDates) {
- console.log('Date selection is disabled on this page.');
- document.getElementById('date-dropdown').style.display = 'none';
+ if (false === window.enableDates) {
+ console.log("Date selection is disabled on this page.");
+ document.getElementById("date-dropdown").style.display = "none";
}
- let end = new Date(window.store.get('end'));
- let start = new Date(window.store.get('start'));
+ let end = new Date(window.store.get("end"));
+ let start = new Date(window.store.get("start"));
this.range = {
start: start,
- end: end
+ end: end,
};
this.defaultRange = {
start: start,
- end: end
+ end: end,
};
- this.language = window.store.get('language');
- this.locale = window.store.get('locale');
- this.locale = 'equal' === this.locale ? this.language : this.locale;
+ this.language = window.store.get("language");
+ this.locale = window.store.get("locale");
+ this.locale = "equal" === this.locale ? this.language : this.locale;
window.__localeId__ = this.language;
this.buildDateRange();
- window.store.observe('start', (newValue) => {
+ window.store.observe("start", (newValue) => {
this.range.start = new Date(newValue);
});
- window.store.observe('end', (newValue) => {
+ window.store.observe("end", (newValue) => {
this.range.end = new Date(newValue);
this.buildDateRange();
});
},
-
buildDateRange() {
//console.log('Dates buildDateRange');
@@ -95,48 +108,69 @@ export default () => ({
let ytd = this.ytd();
// set the title:
- let element = document.getElementsByClassName('daterange-holder')[0];
- element.textContent = format(this.range.start) + ' - ' + format(this.range.end);
- element.setAttribute('data-start', format(this.range.start, 'yyyy-MM-dd'));
- element.setAttribute('data-end', format(this.range.end, 'yyyy-MM-dd'));
+ let element = document.getElementsByClassName("daterange-holder")[0];
+ element.textContent =
+ format(this.range.start) + " - " + format(this.range.end);
+ element.setAttribute(
+ "data-start",
+ format(this.range.start, "yyyy-MM-dd"),
+ );
+ element.setAttribute("data-end", format(this.range.end, "yyyy-MM-dd"));
// set the current one
- element = document.getElementsByClassName('daterange-current')[0];
- element.textContent = format(this.defaultRange.start) + ' - ' + format(this.defaultRange.end);
- element.setAttribute('data-start', format(this.defaultRange.start, 'yyyy-MM-dd'));
- element.setAttribute('data-end', format(this.defaultRange.end, 'yyyy-MM-dd'));
+ element = document.getElementsByClassName("daterange-current")[0];
+ element.textContent =
+ format(this.defaultRange.start) +
+ " - " +
+ format(this.defaultRange.end);
+ element.setAttribute(
+ "data-start",
+ format(this.defaultRange.start, "yyyy-MM-dd"),
+ );
+ element.setAttribute(
+ "data-end",
+ format(this.defaultRange.end, "yyyy-MM-dd"),
+ );
//
// // generate next range
- element = document.getElementsByClassName('daterange-next')[0];
- element.textContent = format(nextRange.start) + ' - ' + format(nextRange.end);
- element.setAttribute('data-start', format(nextRange.start, 'yyyy-MM-dd'));
- element.setAttribute('data-end', format(nextRange.end, 'yyyy-MM-dd'));
+ element = document.getElementsByClassName("daterange-next")[0];
+ element.textContent =
+ format(nextRange.start) + " - " + format(nextRange.end);
+ element.setAttribute(
+ "data-start",
+ format(nextRange.start, "yyyy-MM-dd"),
+ );
+ element.setAttribute("data-end", format(nextRange.end, "yyyy-MM-dd"));
//
// // previous range.
- element = document.getElementsByClassName('daterange-prev')[0];
- element.textContent = format(prevRange.start) + ' - ' + format(prevRange.end);
- element.setAttribute('data-start', format(prevRange.start, 'yyyy-MM-dd'));
- element.setAttribute('data-end', format(prevRange.end, 'yyyy-MM-dd'));
+ element = document.getElementsByClassName("daterange-prev")[0];
+ element.textContent =
+ format(prevRange.start) + " - " + format(prevRange.end);
+ element.setAttribute(
+ "data-start",
+ format(prevRange.start, "yyyy-MM-dd"),
+ );
+ element.setAttribute("data-end", format(prevRange.end, "yyyy-MM-dd"));
//
// // last 7
- element = document.getElementsByClassName('daterange-7d')[0];
- element.setAttribute('data-start', format(last7.start, 'yyyy-MM-dd'));
- element.setAttribute('data-end', format(last7.end, 'yyyy-MM-dd'));
+ element = document.getElementsByClassName("daterange-7d")[0];
+ element.setAttribute("data-start", format(last7.start, "yyyy-MM-dd"));
+ element.setAttribute("data-end", format(last7.end, "yyyy-MM-dd"));
//
// // last 30
- element = document.getElementsByClassName('daterange-30d')[0];
- element.setAttribute('data-start', format(last30.start, 'yyyy-MM-dd'));
- element.setAttribute('data-end', format(last30.end, 'yyyy-MM-dd'));
+ element = document.getElementsByClassName("daterange-30d")[0];
+ element.setAttribute("data-start", format(last30.start, "yyyy-MM-dd"));
+ element.setAttribute("data-end", format(last30.end, "yyyy-MM-dd"));
//
// // MTD
- element = document.getElementsByClassName('daterange-mtd')[0];
- element.setAttribute('data-start', format(mtd.start, 'yyyy-MM-dd'));
- element.setAttribute('data-end', format(mtd.end, 'yyyy-MM-dd'));
+ element = document.getElementsByClassName("daterange-mtd")[0];
+ element.setAttribute("data-start", format(mtd.start, "yyyy-MM-dd"));
+ element.setAttribute("data-end", format(mtd.end, "yyyy-MM-dd"));
//
// // YTD
- element = document.getElementsByClassName('daterange-ytd')[0];
- element.setAttribute('data-start', format(ytd.start, 'yyyy-MM-dd'));
- element.setAttribute('data-end', format(ytd.end, 'yyyy-MM-dd'));
+ element = document.getElementsByClassName("daterange-ytd")[0];
+ element.setAttribute("data-start", format(ytd.start, "yyyy-MM-dd"));
+ element.setAttribute("data-end", format(ytd.end, "yyyy-MM-dd"));
// // custom range.
// // console.log('MainApp: buildDateRange end');
@@ -160,46 +194,44 @@ export default () => ({
let start = startOfMonth(this.range.start);
let nextMonth = addMonths(start, 1);
let end = endOfMonth(nextMonth);
- return {start: nextMonth, end: end};
+ return { start: nextMonth, end: end };
},
getPrevRange() {
let start = startOfMonth(this.range.start);
let prevMonth = subMonths(start, 1);
let end = endOfMonth(prevMonth);
- return {start: prevMonth, end: end};
+ return { start: prevMonth, end: end };
},
ytd() {
- let end = new Date;
+ let end = new Date();
let start = startOfYear(this.range.start);
- return {start: start, end: end};
+ return { start: start, end: end };
},
mtd() {
-
- let end = new Date;
+ let end = new Date();
let start = startOfMonth(this.range.start);
- return {start: start, end: end};
+ return { start: start, end: end };
},
lastDays(days) {
- let end = new Date;
+ let end = new Date();
let start = subDays(end, days);
- return {start: start, end: end};
+ return { start: start, end: end };
},
changeDateRange(e) {
- console.log('changeDateRange');
+ console.log("changeDateRange");
e.preventDefault();
let target = e.currentTarget;
- let start = new Date(target.getAttribute('data-start'));
- let end = new Date(target.getAttribute('data-end'));
- window.store.set('start', start);
- window.store.set('end', end);
+ let start = new Date(target.getAttribute("data-start"));
+ let end = new Date(target.getAttribute("data-end"));
+ window.store.set("start", start);
+ window.store.set("end", end);
this.submitForm();
return false;
},
-
});
diff --git a/resources/assets/v3/js/pages/shared/sidebar.js b/resources/assets/v3/js/pages/shared/sidebar.js
index 1a9b3607f8..d5c712f7da 100644
--- a/resources/assets/v3/js/pages/shared/sidebar.js
+++ b/resources/assets/v3/js/pages/shared/sidebar.js
@@ -19,12 +19,12 @@
*/
export default () => ({
- foo: 'bar',
+ foo: "bar",
init() {
//console.log('init on sidebar')
},
logoutUser(e) {
e.preventDefault();
- document.getElementById('logout-form').submit();
- }
+ document.getElementById("logout-form").submit();
+ },
});
diff --git a/resources/assets/v3/js/pages/transactions/bulk-edit.js b/resources/assets/v3/js/pages/transactions/bulk-edit.js
index e1f1e13ea1..c68da80720 100644
--- a/resources/assets/v3/js/pages/transactions/bulk-edit.js
+++ b/resources/assets/v3/js/pages/transactions/bulk-edit.js
@@ -18,86 +18,93 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
-
-import '../../boot/bootstrap.js';
-import sidebar from '../../pages/shared/sidebar.js';
-import dates from '../shared/dates.js';
+import "../../boot/bootstrap.js";
+import sidebar from "../../pages/shared/sidebar.js";
+import dates from "../shared/dates.js";
import Tags from "bootstrap5-tags";
-import i18next from 'i18next';
-import {addAutocomplete} from "./shared/add-autocomplete.js";
-import Alpine from 'alpinejs';
+import i18next from "i18next";
+import { addAutocomplete } from "./shared/add-autocomplete.js";
+import Alpine from "alpinejs";
window.enableDates = false;
let edit = function () {
return {
detectCategoryChange(e) {
- if('' !== e.target.value) {
+ if ("" !== e.target.value) {
// tags_action_do_nothing
- document.querySelector('input[name="ignore_category"]').checked = false;
+ document.querySelector(
+ 'input[name="ignore_category"]',
+ ).checked = false;
}
},
detectBudgetChange(e) {
- if(0 !== parseInt(e.target.value)) {
+ if (0 !== parseInt(e.target.value)) {
// tags_action_do_nothing
- document.querySelector('input[name="ignore_budget"]').checked = false;
+ document.querySelector('input[name="ignore_budget"]').checked =
+ false;
}
},
detectTagChange() {
let count = 0;
let options = document.querySelector('select[name="tags"]').options;
- for(let i = 0; i < options.length; i ++){
- if (true === options[i].selected){
+ for (let i = 0; i < options.length; i++) {
+ if (true === options[i].selected) {
count++;
}
}
- if(count > 0 && true === document.getElementById('tags_action_do_nothing').checked ) {
- document.getElementById('tags_action_do_nothing').checked = false;
- document.getElementById('tags_action_do_replace').checked = true;
+ if (
+ count > 0 &&
+ true ===
+ document.getElementById("tags_action_do_nothing").checked
+ ) {
+ document.getElementById("tags_action_do_nothing").checked =
+ false;
+ document.getElementById("tags_action_do_replace").checked =
+ true;
}
},
init() {
-
addAutocomplete({
- selector: 'input.ac-category',
- serverUrl: '/api/v1/autocomplete/categories',
- valueField: 'name',
- labelField: 'name',
+ selector: "input.ac-category",
+ serverUrl: "/api/v1/autocomplete/categories",
+ valueField: "name",
+ labelField: "name",
});
-
- Tags.init('select.ac-tags', {
+ Tags.init("select.ac-tags", {
allowClear: true,
- server: '/api/v1/autocomplete/tags',
+ server: "/api/v1/autocomplete/tags",
liveServer: true,
clearEnd: true,
- labelField: 'tag',
- valueField: 'tag',
- queryParam: 'query',
+ labelField: "tag",
+ valueField: "tag",
+ queryParam: "query",
allowNew: true,
//serverDataKey: 'data',
- notFoundMessage: i18next.t('firefly.nothing_found'),
+ notFoundMessage: i18next.t("firefly.nothing_found"),
noCache: true,
fetchOptions: {
headers: {
- 'X-CSRF-TOKEN': document.head.querySelector('meta[name="csrf-token"]').content
- }
- }
+ "X-CSRF-TOKEN": document.head.querySelector(
+ 'meta[name="csrf-token"]',
+ ).content,
+ },
+ },
});
- }
- }
+ },
+ };
};
-
const comps = {
edit,
sidebar,
- dates
+ dates,
};
function loadPage(comps) {
// console.log('loadPage');
- Object.keys(comps).forEach(comp => {
+ Object.keys(comps).forEach((comp) => {
let data = comps[comp]();
Alpine.data(comp, () => data);
// console.log(comp);
@@ -106,7 +113,7 @@ function loadPage(comps) {
}
// wait for load until bootstrapped event is received.
-document.addEventListener('firefly-iii-bootstrapped', () => {
+document.addEventListener("firefly-iii-bootstrapped", () => {
// console.log('Loaded through event listener.');
loadPage(comps);
});
diff --git a/resources/assets/v3/js/pages/transactions/create.js b/resources/assets/v3/js/pages/transactions/create.js
index 91d4537d9b..3002b09acd 100644
--- a/resources/assets/v3/js/pages/transactions/create.js
+++ b/resources/assets/v3/js/pages/transactions/create.js
@@ -18,53 +18,56 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
-import '../../boot/bootstrap.js';
-import sidebar from '../../pages/shared/sidebar.js';
-import dates from '../shared/dates.js';
-import {defaultErrorSet} from "./shared/create-empty-split.js";
-import {parseFromEntries} from "./shared/parse-from-entries.js";
+import "../../boot/bootstrap.js";
+import sidebar from "../../pages/shared/sidebar.js";
+import dates from "../shared/dates.js";
+import { defaultErrorSet } from "./shared/create-empty-split.js";
+import { parseFromEntries } from "./shared/parse-from-entries.js";
import Post from "../../api/model/transaction/post.js";
-import {loadCurrencies} from "./shared/load-currencies.js";
-import {loadBudgets} from "./shared/load-budgets.js";
-import {loadPiggyBanks} from "./shared/load-piggy-banks.js";
-import {loadSubscriptions} from "./shared/load-subscriptions.js";
-import {addAllAutocompleteToForm} from "./shared/add-autocomplete.js";
-import {processAttachments} from "./shared/process-attachments.js";
-import {disableSplitAccounts} from './shared/disable-split-accounts.js';
-import {parseTotalAmount} from "./shared/parse-total-amount.js";
-import {keyUpFromCategory} from "./shared/keyup-from-category.js";
-import {changedAmount} from "./shared/changed-amount.js";
-import {changedForeignAmount} from "./shared/changed-foreign-amount.js";
-import {parseErrors} from "./shared/parse-errors.js";
+import { loadCurrencies } from "./shared/load-currencies.js";
+import { loadBudgets } from "./shared/load-budgets.js";
+import { loadPiggyBanks } from "./shared/load-piggy-banks.js";
+import { loadSubscriptions } from "./shared/load-subscriptions.js";
+import { addAllAutocompleteToForm } from "./shared/add-autocomplete.js";
+import { processAttachments } from "./shared/process-attachments.js";
+import { disableSplitAccounts } from "./shared/disable-split-accounts.js";
+import { parseTotalAmount } from "./shared/parse-total-amount.js";
+import { keyUpFromCategory } from "./shared/keyup-from-category.js";
+import { changedAmount } from "./shared/changed-amount.js";
+import { changedForeignAmount } from "./shared/changed-foreign-amount.js";
+import { parseErrors } from "./shared/parse-errors.js";
import i18next from "i18next";
-import {processUploadError} from "./shared/process-upload-error.js";
-import {showMessageOrRedirectUser} from "./shared/show-message-or-redirect.js";
-import {addSplit} from "./shared/add-split.js";
-import {clearDestinationAccount, clearSourceAccount} from './shared/clear-fields.js';
-import {detectTransactionType} from './shared/detect-transaction-type.js';
-import {determineAmountCurrency} from './shared/determine-amount-currency.js';
-import {loadCustomFields} from './shared/load-custom-fields.js';
-import {loadDefaultCoordinates} from './shared/load-default-coordinates.js';
-import 'leaflet/dist/leaflet.css';
-import {displayMap} from './shared/display-map.js';
-import {renderMap} from './shared/render-map.js';
-import {onMapClick} from './shared/on-map-click.js';
-import {onMapZoom} from "./shared/on-map-zoom.js";
-import {clearLocation} from './shared/clear-location.js';
-import {removeSplit} from "./shared/remove-split.js";
-import {createLinkAutocomplete} from "./shared/create-link-autocomplete.js";
-import {editLink} from "./shared/edit-link.js";
-import {switchLink} from "./shared/switch-link.js";
-import {removeLink} from "./shared/remove-link.js";
-import {saveEditedLink} from "./shared/save-edited-link.js";
-import {saveNewLink} from "./shared/save-new-link.js";
-import {redirectAfterTransactionLinks} from './shared/redirect-after-transaction-links.js';
-import {processTransactionLinks} from './shared/process-transaction-links.js';
-import {addTabListener} from "./shared/add-tab-listener.js";
-import {autoStep} from "./shared/auto-step.js";
-import {respondToTabSwitch} from "./shared/respond-to-tab-switch.js";
-import {loadTransactionLinks} from './shared/load-transaction-links.js';
-import Alpine from 'alpinejs';
+import { processUploadError } from "./shared/process-upload-error.js";
+import { showMessageOrRedirectUser } from "./shared/show-message-or-redirect.js";
+import { addSplit } from "./shared/add-split.js";
+import {
+ clearDestinationAccount,
+ clearSourceAccount,
+} from "./shared/clear-fields.js";
+import { detectTransactionType } from "./shared/detect-transaction-type.js";
+import { determineAmountCurrency } from "./shared/determine-amount-currency.js";
+import { loadCustomFields } from "./shared/load-custom-fields.js";
+import { loadDefaultCoordinates } from "./shared/load-default-coordinates.js";
+import "leaflet/dist/leaflet.css";
+import { displayMap } from "./shared/display-map.js";
+import { renderMap } from "./shared/render-map.js";
+import { onMapClick } from "./shared/on-map-click.js";
+import { onMapZoom } from "./shared/on-map-zoom.js";
+import { clearLocation } from "./shared/clear-location.js";
+import { removeSplit } from "./shared/remove-split.js";
+import { createLinkAutocomplete } from "./shared/create-link-autocomplete.js";
+import { editLink } from "./shared/edit-link.js";
+import { switchLink } from "./shared/switch-link.js";
+import { removeLink } from "./shared/remove-link.js";
+import { saveEditedLink } from "./shared/save-edited-link.js";
+import { saveNewLink } from "./shared/save-new-link.js";
+import { redirectAfterTransactionLinks } from "./shared/redirect-after-transaction-links.js";
+import { processTransactionLinks } from "./shared/process-transaction-links.js";
+import { addTabListener } from "./shared/add-tab-listener.js";
+import { autoStep } from "./shared/auto-step.js";
+import { respondToTabSwitch } from "./shared/respond-to-tab-switch.js";
+import { loadTransactionLinks } from "./shared/load-transaction-links.js";
+import Alpine from "alpinejs";
window.enableDates = false;
@@ -86,7 +89,7 @@ let create = function () {
// properties for the entire transaction group
groupProperties: {
- transactionType: 'unknown',
+ transactionType: "unknown",
titleErrors: [],
title: null,
id: null,
@@ -116,7 +119,7 @@ let create = function () {
// form behavior during transaction, for shared components.
formBehaviour: {
- formType: 'create',
+ formType: "create",
foreignCurrencyEnabled: true,
customFields: {},
defaultCoordinates: {
@@ -141,25 +144,31 @@ let create = function () {
linkTypes: [],
},
-
// notifications
notifications: {
error: {
- show: false, text: '', url: '',
- }, success: {
- show: false, text: '', url: '',
- }, wait: {
- show: false, text: '',
- }
+ show: false,
+ text: "",
+ url: "",
+ },
+ success: {
+ show: false,
+ text: "",
+ url: "",
+ },
+ wait: {
+ show: false,
+ text: "",
+ },
},
// events in the form
changedDateTime() {
- console.warn('changedDateTime, event is not used');
+ console.warn("changedDateTime, event is not used");
},
changedDescription() {
- console.warn('changedDescription, event is not used');
+ console.warn("changedDescription, event is not used");
},
changedDestinationAccount() {
@@ -209,7 +218,7 @@ let create = function () {
let list = [];
let currency;
for (let i in this.formData.enabledCurrencies) {
- if (Object.hasOwn(this.formData.enabledCurrencies,i)) {
+ if (Object.hasOwn(this.formData.enabledCurrencies, i)) {
let current = this.formData.enabledCurrencies[i];
if (current.code === code) {
currency = current;
@@ -219,18 +228,28 @@ let create = function () {
list.push(currency);
this.formData.foreignCurrencies = list;
// is he source account currency anyway:
- if (1 === list.length && list[0].code === this.entries[0].source_account.currency_code) {
- console.log('Foreign currency is same as source currency. Disable foreign amount.');
+ if (
+ 1 === list.length &&
+ list[0].code === this.entries[0].source_account.currency_code
+ ) {
+ console.log(
+ "Foreign currency is same as source currency. Disable foreign amount.",
+ );
this.formBehaviour.foreignCurrencyEnabled = false;
}
- if (1 === list.length && list[0].code !== this.entries[0].source_account.currency_code) {
- console.log('Foreign currency is NOT same as source currency. Enable foreign amount.');
+ if (
+ 1 === list.length &&
+ list[0].code !== this.entries[0].source_account.currency_code
+ ) {
+ console.log(
+ "Foreign currency is NOT same as source currency. Enable foreign amount.",
+ );
this.formBehaviour.foreignCurrencyEnabled = true;
}
// this also forces the currency_code on ALL entries.
for (let i in this.entries) {
- if (Object.hasOwn(this.entries,i)) {
+ if (Object.hasOwn(this.entries, i)) {
this.entries[i].foreign_currency_code = code;
}
}
@@ -243,28 +262,23 @@ let create = function () {
},
processUpload() {
- console.log('Now in processUpload()');
+ console.log("Now in processUpload()");
this.formStates.storedAttachments = true;
this.showMessageOrRedirectUser();
},
clearDescription(index) {
- this.entries[index].description = '';
+ this.entries[index].description = "";
},
clearCategory(index) {
- this.entries[index].category_name = '';
+ this.entries[index].category_name = "";
},
-
-
-
-
-
init() {
this.i18next = i18next;
this.addSplit();
// load currencies and save in form data.
- loadCurrencies().then(data => {
+ loadCurrencies().then((data) => {
this.formStates.loadingCurrencies = false;
this.formData.amountCurrency = data.primaryCurrency;
this.formData.enabledCurrencies = data.enabledCurrencies;
@@ -273,46 +287,44 @@ let create = function () {
this.autoStep();
});
-
- loadBudgets(false).then(data => {
+ loadBudgets(false).then((data) => {
this.formData.budgets = data;
this.formStates.loadingBudgets = false;
this.autoStep();
});
- loadPiggyBanks().then(data => {
+ loadPiggyBanks().then((data) => {
this.formData.piggyBanks = data;
this.formStates.loadingPiggyBanks = false;
this.autoStep();
});
- loadSubscriptions(false).then(data => {
+ loadSubscriptions(false).then((data) => {
this.formData.subscriptions = data;
this.formStates.loadingSubscriptions = false;
this.autoStep();
});
// load custom field preference and enable/disable those fields.
- this.loadCustomFields().then(data => {
+ this.loadCustomFields().then((data) => {
this.formBehaviour.customFields = data;
this.autoStep();
});
-
- document.addEventListener('upload-success', () => {
+ document.addEventListener("upload-success", () => {
console.log('Now in event listener "upload-success"');
this.processUpload();
- document.querySelectorAll("input[type=file]").forEach(input => input.value = "");
+ document
+ .querySelectorAll("input[type=file]")
+ .forEach((input) => (input.value = ""));
});
- document.addEventListener('upload-error', (event) => {
- console.log('Now in event listener "upload-error"')
+ document.addEventListener("upload-error", (event) => {
+ console.log('Now in event listener "upload-error"');
this.processUploadError(event);
});
- document.addEventListener('upload-failed', (event) => {
- console.log('Now in event listener "upload-failed"')
+ document.addEventListener("upload-failed", (event) => {
+ console.log('Now in event listener "upload-failed"');
this.processUploadError(event);
});
-
-
},
save() {
@@ -322,7 +334,7 @@ let create = function () {
this.formStates.isSubmitting = true;
for (let i in this.entries) {
- if (Object.hasOwn(this.entries,i)) {
+ if (Object.hasOwn(this.entries, i)) {
this.entries[i].errors = defaultErrorSet();
}
}
@@ -331,67 +343,92 @@ let create = function () {
this.detectTransactionType();
// parse transaction:
- let transactions = parseFromEntries(this.entries, null, this.groupProperties.transactionType);
+ let transactions = parseFromEntries(
+ this.entries,
+ null,
+ this.groupProperties.transactionType,
+ );
let submission = {
group_title: this.groupProperties.title,
fire_webhooks: this.formStates.webhooksButton,
apply_rules: this.formStates.rulesButton,
- transactions: transactions
+ transactions: transactions,
};
// catch for group title:
- if (transactions.length > 1 && ('' === submission.group_title || null === submission.group_title)) {
+ if (
+ transactions.length > 1 &&
+ ("" === submission.group_title ||
+ null === submission.group_title)
+ ) {
submission.group_title = transactions[0].description;
}
// submit the transaction. Multi-stage process thing going on here!
let poster = new Post();
- poster.post(submission).then((response) => {
- this.formStates.storedGroup = true;
- const group = response.data.data;
- // submission was a success!
- this.groupProperties.id = parseInt(group.id);
- this.groupProperties.title = group.attributes.group_title ?? group.attributes.transactions[0].description;
-
- // submit all transaction links, based on the order of the transaction IDs
- let transactions = [];
- for (let i = 0; i < group.attributes.transactions.length; i++) {
- if (Object.hasOwn(group.attributes.transactions,i)) {
- transactions.push(parseInt(group.attributes.transactions[i].transaction_journal_id));
+ poster
+ .post(submission)
+ .then((response) => {
+ this.formStates.storedGroup = true;
+ const group = response.data.data;
+ // submission was a success!
+ this.groupProperties.id = parseInt(group.id);
+ this.groupProperties.title =
+ group.attributes.group_title ??
+ group.attributes.transactions[0].description;
+
+ // submit all transaction links, based on the order of the transaction IDs
+ let transactions = [];
+ for (
+ let i = 0;
+ i < group.attributes.transactions.length;
+ i++
+ ) {
+ if (Object.hasOwn(group.attributes.transactions, i)) {
+ transactions.push(
+ parseInt(
+ group.attributes.transactions[i]
+ .transaction_journal_id,
+ ),
+ );
+ }
+ }
+ console.log("Go to process transactions", transactions);
+ this.processTransactionLinks(transactions);
+ console.log("Done with process transactions", transactions);
+ // process attachments, if any:
+ const attachmentCount = processAttachments(
+ this.groupProperties.id,
+ group.attributes.transactions,
+ );
+ if (0 === attachmentCount) {
+ this.formStates.storedAttachments = true;
+ }
+ if (attachmentCount > 0) {
+ // if count is more than zero, system is processing transactions in the background.
+ this.notifications.wait.show = true;
+ this.notifications.wait.text = i18next.t(
+ "firefly.wait_attachments",
+ );
+ return;
}
- }
- console.log('Go to process transactions', transactions);
- this.processTransactionLinks(transactions);
- console.log('Done with process transactions', transactions);
- // process attachments, if any:
- const attachmentCount = processAttachments(this.groupProperties.id, group.attributes.transactions);
- if (0 === attachmentCount) {
- this.formStates.storedAttachments = true;
- }
- if (attachmentCount > 0) {
- // if count is more than zero, system is processing transactions in the background.
- this.notifications.wait.show = true;
- this.notifications.wait.text = i18next.t('firefly.wait_attachments');
- return;
- }
- this.showMessageOrRedirectUser();
- }).catch((error) => {
- this.formStates.isSubmitting = true;
- if (typeof error.response !== 'undefined') {
- this.parseErrors(error.response.data);
- }
- });
+ this.showMessageOrRedirectUser();
+ })
+ .catch((error) => {
+ this.formStates.isSubmitting = true;
+ if (typeof error.response !== "undefined") {
+ this.parseErrors(error.response.data);
+ }
+ });
},
+ };
+};
-
- }
-}
-
-let comps = {create, sidebar, dates};
+let comps = { create, sidebar, dates };
function loadPage() {
- Object.keys(comps).forEach(comp => {
+ Object.keys(comps).forEach((comp) => {
console.log(`Loading page component "${comp}"`);
let data = comps[comp]();
Alpine.data(comp, () => data);
@@ -400,12 +437,12 @@ function loadPage() {
}
// wait for load until bootstrapped event is received.
-document.addEventListener('firefly-iii-bootstrapped', () => {
- console.log('Loaded through event listener.');
+document.addEventListener("firefly-iii-bootstrapped", () => {
+ console.log("Loaded through event listener.");
loadPage();
});
// or is bootstrapped before event is triggered.
if (window.bootstrapped) {
- console.log('Loaded through window variable.');
+ console.log("Loaded through window variable.");
loadPage();
}
diff --git a/resources/assets/v3/js/pages/transactions/edit.js b/resources/assets/v3/js/pages/transactions/edit.js
index 823351a87d..2c111c07c8 100644
--- a/resources/assets/v3/js/pages/transactions/edit.js
+++ b/resources/assets/v3/js/pages/transactions/edit.js
@@ -18,56 +18,62 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
-import '../../boot/bootstrap.js';
-import dates from '../../pages/shared/dates.js';
+import "../../boot/bootstrap.js";
+import dates from "../../pages/shared/dates.js";
import Get from "../../api/model/transaction/get.js";
-import {parseDownloadedSplits} from "./shared/parse-downloaded-splits.js";
-import {addAllAutocompleteToForm, getUrls} from "./shared/add-autocomplete.js";
-import {loadCurrencies} from "./shared/load-currencies.js";
-import {loadBudgets} from "./shared/load-budgets.js";
-import {loadPiggyBanks} from "./shared/load-piggy-banks.js";
-import {processUploadError} from "./shared/process-upload-error.js";
-import {loadSubscriptions} from "./shared/load-subscriptions.js";
+import { parseDownloadedSplits } from "./shared/parse-downloaded-splits.js";
+import {
+ addAllAutocompleteToForm,
+ getUrls,
+} from "./shared/add-autocomplete.js";
+import { loadCurrencies } from "./shared/load-currencies.js";
+import { loadBudgets } from "./shared/load-budgets.js";
+import { loadPiggyBanks } from "./shared/load-piggy-banks.js";
+import { processUploadError } from "./shared/process-upload-error.js";
+import { loadSubscriptions } from "./shared/load-subscriptions.js";
import Tags from "bootstrap5-tags";
import i18next from "i18next";
-import {defaultErrorSet} from "./shared/create-empty-split.js";
-import {parseFromEntries} from "./shared/parse-from-entries.js";
+import { defaultErrorSet } from "./shared/create-empty-split.js";
+import { parseFromEntries } from "./shared/parse-from-entries.js";
import Put from "../../api/model/transaction/put.js";
-import {showMessageOrRedirectUser} from "./shared/show-message-or-redirect.js";
-import {processAttachments} from "./shared/process-attachments.js";
+import { showMessageOrRedirectUser } from "./shared/show-message-or-redirect.js";
+import { processAttachments } from "./shared/process-attachments.js";
import sidebar from "../shared/sidebar.js";
-import {disableSplitAccounts} from "./shared/disable-split-accounts.js";
-import {parseTotalAmount} from "./shared/parse-total-amount.js";
-import {keyUpFromCategory} from "./shared/keyup-from-category.js";
-import {changedAmount} from "./shared/changed-amount.js";
-import {changedForeignAmount} from "./shared/changed-foreign-amount.js";
-import {parseErrors} from "./shared/parse-errors.js";
-import {addSplit} from "./shared/add-split.js";
-import {clearDestinationAccount, clearSourceAccount} from "./shared/clear-fields.js";
-import {detectTransactionType} from "./shared/detect-transaction-type.js";
-import {determineAmountCurrency} from "./shared/determine-amount-currency.js";
-import {loadCustomFields} from './shared/load-custom-fields.js';
-import {displayMap} from "./shared/display-map.js";
-import {loadDefaultCoordinates} from './shared/load-default-coordinates.js';
-import {renderMap} from './shared/render-map.js';
-import 'leaflet/dist/leaflet.css';
-import {onMapClick} from './shared/on-map-click.js';
-import {onMapZoom} from './shared/on-map-zoom.js';
-import {clearLocation} from './shared/clear-location.js';
-import {removeSplit} from "./shared/remove-split.js";
-import {loadTransactionLinks} from './shared/load-transaction-links.js';
-import {createLinkAutocomplete} from "./shared/create-link-autocomplete.js";
-import {editLink} from "./shared/edit-link.js";
-import {switchLink} from "./shared/switch-link.js";
-import {removeLink} from "./shared/remove-link.js";
-import {saveEditedLink} from "./shared/save-edited-link.js";
-import {saveNewLink} from "./shared/save-new-link.js";
-import {processTransactionLinks} from "./shared/process-transaction-links.js";
-import {redirectAfterTransactionLinks} from "./shared/redirect-after-transaction-links.js";
-import {addTabListener} from "./shared/add-tab-listener.js";
-import {autoStep} from "./shared/auto-step.js";
-import {respondToTabSwitch} from "./shared/respond-to-tab-switch.js";
-import Alpine from 'alpinejs'
+import { disableSplitAccounts } from "./shared/disable-split-accounts.js";
+import { parseTotalAmount } from "./shared/parse-total-amount.js";
+import { keyUpFromCategory } from "./shared/keyup-from-category.js";
+import { changedAmount } from "./shared/changed-amount.js";
+import { changedForeignAmount } from "./shared/changed-foreign-amount.js";
+import { parseErrors } from "./shared/parse-errors.js";
+import { addSplit } from "./shared/add-split.js";
+import {
+ clearDestinationAccount,
+ clearSourceAccount,
+} from "./shared/clear-fields.js";
+import { detectTransactionType } from "./shared/detect-transaction-type.js";
+import { determineAmountCurrency } from "./shared/determine-amount-currency.js";
+import { loadCustomFields } from "./shared/load-custom-fields.js";
+import { displayMap } from "./shared/display-map.js";
+import { loadDefaultCoordinates } from "./shared/load-default-coordinates.js";
+import { renderMap } from "./shared/render-map.js";
+import "leaflet/dist/leaflet.css";
+import { onMapClick } from "./shared/on-map-click.js";
+import { onMapZoom } from "./shared/on-map-zoom.js";
+import { clearLocation } from "./shared/clear-location.js";
+import { removeSplit } from "./shared/remove-split.js";
+import { loadTransactionLinks } from "./shared/load-transaction-links.js";
+import { createLinkAutocomplete } from "./shared/create-link-autocomplete.js";
+import { editLink } from "./shared/edit-link.js";
+import { switchLink } from "./shared/switch-link.js";
+import { removeLink } from "./shared/remove-link.js";
+import { saveEditedLink } from "./shared/save-edited-link.js";
+import { saveNewLink } from "./shared/save-new-link.js";
+import { processTransactionLinks } from "./shared/process-transaction-links.js";
+import { redirectAfterTransactionLinks } from "./shared/redirect-after-transaction-links.js";
+import { addTabListener } from "./shared/add-tab-listener.js";
+import { autoStep } from "./shared/auto-step.js";
+import { respondToTabSwitch } from "./shared/respond-to-tab-switch.js";
+import Alpine from "alpinejs";
const urls = getUrls();
window.enableDates = false;
@@ -108,7 +114,7 @@ let transactions = function () {
// form behavior during transaction
formBehaviour: {
- formType: 'edit',
+ formType: "edit",
foreignCurrencyEnabled: true,
categorySelectVisible: false,
customFields: {},
@@ -135,23 +141,30 @@ let transactions = function () {
// properties for the entire transaction group
groupProperties: {
- transactionType: 'unknown',
+ transactionType: "unknown",
titleErrors: [],
title: null,
editTitle: null,
- id: null, totalAmount: 0,
+ id: null,
+ totalAmount: 0,
},
// notifications
notifications: {
error: {
- show: false, text: '', url: '',
- }, success: {
- show: false, text: '', url: '',
- }, wait: {
- show: false, text: '',
-
- }
+ show: false,
+ text: "",
+ url: "",
+ },
+ success: {
+ show: false,
+ text: "",
+ url: "",
+ },
+ wait: {
+ show: false,
+ text: "",
+ },
},
// shared functions between edit/create
@@ -193,19 +206,19 @@ let transactions = function () {
// part of the account selection auto-complete
changedDateTime() {
- console.warn('changedDateTime, event is not used');
+ console.warn("changedDateTime, event is not used");
},
changedDescription() {
- console.warn('changedDescription, event is not used');
+ console.warn("changedDescription, event is not used");
},
changedDestinationAccount() {
- console.warn('changedDestinationAccount, event is not used');
+ console.warn("changedDestinationAccount, event is not used");
},
changedSourceAccount() {
- console.warn('changedSourceAccount, event is not used');
+ console.warn("changedSourceAccount, event is not used");
},
getTags(index) {
@@ -214,89 +227,116 @@ let transactions = function () {
getTransactionGroup() {
this.entries = [];
- const page = window.location.href.split('/');
+ const page = window.location.href.split("/");
const groupId = parseInt(page[page.length - 1]);
const getter = new Get();
- getter.show(groupId, {}).then((response) => {
- const data = response.data.data;
- this.formStates.loadingTransaction = false;
- this.groupProperties.id = parseInt(data.id);
- this.groupProperties.transactionType = data.attributes.transactions[0].type.toLowerCase();
- this.groupProperties.title = data.attributes.group_title ?? data.attributes.transactions[0].description;
- this.entries = parseDownloadedSplits(data.attributes.transactions, parseInt(data.id));
-
- // set empty arrays
- for (let i = 0; i < this.entries.length; i++) {
- this.links[i] = []; // empty set of links.
- }
-
- // set amountCurrency.
- for (let i in this.formData.enabledCurrencies) {
- if (Object.hasOwn(this.formData.enabledCurrencies, i)) {
- if (this.formData.enabledCurrencies[i].code === this.entries[0].currency_code) {
- this.formData.amountCurrency = this.formData.enabledCurrencies[i];
- }
+ getter
+ .show(groupId, {})
+ .then((response) => {
+ const data = response.data.data;
+ this.formStates.loadingTransaction = false;
+ this.groupProperties.id = parseInt(data.id);
+ this.groupProperties.transactionType =
+ data.attributes.transactions[0].type.toLowerCase();
+ this.groupProperties.title =
+ data.attributes.group_title ??
+ data.attributes.transactions[0].description;
+ this.entries = parseDownloadedSplits(
+ data.attributes.transactions,
+ parseInt(data.id),
+ );
+
+ // set empty arrays
+ for (let i = 0; i < this.entries.length; i++) {
+ this.links[i] = []; // empty set of links.
}
- }
- // limit foreignCurrencies to a single one when it's a transfer
- if ('transfer' === this.groupProperties.transactionType) {
- this.formData.foreignCurrencies = [];
+
+ // set amountCurrency.
for (let i in this.formData.enabledCurrencies) {
if (Object.hasOwn(this.formData.enabledCurrencies, i)) {
- if (this.formData.enabledCurrencies[i].code === this.entries[0].forein_currency_code) {
- this.formData.foreignCurrencies.push(this.formData.enabledCurrencies[i]);
+ if (
+ this.formData.enabledCurrencies[i].code ===
+ this.entries[0].currency_code
+ ) {
+ this.formData.amountCurrency =
+ this.formData.enabledCurrencies[i];
}
}
}
- }
- this.autoStep();
- // remove waiting thing.
- this.notifications.wait.show = false;
- }).then(() => {
- this.groupProperties.totalAmount = 0;
- for (let i in this.entries) {
- if (Object.hasOwn(this.entries, i)) {
- this.groupProperties.totalAmount = this.groupProperties.totalAmount + parseFloat(this.entries[i].amount);
- }
- }
- setTimeout(() => {
- // send event that transaction group is loaded.
- // document.dispatchEvent(new CustomEvent('transaction-group-loaded'));
-
- // TODO should not be on a timeout.
- // render tags:
- Tags.init('select.ac-tags', {
- allowClear: true,
- server: urls.tag,
- liveServer: true,
- clearEnd: true,
- allowNew: true,
- labelField: 'title',
- valueField: 'id',
- queryParam: 'filter[query]',
- notFoundMessage: i18next.t('firefly.nothing_found'),
- noCache: true,
- fetchOptions: {
- headers: {
- 'X-CSRF-TOKEN': document.head.querySelector('meta[name="csrf-token"]').content
+ // limit foreignCurrencies to a single one when it's a transfer
+ if ("transfer" === this.groupProperties.transactionType) {
+ this.formData.foreignCurrencies = [];
+ for (let i in this.formData.enabledCurrencies) {
+ if (
+ Object.hasOwn(
+ this.formData.enabledCurrencies,
+ i,
+ )
+ ) {
+ if (
+ this.formData.enabledCurrencies[i].code ===
+ this.entries[0].forein_currency_code
+ ) {
+ this.formData.foreignCurrencies.push(
+ this.formData.enabledCurrencies[i],
+ );
+ }
}
}
- });
- }, 150);
- this.autoStep();
- });
+ }
+ this.autoStep();
+ // remove waiting thing.
+ this.notifications.wait.show = false;
+ })
+ .then(() => {
+ this.groupProperties.totalAmount = 0;
+ for (let i in this.entries) {
+ if (Object.hasOwn(this.entries, i)) {
+ this.groupProperties.totalAmount =
+ this.groupProperties.totalAmount +
+ parseFloat(this.entries[i].amount);
+ }
+ }
+ setTimeout(() => {
+ // send event that transaction group is loaded.
+ // document.dispatchEvent(new CustomEvent('transaction-group-loaded'));
+
+ // TODO should not be on a timeout.
+ // render tags:
+ Tags.init("select.ac-tags", {
+ allowClear: true,
+ server: urls.tag,
+ liveServer: true,
+ clearEnd: true,
+ allowNew: true,
+ labelField: "title",
+ valueField: "id",
+ queryParam: "filter[query]",
+ notFoundMessage: i18next.t("firefly.nothing_found"),
+ noCache: true,
+ fetchOptions: {
+ headers: {
+ "X-CSRF-TOKEN": document.head.querySelector(
+ 'meta[name="csrf-token"]',
+ ).content,
+ },
+ },
+ });
+ }, 150);
+ this.autoStep();
+ });
},
-
init() {
-
this.i18next = i18next;
// download translations and get the transaction group.
this.notifications.wait.show = true;
- this.notifications.wait.text = i18next.t('firefly.wait_loading_transaction');
+ this.notifications.wait.text = i18next.t(
+ "firefly.wait_loading_transaction",
+ );
// load meta data.
- loadCurrencies().then(data => {
+ loadCurrencies().then((data) => {
this.formStates.loadingCurrencies = false;
this.formData.primaryCurrency = data.primaryCurrency;
this.formData.enabledCurrencies = data.enabledCurrencies;
@@ -307,40 +347,41 @@ let transactions = function () {
this.autoStep();
});
- loadBudgets(true).then(data => {
+ loadBudgets(true).then((data) => {
this.formData.budgets = data;
this.formStates.loadingBudgets = false;
this.autoStep();
});
- loadPiggyBanks().then(data => {
+ loadPiggyBanks().then((data) => {
this.formData.piggyBanks = data;
this.formStates.loadingPiggyBanks = false;
this.autoStep();
});
- loadSubscriptions(true).then(data => {
+ loadSubscriptions(true).then((data) => {
this.formData.subscriptions = data;
this.formStates.loadingSubscriptions = false;
this.autoStep();
});
// load custom field preference and enable/disable those fields.
- this.loadCustomFields().then(data => {
+ this.loadCustomFields().then((data) => {
this.formBehaviour.customFields = data;
this.autoStep();
});
// add some event listeners
- document.addEventListener('upload-success', () => {
+ document.addEventListener("upload-success", () => {
this.processUpload();
- document.querySelectorAll("input[type=file]").forEach(input => input.value = "");
+ document
+ .querySelectorAll("input[type=file]")
+ .forEach((input) => (input.value = ""));
});
- document.addEventListener('upload-error', (event) => {
+ document.addEventListener("upload-error", (event) => {
this.processUploadError(event);
});
},
-
// TODO is a duplicate
processUpload() {
this.showMessageOrRedirectUser();
@@ -361,16 +402,23 @@ let transactions = function () {
}
}
// parse transaction:
- let transactions = parseFromEntries(this.entries, this.originals, this.groupProperties.transactionType);
+ let transactions = parseFromEntries(
+ this.entries,
+ this.originals,
+ this.groupProperties.transactionType,
+ );
let submission = {
group_title: this.groupProperties.title,
fire_webhooks: this.formStates.webhooksButton,
apply_rules: this.formStates.rulesButton,
- transactions: transactions
+ transactions: transactions,
};
// catch for group title:
- if (null === this.groupProperties.title && transactions.length > 1) {
+ if (
+ null === this.groupProperties.title &&
+ transactions.length > 1
+ ) {
submission.group_title = transactions[0].description;
}
if (1 === transactions.length) {
@@ -379,45 +427,64 @@ let transactions = function () {
// submit the transaction. Multi-stage process thing going on here!
let putter = new Put();
- putter.put(submission, {id: this.groupProperties.id}).then((response) => {
- this.formStates.storedGroup = true;
- const group = response.data.data;
-
- // submission was a success!
- this.groupProperties.id = parseInt(group.id);
- this.groupProperties.title = group.attributes.group_title ?? group.attributes.transactions[0].description;
-
- // process transaction links
- // submit all transaction links, based on the order of the transaction IDs
- let transactions = [];
- for (let i = 0; i < group.attributes.transactions.length; i++) {
- if (Object.hasOwn(group.attributes.transactions, i)) {
- transactions.push(parseInt(group.attributes.transactions[i].transaction_journal_id));
+ putter
+ .put(submission, { id: this.groupProperties.id })
+ .then((response) => {
+ this.formStates.storedGroup = true;
+ const group = response.data.data;
+
+ // submission was a success!
+ this.groupProperties.id = parseInt(group.id);
+ this.groupProperties.title =
+ group.attributes.group_title ??
+ group.attributes.transactions[0].description;
+
+ // process transaction links
+ // submit all transaction links, based on the order of the transaction IDs
+ let transactions = [];
+ for (
+ let i = 0;
+ i < group.attributes.transactions.length;
+ i++
+ ) {
+ if (Object.hasOwn(group.attributes.transactions, i)) {
+ transactions.push(
+ parseInt(
+ group.attributes.transactions[i]
+ .transaction_journal_id,
+ ),
+ );
+ }
+ }
+ this.processTransactionLinks(transactions);
+
+ // process attachments, if any:
+ const attachmentCount = processAttachments(
+ this.groupProperties.id,
+ group.attributes.transactions,
+ );
+ if (0 === attachmentCount) {
+ this.formStates.storedAttachments = true;
+ }
+ if (attachmentCount > 0) {
+ // if count is more than zero, system is processing transactions in the background.
+ this.notifications.wait.show = true;
+ this.notifications.wait.text = i18next.t(
+ "firefly.wait_attachments",
+ );
+ return;
}
- }
- this.processTransactionLinks(transactions);
-
- // process attachments, if any:
- const attachmentCount = processAttachments(this.groupProperties.id, group.attributes.transactions);
- if (0 === attachmentCount) {
- this.formStates.storedAttachments = true;
- }
- if (attachmentCount > 0) {
- // if count is more than zero, system is processing transactions in the background.
- this.notifications.wait.show = true;
- this.notifications.wait.text = i18next.t('firefly.wait_attachments');
- return;
- }
- // if not, respond to user options:
- this.showMessageOrRedirectUser();
- }).catch((error) => {
- console.log(error);
- this.formStates.isSubmitting = false;
- if (typeof error.response !== 'undefined') {
- this.parseErrors(error.response.data);
- }
- });
+ // if not, respond to user options:
+ this.showMessageOrRedirectUser();
+ })
+ .catch((error) => {
+ console.log(error);
+ this.formStates.isSubmitting = false;
+ if (typeof error.response !== "undefined") {
+ this.parseErrors(error.response.data);
+ }
+ });
},
// exclusive to edit form, used to initialize splits.
@@ -426,15 +493,13 @@ let transactions = function () {
this.addAllAutocompleteToForm();
this.addTabListener();
},
+ };
+};
- }
-}
-
-let comps = {transactions, sidebar, dates};
-
+let comps = { transactions, sidebar, dates };
function loadPage() {
- Object.keys(comps).forEach(comp => {
+ Object.keys(comps).forEach((comp) => {
console.log(`Loading page component "${comp}"`);
let data = comps[comp]();
Alpine.data(comp, () => data);
@@ -443,12 +508,12 @@ function loadPage() {
}
// wait for load until bootstrapped event is received.
-document.addEventListener('firefly-iii-bootstrapped', () => {
- console.log('Loaded through event listener.');
+document.addEventListener("firefly-iii-bootstrapped", () => {
+ console.log("Loaded through event listener.");
loadPage();
});
// or is bootstrapped before event is triggered.
if (window.bootstrapped) {
- console.log('Loaded through window variable.');
+ console.log("Loaded through window variable.");
loadPage();
}
diff --git a/resources/assets/v3/js/pages/transactions/mass-edit.js b/resources/assets/v3/js/pages/transactions/mass-edit.js
index e54a1720e7..a67e459944 100644
--- a/resources/assets/v3/js/pages/transactions/mass-edit.js
+++ b/resources/assets/v3/js/pages/transactions/mass-edit.js
@@ -18,11 +18,11 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
-import '../../boot/bootstrap.js';
-import sidebar from '../../pages/shared/sidebar.js';
-import dates from '../shared/dates.js';
-import {addAutocomplete} from "./shared/add-autocomplete.js";
-import Alpine from 'alpinejs'
+import "../../boot/bootstrap.js";
+import sidebar from "../../pages/shared/sidebar.js";
+import dates from "../shared/dates.js";
+import { addAutocomplete } from "./shared/add-autocomplete.js";
+import Alpine from "alpinejs";
window.enableDates = false;
@@ -33,51 +33,48 @@ let edit = function () {
// AC for description
addAutocomplete({
- selector: 'input.ac-description',
- serverUrl: '/api/v1/autocomplete/transactions',
- valueField: 'description',
- labelField: 'description',
+ selector: "input.ac-description",
+ serverUrl: "/api/v1/autocomplete/transactions",
+ valueField: "description",
+ labelField: "description",
});
-
// AC for destination account
addAutocomplete({
- selector: 'input.ac-destination',
- serverUrl: '/api/v1/autocomplete/accounts',
- valueField: 'name',
- labelField: 'name',
+ selector: "input.ac-destination",
+ serverUrl: "/api/v1/autocomplete/accounts",
+ valueField: "name",
+ labelField: "name",
});
// AC for source account
addAutocomplete({
- selector: 'input.ac-source',
- serverUrl: '/api/v1/autocomplete/accounts',
- valueField: 'name',
- labelField: 'name',
+ selector: "input.ac-source",
+ serverUrl: "/api/v1/autocomplete/accounts",
+ valueField: "name",
+ labelField: "name",
});
// AC for category
addAutocomplete({
- selector: 'input.ac-category',
- serverUrl: '/api/v1/autocomplete/categories',
- valueField: 'name',
- labelField: 'name',
+ selector: "input.ac-category",
+ serverUrl: "/api/v1/autocomplete/categories",
+ valueField: "name",
+ labelField: "name",
});
-
- }
- }
+ },
+ };
};
-
const comps = {
edit,
sidebar,
- dates
+ dates,
};
function loadPage(comps) {
// console.log('loadPage');
- Object.keys(comps).forEach(comp => {
+ Object.keys(comps).forEach((comp) => {
let data = comps[comp]();
Alpine.data(comp, () => data);
// console.log(comp);
@@ -86,7 +83,7 @@ function loadPage(comps) {
}
// wait for load until bootstrapped event is received.
-document.addEventListener('firefly-iii-bootstrapped', () => {
+document.addEventListener("firefly-iii-bootstrapped", () => {
// console.log('Loaded through event listener.');
loadPage(comps);
});
diff --git a/resources/assets/v3/js/pages/transactions/shared/add-autocomplete.js b/resources/assets/v3/js/pages/transactions/shared/add-autocomplete.js
index b7108cb464..5519d13e42 100644
--- a/resources/assets/v3/js/pages/transactions/shared/add-autocomplete.js
+++ b/resources/assets/v3/js/pages/transactions/shared/add-autocomplete.js
@@ -21,21 +21,22 @@
import Autocomplete from "bootstrap5-autocomplete";
import i18next from "i18next";
import {
- changeCategory, changeDescription,
+ changeCategory,
+ changeDescription,
changeDestinationAccount,
changeSourceAccount,
selectDestinationAccount,
- selectSourceAccount
+ selectSourceAccount,
} from "./autocomplete-functions.js";
import Tags from "bootstrap5-tags";
export function getUrls() {
return {
- description: '/api/v1/autocomplete/transactions',
- account: '/api/v1/autocomplete/accounts',
- category: '/api/v1/autocomplete/categories',
- tag: '/api/v1/autocomplete/tags',
- }
+ description: "/api/v1/autocomplete/transactions",
+ account: "/api/v1/autocomplete/accounts",
+ category: "/api/v1/autocomplete/categories",
+ tag: "/api/v1/autocomplete/tags",
+ };
}
export function addAllAutocompleteToForm() {
@@ -43,22 +44,33 @@ export function addAllAutocompleteToForm() {
// part of the account selection auto-complete
let filters = {
// source can never be expense account
- source: ['Asset account', 'Loan', 'Debt', 'Mortgage', 'Revenue account'],
+ source: [
+ "Asset account",
+ "Loan",
+ "Debt",
+ "Mortgage",
+ "Revenue account",
+ ],
// destination can never be revenue account
- destination: ['Expense account', 'Loan', 'Debt', 'Mortgage', 'Asset account'],
+ destination: [
+ "Expense account",
+ "Loan",
+ "Debt",
+ "Mortgage",
+ "Asset account",
+ ],
};
// depending on the type of the transaction,
// the filters are changed. For edit form, this means
// the available account types may be limited.
- if('edit' === this.formBehaviour.formType) {
-
- if('withdrawal' === this.groupProperties.transactionType) {
+ if ("edit" === this.formBehaviour.formType) {
+ if ("withdrawal" === this.groupProperties.transactionType) {
// filters.destination = ['Expense account'];
}
- if('deposit' === this.groupProperties.transactionType) {
+ if ("deposit" === this.groupProperties.transactionType) {
// filters.source = ['Revenue account'];
}
- if('transfer' === this.groupProperties.transactionType) {
+ if ("transfer" === this.groupProperties.transactionType) {
filters.source = [this.entries[0].source_account.type];
filters.destination = [this.entries[0].source_account.type];
}
@@ -69,61 +81,68 @@ export function addAllAutocompleteToForm() {
// addedSplit, is called from the HTML
// for source account
const renderAccount = function (item) {
- return item.name_with_balance + '<br><small class="text-muted">' + i18next.t('firefly.account_type_' + item.type) + '</small>';
+ return (
+ item.name_with_balance +
+ '<br><small class="text-muted">' +
+ i18next.t("firefly.account_type_" + item.type) +
+ "</small>"
+ );
};
// render tags:
- Tags.init('select.ac-tags', {
+ Tags.init("select.ac-tags", {
allowClear: true,
server: urls.tag,
liveServer: true,
clearEnd: true,
- labelField: 'tag',
- valueField: 'tag',
- queryParam: 'query',
+ labelField: "tag",
+ valueField: "tag",
+ queryParam: "query",
allowNew: true,
//serverDataKey: 'data',
- notFoundMessage: i18next.t('firefly.nothing_found'),
+ notFoundMessage: i18next.t("firefly.nothing_found"),
noCache: true,
fetchOptions: {
headers: {
- 'X-CSRF-TOKEN': document.head.querySelector('meta[name="csrf-token"]').content
- }
- }
+ "X-CSRF-TOKEN": document.head.querySelector(
+ 'meta[name="csrf-token"]',
+ ).content,
+ },
+ },
});
addAutocomplete({
- selector: 'input.ac-source',
+ selector: "input.ac-source",
serverUrl: urls.account,
account_types: filters.source,
onRenderItem: renderAccount,
- valueField: 'id',
- labelField: 'name',
+ valueField: "id",
+ labelField: "name",
onChange: changeSourceAccount,
- onSelectItem: selectSourceAccount
+ onSelectItem: selectSourceAccount,
});
addAutocomplete({
- selector: 'input.ac-dest',
+ selector: "input.ac-dest",
serverUrl: urls.account,
- valueField: 'id',
- labelField: 'name',
+ valueField: "id",
+ labelField: "name",
account_types: filters.destination,
onRenderItem: renderAccount,
onChange: changeDestinationAccount,
- onSelectItem: selectDestinationAccount
+ onSelectItem: selectDestinationAccount,
});
addAutocomplete({
- selector: 'input.ac-category',
+ selector: "input.ac-category",
serverUrl: urls.category,
- valueField: 'id',
- labelField: 'name',
+ valueField: "id",
+ labelField: "name",
onChange: changeCategory,
- onSelectItem: changeCategory
+ onSelectItem: changeCategory,
});
addAutocomplete({
- selector: 'input.ac-description',
+ selector: "input.ac-description",
serverUrl: urls.description,
- valueField: 'id',
- labelField: 'name',
+ valueField: "id",
+ labelField: "name",
onChange: changeDescription,
onSelectItem: changeDescription,
});
@@ -136,24 +155,32 @@ export function addAutocomplete(options) {
serverParams: {},
fixed: true,
fetchOptions: {
- method: 'GET',
- credentials: 'include',
+ method: "GET",
+ credentials: "include",
headers: {
- 'Content-Type': 'application/json',
- 'Accept': 'application/json',
- 'X-CSRF-TOKEN': document.head.querySelector('meta[name="csrf-token"]').content
- }
+ "Content-Type": "application/json",
+ Accept: "application/json",
+ "X-CSRF-TOKEN": document.head.querySelector(
+ 'meta[name="csrf-token"]',
+ ).content,
+ },
},
- queryParam: 'query',
+ queryParam: "query",
hiddenInput: true,
// preventBrowserAutocomplete: true,
highlightTyped: true,
liveServer: true,
};
- if (typeof options.account_types !== 'undefined' && options.account_types.length > 0) {
- params.serverParams['types'] = options.account_types;
+ if (
+ typeof options.account_types !== "undefined" &&
+ options.account_types.length > 0
+ ) {
+ params.serverParams["types"] = options.account_types;
}
- if (typeof options.onRenderItem !== 'undefined' && null !== options.onRenderItem) {
+ if (
+ typeof options.onRenderItem !== "undefined" &&
+ null !== options.onRenderItem
+ ) {
params.onRenderItem = options.onRenderItem;
}
if (options.valueField) {
@@ -168,7 +195,7 @@ export function addAutocomplete(options) {
if (options.onChange) {
params.onChange = options.onChange;
}
- if(options.hiddenValue) {
+ if (options.hiddenValue) {
params.hiddenValue = options.hiddenValue;
}
diff --git a/resources/assets/v3/js/pages/transactions/shared/add-split.js b/resources/assets/v3/js/pages/transactions/shared/add-split.js
index ceecb81370..b27268c685 100644
--- a/resources/assets/v3/js/pages/transactions/shared/add-split.js
+++ b/resources/assets/v3/js/pages/transactions/shared/add-split.js
@@ -18,7 +18,7 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
-import {createEmptySplit} from "./create-empty-split.js";
+import { createEmptySplit } from "./create-empty-split.js";
export function addSplit() {
this.entries.push(createEmptySplit());
diff --git a/resources/assets/v3/js/pages/transactions/shared/add-tab-listener.js b/resources/assets/v3/js/pages/transactions/shared/add-tab-listener.js
index 05a7508211..54f2eef97c 100644
--- a/resources/assets/v3/js/pages/transactions/shared/add-tab-listener.js
+++ b/resources/assets/v3/js/pages/transactions/shared/add-tab-listener.js
@@ -20,10 +20,14 @@
export function addTabListener() {
// on switch tab (to re-render map if necessary).
- const tabEl = document.querySelectorAll('button[data-bs-toggle="tab"]')
+ const tabEl = document.querySelectorAll('button[data-bs-toggle="tab"]');
// console.log('tabEl length is now', tabEl.length);
- for (let i = 0; i < tabEl.length; i++) {
- tabEl[i].removeEventListener('shown.bs.tab', this.respondToTabSwitch);
- tabEl[i].addEventListener('shown.bs.tab', this.respondToTabSwitch.bind(this), true);
+ for (let i = 0; i < tabEl.length; i++) {
+ tabEl[i].removeEventListener("shown.bs.tab", this.respondToTabSwitch);
+ tabEl[i].addEventListener(
+ "shown.bs.tab",
+ this.respondToTabSwitch.bind(this),
+ true,
+ );
}
}
diff --git a/resources/assets/v3/js/pages/transactions/shared/auto-step.js b/resources/assets/v3/js/pages/transactions/shared/auto-step.js
index 04d9ce48fb..ae5e4f2eef 100644
--- a/resources/assets/v3/js/pages/transactions/shared/auto-step.js
+++ b/resources/assets/v3/js/pages/transactions/shared/auto-step.js
@@ -21,14 +21,18 @@
// this method automatically calls some
// "next steps", whenever the state of the form loads or changes.
// used during the init phase of the form.
-import {loadLinkTypes} from "./load-link-types.js";
+import { loadLinkTypes } from "./load-link-types.js";
export function autoStep() {
// check if custom field "links" is enabled and if so, load the link types and save them in formData.
- if (null === this.formStates.loadingLinks && Object.hasOwn(this.formBehaviour.customFields, 'links') && true === this.formBehaviour.customFields.links) {
+ if (
+ null === this.formStates.loadingLinks &&
+ Object.hasOwn(this.formBehaviour.customFields, "links") &&
+ true === this.formBehaviour.customFields.links
+ ) {
this.formStates.loadingLinks = true;
- loadLinkTypes().then(data => {
- console.log('done loadLinkTypes()');
+ loadLinkTypes().then((data) => {
+ console.log("done loadLinkTypes()");
for (let i = 0; i < data.length; i++) {
if (Object.hasOwn(data, i)) {
let current = data[i];
@@ -38,24 +42,39 @@ export function autoStep() {
}
this.formStates.loadingLinks = false;
this.autoStep(); // yes, recurring.
-
});
}
- if (Object.hasOwn(this.formBehaviour.customFields, 'links') && false === this.formBehaviour.customFields.links) {
+ if (
+ Object.hasOwn(this.formBehaviour.customFields, "links") &&
+ false === this.formBehaviour.customFields.links
+ ) {
this.formStates.storedLinks = true;
this.formStates.loadingLinks = false;
}
// check if the transaction is loaded and also the transaction links AND the field is enabled, then load the autocomplete for links.
- if (false === this.formStates.loadingTransaction && false === this.formStates.loadingLinks && Object.hasOwn(this.formBehaviour.customFields, 'links') && true === this.formBehaviour.customFields.links) {
- for(let i = 0; i < this.entries.length; i++) {
- if(Object.hasOwn(this.entries, i)) {
- this.createLinkAutocomplete('links_modal_search_' + i, 'api/v1/autocomplete/transactions-with-meta');
- if(0 !== parseInt(this.entries[i].transaction_journal_id) && !isNaN(parseInt(this.entries[i].transaction_journal_id))) {
+ if (
+ false === this.formStates.loadingTransaction &&
+ false === this.formStates.loadingLinks &&
+ Object.hasOwn(this.formBehaviour.customFields, "links") &&
+ true === this.formBehaviour.customFields.links
+ ) {
+ for (let i = 0; i < this.entries.length; i++) {
+ if (Object.hasOwn(this.entries, i)) {
+ this.createLinkAutocomplete(
+ "links_modal_search_" + i,
+ "api/v1/autocomplete/transactions-with-meta",
+ );
+ if (
+ 0 !== parseInt(this.entries[i].transaction_journal_id) &&
+ !isNaN(parseInt(this.entries[i].transaction_journal_id))
+ ) {
// load the links for this transaction journal.
- this.loadTransactionLinks(i, parseInt(this.entries[i].transaction_journal_id));
+ this.loadTransactionLinks(
+ i,
+ parseInt(this.entries[i].transaction_journal_id),
+ );
}
}
}
}
-
}
diff --git a/resources/assets/v3/js/pages/transactions/shared/autocomplete-functions.js b/resources/assets/v3/js/pages/transactions/shared/autocomplete-functions.js
index a59ed3de5e..13daefb383 100644
--- a/resources/assets/v3/js/pages/transactions/shared/autocomplete-functions.js
+++ b/resources/assets/v3/js/pages/transactions/shared/autocomplete-functions.js
@@ -19,63 +19,107 @@
*/
export function changeCategory(item, ac) {
- const index = parseInt(ac._searchInput.attributes['data-index'].value);
- if (typeof item !== 'undefined' && item.name) {
- document.querySelector('#form')._x_dataStack[0].$data.entries[index].category_name = item.name;
+ const index = parseInt(ac._searchInput.attributes["data-index"].value);
+ if (typeof item !== "undefined" && item.name) {
+ document.querySelector("#form")._x_dataStack[0].$data.entries[
+ index
+ ].category_name = item.name;
return;
}
- document.querySelector('#form')._x_dataStack[0].$data.entries[index].category_name = ac._searchInput.value;
+ document.querySelector("#form")._x_dataStack[0].$data.entries[
+ index
+ ].category_name = ac._searchInput.value;
}
export function changeDescription(item, ac) {
- const index = parseInt(ac._searchInput.attributes['data-index'].value);
- if (typeof item !== 'undefined' && item.description) {
- document.querySelector('#form')._x_dataStack[0].$data.entries[index].description = item.description;
+ const index = parseInt(ac._searchInput.attributes["data-index"].value);
+ if (typeof item !== "undefined" && item.description) {
+ document.querySelector("#form")._x_dataStack[0].$data.entries[
+ index
+ ].description = item.description;
return;
}
- document.querySelector('#form')._x_dataStack[0].$data.entries[index].description = ac._searchInput.value;
+ document.querySelector("#form")._x_dataStack[0].$data.entries[
+ index
+ ].description = ac._searchInput.value;
}
export function changeDestinationAccount(item, ac) {
- if (typeof item === 'undefined') {
- const index = parseInt(ac._searchInput.attributes['data-index'].value);
- let destination = document.querySelector('#form')._x_dataStack[0].$data.entries[index].destination_account;
+ if (typeof item === "undefined") {
+ const index = parseInt(ac._searchInput.attributes["data-index"].value);
+ let destination =
+ document.querySelector("#form")._x_dataStack[0].$data.entries[index]
+ .destination_account;
if (destination.name === ac._searchInput.value) {
- console.warn('Ignore hallucinated destination account name change to "' + ac._searchInput.value + '"');
+ console.warn(
+ 'Ignore hallucinated destination account name change to "' +
+ ac._searchInput.value +
+ '"',
+ );
return;
}
- document.querySelector('#form')._x_dataStack[0].$data.entries[index].destination_account = {
- name: ac._searchInput.value, alpine_name: ac._searchInput.value,
+ document.querySelector("#form")._x_dataStack[0].$data.entries[
+ index
+ ].destination_account = {
+ name: ac._searchInput.value,
+ alpine_name: ac._searchInput.value,
};
- document.querySelector('#form')._x_dataStack[0].changedDestinationAccount(index);
+ document
+ .querySelector("#form")
+ ._x_dataStack[0].changedDestinationAccount(index);
}
}
export function selectDestinationAccount(item, ac) {
- const index = parseInt(ac._searchInput.attributes['data-index'].value);
- const newAccount = {id: item.id, name: item.name, alpine_name: item.name, type: item.type, currency_code: item.currency_code,};
- document.querySelector('#form')._x_dataStack[0].$data.entries[index].destination_account = newAccount;
- document.querySelector('#form')._x_dataStack[0].changedDestinationAccount(index);
+ const index = parseInt(ac._searchInput.attributes["data-index"].value);
+ const newAccount = {
+ id: item.id,
+ name: item.name,
+ alpine_name: item.name,
+ type: item.type,
+ currency_code: item.currency_code,
+ };
+ document.querySelector("#form")._x_dataStack[0].$data.entries[
+ index
+ ].destination_account = newAccount;
+ document
+ .querySelector("#form")
+ ._x_dataStack[0].changedDestinationAccount(index);
}
export function changeSourceAccount(item, ac) {
- if (typeof item === 'undefined') {
- const index = parseInt(ac._searchInput.attributes['data-index'].value);
- let source = document.querySelector('#form')._x_dataStack[0].$data.entries[index].source_account;
+ if (typeof item === "undefined") {
+ const index = parseInt(ac._searchInput.attributes["data-index"].value);
+ let source =
+ document.querySelector("#form")._x_dataStack[0].$data.entries[index]
+ .source_account;
if (source.name === ac._searchInput.value) {
return;
}
- document.querySelector('#form')._x_dataStack[0].$data.entries[index].source_account = {
- name: ac._searchInput.value, alpine_name: ac._searchInput.value,
+ document.querySelector("#form")._x_dataStack[0].$data.entries[
+ index
+ ].source_account = {
+ name: ac._searchInput.value,
+ alpine_name: ac._searchInput.value,
};
- document.querySelector('#form')._x_dataStack[0].changedSourceAccount(index);
+ document
+ .querySelector("#form")
+ ._x_dataStack[0].changedSourceAccount(index);
}
}
export function selectSourceAccount(item, ac) {
- const index = parseInt(ac._searchInput.attributes['data-index'].value);
- const newAccount = {id: item.id, name: item.name, alpine_name: item.name, type: item.type, currency_code: item.currency_code,};
- document.querySelector('#form')._x_dataStack[0].$data.entries[index].source_account = newAccount;
- document.querySelector('#form')._x_dataStack[0].changedSourceAccount(index);
+ const index = parseInt(ac._searchInput.attributes["data-index"].value);
+ const newAccount = {
+ id: item.id,
+ name: item.name,
+ alpine_name: item.name,
+ type: item.type,
+ currency_code: item.currency_code,
+ };
+ document.querySelector("#form")._x_dataStack[0].$data.entries[
+ index
+ ].source_account = newAccount;
+ document.querySelector("#form")._x_dataStack[0].changedSourceAccount(index);
}
diff --git a/resources/assets/v3/js/pages/transactions/shared/changed-amount.js b/resources/assets/v3/js/pages/transactions/shared/changed-amount.js
index 63cb3fa35a..a093e5a77d 100644
--- a/resources/assets/v3/js/pages/transactions/shared/changed-amount.js
+++ b/resources/assets/v3/js/pages/transactions/shared/changed-amount.js
@@ -24,7 +24,9 @@ export function changedAmount(e) {
this.groupProperties.totalAmount = 0;
for (let i in this.entries) {
if (Object.hasOwn(this.entries, i)) {
- this.groupProperties.totalAmount = this.groupProperties.totalAmount + parseFloat(this.entries[i].amount);
+ this.groupProperties.totalAmount =
+ this.groupProperties.totalAmount +
+ parseFloat(this.entries[i].amount);
}
}
}
diff --git a/resources/assets/v3/js/pages/transactions/shared/clear-fields.js b/resources/assets/v3/js/pages/transactions/shared/clear-fields.js
index d4d85856a0..e84d9763c4 100644
--- a/resources/assets/v3/js/pages/transactions/shared/clear-fields.js
+++ b/resources/assets/v3/js/pages/transactions/shared/clear-fields.js
@@ -18,7 +18,7 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
-import {getAccount} from "./create-empty-split.js";
+import { getAccount } from "./create-empty-split.js";
export function clearSourceAccount(index) {
this.entries[index].source_account = getAccount();
@@ -28,4 +28,4 @@ export function clearSourceAccount(index) {
export function clearDestinationAccount(index) {
this.entries[index].destination_account = getAccount();
this.detectTransactionType();
-};
+}
diff --git a/resources/assets/v3/js/pages/transactions/shared/clear-location.js b/resources/assets/v3/js/pages/transactions/shared/clear-location.js
index 327eecc448..82c8d2cd84 100644
--- a/resources/assets/v3/js/pages/transactions/shared/clear-location.js
+++ b/resources/assets/v3/js/pages/transactions/shared/clear-location.js
@@ -19,14 +19,13 @@
*/
export function clearLocation(e) {
-
let index = parseInt(e.currentTarget.dataset.index);
this.entries[index].hasLocation = false;
this.entries[index].latitude = null;
this.entries[index].longitude = null;
this.entries[index].zoom_level = null;
- if(Object.hasOwn(this.markers, index)) {
+ if (Object.hasOwn(this.markers, index)) {
this.maps[index].removeLayer(this.markers[index]);
}
}
diff --git a/resources/assets/v3/js/pages/transactions/shared/create-empty-split.js b/resources/assets/v3/js/pages/transactions/shared/create-empty-split.js
index d3ec61887a..2a63440fe0 100644
--- a/resources/assets/v3/js/pages/transactions/shared/create-empty-split.js
+++ b/resources/assets/v3/js/pages/transactions/shared/create-empty-split.js
@@ -18,14 +18,13 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
-
import format from "date-fns/format";
export function getAccount() {
return {
- id: '',
- name: '',
- alpine_name: '',
+ id: "",
+ name: "",
+ alpine_name: "",
disabled: false,
};
}
@@ -74,15 +73,15 @@ export function defaultErrorSet() {
export function createEmptySplit() {
let now = new Date();
- let formatted = format(now, 'yyyy-MM-dd HH:mm');
+ let formatted = format(now, "yyyy-MM-dd HH:mm");
return {
- description: '',
+ description: "",
// amount information:
- amount: '',
- currency_code: 'EUR',
- foreign_amount: '',
- foreign_currency_code: '',
+ amount: "",
+ currency_code: "EUR",
+ foreign_amount: "",
+ foreign_currency_code: "",
// source and destination
source_account: getAccount(),
@@ -90,15 +89,15 @@ export function createEmptySplit() {
// meta data information:
budget_id: null,
- category_name: '',
+ category_name: "",
piggy_bank_id: null,
bill_id: null,
tags: [],
- notes: '',
+ notes: "",
// other meta fields:
- internal_reference: '',
- external_url: '',
+ internal_reference: "",
+ external_url: "",
// map
hasLocation: false,
@@ -106,15 +105,14 @@ export function createEmptySplit() {
longitude: null,
zoom_level: null,
-
// date and time
date: formatted,
- interest_date: '',
- book_date: '',
- process_date: '',
- due_date: '',
- payment_date: '',
- invoice_date: '',
+ interest_date: "",
+ book_date: "",
+ process_date: "",
+ due_date: "",
+ payment_date: "",
+ invoice_date: "",
errors: defaultErrorSet(),
};
diff --git a/resources/assets/v3/js/pages/transactions/shared/create-link-autocomplete.js b/resources/assets/v3/js/pages/transactions/shared/create-link-autocomplete.js
index 212d812c44..ee1269b5a3 100644
--- a/resources/assets/v3/js/pages/transactions/shared/create-link-autocomplete.js
+++ b/resources/assets/v3/js/pages/transactions/shared/create-link-autocomplete.js
@@ -20,30 +20,41 @@
import Autocomplete from "bootstrap5-autocomplete";
import formatMoney from "../../../util/format-money.js";
-import {format} from "date-fns";
+import { format } from "date-fns";
export function createLinkAutocomplete(fieldIdentifier, url) {
- let token = document.querySelector('meta[name="csrf-token"]').getAttribute('content');
+ let token = document
+ .querySelector('meta[name="csrf-token"]')
+ .getAttribute("content");
const renderJournal = function (item) {
- return item.description + '<br><small class="text-muted">' + formatMoney(item.amount, item.currency_code) + ' @ ' + format(new Date(item.date), this.i18next.t('config.date_time_fns')) + '</small>';
+ return (
+ item.description +
+ '<br><small class="text-muted">' +
+ formatMoney(item.amount, item.currency_code) +
+ " @ " +
+ format(
+ new Date(item.date),
+ this.i18next.t("config.date_time_fns"),
+ ) +
+ "</small>"
+ );
};
- Autocomplete.init('#' + fieldIdentifier, {
-
- server: url + '?_token=' + token,
- labelField: 'name',
+ Autocomplete.init("#" + fieldIdentifier, {
+ server: url + "?_token=" + token,
+ labelField: "name",
hiddenInput: true,
- valueField: 'id',
+ valueField: "id",
liveServer: true,
onRenderItem: renderJournal.bind(this),
fetchOptions: {
- method: 'GET',
- credentials: 'include',
+ method: "GET",
+ credentials: "include",
headers: {
- 'Content-Type': 'application/json',
- 'Accept': 'application/json',
- 'X-CSRF-TOKEN': token
- }
- }
+ "Content-Type": "application/json",
+ Accept: "application/json",
+ "X-CSRF-TOKEN": token,
+ },
+ },
});
-};
+}
diff --git a/resources/assets/v3/js/pages/transactions/shared/detect-transaction-type.js b/resources/assets/v3/js/pages/transactions/shared/detect-transaction-type.js
index e93bd58d21..5046c72b6b 100644
--- a/resources/assets/v3/js/pages/transactions/shared/detect-transaction-type.js
+++ b/resources/assets/v3/js/pages/transactions/shared/detect-transaction-type.js
@@ -19,81 +19,160 @@
*/
export function detectTransactionType() {
- const sourceType = this.entries[0].source_account.type ?? 'unknown';
- const destType = this.entries[0].destination_account.type ?? 'unknown';
- if ('unknown' === sourceType && 'unknown' === destType) {
- this.groupProperties.transactionType = 'unknown';
- console.warn('Cannot infer transaction type from two unknown accounts.');
+ const sourceType = this.entries[0].source_account.type ?? "unknown";
+ const destType = this.entries[0].destination_account.type ?? "unknown";
+ if ("unknown" === sourceType && "unknown" === destType) {
+ this.groupProperties.transactionType = "unknown";
+ console.warn(
+ "Cannot infer transaction type from two unknown accounts.",
+ );
this.disableSplitAccounts();
return;
}
// transfer: both are the same and in strict set of account types
- if (sourceType === destType && ['Asset account', 'Loan', 'Debt', 'Mortgage'].includes(sourceType)) {
- this.groupProperties.transactionType = 'transfer';
- console.log('Transaction type is detected to be "' + this.groupProperties.transactionType + '".');
+ if (
+ sourceType === destType &&
+ ["Asset account", "Loan", "Debt", "Mortgage"].includes(sourceType)
+ ) {
+ this.groupProperties.transactionType = "transfer";
+ console.log(
+ 'Transaction type is detected to be "' +
+ this.groupProperties.transactionType +
+ '".',
+ );
// this also locks the amount into the amount of the source account
// and the foreign amount (if different) in that of the destination account.
- console.log('filter down currencies for transfer.');
- this.determineAmountCurrency(this.entries[0].source_account.currency_code);
- this.filterForeignCurrencies(this.entries[0].destination_account.currency_code);
+ console.log("filter down currencies for transfer.");
+ this.determineAmountCurrency(
+ this.entries[0].source_account.currency_code,
+ );
+ this.filterForeignCurrencies(
+ this.entries[0].destination_account.currency_code,
+ );
this.disableSplitAccounts();
return;
}
// withdrawals:
- if ('Asset account' === sourceType && ['Expense account', 'Debt', 'Loan', 'Mortgage'].includes(destType)) {
- this.groupProperties.transactionType = 'withdrawal';
- console.log('[a] Transaction type is detected to be "' + this.groupProperties.transactionType + '".');
- this.determineAmountCurrency(this.entries[0].source_account.currency_code);
+ if (
+ "Asset account" === sourceType &&
+ ["Expense account", "Debt", "Loan", "Mortgage"].includes(destType)
+ ) {
+ this.groupProperties.transactionType = "withdrawal";
+ console.log(
+ '[a] Transaction type is detected to be "' +
+ this.groupProperties.transactionType +
+ '".',
+ );
+ this.determineAmountCurrency(
+ this.entries[0].source_account.currency_code,
+ );
this.disableSplitAccounts();
return;
}
- if ('Asset account' === sourceType && 'unknown' === destType) {
- this.groupProperties.transactionType = 'withdrawal';
- console.log('[b] Transaction type is detected to be "' + this.groupProperties.transactionType + '".');
- this.determineAmountCurrency(this.entries[0].source_account.currency_code);
+ if ("Asset account" === sourceType && "unknown" === destType) {
+ this.groupProperties.transactionType = "withdrawal";
+ console.log(
+ '[b] Transaction type is detected to be "' +
+ this.groupProperties.transactionType +
+ '".',
+ );
+ this.determineAmountCurrency(
+ this.entries[0].source_account.currency_code,
+ );
this.disableSplitAccounts();
return;
}
- if (['Debt', 'Loan', 'Mortgage'].includes(sourceType) && 'Expense account' === destType) {
- this.groupProperties.transactionType = 'withdrawal';
- console.log('[c] Transaction type is detected to be "' + this.groupProperties.transactionType + '".');
- this.determineAmountCurrency(this.entries[0].source_account.currency_code);
+ if (
+ ["Debt", "Loan", "Mortgage"].includes(sourceType) &&
+ "Expense account" === destType
+ ) {
+ this.groupProperties.transactionType = "withdrawal";
+ console.log(
+ '[c] Transaction type is detected to be "' +
+ this.groupProperties.transactionType +
+ '".',
+ );
+ this.determineAmountCurrency(
+ this.entries[0].source_account.currency_code,
+ );
this.disableSplitAccounts();
return;
}
// deposits:
- if ('Revenue account' === sourceType && ['Asset account', 'Debt', 'Loan', 'Mortgage'].includes(destType)) {
- this.groupProperties.transactionType = 'deposit';
- console.log('Transaction type is detected to be "' + this.groupProperties.transactionType + '".');
+ if (
+ "Revenue account" === sourceType &&
+ ["Asset account", "Debt", "Loan", "Mortgage"].includes(destType)
+ ) {
+ this.groupProperties.transactionType = "deposit";
+ console.log(
+ 'Transaction type is detected to be "' +
+ this.groupProperties.transactionType +
+ '".',
+ );
this.disableSplitAccounts();
- this.determineAmountCurrency(this.entries[0].destination_account.currency_code);
+ this.determineAmountCurrency(
+ this.entries[0].destination_account.currency_code,
+ );
return;
}
- if ('unknown' === sourceType && ['Asset account', 'Debt', 'Loan', 'Mortgage'].includes(destType)) {
- this.groupProperties.transactionType = 'deposit';
- console.log('Transaction type is detected to be "' + this.groupProperties.transactionType + '".');
- this.determineAmountCurrency(this.entries[0].destination_account.currency_code);
+ if (
+ "unknown" === sourceType &&
+ ["Asset account", "Debt", "Loan", "Mortgage"].includes(destType)
+ ) {
+ this.groupProperties.transactionType = "deposit";
+ console.log(
+ 'Transaction type is detected to be "' +
+ this.groupProperties.transactionType +
+ '".',
+ );
+ this.determineAmountCurrency(
+ this.entries[0].destination_account.currency_code,
+ );
this.disableSplitAccounts();
return;
}
- if ('Expense account' === sourceType && ['Asset account', 'Debt', 'Loan', 'Mortgage'].includes(destType)) {
- this.groupProperties.transactionType = 'deposit';
- console.warn('FORCE transaction type to be "' + this.groupProperties.transactionType + '".');
- this.entries[0].source_account.id = '';
- this.determineAmountCurrency(this.entries[0].destination_account.currency_code);
+ if (
+ "Expense account" === sourceType &&
+ ["Asset account", "Debt", "Loan", "Mortgage"].includes(destType)
+ ) {
+ this.groupProperties.transactionType = "deposit";
+ console.warn(
+ 'FORCE transaction type to be "' +
+ this.groupProperties.transactionType +
+ '".',
+ );
+ this.entries[0].source_account.id = "";
+ this.determineAmountCurrency(
+ this.entries[0].destination_account.currency_code,
+ );
this.disableSplitAccounts();
return;
}
- if (['Debt', 'Loan', 'Mortgage'].includes(sourceType) && 'Asset account' === destType) {
- this.groupProperties.transactionType = 'deposit';
- console.log('Transaction type is detected to be "' + this.groupProperties.transactionType + '".');
- this.determineAmountCurrency(this.entries[0].destination_account.currency_code);
+ if (
+ ["Debt", "Loan", "Mortgage"].includes(sourceType) &&
+ "Asset account" === destType
+ ) {
+ this.groupProperties.transactionType = "deposit";
+ console.log(
+ 'Transaction type is detected to be "' +
+ this.groupProperties.transactionType +
+ '".',
+ );
+ this.determineAmountCurrency(
+ this.entries[0].destination_account.currency_code,
+ );
this.disableSplitAccounts();
return;
}
- console.warn('Unknown account combination between "' + sourceType + '" and "' + destType + '".');
+ console.warn(
+ 'Unknown account combination between "' +
+ sourceType +
+ '" and "' +
+ destType +
+ '".',
+ );
this.disableSplitAccounts();
-};
+}
diff --git a/resources/assets/v3/js/pages/transactions/shared/determine-amount-currency.js b/resources/assets/v3/js/pages/transactions/shared/determine-amount-currency.js
index 092a35e4af..3c16d60da7 100644
--- a/resources/assets/v3/js/pages/transactions/shared/determine-amount-currency.js
+++ b/resources/assets/v3/js/pages/transactions/shared/determine-amount-currency.js
@@ -30,7 +30,7 @@ export function determineAmountCurrency(code) {
}
}
list.push(currency);
- if(1 === list.length) {
+ if (1 === list.length) {
this.formData.amountCurrency = list[0];
// this also forces the currency_code on ALL entries.
for (let i in this.entries) {
@@ -39,4 +39,4 @@ export function determineAmountCurrency(code) {
}
}
}
-};
+}
diff --git a/resources/assets/v3/js/pages/transactions/shared/disable-split-accounts.js b/resources/assets/v3/js/pages/transactions/shared/disable-split-accounts.js
index 64ec8b52b0..7597a1fe63 100644
--- a/resources/assets/v3/js/pages/transactions/shared/disable-split-accounts.js
+++ b/resources/assets/v3/js/pages/transactions/shared/disable-split-accounts.js
@@ -18,21 +18,26 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
-
// what happens when a user adds more than one split?
export function disableSplitAccounts() {
//console.log('Call disableSplitAccounts');
- if(this.entries.length > 1) {
+ if (this.entries.length > 1) {
//console.log('Activate disableSplitAccounts');
// disable source and/or destination, based on account type.
- for(let i = 1;i<this.entries.length;i++) {
+ for (let i = 1; i < this.entries.length; i++) {
// disable source when withdrawal or transfer
- if('transfer' === this.groupProperties.transactionType || 'withdrawal' === this.groupProperties.transactionType) {
+ if (
+ "transfer" === this.groupProperties.transactionType ||
+ "withdrawal" === this.groupProperties.transactionType
+ ) {
this.entries[i].source_account.disabled = true;
// console.log('Disable source account #' + i + 1);
}
// disable destination when deposit or transfer
- if('transfer' === this.groupProperties.transactionType || 'deposit' === this.groupProperties.transactionType) {
+ if (
+ "transfer" === this.groupProperties.transactionType ||
+ "deposit" === this.groupProperties.transactionType
+ ) {
this.entries[i].destination_account.disabled = true;
// console.log('Disable destination account #' + i + 1);
}
diff --git a/resources/assets/v3/js/pages/transactions/shared/display-map.js b/resources/assets/v3/js/pages/transactions/shared/display-map.js
index 311d9fa4e7..7d29447d42 100644
--- a/resources/assets/v3/js/pages/transactions/shared/display-map.js
+++ b/resources/assets/v3/js/pages/transactions/shared/display-map.js
@@ -22,13 +22,13 @@ export function displayMap(index) {
index = parseInt(index);
// show location?
if (true === this.formBehaviour.customFields.location) {
- if(true === this.entries[index].hasLocation) {
+ if (true === this.entries[index].hasLocation) {
this.renderMap(index, false);
return;
}
if (false === this.formBehaviour.defaultCoordinates.loaded) {
// load first, then show map.
- this.loadDefaultCoordinates().then(data => {
+ this.loadDefaultCoordinates().then((data) => {
this.formBehaviour.defaultCoordinates = data;
this.renderMap(index, true);
});
diff --git a/resources/assets/v3/js/pages/transactions/shared/edit-link.js b/resources/assets/v3/js/pages/transactions/shared/edit-link.js
index 7d69a01140..3acf2c31ed 100644
--- a/resources/assets/v3/js/pages/transactions/shared/edit-link.js
+++ b/resources/assets/v3/js/pages/transactions/shared/edit-link.js
@@ -18,9 +18,8 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
-
export function editLink(e) {
let rowIndex = parseInt(e.currentTarget.dataset.rowIndex);
let index = parseInt(e.currentTarget.dataset.index);
this.links[index][rowIndex].editMode = true;
-};
+}
diff --git a/resources/assets/v3/js/pages/transactions/shared/keyup-from-category.js b/resources/assets/v3/js/pages/transactions/shared/keyup-from-category.js
index c71d93972a..0cf6d5f771 100644
--- a/resources/assets/v3/js/pages/transactions/shared/keyup-from-category.js
+++ b/resources/assets/v3/js/pages/transactions/shared/keyup-from-category.js
@@ -18,10 +18,12 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
-export function keyUpFromCategory(e) {
- if (e.key === 'Enter' && false === this.formStates.categorySelectVisible) {
+export function keyUpFromCategory(e) {
+ if (e.key === "Enter" && false === this.formStates.categorySelectVisible) {
this.save();
return;
}
- this.formStates.categorySelectVisible = document.querySelector('input.ac-category').nextSibling.classList.contains('show');
+ this.formStates.categorySelectVisible = document
+ .querySelector("input.ac-category")
+ .nextSibling.classList.contains("show");
}
diff --git a/resources/assets/v3/js/pages/transactions/shared/load-budgets.js b/resources/assets/v3/js/pages/transactions/shared/load-budgets.js
index 2e1fa1cd98..c4ef3ad52d 100644
--- a/resources/assets/v3/js/pages/transactions/shared/load-budgets.js
+++ b/resources/assets/v3/js/pages/transactions/shared/load-budgets.js
@@ -18,24 +18,27 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
-
import Get from "../../../api/model/budget/get.js";
import i18next from "i18next";
export function loadBudgets(includeInactive) {
let params = {
- page: 1, limit: 1337
+ page: 1,
+ limit: 1337,
};
let getter = new Get();
return getter.list(params).then((response) => {
- let returnData = [{
- id: 0, name: '(no budget)',
- }];
+ let returnData = [
+ {
+ id: 0,
+ name: "(no budget)",
+ },
+ ];
for (let i in response.data.data) {
if (Object.hasOwn(response.data.data, i)) {
let current = response.data.data[i];
- if(true === current.attributes.active) {
+ if (true === current.attributes.active) {
let obj = {
id: current.id,
name: current.attributes.name,
@@ -43,10 +46,14 @@ export function loadBudgets(includeInactive) {
returnData.push(obj);
continue;
}
- if(includeInactive && false === current.attributes.active) {
+ if (includeInactive && false === current.attributes.active) {
let obj = {
id: current.id,
- name: current.attributes.name + ' ('+i18next.t('firefly.inactive').toLowerCase()+')',
+ name:
+ current.attributes.name +
+ " (" +
+ i18next.t("firefly.inactive").toLowerCase() +
+ ")",
};
returnData.push(obj);
}
@@ -54,5 +61,4 @@ export function loadBudgets(includeInactive) {
}
return returnData;
});
-
}
diff --git a/resources/assets/v3/js/pages/transactions/shared/load-currencies.js b/resources/assets/v3/js/pages/transactions/shared/load-currencies.js
index 89df756fb9..c85e9992f6 100644
--- a/resources/assets/v3/js/pages/transactions/shared/load-currencies.js
+++ b/resources/assets/v3/js/pages/transactions/shared/load-currencies.js
@@ -18,12 +18,12 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
-
import Get from "../../../api/model/currency/get.js";
export function loadCurrencies() {
let params = {
- page: 1, limit: 1337
+ page: 1,
+ limit: 1337,
};
let getter = new Get();
return getter.list(params).then((response) => {
@@ -35,22 +35,25 @@ export function loadCurrencies() {
};
returnData.foreignCurrencies.push({
- id: 0, name: '(no foreign currency)', code: '__NO_CODE__', default: false, symbol: '', decimal_places: 2,
+ id: 0,
+ name: "(no foreign currency)",
+ code: "__NO_CODE__",
+ default: false,
+ symbol: "",
+ decimal_places: 2,
});
for (let i in response.data.data) {
if (Object.hasOwn(response.data.data, i)) {
let current = response.data.data[i];
if (current.attributes.enabled) {
- let obj =
- {
- id: current.id,
- name: current.attributes.name,
- code: current.attributes.code,
- primary: current.attributes.primary,
- symbol: current.attributes.symbol,
- decimal_places: current.attributes.decimal_places,
-
- };
+ let obj = {
+ id: current.id,
+ name: current.attributes.name,
+ code: current.attributes.code,
+ primary: current.attributes.primary,
+ symbol: current.attributes.symbol,
+ decimal_places: current.attributes.decimal_places,
+ };
if (obj.primary) {
//console.log('Made ' + obj.code + ' primary.');
returnData.primaryCurrency = obj;
diff --git a/resources/assets/v3/js/pages/transactions/shared/load-custom-fields.js b/resources/assets/v3/js/pages/transactions/shared/load-custom-fields.js
index 5accb2a71d..5080847b4c 100644
--- a/resources/assets/v3/js/pages/transactions/shared/load-custom-fields.js
+++ b/resources/assets/v3/js/pages/transactions/shared/load-custom-fields.js
@@ -1,4 +1,3 @@
-
/*
* load-custom-fields.js
* Copyright (c) 2026 [email protected]
@@ -19,10 +18,12 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
-import Preferences from '../../../api/preferences/index.js';
+import Preferences from "../../../api/preferences/index.js";
export function loadCustomFields() {
- return (new Preferences()).getByName('transaction_journal_optional_fields').then(data => {
- return data.data.data.attributes.data;
- });
+ return new Preferences()
+ .getByName("transaction_journal_optional_fields")
+ .then((data) => {
+ return data.data.data.attributes.data;
+ });
}
diff --git a/resources/assets/v3/js/pages/transactions/shared/load-default-coordinates.js b/resources/assets/v3/js/pages/transactions/shared/load-default-coordinates.js
index 2924007634..5550e8cb87 100644
--- a/resources/assets/v3/js/pages/transactions/shared/load-default-coordinates.js
+++ b/resources/assets/v3/js/pages/transactions/shared/load-default-coordinates.js
@@ -21,7 +21,9 @@
import Configuration from "../../../api/configuration/get.js";
export function loadDefaultCoordinates() {
- return (new Configuration()).getByName('firefly.default_location').then(data => {
- return data.data.data.value;
- });
+ return new Configuration()
+ .getByName("firefly.default_location")
+ .then((data) => {
+ return data.data.data.value;
+ });
}
diff --git a/resources/assets/v3/js/pages/transactions/shared/load-link-types.js b/resources/assets/v3/js/pages/transactions/shared/load-link-types.js
index 664e8fb2a7..0558e13dd7 100644
--- a/resources/assets/v3/js/pages/transactions/shared/load-link-types.js
+++ b/resources/assets/v3/js/pages/transactions/shared/load-link-types.js
@@ -2,7 +2,8 @@ import Get from "../../../api/model/link-type/get.js";
export function loadLinkTypes() {
let params = {
- page: 1, limit: 1337
+ page: 1,
+ limit: 1337,
};
let getter = new Get();
return getter.list(params).then((response) => {
diff --git a/resources/assets/v3/js/pages/transactions/shared/load-piggy-banks.js b/resources/assets/v3/js/pages/transactions/shared/load-piggy-banks.js
index 175d4d7c96..72bd34d678 100644
--- a/resources/assets/v3/js/pages/transactions/shared/load-piggy-banks.js
+++ b/resources/assets/v3/js/pages/transactions/shared/load-piggy-banks.js
@@ -22,42 +22,57 @@ import Get from "../../../api/model/piggy-bank/get.js";
export function loadPiggyBanks() {
let params = {
- page: 1, limit: 1337
+ page: 1,
+ limit: 1337,
};
let getter = new Get();
return getter.list(params).then((response) => {
let piggyBanks = {
- '0': {
- id: 0, name: '(no group)', order: 0, piggyBanks: [{
- id: 0, name: '(no piggy bank)', order: 0,
- }]
- }
+ 0: {
+ id: 0,
+ name: "(no group)",
+ order: 0,
+ piggyBanks: [
+ {
+ id: 0,
+ name: "(no piggy bank)",
+ order: 0,
+ },
+ ],
+ },
};
for (let i in response.data.data) {
if (Object.hasOwn(response.data.data, i)) {
let current = response.data.data[i];
- let objectGroupId = current.attributes.object_group_id ?? '0';
- let objectGroupTitle = current.attributes.object_group_title ?? '(no group)';
+ let objectGroupId = current.attributes.object_group_id ?? "0";
+ let objectGroupTitle =
+ current.attributes.object_group_title ?? "(no group)";
let piggyBank = {
- id: current.id, name: current.attributes.name, order: current.attributes.order,
+ id: current.id,
+ name: current.attributes.name,
+ order: current.attributes.order,
};
if (!Object.hasOwn(piggyBanks, objectGroupId)) {
piggyBanks[objectGroupId] = {
id: objectGroupId,
name: objectGroupTitle,
order: current.attributes.object_group_order ?? 0,
- piggyBanks: []
+ piggyBanks: [],
};
}
piggyBanks[objectGroupId].piggyBanks.push(piggyBank);
- piggyBanks[objectGroupId].piggyBanks.sort((a, b) => a.order - b.order);
+ piggyBanks[objectGroupId].piggyBanks.sort(
+ (a, b) => a.order - b.order,
+ );
}
}
//tempObject.sort((a,b) => a.order - b.order);
- return Object.keys(piggyBanks).sort().reduce((obj, key) => {
- obj[key] = piggyBanks[key];
- return obj;
- }, {});
+ return Object.keys(piggyBanks)
+ .sort()
+ .reduce((obj, key) => {
+ obj[key] = piggyBanks[key];
+ return obj;
+ }, {});
});
}
diff --git a/resources/assets/v3/js/pages/transactions/shared/load-subscriptions.js b/resources/assets/v3/js/pages/transactions/shared/load-subscriptions.js
index dd82f328ea..68376c3fc1 100644
--- a/resources/assets/v3/js/pages/transactions/shared/load-subscriptions.js
+++ b/resources/assets/v3/js/pages/transactions/shared/load-subscriptions.js
@@ -23,28 +23,42 @@ import i18next from "i18next";
export function loadSubscriptions(includeInactive) {
let params = {
- page: 1, limit: 1337
+ page: 1,
+ limit: 1337,
};
let getter = new SubscriptionGet();
return getter.list(params).then((response) => {
let subscriptions = {
- '0': {
- id: 0, name: '(no group)', order: 0, subscriptions: [{
- id: 0, name: '(no subscription)', order: 0,
- }]
- }
+ 0: {
+ id: 0,
+ name: "(no group)",
+ order: 0,
+ subscriptions: [
+ {
+ id: 0,
+ name: "(no subscription)",
+ order: 0,
+ },
+ ],
+ },
};
for (let i in response.data.data) {
if (Object.hasOwn(response.data.data, i)) {
let current = response.data.data[i];
- let objectGroupId = current.attributes.object_group_id ?? '0';
- let objectGroupTitle = current.attributes.object_group_title ?? '(no group)';
+ let objectGroupId = current.attributes.object_group_id ?? "0";
+ let objectGroupTitle =
+ current.attributes.object_group_title ?? "(no group)";
let subscription = {
id: current.id,
- name: current.attributes.active ? current.attributes.name : current.attributes.name + ' ('+i18next.t('firefly.inactive').toLowerCase()+')',
+ name: current.attributes.active
+ ? current.attributes.name
+ : current.attributes.name +
+ " (" +
+ i18next.t("firefly.inactive").toLowerCase() +
+ ")",
order: current.attributes.order,
};
- if(!includeInactive && false === current.attributes.active) {
+ if (!includeInactive && false === current.attributes.active) {
// skip over inactive items.
continue;
}
@@ -53,16 +67,20 @@ export function loadSubscriptions(includeInactive) {
id: objectGroupId,
name: objectGroupTitle,
order: current.attributes.object_group_order ?? 0,
- subscriptions: []
+ subscriptions: [],
};
}
subscriptions[objectGroupId].subscriptions.push(subscription);
- subscriptions[objectGroupId].subscriptions.sort((a, b) => a.order - b.order);
+ subscriptions[objectGroupId].subscriptions.sort(
+ (a, b) => a.order - b.order,
+ );
}
}
- return Object.keys(subscriptions).sort().reduce((obj, key) => {
- obj[key] = subscriptions[key];
- return obj;
- }, {});
+ return Object.keys(subscriptions)
+ .sort()
+ .reduce((obj, key) => {
+ obj[key] = subscriptions[key];
+ return obj;
+ }, {});
});
}
diff --git a/resources/assets/v3/js/pages/transactions/shared/load-transaction-links.js b/resources/assets/v3/js/pages/transactions/shared/load-transaction-links.js
index fc702ef631..b8355120d4 100644
--- a/resources/assets/v3/js/pages/transactions/shared/load-transaction-links.js
+++ b/resources/assets/v3/js/pages/transactions/shared/load-transaction-links.js
@@ -1,50 +1,74 @@
-import Get from '../../../api/model/transaction/get.js';
+import Get from "../../../api/model/transaction/get.js";
export function loadTransactionLinks(index, journalId) {
- console.log('Get transaction links for index #' + index + ' and journal #' + journalId);
- (new Get).transactionLinks(journalId).then((data) => {
+ console.log(
+ "Get transaction links for index #" +
+ index +
+ " and journal #" +
+ journalId,
+ );
+ new Get().transactionLinks(journalId).then((data) => {
let links = data.data.data;
for (let i = 0; i < links.length; i++) {
if (Object.hasOwn(links, i)) {
let current = links[i];
console.log(current);
console.log(this.formData.linkTypes);
- let direction = parseInt(journalId) === parseInt(current.attributes.inward_id) ? 'inward' : 'outward';
- let otherJournal = parseInt(current.attributes.inward_id)
- if (parseInt(journalId) === parseInt(current.attributes.inward_id)) {
+ let direction =
+ parseInt(journalId) ===
+ parseInt(current.attributes.inward_id)
+ ? "inward"
+ : "outward";
+ let otherJournal = parseInt(current.attributes.inward_id);
+ if (
+ parseInt(journalId) ===
+ parseInt(current.attributes.inward_id)
+ ) {
otherJournal = parseInt(current.attributes.outward_id);
}
- (new Get).showJournal(otherJournal).then((response) => {
+ new Get().showJournal(otherJournal).then((response) => {
let group = response.data.data;
let foundJournal = null;
- for (let j = 0; j < group.attributes.transactions.length; j++) {
+ for (
+ let j = 0;
+ j < group.attributes.transactions.length;
+ j++
+ ) {
if (Object.hasOwn(group.attributes.transactions, j)) {
let journal = group.attributes.transactions[j];
- if (parseInt(journal.transaction_journal_id) === otherJournal) {
+ if (
+ parseInt(journal.transaction_journal_id) ===
+ otherJournal
+ ) {
foundJournal = journal;
}
}
}
if (null !== foundJournal) {
- console.log('showJournal');
- this.links[index].push(
- {
- id: parseInt(current.id),
- link_type: parseInt(current.attributes.link_type_id) + '_' + direction,
- link_type_id: parseInt(current.attributes.link_type_id),
- link_type_direction: direction,
- link_type_label: this.formData.linkTypes.find(link => link.id === parseInt(current.attributes.link_type_id))[direction],
- journal_id: parseInt(journalId),
- group_id: parseInt(group.id),
- journal_description: foundJournal.description,
- editMode: false,
- stored: false,
- }
- );
+ console.log("showJournal");
+ this.links[index].push({
+ id: parseInt(current.id),
+ link_type:
+ parseInt(current.attributes.link_type_id) +
+ "_" +
+ direction,
+ link_type_id: parseInt(
+ current.attributes.link_type_id,
+ ),
+ link_type_direction: direction,
+ link_type_label: this.formData.linkTypes.find(
+ (link) =>
+ link.id ===
+ parseInt(current.attributes.link_type_id),
+ )[direction],
+ journal_id: parseInt(journalId),
+ group_id: parseInt(group.id),
+ journal_description: foundJournal.description,
+ editMode: false,
+ stored: false,
+ });
}
});
-
-
}
}
});
diff --git a/resources/assets/v3/js/pages/transactions/shared/manage-locations.js b/resources/assets/v3/js/pages/transactions/shared/manage-locations.js
index 660574bb27..f1b65230d5 100644
--- a/resources/assets/v3/js/pages/transactions/shared/manage-locations.js
+++ b/resources/assets/v3/js/pages/transactions/shared/manage-locations.js
@@ -27,29 +27,30 @@ let markers = [];
// location-remove
-document.addEventListener('location-remove', (event) => {
+document.addEventListener("location-remove", (event) => {
markers[event.detail.index].remove();
});
-
function addPointToMap(e) {
// index is always 0.
// let index = parseInt(e.originalEvent.currentTarget.attributes['data-index'].value);
let index = 0;
- let hasLocation = document.querySelector('#form')._x_dataStack[0].$data.entries[index].hasLocation;
+ let hasLocation =
+ document.querySelector("#form")._x_dataStack[0].$data.entries[index]
+ .hasLocation;
if (false === hasLocation) {
- markers[index] = new L.marker(e.latlng, {draggable: true});
- markers[index].on('dragend', dragEnd);
+ markers[index] = new L.marker(e.latlng, { draggable: true });
+ markers[index].on("dragend", dragEnd);
markers[index].addTo(maps[index]);
- const setEvent = new CustomEvent('location-set', {
+ const setEvent = new CustomEvent("location-set", {
detail: {
latitude: e.latlng.lat,
longitude: e.latlng.lng,
index: index,
- zoomLevel: maps[index].getZoom()
- }
+ zoomLevel: maps[index].getZoom(),
+ },
});
document.dispatchEvent(setEvent);
}
@@ -58,11 +59,11 @@ function addPointToMap(e) {
function saveZoomOfMap() {
//let index = parseInt(e.sourceTarget._container.attributes['data-index'].value);
let index = 0;
- const zoomEvent = new CustomEvent('location-zoom', {
+ const zoomEvent = new CustomEvent("location-zoom", {
detail: {
index: index,
- zoomLevel: maps[index].getZoom()
- }
+ zoomLevel: maps[index].getZoom(),
+ },
});
document.dispatchEvent(zoomEvent);
}
@@ -70,36 +71,42 @@ function saveZoomOfMap() {
function dragEnd(event) {
let marker = event.target;
let position = marker.getLatLng();
- marker.setLatLng(new L.LatLng(position.lat, position.lng), {draggable: 'true'});
- const moveEvent = new CustomEvent('location-move', {
+ marker.setLatLng(new L.LatLng(position.lat, position.lng), {
+ draggable: "true",
+ });
+ const moveEvent = new CustomEvent("location-move", {
detail: {
latitude: position.lat,
longitude: position.lng,
- index: 0
- }
+ index: 0,
+ },
});
document.dispatchEvent(moveEvent);
}
export function addLocation(index) {
if (index > 0) {
- console.warn('Corwardly refuse to add a map on split #' + (index + 1));
+ console.warn("Corwardly refuse to add a map on split #" + (index + 1));
return;
}
- if (typeof maps[index] === 'undefined') {
+ if (typeof maps[index] === "undefined") {
// map holder is always the same:
//let holder = document.getElementById('location_map_' + index);
- let holder = document.getElementById('location_map');
+ let holder = document.getElementById("location_map");
if (holder) {
- maps[index] = L.map(holder).setView([holder.dataset.latitude, holder.dataset.longitude], holder.dataset.zoomLevel);
+ maps[index] = L.map(holder).setView(
+ [holder.dataset.latitude, holder.dataset.longitude],
+ holder.dataset.zoomLevel,
+ );
- L.tileLayer('https://tile.openstreetmap.org/{z}/{x}/{y}.png', {
+ L.tileLayer("https://tile.openstreetmap.org/{z}/{x}/{y}.png", {
maxZoom: 19,
- attribution: '&copy; <a href="http://www.openstreetmap.org/copyright">OpenStreetMap</a>'
+ attribution:
+ '&copy; <a href="http://www.openstreetmap.org/copyright">OpenStreetMap</a>',
}).addTo(maps[index]);
- maps[index].on('click', addPointToMap);
- maps[index].on('zoomend', saveZoomOfMap);
+ maps[index].on("click", addPointToMap);
+ maps[index].on("zoomend", saveZoomOfMap);
}
}
}
diff --git a/resources/assets/v3/js/pages/transactions/shared/on-map-click.js b/resources/assets/v3/js/pages/transactions/shared/on-map-click.js
index 9c7cfd3639..9a66cb2b4a 100644
--- a/resources/assets/v3/js/pages/transactions/shared/on-map-click.js
+++ b/resources/assets/v3/js/pages/transactions/shared/on-map-click.js
@@ -1,4 +1,3 @@
-
/*
* on-map-click.js
* Copyright (c) 2026 [email protected]
@@ -19,20 +18,20 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
-import L from 'leaflet';
+import L from "leaflet";
import markerIcon from "leaflet/dist/images/marker-icon.png";
import markerRetinaIcon from "leaflet/dist/images/marker-icon-2x.png";
-import shadow from 'leaflet/dist/images/marker-shadow.png';
+import shadow from "leaflet/dist/images/marker-shadow.png";
export function onMapClick(event) {
-
- L.Marker.prototype.setIcon(L.icon({
- iconUrl: markerIcon,
- iconRetinaIcon: markerRetinaIcon,
- shadowUrl: shadow,
- iconSize: [25, 41],
- iconAnchor: [12, 41]
- }));
-
+ L.Marker.prototype.setIcon(
+ L.icon({
+ iconUrl: markerIcon,
+ iconRetinaIcon: markerRetinaIcon,
+ shadowUrl: shadow,
+ iconSize: [25, 41],
+ iconAnchor: [12, 41],
+ }),
+ );
let index = parseInt(event.originalEvent.currentTarget.dataset.index);
this.entries[index].hasLocation = true;
@@ -41,10 +40,9 @@ export function onMapClick(event) {
this.entries[index].zoom_level = this.maps[index].getZoom();
// add marker.
- if(Object.hasOwn(this.markers, index)) {
+ if (Object.hasOwn(this.markers, index)) {
this.maps[index].removeLayer(this.markers[index]);
}
this.markers[index] = L.marker(event.latlng);
this.markers[index].addTo(this.maps[index]);
-
}
diff --git a/resources/assets/v3/js/pages/transactions/shared/on-map-zoom.js b/resources/assets/v3/js/pages/transactions/shared/on-map-zoom.js
index 747d24c36f..9351d98d58 100644
--- a/resources/assets/v3/js/pages/transactions/shared/on-map-zoom.js
+++ b/resources/assets/v3/js/pages/transactions/shared/on-map-zoom.js
@@ -1,4 +1,3 @@
-
/*
* on-map-zoom.js
* Copyright (c) 2026 [email protected]
diff --git a/resources/assets/v3/js/pages/transactions/shared/parse-downloaded-splits.js b/resources/assets/v3/js/pages/transactions/shared/parse-downloaded-splits.js
index f2572bec07..5712b5ce7b 100644
--- a/resources/assets/v3/js/pages/transactions/shared/parse-downloaded-splits.js
+++ b/resources/assets/v3/js/pages/transactions/shared/parse-downloaded-splits.js
@@ -18,8 +18,8 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
-import {createEmptySplit} from "./create-empty-split.js";
-import {format} from "date-fns";
+import { createEmptySplit } from "./create-empty-split.js";
+import { format } from "date-fns";
export function parseDownloadedSplits(downloads, groupId) {
let returnArray = [];
@@ -56,15 +56,19 @@ export function parseDownloadedSplits(downloads, groupId) {
current.tags = download.tags;
// amount
- current.amount = parseFloat(download.amount).toFixed(download.currency_decimal_places);
+ current.amount = parseFloat(download.amount).toFixed(
+ download.currency_decimal_places,
+ );
current.currency_code = download.currency_code;
- if(null !== download.foreign_amount) {
+ if (null !== download.foreign_amount) {
current.foreign_currency_code = download.foreign_currency_code;
- current.foreign_amount = parseFloat(download.foreign_amount).toFixed(download.foreign_currency_decimal_places);
+ current.foreign_amount = parseFloat(
+ download.foreign_amount,
+ ).toFixed(download.foreign_currency_decimal_places);
}
// date and description
- current.date = format(new Date(download.date), 'yyyy-MM-dd HH:mm');
+ current.date = format(new Date(download.date), "yyyy-MM-dd HH:mm");
current.description = download.description;
// source and destination
@@ -82,7 +86,7 @@ export function parseDownloadedSplits(downloads, groupId) {
alpine_name: download.source_name,
};
- if(null !== download.latitude) {
+ if (null !== download.latitude) {
current.hasLocation = true;
current.latitude = download.latitude;
current.longitude = download.longitude;
diff --git a/resources/assets/v3/js/pages/transactions/shared/parse-errors.js b/resources/assets/v3/js/pages/transactions/shared/parse-errors.js
index 61a1df6442..e635ca0a5d 100644
--- a/resources/assets/v3/js/pages/transactions/shared/parse-errors.js
+++ b/resources/assets/v3/js/pages/transactions/shared/parse-errors.js
@@ -18,8 +18,7 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
-import {spliceErrorsIntoTransactions} from "./splice-errors-into-transactions.js";
-
+import { spliceErrorsIntoTransactions } from "./splice-errors-into-transactions.js";
export function parseErrors(data) {
// disable all messages:
@@ -27,9 +26,12 @@ export function parseErrors(data) {
this.notifications.success.show = false;
this.notifications.wait.show = false;
this.formStates.isSubmitting = false;
- this.notifications.error.text = this.i18next.t('firefly.errors_submission_v2', {errorMessage: data.message});
+ this.notifications.error.text = this.i18next.t(
+ "firefly.errors_submission_v2",
+ { errorMessage: data.message },
+ );
- if (Object.hasOwn(data, 'errors')) {
+ if (Object.hasOwn(data, "errors")) {
this.entries = spliceErrorsIntoTransactions(data.errors, this.entries);
}
}
diff --git a/resources/assets/v3/js/pages/transactions/shared/parse-from-entries.js b/resources/assets/v3/js/pages/transactions/shared/parse-from-entries.js
index 25ab922a93..b2fe53934e 100644
--- a/resources/assets/v3/js/pages/transactions/shared/parse-from-entries.js
+++ b/resources/assets/v3/js/pages/transactions/shared/parse-from-entries.js
@@ -35,7 +35,10 @@ export function parseFromEntries(entries, originals, transactionType) {
let current = {};
// fields for transaction
- if ((compare && original.description !== entry.description) || !compare) {
+ if (
+ (compare && original.description !== entry.description) ||
+ !compare
+ ) {
current.description = entry.description;
}
@@ -47,7 +50,6 @@ export function parseFromEntries(entries, originals, transactionType) {
current.amount = entry.amount;
current.currency_code = entry.currency_code;
-
// dates
current.date = entry.date;
current.interest_date = entry.interest_date;
@@ -78,56 +80,77 @@ export function parseFromEntries(entries, originals, transactionType) {
current.latitude = entry.latitude.toString();
current.zoom_level = entry.zoom_level;
}
- if ('__NO_CODE__' === entry.foreign_currency_code) {
- entry.foreign_currency_code = '';
+ if ("__NO_CODE__" === entry.foreign_currency_code) {
+ entry.foreign_currency_code = "";
}
// if foreign amount currency code is set:
current.foreign_amount = null;
current.foreign_currency_code = null;
- if (typeof entry.foreign_currency_code !== 'undefined' && '' !== entry.foreign_currency_code.toString()) {
+ if (
+ typeof entry.foreign_currency_code !== "undefined" &&
+ "" !== entry.foreign_currency_code.toString()
+ ) {
current.foreign_currency_code = entry.foreign_currency_code;
- console.log('There is a foreign currency code set, ', current.foreign_currency_code);
- if (typeof entry.foreign_amount !== 'undefined' && '' !== entry.foreign_amount.toString() && 0.0 !== entry.foreign_amount) {
+ console.log(
+ "There is a foreign currency code set, ",
+ current.foreign_currency_code,
+ );
+ if (
+ typeof entry.foreign_amount !== "undefined" &&
+ "" !== entry.foreign_amount.toString() &&
+ 0.0 !== entry.foreign_amount
+ ) {
current.foreign_amount = entry.foreign_amount;
- console.log('There is also a foreign amount set, ', current.foreign_amount);
+ console.log(
+ "There is also a foreign amount set, ",
+ current.foreign_amount,
+ );
}
}
- if (null === current.foreign_amount || null === current.foreign_currency_code) {
- current.foreign_amount = '0';
- current.foreign_currency_code = '';
+ if (
+ null === current.foreign_amount ||
+ null === current.foreign_currency_code
+ ) {
+ current.foreign_amount = "0";
+ current.foreign_currency_code = "";
}
// if ID is set:
- if (typeof entry.source_account.id !== 'undefined' && '' !== entry.source_account.id.toString()) {
+ if (
+ typeof entry.source_account.id !== "undefined" &&
+ "" !== entry.source_account.id.toString()
+ ) {
current.source_id = entry.source_account.id;
}
- if (typeof entry.destination_account.id !== 'undefined' && '' !== entry.destination_account.id.toString()) {
+ if (
+ typeof entry.destination_account.id !== "undefined" &&
+ "" !== entry.destination_account.id.toString()
+ ) {
current.destination_id = entry.destination_account.id;
}
if (i > 0) {
- if ('withdrawal' === transactionType) {
+ if ("withdrawal" === transactionType) {
// overrule source
current.source_id = returnArray[0].source_id;
current.source_name = returnArray[0].source_name;
}
- if ('deposit' === transactionType) {
+ if ("deposit" === transactionType) {
// overrule destination
current.destination_id = returnArray[0].destination_id;
current.destination_name = returnArray[0].destination_name;
}
- if ('transfer' === transactionType) {
+ if ("transfer" === transactionType) {
// overrule both
current.source_id = returnArray[0].source_id;
current.source_name = returnArray[0].source_name;
current.destination_id = returnArray[0].destination_id;
current.destination_name = returnArray[0].destination_name;
}
- console.log('Overrule depending on ', transactionType);
+ console.log("Overrule depending on ", transactionType);
}
current.type = transactionType;
-
returnArray.push(current);
}
}
diff --git a/resources/assets/v3/js/pages/transactions/shared/parse-total-amount.js b/resources/assets/v3/js/pages/transactions/shared/parse-total-amount.js
index 7dff9449fc..265a3031c0 100644
--- a/resources/assets/v3/js/pages/transactions/shared/parse-total-amount.js
+++ b/resources/assets/v3/js/pages/transactions/shared/parse-total-amount.js
@@ -22,7 +22,10 @@ import formatMoney from "../../../util/format-money.js";
export function parseTotalAmount() {
if (this.entries.length === 0) {
- return formatMoney(this.groupProperties.totalAmount, 'EUR');
+ return formatMoney(this.groupProperties.totalAmount, "EUR");
}
- return formatMoney(this.groupProperties.totalAmount, this.entries[0].currency_code ?? 'EUR');
+ return formatMoney(
+ this.groupProperties.totalAmount,
+ this.entries[0].currency_code ?? "EUR",
+ );
}
diff --git a/resources/assets/v3/js/pages/transactions/shared/process-attachments.js b/resources/assets/v3/js/pages/transactions/shared/process-attachments.js
index b80f7b3584..d4b5549bf4 100644
--- a/resources/assets/v3/js/pages/transactions/shared/process-attachments.js
+++ b/resources/assets/v3/js/pages/transactions/shared/process-attachments.js
@@ -26,37 +26,58 @@ let uploadFiles = function (fileData) {
let hasError = false;
for (const key in fileData) {
- if (Object.hasOwn(fileData, key) && /^0$|^[1-9]\d*$/.test(key) && key <= 4294967294 && false === hasError) {
+ if (
+ Object.hasOwn(fileData, key) &&
+ /^0$|^[1-9]\d*$/.test(key) &&
+ key <= 4294967294 &&
+ false === hasError
+ ) {
let poster = new AttachmentPost();
- poster.post(fileData[key].name, 'TransactionJournal', fileData[key].journal).then(response => {
- let attachmentId = parseInt(response.data.data.id);
- poster.upload(attachmentId, fileData[key].content).then(() => {
- uploads++;
- if (uploads === count) {
- const event = new CustomEvent('upload-success', {detail: {some: 'details'}});
- document.dispatchEvent(event);
- }
- }).catch(error => {
- console.error('[a] Could not upload');
- // console.error(error);
+ poster
+ .post(
+ fileData[key].name,
+ "TransactionJournal",
+ fileData[key].journal,
+ )
+ .then((response) => {
+ let attachmentId = parseInt(response.data.data.id);
+ poster
+ .upload(attachmentId, fileData[key].content)
+ .then(() => {
+ uploads++;
+ if (uploads === count) {
+ const event = new CustomEvent(
+ "upload-success",
+ { detail: { some: "details" } },
+ );
+ document.dispatchEvent(event);
+ }
+ })
+ .catch((error) => {
+ console.error("[a] Could not upload");
+ // console.error(error);
+ uploads++;
+ // break right away
+ const event = new CustomEvent("upload-failed", {
+ detail: { error: error },
+ });
+ document.dispatchEvent(event);
+ hasError = true;
+ });
+ })
+ .catch((error) => {
+ console.error("Could not create upload.");
+ console.error(error);
uploads++;
- // break right away
- const event = new CustomEvent('upload-failed', {detail: {error: error}});
+ const event = new CustomEvent("upload-failed", {
+ detail: { error: error },
+ });
document.dispatchEvent(event);
hasError = true;
});
- }).catch(error => {
- console.error('Could not create upload.');
- console.error(error);
- uploads++;
- const event = new CustomEvent('upload-failed', {detail: {error: error}});
- document.dispatchEvent(event);
- hasError = true;
- });
}
}
-}
-
+};
export function processAttachments(groupId, transactions) {
// reverse list of transactions
@@ -73,13 +94,21 @@ export function processAttachments(groupId, transactions) {
// loop over all attachments, and add references to this array:
for (const key in attachments) {
- if (Object.hasOwn(attachments, key) && /^0$|^[1-9]\d*$/.test(key) && key <= 4294967294) {
+ if (
+ Object.hasOwn(attachments, key) &&
+ /^0$|^[1-9]\d*$/.test(key) &&
+ key <= 4294967294
+ ) {
for (const fileKey in attachments[key].files) {
- if (Object.hasOwn(attachments[key].files, fileKey) && /^0$|^[1-9]\d*$/.test(fileKey) && fileKey <= 4294967294) {
+ if (
+ Object.hasOwn(attachments[key].files, fileKey) &&
+ /^0$|^[1-9]\d*$/.test(fileKey) &&
+ fileKey <= 4294967294
+ ) {
// include journal thing.
toBeUploaded.push({
journal: transactions[key].transaction_journal_id,
- file: attachments[key].files[fileKey]
+ file: attachments[key].files[fileKey],
});
count++;
}
@@ -89,17 +118,21 @@ export function processAttachments(groupId, transactions) {
// loop all uploads. This is async.
for (const key in toBeUploaded) {
- if (Object.hasOwn(toBeUploaded, key) && /^0$|^[1-9]\d*$/.test(key) && key <= 4294967294) {
-
+ if (
+ Object.hasOwn(toBeUploaded, key) &&
+ /^0$|^[1-9]\d*$/.test(key) &&
+ key <= 4294967294
+ ) {
// create file reader thing that will read all of these uploads
(function (f, key) {
let fileReader = new FileReader();
fileReader.onloadend = function (evt) {
- if (evt.target.readyState === FileReader.DONE) { // DONE == 2
+ if (evt.target.readyState === FileReader.DONE) {
+ // DONE == 2
fileData.push({
name: toBeUploaded[key].file.name,
journal: toBeUploaded[key].journal,
- content: new Blob([evt.target.result])
+ content: new Blob([evt.target.result]),
});
if (fileData.length === count) {
uploadFiles(fileData);
@@ -107,7 +140,7 @@ export function processAttachments(groupId, transactions) {
}
};
fileReader.readAsArrayBuffer(f.file);
- })(toBeUploaded[key], key,);
+ })(toBeUploaded[key], key);
}
}
return count;
diff --git a/resources/assets/v3/js/pages/transactions/shared/process-transaction-links.js b/resources/assets/v3/js/pages/transactions/shared/process-transaction-links.js
index 239e0d073d..4cf2d8c1de 100644
--- a/resources/assets/v3/js/pages/transactions/shared/process-transaction-links.js
+++ b/resources/assets/v3/js/pages/transactions/shared/process-transaction-links.js
@@ -3,7 +3,7 @@ import PostLink from "../../../api/model/transaction-link/post.js";
export function processTransactionLinks(transactions) {
let count = 0;
for (let i = 0; i < transactions.length; i++) {
- if (Object.hasOwn(transactions,i) && Object.hasOwn(this.links, i)) {
+ if (Object.hasOwn(transactions, i) && Object.hasOwn(this.links, i)) {
let journalId = transactions[i];
for (let j = 0; j < this.links[i].length; j++) {
if (Object.hasOwn(this.links[i], j)) {
@@ -11,15 +11,18 @@ export function processTransactionLinks(transactions) {
let link = this.links[i][j];
let left = journalId;
let right = parseInt(link.journal_id);
- if ('inward' === link.link_type_direction) {
+ if ("inward" === link.link_type_direction) {
left = parseInt(link.journal_id);
right = journalId;
}
- (new PostLink).post(link.link_type_id, left, right, null).then(() => {
- this.redirectAfterTransactionLinks(i, j);
- }).catch(function (e) {
- console.error(e);
- });
+ new PostLink()
+ .post(link.link_type_id, left, right, null)
+ .then(() => {
+ this.redirectAfterTransactionLinks(i, j);
+ })
+ .catch(function (e) {
+ console.error(e);
+ });
}
}
}
diff --git a/resources/assets/v3/js/pages/transactions/shared/process-upload-error.js b/resources/assets/v3/js/pages/transactions/shared/process-upload-error.js
index 5c3d8c68bb..6bd98df9f5 100644
--- a/resources/assets/v3/js/pages/transactions/shared/process-upload-error.js
+++ b/resources/assets/v3/js/pages/transactions/shared/process-upload-error.js
@@ -20,17 +20,19 @@
import Delete from "../../../api/model/transaction/delete.js";
-export function processUploadError(event){
+export function processUploadError(event) {
this.notifications.success.show = false;
this.notifications.wait.show = false;
this.notifications.error.show = true;
this.formStates.isSubmitting = false;
- this.notifications.error.text = this.i18next.t('firefly.errors_upload');
+ this.notifications.error.text = this.i18next.t("firefly.errors_upload");
console.log(event.detail.error.response.status);
- if(413 === event.detail.error.response.status) {
- this.notifications.error.text = this.i18next.t('firefly.upload_too_large');
+ if (413 === event.detail.error.response.status) {
+ this.notifications.error.text = this.i18next.t(
+ "firefly.upload_too_large",
+ );
}
- if('create' === this.formBehaviour.formType) {
+ if ("create" === this.formBehaviour.formType) {
// delete transaction and let user try again.
let del = new Delete();
del.delete(this.groupProperties.id);
diff --git a/resources/assets/v3/js/pages/transactions/shared/redirect-after-transaction-links.js b/resources/assets/v3/js/pages/transactions/shared/redirect-after-transaction-links.js
index 52f3070b30..f5db70f60b 100644
--- a/resources/assets/v3/js/pages/transactions/shared/redirect-after-transaction-links.js
+++ b/resources/assets/v3/js/pages/transactions/shared/redirect-after-transaction-links.js
@@ -16,4 +16,4 @@ export function redirectAfterTransactionLinks(oldI, oldJ) {
this.formStates.storedLinks = completed;
this.showMessageOrRedirectUser();
}
-};
+}
diff --git a/resources/assets/v3/js/pages/transactions/shared/remove-link.js b/resources/assets/v3/js/pages/transactions/shared/remove-link.js
index 2265df4f1d..90a53bb094 100644
--- a/resources/assets/v3/js/pages/transactions/shared/remove-link.js
+++ b/resources/assets/v3/js/pages/transactions/shared/remove-link.js
@@ -18,14 +18,14 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
-import Delete from '../../../api/model/transaction-link/delete.js';
+import Delete from "../../../api/model/transaction-link/delete.js";
export function removeLink(e) {
let rowIndex = parseInt(e.currentTarget.dataset.rowIndex);
let index = parseInt(e.currentTarget.dataset.index);
- if(0 !== this.links[index][rowIndex].id) {
+ if (0 !== this.links[index][rowIndex].id) {
// also actually delete it.
- (new Delete).delete(this.links[index][rowIndex].id);
+ new Delete().delete(this.links[index][rowIndex].id);
}
this.links[index].splice(rowIndex, 1);
}
diff --git a/resources/assets/v3/js/pages/transactions/shared/remove-split.js b/resources/assets/v3/js/pages/transactions/shared/remove-split.js
index 844b241a73..440d4a470a 100644
--- a/resources/assets/v3/js/pages/transactions/shared/remove-split.js
+++ b/resources/assets/v3/js/pages/transactions/shared/remove-split.js
@@ -22,6 +22,6 @@ export function removeSplit(index) {
this.entries.splice(index, 1);
this.links.splice(index, 1);
// fall back to index 0
- const triggerFirstTabEl = document.querySelector('#split-0-tab')
+ const triggerFirstTabEl = document.querySelector("#split-0-tab");
triggerFirstTabEl.click();
-};
+}
diff --git a/resources/assets/v3/js/pages/transactions/shared/render-map.js b/resources/assets/v3/js/pages/transactions/shared/render-map.js
index c0a8cd992a..29bf6e4ddf 100644
--- a/resources/assets/v3/js/pages/transactions/shared/render-map.js
+++ b/resources/assets/v3/js/pages/transactions/shared/render-map.js
@@ -1,4 +1,3 @@
-
/*
* render-map.js
* Copyright (c) 2026 [email protected]
@@ -19,18 +18,18 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
-import L from 'leaflet';
+import L from "leaflet";
import markerIcon from "leaflet/dist/images/marker-icon.png";
import markerRetinaIcon from "leaflet/dist/images/marker-icon-2x.png";
-import shadow from 'leaflet/dist/images/marker-shadow.png';
+import shadow from "leaflet/dist/images/marker-shadow.png";
export function renderMap(index, useDefault) {
- const el = document.getElementById('location_map_' + index);
+ const el = document.getElementById("location_map_" + index);
let latitude = parseFloat(this.formBehaviour.defaultCoordinates.latitude);
let longitude = parseFloat(this.formBehaviour.defaultCoordinates.longitude);
let zoomLevel = parseInt(this.formBehaviour.defaultCoordinates.zoom_level);
- if(!useDefault) {
- console.log('Using coordinates from data attributes');
+ if (!useDefault) {
+ console.log("Using coordinates from data attributes");
latitude = parseFloat(el.dataset.latitude);
longitude = parseFloat(el.dataset.longitude);
zoomLevel = parseInt(el.dataset.zoomLevel);
@@ -41,29 +40,31 @@ export function renderMap(index, useDefault) {
// console.log('zoom', zoomLevel);
this.maps[index] = L.map(el).setView([latitude, longitude], zoomLevel);
- this.maps[index].on('click', this.onMapClick.bind(this));
- this.maps[index].on('zoom', this.onMapZoom.bind(this));
- L.tileLayer('https://tile.openstreetmap.org/{z}/{x}/{y}.png', {
+ this.maps[index].on("click", this.onMapClick.bind(this));
+ this.maps[index].on("zoom", this.onMapZoom.bind(this));
+ L.tileLayer("https://tile.openstreetmap.org/{z}/{x}/{y}.png", {
maxZoom: 19,
- referrerPolicy: 'origin-when-cross-origin',
- attribution: '&copy; <a href="http://www.openstreetmap.org/copyright">OpenStreetMap</a>'
+ referrerPolicy: "origin-when-cross-origin",
+ attribution:
+ '&copy; <a href="http://www.openstreetmap.org/copyright">OpenStreetMap</a>',
}).addTo(this.maps[index]);
- if('true' === el.dataset.addMarker) {
- L.Marker.prototype.setIcon(L.icon({
- iconUrl: markerIcon,
- iconRetinaIcon: markerRetinaIcon,
- shadowUrl: shadow,
- iconSize: [25, 41],
- iconAnchor: [12, 41]
- }));
+ if ("true" === el.dataset.addMarker) {
+ L.Marker.prototype.setIcon(
+ L.icon({
+ iconUrl: markerIcon,
+ iconRetinaIcon: markerRetinaIcon,
+ shadowUrl: shadow,
+ iconSize: [25, 41],
+ iconAnchor: [12, 41],
+ }),
+ );
// add marker.
- if(Object.hasOwn(this.markers, index)) {
+ if (Object.hasOwn(this.markers, index)) {
this.maps[index].removeLayer(this.markers[index]);
}
this.markers[index] = L.marker([latitude, longitude]);
this.markers[index].addTo(this.maps[index]);
}
-
}
diff --git a/resources/assets/v3/js/pages/transactions/shared/respond-to-tab-switch.js b/resources/assets/v3/js/pages/transactions/shared/respond-to-tab-switch.js
index 9ad634e192..a043d193b4 100644
--- a/resources/assets/v3/js/pages/transactions/shared/respond-to-tab-switch.js
+++ b/resources/assets/v3/js/pages/transactions/shared/respond-to-tab-switch.js
@@ -27,4 +27,4 @@ export function respondToTabSwitch(event) {
this.maps[index].invalidateSize();
}
//console.log('Switched to new tab!', event.target.dataset.index);
-};
+}
diff --git a/resources/assets/v3/js/pages/transactions/shared/save-edited-link.js b/resources/assets/v3/js/pages/transactions/shared/save-edited-link.js
index a4976b7de9..17dc4be686 100644
--- a/resources/assets/v3/js/pages/transactions/shared/save-edited-link.js
+++ b/resources/assets/v3/js/pages/transactions/shared/save-edited-link.js
@@ -21,19 +21,25 @@
export function saveEditedLink(e) {
let rowIndex = parseInt(e.currentTarget.dataset.rowIndex);
let index = parseInt(e.currentTarget.dataset.index);
- let selector = e.currentTarget.parentNode.querySelector('select[name="new-link-type"]');
+ let selector = e.currentTarget.parentNode.querySelector(
+ 'select[name="new-link-type"]',
+ );
let linkType = selector.value;
- let linkTypeId = parseInt(linkType.split('_')[0]);
- let linkTypeDirection = linkType.split('_')[1];
- let linkTypeObj = this.formData.linkTypes.find(link => link.id === linkTypeId);
- if (typeof linkTypeObj === 'undefined') {
- console.error('Link type not found for id ' + linkTypeId);
+ let linkTypeId = parseInt(linkType.split("_")[0]);
+ let linkTypeDirection = linkType.split("_")[1];
+ let linkTypeObj = this.formData.linkTypes.find(
+ (link) => link.id === linkTypeId,
+ );
+ if (typeof linkTypeObj === "undefined") {
+ console.error("Link type not found for id " + linkTypeId);
return;
}
- this.links[index][rowIndex].link_type = linkTypeId + '_' + linkTypeDirection;
+ this.links[index][rowIndex].link_type =
+ linkTypeId + "_" + linkTypeDirection;
this.links[index][rowIndex].link_type_id = linkTypeId;
this.links[index][rowIndex].link_type_direction = linkTypeDirection;
- this.links[index][rowIndex].link_type_label = linkTypeObj[linkTypeDirection];
+ this.links[index][rowIndex].link_type_label =
+ linkTypeObj[linkTypeDirection];
this.links[index][rowIndex].editMode = false;
-};
+}
diff --git a/resources/assets/v3/js/pages/transactions/shared/save-new-link.js b/resources/assets/v3/js/pages/transactions/shared/save-new-link.js
index f08bcd3bbd..53308fdbf4 100644
--- a/resources/assets/v3/js/pages/transactions/shared/save-new-link.js
+++ b/resources/assets/v3/js/pages/transactions/shared/save-new-link.js
@@ -21,37 +21,49 @@
export function saveNewLink(e) {
let index = parseInt(e.currentTarget.dataset.index);
- let linkSelect = document.getElementById('link_type_id_' + index);
+ let linkSelect = document.getElementById("link_type_id_" + index);
let linkType = linkSelect.value;
let linkLabel = linkSelect.options[linkSelect.selectedIndex].innerHTML;
- let searchBox = document.getElementById('links_modal_search_' + index);
- let hiddenField = searchBox.parentNode.querySelector('input[name="search"]');
+ let searchBox = document.getElementById("links_modal_search_" + index);
+ let hiddenField = searchBox.parentNode.querySelector(
+ 'input[name="search"]',
+ );
- let linkTypeId = parseInt(linkType.split('_')[0]);
- let linkTypeDirection = linkType.split('_')[1];
- let linkTypeObj = this.formData.linkTypes.find(link => link.id === linkTypeId);
+ let linkTypeId = parseInt(linkType.split("_")[0]);
+ let linkTypeDirection = linkType.split("_")[1];
+ let linkTypeObj = this.formData.linkTypes.find(
+ (link) => link.id === linkTypeId,
+ );
- if ('' === linkType || '' === hiddenField.value || '' === searchBox.value) {
+ if ("" === linkType || "" === hiddenField.value || "" === searchBox.value) {
return;
}
// add entry to temporary table.
- console.log('Link ' + linkType + ' ("' + linkLabel + '") to transaction #' + hiddenField.value + '("' + searchBox.value + '")');
-
- this.links[index].push(
- {
- id: 0,
- link_type: linkTypeId + '_' + linkTypeDirection,
- link_type_id: linkTypeId,
- link_type_direction: linkTypeDirection,
- link_type_label: linkTypeObj[linkTypeDirection],
- journal_id: hiddenField.value,
- group_id: hiddenField.value,
- journal_description: searchBox.value,
- editMode: false,
- stored: false,
- }
+ console.log(
+ "Link " +
+ linkType +
+ ' ("' +
+ linkLabel +
+ '") to transaction #' +
+ hiddenField.value +
+ '("' +
+ searchBox.value +
+ '")',
);
- searchBox.value = '';
- hiddenField.value = '';
-};
+
+ this.links[index].push({
+ id: 0,
+ link_type: linkTypeId + "_" + linkTypeDirection,
+ link_type_id: linkTypeId,
+ link_type_direction: linkTypeDirection,
+ link_type_label: linkTypeObj[linkTypeDirection],
+ journal_id: hiddenField.value,
+ group_id: hiddenField.value,
+ journal_description: searchBox.value,
+ editMode: false,
+ stored: false,
+ });
+ searchBox.value = "";
+ hiddenField.value = "";
+}
diff --git a/resources/assets/v3/js/pages/transactions/shared/show-message-or-redirect.js b/resources/assets/v3/js/pages/transactions/shared/show-message-or-redirect.js
index 11b6142462..fada320d87 100644
--- a/resources/assets/v3/js/pages/transactions/shared/show-message-or-redirect.js
+++ b/resources/assets/v3/js/pages/transactions/shared/show-message-or-redirect.js
@@ -21,16 +21,16 @@
import i18next from "i18next";
export function showMessageOrRedirectUser() {
- if(false === this.formStates.storedGroup) {
- console.error('Not yet stored group, return false.');
+ if (false === this.formStates.storedGroup) {
+ console.error("Not yet stored group, return false.");
return;
}
- if(false === this.formStates.storedAttachments) {
- console.error('Not yet stored attachments, return false.');
+ if (false === this.formStates.storedAttachments) {
+ console.error("Not yet stored attachments, return false.");
return;
}
- if(false === this.formStates.storedLinks) {
- console.error('Not yet stored links, return false.');
+ if (false === this.formStates.storedLinks) {
+ console.error("Not yet stored links, return false.");
return;
}
// disable all messages:
@@ -41,11 +41,18 @@ export function showMessageOrRedirectUser() {
if (this.formStates.returnHereButton) {
this.formStates.isSubmitting = false;
this.notifications.success.show = true;
- this.notifications.success.url = 'transactions/show/' + parseInt(this.groupProperties.id);
+ this.notifications.success.url =
+ "transactions/show/" + parseInt(this.groupProperties.id);
// title depends on form role.
- if('create' === this.formBehaviour.formType) {
- this.notifications.success.text = i18next.t('firefly.stored_journal_js', {description: this.groupProperties.title, interpolation: {escapeValue: false}});
+ if ("create" === this.formBehaviour.formType) {
+ this.notifications.success.text = i18next.t(
+ "firefly.stored_journal_js",
+ {
+ description: this.groupProperties.title,
+ interpolation: { escapeValue: false },
+ },
+ );
this.groupProperties.title = null;
// reset the form.
@@ -55,58 +62,80 @@ export function showMessageOrRedirectUser() {
this.groupProperties.totalAmount = 0;
}
}
- if('edit' === this.formBehaviour.formType) {
+ if ("edit" === this.formBehaviour.formType) {
let title = this.groupProperties.title;
- if('' === title) {
+ if ("" === title) {
title = this.entries[0].description;
}
- this.notifications.success.text = i18next.t('firefly.updated_journal_js', {description: title});
+ this.notifications.success.text = i18next.t(
+ "firefly.updated_journal_js",
+ { description: title },
+ );
}
-
return;
}
// the redirect also depends on the "from" in the query param, which is validated by Firefly III on the server side.
// get from parameter from query
const urlParams = new URLSearchParams(window.location.search);
- let params = urlParams.get('_from');
+ let params = urlParams.get("_from");
// find parts
- let parts = URL.parse(params, 'https://example.com/');
+ let parts = URL.parse(params, "https://example.com/");
let from;
- let separator = '?';
- if('' === parts.search) {
- from = urlParams.get('_from').toString();
+ let separator = "?";
+ if ("" === parts.search) {
+ from = urlParams.get("_from").toString();
}
- if('' !== parts.search) {
+ if ("" !== parts.search) {
let obj = new URLSearchParams(parts.search);
let pathName = parts.pathname; // we redirect here!
- obj.delete('message');
- obj.delete('transaction_group_id');
- if(0 === obj.size) {
+ obj.delete("message");
+ obj.delete("transaction_group_id");
+ if (0 === obj.size) {
from = pathName;
}
- if(obj.size > 0) {
- separator = '&';
- from = pathName + '?' + obj.toString();
+ if (obj.size > 0) {
+ separator = "&";
+ from = pathName + "?" + obj.toString();
}
}
// grab base href
- let baseHref = document.querySelector('base').getAttribute('href');
+ let baseHref = document.querySelector("base").getAttribute("href");
baseHref = baseHref.substring(0, baseHref.length - 1);
let finalFrom = baseHref + from;
- if ('' !== from) {
- if('edit' === this.formBehaviour.formType) {
- window.location = finalFrom + separator + 'transaction_group_id=' + this.groupProperties.id + '&message=updated';
+ if ("" !== from) {
+ if ("edit" === this.formBehaviour.formType) {
+ window.location =
+ finalFrom +
+ separator +
+ "transaction_group_id=" +
+ this.groupProperties.id +
+ "&message=updated";
return;
}
- window.location = finalFrom + separator + 'transaction_group_id=' + this.groupProperties.id + '&message=created';
+ window.location =
+ finalFrom +
+ separator +
+ "transaction_group_id=" +
+ this.groupProperties.id +
+ "&message=created";
return;
}
- if('edit' === this.formBehaviour.formType) {
- window.location = 'transactions/show/' + this.groupProperties.id + '?transaction_group_id=' + this.groupProperties.id + '&message=updated';
+ if ("edit" === this.formBehaviour.formType) {
+ window.location =
+ "transactions/show/" +
+ this.groupProperties.id +
+ "?transaction_group_id=" +
+ this.groupProperties.id +
+ "&message=updated";
return;
}
- window.location = 'transactions/show/' + this.groupProperties.id + '?transaction_group_id=' + this.groupProperties.id + '&message=created';
+ window.location =
+ "transactions/show/" +
+ this.groupProperties.id +
+ "?transaction_group_id=" +
+ this.groupProperties.id +
+ "&message=created";
}
diff --git a/resources/assets/v3/js/pages/transactions/shared/splice-errors-into-transactions.js b/resources/assets/v3/js/pages/transactions/shared/splice-errors-into-transactions.js
index 1781540c78..97ae949990 100644
--- a/resources/assets/v3/js/pages/transactions/shared/splice-errors-into-transactions.js
+++ b/resources/assets/v3/js/pages/transactions/shared/splice-errors-into-transactions.js
@@ -34,72 +34,105 @@ export function spliceErrorsIntoTransactions(errors, transactions) {
let fieldName;
let errorArray;
for (const key in errors) {
- if (Object.hasOwn(errors,key)) {
- if (key === 'group_title') {
- console.error('Cannot handle error in group title.');
+ if (Object.hasOwn(errors, key)) {
+ if (key === "group_title") {
+ console.error("Cannot handle error in group title.");
// todo handle group errors.
//this.group_title_errors = errors.errors[key];
continue;
}
- transactionIndex = parseInt(key.split('.')[1]);
- fieldName = key.split('.')[2];
+ transactionIndex = parseInt(key.split(".")[1]);
+ fieldName = key.split(".")[2];
errorArray = cleanupErrors(key, fieldName, errors[key]);
if (!Object.hasOwn(transactions, transactionIndex)) {
- console.error('Cannot handle errors in index #' + transactionIndex);
+ console.error(
+ "Cannot handle errors in index #" + transactionIndex,
+ );
continue;
}
switch (fieldName) {
- case 'currency_code':
- case 'foreign_currency_code':
- case 'category_name':
- case 'piggy_bank_id':
- case 'notes':
- case 'internal_reference':
- case 'external_url':
- case 'latitude':
- case 'longitude':
- case 'zoom_level':
- case 'interest_date':
- case 'book_date':
- case 'process_date':
- case 'due_date':
- case 'payment_date':
- case 'invoice_date':
- case 'amount':
- case 'date':
- case 'budget_id':
- case 'bill_id':
- case 'description':
- case 'tags':
- transactions[transactionIndex].errors[fieldName] = errorArray;
+ case "currency_code":
+ case "foreign_currency_code":
+ case "category_name":
+ case "piggy_bank_id":
+ case "notes":
+ case "internal_reference":
+ case "external_url":
+ case "latitude":
+ case "longitude":
+ case "zoom_level":
+ case "interest_date":
+ case "book_date":
+ case "process_date":
+ case "due_date":
+ case "payment_date":
+ case "invoice_date":
+ case "amount":
+ case "date":
+ case "budget_id":
+ case "bill_id":
+ case "description":
+ case "tags":
+ transactions[transactionIndex].errors[fieldName] =
+ errorArray;
break;
- case 'source_name':
- case 'source_id':
- transactions[transactionIndex].errors.source_account = transactions[transactionIndex].errors.source_account.concat(errorArray);
+ case "source_name":
+ case "source_id":
+ transactions[transactionIndex].errors.source_account =
+ transactions[
+ transactionIndex
+ ].errors.source_account.concat(errorArray);
break;
- case 'type':
+ case "type":
// add custom error to source and destination account
- transactions[transactionIndex].errors.source_account = transactions[transactionIndex].errors.source_account.concat([i18next.t('validation.bad_type_source')]);
- transactions[transactionIndex].errors.destination_account = transactions[transactionIndex].errors.destination_account.concat([i18next.t('validation.bad_type_destination')]);
+ transactions[transactionIndex].errors.source_account =
+ transactions[
+ transactionIndex
+ ].errors.source_account.concat([
+ i18next.t("validation.bad_type_source"),
+ ]);
+ transactions[transactionIndex].errors.destination_account =
+ transactions[
+ transactionIndex
+ ].errors.destination_account.concat([
+ i18next.t("validation.bad_type_destination"),
+ ]);
break;
- case 'destination_name':
- case 'destination_id':
- transactions[transactionIndex].errors.destination_account = transactions[transactionIndex].errors.destination_account.concat(errorArray);
+ case "destination_name":
+ case "destination_id":
+ transactions[transactionIndex].errors.destination_account =
+ transactions[
+ transactionIndex
+ ].errors.destination_account.concat(errorArray);
break;
- case 'foreign_amount':
- case 'foreign_currency_id':
- transactions[transactionIndex].errors.foreign_amount = transactions[transactionIndex].errors.foreign_amount.concat(errorArray);
+ case "foreign_amount":
+ case "foreign_currency_id":
+ transactions[transactionIndex].errors.foreign_amount =
+ transactions[
+ transactionIndex
+ ].errors.foreign_amount.concat(errorArray);
break;
}
// unique some errors.
- if (typeof transactions[transactionIndex] !== 'undefined') {
- transactions[transactionIndex].errors.source_account = Array.from(new Set(transactions[transactionIndex].errors.source_account));
- transactions[transactionIndex].errors.destination_account = Array.from(new Set(transactions[transactionIndex].errors.destination_account));
+ if (typeof transactions[transactionIndex] !== "undefined") {
+ transactions[transactionIndex].errors.source_account =
+ Array.from(
+ new Set(
+ transactions[transactionIndex].errors
+ .source_account,
+ ),
+ );
+ transactions[transactionIndex].errors.destination_account =
+ Array.from(
+ new Set(
+ transactions[transactionIndex].errors
+ .destination_account,
+ ),
+ );
}
}
}
console.log(transactions[0].errors);
return transactions;
-
}
diff --git a/resources/assets/v3/js/pages/transactions/shared/switch-link.js b/resources/assets/v3/js/pages/transactions/shared/switch-link.js
index 6f34e3736d..232c1a3d63 100644
--- a/resources/assets/v3/js/pages/transactions/shared/switch-link.js
+++ b/resources/assets/v3/js/pages/transactions/shared/switch-link.js
@@ -21,18 +21,22 @@
export function switchLink(e) {
let rowIndex = parseInt(e.currentTarget.dataset.rowIndex);
let index = parseInt(e.currentTarget.dataset.index);
- let linkTypeId = parseInt(this.links[index][rowIndex].link_type.split('_')[0]);
- let linkTypeDirection = this.links[index][rowIndex].link_type.split('_')[1];
- let linkType = this.formData.linkTypes.find(link => link.id === linkTypeId);
+ let linkTypeId = parseInt(
+ this.links[index][rowIndex].link_type.split("_")[0],
+ );
+ let linkTypeDirection = this.links[index][rowIndex].link_type.split("_")[1];
+ let linkType = this.formData.linkTypes.find(
+ (link) => link.id === linkTypeId,
+ );
// switch link type.
- linkTypeDirection = 'inward' === linkTypeDirection ? 'outward' : 'inward';
- if (typeof linkType === 'undefined') {
- console.error('Link type not found for id ' + linkTypeId);
+ linkTypeDirection = "inward" === linkTypeDirection ? "outward" : "inward";
+ if (typeof linkType === "undefined") {
+ console.error("Link type not found for id " + linkTypeId);
console.log(this.formData.linkTypes);
return;
}
- this.links[index][rowIndex].link_type = linkType.id + '_' + linkTypeDirection;
+ this.links[index][rowIndex].link_type =
+ linkType.id + "_" + linkTypeDirection;
this.links[index][rowIndex].link_type_label = linkType[linkTypeDirection];
this.links[index][rowIndex].link_type_direction = linkTypeDirection;
-};
-
+}
diff --git a/resources/assets/v3/js/pages/transactions/show.js b/resources/assets/v3/js/pages/transactions/show.js
index 0515a77d3f..9873354c7d 100644
--- a/resources/assets/v3/js/pages/transactions/show.js
+++ b/resources/assets/v3/js/pages/transactions/show.js
@@ -18,13 +18,13 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
-import '../../boot/bootstrap.js';
-import sidebar from '../../pages/shared/sidebar.js';
-import dates from '../shared/dates.js';
+import "../../boot/bootstrap.js";
+import sidebar from "../../pages/shared/sidebar.js";
+import dates from "../shared/dates.js";
import i18next from "i18next";
-import Get from '../../api/model/transaction/get.js';
-import {format} from "date-fns";
-import Alpine from 'alpinejs';
+import Get from "../../api/model/transaction/get.js";
+import { format } from "date-fns";
+import Alpine from "alpinejs";
window.enableDates = false;
@@ -33,49 +33,49 @@ let show = function () {
i18next: null,
group: {
id: 0,
- group_title: '',
+ group_title: "",
transactions: [],
-
},
loading: true,
id: 0,
init() {
this.i18next = i18next;
- const page = window.location.href.split('/');
+ const page = window.location.href.split("/");
this.group.id = parseInt(page[page.length - 1]);
this.downloadTransactionGroup();
// console.log('Generic JS for page with few features.');
},
downloadTransactionGroup() {
- (new Get()).show(this.group.id).then((response) => {
+ new Get().show(this.group.id).then((response) => {
const info = response.data.data;
this.group.transactions = [];
- for(let i =0;i<info.attributes.transactions.length;i++){
- if(Object.hasOwn(info.attributes.transactions, i)) {
- let current =info.attributes.transactions[i];
+ for (let i = 0; i < info.attributes.transactions.length; i++) {
+ if (Object.hasOwn(info.attributes.transactions, i)) {
+ let current = info.attributes.transactions[i];
current.dateObject = new Date(current.date);
- current.dateFormatted = format(current.dateObject, this.i18next.t('config.date_time_fns'))
+ current.dateFormatted = format(
+ current.dateObject,
+ this.i18next.t("config.date_time_fns"),
+ );
this.group.transactions.push(current);
}
}
this.loading = false;
});
- }
- }
-
+ },
+ };
};
-
const comps = {
show,
sidebar,
- dates
+ dates,
};
function loadPage(comps) {
// console.log('loadPage');
- Object.keys(comps).forEach(comp => {
+ Object.keys(comps).forEach((comp) => {
let data = comps[comp]();
Alpine.data(comp, () => data);
// console.log(comp);
@@ -84,7 +84,7 @@ function loadPage(comps) {
}
// wait for load until bootstrapped event is received.
-document.addEventListener('firefly-iii-bootstrapped', () => {
+document.addEventListener("firefly-iii-bootstrapped", () => {
// console.log('Loaded through event listener.');
loadPage(comps);
});
diff --git a/resources/assets/v3/js/pages/webhooks/create.js b/resources/assets/v3/js/pages/webhooks/create.js
index 3bde4950a3..fe9094c5eb 100644
--- a/resources/assets/v3/js/pages/webhooks/create.js
+++ b/resources/assets/v3/js/pages/webhooks/create.js
@@ -18,23 +18,23 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
-import '../../boot/bootstrap.js';
-import sidebar from '../../pages/shared/sidebar.js';
-import dates from '../shared/dates.js';
+import "../../boot/bootstrap.js";
+import sidebar from "../../pages/shared/sidebar.js";
+import dates from "../shared/dates.js";
import i18next from "i18next";
-import {loadDeliveries} from "./shared/load-deliveries.js";
-import {loadResponses} from "./shared/load-responses.js";
-import {loadTriggers} from "./shared/load-triggers.js";
-import Alpine from 'alpinejs';
-import Post from '../../api/model/webhook/post.js'
+import { loadDeliveries } from "./shared/load-deliveries.js";
+import { loadResponses } from "./shared/load-responses.js";
+import { loadTriggers } from "./shared/load-triggers.js";
+import Alpine from "alpinejs";
+import Post from "../../api/model/webhook/post.js";
window.enableDates = false;
let create = function () {
return {
- error_message: '',
- success_message: '',
- title: '',
+ error_message: "",
+ success_message: "",
+ title: "",
i18next: null,
options: {
triggers: [],
@@ -43,42 +43,36 @@ let create = function () {
},
form: {
triggers: {
- loading: true
+ loading: true,
},
responses: {
- loading: true
+ loading: true,
},
deliveries: {
- loading: true
+ loading: true,
},
},
- triggers: [
- "ANY"
- ],
- responses: [
- "RELEVANT"
- ],
- deliveries: [
- "JSON"
- ],
+ triggers: ["ANY"],
+ responses: ["RELEVANT"],
+ deliveries: ["JSON"],
active: true,
- url: '',
+ url: "",
errors: {
title: [],
triggers: [],
responses: [],
deliveries: [],
url: [],
- active: []
+ active: [],
},
hasError: function (field) {
return this.errors[field].length > 0;
},
clearTitle: function () {
- this.title = '';
+ this.title = "";
},
clearUrl: function () {
- this.url = '';
+ this.url = "";
},
handleInput() {
// this.$emit('input', this.administration.title);
@@ -97,13 +91,13 @@ let create = function () {
this.options.deliveries = result;
this.form.deliveries.loading = false;
});
- console.log('Create webhook page.');
+ console.log("Create webhook page.");
},
submit: function (e) {
// reset messages
- this.error_message = '';
- this.success_message = '';
+ this.error_message = "";
+ this.success_message = "";
this.errors = {
title: [],
triggers: [],
@@ -114,7 +108,7 @@ let create = function () {
};
// disable button
- document.getElementById('submitButton').disabled = true;
+ document.getElementById("submitButton").disabled = true;
// collect data
let data = {
@@ -127,49 +121,59 @@ let create = function () {
};
// post!
- (new Post).post(data).then((response) => {
- let webhookId = parseInt(response.data.data.id);
- window.location.href = window.previousUrl + '?webhook_id=' + webhookId + '&message=created';
- }).catch((error) => {
- //console.log(error.response.data);
- this.error_message = error.response.data.message;
- this.errors.title = error.response.data.errors.title ?? [];
- this.errors.triggers = error.response.data.errors.triggers ?? [];
- this.errors.responses = error.response.data.errors.responses ?? [];
- this.errors.deliveries = error.response.data.errors.deliveries ?? [];
- this.errors.url = error.response.data.errors.url ?? [];
+ new Post()
+ .post(data)
+ .then((response) => {
+ let webhookId = parseInt(response.data.data.id);
+ window.location.href =
+ window.previousUrl +
+ "?webhook_id=" +
+ webhookId +
+ "&message=created";
+ })
+ .catch((error) => {
+ //console.log(error.response.data);
+ this.error_message = error.response.data.message;
+ this.errors.title = error.response.data.errors.title ?? [];
+ this.errors.triggers =
+ error.response.data.errors.triggers ?? [];
+ this.errors.responses =
+ error.response.data.errors.responses ?? [];
+ this.errors.deliveries =
+ error.response.data.errors.deliveries ?? [];
+ this.errors.url = error.response.data.errors.url ?? [];
- // if there is a key that ends with a dot and a number, include it in the array:
- for (let key in error.response.data.errors) {
- if(key.includes('.')) {
- let newKey = key.replace(/\.\d+$/, '');
- this.errors[newKey] = this.errors[newKey].concat(error.response.data.errors[key]);
+ // if there is a key that ends with a dot and a number, include it in the array:
+ for (let key in error.response.data.errors) {
+ if (key.includes(".")) {
+ let newKey = key.replace(/\.\d+$/, "");
+ this.errors[newKey] = this.errors[newKey].concat(
+ error.response.data.errors[key],
+ );
+ }
}
- }
- console.log(this.errors);
+ console.log(this.errors);
- // enable button again
- document.getElementById('submitButton').disabled = false;
-
- });
+ // enable button again
+ document.getElementById("submitButton").disabled = false;
+ });
if (e) {
e.preventDefault();
}
- }
- }
+ },
+ };
};
-
const comps = {
create,
sidebar,
- dates
+ dates,
};
function loadPage(comps) {
- console.log('loadPage');
- Object.keys(comps).forEach(comp => {
+ console.log("loadPage");
+ Object.keys(comps).forEach((comp) => {
let data = comps[comp]();
Alpine.data(comp, () => data);
console.log(comp);
@@ -178,12 +182,12 @@ function loadPage(comps) {
}
// wait for load until bootstrapped event is received.
-document.addEventListener('firefly-iii-bootstrapped', () => {
- console.log('Loaded through event listener.');
+document.addEventListener("firefly-iii-bootstrapped", () => {
+ console.log("Loaded through event listener.");
loadPage(comps);
});
// or is bootstrapped before event is triggered.
if (window.bootstrapped) {
- console.log('Loaded through window variable.');
+ console.log("Loaded through window variable.");
loadPage(comps);
}
diff --git a/resources/assets/v3/js/pages/webhooks/edit.js b/resources/assets/v3/js/pages/webhooks/edit.js
index e4ac84f439..ee0acdcae0 100644
--- a/resources/assets/v3/js/pages/webhooks/edit.js
+++ b/resources/assets/v3/js/pages/webhooks/edit.js
@@ -18,16 +18,16 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
-import '../../boot/bootstrap.js';
-import sidebar from '../../pages/shared/sidebar.js';
-import dates from '../shared/dates.js';
+import "../../boot/bootstrap.js";
+import sidebar from "../../pages/shared/sidebar.js";
+import dates from "../shared/dates.js";
import i18next from "i18next";
-import {loadTriggers} from "./shared/load-triggers.js";
-import {loadResponses} from "./shared/load-responses.js";
-import {loadDeliveries} from "./shared/load-deliveries.js";
-import Get from '../../api/model/webhook/get.js';
-import Put from '../../api/model/webhook/put.js';
-import Alpine from 'alpinejs'
+import { loadTriggers } from "./shared/load-triggers.js";
+import { loadResponses } from "./shared/load-responses.js";
+import { loadDeliveries } from "./shared/load-deliveries.js";
+import Get from "../../api/model/webhook/get.js";
+import Put from "../../api/model/webhook/put.js";
+import Alpine from "alpinejs";
window.enableDates = false;
let edit = function () {
@@ -50,16 +50,16 @@ let edit = function () {
this.getWebhook();
},
- error_message: '',
- success_message: '',
- title: '',
+ error_message: "",
+ success_message: "",
+ title: "",
i18next: null,
triggers: ["STORE_TRANSACTION"],
responses: "RELEVANT",
deliveries: "JSON",
id: 0,
active: false,
- url: '',
+ url: "",
options: {
triggers: [],
responses: [],
@@ -67,13 +67,13 @@ let edit = function () {
},
form: {
triggers: {
- loading: true
+ loading: true,
},
responses: {
- loading: true
+ loading: true,
},
deliveries: {
- loading: true
+ loading: true,
},
},
errors: {
@@ -82,31 +82,35 @@ let edit = function () {
responses: [],
deliveries: [],
url: [],
- active: []
+ active: [],
},
getWebhook: function () {
- const page = window.location.href.split('/');
+ const page = window.location.href.split("/");
const webhookId = parseInt(page[page.length - 1]);
this.downloadWebhook(webhookId);
},
downloadWebhook: function (id) {
- (new Get).show(id).then(response => {
- // console.log(response.data.data.attributes);
- this.title = response.data.data.attributes.title;
- this.id = parseInt(response.data.data.id);
- this.triggers = response.data.data.attributes.triggers;
- this.responses = response.data.data.attributes.responses[0];
- this.deliveries = response.data.data.attributes.deliveries[0];
- this.active = response.data.data.attributes.active;
- this.url = response.data.data.attributes.url;
- }).catch(error => {
- this.error_message = error.response.data.message;
- });
+ new Get()
+ .show(id)
+ .then((response) => {
+ // console.log(response.data.data.attributes);
+ this.title = response.data.data.attributes.title;
+ this.id = parseInt(response.data.data.id);
+ this.triggers = response.data.data.attributes.triggers;
+ this.responses = response.data.data.attributes.responses[0];
+ this.deliveries =
+ response.data.data.attributes.deliveries[0];
+ this.active = response.data.data.attributes.active;
+ this.url = response.data.data.attributes.url;
+ })
+ .catch((error) => {
+ this.error_message = error.response.data.message;
+ });
},
submit: function (e) {
// reset messages
- this.error_message = '';
- this.success_message = '';
+ this.error_message = "";
+ this.success_message = "";
this.errors = {
title: [],
triggers: [],
@@ -117,7 +121,7 @@ let edit = function () {
};
// disable button
- document.getElementById('submitButton').disabled = true;
+ document.getElementById("submitButton").disabled = true;
// collect data
let data = {
@@ -130,43 +134,44 @@ let edit = function () {
};
// post!
- (new Put).put(data, {id: this.id}).then((response) => {
- let webhookId = parseInt(response.data.data.id);
- window.location.href = window.previousUrl + '?webhook_id=' + webhookId + '&message=updated';
- }).catch((error) => {
-
- this.error_message = error.response.data.message;
- this.errors.title = error.response.data.errors.title;
- this.errors.triggers = error.response.data.errors.trigger;
- this.errors.responses = error.response.data.errors.response;
- this.errors.deliveries = error.response.data.errors.deliveries;
- this.errors.url = error.response.data.errors.url;
-
- // enable button again
- document.getElementById('submitButton').disabled = false;
-
- });
+ new Put()
+ .put(data, { id: this.id })
+ .then((response) => {
+ let webhookId = parseInt(response.data.data.id);
+ window.location.href =
+ window.previousUrl +
+ "?webhook_id=" +
+ webhookId +
+ "&message=updated";
+ })
+ .catch((error) => {
+ this.error_message = error.response.data.message;
+ this.errors.title = error.response.data.errors.title;
+ this.errors.triggers = error.response.data.errors.trigger;
+ this.errors.responses = error.response.data.errors.response;
+ this.errors.deliveries =
+ error.response.data.errors.deliveries;
+ this.errors.url = error.response.data.errors.url;
+
+ // enable button again
+ document.getElementById("submitButton").disabled = false;
+ });
if (e) {
e.preventDefault();
}
- }
-
-
-
-
- }
+ },
+ };
};
-
const comps = {
edit,
sidebar,
- dates
+ dates,
};
function loadPage(comps) {
- console.log('loadPage');
- Object.keys(comps).forEach(comp => {
+ console.log("loadPage");
+ Object.keys(comps).forEach((comp) => {
let data = comps[comp]();
Alpine.data(comp, () => data);
console.log(comp);
@@ -175,12 +180,12 @@ function loadPage(comps) {
}
// wait for load until bootstrapped event is received.
-document.addEventListener('firefly-iii-bootstrapped', () => {
- console.log('Loaded through event listener.');
+document.addEventListener("firefly-iii-bootstrapped", () => {
+ console.log("Loaded through event listener.");
loadPage(comps);
});
// or is bootstrapped before event is triggered.
if (window.bootstrapped) {
- console.log('Loaded through window variable.');
+ console.log("Loaded through window variable.");
loadPage(comps);
}
diff --git a/resources/assets/v3/js/pages/webhooks/index.js b/resources/assets/v3/js/pages/webhooks/index.js
index 554243b9cb..bb9feec7ec 100644
--- a/resources/assets/v3/js/pages/webhooks/index.js
+++ b/resources/assets/v3/js/pages/webhooks/index.js
@@ -18,13 +18,13 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
-import '../../boot/bootstrap.js';
-import sidebar from '../../pages/shared/sidebar.js';
-import dates from '../shared/dates.js';
+import "../../boot/bootstrap.js";
+import sidebar from "../../pages/shared/sidebar.js";
+import dates from "../shared/dates.js";
import i18next from "i18next";
-import Get from '../../api/model/webhook/get.js';
-import GetConfig from '../../api/configuration/get.js';
-import Alpine from 'alpinejs';
+import Get from "../../api/model/webhook/get.js";
+import GetConfig from "../../api/configuration/get.js";
+import Alpine from "alpinejs";
window.enableDates = false;
let index = function () {
@@ -47,7 +47,7 @@ let index = function () {
webhook.show_secret = !webhook.show_secret;
},
downloadWebhooks: function (page) {
- (new Get).list({page: page}).then((response) => {
+ new Get().list({ page: page }).then((response) => {
for (let i in response.data.data) {
if (Object.hasOwn(response.data.data, i)) {
let current = response.data.data[i];
@@ -64,59 +64,88 @@ let index = function () {
show_secret: false,
};
if (current.attributes.url.length > 20) {
- webhook.url = current.attributes.url.slice(0, 20) + '...';
+ webhook.url =
+ current.attributes.url.slice(0, 20) + "...";
}
this.webhooks.push(webhook);
}
}
- if (response.data.meta.pagination.current_page < response.data.meta.pagination.total_pages) {
- this.downloadWebhooks(parseInt(response.data.meta.pagination.current_page) + 1);
+ if (
+ response.data.meta.pagination.current_page <
+ response.data.meta.pagination.total_pages
+ ) {
+ this.downloadWebhooks(
+ parseInt(response.data.meta.pagination.current_page) +
+ 1,
+ );
return;
}
this.loading = false;
});
},
getOptions: function () {
- (new GetConfig).getByName('webhook.triggers').then((response) => {
- for (let key in response.data.data.value) {
- if(Object.hasOwn(response.data.data.value, key)) {
- this.triggers[key] = i18next.t('firefly.webhook_trigger_' + key);
- }
- }
- }).then(() => {
- (new GetConfig).getByName('webhook.responses').then((response) => {
+ new GetConfig()
+ .getByName("webhook.triggers")
+ .then((response) => {
for (let key in response.data.data.value) {
- if(Object.hasOwn(response.data.data.value, key)) {
- this.responses[key] = i18next.t('firefly.webhook_response_' + key);
+ if (Object.hasOwn(response.data.data.value, key)) {
+ this.triggers[key] = i18next.t(
+ "firefly.webhook_trigger_" + key,
+ );
}
}
- }).then(() => {
- (new GetConfig).getByName('webhook.deliveries').then((response) => {
- for (let key in response.data.data.value) {
- if(Object.hasOwn(response.data.data.value, key)) {
- this.deliveries[key] = i18next.t('firefly.webhook_delivery_' + key);
+ })
+ .then(() => {
+ new GetConfig()
+ .getByName("webhook.responses")
+ .then((response) => {
+ for (let key in response.data.data.value) {
+ if (
+ Object.hasOwn(response.data.data.value, key)
+ ) {
+ this.responses[key] = i18next.t(
+ "firefly.webhook_response_" + key,
+ );
+ }
}
- }
- }).then(() => {
- this.getWebhooks();
- });
+ })
+ .then(() => {
+ new GetConfig()
+ .getByName("webhook.deliveries")
+ .then((response) => {
+ for (let key in response.data.data.value) {
+ if (
+ Object.hasOwn(
+ response.data.data.value,
+ key,
+ )
+ ) {
+ this.deliveries[key] = i18next.t(
+ "firefly.webhook_delivery_" +
+ key,
+ );
+ }
+ }
+ })
+ .then(() => {
+ this.getWebhooks();
+ });
+ });
});
- });
},
- }
+ };
};
-
const comps = {
index,
sidebar,
- dates
+ dates,
};
function loadPage(comps) {
- console.log('loadPage');
- Object.keys(comps).forEach(comp => {
+ console.log("loadPage");
+ Object.keys(comps).forEach((comp) => {
let data = comps[comp]();
Alpine.data(comp, () => data);
console.log(comp);
@@ -125,12 +154,12 @@ function loadPage(comps) {
}
// wait for load until bootstrapped event is received.
-document.addEventListener('firefly-iii-bootstrapped', () => {
- console.log('Loaded through event listener.');
+document.addEventListener("firefly-iii-bootstrapped", () => {
+ console.log("Loaded through event listener.");
loadPage(comps);
});
// or is bootstrapped before event is triggered.
if (window.bootstrapped) {
- console.log('Loaded through window variable.');
+ console.log("Loaded through window variable.");
loadPage(comps);
}
diff --git a/resources/assets/v3/js/pages/webhooks/shared/load-deliveries.js b/resources/assets/v3/js/pages/webhooks/shared/load-deliveries.js
index b3978a7df9..dad69e0ffa 100644
--- a/resources/assets/v3/js/pages/webhooks/shared/load-deliveries.js
+++ b/resources/assets/v3/js/pages/webhooks/shared/load-deliveries.js
@@ -23,22 +23,23 @@ import Get from "../../../api/configuration/get.js";
function loadDeliveries() {
let result = [];
- return (new Get).getByName('webhook.deliveries').then(response => {
- for (let key in response.data.data.value) {
- if(Object.hasOwn(response.data.data.value, key)) {
- result.push(
- {
+ return new Get()
+ .getByName("webhook.deliveries")
+ .then((response) => {
+ for (let key in response.data.data.value) {
+ if (Object.hasOwn(response.data.data.value, key)) {
+ result.push({
id: key,
- name: i18next.t('firefly.webhook_delivery_' + key),
- }
- );
+ name: i18next.t("firefly.webhook_delivery_" + key),
+ });
+ }
}
- }
- return result;
- }).catch((error) => {
- console.error(error);
- return []
- });
+ return result;
+ })
+ .catch((error) => {
+ console.error(error);
+ return [];
+ });
}
-export {loadDeliveries};
+export { loadDeliveries };
diff --git a/resources/assets/v3/js/pages/webhooks/shared/load-responses.js b/resources/assets/v3/js/pages/webhooks/shared/load-responses.js
index 5e41d3b3a6..a93c5058fb 100644
--- a/resources/assets/v3/js/pages/webhooks/shared/load-responses.js
+++ b/resources/assets/v3/js/pages/webhooks/shared/load-responses.js
@@ -23,22 +23,23 @@ import Get from "../../../api/configuration/get.js";
function loadResponses() {
let result = [];
- return (new Get).getByName('webhook.responses').then(response => {
- for (let key in response.data.data.value) {
- if(Object.hasOwn(response.data.data.value, key)) {
- result.push(
- {
+ return new Get()
+ .getByName("webhook.responses")
+ .then((response) => {
+ for (let key in response.data.data.value) {
+ if (Object.hasOwn(response.data.data.value, key)) {
+ result.push({
id: key,
- name: i18next.t('firefly.webhook_response_' + key),
- }
- );
+ name: i18next.t("firefly.webhook_response_" + key),
+ });
+ }
}
- }
- return result;
- }).catch((error) => {
- console.error(error);
- return result;
- });
+ return result;
+ })
+ .catch((error) => {
+ console.error(error);
+ return result;
+ });
}
-export {loadResponses};
+export { loadResponses };
diff --git a/resources/assets/v3/js/pages/webhooks/shared/load-triggers.js b/resources/assets/v3/js/pages/webhooks/shared/load-triggers.js
index 91e672391e..1d1f06e1e7 100644
--- a/resources/assets/v3/js/pages/webhooks/shared/load-triggers.js
+++ b/resources/assets/v3/js/pages/webhooks/shared/load-triggers.js
@@ -19,25 +19,26 @@
*/
import i18next from "i18next";
-import Get from '../../../api/configuration/get.js';
+import Get from "../../../api/configuration/get.js";
export function loadTriggers() {
let result = [];
- return (new Get).getByName('webhook.triggers').then(response => {
- for (let key in response.data.data.value) {
- if(Object.hasOwn(response.data.data.value, key)) {
- result.push(
- {
+ return new Get()
+ .getByName("webhook.triggers")
+ .then((response) => {
+ for (let key in response.data.data.value) {
+ if (Object.hasOwn(response.data.data.value, key)) {
+ result.push({
id: key,
- name: i18next.t('firefly.webhook_trigger_' + key),
- }
- );
+ name: i18next.t("firefly.webhook_trigger_" + key),
+ });
+ }
}
- }
- return result;
- }).catch((error) => {
- console.log(error);
- return result;
- });
+ return result;
+ })
+ .catch((error) => {
+ console.log(error);
+ return result;
+ });
}
diff --git a/resources/assets/v3/js/pages/webhooks/show.js b/resources/assets/v3/js/pages/webhooks/show.js
index 4c50fe70ba..3cae4c8209 100644
--- a/resources/assets/v3/js/pages/webhooks/show.js
+++ b/resources/assets/v3/js/pages/webhooks/show.js
@@ -18,15 +18,15 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
-import '../../boot/bootstrap.js';
-import sidebar from '../../pages/shared/sidebar.js';
-import dates from '../shared/dates.js';
+import "../../boot/bootstrap.js";
+import sidebar from "../../pages/shared/sidebar.js";
+import dates from "../shared/dates.js";
import format from "date-fns/format";
import i18next from "i18next";
-import Post from '../../api/model/webhook/post.js';
-import Get from '../../api/model/webhook/get.js';
-import Put from '../../api/model/webhook/put.js';
-import Alpine from 'alpinejs';
+import Post from "../../api/model/webhook/post.js";
+import Get from "../../api/model/webhook/get.js";
+import Put from "../../api/model/webhook/put.js";
+import Alpine from "alpinejs";
window.enableDates = false;
@@ -40,19 +40,19 @@ let show = function () {
active: false,
show_secret: false,
- title: '',
- url: '',
- secret: '',
+ title: "",
+ url: "",
+ secret: "",
triggers: [],
responses: [],
deliveries: [],
message_attempts: [],
- message_content: '',
+ message_content: "",
messages: [],
- edit_url: '#',
- delete_url: '#',
- success_message: '',
+ edit_url: "#",
+ delete_url: "#",
+ success_message: "",
disabledTrigger: false,
init() {
this.i18next = i18next;
@@ -60,7 +60,7 @@ let show = function () {
},
getWebhook() {
this.loading = true;
- const page = window.location.href.split('/');
+ const page = window.location.href.split("/");
this.id = parseInt(page[page.length - 1]);
this.downloadWebhook();
this.downloadWebhookMessages();
@@ -72,11 +72,13 @@ let show = function () {
if (e) {
e.preventDefault();
}
- let journalId = parseInt(prompt('Enter a transaction ID'));
+ let journalId = parseInt(prompt("Enter a transaction ID"));
if (journalId !== null && journalId > 0 && journalId <= 16777216) {
this.disabledTrigger = true;
- this.success_message = i18next.t('firefly.webhook_was_triggered');
- (new Post).triggerTransaction(this.id, journalId);
+ this.success_message = i18next.t(
+ "firefly.webhook_was_triggered",
+ );
+ new Post().triggerTransaction(this.id, journalId);
// set a time-outs.
this.loading = true;
@@ -87,37 +89,44 @@ let show = function () {
// console.log('OK 3');
}
-
return false;
},
downloadWebhook: function () {
- (new Get).show(this.id).then(response => {
- this.edit_url = './webhooks/edit/' + this.id;
- this.delete_url = './webhooks/delete/' + this.id;
- this.title = response.data.data.attributes.title;
- this.url = response.data.data.attributes.url;
- this.secret = response.data.data.attributes.secret;
- this.triggers = response.data.data.attributes.triggers;
- this.responses = response.data.data.attributes.responses;
- this.deliveries = response.data.data.attributes.deliveries;
- this.active = response.data.data.attributes.active;
- this.url = response.data.data.attributes.url;
- }).catch(error => {
- this.error_message = error.response.data.message;
- });
+ new Get()
+ .show(this.id)
+ .then((response) => {
+ this.edit_url = "./webhooks/edit/" + this.id;
+ this.delete_url = "./webhooks/delete/" + this.id;
+ this.title = response.data.data.attributes.title;
+ this.url = response.data.data.attributes.url;
+ this.secret = response.data.data.attributes.secret;
+ this.triggers = response.data.data.attributes.triggers;
+ this.responses = response.data.data.attributes.responses;
+ this.deliveries = response.data.data.attributes.deliveries;
+ this.active = response.data.data.attributes.active;
+ this.url = response.data.data.attributes.url;
+ })
+ .catch((error) => {
+ this.error_message = error.response.data.message;
+ });
},
downloadWebhookMessages: function () {
this.messages = [];
- (new Get).messages(this.id, {}).then(response => {
+ new Get().messages(this.id, {}).then((response) => {
for (let i in response.data.data) {
- if (Object.hasOwn(response.data.data,i)) {
+ if (Object.hasOwn(response.data.data, i)) {
let current = response.data.data[i];
this.messages.push({
id: current.id,
- created_at: format(new Date(current.attributes.created_at), i18next.t('config.date_time_fns')),
+ created_at: format(
+ new Date(current.attributes.created_at),
+ i18next.t("config.date_time_fns"),
+ ),
uuid: current.attributes.uuid,
- success: current.attributes.sent && !current.attributes.errored,
+ success:
+ current.attributes.sent &&
+ !current.attributes.errored,
message: current.attributes.message,
});
}
@@ -126,26 +135,29 @@ let show = function () {
});
},
resetSecret: function () {
- (new Put).put({secret: 'anything'}, {id: this.id}).then(() => {
+ new Put().put({ secret: "anything" }, { id: this.id }).then(() => {
this.downloadWebhook();
});
},
showWebhookMessage: function (id) {
- (new Get).message(this.id, id, {}).then(response => {
+ new Get().message(this.id, id, {}).then((response) => {
this.message_content = response.data.data.attributes.message;
});
},
showWebhookAttempts: function (id) {
- console.log('showWebhookAttempts', id);
+ console.log("showWebhookAttempts", id);
this.message_attempts = [];
- (new Get).attempts(this.id, id, {}).then(response => {
+ new Get().attempts(this.id, id, {}).then((response) => {
for (let i in response.data.data) {
- if (Object.hasOwn(response.data.data,i)) {
+ if (Object.hasOwn(response.data.data, i)) {
let current = response.data.data[i];
this.message_attempts.push({
id: current.id,
- created_at: format(new Date(current.attributes.created_at), i18next.t('config.date_time_fns')),
+ created_at: format(
+ new Date(current.attributes.created_at),
+ i18next.t("config.date_time_fns"),
+ ),
logs: current.attributes.logs,
status_code: current.attributes.status_code,
response: current.attributes.response,
@@ -154,19 +166,18 @@ let show = function () {
}
});
},
- }
+ };
};
-
const comps = {
show,
sidebar,
- dates
+ dates,
};
function loadPage(comps) {
- console.log('loadPage');
- Object.keys(comps).forEach(comp => {
+ console.log("loadPage");
+ Object.keys(comps).forEach((comp) => {
let data = comps[comp]();
Alpine.data(comp, () => data);
//console.log(comp);
@@ -175,12 +186,12 @@ function loadPage(comps) {
}
// wait for load until bootstrapped event is received.
-document.addEventListener('firefly-iii-bootstrapped', () => {
- console.log('Loaded through event listener.');
+document.addEventListener("firefly-iii-bootstrapped", () => {
+ console.log("Loaded through event listener.");
loadPage(comps);
});
// or is bootstrapped before event is triggered.
if (window.bootstrapped) {
- console.log('Loaded through window variable.');
+ console.log("Loaded through window variable.");
loadPage(comps);
}
diff --git a/resources/assets/v3/js/shared/draw-chart.js b/resources/assets/v3/js/shared/draw-chart.js
index 2d5ab449c5..f8bfe9be51 100644
--- a/resources/assets/v3/js/shared/draw-chart.js
+++ b/resources/assets/v3/js/shared/draw-chart.js
@@ -18,110 +18,110 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
-import Chart from 'chart.js/auto';
+import Chart from "chart.js/auto";
import formatMoney from "../util/format-money.js";
import i18next from "i18next";
let defaultChartOptions = {
-
elements: {
line: {
- cubicInterpolationMode: 'monotone'
- }
+ cubicInterpolationMode: "monotone",
+ },
},
plugins: {
legend: {
display: false,
},
tooltip: {
- callbacks: {
- }
- }
+ callbacks: {},
+ },
},
responsive: true,
maintainAspectRatio: false,
scales: {
x: {
- axis: 'x',
+ axis: "x",
grid: {
- display: false
- }
+ display: false,
+ },
},
y: {
display: true,
beginAtZero: true,
- ticks: {}
+ ticks: {},
},
- }
+ },
};
export function drawSingleCurrencyChart(type, url, holder, anonymous) {
- if ('line' === type) {
+ if ("line" === type) {
drawSingleCurrencyLineChart(url, holder, anonymous);
}
}
function drawSingleCurrencyLineChart(url, holder, anonymous) {
-
- document.getElementById(holder).classList.remove('general-chart-error');
- window.axios.get(url).then((response) => {
- let all = response.data;
- let data = all.data;
- let currency = all.currency;
-
-
- let yAxisCallback = function (value) {
- if (anonymous) {
- value = '0';
- }
- return formatMoney(value, currency.code);
- }
- let labelCallback = function (tooltipItem) {
- "use strict";
- let index = tooltipItem.dataIndex;
- let amount = tooltipItem.dataset.data[index];
- let label = tooltipItem.label;
- let string = formatMoney(amount, currency.code);
- if (anonymous) {
- string = formatMoney('0', currency.code);
+ document.getElementById(holder).classList.remove("general-chart-error");
+ window.axios
+ .get(url)
+ .then((response) => {
+ let all = response.data;
+ let data = all.data;
+ let currency = all.currency;
+
+ let yAxisCallback = function (value) {
+ if (anonymous) {
+ value = "0";
+ }
+ return formatMoney(value, currency.code);
+ };
+ let labelCallback = function (tooltipItem) {
+ "use strict";
+ let index = tooltipItem.dataIndex;
+ let amount = tooltipItem.dataset.data[index];
+ let label = tooltipItem.label;
+ let string = formatMoney(amount, currency.code);
+ if (anonymous) {
+ string = formatMoney("0", currency.code);
+ }
+ return label + ": " + string;
+ };
+
+ let options = { ...defaultChartOptions };
+ options.scales.y.ticks.callback = yAxisCallback;
+ options.plugins.tooltip.callbacks.label = labelCallback;
+
+ if (
+ typeof data === "undefined" ||
+ 0 === data.length ||
+ (typeof data === "object" &&
+ typeof data.labels === "object" &&
+ 0 === data.labels.length)
+ ) {
+ let el = document.getElementById(holder).parentElement;
+ el.innerHTML = "";
+ el.classList.add("general-chart-error");
+ el.innerText = i18next.t("firefly.no_data_for_chart");
+ return;
}
- return label + ': ' + string;
- }
-
-
- let options = {...defaultChartOptions};
- options.scales.y.ticks.callback = yAxisCallback;
- options.plugins.tooltip.callbacks.label = labelCallback;
-
- if (typeof data === 'undefined' || 0 === data.length ||
- (typeof data === 'object' && typeof data.labels === 'object' && 0 === data.labels.length)
- ) {
+ // TODO colorize data?
+ // if (colorData) {
+ // data = colorizeData(data);
+ // }
+
+ // lineChart
+ const ctx = document.getElementById(holder).getContext("2d");
+ new Chart(ctx, {
+ type: "line",
+ data: data,
+ options: options,
+ });
+ })
+ .catch((error) => {
let el = document.getElementById(holder).parentElement;
- el.innerHTML = '';
- el.classList.add('general-chart-error');
- el.innerText = i18next.t('firefly.no_data_for_chart');
- return;
- }
-
- // TODO colorize data?
- // if (colorData) {
- // data = colorizeData(data);
- // }
-
- // lineChart
- const ctx = document.getElementById(holder).getContext('2d');
- new Chart(ctx, {
- type: 'line',
- data: data,
- options: options
+ el.innerHTML = "";
+ el.classList.add("general-chart-error");
+ el.innerText =
+ i18next.t("firefly.could_not_load_chart") + " " + error;
});
- }).catch((error) => {
- let el = document.getElementById(holder).parentElement;
- el.innerHTML = '';
- el.classList.add('general-chart-error');
- el.innerText = i18next.t('firefly.could_not_load_chart') + ' ' + error;
- });
-
-
}
diff --git a/resources/assets/v3/js/store/get-fresh-variable.js b/resources/assets/v3/js/store/get-fresh-variable.js
index f469a3fe73..84968a0c93 100644
--- a/resources/assets/v3/js/store/get-fresh-variable.js
+++ b/resources/assets/v3/js/store/get-fresh-variable.js
@@ -22,25 +22,27 @@ import Get from "../api/preferences/index.js";
import Post from "../api/preferences/post.js";
export function getFreshVariable(name, defaultValue = null) {
- let getter = (new Get);
- return getter.getByName(name).then((response) => {
- // console.log('Get from API');
- return Promise.resolve(parseResponse(name, response));
- }).catch((response) => {
- if(response.status === 404) {
- // preference does not exist (yet).
- // POST it and then return it anyway.
- let poster = (new Post);
- poster.post(name, defaultValue).then((response) => {
- return Promise.resolve(parseResponse(name, response));
- });
- return;
- }
- return Promise.resolve(null);
- });
+ let getter = new Get();
+ return getter
+ .getByName(name)
+ .then((response) => {
+ // console.log('Get from API');
+ return Promise.resolve(parseResponse(name, response));
+ })
+ .catch((response) => {
+ if (response.status === 404) {
+ // preference does not exist (yet).
+ // POST it and then return it anyway.
+ let poster = new Post();
+ poster.post(name, defaultValue).then((response) => {
+ return Promise.resolve(parseResponse(name, response));
+ });
+ return;
+ }
+ return Promise.resolve(null);
+ });
}
function parseResponse(name, response) {
return response.data.data.attributes.data;
}
-
diff --git a/resources/assets/v3/js/store/get-variable.js b/resources/assets/v3/js/store/get-variable.js
index 1eead2a1ec..9714228ab6 100644
--- a/resources/assets/v3/js/store/get-variable.js
+++ b/resources/assets/v3/js/store/get-variable.js
@@ -22,40 +22,53 @@ import Get from "../api/preferences/index.js";
import Post from "../api/preferences/post.js";
export function getVariable(name, defaultValue = null) {
- const validCache = window.store.get('cacheValid');
+ const validCache = window.store.get("cacheValid");
// console.log('Cache valid: ', validCache);
// currently unused, window.X can be used by the blade template
// to make things available quicker than if the store has to grab it through the API.
// then again, it's not that slow.
if (validCache && Object.hasOwn(window, name)) {
- console.log('Returning "'+name+'" from window: ' + window[name]);
+ console.log('Returning "' + name + '" from window: ' + window[name]);
return Promise.resolve(window[name]);
}
// load from store2, if it's present.
const fromStore = window.store.get(name);
- if (validCache && typeof fromStore !== 'undefined') {
- console.log('Returning "'+name+'" from store: ' + fromStore);
+ if (validCache && typeof fromStore !== "undefined") {
+ console.log('Returning "' + name + '" from store: ' + fromStore);
return Promise.resolve(fromStore);
}
- let getter = (new Get);
+ let getter = new Get();
- return getter.getByName(name).then((response) => {
- console.log('Returning "'+name+'" from server: ' + parseResponse(name, response));
- return Promise.resolve(parseResponse(name, response));
- }).catch((error) => {
- console.log(error);
- if('' === defaultValue) {
- // do not try to store empty strings.
- return Promise.resolve(defaultValue);
- }
- // preference does not exist (yet).
- // POST it and then return it anyway.
- let poster = (new Post);
- return poster.post(name, defaultValue).then((response) => {
- console.log('Returning "'+name+'" from POST: ' + parseResponse(name, response));
+ return getter
+ .getByName(name)
+ .then((response) => {
+ console.log(
+ 'Returning "' +
+ name +
+ '" from server: ' +
+ parseResponse(name, response),
+ );
return Promise.resolve(parseResponse(name, response));
+ })
+ .catch((error) => {
+ console.log(error);
+ if ("" === defaultValue) {
+ // do not try to store empty strings.
+ return Promise.resolve(defaultValue);
+ }
+ // preference does not exist (yet).
+ // POST it and then return it anyway.
+ let poster = new Post();
+ return poster.post(name, defaultValue).then((response) => {
+ console.log(
+ 'Returning "' +
+ name +
+ '" from POST: ' +
+ parseResponse(name, response),
+ );
+ return Promise.resolve(parseResponse(name, response));
+ });
});
- });
}
export function parseResponse(name, response) {
@@ -63,4 +76,3 @@ export function parseResponse(name, response) {
window.store.set(name, value);
return value;
}
-
diff --git a/resources/assets/v3/js/store/get-variables.js b/resources/assets/v3/js/store/get-variables.js
index a34dbf3170..ce4858d9ea 100644
--- a/resources/assets/v3/js/store/get-variables.js
+++ b/resources/assets/v3/js/store/get-variables.js
@@ -25,7 +25,7 @@ export function getVariables(preferences) {
let chain = Promise.resolve();
let collectable = [];
let result = {};
- const validCache = window.store.get('cacheValid');
+ const validCache = window.store.get("cacheValid");
// let fromStore;
// first, check cache if elements are present.
@@ -65,21 +65,24 @@ export function getVariables(preferences) {
collectable.push(name);
}
if (collectable.length > 0) {
- let getter = (new Get);
+ let getter = new Get();
// console.log('Have something to collect');
chain = chain.then(() => {
- let names = collectable.join(',');
+ let names = collectable.join(",");
//console.log('Will collect', names);
- return getter.getList(names).then((response) => {
- let parsed = parseResponses(response);
- // console.log('Returning "' + names + '" from server: ', parsed);
- // add to object:
- result = Object.assign(result, parsed);
+ return getter
+ .getList(names)
+ .then((response) => {
+ let parsed = parseResponses(response);
+ // console.log('Returning "' + names + '" from server: ', parsed);
+ // add to object:
+ result = Object.assign(result, parsed);
- return Promise.resolve(result);
- }).catch((error) => {
- console.error(error);
- });
+ return Promise.resolve(result);
+ })
+ .catch((error) => {
+ console.error(error);
+ });
});
}
@@ -89,7 +92,7 @@ export function getVariables(preferences) {
}
export function parseResponses(response) {
- let result = {}
+ let result = {};
for (let i in response.data.data) {
if (Object.hasOwn(response.data.data, i)) {
let current = response.data.data[i];
diff --git a/resources/assets/v3/js/store/store.js b/resources/assets/v3/js/store/store.js
index 9d3f46b0e5..693ccfce71 100644
--- a/resources/assets/v3/js/store/store.js
+++ b/resources/assets/v3/js/store/store.js
@@ -18,8 +18,8 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
-import engine from 'store/src/store-engine';
-import storages from 'store/storages/all';
-import plugins from 'store/plugins/observe';
+import engine from "store/src/store-engine";
+import storages from "store/storages/all";
+import plugins from "store/plugins/observe";
-export default engine.createStore(storages, plugins)
+export default engine.createStore(storages, plugins);
diff --git a/resources/assets/v3/js/support/cleanup-cache.js b/resources/assets/v3/js/support/cleanup-cache.js
index b82203f91e..36addde29b 100644
--- a/resources/assets/v3/js/support/cleanup-cache.js
+++ b/resources/assets/v3/js/support/cleanup-cache.js
@@ -21,13 +21,13 @@
import store from "store";
function cleanupCache() {
- const localValue = store.get('lastActivity');
+ const localValue = store.get("lastActivity");
- store.each(function(value, key) {
- if(key.startsWith('dcx') && !key.includes(localValue)) {
+ store.each(function (value, key) {
+ if (key.startsWith("dcx") && !key.includes(localValue)) {
store.remove(key);
}
});
}
-export {cleanupCache};
+export { cleanupCache };
diff --git a/resources/assets/v3/js/support/get-cache-key.js b/resources/assets/v3/js/support/get-cache-key.js
index 563aca9b88..025247379a 100644
--- a/resources/assets/v3/js/support/get-cache-key.js
+++ b/resources/assets/v3/js/support/get-cache-key.js
@@ -18,30 +18,30 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
-import {format} from "date-fns";
+import { format } from "date-fns";
import store from "store";
//const { createHash } = require('crypto');
-
-
function getCacheKey(string, params) {
- const lastActivity = store.get('lastActivity')
- let newParams = {lastActivity: lastActivity, key: string};
+ const lastActivity = store.get("lastActivity");
+ let newParams = { lastActivity: lastActivity, key: string };
for (const key in params) {
if (Object.hasOwn(params, key)) {
- if(params[key] === null || params[key] === undefined) {
- newParams[key] = '';
+ if (params[key] === null || params[key] === undefined) {
+ newParams[key] = "";
continue;
}
- if(params[key] instanceof Date) {
- newParams[key] = format(params[key], 'yMMdd');
+ if (params[key] instanceof Date) {
+ newParams[key] = format(params[key], "yMMdd");
continue;
}
newParams[key] = params[key];
}
}
- return 'dcx_' + md5(JSON.stringify(newParams)).substring(0,12) + lastActivity;
+ return (
+ "dcx_" + md5(JSON.stringify(newParams)).substring(0, 12) + lastActivity
+ );
}
// Formatted version of a popular md5 implementation
@@ -49,48 +49,135 @@ function getCacheKey(string, params) {
// The function itself is now 42 lines long.
function md5(inputString) {
- var hc="0123456789abcdef";
- function rh(n) {var j,s="";for(j=0;j<=3;j++) s+=hc.charAt((n>>(j*8+4))&0x0F)+hc.charAt((n>>(j*8))&0x0F);return s;}
- function ad(x,y) {var l=(x&0xFFFF)+(y&0xFFFF);var m=(x>>16)+(y>>16)+(l>>16);return (m<<16)|(l&0xFFFF);}
- function rl(n,c) {return (n<<c)|(n>>>(32-c));}
- function cm(q,a,b,x,s,t) {return ad(rl(ad(ad(a,q),ad(x,t)),s),b);}
- function ff(a,b,c,d,x,s,t) {return cm((b&c)|((~b)&d),a,b,x,s,t);}
- function gg(a,b,c,d,x,s,t) {return cm((b&d)|(c&(~d)),a,b,x,s,t);}
- function hh(a,b,c,d,x,s,t) {return cm(b^c^d,a,b,x,s,t);}
- function ii(a,b,c,d,x,s,t) {return cm(c^(b|(~d)),a,b,x,s,t);}
+ var hc = "0123456789abcdef";
+ function rh(n) {
+ var j,
+ s = "";
+ for (j = 0; j <= 3; j++)
+ s +=
+ hc.charAt((n >> (j * 8 + 4)) & 0x0f) +
+ hc.charAt((n >> (j * 8)) & 0x0f);
+ return s;
+ }
+ function ad(x, y) {
+ var l = (x & 0xffff) + (y & 0xffff);
+ var m = (x >> 16) + (y >> 16) + (l >> 16);
+ return (m << 16) | (l & 0xffff);
+ }
+ function rl(n, c) {
+ return (n << c) | (n >>> (32 - c));
+ }
+ function cm(q, a, b, x, s, t) {
+ return ad(rl(ad(ad(a, q), ad(x, t)), s), b);
+ }
+ function ff(a, b, c, d, x, s, t) {
+ return cm((b & c) | (~b & d), a, b, x, s, t);
+ }
+ function gg(a, b, c, d, x, s, t) {
+ return cm((b & d) | (c & ~d), a, b, x, s, t);
+ }
+ function hh(a, b, c, d, x, s, t) {
+ return cm(b ^ c ^ d, a, b, x, s, t);
+ }
+ function ii(a, b, c, d, x, s, t) {
+ return cm(c ^ (b | ~d), a, b, x, s, t);
+ }
function sb(x) {
- var i;var nblk=((x.length+8)>>6)+1;var blks=new Array(nblk*16);for(i=0;i<nblk*16;i++) blks[i]=0;
- for(i=0;i<x.length;i++) blks[i>>2]|=x.charCodeAt(i)<<((i%4)*8);
- blks[i>>2]|=0x80<<((i%4)*8);blks[nblk*16-2]=x.length*8;return blks;
+ var i;
+ var nblk = ((x.length + 8) >> 6) + 1;
+ var blks = new Array(nblk * 16);
+ for (i = 0; i < nblk * 16; i++) blks[i] = 0;
+ for (i = 0; i < x.length; i++)
+ blks[i >> 2] |= x.charCodeAt(i) << ((i % 4) * 8);
+ blks[i >> 2] |= 0x80 << ((i % 4) * 8);
+ blks[nblk * 16 - 2] = x.length * 8;
+ return blks;
}
- var i,x=sb(""+inputString),a=1732584193,b=-271733879,c=-1732584194,d=271733878,olda,oldb,oldc,oldd;
- for(i=0;i<x.length;i+=16) {olda=a;oldb=b;oldc=c;oldd=d;
- a=ff(a,b,c,d,x[i+ 0], 7, -680876936);d=ff(d,a,b,c,x[i+ 1],12, -389564586);c=ff(c,d,a,b,x[i+ 2],17, 606105819);
- b=ff(b,c,d,a,x[i+ 3],22,-1044525330);a=ff(a,b,c,d,x[i+ 4], 7, -176418897);d=ff(d,a,b,c,x[i+ 5],12, 1200080426);
- c=ff(c,d,a,b,x[i+ 6],17,-1473231341);b=ff(b,c,d,a,x[i+ 7],22, -45705983);a=ff(a,b,c,d,x[i+ 8], 7, 1770035416);
- d=ff(d,a,b,c,x[i+ 9],12,-1958414417);c=ff(c,d,a,b,x[i+10],17, -42063);b=ff(b,c,d,a,x[i+11],22,-1990404162);
- a=ff(a,b,c,d,x[i+12], 7, 1804603682);d=ff(d,a,b,c,x[i+13],12, -40341101);c=ff(c,d,a,b,x[i+14],17,-1502002290);
- b=ff(b,c,d,a,x[i+15],22, 1236535329);a=gg(a,b,c,d,x[i+ 1], 5, -165796510);d=gg(d,a,b,c,x[i+ 6], 9,-1069501632);
- c=gg(c,d,a,b,x[i+11],14, 643717713);b=gg(b,c,d,a,x[i+ 0],20, -373897302);a=gg(a,b,c,d,x[i+ 5], 5, -701558691);
- d=gg(d,a,b,c,x[i+10], 9, 38016083);c=gg(c,d,a,b,x[i+15],14, -660478335);b=gg(b,c,d,a,x[i+ 4],20, -405537848);
- a=gg(a,b,c,d,x[i+ 9], 5, 568446438);d=gg(d,a,b,c,x[i+14], 9,-1019803690);c=gg(c,d,a,b,x[i+ 3],14, -187363961);
- b=gg(b,c,d,a,x[i+ 8],20, 1163531501);a=gg(a,b,c,d,x[i+13], 5,-1444681467);d=gg(d,a,b,c,x[i+ 2], 9, -51403784);
- c=gg(c,d,a,b,x[i+ 7],14, 1735328473);b=gg(b,c,d,a,x[i+12],20,-1926607734);a=hh(a,b,c,d,x[i+ 5], 4, -378558);
- d=hh(d,a,b,c,x[i+ 8],11,-2022574463);c=hh(c,d,a,b,x[i+11],16, 1839030562);b=hh(b,c,d,a,x[i+14],23, -35309556);
- a=hh(a,b,c,d,x[i+ 1], 4,-1530992060);d=hh(d,a,b,c,x[i+ 4],11, 1272893353);c=hh(c,d,a,b,x[i+ 7],16, -155497632);
- b=hh(b,c,d,a,x[i+10],23,-1094730640);a=hh(a,b,c,d,x[i+13], 4, 681279174);d=hh(d,a,b,c,x[i+ 0],11, -358537222);
- c=hh(c,d,a,b,x[i+ 3],16, -722521979);b=hh(b,c,d,a,x[i+ 6],23, 76029189);a=hh(a,b,c,d,x[i+ 9], 4, -640364487);
- d=hh(d,a,b,c,x[i+12],11, -421815835);c=hh(c,d,a,b,x[i+15],16, 530742520);b=hh(b,c,d,a,x[i+ 2],23, -995338651);
- a=ii(a,b,c,d,x[i+ 0], 6, -198630844);d=ii(d,a,b,c,x[i+ 7],10, 1126891415);c=ii(c,d,a,b,x[i+14],15,-1416354905);
- b=ii(b,c,d,a,x[i+ 5],21, -57434055);a=ii(a,b,c,d,x[i+12], 6, 1700485571);d=ii(d,a,b,c,x[i+ 3],10,-1894986606);
- c=ii(c,d,a,b,x[i+10],15, -1051523);b=ii(b,c,d,a,x[i+ 1],21,-2054922799);a=ii(a,b,c,d,x[i+ 8], 6, 1873313359);
- d=ii(d,a,b,c,x[i+15],10, -30611744);c=ii(c,d,a,b,x[i+ 6],15,-1560198380);b=ii(b,c,d,a,x[i+13],21, 1309151649);
- a=ii(a,b,c,d,x[i+ 4], 6, -145523070);d=ii(d,a,b,c,x[i+11],10,-1120210379);c=ii(c,d,a,b,x[i+ 2],15, 718787259);
- b=ii(b,c,d,a,x[i+ 9],21, -343485551);a=ad(a,olda);b=ad(b,oldb);c=ad(c,oldc);d=ad(d,oldd);
+ var i,
+ x = sb("" + inputString),
+ a = 1732584193,
+ b = -271733879,
+ c = -1732584194,
+ d = 271733878,
+ olda,
+ oldb,
+ oldc,
+ oldd;
+ for (i = 0; i < x.length; i += 16) {
+ olda = a;
+ oldb = b;
+ oldc = c;
+ oldd = d;
+ a = ff(a, b, c, d, x[i + 0], 7, -680876936);
+ d = ff(d, a, b, c, x[i + 1], 12, -389564586);
+ c = ff(c, d, a, b, x[i + 2], 17, 606105819);
+ b = ff(b, c, d, a, x[i + 3], 22, -1044525330);
+ a = ff(a, b, c, d, x[i + 4], 7, -176418897);
+ d = ff(d, a, b, c, x[i + 5], 12, 1200080426);
+ c = ff(c, d, a, b, x[i + 6], 17, -1473231341);
+ b = ff(b, c, d, a, x[i + 7], 22, -45705983);
+ a = ff(a, b, c, d, x[i + 8], 7, 1770035416);
+ d = ff(d, a, b, c, x[i + 9], 12, -1958414417);
+ c = ff(c, d, a, b, x[i + 10], 17, -42063);
+ b = ff(b, c, d, a, x[i + 11], 22, -1990404162);
+ a = ff(a, b, c, d, x[i + 12], 7, 1804603682);
+ d = ff(d, a, b, c, x[i + 13], 12, -40341101);
+ c = ff(c, d, a, b, x[i + 14], 17, -1502002290);
+ b = ff(b, c, d, a, x[i + 15], 22, 1236535329);
+ a = gg(a, b, c, d, x[i + 1], 5, -165796510);
+ d = gg(d, a, b, c, x[i + 6], 9, -1069501632);
+ c = gg(c, d, a, b, x[i + 11], 14, 643717713);
+ b = gg(b, c, d, a, x[i + 0], 20, -373897302);
+ a = gg(a, b, c, d, x[i + 5], 5, -701558691);
+ d = gg(d, a, b, c, x[i + 10], 9, 38016083);
+ c = gg(c, d, a, b, x[i + 15], 14, -660478335);
+ b = gg(b, c, d, a, x[i + 4], 20, -405537848);
+ a = gg(a, b, c, d, x[i + 9], 5, 568446438);
+ d = gg(d, a, b, c, x[i + 14], 9, -1019803690);
+ c = gg(c, d, a, b, x[i + 3], 14, -187363961);
+ b = gg(b, c, d, a, x[i + 8], 20, 1163531501);
+ a = gg(a, b, c, d, x[i + 13], 5, -1444681467);
+ d = gg(d, a, b, c, x[i + 2], 9, -51403784);
+ c = gg(c, d, a, b, x[i + 7], 14, 1735328473);
+ b = gg(b, c, d, a, x[i + 12], 20, -1926607734);
+ a = hh(a, b, c, d, x[i + 5], 4, -378558);
+ d = hh(d, a, b, c, x[i + 8], 11, -2022574463);
+ c = hh(c, d, a, b, x[i + 11], 16, 1839030562);
+ b = hh(b, c, d, a, x[i + 14], 23, -35309556);
+ a = hh(a, b, c, d, x[i + 1], 4, -1530992060);
+ d = hh(d, a, b, c, x[i + 4], 11, 1272893353);
+ c = hh(c, d, a, b, x[i + 7], 16, -155497632);
+ b = hh(b, c, d, a, x[i + 10], 23, -1094730640);
+ a = hh(a, b, c, d, x[i + 13], 4, 681279174);
+ d = hh(d, a, b, c, x[i + 0], 11, -358537222);
+ c = hh(c, d, a, b, x[i + 3], 16, -722521979);
+ b = hh(b, c, d, a, x[i + 6], 23, 76029189);
+ a = hh(a, b, c, d, x[i + 9], 4, -640364487);
+ d = hh(d, a, b, c, x[i + 12], 11, -421815835);
+ c = hh(c, d, a, b, x[i + 15], 16, 530742520);
+ b = hh(b, c, d, a, x[i + 2], 23, -995338651);
+ a = ii(a, b, c, d, x[i + 0], 6, -198630844);
+ d = ii(d, a, b, c, x[i + 7], 10, 1126891415);
+ c = ii(c, d, a, b, x[i + 14], 15, -1416354905);
+ b = ii(b, c, d, a, x[i + 5], 21, -57434055);
+ a = ii(a, b, c, d, x[i + 12], 6, 1700485571);
+ d = ii(d, a, b, c, x[i + 3], 10, -1894986606);
+ c = ii(c, d, a, b, x[i + 10], 15, -1051523);
+ b = ii(b, c, d, a, x[i + 1], 21, -2054922799);
+ a = ii(a, b, c, d, x[i + 8], 6, 1873313359);
+ d = ii(d, a, b, c, x[i + 15], 10, -30611744);
+ c = ii(c, d, a, b, x[i + 6], 15, -1560198380);
+ b = ii(b, c, d, a, x[i + 13], 21, 1309151649);
+ a = ii(a, b, c, d, x[i + 4], 6, -145523070);
+ d = ii(d, a, b, c, x[i + 11], 10, -1120210379);
+ c = ii(c, d, a, b, x[i + 2], 15, 718787259);
+ b = ii(b, c, d, a, x[i + 9], 21, -343485551);
+ a = ad(a, olda);
+ b = ad(b, oldb);
+ c = ad(c, oldc);
+ d = ad(d, oldd);
}
- return rh(a)+rh(b)+rh(c)+rh(d);
+ return rh(a) + rh(b) + rh(c) + rh(d);
}
-
-
-export {getCacheKey};
+export { getCacheKey };
diff --git a/resources/assets/v3/js/support/get-viewrange.js b/resources/assets/v3/js/support/get-viewrange.js
index 45084cfa61..0b787c8108 100644
--- a/resources/assets/v3/js/support/get-viewrange.js
+++ b/resources/assets/v3/js/support/get-viewrange.js
@@ -19,14 +19,16 @@
*/
import {
- endOfDay, endOfMonth, endOfQuarter,
+ endOfDay,
+ endOfMonth,
+ endOfQuarter,
endOfWeek,
startOfDay,
startOfMonth,
startOfQuarter,
startOfWeek,
startOfYear,
- subDays
+ subDays,
} from "date-fns";
function getViewRange(viewRange, today) {
@@ -36,55 +38,55 @@ function getViewRange(viewRange, today) {
// console.log('getViewRange: ' + viewRange);
switch (viewRange) {
- case 'last365':
+ case "last365":
start = startOfDay(subDays(today, 365));
end = endOfDay(today);
break;
- case 'last90':
+ case "last90":
start = startOfDay(subDays(today, 90));
end = endOfDay(today);
break;
- case 'last30':
+ case "last30":
start = startOfDay(subDays(today, 30));
end = endOfDay(today);
break;
- case 'last7':
+ case "last7":
start = startOfDay(subDays(today, 7));
end = endOfDay(today);
break;
- case 'YTD':
+ case "YTD":
start = startOfYear(today);
end = endOfDay(today);
break;
- case 'QTD':
+ case "QTD":
start = startOfQuarter(today);
end = endOfDay(today);
break;
- case 'MTD':
+ case "MTD":
start = startOfMonth(today);
end = endOfDay(today);
break;
- case '1D':
+ case "1D":
// today:
start = startOfDay(today);
end = endOfDay(today);
break;
- case '1W':
+ case "1W":
// this week:
- start = startOfDay(startOfWeek(today, {weekStartsOn: 1}));
- end = endOfDay(endOfWeek(today, {weekStartsOn: 1}));
+ start = startOfDay(startOfWeek(today, { weekStartsOn: 1 }));
+ end = endOfDay(endOfWeek(today, { weekStartsOn: 1 }));
break;
- case '1M':
+ case "1M":
// this month:
start = startOfDay(startOfMonth(today));
end = endOfDay(endOfMonth(today));
break;
- case '3M':
+ case "3M":
// this quarter
start = startOfDay(startOfQuarter(today));
end = endOfDay(endOfQuarter(today));
break;
- case '6M':
+ case "6M":
// this half-year
if (today.getMonth() <= 5) {
start = new Date(today);
@@ -107,7 +109,7 @@ function getViewRange(viewRange, today) {
end = endOfDay(start);
}
break;
- case '1Y':
+ case "1Y":
// this year
start = new Date(today);
start.setMonth(0);
@@ -120,7 +122,7 @@ function getViewRange(viewRange, today) {
end = endOfDay(end);
break;
}
- return {start: start, end: end};
+ return { start: start, end: end };
}
-export {getViewRange};
+export { getViewRange };
diff --git a/resources/assets/v3/js/support/load-translations.js b/resources/assets/v3/js/support/load-translations.js
index a044729a60..4d52f20444 100644
--- a/resources/assets/v3/js/support/load-translations.js
+++ b/resources/assets/v3/js/support/load-translations.js
@@ -18,7 +18,6 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
-
import i18next from "i18next";
import ChainedBackend from "i18next-chained-backend";
import HttpBackend from "i18next-http-backend";
@@ -29,34 +28,35 @@ let loaded = false;
function loadTranslations(locale) {
// console.log('loadTranslations(' + locale + ')');
if (false === loaded) {
- console.log('Not yet loaded');
- const replacedLocale = locale.replace('-', '_');
+ console.log("Not yet loaded");
+ const replacedLocale = locale.replace("-", "_");
loaded = true;
- const expireTime = import.meta.env.MODE === 'development' ? 1 : 7 * 24 * 60 * 60 * 1000;
+ const expireTime =
+ import.meta.env.MODE === "development"
+ ? 1
+ : 7 * 24 * 60 * 60 * 1000;
// console.log('Will load language "'+replacedLocale+'"');
- return i18next
- .use(ChainedBackend)
- .init({
- load: 'languageOnly',
- fallbackLng: "en",
- lng: replacedLocale,
- debug: import.meta.env.MODE === 'development',
- backend: {
- backends: [
- LocalStorageBackend,
- HttpBackend
- ],
- backendOptions: [{
- load: 'languageOnly',
- expirationTime: expireTime
- }, {
- loadPath: './v3/i18n/{{lng}}.json'
- }]
- }
- });
+ return i18next.use(ChainedBackend).init({
+ load: "languageOnly",
+ fallbackLng: "en",
+ lng: replacedLocale,
+ debug: import.meta.env.MODE === "development",
+ backend: {
+ backends: [LocalStorageBackend, HttpBackend],
+ backendOptions: [
+ {
+ load: "languageOnly",
+ expirationTime: expireTime,
+ },
+ {
+ loadPath: "./v3/i18n/{{lng}}.json",
+ },
+ ],
+ },
+ });
}
- console.warn( 'Loading translations skipped.');
+ console.warn("Loading translations skipped.");
return Promise.resolve();
}
-export {loadTranslations};
+export { loadTranslations };
diff --git a/resources/assets/v3/js/util/format-money.js b/resources/assets/v3/js/util/format-money.js
index 8ccbe6ae8d..07b6b26931 100644
--- a/resources/assets/v3/js/util/format-money.js
+++ b/resources/assets/v3/js/util/format-money.js
@@ -18,20 +18,25 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
-
export default function (amount, currencyCode) {
- if( (typeof amount !== 'number' && typeof amount !== 'string') || isNaN(amount)) {
- console.warn('format-money: amount is not a number:', amount);
- return '';
+ if (
+ (typeof amount !== "number" && typeof amount !== "string") ||
+ isNaN(amount)
+ ) {
+ console.warn("format-money: amount is not a number:", amount);
+ return "";
}
- if(typeof currencyCode !== 'string' || currencyCode.length !== 3) {
- console.warn('format-money: currencyCode is not a valid ISO 4217 code:', currencyCode);
- return '';
+ if (typeof currencyCode !== "string" || currencyCode.length !== 3) {
+ console.warn(
+ "format-money: currencyCode is not a valid ISO 4217 code:",
+ currencyCode,
+ );
+ return "";
}
- let locale = window.__localeId__.replace('_', '-');
+ let locale = window.__localeId__.replace("_", "-");
return Intl.NumberFormat(locale, {
- style: 'currency',
- currency: currencyCode
+ style: "currency",
+ currency: currencyCode,
}).format(amount);
}
diff --git a/resources/assets/v3/js/util/format.js b/resources/assets/v3/js/util/format.js
index 93018b5901..a19c965f5c 100644
--- a/resources/assets/v3/js/util/format.js
+++ b/resources/assets/v3/js/util/format.js
@@ -18,7 +18,7 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
-import {format} from 'date-fns'
+import { format } from "date-fns";
import {
bg,
cs,
@@ -51,8 +51,8 @@ import {
uk,
vi,
zhTW,
- zhCN
-} from 'date-fns/locale'
+ zhCN,
+} from "date-fns/locale";
const locales = {
bg,
@@ -86,14 +86,15 @@ const locales = {
uk,
vi,
zhTW,
- zhCN
-}
+ zhCN,
+};
// by providing a default string of 'PP' or any of its variants for `formatStr`
// it will format dates in whichever way is appropriate to the locale
-export default function (date, formatStr = 'PP') {
- let locale = window.__localeId__.replace('_', '');
+export default function (date, formatStr = "PP") {
+ let locale = window.__localeId__.replace("_", "");
return format(date, formatStr, {
- locale: locales[locale] ?? locales[locale.slice(0, 2)] ?? locales['enUS'] // or global.__localeId__
- })
+ locale:
+ locales[locale] ?? locales[locale.slice(0, 2)] ?? locales["enUS"], // or global.__localeId__
+ });
}
diff --git a/resources/assets/v3/sass/app.scss b/resources/assets/v3/sass/app.scss
index 067719bfa3..cc2086c4ff 100644
--- a/resources/assets/v3/sass/app.scss
+++ b/resources/assets/v3/sass/app.scss
@@ -25,11 +25,11 @@ $link-decoration: none;
$font-family-sans-serif: "Roboto", sans-serif;
// colors are for light mode.
-$danger: #CD5029; // original
+$danger: #cd5029; // original
//$danger: #993B1E; // slightly darker for WCAG on white bg
-$primary: #1E6581; // original
+$primary: #1e6581; // original
//$primary: #1C5E78; // slightly darker for WCAG test on white bg
-$success: #64B624; // original
+$success: #64b624; // original
//$success: #356114; // darker for WCAG pass
//$info: #065E6F;
@@ -37,7 +37,6 @@ $success: #64B624; // original
//$primary: #000;
//$success: #000;
-
@use "admin-lte/src/scss/adminlte" with (
$color-mode-type: $color-mode-type,
$link-decoration: $link-decoration,
@@ -48,54 +47,56 @@ $success: #64B624; // original
);
// for light mode, different money colors are used.
html[data-bs-theme="light"] .money-negative {
- color: #993B1E !important;
+ color: #993b1e !important;
}
html[data-bs-theme="light"] .money-positive {
color: #356114 !important;
}
html[data-bs-theme="light"] .money-transfer {
- color: #065E6F !important;
+ color: #065e6f !important;
}
// for dark mode, different money colors are used.
html[data-bs-theme="dark"] .money-negative {
- color: #E69F89 !important;
+ color: #e69f89 !important;
}
html[data-bs-theme="dark"] .money-positive {
- color: #6BC427 !important;
+ color: #6bc427 !important;
}
html[data-bs-theme="dark"] .money-transfer {
- color: #0BC1E5 !important;
+ color: #0bc1e5 !important;
}
-@import 'shepherd.js/dist/css/shepherd.css';
+@import "shepherd.js/dist/css/shepherd.css";
// custom Firefly III CSS
.general-chart-error {
min-height: 250px;
- text-align:center;
+ text-align: center;
background-size: 32px 32px;
- background-image: url('/images/warning-sign.png');
+ background-image: url("/images/warning-sign.png");
background-repeat: no-repeat;
background-position: center center;
}
.empty-chart-error {
min-height: 250px;
- text-align:center;
+ text-align: center;
background-size: 32px 32px;
- background-image: url('/images/empty.png');
+ background-image: url("/images/empty.png");
background-repeat: no-repeat;
background-position: center center;
}
// hide search.
-body.sidebar-collapse .search-xl {display:none;}
-body.sidebar-collapse .search-xs {display:block !important;}
+body.sidebar-collapse .search-xl {
+ display: none;
+}
+body.sidebar-collapse .search-xs {
+ display: block !important;
+}
// show search
-ul.nav:nth-child(1) > li:nth-child(2)
-
-.piggy-handle {
+ul.nav:nth-child(1) > li:nth-child(2) .piggy-handle {
cursor: move;
}
.object-handle {
@@ -117,22 +118,48 @@ body.waiting * {
}
/* some borders and lines */
-.top-light-border {border-top:1px #aaa solid;}
-.top-dark-border {border-top:1px #777 solid;}
-.bottom-light-border {border-bottom:1px #aaa solid;}
-
+.top-light-border {
+ border-top: 1px #aaa solid;
+}
+.top-dark-border {
+ border-top: 1px #777 solid;
+}
+.bottom-light-border {
+ border-bottom: 1px #aaa solid;
+}
/** new classes because of CSP */
-.wide-chart {width:100%;height:400px;}
-.low-chart {width:100%;height:200px;}
-.medium-chart {width:100%;height:250px;}
-.center-chart {width:100%;margin:0 auto;}
-.map-size {width:100%;height:300px;}
+.wide-chart {
+ width: 100%;
+ height: 400px;
+}
+.low-chart {
+ width: 100%;
+ height: 200px;
+}
+.medium-chart {
+ width: 100%;
+ height: 250px;
+}
+.center-chart {
+ width: 100%;
+ margin: 0 auto;
+}
+.map-size {
+ width: 100%;
+ height: 300px;
+}
/* some info for tables */
-td.quarter th.quarter {width:25%;}
-td.forty th.forty {width:40%;}
-td.thirty th.thirty {width:30%;}
+td.quarter th.quarter {
+ width: 25%;
+}
+td.forty th.forty {
+ width: 40%;
+}
+td.thirty th.thirty {
+ width: 30%;
+}
/* markdown stuff*/
.markdown blockquote p {
@@ -144,111 +171,309 @@ td.thirty th.thirty {width:30%;}
}
/** width for progress bar **/
-.w-0 {width:0 !important;}
-.w-1 {width:1% !important;}
-.w-2 {width:2% !important;}
-.w-3 {width:3% !important;}
-.w-4 {width:4% !important;}
-.w-5 {width:5% !important;}
-.w-6 {width:6% !important;}
-.w-7 {width:7% !important;}
-.w-8 {width:8% !important;}
-.w-9 {width:9% !important;}
-.w-10 {width:10% !important;}
-.w-11 {width:11% !important;}
-.w-12 {width:12% !important;}
-.w-13 {width:13% !important;}
-.w-14 {width:14% !important;}
-.w-15 {width:15% !important;}
-.w-16 {width:16% !important;}
-.w-17 {width:17% !important;}
-.w-18 {width:18% !important;}
-.w-19 {width:19% !important;}
-.w-20 {width:20% !important;}
-.w-21 {width:21% !important;}
-.w-22 {width:22% !important;}
-.w-23 {width:23% !important;}
-.w-24 {width:24% !important;}
-.w-25 {width:25% !important;}
-.w-26 {width:26% !important;}
-.w-27 {width:27% !important;}
-.w-28 {width:28% !important;}
-.w-29 {width:29% !important;}
-.w-30 {width:30% !important;}
-.w-31 {width:31% !important;}
-.w-32 {width:32% !important;}
-.w-33 {width:33% !important;}
-.w-34 {width:34% !important;}
-.w-35 {width:35% !important;}
-.w-36 {width:36% !important;}
-.w-37 {width:37% !important;}
-.w-38 {width:38% !important;}
-.w-39 {width:39% !important;}
-.w-40 {width:40% !important;}
-.w-41 {width:41% !important;}
-.w-42 {width:42% !important;}
-.w-43 {width:43% !important;}
-.w-44 {width:44% !important;}
-.w-45 {width:45% !important;}
-.w-46 {width:46% !important;}
-.w-47 {width:47% !important;}
-.w-48 {width:48% !important;}
-.w-49 {width:49% !important;}
-.w-50 {width:50% !important;}
-.w-51 {width:51% !important;}
-.w-52 {width:52% !important;}
-.w-53 {width:53% !important;}
-.w-54 {width:54% !important;}
-.w-55 {width:55% !important;}
-.w-56 {width:56% !important;}
-.w-57 {width:57% !important;}
-.w-58 {width:58% !important;}
-.w-59 {width:59% !important;}
-.w-60 {width:60% !important;}
-.w-61 {width:61% !important;}
-.w-62 {width:62% !important;}
-.w-63 {width:63% !important;}
-.w-64 {width:64% !important;}
-.w-65 {width:65% !important;}
-.w-66 {width:66% !important;}
-.w-67 {width:67% !important;}
-.w-68 {width:68% !important;}
-.w-69 {width:69% !important;}
-.w-70 {width:70% !important;}
-.w-71 {width:71% !important;}
-.w-72 {width:72% !important;}
-.w-73 {width:73% !important;}
-.w-74 {width:74% !important;}
-.w-75 {width:75% !important;}
-.w-76 {width:76% !important;}
-.w-77 {width:77% !important;}
-.w-78 {width:78% !important;}
-.w-79 {width:79% !important;}
-.w-80 {width:80% !important;}
-.w-81 {width:81% !important;}
-.w-82 {width:82% !important;}
-.w-83 {width:83% !important;}
-.w-84 {width:84% !important;}
-.w-85 {width:85% !important;}
-.w-86 {width:86% !important;}
-.w-87 {width:87% !important;}
-.w-88 {width:88% !important;}
-.w-89 {width:89% !important;}
-.w-90 {width:90% !important;}
-.w-91 {width:91% !important;}
-.w-92 {width:92% !important;}
-.w-93 {width:93% !important;}
-.w-94 {width:94% !important;}
-.w-95 {width:95% !important;}
-.w-96 {width:96% !important;}
-.w-97 {width:97% !important;}
-.w-98 {width:98% !important;}
-.w-99 {width:99% !important;}
-.w-100 {width:100% !important;}
-
-
-
-
+.w-0 {
+ width: 0 !important;
+}
+.w-1 {
+ width: 1% !important;
+}
+.w-2 {
+ width: 2% !important;
+}
+.w-3 {
+ width: 3% !important;
+}
+.w-4 {
+ width: 4% !important;
+}
+.w-5 {
+ width: 5% !important;
+}
+.w-6 {
+ width: 6% !important;
+}
+.w-7 {
+ width: 7% !important;
+}
+.w-8 {
+ width: 8% !important;
+}
+.w-9 {
+ width: 9% !important;
+}
+.w-10 {
+ width: 10% !important;
+}
+.w-11 {
+ width: 11% !important;
+}
+.w-12 {
+ width: 12% !important;
+}
+.w-13 {
+ width: 13% !important;
+}
+.w-14 {
+ width: 14% !important;
+}
+.w-15 {
+ width: 15% !important;
+}
+.w-16 {
+ width: 16% !important;
+}
+.w-17 {
+ width: 17% !important;
+}
+.w-18 {
+ width: 18% !important;
+}
+.w-19 {
+ width: 19% !important;
+}
+.w-20 {
+ width: 20% !important;
+}
+.w-21 {
+ width: 21% !important;
+}
+.w-22 {
+ width: 22% !important;
+}
+.w-23 {
+ width: 23% !important;
+}
+.w-24 {
+ width: 24% !important;
+}
+.w-25 {
+ width: 25% !important;
+}
+.w-26 {
+ width: 26% !important;
+}
+.w-27 {
+ width: 27% !important;
+}
+.w-28 {
+ width: 28% !important;
+}
+.w-29 {
+ width: 29% !important;
+}
+.w-30 {
+ width: 30% !important;
+}
+.w-31 {
+ width: 31% !important;
+}
+.w-32 {
+ width: 32% !important;
+}
+.w-33 {
+ width: 33% !important;
+}
+.w-34 {
+ width: 34% !important;
+}
+.w-35 {
+ width: 35% !important;
+}
+.w-36 {
+ width: 36% !important;
+}
+.w-37 {
+ width: 37% !important;
+}
+.w-38 {
+ width: 38% !important;
+}
+.w-39 {
+ width: 39% !important;
+}
+.w-40 {
+ width: 40% !important;
+}
+.w-41 {
+ width: 41% !important;
+}
+.w-42 {
+ width: 42% !important;
+}
+.w-43 {
+ width: 43% !important;
+}
+.w-44 {
+ width: 44% !important;
+}
+.w-45 {
+ width: 45% !important;
+}
+.w-46 {
+ width: 46% !important;
+}
+.w-47 {
+ width: 47% !important;
+}
+.w-48 {
+ width: 48% !important;
+}
+.w-49 {
+ width: 49% !important;
+}
+.w-50 {
+ width: 50% !important;
+}
+.w-51 {
+ width: 51% !important;
+}
+.w-52 {
+ width: 52% !important;
+}
+.w-53 {
+ width: 53% !important;
+}
+.w-54 {
+ width: 54% !important;
+}
+.w-55 {
+ width: 55% !important;
+}
+.w-56 {
+ width: 56% !important;
+}
+.w-57 {
+ width: 57% !important;
+}
+.w-58 {
+ width: 58% !important;
+}
+.w-59 {
+ width: 59% !important;
+}
+.w-60 {
+ width: 60% !important;
+}
+.w-61 {
+ width: 61% !important;
+}
+.w-62 {
+ width: 62% !important;
+}
+.w-63 {
+ width: 63% !important;
+}
+.w-64 {
+ width: 64% !important;
+}
+.w-65 {
+ width: 65% !important;
+}
+.w-66 {
+ width: 66% !important;
+}
+.w-67 {
+ width: 67% !important;
+}
+.w-68 {
+ width: 68% !important;
+}
+.w-69 {
+ width: 69% !important;
+}
+.w-70 {
+ width: 70% !important;
+}
+.w-71 {
+ width: 71% !important;
+}
+.w-72 {
+ width: 72% !important;
+}
+.w-73 {
+ width: 73% !important;
+}
+.w-74 {
+ width: 74% !important;
+}
+.w-75 {
+ width: 75% !important;
+}
+.w-76 {
+ width: 76% !important;
+}
+.w-77 {
+ width: 77% !important;
+}
+.w-78 {
+ width: 78% !important;
+}
+.w-79 {
+ width: 79% !important;
+}
+.w-80 {
+ width: 80% !important;
+}
+.w-81 {
+ width: 81% !important;
+}
+.w-82 {
+ width: 82% !important;
+}
+.w-83 {
+ width: 83% !important;
+}
+.w-84 {
+ width: 84% !important;
+}
+.w-85 {
+ width: 85% !important;
+}
+.w-86 {
+ width: 86% !important;
+}
+.w-87 {
+ width: 87% !important;
+}
+.w-88 {
+ width: 88% !important;
+}
+.w-89 {
+ width: 89% !important;
+}
+.w-90 {
+ width: 90% !important;
+}
+.w-91 {
+ width: 91% !important;
+}
+.w-92 {
+ width: 92% !important;
+}
+.w-93 {
+ width: 93% !important;
+}
+.w-94 {
+ width: 94% !important;
+}
+.w-95 {
+ width: 95% !important;
+}
+.w-96 {
+ width: 96% !important;
+}
+.w-97 {
+ width: 97% !important;
+}
+.w-98 {
+ width: 98% !important;
+}
+.w-99 {
+ width: 99% !important;
+}
+.w-100 {
+ width: 100% !important;
+}
// @import "admin-lte/dist/css/adminlte.min.css";
diff --git a/resources/lang/en_US/list.php b/resources/lang/en_US/list.php
index 04b69f0f05..477f2c62cb 100644
--- a/resources/lang/en_US/list.php
+++ b/resources/lang/en_US/list.php
@@ -23,54 +23,54 @@
declare(strict_types=1);
return [
- 'buttons' => 'Buttons',
- 'icon' => 'Icon',
- 'id' => 'ID',
- 'create_date' => 'Created at',
- 'date_time' => 'Date and time',
- 'uuid' => 'UUID',
- 'success' => 'Success?',
- 'more_details' => 'More details',
- 'responds_when' => 'Responds when',
- 'responds_with' => 'Responds with',
- 'primary_currency' => 'Primary currency',
- 'update_date' => 'Updated at',
- 'updated_at' => 'Updated at',
- 'balance_before' => 'Balance before',
- 'balance_after' => 'Balance after',
- 'name' => 'Name',
- 'role' => 'Role',
- 'currentBalance' => 'Current balance',
- 'linked_to_rules' => 'Relevant rules',
- 'active' => 'Is active?',
- 'percentage' => 'pct.',
- 'recurring_transaction' => 'Recurring transaction',
- 'next_due' => 'Next due',
- 'transaction_type' => 'Type',
- 'running_balance' => 'Running balance',
- 'lastActivity' => 'Last activity',
- 'balanceDiff' => 'Balance difference',
- 'other_meta_data' => 'Other meta data',
- 'invited_at' => 'Invited at',
- 'expires' => 'Invitation expires',
- 'invited_by' => 'Invited by',
- 'invite_link' => 'Invite link',
- 'account_type' => 'Account type',
- 'created_at' => 'Created at',
- 'account' => 'Account',
- 'external_url' => 'External URL',
- 'matchingAmount' => 'Amount',
- 'destination' => 'Destination',
- 'source' => 'Source',
- 'next_expected_match' => 'Next expected match',
- 'automatch' => 'Auto match?',
- 'drag_and_drop' => 'Drag and drop',
- 'number' => 'Account number',
- 'current_balance' => 'Current balance',
- 'last_activity' => 'Last activity',
- 'amount_due' => 'Amount due',
- 'balance_difference' => 'Balance difference',
- 'menu' => 'Menu',
+ 'buttons' => 'Buttons',
+ 'icon' => 'Icon',
+ 'id' => 'ID',
+ 'create_date' => 'Created at',
+ 'date_time' => 'Date and time',
+ 'uuid' => 'UUID',
+ 'success' => 'Success?',
+ 'more_details' => 'More details',
+ 'responds_when' => 'Responds when',
+ 'responds_with' => 'Responds with',
+ 'primary_currency' => 'Primary currency',
+ 'update_date' => 'Updated at',
+ 'updated_at' => 'Updated at',
+ 'balance_before' => 'Balance before',
+ 'balance_after' => 'Balance after',
+ 'name' => 'Name',
+ 'role' => 'Role',
+ 'currentBalance' => 'Current balance',
+ 'linked_to_rules' => 'Relevant rules',
+ 'active' => 'Is active?',
+ 'percentage' => 'pct.',
+ 'recurring_transaction' => 'Recurring transaction',
+ 'next_due' => 'Next due',
+ 'transaction_type' => 'Type',
+ 'running_balance' => 'Running balance',
+ 'lastActivity' => 'Last activity',
+ 'balanceDiff' => 'Balance difference',
+ 'other_meta_data' => 'Other meta data',
+ 'invited_at' => 'Invited at',
+ 'expires' => 'Invitation expires',
+ 'invited_by' => 'Invited by',
+ 'invite_link' => 'Invite link',
+ 'account_type' => 'Account type',
+ 'created_at' => 'Created at',
+ 'account' => 'Account',
+ 'external_url' => 'External URL',
+ 'matchingAmount' => 'Amount',
+ 'destination' => 'Destination',
+ 'source' => 'Source',
+ 'next_expected_match' => 'Next expected match',
+ 'automatch' => 'Auto match?',
+ 'drag_and_drop' => 'Drag and drop',
+ 'number' => 'Account number',
+ 'current_balance' => 'Current balance',
+ 'last_activity' => 'Last activity',
+ 'amount_due' => 'Amount due',
+ 'balance_difference' => 'Balance difference',
+ 'menu' => 'Menu',
'repeat_freq' => 'Repeats',
'description' => 'Description',
@@ -138,30 +138,30 @@ return [
'account_at_bunq' => 'Account with bunq',
'file_name' => 'File name',
- 'file_size' => 'File size',
- 'file_type' => 'File type',
- 'attached_to' => 'Attached to',
- 'file_exists' => 'File exists',
- 'spectre_bank' => 'Bank',
- 'spectre_last_use' => 'Last login',
- 'spectre_status' => 'Status',
- 'bunq_payment_id' => 'bunq payment ID',
- 'repetitions' => 'Repetitions',
- 'title' => 'Title',
- 'transaction_s' => 'Transaction(s)',
- 'field' => 'Field',
- 'value' => 'Value',
- 'interest' => 'Interest',
- 'interest_period' => 'Interest period',
- 'liability_type' => 'Type of liability',
- 'liability_direction' => 'Liability in/out',
- 'end_date' => 'End date',
- 'payment_info' => 'Payment information',
- 'expected_info' => 'Next expected transaction',
- 'start_date' => 'Start date',
- 'trigger' => 'Trigger',
- 'response' => 'Response',
- 'delivery' => 'Delivery',
- 'url' => 'URL',
- 'secret' => 'Secret',
+ 'file_size' => 'File size',
+ 'file_type' => 'File type',
+ 'attached_to' => 'Attached to',
+ 'file_exists' => 'File exists',
+ 'spectre_bank' => 'Bank',
+ 'spectre_last_use' => 'Last login',
+ 'spectre_status' => 'Status',
+ 'bunq_payment_id' => 'bunq payment ID',
+ 'repetitions' => 'Repetitions',
+ 'title' => 'Title',
+ 'transaction_s' => 'Transaction(s)',
+ 'field' => 'Field',
+ 'value' => 'Value',
+ 'interest' => 'Interest',
+ 'interest_period' => 'Interest period',
+ 'liability_type' => 'Type of liability',
+ 'liability_direction' => 'Liability in/out',
+ 'end_date' => 'End date',
+ 'payment_info' => 'Payment information',
+ 'expected_info' => 'Next expected transaction',
+ 'start_date' => 'Start date',
+ 'trigger' => 'Trigger',
+ 'response' => 'Response',
+ 'delivery' => 'Delivery',
+ 'url' => 'URL',
+ 'secret' => 'Secret',
];