Skip to content

Firefly III: a personal finances manager

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

JC5a031a25146c5
diff --git a/app/Api/V1/Controllers/Insight/Income/TagController.php b/app/Api/V1/Controllers/Insight/Income/TagController.php
index 94be2ae461..df99eef909 100644
--- a/app/Api/V1/Controllers/Insight/Income/TagController.php
+++ b/app/Api/V1/Controllers/Insight/Income/TagController.php
@@ -158,10 +158,7 @@ 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 b7b85fd376..f92a7aa9f0 100644
--- a/app/Api/V1/Controllers/Insight/Transfer/TagController.php
+++ b/app/Api/V1/Controllers/Insight/Transfer/TagController.php
@@ -155,10 +155,7 @@ 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 d461374baa..2edb4f5531 100644
--- a/app/Http/Controllers/Budget/BudgetLimitController.php
+++ b/app/Http/Controllers/Budget/BudgetLimitController.php
@@ -198,13 +198,7 @@ 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 52c6f900e3..65429e59c1 100644
--- a/app/Http/Controllers/Budget/IndexController.php
+++ b/app/Http/Controllers/Budget/IndexController.php
@@ -272,10 +272,7 @@ 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 f4b32fe5c5..ad724137dc 100644
--- a/app/Http/Controllers/Chart/BudgetController.php
+++ b/app/Http/Controllers/Chart/BudgetController.php
@@ -539,13 +539,7 @@ 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 affea656a0..476da65ac3 100644
--- a/app/Jobs/CreateAutoBudgetLimits.php
+++ b/app/Jobs/CreateAutoBudgetLimits.php
@@ -132,13 +132,7 @@ 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));
@@ -228,13 +222,7 @@ 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 a507156873..a3a940b1ba 100644
--- a/app/Support/Http/Controllers/AugumentData.php
+++ b/app/Support/Http/Controllers/AugumentData.php
@@ -222,14 +222,7 @@ 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 2428353cb0..d0c09bf027 100644
--- a/app/Support/JsonApi/Enrichments/RecurringEnrichment.php
+++ b/app/Support/JsonApi/Enrichments/RecurringEnrichment.php
@@ -354,11 +354,7 @@ 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/changelog.md b/changelog.md
index 7272fb3b18..cca8cd7511 100644
--- a/changelog.md
+++ b/changelog.md
@@ -7,7 +7,7 @@ This project adheres to [Semantic Versioning](http://semver.org/).
### Fixed
- [Discussion 12760](https://github.com/orgs/firefly-iii/discussions/12760) (419 Page expired when selecting a different date range) started by @wecoyote5
-- #12779
+- [Issue 12779](https://github.com/firefly-iii/firefly-iii/issues/12779) ("Create new ..." button on homepage doesn't pre-fill the corresponding account field) reported by @leppa
- [Issue 12781](https://github.com/firefly-iii/firefly-iii/issues/12781) (When mass editing transactions, only the last tag is kept) reported by @bertille-ddp
- [Issue 12782](https://github.com/firefly-iii/firefly-iii/issues/12782) (accounts with attachement in show page returns 500 error page) reported by @SL1c3R57
- [Issue 12783](https://github.com/firefly-iii/firefly-iii/issues/12783) (Clone / Clone & Edit doesn't work) reported by @gthbusrr
@@ -16,7 +16,7 @@ This project adheres to [Semantic Versioning](http://semver.org/).
- [Issue 12794](https://github.com/firefly-iii/firefly-iii/issues/12794) (Mobile layout: Budget and Spending chart is not displayed) reported by @MaxMapo
- [Issue 12795](https://github.com/firefly-iii/firefly-iii/issues/12795) (Clicking dates in reporting section with mouse always reset both dateboxes to "gg/mm/yyyy".) reported by @no-coders
- [Issue 12803](https://github.com/firefly-iii/firefly-iii/issues/12803) (Error "The description.xxxxxx field is required." when mass updating transactions) reported by @andyesten
-- #12815
+- [Issue 12815](https://github.com/firefly-iii/firefly-iii/issues/12815) (Reports shows disabled accounts) reported by @jlauwers
- References to layout `v2` will no longer break Firefly III.
- The show/hide password button is separated from the password field more clearly.
- Login throttle is a little more strict.
diff --git a/composer.lock b/composer.lock
index 8d1533f573..bece63ccc9 100644
--- a/composer.lock
+++ b/composer.lock
@@ -942,16 +942,16 @@
},
{
"name": "filp/whoops",
- "version": "2.18.4",
+ "version": "2.18.5",
"source": {
"type": "git",
"url": "https://github.com/filp/whoops.git",
- "reference": "d2102955e48b9fd9ab24280a7ad12ed552752c4d"
+ "reference": "baec851ad6ae00db8bd0fdd30d208afc1b71c56e"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/filp/whoops/zipball/d2102955e48b9fd9ab24280a7ad12ed552752c4d",
- "reference": "d2102955e48b9fd9ab24280a7ad12ed552752c4d",
+ "url": "https://api.github.com/repos/filp/whoops/zipball/baec851ad6ae00db8bd0fdd30d208afc1b71c56e",
+ "reference": "baec851ad6ae00db8bd0fdd30d208afc1b71c56e",
"shasum": ""
},
"require": {
@@ -960,8 +960,8 @@
},
"require-dev": {
"mockery/mockery": "^1.0",
- "phpunit/phpunit": "^7.5.20 || ^8.5.8 || ^9.3.3",
- "symfony/var-dumper": "^4.0 || ^5.0"
+ "phpunit/phpunit": "^7.5.20 || ^8.5.8 || ^9.3.3 || ^10.5.58",
+ "symfony/var-dumper": "^4.0 || ^5.0 || ^6.0 || ^7.0 || ^8.0"
},
"suggest": {
"symfony/var-dumper": "Pretty print complex values better with var-dumper available",
@@ -1001,7 +1001,7 @@
],
"support": {
"issues": "https://github.com/filp/whoops/issues",
- "source": "https://github.com/filp/whoops/tree/2.18.4"
+ "source": "https://github.com/filp/whoops/tree/2.18.5"
},
"funding": [
{
@@ -1009,7 +1009,7 @@
"type": "github"
}
],
- "time": "2025-08-08T12:00:00+00:00"
+ "time": "2026-09-18T12:00:00+00:00"
},
{
"name": "firebase/php-jwt",
diff --git a/config/firefly.php b/config/firefly.php
index 34a758c3e3..45b0fea124 100644
--- a/config/firefly.php
+++ b/config/firefly.php
@@ -79,7 +79,7 @@ return [
// see cer.php for exchange rates feature flag.
],
'version' => 'develop/2026-09-18',
-'build_time' => 1789703309,
+'build_time' => 1789732944,
'api_version' => '2.1.0', // field is no longer used.
'db_version' => 28, // field is no longer used.
diff --git a/resources/assets/v3/js/api/model/transaction/get.js b/resources/assets/v3/js/api/model/transaction/get.js
index d5347573b1..dc9edb8bc6 100644
--- a/resources/assets/v3/js/api/model/transaction/get.js
+++ b/resources/assets/v3/js/api/model/transaction/get.js
@@ -40,9 +40,6 @@ export default class Get {
});
}
transactionLinks(id, params) {
- return api.get(
- "/api/v1/transaction-journals/" + parseInt(id) + "/links",
- { params: params },
- );
+ return api.get("/api/v1/transaction-journals/" + parseInt(id) + "/links", { params: params });
}
}
diff --git a/resources/assets/v3/js/api/model/webhook/get.js b/resources/assets/v3/js/api/model/webhook/get.js
index 6d05155756..8bd0da8aeb 100644
--- a/resources/assets/v3/js/api/model/webhook/get.js
+++ b/resources/assets/v3/js/api/model/webhook/get.js
@@ -34,22 +34,11 @@ export default class Get {
});
}
message(webhook, message, params) {
- return api.get(
- "/api/v1/webhooks/" +
- parseInt(webhook) +
- "/messages/" +
- parseInt(message),
- { params: 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 },
- );
+ 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 903d9ff0d7..8058fc3148 100644
--- a/resources/assets/v3/js/api/model/webhook/post.js
+++ b/resources/assets/v3/js/api/model/webhook/post.js
@@ -22,13 +22,7 @@ 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) {
diff --git a/resources/assets/v3/js/boot/bootstrap.js b/resources/assets/v3/js/boot/bootstrap.js
index a88be86a11..c3dc12bf1f 100644
--- a/resources/assets/v3/js/boot/bootstrap.js
+++ b/resources/assets/v3/js/boot/bootstrap.js
@@ -56,118 +56,112 @@ getFreshVariable("lastActivity")
// 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;
- }
+ 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;
+ }
- // save local in window.__ something
- window.__localeId__ = values.locale;
- store.set("language", values.language);
- store.set("locale", values.locale);
- // console.log(
- // "Language is " +
- // values.language +
- // ", locale is " +
- // values.locale,
- // );
- loadTranslations(values.locale).then(() => {
- const event = new Event("firefly-iii-bootstrapped");
- document.dispatchEvent(event);
- window.bootstrapped = true;
- // console.log('Bootstrapped!');
+ // save local in window.__ something
+ window.__localeId__ = values.locale;
+ store.set("language", values.language);
+ store.set("locale", values.locale);
+ // console.log(
+ // "Language is " +
+ // values.language +
+ // ", locale is " +
+ // 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,
- });
- axios.defaults.withCredentials = true;
- axios.defaults.baseURL = url;
+ // page may have an introduction necessary to be played.
+ if (!window.showTour) {
+ return;
+ }
+ 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;
+ 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,
+ 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);
- });
+ });
+ // 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];
+ 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 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,
+ 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);
diff --git a/resources/assets/v3/js/form/create-autocomplete.js b/resources/assets/v3/js/form/create-autocomplete.js
index c87b49d5be..7c37875d7c 100644
--- a/resources/assets/v3/js/form/create-autocomplete.js
+++ b/resources/assets/v3/js/form/create-autocomplete.js
@@ -21,9 +21,7 @@
import Autocomplete from "bootstrap5-autocomplete";
function createAutocomplete(fieldIdentifier, url) {
- let token = document
- .querySelector('meta[name="csrf-token"]')
- .getAttribute("content");
+ let token = document.querySelector('meta[name="csrf-token"]').getAttribute("content");
Autocomplete.init("#" + fieldIdentifier, {
server: url + "?_token=" + token,
labelField: "name",
diff --git a/resources/assets/v3/js/form/create-tag-field.js b/resources/assets/v3/js/form/create-tag-field.js
index 3603b03a67..ee022762ef 100644
--- a/resources/assets/v3/js/form/create-tag-field.js
+++ b/resources/assets/v3/js/form/create-tag-field.js
@@ -19,9 +19,7 @@
*/
import Tags from "bootstrap5-tags";
function createTagField(fieldIdentifier) {
- let token = document
- .querySelector('meta[name="csrf-token"]')
- .getAttribute("content");
+ let token = document.querySelector('meta[name="csrf-token"]').getAttribute("content");
Tags.init("#" + fieldIdentifier, {
allowNew: true,
allowClear: true,
diff --git a/resources/assets/v3/js/pages/accounts/create.js b/resources/assets/v3/js/pages/accounts/create.js
index 21d39cf584..f984335299 100644
--- a/resources/assets/v3/js/pages/accounts/create.js
+++ b/resources/assets/v3/js/pages/accounts/create.js
@@ -27,9 +27,7 @@ import Alpine from "alpinejs";
let create = function () {
return {
init() {
- let list = document.querySelectorAll(
- 'div.app-content form input[type="text"]:enabled',
- );
+ let list = document.querySelectorAll('div.app-content form input[type="text"]:enabled');
if (list.length > 0) {
list[0].focus();
}
@@ -38,27 +36,23 @@ let create = function () {
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");
+ 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");
+ 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");
+ 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");
+ document.querySelector('label[for="ffInput_opening_balance"]').textContent =
+ i18next.t("firefly.i_owe_amount");
}
}
},
diff --git a/resources/assets/v3/js/pages/accounts/edit.js b/resources/assets/v3/js/pages/accounts/edit.js
index 41394fffbb..f631a4ec84 100644
--- a/resources/assets/v3/js/pages/accounts/edit.js
+++ b/resources/assets/v3/js/pages/accounts/edit.js
@@ -27,9 +27,7 @@ import Alpine from "alpinejs";
let edit = function () {
return {
init() {
- let list = document.querySelectorAll(
- 'div.app-content form input[type="text"]:enabled',
- );
+ let list = document.querySelectorAll('div.app-content form input[type="text"]:enabled');
if (list.length > 0) {
list[0].focus();
}
@@ -38,27 +36,23 @@ let edit = function () {
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");
+ 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");
+ 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");
+ 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");
+ document.querySelector('label[for="ffInput_opening_balance"]').textContent =
+ i18next.t("firefly.i_owe_amount");
}
}
},
diff --git a/resources/assets/v3/js/pages/accounts/index.js b/resources/assets/v3/js/pages/accounts/index.js
index f1cf1cd8f7..e24122830c 100644
--- a/resources/assets/v3/js/pages/accounts/index.js
+++ b/resources/assets/v3/js/pages/accounts/index.js
@@ -42,17 +42,11 @@ let index = function () {
let item = e.detail[i];
if (item.order !== item.currentOrder) {
// PUT new order to system.
- new Put().put(
- { order: item.order },
- { id: item.id },
- );
+ new Put().put({ order: item.order }, { id: item.id });
// save new order as current order in the row.
document
.querySelector(`tr[data-id="${item.id}"]`)
- .setAttribute(
- "data-current-order",
- item.order,
- );
+ .setAttribute("data-current-order", item.order);
}
}
}
diff --git a/resources/assets/v3/js/pages/administrations/edit.js b/resources/assets/v3/js/pages/administrations/edit.js
index 7a9181ebb6..a5a2d1f121 100644
--- a/resources/assets/v3/js/pages/administrations/edit.js
+++ b/resources/assets/v3/js/pages/administrations/edit.js
@@ -55,9 +55,7 @@ let edit = function () {
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,
};
@@ -96,16 +94,12 @@ let edit = function () {
.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";
+ 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;
+ this.errors.primary_currency_id = error.response.data.errors.primary_currency_id;
// enable button again
document.getElementById("submitButton").disabled = false;
diff --git a/resources/assets/v3/js/pages/administrations/index.js b/resources/assets/v3/js/pages/administrations/index.js
index f025dba7b9..bdbf55ca64 100644
--- a/resources/assets/v3/js/pages/administrations/index.js
+++ b/resources/assets/v3/js/pages/administrations/index.js
@@ -44,23 +44,15 @@ let index = function () {
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);
}
});
},
diff --git a/resources/assets/v3/js/pages/dashboard/boxes.js b/resources/assets/v3/js/pages/dashboard/boxes.js
index a9a2b8cce5..bc25c4e167 100644
--- a/resources/assets/v3/js/pages/dashboard/boxes.js
+++ b/resources/assets/v3/js/pages/dashboard/boxes.js
@@ -100,10 +100,7 @@ export default () => ({
// console.log('NOT PRIMARY CURRENCY');
if (key.startsWith("balance-in-")) {
this.balanceBox.amounts.push(
- formatMoney(
- this.anonymous ? 0 : current.monetary_value,
- current.currency_code,
- ),
+ formatMoney(this.anonymous ? 0 : current.monetary_value, current.currency_code),
);
continue;
}
@@ -116,10 +113,7 @@ export default () => ({
// append the amount spent.
subtitles[current.currency_code] =
subtitles[current.currency_code] +
- formatMoney(
- this.anonymous ? 0 : current.monetary_value,
- current.currency_code,
- );
+ formatMoney(this.anonymous ? 0 : current.monetary_value, current.currency_code);
continue;
}
// earned info is used in subtitle:
@@ -130,10 +124,7 @@ export default () => ({
}
// prepend the amount earned.
subtitles[current.currency_code] =
- formatMoney(
- this.anonymous ? 0 : current.monetary_value,
- current.currency_code,
- ) +
+ formatMoney(this.anonymous ? 0 : current.monetary_value, current.currency_code) +
" + " +
subtitles[current.currency_code];
continue;
@@ -141,48 +132,32 @@ export default () => ({
if (key.startsWith("bills-unpaid-in-")) {
this.billBox.unpaid.push(
- formatMoney(
- this.anonymous ? 0 : current.monetary_value,
- current.currency_code,
- ),
+ formatMoney(this.anonymous ? 0 : current.monetary_value, current.currency_code),
);
continue;
}
if (key.startsWith("bills-paid-in-")) {
this.billBox.paid.push(
- formatMoney(
- this.anonymous ? 0 : current.monetary_value,
- current.currency_code,
- ),
+ formatMoney(this.anonymous ? 0 : current.monetary_value, current.currency_code),
);
continue;
}
if (key.startsWith("left-to-spend-in-")) {
- sumMoneyLeft =
- sumMoneyLeft + parseFloat(current.monetary_value);
+ sumMoneyLeft = sumMoneyLeft + parseFloat(current.monetary_value);
this.leftBox.left.push(
- formatMoney(
- this.anonymous ? 0 : current.monetary_value,
- current.currency_code,
- ),
+ formatMoney(this.anonymous ? 0 : current.monetary_value, current.currency_code),
);
continue;
}
if (key.startsWith("left-per-day-to-spend-in-")) {
this.leftBox.perDay.push(
- formatMoney(
- this.anonymous ? 0 : current.monetary_value,
- current.currency_code,
- ),
+ formatMoney(this.anonymous ? 0 : current.monetary_value, current.currency_code),
);
continue;
}
if (key.startsWith("net-worth-in-")) {
this.netBox.net.push(
- formatMoney(
- this.anonymous ? 0 : current.monetary_value,
- current.currency_code,
- ),
+ formatMoney(this.anonymous ? 0 : current.monetary_value, current.currency_code),
);
}
}
diff --git a/resources/assets/v3/js/pages/dashboard/dashboard.js b/resources/assets/v3/js/pages/dashboard/dashboard.js
index 388bd3bfc2..227dbeeb74 100644
--- a/resources/assets/v3/js/pages/dashboard/dashboard.js
+++ b/resources/assets/v3/js/pages/dashboard/dashboard.js
@@ -72,37 +72,21 @@ let index = function () {
if (Object.hasOwn(response.data.data, i)) {
let current = response.data.data[i];
let currentAmount =
- null === current.attributes.current_amount
- ? "0"
- : current.attributes.current_amount;
+ null === current.attributes.current_amount ? "0" : current.attributes.current_amount;
let targetAmount =
- null === current.attributes.target_amount
- ? "0"
- : current.attributes.target_amount;
+ null === current.attributes.target_amount ? "0" : current.attributes.target_amount;
let piggy = {
id: current.id,
name: current.attributes.name,
percentage:
- null === current.attributes.percentage
- ? 0
- : parseInt(current.attributes.percentage),
+ null === current.attributes.percentage ? 0 : parseInt(current.attributes.percentage),
amount:
- formatMoney(
- currentAmount,
- current.attributes.currency_code,
- ) +
+ formatMoney(currentAmount, current.attributes.currency_code) +
" / " +
- formatMoney(
- targetAmount,
- current.attributes.currency_code,
- ),
+ formatMoney(targetAmount, current.attributes.currency_code),
};
if (null === current.attributes.target_amount) {
- piggy.amount =
- formatMoney(
- currentAmount,
- current.attributes.currency_code,
- ) + " / ∞";
+ piggy.amount = formatMoney(currentAmount, current.attributes.currency_code) + " / ∞";
}
if (this.anonymous) {
piggy.amount = "- / -";
@@ -112,9 +96,7 @@ let index = function () {
}
}
- let totalPages = parseInt(
- response.data.meta.pagination.total_pages,
- );
+ let totalPages = parseInt(response.data.meta.pagination.total_pages);
if (totalPages > page) {
this.downloadPiggyBanks(page + 1);
return;
diff --git a/resources/assets/v3/js/pages/exchange-rates/index.js b/resources/assets/v3/js/pages/exchange-rates/index.js
index 13f97d7cdc..93239c0e13 100644
--- a/resources/assets/v3/js/pages/exchange-rates/index.js
+++ b/resources/assets/v3/js/pages/exchange-rates/index.js
@@ -56,14 +56,8 @@ 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);
}
});
},
diff --git a/resources/assets/v3/js/pages/exchange-rates/rates.js b/resources/assets/v3/js/pages/exchange-rates/rates.js
index 7b9b47865d..8dd3290043 100644
--- a/resources/assets/v3/js/pages/exchange-rates/rates.js
+++ b/resources/assets/v3/js/pages/exchange-rates/rates.js
@@ -59,12 +59,9 @@ let rates = function () {
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();
@@ -93,11 +90,7 @@ let rates = function () {
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);
@@ -123,14 +116,9 @@ let rates = function () {
}
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 },
- )
- .then(() => {
- this.updating = false;
- });
+ new Put().put({ rate: this.rates[index].rate }, { id: this.rates[index].rate_id }).then(() => {
+ this.updating = false;
+ });
}
}
if ("" !== this.rates[index].inverse) {
@@ -154,10 +142,7 @@ let rates = function () {
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 },
- )
+ .put({ rate: this.rates[index].inverse }, { id: this.rates[index].inverse_id })
.then(() => {
this.updating = false;
});
@@ -222,104 +207,74 @@ let rates = function () {
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 + '"');
+ 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;
- }
- // 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,
- // );
+ // 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,
+ // );
}
- 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);
+ });
},
};
};
diff --git a/resources/assets/v3/js/pages/generic-nodates.js b/resources/assets/v3/js/pages/generic-nodates.js
index 919660de1e..993d8ebaef 100644
--- a/resources/assets/v3/js/pages/generic-nodates.js
+++ b/resources/assets/v3/js/pages/generic-nodates.js
@@ -29,9 +29,7 @@ let index = function () {
return {
init() {
(function () {
- let list = document.querySelectorAll(
- 'div.app-content form input[type="text"]:enabled',
- );
+ let list = document.querySelectorAll('div.app-content form input[type="text"]:enabled');
if (list.length > 0) {
list[0].focus();
}
diff --git a/resources/assets/v3/js/pages/generic.js b/resources/assets/v3/js/pages/generic.js
index 16517c3846..e9d0e1106b 100644
--- a/resources/assets/v3/js/pages/generic.js
+++ b/resources/assets/v3/js/pages/generic.js
@@ -29,9 +29,7 @@ let index = function () {
return {
init() {
(function () {
- let list = document.querySelectorAll(
- 'div.app-content form input[type="text"]:enabled',
- );
+ let list = document.querySelectorAll('div.app-content form input[type="text"]:enabled');
if (list.length > 0) {
list[0].focus();
}
diff --git a/resources/assets/v3/js/pages/piggy-banks/show.js b/resources/assets/v3/js/pages/piggy-banks/show.js
index 3bfa7b77e2..c3a2bce864 100644
--- a/resources/assets/v3/js/pages/piggy-banks/show.js
+++ b/resources/assets/v3/js/pages/piggy-banks/show.js
@@ -36,12 +36,7 @@ let show = function () {
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() {
diff --git a/resources/assets/v3/js/pages/profile/oauth.js b/resources/assets/v3/js/pages/profile/oauth.js
index c6f17bdd4c..9d930f98cc 100644
--- a/resources/assets/v3/js/pages/profile/oauth.js
+++ b/resources/assets/v3/js/pages/profile/oauth.js
@@ -62,29 +62,21 @@ let index = function () {
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();
@@ -155,15 +147,11 @@ let index = function () {
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."];
}
});
},
@@ -186,10 +174,7 @@ let index = function () {
});
},
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.
@@ -213,15 +198,11 @@ let index = function () {
})
.catch((error) => {
if (typeof error.response.data === "object") {
- for (const value of Object.entries(
- error.response.data.errors,
- )) {
+ for (const value of Object.entries(error.response.data.errors)) {
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);
});
@@ -230,11 +211,9 @@ let index = function () {
* Revoke the given token.
*/
revoke(token) {
- api.delete("./oauth/personal-access-tokens/" + token.id).then(
- () => {
- this.getTokens();
- },
- );
+ api.delete("./oauth/personal-access-tokens/" + token.id).then(() => {
+ this.getTokens();
+ });
},
/**
@@ -242,21 +221,13 @@ 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) => {
- this.clientSecret = response.data.plainSecret;
- new Modal(
- document.getElementById("modal-client-secret"),
- {},
- ).show();
- },
- );
+ api.post("./oauth/clients/regenerate/" + client.id).then((response) => {
+ this.clientSecret = response.data.plainSecret;
+ new Modal(document.getElementById("modal-client-secret"), {}).show();
+ });
},
/**
@@ -271,12 +242,7 @@ let index = function () {
* Create a new OAuth client for the user.
*/
store() {
- this.persistClient(
- "post",
- "./oauth/clients",
- this.createForm,
- "#modal-create-client",
- );
+ this.persistClient("post", "./oauth/clients", this.createForm, "#modal-create-client");
},
/**
* Edit the given client.
@@ -293,12 +259,7 @@ let index = function () {
* Update the client being edited.
*/
update() {
- this.persistClient(
- "put",
- "./oauth/clients/" + this.editForm.id,
- this.editForm,
- "#modal-edit-client",
- );
+ this.persistClient("put", "./oauth/clients/" + this.editForm.id, this.editForm, "#modal-edit-client");
},
};
};
diff --git a/resources/assets/v3/js/pages/recurring/create.js b/resources/assets/v3/js/pages/recurring/create.js
index 2021650760..1140bcad29 100644
--- a/resources/assets/v3/js/pages/recurring/create.js
+++ b/resources/assets/v3/js/pages/recurring/create.js
@@ -47,29 +47,19 @@ let create = function () {
respondToFirstDateChange: respondToFirstDateChange,
init() {
createTagField("ffInput_tags");
- createAutocomplete(
- "ffInput_category",
- "./api/v1/autocomplete/categories",
- );
+ createAutocomplete("ffInput_category", "./api/v1/autocomplete/categories");
createButtonSwitcher();
switchTransactionType("withdrawal");
this.respondToFirstDateChange();
respondToRepetitionEnd();
- document
- .getElementById("ffInput_first_date")
- .addEventListener("change", this.respondToFirstDateChange);
+ 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");
this.calendar = new Calendar(calendarEl, {
- plugins: [
- themePlugin,
- dayGridPlugin,
- timeGridPlugin,
- listPlugin,
- ],
+ plugins: [themePlugin, dayGridPlugin, timeGridPlugin, listPlugin],
initialView: "dayGridMonth",
headerToolbar: {
left: "prev,next today",
@@ -77,32 +67,18 @@ let create = function () {
},
});
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;
// 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();
diff --git a/resources/assets/v3/js/pages/recurring/edit.js b/resources/assets/v3/js/pages/recurring/edit.js
index 47dcb39d7f..dfaaaf04a4 100644
--- a/resources/assets/v3/js/pages/recurring/edit.js
+++ b/resources/assets/v3/js/pages/recurring/edit.js
@@ -45,32 +45,20 @@ let edit = function () {
respondToFirstDateChange: respondToFirstDateChange,
init() {
createTagField("ffInput_tags");
- createAutocomplete(
- "ffInput_category",
- "./api/v1/autocomplete/categories",
- );
+ createAutocomplete("ffInput_category", "./api/v1/autocomplete/categories");
createButtonSwitcher();
- switchTransactionType(
- document.getElementsByName("transaction_type")[0].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_first_date").addEventListener("change", this.respondToFirstDateChange);
document
.getElementById("ffInput_repetition_end")
.addEventListener("change", respondToRepetitionEnd.bind(this));
let calendarEl = document.getElementById("recurring_calendar");
this.calendar = new Calendar(calendarEl, {
- plugins: [
- themePlugin,
- dayGridPlugin,
- timeGridPlugin,
- listPlugin,
- ],
+ plugins: [themePlugin, dayGridPlugin, timeGridPlugin, listPlugin],
initialView: "dayGridMonth",
headerToolbar: {
left: "prev,next today",
@@ -78,33 +66,19 @@ let edit = function () {
},
});
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;
// 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();
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 ab068134cb..a0fd6d801e 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
@@ -61,9 +61,7 @@ function respondToFirstDateChange() {
.then(parseRepetitionSuggestions)
.catch(function () {
console.error("Could not load repetition suggestions");
- alert(
- "Could not load repetition suggestions. Please enter a valid date.",
- );
+ alert("Could not load repetition suggestions. Please enter a valid date.");
});
}
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 4cf562f06e..4eda3143b2 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
@@ -23,23 +23,17 @@ function respondToRepetitionEnd() {
var value = obj.value;
switch (value) {
case "forever":
- document.getElementById("repeat_until_holder").style.display =
- "none";
- document.getElementById("repetitions_holder").style.display =
- "none";
+ 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";
+ 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";
+ document.getElementById("repeat_until_holder").style.display = "none";
+ document.getElementById("repetitions_holder").style.display = "block";
break;
}
}
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 d0461c98b4..1acd0ce90b 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
@@ -31,21 +31,16 @@ function switchTransactionType(transactionType) {
list[i].classList.add("btn-secondary");
}
}
- document.querySelector(
- 'input[type="hidden"][name="transaction_type"]',
- ).value = 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";
// 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";
@@ -59,31 +54,23 @@ function switchTransactionType(transactionType) {
}
if (transactionType === "deposit") {
- document.getElementById("deposit_source_id_holder").style.display =
- "block";
+ document.getElementById("deposit_source_id_holder").style.display = "block";
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("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("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("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";
diff --git a/resources/assets/v3/js/pages/shared/dates.js b/resources/assets/v3/js/pages/shared/dates.js
index d2b556a521..c93d30c914 100644
--- a/resources/assets/v3/js/pages/shared/dates.js
+++ b/resources/assets/v3/js/pages/shared/dates.js
@@ -18,14 +18,7 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
-import {
- addMonths,
- endOfMonth,
- startOfMonth,
- startOfYear,
- subDays,
- subMonths,
-} from "date-fns";
+import { addMonths, endOfMonth, startOfMonth, startOfYear, subDays, subMonths } from "date-fns";
import format from "../../util/format";
export default () => ({
@@ -54,14 +47,8 @@ export default () => ({
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("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",
@@ -71,14 +58,10 @@ export default () => ({
// console.log("Date selection is disabled on this page.");
document.getElementById("date-dropdown").style.display = "none";
}
- document
- .getElementById("customDateRangeCalendar")
- .addEventListener("change", (e) => {
- console.log(
- "responding to change event in customDateRangeCalendar",
- );
- this.updateDatesNoSubmit(e);
- });
+ document.getElementById("customDateRangeCalendar").addEventListener("change", (e) => {
+ console.log("responding to change event in customDateRangeCalendar");
+ this.updateDatesNoSubmit(e);
+ });
let end = new Date(window.store.get("end"));
let start = new Date(window.store.get("start"));
@@ -118,47 +101,26 @@ export default () => ({
// 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.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.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.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.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
diff --git a/resources/assets/v3/js/pages/shared/drag-and-droppable-rows.js b/resources/assets/v3/js/pages/shared/drag-and-droppable-rows.js
index 7627f1b5a7..31246a9e4d 100644
--- a/resources/assets/v3/js/pages/shared/drag-and-droppable-rows.js
+++ b/resources/assets/v3/js/pages/shared/drag-and-droppable-rows.js
@@ -35,11 +35,7 @@ export function addDrag() {
function handleRowSwap(clientY, targetElement) {
const targetRow = targetElement.closest("tr");
- if (
- targetRow &&
- targetRow !== draggedRow &&
- targetRow.parentNode === tbody
- ) {
+ if (targetRow && targetRow !== draggedRow && targetRow.parentNode === tbody) {
const rect = targetRow.getBoundingClientRect();
const next = (clientY - rect.top) / (rect.bottom - rect.top) > 0.5;
const nextSibling = next ? targetRow.nextSibling : targetRow;
@@ -130,10 +126,7 @@ export function addDrag() {
const touch = e.touches[0];
// Find what element is currently underneath the user's finger
- const elementUnderFinger = document.elementFromPoint(
- touch.clientX,
- touch.clientY,
- );
+ const elementUnderFinger = document.elementFromPoint(touch.clientX, touch.clientY);
if (elementUnderFinger) {
handleRowSwap(touch.clientY, elementUnderFinger);
diff --git a/resources/assets/v3/js/pages/transactions/bulk-edit.js b/resources/assets/v3/js/pages/transactions/bulk-edit.js
index c68da80720..385687ad6e 100644
--- a/resources/assets/v3/js/pages/transactions/bulk-edit.js
+++ b/resources/assets/v3/js/pages/transactions/bulk-edit.js
@@ -33,16 +33,13 @@ let edit = function () {
detectCategoryChange(e) {
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)) {
// tags_action_do_nothing
- document.querySelector('input[name="ignore_budget"]').checked =
- false;
+ document.querySelector('input[name="ignore_budget"]').checked = false;
}
},
detectTagChange() {
@@ -53,15 +50,9 @@ let edit = function () {
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() {
@@ -86,9 +77,7 @@ let edit = function () {
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,
},
},
});
diff --git a/resources/assets/v3/js/pages/transactions/create.js b/resources/assets/v3/js/pages/transactions/create.js
index 05c13dea00..c8077dd85a 100644
--- a/resources/assets/v3/js/pages/transactions/create.js
+++ b/resources/assets/v3/js/pages/transactions/create.js
@@ -21,54 +21,54 @@
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 { defaultErrorSet } from "./shared/create-empty-split.js";
+import { parseFromEntries } from "./shared/parse-from-entries.js";
import Post from "../../api/model/transaction/post.js";
import Get from "../../api/model/account/get.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 {disableSplitInputs} from "./shared/disable-split-inputs.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 { disableSplitInputs } from "./shared/disable-split-inputs.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 { 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 { 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 {keyUpFromSource} from "./shared/keyup-from-source.js";
-import {keyUpFromDestination} from "./shared/keyup-from-destination.js";
-import {keyUpFromDescription} from "./shared/keyup-from-description.js";
+import { keyUpFromSource } from "./shared/keyup-from-source.js";
+import { keyUpFromDestination } from "./shared/keyup-from-destination.js";
+import { keyUpFromDescription } from "./shared/keyup-from-description.js";
import focusFirstInput from "../../shared/focus-first-input.js";
window.enableDates = false;
@@ -239,19 +239,13 @@ 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
- ) {
+ 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
- ) {
+ 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.",
// );
@@ -284,26 +278,28 @@ let create = function () {
this.entries[index].category_name = "";
},
fillSourceAccount() {
- this.fillAccount('source', 'source_account');
+ this.fillAccount("source", "source_account");
},
fillDestinationAccount() {
- this.fillAccount('destination', 'destination_account');
+ this.fillAccount("destination", "destination_account");
},
fillAccount(direction, field) {
this.entries[0][field].loading = true;
const urlParams = new URLSearchParams(window.location.search);
const accountId = parseInt(urlParams.get(direction));
if (accountId > 0) {
- (new Get).get(accountId).then((response) => {
+ new Get().get(accountId).then((response) => {
// source ID must be asset account or liabilities.
let account = response.data.data;
let attributes = response.data.data.attributes;
- if ('asset' !== attributes.type && 'liabilities' !== attributes.type) {
+ if ("asset" !== attributes.type && "liabilities" !== attributes.type) {
return;
}
- let type = 'Asset account';
- if ('liabilities' === attributes.type) {
- type = String(attributes.liability_type).charAt(0).toUpperCase() + String(attributes.liability_type).slice(1);
+ let type = "Asset account";
+ if ("liabilities" === attributes.type) {
+ type =
+ String(attributes.liability_type).charAt(0).toUpperCase() +
+ String(attributes.liability_type).slice(1);
}
this.entries[0][field] = {
id: account.id,
@@ -361,9 +357,7 @@ let create = function () {
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) => {
@@ -392,11 +386,7 @@ 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,
@@ -405,11 +395,7 @@ let create = function () {
};
// 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;
}
@@ -423,42 +409,27 @@ let create = function () {
// submission was a success!
this.groupProperties.id = parseInt(group.id);
this.groupProperties.title =
- group.attributes.group_title ??
- group.attributes.transactions[0].description;
+ 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++
- ) {
+ 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,
- ),
- );
+ 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,
- );
+ 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",
- );
+ this.notifications.wait.text = i18next.t("firefly.wait_attachments");
return;
}
@@ -474,7 +445,7 @@ let create = function () {
};
};
-let comps = {create, sidebar, dates};
+let comps = { create, sidebar, dates };
function loadPage() {
Object.keys(comps).forEach((comp) => {
diff --git a/resources/assets/v3/js/pages/transactions/edit.js b/resources/assets/v3/js/pages/transactions/edit.js
index 5f0feb8122..7f8fd7f93f 100644
--- a/resources/assets/v3/js/pages/transactions/edit.js
+++ b/resources/assets/v3/js/pages/transactions/edit.js
@@ -22,10 +22,7 @@ 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 { 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";
@@ -49,10 +46,7 @@ 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 { 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";
@@ -250,15 +244,10 @@ let transactions = function () {
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.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),
- );
+ 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++) {
@@ -268,12 +257,8 @@ let transactions = function () {
// 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];
+ if (this.formData.enabledCurrencies[i].code === this.entries[0].currency_code) {
+ this.formData.amountCurrency = this.formData.enabledCurrencies[i];
}
}
}
@@ -281,19 +266,9 @@ let transactions = function () {
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].foreign_currency_code
- ) {
- this.formData.foreignCurrencies.push(
- this.formData.enabledCurrencies[i],
- );
+ if (Object.hasOwn(this.formData.enabledCurrencies, i)) {
+ if (this.formData.enabledCurrencies[i].code === this.entries[0].foreign_currency_code) {
+ this.formData.foreignCurrencies.push(this.formData.enabledCurrencies[i]);
}
}
}
@@ -308,8 +283,7 @@ let transactions = function () {
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 + parseFloat(this.entries[i].amount);
}
}
setTimeout(() => {
@@ -331,9 +305,7 @@ let transactions = function () {
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,
},
},
});
@@ -346,9 +318,7 @@ let transactions = function () {
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) => {
@@ -387,9 +357,7 @@ let transactions = function () {
// add some event listeners
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) => {
@@ -417,11 +385,7 @@ 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,
@@ -430,10 +394,7 @@ let transactions = function () {
};
// 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) {
@@ -451,42 +412,27 @@ let transactions = function () {
// submission was a success!
this.groupProperties.id = parseInt(group.id);
this.groupProperties.title =
- group.attributes.group_title ??
- group.attributes.transactions[0].description;
+ 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++
- ) {
+ 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,
- ),
- );
+ 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,
- );
+ 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",
- );
+ this.notifications.wait.text = i18next.t("firefly.wait_attachments");
return;
}
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 33653d7291..e4c8d16f03 100644
--- a/resources/assets/v3/js/pages/transactions/shared/add-autocomplete.js
+++ b/resources/assets/v3/js/pages/transactions/shared/add-autocomplete.js
@@ -44,21 +44,9 @@ 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
@@ -106,9 +94,7 @@ export function addAllAutocompleteToForm() {
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,
},
},
});
@@ -171,9 +157,7 @@ export function addAutocomplete(options) {
headers: {
"Content-Type": "application/json",
Accept: "application/json",
- "X-CSRF-TOKEN": document.head.querySelector(
- 'meta[name="csrf-token"]',
- ).content,
+ "X-CSRF-TOKEN": document.head.querySelector('meta[name="csrf-token"]').content,
},
},
queryParam: "query",
@@ -182,16 +166,10 @@ export function addAutocomplete(options) {
highlightTyped: true,
liveServer: true,
};
- if (
- typeof options.account_types !== "undefined" &&
- options.account_types.length > 0
- ) {
+ 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) {
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 54f2eef97c..5494548901 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
@@ -24,10 +24,6 @@ export function addTabListener() {
// 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,
- );
+ 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 3614deb6c7..2c71527749 100644
--- a/resources/assets/v3/js/pages/transactions/shared/auto-step.js
+++ b/resources/assets/v3/js/pages/transactions/shared/auto-step.js
@@ -44,10 +44,7 @@ export function autoStep() {
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;
}
@@ -60,19 +57,13 @@ export function autoStep() {
) {
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",
- );
+ 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 bc1008ffb0..7d9a8f1b10 100644
--- a/resources/assets/v3/js/pages/transactions/shared/autocomplete-functions.js
+++ b/resources/assets/v3/js/pages/transactions/shared/autocomplete-functions.js
@@ -21,68 +21,46 @@
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;
+ 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;
+ 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 === "object") {
// changed account but did not select.
const index = parseInt(ac._searchInput.attributes["data-index"].value);
- document.querySelector("#form")._x_dataStack[0].$data.entries[
- index
- ].destination_account = {
+ document.querySelector("#form")._x_dataStack[0].$data.entries[index].destination_account = {
id: item.id,
name: item.name,
alpine_name: item.name,
type: item.type,
currency_code: item.currency_code,
};
- document
- .querySelector("#form")
- ._x_dataStack[0].changedDestinationAccount();
+ document.querySelector("#form")._x_dataStack[0].changedDestinationAccount();
}
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;
+ 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 = {
+ 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();
+ document.querySelector("#form")._x_dataStack[0].changedDestinationAccount();
}
}
@@ -95,9 +73,7 @@ export function selectDestinationAccount(item, ac) {
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].$data.entries[index].destination_account = newAccount;
document.querySelector("#form")._x_dataStack[0].changedDestinationAccount();
}
@@ -105,9 +81,7 @@ export function changeSourceAccount(item, ac) {
if (typeof item === "object") {
// changed account but did not select.
const index = parseInt(ac._searchInput.attributes["data-index"].value);
- document.querySelector("#form")._x_dataStack[0].$data.entries[
- index
- ].source_account = {
+ document.querySelector("#form")._x_dataStack[0].$data.entries[index].source_account = {
id: item.id,
name: item.name,
alpine_name: item.name,
@@ -119,29 +93,21 @@ 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;
+ 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 = {
+ 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);
- document.querySelector("#form")._x_dataStack[0].$data.entries[
- index
- ].source_account = {
+ document.querySelector("#form")._x_dataStack[0].$data.entries[index].source_account = {
id: item.id,
name: item.name,
alpine_name: item.name,
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 a093e5a77d..63cb3fa35a 100644
--- a/resources/assets/v3/js/pages/transactions/shared/changed-amount.js
+++ b/resources/assets/v3/js/pages/transactions/shared/changed-amount.js
@@ -24,9 +24,7 @@ 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/create-link-autocomplete.js b/resources/assets/v3/js/pages/transactions/shared/create-link-autocomplete.js
index ee1269b5a3..ab8861c265 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
@@ -23,9 +23,7 @@ import formatMoney from "../../../util/format-money.js";
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 (
@@ -33,10 +31,7 @@ export function createLinkAutocomplete(fieldIdentifier, url) {
'<br><small class="text-muted">' +
formatMoney(item.amount, item.currency_code) +
" @ " +
- format(
- new Date(item.date),
- this.i18next.t("config.date_time_fns"),
- ) +
+ format(new Date(item.date), this.i18next.t("config.date_time_fns")) +
"</small>"
);
};
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 b1b7914b32..e4627ea9ba 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
@@ -23,18 +23,13 @@ export function detectTransactionType() {
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.",
- );
+ console.warn("Cannot infer transaction type from two unknown accounts.");
this.disableSplitInputs();
return;
}
// transfer: both are the same and in strict set of account types
- if (
- sourceType === destType &&
- ["Asset account", "Loan", "Debt", "Mortgage"].includes(sourceType)
- ) {
+ if (sourceType === destType && ["Asset account", "Loan", "Debt", "Mortgage"].includes(sourceType)) {
this.groupProperties.transactionType = "transfer";
// console.log(
// 'Transaction type is detected to be "' +
@@ -45,29 +40,20 @@ export function detectTransactionType() {
// 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,
- );
+ this.determineAmountCurrency(this.entries[0].source_account.currency_code);
+ this.filterForeignCurrencies(this.entries[0].destination_account.currency_code);
this.disableSplitInputs();
return;
}
// withdrawals:
- if (
- "Asset account" === sourceType &&
- ["Expense account", "Debt", "Loan", "Mortgage"].includes(destType)
- ) {
+ 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.determineAmountCurrency(this.entries[0].source_account.currency_code);
this.disableSplitInputs();
return;
}
@@ -78,34 +64,24 @@ export function detectTransactionType() {
// this.groupProperties.transactionType +
// '".',
// );
- this.determineAmountCurrency(
- this.entries[0].source_account.currency_code,
- );
+ this.determineAmountCurrency(this.entries[0].source_account.currency_code);
this.disableSplitInputs();
return;
}
- if (
- ["Debt", "Loan", "Mortgage"].includes(sourceType) &&
- "Expense account" === destType
- ) {
+ 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.determineAmountCurrency(this.entries[0].source_account.currency_code);
this.disableSplitInputs();
return;
}
// deposits:
- if (
- "Revenue account" === sourceType &&
- ["Asset account", "Debt", "Loan", "Mortgage"].includes(destType)
- ) {
+ if ("Revenue account" === sourceType && ["Asset account", "Debt", "Loan", "Mortgage"].includes(destType)) {
this.groupProperties.transactionType = "deposit";
// console.log(
// 'Transaction type is detected to be "' +
@@ -113,66 +89,39 @@ export function detectTransactionType() {
// '".',
// );
this.disableSplitInputs();
- 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)
- ) {
+ 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.determineAmountCurrency(this.entries[0].destination_account.currency_code);
this.disableSplitInputs();
return;
}
- if (
- "Expense account" === sourceType &&
- ["Asset account", "Debt", "Loan", "Mortgage"].includes(destType)
- ) {
+ 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 +
- '".',
- );
+ 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.determineAmountCurrency(this.entries[0].destination_account.currency_code);
this.disableSplitInputs();
return;
}
- if (
- ["Debt", "Loan", "Mortgage"].includes(sourceType) &&
- "Asset account" === destType
- ) {
+ 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.determineAmountCurrency(this.entries[0].destination_account.currency_code);
this.disableSplitInputs();
return;
}
- console.warn(
- 'Unknown account combination between "' +
- sourceType +
- '" and "' +
- destType +
- '".',
- );
+ console.warn('Unknown account combination between "' + sourceType + '" and "' + destType + '".');
this.disableSplitInputs();
}
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 909195e3fb..f16d4f17a6 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
@@ -21,8 +21,7 @@
export function keyUpFromCategory(e) {
let target = e.currentTarget.nextSibling;
setTimeout(() => {
- this.formStates.categorySelectVisible =
- target.classList.contains("show");
+ this.formStates.categorySelectVisible = target.classList.contains("show");
}, 600);
if (e.key === "Enter" && false === this.formStates.categorySelectVisible) {
this.save();
diff --git a/resources/assets/v3/js/pages/transactions/shared/keyup-from-description.js b/resources/assets/v3/js/pages/transactions/shared/keyup-from-description.js
index 09c1e61de7..b50e4d2361 100644
--- a/resources/assets/v3/js/pages/transactions/shared/keyup-from-description.js
+++ b/resources/assets/v3/js/pages/transactions/shared/keyup-from-description.js
@@ -21,13 +21,9 @@
export function keyUpFromDescription(e) {
let target = e.currentTarget.nextSibling;
setTimeout(() => {
- this.formStates.descriptionSelectVisible =
- target.classList.contains("show");
+ this.formStates.descriptionSelectVisible = target.classList.contains("show");
}, 600);
- if (
- e.key === "Enter" &&
- false === this.formStates.descriptionSelectVisible
- ) {
+ if (e.key === "Enter" && false === this.formStates.descriptionSelectVisible) {
this.save();
}
}
diff --git a/resources/assets/v3/js/pages/transactions/shared/keyup-from-destination.js b/resources/assets/v3/js/pages/transactions/shared/keyup-from-destination.js
index adc0d08e66..b7803742f4 100644
--- a/resources/assets/v3/js/pages/transactions/shared/keyup-from-destination.js
+++ b/resources/assets/v3/js/pages/transactions/shared/keyup-from-destination.js
@@ -21,13 +21,9 @@
export function keyUpFromDestination(e) {
let target = e.currentTarget.nextSibling;
setTimeout(() => {
- this.formStates.destinationSelectVisible =
- target.classList.contains("show");
+ this.formStates.destinationSelectVisible = target.classList.contains("show");
}, 600);
- if (
- e.key === "Enter" &&
- false === this.formStates.destinationSelectVisible
- ) {
+ if (e.key === "Enter" && false === this.formStates.destinationSelectVisible) {
this.save();
}
}
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 c4ef3ad52d..d9ef945877 100644
--- a/resources/assets/v3/js/pages/transactions/shared/load-budgets.js
+++ b/resources/assets/v3/js/pages/transactions/shared/load-budgets.js
@@ -49,11 +49,7 @@ export function loadBudgets(includeInactive) {
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);
}
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 5080847b4c..4c7406a9f2 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
@@ -21,9 +21,7 @@
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 5550e8cb87..e905819b0e 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,9 +21,7 @@
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-piggy-banks.js b/resources/assets/v3/js/pages/transactions/shared/load-piggy-banks.js
index 72bd34d678..f27d21da51 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
@@ -46,8 +46,7 @@ export function loadPiggyBanks() {
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 objectGroupTitle = current.attributes.object_group_title ?? "(no group)";
let piggyBank = {
id: current.id,
name: current.attributes.name,
@@ -62,9 +61,7 @@ export function loadPiggyBanks() {
};
}
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);
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 68376c3fc1..a20cdae43b 100644
--- a/resources/assets/v3/js/pages/transactions/shared/load-subscriptions.js
+++ b/resources/assets/v3/js/pages/transactions/shared/load-subscriptions.js
@@ -46,16 +46,12 @@ export function loadSubscriptions(includeInactive) {
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 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() +
- ")",
+ : current.attributes.name + " (" + i18next.t("firefly.inactive").toLowerCase() + ")",
order: current.attributes.order,
};
if (!includeInactive && false === current.attributes.active) {
@@ -71,9 +67,7 @@ export function loadSubscriptions(includeInactive) {
};
}
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)
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 34f51c09c5..f38de6b5ea 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
@@ -14,32 +14,18 @@ export function loadTransactionLinks(index, journalId) {
if (Object.hasOwn(links, i)) {
let current = links[i];
// console.log('Get link info for link #' + current.id);
- let direction =
- parseInt(journalId) ===
- parseInt(current.attributes.inward_id)
- ? "outward"
- : "inward";
+ let direction = parseInt(journalId) === parseInt(current.attributes.inward_id) ? "outward" : "inward";
let otherJournal = parseInt(current.attributes.inward_id);
- if (
- parseInt(journalId) ===
- 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) => {
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;
}
}
@@ -49,22 +35,13 @@ export function loadTransactionLinks(index, journalId) {
// console.log("Current link is, found opposing. ", parseInt(current.id));
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: 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),
+ (link) => link.id === parseInt(current.attributes.link_type_id),
)[direction],
- journal_id: parseInt(
- foundJournal.transaction_journal_id,
- ),
+ journal_id: parseInt(foundJournal.transaction_journal_id),
group_id: parseInt(group.id),
journal_description: foundJournal.description,
editMode: 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 f1b65230d5..1a4fe68af3 100644
--- a/resources/assets/v3/js/pages/transactions/shared/manage-locations.js
+++ b/resources/assets/v3/js/pages/transactions/shared/manage-locations.js
@@ -35,9 +35,7 @@ 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 });
@@ -102,8 +100,7 @@ export function addLocation(index) {
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);
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 0a5cf481fd..bf0e2066c1 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
@@ -30,9 +30,7 @@ export function parseDownloadedSplits(downloads, groupId) {
let current = createEmptySplit();
// meta data
- current.transaction_journal_id = parseInt(
- download.transaction_journal_id,
- );
+ current.transaction_journal_id = parseInt(download.transaction_journal_id);
current.transaction_group_id = groupId;
current.bill_id = download.bill_id;
current.bill_name = download.bill_name;
@@ -58,15 +56,13 @@ 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) {
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
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 e635ca0a5d..4f1b5a26a3 100644
--- a/resources/assets/v3/js/pages/transactions/shared/parse-errors.js
+++ b/resources/assets/v3/js/pages/transactions/shared/parse-errors.js
@@ -26,10 +26,7 @@ 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")) {
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 0fd1ed83ca..1d4bb76386 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,21 +35,13 @@ 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;
}
// original transaction journal id.
- if (
- Object.hasOwn(entry, "transaction_journal_id") &&
- parseInt(entry.transaction_journal_id) > 0
- ) {
- current.transaction_journal_id = parseInt(
- entry.transaction_journal_id,
- );
+ if (Object.hasOwn(entry, "transaction_journal_id") && parseInt(entry.transaction_journal_id) > 0) {
+ current.transaction_journal_id = parseInt(entry.transaction_journal_id);
}
// source and destination NAME
@@ -63,12 +55,7 @@ export function parseFromEntries(entries, originals, transactionType) {
// dates
current.date = entry.date;
if (i > 0 && !!returnArray[0]) {
- console.log(
- "Overrule date for entry ",
- i,
- " with ",
- returnArray[0].date,
- );
+ console.log("Overrule date for entry ", i, " with ", returnArray[0].date);
current.date = returnArray[0].date;
}
@@ -106,10 +93,7 @@ export function parseFromEntries(entries, originals, transactionType) {
// 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, ",
@@ -127,25 +111,16 @@ export function parseFromEntries(entries, originals, transactionType) {
// );
}
}
- if (
- null === current.foreign_amount ||
- null === 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) {
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 265a3031c0..96913a0c41 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
@@ -24,8 +24,5 @@ export function parseTotalAmount() {
if (this.entries.length === 0) {
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 d4b5549bf4..9ee2db2fe2 100644
--- a/resources/assets/v3/js/pages/transactions/shared/process-attachments.js
+++ b/resources/assets/v3/js/pages/transactions/shared/process-attachments.js
@@ -26,19 +26,10 @@ 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,
- )
+ .post(fileData[key].name, "TransactionJournal", fileData[key].journal)
.then((response) => {
let attachmentId = parseInt(response.data.data.id);
poster
@@ -46,10 +37,7 @@ let uploadFiles = function (fileData) {
.then(() => {
uploads++;
if (uploads === count) {
- const event = new CustomEvent(
- "upload-success",
- { detail: { some: "details" } },
- );
+ const event = new CustomEvent("upload-success", { detail: { some: "details" } });
document.dispatchEvent(event);
}
})
@@ -94,11 +82,7 @@ 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) &&
@@ -118,11 +102,7 @@ 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();
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 a6072fc79f..4e57eb823d 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
@@ -28,9 +28,7 @@ export function processUploadError(event) {
this.notifications.error.text = this.i18next.t("firefly.errors_upload");
// console.error(event.detail.error.response.status);
if (413 === event.detail.error.response.status) {
- this.notifications.error.text = this.i18next.t(
- "firefly.upload_too_large",
- );
+ this.notifications.error.text = this.i18next.t("firefly.upload_too_large");
}
if ("create" === this.formBehaviour.formType) {
// delete transaction and let user try again.
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 a31b9435be..12686f8b35 100644
--- a/resources/assets/v3/js/pages/transactions/shared/render-map.js
+++ b/resources/assets/v3/js/pages/transactions/shared/render-map.js
@@ -45,8 +45,7 @@ export function renderMap(index, useDefault) {
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>',
+ attribution: '&copy; <a href="http://www.openstreetmap.org/copyright">OpenStreetMap</a>',
}).addTo(this.maps[index]);
if ("true" === el.dataset.addMarker) {
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 17dc4be686..24dd834211 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,25 +21,19 @@
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,
- );
+ 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 253e675856..67aae2be6e 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
@@ -24,15 +24,11 @@ export function saveNewLink(e) {
let linkSelect = document.getElementById("link_type_id_" + index);
let linkType = linkSelect.value;
let searchBox = document.getElementById("links_modal_search_" + index);
- let hiddenField = searchBox.parentNode.querySelector(
- 'input[name="search"]',
- );
+ 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 linkTypeObj = this.formData.linkTypes.find((link) => link.id === linkTypeId);
if ("" === linkType || "" === hiddenField.value || "" === searchBox.value) {
return;
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 fada320d87..0ccccb3cb2 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
@@ -41,18 +41,14 @@ 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 },
- },
- );
+ this.notifications.success.text = i18next.t("firefly.stored_journal_js", {
+ description: this.groupProperties.title,
+ interpolation: { escapeValue: false },
+ });
this.groupProperties.title = null;
// reset the form.
@@ -67,10 +63,7 @@ export function showMessageOrRedirectUser() {
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;
@@ -108,19 +101,11 @@ export function showMessageOrRedirectUser() {
if ("" !== from) {
if ("edit" === this.formBehaviour.formType) {
window.location =
- finalFrom +
- separator +
- "transaction_group_id=" +
- this.groupProperties.id +
- "&message=updated";
+ finalFrom + separator + "transaction_group_id=" + this.groupProperties.id + "&message=updated";
return;
}
window.location =
- finalFrom +
- separator +
- "transaction_group_id=" +
- this.groupProperties.id +
- "&message=created";
+ finalFrom + separator + "transaction_group_id=" + this.groupProperties.id + "&message=created";
return;
}
if ("edit" === this.formBehaviour.formType) {
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 e78448ba2e..41d8fb4bd1 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
@@ -45,9 +45,7 @@ export function spliceErrorsIntoTransactions(errors, transactions) {
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) {
@@ -73,62 +71,41 @@ export function spliceErrorsIntoTransactions(errors, transactions) {
case "bill_id":
case "description":
case "tags":
- transactions[transactionIndex].errors[fieldName] =
- errorArray;
+ transactions[transactionIndex].errors[fieldName] = errorArray;
break;
case "source_name":
case "source_id":
transactions[transactionIndex].errors.source_account =
- transactions[
- transactionIndex
- ].errors.source_account.concat(errorArray);
+ transactions[transactionIndex].errors.source_account.concat(errorArray);
break;
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);
+ 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);
+ 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,
- ),
- );
+ 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),
+ );
}
}
}
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 a47abd32ee..d443efd412 100644
--- a/resources/assets/v3/js/pages/transactions/shared/switch-link.js
+++ b/resources/assets/v3/js/pages/transactions/shared/switch-link.js
@@ -21,13 +21,9 @@
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 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 linkType = this.formData.linkTypes.find((link) => link.id === linkTypeId);
// switch link type.
linkTypeDirection = "inward" === linkTypeDirection ? "outward" : "inward";
if (typeof linkType === "undefined") {
@@ -35,8 +31,7 @@ export function switchLink(e) {
// 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 89b4d4c1fd..3f8d40fd46 100644
--- a/resources/assets/v3/js/pages/transactions/show.js
+++ b/resources/assets/v3/js/pages/transactions/show.js
@@ -54,10 +54,7 @@ let show = function () {
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"));
console.log("Date formatted is", current.dateFormatted);
this.group.transactions.push(current);
}
diff --git a/resources/assets/v3/js/pages/webhooks/create.js b/resources/assets/v3/js/pages/webhooks/create.js
index f8d72ad396..47348d65a7 100644
--- a/resources/assets/v3/js/pages/webhooks/create.js
+++ b/resources/assets/v3/js/pages/webhooks/create.js
@@ -125,31 +125,22 @@ let create = function () {
.post(data)
.then((response) => {
let webhookId = parseInt(response.data.data.id);
- window.location.href =
- window.previousUrl +
- "?webhook_id=" +
- webhookId +
- "&message=created";
+ 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.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],
- );
+ this.errors[newKey] = this.errors[newKey].concat(error.response.data.errors[key]);
}
}
diff --git a/resources/assets/v3/js/pages/webhooks/edit.js b/resources/assets/v3/js/pages/webhooks/edit.js
index 7d6dbeb00d..3b8f920feb 100644
--- a/resources/assets/v3/js/pages/webhooks/edit.js
+++ b/resources/assets/v3/js/pages/webhooks/edit.js
@@ -98,8 +98,7 @@ let edit = function () {
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.deliveries = response.data.data.attributes.deliveries[0];
this.active = response.data.data.attributes.active;
this.url = response.data.data.attributes.url;
})
@@ -138,19 +137,14 @@ let edit = function () {
.put(data, { id: this.id })
.then((response) => {
let webhookId = parseInt(response.data.data.id);
- window.location.href =
- window.previousUrl +
- "?webhook_id=" +
- webhookId +
- "&message=updated";
+ 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.deliveries = error.response.data.errors.deliveries;
this.errors.url = error.response.data.errors.url;
// enable button again
diff --git a/resources/assets/v3/js/pages/webhooks/index.js b/resources/assets/v3/js/pages/webhooks/index.js
index a038a41015..ea47798871 100644
--- a/resources/assets/v3/js/pages/webhooks/index.js
+++ b/resources/assets/v3/js/pages/webhooks/index.js
@@ -64,21 +64,14 @@ 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;
@@ -90,9 +83,7 @@ let index = function () {
.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,
- );
+ this.triggers[key] = i18next.t("firefly.webhook_trigger_" + key);
}
}
})
@@ -101,12 +92,8 @@ let index = function () {
.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,
- );
+ if (Object.hasOwn(response.data.data.value, key)) {
+ this.responses[key] = i18next.t("firefly.webhook_response_" + key);
}
}
})
@@ -115,16 +102,8 @@ let index = function () {
.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,
- );
+ if (Object.hasOwn(response.data.data.value, key)) {
+ this.deliveries[key] = i18next.t("firefly.webhook_delivery_" + key);
}
}
})
diff --git a/resources/assets/v3/js/pages/webhooks/show.js b/resources/assets/v3/js/pages/webhooks/show.js
index 347465fd28..a39c151c08 100644
--- a/resources/assets/v3/js/pages/webhooks/show.js
+++ b/resources/assets/v3/js/pages/webhooks/show.js
@@ -75,9 +75,7 @@ let show = function () {
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",
- );
+ this.success_message = i18next.t("firefly.webhook_was_triggered");
new Post().triggerTransaction(this.id, journalId);
// set a time-outs.
@@ -124,9 +122,7 @@ let show = function () {
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,
});
}
diff --git a/resources/assets/v3/js/shared/draw-chart.js b/resources/assets/v3/js/shared/draw-chart.js
index b59409053f..714431d057 100644
--- a/resources/assets/v3/js/shared/draw-chart.js
+++ b/resources/assets/v3/js/shared/draw-chart.js
@@ -60,13 +60,7 @@ let defaultChartOptions = {
},
};
-export function drawMultiCurrencyChart(
- type,
- url,
- holder,
- anonymous,
- drawTodayMarker,
-) {
+export function drawMultiCurrencyChart(type, url, holder, anonymous, drawTodayMarker) {
if ("line" === type) {
drawMultiCurrencyLineChart(url, holder, anonymous, drawTodayMarker);
return;
@@ -115,18 +109,13 @@ function drawMultiCurrencyStackedColumnChart(url, holder, anonymous) {
for (let i = 0; i < all.length; i++) {
if (Object.hasOwn(all, i)) {
let current = all[i];
- let label =
- current.label + " (" + current.currency_code + ")";
+ let label = current.label + " (" + current.currency_code + ")";
console.log("Now processing", label);
current.entries.spent = parseFloat(current.entries.spent);
- current.entries.budgeted = parseFloat(
- current.entries.budgeted,
- );
+ current.entries.budgeted = parseFloat(current.entries.budgeted);
current.entries.left = parseFloat(current.entries.left);
- current.entries.overspent = parseFloat(
- current.entries.overspent,
- );
+ current.entries.overspent = parseFloat(current.entries.overspent);
if (current.entries.spent < 0) {
current.entries.spent = current.entries.spent * -1;
}
@@ -166,10 +155,7 @@ function drawMultiCurrencyStackedColumnChart(url, holder, anonymous) {
}
}
// user has not overspent, and there was a budget set.
- if (
- current.entries.spent < current.entries.budgeted &&
- 0 !== current.entries.budgeted
- ) {
+ if (current.entries.spent < current.entries.budgeted && 0 !== current.entries.budgeted) {
// console.log('A: Is not overspent, and there was a budget', current.entries.spent, current.entries.budgeted);
let key = "budgeted" + current.currency_code;
datasets[key].data[labelIndex] = 0; // parseFloat(current.entries.budgeted);
@@ -184,14 +170,10 @@ function drawMultiCurrencyStackedColumnChart(url, holder, anonymous) {
datasets[key].data[labelIndex] = 0;
}
// user has overspent and there was a budget set.
- if (
- current.entries.spent >= current.entries.budgeted &&
- 0 !== current.entries.budgeted
- ) {
+ if (current.entries.spent >= current.entries.budgeted && 0 !== current.entries.budgeted) {
// console.log('B: Is overspent, and there was a budget', current.entries.spent, current.entries.budgeted);
let key = "budgeted" + current.currency_code;
- datasets[key].data[labelIndex] =
- current.entries.budgeted;
+ datasets[key].data[labelIndex] = current.entries.budgeted;
key = "spent" + current.currency_code;
datasets[key].data[labelIndex] = 0;
@@ -200,14 +182,10 @@ function drawMultiCurrencyStackedColumnChart(url, holder, anonymous) {
datasets[key].data[labelIndex] = 0;
key = "overspent" + current.currency_code;
- datasets[key].data[labelIndex] =
- current.entries.overspent;
+ datasets[key].data[labelIndex] = current.entries.overspent;
}
- if (
- current.entries.spent >= current.entries.budgeted &&
- 0 === current.entries.budgeted
- ) {
+ if (current.entries.spent >= current.entries.budgeted && 0 === current.entries.budgeted) {
// user has no budget set.
let key = "budgeted" + current.currency_code;
datasets[key].data[labelIndex] = 0;
@@ -230,10 +208,7 @@ function drawMultiCurrencyStackedColumnChart(url, holder, anonymous) {
id: axisId,
type: "linear",
stacked: true,
- position:
- 0 === Object.keys(axes).length % 2
- ? "left"
- : "right",
+ position: 0 === Object.keys(axes).length % 2 ? "left" : "right",
ticks: {
callback: function (value) {
if (anonymous) {
@@ -269,15 +244,9 @@ function drawMultiCurrencyStackedColumnChart(url, holder, anonymous) {
let index = tooltipItem.dataIndex;
let amount = tooltipItem.dataset.data[index];
- let string = formatMoney(
- amount,
- tooltipItem.dataset.currency_code,
- );
+ let string = formatMoney(amount, tooltipItem.dataset.currency_code);
if (anonymous) {
- string = formatMoney(
- "0",
- tooltipItem.dataset.currency_code,
- );
+ string = formatMoney("0", tooltipItem.dataset.currency_code);
}
if (tooltipItem.dataset.label.startsWith("budgeted")) {
return i18next.t("firefly.budgeted") + ": " + string;
@@ -298,9 +267,7 @@ function drawMultiCurrencyStackedColumnChart(url, holder, anonymous) {
if (
typeof data === "undefined" ||
0 === data.length ||
- (typeof data === "object" &&
- typeof data.labels === "object" &&
- 0 === data.labels.length)
+ (typeof data === "object" && typeof data.labels === "object" && 0 === data.labels.length)
) {
let el = document.getElementById(holder).parentElement;
el.innerHTML = "";
@@ -329,8 +296,7 @@ function drawMultiCurrencyStackedColumnChart(url, holder, anonymous) {
let el = document.getElementById(holder).parentElement;
el.innerHTML = "";
el.classList.add("general-chart-error");
- el.innerText =
- i18next.t("firefly.could_not_load_chart") + " " + error;
+ el.innerText = i18next.t("firefly.could_not_load_chart") + " " + error;
});
}
@@ -377,12 +343,7 @@ function drawMultiCurrencyLineChart(url, holder, anonymous, drawTodayMarker) {
drawTodayIndex = labelCount;
}
// add the label to the array
- data.labels.push(
- format(
- date,
- i18next.t("config.month_and_day_fns"),
- ),
- );
+ data.labels.push(format(date, i18next.t("config.month_and_day_fns")));
}
}
}
@@ -410,10 +371,7 @@ function drawMultiCurrencyLineChart(url, holder, anonymous, drawTodayMarker) {
axes[axisId] = {
id: axisId,
type: "linear",
- position:
- 0 === Object.keys(axes).length % 2
- ? "left"
- : "right",
+ position: 0 === Object.keys(axes).length % 2 ? "left" : "right",
ticks: {
callback: function (value) {
if (anonymous) {
@@ -438,15 +396,9 @@ function drawMultiCurrencyLineChart(url, holder, anonymous, drawTodayMarker) {
let index = tooltipItem.dataIndex;
let amount = tooltipItem.dataset.data[index];
- let string = formatMoney(
- amount,
- tooltipItem.dataset.currency_code,
- );
+ let string = formatMoney(amount, tooltipItem.dataset.currency_code);
if (anonymous) {
- string = formatMoney(
- "0",
- tooltipItem.dataset.currency_code,
- );
+ string = formatMoney("0", tooltipItem.dataset.currency_code);
}
return tooltipItem.dataset.label + ": " + string;
};
@@ -455,9 +407,7 @@ function drawMultiCurrencyLineChart(url, holder, anonymous, drawTodayMarker) {
if (
typeof data === "undefined" ||
0 === data.length ||
- (typeof data === "object" &&
- typeof data.labels === "object" &&
- 0 === data.labels.length)
+ (typeof data === "object" && typeof data.labels === "object" && 0 === data.labels.length)
) {
let el = document.getElementById(holder).parentElement;
el.innerHTML = "";
@@ -473,10 +423,7 @@ function drawMultiCurrencyLineChart(url, holder, anonymous, drawTodayMarker) {
// add a marker to the chart if defined.
if (drawTodayMarker && "" !== drawTodayLabel) {
- let markDate = format(
- new Date(drawTodayLabel),
- i18next.t("config.month_and_day_fns"),
- );
+ let markDate = format(new Date(drawTodayLabel), i18next.t("config.month_and_day_fns"));
let today = i18next.t("firefly.today");
let xAdjust = 0;
if (drawTodayIndex < 3) {
@@ -521,8 +468,7 @@ function drawMultiCurrencyLineChart(url, holder, anonymous, drawTodayMarker) {
let el = document.getElementById(holder).parentElement;
el.innerHTML = "";
el.classList.add("general-chart-error");
- el.innerText =
- i18next.t("firefly.could_not_load_chart") + " " + error;
+ el.innerText = i18next.t("firefly.could_not_load_chart") + " " + error;
});
}
@@ -560,9 +506,7 @@ function drawSingleCurrencyLineChart(url, holder, anonymous) {
if (
typeof data === "undefined" ||
0 === data.length ||
- (typeof data === "object" &&
- typeof data.labels === "object" &&
- 0 === data.labels.length)
+ (typeof data === "object" && typeof data.labels === "object" && 0 === data.labels.length)
) {
let el = document.getElementById(holder).parentElement;
el.innerHTML = "";
@@ -588,18 +532,13 @@ function drawSingleCurrencyLineChart(url, holder, anonymous) {
let el = document.getElementById(holder).parentElement;
el.innerHTML = "";
el.classList.add("general-chart-error");
- el.innerText =
- i18next.t("firefly.could_not_load_chart") + " " + error;
+ el.innerText = i18next.t("firefly.could_not_load_chart") + " " + error;
});
}
// https://stackoverflow.com/questions/43855166/how-to-tell-if-two-dates-are-in-the-same-day-or-in-the-same-hour
function isSameDay(d1, d2) {
- return (
- d1.getFullYear() === d2.getFullYear() &&
- d1.getMonth() === d2.getMonth() &&
- d1.getDate() === d2.getDate()
- );
+ return d1.getFullYear() === d2.getFullYear() && d1.getMonth() === d2.getMonth() && d1.getDate() === d2.getDate();
}
function formatLabel(str, maxWidth) {
diff --git a/resources/assets/v3/js/shared/focus-first-input.js b/resources/assets/v3/js/shared/focus-first-input.js
index 94b40bdfcd..203e2c1534 100644
--- a/resources/assets/v3/js/shared/focus-first-input.js
+++ b/resources/assets/v3/js/shared/focus-first-input.js
@@ -19,14 +19,12 @@
*/
export default function focusFirstInput() {
- let list = document.querySelectorAll('div.app-content form input[type="text"]:enabled',);
+ let list = document.querySelectorAll('div.app-content form input[type="text"]:enabled');
if (list.length > 0) {
list[0].focus();
return;
}
- list = document.querySelectorAll(
- 'div.app-content input[type="text"]:enabled',
- );
+ list = document.querySelectorAll('div.app-content input[type="text"]:enabled');
if (list.length > 0) {
list[0].focus();
}
diff --git a/resources/assets/v3/js/store/get-variable.js b/resources/assets/v3/js/store/get-variable.js
index 5c9b81875c..7cafff1062 100644
--- a/resources/assets/v3/js/store/get-variable.js
+++ b/resources/assets/v3/js/store/get-variable.js
@@ -28,19 +28,13 @@ export function getVariable(name, defaultValue = null) {
// 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 with value: ',
- window[name],
- );
+ console.log('Returning "' + name + '" from window with value: ', 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 with value: ',
- fromStore,
- );
+ console.log('Returning "' + name + '" from store with value: ', fromStore);
return Promise.resolve(fromStore);
}
let getter = new Get();
@@ -48,10 +42,7 @@ export function getVariable(name, defaultValue = null) {
return getter
.getByName(name)
.then((response) => {
- console.log(
- 'Returning "' + name + '" from server with value: ',
- parseResponse(name, response),
- );
+ console.log('Returning "' + name + '" from server with value: ', parseResponse(name, response));
return Promise.resolve(parseResponse(name, response));
})
.catch((error) => {
@@ -64,10 +55,7 @@ export function getVariable(name, defaultValue = null) {
// POST it and then return it anyway.
let poster = new Post();
return poster.post(name, defaultValue).then((response) => {
- console.log(
- 'Returning "' + name + '" from POST with value: ',
- parseResponse(name, response),
- );
+ console.log('Returning "' + name + '" from POST with value: ', parseResponse(name, response));
return Promise.resolve(parseResponse(name, response));
});
});
diff --git a/resources/assets/v3/js/support/get-cache-key.js b/resources/assets/v3/js/support/get-cache-key.js
index 025247379a..4092967f82 100644
--- a/resources/assets/v3/js/support/get-cache-key.js
+++ b/resources/assets/v3/js/support/get-cache-key.js
@@ -39,9 +39,7 @@ function getCacheKey(string, params) {
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
@@ -53,10 +51,7 @@ function md5(inputString) {
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);
+ 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) {
@@ -87,8 +82,7 @@ function md5(inputString) {
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);
+ 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;
diff --git a/resources/assets/v3/js/support/load-translations.js b/resources/assets/v3/js/support/load-translations.js
index 44cab874c0..50787a0310 100644
--- a/resources/assets/v3/js/support/load-translations.js
+++ b/resources/assets/v3/js/support/load-translations.js
@@ -31,10 +31,7 @@ function loadTranslations(locale) {
// 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",
diff --git a/resources/assets/v3/js/util/format-money.js b/resources/assets/v3/js/util/format-money.js
index 3a0d08b2ce..621ae3a2c5 100644
--- a/resources/assets/v3/js/util/format-money.js
+++ b/resources/assets/v3/js/util/format-money.js
@@ -19,18 +19,12 @@
*/
export default function (amount, currencyCode) {
- if (
- (typeof amount !== "number" && typeof amount !== "string") ||
- isNaN(amount)
- ) {
+ 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,
- );
+ console.warn("format-money: currencyCode is not a valid ISO 4217 code:", currencyCode);
return "";
}
let locale = window.__localeId__.replace("_", "-");
diff --git a/resources/assets/v3/js/util/format.js b/resources/assets/v3/js/util/format.js
index b72b6733ec..9a70aa97ec 100644
--- a/resources/assets/v3/js/util/format.js
+++ b/resources/assets/v3/js/util/format.js
@@ -95,7 +95,6 @@ export default function (date, formatStr = "PP") {
let locale = window.__localeId__.replace("_", "");
// console.log("Locale is " + locale);
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/vite.config.js b/resources/assets/v3/vite.config.js
index 9a11009726..ffe05f1788 100644
--- a/resources/assets/v3/vite.config.js
+++ b/resources/assets/v3/vite.config.js
@@ -27,12 +27,8 @@ export default defineConfig(({ command }) => {
let https = null;
if (command === "serve") {
https = {
- key: fs.readFileSync(
- `/vagrant/tls-certificates/wildcard.sd.internal.key`,
- ),
- cert: fs.readFileSync(
- `/vagrant/tls-certificates/wildcard.sd.internal.crt`,
- ),
+ key: fs.readFileSync(`/vagrant/tls-certificates/wildcard.sd.internal.key`),
+ cert: fs.readFileSync(`/vagrant/tls-certificates/wildcard.sd.internal.crt`),
};
}