Show * in sidebar for unreconciled accounts
This commit is contained in:
parent
51ece59866
commit
034f4f2a90
@ -2,7 +2,7 @@
|
|||||||
import { computed } from "vue";
|
import { computed } from "vue";
|
||||||
import Currency from "../components/Currency.vue"
|
import Currency from "../components/Currency.vue"
|
||||||
import { useBudgetsStore } from "../stores/budget"
|
import { useBudgetsStore } from "../stores/budget"
|
||||||
import { useAccountStore } from "../stores/budget-account"
|
import { Account, useAccountStore } from "../stores/budget-account"
|
||||||
import { useSettingsStore } from "../stores/settings"
|
import { useSettingsStore } from "../stores/settings"
|
||||||
|
|
||||||
const ExpandMenu = computed(() => useSettingsStore().Menu.Expand);
|
const ExpandMenu = computed(() => useSettingsStore().Menu.Expand);
|
||||||
@ -16,6 +16,18 @@ const OnBudgetAccounts = computed(() => accountStore.OnBudgetAccounts);
|
|||||||
const OffBudgetAccounts = computed(() => accountStore.OffBudgetAccounts);
|
const OffBudgetAccounts = computed(() => accountStore.OffBudgetAccounts);
|
||||||
const OnBudgetAccountsBalance = computed(() => accountStore.OnBudgetAccountsBalance);
|
const OnBudgetAccountsBalance = computed(() => accountStore.OnBudgetAccountsBalance);
|
||||||
const OffBudgetAccountsBalance = computed(() => accountStore.OffBudgetAccountsBalance);
|
const OffBudgetAccountsBalance = computed(() => accountStore.OffBudgetAccountsBalance);
|
||||||
|
|
||||||
|
function isRecentlyReconciled(account : Account) {
|
||||||
|
const now = new Date().getTime();
|
||||||
|
const recently = 7 * 24 * 60 * 60 * 1000;
|
||||||
|
console.log(account.Name, account.LastReconciled, now, recently, new Date(now-recently));
|
||||||
|
return new Date(now - recently).getTime() < account.LastReconciled.getTime();
|
||||||
|
}
|
||||||
|
|
||||||
|
function getAccountName(account : Account) {
|
||||||
|
const reconciledMarker = isRecentlyReconciled(account) ? "" : " *";
|
||||||
|
return account.Name + reconciledMarker;
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
@ -35,7 +47,7 @@ const OffBudgetAccountsBalance = computed(() => accountStore.OffBudgetAccountsBa
|
|||||||
<Currency :class="ExpandMenu?'md:inline':'md:hidden'" :value="OnBudgetAccountsBalance" />
|
<Currency :class="ExpandMenu?'md:inline':'md:hidden'" :value="OnBudgetAccountsBalance" />
|
||||||
</div>
|
</div>
|
||||||
<div v-for="account in OnBudgetAccounts" class="flex flex-row justify-between">
|
<div v-for="account in OnBudgetAccounts" class="flex flex-row justify-between">
|
||||||
<router-link :to="'/budget/'+CurrentBudgetID+'/account/'+account.ID">{{account.Name}}</router-link>
|
<router-link :to="'/budget/'+CurrentBudgetID+'/account/'+account.ID">{{getAccountName(account)}}</router-link>
|
||||||
<Currency :class="ExpandMenu?'md:inline':'md:hidden'" :value="account.ClearedBalance" />
|
<Currency :class="ExpandMenu?'md:inline':'md:hidden'" :value="account.ClearedBalance" />
|
||||||
</div>
|
</div>
|
||||||
</li>
|
</li>
|
||||||
@ -45,7 +57,7 @@ const OffBudgetAccountsBalance = computed(() => accountStore.OffBudgetAccountsBa
|
|||||||
<Currency :class="ExpandMenu?'md:inline':'md:hidden'" :value="OffBudgetAccountsBalance" />
|
<Currency :class="ExpandMenu?'md:inline':'md:hidden'" :value="OffBudgetAccountsBalance" />
|
||||||
</div>
|
</div>
|
||||||
<div v-for="account in OffBudgetAccounts" class="flex flex-row justify-between">
|
<div v-for="account in OffBudgetAccounts" class="flex flex-row justify-between">
|
||||||
<router-link :to="'/budget/'+CurrentBudgetID+'/account/'+account.ID">{{account.Name}}</router-link>
|
<router-link :to="'/budget/'+CurrentBudgetID+'/account/'+account.ID">{{getAccountName(account)}}</router-link>
|
||||||
<Currency :class="ExpandMenu?'md:inline':'md:hidden'" :value="account.ClearedBalance" />
|
<Currency :class="ExpandMenu?'md:inline':'md:hidden'" :value="account.ClearedBalance" />
|
||||||
</div>
|
</div>
|
||||||
</li>
|
</li>
|
||||||
|
@ -20,6 +20,7 @@ export interface Account {
|
|||||||
WorkingBalance: number
|
WorkingBalance: number
|
||||||
ReconciledBalance: number
|
ReconciledBalance: number
|
||||||
Transactions: string[]
|
Transactions: string[]
|
||||||
|
LastReconciled: Date
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface Category {
|
export interface Category {
|
||||||
|
@ -58,6 +58,7 @@ export const useBudgetsStore = defineStore('budget', {
|
|||||||
for (const account of response.Accounts || []) {
|
for (const account of response.Accounts || []) {
|
||||||
const existingAccount = accounts.Accounts.get(account.ID);
|
const existingAccount = accounts.Accounts.get(account.ID);
|
||||||
account.Transactions = existingAccount?.Transactions ?? [];
|
account.Transactions = existingAccount?.Transactions ?? [];
|
||||||
|
account.LastReconciled = new Date(account.LastReconciled);
|
||||||
accounts.Accounts.set(account.ID, account);
|
accounts.Accounts.set(account.ID, account);
|
||||||
}
|
}
|
||||||
for (const category of response.Categories || []) {
|
for (const category of response.Categories || []) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user