Fix various issues and remove debug comments.

This commit is contained in:
James Cole 2021-12-10 16:42:02 +01:00
parent 219c3c11f9
commit f32bdd6c76
No known key found for this signature in database
GPG Key ID: BDE6667570EADBD5
22 changed files with 240 additions and 145 deletions

View File

@ -275,8 +275,8 @@ export default {
this.hasAttachments = false; this.hasAttachments = false;
}, },
uploadedAttachments: function (e) { uploadedAttachments: function (e) {
console.log('Response to event uploaded-attachments'); // console.log('Response to event uploaded-attachments');
console.log(e); // console.log(e);
this.finishSubmission(); this.finishSubmission();
}, },
submitForm: function (e) { submitForm: function (e) {

View File

@ -177,13 +177,9 @@
import {mapGetters, mapMutations} from "vuex"; import {mapGetters, mapMutations} from "vuex";
import Sortable from "sortablejs"; import Sortable from "sortablejs";
import format from "date-fns/format"; import format from "date-fns/format";
// import {setup} from 'axios-cache-adapter';
// import {cacheAdapterEnhancer} from 'axios-extensions';
import {configureAxios} from "../../shared/forageStore"; import {configureAxios} from "../../shared/forageStore";
// get all and cache, dont keep the table busy.
export default { export default {
name: "Index", name: "Index",
props: { props: {

View File

@ -80,8 +80,8 @@
<script> <script>
import TransactionListLarge from "../transactions/TransactionListLarge"; import TransactionListLarge from "../transactions/TransactionListLarge";
import format from "date-fns/format";
import {mapGetters} from "vuex"; import {mapGetters} from "vuex";
import format from "date-fns/format";
import {configureAxios} from "../../shared/forageStore"; import {configureAxios} from "../../shared/forageStore";
export default { export default {
@ -147,32 +147,36 @@ export default {
this.updatePageTitle(); this.updatePageTitle();
}, },
getTransactions: function () { getTransactions: function () {
// console.log('getTransactions()');
if (this.showReady && !this.loading) { if (this.showReady && !this.loading) {
// console.log('Show ready, not loading, go for download');
this.loading = true; this.loading = true;
this.rawTransactions = [];
configureAxios().then(async (api) => { configureAxios().then(async (api) => {
// console.log('Now getTransactions() x Start'); // console.log('Now getTransactions() x Start');
let startStr = format(this.start, 'y-MM-dd'); let startStr = format(this.start, 'y-MM-dd');
let endStr = format(this.end, 'y-MM-dd'); let endStr = format(this.end, 'y-MM-dd');
this.rawTransactions = []; let url = './api/v1/accounts/' + this.accountId + '/transactions?page=' + this.currentPage + '&limit=' + this.perPage + '&start=' + startStr + '&end=' + endStr + '&cache=' + this.cacheKey;
let url = './api/v1/accounts/' + this.accountId + '/transactions?page=1&limit=' + this.perPage + '&start=' + startStr + '&end=' + endStr + '&cache=' + this.cacheKey;
api.get(url) api.get(url)
.then(response => { .then(response => {
// console.log('Now getTransactions() DONE!'); // console.log('Now getTransactions() DONE!');
this.total = parseInt(response.data.meta.pagination.total); this.total = parseInt(response.data.meta.pagination.total);
let transactions = response.data.data;
// console.log('Have downloaded ' + transactions.length + ' transactions');
// console.log(response.data);
this.rawTransactions = response.data.data; this.rawTransactions = response.data.data;
this.loading = false; this.loading = false;
} }
); );
}); });
} }
}, },
jumpToPage: function (event) { jumpToPage: function (event) {
// console.log('noticed a change!'); // console.log('noticed a change in account/show!');
this.currentPage = event.page; this.currentPage = event.page;
this.downloadTransactionList(event.page); this.getTransactions();
}, },
}, },
watch: { watch: {

View File

@ -23,93 +23,131 @@
<Alert :message="errorMessage" type="danger"/> <Alert :message="errorMessage" type="danger"/>
<Alert :message="successMessage" type="success"/> <Alert :message="successMessage" type="success"/>
<form @submit="submitForm" autocomplete="off"> <form @submit="submitForm" autocomplete="off">
<div class="row"> <div class="col">
<div class="col-xl-6 col-lg-6 col-md-12 col-sm-12 col-xs-12"> <!-- tabs -->
<div class="card card-primary"> <ul class="nav nav-tabs ml-auto p-2" id="subscriptionTabs">
<div class="card-header"> <li>
<h3 class="card-title"> <li class="nav-item"><a class="nav-link active" href="#subscription" data-toggle="pill">
{{ $t('firefly.mandatoryFields') }} Subscription
</h3> </a>
</div> </li>
<div class="card-body"> <li>
<GenericTextInput :disabled="submitting" v-model="name" field-name="name" :errors="errors.name" :title="$t('form.name')" <li class="nav-item"><a class="nav-link" href="#rule" data-toggle="pill">
v-on:set-field="storeField($event)"/> Rule
<GenericCurrency :disabled="submitting" v-model="currency_id" :errors="errors.currency_id" v-on:set-field="storeField($event)"/> </a>
</li>
<GenericTextInput :disabled="submitting" field-type="number" field-step="any" v-model="amount_min" </ul>
field-name="amount_min" :errors="errors.amount_min" :title="$t('form.amount_min')" v-on:set-field="storeField($event)"/>
<GenericTextInput :disabled="submitting" field-type="number" field-step="any" v-model="amount_max"
field-name="amount_max" :errors="errors.amount_max" :title="$t('form.amount_max')" v-on:set-field="storeField($event)"/>
<GenericTextInput :disabled="submitting" field-type="date" v-model="date" field-name="date"
:errors="errors.date" :title="$t('form.startdate')" v-on:set-field="storeField($event)"/>
<GenericTextInput :disabled="submitting" field-type="date" v-model="end_date" field-name="end_date"
:errors="errors.end_date" :title="$t('form.end_date')" v-on:set-field="storeField($event)"/>
<GenericTextInput :disabled="submitting" field-type="date" v-model="extension_date" field-name="extension_date"
:errors="errors.extension_date" :title="$t('form.extension_date')" v-on:set-field="storeField($event)"/>
<RepeatFrequencyPeriod :disabled="submitting" v-model="repeat_freq" :errors="errors.repeat_freq"
v-on:set-field="storeField($event)"/>
</div>
</div>
</div>
<div class="col-xl-6 col-lg-6 col-md-12 col-sm-12 col-xs-12">
<div class="card">
<div class="card-header">
<h3 class="card-title">
{{ $t('firefly.optionalFields') }}
</h3>
</div>
<div class="card-body">
<GenericTextarea :disabled="submitting" field-name="notes" :title="$t('form.notes')" v-model="notes" :errors="errors.notes"
v-on:set-field="storeField($event)"/>
<GenericAttachments :disabled="submitting" :title="$t('form.attachments')" field-name="attachments" :errors="errors.attachments"
v-on:selected-attachments="selectedAttachments($event)"
v-on:selected-no-attachments="selectedNoAttachments($event)"
v-on:uploaded-attachments="uploadedAttachments($event)"
:upload-trigger="uploadTrigger"
:upload-object-type="uploadObjectType"
:upload-object-id="uploadObjectId"
/>
<GenericTextInput :disabled="submitting" v-model="skip" field-name="skip" :errors="errors.skip" :title="$t('form.skip')"
v-on:set-field="storeField($event)"/>
<GenericGroup :disabled="submitting" v-model="group_title" field-name="group_title" :errors="errors.group_title" :title="$t('form.object_group')"
v-on:set-field="storeField($event)"/>
</div>
</div>
</div>
</div> </div>
<div class="row"> <div class="tab-content" id="subscriptionTabContent">
<div class="col-xl-6 col-lg-6 col-md-12 col-sm-12 col-xs-12 offset-xl-6 offset-lg-6"> <div class="tab-pane show active" id="subscription" role="tabpanel" aria-labelledby="subscription-tab">
<div class="card"> <div class="row">
<div class="card-body"> <div class="col-xl-6 col-lg-6 col-md-12 col-sm-12 col-xs-12">
<div class="row"> <div class="card card-primary">
<div class="col-lg-6 offset-lg-6"> <div class="card-header">
<button :disabled=submitting type="button" @click="submitForm" class="btn btn-success btn-block">{{ <h3 class="card-title">
$t('firefly.store_new_bill') {{ $t('firefly.mandatoryFields') }}
}} </h3>
</button> </div>
<div class="form-check"> <div class="card-body">
<input id="createAnother" v-model="createAnother" class="form-check-input" type="checkbox"> <GenericTextInput :disabled="submitting" v-model="name" field-name="name" :errors="errors.name" :title="$t('form.name')"
<label class="form-check-label" for="createAnother"> v-on:set-field="storeField($event)"/>
<span class="small">{{ $t('firefly.create_another') }}</span> <GenericCurrency :disabled="submitting" v-model="currency_id" :errors="errors.currency_id" v-on:set-field="storeField($event)"/>
</label>
</div> <GenericTextInput :disabled="submitting" field-type="number" field-step="any" v-model="amount_min"
<div class="form-check"> field-name="amount_min" :errors="errors.amount_min" :title="$t('form.amount_min')" v-on:set-field="storeField($event)"/>
<input id="resetFormAfter" v-model="resetFormAfter" :disabled="!createAnother" class="form-check-input" type="checkbox">
<label class="form-check-label" for="resetFormAfter"> <GenericTextInput :disabled="submitting" field-type="number" field-step="any" v-model="amount_max"
<span class="small">{{ $t('firefly.reset_after') }}</span> field-name="amount_max" :errors="errors.amount_max" :title="$t('form.amount_max')" v-on:set-field="storeField($event)"/>
</label>
<GenericTextInput :disabled="submitting" field-type="date" v-model="date" field-name="date"
:errors="errors.date" :title="$t('form.startdate')" v-on:set-field="storeField($event)"/>
<GenericTextInput :disabled="submitting" field-type="date" v-model="end_date" field-name="end_date"
:errors="errors.end_date" :title="$t('form.end_date')" v-on:set-field="storeField($event)"/>
<GenericTextInput :disabled="submitting" field-type="date" v-model="extension_date" field-name="extension_date"
:errors="errors.extension_date" :title="$t('form.extension_date')" v-on:set-field="storeField($event)"/>
<RepeatFrequencyPeriod :disabled="submitting" v-model="repeat_freq" :errors="errors.repeat_freq"
v-on:set-field="storeField($event)"/>
</div>
</div>
</div>
<div class="col-xl-6 col-lg-6 col-md-12 col-sm-12 col-xs-12">
<div class="card">
<div class="card-header">
<h3 class="card-title">
{{ $t('firefly.optionalFields') }}
</h3>
</div>
<div class="card-body">
<GenericTextarea :disabled="submitting" field-name="notes" :title="$t('form.notes')" v-model="notes" :errors="errors.notes"
v-on:set-field="storeField($event)"/>
<GenericAttachments :disabled="submitting" :title="$t('form.attachments')" field-name="attachments" :errors="errors.attachments"
v-on:selected-attachments="selectedAttachments($event)"
v-on:selected-no-attachments="selectedNoAttachments($event)"
v-on:uploaded-attachments="uploadedAttachments($event)"
:upload-trigger="uploadTrigger"
:upload-object-type="uploadObjectType"
:upload-object-id="uploadObjectId"
/>
<GenericTextInput :disabled="submitting" v-model="skip" field-name="skip" :errors="errors.skip" :title="$t('form.skip')"
v-on:set-field="storeField($event)"/>
<GenericGroup :disabled="submitting" v-model="group_title" field-name="group_title" :errors="errors.group_title"
:title="$t('form.object_group')"
v-on:set-field="storeField($event)"/>
</div>
</div>
</div>
</div>
<div class="row">
<div class="col-xl-6 col-lg-6 col-md-12 col-sm-12 col-xs-12 offset-xl-6 offset-lg-6">
<div class="card">
<div class="card-body">
<div class="row">
<div class="col-lg-6 offset-lg-6">
<button :disabled=submitting type="button" @click="submitForm" class="btn btn-success btn-block">{{
$t('firefly.store_new_bill')
}}
</button>
<div class="form-check">
<input id="createAnother" v-model="createAnother" class="form-check-input" type="checkbox">
<label class="form-check-label" for="createAnother">
<span class="small">{{ $t('firefly.create_another') }}</span>
</label>
</div>
<div class="form-check">
<input id="resetFormAfter" v-model="resetFormAfter" :disabled="!createAnother" class="form-check-input" type="checkbox">
<label class="form-check-label" for="resetFormAfter">
<span class="small">{{ $t('firefly.reset_after') }}</span>
</label>
</div>
</div>
</div> </div>
</div> </div>
</div> </div>
</div> </div>
</div> </div>
</div> </div>
<div class="tab-pane show" id="rule" role="tabpanel" aria-labelledby="rule-tab">
<div class="row">
<div class="col-xl-6 col-lg-6 col-md-12 col-sm-12 col-xs-12">
<div class="card card-primary">
<div class="card-header">
<h3 class="card-title">
Title
</h3>
</div>
<div class="card-body">
<p>
In the future here you can set rule info for the new subscription.
</p>
</div>
</div>
</div>
</div>
</div>
</div> </div>
</form> </form>
</div> </div>
@ -226,7 +264,7 @@ export default {
this.uploadObjectId = this.returnedId; this.uploadObjectId = this.returnedId;
this.uploadTrigger = true; this.uploadTrigger = true;
} }
if(!this.hasAttachments) { if (!this.hasAttachments) {
this.finishSubmission(); this.finishSubmission();
} }
}) })
@ -236,10 +274,10 @@ export default {
// display errors! // display errors!
}); });
}, },
uploadedAttachments: function(e) { uploadedAttachments: function (e) {
this.finishSubmission(); this.finishSubmission();
}, },
finishSubmission: function() { finishSubmission: function () {
this.successMessage = this.$t('firefly.stored_new_bill_js', {ID: this.returnedId, name: this.returnedTitle}); this.successMessage = this.$t('firefly.stored_new_bill_js', {ID: this.returnedId, name: this.returnedTitle});
// stay here is false? // stay here is false?
if (false === this.createAnother) { if (false === this.createAnother) {

View File

@ -269,10 +269,10 @@ export default {
}; };
}, },
downloadBills: function (page) { downloadBills: function (page) {
console.log('downloadBills'); // console.log('downloadBills');
console.log(this.indexReady); // console.log(this.indexReady);
console.log(this.loading); // console.log(this.loading);
console.log(this.downloaded); // console.log(this.downloaded);
this.resetGroups(); this.resetGroups();
// console.log('getAccountList()'); // console.log('getAccountList()');
if (this.indexReady && !this.loading && !this.downloaded) { if (this.indexReady && !this.loading && !this.downloaded) {

View File

@ -215,16 +215,16 @@ export default {
let pctOrange = 0; let pctOrange = 0;
let pctRed = 0; let pctRed = 0;
//console.log('Collected "' + period + '" budget limit #' + currentId + ' (part of budget #' + budgetId + ')'); //console.log('Collected "' + period + '" budget limit #' + currentId + ' (part of budget #' + budgetId + ')');
console.log('Spent ' + spentFloatPos + ' of ' + amount); // console.log('Spent ' + spentFloatPos + ' of ' + amount);
// remove budget info from rawBudgets if it's there: // remove budget info from rawBudgets if it's there:
this.filterBudgets(budgetId, currencyId); this.filterBudgets(budgetId, currencyId);
let name = this.budgets[current.attributes.budget_id].name; let name = this.budgets[current.attributes.budget_id].name;
// spent within budget: // spent within budget:
if (0.0 !== spentFloat && spentFloatPos < amount) { if (0.0 !== spentFloat && spentFloatPos < amount) {
console.log('Spent ' + name + ' in budget'); // console.log('Spent ' + name + ' in budget');
pctGreen = (spentFloatPos / amount) * 100; pctGreen = (spentFloatPos / amount) * 100;
console.log('pctGreen is ' + pctGreen); // console.log('pctGreen is ' + pctGreen);
} }
// spent over budget // spent over budget

View File

@ -97,22 +97,22 @@ export default {
// }); // });
// new code // new code
console.log('start of new'); // console.log('start of new');
let files = this.$refs.att.files; let files = this.$refs.att.files;
this.uploads = files.length; this.uploads = files.length;
// loop all files and create attachments. // loop all files and create attachments.
for (let i in files) { for (let i in files) {
if (files.hasOwnProperty(i) && /^0$|^[1-9]\d*$/.test(i) && i <= 4294967294) { if (files.hasOwnProperty(i) && /^0$|^[1-9]\d*$/.test(i) && i <= 4294967294) {
console.log('Now at file ' + (parseInt(i) + 1) + ' / ' + files.length); // console.log('Now at file ' + (parseInt(i) + 1) + ' / ' + files.length);
// read file into file reader: // read file into file reader:
let current = files[i]; let current = files[i];
let fileReader = new FileReader(); let fileReader = new FileReader();
let theParent = this; // dont ask me why i need to do this. let theParent = this; // dont ask me why i need to do this.
fileReader.onloadend = evt => { fileReader.onloadend = evt => {
if (evt.target.readyState === FileReader.DONE) { if (evt.target.readyState === FileReader.DONE) {
console.log('I am done reading file ' + (parseInt(i) + 1)); // console.log('I am done reading file ' + (parseInt(i) + 1));
this.createAttachment(current.name).then(response => { this.createAttachment(current.name).then(response => {
console.log('Created attachment. Now upload (1)'); // console.log('Created attachment. Now upload (1)');
return theParent.uploadAttachment(response.data.data.id, new Blob([evt.target.result])); return theParent.uploadAttachment(response.data.data.id, new Blob([evt.target.result]));
}).then(theParent.countAttachment); }).then(theParent.countAttachment);
} }
@ -121,7 +121,7 @@ export default {
} }
} }
if (0 === files.length) { if (0 === files.length) {
console.log('No files to upload. Emit event!'); // console.log('No files to upload. Emit event!');
this.$emit('uploaded-attachments', this.transaction_journal_id); this.$emit('uploaded-attachments', this.transaction_journal_id);
} }
// Promise.all(promises).then(response => { // Promise.all(promises).then(response => {
@ -138,15 +138,15 @@ export default {
methods: { methods: {
countAttachment: function () { countAttachment: function () {
this.uploaded++; this.uploaded++;
console.log('Uploaded ' + this.uploaded + ' / ' + this.uploads); // console.log('Uploaded ' + this.uploaded + ' / ' + this.uploads);
if (this.uploaded >= this.uploads) { if (this.uploaded >= this.uploads) {
console.log('All files uploaded. Emit event for ' + this.uploadObjectId); // console.log('All files uploaded. Emit event for ' + this.uploadObjectId);
this.$emit('uploaded-attachments', this.uploadObjectId); this.$emit('uploaded-attachments', this.uploadObjectId);
} }
}, },
uploadAttachment: function (attachmentId, data) { uploadAttachment: function (attachmentId, data) {
this.created++; this.created++;
console.log('Now in uploadAttachment()'); // console.log('Now in uploadAttachment()');
const uploadUri = './api/v1/attachments/' + attachmentId + '/upload'; const uploadUri = './api/v1/attachments/' + attachmentId + '/upload';
return axios.post(uploadUri, data) return axios.post(uploadUri, data)
}, },

View File

@ -20,7 +20,7 @@
const lodashClonedeep = require('lodash.clonedeep'); const lodashClonedeep = require('lodash.clonedeep');
import {getDefaultTransaction, getDefaultErrors} from '../../../../shared/transactions'; import {getDefaultErrors, getDefaultTransaction} from '../../../../shared/transactions';
// initial state // initial state
const state = () => ({ const state = () => ({
@ -100,6 +100,7 @@ const mutations = {
state.transactions[payload.index].errors = lodashClonedeep(state.defaultErrors); state.transactions[payload.index].errors = lodashClonedeep(state.defaultErrors);
}, },
resetTransactions(state) { resetTransactions(state) {
// console.log('Store: Record call to resetTransactions :(');
state.transactions = []; state.transactions = [];
}, },
setGroupTitle(state, payload) { setGroupTitle(state, payload) {
@ -109,12 +110,13 @@ const mutations = {
state.customDateFields = payload; state.customDateFields = payload;
}, },
deleteTransaction(state, payload) { deleteTransaction(state, payload) {
// console.log('Record call to deleteTransaction!');
state.transactions.splice(payload.index, 1); state.transactions.splice(payload.index, 1);
// console.log('Deleted transaction ' + payload.index); // console.log('Deleted transaction ' + payload.index);
// console.log(state.transactions); // console.log(state.transactions);
if (0 === state.transactions.length) { // if (0 === state.transactions.length) {
// console.log('array is empty!'); // console.log('array is empty!');
} // }
}, },
setTransactionType(state, transactionType) { setTransactionType(state, transactionType) {
state.transactionType = transactionType; state.transactionType = transactionType;

View File

@ -221,7 +221,7 @@ export default {
] ]
), ),
addTransactionArray: function (event) { addTransactionArray: function (event) {
console.log('Record call to addTransactionArray'); // console.log('Record call to addTransactionArray');
event.preventDefault(); event.preventDefault();
this.addTransaction(); this.addTransaction();
}, },
@ -229,8 +229,8 @@ export default {
* Removes a split from the array. * Removes a split from the array.
*/ */
removeTransaction: function (payload) { removeTransaction: function (payload) {
console.log('Record call to removeTransaction'); // console.log('Record call to removeTransaction');
console.log('Triggered to remove transaction ' + payload.index); // console.log('Triggered to remove transaction ' + payload.index);
window.$('#tab_split_' + (payload.index - 1)).click(); window.$('#tab_split_' + (payload.index - 1)).click();
this.$store.commit('transactions/create/deleteTransaction', payload); this.$store.commit('transactions/create/deleteTransaction', payload);
}, },

View File

@ -153,7 +153,7 @@ export default {
this.getTransactionList(); this.getTransactionList();
}, },
jumpToPage: function (event) { jumpToPage: function (event) {
console.log('noticed a change in transactions/index.vue!'); // console.log('noticed a change in transactions/index.vue!');
this.currentPage = event.page; this.currentPage = event.page;
this.downloadTransactionList(event.page); this.downloadTransactionList(event.page);
}, },

View File

@ -209,6 +209,7 @@
<TransactionTags <TransactionTags
v-model="transaction.tags" v-model="transaction.tags"
v-on="$listeners" v-on="$listeners"
ref="tags"
:errors="transaction.errors.tags" :errors="transaction.errors.tags"
:index="index" :index="index"
/> />
@ -381,12 +382,13 @@ export default {
methods: { methods: {
removeTransaction: function () { removeTransaction: function () {
// console.log('Will remove transaction ' + this.index); // console.log('Will remove transaction ' + this.index);
this.$emit('remove-transaction', {index: this.index}); this.$emit('remove-transaction', {index: this.index});
}, },
triggerNextAccount: function(e) { triggerNextAccount: function(e) {
//alert(e); //alert(e);
if('source' === e) { if('source' === e) {
console.log('Jump to destination!'); // console.log('Jump to destination!');
this.$refs.destinationAccount.giveFocus(); this.$refs.destinationAccount.giveFocus();
} }
} }

View File

@ -19,17 +19,22 @@
--> -->
<template> <template>
<div v-if="transactions.length > 1" class="row"> <div>
<div class="col"> <span>Length: {{ this.transactions.length }}</span>
<!-- tabs -->
<ul class="nav nav-pills ml-auto p-2" id="transactionTabs"> <div v-if="transactions.length > 1" class="row">
<li v-for="(transaction, index) in this.transactions" class="nav-item"><a :class="'nav-link' + (0 === index ? ' active' : '')" <div class="col">
:href="'#split_' + index" <!-- tabs -->
data-toggle="pill"> <ul class="nav nav-pills ml-auto p-2" id="transactionTabs">
<span v-if="'' !== transaction.description">{{ transaction.description }}</span> <li v-for="(transaction, index) in this.transactions" class="nav-item"><a :class="'nav-link' + (0 === index ? ' active' : '')"
<span v-if="'' === transaction.description">Split {{ index + 1 }}</span> :href="'#split_' + index"
</a></li> :id="'tab_split_' + index"
</ul> data-toggle="pill">
<span v-if="'' !== transaction.description">{{ transaction.description }}</span>
<span v-if="'' === transaction.description">Split {{ index + 1 }}</span>
</a></li>
</ul>
</div>
</div> </div>
</div> </div>
</template> </template>
@ -41,7 +46,7 @@ export default {
transactions: { transactions: {
type: Array, type: Array,
required: true, required: true,
default: function() { default: function () {
return []; return [];
} }
}, },

View File

@ -116,15 +116,22 @@ export default {
// console.log('TransactionAccount::created() direction=' + this.direction + ', type=' + this.transactionType + ' , name="' + this.accountName + '"'); // console.log('TransactionAccount::created() direction=' + this.direction + ', type=' + this.transactionType + ' , name="' + this.accountName + '"');
this.selectedAccountTrigger = true; this.selectedAccountTrigger = true;
}, },
mounted: function () {
this.$nextTick(function () {
if (0 === this.index) {
this.$refs.inputThing.$refs.input.tabIndex = 2;
}
})
},
methods: { methods: {
getACURL: function (types, query) { getACURL: function (types, query) {
return './api/v1/autocomplete/accounts?types=' + types.join(',') + '&query=' + query; return './api/v1/autocomplete/accounts?types=' + types.join(',') + '&query=' + query;
}, },
giveFocus: function() { giveFocus: function () {
console.log('I want focus! now OK: ' + this.direction + ' l: ' + this.accounts.length); //console.log('I want focus! now OK: ' + this.direction + ' l: ' + this.accounts.length);
//console.log(this.$refs.inputThing.$refs.input.value); //console.log(this.$refs.inputThing.$refs.input.value);
this.$refs.inputThing.$refs.input.focus(); this.$refs.inputThing.$refs.input.focus();
console.log(this.$refs.inputThing.isFocused); //console.log(this.$refs.inputThing.isFocused);
}, },
userSelectedAccount: function (event) { userSelectedAccount: function (event) {
// console.log('userSelectedAccount!'); // console.log('userSelectedAccount!');

View File

@ -69,11 +69,18 @@ export default {
this.transactionAmount = this.formatNumber(this.amount); this.transactionAmount = this.formatNumber(this.amount);
} }
}, },
mounted: function () {
this.$nextTick(function () {
if (0 === this.index) {
this.$refs.input.tabIndex = 3;
}
})
},
methods: { methods: {
formatNumber(str) { formatNumber(str) {
return parseFloat(str).toFixed(this.fractionDigits); return parseFloat(str).toFixed(this.fractionDigits);
}, },
giveFocus: function() { giveFocus: function () {
this.$refs.input.focus(); this.$refs.input.focus();
}, },
}, },

View File

@ -52,6 +52,11 @@ export default {
bill: this.value, bill: this.value,
} }
}, },
mounted: function () {
this.$nextTick(function () {
this.$refs.bill.tabIndex = 9;
})
},
created() { created() {
this.collectData(); this.collectData();
}, },

View File

@ -52,6 +52,11 @@ export default {
emitEvent: true emitEvent: true
} }
}, },
mounted: function () {
this.$nextTick(function () {
this.$refs.budget.tabIndex = 8;
})
},
created() { created() {
this.collectData(); this.collectData();
}, },

View File

@ -35,6 +35,7 @@
inputName="category[]" inputName="category[]"
@hit="selectedCategory = $event" @hit="selectedCategory = $event"
@input="lookupCategory" @input="lookupCategory"
ref="input"
> >
<template slot="append"> <template slot="append">
<div class="input-group-append"> <div class="input-group-append">
@ -64,7 +65,11 @@ export default {
category: this.value category: this.value
} }
}, },
mounted: function () {
this.$nextTick(function () {
this.$refs.input.$refs.input.tabIndex = 10;
})
},
created() { created() {
//console.log('Created category(' + this.index + ') "' + this.value + '"'); //console.log('Created category(' + this.index + ') "' + this.value + '"');
// initial list of accounts: // initial list of accounts:

View File

@ -67,7 +67,14 @@ export default {
let parts = this.date.split('T'); let parts = this.date.split('T');
this.dateStr = parts[0]; this.dateStr = parts[0];
this.timeStr = parts[1]; this.timeStr = parts[1];
},
mounted: function () {
if (0 === this.index) {
this.$nextTick(function () {
this.$refs.date.tabIndex = 6;
this.$refs.time.tabIndex = 7;
});
}
}, },
data() { data() {
return { return {

View File

@ -31,6 +31,7 @@
autocomplete="off" autocomplete="off"
name="foreign_amount[]" name="foreign_amount[]"
type="number" type="number"
ref="input"
> >
</div> </div>
<span v-if="errors.length > 0"> <span v-if="errors.length > 0">
@ -66,6 +67,11 @@ export default {
this.amount = this.formatNumber(this.amount); this.amount = this.formatNumber(this.amount);
} }
}, },
mounted: function () {
this.$nextTick(function () {
this.$refs.input.tabIndex = 5;
})
},
methods: { methods: {
formatNumber(str) { formatNumber(str) {
return parseFloat(str).toFixed(this.fractionDigits); return parseFloat(str).toFixed(this.fractionDigits);

View File

@ -23,7 +23,7 @@
<div v-if="isVisible" class="form-group"> <div v-if="isVisible" class="form-group">
<div class="text-xs">&nbsp;</div> <div class="text-xs">&nbsp;</div>
<div class="input-group"> <div class="input-group">
<select v-model="selectedCurrency" class="form-control" name="foreign_currency_id[]"> <select v-model="selectedCurrency" class="form-control" ref="input" name="foreign_currency_id[]">
<option v-for="currency in selectableCurrencies" :label="currency.name" :value="currency.id">{{ currency.name }}</option> <option v-for="currency in selectableCurrencies" :label="currency.name" :value="currency.id">{{ currency.name }}</option>
</select> </select>
</div> </div>
@ -77,6 +77,11 @@ export default {
// console.log('Created TransactionForeignCurrency'); // console.log('Created TransactionForeignCurrency');
this.getAllCurrencies(); this.getAllCurrencies();
}, },
mounted: function () {
this.$nextTick(function () {
this.$refs.input.tabIndex = 4;
})
},
methods: { methods: {
lockCurrency: function () { lockCurrency: function () {
// console.log('Lock currency (' + this.transactionType + ')'); // console.log('Lock currency (' + this.transactionType + ')');

View File

@ -225,12 +225,12 @@ export default {
this.$emit('jump-page', {page: value}); this.$emit('jump-page', {page: value});
}, },
entries: function (value) { entries: function (value) {
console.log('detected new transactions! (' + value.length + ')'); // console.log('detected new transactions! (' + value.length + ')');
this.parseTransactions(); this.parseTransactions();
}, },
value: function (value) { // value: function (value) {
console.log('Watch value!'); // // console.log('Watch value!');
} // }
}, },
methods: { methods: {
...mapMutations('root', ['refreshCacheKey',]), ...mapMutations('root', ['refreshCacheKey',]),
@ -239,10 +239,10 @@ export default {
// console.log('Start of parseTransactions. Count of entries is ' + this.entries.length + ' and page is ' + this.page); // console.log('Start of parseTransactions. Count of entries is ' + this.entries.length + ' and page is ' + this.page);
// console.log('Reported total is ' + this.total); // console.log('Reported total is ' + this.total);
if (0 === this.entries.length) { if (0 === this.entries.length) {
console.log('Will not render now because length is 0.'); // console.log('Will not render now because length is 0.');
return; return;
} }
console.log('Now have ' + this.transactions.length + ' transactions'); // console.log('Now have ' + this.transactions.length + ' transactions');
for (let i = 0; i < this.total; i++) { for (let i = 0; i < this.total; i++) {
this.transactions.push({dummy: true, type: 'x'}); this.transactions.push({dummy: true, type: 'x'});
// console.log('Push dummy to index ' + i); // console.log('Push dummy to index ' + i);
@ -270,7 +270,7 @@ export default {
}, },
newCacheKey: function () { newCacheKey: function () {
this.refreshCacheKey(); this.refreshCacheKey();
console.log('Cache key is now ' + this.cacheKey); // console.log('Cache key is now ' + this.cacheKey);
this.$emit('refreshed-cache-key'); this.$emit('refreshed-cache-key');
}, },
updateFieldList: function () { updateFieldList: function () {

View File

@ -29,6 +29,7 @@
:add-only-from-autocomplete="false" :add-only-from-autocomplete="false"
:autocomplete-items="autocompleteItems" :autocomplete-items="autocompleteItems"
:tags="tags" :tags="tags"
ref="input"
:title="$t('firefly.tags')" :title="$t('firefly.tags')"
v-bind:placeholder="$t('firefly.tags')" v-bind:placeholder="$t('firefly.tags')"
@tags-changed="newTags => this.tags = newTags" @tags-changed="newTags => this.tags = newTags"