feat(frontend) : allow multiple type selection in time entry drawer and remove group creation from kanban
Replace single-select dropdown with multi-select colored badges for types in TimeEntryDrawer, matching TaskDrawer pattern. Remove the "Ajouter un groupe" button and associated code from the kanban page. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -72,13 +72,29 @@
|
|||||||
min-width="w-full"
|
min-width="w-full"
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<MalioSelect
|
<div>
|
||||||
v-model="form.typeId"
|
<p class="mb-2 text-sm font-semibold text-neutral-700">Types</p>
|
||||||
:options="typeOptions"
|
<div class="flex flex-wrap gap-2">
|
||||||
label="Type"
|
<label
|
||||||
empty-option-label="— Aucun —"
|
v-for="type in types"
|
||||||
min-width="w-full"
|
:key="type.id"
|
||||||
/>
|
class="cursor-pointer rounded-full px-3 py-1 text-xs font-semibold transition"
|
||||||
|
:class="form.typeIds.includes(type.id)
|
||||||
|
? 'text-white'
|
||||||
|
: 'bg-neutral-100 text-neutral-600 hover:bg-neutral-200'"
|
||||||
|
:style="form.typeIds.includes(type.id) ? { backgroundColor: type.color } : {}"
|
||||||
|
>
|
||||||
|
<input
|
||||||
|
type="checkbox"
|
||||||
|
class="hidden"
|
||||||
|
:value="type.id"
|
||||||
|
:checked="form.typeIds.includes(type.id)"
|
||||||
|
@change="toggleType(type.id)"
|
||||||
|
/>
|
||||||
|
{{ type.label }}
|
||||||
|
</label>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
<div class="flex items-center" :class="isEditing ? 'justify-between' : 'justify-end'">
|
<div class="flex items-center" :class="isEditing ? 'justify-between' : 'justify-end'">
|
||||||
<button
|
<button
|
||||||
@@ -138,7 +154,7 @@ const form = reactive({
|
|||||||
endTime: '',
|
endTime: '',
|
||||||
userId: authStore.user?.id ?? null as number | null,
|
userId: authStore.user?.id ?? null as number | null,
|
||||||
projectId: null as number | null,
|
projectId: null as number | null,
|
||||||
typeId: null as number | null,
|
typeIds: [] as number[],
|
||||||
})
|
})
|
||||||
|
|
||||||
const userOptions = computed(() =>
|
const userOptions = computed(() =>
|
||||||
@@ -149,10 +165,6 @@ const projectOptions = computed(() =>
|
|||||||
props.projects.map(p => ({ label: p.name, value: p.id }))
|
props.projects.map(p => ({ label: p.name, value: p.id }))
|
||||||
)
|
)
|
||||||
|
|
||||||
const typeOptions = computed(() =>
|
|
||||||
props.types.map(t => ({ label: t.label, value: t.id }))
|
|
||||||
)
|
|
||||||
|
|
||||||
const durationLabel = computed(() => {
|
const durationLabel = computed(() => {
|
||||||
if (!form.startTime || !form.endTime) return ''
|
if (!form.startTime || !form.endTime) return ''
|
||||||
const [sh, sm] = form.startTime.split(':').map(Number) as [number, number]
|
const [sh, sm] = form.startTime.split(':').map(Number) as [number, number]
|
||||||
@@ -164,6 +176,15 @@ const durationLabel = computed(() => {
|
|||||||
return m > 0 ? `${h}h${String(m).padStart(2, '0')}` : `${h}h`
|
return m > 0 ? `${h}h${String(m).padStart(2, '0')}` : `${h}h`
|
||||||
})
|
})
|
||||||
|
|
||||||
|
function toggleType(id: number) {
|
||||||
|
const idx = form.typeIds.indexOf(id)
|
||||||
|
if (idx >= 0) {
|
||||||
|
form.typeIds.splice(idx, 1)
|
||||||
|
} else {
|
||||||
|
form.typeIds.push(id)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
function toLocalDate(iso: string): string {
|
function toLocalDate(iso: string): string {
|
||||||
const d = new Date(iso)
|
const d = new Date(iso)
|
||||||
const offset = d.getTimezoneOffset()
|
const offset = d.getTimezoneOffset()
|
||||||
@@ -191,7 +212,7 @@ function populateForm(entry: TimeEntry | null | undefined) {
|
|||||||
form.endTime = entry.stoppedAt ? toLocalTime(entry.stoppedAt) : ''
|
form.endTime = entry.stoppedAt ? toLocalTime(entry.stoppedAt) : ''
|
||||||
form.userId = entry.user?.id ?? authStore.user?.id ?? null
|
form.userId = entry.user?.id ?? authStore.user?.id ?? null
|
||||||
form.projectId = entry.project?.id ?? null
|
form.projectId = entry.project?.id ?? null
|
||||||
form.typeId = entry.types?.[0]?.id ?? null
|
form.typeIds = entry.types?.map(t => t.id) ?? []
|
||||||
} else {
|
} else {
|
||||||
form.title = ''
|
form.title = ''
|
||||||
form.description = ''
|
form.description = ''
|
||||||
@@ -200,7 +221,7 @@ function populateForm(entry: TimeEntry | null | undefined) {
|
|||||||
form.endTime = ''
|
form.endTime = ''
|
||||||
form.userId = authStore.user?.id ?? null
|
form.userId = authStore.user?.id ?? null
|
||||||
form.projectId = null
|
form.projectId = null
|
||||||
form.typeId = null
|
form.typeIds = []
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -230,7 +251,7 @@ async function onSubmit() {
|
|||||||
stoppedAt: form.endTime ? toISO(form.date, form.endTime) : null,
|
stoppedAt: form.endTime ? toISO(form.date, form.endTime) : null,
|
||||||
user: `/api/users/${form.userId}`,
|
user: `/api/users/${form.userId}`,
|
||||||
project: form.projectId ? `/api/projects/${form.projectId}` : null,
|
project: form.projectId ? `/api/projects/${form.projectId}` : null,
|
||||||
types: form.typeId ? [`/api/task_types/${form.typeId}`] : [],
|
types: form.typeIds.map(id => `/api/task_types/${id}`),
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isEditing.value && props.entry) {
|
if (isEditing.value && props.entry) {
|
||||||
|
|||||||
@@ -2,20 +2,12 @@
|
|||||||
<div>
|
<div>
|
||||||
<div class="flex items-center justify-between">
|
<div class="flex items-center justify-between">
|
||||||
<h1 class="text-2xl font-bold text-primary-500">{{ project?.name ?? '' }}</h1>
|
<h1 class="text-2xl font-bold text-primary-500">{{ project?.name ?? '' }}</h1>
|
||||||
<div class="flex gap-3">
|
<button
|
||||||
<button
|
class="rounded-md bg-primary-500 px-4 py-2 text-sm font-semibold text-white hover:bg-secondary-500"
|
||||||
class="rounded-md bg-secondary-500 px-4 py-2 text-sm font-semibold text-white hover:bg-secondary-600"
|
@click="openTaskCreate"
|
||||||
@click="openGroupCreate"
|
>
|
||||||
>
|
+ Ajouter un ticket
|
||||||
+ Ajouter un groupe
|
</button>
|
||||||
</button>
|
|
||||||
<button
|
|
||||||
class="rounded-md bg-primary-500 px-4 py-2 text-sm font-semibold text-white hover:bg-secondary-500"
|
|
||||||
@click="openTaskCreate"
|
|
||||||
>
|
|
||||||
+ Ajouter un ticket
|
|
||||||
</button>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="mt-4">
|
<div class="mt-4">
|
||||||
@@ -137,12 +129,6 @@
|
|||||||
@saved="onSaved"
|
@saved="onSaved"
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<TaskGroupDrawer
|
|
||||||
v-model="groupDrawerOpen"
|
|
||||||
:group="selectedGroup"
|
|
||||||
:project-id="projectId"
|
|
||||||
@saved="onSaved"
|
|
||||||
/>
|
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
@@ -193,8 +179,6 @@ const dragOverStatusId = ref<number | null>(null)
|
|||||||
const dragCounter = ref(0)
|
const dragCounter = ref(0)
|
||||||
const taskDrawerOpen = ref(false)
|
const taskDrawerOpen = ref(false)
|
||||||
const selectedTask = ref<Task | null>(null)
|
const selectedTask = ref<Task | null>(null)
|
||||||
const groupDrawerOpen = ref(false)
|
|
||||||
const selectedGroup = ref<TaskGroup | null>(null)
|
|
||||||
|
|
||||||
const groupFilterOptions = computed(() =>
|
const groupFilterOptions = computed(() =>
|
||||||
groups.value.map(g => ({ label: g.title, value: g.id }))
|
groups.value.map(g => ({ label: g.title, value: g.id }))
|
||||||
@@ -249,11 +233,6 @@ function openTaskEdit(task: Task) {
|
|||||||
taskDrawerOpen.value = true
|
taskDrawerOpen.value = true
|
||||||
}
|
}
|
||||||
|
|
||||||
function openGroupCreate() {
|
|
||||||
selectedGroup.value = null
|
|
||||||
groupDrawerOpen.value = true
|
|
||||||
}
|
|
||||||
|
|
||||||
function onDragEnter(id: number) {
|
function onDragEnter(id: number) {
|
||||||
dragCounter.value++
|
dragCounter.value++
|
||||||
dragOverStatusId.value = id
|
dragOverStatusId.value = id
|
||||||
|
|||||||
Reference in New Issue
Block a user