Update frontpage and packages.

This commit is contained in:
James Cole 2021-07-30 07:02:11 +02:00
parent 1a79525024
commit 8ebdd481aa
No known key found for this signature in database
GPG Key ID: B5669F9493CDE38D
24 changed files with 362 additions and 282 deletions

368
composer.lock generated

File diff suppressed because it is too large Load Diff

View File

@ -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,9 +265,24 @@ 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;
if (this.hasAttachments) {
// upload attachments. Do a callback to a finish up method.
this.uploadObjectId = this.returnedId;
this.uploadTrigger = true;
}
if (!this.hasAttachments) {
this.finishSubmission();
}
})
.catch(error => {
this.submitting = false;
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) {
@ -269,11 +310,6 @@ export default {
this.notes = null;
this.location = {};
}
})
.catch(error => {
this.submitting = false;
this.parseErrors(error.response.data);
});
},
parseErrors: function (errors) {
this.errors = lodashClonedeep(this.defaultErrors);
@ -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;
}

View File

@ -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>

View File

@ -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;

View File

@ -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);

View File

@ -23,18 +23,40 @@
<div class="text-xs d-none d-lg-block d-xl-block">
{{ title }}
</div>
<div class="input-group">
group
<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: {

View File

@ -1064,9 +1064,9 @@
integrity sha512-Klz949h02Gz2uZCMGwDUSDS1YBlTdDDgbWHi+81l29tQALUtvz4rAYi5uoVhE5Lagoq6DeqAUlbrHvW/mXDgdQ==
"@types/node@*":
version "16.4.6"
resolved "https://registry.yarnpkg.com/@types/node/-/node-16.4.6.tgz#1734d119dfa8fede5606d35ae10f9fc9c84d889b"
integrity sha512-FKyawK3o5KL16AwbeFajen8G4K3mmqUrQsehn5wNKs8IzlKHE8TfnSmILXVMVziAEcnB23u1RCFU1NT6hSyr7Q==
version "16.4.7"
resolved "https://registry.yarnpkg.com/@types/node/-/node-16.4.7.tgz#f7afa78769d4b477f5092d7c3468e2e8653d779c"
integrity sha512-aDDY54sst8sx47CWT6QQqIZp45yURq4dic0+HCYfYNcY5Ejlb/CLmFnRLfy3wQuYafOeh3lB/DAKaqRKBtcZmA==
"@types/parse-json@^4.0.0":
version "4.0.0"
@ -1830,9 +1830,9 @@ buffer-equal@0.0.1:
integrity sha1-kbx0sR6kBbyRa8aqkI+q+ltKrEs=
buffer-from@^1.0.0:
version "1.1.1"
resolved "https://registry.yarnpkg.com/buffer-from/-/buffer-from-1.1.1.tgz#32713bc028f75c02fdb710d7c7bcec1f2c6070ef"
integrity sha512-MQcXEUbCKtEo7bhqEs6560Hyd4XaovZlO/k9V3hjVUF/zwW7KBVdSK4gIt/bzwS9MbR5qob+F5jusZsb0YQK2A==
version "1.1.2"
resolved "https://registry.yarnpkg.com/buffer-from/-/buffer-from-1.1.2.tgz#2b146a6fd72e80b4f55d255f35ed59a3a9a41bd5"
integrity sha512-E+XQCRwSbaaiChtv6k6Dwgc+bx+Bs6vuKJHHl5kox/BaKbhiXzqQOwK4cO22yElGp2OCmjwVhT3HmxgyPGnJfQ==
buffer-indexof@^1.0.0:
version "1.1.1"
@ -2000,9 +2000,9 @@ clean-css@^4.2.3:
source-map "~0.6.0"
"clean-css@^4.2.3 || ^5.1.2":
version "5.1.3"
resolved "https://registry.yarnpkg.com/clean-css/-/clean-css-5.1.3.tgz#42348778c3acb0083946ba340896802be5517ee2"
integrity sha512-qGXzUCDpLwAlPx0kYeU4QXjzQIcIYZbJjD4FNm7NnSjoP0hYMVZhHOpUYJ6AwfkMX2cceLRq54MeCgHy/va1cA==
version "5.1.4"
resolved "https://registry.yarnpkg.com/clean-css/-/clean-css-5.1.4.tgz#d191c98347f9fc36b301f99bb827898151175782"
integrity sha512-e6JAuR0T2ahg7fOSv98Nxqh7mHWOac5TaCSgrr61h/6mkPLwlxX38hzob4h6IKj/UHlrrLXvAEjWqXlvi8r8lQ==
dependencies:
source-map "~0.6.0"
@ -2212,9 +2212,9 @@ cookie@0.4.0:
integrity sha512-+Hp8fLp57wnUSt0tY0tHEXh4voZRDnoIrZPqlo3DPiI4y9lwg/jqx+1Om94/W6ZaPDOUbnjOt/99w66zk+l1Xg==
core-js-compat@^3.14.0, core-js-compat@^3.15.0:
version "3.15.2"
resolved "https://registry.yarnpkg.com/core-js-compat/-/core-js-compat-3.15.2.tgz#47272fbb479880de14b4e6081f71f3492f5bd3cb"
integrity sha512-Wp+BJVvwopjI+A1EFqm2dwUmWYXrvucmtIB2LgXn/Rb+gWPKYxtmb4GKHGKG/KGF1eK9jfjzT38DITbTOCX/SQ==
version "3.16.0"
resolved "https://registry.yarnpkg.com/core-js-compat/-/core-js-compat-3.16.0.tgz#fced4a0a534e7e02f7e084bff66c701f8281805f"
integrity sha512-5D9sPHCdewoUK7pSUPfTF7ZhLh8k9/CoJXWUEo+F1dZT5Z1DVgcuRqUKhjeKW+YLb8f21rTFgWwQJiNw1hoZ5Q==
dependencies:
browserslist "^4.16.6"
semver "7.0.0"
@ -2225,9 +2225,9 @@ core-js@^2.4.0:
integrity sha512-Kb2wC0fvsWfQrgk8HU5lW6U/Lcs8+9aaYcy4ZFc6DDlo4nZ7n70dEgE5rtR0oG6ufKDUnrwfWL1mXR5ljDatrQ==
core-js@^3.15.2:
version "3.15.2"
resolved "https://registry.yarnpkg.com/core-js/-/core-js-3.15.2.tgz#740660d2ff55ef34ce664d7e2455119c5bdd3d61"
integrity sha512-tKs41J7NJVuaya8DxIOCnl8QuPHx5/ZVbFo1oKgVl1qHFBBrDctzQGtuLjPpRdNTWmKPH6oEvgN/MUID+l485Q==
version "3.16.0"
resolved "https://registry.yarnpkg.com/core-js/-/core-js-3.16.0.tgz#1d46fb33720bc1fa7f90d20431f36a5540858986"
integrity sha512-5+5VxRFmSf97nM8Jr2wzOwLqRo6zphH2aX+7KsAUONObyzakDNq2G/bgbhinxB4PoV9L3aXQYhiDKyIKWd2c8g==
core-util-is@~1.0.0:
version "1.0.2"
@ -2924,9 +2924,9 @@ ekko-lightbox@^5.3.0:
integrity sha512-mbacwySuVD3Ad6F2hTkjSTvJt59bcVv2l/TmBerp4xZnLak8tPtA4AScUn4DL42c1ksTiAO6sGhJZ52P/1Qgew==
electron-to-chromium@^1.3.723:
version "1.3.790"
resolved "https://registry.yarnpkg.com/electron-to-chromium/-/electron-to-chromium-1.3.790.tgz#5c569290929d92c8094fa08c79bc9393ca9e94e7"
integrity sha512-epMH/S2MkhBv+Y0+nHK8dC7bzmOaPwcmiYqt+VwxSUJLgPzkqZnGUEQ8eVhy5zGmgWm9tDDdXkHDzOEsVU979A==
version "1.3.791"
resolved "https://registry.yarnpkg.com/electron-to-chromium/-/electron-to-chromium-1.3.791.tgz#e38f325ff22470bdcff34409d58c0baf9c2e3e93"
integrity sha512-Tdx7w1fZpeWOOBluK+kXTAKCXyc79K65RB6Zp0+sPSZZhDjXlrxfGlXrlMGVVQUrKCyEZFQs1UBBLNz5IdbF0g==
elliptic@^6.5.3:
version "6.5.4"
@ -6652,15 +6652,15 @@ webpack-sources@^1.1.0:
source-list-map "^2.0.0"
source-map "~0.6.1"
webpack-sources@^3.0.1:
version "3.0.3"
resolved "https://registry.yarnpkg.com/webpack-sources/-/webpack-sources-3.0.3.tgz#33c478e1f67bf5577d3ec5ced4bded0a06ec88d0"
integrity sha512-/Qgfp3i1FT2z/tpNj+d/ZeDTbdOWG5V6DdTjIvMLVhrhtpFxmMTZrGnEQEa0J7HF8Plls5kGa7TZ7IsvgnFdtA==
webpack-sources@^3.1.1:
version "3.1.1"
resolved "https://registry.yarnpkg.com/webpack-sources/-/webpack-sources-3.1.1.tgz#586d15bc9a9723765f6a735f672357d6402f9c57"
integrity sha512-ztUmIWq0LWaw+1YyR3bXtUPjt8vQedtI9WxGn/q1V1ASHsombnaso7MN9S25lzKS/OuC9Q8lEg3GsZexjDbdlQ==
webpack@^5.38.1, webpack@^5.40.0:
version "5.47.0"
resolved "https://registry.yarnpkg.com/webpack/-/webpack-5.47.0.tgz#3c13862b5d7b428792bfe76c5f67a0f43ba685f8"
integrity sha512-soKLGwcUM1R3YEbJhJNiZzy7T43TnI7ENda/ywfDp9G1mDlDTpO+qfc8I5b0AzMr9xM3jyvQ0n7ctJyiXuXW6Q==
version "5.47.1"
resolved "https://registry.yarnpkg.com/webpack/-/webpack-5.47.1.tgz#20fb7d76f68912a2249a6dd7ff16faa178049ad2"
integrity sha512-cW+Mzy9SCDapFV4OrkHuP6EFV2mAsiQd+gOa3PKtHNoKg6qPqQXZzBlHH+CnQG1osplBCqwsJZ8CfGO6XWah0g==
dependencies:
"@types/eslint-scope" "^3.7.0"
"@types/estree" "^0.0.50"
@ -6684,7 +6684,7 @@ webpack@^5.38.1, webpack@^5.40.0:
tapable "^2.1.1"
terser-webpack-plugin "^5.1.3"
watchpack "^2.2.0"
webpack-sources "^3.0.1"
webpack-sources "^3.1.1"
webpackbar@^5.0.0-3:
version "5.0.0-3"

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long