Update translations + JS

This commit is contained in:
James Cole
2020-10-17 21:41:13 +02:00
parent a79f7e3b59
commit 937c11e83c
76 changed files with 1656 additions and 1603 deletions

View File

@@ -18,207 +18,207 @@
- along with this program. If not, see <https://www.gnu.org/licenses/>.
-->
<template>
<div class="form-group" v-bind:class="{ 'has-error': hasError()}">
<div class="col-sm-12 text-sm">
{{ inputDescription }}
</div>
<div class="col-sm-12">
<div class="input-group">
<input
ref="input"
type="text"
:placeholder="inputDescription"
:data-index="index"
autocomplete="off"
data-role="input"
v-on:keypress="handleEnter"
:disabled="inputDisabled"
class="form-control"
v-on:submit.prevent
:name="inputName"
:title="inputDescription">
<span class="input-group-btn">
<button
v-on:click="clearSource"
class="btn btn-default"
tabIndex="-1"
type="button"><i class="fa fa-trash-o"></i></button>
</span>
</div>
<typeahead
:open-on-empty=true
:open-on-focus=true
v-on:input="selectedItem"
:async-function="aSyncFunction"
v-model="name"
:target="target"
item-key="name_with_balance"
></typeahead>
<ul class="list-unstyled" v-for="error in this.error">
<li class="text-danger">{{ error }}</li>
</ul>
</div>
<div class="form-group" v-bind:class="{ 'has-error': hasError()}">
<div class="col-sm-12 text-sm">
{{ inputDescription }}
</div>
<div class="col-sm-12">
<div class="input-group">
<input
ref="input"
:data-index="index"
:disabled="inputDisabled"
:name="inputName"
:placeholder="inputDescription"
:title="inputDescription"
autocomplete="off"
class="form-control"
data-role="input"
type="text"
v-on:keypress="handleEnter"
v-on:submit.prevent>
<span class="input-group-btn">
<button
class="btn btn-default"
tabIndex="-1"
type="button"
v-on:click="clearSource"><i class="fa fa-trash-o"></i></button>
</span>
</div>
<typeahead
v-model="name"
:async-function="aSyncFunction"
:open-on-empty=true
:open-on-focus=true
:target="target"
item-key="name_with_balance"
v-on:input="selectedItem"
></typeahead>
<ul v-for="error in this.error" class="list-unstyled">
<li class="text-danger">{{ error }}</li>
</ul>
</div>
</div>
</template>
<script>
export default {
props: {
inputName: String,
inputDescription: String,
index: Number,
transactionType: String,
error: Array,
accountName: {
type: String,
default: ''
},
accountTypeFilters: {
type: Array,
default: function () {
return [];
}
},
defaultAccountTypeFilters: {
type: Array,
default: function () {
return [];
}
}
},
data() {
return {
accountAutoCompleteURI: null,
name: null,
trType: this.transactionType,
target: null,
inputDisabled: false,
allowedTypes: this.accountTypeFilters,
defaultAllowedTypes: this.defaultAccountTypeFilters
}
},
ready() {
// console.log('ready(): this.name = this.accountName (' + this.accountName + ')');
this.name = this.accountName;
},
mounted() {
this.target = this.$refs.input;
this.updateACURI(this.allowedTypes.join(','));
// console.log('mounted(): this.name = this.accountName (' + this.accountName + ')');
this.name = this.accountName;
this.triggerTransactionType();
},
watch: {
transactionType() {
this.triggerTransactionType();
},
accountName() {
// console.log('AccountSelect watch accountName!');
this.name = this.accountName;
},
accountTypeFilters() {
let types = this.accountTypeFilters.join(',');
if (0 === this.accountTypeFilters.length) {
types = this.defaultAccountTypeFilters.join(',');
}
this.updateACURI(types);
},
name() {
// console.log('Watch: name()');
// console.log(this.name);
}
},
methods:
{
aSyncFunction: function (query, done) {
axios.get(this.accountAutoCompleteURI + query)
.then(res => {
done(res.data);
})
.catch(err => {
// any error handler
})
},
updateACURI: function (types) {
this.accountAutoCompleteURI =
document.getElementsByTagName('base')[0].href +
'api/v1/autocomplete/accounts' +
'?types=' +
types +
'&query=';
// console.log('Auto complete URI is now ' + this.accountAutoCompleteURI);
},
hasError: function () {
return this.error.length > 0;
},
triggerTransactionType: function () {
// console.log('On triggerTransactionType(' + this.inputName + ')');
if(null === this.name) {
// console.log('this.name is NULL.');
}
if (null === this.transactionType) {
// console.log('Transaction type is NULL.');
return;
}
if ('' === this.transactionType) {
// console.log('Transaction type is "".');
return;
}
this.inputDisabled = false;
if (this.transactionType.toString() !== '' && this.index > 0) {
if (this.transactionType.toString().toLowerCase() === 'transfer') {
this.inputDisabled = true;
// todo: needs to copy value from very first input
return;
}
if (this.transactionType.toString().toLowerCase() === 'withdrawal' && this.inputName.substr(0, 6).toLowerCase() === 'source') {
// todo also clear value?
this.inputDisabled = true;
return;
}
if (this.transactionType.toString().toLowerCase() === 'deposit' && this.inputName.substr(0, 11).toLowerCase() === 'destination') {
// todo also clear value?
this.inputDisabled = true;
}
}
},
selectedItem: function (e) {
// console.log('In SelectedItem()');
if (typeof this.name === 'undefined') {
// console.log('Is undefined');
return;
}
if(typeof this.name === 'string') {
// console.log('Is a string.');
//this.trType = null;
this.$emit('clear:value');
}
// emit the fact that the user selected a type of account
// (influencing the destination)
// console.log('Is some object maybe:');
// console.log(this.name);
this.$emit('select:account', this.name);
},
clearSource: function (e) {
// console.log('clearSource()');
//props.value = '';
this.name = '';
// some event?
this.$emit('clear:value')
},
handleEnter: function (e) {
// todo feels sloppy
if (e.keyCode === 13) {
//e.preventDefault();
}
}
}
export default {
props: {
inputName: String,
inputDescription: String,
index: Number,
transactionType: String,
error: Array,
accountName: {
type: String,
default: ''
},
accountTypeFilters: {
type: Array,
default: function () {
return [];
}
},
defaultAccountTypeFilters: {
type: Array,
default: function () {
return [];
}
}
},
data() {
return {
accountAutoCompleteURI: null,
name: null,
trType: this.transactionType,
target: null,
inputDisabled: false,
allowedTypes: this.accountTypeFilters,
defaultAllowedTypes: this.defaultAccountTypeFilters
}
},
ready() {
// console.log('ready(): this.name = this.accountName (' + this.accountName + ')');
this.name = this.accountName;
},
mounted() {
this.target = this.$refs.input;
this.updateACURI(this.allowedTypes.join(','));
// console.log('mounted(): this.name = this.accountName (' + this.accountName + ')');
this.name = this.accountName;
this.triggerTransactionType();
},
watch: {
transactionType() {
this.triggerTransactionType();
},
accountName() {
// console.log('AccountSelect watch accountName!');
this.name = this.accountName;
},
accountTypeFilters() {
let types = this.accountTypeFilters.join(',');
if (0 === this.accountTypeFilters.length) {
types = this.defaultAccountTypeFilters.join(',');
}
this.updateACURI(types);
},
name() {
// console.log('Watch: name()');
// console.log(this.name);
}
},
methods:
{
aSyncFunction: function (query, done) {
axios.get(this.accountAutoCompleteURI + query)
.then(res => {
done(res.data);
})
.catch(err => {
// any error handler
})
},
updateACURI: function (types) {
this.accountAutoCompleteURI =
document.getElementsByTagName('base')[0].href +
'api/v1/autocomplete/accounts' +
'?types=' +
types +
'&query=';
// console.log('Auto complete URI is now ' + this.accountAutoCompleteURI);
},
hasError: function () {
return this.error.length > 0;
},
triggerTransactionType: function () {
// console.log('On triggerTransactionType(' + this.inputName + ')');
if (null === this.name) {
// console.log('this.name is NULL.');
}
if (null === this.transactionType) {
// console.log('Transaction type is NULL.');
return;
}
if ('' === this.transactionType) {
// console.log('Transaction type is "".');
return;
}
this.inputDisabled = false;
if (this.transactionType.toString() !== '' && this.index > 0) {
if (this.transactionType.toString().toLowerCase() === 'transfer') {
this.inputDisabled = true;
// todo: needs to copy value from very first input
return;
}
if (this.transactionType.toString().toLowerCase() === 'withdrawal' && this.inputName.substr(0, 6).toLowerCase() === 'source') {
// todo also clear value?
this.inputDisabled = true;
return;
}
if (this.transactionType.toString().toLowerCase() === 'deposit' && this.inputName.substr(0, 11).toLowerCase() === 'destination') {
// todo also clear value?
this.inputDisabled = true;
}
}
},
selectedItem: function (e) {
// console.log('In SelectedItem()');
if (typeof this.name === 'undefined') {
// console.log('Is undefined');
return;
}
if (typeof this.name === 'string') {
// console.log('Is a string.');
//this.trType = null;
this.$emit('clear:value');
}
// emit the fact that the user selected a type of account
// (influencing the destination)
// console.log('Is some object maybe:');
// console.log(this.name);
this.$emit('select:account', this.name);
},
clearSource: function (e) {
// console.log('clearSource()');
//props.value = '';
this.name = '';
// some event?
this.$emit('clear:value')
},
handleEnter: function (e) {
// todo feels sloppy
if (e.keyCode === 13) {
//e.preventDefault();
}
}
}
}
</script>
<style scoped>

View File

@@ -23,31 +23,31 @@
<div class="col-sm-8 col-sm-offset-4 text-sm">
{{ $t('firefly.amount') }}
</div>
<label class="col-sm-4 control-label" ref="cur"></label>
<label ref="cur" class="col-sm-4 control-label"></label>
<div class="col-sm-8">
<div class="input-group">
<input type="number"
@input="handleInput"
ref="amount"
<input ref="amount"
:title="$t('firefly.amount')"
:value="value"
step="any"
autocomplete="off"
class="form-control"
name="amount[]"
:title="$t('firefly.amount')"
autocomplete="off"
v-bind:placeholder="$t('firefly.amount')">
step="any"
type="number"
v-bind:placeholder="$t('firefly.amount')"
@input="handleInput">
<span class="input-group-btn">
<button
v-on:click="clearAmount"
tabIndex="-1"
class="btn btn-default"
type="button"><i class="fa fa-trash-o"></i></button>
tabIndex="-1"
type="button"
v-on:click="clearAmount"><i class="fa fa-trash-o"></i></button>
</span>
</div>
</div>
<ul class="list-unstyled" v-for="error in this.error">
<ul v-for="error in this.error" class="list-unstyled">
<li class="text-danger">{{ error }}</li>
</ul>
</div>
@@ -133,7 +133,7 @@ export default {
console.log('amount: watch source triggered');
this.changeData();
},
value: function() {
value: function () {
console.log('amount: value changed');
},
destination: function () {

View File

@@ -19,29 +19,29 @@
-->
<template>
<div class="form-group"
v-bind:class="{ 'has-error': hasError()}"
v-if="typeof this.transactionType === 'undefined' || this.transactionType === 'withdrawal' || this.transactionType === 'Withdrawal' || this.transactionType === '' || null === this.transactionType">
<div v-if="typeof this.transactionType === 'undefined' || this.transactionType === 'withdrawal' || this.transactionType === 'Withdrawal' || this.transactionType === '' || null === this.transactionType"
class="form-group"
v-bind:class="{ 'has-error': hasError()}">
<div class="col-sm-12 text-sm">
{{ $t('firefly.bill') }}
</div>
<div class="col-sm-12">
<select
name="bill[]"
v-if="this.bills.length > 0"
ref="bill"
v-model="selected"
@input="handleInput"
v-on:change="signalChange"
:title="$t('firefly.bill')"
class="form-control"
v-if="this.bills.length > 0">
name="bill[]"
@input="handleInput"
v-on:change="signalChange">
<option v-for="cBill in this.bills"
:label="cBill.name"
:value="cBill.id">{{ cBill.name }}
</option>
</select>
<p class="help-block" v-if="this.bills.length === 1" v-html="$t('firefly.no_bill_pointer')"></p>
<ul class="list-unstyled" v-for="error in this.error">
<p v-if="this.bills.length === 1" class="help-block" v-html="$t('firefly.no_bill_pointer')"></p>
<ul v-for="error in this.error" class="list-unstyled">
<li class="text-danger">{{ error }}</li>
</ul>
</div>

View File

@@ -19,29 +19,29 @@
-->
<template>
<div class="form-group"
v-bind:class="{ 'has-error': hasError()}"
v-if="typeof this.transactionType === 'undefined' || this.transactionType === 'withdrawal' || this.transactionType === 'Withdrawal' || this.transactionType === '' || null === this.transactionType">
<div v-if="typeof this.transactionType === 'undefined' || this.transactionType === 'withdrawal' || this.transactionType === 'Withdrawal' || this.transactionType === '' || null === this.transactionType"
class="form-group"
v-bind:class="{ 'has-error': hasError()}">
<div class="col-sm-12 text-sm">
{{ $t('firefly.budget') }}
</div>
<div class="col-sm-12">
<select
name="budget[]"
v-if="this.budgets.length > 0"
ref="budget"
v-model="selected"
@input="handleInput"
v-on:change="signalChange"
:title="$t('firefly.budget')"
class="form-control"
v-if="this.budgets.length > 0">
name="budget[]"
@input="handleInput"
v-on:change="signalChange">
<option v-for="cBudget in this.budgets"
:label="cBudget.name"
:value="cBudget.id">{{ cBudget.name }}
</option>
</select>
<p class="help-block" v-if="this.budgets.length === 1" v-html="$t('firefly.no_budget_pointer')"></p>
<ul class="list-unstyled" v-for="error in this.error">
<p v-if="this.budgets.length === 1" class="help-block" v-html="$t('firefly.no_budget_pointer')"></p>
<ul v-for="error in this.error" class="list-unstyled">
<li class="text-danger">{{ error }}</li>
</ul>
</div>

View File

@@ -19,125 +19,125 @@
-->
<template>
<div class="form-group" v-bind:class="{ 'has-error': hasError()}">
<div class="col-sm-12 text-sm">
{{ $t('firefly.category') }}
</div>
<div class="col-sm-12">
<div class="input-group">
<input
ref="input"
:value="value"
@input="handleInput"
type="text"
v-bind:placeholder="$t('firefly.category')"
autocomplete="off"
data-role="input"
v-on:keypress="handleEnter"
class="form-control"
v-on:submit.prevent
name="category[]"
v-bind:title="$t('firefly.category')">
<span class="input-group-btn">
<button
v-on:click="clearCategory"
class="btn btn-default"
type="button"><i class="fa fa-trash-o"></i></button>
</span>
</div>
<typeahead
:open-on-empty=true
:open-on-focus=true
v-on:input="selectedItem"
:async-function="aSyncFunction"
v-model="name"
:target="target"
item-key="name"
></typeahead>
<ul class="list-unstyled" v-for="error in this.error">
<li class="text-danger">{{ error }}</li>
</ul>
</div>
<div class="form-group" v-bind:class="{ 'has-error': hasError()}">
<div class="col-sm-12 text-sm">
{{ $t('firefly.category') }}
</div>
<div class="col-sm-12">
<div class="input-group">
<input
ref="input"
:value="value"
autocomplete="off"
class="form-control"
data-role="input"
name="category[]"
type="text"
v-bind:placeholder="$t('firefly.category')"
v-bind:title="$t('firefly.category')"
@input="handleInput"
v-on:keypress="handleEnter"
v-on:submit.prevent>
<span class="input-group-btn">
<button
class="btn btn-default"
type="button"
v-on:click="clearCategory"><i class="fa fa-trash-o"></i></button>
</span>
</div>
<typeahead
v-model="name"
:async-function="aSyncFunction"
:open-on-empty=true
:open-on-focus=true
:target="target"
item-key="name"
v-on:input="selectedItem"
></typeahead>
<ul v-for="error in this.error" class="list-unstyled">
<li class="text-danger">{{ error }}</li>
</ul>
</div>
</div>
</template>
<script>
export default {
name: "Category",
props: {
value: String,
inputName: String,
error: Array,
accountName: {
type: String,
default: ''
},
},
data() {
return {
categoryAutoCompleteURI: null,
name: null,
target: null,
}
},
ready() {
this.name = this.accountName;
},
mounted() {
this.target = this.$refs.input;
this.categoryAutoCompleteURI = document.getElementsByTagName('base')[0].href + "api/v1/autocomplete/categories?query=";
},
methods: {
hasError: function () {
return this.error.length > 0;
},
aSyncFunction: function (query, done) {
axios.get(this.categoryAutoCompleteURI + query)
.then(res => {
done(res.data);
})
.catch(err => {
// any error handler
})
},
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 () {
//props.value = '';
this.name = '';
this.$refs.input.value = '';
this.$emit('input', this.$refs.input.value);
// some event?
this.$emit('clear:category')
},
selectedItem: function (e) {
if (typeof this.name === 'undefined') {
return;
}
// emit the fact that the user selected a type of account
// (influencing the destination)
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) {
// todo feels sloppy
if (e.keyCode === 13) {
//e.preventDefault();
}
}
}
export default {
name: "Category",
props: {
value: String,
inputName: String,
error: Array,
accountName: {
type: String,
default: ''
},
},
data() {
return {
categoryAutoCompleteURI: null,
name: null,
target: null,
}
},
ready() {
this.name = this.accountName;
},
mounted() {
this.target = this.$refs.input;
this.categoryAutoCompleteURI = document.getElementsByTagName('base')[0].href + "api/v1/autocomplete/categories?query=";
},
methods: {
hasError: function () {
return this.error.length > 0;
},
aSyncFunction: function (query, done) {
axios.get(this.categoryAutoCompleteURI + query)
.then(res => {
done(res.data);
})
.catch(err => {
// any error handler
})
},
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 () {
//props.value = '';
this.name = '';
this.$refs.input.value = '';
this.$emit('input', this.$refs.input.value);
// some event?
this.$emit('clear:category')
},
selectedItem: function (e) {
if (typeof this.name === 'undefined') {
return;
}
// emit the fact that the user selected a type of account
// (influencing the destination)
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) {
// todo feels sloppy
if (e.keyCode === 13) {
//e.preventDefault();
}
}
}
}
</script>
<style scoped>

View File

@@ -21,27 +21,27 @@
<template>
<form accept-charset="UTF-8" class="form-horizontal" enctype="multipart/form-data">
<input name="_token" type="hidden" value="xxx">
<div class="row" v-if="error_message !== ''">
<div v-if="error_message !== ''" class="row">
<div class="col-lg-12">
<div class="alert alert-danger alert-dismissible" role="alert">
<button type="button" class="close" data-dismiss="alert" v-bind:aria-label="$t('firefly.close')"><span
<button class="close" data-dismiss="alert" type="button" v-bind:aria-label="$t('firefly.close')"><span
aria-hidden="true">&times;</span></button>
<strong>{{ $t("firefly.flash_error") }}</strong> {{ error_message }}
</div>
</div>
</div>
<div class="row" v-if="success_message !== ''">
<div v-if="success_message !== ''" class="row">
<div class="col-lg-12">
<div class="alert alert-success alert-dismissible" role="alert">
<button type="button" class="close" data-dismiss="alert" v-bind:aria-label="$t('firefly.close')"><span
<button class="close" data-dismiss="alert" type="button" v-bind:aria-label="$t('firefly.close')"><span
aria-hidden="true">&times;</span></button>
<strong>{{ $t("firefly.flash_success") }}</strong> <span v-html="success_message"></span>
</div>
</div>
</div>
<div>
<div class="row" v-for="(transaction, index) in transactions">
<div v-for="(transaction, index) in transactions" class="row">
<div class="col-lg-12">
<div class="box">
<div class="box-header with-border">
@@ -51,116 +51,117 @@
}}</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>
<button type="button" v-on:click="deleteTransaction(index, $event)" class="btn btn-xs btn-danger"><i
<div v-if="transactions.length > 1" class="box-tools pull-right" x>
<button class="btn btn-xs btn-danger" type="button" v-on:click="deleteTransaction(index, $event)"><i
class="fa fa-trash"></i></button>
</div>
</div>
<div class="box-body">
<div class="row">
<div class="col-lg-4" id="transaction-info">
<div id="transaction-info" class="col-lg-4">
<transaction-description
v-model="transaction.description"
:index="index"
:error="transaction.errors.description"
:index="index"
>
</transaction-description>
<account-select
inputName="source[]"
v-bind:inputDescription="$t('firefly.source_account')"
:accountName="transaction.source_account.name"
:accountTypeFilters="transaction.source_account.allowed_types"
:defaultAccountTypeFilters="transaction.source_account.default_allowed_types"
:transactionType="transactionType"
:error="transaction.errors.source_account"
:index="index"
:transactionType="transactionType"
inputName="source[]"
v-bind:inputDescription="$t('firefly.source_account')"
v-on:clear:value="clearSource(index)"
v-on:select:account="selectedSourceAccount(index, $event)"
:error="transaction.errors.source_account"
></account-select>
<account-select
inputName="destination[]"
v-bind:inputDescription="$t('firefly.destination_account')"
:accountName="transaction.destination_account.name"
:accountTypeFilters="transaction.destination_account.allowed_types"
:defaultAccountTypeFilters="transaction.destination_account.default_allowed_types"
:transactionType="transactionType"
:error="transaction.errors.destination_account"
:index="index"
:transactionType="transactionType"
inputName="destination[]"
v-bind:inputDescription="$t('firefly.destination_account')"
v-on:clear:value="clearDestination(index)"
v-on:select:account="selectedDestinationAccount(index, $event)"
:error="transaction.errors.destination_account"
></account-select>
<p class="text-warning" v-if="0!== index && (null === transactionType || 'invalid' === transactionType || '' === transactionType)">
<p v-if="0!== index && (null === transactionType || 'invalid' === transactionType || '' === transactionType)"
class="text-warning">
{{ $t('firefly.multi_account_warning_unknown') }}
</p>
<p class="text-warning" v-if="0!== index && 'Withdrawal' === transactionType">
<p v-if="0!== index && 'Withdrawal' === transactionType" class="text-warning">
{{ $t('firefly.multi_account_warning_withdrawal') }}
</p>
<p class="text-warning" v-if="0!== index && 'Deposit' === transactionType">
<p v-if="0!== index && 'Deposit' === transactionType" class="text-warning">
{{ $t('firefly.multi_account_warning_deposit') }}
</p>
<p class="text-warning" v-if="0!== index && 'Transfer' === transactionType">
<p v-if="0!== index && 'Transfer' === transactionType" class="text-warning">
{{ $t('firefly.multi_account_warning_transfer') }}
</p>
<standard-date v-if="0===index"
v-model="transaction.date"
:index="index"
:error="transaction.errors.date"
:index="index"
>
</standard-date>
<div v-if="index===0">
<transaction-type
:source="transaction.source_account.type"
:destination="transaction.destination_account.type"
:source="transaction.source_account.type"
v-on:set:transactionType="setTransactionType($event)"
v-on:act:limitSourceType="limitSourceType($event)"
v-on:act:limitDestinationType="limitDestinationType($event)"
></transaction-type>
</div>
</div>
<div class="col-lg-4" id="amount-info">
<div id="amount-info" class="col-lg-4">
<amount
:source="transaction.source_account"
:destination="transaction.destination_account"
v-model="transaction.amount"
:destination="transaction.destination_account"
:error="transaction.errors.amount"
:source="transaction.source_account"
:transactionType="transactionType"
></amount>
<foreign-amount
:source="transaction.source_account"
:destination="transaction.destination_account"
v-model="transaction.foreign_amount"
:transactionType="transactionType"
:destination="transaction.destination_account"
:error="transaction.errors.foreign_amount"
:source="transaction.source_account"
:transactionType="transactionType"
v-bind:title="$t('form.foreign_amount')"
></foreign-amount>
</div>
<div class="col-lg-4" id="optional-info">
<div id="optional-info" class="col-lg-4">
<budget
:transactionType="transactionType"
v-model="transaction.budget"
:error="transaction.errors.budget_id"
:no_budget="$t('firefly.none_in_select_list')"
:transactionType="transactionType"
></budget>
<category
:transactionType="transactionType"
v-model="transaction.category"
:error="transaction.errors.category"
:transactionType="transactionType"
></category>
<piggy-bank
:transactionType="transactionType"
v-model="transaction.piggy_bank"
:error="transaction.errors.piggy_bank"
:no_piggy_bank="$t('firefly.no_piggy_bank')"
:transactionType="transactionType"
></piggy-bank>
<tags
v-model="transaction.tags"
:error="transaction.errors.tags"
></tags>
<bill
:transactionType="transactionType"
v-model="transaction.bill"
:error="transaction.errors.bill_id"
:no_bill="$t('firefly.none_in_select_list')"
:transactionType="transactionType"
></bill>
<custom-transaction-fields
v-model="transaction.custom_fields"
@@ -169,7 +170,7 @@
</div>
</div>
</div>
<div class="box-footer" v-if="transactions.length-1 === index">
<div v-if="transactions.length-1 === index" class="box-footer">
<button class="split_add_btn btn btn-default" type="button" @click="addTransactionToArray">
{{ $t('firefly.add_another_split') }}
</button>
@@ -178,7 +179,7 @@
</div>
</div>
</div>
<div class="row" v-if="transactions.length > 1">
<div v-if="transactions.length > 1" class="row">
<div class="col-lg-6 col-md-6 col-sm-12 col-xs-12">
<div class="box">
<div class="box-header with-border">
@@ -188,8 +189,8 @@
</div>
<div class="box-body">
<group-description
:error="group_title_errors"
v-model="group_title"
:error="group_title_errors"
></group-description>
</div>
</div>
@@ -221,7 +222,7 @@
</div>
<div class="box-footer">
<div class="btn-group">
<button class="btn btn-success" id="submitButton" @click="submit">{{ $t('firefly.submit') }}</button>
<button id="submitButton" class="btn btn-success" @click="submit">{{ $t('firefly.submit') }}</button>
</div>
<p class="text-success" v-html="success_message"></p>
<p class="text-danger" v-html="error_message"></p>

View File

@@ -27,20 +27,20 @@
</div>
<div class="col-sm-12">
<div class="input-group">
<input multiple="multiple"
autocomplete="off"
<input ref="input"
:name="name"
:placeholder="title"
:title="title"
ref="input"
:name="name" type="file" class="form-control">
autocomplete="off"
class="form-control" multiple="multiple" type="file">
<span class="input-group-btn">
<button
v-on:click="clearAtt"
class="btn btn-default"
type="button"><i class="fa fa-trash-o"></i></button>
type="button"
v-on:click="clearAtt"><i class="fa fa-trash-o"></i></button>
</span>
</div>
<ul class="list-unstyled" v-for="error in this.error">
<ul v-for="error in this.error" class="list-unstyled">
<li class="text-danger">{{ error }}</li>
</ul>
</div>

View File

@@ -19,58 +19,58 @@
-->
<template>
<div class="form-group"
v-bind:class="{ 'has-error': hasError()}"
>
<div class="col-sm-12 text-sm">
{{ title }}
</div>
<div class="col-sm-12">
<div class="input-group">
<input type="date" class="form-control" :name="name"
:title="title" autocomplete="off"
ref="date"
:value="value ? value.substr(0,10): ''" @input="handleInput"
:placeholder="title">
<span class="input-group-btn">
<button
tabIndex="-1"
v-on:click="clearDate"
class="btn btn-default"
type="button"><i class="fa fa-trash-o"></i></button>
</span>
</div>
<ul class="list-unstyled" v-for="error in this.error">
<li class="text-danger">{{ error }}</li>
</ul>
</div>
<div class="form-group"
v-bind:class="{ 'has-error': hasError()}"
>
<div class="col-sm-12 text-sm">
{{ title }}
</div>
<div class="col-sm-12">
<div class="input-group">
<input ref="date" :name="name" :placeholder="title"
:title="title" :value="value ? value.substr(0,10): ''"
autocomplete="off"
class="form-control" type="date"
@input="handleInput">
<span class="input-group-btn">
<button
class="btn btn-default"
tabIndex="-1"
type="button"
v-on:click="clearDate"><i class="fa fa-trash-o"></i></button>
</span>
</div>
<ul v-for="error in this.error" class="list-unstyled">
<li class="text-danger">{{ error }}</li>
</ul>
</div>
</div>
</template>
<script>
export default {
name: "CustomDate",
props: {
value: String,
title: String,
name: String,
error: Array,
},
methods: {
handleInput(e) {
this.$emit('input', this.$refs.date.value);
},
hasError: function () {
return this.error.length > 0;
},
clearDate: function () {
//props.value = '';
this.name = '';
this.$refs.date.value = '';
this.$emit('input', this.$refs.date.value);
},
}
}
export default {
name: "CustomDate",
props: {
value: String,
title: String,
name: String,
error: Array,
},
methods: {
handleInput(e) {
this.$emit('input', this.$refs.date.value);
},
hasError: function () {
return this.error.length > 0;
},
clearDate: function () {
//props.value = '';
this.name = '';
this.$refs.date.value = '';
this.$emit('input', this.$refs.date.value);
},
}
}
</script>
<style scoped>

View File

@@ -19,58 +19,58 @@
-->
<template>
<div class="form-group"
v-bind:class="{ 'has-error': hasError()}"
>
<div class="col-sm-12 text-sm">
{{ title }}
</div>
<div class="col-sm-12">
<div class="input-group">
<input type="text" class="form-control" :name="name"
:title="title" autocomplete="off"
ref="str"
:value="value" @input="handleInput"
:placeholder="title">
<span class="input-group-btn">
<button
tabIndex="-1"
v-on:click="clearField"
class="btn btn-default"
type="button"><i class="fa fa-trash-o"></i></button>
</span>
</div>
<ul class="list-unstyled" v-for="error in this.error">
<li class="text-danger">{{ error }}</li>
</ul>
</div>
<div class="form-group"
v-bind:class="{ 'has-error': hasError()}"
>
<div class="col-sm-12 text-sm">
{{ title }}
</div>
<div class="col-sm-12">
<div class="input-group">
<input ref="str" :name="name" :placeholder="title"
:title="title" :value="value"
autocomplete="off"
class="form-control" type="text"
@input="handleInput">
<span class="input-group-btn">
<button
class="btn btn-default"
tabIndex="-1"
type="button"
v-on:click="clearField"><i class="fa fa-trash-o"></i></button>
</span>
</div>
<ul v-for="error in this.error" class="list-unstyled">
<li class="text-danger">{{ error }}</li>
</ul>
</div>
</div>
</template>
<script>
export default {
name: "CustomString",
props: {
title: String,
name: String,
value: String,
error: Array
},
methods: {
handleInput(e) {
this.$emit('input', this.$refs.str.value);
},
clearField: function () {
//props.value = '';
this.name = '';
this.$refs.str.value = '';
this.$emit('input', this.$refs.str.value);
},
hasError: function () {
return this.error.length > 0;
}
}
export default {
name: "CustomString",
props: {
title: String,
name: String,
value: String,
error: Array
},
methods: {
handleInput(e) {
this.$emit('input', this.$refs.str.value);
},
clearField: function () {
//props.value = '';
this.name = '';
this.$refs.str.value = '';
this.$emit('input', this.$refs.str.value);
},
hasError: function () {
return this.error.length > 0;
}
}
}
</script>
<style scoped>

View File

@@ -19,50 +19,50 @@
-->
<template>
<div class="form-group"
v-bind:class="{ 'has-error': hasError()}"
>
<div class="col-sm-12 text-sm">
{{ title }}
</div>
<div class="col-sm-12">
<textarea class="form-control" :name="name"
:title="title" autocomplete="off"
ref="str"
rows="8"
v-model="textValue"
@input="handleInput"
:placeholder="title"></textarea>
<ul class="list-unstyled" v-for="error in this.error">
<li class="text-danger">{{ error }}</li>
</ul>
</div>
<div class="form-group"
v-bind:class="{ 'has-error': hasError()}"
>
<div class="col-sm-12 text-sm">
{{ title }}
</div>
<div class="col-sm-12">
<textarea ref="str" v-model="textValue"
:name="name" :placeholder="title"
:title="title"
autocomplete="off"
class="form-control"
rows="8"
@input="handleInput"></textarea>
<ul v-for="error in this.error" class="list-unstyled">
<li class="text-danger">{{ error }}</li>
</ul>
</div>
</div>
</template>
<script>
export default {
name: "CustomTextarea",
props: {
title: String,
name: String,
value: String,
error: Array
},
data() {
return {
textValue: this.value,
}
},
methods: {
handleInput(e) {
this.$emit('input', this.$refs.str.value);
},
hasError: function () {
return this.error.length > 0;
}
}
export default {
name: "CustomTextarea",
props: {
title: String,
name: String,
value: String,
error: Array
},
data() {
return {
textValue: this.value,
}
},
methods: {
handleInput(e) {
this.$emit('input', this.$refs.str.value);
},
hasError: function () {
return this.error.length > 0;
}
}
}
</script>
<style scoped>

View File

@@ -19,107 +19,117 @@
-->
<template>
<div>
<p class="help-block" v-html="$t('firefly.hidden_fields_preferences')"></p>
<component
:error="error.interest_date"
v-model="value.interest_date" v-if="this.fields.interest_date" name="interest_date[]" v-bind:title="$t('form.interest_date')" v-bind:is="dateComponent"></component>
<component
:error="error.book_date"
v-model="value.book_date" v-if="this.fields.book_date" name="book_date[]" v-bind:title="$t('form.book_date')" v-bind:is="dateComponent"></component>
<component
:error="error.process_date"
v-model="value.process_date" v-if="this.fields.process_date" name="process_date[]" v-bind:title="$t('form.process_date')" v-bind:is="dateComponent"></component>
<component
:error="error.due_date"
v-model="value.due_date" v-if="this.fields.due_date" name="due_date[]" v-bind:title="$t('form.due_date')" v-bind:is="dateComponent"></component>
<component
:error="error.payment_date"
v-model="value.payment_date" v-if="this.fields.payment_date" name="payment_date[]" v-bind:title="$t('form.payment_date')" v-bind:is="dateComponent"></component>
<div>
<p class="help-block" v-html="$t('firefly.hidden_fields_preferences')"></p>
<component
v-bind:is="dateComponent"
v-if="this.fields.interest_date" v-model="value.interest_date" :error="error.interest_date"
name="interest_date[]" v-bind:title="$t('form.interest_date')"></component>
<component
v-bind:is="dateComponent"
v-if="this.fields.book_date" v-model="value.book_date" :error="error.book_date" name="book_date[]"
v-bind:title="$t('form.book_date')"></component>
<component
v-bind:is="dateComponent"
v-if="this.fields.process_date" v-model="value.process_date" :error="error.process_date"
name="process_date[]" v-bind:title="$t('form.process_date')"></component>
<component
v-bind:is="dateComponent"
v-if="this.fields.due_date" v-model="value.due_date" :error="error.due_date" name="due_date[]"
v-bind:title="$t('form.due_date')"></component>
<component
v-bind:is="dateComponent"
v-if="this.fields.payment_date" v-model="value.payment_date" :error="error.payment_date"
name="payment_date[]" v-bind:title="$t('form.payment_date')"></component>
<component
:error="error.invoice_date"
v-model="value.invoice_date" v-if="this.fields.invoice_date" name="invoice_date[]" v-bind:title="$t('form.invoice_date')" v-bind:is="dateComponent"></component>
<component
v-bind:is="dateComponent"
v-if="this.fields.invoice_date" v-model="value.invoice_date" :error="error.invoice_date"
name="invoice_date[]" v-bind:title="$t('form.invoice_date')"></component>
<component
:error="error.internal_reference"
v-model="value.internal_reference" v-if="this.fields.internal_reference" name="internal_reference[]" v-bind:title="$t('form.internal_reference')" v-bind:is="stringComponent"></component>
<component
v-bind:is="stringComponent"
v-if="this.fields.internal_reference" v-model="value.internal_reference" :error="error.internal_reference"
name="internal_reference[]" v-bind:title="$t('form.internal_reference')"></component>
<component
:error="error.attachments"
v-model="value.attachments" v-if="this.fields.attachments" name="attachments[]" v-bind:title="$t('firefly.attachments')" v-bind:is="attachmentComponent"></component>
<component
v-bind:is="attachmentComponent"
v-if="this.fields.attachments" v-model="value.attachments" :error="error.attachments"
name="attachments[]" v-bind:title="$t('firefly.attachments')"></component>
<component
:error="error.external_uri"
v-model="value.external_uri" v-if="this.fields.external_uri" name="external_uri[]" v-bind:title="$t('firefly.external_uri')" v-bind:is="uriComponent"></component>
<component
v-bind:is="uriComponent"
v-if="this.fields.external_uri" v-model="value.external_uri" :error="error.external_uri"
name="external_uri[]" v-bind:title="$t('firefly.external_uri')"></component>
<component
:error="error.notes"
v-model="value.notes" v-if="this.fields.notes" name="notes[]" v-bind:title="$t('firefly.notes')" v-bind:is="textareaComponent"></component>
</div>
<component
v-bind:is="textareaComponent"
v-if="this.fields.notes" v-model="value.notes" :error="error.notes" name="notes[]"
v-bind:title="$t('firefly.notes')"></component>
</div>
</template>
<script>
export default {
name: "CustomTransactionFields",
props: ['value','error'],
mounted() {
this.getPreference();
},
data() {
return {
customInterestDate: null,
fields: [
{
"interest_date": false,
"book_date": false,
"process_date": false,
"due_date": false,
"payment_date": false,
"invoice_date": false,
"internal_reference": false,
"notes": false,
"attachments": false,
"external_uri": false
}
]
};
},
computed: {
// TODO this seems a pretty weird way of doing it.
dateComponent () {
return 'custom-date';
},
stringComponent () {
return 'custom-string';
},
attachmentComponent () {
return 'custom-attachments';
},
textareaComponent () {
return 'custom-textarea';
},
uriComponent () {
return 'custom-uri';
}
},
methods: {
handleInput(e) {
this.$emit('input', this.value);
},
getPreference() {
// Vue.component('custom-date', (resolve) => {
// console.log('loaded');
// });
const url = document.getElementsByTagName('base')[0].href + 'api/v1/preferences/transaction_journal_optional_fields';
axios.get(url).then(response => {
this.fields = response.data.data.attributes.data;
}).catch(() => console.warn('Oh. Something went wrong loading custom transaction fields.'));
},
export default {
name: "CustomTransactionFields",
props: ['value', 'error'],
mounted() {
this.getPreference();
},
data() {
return {
customInterestDate: null,
fields: [
{
"interest_date": false,
"book_date": false,
"process_date": false,
"due_date": false,
"payment_date": false,
"invoice_date": false,
"internal_reference": false,
"notes": false,
"attachments": false,
"external_uri": false
}
]
};
},
computed: {
// TODO this seems a pretty weird way of doing it.
dateComponent() {
return 'custom-date';
},
stringComponent() {
return 'custom-string';
},
attachmentComponent() {
return 'custom-attachments';
},
textareaComponent() {
return 'custom-textarea';
},
uriComponent() {
return 'custom-uri';
}
},
methods: {
handleInput(e) {
this.$emit('input', this.value);
},
getPreference() {
// Vue.component('custom-date', (resolve) => {
// console.log('loaded');
// });
const url = document.getElementsByTagName('base')[0].href + 'api/v1/preferences/transaction_journal_optional_fields';
axios.get(url).then(response => {
this.fields = response.data.data.attributes.data;
}).catch(() => console.warn('Oh. Something went wrong loading custom transaction fields.'));
},
}
}
</script>
<style scoped>

View File

@@ -19,57 +19,57 @@
-->
<template>
<div class="form-group"
v-bind:class="{ 'has-error': hasError()}"
>
<div class="col-sm-12 text-sm">
{{ title }}
</div>
<div class="col-sm-12">
<div class="input-group">
<input type="url" class="form-control" :name="name"
:title="title" autocomplete="off"
ref="uri"
:value="value" @input="handleInput"
:placeholder="title">
<span class="input-group-btn">
<button
tabIndex="-1"
v-on:click="clearField"
class="btn btn-default"
type="button"><i class="fa fa-trash-o"></i></button>
</span>
</div>
<ul class="list-unstyled" v-for="error in this.error">
<li class="text-danger">{{ error }}</li>
</ul>
</div>
<div class="form-group"
v-bind:class="{ 'has-error': hasError()}"
>
<div class="col-sm-12 text-sm">
{{ title }}
</div>
<div class="col-sm-12">
<div class="input-group">
<input ref="uri" :name="name" :placeholder="title"
:title="title" :value="value"
autocomplete="off"
class="form-control" type="url"
@input="handleInput">
<span class="input-group-btn">
<button
class="btn btn-default"
tabIndex="-1"
type="button"
v-on:click="clearField"><i class="fa fa-trash-o"></i></button>
</span>
</div>
<ul v-for="error in this.error" class="list-unstyled">
<li class="text-danger">{{ error }}</li>
</ul>
</div>
</div>
</template>
<script>
export default {
name: "CustomString",
props: {
title: String,
name: String,
value: String,
error: Array
},
methods: {
handleInput(e) {
this.$emit('input', this.$refs.uri.value);
},
clearField: function () {
this.name = '';
this.$refs.uri.value = '';
this.$emit('input', this.$refs.uri.value);
},
hasError: function () {
return this.error.length > 0;
}
}
export default {
name: "CustomString",
props: {
title: String,
name: String,
value: String,
error: Array
},
methods: {
handleInput(e) {
this.$emit('input', this.$refs.uri.value);
},
clearField: function () {
this.name = '';
this.$refs.uri.value = '';
this.$emit('input', this.$refs.uri.value);
},
hasError: function () {
return this.error.length > 0;
}
}
}
</script>
<style scoped>

View File

@@ -19,30 +19,30 @@
-->
<template>
<form method="POST" action="#" accept-charset="UTF-8" class="form-horizontal" id="store"
enctype="multipart/form-data">
<form id="store" accept-charset="UTF-8" action="#" class="form-horizontal" enctype="multipart/form-data"
method="POST">
<input name="_token" type="hidden" value="xxx">
<div class="row" v-if="error_message !== ''">
<div v-if="error_message !== ''" class="row">
<div class="col-lg-12">
<div class="alert alert-danger alert-dismissible" role="alert">
<button type="button" class="close" data-dismiss="alert" v-bind:aria-label="$t('firefly.close')"><span
<button class="close" data-dismiss="alert" type="button" v-bind:aria-label="$t('firefly.close')"><span
aria-hidden="true">&times;</span></button>
<strong>{{ $t("firefly.flash_error") }}</strong> {{ error_message }}
</div>
</div>
</div>
<div class="row" v-if="success_message !== ''">
<div v-if="success_message !== ''" class="row">
<div class="col-lg-12">
<div class="alert alert-success alert-dismissible" role="alert">
<button type="button" class="close" data-dismiss="alert" v-bind:aria-label="$t('firefly.close')"><span
<button class="close" data-dismiss="alert" type="button" v-bind:aria-label="$t('firefly.close')"><span
aria-hidden="true">&times;</span></button>
<strong>{{ $t("firefly.flash_success") }}</strong> <span v-html="success_message"></span>
</div>
</div>
</div>
<div>
<div class="row" v-for="(transaction, index) in transactions">
<div v-for="(transaction, index) in transactions" class="row">
<div class="col-lg-12">
<div class="box">
<div class="box-header with-border">
@@ -52,8 +52,8 @@
}}</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">
<button type="button" v-on:click="deleteTransaction(index, $event)" class="btn btn-xs btn-danger"><i
<div v-if="transactions.length > 1" class="box-tools pull-right">
<button class="btn btn-xs btn-danger" type="button" v-on:click="deleteTransaction(index, $event)"><i
class="fa fa-trash"></i></button>
</div>
</div>
@@ -62,22 +62,22 @@
<div class="col-lg-4">
<transaction-description v-if="transactionType.toLowerCase() !== 'reconciliation'"
v-model="transaction.description"
:index="index"
:error="transaction.errors.description"
:index="index"
>
</transaction-description>
<account-select v-if="transactionType.toLowerCase() !== 'reconciliation'"
inputName="source[]"
v-bind:inputDescription="$t('firefly.source_account')"
:accountName="transaction.source_account.name"
:accountTypeFilters="transaction.source_account.allowed_types"
:transactionType="transactionType"
:error="transaction.errors.source_account"
:index="index"
:transactionType="transactionType"
inputName="source[]"
v-bind:inputDescription="$t('firefly.source_account')"
v-on:clear:value="clearSource(index)"
v-on:select:account="selectedSourceAccount(index, $event)"
:error="transaction.errors.source_account"
></account-select>
<div class="form-group" v-if="transactionType.toLowerCase() === 'reconciliation'">
<div v-if="transactionType.toLowerCase() === 'reconciliation'" class="form-group">
<div class="col-sm-12">
<p id="ffInput_source" class="form-control-static">
<em>
@@ -87,17 +87,17 @@
</div>
</div>
<account-select v-if="transactionType.toLowerCase() !== 'reconciliation'"
inputName="destination[]"
v-bind:inputDescription="$t('firefly.destination_account')"
:accountName="transaction.destination_account.name"
:accountTypeFilters="transaction.destination_account.allowed_types"
:transactionType="transactionType"
:error="transaction.errors.destination_account"
:index="index"
:transactionType="transactionType"
inputName="destination[]"
v-bind:inputDescription="$t('firefly.destination_account')"
v-on:clear:value="clearDestination(index)"
v-on:select:account="selectedDestinationAccount(index, $event)"
:error="transaction.errors.destination_account"
></account-select>
<div class="form-group" v-if="transactionType.toLowerCase() === 'reconciliation'">
<div v-if="transactionType.toLowerCase() === 'reconciliation'" class="form-group">
<div class="col-sm-12">
<p id="ffInput_dest" class="form-control-static">
<em>
@@ -108,14 +108,14 @@
</div>
<standard-date
v-model="transaction.date"
:index="index"
:error="transaction.errors.date"
:index="index"
>
</standard-date>
<div v-if="index===0">
<transaction-type
:source="transaction.source_account.type"
:destination="transaction.destination_account.type"
:source="transaction.source_account.type"
v-on:set:transactionType="setTransactionType($event)"
v-on:act:limitSourceType="limitSourceType($event)"
v-on:act:limitDestinationType="limitDestinationType($event)"
@@ -125,45 +125,45 @@
<div class="col-lg-4">
<!-- -->
<amount
:source="transaction.source_account"
:destination="transaction.destination_account"
v-model="transaction.amount"
:destination="transaction.destination_account"
:error="transaction.errors.amount"
:source="transaction.source_account"
:transactionType="transactionType"
></amount>
<foreign-amount v-if="transactionType.toLowerCase() !== 'reconciliation'"
:source="transaction.source_account"
:destination="transaction.destination_account"
v-model="transaction.foreign_amount"
:transactionType="transactionType"
:destination="transaction.destination_account"
:error="transaction.errors.foreign_amount"
:no_currency="$t('firefly.none_in_select_list')"
:source="transaction.source_account"
:transactionType="transactionType"
v-bind:title="$t('form.foreign_amount')"
></foreign-amount>
</div>
<div class="col-lg-4">
<budget
:transactionType="transactionType"
v-model="transaction.budget"
:error="transaction.errors.budget_id"
:no_budget="$t('firefly.none_in_select_list')"
:transactionType="transactionType"
></budget>
<category
:transactionType="transactionType"
v-model="transaction.category"
:error="transaction.errors.category"
:transactionType="transactionType"
></category>
<tags
:transactionType="transactionType"
:tags="transaction.tags"
v-model="transaction.tags"
:error="transaction.errors.tags"
:tags="transaction.tags"
:transactionType="transactionType"
></tags>
<bill
:transactionType="transactionType"
v-model="transaction.bill"
:error="transaction.errors.bill_id"
:no_bill="$t('firefly.none_in_select_list')"
:transactionType="transactionType"
></bill>
<custom-transaction-fields
v-model="transaction.custom_fields"
@@ -172,8 +172,8 @@
</div>
</div>
</div>
<div class="box-footer"
v-if="transactions.length-1 === index && transactionType.toLowerCase() !== 'reconciliation'">
<div v-if="transactions.length-1 === index && transactionType.toLowerCase() !== 'reconciliation'"
class="box-footer">
<button class="btn btn-default" type="button" @click="addTransaction">{{
$t('firefly.add_another_split')
}}
@@ -183,7 +183,7 @@
</div>
</div>
</div>
<div class="row" v-if="transactions.length > 1">
<div v-if="transactions.length > 1" class="row">
<div class="col-lg-6 col-md-6 col-sm-12 col-xs-12">
<div class="box">
<div class="box-header with-border">
@@ -193,8 +193,8 @@
</div>
<div class="box-body">
<group-description
:error="group_title_errors"
v-model="group_title"
:error="group_title_errors"
></group-description>
</div>
</div>
@@ -215,7 +215,7 @@
{{ $t('firefly.after_update_create_another') }}
</label>
</div>
<div class="checkbox" v-if="null !== transactionType && transactionType.toLowerCase() !== 'reconciliation'">
<div v-if="null !== transactionType && transactionType.toLowerCase() !== 'reconciliation'" class="checkbox">
<label>
<input v-model="storeAsNew" name="store_as_new" type="checkbox">
{{ $t('firefly.store_as_new') }}
@@ -224,7 +224,7 @@
</div>
<div class="box-footer">
<div class="btn-group">
<button class="btn btn-success" @click="submit" id="submitButton">{{
<button id="submitButton" class="btn btn-success" @click="submit">{{
$t('firefly.update_transaction')
}}
</button>

View File

@@ -23,17 +23,17 @@
Show if:
- one or more currencies.
-->
<div class="form-group" v-bind:class="{ 'has-error': hasError()}" v-if="this.enabledCurrencies.length >= 1">
<div v-if="this.enabledCurrencies.length >= 1" class="form-group" v-bind:class="{ 'has-error': hasError()}">
<div class="col-sm-8 col-sm-offset-4 text-sm">
{{ $t('form.foreign_amount') }}
</div>
<div class="col-sm-4">
<select class="form-control" ref="currency_select" name="foreign_currency[]" @input="handleInput">
<select ref="currency_select" class="form-control" name="foreign_currency[]" @input="handleInput">
<option
v-for="currency in this.enabledCurrencies"
:value="currency.id"
:label="currency.attributes.name"
:selected="parseInt(value.currency_id) === parseInt(currency.id)"
:value="currency.id"
>
{{ currency.attributes.name }}
@@ -42,18 +42,18 @@
</div>
<div class="col-sm-8">
<div class="input-group">
<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="this.title" autocomplete="off" :placeholder="this.title">
<input v-if="this.enabledCurrencies.length > 0" ref="amount" :placeholder="this.title" :title="this.title" :value="value.amount" autocomplete="off"
class="form-control" name="foreign_amount[]"
step="any" type="number" @input="handleInput">
<span class="input-group-btn">
<button
v-on:click="clearAmount"
tabIndex="-1"
class="btn btn-default"
type="button"><i class="fa fa-trash-o"></i></button>
tabIndex="-1"
type="button"
v-on:click="clearAmount"><i class="fa fa-trash-o"></i></button>
</span>
</div>
<ul class="list-unstyled" v-for="error in this.error">
<ul v-for="error in this.error" class="list-unstyled">
<li class="text-danger">{{ error }}</li>
</ul>
</div>

View File

@@ -19,59 +19,59 @@
-->
<template>
<div class="form-group" v-bind:class="{ 'has-error': hasError()}">
<div class="col-sm-12 text-sm">
{{ $t('firefly.split_transaction_title') }}
</div>
<div class="col-sm-12">
<div class="input-group">
<input
type="text"
class="form-control"
name="group_title"
v-bind:title="$t('firefly.split_transaction_title')"
ref="descr"
autocomplete="off"
v-bind:placeholder="$t('firefly.split_transaction_title')"
:value="value" @input="handleInput"
>
<span class="input-group-btn">
<button
tabIndex="-1"
v-on:click="clearField"
class="btn btn-default"
type="button"><i class="fa fa-trash-o"></i></button>
</span>
</div>
<p class="help-block" v-if="error.length === 0">
{{ $t('firefly.split_transaction_title_help') }}
</p>
<ul class="list-unstyled" v-for="error in this.error">
<li class="text-danger">{{ error }}</li>
</ul>
</div>
<div class="form-group" v-bind:class="{ 'has-error': hasError()}">
<div class="col-sm-12 text-sm">
{{ $t('firefly.split_transaction_title') }}
</div>
<div class="col-sm-12">
<div class="input-group">
<input
ref="descr"
:value="value"
autocomplete="off"
class="form-control"
name="group_title"
type="text"
v-bind:placeholder="$t('firefly.split_transaction_title')"
v-bind:title="$t('firefly.split_transaction_title')" @input="handleInput"
>
<span class="input-group-btn">
<button
class="btn btn-default"
tabIndex="-1"
type="button"
v-on:click="clearField"><i class="fa fa-trash-o"></i></button>
</span>
</div>
<p v-if="error.length === 0" class="help-block">
{{ $t('firefly.split_transaction_title_help') }}
</p>
<ul v-for="error in this.error" class="list-unstyled">
<li class="text-danger">{{ error }}</li>
</ul>
</div>
</div>
</template>
<script>
export default {
props: ['error', 'value', 'index'],
name: "GroupDescription",
methods: {
hasError: function () {
return this.error.length > 0;
},
handleInput(e) {
this.$emit('input', this.$refs.descr.value);
},
clearField: function () {
//props.value = '';
this.name = '';
this.$refs.descr.value = '';
this.$emit('input', this.$refs.descr.value);
},
}
}
export default {
props: ['error', 'value', 'index'],
name: "GroupDescription",
methods: {
hasError: function () {
return this.error.length > 0;
},
handleInput(e) {
this.$emit('input', this.$refs.descr.value);
},
clearField: function () {
//props.value = '';
this.name = '';
this.$refs.descr.value = '';
this.$emit('input', this.$refs.descr.value);
},
}
}
</script>
<style scoped>

View File

@@ -18,98 +18,103 @@
- along with this program. If not, see <https://www.gnu.org/licenses/>.
-->
<template>
<div class="form-group"
v-bind:class="{ 'has-error': hasError()}"
v-if="typeof this.transactionType !== 'undefined' && this.transactionType === 'Transfer'">
<div class="col-sm-12 text-sm">
{{ $t('firefly.piggy_bank') }}
<div v-if="typeof this.transactionType !== 'undefined' && this.transactionType === 'Transfer'"
class="form-group"
v-bind:class="{ 'has-error': hasError()}">
<div class="col-sm-12 text-sm">
{{ $t('firefly.piggy_bank') }}
</div>
<div class="col-sm-12">
<select name="piggy_bank[]" ref="piggy" @input="handleInput" class="form-control">
<optgroup v-for="(option, key) in this.piggies" v-bind:label="key">
<option v-for="piggy in option.piggies" :label="piggy.name_with_balance" :value="piggy.id">{{piggy.name_with_balance}}</option>
</optgroup>
</select>
<ul class="list-unstyled" v-for="error in this.error">
<li class="text-danger">{{ error }}</li>
</ul>
</div>
</div>
<div class="col-sm-12">
<select ref="piggy" class="form-control" name="piggy_bank[]" @input="handleInput">
<optgroup v-for="(option, key) in this.piggies" v-bind:label="key">
<option v-for="piggy in option.piggies" :label="piggy.name_with_balance" :value="piggy.id">
{{ piggy.name_with_balance }}
</option>
</optgroup>
</select>
<ul v-for="error in this.error" class="list-unstyled">
<li class="text-danger">{{ error }}</li>
</ul>
</div>
</div>
</template>
<script>
export default {
name: "PiggyBank",
props: ['value','transactionType','error', 'no_piggy_bank'],
mounted() {
this.loadPiggies();
},
data() {
return {
piggies: [],
}
},
methods: {
handleInput(e) {
this.$emit('input', this.$refs.piggy.value);
},
hasError: function () {
return this.error.length > 0;
},
loadPiggies: function () {
let URI = document.getElementsByTagName('base')[0].href + "api/v1/autocomplete/piggy-banks-with-balance?limit=1337";
axios.get(URI, {}).then((res) => {
let tempList = {
0: {
group: {
title: this.$t('firefly.default_group_title_name')
},
piggies: [
{
name_with_balance: this.no_piggy_bank,
id: 0,
}
],
}
};
for (const key in res.data) {
if (res.data.hasOwnProperty(key) && /^0$|^[1-9]\d*$/.test(key) && key <= 4294967294) {
// add to temp list
let currentPiggy = res.data[key];
if (currentPiggy.objectGroup) {
let groupOrder = currentPiggy.objectGroup.order;
if (!tempList[groupOrder]) {
tempList[groupOrder] = {
group: {
title: currentPiggy.objectGroup.title
},
piggies: [],
};
}
tempList[groupOrder].piggies.push({name_with_balance: currentPiggy.name_with_balance, id: currentPiggy.id});
}
if (!currentPiggy.objectGroup) {
// add to empty one:
tempList[0].piggies.push({name_with_balance: currentPiggy.name_with_balance, id: currentPiggy.id});
}
//console.log(currentPiggy);
this.piggies.push(res.data[key]);
}
}
const ordered = {};
Object.keys(tempList).sort().forEach(function(key) {
let groupName = tempList[key].group.title;
ordered[groupName] = tempList[key];
});
// final list:
this.piggies = ordered;
// console.log(ordered);
});
}
}
export default {
name: "PiggyBank",
props: ['value', 'transactionType', 'error', 'no_piggy_bank'],
mounted() {
this.loadPiggies();
},
data() {
return {
piggies: [],
}
},
methods: {
handleInput(e) {
this.$emit('input', this.$refs.piggy.value);
},
hasError: function () {
return this.error.length > 0;
},
loadPiggies: function () {
let URI = document.getElementsByTagName('base')[0].href + "api/v1/autocomplete/piggy-banks-with-balance?limit=1337";
axios.get(URI, {}).then((res) => {
let tempList = {
0: {
group: {
title: this.$t('firefly.default_group_title_name')
},
piggies: [
{
name_with_balance: this.no_piggy_bank,
id: 0,
}
],
}
};
for (const key in res.data) {
if (res.data.hasOwnProperty(key) && /^0$|^[1-9]\d*$/.test(key) && key <= 4294967294) {
// add to temp list
let currentPiggy = res.data[key];
if (currentPiggy.objectGroup) {
let groupOrder = currentPiggy.objectGroup.order;
if (!tempList[groupOrder]) {
tempList[groupOrder] = {
group: {
title: currentPiggy.objectGroup.title
},
piggies: [],
};
}
tempList[groupOrder].piggies.push({
name_with_balance: currentPiggy.name_with_balance,
id: currentPiggy.id
});
}
if (!currentPiggy.objectGroup) {
// add to empty one:
tempList[0].piggies.push({name_with_balance: currentPiggy.name_with_balance, id: currentPiggy.id});
}
//console.log(currentPiggy);
this.piggies.push(res.data[key]);
}
}
const ordered = {};
Object.keys(tempList).sort().forEach(function (key) {
let groupName = tempList[key].group.title;
ordered[groupName] = tempList[key];
});
// final list:
this.piggies = ordered;
// console.log(ordered);
});
}
}
}
</script>
<style scoped>

View File

@@ -19,61 +19,61 @@
-->
<template>
<div class="form-group" v-bind:class="{ 'has-error': hasError()}">
<div class="col-sm-12 text-sm">
{{ $t('firefly.date') }}
</div>
<div class="col-sm-12">
<div class="input-group">
<input
type="date"
class="form-control"
name="date[]"
v-bind:title="$t('firefly.date')"
ref="date"
autocomplete="off"
:disabled="index > 0"
v-bind:placeholder="$t('firefly.date')"
:value="value" @input="handleInput"
>
<span class="input-group-btn">
<button
tabIndex="-1"
v-on:click="clearDate"
class="btn btn-default"
type="button"><i class="fa fa-trash-o"></i></button>
</span>
</div>
<ul class="list-unstyled" v-for="error in this.error">
<li class="text-danger">{{ error }}</li>
</ul>
</div>
<div class="form-group" v-bind:class="{ 'has-error': hasError()}">
<div class="col-sm-12 text-sm">
{{ $t('firefly.date') }}
</div>
<div class="col-sm-12">
<div class="input-group">
<input
ref="date"
:disabled="index > 0"
:value="value"
autocomplete="off"
class="form-control"
name="date[]"
type="date"
v-bind:placeholder="$t('firefly.date')"
v-bind:title="$t('firefly.date')" @input="handleInput"
>
<span class="input-group-btn">
<button
class="btn btn-default"
tabIndex="-1"
type="button"
v-on:click="clearDate"><i class="fa fa-trash-o"></i></button>
</span>
</div>
<ul v-for="error in this.error" class="list-unstyled">
<li class="text-danger">{{ error }}</li>
</ul>
</div>
</div>
</template>
<script>
export default {
props: ['error', 'value', 'index'],
name: "StandardDate",
methods: {
hasError: function () {
return this.error.length > 0;
},
handleInput(e) {
this.$emit('input', this.$refs.date.value);
},
clearDate: function () {
//props.value = '';
this.name = '';
this.$refs.date.value = '';
this.$emit('input', this.$refs.date.value);
// some event?
this.$emit('clear:date')
},
}
}
export default {
props: ['error', 'value', 'index'],
name: "StandardDate",
methods: {
hasError: function () {
return this.error.length > 0;
},
handleInput(e) {
this.$emit('input', this.$refs.date.value);
},
clearDate: function () {
//props.value = '';
this.name = '';
this.$refs.date.value = '';
this.$emit('input', this.$refs.date.value);
// some event?
this.$emit('clear:date')
},
}
}
</script>
<style scoped>

View File

@@ -19,91 +19,91 @@
-->
<template>
<div class="form-group"
v-bind:class="{ 'has-error': hasError()}"
>
<div class="col-sm-12 text-sm">
{{ $t('firefly.tags') }}
</div>
<div class="col-sm-12">
<div class="input-group">
<vue-tags-input
v-model="tag"
:tags="tags"
:title="$t('firefly.tags')"
classes="form-input"
:autocomplete-items="autocompleteItems"
:add-only-from-autocomplete="false"
@tags-changed="update"
v-bind:placeholder="$t('firefly.tags')"
/>
<span class="input-group-btn">
<button
v-on:click="clearTags"
tabIndex="-1"
class="btn btn-default"
type="button"><i class="fa fa-trash-o"></i></button>
</span>
</div>
</div>
<ul class="list-unstyled" v-for="error in this.error">
<li class="text-danger">{{ error }}</li>
</ul>
</div>
<div class="form-group"
v-bind:class="{ 'has-error': hasError()}"
>
<div class="col-sm-12 text-sm">
{{ $t('firefly.tags') }}
</div>
<div class="col-sm-12">
<div class="input-group">
<vue-tags-input
v-model="tag"
:add-only-from-autocomplete="false"
:autocomplete-items="autocompleteItems"
:tags="tags"
:title="$t('firefly.tags')"
classes="form-input"
v-bind:placeholder="$t('firefly.tags')"
@tags-changed="update"
/>
<span class="input-group-btn">
<button
class="btn btn-default"
tabIndex="-1"
type="button"
v-on:click="clearTags"><i class="fa fa-trash-o"></i></button>
</span>
</div>
</div>
<ul v-for="error in this.error" class="list-unstyled">
<li class="text-danger">{{ error }}</li>
</ul>
</div>
</div>
</template>
<script>
import axios from 'axios';
import VueTagsInput from '@johmun/vue-tags-input';
import axios from 'axios';
import VueTagsInput from '@johmun/vue-tags-input';
export default {
name: "Tags",
components: {
VueTagsInput
},
props: ['value','error'],
data() {
return {
tag: '',
autocompleteItems: [],
debounce: null,
tags: this.value,
};
},
watch: {
'tag': 'initItems',
},
methods: {
update(newTags) {
this.autocompleteItems = [];
this.tags = newTags;
this.$emit('input', this.tags);
},
clearTags() {
this.tags = [];
},
hasError: function () {
return this.error.length > 0;
},
initItems() {
// console.log('Now in initItems');
if (this.tag.length < 2) {
return;
}
const url = document.getElementsByTagName('base')[0].href + `api/v1/autocomplete/tags?query=${this.tag}`;
export default {
name: "Tags",
components: {
VueTagsInput
},
props: ['value', 'error'],
data() {
return {
tag: '',
autocompleteItems: [],
debounce: null,
tags: this.value,
};
},
watch: {
'tag': 'initItems',
},
methods: {
update(newTags) {
this.autocompleteItems = [];
this.tags = newTags;
this.$emit('input', this.tags);
},
clearTags() {
this.tags = [];
},
hasError: function () {
return this.error.length > 0;
},
initItems() {
// console.log('Now in initItems');
if (this.tag.length < 2) {
return;
}
const url = document.getElementsByTagName('base')[0].href + `api/v1/autocomplete/tags?query=${this.tag}`;
clearTimeout(this.debounce);
this.debounce = setTimeout(() => {
axios.get(url).then(response => {
this.autocompleteItems = response.data.map(a => {
return {text: a.tag};
});
}).catch(() => console.warn('Oh. Something went wrong loading tags.'));
}, 600);
},
},
}
clearTimeout(this.debounce);
this.debounce = setTimeout(() => {
axios.get(url).then(response => {
this.autocompleteItems = response.data.map(a => {
return {text: a.tag};
});
}).catch(() => console.warn('Oh. Something went wrong loading tags.'));
}, 600);
},
},
}
</script>
<style scoped>

View File

@@ -26,35 +26,35 @@
<div class="col-sm-12">
<div class="input-group">
<input
type="text"
ref="descr"
:title="$t('firefly.description')"
:value="value"
autocomplete="off"
class="form-control"
name="description[]"
:title="$t('firefly.description')"
v-on:keypress="handleEnter"
v-on:submit.prevent
ref="descr"
autocomplete="off"
type="text"
v-bind:placeholder="$t('firefly.description')"
:value="value" @input="handleInput"
@input="handleInput"
v-on:keypress="handleEnter" v-on:submit.prevent
>
<span class="input-group-btn">
<button
v-on:click="clearDescription"
tabIndex="-1"
class="btn btn-default"
type="button"><i class="fa fa-trash-o"></i></button>
tabIndex="-1"
type="button"
v-on:click="clearDescription"><i class="fa fa-trash-o"></i></button>
</span>
</div>
<typeahead
v-model="name"
:async-function="aSyncFunction"
:open-on-empty=true
:open-on-focus=true
v-on:input="selectedItem"
:async-function="aSyncFunction"
v-model="name"
:target="target"
item-key="description"
v-on:input="selectedItem"
></typeahead>
<ul class="list-unstyled" v-for="error in this.error">
<ul v-for="error in this.error" class="list-unstyled">
<li class="text-danger">{{ error }}</li>
</ul>
</div>

View File

@@ -19,70 +19,70 @@
-->
<template>
<div class="form-group">
<div class="col-sm-12">
<label v-if="sentence !== ''" class="control-label text-info">
{{ sentence }}
</label>
</div>
<div class="form-group">
<div class="col-sm-12">
<label v-if="sentence !== ''" class="control-label text-info">
{{ sentence }}
</label>
</div>
</div>
</template>
<script>
export default {
props: {
source: String,
destination: String,
type: String
},
methods: {
changeValue: function () {
if (this.source && this.destination) {
let transactionType = '';
if (window.accountToTypes[this.source]) {
if (window.accountToTypes[this.source][this.destination]) {
transactionType = window.accountToTypes[this.source][this.destination];
} else {
console.warn('User selected an impossible destination.');
}
} else {
console.warn('User selected an impossible source.');
}
if ('' !== transactionType) {
this.transactionType = transactionType;
this.sentence = this.$t('firefly.you_create_' + transactionType.toLowerCase());
export default {
props: {
source: String,
destination: String,
type: String
},
methods: {
changeValue: function () {
if (this.source && this.destination) {
let transactionType = '';
if (window.accountToTypes[this.source]) {
if (window.accountToTypes[this.source][this.destination]) {
transactionType = window.accountToTypes[this.source][this.destination];
} else {
console.warn('User selected an impossible destination.');
}
} else {
console.warn('User selected an impossible source.');
}
if ('' !== transactionType) {
this.transactionType = transactionType;
this.sentence = this.$t('firefly.you_create_' + transactionType.toLowerCase());
// Must also emit a change to set ALL sources and destinations to this particular type.
this.$emit('act:limitSourceType', this.source);
this.$emit('act:limitDestinationType', this.destination);
}
} else {
this.sentence = '';
this.transactionType = '';
}
// emit event how cool is that.
this.$emit('set:transactionType', this.transactionType);
}
},
data() {
return {
transactionType: this.type,
sentence: ''
}
},
watch: {
source() {
this.changeValue();
},
destination() {
this.changeValue();
}
},
name: "TransactionType"
// Must also emit a change to set ALL sources and destinations to this particular type.
this.$emit('act:limitSourceType', this.source);
this.$emit('act:limitDestinationType', this.destination);
}
} else {
this.sentence = '';
this.transactionType = '';
}
// emit event how cool is that.
this.$emit('set:transactionType', this.transactionType);
}
},
data() {
return {
transactionType: this.type,
sentence: ''
}
},
watch: {
source() {
this.changeValue();
},
destination() {
this.changeValue();
}
},
name: "TransactionType"
}
</script>
<style scoped>