Move logic for hidden categories to client

This commit is contained in:
2022-02-23 13:42:33 +00:00
parent 674bef667b
commit f93888cbbc
3 changed files with 34 additions and 18 deletions

View File

@ -14,10 +14,16 @@ const props = defineProps<{
const budgetsStore = useBudgetsStore();
const CurrentBudgetID = computed(() => budgetsStore.CurrentBudgetID);
const categoriesForMonth = useAccountStore().CategoriesForMonth;
const accountStore = useAccountStore();
const categoriesForMonth = accountStore.CategoriesForMonth;
const Categories = computed(() => {
return [...categoriesForMonth(selected.value.Year, selected.value.Month)];
});
const hiddenCategoriesForMonth = accountStore.HiddenCategoriesForMonth;
const HiddenCategories = computed(() => {
return [...hiddenCategoriesForMonth(selected.value.Year, selected.value.Month)];
});
const previous = computed(() => ({
Year: new Date(selected.value.Year, selected.value.Month - 1, 1).getFullYear(),
@ -88,5 +94,23 @@ onMounted(() => {
<Currency :value="category.Available" />
</td>
</tr>
<tr v-for="category in HiddenCategories">
<td>{{ category.Group }}</td>
<td>{{ category.Name }}</td>
<td></td>
<td></td>
<td class="text-right">
<Currency :value="category.AvailableLastMonth" />
</td>
<td class="text-right">
<Currency :value="category.Assigned" />
</td>
<td class="text-right">
<Currency :value="category.Activity" />
</td>
<td class="text-right">
<Currency :value="category.Available" />
</td>
</tr>
</table>
</template>

View File

@ -58,7 +58,13 @@ export const useAccountStore = defineStore("budget/account", {
const yearMap = state.Months.get(year);
const monthMap = yearMap?.get(month);
console.log("MTH", monthMap)
return [...monthMap?.values() || []];
return [...monthMap?.values() || []].filter(x => x.Group != "Hidden Categories");
},
HiddenCategoriesForMonth: (state) => (year: number, month: number) => {
const yearMap = state.Months.get(year);
const monthMap = yearMap?.get(month);
console.log("MTH", monthMap)
return [...monthMap?.values() || []].filter(x => x.Group == "Hidden Categories");
},
CurrentAccount(state): Account | undefined {
if (state.CurrentAccountID == null)