|
7 | 7 | TimeTrackerControls,
|
8 | 8 | TimeTrackerRunningInDifferentOrganizationOverlay,
|
9 | 9 | TimeEntryMassActionRow,
|
| 10 | + TimeEntryCreateModal, |
| 11 | + MoreOptionsDropdown, |
10 | 12 | } from '@solidtime/ui'
|
11 | 13 | import {
|
12 | 14 | emptyTimeEntry,
|
@@ -35,7 +37,7 @@ import { getAllTags, useTagCreateMutation } from '../utils/tags.ts'
|
35 | 37 | import { LoadingSpinner } from '@solidtime/ui'
|
36 | 38 |
|
37 | 39 | import { useLiveTimer } from '../utils/liveTimer.ts'
|
38 |
| -import { ClockIcon } from '@heroicons/vue/20/solid' |
| 40 | +import { ClockIcon, PlusIcon } from '@heroicons/vue/20/solid' |
39 | 41 | import { CardTitle } from '@solidtime/ui'
|
40 | 42 | import { useStorage } from '@vueuse/core'
|
41 | 43 | import { currentMembershipId, useMyMemberships } from '../utils/myMemberships.ts'
|
@@ -139,6 +141,14 @@ function createTimeEntry(timeEntry: Omit<CreateTimeEntryBody, 'member_id'>) {
|
139 | 141 | timeEntryCreate.mutate(updatedTimeEntry)
|
140 | 142 | }
|
141 | 143 |
|
| 144 | +function createManualTimeEntry(timeEntry: Omit<CreateTimeEntryBody, 'member_id'>) { |
| 145 | + const updatedTimeEntry = { |
| 146 | + ...timeEntry, |
| 147 | + member_id: currentMembershipId.value, |
| 148 | + } as CreateTimeEntryBody |
| 149 | + timeEntryCreate.mutate(updatedTimeEntry) |
| 150 | +} |
| 151 | +
|
142 | 152 | async function createTag(newTagName: string): Promise<Tag | undefined> {
|
143 | 153 | const { data, mutateAsync } = tagCreate
|
144 | 154 | await mutateAsync({ name: newTagName })
|
@@ -296,44 +306,70 @@ const canCreateProjects = computed(() => {
|
296 | 306 | }
|
297 | 307 | return false
|
298 | 308 | })
|
| 309 | +
|
| 310 | +const showManualTimeEntryModal = ref(false) |
299 | 311 | </script>
|
300 | 312 |
|
301 | 313 | <template>
|
302 | 314 | <div class="h-[calc(100vh-40px)]">
|
303 | 315 | <div
|
304 | 316 | v-if="timeEntries && projects && tasks && tags && clients"
|
305 | 317 | class="flex flex-col h-full">
|
306 |
| - <div |
307 |
| - class="px-4 pb-4 pt-2 border-b border-border-primary bg-primary z-10 w-full top-0 left-0"> |
308 |
| - <CardTitle title="Time Tracker" :icon="ClockIcon as Component"></CardTitle> |
309 |
| - <div class="relative"> |
310 |
| - <TimeTrackerRunningInDifferentOrganizationOverlay |
311 |
| - v-if=" |
312 |
| - currentTimeEntry.organization_id && |
313 |
| - currentTimeEntry.organization_id !== currentOrganizationId |
314 |
| - " |
315 |
| - @switch-organization=" |
316 |
| - switchOrganization |
317 |
| - "></TimeTrackerRunningInDifferentOrganizationOverlay> |
318 |
| - <TimeTrackerControls |
319 |
| - v-model:currentTimeEntry="currentTimeEntry" |
320 |
| - v-model:liveTimer="liveTimer" |
321 |
| - :tags |
| 318 | + <div class="flex"> |
| 319 | + <div |
| 320 | + class="pl-4 pb-4 pt-2 border-b border-border-primary bg-primary z-10 w-full top-0 left-0"> |
| 321 | + <CardTitle title="Time Tracker" :icon="ClockIcon as Component"></CardTitle> |
| 322 | + <div class="relative"> |
| 323 | + <TimeTrackerRunningInDifferentOrganizationOverlay |
| 324 | + v-if=" |
| 325 | + currentTimeEntry.organization_id && |
| 326 | + currentTimeEntry.organization_id !== currentOrganizationId |
| 327 | + " |
| 328 | + @switch-organization=" |
| 329 | + switchOrganization |
| 330 | + "></TimeTrackerRunningInDifferentOrganizationOverlay> |
| 331 | + <TimeTrackerControls |
| 332 | + v-model:currentTimeEntry="currentTimeEntry" |
| 333 | + v-model:liveTimer="liveTimer" |
| 334 | + :tags |
| 335 | + :enableEstimatedTime="false" |
| 336 | + :canCreateProject="canCreateProjects" |
| 337 | + :createProject |
| 338 | + :createClient |
| 339 | + :tasks |
| 340 | + :clients |
| 341 | + :projects |
| 342 | + :createTag |
| 343 | + :isActive |
| 344 | + :currency |
| 345 | + @start-live-timer="startLiveTimer" |
| 346 | + @stop-live-timer="stopLiveTimer" |
| 347 | + @start-timer="startTimer" |
| 348 | + @stop-timer="stopTimer" |
| 349 | + @update-time-entry="updateCurrentTimeEntry"></TimeTrackerControls> |
| 350 | + </div> |
| 351 | + </div> |
| 352 | + <div class="flex justify-center items-center pt-8 group pr-4"> |
| 353 | + <MoreOptionsDropdown label="More Time Entry Options"> |
| 354 | + <button |
| 355 | + aria-label="Create Manual time entry" |
| 356 | + class="flex items-center space-x-3 rounded w-full px-3 py-2.5 text-start text-sm font-medium leading-5 text-white hover:bg-card-background-active focus:outline-none focus:bg-card-background-active transition duration-150 ease-in-out" |
| 357 | + @click="showManualTimeEntryModal = true"> |
| 358 | + <PlusIcon class="w-5 text-icon-active"></PlusIcon> |
| 359 | + <span>Create Manual Time Entry</span> |
| 360 | + </button> |
| 361 | + </MoreOptionsDropdown> |
| 362 | + <TimeEntryCreateModal |
| 363 | + v-model:show="showManualTimeEntryModal" |
322 | 364 | :enableEstimatedTime="false"
|
323 |
| - :canCreateProject="canCreateProjects" |
324 |
| - :createProject |
325 |
| - :createClient |
326 |
| - :tasks |
327 |
| - :clients |
| 365 | + :createProject="createProject" |
| 366 | + :createClient="createClient" |
| 367 | + :createTag="createTag" |
| 368 | + :createTimeEntry="createManualTimeEntry" |
328 | 369 | :projects
|
329 |
| - :createTag |
330 |
| - :isActive |
331 |
| - :currency |
332 |
| - @start-live-timer="startLiveTimer" |
333 |
| - @stop-live-timer="stopLiveTimer" |
334 |
| - @start-timer="startTimer" |
335 |
| - @stop-timer="stopTimer" |
336 |
| - @update-time-entry="updateCurrentTimeEntry"></TimeTrackerControls> |
| 370 | + :tasks |
| 371 | + :tags |
| 372 | + :clients></TimeEntryCreateModal> |
337 | 373 | </div>
|
338 | 374 | </div>
|
339 | 375 | <div class="overflow-y-scroll w-full flex-1">
|
|
0 commit comments