From 780c1ed85a968588cd246825f4e6d07970a43eb8 Mon Sep 17 00:00:00 2001 From: Mohamed amaan Date: Thu, 30 Jan 2025 07:29:02 +0530 Subject: [PATCH 01/21] start working --- src/pages/Scheduling/ScheduleExceptions.tsx | 1 + 1 file changed, 1 insertion(+) diff --git a/src/pages/Scheduling/ScheduleExceptions.tsx b/src/pages/Scheduling/ScheduleExceptions.tsx index 7480c49a323..27bb8658725 100644 --- a/src/pages/Scheduling/ScheduleExceptions.tsx +++ b/src/pages/Scheduling/ScheduleExceptions.tsx @@ -112,6 +112,7 @@ const ScheduleExceptionItem = ( + {/* working on alertdialog */} + + + + + + + {t("are_you_sure")} + + {t("this_will_permanently_remove_the_exception")} + + +
+ + +
+
+
{/* TODO: Add this information */} {/*
From a4cd8142073d20bf1fb9cd06370cda47e174d0e6 Mon Sep 17 00:00:00 2001 From: Mohamed amaan Date: Fri, 31 Jan 2025 00:44:06 +0530 Subject: [PATCH 03/21] translation added --- public/locale/en.json | 2 ++ 1 file changed, 2 insertions(+) diff --git a/public/locale/en.json b/public/locale/en.json index 4baaa151214..7f3ddcd02ea 100644 --- a/public/locale/en.json +++ b/public/locale/en.json @@ -382,6 +382,7 @@ "archived_files": "Archived Files", "are_non_editable_fields": "are non-editable fields", "are_you_still_watching": "Are you still watching?", + "are_you_sure": "Are you sure?", "are_you_sure_want_to_delete": "Are you sure you want to delete {{name}}?", "are_you_sure_want_to_delete_this_record": "Are you sure want to delete this record?", "are_you_sure_want_to_remove": "Are you sure you want to remove {{name}} from the patient? This action cannot be undone", @@ -1982,6 +1983,7 @@ "thank_you_for_choosing": "Thank you for choosing our care service", "the_request_for_resources_placed_by_yourself_is": "The request for resource (details below) placed by yourself is", "third_party_software_licenses": "Third Party Software Licenses", + "this_will_permanently_remove_the_exception": "This action will permanently remove the exception", "time": "Time", "time_slot": "Time Slot", "title_of_request": "Title of Request", From 1d341166594062b46b1475ed4c33c3c3de8f44eb Mon Sep 17 00:00:00 2001 From: Mohamed amaan Date: Fri, 31 Jan 2025 01:27:28 +0530 Subject: [PATCH 04/21] crteate Schedule template sheet popup added --- .../CreateScheduleTemplateSheet.tsx | 77 +++++++++++++++---- 1 file changed, 62 insertions(+), 15 deletions(-) diff --git a/src/pages/Scheduling/components/CreateScheduleTemplateSheet.tsx b/src/pages/Scheduling/components/CreateScheduleTemplateSheet.tsx index a32f3d193bf..eab1ded63eb 100644 --- a/src/pages/Scheduling/components/CreateScheduleTemplateSheet.tsx +++ b/src/pages/Scheduling/components/CreateScheduleTemplateSheet.tsx @@ -3,6 +3,7 @@ import { useMutation, useQueryClient } from "@tanstack/react-query"; import { isAfter, isBefore, parse } from "date-fns"; import { ArrowRightIcon } from "lucide-react"; import { useQueryParams } from "raviger"; +import { useState } from "react"; import { useForm } from "react-hook-form"; import { useTranslation } from "react-i18next"; import { Trans } from "react-i18next"; @@ -17,6 +18,14 @@ import WeekdayCheckbox, { import { Button } from "@/components/ui/button"; import { DatePicker } from "@/components/ui/date-picker"; +import { + Dialog, + DialogContent, + DialogDescription, + DialogHeader, + DialogTitle, + DialogTrigger, +} from "@/components/ui/dialog"; import { Form, FormControl, @@ -235,6 +244,9 @@ export default function CreateScheduleTemplateSheet({ ); }; + const [openDialog, setOpenDialog] = useState(false); + const [removeIndex, setRemoveIndex] = useState(null); + return (
- + + + + + + + {t("are_you_sure")} + + {t("this_will_permanently_remove_the_template")} + + +
+ + +
+
+
From 3d1963630cc4b2d6e6062b1dd2d4a90be421ce74 Mon Sep 17 00:00:00 2001 From: Mohamed amaan Date: Fri, 31 Jan 2025 01:28:22 +0530 Subject: [PATCH 05/21] edit shedule template sheet popup added --- .../components/EditScheduleTemplateSheet.tsx | 57 +++++++++++++++---- 1 file changed, 47 insertions(+), 10 deletions(-) diff --git a/src/pages/Scheduling/components/EditScheduleTemplateSheet.tsx b/src/pages/Scheduling/components/EditScheduleTemplateSheet.tsx index 5cdd6790bcb..1b78f8fee79 100644 --- a/src/pages/Scheduling/components/EditScheduleTemplateSheet.tsx +++ b/src/pages/Scheduling/components/EditScheduleTemplateSheet.tsx @@ -17,6 +17,14 @@ import WeekdayCheckbox, { import { Button } from "@/components/ui/button"; import { DatePicker } from "@/components/ui/date-picker"; +import { + Dialog, + DialogContent, + DialogDescription, + DialogHeader, + DialogTitle, + DialogTrigger, +} from "@/components/ui/dialog"; import { Form, FormControl, @@ -126,6 +134,7 @@ const ScheduleTemplateEditor = ({ }) => { const { t } = useTranslation(); const queryClient = useQueryClient(); + const [isDialogOpen, setDialogOpen] = useState(false); const templateFormSchema = z .object({ @@ -250,16 +259,44 @@ const ScheduleTemplateEditor = ({
- + + + + + + + {t("are_you_sure")} + + {t("this_will_permanently_remove_the_template")} + + +
+ + +
+
+
- - + + - - - - {t("are_you_sure")} - - {t("this_will_permanently_remove_the_exception")} - - -
- - -
-
-
+ {t("confirm")} + + + + {/* TODO: Add this information */} {/*
From 5394fb1e78e03c732f8911a5d97cc94b7f6d66fa Mon Sep 17 00:00:00 2001 From: Mohamed amaan Date: Tue, 4 Feb 2025 21:44:31 +0530 Subject: [PATCH 08/21] confirm popup added on scheduleTemplate --- .../CreateScheduleTemplateSheet.tsx | 74 +++++++++++-------- 1 file changed, 42 insertions(+), 32 deletions(-) diff --git a/src/pages/Scheduling/components/CreateScheduleTemplateSheet.tsx b/src/pages/Scheduling/components/CreateScheduleTemplateSheet.tsx index 3851534e11a..31d3e85b0f9 100644 --- a/src/pages/Scheduling/components/CreateScheduleTemplateSheet.tsx +++ b/src/pages/Scheduling/components/CreateScheduleTemplateSheet.tsx @@ -16,16 +16,20 @@ import WeekdayCheckbox, { DayOfWeek, } from "@/CAREUI/interactive/WeekdayCheckbox"; +import { Alert, AlertDescription, AlertTitle } from "@/components/ui/alert"; +import { + AlertDialog, + AlertDialogAction, + AlertDialogCancel, + AlertDialogContent, + AlertDialogDescription, + AlertDialogFooter, + AlertDialogHeader, + AlertDialogTitle, + AlertDialogTrigger, +} from "@/components/ui/alert-dialog"; import { Button } from "@/components/ui/button"; import { DatePicker } from "@/components/ui/date-picker"; -import { - Dialog, - DialogContent, - DialogDescription, - DialogHeader, - DialogTitle, - DialogTrigger, -} from "@/components/ui/dialog"; import { Form, FormControl, @@ -363,8 +367,11 @@ export default function CreateScheduleTemplateSheet({ {form.watch(`availabilities.${index}.name`)}
- - + + - - - - {t("are_you_sure")} - - {t("this_will_permanently_remove_the_template")} - - -
- - -
-
-
+ {t("confirm")} + + + +
From 48e16248cfd0f5c5420b6fbd42c75e39adc6feee Mon Sep 17 00:00:00 2001 From: Mohamed amaan Date: Tue, 4 Feb 2025 21:45:12 +0530 Subject: [PATCH 09/21] confirm popup added on Editschedule Template --- .../components/EditScheduleTemplateSheet.tsx | 114 +++++++++++------- 1 file changed, 73 insertions(+), 41 deletions(-) diff --git a/src/pages/Scheduling/components/EditScheduleTemplateSheet.tsx b/src/pages/Scheduling/components/EditScheduleTemplateSheet.tsx index 1b78f8fee79..982bd643cb8 100644 --- a/src/pages/Scheduling/components/EditScheduleTemplateSheet.tsx +++ b/src/pages/Scheduling/components/EditScheduleTemplateSheet.tsx @@ -15,16 +15,20 @@ import WeekdayCheckbox, { DayOfWeek, } from "@/CAREUI/interactive/WeekdayCheckbox"; +import { Alert, AlertDescription, AlertTitle } from "@/components/ui/alert"; +import { + AlertDialog, + AlertDialogAction, + AlertDialogCancel, + AlertDialogContent, + AlertDialogDescription, + AlertDialogFooter, + AlertDialogHeader, + AlertDialogTitle, + AlertDialogTrigger, +} from "@/components/ui/alert-dialog"; import { Button } from "@/components/ui/button"; import { DatePicker } from "@/components/ui/date-picker"; -import { - Dialog, - DialogContent, - DialogDescription, - DialogHeader, - DialogTitle, - DialogTrigger, -} from "@/components/ui/dialog"; import { Form, FormControl, @@ -259,8 +263,8 @@ const ScheduleTemplateEditor = ({
- - + + - - - - {t("are_you_sure")} - - {t("this_will_permanently_remove_the_template")} - - -
- - -
-
-
+ {t("confirm")} + + + +
- + + + + + + + {t("are_you_sure")} + + + {t("warning")} + + {t("this_will_permanently_remove_the_template")} + + + + + + {t("cancel")} + { + deleteAvailability(); + setOpenDialog(false); + }} + > + {t("confirm")} + + + +
From 036002cdc9856de67388d006bf80c994e7418c93 Mon Sep 17 00:00:00 2001 From: Mohamed amaan Date: Tue, 4 Feb 2025 21:46:15 +0530 Subject: [PATCH 10/21] warning translation added --- public/locale/en.json | 1 + 1 file changed, 1 insertion(+) diff --git a/public/locale/en.json b/public/locale/en.json index 2b8704cbdf6..b1565de1993 100644 --- a/public/locale/en.json +++ b/public/locale/en.json @@ -2019,6 +2019,7 @@ "thank_you_for_choosing": "Thank you for choosing our care service", "the_request_for_resources_placed_by_yourself_is": "The request for resource (details below) placed by yourself is", "third_party_software_licenses": "Third Party Software Licenses", + "this_will_permanently_remove_the_template": "This will permanently remove the template and cannot be undone", "time": "Time", "time_slot": "Time Slot", "title": "Title", From 4336c0420543e4b39a7eb1a90d4a25069b7edc2d Mon Sep 17 00:00:00 2001 From: Mohamed amaan Date: Wed, 5 Feb 2025 01:12:29 +0530 Subject: [PATCH 11/21] minor issues solved --- public/locale/en.json | 2 ++ src/pages/Scheduling/ScheduleExceptions.tsx | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/public/locale/en.json b/public/locale/en.json index b1565de1993..f54818117b0 100644 --- a/public/locale/en.json +++ b/public/locale/en.json @@ -2019,6 +2019,8 @@ "thank_you_for_choosing": "Thank you for choosing our care service", "the_request_for_resources_placed_by_yourself_is": "The request for resource (details below) placed by yourself is", "third_party_software_licenses": "Third Party Software Licenses", + "this_action_is_irreversible": "This action is irreversible. Once a file is archived it cannot be unarchived.", + "this_file_has_been_archived": "This file has been archived and cannot be unarchived.", "this_will_permanently_remove_the_template": "This will permanently remove the template and cannot be undone", "time": "Time", "time_slot": "Time Slot", diff --git a/src/pages/Scheduling/ScheduleExceptions.tsx b/src/pages/Scheduling/ScheduleExceptions.tsx index b07974736a2..c4762e75732 100644 --- a/src/pages/Scheduling/ScheduleExceptions.tsx +++ b/src/pages/Scheduling/ScheduleExceptions.tsx @@ -149,7 +149,7 @@ const ScheduleExceptionItem = ( {t("cancel")} { - deleteException(undefined); + deleteException(); setOpen(false); }} > From b10ce7daeac5c9bef7f4dd78145574f05e128bc6 Mon Sep 17 00:00:00 2001 From: Mohamed amaan Date: Thu, 6 Feb 2025 22:53:38 +0530 Subject: [PATCH 12/21] alert-dialog destructive variant added --- src/components/ui/alert-dialog.tsx | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/src/components/ui/alert-dialog.tsx b/src/components/ui/alert-dialog.tsx index 3d1ea1cd215..2bc2c159db5 100644 --- a/src/components/ui/alert-dialog.tsx +++ b/src/components/ui/alert-dialog.tsx @@ -1,4 +1,5 @@ import * as AlertDialogPrimitive from "@radix-ui/react-alert-dialog"; +import { type VariantProps, cva } from "class-variance-authority"; import * as React from "react"; import { cn } from "@/lib/utils"; @@ -97,13 +98,27 @@ const AlertDialogDescription = React.forwardRef< AlertDialogDescription.displayName = AlertDialogPrimitive.Description.displayName; +const alertVariants = cva("mt-2 sm:mt-0", { + variants: { + variant: { + default: "bg-white text-gray-950 dark:bg-gray-950 dark:text-gray-50", + destructive: + "bg-red-500 text-gray-50 shadow-sm hover:bg-red-500/90 dark:bg-red-900 dark:text-gray-50 dark:hover:bg-red-900/90", + }, + }, + defaultVariants: { + variant: "default", + }, +}); + const AlertDialogAction = React.forwardRef< React.ElementRef, - React.ComponentPropsWithoutRef ->(({ className, ...props }, ref) => ( + React.ComponentPropsWithoutRef & + VariantProps +>(({ className, variant, ...props }, ref) => ( )); From b2e4b77422e012c8de49e704b1054a3541ecf748 Mon Sep 17 00:00:00 2001 From: Mohamed amaan Date: Fri, 7 Feb 2025 00:16:31 +0530 Subject: [PATCH 13/21] confirm button color updated, variant distructive added --- src/pages/Scheduling/ScheduleExceptions.tsx | 1 + src/pages/Scheduling/components/CreateScheduleTemplateSheet.tsx | 1 + src/pages/Scheduling/components/EditScheduleTemplateSheet.tsx | 2 ++ 3 files changed, 4 insertions(+) diff --git a/src/pages/Scheduling/ScheduleExceptions.tsx b/src/pages/Scheduling/ScheduleExceptions.tsx index c4762e75732..85b76c0bf1c 100644 --- a/src/pages/Scheduling/ScheduleExceptions.tsx +++ b/src/pages/Scheduling/ScheduleExceptions.tsx @@ -148,6 +148,7 @@ const ScheduleExceptionItem = ( {t("cancel")} { deleteException(); setOpen(false); diff --git a/src/pages/Scheduling/components/CreateScheduleTemplateSheet.tsx b/src/pages/Scheduling/components/CreateScheduleTemplateSheet.tsx index 31d3e85b0f9..288c7882116 100644 --- a/src/pages/Scheduling/components/CreateScheduleTemplateSheet.tsx +++ b/src/pages/Scheduling/components/CreateScheduleTemplateSheet.tsx @@ -405,6 +405,7 @@ export default function CreateScheduleTemplateSheet({ {t("cancel")} { const availabilities = form.getValues("availabilities"); diff --git a/src/pages/Scheduling/components/EditScheduleTemplateSheet.tsx b/src/pages/Scheduling/components/EditScheduleTemplateSheet.tsx index 982bd643cb8..8be3fd33c3e 100644 --- a/src/pages/Scheduling/components/EditScheduleTemplateSheet.tsx +++ b/src/pages/Scheduling/components/EditScheduleTemplateSheet.tsx @@ -290,6 +290,7 @@ const ScheduleTemplateEditor = ({ {t("cancel")} { deleteTemplate(); setDialogOpen(false); @@ -419,6 +420,7 @@ const AvailabilityEditor = ({ {t("cancel")} { deleteAvailability(); setOpenDialog(false); From e92c37dfa12f27cc986cd416b3d900e50773dd54 Mon Sep 17 00:00:00 2001 From: Mohamed amaan Date: Fri, 7 Feb 2025 20:19:06 +0530 Subject: [PATCH 14/21] removed extra className of the button, only use variant for better maintainability --- src/pages/Scheduling/components/CreateScheduleTemplateSheet.tsx | 1 - src/pages/Scheduling/components/EditScheduleTemplateSheet.tsx | 1 - 2 files changed, 2 deletions(-) diff --git a/src/pages/Scheduling/components/CreateScheduleTemplateSheet.tsx b/src/pages/Scheduling/components/CreateScheduleTemplateSheet.tsx index 288c7882116..f7db692cc13 100644 --- a/src/pages/Scheduling/components/CreateScheduleTemplateSheet.tsx +++ b/src/pages/Scheduling/components/CreateScheduleTemplateSheet.tsx @@ -376,7 +376,6 @@ export default function CreateScheduleTemplateSheet({ type="button" variant="secondary" size="sm" - className="text-gray-600 hover:text-gray-900" onClick={() => { setRemoveIndex(index); setOpenDialog(true); diff --git a/src/pages/Scheduling/components/EditScheduleTemplateSheet.tsx b/src/pages/Scheduling/components/EditScheduleTemplateSheet.tsx index 8be3fd33c3e..2c9ff3a35e6 100644 --- a/src/pages/Scheduling/components/EditScheduleTemplateSheet.tsx +++ b/src/pages/Scheduling/components/EditScheduleTemplateSheet.tsx @@ -400,7 +400,6 @@ const AvailabilityEditor = ({ size="icon" onClick={() => setOpenDialog(true)} disabled={isDeleting} - className="text-red-600 hover:text-red-700 hover:bg-red-50" > From 36bcbd3791db39a3daf7434d1fb6aff60737a2a7 Mon Sep 17 00:00:00 2001 From: Mohamed amaan Date: Fri, 7 Feb 2025 21:07:29 +0530 Subject: [PATCH 15/21] Reset the state on both cancel and confirm. --- src/pages/Scheduling/ScheduleExceptions.tsx | 4 +++- .../components/CreateScheduleTemplateSheet.tsx | 15 +++++++++++++-- .../components/EditScheduleTemplateSheet.tsx | 18 ++++++++++++++---- 3 files changed, 30 insertions(+), 7 deletions(-) diff --git a/src/pages/Scheduling/ScheduleExceptions.tsx b/src/pages/Scheduling/ScheduleExceptions.tsx index 85b76c0bf1c..0f8077a7833 100644 --- a/src/pages/Scheduling/ScheduleExceptions.tsx +++ b/src/pages/Scheduling/ScheduleExceptions.tsx @@ -146,7 +146,9 @@ const ScheduleExceptionItem = ( - {t("cancel")} + setOpen(false)}> + {t("cancel")} + { diff --git a/src/pages/Scheduling/components/CreateScheduleTemplateSheet.tsx b/src/pages/Scheduling/components/CreateScheduleTemplateSheet.tsx index f7db692cc13..e2319d4d453 100644 --- a/src/pages/Scheduling/components/CreateScheduleTemplateSheet.tsx +++ b/src/pages/Scheduling/components/CreateScheduleTemplateSheet.tsx @@ -369,7 +369,10 @@ export default function CreateScheduleTemplateSheet({
{ + setOpenDialog(open); + if (!open) setRemoveIndex(null); + }} >