diff --git a/apps/web/app/[locale]/timesheet/[memberId]/components/TimesheetFilter.tsx b/apps/web/app/[locale]/timesheet/[memberId]/components/TimesheetFilter.tsx index 35af8d5ec..1d96b1aa5 100644 --- a/apps/web/app/[locale]/timesheet/[memberId]/components/TimesheetFilter.tsx +++ b/apps/web/app/[locale]/timesheet/[memberId]/components/TimesheetFilter.tsx @@ -1,33 +1,46 @@ import { FilterWithStatus } from './FilterWithStatus'; import { FrequencySelect, TimeSheetFilterPopover, TimesheetFilterDate } from '.'; import { Button } from 'lib/components'; - -export function TimesheetFilter() { +import { AddManualTimeModal } from '@/lib/features/manual-time/add-manual-time-modal'; +interface ITimesheetFilter { + isOpen: boolean, + openModal: () => void, + closeModal: () => void +} +export function TimesheetFilter({ closeModal, isOpen, openModal }: ITimesheetFilter) { return ( -
-
- { - console.log(label) - }} - /> -
-
-
-
- - - - + <> + { + isOpen && } +
+
+ { + console.log(label) + }} + /> +
+
+
+
+ + + + +
-
- + ) } diff --git a/apps/web/app/[locale]/timesheet/[memberId]/page.tsx b/apps/web/app/[locale]/timesheet/[memberId]/page.tsx index f8ce5238b..4f8f26126 100644 --- a/apps/web/app/[locale]/timesheet/[memberId]/page.tsx +++ b/apps/web/app/[locale]/timesheet/[memberId]/page.tsx @@ -5,7 +5,7 @@ import { useTranslations } from 'next-intl'; import { withAuthentication } from 'lib/app/authenticator'; import { Breadcrumb, Container, Divider } from 'lib/components'; import { Footer, MainLayout } from 'lib/layout'; -import { useAuthenticateUser, useDailyPlan, useLocalStorageState, useOrganizationTeams } from '@app/hooks'; +import { useAuthenticateUser, useDailyPlan, useLocalStorageState, useModal, useOrganizationTeams } from '@app/hooks'; import { clsxm } from '@app/utils'; import { fullWidthState } from '@app/stores/fullWidth'; import { useAtomValue } from 'jotai'; @@ -36,7 +36,11 @@ const TimeSheet = React.memo(function TimeSheetPage({ params }: { params: { memb const { user } = useAuthenticateUser(); const { sortedPlans } = useDailyPlan(); - + const { + isOpen: isManualTimeModalOpen, + openModal: openManualTimeModal, + closeModal: closeManualTimeModal + } = useModal(); const username = user?.name || user?.firstName || user?.lastName || user?.username; const [timesheetNavigator, setTimesheetNavigator] = useLocalStorageState('timesheet-viewMode', 'ListView'); @@ -132,7 +136,11 @@ const TimeSheet = React.memo(function TimeSheetPage({ params }: { params: { memb
{/* */}
- +
{timesheetNavigator === 'ListView' ? diff --git a/apps/web/app/helpers/date.ts b/apps/web/app/helpers/date.ts index 3a0783f31..436b6c5c4 100644 --- a/apps/web/app/helpers/date.ts +++ b/apps/web/app/helpers/date.ts @@ -216,3 +216,12 @@ export const getGreeting = (t: TranslationHooks) => { return t('pages.timesheet.GREETINGS.GOOD_EVENING'); } } + +export const formatDate = (dateStr: string | Date): string => { + try { + return moment(dateStr).format('ddd DD MMM YYYY'); + } catch (error) { + console.error('Invalid date format:', error); + return ''; + } +} diff --git a/apps/web/lib/features/integrations/calendar/table-time-sheet.tsx b/apps/web/lib/features/integrations/calendar/table-time-sheet.tsx index 5b6048ddf..fb206d6e9 100644 --- a/apps/web/lib/features/integrations/calendar/table-time-sheet.tsx +++ b/apps/web/lib/features/integrations/calendar/table-time-sheet.tsx @@ -61,6 +61,7 @@ import { Badge } from '@components/ui/badge' import { IDailyPlan } from "@/app/interfaces" import { StatusType, getTimesheetButtons } from "@/app/[locale]/timesheet/[memberId]/components" import { useTranslations } from "next-intl" +import { formatDate } from "@/app/helpers" @@ -223,57 +224,66 @@ export function DataTableTimeSheet({ data }: { data?: IDailyPlan[] }) { ))} */} - - {Object.entries(groupedRows).map(([status, rows]) => ( - - -
-
-
-
- - {status} - - ({rows.length}) + {data?.map((plan, index) => ( +
+
+ {formatDate(plan?.date)} + 64:30h +
+ + {Object.entries(groupedRows).map(([status, rows]) => ( + + +
+
+
+
+ + {status} + + ({rows.length}) +
+ + Total + 24:30h + +
+
+ {getTimesheetButtons(status as StatusType, t)} +
- - Total - 24:30h - -
-
- {getTimesheetButtons(status as StatusType, t)} -
-
- - - {rows.length ? ( - rows.map((row) => ( - - {row.getVisibleCells().map((cell) => ( - - {flexRender(cell.column.columnDef.cell, cell.getContext())} - - ))} - - )) - ) : ( - - No results. - - )} - - - ))} - + + + {rows.length ? ( + rows.map((row) => ( + + {row.getVisibleCells().map((cell) => ( + + {flexRender(cell.column.columnDef.cell, cell.getContext())} + + ))} + + )) + ) : ( + + No results. + + )} + + + ))} + +
+ ))} +