add aggregation/grouping of time entries with same attributes in time view

This commit is contained in:
Gregor Vostrak
2024-05-16 13:08:10 +02:00
parent 4edf282083
commit e2c6026b47
15 changed files with 355 additions and 66 deletions

View File

@@ -87,3 +87,11 @@ export function formatHumanReadableDate(date: string) {
}
return dayjs(date).fromNow();
}
export function formatStartEnd(start: string, end: string | null) {
if (end) {
return `${formatTime(start)} - ${formatTime(end)}`;
} else {
return `${formatTime(start)} - ...`;
}
}

View File

@@ -24,9 +24,29 @@ export const useMembersStore = defineStore('members', () => {
}
}
async function removeMember(membershipId: string) {
const organization = getCurrentOrganizationId();
if (organization) {
await handleApiRequestNotifications(
api.removeMember(
{},
{
params: {
organization: organization,
membership: membershipId,
},
}
),
'Member deleted successfully',
'Failed to delete member'
);
await fetchMembers();
}
}
const members = computed<Member[]>(() => {
return membersResponse.value?.data || [];
});
return { members, fetchMembers };
return { members, fetchMembers, removeMember };
});

View File

@@ -5,6 +5,7 @@ import { reactive, ref } from 'vue';
import type { CreateTimeEntryBody, TimeEntry } from '@/utils/api';
import dayjs from 'dayjs';
import { useNotificationsStore } from '@/utils/notification';
export type TimeEntriesGroupedByType = TimeEntry & { timeEntries: TimeEntry[] };
export const useTimeEntriesStore = defineStore('timeEntries', () => {
const timeEntries = ref<TimeEntry[]>(reactive([]));