From 97521cbcdd980c4bf60f4d15f4a9fc1aa20cce79 Mon Sep 17 00:00:00 2001 From: Innocent-akim Date: Thu, 21 Nov 2024 20:43:25 +0200 Subject: [PATCH] feat: add component for timesheet creation and optimize task button --- .../[memberId]/components/AddTaskModal.tsx | 156 ++++++++++++++++++ .../[memberId]/components/EditTaskModal.tsx | 2 +- .../components/FilterWithStatus.tsx | 39 ++++- .../[memberId]/components/TimesheetFilter.tsx | 14 +- .../[locale]/timesheet/[memberId]/page.tsx | 5 +- apps/web/app/hooks/features/useTimesheet.ts | 3 +- .../calendar/table-time-sheet.tsx | 20 ++- 7 files changed, 212 insertions(+), 27 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..b688b20a0 --- /dev/null +++ b/apps/web/app/[locale]/timesheet/[memberId]/components/AddTaskModal.tsx @@ -0,0 +1,156 @@ +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 as [], + }; + const handleSelectedValuesChange = (values: { [key: string]: Item | null }) => { + // Handle value changes + }; + const selectedValues = { + Preject: 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 +