|
|
|
@@ -2,7 +2,7 @@
|
|
|
|
|
import { computed } from "vue";
|
|
|
|
|
import Currency from "../components/Currency.vue"
|
|
|
|
|
import { useBudgetsStore } from "../stores/budget"
|
|
|
|
|
import { useAccountStore } from "../stores/budget-account"
|
|
|
|
|
import { Account, useAccountStore } from "../stores/budget-account"
|
|
|
|
|
import { useSettingsStore } from "../stores/settings"
|
|
|
|
|
|
|
|
|
|
const ExpandMenu = computed(() => useSettingsStore().Menu.Expand);
|
|
|
|
@@ -16,6 +16,18 @@ const OnBudgetAccounts = computed(() => accountStore.OnBudgetAccounts);
|
|
|
|
|
const OffBudgetAccounts = computed(() => accountStore.OffBudgetAccounts);
|
|
|
|
|
const OnBudgetAccountsBalance = computed(() => accountStore.OnBudgetAccountsBalance);
|
|
|
|
|
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>
|
|
|
|
|
|
|
|
|
|
<template>
|
|
|
|
@@ -35,7 +47,7 @@ const OffBudgetAccountsBalance = computed(() => accountStore.OffBudgetAccountsBa
|
|
|
|
|
<Currency :class="ExpandMenu?'md:inline':'md:hidden'" :value="OnBudgetAccountsBalance" />
|
|
|
|
|
</div>
|
|
|
|
|
<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" />
|
|
|
|
|
</div>
|
|
|
|
|
</li>
|
|
|
|
@@ -45,7 +57,7 @@ const OffBudgetAccountsBalance = computed(() => accountStore.OffBudgetAccountsBa
|
|
|
|
|
<Currency :class="ExpandMenu?'md:inline':'md:hidden'" :value="OffBudgetAccountsBalance" />
|
|
|
|
|
</div>
|
|
|
|
|
<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" />
|
|
|
|
|
</div>
|
|
|
|
|
</li>
|
|
|
|
|