This commit is contained in:
James Cole committed 2026-09-30 09:24:29 +02:00
1 parent 91bee03eb5
commit aa323d9633
6 files changed
+25 -11

No files matched your search

@@ -36,9 +36,6 @@ let index = function () {
anonymous: false,
loadingPiggyBanks: true,
init() {
console.log("I am translation");
console.log(i18next.t(format(new Date(), "d MMMM yyyy 'o' HH:mm")));
getVariable("anonymous").then((value) => {
let start = new Date(window.store.get("start"));
let end = new Date(window.store.get("end"));
@@ -336,7 +336,7 @@ let create = function () {
this.processUploadError(event);
});
document.addEventListener("upload-failed", (event) => {
console.log('Now in event listener "upload-failed"');
// console.log('Now in event listener "upload-failed"');
this.processUploadError(event);
});
},
@@ -345,7 +345,7 @@ let transactions = function () {
});
document.addEventListener("upload-failed", (event) => {
console.log('Now in event listener "upload-failed"');
// console.log('Now in event listener "upload-failed"');
this.processUploadError(event);
});
@@ -37,11 +37,10 @@ export function changeDescription(item, ac) {
}
export function changeDestinationAccount(item, ac) {
console.log("changeDestinationAccount", item, ac);
if (typeof item === "object") {
// changed account but did not select.
const index = parseInt(ac._searchInput.dataset.index);
console.log("changeDestinationAccount X", document.querySelector("#form"));
// console.log("[a] changeDestinationAccount("+index+")", document.querySelector("#form"));
document.querySelector("#form")._x_dataStack[0].$data.entries[index].destination_account = {
id: item.id,
name: item.name,
@@ -54,6 +53,7 @@ export function changeDestinationAccount(item, ac) {
}
if (typeof item === "undefined") {
const index = parseInt(ac._searchInput.dataset.index);
// console.log("[b]changeDestinationAccount("+index+")", document.querySelector("#form"));
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 + '"');
@@ -69,7 +69,7 @@ export function changeDestinationAccount(item, ac) {
export function selectDestinationAccount(item, ac) {
const index = parseInt(ac._searchInput.attributes["data-index"].value);
console.log("selectDestinationAccount", index);
// console.log("selectDestinationAccount("+index+")");
document.querySelector("#form")._x_dataStack[0].$data.entries[index].destination_account = {
id: item.id,
name: item.name,
@@ -78,7 +78,15 @@ export function selectDestinationAccount(item, ac) {
currency_code: item.currency_code,
account_currency_code: item.account_currency_code,
};
document.querySelector("#form")._x_dataStack[0].changedDestinationAccount();
// document.querySelector("#form")._x_dataStack[0].entries[index].destination_account = {
// id: item.id,
// name: item.name,
// alpine_name: item.name,
// type: item.type,
// currency_code: item.currency_code,
// account_currency_code: item.account_currency_code,
// };
document.querySelector("#form")._x_dataStack[0].changedDestinationAccount("selectDestinationAccount("+index+")");
}
export function changeSourceAccount(item, ac) {
@@ -120,5 +128,14 @@ export function selectSourceAccount(item, ac) {
currency_code: item.currency_code,
account_currency_code: item.account_currency_code,
};
// console.log('$data', document.querySelector("#form")._x_dataStack[0].$data);
// document.querySelector("#form")._x_dataStack[0].entries[index].source_account = {
// id: item.id,
// name: item.name,
// alpine_name: item.name,
// type: item.type,
// currency_code: item.currency_code,
// account_currency_code: item.account_currency_code,
// };
document.querySelector("#form")._x_dataStack[0].changedSourceAccount(index);
}
@@ -69,7 +69,7 @@ export function disableSplitInputs() {
// if is withdrawal, pre-fill the destination account with the first entry's destination account.
if ("withdrawal" === this.groupProperties.transactionType) {
this.entries[i].destination_account = this.entries[i - 1].destination_account;
this.entries[i].destination_account = JSON.parse(JSON.stringify(this.entries[i - 1].destination_account));//structuredClone();
}
// disable source when withdrawal or transfer
@@ -16,7 +16,7 @@
<input type="text"
:class="{'is-invalid': transaction.errors.destination_account.length > 0, 'form-control': true, 'ac-dest': true}"
:id="'dest_' + index"
x-model="transaction.destination_account.alpine_name"
x-model="entries[index].destination_account.alpine_name"
:data-index="index"
@keydown="keyUpFromDestination"
@changed="changedDestinationAccount"