diff --git a/apps/web/lib/components/modal.tsx b/apps/web/lib/components/modal.tsx index 33ea9eed9..84985fc01 100644 --- a/apps/web/lib/components/modal.tsx +++ b/apps/web/lib/components/modal.tsx @@ -11,6 +11,7 @@ type Props = { description?: string; isOpen: boolean; closeModal: () => void; + customCloseModal?: () => void; className?: string; alignCloseIcon?: boolean; showCloseIcon?: boolean; @@ -19,6 +20,7 @@ type Props = { export function Modal({ isOpen, closeModal, + customCloseModal, children, title, titleClass, @@ -54,7 +56,10 @@ export function Modal({ {description && {description}} {showCloseIcon && (
{ + closeModal(); + customCloseModal?.(); + }} className={`absolute ${ alignCloseIcon ? 'right-2 top-3' : 'right-3 top-3' } md:right-2 md:top-3 cursor-pointer z-50`} diff --git a/apps/web/lib/features/daily-plan/add-task-estimation-hours-modal.tsx b/apps/web/lib/features/daily-plan/add-task-estimation-hours-modal.tsx index 7bc9307fd..cfa1b9797 100644 --- a/apps/web/lib/features/daily-plan/add-task-estimation-hours-modal.tsx +++ b/apps/web/lib/features/daily-plan/add-task-estimation-hours-modal.tsx @@ -720,21 +720,13 @@ function TaskCard(props: ITaskCardProps) { if (plan && plan.id) { await addTaskToPlan({ taskId: task.id }, plan.id); } else { - if (plan) { - await createDailyPlan({ - workTimePlanned: 0, - taskId: task.id, - date: new Date(moment(plan.date).format('YYYY-MM-DD')), - status: DailyPlanStatusEnum.OPEN, - tenantId: user?.tenantId ?? '', - employeeId: user?.employee.id, - organizationId: user?.employee.organizationId - }); - } else if (selectedDate) { + const planDate = plan ? plan.date : selectedDate; + + if (planDate) { await createDailyPlan({ workTimePlanned: 0, taskId: task.id, - date: new Date(moment(selectedDate).format('YYYY-MM-DD')), + date: new Date(moment(planDate).format('YYYY-MM-DD')), status: DailyPlanStatusEnum.OPEN, tenantId: user?.tenantId ?? '', employeeId: user?.employee.id, @@ -826,6 +818,12 @@ function TaskCard(props: ITaskCardProps) { ); } +/** + * ---------------------------------------------------------------- + * ----------------- TASK CARD ACTIONS ------------------- + * ---------------------------------------------------------------- + */ + interface ITaskCardActionsProps { task: ITeamTask; selectedPlan: IDailyPlan; @@ -980,6 +978,12 @@ function TaskCardActions(props: ITaskCardActionsProps) { ); } +/** + * ---------------------------------------------------------------- + * ---------------- UNPLAN TASK ACTIONS ---------------- + * ---------------------------------------------------------------- + */ + interface IUnplanTaskProps { taskId: string; selectedPlanId: string; diff --git a/apps/web/lib/features/daily-plan/all-plans-modal.tsx b/apps/web/lib/features/daily-plan/all-plans-modal.tsx index 1550263c3..33526dd2a 100644 --- a/apps/web/lib/features/daily-plan/all-plans-modal.tsx +++ b/apps/web/lib/features/daily-plan/all-plans-modal.tsx @@ -135,7 +135,12 @@ export const AllPlansModal = memo(function AllPlansModal(props: IAllPlansModal) }, [createDailyPlan, customDate, user?.employee.id, user?.employee.organizationId, user?.tenantId]); return ( - + null} + className={clsxm('w-[36rem]')} + >