From 8f6352dba1f95000bf2bcb639fd0b322691cfcd3 Mon Sep 17 00:00:00 2001 From: AKILIMAILI CIZUNGU Innocent <51681130+Innocent-Akim@users.noreply.github.com> Date: Fri, 22 Nov 2024 19:12:46 +0200 Subject: [PATCH 01/12] [Feat]: Add Component for Timesheet Creation and Optimize Task Button (#3359) * feat: add component for timesheet creation and optimize task button * feat(timesheet): add grouping by week and month functionality * fix: simplify and improve readability of conditional rendering in timesheet display * feat: timesheet creation task buttons * fix:coderabbitai --- .../[memberId]/components/AddTaskModal.tsx | 157 ++++++++++++++++++ .../components/FilterWithStatus.tsx | 42 ++++- .../[memberId]/components/FrequencySelect.tsx | 15 +- .../[memberId]/components/TimesheetAction.tsx | 9 +- .../[memberId]/components/TimesheetFilter.tsx | 14 +- .../[locale]/timesheet/[memberId]/page.tsx | 37 +++-- .../hooks/features/useTimelogFilterOptions.ts | 5 +- apps/web/app/hooks/features/useTimesheet.ts | 66 +++++++- apps/web/app/interfaces/ITask.ts | 4 + apps/web/app/stores/time-logs.ts | 5 +- .../calendar/table-time-sheet.tsx | 41 +++-- 11 files changed, 330 insertions(+), 65 deletions(-) create mode 100644 apps/web/app/[locale]/timesheet/[memberId]/components/AddTaskModal.tsx diff --git a/apps/web/app/[locale]/timesheet/[memberId]/components/AddTaskModal.tsx b/apps/web/app/[locale]/timesheet/[memberId]/components/AddTaskModal.tsx new file mode 100644 index 000000000..86a6812f0 --- /dev/null +++ b/apps/web/app/[locale]/timesheet/[memberId]/components/AddTaskModal.tsx @@ -0,0 +1,157 @@ +import { useTeamTasks } from '@/app/hooks'; +import { ITaskIssue } from '@/app/interfaces'; +import { clsxm } from '@/app/utils'; +import { Modal } from '@/lib/components' +import { CustomSelect, TaskStatus, taskIssues } from '@/lib/features'; +import { Item, ManageOrMemberComponent, getNestedValue } from '@/lib/features/manual-time/manage-member-component'; +import { useTranslations } from 'next-intl'; +import React from 'react' +import { ToggleButton } from './EditTaskModal'; +export interface IAddTaskModalProps { + isOpen: boolean; + closeModal: () => void; +} +export function AddTaskModal({ closeModal, isOpen }: IAddTaskModalProps) { + const t = useTranslations(); + const { activeTeam } = useTeamTasks(); + const [notes, setNotes] = React.useState(''); + const [task, setTasks] = React.useState('') + const [isBillable, setIsBillable] = React.useState(true); + + const projectItemsLists = { + Project: activeTeam?.projects ?? [], + }; + + const handleSelectedValuesChange = (values: { [key: string]: Item | null }) => { + // Handle value changes + }; + const selectedValues = { + Project: null, + }; + const handleChange = (field: string, selectedItem: Item | null) => { + // Handle field changes + }; + + const fields = [ + { + label: t('sidebar.PROJECTS'), + placeholder: 'Select a project', + isRequired: true, + valueKey: 'id', + displayKey: 'name', + element: 'Project' + }, + ]; + + return ( + +
+
+ + setTasks(e.target?.value)} + className="w-full p-1 border font-normal border-slate-300 dark:border-slate-600 dark:bg-dark--theme-light rounded-md" + required + /> +
+
+ + items)} + renderOption={(option) => ( +
+ + {option} +
+ )} + /> +
+
+ +
+ setIsBillable(true)} + label={t('pages.timesheet.BILLABLE.YES')} + /> + setIsBillable(false)} + label={t('pages.timesheet.BILLABLE.NO')} + /> +
+
+
+ getNestedValue(item, displayKey) || ''} + itemToValue={(item, valueKey) => getNestedValue(item, valueKey) || ''} + /> +
+
+ Notes +