From dd32864f90ff46dc1f6afedf8352d87954dc7beb Mon Sep 17 00:00:00 2001 From: AKILIMAILI CIZUNGU Innocent <51681130+Innocent-Akim@users.noreply.github.com> Date: Tue, 27 Aug 2024 08:51:23 +0200 Subject: [PATCH] [Feat]: Add Badget Status, Select Filter status, Button delete (#2954) * feat: add badget status, select filter, button delete * fix: cspell --- apps/web/app/[locale]/calendar/page.tsx | 4 +- .../calendar/confirm-change-status.tsx | 25 ++++++++++++- .../calendar/setup-time-sheet.tsx | 26 +++++++++++-- .../calendar/table-time-sheet.tsx | 37 +++---------------- 4 files changed, 54 insertions(+), 38 deletions(-) diff --git a/apps/web/app/[locale]/calendar/page.tsx b/apps/web/app/[locale]/calendar/page.tsx index 4b44f4b62..dadeaf474 100644 --- a/apps/web/app/[locale]/calendar/page.tsx +++ b/apps/web/app/[locale]/calendar/page.tsx @@ -63,7 +63,7 @@ const CalendarPage = () => { params='AddManuelTime' />
@@ -82,7 +82,7 @@ const CalendarPage = () => { setCalendarTimeSheet={setCalendarTimeSheet} /> -
+
diff --git a/apps/web/lib/features/integrations/calendar/confirm-change-status.tsx b/apps/web/lib/features/integrations/calendar/confirm-change-status.tsx index a9b7c914f..4f7b6bbc1 100644 --- a/apps/web/lib/features/integrations/calendar/confirm-change-status.tsx +++ b/apps/web/lib/features/integrations/calendar/confirm-change-status.tsx @@ -1,4 +1,5 @@ import { clsxm } from '@app/utils'; +import { Badge } from '@components/ui/badge'; import { Button } from '@components/ui/button'; import { Modal } from 'lib/components' import React from 'react' @@ -49,7 +50,7 @@ export function ConfirmStatusChange({ closeModal, isOpen, newStatus, oldStatus } const StatusTransition = ({ previousStatus, currentStatus, currentStatusClass, previousStatusClass }: { previousStatus: string; currentStatus: string; currentStatusClass: string; previousStatusClass: string }) => (
- {previousStatus} + {previousStatus} to {currentStatus}
@@ -78,3 +79,25 @@ const CommentInputArea = () => ( ); + + +export function StatusBadge({ selectedStatus, filterNumber }: { selectedStatus?: string, filterNumber?: string }) { + const [selected] = React.useState(selectedStatus); + const getColorClass = () => { + switch (selected) { + case "Rejected": + return `text-red-500 ${filterNumber ? "border-gray-200 dark:border-gray-700" : " border-red-500"} `; + case "Approved": + return `text-green-500 ${filterNumber ? "border-gray-200 dark:border-gray-700" : "border-green-500"}`; + case "Pending": + return `text-orange-500 ${filterNumber ? "border-gray-200 dark:border-gray-700" : "border-orange-500"} `; + default: + return `text-gray-500 dark:text-gray-200 border-gray-200 dark:border-gray-700 !py-0 font-normal`; + } + }; + + return ( + {filterNumber}{" "}{selected} + ); +} diff --git a/apps/web/lib/features/integrations/calendar/setup-time-sheet.tsx b/apps/web/lib/features/integrations/calendar/setup-time-sheet.tsx index c2143d44a..0d31fde8a 100644 --- a/apps/web/lib/features/integrations/calendar/setup-time-sheet.tsx +++ b/apps/web/lib/features/integrations/calendar/setup-time-sheet.tsx @@ -1,9 +1,12 @@ "use client" import React from 'react' -import { DataTableTimeSheet } from './table-time-sheet' +import { DataTableTimeSheet, SelectFilter } from './table-time-sheet' import { HeadTimeSheet } from '@app/[locale]/calendar/component' -import { timesheetCalendar } from './helper-calendar' +import { statusOptions, timesheetCalendar } from './helper-calendar' +import { StatusBadge } from './confirm-change-status' +import { RiDeleteBinLine } from "react-icons/ri"; + interface ISetupTimeSheetProps { timesheet?: timesheetCalendar @@ -17,7 +20,24 @@ export function SetupTimeSheet({ timesheet }: ISetupTimeSheetProps) {
-
+
+
+
+ 123 Logs Selected + + +
+
+ + {statusOptions.map((items, index) => ( + + + ))} +
+
diff --git a/apps/web/lib/features/integrations/calendar/table-time-sheet.tsx b/apps/web/lib/features/integrations/calendar/table-time-sheet.tsx index 0a38b4f55..e6c533f9d 100644 --- a/apps/web/lib/features/integrations/calendar/table-time-sheet.tsx +++ b/apps/web/lib/features/integrations/calendar/table-time-sheet.tsx @@ -49,10 +49,9 @@ import { MdKeyboardArrowLeft, MdKeyboardArrowRight } from "react-icons/md"; -import { ConfirmStatusChange, TimeSheet, dataSourceTimeSheet, statusOptions } from "." +import { ConfirmStatusChange, StatusBadge, TimeSheet, dataSourceTimeSheet, statusOptions } from "." import { useModal } from "@app/hooks" import { Checkbox } from "@components/ui/checkbox"; -import { Badge } from "@components/ui/badge" @@ -318,32 +317,6 @@ export function DataTableTimeSheet() { -function StatusBadge({ selectedStatus }: { selectedStatus?: string }) { - - const [selected] = React.useState(selectedStatus); - - const getColorClass = () => { - switch (selected) { - case "Rejected": - return "text-red-500 border-red-500 "; - case "Approved": - return "text-green-500 border-green-500"; - case "Pending": - return "text-orange-500 border-orange-500"; - default: - return "text-gray-500 border-gray-200"; - } - - - }; - - - return ( - {selected} - ); -} - export function SelectFilter({ selectedStatus }: { selectedStatus?: string }) { @@ -354,11 +327,11 @@ export function SelectFilter({ selectedStatus }: { selectedStatus?: string }) { const getColorClass = () => { switch (selected) { case "Rejected": - return "text-red-500 border-red-500 rou"; + return "text-red-500 border-gray-200"; case "Approved": - return "text-green-500 border-green-500"; + return "text-green-500 border-gray-200"; case "Pending": - return "text-orange-500 border-orange-500"; + return "text-orange-500 border-gray-200"; default: return "text-gray-500 border-gray-200"; } @@ -387,7 +360,7 @@ export function SelectFilter({ selectedStatus }: { selectedStatus?: string }) { onValueChange={(value) => onValueChanges(value)} >