From ae3eeed7d97c6793ae3e94b9219489040eb39a3a Mon Sep 17 00:00:00 2001 From: matthieu Date: Tue, 10 Mar 2026 23:47:49 +0100 Subject: [PATCH] refactor(time-tracking) : use MalioSelect for filters and drawer, improve calendar cards Co-Authored-By: Claude Opus 4.6 --- frontend/components/TimeEntryBlock.vue | 28 ++++++------ frontend/components/TimeEntryDrawer.vue | 61 +++++++++++++------------ frontend/pages/time-tracking.vue | 60 ++++++++++++++++-------- 3 files changed, 87 insertions(+), 62 deletions(-) diff --git a/frontend/components/TimeEntryBlock.vue b/frontend/components/TimeEntryBlock.vue index 8579f0d..c8e0930 100644 --- a/frontend/components/TimeEntryBlock.vue +++ b/frontend/components/TimeEntryBlock.vue @@ -18,27 +18,29 @@
- + @@ -88,13 +90,11 @@ const resizeTopDeltaMinutes = ref(0) const resizeBottomDeltaMinutes = ref(0) const duration = computed(() => { - const startMs = startDate.value.getTime() + resizeTopDeltaMinutes.value * 60000 - const endMs = endDate.value.getTime() + resizeBottomDeltaMinutes.value * 60000 - const diff = endMs - startMs - const h = Math.floor(diff / 3600000) - const m = Math.floor((diff % 3600000) / 60000) - const s = Math.floor((diff % 60000) / 1000) - return [h, m, s].map((v) => String(v).padStart(2, '0')).join(' : ') + const mins = Math.floor((endDate.value.getTime() + resizeBottomDeltaMinutes.value * 60000 + - startDate.value.getTime() - resizeTopDeltaMinutes.value * 60000) / 60000) + const h = Math.floor(mins / 60) + const m = mins % 60 + return m > 0 ? `${h}h${String(m).padStart(2, '0')}` : `${h}h` }) const heightPx = computed(() => { diff --git a/frontend/components/TimeEntryDrawer.vue b/frontend/components/TimeEntryDrawer.vue index a3b2a17..7fcde22 100644 --- a/frontend/components/TimeEntryDrawer.vue +++ b/frontend/components/TimeEntryDrawer.vue @@ -57,37 +57,28 @@ {{ durationLabel }}
-
- - -
+ -
- - -
+ -
- - -
+
-
+

{{ currentMonthLabel }}

@@ -33,29 +33,35 @@
- + :options="userOptions" + min-width="!w-40" + text-field="text-sm" + text-value="text-sm" + label="User" + empty-option-label="User" + /> - + :options="projectOptions" + empty-option-label="Tous" + label="Projet" + min-width="!w-40" + text-field="text-sm" + text-value="text-sm" + /> - + :options="typeOptions" + empty-option-label="Tous" + label="Type" + min-width="!w-40" + text-field="text-sm" + text-value="text-sm" + />
@@ -145,6 +151,18 @@ const currentMonthLabel = computed(() => { return `${months[d.getMonth()]} ${d.getFullYear()}` }) +const userOptions = computed(() => + users.value.map(u => ({ label: u.username, value: u.id })) +) + +const projectOptions = computed(() => + projects.value.map(p => ({ label: p.name, value: p.id })) +) + +const typeOptions = computed(() => + types.value.map(t => ({ label: t.label, value: t.id })) +) + const filteredEntries = computed(() => { let result = entries.value if (selectedProjectId.value) { @@ -284,4 +302,8 @@ watch(viewMode, () => { startDate.value = viewMode.value === 'day' ? startDate.value : getMonday(startDate.value) loadEntries() }) + +watch(selectedUserId, () => { + loadEntries() +})