Add getters for current budget ID and Name
This commit is contained in:
parent
80b5a7abfe
commit
ddaf647d87
@ -28,7 +28,7 @@ export default defineComponent({
|
|||||||
<div class="flex bg-gray-400 p-4 m-2 rounded-lg">
|
<div class="flex bg-gray-400 p-4 m-2 rounded-lg">
|
||||||
<span class="flex-1 font-bold text-5xl -my-3" @click="toggleMenu">≡</span>
|
<span class="flex-1 font-bold text-5xl -my-3" @click="toggleMenu">≡</span>
|
||||||
|
|
||||||
<span class="flex-1">{{$store.getters.CurrentBudget.Name}}</span>
|
<span class="flex-1">{{$store.getters.CurrentBudgetName}}</span>
|
||||||
|
|
||||||
<div class="flex flex-1 flex-row justify-end -mx-4">
|
<div class="flex flex-1 flex-row justify-end -mx-4">
|
||||||
<router-link class="mx-4" v-if="loggedIn" to="/dashboard">Dashboard</router-link>
|
<router-link class="mx-4" v-if="loggedIn" to="/dashboard">Dashboard</router-link>
|
||||||
|
@ -82,7 +82,7 @@ export default defineComponent({
|
|||||||
>{{ transaction.CategoryGroup ? transaction.CategoryGroup + " : " + transaction.Category : "" }}</td>
|
>{{ transaction.CategoryGroup ? transaction.CategoryGroup + " : " + transaction.Category : "" }}</td>
|
||||||
<td>
|
<td>
|
||||||
<a
|
<a
|
||||||
:href="'/budget/' + $store.getters.CurrentBudget.ID + '/transaction/' + transaction.ID"
|
:href="'/budget/' + $store.getters.CurrentBudgetID + '/transaction/' + transaction.ID"
|
||||||
>{{ transaction.Memo }}</a>
|
>{{ transaction.Memo }}</a>
|
||||||
</td>
|
</td>
|
||||||
<td
|
<td
|
||||||
|
@ -10,12 +10,12 @@ export default defineComponent({
|
|||||||
<div class="flex flex-col">
|
<div class="flex flex-col">
|
||||||
<span class="m-1 p-1 px-3 text-xl">
|
<span class="m-1 p-1 px-3 text-xl">
|
||||||
<router-link to="/dashboard">⌂</router-link>
|
<router-link to="/dashboard">⌂</router-link>
|
||||||
{{$store.getters.CurrentBudget.Name}}
|
{{$store.getters.CurrentBudgetName}}
|
||||||
</span>
|
</span>
|
||||||
<span class="bg-orange-200 rounded-lg m-1 p-1 px-3 flex flex-col">
|
<span class="bg-orange-200 rounded-lg m-1 p-1 px-3 flex flex-col">
|
||||||
<router-link :to="'/budget/'+budgetid">Budget</router-link><br />
|
<router-link :to="'/budget/'+budgetid">Budget</router-link><br />
|
||||||
<span>Reports (Coming Soon)</span>
|
<span>Reports (Coming Soon)</span>
|
||||||
<router-link :to="'/budget/'+$store.getters.CurrentBudget.ID+'/all-accounts'">All Accounts</router-link>
|
<router-link :to="'/budget/'+$store.getters.CurrentBudgetID+'/all-accounts'">All Accounts</router-link>
|
||||||
</span>
|
</span>
|
||||||
<li class="bg-orange-200 rounded-lg m-1 p-1 px-3">
|
<li class="bg-orange-200 rounded-lg m-1 p-1 px-3">
|
||||||
On-Budget Accounts
|
On-Budget Accounts
|
||||||
@ -35,13 +35,13 @@ export default defineComponent({
|
|||||||
Closed Accounts
|
Closed Accounts
|
||||||
</li>
|
</li>
|
||||||
<!--<li>
|
<!--<li>
|
||||||
<router-link :to="'/budget/'+$store.getters.CurrentBudget.ID+'/accounts'">Edit accounts</router-link>
|
<router-link :to="'/budget/'+$store.getters.CurrentBudgetID+'/accounts'">Edit accounts</router-link>
|
||||||
</li>-->
|
</li>-->
|
||||||
<li class="bg-red-200 rounded-lg m-1 p-1 px-3">
|
<li class="bg-red-200 rounded-lg m-1 p-1 px-3">
|
||||||
+ Add Account
|
+ Add Account
|
||||||
</li>
|
</li>
|
||||||
<li class="bg-red-200 rounded-lg m-1 p-1 px-3">
|
<li class="bg-red-200 rounded-lg m-1 p-1 px-3">
|
||||||
<router-link :to="'/budget/'+$store.getters.CurrentBudget.ID+'/settings'">Budget-Settings</router-link>
|
<router-link :to="'/budget/'+$store.getters.CurrentBudgetID+'/settings'">Budget-Settings</router-link>
|
||||||
</li>
|
</li>
|
||||||
<!--<li><router-link to="/admin">Admin</router-link></li>-->
|
<!--<li><router-link to="/admin">Admin</router-link></li>-->
|
||||||
</div>
|
</div>
|
||||||
|
@ -201,15 +201,27 @@ export const store = createStore<State>({
|
|||||||
'Authorization': 'Bearer ' + state.Session.Token
|
'Authorization': 'Bearer ' + state.Session.Token
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
CurrentBudget(state) {
|
CurrentBudget(state) : Budget | undefined {
|
||||||
if (state.CurrentBudgetID == null)
|
if (state.CurrentBudgetID == null)
|
||||||
return {};
|
return undefined;
|
||||||
|
|
||||||
return state.Budgets.get(state.CurrentBudgetID) || {};
|
return state.Budgets.get(state.CurrentBudgetID);
|
||||||
},
|
},
|
||||||
CurrentAccount(state) {
|
CurrentBudgetID(state) : string | undefined {
|
||||||
|
return state.CurrentBudgetID;
|
||||||
|
},
|
||||||
|
CurrentBudgetName(state) : string {
|
||||||
|
if (state.CurrentBudgetID == null)
|
||||||
|
return "";
|
||||||
|
|
||||||
|
const currentBudget = state.Budgets.get(state.CurrentBudgetID);
|
||||||
|
if(currentBudget != undefined)
|
||||||
|
return currentBudget.Name;
|
||||||
|
return "";
|
||||||
|
},
|
||||||
|
CurrentAccount(state) : Account | undefined {
|
||||||
if (state.CurrentAccountID == null)
|
if (state.CurrentAccountID == null)
|
||||||
return { name: "Not found" };
|
return undefined;
|
||||||
return state.Accounts.get(state.CurrentAccountID);
|
return state.Accounts.get(state.CurrentAccountID);
|
||||||
},
|
},
|
||||||
OnBudgetAccounts(state) {
|
OnBudgetAccounts(state) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user