mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-10-03 11:08:28 +00:00
Update frontpage and packages.
This commit is contained in:
@@ -34,7 +34,7 @@
|
||||
<div class="card-body">
|
||||
<GenericTextInput :disabled="submitting" v-model="name" field-name="name" :errors="errors.name" :title="$t('form.name')"
|
||||
v-on:set-field="storeField($event)"/>
|
||||
<GenericCurrency :disabled="submitting" v-model="currency_id" :errors="errors.currency" v-on:set-field="storeField($event)"/>
|
||||
<GenericCurrency :disabled="submitting" v-model="currency_id" :errors="errors.currency_id" v-on:set-field="storeField($event)"/>
|
||||
<AssetAccountRole :disabled="submitting" v-if="'asset' === type" v-model="account_role" :errors="errors.account_role"
|
||||
v-on:set-field="storeField($event)"/>
|
||||
<LiabilityType :disabled="submitting" v-if="'liabilities' === type" v-model="liability_type" :errors="errors.liability_type"
|
||||
@@ -88,7 +88,15 @@
|
||||
|
||||
<GenericLocation :disabled="submitting" v-model="location" :title="$t('form.location')" :errors="errors.location"
|
||||
v-on:set-field="storeField($event)"/>
|
||||
<GenericAttachments :disabled="submitting" :title="$t('form.attachments')" field-name="attachments" :errors="errors.attachments"/>
|
||||
|
||||
<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"
|
||||
/>
|
||||
|
||||
|
||||
</div>
|
||||
@@ -168,7 +176,7 @@ export default {
|
||||
// info
|
||||
name: '',
|
||||
type: 'any',
|
||||
|
||||
currency_id: null,
|
||||
|
||||
// liabilities
|
||||
liability_type: 'Loan',
|
||||
@@ -178,6 +186,7 @@ export default {
|
||||
interest: null,
|
||||
interest_period: 'monthly',
|
||||
|
||||
|
||||
// optional fields
|
||||
iban: null,
|
||||
bic: null,
|
||||
@@ -190,12 +199,20 @@ export default {
|
||||
notes: null,
|
||||
location: {},
|
||||
|
||||
// has attachments to upload?
|
||||
hasAttachments: false,
|
||||
uploadTrigger: false,
|
||||
uploadObjectId: 0,
|
||||
uploadObjectType: 'Account',
|
||||
|
||||
|
||||
account_role: 'defaultAsset',
|
||||
errors: {},
|
||||
errors: {
|
||||
currency_id: [],
|
||||
},
|
||||
defaultErrors: {
|
||||
name: [],
|
||||
currency: [],
|
||||
currency_id: [],
|
||||
account_role: [],
|
||||
liability_type: [],
|
||||
liability_direction: [],
|
||||
@@ -217,7 +234,7 @@ export default {
|
||||
},
|
||||
methods: {
|
||||
storeField: function (payload) {
|
||||
// console.log(payload);
|
||||
console.log(payload);
|
||||
if ('location' === payload.field) {
|
||||
if (true === payload.value.hasMarker) {
|
||||
this.location = payload.value;
|
||||
@@ -228,6 +245,15 @@ export default {
|
||||
}
|
||||
this[payload.field] = payload.value;
|
||||
},
|
||||
selectedAttachments: function (e) {
|
||||
this.hasAttachments = true;
|
||||
},
|
||||
selectedNoAttachments: function (e) {
|
||||
this.hasAttachments = false;
|
||||
},
|
||||
uploadedAttachments: function (e) {
|
||||
this.finishSubmission();
|
||||
},
|
||||
submitForm: function (e) {
|
||||
e.preventDefault();
|
||||
this.submitting = true;
|
||||
@@ -239,35 +265,16 @@ export default {
|
||||
axios.post(url, submission)
|
||||
.then(response => {
|
||||
this.errors = lodashClonedeep(this.defaultErrors);
|
||||
// console.log('success!');
|
||||
this.returnedId = parseInt(response.data.data.id);
|
||||
this.returnedTitle = response.data.data.attributes.name;
|
||||
this.successMessage = this.$t('firefly.stored_new_account_js', {ID: this.returnedId, name: this.returnedTitle});
|
||||
// stay here is false?
|
||||
if (false === this.createAnother) {
|
||||
window.location.href = (window.previousURL ?? '/') + '?account_id=' + this.returnedId + '&message=created';
|
||||
return;
|
||||
|
||||
if (this.hasAttachments) {
|
||||
// upload attachments. Do a callback to a finish up method.
|
||||
this.uploadObjectId = this.returnedId;
|
||||
this.uploadTrigger = true;
|
||||
}
|
||||
this.submitting = false;
|
||||
if (this.resetFormAfter) {
|
||||
// console.log('reset!');
|
||||
this.name = '';
|
||||
this.liability_type = 'Loan';
|
||||
this.liability_direction = 'debit';
|
||||
this.liability_amount = null;
|
||||
this.liability_date = null;
|
||||
this.interest = null;
|
||||
this.interest_period = 'monthly';
|
||||
this.iban = null;
|
||||
this.bic = null;
|
||||
this.account_number = null;
|
||||
this.virtual_balance = null;
|
||||
this.opening_balance = null;
|
||||
this.opening_balance_date = null;
|
||||
this.include_net_worth = true;
|
||||
this.active = true;
|
||||
this.notes = null;
|
||||
this.location = {};
|
||||
if (!this.hasAttachments) {
|
||||
this.finishSubmission();
|
||||
}
|
||||
})
|
||||
.catch(error => {
|
||||
@@ -275,6 +282,35 @@ export default {
|
||||
this.parseErrors(error.response.data);
|
||||
});
|
||||
},
|
||||
finishSubmission: function () {
|
||||
this.successMessage = this.$t('firefly.stored_new_account_js', {ID: this.returnedId, name: this.returnedTitle});
|
||||
// stay here is false?
|
||||
if (false === this.createAnother) {
|
||||
window.location.href = (window.previousURL ?? '/') + '?account_id=' + this.returnedId + '&message=created';
|
||||
return;
|
||||
}
|
||||
this.submitting = false;
|
||||
if (this.resetFormAfter) {
|
||||
// console.log('reset!');
|
||||
this.name = '';
|
||||
this.liability_type = 'Loan';
|
||||
this.liability_direction = 'debit';
|
||||
this.liability_amount = null;
|
||||
this.liability_date = null;
|
||||
this.interest = null;
|
||||
this.interest_period = 'monthly';
|
||||
this.iban = null;
|
||||
this.bic = null;
|
||||
this.account_number = null;
|
||||
this.virtual_balance = null;
|
||||
this.opening_balance = null;
|
||||
this.opening_balance_date = null;
|
||||
this.include_net_worth = true;
|
||||
this.active = true;
|
||||
this.notes = null;
|
||||
this.location = {};
|
||||
}
|
||||
},
|
||||
parseErrors: function (errors) {
|
||||
this.errors = lodashClonedeep(this.defaultErrors);
|
||||
// console.log(errors);
|
||||
@@ -282,7 +318,7 @@ export default {
|
||||
if (errors.errors.hasOwnProperty(i)) {
|
||||
this.errors[i] = errors.errors[i];
|
||||
}
|
||||
if('liability_start_date' === i) {
|
||||
if ('liability_start_date' === i) {
|
||||
this.errors.opening_balance_date = errors.errors[i];
|
||||
}
|
||||
}
|
||||
@@ -314,7 +350,7 @@ export default {
|
||||
submission.opening_balance = this.opening_balance;
|
||||
submission.opening_balance_date = this.opening_balance_date;
|
||||
}
|
||||
if('' === submission.opening_balance) {
|
||||
if ('' === submission.opening_balance) {
|
||||
delete submission.opening_balance;
|
||||
}
|
||||
|
||||
|
@@ -30,7 +30,8 @@
|
||||
></b-pagination>
|
||||
</div>
|
||||
<div class="col-lg-4 col-md-6 col-sm-12 col-xs-12">
|
||||
<button @click="newCacheKey" class="btn btn-sm float-right btn-info"><span class="fas fa-sync"></span></button>
|
||||
<a :href="'./accounts/create/' + type" class="btn btn-sm mb-2 float-right btn-success" :title="$t('firefly.create_new_' + type)"><span class="fas fa-plus"></span> {{ $t('firefly.create_new_' + type) }}</a>
|
||||
<button @click="newCacheKey" class="btn btn-sm mb-2 mr-2 float-right btn-info"><span class="fas fa-sync"></span></button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
@@ -151,9 +152,6 @@
|
||||
</template>
|
||||
</b-table>
|
||||
</div>
|
||||
<div class="card-footer">
|
||||
<a :href="'./accounts/create/' + type" class="btn btn-success" :title="$t('firefly.create_new_' + type)">{{ $t('firefly.create_new_' + type) }}</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -167,7 +165,8 @@
|
||||
></b-pagination>
|
||||
</div>
|
||||
<div class="col-lg-4 col-md-6 col-sm-12 col-xs-12">
|
||||
<button @click="newCacheKey" class="btn btn-sm float-right btn-info"><span class="fas fa-sync"></span></button>
|
||||
<a :href="'./accounts/create/' + type" class="btn btn-sm mt-2 float-right btn-success" :title="$t('firefly.create_new_' + type)"><span class="fas fa-plus"></span> {{ $t('firefly.create_new_' + type) }}</a>
|
||||
<button @click="newCacheKey" class="btn btn-sm mt-2 mr-2 float-right btn-info"><span class="fas fa-sync"></span></button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
@@ -34,7 +34,7 @@
|
||||
<div class="card-body">
|
||||
<GenericTextInput :disabled="submitting" v-model="name" field-name="name" :errors="errors.name" :title="$t('form.name')"
|
||||
v-on:set-field="storeField($event)"/>
|
||||
<GenericCurrency :disabled="submitting" v-model="currency_id" :errors="errors.currency" v-on:set-field="storeField($event)"/>
|
||||
<GenericCurrency :disabled="submitting" v-model="currency_id" :errors="errors.currency_id" v-on:set-field="storeField($event)"/>
|
||||
|
||||
<GenericTextInput :disabled="submitting" field-type="number" field-step="any" v-model="amount_min"
|
||||
field-name="amount_min" :errors="errors.amount_min" :title="$t('form.amount_min')" v-on:set-field="storeField($event)"/>
|
||||
@@ -72,7 +72,6 @@
|
||||
: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')"
|
||||
@@ -124,6 +123,7 @@ import GenericCurrency from "../form/GenericCurrency";
|
||||
import GenericTextarea from "../form/GenericTextarea";
|
||||
import GenericAttachments from "../form/GenericAttachments";
|
||||
import GenericGroup from "../form/GenericGroup";
|
||||
import format from "date-fns/format";
|
||||
|
||||
const lodashClonedeep = require('lodash.clonedeep');
|
||||
|
||||
@@ -167,12 +167,14 @@ export default {
|
||||
|
||||
// errors
|
||||
errors: {
|
||||
currency: [],
|
||||
currency_id: [],
|
||||
repeat_freq: [],
|
||||
group_title: [],
|
||||
},
|
||||
defaultErrors: {
|
||||
name: [],
|
||||
currency: [],
|
||||
group_title: [],
|
||||
currency_id: [],
|
||||
amount_min: [],
|
||||
amount_max: [],
|
||||
date: [],
|
||||
@@ -182,9 +184,12 @@ export default {
|
||||
}
|
||||
}
|
||||
},
|
||||
created() {
|
||||
this.date = format(new Date, 'yyyy-MM-dd');
|
||||
},
|
||||
methods: {
|
||||
storeField: function (payload) {
|
||||
// console.log(payload);
|
||||
console.log(payload);
|
||||
if ('location' === payload.field) {
|
||||
if (true === payload.value.hasMarker) {
|
||||
this.location = payload.value;
|
||||
@@ -259,14 +264,14 @@ export default {
|
||||
getSubmission: function () {
|
||||
let submission = {
|
||||
name: this.name,
|
||||
currency_id: this.currency,
|
||||
currency_id: this.currency_id,
|
||||
amount_min: this.amount_min,
|
||||
amount_max: this.amount_max,
|
||||
date: this.date,
|
||||
repeat_freq: this.repeat_freq,
|
||||
skip: this.skip,
|
||||
active: true,
|
||||
object_group_title: this.object_group_title
|
||||
object_group_title: this.group_title
|
||||
};
|
||||
if (Object.keys(this.location).length >= 3) {
|
||||
submission.longitude = this.location.lng;
|
||||
|
@@ -22,7 +22,7 @@
|
||||
<div>
|
||||
<div class="row">
|
||||
<div class="col-lg-12 col-md-12 col-sm-12 col-xs-12">
|
||||
<a href="./subscriptions/create" class="btn btn-sm mb-2 float-right btn-success"><span class="fas fa-plus"></span> {{ $t('firefly.create_new_bill') }}</a>
|
||||
<a href="./subscriptions/create" class="btn btn-sm mb-2 float-right btn-success"><span class="fas fa-plus"></span> {{ $t('firefly.create_new_bill') }}</a>
|
||||
<button @click="newCacheKey" class="btn btn-sm mb-2 mr-2 float-right btn-info"><span class="fas fa-sync"></span></button>
|
||||
</div>
|
||||
</div>
|
||||
|
@@ -46,8 +46,6 @@
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import {mapGetters} from "vuex";
|
||||
|
||||
export default {
|
||||
name: "GenericCurrency",
|
||||
props: {
|
||||
@@ -58,9 +56,6 @@ export default {
|
||||
default: false
|
||||
},
|
||||
},
|
||||
computed: {
|
||||
...mapGetters('root', [ 'cacheKey']),
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
loading: true,
|
||||
@@ -73,7 +68,7 @@ export default {
|
||||
this.loadCurrencyPage(1);
|
||||
},
|
||||
loadCurrencyPage: function (page) {
|
||||
axios.get('./api/v1/currencies?page=' + page + '&key=' + this.cacheKey)
|
||||
axios.get('./api/v1/currencies?page=' + page)
|
||||
.then(response => {
|
||||
let totalPages = parseInt(response.data.meta.pagination.total_pages);
|
||||
let currentPage = parseInt(response.data.meta.pagination.current_page);
|
||||
|
@@ -23,18 +23,40 @@
|
||||
<div class="text-xs d-none d-lg-block d-xl-block">
|
||||
{{ title }}
|
||||
</div>
|
||||
<div class="input-group">
|
||||
group
|
||||
</div>
|
||||
<vue-typeahead-bootstrap
|
||||
v-model="localValue"
|
||||
:data="groupTitles"
|
||||
:inputClass="errors.length > 0 ? 'is-invalid' : ''"
|
||||
:minMatchingChars="3"
|
||||
:placeholder="title"
|
||||
:serializer="item => item.title"
|
||||
:showOnFocus=true
|
||||
autofocus
|
||||
inputName="description[]"
|
||||
@input="lookupGroupTitle"
|
||||
>
|
||||
<template slot="append">
|
||||
<div class="input-group-append">
|
||||
<button class="btn btn-outline-secondary" tabindex="-1" type="button" v-on:click="clearGroupTitle"><span class="far fa-trash-alt"></span></button>
|
||||
</div>
|
||||
</template>
|
||||
</vue-typeahead-bootstrap>
|
||||
<span v-if="errors.length > 0">
|
||||
<span v-for="error in errors" class="text-danger small">{{ error }}<br/></span>
|
||||
</span>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
import VueTypeaheadBootstrap from 'vue-typeahead-bootstrap';
|
||||
import {debounce} from "lodash";
|
||||
|
||||
<script>
|
||||
import VueTypeaheadBootstrap from "vue-typeahead-bootstrap";
|
||||
import {debounce} from "lodash";
|
||||
|
||||
export default {
|
||||
name: "GenericGroup",
|
||||
components: {VueTypeaheadBootstrap},
|
||||
props: {
|
||||
title: {
|
||||
type: String,
|
||||
@@ -45,8 +67,8 @@ export default {
|
||||
default: ''
|
||||
},
|
||||
value: {
|
||||
type: Boolean,
|
||||
default: false
|
||||
type: String,
|
||||
default: ''
|
||||
},
|
||||
fieldName: {
|
||||
type: String,
|
||||
@@ -63,9 +85,26 @@ export default {
|
||||
}
|
||||
},
|
||||
},
|
||||
methods: {
|
||||
clearGroupTitle: function () {
|
||||
this.localValue = '';
|
||||
},
|
||||
getACURL: function (query) {
|
||||
// update autocomplete URL:
|
||||
return document.getElementsByTagName('base')[0].href + 'api/v1/autocomplete/object-groups?query=' + query;
|
||||
},
|
||||
lookupGroupTitle: debounce(function () {
|
||||
// update autocomplete URL:
|
||||
axios.get(this.getACURL(this.value))
|
||||
.then(response => {
|
||||
this.groupTitles = response.data;
|
||||
})
|
||||
}, 300)
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
localValue: this.value
|
||||
localValue: this.value,
|
||||
groupTitles: [],
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
|
Reference in New Issue
Block a user