Fix store references

This commit is contained in:
James Cole
2022-05-08 09:32:07 +02:00
31 changed files with 225 additions and 121 deletions

View File

@@ -108,7 +108,11 @@ class FixTransactionTypes extends Command
} }
$expectedType = (string) config(sprintf('firefly.account_to_transaction.%s.%s', $source->accountType->type, $destination->accountType->type)); $expectedType = (string) config(sprintf('firefly.account_to_transaction.%s.%s', $source->accountType->type, $destination->accountType->type));
if ($expectedType !== $type) { if ($expectedType !== $type) {
$this->line(sprintf('Transaction journal #%d was of type "%s" but is corrected to "%s"', $journal->id, $type, $expectedType)); $this->line(
sprintf('Transaction journal #%d was of type "%s" but is corrected to "%s" (%s -> %s)',
$journal->id, $type, $expectedType,
$source->accountType->type, $destination->accountType->type,
));
$this->changeJournal($journal, $expectedType); $this->changeJournal($journal, $expectedType);
return true; return true;

View File

@@ -608,7 +608,10 @@ return [
AccountType::RECONCILIATION => TransactionTypeModel::RECONCILIATION, AccountType::RECONCILIATION => TransactionTypeModel::RECONCILIATION,
], ],
AccountType::CASH => [ AccountType::CASH => [
AccountType::ASSET => TransactionTypeEnum::DEPOSIT->value, AccountType::ASSET => TransactionTypeModel::DEPOSIT,
AccountType::LOAN => TransactionTypeModel::DEPOSIT,
AccountType::DEBT => TransactionTypeModel::DEPOSIT,
AccountType::MORTGAGE => TransactionTypeModel::DEPOSIT,
], ],
AccountType::DEBT => [ AccountType::DEBT => [
AccountType::ASSET => TransactionTypeEnum::DEPOSIT->value, AccountType::ASSET => TransactionTypeEnum::DEPOSIT->value,
@@ -693,6 +696,7 @@ return [
AccountType::LOAN => [AccountType::LIABILITY_CREDIT], AccountType::LOAN => [AccountType::LIABILITY_CREDIT],
AccountType::DEBT => [AccountType::LIABILITY_CREDIT], AccountType::DEBT => [AccountType::LIABILITY_CREDIT],
AccountType::MORTGAGE => [AccountType::LIABILITY_CREDIT], AccountType::MORTGAGE => [AccountType::LIABILITY_CREDIT],
AccountType::LIABILITY_CREDIT => [AccountType::LOAN, AccountType::DEBT, AccountType::MORTGAGE],
], ],
], ],
// if you add fields to this array, dont forget to update the export routine (ExportDataGenerator). // if you add fields to this array, dont forget to update the export routine (ExportDataGenerator).

View File

@@ -159,18 +159,24 @@ export default {
}, },
mounted() { mounted() {
this.type = this.$route.params.type; this.type = this.$route.params.type;
if (null === this.getRange.start || null === this.getRange.end) {
if (null === this.store.getRange.start || null === this.store.getRange.end) {
// subscribe, then update: // subscribe, then update:
const $store = useStore(); this.store.$onAction(
$store.subscribe((mutation, state) => { ({name, $store, args, after, onError,}) => {
if ('fireflyiii/setRange' === mutation.type) { after((result) => {
this.range = {start: mutation.payload.start, end: mutation.payload.end}; if (name === 'setRange') {
this.range = result;
this.triggerUpdate(); this.triggerUpdate();
} }
}); })
} }
if (null !== this.getRange.start && null !== this.getRange.end) { )
this.range = {start: this.getRange.start, end: this.getRange.end}; }
if (null !== this.store.getRange.start && null !== this.store.getRange.end) {
this.range = {start: this.store.getRange.start, end: this.store.getRange.end};
this.triggerUpdate(); this.triggerUpdate();
} }
}, },

View File

@@ -168,7 +168,7 @@ export default {
}, },
destroyBudget: function (id) { destroyBudget: function (id) {
(new Destroy('budgets')).destroy(id).then(() => { (new Destroy('budgets')).destroy(id).then(() => {
this.store.dispatch('fireflyiii/refreshCacheKey'); this.store.refreshCacheKey();
this.triggerUpdate(); this.triggerUpdate();
}); });
}, },

View File

