Skip to content

Firefly III: a personal finances manager

Fix many JS lint issues.

James Cole6104c944c459
diff --git a/resources/assets/v3/js/pages/recurring/create.js b/resources/assets/v3/js/pages/recurring/create.js
index eb224dbc73..f79e62ca8a 100644
--- a/resources/assets/v3/js/pages/recurring/create.js
+++ b/resources/assets/v3/js/pages/recurring/create.js
@@ -38,22 +38,22 @@ import {respondToRepetitionEnd} from './shared/respond-to-repetition-end.js';
import 'fullcalendar/skeleton.css'; // ALWAYS NEED SKELETON
import 'fullcalendar/themes/monarch/theme.css'; // YOUR THEME
import 'fullcalendar/themes/monarch/palettes/purple.css'; // YOUR THEME'S PALETTE
-
+import Alpine from 'alpinejs';
let create = function () {
return {
calendar: null,
eventSource: null,
+ repetitionType:null,
+ respondToFirstDateChange: respondToFirstDateChange,
init() {
createTagField('ffInput_tags');
createAutocomplete('ffInput_category', './api/v1/autocomplete/categories');
createButtonSwitcher();
switchTransactionType('withdrawal');
- let type = document.getElementById('repetitionType').value;
- let suggestUrl = document.getElementById('suggestUrl').value;
- respondToFirstDateChange(type, suggestUrl);
+ this.respondToFirstDateChange();
respondToRepetitionEnd();
- document.getElementById('ffInput_first_date').addEventListener('change', respondToFirstDateChange.bind(this));
+ document.getElementById('ffInput_first_date').addEventListener('change', this.respondToFirstDateChange);
document.getElementById('ffInput_repetition_end').addEventListener('change', respondToRepetitionEnd.bind(this));
@@ -83,7 +83,7 @@ let create = function () {
let eventSource = new EventSource(newEventsUrl);
this.calendar.removeAllEventSources();
this.calendar.addEventSource(eventSource);
- $('#calendarModal').modal('show');
+ // $('#calendarModal').modal('show');
return false;
}
diff --git a/resources/assets/v3/js/pages/recurring/edit.js b/resources/assets/v3/js/pages/recurring/edit.js
index 6127ccd97c..49e06e00ad 100644
--- a/resources/assets/v3/js/pages/recurring/edit.js
+++ b/resources/assets/v3/js/pages/recurring/edit.js
@@ -33,6 +33,7 @@ import themePlugin from "fullcalendar/themes/monarch";
import dayGridPlugin from "fullcalendar/daygrid";
import timeGridPlugin from "fullcalendar/timegrid";
import listPlugin from "fullcalendar/list";
+import Alpine from 'alpinejs';
// stylesheets
import 'fullcalendar/skeleton.css'; // ALWAYS NEED SKELETON
@@ -41,17 +42,17 @@ import 'fullcalendar/themes/monarch/palettes/purple.css'; // YOUR THEME'S PALETT
let edit = function () {
return {
+ type: null,
+ respondToFirstDateChange: respondToFirstDateChange,
init() {
createTagField('ffInput_tags');
createAutocomplete('ffInput_category','./api/v1/autocomplete/categories');
createButtonSwitcher();
switchTransactionType(document.getElementsByName('transaction_type')[0].value);
-
- let type = document.getElementById('repetitionType').value;
- let suggestUrl = document.getElementById('suggestUrl').value;
- respondToFirstDateChange(type, suggestUrl);
+ this.type = document.getElementById('repetitionType').value;
+ this.respondToFirstDateChange();
respondToRepetitionEnd();
- document.getElementById('ffInput_first_date').addEventListener('change', respondToFirstDateChange.bind(this));
+ document.getElementById('ffInput_first_date').addEventListener('change', this.respondToFirstDateChange);
document.getElementById('ffInput_repetition_end').addEventListener('change', respondToRepetitionEnd.bind(this));
let calendarEl = document.getElementById('recurring_calendar');
@@ -81,7 +82,7 @@ let edit = function () {
let eventSource = new EventSource(newEventsUrl);
this.calendar.removeAllEventSources();
this.calendar.addEventSource(eventSource);
- $('#calendarModal').modal('show');
+ //$('#calendarModal').modal('show');
return false;
}
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 8d4725e1ed..0137aefc8b 100644
--- a/resources/assets/v3/js/pages/recurring/shared/respond-to-first-date-change.js
+++ b/resources/assets/v3/js/pages/recurring/shared/respond-to-first-date-change.js
@@ -18,12 +18,15 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
-function parseRepetitionSuggestions(data) {
+import {api} from "../../../boot/axios";
+
+function parseRepetitionSuggestions(response) {
+ let data = response.data;
let select = document.getElementById('ffInput_repetition_type');
select.innerHTML = '';
let opt;
for (var k in data) {
- if (data.hasOwnProperty(k)) {
+ if (Object.hasOwn(data, k)) {
console.log('label: ' + data[k].label + ', selected: ' + data[k].selected);
opt = document.createElement('option');
opt.value = k;
@@ -38,22 +41,24 @@ function parseRepetitionSuggestions(data) {
select.disabled = false;
}
-function respondToFirstDateChange(oldRepetitionType, suggestUrl) {
+function respondToFirstDateChange() {
+ let suggestUrl = './recurring/suggest';
let obj = document.getElementById('ffInput_first_date');
let select = document.getElementById('ffInput_repetition_type');
let date = obj.value;
select.disabled = true;
// preselected value:
- var preSelected = oldRepetitionType;
+ var preSelected = this.type;
if (preSelected === '') {
preSelected = select.value;
}
-
- $.getJSON(suggestUrl, {date: date, pre_select: preSelected, past: 'true'}).fail(function () {
+ api.get(suggestUrl, {params: {date: date, pre_select: preSelected, past: 'true'}}).
+ then(parseRepetitionSuggestions)
+ .catch(function () {
console.error('Could not load repetition suggestions');
alert('Could not load repetition suggestions. Please enter a valid date.');
- }).done(parseRepetitionSuggestions);
+ });
}
export {respondToFirstDateChange}
diff --git a/resources/assets/v3/js/pages/shared/dates.js b/resources/assets/v3/js/pages/shared/dates.js
index 1a28c8ad36..8c031b0a2e 100644
--- a/resources/assets/v3/js/pages/shared/dates.js
+++ b/resources/assets/v3/js/pages/shared/dates.js
@@ -26,9 +26,9 @@ export default () => ({
start: null, end: null
},
eventListeners: {
- ['@CustomEvents.change'](event) {
- console.log('I heard that! (dashboard/dates)');
- }
+ // ['@CustomEvents.change'](event) {
+ // console.log('I heard that! (dashboard/dates)');
+ // }
},
updateDates(e) {
let split = e.originalTarget._props.value.split('/');
diff --git a/resources/assets/v3/js/pages/transactions/bulk-edit.js b/resources/assets/v3/js/pages/transactions/bulk-edit.js
index 8659820d62..e1f1e13ea1 100644
--- a/resources/assets/v3/js/pages/transactions/bulk-edit.js
+++ b/resources/assets/v3/js/pages/transactions/bulk-edit.js
@@ -25,6 +25,7 @@ import dates from '../shared/dates.js';
import Tags from "bootstrap5-tags";
import i18next from 'i18next';
import {addAutocomplete} from "./shared/add-autocomplete.js";
+import Alpine from 'alpinejs';
window.enableDates = false;
@@ -42,7 +43,7 @@ let edit = function () {
document.querySelector('input[name="ignore_budget"]').checked = false;
}
},
- detectTagChange(e) {
+ detectTagChange() {
let count = 0;
let options = document.querySelector('select[name="tags"]').options;
for(let i = 0; i < options.length; i ++){
diff --git a/resources/assets/v3/js/pages/transactions/create.js b/resources/assets/v3/js/pages/transactions/create.js
index d999ac0e5c..91d4537d9b 100644
--- a/resources/assets/v3/js/pages/transactions/create.js
+++ b/resources/assets/v3/js/pages/transactions/create.js
@@ -64,6 +64,7 @@ import {addTabListener} from "./shared/add-tab-listener.js";
import {autoStep} from "./shared/auto-step.js";
import {respondToTabSwitch} from "./shared/respond-to-tab-switch.js";
import {loadTransactionLinks} from './shared/load-transaction-links.js';
+import Alpine from 'alpinejs';
window.enableDates = false;
@@ -153,19 +154,19 @@ let create = function () {
},
// events in the form
- changedDateTime(event) {
+ changedDateTime() {
console.warn('changedDateTime, event is not used');
},
- changedDescription(event) {
+ changedDescription() {
console.warn('changedDescription, event is not used');
},
- changedDestinationAccount(event) {
+ changedDestinationAccount() {
this.detectTransactionType();
},
- changedSourceAccount(event) {
+ changedSourceAccount() {
this.detectTransactionType();
},
// shared functions with edit/create transaction.
@@ -208,7 +209,7 @@ let create = function () {
let list = [];
let currency;
for (let i in this.formData.enabledCurrencies) {
- if (this.formData.enabledCurrencies.hasOwnProperty(i)) {
+ if (Object.hasOwn(this.formData.enabledCurrencies,i)) {
let current = this.formData.enabledCurrencies[i];
if (current.code === code) {
currency = current;
@@ -229,7 +230,7 @@ let create = function () {
// this also forces the currency_code on ALL entries.
for (let i in this.entries) {
- if (this.entries.hasOwnProperty(i)) {
+ if (Object.hasOwn(this.entries,i)) {
this.entries[i].foreign_currency_code = code;
}
}
@@ -241,7 +242,7 @@ let create = function () {
this.formStates.loadingTransaction = false;
},
- processUpload(event) {
+ processUpload() {
console.log('Now in processUpload()');
this.formStates.storedAttachments = true;
this.showMessageOrRedirectUser();
@@ -296,9 +297,9 @@ let create = function () {
});
- document.addEventListener('upload-success', (event) => {
+ document.addEventListener('upload-success', () => {
console.log('Now in event listener "upload-success"');
- this.processUpload(event);
+ this.processUpload();
document.querySelectorAll("input[type=file]").forEach(input => input.value = "");
});
@@ -321,7 +322,7 @@ let create = function () {
this.formStates.isSubmitting = true;
for (let i in this.entries) {
- if (this.entries.hasOwnProperty(i)) {
+ if (Object.hasOwn(this.entries,i)) {
this.entries[i].errors = defaultErrorSet();
}
}
@@ -355,7 +356,7 @@ let create = function () {
// submit all transaction links, based on the order of the transaction IDs
let transactions = [];
for (let i = 0; i < group.attributes.transactions.length; i++) {
- if (group.attributes.transactions.hasOwnProperty(i)) {
+ if (Object.hasOwn(group.attributes.transactions,i)) {
transactions.push(parseInt(group.attributes.transactions[i].transaction_journal_id));
}
}
diff --git a/resources/assets/v3/js/pages/transactions/edit.js b/resources/assets/v3/js/pages/transactions/edit.js
index 5a6056b5ea..823351a87d 100644
--- a/resources/assets/v3/js/pages/transactions/edit.js
+++ b/resources/assets/v3/js/pages/transactions/edit.js
@@ -67,6 +67,7 @@ import {redirectAfterTransactionLinks} from "./shared/redirect-after-transaction
import {addTabListener} from "./shared/add-tab-listener.js";
import {autoStep} from "./shared/auto-step.js";
import {respondToTabSwitch} from "./shared/respond-to-tab-switch.js";
+import Alpine from 'alpinejs'
const urls = getUrls();
window.enableDates = false;
@@ -191,19 +192,19 @@ let transactions = function () {
// part of the account selection auto-complete
- changedDateTime(event) {
+ changedDateTime() {
console.warn('changedDateTime, event is not used');
},
- changedDescription(event) {
+ changedDescription() {
console.warn('changedDescription, event is not used');
},
- changedDestinationAccount(event) {
+ changedDestinationAccount() {
console.warn('changedDestinationAccount, event is not used');
},
- changedSourceAccount(event) {
+ changedSourceAccount() {
console.warn('changedSourceAccount, event is not used');
},
@@ -231,7 +232,7 @@ let transactions = function () {
// set amountCurrency.
for (let i in this.formData.enabledCurrencies) {
- if (this.formData.enabledCurrencies.hasOwnProperty(i)) {
+ 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];
}
@@ -241,7 +242,7 @@ let transactions = function () {
if ('transfer' === this.groupProperties.transactionType) {
this.formData.foreignCurrencies = [];
for (let i in this.formData.enabledCurrencies) {
- if (this.formData.enabledCurrencies.hasOwnProperty(i)) {
+ if (Object.hasOwn(this.formData.enabledCurrencies, i)) {
if (this.formData.enabledCurrencies[i].code === this.entries[0].forein_currency_code) {
this.formData.foreignCurrencies.push(this.formData.enabledCurrencies[i]);
}
@@ -254,7 +255,7 @@ let transactions = function () {
}).then(() => {
this.groupProperties.totalAmount = 0;
for (let i in this.entries) {
- if (this.entries.hasOwnProperty(i)) {
+ if (Object.hasOwn(this.entries, i)) {
this.groupProperties.totalAmount = this.groupProperties.totalAmount + parseFloat(this.entries[i].amount);
}
}
@@ -329,8 +330,8 @@ let transactions = function () {
});
// add some event listeners
- document.addEventListener('upload-success', (event) => {
- this.processUpload(event);
+ document.addEventListener('upload-success', () => {
+ this.processUpload();
document.querySelectorAll("input[type=file]").forEach(input => input.value = "");
});
@@ -341,7 +342,7 @@ let transactions = function () {
// TODO is a duplicate
- processUpload(event) {
+ processUpload() {
this.showMessageOrRedirectUser();
},
@@ -355,7 +356,7 @@ let transactions = function () {
// reset all errors in the entries array:
for (let i in this.entries) {
- if (this.entries.hasOwnProperty(i)) {
+ if (Object.hasOwn(this.entries, i)) {
this.entries[i].errors = defaultErrorSet();
}
}
@@ -390,7 +391,7 @@ let transactions = function () {
// submit all transaction links, based on the order of the transaction IDs
let transactions = [];
for (let i = 0; i < group.attributes.transactions.length; i++) {
- if (group.attributes.transactions.hasOwnProperty(i)) {
+ if (Object.hasOwn(group.attributes.transactions, i)) {
transactions.push(parseInt(group.attributes.transactions[i].transaction_journal_id));
}
}
diff --git a/resources/assets/v3/js/pages/transactions/mass-edit.js b/resources/assets/v3/js/pages/transactions/mass-edit.js
index bd1857e00d..e54a1720e7 100644
--- a/resources/assets/v3/js/pages/transactions/mass-edit.js
+++ b/resources/assets/v3/js/pages/transactions/mass-edit.js
@@ -22,6 +22,7 @@ import '../../boot/bootstrap.js';
import sidebar from '../../pages/shared/sidebar.js';
import dates from '../shared/dates.js';
import {addAutocomplete} from "./shared/add-autocomplete.js";
+import Alpine from 'alpinejs'
window.enableDates = false;
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 5d76bcbca0..b7108cb464 100644
--- a/resources/assets/v3/js/pages/transactions/shared/add-autocomplete.js
+++ b/resources/assets/v3/js/pages/transactions/shared/add-autocomplete.js
@@ -68,7 +68,7 @@ export function addAllAutocompleteToForm() {
setTimeout(() => {
// addedSplit, is called from the HTML
// for source account
- const renderAccount = function (item, b, c) {
+ const renderAccount = function (item) {
return item.name_with_balance + '<br><small class="text-muted">' + i18next.t('firefly.account_type_' + item.type) + '</small>';
};
diff --git a/resources/assets/v3/js/pages/transactions/shared/add-split.js b/resources/assets/v3/js/pages/transactions/shared/add-split.js
index 651ba4a397..ceecb81370 100644
--- a/resources/assets/v3/js/pages/transactions/shared/add-split.js
+++ b/resources/assets/v3/js/pages/transactions/shared/add-split.js
@@ -19,7 +19,6 @@
*/
import {createEmptySplit} from "./create-empty-split.js";
-import {addAllAutocompleteToForm} from "./add-autocomplete.js";
export function addSplit() {
this.entries.push(createEmptySplit());
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 f669422f2c..04d9ce48fb 100644
--- a/resources/assets/v3/js/pages/transactions/shared/auto-step.js
+++ b/resources/assets/v3/js/pages/transactions/shared/auto-step.js
@@ -25,12 +25,12 @@ import {loadLinkTypes} from "./load-link-types.js";
export function autoStep() {
// check if custom field "links" is enabled and if so, load the link types and save them in formData.
- if (null === this.formStates.loadingLinks && this.formBehaviour.customFields.hasOwnProperty('links') && true === this.formBehaviour.customFields.links) {
+ if (null === this.formStates.loadingLinks && Object.hasOwn(this.formBehaviour.customFields, 'links') && true === this.formBehaviour.customFields.links) {
this.formStates.loadingLinks = true;
loadLinkTypes().then(data => {
console.log('done loadLinkTypes()');
for (let i = 0; i < data.length; i++) {
- if (data.hasOwnProperty(i)) {
+ if (Object.hasOwn(data, i)) {
let current = data[i];
current.id = parseInt(current.id);
this.formData.linkTypes.push(current);
@@ -41,14 +41,14 @@ export function autoStep() {
});
}
- if (this.formBehaviour.customFields.hasOwnProperty('links') && false === this.formBehaviour.customFields.links) {
+ if (Object.hasOwn(this.formBehaviour.customFields, 'links') && false === this.formBehaviour.customFields.links) {
this.formStates.storedLinks = true;
this.formStates.loadingLinks = false;
}
// check if the transaction is loaded and also the transaction links AND the field is enabled, then load the autocomplete for links.
- if (false === this.formStates.loadingTransaction && false === this.formStates.loadingLinks && this.formBehaviour.customFields.hasOwnProperty('links') && true === this.formBehaviour.customFields.links) {
+ if (false === this.formStates.loadingTransaction && false === this.formStates.loadingLinks && Object.hasOwn(this.formBehaviour.customFields, 'links') && true === this.formBehaviour.customFields.links) {
for(let i = 0; i < this.entries.length; i++) {
- if(this.entries.hasOwnProperty(i)) {
+ if(Object.hasOwn(this.entries, i)) {
this.createLinkAutocomplete('links_modal_search_' + i, 'api/v1/autocomplete/transactions-with-meta');
if(0 !== parseInt(this.entries[i].transaction_journal_id) && !isNaN(parseInt(this.entries[i].transaction_journal_id))) {
// load the links for this transaction journal.
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 5bd2102ef1..63cb3fa35a 100644
--- a/resources/assets/v3/js/pages/transactions/shared/changed-amount.js
+++ b/resources/assets/v3/js/pages/transactions/shared/changed-amount.js
@@ -23,7 +23,7 @@ export function changedAmount(e) {
this.entries[index].amount = parseFloat(e.target.value);
this.groupProperties.totalAmount = 0;
for (let i in this.entries) {
- if (this.entries.hasOwnProperty(i)) {
+ if (Object.hasOwn(this.entries, i)) {
this.groupProperties.totalAmount = this.groupProperties.totalAmount + parseFloat(this.entries[i].amount);
}
}
diff --git a/resources/assets/v3/js/pages/transactions/shared/clear-location.js b/resources/assets/v3/js/pages/transactions/shared/clear-location.js
index 4d9994878c..327eecc448 100644
--- a/resources/assets/v3/js/pages/transactions/shared/clear-location.js
+++ b/resources/assets/v3/js/pages/transactions/shared/clear-location.js
@@ -26,7 +26,7 @@ export function clearLocation(e) {
this.entries[index].longitude = null;
this.entries[index].zoom_level = null;
- if(this.markers.hasOwnProperty(index)) {
+ if(Object.hasOwn(this.markers, index)) {
this.maps[index].removeLayer(this.markers[index]);
}
}
diff --git a/resources/assets/v3/js/pages/transactions/shared/create-link-autocomplete.js b/resources/assets/v3/js/pages/transactions/shared/create-link-autocomplete.js
index 27d79c3c47..212d812c44 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
@@ -25,7 +25,7 @@ import {format} from "date-fns";
export function createLinkAutocomplete(fieldIdentifier, url) {
let token = document.querySelector('meta[name="csrf-token"]').getAttribute('content');
- const renderJournal = function (item, b, c) {
+ const renderJournal = function (item) {
return item.description + '<br><small class="text-muted">' + formatMoney(item.amount, item.currency_code) + ' @ ' + format(new Date(item.date), this.i18next.t('config.date_time_fns')) + '</small>';
};
Autocomplete.init('#' + fieldIdentifier, {
diff --git a/resources/assets/v3/js/pages/transactions/shared/determine-amount-currency.js b/resources/assets/v3/js/pages/transactions/shared/determine-amount-currency.js
index 6709f0c3e0..092a35e4af 100644
--- a/resources/assets/v3/js/pages/transactions/shared/determine-amount-currency.js
+++ b/resources/assets/v3/js/pages/transactions/shared/determine-amount-currency.js
@@ -22,7 +22,7 @@ export function determineAmountCurrency(code) {
let list = [];
let currency;
for (let i in this.formData.enabledCurrencies) {
- if (this.formData.enabledCurrencies.hasOwnProperty(i)) {
+ if (Object.hasOwn(this.formData.enabledCurrencies, i)) {
let current = this.formData.enabledCurrencies[i];
if (current.code === code) {
currency = current;
@@ -34,7 +34,7 @@ export function determineAmountCurrency(code) {
this.formData.amountCurrency = list[0];
// this also forces the currency_code on ALL entries.
for (let i in this.entries) {
- if (this.entries.hasOwnProperty(i)) {
+ if (Object.hasOwn(this.entries, i)) {
this.entries[i].currency_code = code;
}
}
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 f774c6715b..2e1fa1cd98 100644
--- a/resources/assets/v3/js/pages/transactions/shared/load-budgets.js
+++ b/resources/assets/v3/js/pages/transactions/shared/load-budgets.js
@@ -33,7 +33,7 @@ export function loadBudgets(includeInactive) {
}];
for (let i in response.data.data) {
- if (response.data.data.hasOwnProperty(i)) {
+ if (Object.hasOwn(response.data.data, i)) {
let current = response.data.data[i];
if(true === current.attributes.active) {
let obj = {
diff --git a/resources/assets/v3/js/pages/transactions/shared/load-currencies.js b/resources/assets/v3/js/pages/transactions/shared/load-currencies.js
index abd034c7c3..89df756fb9 100644
--- a/resources/assets/v3/js/pages/transactions/shared/load-currencies.js
+++ b/resources/assets/v3/js/pages/transactions/shared/load-currencies.js
@@ -38,7 +38,7 @@ export function loadCurrencies() {
id: 0, name: '(no foreign currency)', code: '__NO_CODE__', default: false, symbol: '', decimal_places: 2,
});
for (let i in response.data.data) {
- if (response.data.data.hasOwnProperty(i)) {
+ if (Object.hasOwn(response.data.data, i)) {
let current = response.data.data[i];
if (current.attributes.enabled) {
let obj =
diff --git a/resources/assets/v3/js/pages/transactions/shared/load-link-types.js b/resources/assets/v3/js/pages/transactions/shared/load-link-types.js
index b03381a46c..664e8fb2a7 100644
--- a/resources/assets/v3/js/pages/transactions/shared/load-link-types.js
+++ b/resources/assets/v3/js/pages/transactions/shared/load-link-types.js
@@ -8,7 +8,7 @@ export function loadLinkTypes() {
return getter.list(params).then((response) => {
let set = [];
for (let i in response.data.data) {
- if (response.data.data.hasOwnProperty(i)) {
+ if (Object.hasOwn(response.data.data, i)) {
let current = response.data.data[i];
let entry = {
id: current.id,
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 1776211a85..175d4d7c96 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
@@ -35,14 +35,14 @@ export function loadPiggyBanks() {
};
for (let i in response.data.data) {
- if (response.data.data.hasOwnProperty(i)) {
+ 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 piggyBank = {
id: current.id, name: current.attributes.name, order: current.attributes.order,
};
- if (!piggyBanks.hasOwnProperty(objectGroupId)) {
+ if (!Object.hasOwn(piggyBanks, objectGroupId)) {
piggyBanks[objectGroupId] = {
id: objectGroupId,
name: objectGroupTitle,
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 3bdb1a5278..dd82f328ea 100644
--- a/resources/assets/v3/js/pages/transactions/shared/load-subscriptions.js
+++ b/resources/assets/v3/js/pages/transactions/shared/load-subscriptions.js
@@ -35,7 +35,7 @@ export function loadSubscriptions(includeInactive) {
}
};
for (let i in response.data.data) {
- if (response.data.data.hasOwnProperty(i)) {
+ 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)';
@@ -48,7 +48,7 @@ export function loadSubscriptions(includeInactive) {
// skip over inactive items.
continue;
}
- if (!subscriptions.hasOwnProperty(objectGroupId)) {
+ if (!Object.hasOwn(subscriptions, objectGroupId)) {
subscriptions[objectGroupId] = {
id: objectGroupId,
name: objectGroupTitle,
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 9348d62b47..fc702ef631 100644
--- a/resources/assets/v3/js/pages/transactions/shared/load-transaction-links.js
+++ b/resources/assets/v3/js/pages/transactions/shared/load-transaction-links.js
@@ -1,48 +1,48 @@
-
import Get from '../../../api/model/transaction/get.js';
+
export function loadTransactionLinks(index, journalId) {
console.log('Get transaction links for index #' + index + ' and journal #' + journalId);
(new Get).transactionLinks(journalId).then((data) => {
let links = data.data.data;
- for(let i = 0;i< links.length; i++) {
- if(links.hasOwnProperty(i)) {
+ for (let i = 0; i < links.length; i++) {
+ if (Object.hasOwn(links, i)) {
let current = links[i];
console.log(current);
console.log(this.formData.linkTypes);
let direction = parseInt(journalId) === parseInt(current.attributes.inward_id) ? 'inward' : 'outward';
let otherJournal = parseInt(current.attributes.inward_id)
- if(parseInt(journalId) === parseInt(current.attributes.inward_id)) {
+ 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 group = response.data.data;
let foundJournal = null;
- for(let j=0;j<group.attributes.transactions.length;j++) {
- if(group.attributes.transactions.hasOwnProperty(j)) {
+ for (let j = 0; j < group.attributes.transactions.length; j++) {
+ if (Object.hasOwn(group.attributes.transactions, j)) {
let journal = group.attributes.transactions[j];
- if(parseInt(journal.transaction_journal_id) === otherJournal) {
+ if (parseInt(journal.transaction_journal_id) === otherJournal) {
foundJournal = journal;
}
}
}
- if(null !== foundJournal) {
+ if (null !== foundJournal) {
console.log('showJournal');
- this.links[index].push(
- {
- id: parseInt(current.id),
- link_type: parseInt(current.attributes.link_type_id) + '_' + direction,
- link_type_id: parseInt(current.attributes.link_type_id),
- link_type_direction: direction,
- link_type_label: this.formData.linkTypes.find(link => link.id === parseInt(current.attributes.link_type_id))[direction],
- journal_id: parseInt(journalId),
- group_id: parseInt(group.id),
- journal_description: foundJournal.description,
- editMode: false,
- stored: false,
- }
- );
+ this.links[index].push(
+ {
+ id: parseInt(current.id),
+ link_type: parseInt(current.attributes.link_type_id) + '_' + direction,
+ link_type_id: parseInt(current.attributes.link_type_id),
+ link_type_direction: direction,
+ link_type_label: this.formData.linkTypes.find(link => link.id === parseInt(current.attributes.link_type_id))[direction],
+ journal_id: parseInt(journalId),
+ group_id: parseInt(group.id),
+ journal_description: foundJournal.description,
+ editMode: false,
+ stored: false,
+ }
+ );
}
- } );
+ });
}
diff --git a/resources/assets/v3/js/pages/transactions/shared/manage-locations.js b/resources/assets/v3/js/pages/transactions/shared/manage-locations.js
index 92fce38165..660574bb27 100644
--- a/resources/assets/v3/js/pages/transactions/shared/manage-locations.js
+++ b/resources/assets/v3/js/pages/transactions/shared/manage-locations.js
@@ -55,7 +55,7 @@ function addPointToMap(e) {
}
}
-function saveZoomOfMap(e) {
+function saveZoomOfMap() {
//let index = parseInt(e.sourceTarget._container.attributes['data-index'].value);
let index = 0;
const zoomEvent = new CustomEvent('location-zoom', {
diff --git a/resources/assets/v3/js/pages/transactions/shared/on-map-click.js b/resources/assets/v3/js/pages/transactions/shared/on-map-click.js
index 2f48101134..9c7cfd3639 100644
--- a/resources/assets/v3/js/pages/transactions/shared/on-map-click.js
+++ b/resources/assets/v3/js/pages/transactions/shared/on-map-click.js
@@ -41,7 +41,7 @@ export function onMapClick(event) {
this.entries[index].zoom_level = this.maps[index].getZoom();
// add marker.
- if(this.markers.hasOwnProperty(index)) {
+ if(Object.hasOwn(this.markers, index)) {
this.maps[index].removeLayer(this.markers[index]);
}
this.markers[index] = L.marker(event.latlng);
diff --git a/resources/assets/v3/js/pages/transactions/shared/on-map-zoom.js b/resources/assets/v3/js/pages/transactions/shared/on-map-zoom.js
index 37b1db7aa2..747d24c36f 100644
--- a/resources/assets/v3/js/pages/transactions/shared/on-map-zoom.js
+++ b/resources/assets/v3/js/pages/transactions/shared/on-map-zoom.js
@@ -19,10 +19,6 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
-import L from 'leaflet';
-import markerIcon from "leaflet/dist/images/marker-icon.png";
-import markerRetinaIcon from "leaflet/dist/images/marker-icon-2x.png";
-import shadow from 'leaflet/dist/images/marker-shadow.png';
export function onMapZoom(event) {
let index = parseInt(event.target._container.dataset.index);
this.entries[index].zoom_level = this.maps[index].getZoom();
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 9776b48acc..f2572bec07 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
@@ -24,7 +24,7 @@ import {format} from "date-fns";
export function parseDownloadedSplits(downloads, groupId) {
let returnArray = [];
for (let i in downloads) {
- if (downloads.hasOwnProperty(i)) {
+ if (Object.hasOwn(downloads, i)) {
// we have at least all default values!
let download = downloads[i];
let current = createEmptySplit();
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 c5820c6528..61a1df6442 100644
--- a/resources/assets/v3/js/pages/transactions/shared/parse-errors.js
+++ b/resources/assets/v3/js/pages/transactions/shared/parse-errors.js
@@ -29,7 +29,7 @@ export function parseErrors(data) {
this.formStates.isSubmitting = false;
this.notifications.error.text = this.i18next.t('firefly.errors_submission_v2', {errorMessage: data.message});
- if (data.hasOwnProperty('errors')) {
+ if (Object.hasOwn(data, 'errors')) {
this.entries = spliceErrorsIntoTransactions(data.errors, this.entries);
}
}
diff --git a/resources/assets/v3/js/pages/transactions/shared/parse-from-entries.js b/resources/assets/v3/js/pages/transactions/shared/parse-from-entries.js
index cd60192d36..25ab922a93 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
@@ -28,9 +28,9 @@ export function parseFromEntries(entries, originals, transactionType) {
const entry = entries[i];
let compare = false;
let original = {};
- if (originals !== null && originals.hasOwnProperty(i)) {
+ if (originals !== null && Object.hasOwn(originals, i)) {
compare = true;
- let original = originals[i];
+ // let original = originals[i];
}
let current = {};
diff --git a/resources/views/recurring/create.blade.php b/resources/views/recurring/create.blade.php
index 0d51003a31..59baed5d3a 100644
--- a/resources/views/recurring/create.blade.php
+++ b/resources/views/recurring/create.blade.php
@@ -29,7 +29,9 @@
<div class="input-group has-validation">
<label for="inputEmail3" class="col-sm-3 col-form-label">{{ trans('form.calendar') }}</label>
<div class="col-sm-9">
- <button class="btn btn-outline-secondary" type="button" id="calendar-link">{{ __('firefly.click_for_calendar') }}</button>
+ <button
+ data-bs-toggle="modal" data-bs-target="#calendarModal"
+ class="btn btn-outline-secondary" type="button" id="calendar-link">{{ __('firefly.click_for_calendar') }}</button>
</div>
</div>
</div>
diff --git a/resources/views/recurring/edit.blade.php b/resources/views/recurring/edit.blade.php
index 57c0a50203..301a5e69c8 100644
--- a/resources/views/recurring/edit.blade.php
+++ b/resources/views/recurring/edit.blade.php
@@ -31,7 +31,9 @@
<div class="input-group has-validation">
<label for="inputEmail3" class="col-sm-3 col-form-label">{{ trans('form.calendar') }}</label>
<div class="col-sm-9">
- <button class="btn btn-outline-secondary" type="button" id="calendar-link">{{ __('firefly.click_for_calendar') }}</button>
+ <button
+ data-bs-toggle="modal" data-bs-target="#calendarModal"
+ class="btn btn-outline-secondary" type="button" id="calendar-link">{{ __('firefly.click_for_calendar') }}</button>
</div>
</div>
</div>