cortex-react-components 3.0.8 → 3.0.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{chunk-4HFMA57F.mjs → chunk-27NWC2OO.mjs} +4 -4
- package/dist/{chunk-44F47U5Y.mjs → chunk-34R3E2JB.mjs} +1 -1
- package/dist/{chunk-HLEMFDTD.mjs → chunk-3R2LCGLI.mjs} +1 -1
- package/dist/{chunk-2ZSH4X75.mjs → chunk-4DNX5IYR.mjs} +1 -1
- package/dist/{chunk-HABWABS7.mjs → chunk-4O6ESJYG.mjs} +32 -11
- package/dist/{chunk-B3UYSM32.mjs → chunk-5DYPBHBP.mjs} +4 -4
- package/dist/{chunk-PJZ5PWKP.mjs → chunk-5OGDBGXG.mjs} +1 -1
- package/dist/{chunk-KIZUBPPQ.mjs → chunk-6GO5N6ZP.mjs} +1 -1
- package/dist/{chunk-5Q43DAAS.mjs → chunk-6VQJSQRU.mjs} +8 -8
- package/dist/{chunk-QPPQNK6O.mjs → chunk-6VQLA4YU.mjs} +2 -2
- package/dist/{chunk-GXTF5CHJ.mjs → chunk-7D3SYOXW.mjs} +7 -4
- package/dist/{chunk-F563CDDJ.mjs → chunk-AQPLEBKG.mjs} +2 -2
- package/dist/{chunk-SNNQIUJH.mjs → chunk-BVCARDFK.mjs} +3 -3
- package/dist/{chunk-HGDLIXPQ.mjs → chunk-DGV5AVAW.mjs} +1 -1
- package/dist/{chunk-GV3CMMKT.mjs → chunk-FECAR2TE.mjs} +1 -1
- package/dist/{chunk-5KOAYGTO.mjs → chunk-G5N5MCLS.mjs} +5 -5
- package/dist/{chunk-SHHLY2QV.mjs → chunk-G7GPQ6BO.mjs} +1 -1
- package/dist/{chunk-354MPNDV.mjs → chunk-ICVTRW5Y.mjs} +1 -1
- package/dist/{chunk-4BRK5CBG.mjs → chunk-IFEQNYUB.mjs} +2 -2
- package/dist/{chunk-LCRSPNPB.mjs → chunk-LELKTN52.mjs} +18 -14
- package/dist/{chunk-VEIZROGM.mjs → chunk-M6ELOAGS.mjs} +1 -1
- package/dist/{chunk-YI6FLZOK.mjs → chunk-M7LM5P64.mjs} +1 -1
- package/dist/{chunk-EUAQNPRU.mjs → chunk-NHDPHK6D.mjs} +2 -2
- package/dist/{chunk-L34WYFSB.mjs → chunk-NKHYDT5B.mjs} +1 -1
- package/dist/{chunk-X6PPZZ2E.mjs → chunk-OYHXC3AT.mjs} +8 -8
- package/dist/{chunk-7ZMZT7I6.mjs → chunk-P7BPG7W7.mjs} +1 -1
- package/dist/{chunk-EGZL4DVZ.mjs → chunk-PAXCURFR.mjs} +1 -1
- package/dist/chunk-PIQUYPOZ.mjs +41 -0
- package/dist/{chunk-COHYOWMB.mjs → chunk-PVI4R7FJ.mjs} +1 -1
- package/dist/{chunk-HJLIEMLX.mjs → chunk-QC2AXU6I.mjs} +2 -2
- package/dist/{chunk-PE7KJR4A.mjs → chunk-RC6YHGVV.mjs} +1 -1
- package/dist/{chunk-USE5WY4U.mjs → chunk-S4FUSOSS.mjs} +1 -1
- package/dist/{chunk-TZDVVQBQ.mjs → chunk-SRK3Y7FA.mjs} +1 -1
- package/dist/{chunk-2S3O5TYH.mjs → chunk-UBEWNGCN.mjs} +1 -1
- package/dist/{chunk-X2KTMYOD.mjs → chunk-UJI3Y73K.mjs} +2 -2
- package/dist/{chunk-HXPXJ26M.mjs → chunk-VF2QBVAI.mjs} +1 -1
- package/dist/{chunk-4YRR74Y4.mjs → chunk-VMYEV3FG.mjs} +1 -1
- package/dist/{chunk-IXQESSPI.mjs → chunk-WA3OQB7X.mjs} +1 -1
- package/dist/{chunk-Z6MYLHDW.mjs → chunk-YFOEG4PP.mjs} +1 -1
- package/dist/{chunk-YJIB2FYD.mjs → chunk-YMXGTNMY.mjs} +2 -2
- package/dist/{chunk-QRC3VJEY.mjs → chunk-ZXU5T3GV.mjs} +1 -1
- package/dist/{chunk-TMVCGF2B.mjs → chunk-ZZ5EM2M4.mjs} +1 -1
- package/dist/components/Blocks/Banner.mjs +5 -5
- package/dist/components/Blocks/CallToAction.mjs +5 -5
- package/dist/components/Blocks/CollapsibleArea.mjs +6 -6
- package/dist/components/Blocks/Content.mjs +6 -6
- package/dist/components/Blocks/FeaturesBlock.mjs +5 -5
- package/dist/components/Blocks/ImageBlock.mjs +3 -3
- package/dist/components/Blocks/MediaBlock.mjs +3 -3
- package/dist/components/Blocks/RelatedPosts.mjs +7 -7
- package/dist/components/Blocks/RenderBlocks.mjs +8 -8
- package/dist/components/Blocks/ReusableContentBlock.mjs +8 -8
- package/dist/components/Blocks/index.mjs +15 -15
- package/dist/components/CRM/index.mjs +3 -3
- package/dist/components/Cards/ContentCard.mjs +5 -5
- package/dist/components/Cards/FeatureCard.mjs +5 -5
- package/dist/components/Cards/index.mjs +5 -5
- package/dist/components/Chat/ChatInterface.mjs +8 -8
- package/dist/components/Chat/CopilotInterface.mjs +9 -9
- package/dist/components/Chat/PartTypes/MessageHandler.mjs +6 -6
- package/dist/components/Chat/PartTypes/index.mjs +4 -4
- package/dist/components/Chat/demo-long-messages.mjs +9 -9
- package/dist/components/Chat/demo-tests.mjs +9 -9
- package/dist/components/Chat/demo.mjs +9 -9
- package/dist/components/Chat/example-usage.mjs +9 -9
- package/dist/components/Chat/example-with-vercel-ai.mjs +9 -9
- package/dist/components/Chat/index.mjs +13 -13
- package/dist/components/DigitalColleagues/AppSidebarLeft.mjs +3 -3
- package/dist/components/DigitalColleagues/MainPage.mjs +4 -4
- package/dist/components/DigitalColleagues/Pages/dashboardpage.mjs +4 -4
- package/dist/components/DigitalColleagues/Views/index.mjs +11 -11
- package/dist/components/DigitalColleagues/index.mjs +14 -14
- package/dist/components/Foundary/AppSidebarLeft.mjs +3 -3
- package/dist/components/Foundary/Knowledge/add-knowledge-modal.mjs +4 -4
- package/dist/components/Foundary/Knowledge/add-team-context.mjs +4 -4
- package/dist/components/Foundary/MainPage.mjs +4 -4
- package/dist/components/Foundary/Pages/dashboardpage.mjs +4 -4
- package/dist/components/Foundary/Views/KnowledgeView.mjs +4 -4
- package/dist/components/Foundary/Views/index.mjs +11 -11
- package/dist/components/Foundary/file-edit.mjs +4 -4
- package/dist/components/Foundary/index.mjs +14 -14
- package/dist/components/HeaderFooter/SectionHeading.mjs +6 -6
- package/dist/components/Heros/HighImpact/index.mjs +6 -6
- package/dist/components/Heros/LowImpact/index.mjs +6 -6
- package/dist/components/Heros/MediumImpact/index.mjs +6 -6
- package/dist/components/Heros/PostHero/index.mjs +4 -4
- package/dist/components/Heros/RenderHero.mjs +9 -9
- package/dist/components/Heros/index.mjs +13 -13
- package/dist/components/Holidays/CalendarView.d.ts +2 -1
- package/dist/components/Holidays/CalendarView.js +18 -14
- package/dist/components/Holidays/CalendarView.mjs +1 -1
- package/dist/components/Holidays/HolidayGrid.js +5 -3
- package/dist/components/Holidays/HolidayGrid.mjs +2 -2
- package/dist/components/Holidays/HolidayTracker.d.ts +2 -1
- package/dist/components/Holidays/HolidayTracker.js +65 -35
- package/dist/components/Holidays/HolidayTracker.mjs +5 -5
- package/dist/components/Holidays/RequestLeave.js +40 -17
- package/dist/components/Holidays/RequestLeave.mjs +2 -2
- package/dist/components/Holidays/index.js +65 -35
- package/dist/components/Holidays/index.mjs +5 -5
- package/dist/components/Layouts/OutputHeaderFooter.mjs +8 -8
- package/dist/components/Layouts/Print.mjs +12 -12
- package/dist/components/Layouts/SlideShow.mjs +14 -14
- package/dist/components/Layouts/index.mjs +15 -15
- package/dist/components/Menus/SidebarLeft.mjs +3 -3
- package/dist/components/Menus/SidebarLeftMulti.mjs +3 -3
- package/dist/components/Menus/SidebarRight.mjs +3 -3
- package/dist/components/Menus/index.mjs +8 -8
- package/dist/components/Payload/CollectionArchive/index.mjs +4 -4
- package/dist/components/Payload/Media/index.mjs +2 -2
- package/dist/components/Payload/PayloadCard/index.mjs +3 -3
- package/dist/components/Payload/RichText/index.mjs +5 -5
- package/dist/components/Payload/RichText/serialize.mjs +5 -5
- package/dist/components/Payload/index.mjs +7 -7
- package/dist/components/Projects/EpicsView.mjs +2 -2
- package/dist/components/Projects/FileView.mjs +4 -4
- package/dist/components/Projects/KanbanBoardView.mjs +7 -7
- package/dist/components/Projects/ProjectPage.mjs +9 -9
- package/dist/components/Projects/ProjectView.mjs +9 -9
- package/dist/components/Projects/TaskDetailsModal.mjs +4 -4
- package/dist/components/Projects/file-list.mjs +4 -4
- package/dist/components/Projects/index.mjs +8 -8
- package/dist/components/dc-temp/index.mjs +4 -4
- package/dist/components/index.js +97 -67
- package/dist/components/index.mjs +73 -73
- package/dist/components/ui/index.mjs +12 -12
- package/dist/components/ui/sidebar.mjs +2 -2
- package/dist/decorators/Intranet.mjs +51 -51
- package/dist/index.js +97 -67
- package/dist/index.mjs +85 -85
- package/dist/metafile-cjs.json +1 -1
- package/dist/metafile-esm.json +1 -1
- package/dist/pages/Blog.mjs +10 -10
- package/dist/pages/Documentation.mjs +4 -4
- package/dist/pages/IndexPage.mjs +14 -14
- package/dist/pages/Intranet.mjs +4 -4
- package/dist/pages/LandingPage.mjs +62 -62
- package/dist/pages/Page.mjs +12 -12
- package/dist/pages/Publish.mjs +52 -52
- package/dist/pages/Website.mjs +12 -12
- package/dist/sections/AboutSection.mjs +7 -7
- package/dist/sections/BlogDetail.mjs +6 -6
- package/dist/sections/BlogList.mjs +7 -7
- package/dist/sections/BlogListSection.mjs +7 -7
- package/dist/sections/ContactSection.mjs +7 -7
- package/dist/sections/PageSections.mjs +62 -62
- package/dist/sections/PricingSection.mjs +7 -7
- package/dist/sections/ServiceDetail.mjs +6 -6
- package/dist/sections/ServiceDetailSection.mjs +6 -6
- package/dist/sections/ServiceSection.mjs +52 -52
- package/dist/sections/index.mjs +62 -62
- package/dist/utils/DaysUtil.js +9 -7
- package/dist/utils/DaysUtil.mjs +1 -1
- package/package.json +1 -1
- package/dist/chunk-I4UOIVSC.mjs +0 -39
- package/dist/{chunk-25OSLP2V.mjs → chunk-6TVRFATY.mjs} +3 -3
- package/dist/{chunk-D5KV6INF.mjs → chunk-AEFGMCK3.mjs} +3 -3
- package/dist/{chunk-MFXCOX3L.mjs → chunk-CT6KAYGR.mjs} +3 -3
- package/dist/{chunk-M5XPU4JK.mjs → chunk-L666B5DN.mjs} +6 -6
- package/dist/{chunk-2YHN7ZCJ.mjs → chunk-NKRBXAPF.mjs} +3 -3
- package/dist/{chunk-DWGG6JKH.mjs → chunk-ZFWHFUZP.mjs} +3 -3
|
@@ -2642,14 +2642,16 @@ var bankHolidays = [
|
|
|
2642
2642
|
|
|
2643
2643
|
// src/utils/DaysUtil.ts
|
|
2644
2644
|
var isDayOff = (date) => {
|
|
2645
|
-
const isSunday = date.
|
|
2646
|
-
const isSaturday = date.
|
|
2647
|
-
const isBankHoliday = bankHolidays.some(
|
|
2645
|
+
const isSunday = date.getUTCDay() === 0;
|
|
2646
|
+
const isSaturday = date.getUTCDay() === 6;
|
|
2647
|
+
const isBankHoliday = bankHolidays.some(
|
|
2648
|
+
(h) => h.getFullYear() === date.getUTCFullYear() && h.getMonth() === date.getUTCMonth() && h.getDate() === date.getUTCDate()
|
|
2649
|
+
);
|
|
2648
2650
|
return isSunday || isSaturday || isBankHoliday;
|
|
2649
2651
|
};
|
|
2650
2652
|
var getTotalDaysBetween = (startDate, endDate, isHalfDay = false) => {
|
|
2651
|
-
|
|
2652
|
-
const end = new Date(endDate);
|
|
2653
|
+
let start = new Date(Date.UTC(startDate.getUTCFullYear(), startDate.getUTCMonth(), startDate.getUTCDate()));
|
|
2654
|
+
const end = new Date(Date.UTC(endDate.getUTCFullYear(), endDate.getUTCMonth(), endDate.getUTCDate()));
|
|
2653
2655
|
let count = 0;
|
|
2654
2656
|
if (isHalfDay && !isDayOff(start)) {
|
|
2655
2657
|
return 0.5;
|
|
@@ -2658,7 +2660,7 @@ var getTotalDaysBetween = (startDate, endDate, isHalfDay = false) => {
|
|
|
2658
2660
|
if (!isDayOff(start)) {
|
|
2659
2661
|
count++;
|
|
2660
2662
|
}
|
|
2661
|
-
start
|
|
2663
|
+
start = new Date(start.getTime() + 24 * 60 * 60 * 1e3);
|
|
2662
2664
|
}
|
|
2663
2665
|
return count;
|
|
2664
2666
|
};
|
|
@@ -2666,7 +2668,7 @@ var getIsMultipleDays = (startDate, endDate) => {
|
|
|
2666
2668
|
if (!startDate || !endDate) {
|
|
2667
2669
|
return false;
|
|
2668
2670
|
}
|
|
2669
|
-
const isMultipleDays = startDate.
|
|
2671
|
+
const isMultipleDays = startDate.getUTCFullYear() !== endDate.getUTCFullYear() || startDate.getUTCMonth() !== endDate.getUTCMonth() || startDate.getUTCDate() !== endDate.getUTCDate();
|
|
2670
2672
|
return isMultipleDays;
|
|
2671
2673
|
};
|
|
2672
2674
|
|
|
@@ -2840,38 +2842,42 @@ function HolidayGrid({
|
|
|
2840
2842
|
var import_react = require("react");
|
|
2841
2843
|
var import_lucide_react2 = require("lucide-react");
|
|
2842
2844
|
var import_jsx_runtime4 = require("react/jsx-runtime");
|
|
2843
|
-
function CalendarView({ currentDate, setCurrentDate, holidays }) {
|
|
2845
|
+
function CalendarView({ currentDate, setCurrentDate, holidays, today }) {
|
|
2844
2846
|
const [selectedDay, setSelectedDay] = (0, import_react.useState)(null);
|
|
2845
|
-
const
|
|
2847
|
+
const isSameUtcDay = (a, b) => a.getUTCFullYear() === b.getUTCFullYear() && a.getUTCMonth() === b.getUTCMonth() && a.getUTCDate() === b.getUTCDate();
|
|
2848
|
+
const firstDayOfMonth = (new Date(Date.UTC(currentDate.getUTCFullYear(), currentDate.getUTCMonth(), 1)).getUTCDay() + 6) % 7;
|
|
2846
2849
|
const days = Array.from({ length: 42 }, (_, i) => {
|
|
2847
2850
|
const day = new Date(
|
|
2848
|
-
|
|
2849
|
-
|
|
2850
|
-
|
|
2851
|
-
|
|
2851
|
+
Date.UTC(
|
|
2852
|
+
currentDate.getUTCFullYear(),
|
|
2853
|
+
currentDate.getUTCMonth(),
|
|
2854
|
+
i - firstDayOfMonth + 1
|
|
2855
|
+
)
|
|
2852
2856
|
);
|
|
2853
2857
|
const filteredHolidays = holidays.filter(
|
|
2854
2858
|
(h) => TimeUtil.toUtcMidnight(new Date(h.startDate)) <= day && TimeUtil.toUtcEndOfDay(new Date(h.endDate)) >= day
|
|
2855
2859
|
);
|
|
2856
2860
|
return {
|
|
2857
2861
|
date: day,
|
|
2858
|
-
isCurrentMonth: day.
|
|
2859
|
-
isToday: day
|
|
2862
|
+
isCurrentMonth: day.getUTCMonth() === currentDate.getUTCMonth(),
|
|
2863
|
+
isToday: isSameUtcDay(day, today),
|
|
2860
2864
|
holidays: filteredHolidays
|
|
2861
2865
|
};
|
|
2862
2866
|
});
|
|
2863
2867
|
const prevMonth = () => {
|
|
2864
|
-
setCurrentDate(new Date(currentDate.
|
|
2868
|
+
setCurrentDate(new Date(Date.UTC(currentDate.getUTCFullYear(), currentDate.getUTCMonth() - 1, 1)));
|
|
2865
2869
|
};
|
|
2866
2870
|
const nextMonth = () => {
|
|
2867
|
-
setCurrentDate(new Date(currentDate.
|
|
2871
|
+
setCurrentDate(new Date(Date.UTC(currentDate.getUTCFullYear(), currentDate.getUTCMonth() + 1, 1)));
|
|
2868
2872
|
};
|
|
2869
2873
|
const setToday = () => {
|
|
2870
|
-
setCurrentDate(/* @__PURE__ */ new Date());
|
|
2874
|
+
setCurrentDate(TimeUtil.toUtcMidnight(/* @__PURE__ */ new Date()));
|
|
2871
2875
|
};
|
|
2876
|
+
const months = ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"];
|
|
2877
|
+
const monthYearDisplay = `${months[currentDate.getUTCMonth()]} ${currentDate.getUTCFullYear()}`;
|
|
2872
2878
|
return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: "lg:flex lg:h-full lg:flex-col", children: [
|
|
2873
2879
|
/* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("header", { className: "flex items-center justify-between border-b border-gray-200 px-6 py-4 lg:flex-none", children: [
|
|
2874
|
-
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("h1", { className: "text-base font-semibold text-foreground", children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("time", { dateTime: currentDate.toISOString(), children:
|
|
2880
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("h1", { className: "text-base font-semibold text-foreground", children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("time", { dateTime: currentDate.toISOString(), children: monthYearDisplay }) }),
|
|
2875
2881
|
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { className: "flex items-center", children: /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: "relative flex items-center rounded-md gap-1 md:items-stretch", children: [
|
|
2876
2882
|
/* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
|
|
2877
2883
|
Button,
|
|
@@ -2958,7 +2964,7 @@ function CalendarView({ currentDate, setCurrentDate, holidays }) {
|
|
|
2958
2964
|
"flex h-6 w-6 items-center justify-center rounded-full",
|
|
2959
2965
|
day.isToday && "bg-indigo-600 font-semibold text-white"
|
|
2960
2966
|
),
|
|
2961
|
-
children: day.date.
|
|
2967
|
+
children: day.date.getUTCDate()
|
|
2962
2968
|
}
|
|
2963
2969
|
),
|
|
2964
2970
|
day.holidays.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("ol", { className: "mt-2 space-y-1 overflow-visible", children: day.holidays.map((holiday) => /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("li", { className: "overflow-visible", children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
@@ -2995,7 +3001,7 @@ function CalendarView({ currentDate, setCurrentDate, holidays }) {
|
|
|
2995
3001
|
day.date === selectedDay && day.isToday && "flex h-6 w-6 items-center justify-center rounded-full bg-indigo-600",
|
|
2996
3002
|
day.date === selectedDay && !day.isToday && "flex h-6 w-6 items-center justify-center rounded-full bg-gray-900"
|
|
2997
3003
|
),
|
|
2998
|
-
children: day.date.
|
|
3004
|
+
children: day.date.getUTCDate()
|
|
2999
3005
|
}
|
|
3000
3006
|
),
|
|
3001
3007
|
/* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("span", { className: "sr-only", children: [
|
|
@@ -3104,7 +3110,6 @@ var PopoverContent = React4.forwardRef(({ className, align = "center", sideOffse
|
|
|
3104
3110
|
PopoverContent.displayName = PopoverPrimitive.Content.displayName;
|
|
3105
3111
|
|
|
3106
3112
|
// src/components/Holidays/RequestLeave.tsx
|
|
3107
|
-
var import_date_fns = require("date-fns");
|
|
3108
3113
|
var import_lucide_react3 = require("lucide-react");
|
|
3109
3114
|
var import_navigation = require("next/navigation");
|
|
3110
3115
|
var import_sonner = require("sonner");
|
|
@@ -3124,11 +3129,26 @@ var ButtonGroup = ({ options, value, onChange, disabled = [] }) => {
|
|
|
3124
3129
|
)) });
|
|
3125
3130
|
};
|
|
3126
3131
|
function RequestLeave({ remainingDays, submitLeaveRequest }) {
|
|
3127
|
-
const
|
|
3128
|
-
|
|
3132
|
+
const setToMidnightUTC = (date) => {
|
|
3133
|
+
return new Date(Date.UTC(date.getFullYear(), date.getMonth(), date.getDate(), 0, 0, 0, 0));
|
|
3134
|
+
};
|
|
3135
|
+
const formatDateUTC = (date) => {
|
|
3136
|
+
const months = ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"];
|
|
3137
|
+
const day = date.getUTCDate();
|
|
3138
|
+
const month = months[date.getUTCMonth()];
|
|
3139
|
+
const year = date.getUTCFullYear();
|
|
3140
|
+
const suffix = day === 1 || day === 21 || day === 31 ? "st" : day === 2 || day === 22 ? "nd" : day === 3 || day === 23 ? "rd" : "th";
|
|
3141
|
+
return `${month} ${day}${suffix}, ${year}`;
|
|
3142
|
+
};
|
|
3143
|
+
const [startDate, setStartDate] = (0, import_react2.useState)(void 0);
|
|
3144
|
+
const [endDate, setEndDate] = (0, import_react2.useState)(void 0);
|
|
3145
|
+
(0, import_react2.useEffect)(() => {
|
|
3146
|
+
if (startDate === void 0) setStartDate(setToMidnightUTC(/* @__PURE__ */ new Date()));
|
|
3147
|
+
if (endDate === void 0) setEndDate(setToMidnightUTC(/* @__PURE__ */ new Date()));
|
|
3148
|
+
}, []);
|
|
3129
3149
|
const [leaveType, setLeaveType] = (0, import_react2.useState)("Full Day");
|
|
3130
3150
|
const [isMultipleDays, setIsMultipleDays] = (0, import_react2.useState)(false);
|
|
3131
|
-
const [totalDays, setTotalDays] = (0, import_react2.useState)(
|
|
3151
|
+
const [totalDays, setTotalDays] = (0, import_react2.useState)(0);
|
|
3132
3152
|
const router = (0, import_navigation.useRouter)();
|
|
3133
3153
|
(0, import_react2.useEffect)(() => {
|
|
3134
3154
|
const isMultipleDays2 = getIsMultipleDays(startDate, endDate);
|
|
@@ -3197,7 +3217,7 @@ function RequestLeave({ remainingDays, submitLeaveRequest }) {
|
|
|
3197
3217
|
),
|
|
3198
3218
|
children: [
|
|
3199
3219
|
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_lucide_react3.CalendarIcon, { className: "mr-2 h-4 w-4" }),
|
|
3200
|
-
startDate ? (
|
|
3220
|
+
startDate ? formatDateUTC(startDate) : /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("span", { children: "Pick a date" })
|
|
3201
3221
|
]
|
|
3202
3222
|
}
|
|
3203
3223
|
) }),
|
|
@@ -3207,9 +3227,12 @@ function RequestLeave({ remainingDays, submitLeaveRequest }) {
|
|
|
3207
3227
|
mode: "single",
|
|
3208
3228
|
selected: startDate,
|
|
3209
3229
|
onSelect: (date) => {
|
|
3210
|
-
|
|
3211
|
-
|
|
3212
|
-
|
|
3230
|
+
if (date) {
|
|
3231
|
+
const dateMidnight = setToMidnightUTC(date);
|
|
3232
|
+
setStartDate(dateMidnight);
|
|
3233
|
+
if (!endDate || date > endDate) {
|
|
3234
|
+
setEndDate(dateMidnight);
|
|
3235
|
+
}
|
|
3213
3236
|
}
|
|
3214
3237
|
},
|
|
3215
3238
|
initialFocus: true
|
|
@@ -3230,7 +3253,7 @@ function RequestLeave({ remainingDays, submitLeaveRequest }) {
|
|
|
3230
3253
|
),
|
|
3231
3254
|
children: [
|
|
3232
3255
|
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_lucide_react3.CalendarIcon, { className: "mr-2 h-4 w-4" }),
|
|
3233
|
-
endDate ? (
|
|
3256
|
+
endDate ? formatDateUTC(endDate) : /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("span", { children: "Pick a date" })
|
|
3234
3257
|
]
|
|
3235
3258
|
}
|
|
3236
3259
|
) }),
|
|
@@ -3239,7 +3262,11 @@ function RequestLeave({ remainingDays, submitLeaveRequest }) {
|
|
|
3239
3262
|
{
|
|
3240
3263
|
mode: "single",
|
|
3241
3264
|
selected: endDate,
|
|
3242
|
-
onSelect:
|
|
3265
|
+
onSelect: (date) => {
|
|
3266
|
+
if (date) {
|
|
3267
|
+
setEndDate(setToMidnightUTC(date));
|
|
3268
|
+
}
|
|
3269
|
+
},
|
|
3243
3270
|
disabled: (date) => startDate ? date < startDate : false,
|
|
3244
3271
|
initialFocus: true
|
|
3245
3272
|
}
|
|
@@ -3458,7 +3485,7 @@ function ApproveLeave({ leaveRequests, onApprove, onReject }) {
|
|
|
3458
3485
|
|
|
3459
3486
|
// src/components/Holidays/HolidayTracker.tsx
|
|
3460
3487
|
var import_navigation3 = require("next/navigation");
|
|
3461
|
-
var
|
|
3488
|
+
var import_date_fns = require("date-fns");
|
|
3462
3489
|
var import_jsx_runtime12 = require("react/jsx-runtime");
|
|
3463
3490
|
function classNames2(...classes) {
|
|
3464
3491
|
return classes.filter(Boolean).join(" ");
|
|
@@ -3467,6 +3494,7 @@ function HolidayTracker({
|
|
|
3467
3494
|
holidays,
|
|
3468
3495
|
currentUser,
|
|
3469
3496
|
currentDate,
|
|
3497
|
+
today,
|
|
3470
3498
|
leaveApprovals,
|
|
3471
3499
|
employees,
|
|
3472
3500
|
submitLeaveRequest,
|
|
@@ -3476,9 +3504,10 @@ function HolidayTracker({
|
|
|
3476
3504
|
const [currentTab, setCurrentTab] = (0, import_react4.useState)("Calendar View");
|
|
3477
3505
|
const router = (0, import_navigation3.useRouter)();
|
|
3478
3506
|
const isLoading = false;
|
|
3479
|
-
const parsedCurrentDate = TimeUtil.toUtcMidnight((0,
|
|
3507
|
+
const parsedCurrentDate = TimeUtil.toUtcMidnight((0, import_date_fns.parseISO)(currentDate));
|
|
3508
|
+
const parsedToday = TimeUtil.toUtcMidnight((0, import_date_fns.parseISO)(today));
|
|
3480
3509
|
const setCurrentDate = async (date) => {
|
|
3481
|
-
const formattedDate = (0,
|
|
3510
|
+
const formattedDate = (0, import_date_fns.format)(date, "dd-MM-yyyy");
|
|
3482
3511
|
const url = new URL(window.location.href);
|
|
3483
3512
|
url.searchParams.set("date", formattedDate);
|
|
3484
3513
|
router.push(url.toString());
|
|
@@ -3558,7 +3587,8 @@ function HolidayTracker({
|
|
|
3558
3587
|
{
|
|
3559
3588
|
currentDate: parsedCurrentDate,
|
|
3560
3589
|
setCurrentDate,
|
|
3561
|
-
holidays
|
|
3590
|
+
holidays,
|
|
3591
|
+
today: parsedToday
|
|
3562
3592
|
}
|
|
3563
3593
|
),
|
|
3564
3594
|
currentTab === "Request Leave" && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
@@ -2,12 +2,12 @@
|
|
|
2
2
|
"use strict";
|
|
3
3
|
import {
|
|
4
4
|
HolidayTracker
|
|
5
|
-
} from "../../chunk-
|
|
6
|
-
import "../../chunk-
|
|
5
|
+
} from "../../chunk-7D3SYOXW.mjs";
|
|
6
|
+
import "../../chunk-4O6ESJYG.mjs";
|
|
7
7
|
import "../../chunk-7UVCCDPI.mjs";
|
|
8
|
-
import "../../chunk-
|
|
9
|
-
import "../../chunk-
|
|
10
|
-
import "../../chunk-
|
|
8
|
+
import "../../chunk-LELKTN52.mjs";
|
|
9
|
+
import "../../chunk-P7BPG7W7.mjs";
|
|
10
|
+
import "../../chunk-PIQUYPOZ.mjs";
|
|
11
11
|
import "../../chunk-IZ2IHNU4.mjs";
|
|
12
12
|
import "../../chunk-6V75REDA.mjs";
|
|
13
13
|
import "../../chunk-B2NSGNGK.mjs";
|
|
@@ -2629,7 +2629,6 @@ var PopoverContent = React3.forwardRef(({ className, align = "center", sideOffse
|
|
|
2629
2629
|
PopoverContent.displayName = PopoverPrimitive.Content.displayName;
|
|
2630
2630
|
|
|
2631
2631
|
// src/components/Holidays/RequestLeave.tsx
|
|
2632
|
-
var import_date_fns = require("date-fns");
|
|
2633
2632
|
var import_lucide_react = require("lucide-react");
|
|
2634
2633
|
var import_navigation = require("next/navigation");
|
|
2635
2634
|
var import_sonner = require("sonner");
|
|
@@ -2674,14 +2673,16 @@ var bankHolidays = [
|
|
|
2674
2673
|
|
|
2675
2674
|
// src/utils/DaysUtil.ts
|
|
2676
2675
|
var isDayOff = (date) => {
|
|
2677
|
-
const isSunday = date.
|
|
2678
|
-
const isSaturday = date.
|
|
2679
|
-
const isBankHoliday = bankHolidays.some(
|
|
2676
|
+
const isSunday = date.getUTCDay() === 0;
|
|
2677
|
+
const isSaturday = date.getUTCDay() === 6;
|
|
2678
|
+
const isBankHoliday = bankHolidays.some(
|
|
2679
|
+
(h) => h.getFullYear() === date.getUTCFullYear() && h.getMonth() === date.getUTCMonth() && h.getDate() === date.getUTCDate()
|
|
2680
|
+
);
|
|
2680
2681
|
return isSunday || isSaturday || isBankHoliday;
|
|
2681
2682
|
};
|
|
2682
2683
|
var getTotalDaysBetween = (startDate, endDate, isHalfDay = false) => {
|
|
2683
|
-
|
|
2684
|
-
const end = new Date(endDate);
|
|
2684
|
+
let start = new Date(Date.UTC(startDate.getUTCFullYear(), startDate.getUTCMonth(), startDate.getUTCDate()));
|
|
2685
|
+
const end = new Date(Date.UTC(endDate.getUTCFullYear(), endDate.getUTCMonth(), endDate.getUTCDate()));
|
|
2685
2686
|
let count = 0;
|
|
2686
2687
|
if (isHalfDay && !isDayOff(start)) {
|
|
2687
2688
|
return 0.5;
|
|
@@ -2690,7 +2691,7 @@ var getTotalDaysBetween = (startDate, endDate, isHalfDay = false) => {
|
|
|
2690
2691
|
if (!isDayOff(start)) {
|
|
2691
2692
|
count++;
|
|
2692
2693
|
}
|
|
2693
|
-
start
|
|
2694
|
+
start = new Date(start.getTime() + 24 * 60 * 60 * 1e3);
|
|
2694
2695
|
}
|
|
2695
2696
|
return count;
|
|
2696
2697
|
};
|
|
@@ -2698,7 +2699,7 @@ var getIsMultipleDays = (startDate, endDate) => {
|
|
|
2698
2699
|
if (!startDate || !endDate) {
|
|
2699
2700
|
return false;
|
|
2700
2701
|
}
|
|
2701
|
-
const isMultipleDays = startDate.
|
|
2702
|
+
const isMultipleDays = startDate.getUTCFullYear() !== endDate.getUTCFullYear() || startDate.getUTCMonth() !== endDate.getUTCMonth() || startDate.getUTCDate() !== endDate.getUTCDate();
|
|
2702
2703
|
return isMultipleDays;
|
|
2703
2704
|
};
|
|
2704
2705
|
|
|
@@ -2719,11 +2720,26 @@ var ButtonGroup = ({ options, value, onChange, disabled = [] }) => {
|
|
|
2719
2720
|
)) });
|
|
2720
2721
|
};
|
|
2721
2722
|
function RequestLeave({ remainingDays, submitLeaveRequest }) {
|
|
2722
|
-
const
|
|
2723
|
-
|
|
2723
|
+
const setToMidnightUTC = (date) => {
|
|
2724
|
+
return new Date(Date.UTC(date.getFullYear(), date.getMonth(), date.getDate(), 0, 0, 0, 0));
|
|
2725
|
+
};
|
|
2726
|
+
const formatDateUTC = (date) => {
|
|
2727
|
+
const months = ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"];
|
|
2728
|
+
const day = date.getUTCDate();
|
|
2729
|
+
const month = months[date.getUTCMonth()];
|
|
2730
|
+
const year = date.getUTCFullYear();
|
|
2731
|
+
const suffix = day === 1 || day === 21 || day === 31 ? "st" : day === 2 || day === 22 ? "nd" : day === 3 || day === 23 ? "rd" : "th";
|
|
2732
|
+
return `${month} ${day}${suffix}, ${year}`;
|
|
2733
|
+
};
|
|
2734
|
+
const [startDate, setStartDate] = (0, import_react.useState)(void 0);
|
|
2735
|
+
const [endDate, setEndDate] = (0, import_react.useState)(void 0);
|
|
2736
|
+
(0, import_react.useEffect)(() => {
|
|
2737
|
+
if (startDate === void 0) setStartDate(setToMidnightUTC(/* @__PURE__ */ new Date()));
|
|
2738
|
+
if (endDate === void 0) setEndDate(setToMidnightUTC(/* @__PURE__ */ new Date()));
|
|
2739
|
+
}, []);
|
|
2724
2740
|
const [leaveType, setLeaveType] = (0, import_react.useState)("Full Day");
|
|
2725
2741
|
const [isMultipleDays, setIsMultipleDays] = (0, import_react.useState)(false);
|
|
2726
|
-
const [totalDays, setTotalDays] = (0, import_react.useState)(
|
|
2742
|
+
const [totalDays, setTotalDays] = (0, import_react.useState)(0);
|
|
2727
2743
|
const router = (0, import_navigation.useRouter)();
|
|
2728
2744
|
(0, import_react.useEffect)(() => {
|
|
2729
2745
|
const isMultipleDays2 = getIsMultipleDays(startDate, endDate);
|
|
@@ -2792,7 +2808,7 @@ function RequestLeave({ remainingDays, submitLeaveRequest }) {
|
|
|
2792
2808
|
),
|
|
2793
2809
|
children: [
|
|
2794
2810
|
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_lucide_react.CalendarIcon, { className: "mr-2 h-4 w-4" }),
|
|
2795
|
-
startDate ? (
|
|
2811
|
+
startDate ? formatDateUTC(startDate) : /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { children: "Pick a date" })
|
|
2796
2812
|
]
|
|
2797
2813
|
}
|
|
2798
2814
|
) }),
|
|
@@ -2802,9 +2818,12 @@ function RequestLeave({ remainingDays, submitLeaveRequest }) {
|
|
|
2802
2818
|
mode: "single",
|
|
2803
2819
|
selected: startDate,
|
|
2804
2820
|
onSelect: (date) => {
|
|
2805
|
-
|
|
2806
|
-
|
|
2807
|
-
|
|
2821
|
+
if (date) {
|
|
2822
|
+
const dateMidnight = setToMidnightUTC(date);
|
|
2823
|
+
setStartDate(dateMidnight);
|
|
2824
|
+
if (!endDate || date > endDate) {
|
|
2825
|
+
setEndDate(dateMidnight);
|
|
2826
|
+
}
|
|
2808
2827
|
}
|
|
2809
2828
|
},
|
|
2810
2829
|
initialFocus: true
|
|
@@ -2825,7 +2844,7 @@ function RequestLeave({ remainingDays, submitLeaveRequest }) {
|
|
|
2825
2844
|
),
|
|
2826
2845
|
children: [
|
|
2827
2846
|
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_lucide_react.CalendarIcon, { className: "mr-2 h-4 w-4" }),
|
|
2828
|
-
endDate ? (
|
|
2847
|
+
endDate ? formatDateUTC(endDate) : /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { children: "Pick a date" })
|
|
2829
2848
|
]
|
|
2830
2849
|
}
|
|
2831
2850
|
) }),
|
|
@@ -2834,7 +2853,11 @@ function RequestLeave({ remainingDays, submitLeaveRequest }) {
|
|
|
2834
2853
|
{
|
|
2835
2854
|
mode: "single",
|
|
2836
2855
|
selected: endDate,
|
|
2837
|
-
onSelect:
|
|
2856
|
+
onSelect: (date) => {
|
|
2857
|
+
if (date) {
|
|
2858
|
+
setEndDate(setToMidnightUTC(date));
|
|
2859
|
+
}
|
|
2860
|
+
},
|
|
2838
2861
|
disabled: (date) => startDate ? date < startDate : false,
|
|
2839
2862
|
initialFocus: true
|
|
2840
2863
|
}
|
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
"use strict";
|
|
3
3
|
import {
|
|
4
4
|
RequestLeave
|
|
5
|
-
} from "../../chunk-
|
|
6
|
-
import "../../chunk-
|
|
5
|
+
} from "../../chunk-4O6ESJYG.mjs";
|
|
6
|
+
import "../../chunk-PIQUYPOZ.mjs";
|
|
7
7
|
import "../../chunk-IZ2IHNU4.mjs";
|
|
8
8
|
import "../../chunk-6V75REDA.mjs";
|
|
9
9
|
import "../../chunk-B2NSGNGK.mjs";
|
|
@@ -2854,7 +2854,6 @@ var PopoverContent = React5.forwardRef(({ className, align = "center", sideOffse
|
|
|
2854
2854
|
PopoverContent.displayName = PopoverPrimitive.Content.displayName;
|
|
2855
2855
|
|
|
2856
2856
|
// src/components/Holidays/RequestLeave.tsx
|
|
2857
|
-
var import_date_fns = require("date-fns");
|
|
2858
2857
|
var import_lucide_react2 = require("lucide-react");
|
|
2859
2858
|
var import_navigation2 = require("next/navigation");
|
|
2860
2859
|
var import_sonner2 = require("sonner");
|
|
@@ -2899,14 +2898,16 @@ var bankHolidays = [
|
|
|
2899
2898
|
|
|
2900
2899
|
// src/utils/DaysUtil.ts
|
|
2901
2900
|
var isDayOff = (date) => {
|
|
2902
|
-
const isSunday = date.
|
|
2903
|
-
const isSaturday = date.
|
|
2904
|
-
const isBankHoliday = bankHolidays.some(
|
|
2901
|
+
const isSunday = date.getUTCDay() === 0;
|
|
2902
|
+
const isSaturday = date.getUTCDay() === 6;
|
|
2903
|
+
const isBankHoliday = bankHolidays.some(
|
|
2904
|
+
(h) => h.getFullYear() === date.getUTCFullYear() && h.getMonth() === date.getUTCMonth() && h.getDate() === date.getUTCDate()
|
|
2905
|
+
);
|
|
2905
2906
|
return isSunday || isSaturday || isBankHoliday;
|
|
2906
2907
|
};
|
|
2907
2908
|
var getTotalDaysBetween = (startDate, endDate, isHalfDay = false) => {
|
|
2908
|
-
|
|
2909
|
-
const end = new Date(endDate);
|
|
2909
|
+
let start = new Date(Date.UTC(startDate.getUTCFullYear(), startDate.getUTCMonth(), startDate.getUTCDate()));
|
|
2910
|
+
const end = new Date(Date.UTC(endDate.getUTCFullYear(), endDate.getUTCMonth(), endDate.getUTCDate()));
|
|
2910
2911
|
let count = 0;
|
|
2911
2912
|
if (isHalfDay && !isDayOff(start)) {
|
|
2912
2913
|
return 0.5;
|
|
@@ -2915,7 +2916,7 @@ var getTotalDaysBetween = (startDate, endDate, isHalfDay = false) => {
|
|
|
2915
2916
|
if (!isDayOff(start)) {
|
|
2916
2917
|
count++;
|
|
2917
2918
|
}
|
|
2918
|
-
start
|
|
2919
|
+
start = new Date(start.getTime() + 24 * 60 * 60 * 1e3);
|
|
2919
2920
|
}
|
|
2920
2921
|
return count;
|
|
2921
2922
|
};
|
|
@@ -2923,7 +2924,7 @@ var getIsMultipleDays = (startDate, endDate) => {
|
|
|
2923
2924
|
if (!startDate || !endDate) {
|
|
2924
2925
|
return false;
|
|
2925
2926
|
}
|
|
2926
|
-
const isMultipleDays = startDate.
|
|
2927
|
+
const isMultipleDays = startDate.getUTCFullYear() !== endDate.getUTCFullYear() || startDate.getUTCMonth() !== endDate.getUTCMonth() || startDate.getUTCDate() !== endDate.getUTCDate();
|
|
2927
2928
|
return isMultipleDays;
|
|
2928
2929
|
};
|
|
2929
2930
|
|
|
@@ -2944,11 +2945,26 @@ var ButtonGroup = ({ options, value, onChange, disabled = [] }) => {
|
|
|
2944
2945
|
)) });
|
|
2945
2946
|
};
|
|
2946
2947
|
function RequestLeave({ remainingDays, submitLeaveRequest }) {
|
|
2947
|
-
const
|
|
2948
|
-
|
|
2948
|
+
const setToMidnightUTC = (date) => {
|
|
2949
|
+
return new Date(Date.UTC(date.getFullYear(), date.getMonth(), date.getDate(), 0, 0, 0, 0));
|
|
2950
|
+
};
|
|
2951
|
+
const formatDateUTC = (date) => {
|
|
2952
|
+
const months = ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"];
|
|
2953
|
+
const day = date.getUTCDate();
|
|
2954
|
+
const month = months[date.getUTCMonth()];
|
|
2955
|
+
const year = date.getUTCFullYear();
|
|
2956
|
+
const suffix = day === 1 || day === 21 || day === 31 ? "st" : day === 2 || day === 22 ? "nd" : day === 3 || day === 23 ? "rd" : "th";
|
|
2957
|
+
return `${month} ${day}${suffix}, ${year}`;
|
|
2958
|
+
};
|
|
2959
|
+
const [startDate, setStartDate] = (0, import_react2.useState)(void 0);
|
|
2960
|
+
const [endDate, setEndDate] = (0, import_react2.useState)(void 0);
|
|
2961
|
+
(0, import_react2.useEffect)(() => {
|
|
2962
|
+
if (startDate === void 0) setStartDate(setToMidnightUTC(/* @__PURE__ */ new Date()));
|
|
2963
|
+
if (endDate === void 0) setEndDate(setToMidnightUTC(/* @__PURE__ */ new Date()));
|
|
2964
|
+
}, []);
|
|
2949
2965
|
const [leaveType, setLeaveType] = (0, import_react2.useState)("Full Day");
|
|
2950
2966
|
const [isMultipleDays, setIsMultipleDays] = (0, import_react2.useState)(false);
|
|
2951
|
-
const [totalDays, setTotalDays] = (0, import_react2.useState)(
|
|
2967
|
+
const [totalDays, setTotalDays] = (0, import_react2.useState)(0);
|
|
2952
2968
|
const router = (0, import_navigation2.useRouter)();
|
|
2953
2969
|
(0, import_react2.useEffect)(() => {
|
|
2954
2970
|
const isMultipleDays2 = getIsMultipleDays(startDate, endDate);
|
|
@@ -3017,7 +3033,7 @@ function RequestLeave({ remainingDays, submitLeaveRequest }) {
|
|
|
3017
3033
|
),
|
|
3018
3034
|
children: [
|
|
3019
3035
|
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_lucide_react2.CalendarIcon, { className: "mr-2 h-4 w-4" }),
|
|
3020
|
-
startDate ? (
|
|
3036
|
+
startDate ? formatDateUTC(startDate) : /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("span", { children: "Pick a date" })
|
|
3021
3037
|
]
|
|
3022
3038
|
}
|
|
3023
3039
|
) }),
|
|
@@ -3027,9 +3043,12 @@ function RequestLeave({ remainingDays, submitLeaveRequest }) {
|
|
|
3027
3043
|
mode: "single",
|
|
3028
3044
|
selected: startDate,
|
|
3029
3045
|
onSelect: (date) => {
|
|
3030
|
-
|
|
3031
|
-
|
|
3032
|
-
|
|
3046
|
+
if (date) {
|
|
3047
|
+
const dateMidnight = setToMidnightUTC(date);
|
|
3048
|
+
setStartDate(dateMidnight);
|
|
3049
|
+
if (!endDate || date > endDate) {
|
|
3050
|
+
setEndDate(dateMidnight);
|
|
3051
|
+
}
|
|
3033
3052
|
}
|
|
3034
3053
|
},
|
|
3035
3054
|
initialFocus: true
|
|
@@ -3050,7 +3069,7 @@ function RequestLeave({ remainingDays, submitLeaveRequest }) {
|
|
|
3050
3069
|
),
|
|
3051
3070
|
children: [
|
|
3052
3071
|
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_lucide_react2.CalendarIcon, { className: "mr-2 h-4 w-4" }),
|
|
3053
|
-
endDate ? (
|
|
3072
|
+
endDate ? formatDateUTC(endDate) : /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("span", { children: "Pick a date" })
|
|
3054
3073
|
]
|
|
3055
3074
|
}
|
|
3056
3075
|
) }),
|
|
@@ -3059,7 +3078,11 @@ function RequestLeave({ remainingDays, submitLeaveRequest }) {
|
|
|
3059
3078
|
{
|
|
3060
3079
|
mode: "single",
|
|
3061
3080
|
selected: endDate,
|
|
3062
|
-
onSelect:
|
|
3081
|
+
onSelect: (date) => {
|
|
3082
|
+
if (date) {
|
|
3083
|
+
setEndDate(setToMidnightUTC(date));
|
|
3084
|
+
}
|
|
3085
|
+
},
|
|
3063
3086
|
disabled: (date) => startDate ? date < startDate : false,
|
|
3064
3087
|
initialFocus: true
|
|
3065
3088
|
}
|
|
@@ -3278,38 +3301,42 @@ function HolidayGrid({
|
|
|
3278
3301
|
var import_react3 = require("react");
|
|
3279
3302
|
var import_lucide_react4 = require("lucide-react");
|
|
3280
3303
|
var import_jsx_runtime11 = require("react/jsx-runtime");
|
|
3281
|
-
function CalendarView({ currentDate, setCurrentDate, holidays }) {
|
|
3304
|
+
function CalendarView({ currentDate, setCurrentDate, holidays, today }) {
|
|
3282
3305
|
const [selectedDay, setSelectedDay] = (0, import_react3.useState)(null);
|
|
3283
|
-
const
|
|
3306
|
+
const isSameUtcDay = (a, b) => a.getUTCFullYear() === b.getUTCFullYear() && a.getUTCMonth() === b.getUTCMonth() && a.getUTCDate() === b.getUTCDate();
|
|
3307
|
+
const firstDayOfMonth = (new Date(Date.UTC(currentDate.getUTCFullYear(), currentDate.getUTCMonth(), 1)).getUTCDay() + 6) % 7;
|
|
3284
3308
|
const days = Array.from({ length: 42 }, (_, i) => {
|
|
3285
3309
|
const day = new Date(
|
|
3286
|
-
|
|
3287
|
-
|
|
3288
|
-
|
|
3289
|
-
|
|
3310
|
+
Date.UTC(
|
|
3311
|
+
currentDate.getUTCFullYear(),
|
|
3312
|
+
currentDate.getUTCMonth(),
|
|
3313
|
+
i - firstDayOfMonth + 1
|
|
3314
|
+
)
|
|
3290
3315
|
);
|
|
3291
3316
|
const filteredHolidays = holidays.filter(
|
|
3292
3317
|
(h) => TimeUtil.toUtcMidnight(new Date(h.startDate)) <= day && TimeUtil.toUtcEndOfDay(new Date(h.endDate)) >= day
|
|
3293
3318
|
);
|
|
3294
3319
|
return {
|
|
3295
3320
|
date: day,
|
|
3296
|
-
isCurrentMonth: day.
|
|
3297
|
-
isToday: day
|
|
3321
|
+
isCurrentMonth: day.getUTCMonth() === currentDate.getUTCMonth(),
|
|
3322
|
+
isToday: isSameUtcDay(day, today),
|
|
3298
3323
|
holidays: filteredHolidays
|
|
3299
3324
|
};
|
|
3300
3325
|
});
|
|
3301
3326
|
const prevMonth = () => {
|
|
3302
|
-
setCurrentDate(new Date(currentDate.
|
|
3327
|
+
setCurrentDate(new Date(Date.UTC(currentDate.getUTCFullYear(), currentDate.getUTCMonth() - 1, 1)));
|
|
3303
3328
|
};
|
|
3304
3329
|
const nextMonth = () => {
|
|
3305
|
-
setCurrentDate(new Date(currentDate.
|
|
3330
|
+
setCurrentDate(new Date(Date.UTC(currentDate.getUTCFullYear(), currentDate.getUTCMonth() + 1, 1)));
|
|
3306
3331
|
};
|
|
3307
3332
|
const setToday = () => {
|
|
3308
|
-
setCurrentDate(/* @__PURE__ */ new Date());
|
|
3333
|
+
setCurrentDate(TimeUtil.toUtcMidnight(/* @__PURE__ */ new Date()));
|
|
3309
3334
|
};
|
|
3335
|
+
const months = ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"];
|
|
3336
|
+
const monthYearDisplay = `${months[currentDate.getUTCMonth()]} ${currentDate.getUTCFullYear()}`;
|
|
3310
3337
|
return /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { className: "lg:flex lg:h-full lg:flex-col", children: [
|
|
3311
3338
|
/* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("header", { className: "flex items-center justify-between border-b border-gray-200 px-6 py-4 lg:flex-none", children: [
|
|
3312
|
-
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("h1", { className: "text-base font-semibold text-foreground", children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("time", { dateTime: currentDate.toISOString(), children:
|
|
3339
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("h1", { className: "text-base font-semibold text-foreground", children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("time", { dateTime: currentDate.toISOString(), children: monthYearDisplay }) }),
|
|
3313
3340
|
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("div", { className: "flex items-center", children: /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { className: "relative flex items-center rounded-md gap-1 md:items-stretch", children: [
|
|
3314
3341
|
/* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(
|
|
3315
3342
|
Button,
|
|
@@ -3396,7 +3423,7 @@ function CalendarView({ currentDate, setCurrentDate, holidays }) {
|
|
|
3396
3423
|
"flex h-6 w-6 items-center justify-center rounded-full",
|
|
3397
3424
|
day.isToday && "bg-indigo-600 font-semibold text-white"
|
|
3398
3425
|
),
|
|
3399
|
-
children: day.date.
|
|
3426
|
+
children: day.date.getUTCDate()
|
|
3400
3427
|
}
|
|
3401
3428
|
),
|
|
3402
3429
|
day.holidays.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("ol", { className: "mt-2 space-y-1 overflow-visible", children: day.holidays.map((holiday) => /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("li", { className: "overflow-visible", children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
@@ -3433,7 +3460,7 @@ function CalendarView({ currentDate, setCurrentDate, holidays }) {
|
|
|
3433
3460
|
day.date === selectedDay && day.isToday && "flex h-6 w-6 items-center justify-center rounded-full bg-indigo-600",
|
|
3434
3461
|
day.date === selectedDay && !day.isToday && "flex h-6 w-6 items-center justify-center rounded-full bg-gray-900"
|
|
3435
3462
|
),
|
|
3436
|
-
children: day.date.
|
|
3463
|
+
children: day.date.getUTCDate()
|
|
3437
3464
|
}
|
|
3438
3465
|
),
|
|
3439
3466
|
/* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("span", { className: "sr-only", children: [
|
|
@@ -3461,7 +3488,7 @@ var import_react4 = require("react");
|
|
|
3461
3488
|
var import_lucide_react5 = require("lucide-react");
|
|
3462
3489
|
var import_lucide_react6 = require("lucide-react");
|
|
3463
3490
|
var import_navigation3 = require("next/navigation");
|
|
3464
|
-
var
|
|
3491
|
+
var import_date_fns = require("date-fns");
|
|
3465
3492
|
var import_jsx_runtime12 = require("react/jsx-runtime");
|
|
3466
3493
|
function classNames2(...classes) {
|
|
3467
3494
|
return classes.filter(Boolean).join(" ");
|
|
@@ -3470,6 +3497,7 @@ function HolidayTracker({
|
|
|
3470
3497
|
holidays,
|
|
3471
3498
|
currentUser,
|
|
3472
3499
|
currentDate,
|
|
3500
|
+
today,
|
|
3473
3501
|
leaveApprovals,
|
|
3474
3502
|
employees,
|
|
3475
3503
|
submitLeaveRequest,
|
|
@@ -3479,9 +3507,10 @@ function HolidayTracker({
|
|
|
3479
3507
|
const [currentTab, setCurrentTab] = (0, import_react4.useState)("Calendar View");
|
|
3480
3508
|
const router = (0, import_navigation3.useRouter)();
|
|
3481
3509
|
const isLoading = false;
|
|
3482
|
-
const parsedCurrentDate = TimeUtil.toUtcMidnight((0,
|
|
3510
|
+
const parsedCurrentDate = TimeUtil.toUtcMidnight((0, import_date_fns.parseISO)(currentDate));
|
|
3511
|
+
const parsedToday = TimeUtil.toUtcMidnight((0, import_date_fns.parseISO)(today));
|
|
3483
3512
|
const setCurrentDate = async (date) => {
|
|
3484
|
-
const formattedDate = (0,
|
|
3513
|
+
const formattedDate = (0, import_date_fns.format)(date, "dd-MM-yyyy");
|
|
3485
3514
|
const url = new URL(window.location.href);
|
|
3486
3515
|
url.searchParams.set("date", formattedDate);
|
|
3487
3516
|
router.push(url.toString());
|
|
@@ -3561,7 +3590,8 @@ function HolidayTracker({
|
|
|
3561
3590
|
{
|
|
3562
3591
|
currentDate: parsedCurrentDate,
|
|
3563
3592
|
setCurrentDate,
|
|
3564
|
-
holidays
|
|
3593
|
+
holidays,
|
|
3594
|
+
today: parsedToday
|
|
3565
3595
|
}
|
|
3566
3596
|
),
|
|
3567
3597
|
currentTab === "Request Leave" && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|