@@ -76,6 +76,7 @@
<script> <script>
import Get from "../../api/categories/get"; import Get from "../../api/categories/get";
import Put from "../../api/categories/put"; import Put from "../../api/categories/put";
import {useFireflyIIIStore} from "../../stores/fireflyiii";
export default { export default {
name: "Edit", name: "Edit",
@@ -91,6 +92,7 @@ export default {
// category fields: // category fields:
id: 0, id: 0,
name: '', name: '',
store: null
} }
}, },
computed: { computed: {
@@ -101,6 +103,7 @@ export default {
created() { created() {
this.id = parseInt(this.$route.params.id); this.id = parseInt(this.$route.params.id);
this.collectCategory(); this.collectCategory();
this.store = useFireflyIIIStore();
}, },
methods: { methods: {
collectCategory: function() { collectCategory: function() {
@@ -144,7 +147,7 @@ export default {
this.errorMessage = ''; this.errorMessage = '';
}, },
processSuccess: function (response) { processSuccess: function (response) {
this.$store.dispatch('fireflyiii/refreshCacheKey'); this.store.refreshCacheKey();
if (!response) { if (!response) {
return; return;
} }

View File

@@ -90,6 +90,7 @@
// import {mapGetters, useStore} from "vuex"; // import {mapGetters, useStore} from "vuex";
import Destroy from "../../api/generic/destroy"; import Destroy from "../../api/generic/destroy";
import List from "../../api/categories/list"; import List from "../../api/categories/list";
import {useFireflyIIIStore} from "../../stores/fireflyiii";
export default { export default {
name: 'Index', name: 'Index',
@@ -118,6 +119,7 @@ export default {
{name: 'name', label: 'Name', field: 'name', align: 'left'}, {name: 'name', label: 'Name', field: 'name', align: 'left'},
{name: 'menu', label: ' ', field: 'menu', align: 'right'}, {name: 'menu', label: ' ', field: 'menu', align: 'right'},
], ],
store: null,
} }
}, },
computed: { computed: {
@@ -125,21 +127,27 @@ export default {
}, },
created() { created() {
this.pagination.rowsPerPage = this.getListPageSize; this.pagination.rowsPerPage = this.getListPageSize;
this.store = useFireflyIIIStore();
}, },
mounted() { mounted() {
this.type = this.$route.params.type; this.type = this.$route.params.type;
if (null === this.getRange.start || null === this.getRange.end) { if (null === this.store.getRange.start || null === this.store.getRange.end) {
// subscribe, then update: // subscribe, then update:
const $store = useStore(); this.store.$onAction(
$store.subscribe((mutation, state) => { ({name, $store, args, after, onError,}) => {
if ('fireflyiii/setRange' === mutation.type) { after((result) => {
this.range = {start: mutation.payload.start, end: mutation.payload.end}; if (name === 'setRange') {
this.range = result;
this.triggerUpdate(); this.triggerUpdate();
} }
}); })
} }
if (null !== this.getRange.start && null !== this.getRange.end) { )
this.range = {start: this.getRange.start, end: this.getRange.end};
}
if (null !== this.store.getRange.start && null !== this.store.getRange.end) {
this.range = {start: this.store.getRange.start, end: this.store.getRange.end};
this.triggerUpdate(); this.triggerUpdate();
} }
}, },
@@ -156,7 +164,7 @@ export default {
}, },
destroyCategory: function (id) { destroyCategory: function (id) {
(new Destroy('categories')).destroy(id).then(() => { (new Destroy('categories')).destroy(id).then(() => {
this.$store.dispatch('fireflyiii/refreshCacheKey'); this.store.refreshCacheKey();
this.triggerUpdate(); this.triggerUpdate();
}); });
}, },

View File

@@ -97,6 +97,7 @@
<script> <script>
import Post from "../../api/currencies/post"; import Post from "../../api/currencies/post";
import {useFireflyIIIStore} from "../../stores/fireflyiii";
export default { export default {
name: 'Create', name: 'Create',
@@ -113,6 +114,7 @@ export default {
name: '', name: '',
code: '', code: '',
symbol: '', symbol: '',
store: null,
} }
}, },
computed: { computed: {
@@ -123,6 +125,7 @@ export default {
created() { created() {
this.resetForm(); this.resetForm();
this.type = this.$route.params.type; this.type = this.$route.params.type;
this.store = useFireflyIIIStore();
}, },
methods: { methods: {
resetForm: function () { resetForm: function () {
@@ -175,7 +178,7 @@ export default {
if (!response) { if (!response) {
return; return;
} }
this.$store.dispatch('fireflyiii/refreshCacheKey'); this.store.refreshCacheKey();
this.submitting = false; this.submitting = false;
let message = { let message = {
level: 'success', level: 'success',

View File

@@ -96,6 +96,7 @@
<script> <script>
import Get from "../../api/currencies/get"; import Get from "../../api/currencies/get";
import Put from "../../api/currencies/put"; import Put from "../../api/currencies/put";
import {useFireflyIIIStore} from "../../stores/fireflyiii";
export default { export default {
name: "Edit", name: "Edit",
@@ -112,6 +113,7 @@ export default {
code: '', code: '',
name: '', name: '',
symbol: '', symbol: '',
store: null,
} }
}, },
computed: { computed: {
@@ -122,6 +124,7 @@ export default {
created() { created() {
this.code = this.$route.params.code; this.code = this.$route.params.code;
this.collectCurrency(); this.collectCurrency();
this.store = useFireflyIIIStore();
}, },
methods: { methods: {
collectCurrency: function() { collectCurrency: function() {
@@ -172,7 +175,7 @@ export default {
this.errorMessage = ''; this.errorMessage = '';
}, },
processSuccess: function (response) { processSuccess: function (response) {
this.$store.dispatch('fireflyiii/refreshCacheKey'); this.store.refreshCacheKey();
if (!response) { if (!response) {
return; return;
} }

View File

@@ -90,6 +90,7 @@
// import {mapGetters, useStore} from "vuex"; // import {mapGetters, useStore} from "vuex";
import Destroy from "../../api/generic/destroy"; import Destroy from "../../api/generic/destroy";
import List from "../../api/currencies/list"; import List from "../../api/currencies/list";
import {useFireflyIIIStore} from "../../stores/fireflyiii";
export default { export default {
name: 'Index', name: 'Index',
@@ -119,6 +120,7 @@ export default {
{name: 'name', label: 'Code', field: 'code', align: 'left'}, {name: 'name', label: 'Code', field: 'code', align: 'left'},
{name: 'menu', label: ' ', field: 'menu', align: 'right'}, {name: 'menu', label: ' ', field: 'menu', align: 'right'},
], ],
store: null,
} }
}, },
computed: { computed: {
@@ -126,21 +128,27 @@ export default {
}, },
created() { created() {
this.pagination.rowsPerPage = this.getListPageSize; this.pagination.rowsPerPage = this.getListPageSize;
this.store = useFireflyIIIStore();
}, },
mounted() { mounted() {
this.type = this.$route.params.type; this.type = this.$route.params.type;
if (null === this.getRange.start || null === this.getRange.end) { if (null === this.store.getRange.start || null === this.store.getRange.end) {
// subscribe, then update: // subscribe, then update:
const $store = useStore(); this.store.$onAction(
$store.subscribe((mutation, state) => { ({name, $store, args, after, onError,}) => {
if ('fireflyiii/setRange' === mutation.type) { after((result) => {
this.range = {start: mutation.payload.start, end: mutation.payload.end}; if (name === 'setRange') {
this.range = result;
this.triggerUpdate(); this.triggerUpdate();
} }
}); })
} }
if (null !== this.getRange.start && null !== this.getRange.end) { )
this.range = {start: this.getRange.start, end: this.getRange.end};
}
if (null !== this.store.getRange.start && null !== this.store.getRange.end) {
this.range = {start: this.store.getRange.start, end: this.store.getRange.end};
this.triggerUpdate(); this.triggerUpdate();
} }
}, },
@@ -158,7 +166,7 @@ export default {
}, },
destroyCurrency: function (code) { destroyCurrency: function (code) {
(new Destroy('currencies')).destroy(code).then(() => { (new Destroy('currencies')).destroy(code).then(() => {
this.$store.dispatch('fireflyiii/refreshCacheKey'); this.store.refreshCacheKey();
this.triggerUpdate(); this.triggerUpdate();
}); });
}, },

View File

@@ -128,8 +128,8 @@ export default {
this.store = useFireflyIIIStore(); this.store = useFireflyIIIStore();
if (null === this.range.start || null === this.range.end) { if (null === this.range.start || null === this.range.end) {
// subscribe, then update:
// subscribe, then update:
this.store.$onAction( this.store.$onAction(
({name, $store, args, after, onError,}) => { ({name, $store, args, after, onError,}) => {
after((result) => { after((result) => {

View File

@@ -76,6 +76,7 @@
<script> <script>
import Get from "../../api/groups/get"; import Get from "../../api/groups/get";
import Put from "../../api/groups/put"; import Put from "../../api/groups/put";
import {useFireflyIIIStore} from "../../stores/fireflyiii";
export default { export default {
name: "Edit", name: "Edit",
@@ -91,6 +92,7 @@ export default {
// group fields: // group fields:
id: 0, id: 0,
title: '', title: '',
store: null,
} }
}, },
computed: { computed: {
@@ -101,6 +103,7 @@ export default {
created() { created() {
this.id = parseInt(this.$route.params.id); this.id = parseInt(this.$route.params.id);
this.collectGroup(); this.collectGroup();
this.store = useFireflyIIIStore();
}, },
methods: { methods: {
collectGroup: function() { collectGroup: function() {
@@ -144,7 +147,7 @@ export default {
this.errorMessage = ''; this.errorMessage = '';
}, },
processSuccess: function (response) { processSuccess: function (response) {
this.$store.dispatch('fireflyiii/refreshCacheKey'); this.store.refreshCacheKey();
if (!response) { if (!response) {
return; return;
} }

View File

@@ -74,6 +74,7 @@
// import {mapGetters, useStore} from "vuex"; // import {mapGetters, useStore} from "vuex";
import Destroy from "../../api/generic/destroy"; import Destroy from "../../api/generic/destroy";
import List from "../../api/groups/list"; import List from "../../api/groups/list";
import {useFireflyIIIStore} from "../../stores/fireflyiii";
export default { export default {
name: 'Index', name: 'Index',
@@ -101,7 +102,8 @@ export default {
columns: [ columns: [
{name: 'title', label: 'Title', field: 'title', align: 'left'}, {name: 'title', label: 'Title', field: 'title', align: 'left'},
{name: 'menu', label: ' ', field: 'menu', align: 'right'}, {name: 'menu', label: ' ', field: 'menu', align: 'right'},
] ],
store: null
} }
}, },
computed: { computed: {
@@ -109,21 +111,26 @@ export default {
}, },
created() { created() {
this.pagination.rowsPerPage = this.getListPageSize; this.pagination.rowsPerPage = this.getListPageSize;
this.store = useFireflyIIIStore();
}, },
mounted() { mounted() {
this.type = this.$route.params.type; this.type = this.$route.params.type;
if (null === this.getRange.start || null === this.getRange.end) { if (null === this.store.getRange.start || null === this.store.getRange.end) {
// subscribe, then update: // subscribe, then update:
const $store = useStore(); this.store.$onAction(
$store.subscribe((mutation, state) => { ({name, $store, args, after, onError,}) => {
if ('fireflyiii/setRange' === mutation.type) { after((result) => {
this.range = {start: mutation.payload.start, end: mutation.payload.end}; if (name === 'setRange') {
this.range = result;
this.triggerUpdate(); this.triggerUpdate();
} }
}); })
} }
if (null !== this.getRange.start && null !== this.getRange.end) { )
this.range = {start: this.getRange.start, end: this.getRange.end}; }
if (null !== this.store.getRange.start && null !== this.store.getRange.end) {
this.range = {start: this.store.getRange.start, end: this.store.getRange.end};
this.triggerUpdate(); this.triggerUpdate();
} }
}, },
@@ -141,7 +148,7 @@ export default {
}, },
destroyGroup: function (identifier) { destroyGroup: function (identifier) {
(new Destroy('object_groups')).destroy(identifier).then(() => { (new Destroy('object_groups')).destroy(identifier).then(() => {
this.$store.dispatch('fireflyiii/refreshCacheKey'); this.store.refreshCacheKey();
this.triggerUpdate(); this.triggerUpdate();
}); });
}, },

View File

@@ -105,7 +105,7 @@
import Post from "../../api/piggy-banks/post"; import Post from "../../api/piggy-banks/post";
import List from "../../api/accounts/list"; import List from "../../api/accounts/list";
// import {mapGetters} from "vuex"; // import {mapGetters} from "vuex";
import {getCacheKey} from "../../store/fireflyiii/getters"; // import {getCacheKey} from "../../store/fireflyiii/getters";
export default { export default {
name: 'Create', name: 'Create',

View File

@@ -76,6 +76,7 @@
<script> <script>
import Get from "../../api/piggy-banks/get"; import Get from "../../api/piggy-banks/get";
import Put from "../../api/piggy-banks/put"; import Put from "../../api/piggy-banks/put";
import {useFireflyIIIStore} from "../../stores/fireflyiii";
export default { export default {
name: "Edit", name: "Edit",
@@ -91,6 +92,7 @@ export default {
// piggy bank fields: // piggy bank fields:
id: 0, id: 0,
name: '', name: '',
store: null,
} }
}, },
computed: { computed: {
@@ -101,6 +103,7 @@ export default {
created() { created() {
this.id = parseInt(this.$route.params.id); this.id = parseInt(this.$route.params.id);
this.collectPiggyBank(); this.collectPiggyBank();
this.store = useFireflyIIIStore();
}, },
methods: { methods: {
collectPiggyBank: function() { collectPiggyBank: function() {
@@ -143,7 +146,7 @@ export default {
this.errorMessage = ''; this.errorMessage = '';
}, },
processSuccess: function (response) { processSuccess: function (response) {
this.$store.dispatch('fireflyiii/refreshCacheKey'); this.store.refreshCacheKey();
if (!response) { if (!response) {
return; return;
} }

View File

@@ -87,6 +87,7 @@
// import {mapGetters, useStore} from "vuex"; // import {mapGetters, useStore} from "vuex";
import Destroy from "../../api/generic/destroy"; import Destroy from "../../api/generic/destroy";
import List from "../../api/piggy-banks/list"; import List from "../../api/piggy-banks/list";
import {useFireflyIIIStore} from "../../stores/fireflyiii";
export default { export default {
name: 'Index', name: 'Index',
@@ -115,6 +116,7 @@ export default {
{name: 'name', label: 'Name', field: 'name', align: 'left'}, {name: 'name', label: 'Name', field: 'name', align: 'left'},
{name: 'menu', label: ' ', field: 'menu', align: 'right'}, {name: 'menu', label: ' ', field: 'menu', align: 'right'},
], ],
store: null,
} }
}, },
computed: { computed: {
@@ -122,20 +124,24 @@ export default {
}, },
created() { created() {
this.pagination.rowsPerPage = this.getListPageSize; this.pagination.rowsPerPage = this.getListPageSize;
this.store = useFireflyIIIStore();
}, },
mounted() { mounted() {
if (null === this.getRange.start || null === this.getRange.end) { if (null === this.store.getRange.start || null === this.store.getRange.end) {
// subscribe, then update: // subscribe, then update:
const $store = useStore(); this.store.$onAction(
$store.subscribe((mutation, state) => { ({name, $store, args, after, onError,}) => {
if ('fireflyiii/setRange' === mutation.type) { after((result) => {
this.range = {start: mutation.payload.start, end: mutation.payload.end}; if (name === 'setRange') {
this.range = result;
this.triggerUpdate(); this.triggerUpdate();
} }
}); })
} }
if (null !== this.getRange.start && null !== this.getRange.end) { )
this.range = {start: this.getRange.start, end: this.getRange.end}; }
if (null !== this.store.getRange.start && null !== this.store.getRange.end) {
this.range = {start: this.store.getRange.start, end: this.store.getRange.end};
this.triggerUpdate(); this.triggerUpdate();
} }
}, },
@@ -152,7 +158,7 @@ export default {
}, },
destroyPiggyBank: function (id) { destroyPiggyBank: function (id) {
(new Destroy('piggy_banks')).destroy(id).then(() => { (new Destroy('piggy_banks')).destroy(id).then(() => {
this.$store.dispatch('fireflyiii/refreshCacheKey'); this.store.refreshCacheKey();
this.triggerUpdate(); this.triggerUpdate();
}); });
}, },

View File

@@ -147,11 +147,13 @@ import Configuration from "../../api/system/configuration";
import Put from "../../api/preferences/put"; import Put from "../../api/preferences/put";
import Preferences from "../../api/preferences"; import Preferences from "../../api/preferences";
import List from "../../api/accounts/list"; import List from "../../api/accounts/list";
import {useFireflyIIIStore} from "../../stores/fireflyiii";
// import {mapGetters} from "vuex"; // import {mapGetters} from "vuex";
export default { export default {
name: 'Index', name: 'Index',
mounted() { mounted() {
this.store = useFireflyIIIStore();
this.isOk = { this.isOk = {
language: true, language: true,
accounts: true, accounts: true,
@@ -225,7 +227,8 @@ export default {
date: [], date: [],
meta: [], meta: [],
ref: [] ref: []
} },
store: null,
} }
}, },
watch: { watch: {
@@ -233,7 +236,7 @@ export default {
this.isOk.language = false; this.isOk.language = false;
this.isLoading.language = true; this.isLoading.language = true;
(new Put).put('listPageSize', value).then(() => { (new Put).put('listPageSize', value).then(() => {
this.$store.dispatch('fireflyiii/refreshCacheKey'); this.store.refreshCacheKey();
this.isOk.pageSize = true; this.isOk.pageSize = true;
this.isLoading.pageSize = false; this.isLoading.pageSize = false;
this.isFailure.pageSize = false; this.isFailure.pageSize = false;
@@ -256,7 +259,7 @@ export default {
this.isOk.language = false; this.isOk.language = false;
this.isLoading.language = true; this.isLoading.language = true;
(new Put).put('language', value).then(() => { (new Put).put('language', value).then(() => {
this.$store.dispatch('fireflyiii/refreshCacheKey'); this.store.refreshCacheKey();
this.isOk.language = true; this.isOk.language = true;
this.isLoading.language = false; this.isLoading.language = false;
this.isFailure.language = false; this.isFailure.language = false;
@@ -268,7 +271,7 @@ export default {
}, },
accounts: function (value) { accounts: function (value) {
(new Put).put('frontpageAccounts', value).then(() => { (new Put).put('frontpageAccounts', value).then(() => {
this.$store.dispatch('fireflyiii/refreshCacheKey'); this.store.refreshCacheKey();
this.isOk.accounts = true; this.isOk.accounts = true;
this.isLoading.accounts = false; this.isLoading.accounts = false;
this.isFailure.accounts = false; this.isFailure.accounts = false;
@@ -280,7 +283,7 @@ export default {
}, },
viewRange: function (value) { viewRange: function (value) {
(new Put).put('viewRange', value).then(() => { (new Put).put('viewRange', value).then(() => {
this.$store.dispatch('fireflyiii/refreshCacheKey'); this.store.refreshCacheKey();
this.isOk.pageSize = true; this.isOk.pageSize = true;
this.isLoading.pageSize = false; this.isLoading.pageSize = false;
this.isFailure.pageSize = false; this.isFailure.pageSize = false;
@@ -328,7 +331,7 @@ export default {
} }
} }
(new Put).put('transaction_journal_optional_fields', submission).then(() => { (new Put).put('transaction_journal_optional_fields', submission).then(() => {
this.$store.dispatch('fireflyiii/refreshCacheKey'); this.store.refreshCacheKey();
this.isOk.transactionFields = true; this.isOk.transactionFields = true;
this.isLoading.transactionFields = false; this.isLoading.transactionFields = false;
this.isFailure.transactionFields = false; this.isFailure.transactionFields = false;

View File

@@ -224,7 +224,7 @@
<script> <script>
import Post from "../../api/recurring/post"; import Post from "../../api/recurring/post";
// import {mapGetters} from "vuex"; // import {mapGetters} from "vuex";
import {getCacheKey} from "../../store/fireflyiii/getters"; // import {getCacheKey} from "../../store/fireflyiii/getters";
import format from "date-fns/format"; import format from "date-fns/format";
import List from "../../api/accounts/list"; import List from "../../api/accounts/list";
import {parseISO} from "date-fns"; import {parseISO} from "date-fns";

View File

@@ -228,6 +228,7 @@ import Put from "../../api/recurring/put";
import {parseISO} from "date-fns"; import {parseISO} from "date-fns";
import format from "date-fns/format"; import format from "date-fns/format";
import List from "../../api/accounts/list"; import List from "../../api/accounts/list";
import {useFireflyIIIStore} from "../../stores/fireflyiii";
export default { export default {
name: "Edit", name: "Edit",
@@ -267,7 +268,8 @@ export default {
nr_of_repetitions: 0, nr_of_repetitions: 0,
repeat_until: '', repeat_until: '',
repetitions: {}, repetitions: {},
transactions: {} transactions: {},
store: null,
} }
}, },
watch: { watch: {
@@ -284,6 +286,7 @@ export default {
// TODO some forms use 'loading' others use 'submitting' or 'disabledInput', needs to be the same. // TODO some forms use 'loading' others use 'submitting' or 'disabledInput', needs to be the same.
created() { created() {
this.loading = true; this.loading = true;
this.store = useFireflyIIIStore();
this.resetErrors(); this.resetErrors();
this.resetForm(); this.resetForm();
this.getAccounts().then(() => { this.getAccounts().then(() => {
@@ -520,7 +523,7 @@ export default {
this.errorMessage = ''; this.errorMessage = '';
}, },
processSuccess: function (response) { processSuccess: function (response) {
this.$store.dispatch('fireflyiii/refreshCacheKey'); this.store.refreshCacheKey();
if (!response) { if (!response) {
return; return;
} }

View File

@@ -87,6 +87,7 @@
// import {mapGetters, useStore} from "vuex"; // import {mapGetters, useStore} from "vuex";
import Destroy from "../../api/generic/destroy"; import Destroy from "../../api/generic/destroy";
import List from "../../api/recurring/list"; import List from "../../api/recurring/list";
import {useFireflyIIIStore} from "../../stores/fireflyiii";
export default { export default {
name: 'Index', name: 'Index',
@@ -115,6 +116,7 @@ export default {
{name: 'name', label: 'Name', field: 'name', align: 'left'}, {name: 'name', label: 'Name', field: 'name', align: 'left'},
{name: 'menu', label: ' ', field: 'menu', align: 'right'}, {name: 'menu', label: ' ', field: 'menu', align: 'right'},
], ],
store: null
} }
}, },
computed: { computed: {
@@ -122,21 +124,25 @@ export default {
}, },
created() { created() {
this.pagination.rowsPerPage = this.getListPageSize; this.pagination.rowsPerPage = this.getListPageSize;
this.store = useFireflyIIIStore();
}, },
mounted() { mounted() {
this.type = this.$route.params.type; this.type = this.$route.params.type;
if (null === this.getRange.start || null === this.getRange.end) { if (null === this.store.getRange.start || null === this.store.getRange.end) {
// subscribe, then update: // subscribe, then update:
const $store = useStore(); this.store.$onAction(
$store.subscribe((mutation, state) => { ({name, $store, args, after, onError,}) => {
if ('fireflyiii/setRange' === mutation.type) { after((result) => {
this.range = {start: mutation.payload.start, end: mutation.payload.end}; if (name === 'setRange') {
this.range = result;
this.triggerUpdate(); this.triggerUpdate();
} }
}); })
} }
if (null !== this.getRange.start && null !== this.getRange.end) { )
this.range = {start: this.getRange.start, end: this.getRange.end}; }
if (null !== this.store.getRange.start && null !== this.store.getRange.end) {
this.range = {start: this.store.getRange.start, end: this.store.getRange.end};
this.triggerUpdate(); this.triggerUpdate();
} }
}, },
@@ -153,7 +159,7 @@ export default {
}, },
destroyRecurring: function (id) { destroyRecurring: function (id) {
(new Destroy('recurrences')).destroy(id).then(() => { (new Destroy('recurrences')).destroy(id).then(() => {
this.$store.dispatch('fireflyiii/refreshCacheKey'); this.store.refreshCacheKey();
this.triggerUpdate(); this.triggerUpdate();
}); });
}, },

View File

@@ -76,7 +76,7 @@
<script> <script>
import Post from "../../api/rule-groups/post"; import Post from "../../api/rule-groups/post";
// import {mapGetters} from "vuex"; // import {mapGetters} from "vuex";
import {getCacheKey} from "../../store/fireflyiii/getters"; // import {getCacheKey} from "../../store/fireflyiii/getters";
export default { export default {
name: 'Create', name: 'Create',

View File

@@ -76,6 +76,7 @@
<script> <script>
import Get from "../../api/rule-groups/get"; import Get from "../../api/rule-groups/get";
import Put from "../../api/rule-groups/put"; import Put from "../../api/rule-groups/put";
import {useFireflyIIIStore} from "../../stores/fireflyiii";
export default { export default {
name: "Edit", name: "Edit",
@@ -91,6 +92,7 @@ export default {
// rule group fields: // rule group fields:
id: 0, id: 0,
title: '', title: '',
store: null,
} }
}, },
computed: { computed: {
@@ -100,6 +102,7 @@ export default {
}, },
created() { created() {
this.id = parseInt(this.$route.params.id); this.id = parseInt(this.$route.params.id);
this.store = useFireflyIIIStore();
this.collectRuleGroup(); this.collectRuleGroup();
}, },
methods: { methods: {
@@ -143,7 +146,7 @@ export default {
this.errorMessage = ''; this.errorMessage = '';
}, },
processSuccess: function (response) { processSuccess: function (response) {
this.$store.dispatch('fireflyiii/refreshCacheKey'); this.store.refreshCacheKey();
if (!response) { if (!response) {
return; return;
} }

View File

@@ -233,7 +233,7 @@
<script> <script>
import Post from "../../api/rules/post"; import Post from "../../api/rules/post";
// import {mapGetters} from "vuex"; // import {mapGetters} from "vuex";
import {getCacheKey} from "../../store/fireflyiii/getters"; // import {getCacheKey} from "../../store/fireflyiii/getters";
import Configuration from "../../api/system/configuration"; import Configuration from "../../api/system/configuration";
import List from "../../api/rule-groups/list"; import List from "../../api/rule-groups/list";

View File

@@ -76,6 +76,7 @@
<script> <script>
import Get from "../../api/rules/get"; import Get from "../../api/rules/get";
import Put from "../../api/rules/put"; import Put from "../../api/rules/put";
import {useFireflyIIIStore} from "../../stores/fireflyiii";
export default { export default {
name: "Edit", name: "Edit",
@@ -91,6 +92,7 @@ export default {
// rule fields: // rule fields:
id: 0, id: 0,
title: '', title: '',
store: null
} }
}, },
computed: { computed: {
@@ -100,6 +102,7 @@ export default {
}, },
created() { created() {
this.id = parseInt(this.$route.params.id); this.id = parseInt(this.$route.params.id);
this.store = useFireflyIIIStore();
this.collectRule(); this.collectRule();
}, },
methods: { methods: {
@@ -143,7 +146,7 @@ export default {
this.errorMessage = ''; this.errorMessage = '';
}, },
processSuccess: function (response) { processSuccess: function (response) {
this.$store.dispatch('fireflyiii/refreshCacheKey'); this.store.refreshCacheKey();
if (!response) { if (!response) {
return; return;
} }

View File

@@ -101,6 +101,7 @@
import List from "../../api/rule-groups/list"; import List from "../../api/rule-groups/list";
import Get from "../../api/rule-groups/get"; import Get from "../../api/rule-groups/get";
import Destroy from "../../api/generic/destroy"; import Destroy from "../../api/generic/destroy";
import {useFireflyIIIStore} from "../../stores/fireflyiii";
export default { export default {
name: 'Index', name: 'Index',
@@ -113,6 +114,7 @@ export default {
} }
}, },
mounted() { mounted() {
this.store = useFireflyIIIStore();
this.triggerUpdate(); this.triggerUpdate();
}, },
data() { data() {
@@ -126,6 +128,7 @@ export default {
{name: 'menu', label: ' ', field: 'menu', align: 'right'}, {name: 'menu', label: ' ', field: 'menu', align: 'right'},
], ],
ruleGroups: {}, ruleGroups: {},
store: null
} }
}, },
computed: { computed: {
@@ -162,13 +165,13 @@ export default {
}, },
destroyRuleGroup: function (id) { destroyRuleGroup: function (id) {
(new Destroy('rule_groups')).destroy(id).then(() => { (new Destroy('rule_groups')).destroy(id).then(() => {
this.$store.dispatch('fireflyiii/refreshCacheKey'); this.store.refreshCacheKey();
this.triggerUpdate(); this.triggerUpdate();
}); });
}, },
destroyRule: function (id) { destroyRule: function (id) {
(new Destroy('rules')).destroy(id).then(() => { (new Destroy('rules')).destroy(id).then(() => {
this.$store.dispatch('fireflyiii/refreshCacheKey'); this.store.refreshCacheKey();
this.triggerUpdate(); this.triggerUpdate();
}); });
}, },

View File

@@ -88,6 +88,7 @@
// import {mapGetters, useStore} from "vuex"; // import {mapGetters, useStore} from "vuex";
import List from "../../api/subscriptions/list"; import List from "../../api/subscriptions/list";
import Destroy from "../../api/generic/destroy"; import Destroy from "../../api/generic/destroy";
import {useFireflyIIIStore} from "../../stores/fireflyiii";
export default { export default {
name: 'Index', name: 'Index',
@@ -99,18 +100,23 @@ export default {
}, },
mounted() { mounted() {
this.type = this.$route.params.type; this.type = this.$route.params.type;
if (null === this.getRange.start || null === this.getRange.end) { this.store = useFireflyIIIStore();
if (null === this.store.getRange.start || null === this.store.getRange.end) {
// subscribe, then update: // subscribe, then update:
const $store = useStore(); this.store.$onAction(
$store.subscribe((mutation, state) => { ({name, $store, args, after, onError,}) => {
if ('fireflyiii/setRange' === mutation.type) { after((result) => {
this.range = {start: mutation.payload.start, end: mutation.payload.end}; if (name === 'setRange') {
this.range = result;
this.triggerUpdate(); this.triggerUpdate();
} }
}); })
} }
if (null !== this.getRange.start && null !== this.getRange.end) { )
this.range = {start: this.getRange.start, end: this.getRange.end}; }
if (null !== this.store.getRange.start && null !== this.store.getRange.end) {
this.range = {start: this.store.getRange.start, end: this.store.getRange.end};
this.triggerUpdate(); this.triggerUpdate();
} }
}, },
@@ -129,6 +135,7 @@ export default {
{name: 'name', label: 'Name', field: 'name', align: 'left'}, {name: 'name', label: 'Name', field: 'name', align: 'left'},
{name: 'menu', label: ' ', field: 'menu', align: 'right'}, {name: 'menu', label: ' ', field: 'menu', align: 'right'},
], ],
store: null,
} }
}, },
methods: { methods: {
@@ -148,7 +155,7 @@ export default {
}, },
destroySubscription: function (id) { destroySubscription: function (id) {
(new Destroy('bills')).destroy(id).then(() => { (new Destroy('bills')).destroy(id).then(() => {
this.$store.dispatch('fireflyiii/refreshCacheKey'); this.store.refreshCacheKey();
this.triggerUpdate(); this.triggerUpdate();
}); });
}, },

View File

@@ -76,18 +76,21 @@ export default {
created() { created() {
}, },
mounted() { mounted() {
if (null === this.getRange.start || null === this.getRange.end) { if (null === this.store.getRange.start || null === this.store.getRange.end) {
// subscribe, then update: // subscribe, then update:
const $store = useStore(); this.store.$onAction(
$store.subscribe((mutation, state) => { ({name, $store, args, after, onError,}) => {
if ('fireflyiii/setRange' === mutation.type) { after((result) => {
this.range = {start: mutation.payload.start, end: mutation.payload.end}; if (name === 'setRange') {
this.range = result;
this.triggerUpdate(); this.triggerUpdate();
} }
}); })
} }
if (null !== this.getRange.start && null !== this.getRange.end) { )
this.range = {start: this.getRange.start, end: this.getRange.end}; }
if (null !== this.store.getRange.start && null !== this.store.getRange.end) {
this.range = {start: this.store.getRange.start, end: this.store.getRange.end};
this.triggerUpdate(); this.triggerUpdate();
} }
}, },

View File

@@ -120,6 +120,7 @@ import formatISO from 'date-fns/formatISO';
import Put from "../../api/transactions/put"; import Put from "../../api/transactions/put";
import { useQuasar } from 'quasar'; import { useQuasar } from 'quasar';
import Get from "../../api/transactions/get"; import Get from "../../api/transactions/get";
import {useFireflyIIIStore} from "../../stores/fireflyiii";
export default { export default {
name: 'Edit', name: 'Edit',
@@ -134,7 +135,8 @@ export default {
index: 0, index: 0,
doResetForm: false, doResetForm: false,
group_title: '', group_title: '',
errorMessage: '' errorMessage: '',
store: null
} }
}, },
computed: { computed: {
@@ -144,6 +146,7 @@ export default {
}, },
created() { created() {
this.id = parseInt(this.$route.params.id); this.id = parseInt(this.$route.params.id);
this.store = useFireflyIIIStore();
this.resetForm(); this.resetForm();
this.collectTransaction(); this.collectTransaction();
}, },
@@ -212,7 +215,7 @@ export default {
}, },
processSuccess: function (response) { processSuccess: function (response) {
this.submitting = false; this.submitting = false;
this.$store.dispatch('fireflyiii/refreshCacheKey'); this.store.refreshCacheKey();
let message = { let message = {
level: 'success', level: 'success',
text: 'Updated transaction', text: 'Updated transaction',

View File

@@ -120,18 +120,24 @@ export default {
}, },
mounted() { mounted() {
this.type = this.$route.params.type; this.type = this.$route.params.type;
if (null === this.getRange.start || null === this.getRange.end) { if (null === this.store.getRange.start || null === this.store.getRange.end) {
// subscribe, then update: // subscribe, then update:
const $store = useStore(); this.store.$onAction(
$store.subscribe((mutation, state) => { ({name, $store, args, after, onError,}) => {
if ('fireflyiii/setRange' === mutation.type) { after((result) => {
this.range = {start: mutation.payload.start, end: mutation.payload.end}; if (name === 'setRange') {
this.range = result;
this.triggerUpdate(); this.triggerUpdate();
} }
}); })
} }
if (null !== this.getRange.start && null !== this.getRange.end) { )
this.range = {start: this.getRange.start, end: this.getRange.end};
}
if (null !== this.store.getRange.start && null !== this.store.getRange.end) {
this.range = {start: this.store.getRange.start, end: this.store.getRange.end};
this.triggerUpdate(); this.triggerUpdate();
} }
}, },

View File

@@ -133,7 +133,7 @@
<script> <script>
import Post from "../../api/webhooks/post"; import Post from "../../api/webhooks/post";
// import {mapGetters} from "vuex"; // import {mapGetters} from "vuex";
import {getCacheKey} from "../../store/fireflyiii/getters"; // import {getCacheKey} from "../../store/fireflyiii/getters";
export default { export default {
name: 'Create', name: 'Create',

View File

@@ -130,6 +130,7 @@
<script> <script>
import Get from "../../api/webhooks/get"; import Get from "../../api/webhooks/get";
import Put from "../../api/webhooks/put"; import Put from "../../api/webhooks/put";
import {useFireflyIIIStore} from "../../stores/fireflyiii";
export default { export default {
name: "Edit", name: "Edit",
@@ -165,6 +166,7 @@ export default {
response: '', response: '',
delivery: '', delivery: '',
trigger: '', trigger: '',
store: null,
} }
}, },
computed: { computed: {
@@ -174,6 +176,7 @@ export default {
}, },
created() { created() {
this.id = parseInt(this.$route.params.id); this.id = parseInt(this.$route.params.id);
this.store = useFireflyIIIStore();
this.collectWebhook(); this.collectWebhook();
}, },
methods: { methods: {
@@ -233,7 +236,7 @@ export default {
this.errorMessage = ''; this.errorMessage = '';
}, },
processSuccess: function (response) { processSuccess: function (response) {
this.$store.dispatch('fireflyiii/refreshCacheKey'); this.store.refreshCacheKey();
if (!response) { if (!response) {
return; return;
} }

View File

@@ -88,6 +88,7 @@
// import {mapGetters} from "vuex"; // import {mapGetters} from "vuex";
import Destroy from "../../api/generic/destroy"; import Destroy from "../../api/generic/destroy";
import List from "../../api/webhooks/list"; import List from "../../api/webhooks/list";
import {useFireflyIIIStore} from "../../stores/fireflyiii";
export default { export default {
name: 'Index', name: 'Index',
@@ -116,6 +117,7 @@ export default {
{name: 'title', label: 'Title', field: 'title', align: 'left'}, {name: 'title', label: 'Title', field: 'title', align: 'left'},
{name: 'menu', label: ' ', field: 'menu', align: 'right'}, {name: 'menu', label: ' ', field: 'menu', align: 'right'},
], ],
store: null,
} }
}, },
computed: { computed: {
@@ -123,6 +125,7 @@ export default {
}, },
created() { created() {
this.pagination.rowsPerPage = this.getListPageSize; this.pagination.rowsPerPage = this.getListPageSize;
this.store = useFireflyIIIStore();
}, },
mounted() { mounted() {
this.triggerUpdate(); this.triggerUpdate();
@@ -140,7 +143,7 @@ export default {
}, },
destroyWebhook: function (id) { destroyWebhook: function (id) {
(new Destroy('webhooks')).destroy(id).then(() => { (new Destroy('webhooks')).destroy(id).then(() => {
this.$store.dispatch('fireflyiii/refreshCacheKey'); this.store.refreshCacheKey();
this.triggerUpdate(); this.triggerUpdate();
}); });
}, },