11<template >
2- <div class =" w-full flex flex-row items-start gap-1" >
3- <UIcon
4- v-if =" isCompleted"
5- name =" i-lucide-check"
6- class =" shrink-0 mt-1.5 size-6 text-secondary"
7- />
8- <UCheckbox
9- v-else-if =" canComplete"
10- v-model =" checkbox"
11- variant =" list"
12- icon =" i-lucide-check"
13- class =" shrink-0 mt-1.5 duration-200 motion-preset-bounce"
14- :ui =" {
15- base: 'size-6',
16- }"
17- @change =" handleComplete"
18- />
19- <UCheckbox
20- v-else
21- v-model =" checkbox"
22- color =" secondary"
23- variant =" list"
24- icon =" i-lucide-check"
25- :ui =" {
26- base: 'size-6',
27- }"
28- class =" shrink-0 mt-1.5 duration-200 motion-preset-bounce"
29- disabled
30- />
31-
2+ <div >
323 <UDropdownMenu
334 :items =" items"
345 :content =" {
3910 item: 'p-2 motion-preset-slide-left motion-duration-200',
4011 }"
4112 >
42- <UButton
43- color =" secondary"
44- :variant =" isFocused ? 'ghost' : 'ghost'"
45- :trailing-icon =" isFocused ? 'i-lucide-goal' : undefined"
46- block
47- :ui =" {
48- trailingIcon: [
49- 'self-start mt-0.5 text-dimmed',
50- isFocused ? 'text-secondary' : undefined,
51- ],
52- }"
53- class =" group/task duration-200 motion-preset-bounce"
54- @click =" vibrate()"
55- >
56- <div class =" w-full flex flex-col gap-2 items-start" >
57- <div class =" flex flex-col gap-1 items-start text-left" >
58- <h4 class =" text-base/5 font-medium tg-text" >
59- {{ task.name }}
60- </h4 >
61- <p v-if =" task.description" class =" text-sm/4 text-muted font-normal" >
62- {{ task.description }}
63- </p >
64- </div >
65-
66- <div class =" flex flex-row gap-y-1 gap-x-2 items-center" >
67- <UBadge
68- v-if =" task?.date"
69- size =" md"
70- color =" primary"
71- variant =" soft"
72- icon =" i-lucide-calendar"
73- class =" shrink-0"
74- >
75- {{ df.format(parseDate(task.date).toDate(getLocalTimeZone())) }}
76- </UBadge >
77- </div >
78- </div >
79- </UButton >
13+ <TaskInfoCard :task =" task" />
8014 </UDropdownMenu >
8115 </div >
8216</template >
8519import type { DropdownMenuItem } from ' @nuxt/ui'
8620import type { Task } from ' @roll-stack/database'
8721import { ModalCompleteTask , ModalUpdateTask } from ' #components'
88- import { DateFormatter , getLocalTimeZone , parseDate } from ' @internationalized/date'
8922
9023const { task } = defineProps <{
9124 task: Task
9225}>()
9326
9427const { vibrate } = useFeedback ()
95- const taskStore = useTaskStore ()
28+
9629const userStore = useUserStore ()
30+ const taskStore = useTaskStore ()
9731
9832const list = computed (() => taskStore .lists .find ((list ) => list .id === task .listId ))
9933
10034const overlay = useOverlay ()
10135const modalUpdateTask = overlay .create (ModalUpdateTask )
10236const modalCompleteTask = overlay .create (ModalCompleteTask )
10337
104- const df = new DateFormatter (' ru-RU' , {
105- dateStyle: ' long' ,
106- })
107-
10838const isCompleted = computed (() => !! task .completedAt )
10939const performer = computed (() => userStore .staff .find ((staff ) => staff .id === task .performerId ))
11040
@@ -113,8 +43,6 @@ const canComplete = computed(() => canEdit.value && !isCompleted.value && (task.
11343const canFocus = computed (() => task .performerId === userStore .id && ! isCompleted .value )
11444const isFocused = computed (() => task .id === performer .value ?.focusedTaskId )
11545
116- const checkbox = ref (false )
117-
11846const items = computed <DropdownMenuItem []>(() => {
11947 const menuItems: DropdownMenuItem [] = [
12048 {
@@ -147,6 +75,12 @@ const items = computed<DropdownMenuItem[]>(() => {
14775 },
14876 condition: canEdit .value ,
14977 },
78+ {
79+ label: ' Задача закрыта' ,
80+ icon: ' i-lucide-check' ,
81+ disabled: true ,
82+ condition: isCompleted .value ,
83+ },
15084 ]
15185
15286 return menuItems .filter ((item ) => item .condition )
@@ -177,16 +111,4 @@ async function onUnfocus() {
177111 vibrate (' error' )
178112 }
179113}
180-
181- function handleComplete() {
182- vibrate ()
183-
184- if (! checkbox .value ) {
185- return
186- }
187-
188- modalCompleteTask .open ({ taskId: task .id })
189-
190- checkbox .value = false
191- }
192114 </script >
0 commit comments