This commit is contained in:
James Cole
2020-10-02 07:47:02 +02:00
parent 8eb6b5a364
commit 8c7e3b3731
8 changed files with 352 additions and 320 deletions

View File

@@ -52,7 +52,7 @@
}}</span>
<span v-if="transactions.length === 1">{{ $t('firefly.transaction_journal_information') }}</span>
</h3>
<div class="box-tools pull-right" v-if="transactions.length > 1" x>
<div class="box-tools pull-right" v-if="transactions.length > 1">
<button type="button" v-on:click="deleteTransaction(index, $event)" class="btn btn-xs btn-danger"><i
class="fa fa-trash"></i></button>
</div>
@@ -224,7 +224,7 @@
</div>
<div class="box-footer">
<div class="btn-group">
<button class="btn btn-success" @click="submit">{{ $t('firefly.update_transaction') }}</button>
<button class="btn btn-success" @click="submit" id="submitButton">{{ $t('firefly.update_transaction') }}</button>
</div>
</div>
</div>
@@ -664,6 +664,10 @@ export default {
return currentArray;
},
submit: function (e) {
let button = $('#submitButton');
button.prop("disabled", true);
const page = window.location.href.split('/');
const groupId = page[page.length - 1];
let uri = './api/v1/transactions/' + groupId + '?_token=' + document.head.querySelector('meta[name="csrf-token"]').content;
@@ -675,9 +679,6 @@ export default {
}
const data = this.convertData();
let button = $('#submitButton');
button.prop("disabled", true);
//axios.put(uri, data)
axios({
method: method,
@@ -840,6 +841,7 @@ export default {
addTransaction: function (e) {
this.transactions.push({
transaction_journal_id: 0,
description: "",
@@ -913,6 +915,17 @@ export default {
allowed_types: []
}
});
let count = this.transactions.length;
console.log('Transactions length = ' + count);
// also set accounts from previous entry, if present.
if(this.transactions.length > 1) {
console.log('Adding split.');
this.transactions[count-1].source_account = this.transactions[count-2].source_account;
this.transactions[count-1].destination_account = this.transactions[count-2].destination_account;
this.transactions[count-1].date = this.transactions[count-2].date;
}
console.log('Transactions length now = ' + this.transactions.length);
if (e) {
e.preventDefault();
}