@@ -5,42 +5,31 @@ import DialogModal from '@/packages/ui/src/DialogModal.vue';
55import { computed , nextTick , ref , watch } from ' vue' ;
66import PrimaryButton from ' @/packages/ui/src/Buttons/PrimaryButton.vue' ;
77import TimeTrackerProjectTaskDropdown from ' @/packages/ui/src/TimeTracker/TimeTrackerProjectTaskDropdown.vue' ;
8- import { getCurrentUserId } from ' @/utils/useUser' ;
98import InputLabel from ' @/packages/ui/src/Input/InputLabel.vue' ;
109import { TagIcon } from ' @heroicons/vue/20/solid' ;
1110import {
1211 getDayJsInstance ,
1312 getLocalizedDayJs ,
1413} from ' @/packages/ui/src/utils/time' ;
15- import { storeToRefs } from ' pinia' ;
16- import { useTasksStore } from ' @/utils/useTasks' ;
17- import { useProjectsStore } from ' @/utils/useProjects' ;
18- import { useTagsStore } from ' @/utils/useTags' ;
1914import type {
2015 CreateClientBody ,
2116 CreateProjectBody ,
2217 Project ,
2318 Client ,
2419 CreateTimeEntryBody ,
2520} from ' @/packages/api/src' ;
26- import { useClientsStore } from ' @/utils/useClients' ;
2721import TimePicker from ' @/packages/ui/src/Input/TimePicker.vue' ;
2822import { getOrganizationCurrencyString } from ' @/utils/money' ;
2923import { canCreateProjects } from ' @/utils/permissions' ;
3024import TagDropdown from ' @/packages/ui/src/Tag/TagDropdown.vue' ;
3125import { Badge } from ' @/packages/ui/src' ;
3226import BillableIcon from ' @/packages/ui/src/Icons/BillableIcon.vue' ;
33- import SelectDropdown from ' ../../.. /packages/ui/src/Input/SelectDropdown.vue' ;
27+ import SelectDropdown from ' @ /packages/ui/src/Input/SelectDropdown.vue' ;
3428import DatePicker from ' @/packages/ui/src/Input/DatePicker.vue' ;
3529import DurationHumanInput from ' @/packages/ui/src/Input/DurationHumanInput.vue' ;
3630
3731import { InformationCircleIcon } from ' @heroicons/vue/20/solid' ;
38- const projectStore = useProjectsStore ();
39- const { projects } = storeToRefs (projectStore );
40- const taskStore = useTasksStore ();
41- const { tasks } = storeToRefs (taskStore );
42- const clientStore = useClientsStore ();
43- const { clients } = storeToRefs (clientStore );
32+ import type { Tag , Task } from ' @/packages/api' ;
4433
4534const show = defineModel (' show' , { default: false });
4635const saving = ref (false );
@@ -52,6 +41,11 @@ const props = defineProps<{
5241 ) => Promise <void >;
5342 createClient: (client : CreateClientBody ) => Promise <Client | undefined >;
5443 createProject: (project : CreateProjectBody ) => Promise <Project | undefined >;
44+ createTag: (name : string ) => Promise <Tag | undefined >;
45+ tags: Tag [];
46+ projects: Project [];
47+ tasks: Task [];
48+ clients: Client [];
5549}>();
5650
5751const description = ref <HTMLInputElement | null >(null );
@@ -72,7 +66,6 @@ const timeEntryDefaultValues = {
7266 billable: false ,
7367 start: getDayJsInstance ().utc ().subtract (1 , ' h' ).format (),
7468 end: getDayJsInstance ().utc ().format (),
75- user_id: getCurrentUserId (),
7669};
7770
7871const timeEntry = ref ({ ... timeEntryDefaultValues });
@@ -101,17 +94,18 @@ async function submit() {
10194 localEnd .value = getLocalizedDayJs (timeEntryDefaultValues .end ).format ();
10295 show .value = false ;
10396}
104- const { tags } = storeToRefs (useTagsStore ());
105- async function createTag(tag : string ) {
106- return await useTagsStore ().createTag (tag );
107- }
10897
10998const billableProxy = computed ({
11099 get : () => (timeEntry .value .billable ? ' true' : ' false' ),
111100 set : (value : string ) => {
112101 timeEntry .value .billable = value === ' true' ;
113102 },
114103});
104+
105+ type BillableOption = {
106+ label: string ;
107+ value: string ;
108+ };
115109 </script >
116110
117111<template >
@@ -183,8 +177,12 @@ const billableProxy = computed({
183177 <div class =" flex-col" >
184178 <SelectDropdown
185179 v-model =" billableProxy"
186- :get-key-from-item =" (item) => item.value"
187- :get-name-for-item =" (item) => item.label"
180+ :get-key-from-item ="
181+ (item: BillableOption) => item.value
182+ "
183+ :get-name-for-item ="
184+ (item: BillableOption) => item.label
185+ "
188186 :items =" [
189187 {
190188 label: 'Billable',
0 commit comments