Skip to content

Commit

Permalink
Merge pull request #3103 from ever-co/3062-improvement-see-plan--drop…
Browse files Browse the repository at this point in the history
…downs-months-years

fix dropdowns in 'See plan' modal
  • Loading branch information
evereq authored Oct 3, 2024
2 parents b9cd449 + 9ef979e commit 0e1939f
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 14 deletions.
7 changes: 6 additions & 1 deletion apps/web/lib/components/modal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ type Props = {
description?: string;
isOpen: boolean;
closeModal: () => void;
customCloseModal?: () => void;
className?: string;
alignCloseIcon?: boolean;
showCloseIcon?: boolean;
Expand All @@ -19,6 +20,7 @@ type Props = {
export function Modal({
isOpen,
closeModal,
customCloseModal,
children,
title,
titleClass,
Expand Down Expand Up @@ -54,7 +56,10 @@ export function Modal({
{description && <Dialog.Description>{description}</Dialog.Description>}
{showCloseIcon && (
<div
onClick={closeModal}
onClick={() => {
closeModal();
customCloseModal?.();
}}
className={`absolute ${
alignCloseIcon ? 'right-2 top-3' : 'right-3 top-3'
} md:right-2 md:top-3 cursor-pointer z-50`}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -826,6 +818,12 @@ function TaskCard(props: ITaskCardProps) {
);
}

/**
* ----------------------------------------------------------------
* ----------------- TASK CARD ACTIONS -------------------
* ----------------------------------------------------------------
*/

interface ITaskCardActionsProps {
task: ITeamTask;
selectedPlan: IDailyPlan;
Expand Down Expand Up @@ -980,6 +978,12 @@ function TaskCardActions(props: ITaskCardActionsProps) {
);
}

/**
* ----------------------------------------------------------------
* ---------------- UNPLAN TASK ACTIONS ----------------
* ----------------------------------------------------------------
*/

interface IUnplanTaskProps {
taskId: string;
selectedPlanId: string;
Expand Down
7 changes: 6 additions & 1 deletion apps/web/lib/features/daily-plan/all-plans-modal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,12 @@ export const AllPlansModal = memo(function AllPlansModal(props: IAllPlansModal)
}, [createDailyPlan, customDate, user?.employee.id, user?.employee.organizationId, user?.tenantId]);

return (
<Modal isOpen={isOpen} closeModal={handleCloseModal} className={clsxm('w-[36rem]')}>
<Modal
isOpen={isOpen}
customCloseModal={handleCloseModal}
closeModal={() => null}
className={clsxm('w-[36rem]')}
>
<Card className="w-full h-full overflow-hidden" shadow="custom">
<div className="w-full flex flex-col gap-3 ">
<div className="relative w-full h-12 flex items-center justify-center">
Expand Down

0 comments on commit 0e1939f

Please sign in to comment.