mirror of
https://github.com/solidtime-io/solidtime.git
synced 2026-08-18 13:12:16 +01:00
feat: add duplicate time entry fields
This commit is contained in:
committed by
Gregor Vostrak
parent
4a50145329
commit
639f5332e4
@@ -400,6 +400,7 @@ async function downloadExport(format: ExportFormat) {
|
|||||||
:on-start-stop-click="() => startTimeEntryFromExisting(entry)"
|
:on-start-stop-click="() => startTimeEntryFromExisting(entry)"
|
||||||
:delete-time-entry="() => deleteTimeEntries([entry])"
|
:delete-time-entry="() => deleteTimeEntries([entry])"
|
||||||
:currency="getOrganizationCurrencyString()"
|
:currency="getOrganizationCurrencyString()"
|
||||||
|
:duplicate-time-entry="() => createTimeEntry(entry)"
|
||||||
:members="members"
|
:members="members"
|
||||||
show-date
|
show-date
|
||||||
show-member
|
show-member
|
||||||
|
|||||||
@@ -33,6 +33,7 @@ const props = defineProps<{
|
|||||||
createProject: (project: CreateProjectBody) => Promise<Project | undefined>;
|
createProject: (project: CreateProjectBody) => Promise<Project | undefined>;
|
||||||
createClient: (client: CreateClientBody) => Promise<Client | undefined>;
|
createClient: (client: CreateClientBody) => Promise<Client | undefined>;
|
||||||
onStartStopClick: (timeEntry: TimeEntry) => void;
|
onStartStopClick: (timeEntry: TimeEntry) => void;
|
||||||
|
duplicateTimeEntry: (timeEntry: TimeEntry) => void;
|
||||||
updateTimeEntries: (ids: string[], changes: Partial<TimeEntry>) => void;
|
updateTimeEntries: (ids: string[], changes: Partial<TimeEntry>) => void;
|
||||||
updateTimeEntry: (timeEntry: TimeEntry) => void;
|
updateTimeEntry: (timeEntry: TimeEntry) => void;
|
||||||
deleteTimeEntries: (timeEntries: TimeEntry[]) => void;
|
deleteTimeEntries: (timeEntries: TimeEntry[]) => void;
|
||||||
@@ -173,6 +174,7 @@ function onSelectChange(checked: boolean) {
|
|||||||
@changed="onStartStopClick(timeEntry)"></TimeTrackerStartStop>
|
@changed="onStartStopClick(timeEntry)"></TimeTrackerStartStop>
|
||||||
<TimeEntryMoreOptionsDropdown
|
<TimeEntryMoreOptionsDropdown
|
||||||
:show-edit="false"
|
:show-edit="false"
|
||||||
|
:show-duplicate="false"
|
||||||
@delete="
|
@delete="
|
||||||
deleteTimeEntries(timeEntry?.timeEntries ?? [])
|
deleteTimeEntries(timeEntry?.timeEntries ?? [])
|
||||||
"></TimeEntryMoreOptionsDropdown>
|
"></TimeEntryMoreOptionsDropdown>
|
||||||
@@ -202,6 +204,7 @@ function onSelectChange(checked: boolean) {
|
|||||||
:update-time-entry="(timeEntry: TimeEntry) => updateTimeEntry(timeEntry)"
|
:update-time-entry="(timeEntry: TimeEntry) => updateTimeEntry(timeEntry)"
|
||||||
:on-start-stop-click="() => onStartStopClick(subEntry)"
|
:on-start-stop-click="() => onStartStopClick(subEntry)"
|
||||||
:delete-time-entry="() => deleteTimeEntries([subEntry])"
|
:delete-time-entry="() => deleteTimeEntries([subEntry])"
|
||||||
|
:duplicate-time-entry="() => duplicateTimeEntry(subEntry)"
|
||||||
:currency="currency"
|
:currency="currency"
|
||||||
:create-tag
|
:create-tag
|
||||||
:time-entry="subEntry"
|
:time-entry="subEntry"
|
||||||
|
|||||||
@@ -108,6 +108,7 @@ function startTimeEntryFromExisting(entry: TimeEntry) {
|
|||||||
tags: [...entry.tags],
|
tags: [...entry.tags],
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function sumDuration(timeEntries: TimeEntry[]) {
|
function sumDuration(timeEntries: TimeEntry[]) {
|
||||||
return timeEntries.reduce((acc, entry) => acc + (entry?.duration ?? 0), 0);
|
return timeEntries.reduce((acc, entry) => acc + (entry?.duration ?? 0), 0);
|
||||||
}
|
}
|
||||||
@@ -158,6 +159,7 @@ function unselectAllTimeEntries(value: TimeEntriesGroupedByType[]) {
|
|||||||
:tags="tags"
|
:tags="tags"
|
||||||
:clients
|
:clients
|
||||||
:on-start-stop-click="startTimeEntryFromExisting"
|
:on-start-stop-click="startTimeEntryFromExisting"
|
||||||
|
:duplicate-time-entry="createTimeEntry"
|
||||||
:update-time-entries
|
:update-time-entries
|
||||||
:update-time-entry
|
:update-time-entry
|
||||||
:delete-time-entries
|
:delete-time-entries
|
||||||
@@ -198,6 +200,7 @@ function unselectAllTimeEntries(value: TimeEntriesGroupedByType[]) {
|
|||||||
:update-time-entry
|
:update-time-entry
|
||||||
:on-start-stop-click="() => startTimeEntryFromExisting(entry)"
|
:on-start-stop-click="() => startTimeEntryFromExisting(entry)"
|
||||||
:delete-time-entry="() => deleteTimeEntries([entry])"
|
:delete-time-entry="() => deleteTimeEntries([entry])"
|
||||||
|
:duplicate-time-entry="() => createTimeEntry(entry)"
|
||||||
:currency="currency"
|
:currency="currency"
|
||||||
:time-entry="entry.timeEntries[0]"
|
:time-entry="entry.timeEntries[0]"
|
||||||
@selected="selectedTimeEntries.push(entry)"
|
@selected="selectedTimeEntries.push(entry)"
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { TrashIcon, PencilIcon } from '@heroicons/vue/20/solid';
|
import { TrashIcon, PencilIcon, DocumentDuplicateIcon } from '@heroicons/vue/20/solid';
|
||||||
import {
|
import {
|
||||||
DropdownMenu,
|
DropdownMenu,
|
||||||
DropdownMenuContent,
|
DropdownMenuContent,
|
||||||
@@ -10,8 +10,10 @@ import {
|
|||||||
const props = withDefaults(
|
const props = withDefaults(
|
||||||
defineProps<{
|
defineProps<{
|
||||||
showEdit?: boolean;
|
showEdit?: boolean;
|
||||||
|
showDuplicate?: boolean;
|
||||||
}>(),
|
}>(),
|
||||||
{
|
{
|
||||||
|
showDuplicate: true,
|
||||||
showEdit: true,
|
showEdit: true,
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
@@ -19,6 +21,7 @@ const props = withDefaults(
|
|||||||
const emit = defineEmits<{
|
const emit = defineEmits<{
|
||||||
edit: [];
|
edit: [];
|
||||||
delete: [];
|
delete: [];
|
||||||
|
duplicate: [];
|
||||||
}>();
|
}>();
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
@@ -51,6 +54,14 @@ const emit = defineEmits<{
|
|||||||
<PencilIcon class="w-5" />
|
<PencilIcon class="w-5" />
|
||||||
<span>Edit</span>
|
<span>Edit</span>
|
||||||
</DropdownMenuItem>
|
</DropdownMenuItem>
|
||||||
|
<DropdownMenuItem
|
||||||
|
v-if="props.showDuplicate"
|
||||||
|
data-testid="time_entry_duplicate"
|
||||||
|
class="flex items-center space-x-3 cursor-pointer"
|
||||||
|
@click="emit('duplicate')">
|
||||||
|
<DocumentDuplicateIcon class="w-5" />
|
||||||
|
<span>Duplicate</span>
|
||||||
|
</DropdownMenuItem>
|
||||||
<DropdownMenuItem
|
<DropdownMenuItem
|
||||||
data-testid="time_entry_delete"
|
data-testid="time_entry_delete"
|
||||||
class="flex items-center space-x-3 cursor-pointer text-destructive focus:text-destructive"
|
class="flex items-center space-x-3 cursor-pointer text-destructive focus:text-destructive"
|
||||||
|
|||||||
@@ -36,6 +36,7 @@ const props = defineProps<{
|
|||||||
createClient: (client: CreateClientBody) => Promise<Client | undefined>;
|
createClient: (client: CreateClientBody) => Promise<Client | undefined>;
|
||||||
onStartStopClick: () => void;
|
onStartStopClick: () => void;
|
||||||
deleteTimeEntry: () => void;
|
deleteTimeEntry: () => void;
|
||||||
|
duplicateTimeEntry?: () => void;
|
||||||
updateTimeEntry: (timeEntry: TimeEntry) => void;
|
updateTimeEntry: (timeEntry: TimeEntry) => void;
|
||||||
currency: string;
|
currency: string;
|
||||||
showMember?: boolean;
|
showMember?: boolean;
|
||||||
@@ -166,6 +167,7 @@ async function handleDeleteTimeEntry() {
|
|||||||
@changed="onStartStopClick"></TimeTrackerStartStop>
|
@changed="onStartStopClick"></TimeTrackerStartStop>
|
||||||
<TimeEntryMoreOptionsDropdown
|
<TimeEntryMoreOptionsDropdown
|
||||||
@edit="handleEdit"
|
@edit="handleEdit"
|
||||||
|
@duplicate="duplicateTimeEntry"
|
||||||
@delete="deleteTimeEntry"></TimeEntryMoreOptionsDropdown>
|
@delete="deleteTimeEntry"></TimeEntryMoreOptionsDropdown>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
Reference in New Issue
Block a user