Use grid instead of table
This commit is contained in:
parent
18149eef8b
commit
6dd8a3791f
@ -17,7 +17,7 @@ const CurrentBudgetID = computed(() => budgetsStore.CurrentBudgetID);
|
|||||||
const accountStore = useAccountStore();
|
const accountStore = useAccountStore();
|
||||||
const categoriesForMonth = accountStore.CategoriesForMonthAndGroup;
|
const categoriesForMonth = accountStore.CategoriesForMonthAndGroup;
|
||||||
|
|
||||||
function GetCategories(group : string) {
|
function GetCategories(group: string) {
|
||||||
return [...categoriesForMonth(selected.value.Year, selected.value.Month, group)];
|
return [...categoriesForMonth(selected.value.Year, selected.value.Month, group)];
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -56,12 +56,12 @@ onMounted(() => {
|
|||||||
|
|
||||||
const expandedGroups = ref<Map<string, boolean>>(new Map<string, boolean>())
|
const expandedGroups = ref<Map<string, boolean>>(new Map<string, boolean>())
|
||||||
|
|
||||||
function toggleGroup(group : {Name : string, Expand: boolean}) {
|
function toggleGroup(group: { Name: string, Expand: boolean }) {
|
||||||
console.log(expandedGroups.value);
|
console.log(expandedGroups.value);
|
||||||
expandedGroups.value.set(group.Name, !(expandedGroups.value.get(group.Name) ?? group.Expand))
|
expandedGroups.value.set(group.Name, !(expandedGroups.value.get(group.Name) ?? group.Expand))
|
||||||
}
|
}
|
||||||
|
|
||||||
function getGroupState(group : {Name : string, Expand: boolean}) : boolean {
|
function getGroupState(group: { Name: string, Expand: boolean }): boolean {
|
||||||
return expandedGroups.value.get(group.Name) ?? group.Expand;
|
return expandedGroups.value.get(group.Name) ?? group.Expand;
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
@ -79,31 +79,24 @@ function getGroupState(group : {Name : string, Expand: boolean}) : boolean {
|
|||||||
:to="'/budget/' + CurrentBudgetID + '/budgeting/' + next.Year + '/' + next.Month"
|
:to="'/budget/' + CurrentBudgetID + '/budgeting/' + next.Year + '/' + next.Month"
|
||||||
>Next Month</router-link>
|
>Next Month</router-link>
|
||||||
</div>
|
</div>
|
||||||
<table class="container col-lg-12" id="content">
|
<div class="container col-lg-12 grid grid-cols-4 md:grid-cols-5" id="content">
|
||||||
<tr>
|
<span>Category</span>
|
||||||
<th>Category</th>
|
<span class="hidden md:block">Leftover</span>
|
||||||
<th class="hidden md:block">Leftover</th>
|
<span>Assigned</span>
|
||||||
<th>Assigned</th>
|
<span>Activity</span>
|
||||||
<th>Activity</th>
|
<span>Available</span>
|
||||||
<th>Available</th>
|
<template v-for="group in GroupsForMonth">
|
||||||
</tr>
|
<a
|
||||||
<tbody v-for="group in GroupsForMonth">
|
class="text-lg font-bold col-span-4 md:col-span-5"
|
||||||
<tr><td><a class="text-lg font-bold" colspan="4" @click="toggleGroup(group)">{{ (getGroupState(group) ? "−" : "+") + " " + group.Name }}</a></td></tr>
|
@click="toggleGroup(group)"
|
||||||
<tr v-for="category in GetCategories(group.Name)" v-if="getGroupState(group)">
|
>{{ (getGroupState(group) ? "−" : "+") + " " + group.Name }}</a>
|
||||||
<td>{{ category.Name }}</td>
|
<template v-for="category in GetCategories(group.Name)" v-if="getGroupState(group)">
|
||||||
<td class="text-right hidden md:block">
|
<span>{{ category.Name }}</span>
|
||||||
<Currency :value="category.AvailableLastMonth" />
|
<Currency :value="category.AvailableLastMonth" />
|
||||||
</td>
|
|
||||||
<td class="text-right">
|
|
||||||
<Currency :value="category.Assigned" />
|
<Currency :value="category.Assigned" />
|
||||||
</td>
|
|
||||||
<td class="text-right">
|
|
||||||
<Currency :value="category.Activity" />
|
<Currency :value="category.Activity" />
|
||||||
</td>
|
|
||||||
<td class="text-right">
|
|
||||||
<Currency :value="category.Available" />
|
<Currency :value="category.Available" />
|
||||||
</td>
|
</template>
|
||||||
</tr>
|
</template>
|
||||||
</tbody>
|
</div>
|
||||||
</table>
|
|
||||||
</template>
|
</template>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user