Fix model and add debug info.

This commit is contained in:
James Cole
2019-05-11 05:32:09 +02:00
parent c0029af929
commit fd28589395
11 changed files with 11796 additions and 28017 deletions

View File

@@ -46,6 +46,7 @@ class BankDebitCredit implements ConverterInterface
$negative = [ $negative = [
'D', // Old style Rabobank (NL). Short for "Debit" 'D', // Old style Rabobank (NL). Short for "Debit"
'A', // New style Rabobank (NL). Short for "Af" 'A', // New style Rabobank (NL). Short for "Af"
'DR', // https://old.reddit.com/r/FireflyIII/comments/bn2edf/generic_debitcredit_indicator/
'Af', // ING (NL). 'Af', // ING (NL).
'Debet', // Triodos (NL) 'Debet', // Triodos (NL)
]; ];

View File

@@ -89,22 +89,6 @@ return [
'incomeAndExpensesChart' => ['element' => '#incomeAndExpensesChart', 'position' => 'top'], 'incomeAndExpensesChart' => ['element' => '#incomeAndExpensesChart', 'position' => 'top'],
], ],
// transactions: create (also per type!)
'transactions_create' => [
'switch_box' => ['element' => '#switch-box'],
'ffInput_category' => ['element' => '#ffInput_category'],
],
'transactions_create_withdrawal' => [
'ffInput_budget' => ['element' => '#ffInput_budget_id'],
'currency_dropdown_amount' => ['element' => '#currency_dropdown_amount'],
],
'transactions_create_deposit' => [
'currency_dropdown_amount' => ['element' => '#currency_dropdown_amount'],
],
'transactions_create_transfer' => [
'ffInput_piggy_bank_id' => ['element' => '#ffInput_piggy_bank_id'],
],
// piggies: index, create, show // piggies: index, create, show
'piggy-banks_index' => [ 'piggy-banks_index' => [
'saved' => ['element' => '.piggySaved'], 'saved' => ['element' => '.piggySaved'],

15164
package-lock.json generated

File diff suppressed because it is too large Load Diff

24399
public/v1/js/app.js vendored

File diff suppressed because one or more lines are too long

View File

@@ -22,7 +22,8 @@
<div class="form-group"> <div class="form-group">
<label class="col-sm-4 control-label" ref="cur"></label> <label class="col-sm-4 control-label" ref="cur"></label>
<div class="col-sm-8"> <div class="col-sm-8">
<input type="number" step="any" class="form-control" name="amount[]" <input type="number" ref="amount" :value="value" @input="handleInput" step="any" class="form-control"
name="amount[]"
title="amount" autocomplete="off" placeholder="Amount"> title="amount" autocomplete="off" placeholder="Amount">
</div> </div>
</div> </div>
@@ -31,15 +32,18 @@
<script> <script>
export default { export default {
name: "Amount", name: "Amount",
props: ['source', 'destination', 'transactionType'], props: ['source', 'destination', 'transactionType','value'],
data() { data() {
return { return {
sourceAccount: this.source, sourceAccount: this.source,
destinationAccount: this.destination, destinationAccount: this.destination,
type: this.transactionType, type: this.transactionType
} }
}, },
methods: { methods: {
handleInput(e) {
this.$emit('input', this.$refs.amount.value);
},
changeData: function () { changeData: function () {
if ('' === this.transactionType) { if ('' === this.transactionType) {
$(this.$refs.cur).text(this.sourceAccount.currency_name); $(this.$refs.cur).text(this.sourceAccount.currency_name);

View File

@@ -21,8 +21,8 @@
<template> <template>
<div class="form-group" v-if="typeof this.transactionType !== 'undefined' && this.transactionType === 'Withdrawal'"> <div class="form-group" v-if="typeof this.transactionType !== 'undefined' && this.transactionType === 'Withdrawal'">
<div class="col-sm-12"> <div class="col-sm-12">
<select name="budget[]" class="form-control" v-if="this.budgets.length > 0"> <select name="budget[]" ref="budget" @input="handleInput" class="form-control" v-if="this.budgets.length > 0">
<option v-for="budget in this.budgets">{{budget.name}}</option> <option v-for="budget in this.budgets" :label="budget.name" :value="budget.id">{{budget.name}}</option>
</select> </select>
</div> </div>
</div> </div>
@@ -31,7 +31,7 @@
<script> <script>
export default { export default {
name: "Budget", name: "Budget",
props: ['transactionType'], props: ['transactionType','value'],
mounted() { mounted() {
this.loadBudgets(); this.loadBudgets();
}, },
@@ -41,6 +41,9 @@
} }
}, },
methods: { methods: {
handleInput(e) {
this.$emit('input', this.$refs.budget.value);
},
loadBudgets: function () { loadBudgets: function () {
let URI = document.getElementsByTagName('base')[0].href + "json/budgets"; let URI = document.getElementsByTagName('base')[0].href + "json/budgets";
axios.get(URI, {}).then((res) => { axios.get(URI, {}).then((res) => {

View File

@@ -24,6 +24,8 @@
<div class="input-group"> <div class="input-group">
<input <input
ref="input" ref="input"
:value="value"
@input="handleInput"
type="text" type="text"
placeholder="Category" placeholder="Category"
autocomplete="off" autocomplete="off"
@@ -57,6 +59,7 @@
export default { export default {
name: "Category", name: "Category",
props: { props: {
value: String,
inputName: String, inputName: String,
accountName: { accountName: {
type: String, type: String,
@@ -76,9 +79,16 @@
mounted() { mounted() {
this.target = this.$refs.input; this.target = this.$refs.input;
this.categoryAutoCompleteURI = document.getElementsByTagName('base')[0].href + "json/categories?query="; this.categoryAutoCompleteURI = document.getElementsByTagName('base')[0].href + "json/categories?query=";
//this.triggerTransactionType();
}, },
methods: { methods: {
handleInput(e) {
if (typeof this.$refs.input.value === 'string') {
this.$emit('input', this.$refs.input.value);
return;
}
this.$emit('input', this.$refs.input.value.name);
},
clearCategory: function () { clearCategory: function () {
//props.value = ''; //props.value = '';
this.name = ''; this.name = '';
@@ -92,6 +102,12 @@
// emit the fact that the user selected a type of account // emit the fact that the user selected a type of account
// (influencing the destination) // (influencing the destination)
this.$emit('select:category', this.name); this.$emit('select:category', this.name);
if (typeof this.name === 'string') {
this.$emit('input', this.name);
return;
}
this.$emit('input', this.name.name);
}, },
handleEnter: function (e) { handleEnter: function (e) {
// todo feels sloppy // todo feels sloppy

View File

@@ -19,7 +19,8 @@
--> -->
<template> <template>
<form method="POST" action="transactions/store" accept-charset="UTF-8" class="form-horizontal" id="store" enctype="multipart/form-data"> <form method="POST" action="transactions/store" accept-charset="UTF-8" class="form-horizontal" id="store"
enctype="multipart/form-data">
<input name="_token" type="hidden" value="xxx"> <input name="_token" type="hidden" value="xxx">
<div class="row" v-if="transactions.length > 1"> <div class="row" v-if="transactions.length > 1">
@@ -35,11 +36,13 @@
<div class="col-sm-12"> <div class="col-sm-12">
<input type="text" class="form-control" name="group_title" <input type="text" class="form-control" name="group_title"
v-model="group_title" v-model="group_title"
title="Description of the split transaction" autocomplete="off" placeholder="Description of the split transaction"> title="Description of the split transaction" autocomplete="off"
placeholder="Description of the split transaction">
<p class="help-block"> <p class="help-block">
If you create a split transaction, there must be a global description for all splits of the transaction. If you create a split transaction, there must be a global description for all splits
of the transaction.
</p> </p>
</div> </div>
</div> </div>
@@ -58,7 +61,8 @@
<span v-if="transactions.length === 1">Transaction information</span> <span v-if="transactions.length === 1">Transaction information</span>
</h3> </h3>
<div class="box-tools pull-right" v-if="transactions.length > 1" x> <div class="box-tools pull-right" v-if="transactions.length > 1" x>
<button v-on:click="deleteTransaction(index, $event)" class="btn btn-xs btn-danger"><i class="fa fa-trash"></i></button> <button v-on:click="deleteTransaction(index, $event)" class="btn btn-xs btn-danger"><i
class="fa fa-trash"></i></button>
</div> </div>
</div> </div>
<div class="box-body"> <div class="box-body">
@@ -114,19 +118,32 @@
<amount <amount
:source="transaction.source_account" :source="transaction.source_account"
:destination="transaction.destination_account" :destination="transaction.destination_account"
v-model="transaction.amount"
:transactionType="transactionType" :transactionType="transactionType"
></amount> ></amount>
<foreign-amount <foreign-amount
:source="transaction.source_account" :source="transaction.source_account"
:destination="transaction.destination_account" :destination="transaction.destination_account"
v-model="transaction.foreign_amount"
:transactionType="transactionType" :transactionType="transactionType"
></foreign-amount> ></foreign-amount>
</div> </div>
<div class="col-lg-4"> <div class="col-lg-4">
<budget :transactionType="transactionType"></budget> <budget
<category :transactionType="transactionType"></category> :transactionType="transactionType"
<piggy-bank :transactionType="transactionType"></piggy-bank> v-model="transaction.budget"
<tags></tags> ></budget>
<category
:transactionType="transactionType"
v-model="transaction.category"
></category>
<piggy-bank
:transactionType="transactionType"
v-model="transaction.piggy_bank"
></piggy-bank>
<tags
v-model="transaction.tags"
></tags>
<!-- custom string fields --> <!-- custom string fields -->
<custom-transaction-fields></custom-transaction-fields> <custom-transaction-fields></custom-transaction-fields>
@@ -140,6 +157,7 @@
</div> </div>
</div> </div>
</div> </div>
<pre>{{ $data }}</pre>
<div class="row"> <div class="row">
<div class="col-lg-12"> <div class="col-lg-12">
<p> <p>
@@ -167,7 +185,14 @@
description: "", description: "",
date: "", date: "",
amount: "", amount: "",
foreign_amount: "", category: "",
piggy_bank: 0,
budget: 0,
tags: [],
foreign_amount: {
amount: "",
currency_id: 0
},
source_account: { source_account: {
id: 0, id: 0,
name: "", name: "",

View File

@@ -21,12 +21,22 @@
<template> <template>
<div class="form-group"> <div class="form-group">
<div class="col-sm-4"> <div class="col-sm-4">
<select class="form-control" name="foreign_currency[]" v-if="this.enabledCurrencies.length > 0"> <select class="form-control" ref="currency_select" name="foreign_currency[]"
<option v-for="currency in this.enabledCurrencies" v-if="currency.enabled">{{ currency.name }}</option> v-if="this.enabledCurrencies.length > 0" @input="handleInput">
<option
v-for="currency in this.enabledCurrencies"
v-if="currency.enabled"
:value="currency.id"
:label="currency.name"
>
{{ currency.name }}
</option>
</select> </select>
</div> </div>
<div class="col-sm-8"> <div class="col-sm-8">
<input type="number" step="any" class="form-control" name="foreign_amount[]" v-if="this.enabledCurrencies.length > 0" <input type="number" @input="handleInput" ref="amount" :value="value.amount" step="any" class="form-control"
name="foreign_amount[]" v-if="this.enabledCurrencies.length > 0"
title="Foreign amount" autocomplete="off" placeholder="Foreign amount"> title="Foreign amount" autocomplete="off" placeholder="Foreign amount">
</div> </div>
</div> </div>
@@ -35,7 +45,7 @@
<script> <script>
export default { export default {
name: "ForeignAmountSelect", name: "ForeignAmountSelect",
props: ['source', 'destination', 'transactionType'], props: ['source', 'destination', 'transactionType', 'value'],
mounted() { mounted() {
this.loadCurrencies(); this.loadCurrencies();
}, },
@@ -58,6 +68,13 @@
} }
}, },
methods: { methods: {
handleInput(e) {
this.$emit('input', {
amount: +this.$refs.amount.value,
currency_id: this.$refs.currency_select.value,
}
);
},
changeData: function () { changeData: function () {
this.enabledCurrencies = []; this.enabledCurrencies = [];
if (this.transactionType === 'Transfer') { if (this.transactionType === 'Transfer') {

View File

@@ -21,8 +21,8 @@
<template> <template>
<div class="form-group" v-if="typeof this.transactionType !== 'undefined' && this.transactionType === 'Transfer'"> <div class="form-group" v-if="typeof this.transactionType !== 'undefined' && this.transactionType === 'Transfer'">
<div class="col-sm-12"> <div class="col-sm-12">
<select name="piggy_bank[]" class="form-control" v-if="this.piggies.length > 0"> <select name="piggy_bank[]" ref="piggy" @input="handleInput" class="form-control" v-if="this.piggies.length > 0">
<option v-for="piggy in this.piggies">{{piggy.name}}</option> <option v-for="piggy in this.piggies" :label="piggy.name" :value="piggy.id">{{piggy.name}}</option>
</select> </select>
</div> </div>
</div> </div>
@@ -31,7 +31,7 @@
<script> <script>
export default { export default {
name: "PiggyBank", name: "PiggyBank",
props: ['transactionType'], props: ['value','transactionType'],
mounted() { mounted() {
this.loadPiggies(); this.loadPiggies();
}, },
@@ -41,6 +41,9 @@
} }
}, },
methods: { methods: {
handleInput(e) {
this.$emit('input', this.$refs.piggy.value);
},
loadPiggies: function () { loadPiggies: function () {
let URI = document.getElementsByTagName('base')[0].href + "json/piggy-banks"; let URI = document.getElementsByTagName('base')[0].href + "json/piggy-banks";
axios.get(URI, {}).then((res) => { axios.get(URI, {}).then((res) => {

View File

@@ -42,7 +42,9 @@
name: "Tags", name: "Tags",
components: { components: {
VueTagsInput VueTagsInput
}, data() { },
props: ['value'],
data() {
return { return {
tag: '', tag: '',
tags: [], tags: [],
@@ -57,6 +59,7 @@
update(newTags) { update(newTags) {
this.autocompleteItems = []; this.autocompleteItems = [];
this.tags = newTags; this.tags = newTags;
this.$emit('input', this.tags);
}, },
initItems() { initItems() {
if (this.tag.length < 2) { if (this.tag.length < 2) {