@j3m-quantum/ui 1.5.0 → 1.6.1
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/index.cjs +1347 -126
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +306 -1
- package/dist/index.d.ts +306 -1
- package/dist/index.js +1304 -125
- package/dist/index.js.map +1 -1
- package/dist/styles/generated/variables.css +0 -3
- package/package.json +2 -1
package/dist/index.cjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var React17 = require('react');
|
|
4
4
|
var reactSlot = require('@radix-ui/react-slot');
|
|
5
5
|
var classVarianceAuthority = require('class-variance-authority');
|
|
6
6
|
var clsx = require('clsx');
|
|
@@ -40,6 +40,7 @@ var PopoverPrimitive = require('@radix-ui/react-popover');
|
|
|
40
40
|
var HoverCardPrimitive = require('@radix-ui/react-hover-card');
|
|
41
41
|
var CollapsiblePrimitive = require('@radix-ui/react-collapsible');
|
|
42
42
|
var ResizablePrimitive = require('react-resizable-panels');
|
|
43
|
+
var reactTable = require('@tanstack/react-table');
|
|
43
44
|
var dateFns = require('date-fns');
|
|
44
45
|
|
|
45
46
|
function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
|
|
@@ -62,7 +63,7 @@ function _interopNamespace(e) {
|
|
|
62
63
|
return Object.freeze(n);
|
|
63
64
|
}
|
|
64
65
|
|
|
65
|
-
var
|
|
66
|
+
var React17__namespace = /*#__PURE__*/_interopNamespace(React17);
|
|
66
67
|
var SeparatorPrimitive__namespace = /*#__PURE__*/_interopNamespace(SeparatorPrimitive);
|
|
67
68
|
var CheckboxPrimitive__namespace = /*#__PURE__*/_interopNamespace(CheckboxPrimitive);
|
|
68
69
|
var RadioGroupPrimitive__namespace = /*#__PURE__*/_interopNamespace(RadioGroupPrimitive);
|
|
@@ -95,8 +96,8 @@ var ResizablePrimitive__namespace = /*#__PURE__*/_interopNamespace(ResizablePrim
|
|
|
95
96
|
// src/hooks/use-mobile.ts
|
|
96
97
|
var MOBILE_BREAKPOINT = 768;
|
|
97
98
|
function useIsMobile() {
|
|
98
|
-
const [isMobile, setIsMobile] =
|
|
99
|
-
|
|
99
|
+
const [isMobile, setIsMobile] = React17__namespace.useState(void 0);
|
|
100
|
+
React17__namespace.useEffect(() => {
|
|
100
101
|
const mql = window.matchMedia(`(max-width: ${MOBILE_BREAKPOINT - 1}px)`);
|
|
101
102
|
const onChange = () => {
|
|
102
103
|
setIsMobile(window.innerWidth < MOBILE_BREAKPOINT);
|
|
@@ -137,7 +138,7 @@ var buttonVariants = classVarianceAuthority.cva(
|
|
|
137
138
|
}
|
|
138
139
|
}
|
|
139
140
|
);
|
|
140
|
-
var Button =
|
|
141
|
+
var Button = React17__namespace.forwardRef(
|
|
141
142
|
({ className, variant, size, asChild = false, ...props }, ref) => {
|
|
142
143
|
const Comp = asChild ? reactSlot.Slot : "button";
|
|
143
144
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -501,7 +502,7 @@ function Slider({
|
|
|
501
502
|
max = 100,
|
|
502
503
|
...props
|
|
503
504
|
}) {
|
|
504
|
-
const _values =
|
|
505
|
+
const _values = React17__namespace.useMemo(
|
|
505
506
|
() => Array.isArray(value) ? value : Array.isArray(defaultValue) ? defaultValue : [min, max],
|
|
506
507
|
[value, defaultValue, min, max]
|
|
507
508
|
);
|
|
@@ -787,7 +788,7 @@ function Toggle({
|
|
|
787
788
|
}
|
|
788
789
|
);
|
|
789
790
|
}
|
|
790
|
-
var ToggleGroupContext =
|
|
791
|
+
var ToggleGroupContext = React17__namespace.createContext({
|
|
791
792
|
size: "default",
|
|
792
793
|
variant: "default",
|
|
793
794
|
spacing: 0
|
|
@@ -824,7 +825,7 @@ function ToggleGroupItem({
|
|
|
824
825
|
size,
|
|
825
826
|
...props
|
|
826
827
|
}) {
|
|
827
|
-
const context =
|
|
828
|
+
const context = React17__namespace.useContext(ToggleGroupContext);
|
|
828
829
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
829
830
|
ToggleGroupPrimitive__namespace.Item,
|
|
830
831
|
{
|
|
@@ -854,7 +855,7 @@ function ThemeSwitch({
|
|
|
854
855
|
className,
|
|
855
856
|
size = "default"
|
|
856
857
|
}) {
|
|
857
|
-
const [isChecked, setIsChecked] =
|
|
858
|
+
const [isChecked, setIsChecked] = React17__namespace.useState(defaultChecked);
|
|
858
859
|
const isControlled = checked !== void 0;
|
|
859
860
|
const currentChecked = isControlled ? checked : isChecked;
|
|
860
861
|
const handleClick = () => {
|
|
@@ -1274,7 +1275,7 @@ function Label2({
|
|
|
1274
1275
|
);
|
|
1275
1276
|
}
|
|
1276
1277
|
var Form = reactHookForm.FormProvider;
|
|
1277
|
-
var FormFieldContext =
|
|
1278
|
+
var FormFieldContext = React17__namespace.createContext(
|
|
1278
1279
|
{}
|
|
1279
1280
|
);
|
|
1280
1281
|
var FormField = ({
|
|
@@ -1283,8 +1284,8 @@ var FormField = ({
|
|
|
1283
1284
|
return /* @__PURE__ */ jsxRuntime.jsx(FormFieldContext.Provider, { value: { name: props.name }, children: /* @__PURE__ */ jsxRuntime.jsx(reactHookForm.Controller, { ...props }) });
|
|
1284
1285
|
};
|
|
1285
1286
|
var useFormField = () => {
|
|
1286
|
-
const fieldContext =
|
|
1287
|
-
const itemContext =
|
|
1287
|
+
const fieldContext = React17__namespace.useContext(FormFieldContext);
|
|
1288
|
+
const itemContext = React17__namespace.useContext(FormItemContext);
|
|
1288
1289
|
const { getFieldState } = reactHookForm.useFormContext();
|
|
1289
1290
|
const formState = reactHookForm.useFormState({ name: fieldContext.name });
|
|
1290
1291
|
const fieldState = getFieldState(fieldContext.name, formState);
|
|
@@ -1301,11 +1302,11 @@ var useFormField = () => {
|
|
|
1301
1302
|
...fieldState
|
|
1302
1303
|
};
|
|
1303
1304
|
};
|
|
1304
|
-
var FormItemContext =
|
|
1305
|
+
var FormItemContext = React17__namespace.createContext(
|
|
1305
1306
|
{}
|
|
1306
1307
|
);
|
|
1307
1308
|
function FormItem({ className, ...props }) {
|
|
1308
|
-
const id =
|
|
1309
|
+
const id = React17__namespace.useId();
|
|
1309
1310
|
return /* @__PURE__ */ jsxRuntime.jsx(FormItemContext.Provider, { value: { id }, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
1310
1311
|
"div",
|
|
1311
1312
|
{
|
|
@@ -1553,7 +1554,7 @@ function FieldError({
|
|
|
1553
1554
|
errors,
|
|
1554
1555
|
...props
|
|
1555
1556
|
}) {
|
|
1556
|
-
const content =
|
|
1557
|
+
const content = React17.useMemo(() => {
|
|
1557
1558
|
if (children) {
|
|
1558
1559
|
return children;
|
|
1559
1560
|
}
|
|
@@ -2407,8 +2408,8 @@ function CalendarDayButton({
|
|
|
2407
2408
|
modifiers,
|
|
2408
2409
|
...props
|
|
2409
2410
|
}) {
|
|
2410
|
-
const ref =
|
|
2411
|
-
|
|
2411
|
+
const ref = React17__namespace.useRef(null);
|
|
2412
|
+
React17__namespace.useEffect(() => {
|
|
2412
2413
|
if (modifiers.focused) ref.current?.focus();
|
|
2413
2414
|
}, [modifiers.focused]);
|
|
2414
2415
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -2429,9 +2430,9 @@ function CalendarDayButton({
|
|
|
2429
2430
|
}
|
|
2430
2431
|
);
|
|
2431
2432
|
}
|
|
2432
|
-
var CarouselContext =
|
|
2433
|
+
var CarouselContext = React17__namespace.createContext(null);
|
|
2433
2434
|
function useCarousel() {
|
|
2434
|
-
const context =
|
|
2435
|
+
const context = React17__namespace.useContext(CarouselContext);
|
|
2435
2436
|
if (!context) {
|
|
2436
2437
|
throw new Error("useCarousel must be used within a <Carousel />");
|
|
2437
2438
|
}
|
|
@@ -2453,20 +2454,20 @@ function Carousel({
|
|
|
2453
2454
|
},
|
|
2454
2455
|
plugins
|
|
2455
2456
|
);
|
|
2456
|
-
const [canScrollPrev, setCanScrollPrev] =
|
|
2457
|
-
const [canScrollNext, setCanScrollNext] =
|
|
2458
|
-
const onSelect =
|
|
2457
|
+
const [canScrollPrev, setCanScrollPrev] = React17__namespace.useState(false);
|
|
2458
|
+
const [canScrollNext, setCanScrollNext] = React17__namespace.useState(false);
|
|
2459
|
+
const onSelect = React17__namespace.useCallback((api2) => {
|
|
2459
2460
|
if (!api2) return;
|
|
2460
2461
|
setCanScrollPrev(api2.canScrollPrev());
|
|
2461
2462
|
setCanScrollNext(api2.canScrollNext());
|
|
2462
2463
|
}, []);
|
|
2463
|
-
const scrollPrev =
|
|
2464
|
+
const scrollPrev = React17__namespace.useCallback(() => {
|
|
2464
2465
|
api?.scrollPrev();
|
|
2465
2466
|
}, [api]);
|
|
2466
|
-
const scrollNext =
|
|
2467
|
+
const scrollNext = React17__namespace.useCallback(() => {
|
|
2467
2468
|
api?.scrollNext();
|
|
2468
2469
|
}, [api]);
|
|
2469
|
-
const handleKeyDown =
|
|
2470
|
+
const handleKeyDown = React17__namespace.useCallback(
|
|
2470
2471
|
(event) => {
|
|
2471
2472
|
if (event.key === "ArrowLeft") {
|
|
2472
2473
|
event.preventDefault();
|
|
@@ -2478,11 +2479,11 @@ function Carousel({
|
|
|
2478
2479
|
},
|
|
2479
2480
|
[scrollPrev, scrollNext]
|
|
2480
2481
|
);
|
|
2481
|
-
|
|
2482
|
+
React17__namespace.useEffect(() => {
|
|
2482
2483
|
if (!api || !setApi) return;
|
|
2483
2484
|
setApi(api);
|
|
2484
2485
|
}, [api, setApi]);
|
|
2485
|
-
|
|
2486
|
+
React17__namespace.useEffect(() => {
|
|
2486
2487
|
if (!api) return;
|
|
2487
2488
|
onSelect(api);
|
|
2488
2489
|
api.on("reInit", onSelect);
|
|
@@ -2615,9 +2616,9 @@ function CarouselNext({
|
|
|
2615
2616
|
);
|
|
2616
2617
|
}
|
|
2617
2618
|
var THEMES = { light: "", dark: ".dark" };
|
|
2618
|
-
var ChartContext =
|
|
2619
|
+
var ChartContext = React17__namespace.createContext(null);
|
|
2619
2620
|
function useChart() {
|
|
2620
|
-
const context =
|
|
2621
|
+
const context = React17__namespace.useContext(ChartContext);
|
|
2621
2622
|
if (!context) {
|
|
2622
2623
|
throw new Error("useChart must be used within a <ChartContainer />");
|
|
2623
2624
|
}
|
|
@@ -2630,7 +2631,7 @@ function ChartContainer({
|
|
|
2630
2631
|
config,
|
|
2631
2632
|
...props
|
|
2632
2633
|
}) {
|
|
2633
|
-
const uniqueId =
|
|
2634
|
+
const uniqueId = React17__namespace.useId();
|
|
2634
2635
|
const chartId = `chart-${id || uniqueId.replace(/:/g, "")}`;
|
|
2635
2636
|
return /* @__PURE__ */ jsxRuntime.jsx(ChartContext.Provider, { value: { config }, children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
2636
2637
|
"div",
|
|
@@ -2691,7 +2692,7 @@ function ChartTooltipContent({
|
|
|
2691
2692
|
labelKey
|
|
2692
2693
|
}) {
|
|
2693
2694
|
const { config } = useChart();
|
|
2694
|
-
const tooltipLabel =
|
|
2695
|
+
const tooltipLabel = React17__namespace.useMemo(() => {
|
|
2695
2696
|
if (hideLabel || !payload?.length) {
|
|
2696
2697
|
return null;
|
|
2697
2698
|
}
|
|
@@ -3394,8 +3395,8 @@ function TooltipContent({
|
|
|
3394
3395
|
) });
|
|
3395
3396
|
}
|
|
3396
3397
|
function useDetectTheme() {
|
|
3397
|
-
const [theme, setTheme] =
|
|
3398
|
-
|
|
3398
|
+
const [theme, setTheme] = React17__namespace.useState("light");
|
|
3399
|
+
React17__namespace.useEffect(() => {
|
|
3399
3400
|
const isDark = document.documentElement.classList.contains("dark");
|
|
3400
3401
|
setTheme(isDark ? "dark" : "light");
|
|
3401
3402
|
const observer = new MutationObserver((mutations) => {
|
|
@@ -3447,6 +3448,81 @@ function Spinner({ className, ...props }) {
|
|
|
3447
3448
|
}
|
|
3448
3449
|
);
|
|
3449
3450
|
}
|
|
3451
|
+
var deliveryIndicatorVariants = classVarianceAuthority.cva(
|
|
3452
|
+
"inline-block rounded-full shrink-0",
|
|
3453
|
+
{
|
|
3454
|
+
variants: {
|
|
3455
|
+
status: {
|
|
3456
|
+
"on-time": "bg-[var(--j3m-green-9,#84EBB4)]",
|
|
3457
|
+
"delayed": "bg-[var(--j3m-yellow-9,#FFDB43)]",
|
|
3458
|
+
"critical": "bg-[var(--j3m-red-9,#FB3748)]",
|
|
3459
|
+
"pending": "bg-[var(--j3m-gray-6,#D2D2D2)]"
|
|
3460
|
+
},
|
|
3461
|
+
size: {
|
|
3462
|
+
sm: "h-1.5 w-3",
|
|
3463
|
+
default: "h-1.5 w-3",
|
|
3464
|
+
lg: "h-2 w-4"
|
|
3465
|
+
}
|
|
3466
|
+
},
|
|
3467
|
+
defaultVariants: {
|
|
3468
|
+
status: "pending",
|
|
3469
|
+
size: "default"
|
|
3470
|
+
}
|
|
3471
|
+
}
|
|
3472
|
+
);
|
|
3473
|
+
function DeliveryIndicator({
|
|
3474
|
+
className,
|
|
3475
|
+
status,
|
|
3476
|
+
size,
|
|
3477
|
+
label,
|
|
3478
|
+
showTooltip = false,
|
|
3479
|
+
...props
|
|
3480
|
+
}) {
|
|
3481
|
+
const indicator = /* @__PURE__ */ jsxRuntime.jsx(
|
|
3482
|
+
"span",
|
|
3483
|
+
{
|
|
3484
|
+
"data-slot": "delivery-indicator",
|
|
3485
|
+
"data-status": status,
|
|
3486
|
+
className: cn(deliveryIndicatorVariants({ status, size }), className),
|
|
3487
|
+
"aria-label": label || `Delivery status: ${status}`,
|
|
3488
|
+
role: "img",
|
|
3489
|
+
...props
|
|
3490
|
+
}
|
|
3491
|
+
);
|
|
3492
|
+
if (showTooltip && label) {
|
|
3493
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(Tooltip2, { children: [
|
|
3494
|
+
/* @__PURE__ */ jsxRuntime.jsx(TooltipTrigger, { asChild: true, children: indicator }),
|
|
3495
|
+
/* @__PURE__ */ jsxRuntime.jsx(TooltipContent, { children: label })
|
|
3496
|
+
] });
|
|
3497
|
+
}
|
|
3498
|
+
return indicator;
|
|
3499
|
+
}
|
|
3500
|
+
function DeliveryIndicators({
|
|
3501
|
+
className,
|
|
3502
|
+
deliveries,
|
|
3503
|
+
size = "default",
|
|
3504
|
+
showTooltips = false,
|
|
3505
|
+
...props
|
|
3506
|
+
}) {
|
|
3507
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
3508
|
+
"div",
|
|
3509
|
+
{
|
|
3510
|
+
"data-slot": "delivery-indicators",
|
|
3511
|
+
className: cn("flex items-center gap-1", className),
|
|
3512
|
+
...props,
|
|
3513
|
+
children: deliveries.map((delivery, index) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
3514
|
+
DeliveryIndicator,
|
|
3515
|
+
{
|
|
3516
|
+
status: delivery.status,
|
|
3517
|
+
size,
|
|
3518
|
+
label: delivery.label,
|
|
3519
|
+
showTooltip: showTooltips
|
|
3520
|
+
},
|
|
3521
|
+
index
|
|
3522
|
+
))
|
|
3523
|
+
}
|
|
3524
|
+
);
|
|
3525
|
+
}
|
|
3450
3526
|
function Breadcrumb({ ...props }) {
|
|
3451
3527
|
return /* @__PURE__ */ jsxRuntime.jsx("nav", { "aria-label": "breadcrumb", "data-slot": "breadcrumb", ...props });
|
|
3452
3528
|
}
|
|
@@ -3969,7 +4045,7 @@ function CommandShortcut({
|
|
|
3969
4045
|
}
|
|
3970
4046
|
);
|
|
3971
4047
|
}
|
|
3972
|
-
var SearchTrigger =
|
|
4048
|
+
var SearchTrigger = React17__namespace.forwardRef(
|
|
3973
4049
|
({
|
|
3974
4050
|
className,
|
|
3975
4051
|
placeholder = "Search...",
|
|
@@ -4005,7 +4081,7 @@ var SearchTrigger = React15__namespace.forwardRef(
|
|
|
4005
4081
|
);
|
|
4006
4082
|
SearchTrigger.displayName = "SearchTrigger";
|
|
4007
4083
|
function useSearchShortcut(onOpen, key = "k") {
|
|
4008
|
-
|
|
4084
|
+
React17__namespace.useEffect(() => {
|
|
4009
4085
|
const down = (e) => {
|
|
4010
4086
|
if (e.key.toLowerCase() === key.toLowerCase() && (e.metaKey || e.ctrlKey)) {
|
|
4011
4087
|
e.preventDefault();
|
|
@@ -4980,9 +5056,9 @@ var SIDEBAR_WIDTH = "16rem";
|
|
|
4980
5056
|
var SIDEBAR_WIDTH_MOBILE = "18rem";
|
|
4981
5057
|
var SIDEBAR_WIDTH_ICON = "3rem";
|
|
4982
5058
|
var SIDEBAR_KEYBOARD_SHORTCUT = "b";
|
|
4983
|
-
var SidebarContext =
|
|
5059
|
+
var SidebarContext = React17__namespace.createContext(null);
|
|
4984
5060
|
function useSidebar() {
|
|
4985
|
-
const context =
|
|
5061
|
+
const context = React17__namespace.useContext(SidebarContext);
|
|
4986
5062
|
if (!context) {
|
|
4987
5063
|
throw new Error("useSidebar must be used within a SidebarProvider.");
|
|
4988
5064
|
}
|
|
@@ -4998,10 +5074,10 @@ function SidebarProvider({
|
|
|
4998
5074
|
...props
|
|
4999
5075
|
}) {
|
|
5000
5076
|
const isMobile = useIsMobile();
|
|
5001
|
-
const [openMobile, setOpenMobile] =
|
|
5002
|
-
const [_open, _setOpen] =
|
|
5077
|
+
const [openMobile, setOpenMobile] = React17__namespace.useState(false);
|
|
5078
|
+
const [_open, _setOpen] = React17__namespace.useState(defaultOpen);
|
|
5003
5079
|
const open = openProp ?? _open;
|
|
5004
|
-
const setOpen =
|
|
5080
|
+
const setOpen = React17__namespace.useCallback(
|
|
5005
5081
|
(value) => {
|
|
5006
5082
|
const openState = typeof value === "function" ? value(open) : value;
|
|
5007
5083
|
if (setOpenProp) {
|
|
@@ -5013,10 +5089,10 @@ function SidebarProvider({
|
|
|
5013
5089
|
},
|
|
5014
5090
|
[setOpenProp, open]
|
|
5015
5091
|
);
|
|
5016
|
-
const toggleSidebar =
|
|
5092
|
+
const toggleSidebar = React17__namespace.useCallback(() => {
|
|
5017
5093
|
return isMobile ? setOpenMobile((open2) => !open2) : setOpen((open2) => !open2);
|
|
5018
5094
|
}, [isMobile, setOpen, setOpenMobile]);
|
|
5019
|
-
|
|
5095
|
+
React17__namespace.useEffect(() => {
|
|
5020
5096
|
const handleKeyDown = (event) => {
|
|
5021
5097
|
if (event.key === SIDEBAR_KEYBOARD_SHORTCUT && (event.metaKey || event.ctrlKey)) {
|
|
5022
5098
|
event.preventDefault();
|
|
@@ -5027,7 +5103,7 @@ function SidebarProvider({
|
|
|
5027
5103
|
return () => window.removeEventListener("keydown", handleKeyDown);
|
|
5028
5104
|
}, [toggleSidebar]);
|
|
5029
5105
|
const state = open ? "expanded" : "collapsed";
|
|
5030
|
-
const contextValue =
|
|
5106
|
+
const contextValue = React17__namespace.useMemo(
|
|
5031
5107
|
() => ({
|
|
5032
5108
|
state,
|
|
5033
5109
|
open,
|
|
@@ -5485,7 +5561,7 @@ function SidebarMenuSkeleton({
|
|
|
5485
5561
|
showIcon = false,
|
|
5486
5562
|
...props
|
|
5487
5563
|
}) {
|
|
5488
|
-
const width =
|
|
5564
|
+
const width = React17__namespace.useMemo(() => {
|
|
5489
5565
|
return `${Math.floor(Math.random() * 40) + 50}%`;
|
|
5490
5566
|
}, []);
|
|
5491
5567
|
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
@@ -5628,7 +5704,7 @@ var sectionVariants = classVarianceAuthority.cva(
|
|
|
5628
5704
|
}
|
|
5629
5705
|
);
|
|
5630
5706
|
var isGlassVariant = (variant) => variant?.startsWith("glass-") ?? false;
|
|
5631
|
-
var Section =
|
|
5707
|
+
var Section = React17__namespace.forwardRef(
|
|
5632
5708
|
({ className, variant, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
5633
5709
|
"section",
|
|
5634
5710
|
{
|
|
@@ -5640,7 +5716,7 @@ var Section = React15__namespace.forwardRef(
|
|
|
5640
5716
|
)
|
|
5641
5717
|
);
|
|
5642
5718
|
Section.displayName = "Section";
|
|
5643
|
-
var SectionHeader =
|
|
5719
|
+
var SectionHeader = React17__namespace.forwardRef(
|
|
5644
5720
|
({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
5645
5721
|
"div",
|
|
5646
5722
|
{
|
|
@@ -5655,7 +5731,7 @@ var SectionHeader = React15__namespace.forwardRef(
|
|
|
5655
5731
|
)
|
|
5656
5732
|
);
|
|
5657
5733
|
SectionHeader.displayName = "SectionHeader";
|
|
5658
|
-
var SectionTitle =
|
|
5734
|
+
var SectionTitle = React17__namespace.forwardRef(
|
|
5659
5735
|
({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
5660
5736
|
"h2",
|
|
5661
5737
|
{
|
|
@@ -5669,7 +5745,7 @@ var SectionTitle = React15__namespace.forwardRef(
|
|
|
5669
5745
|
)
|
|
5670
5746
|
);
|
|
5671
5747
|
SectionTitle.displayName = "SectionTitle";
|
|
5672
|
-
var SectionDescription =
|
|
5748
|
+
var SectionDescription = React17__namespace.forwardRef(
|
|
5673
5749
|
({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
5674
5750
|
"p",
|
|
5675
5751
|
{
|
|
@@ -5683,7 +5759,7 @@ var SectionDescription = React15__namespace.forwardRef(
|
|
|
5683
5759
|
)
|
|
5684
5760
|
);
|
|
5685
5761
|
SectionDescription.displayName = "SectionDescription";
|
|
5686
|
-
var SectionContent =
|
|
5762
|
+
var SectionContent = React17__namespace.forwardRef(
|
|
5687
5763
|
({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
5688
5764
|
"div",
|
|
5689
5765
|
{
|
|
@@ -5697,7 +5773,7 @@ var SectionContent = React15__namespace.forwardRef(
|
|
|
5697
5773
|
)
|
|
5698
5774
|
);
|
|
5699
5775
|
SectionContent.displayName = "SectionContent";
|
|
5700
|
-
var SectionFooter =
|
|
5776
|
+
var SectionFooter = React17__namespace.forwardRef(
|
|
5701
5777
|
({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
5702
5778
|
"div",
|
|
5703
5779
|
{
|
|
@@ -5713,6 +5789,180 @@ var SectionFooter = React15__namespace.forwardRef(
|
|
|
5713
5789
|
)
|
|
5714
5790
|
);
|
|
5715
5791
|
SectionFooter.displayName = "SectionFooter";
|
|
5792
|
+
function DataTableColumnHeader({
|
|
5793
|
+
column,
|
|
5794
|
+
title,
|
|
5795
|
+
className
|
|
5796
|
+
}) {
|
|
5797
|
+
if (!column.getCanSort()) {
|
|
5798
|
+
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: cn(className), children: title });
|
|
5799
|
+
}
|
|
5800
|
+
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: cn("flex items-center gap-2", className), children: /* @__PURE__ */ jsxRuntime.jsxs(DropdownMenu, { children: [
|
|
5801
|
+
/* @__PURE__ */ jsxRuntime.jsx(DropdownMenuTrigger, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
5802
|
+
Button,
|
|
5803
|
+
{
|
|
5804
|
+
variant: "ghost",
|
|
5805
|
+
size: "sm",
|
|
5806
|
+
className: "data-[state=open]:bg-accent -ml-3 h-8",
|
|
5807
|
+
children: [
|
|
5808
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { children: title }),
|
|
5809
|
+
column.getIsSorted() === "desc" ? /* @__PURE__ */ jsxRuntime.jsx(lucideReact.ArrowDown, {}) : column.getIsSorted() === "asc" ? /* @__PURE__ */ jsxRuntime.jsx(lucideReact.ArrowUp, {}) : /* @__PURE__ */ jsxRuntime.jsx(lucideReact.ChevronsUpDown, {})
|
|
5810
|
+
]
|
|
5811
|
+
}
|
|
5812
|
+
) }),
|
|
5813
|
+
/* @__PURE__ */ jsxRuntime.jsxs(DropdownMenuContent, { align: "start", children: [
|
|
5814
|
+
/* @__PURE__ */ jsxRuntime.jsxs(DropdownMenuItem, { onClick: () => column.toggleSorting(false), children: [
|
|
5815
|
+
/* @__PURE__ */ jsxRuntime.jsx(lucideReact.ArrowUp, {}),
|
|
5816
|
+
"Asc"
|
|
5817
|
+
] }),
|
|
5818
|
+
/* @__PURE__ */ jsxRuntime.jsxs(DropdownMenuItem, { onClick: () => column.toggleSorting(true), children: [
|
|
5819
|
+
/* @__PURE__ */ jsxRuntime.jsx(lucideReact.ArrowDown, {}),
|
|
5820
|
+
"Desc"
|
|
5821
|
+
] }),
|
|
5822
|
+
column.getCanHide() && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
5823
|
+
/* @__PURE__ */ jsxRuntime.jsx(DropdownMenuSeparator, {}),
|
|
5824
|
+
/* @__PURE__ */ jsxRuntime.jsxs(DropdownMenuItem, { onClick: () => column.toggleVisibility(false), children: [
|
|
5825
|
+
/* @__PURE__ */ jsxRuntime.jsx(lucideReact.EyeOff, {}),
|
|
5826
|
+
"Hide"
|
|
5827
|
+
] })
|
|
5828
|
+
] })
|
|
5829
|
+
] })
|
|
5830
|
+
] }) });
|
|
5831
|
+
}
|
|
5832
|
+
function DataTablePagination({
|
|
5833
|
+
table,
|
|
5834
|
+
showRowSelection = true,
|
|
5835
|
+
pageSizeOptions = [10, 20, 25, 30, 40, 50]
|
|
5836
|
+
}) {
|
|
5837
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center justify-between px-2", children: [
|
|
5838
|
+
showRowSelection && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "text-muted-foreground flex-1 text-sm", children: [
|
|
5839
|
+
table.getFilteredSelectedRowModel().rows.length,
|
|
5840
|
+
" of",
|
|
5841
|
+
" ",
|
|
5842
|
+
table.getFilteredRowModel().rows.length,
|
|
5843
|
+
" row(s) selected."
|
|
5844
|
+
] }),
|
|
5845
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center space-x-6 lg:space-x-8", children: [
|
|
5846
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center space-x-2", children: [
|
|
5847
|
+
/* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-sm font-medium", children: "Rows per page" }),
|
|
5848
|
+
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
5849
|
+
Select,
|
|
5850
|
+
{
|
|
5851
|
+
value: `${table.getState().pagination.pageSize}`,
|
|
5852
|
+
onValueChange: (value) => {
|
|
5853
|
+
table.setPageSize(Number(value));
|
|
5854
|
+
},
|
|
5855
|
+
children: [
|
|
5856
|
+
/* @__PURE__ */ jsxRuntime.jsx(SelectTrigger, { className: "h-8 w-[70px]", children: /* @__PURE__ */ jsxRuntime.jsx(SelectValue, { placeholder: table.getState().pagination.pageSize }) }),
|
|
5857
|
+
/* @__PURE__ */ jsxRuntime.jsx(SelectContent, { side: "top", children: pageSizeOptions.map((pageSize) => /* @__PURE__ */ jsxRuntime.jsx(SelectItem, { value: `${pageSize}`, children: pageSize }, pageSize)) })
|
|
5858
|
+
]
|
|
5859
|
+
}
|
|
5860
|
+
)
|
|
5861
|
+
] }),
|
|
5862
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex w-[100px] items-center justify-center text-sm font-medium", children: [
|
|
5863
|
+
"Page ",
|
|
5864
|
+
table.getState().pagination.pageIndex + 1,
|
|
5865
|
+
" of",
|
|
5866
|
+
" ",
|
|
5867
|
+
table.getPageCount()
|
|
5868
|
+
] }),
|
|
5869
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center space-x-2", children: [
|
|
5870
|
+
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
5871
|
+
Button,
|
|
5872
|
+
{
|
|
5873
|
+
variant: "outline",
|
|
5874
|
+
size: "icon",
|
|
5875
|
+
className: "hidden size-8 lg:flex",
|
|
5876
|
+
onClick: () => table.setPageIndex(0),
|
|
5877
|
+
disabled: !table.getCanPreviousPage(),
|
|
5878
|
+
children: [
|
|
5879
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "sr-only", children: "Go to first page" }),
|
|
5880
|
+
/* @__PURE__ */ jsxRuntime.jsx(lucideReact.ChevronsLeft, {})
|
|
5881
|
+
]
|
|
5882
|
+
}
|
|
5883
|
+
),
|
|
5884
|
+
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
5885
|
+
Button,
|
|
5886
|
+
{
|
|
5887
|
+
variant: "outline",
|
|
5888
|
+
size: "icon",
|
|
5889
|
+
className: "size-8",
|
|
5890
|
+
onClick: () => table.previousPage(),
|
|
5891
|
+
disabled: !table.getCanPreviousPage(),
|
|
5892
|
+
children: [
|
|
5893
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "sr-only", children: "Go to previous page" }),
|
|
5894
|
+
/* @__PURE__ */ jsxRuntime.jsx(lucideReact.ChevronLeft, {})
|
|
5895
|
+
]
|
|
5896
|
+
}
|
|
5897
|
+
),
|
|
5898
|
+
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
5899
|
+
Button,
|
|
5900
|
+
{
|
|
5901
|
+
variant: "outline",
|
|
5902
|
+
size: "icon",
|
|
5903
|
+
className: "size-8",
|
|
5904
|
+
onClick: () => table.nextPage(),
|
|
5905
|
+
disabled: !table.getCanNextPage(),
|
|
5906
|
+
children: [
|
|
5907
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "sr-only", children: "Go to next page" }),
|
|
5908
|
+
/* @__PURE__ */ jsxRuntime.jsx(lucideReact.ChevronRight, {})
|
|
5909
|
+
]
|
|
5910
|
+
}
|
|
5911
|
+
),
|
|
5912
|
+
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
5913
|
+
Button,
|
|
5914
|
+
{
|
|
5915
|
+
variant: "outline",
|
|
5916
|
+
size: "icon",
|
|
5917
|
+
className: "hidden size-8 lg:flex",
|
|
5918
|
+
onClick: () => table.setPageIndex(table.getPageCount() - 1),
|
|
5919
|
+
disabled: !table.getCanNextPage(),
|
|
5920
|
+
children: [
|
|
5921
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "sr-only", children: "Go to last page" }),
|
|
5922
|
+
/* @__PURE__ */ jsxRuntime.jsx(lucideReact.ChevronsRight, {})
|
|
5923
|
+
]
|
|
5924
|
+
}
|
|
5925
|
+
)
|
|
5926
|
+
] })
|
|
5927
|
+
] })
|
|
5928
|
+
] });
|
|
5929
|
+
}
|
|
5930
|
+
function DataTableViewOptions({
|
|
5931
|
+
table
|
|
5932
|
+
}) {
|
|
5933
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(DropdownMenu, { children: [
|
|
5934
|
+
/* @__PURE__ */ jsxRuntime.jsx(DropdownMenuTrigger, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
5935
|
+
Button,
|
|
5936
|
+
{
|
|
5937
|
+
variant: "outline",
|
|
5938
|
+
size: "sm",
|
|
5939
|
+
className: "ml-auto hidden h-8 lg:flex",
|
|
5940
|
+
children: [
|
|
5941
|
+
/* @__PURE__ */ jsxRuntime.jsx(lucideReact.Settings2, {}),
|
|
5942
|
+
"View"
|
|
5943
|
+
]
|
|
5944
|
+
}
|
|
5945
|
+
) }),
|
|
5946
|
+
/* @__PURE__ */ jsxRuntime.jsxs(DropdownMenuContent, { align: "end", className: "w-[150px]", children: [
|
|
5947
|
+
/* @__PURE__ */ jsxRuntime.jsx(DropdownMenuLabel, { children: "Toggle columns" }),
|
|
5948
|
+
/* @__PURE__ */ jsxRuntime.jsx(DropdownMenuSeparator, {}),
|
|
5949
|
+
table.getAllColumns().filter(
|
|
5950
|
+
(column) => typeof column.accessorFn !== "undefined" && column.getCanHide()
|
|
5951
|
+
).map((column) => {
|
|
5952
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
5953
|
+
DropdownMenuCheckboxItem,
|
|
5954
|
+
{
|
|
5955
|
+
className: "capitalize",
|
|
5956
|
+
checked: column.getIsVisible(),
|
|
5957
|
+
onCheckedChange: (value) => column.toggleVisibility(!!value),
|
|
5958
|
+
children: column.id
|
|
5959
|
+
},
|
|
5960
|
+
column.id
|
|
5961
|
+
);
|
|
5962
|
+
})
|
|
5963
|
+
] })
|
|
5964
|
+
] });
|
|
5965
|
+
}
|
|
5716
5966
|
function SearchForm({ ...props }) {
|
|
5717
5967
|
return /* @__PURE__ */ jsxRuntime.jsx("form", { ...props, children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "relative", children: [
|
|
5718
5968
|
/* @__PURE__ */ jsxRuntime.jsx(Label2, { htmlFor: "search", className: "sr-only", children: "Search" }),
|
|
@@ -5748,7 +5998,7 @@ function SiteHeader({
|
|
|
5748
5998
|
children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex h-[var(--header-height,3.5rem)] w-full items-center gap-[var(--j3m-spacing-s)] px-[var(--j3m-spacing-m)]", children: [
|
|
5749
5999
|
trigger,
|
|
5750
6000
|
trigger && /* @__PURE__ */ jsxRuntime.jsx(Separator, { orientation: "vertical", className: "mr-[var(--j3m-spacing-s)] h-4" }),
|
|
5751
|
-
/* @__PURE__ */ jsxRuntime.jsx(Breadcrumb, { className: "hidden sm:block", children: /* @__PURE__ */ jsxRuntime.jsx(BreadcrumbList, { children: breadcrumbs.map((item, index) => /* @__PURE__ */ jsxRuntime.jsxs(
|
|
6001
|
+
/* @__PURE__ */ jsxRuntime.jsx(Breadcrumb, { className: "hidden sm:block", children: /* @__PURE__ */ jsxRuntime.jsx(BreadcrumbList, { children: breadcrumbs.map((item, index) => /* @__PURE__ */ jsxRuntime.jsxs(React17__namespace.Fragment, { children: [
|
|
5752
6002
|
index > 0 && /* @__PURE__ */ jsxRuntime.jsx(BreadcrumbSeparator, {}),
|
|
5753
6003
|
/* @__PURE__ */ jsxRuntime.jsx(BreadcrumbItem, { children: item.href ? /* @__PURE__ */ jsxRuntime.jsx(BreadcrumbLink, { href: item.href, children: item.label }) : /* @__PURE__ */ jsxRuntime.jsx(BreadcrumbPage, { children: item.label }) })
|
|
5754
6004
|
] }, index)) }) }),
|
|
@@ -5897,6 +6147,934 @@ function NavUser({ user }) {
|
|
|
5897
6147
|
)
|
|
5898
6148
|
] }) }) });
|
|
5899
6149
|
}
|
|
6150
|
+
function PlanningTableToolbar({
|
|
6151
|
+
className,
|
|
6152
|
+
table,
|
|
6153
|
+
...props
|
|
6154
|
+
}) {
|
|
6155
|
+
const isFiltered = table.getState().columnFilters.length > 0;
|
|
6156
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
6157
|
+
"div",
|
|
6158
|
+
{
|
|
6159
|
+
"data-slot": "planning-table-toolbar",
|
|
6160
|
+
className: cn("flex items-center gap-2", className),
|
|
6161
|
+
...props,
|
|
6162
|
+
children: [
|
|
6163
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
6164
|
+
Input,
|
|
6165
|
+
{
|
|
6166
|
+
placeholder: "Filter suppliers...",
|
|
6167
|
+
value: table.getColumn("supplier")?.getFilterValue() ?? "",
|
|
6168
|
+
onChange: (event) => table.getColumn("supplier")?.setFilterValue(event.target.value),
|
|
6169
|
+
className: "h-8 w-[150px] lg:w-[250px]"
|
|
6170
|
+
}
|
|
6171
|
+
),
|
|
6172
|
+
isFiltered && /* @__PURE__ */ jsxRuntime.jsxs(
|
|
6173
|
+
Button,
|
|
6174
|
+
{
|
|
6175
|
+
variant: "ghost",
|
|
6176
|
+
onClick: () => table.resetColumnFilters(),
|
|
6177
|
+
className: "h-8 px-2 lg:px-3",
|
|
6178
|
+
children: [
|
|
6179
|
+
"Reset",
|
|
6180
|
+
/* @__PURE__ */ jsxRuntime.jsx(lucideReact.X, { className: "ml-2 h-4 w-4" })
|
|
6181
|
+
]
|
|
6182
|
+
}
|
|
6183
|
+
)
|
|
6184
|
+
]
|
|
6185
|
+
}
|
|
6186
|
+
);
|
|
6187
|
+
}
|
|
6188
|
+
function getBadgeVariant(badgeType) {
|
|
6189
|
+
const variantMap = {
|
|
6190
|
+
Welded: "secondary",
|
|
6191
|
+
Painted: "secondary",
|
|
6192
|
+
Glazed: "secondary",
|
|
6193
|
+
Delivered: "secondary",
|
|
6194
|
+
Cured: "secondary",
|
|
6195
|
+
Assembled: "secondary",
|
|
6196
|
+
Tested: "secondary",
|
|
6197
|
+
Sealed: "secondary"
|
|
6198
|
+
};
|
|
6199
|
+
return variantMap[badgeType] || "secondary";
|
|
6200
|
+
}
|
|
6201
|
+
function SupplierCell({
|
|
6202
|
+
className,
|
|
6203
|
+
supplier,
|
|
6204
|
+
...props
|
|
6205
|
+
}) {
|
|
6206
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
6207
|
+
"div",
|
|
6208
|
+
{
|
|
6209
|
+
"data-slot": "supplier-cell",
|
|
6210
|
+
className: cn(
|
|
6211
|
+
"flex flex-col justify-center gap-1 py-3 px-4 w-[200px] h-[72px]",
|
|
6212
|
+
className
|
|
6213
|
+
),
|
|
6214
|
+
...props,
|
|
6215
|
+
children: [
|
|
6216
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-sm font-semibold leading-tight text-foreground", children: supplier.name }),
|
|
6217
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-2", children: [
|
|
6218
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
6219
|
+
Badge,
|
|
6220
|
+
{
|
|
6221
|
+
variant: getBadgeVariant(supplier.badgeType),
|
|
6222
|
+
className: "text-[10px] px-1.5 py-0 h-5 font-normal",
|
|
6223
|
+
children: supplier.badgeType
|
|
6224
|
+
}
|
|
6225
|
+
),
|
|
6226
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-xs text-muted-foreground", children: supplier.scope })
|
|
6227
|
+
] })
|
|
6228
|
+
]
|
|
6229
|
+
}
|
|
6230
|
+
);
|
|
6231
|
+
}
|
|
6232
|
+
function getCombinedRiskLevel(data) {
|
|
6233
|
+
const productionStatus = data.production?.status || "on-time";
|
|
6234
|
+
const hasDeliveryCritical = data.deliveries?.some((d) => d.status === "critical");
|
|
6235
|
+
const hasDeliveryDelayed = data.deliveries?.some((d) => d.status === "delayed");
|
|
6236
|
+
if (productionStatus === "critical" || hasDeliveryCritical) {
|
|
6237
|
+
return "critical";
|
|
6238
|
+
}
|
|
6239
|
+
if (productionStatus === "delayed" || hasDeliveryDelayed || data.hasWarning) {
|
|
6240
|
+
return "warning";
|
|
6241
|
+
}
|
|
6242
|
+
return "normal";
|
|
6243
|
+
}
|
|
6244
|
+
function getRowStatus(status) {
|
|
6245
|
+
if (status === "critical") return "critical";
|
|
6246
|
+
if (status === "delayed") return "warning";
|
|
6247
|
+
return "normal";
|
|
6248
|
+
}
|
|
6249
|
+
var riskColorClasses = {
|
|
6250
|
+
normal: {
|
|
6251
|
+
border: "border-l-green-500",
|
|
6252
|
+
bg: "bg-green-50 dark:bg-green-950/50"
|
|
6253
|
+
},
|
|
6254
|
+
warning: {
|
|
6255
|
+
border: "border-l-amber-500",
|
|
6256
|
+
bg: "bg-amber-50 dark:bg-amber-950/50"
|
|
6257
|
+
},
|
|
6258
|
+
critical: {
|
|
6259
|
+
border: "border-l-red-500",
|
|
6260
|
+
bg: "bg-red-50 dark:bg-red-950/50"
|
|
6261
|
+
}
|
|
6262
|
+
};
|
|
6263
|
+
var statusColors = {
|
|
6264
|
+
normal: {
|
|
6265
|
+
icon: "text-green-600 dark:text-green-400",
|
|
6266
|
+
progress: "bg-green-500",
|
|
6267
|
+
text: "text-green-700 dark:text-green-300"
|
|
6268
|
+
},
|
|
6269
|
+
warning: {
|
|
6270
|
+
icon: "text-amber-600 dark:text-amber-400",
|
|
6271
|
+
progress: "bg-amber-500",
|
|
6272
|
+
text: "text-amber-700 dark:text-amber-300"
|
|
6273
|
+
},
|
|
6274
|
+
critical: {
|
|
6275
|
+
icon: "text-red-600 dark:text-red-400",
|
|
6276
|
+
progress: "bg-red-500",
|
|
6277
|
+
text: "text-red-700 dark:text-red-300"
|
|
6278
|
+
}
|
|
6279
|
+
};
|
|
6280
|
+
function WeekCell({
|
|
6281
|
+
className,
|
|
6282
|
+
data,
|
|
6283
|
+
week,
|
|
6284
|
+
supplier,
|
|
6285
|
+
isCurrentWeek,
|
|
6286
|
+
onCellClick,
|
|
6287
|
+
...props
|
|
6288
|
+
}) {
|
|
6289
|
+
const handleClick = () => {
|
|
6290
|
+
if (onCellClick && data.type !== "empty") {
|
|
6291
|
+
onCellClick();
|
|
6292
|
+
}
|
|
6293
|
+
};
|
|
6294
|
+
const handleKeyDown = (e) => {
|
|
6295
|
+
if ((e.key === "Enter" || e.key === " ") && onCellClick && data.type !== "empty") {
|
|
6296
|
+
e.preventDefault();
|
|
6297
|
+
onCellClick();
|
|
6298
|
+
}
|
|
6299
|
+
};
|
|
6300
|
+
const combinedRisk = data.type === "data" ? getCombinedRiskLevel(data) : "normal";
|
|
6301
|
+
const cardColors = riskColorClasses[combinedRisk];
|
|
6302
|
+
const productionProgress = data.production?.progress ?? data.progress ?? 0;
|
|
6303
|
+
const productionStatus = getRowStatus(data.production?.status);
|
|
6304
|
+
const productionColors = statusColors[productionStatus];
|
|
6305
|
+
const deliveryCount = data.deliveries?.length ?? 0;
|
|
6306
|
+
const worstDeliveryStatus = data.deliveries?.some((d) => d.status === "critical") ? "critical" : data.deliveries?.some((d) => d.status === "delayed") ? "warning" : "normal";
|
|
6307
|
+
const deliveryColors = statusColors[worstDeliveryStatus];
|
|
6308
|
+
if (data.type === "empty") {
|
|
6309
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
6310
|
+
"div",
|
|
6311
|
+
{
|
|
6312
|
+
"data-slot": "week-cell",
|
|
6313
|
+
"data-state": "empty",
|
|
6314
|
+
"data-current-week": isCurrentWeek,
|
|
6315
|
+
className: cn(
|
|
6316
|
+
"flex w-[120px] h-[72px] items-center justify-center cursor-default",
|
|
6317
|
+
isCurrentWeek && "bg-primary/5",
|
|
6318
|
+
className
|
|
6319
|
+
),
|
|
6320
|
+
...props,
|
|
6321
|
+
children: /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-muted-foreground/30 text-xl", children: "\xB7" })
|
|
6322
|
+
}
|
|
6323
|
+
);
|
|
6324
|
+
}
|
|
6325
|
+
if (data.type === "no-logistics") {
|
|
6326
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
6327
|
+
"div",
|
|
6328
|
+
{
|
|
6329
|
+
"data-slot": "week-cell",
|
|
6330
|
+
"data-state": "no-logistics",
|
|
6331
|
+
"data-current-week": isCurrentWeek,
|
|
6332
|
+
onClick: handleClick,
|
|
6333
|
+
onKeyDown: handleKeyDown,
|
|
6334
|
+
role: "button",
|
|
6335
|
+
tabIndex: 0,
|
|
6336
|
+
className: cn(
|
|
6337
|
+
"flex flex-col w-[120px] h-[72px] justify-center p-1",
|
|
6338
|
+
"cursor-pointer",
|
|
6339
|
+
isCurrentWeek && "bg-primary/5",
|
|
6340
|
+
className
|
|
6341
|
+
),
|
|
6342
|
+
...props,
|
|
6343
|
+
children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
6344
|
+
"div",
|
|
6345
|
+
{
|
|
6346
|
+
className: cn(
|
|
6347
|
+
"flex flex-col w-full h-full justify-center gap-1.5 rounded-md border-l-[3px] px-2 py-1.5",
|
|
6348
|
+
"border-l-muted-foreground/30 bg-muted/50",
|
|
6349
|
+
// Hover lift effect with shadow
|
|
6350
|
+
"transition-all duration-200 ease-out",
|
|
6351
|
+
"hover:-translate-y-0.5 hover:shadow-md hover:bg-muted/70"
|
|
6352
|
+
),
|
|
6353
|
+
children: [
|
|
6354
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-1.5", children: [
|
|
6355
|
+
/* @__PURE__ */ jsxRuntime.jsx(lucideReact.Factory, { className: "h-3.5 w-3.5 shrink-0 text-muted-foreground" }),
|
|
6356
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex-1 h-1.5 bg-muted-foreground/20 rounded-full overflow-hidden", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
6357
|
+
"div",
|
|
6358
|
+
{
|
|
6359
|
+
className: "h-full bg-muted-foreground/40 rounded-full",
|
|
6360
|
+
style: { width: `${productionProgress}%` }
|
|
6361
|
+
}
|
|
6362
|
+
) })
|
|
6363
|
+
] }),
|
|
6364
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-1.5 text-muted-foreground", children: [
|
|
6365
|
+
/* @__PURE__ */ jsxRuntime.jsx(lucideReact.Truck, { className: "h-3.5 w-3.5 shrink-0" }),
|
|
6366
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-[10px]", children: "No logistics" })
|
|
6367
|
+
] })
|
|
6368
|
+
]
|
|
6369
|
+
}
|
|
6370
|
+
)
|
|
6371
|
+
}
|
|
6372
|
+
);
|
|
6373
|
+
}
|
|
6374
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
6375
|
+
"div",
|
|
6376
|
+
{
|
|
6377
|
+
"data-slot": "week-cell",
|
|
6378
|
+
"data-state": "data",
|
|
6379
|
+
"data-risk": combinedRisk,
|
|
6380
|
+
"data-current-week": isCurrentWeek,
|
|
6381
|
+
onClick: handleClick,
|
|
6382
|
+
onKeyDown: handleKeyDown,
|
|
6383
|
+
role: "button",
|
|
6384
|
+
tabIndex: 0,
|
|
6385
|
+
className: cn(
|
|
6386
|
+
"flex flex-col w-[120px] h-[72px] justify-center p-1",
|
|
6387
|
+
"cursor-pointer",
|
|
6388
|
+
isCurrentWeek && "bg-primary/5",
|
|
6389
|
+
className
|
|
6390
|
+
),
|
|
6391
|
+
...props,
|
|
6392
|
+
children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
6393
|
+
"div",
|
|
6394
|
+
{
|
|
6395
|
+
className: cn(
|
|
6396
|
+
"flex flex-col w-full h-full justify-center gap-1.5 rounded-md border-l-[3px] px-2 py-1.5",
|
|
6397
|
+
cardColors.border,
|
|
6398
|
+
cardColors.bg,
|
|
6399
|
+
// Hover lift effect with shadow
|
|
6400
|
+
"transition-all duration-200 ease-out",
|
|
6401
|
+
"hover:-translate-y-0.5 hover:shadow-md"
|
|
6402
|
+
),
|
|
6403
|
+
children: [
|
|
6404
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-1.5", children: [
|
|
6405
|
+
/* @__PURE__ */ jsxRuntime.jsx(lucideReact.Factory, { className: cn("h-3.5 w-3.5 shrink-0", productionColors.icon) }),
|
|
6406
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex-1 h-1.5 bg-black/10 dark:bg-white/10 rounded-full overflow-hidden", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
6407
|
+
"div",
|
|
6408
|
+
{
|
|
6409
|
+
className: cn("h-full rounded-full transition-all", productionColors.progress),
|
|
6410
|
+
style: { width: `${productionProgress}%` }
|
|
6411
|
+
}
|
|
6412
|
+
) })
|
|
6413
|
+
] }),
|
|
6414
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-1.5", children: [
|
|
6415
|
+
/* @__PURE__ */ jsxRuntime.jsx(lucideReact.Truck, { className: cn("h-3.5 w-3.5 shrink-0", deliveryColors.icon) }),
|
|
6416
|
+
deliveryCount > 0 ? /* @__PURE__ */ jsxRuntime.jsxs("span", { className: cn("text-[10px] font-medium", deliveryColors.text), children: [
|
|
6417
|
+
deliveryCount,
|
|
6418
|
+
"x delivery"
|
|
6419
|
+
] }) : /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-[10px] text-muted-foreground", children: "\u2014" })
|
|
6420
|
+
] })
|
|
6421
|
+
]
|
|
6422
|
+
}
|
|
6423
|
+
)
|
|
6424
|
+
}
|
|
6425
|
+
);
|
|
6426
|
+
}
|
|
6427
|
+
function WeekHeader({
|
|
6428
|
+
className,
|
|
6429
|
+
week,
|
|
6430
|
+
...props
|
|
6431
|
+
}) {
|
|
6432
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
6433
|
+
"div",
|
|
6434
|
+
{
|
|
6435
|
+
"data-slot": "week-header",
|
|
6436
|
+
"data-current-week": week.isCurrentWeek,
|
|
6437
|
+
className: cn(
|
|
6438
|
+
"flex flex-col justify-center gap-0.5 w-[120px] text-left",
|
|
6439
|
+
className
|
|
6440
|
+
),
|
|
6441
|
+
...props,
|
|
6442
|
+
children: [
|
|
6443
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-2", children: [
|
|
6444
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: cn(
|
|
6445
|
+
"text-sm font-medium",
|
|
6446
|
+
week.isCurrentWeek ? "text-primary" : "text-foreground"
|
|
6447
|
+
), children: week.label }),
|
|
6448
|
+
week.isCurrentWeek && /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "relative flex h-2 w-2", children: [
|
|
6449
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "animate-ping absolute inline-flex h-full w-full rounded-full bg-primary opacity-75" }),
|
|
6450
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "relative inline-flex rounded-full h-2 w-2 bg-primary" })
|
|
6451
|
+
] })
|
|
6452
|
+
] }),
|
|
6453
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-[11px] text-muted-foreground whitespace-nowrap", children: week.dateRange })
|
|
6454
|
+
]
|
|
6455
|
+
}
|
|
6456
|
+
);
|
|
6457
|
+
}
|
|
6458
|
+
|
|
6459
|
+
// src/blocks/planning-table/types.ts
|
|
6460
|
+
function getWeekKey(date) {
|
|
6461
|
+
const year = date.getFullYear();
|
|
6462
|
+
const weekNumber = getISOWeek(date);
|
|
6463
|
+
return `${year}-W${weekNumber.toString().padStart(2, "0")}`;
|
|
6464
|
+
}
|
|
6465
|
+
function getISOWeek(date) {
|
|
6466
|
+
const d = new Date(Date.UTC(date.getFullYear(), date.getMonth(), date.getDate()));
|
|
6467
|
+
const dayNum = d.getUTCDay() || 7;
|
|
6468
|
+
d.setUTCDate(d.getUTCDate() + 4 - dayNum);
|
|
6469
|
+
const yearStart = new Date(Date.UTC(d.getUTCFullYear(), 0, 1));
|
|
6470
|
+
return Math.ceil(((d.getTime() - yearStart.getTime()) / 864e5 + 1) / 7);
|
|
6471
|
+
}
|
|
6472
|
+
function generateWeeks(startDate, count) {
|
|
6473
|
+
const weeks = [];
|
|
6474
|
+
const current = new Date(startDate);
|
|
6475
|
+
const today = /* @__PURE__ */ new Date();
|
|
6476
|
+
const currentWeekKey = getWeekKey(today);
|
|
6477
|
+
const dayOfWeek = current.getDay();
|
|
6478
|
+
const daysToMonday = dayOfWeek === 0 ? -6 : 1 - dayOfWeek;
|
|
6479
|
+
current.setDate(current.getDate() + daysToMonday);
|
|
6480
|
+
for (let i = 0; i < count; i++) {
|
|
6481
|
+
const weekStart = new Date(current);
|
|
6482
|
+
const weekEnd = new Date(current);
|
|
6483
|
+
weekEnd.setDate(weekEnd.getDate() + 6);
|
|
6484
|
+
const weekNumber = getISOWeek(weekStart);
|
|
6485
|
+
const year = weekStart.getFullYear();
|
|
6486
|
+
const weekKey = `${year}-W${weekNumber.toString().padStart(2, "0")}`;
|
|
6487
|
+
weeks.push({
|
|
6488
|
+
weekNumber,
|
|
6489
|
+
year,
|
|
6490
|
+
startDate: weekStart,
|
|
6491
|
+
endDate: weekEnd,
|
|
6492
|
+
label: `W${weekNumber.toString().padStart(2, "0")}`,
|
|
6493
|
+
dateRange: formatDateRange(weekStart, weekEnd),
|
|
6494
|
+
isCurrentWeek: weekKey === currentWeekKey
|
|
6495
|
+
});
|
|
6496
|
+
current.setDate(current.getDate() + 7);
|
|
6497
|
+
}
|
|
6498
|
+
return weeks;
|
|
6499
|
+
}
|
|
6500
|
+
function formatDateRange(start, end) {
|
|
6501
|
+
const months = ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"];
|
|
6502
|
+
const startMonth = months[start.getMonth()];
|
|
6503
|
+
const endMonth = months[end.getMonth()];
|
|
6504
|
+
if (startMonth === endMonth) {
|
|
6505
|
+
return `${startMonth} ${start.getDate()} - ${end.getDate()}`;
|
|
6506
|
+
}
|
|
6507
|
+
return `${startMonth} ${start.getDate()} - ${endMonth} ${end.getDate()}`;
|
|
6508
|
+
}
|
|
6509
|
+
function formatProductionUnit(unit) {
|
|
6510
|
+
const unitLabels = {
|
|
6511
|
+
quantity: "pcs",
|
|
6512
|
+
kvm: "m\xB2",
|
|
6513
|
+
ton: "ton",
|
|
6514
|
+
kg: "kg",
|
|
6515
|
+
m: "m",
|
|
6516
|
+
pcs: "pcs"
|
|
6517
|
+
};
|
|
6518
|
+
return unitLabels[unit] || unit;
|
|
6519
|
+
}
|
|
6520
|
+
function SupplierColumnHeader({
|
|
6521
|
+
column
|
|
6522
|
+
}) {
|
|
6523
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
6524
|
+
Button,
|
|
6525
|
+
{
|
|
6526
|
+
variant: "ghost",
|
|
6527
|
+
size: "sm",
|
|
6528
|
+
className: "-ml-3 h-8 data-[state=open]:bg-accent",
|
|
6529
|
+
onClick: () => column.toggleSorting(column.getIsSorted() === "asc"),
|
|
6530
|
+
children: [
|
|
6531
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "font-medium", children: "Supplier / Scope" }),
|
|
6532
|
+
/* @__PURE__ */ jsxRuntime.jsx(lucideReact.ArrowUpDown, { className: "ml-2 h-4 w-4" })
|
|
6533
|
+
]
|
|
6534
|
+
}
|
|
6535
|
+
);
|
|
6536
|
+
}
|
|
6537
|
+
function getSupplierColumn() {
|
|
6538
|
+
return {
|
|
6539
|
+
id: "supplier",
|
|
6540
|
+
accessorKey: "name",
|
|
6541
|
+
header: ({ column }) => /* @__PURE__ */ jsxRuntime.jsx(SupplierColumnHeader, { column }),
|
|
6542
|
+
cell: ({ row }) => /* @__PURE__ */ jsxRuntime.jsx(SupplierCell, { supplier: row.original }),
|
|
6543
|
+
enableSorting: true,
|
|
6544
|
+
enableHiding: false
|
|
6545
|
+
};
|
|
6546
|
+
}
|
|
6547
|
+
function generateWeekColumns(weeks, config) {
|
|
6548
|
+
return weeks.map((week) => {
|
|
6549
|
+
const weekKey = getWeekKey(week.startDate);
|
|
6550
|
+
return {
|
|
6551
|
+
id: weekKey,
|
|
6552
|
+
accessorFn: (supplier) => supplier.weeks[weekKey],
|
|
6553
|
+
header: () => /* @__PURE__ */ jsxRuntime.jsx(WeekHeader, { week }),
|
|
6554
|
+
cell: ({ row }) => {
|
|
6555
|
+
const supplier = row.original;
|
|
6556
|
+
const data = supplier.weeks[weekKey] || { type: "empty" };
|
|
6557
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
6558
|
+
WeekCell,
|
|
6559
|
+
{
|
|
6560
|
+
data,
|
|
6561
|
+
week,
|
|
6562
|
+
supplier,
|
|
6563
|
+
isCurrentWeek: week.isCurrentWeek,
|
|
6564
|
+
onCellClick: config?.onCellClick ? () => config.onCellClick?.(supplier, week, data) : void 0
|
|
6565
|
+
}
|
|
6566
|
+
);
|
|
6567
|
+
},
|
|
6568
|
+
enableSorting: false,
|
|
6569
|
+
enableHiding: true
|
|
6570
|
+
};
|
|
6571
|
+
});
|
|
6572
|
+
}
|
|
6573
|
+
function generateColumns(weeks, config) {
|
|
6574
|
+
return [
|
|
6575
|
+
getSupplierColumn(),
|
|
6576
|
+
...generateWeekColumns(weeks, config)
|
|
6577
|
+
];
|
|
6578
|
+
}
|
|
6579
|
+
function PlanningTable({
|
|
6580
|
+
className,
|
|
6581
|
+
suppliers,
|
|
6582
|
+
config = {}
|
|
6583
|
+
}) {
|
|
6584
|
+
const {
|
|
6585
|
+
weekCount = 12,
|
|
6586
|
+
startDate = /* @__PURE__ */ new Date(),
|
|
6587
|
+
highlightCurrentWeek = true,
|
|
6588
|
+
showToolbar = true,
|
|
6589
|
+
showPagination = true,
|
|
6590
|
+
pageSizeOptions = [10, 20, 30, 50],
|
|
6591
|
+
defaultPageSize = 10,
|
|
6592
|
+
stickySupplierColumn = true,
|
|
6593
|
+
maxHeight = "600px"
|
|
6594
|
+
} = config;
|
|
6595
|
+
const weeks = React17__namespace.useMemo(
|
|
6596
|
+
() => generateWeeks(startDate, weekCount),
|
|
6597
|
+
[startDate, weekCount]
|
|
6598
|
+
);
|
|
6599
|
+
const currentWeekKey = React17__namespace.useMemo(() => {
|
|
6600
|
+
const currentWeek = weeks.find((w) => w.isCurrentWeek);
|
|
6601
|
+
return currentWeek ? getWeekKey(currentWeek.startDate) : null;
|
|
6602
|
+
}, [weeks]);
|
|
6603
|
+
const columns = React17__namespace.useMemo(
|
|
6604
|
+
() => generateColumns(weeks, config),
|
|
6605
|
+
[weeks, config]
|
|
6606
|
+
);
|
|
6607
|
+
const [sorting, setSorting] = React17__namespace.useState([]);
|
|
6608
|
+
const [columnFilters, setColumnFilters] = React17__namespace.useState([]);
|
|
6609
|
+
const [columnVisibility, setColumnVisibility] = React17__namespace.useState({});
|
|
6610
|
+
const [rowSelection, setRowSelection] = React17__namespace.useState({});
|
|
6611
|
+
const table = reactTable.useReactTable({
|
|
6612
|
+
data: suppliers,
|
|
6613
|
+
columns,
|
|
6614
|
+
getCoreRowModel: reactTable.getCoreRowModel(),
|
|
6615
|
+
getSortedRowModel: reactTable.getSortedRowModel(),
|
|
6616
|
+
getFilteredRowModel: reactTable.getFilteredRowModel(),
|
|
6617
|
+
getPaginationRowModel: reactTable.getPaginationRowModel(),
|
|
6618
|
+
onSortingChange: setSorting,
|
|
6619
|
+
onColumnFiltersChange: setColumnFilters,
|
|
6620
|
+
onColumnVisibilityChange: setColumnVisibility,
|
|
6621
|
+
onRowSelectionChange: setRowSelection,
|
|
6622
|
+
state: {
|
|
6623
|
+
sorting,
|
|
6624
|
+
columnFilters,
|
|
6625
|
+
columnVisibility,
|
|
6626
|
+
rowSelection
|
|
6627
|
+
},
|
|
6628
|
+
initialState: {
|
|
6629
|
+
pagination: {
|
|
6630
|
+
pageSize: defaultPageSize
|
|
6631
|
+
}
|
|
6632
|
+
}
|
|
6633
|
+
});
|
|
6634
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
6635
|
+
"div",
|
|
6636
|
+
{
|
|
6637
|
+
"data-slot": "planning-table",
|
|
6638
|
+
className: cn("flex flex-col gap-4", className),
|
|
6639
|
+
children: [
|
|
6640
|
+
showToolbar && /* @__PURE__ */ jsxRuntime.jsx(PlanningTableToolbar, { table }),
|
|
6641
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "rounded-lg border bg-card shadow-md", children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
6642
|
+
ScrollArea,
|
|
6643
|
+
{
|
|
6644
|
+
className: "w-full",
|
|
6645
|
+
style: { maxHeight },
|
|
6646
|
+
children: [
|
|
6647
|
+
/* @__PURE__ */ jsxRuntime.jsxs("table", { className: "w-full caption-bottom text-sm border-collapse", children: [
|
|
6648
|
+
/* @__PURE__ */ jsxRuntime.jsx("thead", { className: "[&_tr]:border-b bg-sidebar sticky top-0 z-20", children: table.getHeaderGroups().map((headerGroup) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
6649
|
+
"tr",
|
|
6650
|
+
{
|
|
6651
|
+
className: "border-b transition-colors",
|
|
6652
|
+
children: headerGroup.headers.map((header, index) => {
|
|
6653
|
+
const isCurrentWeekColumn = header.id === currentWeekKey;
|
|
6654
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
6655
|
+
"th",
|
|
6656
|
+
{
|
|
6657
|
+
className: cn(
|
|
6658
|
+
"h-14 px-4 text-left align-middle font-medium text-muted-foreground border-r border-border last:border-r-0",
|
|
6659
|
+
index === 0 && stickySupplierColumn && [
|
|
6660
|
+
"sticky left-0 z-30 bg-sidebar min-w-[200px]"
|
|
6661
|
+
],
|
|
6662
|
+
index > 0 && "min-w-[120px] w-[120px]",
|
|
6663
|
+
isCurrentWeekColumn && "bg-primary/10 border-t-2 border-t-primary"
|
|
6664
|
+
),
|
|
6665
|
+
children: header.isPlaceholder ? null : reactTable.flexRender(
|
|
6666
|
+
header.column.columnDef.header,
|
|
6667
|
+
header.getContext()
|
|
6668
|
+
)
|
|
6669
|
+
},
|
|
6670
|
+
header.id
|
|
6671
|
+
);
|
|
6672
|
+
})
|
|
6673
|
+
},
|
|
6674
|
+
headerGroup.id
|
|
6675
|
+
)) }),
|
|
6676
|
+
/* @__PURE__ */ jsxRuntime.jsx("tbody", { className: "[&_tr:last-child]:border-0 bg-background", children: table.getRowModel().rows?.length ? table.getRowModel().rows.map((row) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
6677
|
+
"tr",
|
|
6678
|
+
{
|
|
6679
|
+
"data-state": row.getIsSelected() && "selected",
|
|
6680
|
+
className: "border-b transition-colors hover:bg-muted/50 data-[state=selected]:bg-muted",
|
|
6681
|
+
children: row.getVisibleCells().map((cell, index) => {
|
|
6682
|
+
const isCurrentWeekColumn = cell.column.id === currentWeekKey;
|
|
6683
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
6684
|
+
"td",
|
|
6685
|
+
{
|
|
6686
|
+
className: cn(
|
|
6687
|
+
"p-0 align-middle border-r border-border last:border-r-0",
|
|
6688
|
+
index === 0 && stickySupplierColumn && [
|
|
6689
|
+
"sticky left-0 z-10 bg-background min-w-[200px]"
|
|
6690
|
+
],
|
|
6691
|
+
index > 0 && "min-w-[120px] w-[120px]",
|
|
6692
|
+
isCurrentWeekColumn && "bg-primary/5"
|
|
6693
|
+
),
|
|
6694
|
+
children: reactTable.flexRender(
|
|
6695
|
+
cell.column.columnDef.cell,
|
|
6696
|
+
cell.getContext()
|
|
6697
|
+
)
|
|
6698
|
+
},
|
|
6699
|
+
cell.id
|
|
6700
|
+
);
|
|
6701
|
+
})
|
|
6702
|
+
},
|
|
6703
|
+
row.id
|
|
6704
|
+
)) : /* @__PURE__ */ jsxRuntime.jsx("tr", { children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
6705
|
+
"td",
|
|
6706
|
+
{
|
|
6707
|
+
colSpan: columns.length,
|
|
6708
|
+
className: "h-24 text-center",
|
|
6709
|
+
children: "No suppliers found."
|
|
6710
|
+
}
|
|
6711
|
+
) }) })
|
|
6712
|
+
] }),
|
|
6713
|
+
/* @__PURE__ */ jsxRuntime.jsx(ScrollBar, { orientation: "horizontal" }),
|
|
6714
|
+
/* @__PURE__ */ jsxRuntime.jsx(ScrollBar, { orientation: "vertical" })
|
|
6715
|
+
]
|
|
6716
|
+
}
|
|
6717
|
+
) }),
|
|
6718
|
+
showPagination && /* @__PURE__ */ jsxRuntime.jsx(
|
|
6719
|
+
DataTablePagination,
|
|
6720
|
+
{
|
|
6721
|
+
table,
|
|
6722
|
+
showRowSelection: false,
|
|
6723
|
+
pageSizeOptions
|
|
6724
|
+
}
|
|
6725
|
+
)
|
|
6726
|
+
]
|
|
6727
|
+
}
|
|
6728
|
+
);
|
|
6729
|
+
}
|
|
6730
|
+
function getStatusBadgeVariant(status) {
|
|
6731
|
+
switch (status) {
|
|
6732
|
+
case "on-time":
|
|
6733
|
+
return "outline";
|
|
6734
|
+
// Green text with outline
|
|
6735
|
+
case "delayed":
|
|
6736
|
+
return "secondary";
|
|
6737
|
+
case "critical":
|
|
6738
|
+
return "destructive";
|
|
6739
|
+
default:
|
|
6740
|
+
return "outline";
|
|
6741
|
+
}
|
|
6742
|
+
}
|
|
6743
|
+
function getStatusBadgeClasses(status) {
|
|
6744
|
+
switch (status) {
|
|
6745
|
+
case "on-time":
|
|
6746
|
+
return "border-green-500 text-green-600 bg-green-50 dark:bg-green-950/50";
|
|
6747
|
+
case "delayed":
|
|
6748
|
+
return "border-amber-500 text-amber-600 bg-amber-50 dark:bg-amber-950/50";
|
|
6749
|
+
case "critical":
|
|
6750
|
+
return "";
|
|
6751
|
+
// Use default destructive
|
|
6752
|
+
default:
|
|
6753
|
+
return "";
|
|
6754
|
+
}
|
|
6755
|
+
}
|
|
6756
|
+
function getStatusLabel(status) {
|
|
6757
|
+
switch (status) {
|
|
6758
|
+
case "on-time":
|
|
6759
|
+
return "On Track";
|
|
6760
|
+
case "delayed":
|
|
6761
|
+
return "At Risk";
|
|
6762
|
+
case "critical":
|
|
6763
|
+
return "Critical";
|
|
6764
|
+
case "pending":
|
|
6765
|
+
return "Pending";
|
|
6766
|
+
default:
|
|
6767
|
+
return status;
|
|
6768
|
+
}
|
|
6769
|
+
}
|
|
6770
|
+
function DeliveryCard({ delivery, index }) {
|
|
6771
|
+
const [isOpen, setIsOpen] = React17__namespace.useState(false);
|
|
6772
|
+
const hasElements = delivery.elements && delivery.elements.length > 0;
|
|
6773
|
+
const elementsAtRisk = delivery.elementsAtRisk ?? delivery.elements?.filter((e) => !e.isProduced).length ?? 0;
|
|
6774
|
+
return /* @__PURE__ */ jsxRuntime.jsx(Collapsible, { open: isOpen, onOpenChange: setIsOpen, children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "rounded-lg border overflow-hidden bg-card", children: [
|
|
6775
|
+
/* @__PURE__ */ jsxRuntime.jsx(CollapsibleTrigger2, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
6776
|
+
"button",
|
|
6777
|
+
{
|
|
6778
|
+
className: cn(
|
|
6779
|
+
"w-full flex items-center justify-between p-3 text-left",
|
|
6780
|
+
"hover:bg-muted/50 transition-colors",
|
|
6781
|
+
hasElements && "cursor-pointer"
|
|
6782
|
+
),
|
|
6783
|
+
disabled: !hasElements,
|
|
6784
|
+
children: [
|
|
6785
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-3", children: [
|
|
6786
|
+
/* @__PURE__ */ jsxRuntime.jsx(lucideReact.Truck, { className: "h-4 w-4 text-muted-foreground" }),
|
|
6787
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
6788
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "text-sm font-medium", children: delivery.label || `Delivery ${index + 1}` }),
|
|
6789
|
+
delivery.destination && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "text-xs text-muted-foreground", children: [
|
|
6790
|
+
"\u2192 ",
|
|
6791
|
+
delivery.destination
|
|
6792
|
+
] })
|
|
6793
|
+
] })
|
|
6794
|
+
] }),
|
|
6795
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-2", children: [
|
|
6796
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
6797
|
+
Badge,
|
|
6798
|
+
{
|
|
6799
|
+
variant: getStatusBadgeVariant(delivery.status),
|
|
6800
|
+
className: cn("text-xs", getStatusBadgeClasses(delivery.status)),
|
|
6801
|
+
children: getStatusLabel(delivery.status)
|
|
6802
|
+
}
|
|
6803
|
+
),
|
|
6804
|
+
hasElements && /* @__PURE__ */ jsxRuntime.jsx(lucideReact.ChevronDown, { className: cn(
|
|
6805
|
+
"h-4 w-4 text-muted-foreground transition-transform",
|
|
6806
|
+
isOpen && "rotate-180"
|
|
6807
|
+
) })
|
|
6808
|
+
] })
|
|
6809
|
+
]
|
|
6810
|
+
}
|
|
6811
|
+
) }),
|
|
6812
|
+
hasElements && /* @__PURE__ */ jsxRuntime.jsxs(CollapsibleContent2, { children: [
|
|
6813
|
+
/* @__PURE__ */ jsxRuntime.jsx(Separator, {}),
|
|
6814
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "p-3 space-y-2", children: [
|
|
6815
|
+
elementsAtRisk > 0 && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-2 text-xs text-amber-600 dark:text-amber-400 mb-2", children: [
|
|
6816
|
+
/* @__PURE__ */ jsxRuntime.jsx(lucideReact.AlertTriangle, { className: "h-3.5 w-3.5" }),
|
|
6817
|
+
/* @__PURE__ */ jsxRuntime.jsxs("span", { children: [
|
|
6818
|
+
elementsAtRisk,
|
|
6819
|
+
" element(s) probably not all produced"
|
|
6820
|
+
] })
|
|
6821
|
+
] }),
|
|
6822
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "space-y-1.5", children: delivery.elements?.map((element) => /* @__PURE__ */ jsxRuntime.jsxs(
|
|
6823
|
+
"div",
|
|
6824
|
+
{
|
|
6825
|
+
className: cn(
|
|
6826
|
+
"flex items-center justify-between text-xs p-2 rounded",
|
|
6827
|
+
element.isProduced ? "bg-muted/30" : "bg-amber-50/50 dark:bg-amber-950/30"
|
|
6828
|
+
),
|
|
6829
|
+
children: [
|
|
6830
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-2", children: [
|
|
6831
|
+
element.isProduced ? /* @__PURE__ */ jsxRuntime.jsx(lucideReact.CheckCircle2, { className: "h-3.5 w-3.5 text-green-600" }) : /* @__PURE__ */ jsxRuntime.jsx(lucideReact.XCircle, { className: "h-3.5 w-3.5 text-amber-600" }),
|
|
6832
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: element.isProduced ? "text-foreground" : "text-amber-700 dark:text-amber-300", children: element.name })
|
|
6833
|
+
] }),
|
|
6834
|
+
element.quantity && /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "text-muted-foreground", children: [
|
|
6835
|
+
element.quantity,
|
|
6836
|
+
" ",
|
|
6837
|
+
element.unit ? formatProductionUnit(element.unit) : "pcs"
|
|
6838
|
+
] })
|
|
6839
|
+
]
|
|
6840
|
+
},
|
|
6841
|
+
element.id
|
|
6842
|
+
)) })
|
|
6843
|
+
] })
|
|
6844
|
+
] })
|
|
6845
|
+
] }) });
|
|
6846
|
+
}
|
|
6847
|
+
function WeekDetailDialog({
|
|
6848
|
+
open,
|
|
6849
|
+
onOpenChange,
|
|
6850
|
+
supplier,
|
|
6851
|
+
week,
|
|
6852
|
+
data,
|
|
6853
|
+
onProgressUpdate
|
|
6854
|
+
}) {
|
|
6855
|
+
const production = data?.production;
|
|
6856
|
+
const initialProgress = production?.progress ?? data?.progress ?? 0;
|
|
6857
|
+
const initialProduced = production?.produced ?? 0;
|
|
6858
|
+
const [progressValue, setProgressValue] = React17__namespace.useState(initialProgress.toString());
|
|
6859
|
+
const [producedValue, setProducedValue] = React17__namespace.useState(initialProduced.toString());
|
|
6860
|
+
const [hasChanges, setHasChanges] = React17__namespace.useState(false);
|
|
6861
|
+
React17__namespace.useEffect(() => {
|
|
6862
|
+
const newProgress = data?.production?.progress ?? data?.progress ?? 0;
|
|
6863
|
+
const newProduced = data?.production?.produced ?? 0;
|
|
6864
|
+
setProgressValue(newProgress.toString());
|
|
6865
|
+
setProducedValue(newProduced.toString());
|
|
6866
|
+
setHasChanges(false);
|
|
6867
|
+
}, [data]);
|
|
6868
|
+
const handleProgressChange = (e) => {
|
|
6869
|
+
const value = e.target.value;
|
|
6870
|
+
setProgressValue(value);
|
|
6871
|
+
setHasChanges(true);
|
|
6872
|
+
};
|
|
6873
|
+
const handleProducedChange = (e) => {
|
|
6874
|
+
const value = e.target.value;
|
|
6875
|
+
setProducedValue(value);
|
|
6876
|
+
if (production?.target) {
|
|
6877
|
+
const produced = parseFloat(value) || 0;
|
|
6878
|
+
const calculatedProgress = Math.round(produced / production.target * 100);
|
|
6879
|
+
setProgressValue(Math.min(100, calculatedProgress).toString());
|
|
6880
|
+
}
|
|
6881
|
+
setHasChanges(true);
|
|
6882
|
+
};
|
|
6883
|
+
const handleSave = () => {
|
|
6884
|
+
if (!supplier || !week || !onProgressUpdate) return;
|
|
6885
|
+
const newProgress = Math.min(100, Math.max(0, parseFloat(progressValue) || 0));
|
|
6886
|
+
const newProduced = parseFloat(producedValue) || 0;
|
|
6887
|
+
const weekKey = `${week.year}-W${week.weekNumber.toString().padStart(2, "0")}`;
|
|
6888
|
+
onProgressUpdate(supplier.id, weekKey, newProgress, production ? newProduced : void 0);
|
|
6889
|
+
setHasChanges(false);
|
|
6890
|
+
};
|
|
6891
|
+
if (!supplier || !week || !data) {
|
|
6892
|
+
return null;
|
|
6893
|
+
}
|
|
6894
|
+
const productionProgress = parseFloat(progressValue) || 0;
|
|
6895
|
+
const productionStatus = production?.status ?? "on-time";
|
|
6896
|
+
return /* @__PURE__ */ jsxRuntime.jsx(Dialog, { open, onOpenChange, children: /* @__PURE__ */ jsxRuntime.jsxs(DialogContent, { className: "max-w-lg max-h-[80vh] overflow-y-auto", children: [
|
|
6897
|
+
/* @__PURE__ */ jsxRuntime.jsxs(DialogHeader, { children: [
|
|
6898
|
+
/* @__PURE__ */ jsxRuntime.jsxs(DialogTitle, { className: "flex items-center gap-2", children: [
|
|
6899
|
+
supplier.name,
|
|
6900
|
+
/* @__PURE__ */ jsxRuntime.jsx(Badge, { variant: "secondary", className: "text-xs font-normal", children: supplier.badgeType })
|
|
6901
|
+
] }),
|
|
6902
|
+
/* @__PURE__ */ jsxRuntime.jsxs(DialogDescription, { className: "flex items-center gap-2", children: [
|
|
6903
|
+
/* @__PURE__ */ jsxRuntime.jsx(lucideReact.Calendar, { className: "h-4 w-4" }),
|
|
6904
|
+
week.label,
|
|
6905
|
+
" \u2022 ",
|
|
6906
|
+
week.dateRange
|
|
6907
|
+
] })
|
|
6908
|
+
] }),
|
|
6909
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-4 mt-2", children: [
|
|
6910
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "text-sm text-muted-foreground", children: [
|
|
6911
|
+
"Scope: ",
|
|
6912
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-foreground", children: supplier.scope })
|
|
6913
|
+
] }),
|
|
6914
|
+
data.type !== "empty" && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
6915
|
+
/* @__PURE__ */ jsxRuntime.jsx(Separator, {}),
|
|
6916
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-3", children: [
|
|
6917
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-2", children: [
|
|
6918
|
+
/* @__PURE__ */ jsxRuntime.jsx(lucideReact.Factory, { className: "h-4 w-4 text-muted-foreground" }),
|
|
6919
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-sm font-medium", children: "Production Progress" }),
|
|
6920
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
6921
|
+
Badge,
|
|
6922
|
+
{
|
|
6923
|
+
variant: getStatusBadgeVariant(productionStatus),
|
|
6924
|
+
className: cn("text-xs ml-auto", getStatusBadgeClasses(productionStatus)),
|
|
6925
|
+
children: getStatusLabel(productionStatus)
|
|
6926
|
+
}
|
|
6927
|
+
)
|
|
6928
|
+
] }),
|
|
6929
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-1.5", children: [
|
|
6930
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex justify-between text-xs text-muted-foreground", children: [
|
|
6931
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { children: "Progress" }),
|
|
6932
|
+
/* @__PURE__ */ jsxRuntime.jsxs("span", { children: [
|
|
6933
|
+
Math.round(productionProgress),
|
|
6934
|
+
"%"
|
|
6935
|
+
] })
|
|
6936
|
+
] }),
|
|
6937
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "w-full h-2 bg-muted rounded-full overflow-hidden", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
6938
|
+
"div",
|
|
6939
|
+
{
|
|
6940
|
+
className: cn(
|
|
6941
|
+
"h-full rounded-full transition-all",
|
|
6942
|
+
productionStatus === "critical" ? "bg-red-500" : productionStatus === "delayed" ? "bg-amber-500" : "bg-green-500"
|
|
6943
|
+
),
|
|
6944
|
+
style: { width: `${productionProgress}%` }
|
|
6945
|
+
}
|
|
6946
|
+
) })
|
|
6947
|
+
] }),
|
|
6948
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: cn(
|
|
6949
|
+
"p-3 rounded-lg border bg-card space-y-3"
|
|
6950
|
+
), children: [
|
|
6951
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "text-xs font-medium text-muted-foreground uppercase tracking-wide", children: "Update Progress" }),
|
|
6952
|
+
production ? (
|
|
6953
|
+
// If we have production data, show produced amount input
|
|
6954
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "grid gap-3", children: [
|
|
6955
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-1.5", children: [
|
|
6956
|
+
/* @__PURE__ */ jsxRuntime.jsxs(Label2, { htmlFor: "produced", className: "text-xs", children: [
|
|
6957
|
+
"Produced (",
|
|
6958
|
+
formatProductionUnit(production.unit),
|
|
6959
|
+
")"
|
|
6960
|
+
] }),
|
|
6961
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-2", children: [
|
|
6962
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
6963
|
+
Input,
|
|
6964
|
+
{
|
|
6965
|
+
id: "produced",
|
|
6966
|
+
type: "number",
|
|
6967
|
+
min: "0",
|
|
6968
|
+
max: production.target,
|
|
6969
|
+
value: producedValue,
|
|
6970
|
+
onChange: handleProducedChange,
|
|
6971
|
+
className: "h-8 text-sm"
|
|
6972
|
+
}
|
|
6973
|
+
),
|
|
6974
|
+
/* @__PURE__ */ jsxRuntime.jsxs("span", { className: "text-sm text-muted-foreground whitespace-nowrap", children: [
|
|
6975
|
+
"/ ",
|
|
6976
|
+
production.target,
|
|
6977
|
+
" ",
|
|
6978
|
+
formatProductionUnit(production.unit)
|
|
6979
|
+
] })
|
|
6980
|
+
] })
|
|
6981
|
+
] }),
|
|
6982
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-1.5", children: [
|
|
6983
|
+
/* @__PURE__ */ jsxRuntime.jsx(Label2, { htmlFor: "progress", className: "text-xs", children: "Progress (%)" }),
|
|
6984
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
6985
|
+
Input,
|
|
6986
|
+
{
|
|
6987
|
+
id: "progress",
|
|
6988
|
+
type: "number",
|
|
6989
|
+
min: "0",
|
|
6990
|
+
max: "100",
|
|
6991
|
+
value: progressValue,
|
|
6992
|
+
onChange: handleProgressChange,
|
|
6993
|
+
className: "h-8 text-sm"
|
|
6994
|
+
}
|
|
6995
|
+
)
|
|
6996
|
+
] })
|
|
6997
|
+
] })
|
|
6998
|
+
) : (
|
|
6999
|
+
// Simple progress input if no production data
|
|
7000
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-1.5", children: [
|
|
7001
|
+
/* @__PURE__ */ jsxRuntime.jsx(Label2, { htmlFor: "progress", className: "text-xs", children: "Progress (%)" }),
|
|
7002
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
7003
|
+
Input,
|
|
7004
|
+
{
|
|
7005
|
+
id: "progress",
|
|
7006
|
+
type: "number",
|
|
7007
|
+
min: "0",
|
|
7008
|
+
max: "100",
|
|
7009
|
+
value: progressValue,
|
|
7010
|
+
onChange: handleProgressChange,
|
|
7011
|
+
className: "h-8 text-sm"
|
|
7012
|
+
}
|
|
7013
|
+
)
|
|
7014
|
+
] })
|
|
7015
|
+
),
|
|
7016
|
+
onProgressUpdate && /* @__PURE__ */ jsxRuntime.jsx(
|
|
7017
|
+
Button,
|
|
7018
|
+
{
|
|
7019
|
+
size: "sm",
|
|
7020
|
+
className: "w-full",
|
|
7021
|
+
disabled: !hasChanges,
|
|
7022
|
+
onClick: handleSave,
|
|
7023
|
+
children: hasChanges ? "Save Progress" : "No Changes"
|
|
7024
|
+
}
|
|
7025
|
+
)
|
|
7026
|
+
] }),
|
|
7027
|
+
production && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center justify-between p-3 rounded-lg border bg-muted/30", children: [
|
|
7028
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-2", children: [
|
|
7029
|
+
/* @__PURE__ */ jsxRuntime.jsx(lucideReact.Package, { className: "h-4 w-4 text-muted-foreground" }),
|
|
7030
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-sm", children: "Target" })
|
|
7031
|
+
] }),
|
|
7032
|
+
/* @__PURE__ */ jsxRuntime.jsxs("span", { className: "text-sm font-medium", children: [
|
|
7033
|
+
production.target,
|
|
7034
|
+
" ",
|
|
7035
|
+
formatProductionUnit(production.unit)
|
|
7036
|
+
] })
|
|
7037
|
+
] })
|
|
7038
|
+
] })
|
|
7039
|
+
] }),
|
|
7040
|
+
data.deliveries && data.deliveries.length > 0 && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
7041
|
+
/* @__PURE__ */ jsxRuntime.jsx(Separator, {}),
|
|
7042
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-3", children: [
|
|
7043
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-2", children: [
|
|
7044
|
+
/* @__PURE__ */ jsxRuntime.jsx(lucideReact.Truck, { className: "h-4 w-4 text-muted-foreground" }),
|
|
7045
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-sm font-medium", children: "Deliveries" }),
|
|
7046
|
+
/* @__PURE__ */ jsxRuntime.jsxs("span", { className: "text-xs text-muted-foreground ml-auto", children: [
|
|
7047
|
+
data.deliveries.length,
|
|
7048
|
+
" scheduled"
|
|
7049
|
+
] })
|
|
7050
|
+
] }),
|
|
7051
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "space-y-2", children: data.deliveries.map((delivery, index) => /* @__PURE__ */ jsxRuntime.jsx(DeliveryCard, { delivery, index }, delivery.id)) })
|
|
7052
|
+
] })
|
|
7053
|
+
] }),
|
|
7054
|
+
data.type === "no-logistics" && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
7055
|
+
/* @__PURE__ */ jsxRuntime.jsx(Separator, {}),
|
|
7056
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-2 text-muted-foreground p-3 bg-muted/50 rounded-lg", children: [
|
|
7057
|
+
/* @__PURE__ */ jsxRuntime.jsx(lucideReact.Truck, { className: "h-4 w-4" }),
|
|
7058
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-sm", children: "No logistics scheduled for this week" })
|
|
7059
|
+
] })
|
|
7060
|
+
] }),
|
|
7061
|
+
data.hasWarning && data.warningMessage && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
7062
|
+
/* @__PURE__ */ jsxRuntime.jsx(Separator, {}),
|
|
7063
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-start gap-2 rounded-lg bg-amber-50 dark:bg-amber-950/50 p-3 text-amber-700 dark:text-amber-300", children: [
|
|
7064
|
+
/* @__PURE__ */ jsxRuntime.jsx(lucideReact.AlertTriangle, { className: "h-4 w-4 mt-0.5 shrink-0" }),
|
|
7065
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "text-sm", children: data.warningMessage })
|
|
7066
|
+
] })
|
|
7067
|
+
] }),
|
|
7068
|
+
data.notes && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
7069
|
+
/* @__PURE__ */ jsxRuntime.jsx(Separator, {}),
|
|
7070
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-1.5", children: [
|
|
7071
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-xs text-muted-foreground", children: "Notes" }),
|
|
7072
|
+
/* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-sm", children: data.notes })
|
|
7073
|
+
] })
|
|
7074
|
+
] })
|
|
7075
|
+
] })
|
|
7076
|
+
] }) });
|
|
7077
|
+
}
|
|
5900
7078
|
|
|
5901
7079
|
// src/components/event-calendar/types.ts
|
|
5902
7080
|
var DEFAULT_WORKING_HOURS = {
|
|
@@ -5960,7 +7138,7 @@ var BADGE_VARIANT_LABELS = {
|
|
|
5960
7138
|
colored: "Colored",
|
|
5961
7139
|
mixed: "Mixed"
|
|
5962
7140
|
};
|
|
5963
|
-
var CalendarContext =
|
|
7141
|
+
var CalendarContext = React17__namespace.createContext(null);
|
|
5964
7142
|
function EventCalendarProvider({
|
|
5965
7143
|
children,
|
|
5966
7144
|
events: initialEvents = [],
|
|
@@ -5975,38 +7153,38 @@ function EventCalendarProvider({
|
|
|
5975
7153
|
onEventUpdate,
|
|
5976
7154
|
onEventDelete
|
|
5977
7155
|
}) {
|
|
5978
|
-
const [selectedDate, setSelectedDate] =
|
|
5979
|
-
const [selectedUserId, setSelectedUserId] =
|
|
5980
|
-
const [events, setEventsState] =
|
|
5981
|
-
const [users] =
|
|
5982
|
-
const [badgeVariant, setBadgeVariant] =
|
|
5983
|
-
const [view, setView] =
|
|
5984
|
-
const [workingHours, setWorkingHours] =
|
|
5985
|
-
const [visibleHours, setVisibleHours] =
|
|
5986
|
-
|
|
7156
|
+
const [selectedDate, setSelectedDate] = React17__namespace.useState(defaultDate);
|
|
7157
|
+
const [selectedUserId, setSelectedUserId] = React17__namespace.useState(defaultUserId);
|
|
7158
|
+
const [events, setEventsState] = React17__namespace.useState(initialEvents);
|
|
7159
|
+
const [users] = React17__namespace.useState(initialUsers);
|
|
7160
|
+
const [badgeVariant, setBadgeVariant] = React17__namespace.useState(defaultBadgeVariant);
|
|
7161
|
+
const [view, setView] = React17__namespace.useState(defaultView);
|
|
7162
|
+
const [workingHours, setWorkingHours] = React17__namespace.useState(defaultWorkingHours);
|
|
7163
|
+
const [visibleHours, setVisibleHours] = React17__namespace.useState(defaultVisibleHours);
|
|
7164
|
+
React17__namespace.useEffect(() => {
|
|
5987
7165
|
setEventsState(initialEvents);
|
|
5988
7166
|
}, [initialEvents]);
|
|
5989
|
-
const setEvents =
|
|
7167
|
+
const setEvents = React17__namespace.useCallback((newEvents) => {
|
|
5990
7168
|
setEventsState(newEvents);
|
|
5991
7169
|
}, []);
|
|
5992
|
-
const addEvent =
|
|
7170
|
+
const addEvent = React17__namespace.useCallback((event) => {
|
|
5993
7171
|
setEventsState((prev) => [...prev, event]);
|
|
5994
7172
|
onEventAdd?.(event);
|
|
5995
7173
|
}, [onEventAdd]);
|
|
5996
|
-
const updateEvent =
|
|
7174
|
+
const updateEvent = React17__namespace.useCallback((event) => {
|
|
5997
7175
|
setEventsState(
|
|
5998
7176
|
(prev) => prev.map((e) => e.id === event.id ? event : e)
|
|
5999
7177
|
);
|
|
6000
7178
|
onEventUpdate?.(event);
|
|
6001
7179
|
}, [onEventUpdate]);
|
|
6002
|
-
const deleteEvent =
|
|
7180
|
+
const deleteEvent = React17__namespace.useCallback((eventId) => {
|
|
6003
7181
|
setEventsState((prev) => prev.filter((e) => e.id !== eventId));
|
|
6004
7182
|
onEventDelete?.(eventId);
|
|
6005
7183
|
}, [onEventDelete]);
|
|
6006
|
-
const goToToday =
|
|
7184
|
+
const goToToday = React17__namespace.useCallback(() => {
|
|
6007
7185
|
setSelectedDate(/* @__PURE__ */ new Date());
|
|
6008
7186
|
}, []);
|
|
6009
|
-
const goToPrevious =
|
|
7187
|
+
const goToPrevious = React17__namespace.useCallback(() => {
|
|
6010
7188
|
setSelectedDate((current) => {
|
|
6011
7189
|
switch (view) {
|
|
6012
7190
|
case "day":
|
|
@@ -6024,7 +7202,7 @@ function EventCalendarProvider({
|
|
|
6024
7202
|
}
|
|
6025
7203
|
});
|
|
6026
7204
|
}, [view]);
|
|
6027
|
-
const goToNext =
|
|
7205
|
+
const goToNext = React17__namespace.useCallback(() => {
|
|
6028
7206
|
setSelectedDate((current) => {
|
|
6029
7207
|
switch (view) {
|
|
6030
7208
|
case "day":
|
|
@@ -6042,7 +7220,7 @@ function EventCalendarProvider({
|
|
|
6042
7220
|
}
|
|
6043
7221
|
});
|
|
6044
7222
|
}, [view]);
|
|
6045
|
-
const contextValue =
|
|
7223
|
+
const contextValue = React17__namespace.useMemo(
|
|
6046
7224
|
() => ({
|
|
6047
7225
|
// State
|
|
6048
7226
|
selectedDate,
|
|
@@ -6089,7 +7267,7 @@ function EventCalendarProvider({
|
|
|
6089
7267
|
return /* @__PURE__ */ jsxRuntime.jsx(CalendarContext.Provider, { value: contextValue, children });
|
|
6090
7268
|
}
|
|
6091
7269
|
function useEventCalendar() {
|
|
6092
|
-
const context =
|
|
7270
|
+
const context = React17__namespace.useContext(CalendarContext);
|
|
6093
7271
|
if (!context) {
|
|
6094
7272
|
throw new Error("useEventCalendar must be used within an EventCalendarProvider");
|
|
6095
7273
|
}
|
|
@@ -6097,14 +7275,14 @@ function useEventCalendar() {
|
|
|
6097
7275
|
}
|
|
6098
7276
|
function useFilteredEvents() {
|
|
6099
7277
|
const { events, selectedUserId } = useEventCalendar();
|
|
6100
|
-
return
|
|
7278
|
+
return React17__namespace.useMemo(() => {
|
|
6101
7279
|
if (!selectedUserId) return events;
|
|
6102
7280
|
return events.filter((event) => event.user.id === selectedUserId);
|
|
6103
7281
|
}, [events, selectedUserId]);
|
|
6104
7282
|
}
|
|
6105
7283
|
function useEventsInRange(startDate, endDate) {
|
|
6106
7284
|
const filteredEvents = useFilteredEvents();
|
|
6107
|
-
return
|
|
7285
|
+
return React17__namespace.useMemo(() => {
|
|
6108
7286
|
return filteredEvents.filter((event) => {
|
|
6109
7287
|
const eventStart = new Date(event.startDate);
|
|
6110
7288
|
const eventEnd = new Date(event.endDate);
|
|
@@ -6478,7 +7656,7 @@ function getViewDateRange(date, view) {
|
|
|
6478
7656
|
return { start: dateFns.startOfMonth(date), end: dateFns.endOfMonth(date) };
|
|
6479
7657
|
}
|
|
6480
7658
|
}
|
|
6481
|
-
function
|
|
7659
|
+
function formatDateRange2(start, end) {
|
|
6482
7660
|
if (dateFns.isSameDay(start, end)) {
|
|
6483
7661
|
return dateFns.format(start, "MMM d, yyyy");
|
|
6484
7662
|
}
|
|
@@ -6662,8 +7840,8 @@ function MoreEvents({ count, onClick, className }) {
|
|
|
6662
7840
|
);
|
|
6663
7841
|
}
|
|
6664
7842
|
function TimeIndicator({ className }) {
|
|
6665
|
-
const [now, setNow] =
|
|
6666
|
-
|
|
7843
|
+
const [now, setNow] = React17__namespace.useState(/* @__PURE__ */ new Date());
|
|
7844
|
+
React17__namespace.useEffect(() => {
|
|
6667
7845
|
const interval = setInterval(() => setNow(/* @__PURE__ */ new Date()), 6e4);
|
|
6668
7846
|
return () => clearInterval(interval);
|
|
6669
7847
|
}, []);
|
|
@@ -6700,24 +7878,24 @@ function DateBadge({ date, className }) {
|
|
|
6700
7878
|
}
|
|
6701
7879
|
);
|
|
6702
7880
|
}
|
|
6703
|
-
var DragContext =
|
|
7881
|
+
var DragContext = React17__namespace.createContext(null);
|
|
6704
7882
|
function DragProvider({
|
|
6705
7883
|
children,
|
|
6706
7884
|
snapMinutes = 15,
|
|
6707
7885
|
onDragStart,
|
|
6708
7886
|
onDragEnd
|
|
6709
7887
|
}) {
|
|
6710
|
-
const [draggedEvent, setDraggedEventState] =
|
|
6711
|
-
const [isDragging, setIsDragging] =
|
|
7888
|
+
const [draggedEvent, setDraggedEventState] = React17__namespace.useState(null);
|
|
7889
|
+
const [isDragging, setIsDragging] = React17__namespace.useState(false);
|
|
6712
7890
|
const { updateEvent } = useEventCalendar();
|
|
6713
|
-
const setDraggedEvent =
|
|
7891
|
+
const setDraggedEvent = React17__namespace.useCallback((event) => {
|
|
6714
7892
|
setDraggedEventState(event);
|
|
6715
7893
|
setIsDragging(!!event);
|
|
6716
7894
|
if (event) {
|
|
6717
7895
|
onDragStart?.(event);
|
|
6718
7896
|
}
|
|
6719
7897
|
}, [onDragStart]);
|
|
6720
|
-
const handleDrop =
|
|
7898
|
+
const handleDrop = React17__namespace.useCallback((newStartDate) => {
|
|
6721
7899
|
if (!draggedEvent) return;
|
|
6722
7900
|
const snappedDate = snapToInterval(newStartDate, snapMinutes);
|
|
6723
7901
|
const { startDate, endDate } = calculateDropDates(draggedEvent, snappedDate);
|
|
@@ -6730,7 +7908,7 @@ function DragProvider({
|
|
|
6730
7908
|
onDragEnd?.(updatedEvent, new Date(startDate), new Date(endDate));
|
|
6731
7909
|
setDraggedEvent(null);
|
|
6732
7910
|
}, [draggedEvent, snapMinutes, updateEvent, onDragEnd, setDraggedEvent]);
|
|
6733
|
-
const contextValue =
|
|
7911
|
+
const contextValue = React17__namespace.useMemo(
|
|
6734
7912
|
() => ({
|
|
6735
7913
|
draggedEvent,
|
|
6736
7914
|
setDraggedEvent,
|
|
@@ -6741,7 +7919,7 @@ function DragProvider({
|
|
|
6741
7919
|
return /* @__PURE__ */ jsxRuntime.jsx(DragContext.Provider, { value: contextValue, children: /* @__PURE__ */ jsxRuntime.jsx(DragDropHandler, { onDrop: handleDrop, children }) });
|
|
6742
7920
|
}
|
|
6743
7921
|
function useDrag() {
|
|
6744
|
-
const context =
|
|
7922
|
+
const context = React17__namespace.useContext(DragContext);
|
|
6745
7923
|
if (!context) {
|
|
6746
7924
|
throw new Error("useDrag must be used within a DragProvider");
|
|
6747
7925
|
}
|
|
@@ -6786,7 +7964,7 @@ function DroppableZone({
|
|
|
6786
7964
|
}) {
|
|
6787
7965
|
const { draggedEvent, setDraggedEvent } = useDrag();
|
|
6788
7966
|
const { updateEvent } = useEventCalendar();
|
|
6789
|
-
const [isOver, setIsOver] =
|
|
7967
|
+
const [isOver, setIsOver] = React17__namespace.useState(false);
|
|
6790
7968
|
const handleDragOver = (e) => {
|
|
6791
7969
|
e.preventDefault();
|
|
6792
7970
|
e.dataTransfer.dropEffect = "move";
|
|
@@ -6824,23 +8002,23 @@ function DroppableZone({
|
|
|
6824
8002
|
function useDroppable({ date, hour, minute = 0, onDrop }) {
|
|
6825
8003
|
const { draggedEvent, setDraggedEvent } = useDrag();
|
|
6826
8004
|
const { updateEvent } = useEventCalendar();
|
|
6827
|
-
const [isOver, setIsOver] =
|
|
6828
|
-
const dropTargetDate =
|
|
8005
|
+
const [isOver, setIsOver] = React17__namespace.useState(false);
|
|
8006
|
+
const dropTargetDate = React17__namespace.useMemo(() => {
|
|
6829
8007
|
const targetDate = new Date(date);
|
|
6830
8008
|
if (hour !== void 0) {
|
|
6831
8009
|
targetDate.setHours(hour, minute, 0, 0);
|
|
6832
8010
|
}
|
|
6833
8011
|
return targetDate;
|
|
6834
8012
|
}, [date, hour, minute]);
|
|
6835
|
-
const handleDragOver =
|
|
8013
|
+
const handleDragOver = React17__namespace.useCallback((e) => {
|
|
6836
8014
|
e.preventDefault();
|
|
6837
8015
|
e.dataTransfer.dropEffect = "move";
|
|
6838
8016
|
if (!isOver) setIsOver(true);
|
|
6839
8017
|
}, [isOver]);
|
|
6840
|
-
const handleDragLeave =
|
|
8018
|
+
const handleDragLeave = React17__namespace.useCallback(() => {
|
|
6841
8019
|
setIsOver(false);
|
|
6842
8020
|
}, []);
|
|
6843
|
-
const handleDrop =
|
|
8021
|
+
const handleDrop = React17__namespace.useCallback((e) => {
|
|
6844
8022
|
e.preventDefault();
|
|
6845
8023
|
setIsOver(false);
|
|
6846
8024
|
if (!draggedEvent) return;
|
|
@@ -6867,13 +8045,13 @@ function useDroppable({ date, hour, minute = 0, onDrop }) {
|
|
|
6867
8045
|
function useDraggable(event, disabled = false) {
|
|
6868
8046
|
const { setDraggedEvent, draggedEvent } = useDrag();
|
|
6869
8047
|
const isDragged = draggedEvent?.id === event.id;
|
|
6870
|
-
const handleDragStart =
|
|
8048
|
+
const handleDragStart = React17__namespace.useCallback((e) => {
|
|
6871
8049
|
if (disabled) return;
|
|
6872
8050
|
e.dataTransfer.effectAllowed = "move";
|
|
6873
8051
|
e.dataTransfer.setData("text/plain", event.id);
|
|
6874
8052
|
setDraggedEvent(event);
|
|
6875
8053
|
}, [disabled, event, setDraggedEvent]);
|
|
6876
|
-
const handleDragEnd =
|
|
8054
|
+
const handleDragEnd = React17__namespace.useCallback(() => {
|
|
6877
8055
|
setDraggedEvent(null);
|
|
6878
8056
|
}, [setDraggedEvent]);
|
|
6879
8057
|
return {
|
|
@@ -6914,15 +8092,15 @@ function MonthView({
|
|
|
6914
8092
|
}) {
|
|
6915
8093
|
const { selectedDate, badgeVariant, setSelectedDate, setView } = useEventCalendar();
|
|
6916
8094
|
const filteredEvents = useFilteredEvents();
|
|
6917
|
-
const { singleDayEvents, multiDayEvents } =
|
|
8095
|
+
const { singleDayEvents, multiDayEvents } = React17__namespace.useMemo(
|
|
6918
8096
|
() => splitEventsByDuration(filteredEvents),
|
|
6919
8097
|
[filteredEvents]
|
|
6920
8098
|
);
|
|
6921
|
-
const cells =
|
|
8099
|
+
const cells = React17__namespace.useMemo(
|
|
6922
8100
|
() => getCalendarCells(selectedDate),
|
|
6923
8101
|
[selectedDate]
|
|
6924
8102
|
);
|
|
6925
|
-
const eventPositions =
|
|
8103
|
+
const eventPositions = React17__namespace.useMemo(
|
|
6926
8104
|
() => calculateMonthEventPositions(multiDayEvents, singleDayEvents, selectedDate),
|
|
6927
8105
|
[multiDayEvents, singleDayEvents, selectedDate]
|
|
6928
8106
|
);
|
|
@@ -7104,7 +8282,7 @@ function WeekView({
|
|
|
7104
8282
|
visibleHours
|
|
7105
8283
|
} = useEventCalendar();
|
|
7106
8284
|
const filteredEvents = useFilteredEvents();
|
|
7107
|
-
const { singleDayEvents, multiDayEvents } =
|
|
8285
|
+
const { singleDayEvents, multiDayEvents } = React17__namespace.useMemo(
|
|
7108
8286
|
() => splitEventsByDuration(filteredEvents),
|
|
7109
8287
|
[filteredEvents]
|
|
7110
8288
|
);
|
|
@@ -7310,8 +8488,8 @@ function CalendarTimeline({
|
|
|
7310
8488
|
firstVisibleHour,
|
|
7311
8489
|
lastVisibleHour
|
|
7312
8490
|
}) {
|
|
7313
|
-
const [currentTime, setCurrentTime] =
|
|
7314
|
-
|
|
8491
|
+
const [currentTime, setCurrentTime] = React17__namespace.useState(/* @__PURE__ */ new Date());
|
|
8492
|
+
React17__namespace.useEffect(() => {
|
|
7315
8493
|
const interval = setInterval(() => {
|
|
7316
8494
|
setCurrentTime(/* @__PURE__ */ new Date());
|
|
7317
8495
|
}, 6e4);
|
|
@@ -7394,7 +8572,7 @@ function DayView({
|
|
|
7394
8572
|
visibleHours
|
|
7395
8573
|
} = useEventCalendar();
|
|
7396
8574
|
const filteredEvents = useFilteredEvents();
|
|
7397
|
-
const { singleDayEvents, multiDayEvents } =
|
|
8575
|
+
const { singleDayEvents, multiDayEvents } = React17__namespace.useMemo(
|
|
7398
8576
|
() => splitEventsByDuration(filteredEvents),
|
|
7399
8577
|
[filteredEvents]
|
|
7400
8578
|
);
|
|
@@ -7402,7 +8580,7 @@ function DayView({
|
|
|
7402
8580
|
visibleHours,
|
|
7403
8581
|
singleDayEvents
|
|
7404
8582
|
);
|
|
7405
|
-
const currentEvents =
|
|
8583
|
+
const currentEvents = React17__namespace.useMemo(() => {
|
|
7406
8584
|
if (!dateFns.isToday(selectedDate)) return [];
|
|
7407
8585
|
return getCurrentEvents(singleDayEvents);
|
|
7408
8586
|
}, [singleDayEvents, selectedDate]);
|
|
@@ -7626,8 +8804,8 @@ function CalendarTimeline2({
|
|
|
7626
8804
|
firstVisibleHour,
|
|
7627
8805
|
lastVisibleHour
|
|
7628
8806
|
}) {
|
|
7629
|
-
const [currentTime, setCurrentTime] =
|
|
7630
|
-
|
|
8807
|
+
const [currentTime, setCurrentTime] = React17__namespace.useState(/* @__PURE__ */ new Date());
|
|
8808
|
+
React17__namespace.useEffect(() => {
|
|
7631
8809
|
const interval = setInterval(() => {
|
|
7632
8810
|
setCurrentTime(/* @__PURE__ */ new Date());
|
|
7633
8811
|
}, 6e4);
|
|
@@ -7661,7 +8839,7 @@ function YearView({
|
|
|
7661
8839
|
}) {
|
|
7662
8840
|
const { selectedDate, setSelectedDate, setView } = useEventCalendar();
|
|
7663
8841
|
const filteredEvents = useFilteredEvents();
|
|
7664
|
-
const months =
|
|
8842
|
+
const months = React17__namespace.useMemo(() => {
|
|
7665
8843
|
const yearStart = dateFns.startOfYear(selectedDate);
|
|
7666
8844
|
return Array.from({ length: 12 }, (_, i) => dateFns.addMonths(yearStart, i));
|
|
7667
8845
|
}, [selectedDate]);
|
|
@@ -7784,11 +8962,11 @@ function AgendaView({
|
|
|
7784
8962
|
}) {
|
|
7785
8963
|
const { selectedDate, setSelectedDate, setView } = useEventCalendar();
|
|
7786
8964
|
const filteredEvents = useFilteredEvents();
|
|
7787
|
-
const { singleDayEvents, multiDayEvents } =
|
|
8965
|
+
const { singleDayEvents, multiDayEvents } = React17__namespace.useMemo(
|
|
7788
8966
|
() => splitEventsByDuration(filteredEvents),
|
|
7789
8967
|
[filteredEvents]
|
|
7790
8968
|
);
|
|
7791
|
-
const eventsByDay =
|
|
8969
|
+
const eventsByDay = React17__namespace.useMemo(() => {
|
|
7792
8970
|
const allDates = /* @__PURE__ */ new Map();
|
|
7793
8971
|
singleDayEvents.forEach((event) => {
|
|
7794
8972
|
const eventDate = dateFns.parseISO(event.startDate);
|
|
@@ -7981,7 +9159,7 @@ function CalendarHeader({
|
|
|
7981
9159
|
const filteredEvents = useFilteredEvents();
|
|
7982
9160
|
const eventCount = filteredEvents.length;
|
|
7983
9161
|
const { start: rangeStart, end: rangeEnd } = getViewDateRange(selectedDate, view);
|
|
7984
|
-
const dateRangeLabel =
|
|
9162
|
+
const dateRangeLabel = formatDateRange2(rangeStart, rangeEnd);
|
|
7985
9163
|
const getInitials = (name) => {
|
|
7986
9164
|
return name.split(" ").map((n) => n[0]).join("").toUpperCase().slice(0, 2);
|
|
7987
9165
|
};
|
|
@@ -8253,16 +9431,16 @@ function EventDialog({
|
|
|
8253
9431
|
defaultUserId
|
|
8254
9432
|
}) {
|
|
8255
9433
|
const { addEvent, updateEvent, deleteEvent, users } = useEventCalendar();
|
|
8256
|
-
const [title, setTitle] =
|
|
8257
|
-
const [description, setDescription] =
|
|
8258
|
-
const [startDate, setStartDate] =
|
|
8259
|
-
const [startTime, setStartTime] =
|
|
8260
|
-
const [endDate, setEndDate] =
|
|
8261
|
-
const [endTime, setEndTime] =
|
|
8262
|
-
const [color, setColor] =
|
|
8263
|
-
const [userId, setUserId] =
|
|
8264
|
-
const [isSubmitting, setIsSubmitting] =
|
|
8265
|
-
|
|
9434
|
+
const [title, setTitle] = React17__namespace.useState("");
|
|
9435
|
+
const [description, setDescription] = React17__namespace.useState("");
|
|
9436
|
+
const [startDate, setStartDate] = React17__namespace.useState("");
|
|
9437
|
+
const [startTime, setStartTime] = React17__namespace.useState("");
|
|
9438
|
+
const [endDate, setEndDate] = React17__namespace.useState("");
|
|
9439
|
+
const [endTime, setEndTime] = React17__namespace.useState("");
|
|
9440
|
+
const [color, setColor] = React17__namespace.useState("blue");
|
|
9441
|
+
const [userId, setUserId] = React17__namespace.useState("");
|
|
9442
|
+
const [isSubmitting, setIsSubmitting] = React17__namespace.useState(false);
|
|
9443
|
+
React17__namespace.useEffect(() => {
|
|
8266
9444
|
if (open) {
|
|
8267
9445
|
if (mode === "edit" && event) {
|
|
8268
9446
|
const start = dateFns.parseISO(event.startDate);
|
|
@@ -8485,7 +9663,7 @@ function QuickAddEvent({
|
|
|
8485
9663
|
onOpenDialog,
|
|
8486
9664
|
onClose
|
|
8487
9665
|
}) {
|
|
8488
|
-
const [title, setTitle] =
|
|
9666
|
+
const [title, setTitle] = React17__namespace.useState("");
|
|
8489
9667
|
const { users } = useEventCalendar();
|
|
8490
9668
|
const handleSubmit = (e) => {
|
|
8491
9669
|
e.preventDefault();
|
|
@@ -8552,8 +9730,8 @@ var HOUR_OPTIONS = Array.from({ length: 25 }, (_, i) => {
|
|
|
8552
9730
|
});
|
|
8553
9731
|
function ChangeVisibleHoursInput() {
|
|
8554
9732
|
const { visibleHours, setVisibleHours } = useEventCalendar();
|
|
8555
|
-
const [from, setFrom] =
|
|
8556
|
-
const [to, setTo] =
|
|
9733
|
+
const [from, setFrom] = React17__namespace.useState(visibleHours.from);
|
|
9734
|
+
const [to, setTo] = React17__namespace.useState(visibleHours.to);
|
|
8557
9735
|
const handleApply = () => {
|
|
8558
9736
|
const toHour = to === 0 ? 24 : to;
|
|
8559
9737
|
setVisibleHours({ from, to: toHour });
|
|
@@ -8599,7 +9777,7 @@ var HOUR_OPTIONS2 = Array.from({ length: 25 }, (_, i) => {
|
|
|
8599
9777
|
});
|
|
8600
9778
|
function ChangeWorkingHoursInput() {
|
|
8601
9779
|
const { workingHours, setWorkingHours } = useEventCalendar();
|
|
8602
|
-
const [localWorkingHours, setLocalWorkingHours] =
|
|
9780
|
+
const [localWorkingHours, setLocalWorkingHours] = React17__namespace.useState({
|
|
8603
9781
|
...workingHours
|
|
8604
9782
|
});
|
|
8605
9783
|
const handleToggleDay = (dayId) => {
|
|
@@ -8748,8 +9926,8 @@ function CalendarSettingsButton({
|
|
|
8748
9926
|
);
|
|
8749
9927
|
}
|
|
8750
9928
|
function useMediaQuery(query) {
|
|
8751
|
-
const [matches, setMatches] =
|
|
8752
|
-
|
|
9929
|
+
const [matches, setMatches] = React17__namespace.useState(false);
|
|
9930
|
+
React17__namespace.useEffect(() => {
|
|
8753
9931
|
const media = window.matchMedia(query);
|
|
8754
9932
|
setMatches(media.matches);
|
|
8755
9933
|
const listener = (event) => {
|
|
@@ -8801,11 +9979,11 @@ function BigCalendarInner({
|
|
|
8801
9979
|
maxEventsPerDay
|
|
8802
9980
|
}) {
|
|
8803
9981
|
const { view, setView } = useEventCalendar();
|
|
8804
|
-
const [dialogOpen, setDialogOpen] =
|
|
8805
|
-
const [settingsDialogOpen, setSettingsDialogOpen] =
|
|
8806
|
-
const [selectedEvent, setSelectedEvent] =
|
|
8807
|
-
const [dialogMode, setDialogMode] =
|
|
8808
|
-
const [defaultDate, setDefaultDate] =
|
|
9982
|
+
const [dialogOpen, setDialogOpen] = React17__namespace.useState(false);
|
|
9983
|
+
const [settingsDialogOpen, setSettingsDialogOpen] = React17__namespace.useState(false);
|
|
9984
|
+
const [selectedEvent, setSelectedEvent] = React17__namespace.useState(null);
|
|
9985
|
+
const [dialogMode, setDialogMode] = React17__namespace.useState("add");
|
|
9986
|
+
const [defaultDate, setDefaultDate] = React17__namespace.useState(/* @__PURE__ */ new Date());
|
|
8809
9987
|
const isMobile = useMediaQuery("(max-width: 768px)");
|
|
8810
9988
|
const isCompact = compact === "auto" ? isMobile : compact;
|
|
8811
9989
|
const handleAddClick = () => {
|
|
@@ -8964,6 +10142,30 @@ function CalendarView({
|
|
|
8964
10142
|
}
|
|
8965
10143
|
}
|
|
8966
10144
|
|
|
10145
|
+
Object.defineProperty(exports, "flexRender", {
|
|
10146
|
+
enumerable: true,
|
|
10147
|
+
get: function () { return reactTable.flexRender; }
|
|
10148
|
+
});
|
|
10149
|
+
Object.defineProperty(exports, "getCoreRowModel", {
|
|
10150
|
+
enumerable: true,
|
|
10151
|
+
get: function () { return reactTable.getCoreRowModel; }
|
|
10152
|
+
});
|
|
10153
|
+
Object.defineProperty(exports, "getFilteredRowModel", {
|
|
10154
|
+
enumerable: true,
|
|
10155
|
+
get: function () { return reactTable.getFilteredRowModel; }
|
|
10156
|
+
});
|
|
10157
|
+
Object.defineProperty(exports, "getPaginationRowModel", {
|
|
10158
|
+
enumerable: true,
|
|
10159
|
+
get: function () { return reactTable.getPaginationRowModel; }
|
|
10160
|
+
});
|
|
10161
|
+
Object.defineProperty(exports, "getSortedRowModel", {
|
|
10162
|
+
enumerable: true,
|
|
10163
|
+
get: function () { return reactTable.getSortedRowModel; }
|
|
10164
|
+
});
|
|
10165
|
+
Object.defineProperty(exports, "useReactTable", {
|
|
10166
|
+
enumerable: true,
|
|
10167
|
+
get: function () { return reactTable.useReactTable; }
|
|
10168
|
+
});
|
|
8967
10169
|
Object.defineProperty(exports, "areIntervalsOverlapping", {
|
|
8968
10170
|
enumerable: true,
|
|
8969
10171
|
get: function () { return dateFns.areIntervalsOverlapping; }
|
|
@@ -9087,8 +10289,13 @@ exports.ContextMenuSubTrigger = ContextMenuSubTrigger;
|
|
|
9087
10289
|
exports.ContextMenuTrigger = ContextMenuTrigger;
|
|
9088
10290
|
exports.DEFAULT_VISIBLE_HOURS = DEFAULT_VISIBLE_HOURS;
|
|
9089
10291
|
exports.DEFAULT_WORKING_HOURS = DEFAULT_WORKING_HOURS;
|
|
10292
|
+
exports.DataTableColumnHeader = DataTableColumnHeader;
|
|
10293
|
+
exports.DataTablePagination = DataTablePagination;
|
|
10294
|
+
exports.DataTableViewOptions = DataTableViewOptions;
|
|
9090
10295
|
exports.DateBadge = DateBadge;
|
|
9091
10296
|
exports.DayView = DayView;
|
|
10297
|
+
exports.DeliveryIndicator = DeliveryIndicator;
|
|
10298
|
+
exports.DeliveryIndicators = DeliveryIndicators;
|
|
9092
10299
|
exports.Dialog = Dialog;
|
|
9093
10300
|
exports.DialogClose = DialogClose;
|
|
9094
10301
|
exports.DialogContent = DialogContent;
|
|
@@ -9218,6 +10425,8 @@ exports.PaginationItem = PaginationItem;
|
|
|
9218
10425
|
exports.PaginationLink = PaginationLink;
|
|
9219
10426
|
exports.PaginationNext = PaginationNext;
|
|
9220
10427
|
exports.PaginationPrevious = PaginationPrevious;
|
|
10428
|
+
exports.PlanningTable = PlanningTable;
|
|
10429
|
+
exports.PlanningTableToolbar = PlanningTableToolbar;
|
|
9221
10430
|
exports.PlayerCanvas = PlayerCanvas;
|
|
9222
10431
|
exports.PlayerCanvasActionButton = PlayerCanvasActionButton;
|
|
9223
10432
|
exports.PlayerCanvasControls = PlayerCanvasControls;
|
|
@@ -9296,6 +10505,7 @@ exports.SiteHeader = SiteHeader;
|
|
|
9296
10505
|
exports.Skeleton = Skeleton;
|
|
9297
10506
|
exports.Slider = Slider;
|
|
9298
10507
|
exports.Spinner = Spinner;
|
|
10508
|
+
exports.SupplierCell = SupplierCell;
|
|
9299
10509
|
exports.Switch = Switch;
|
|
9300
10510
|
exports.Table = Table;
|
|
9301
10511
|
exports.TableBody = TableBody;
|
|
@@ -9326,6 +10536,9 @@ exports.TooltipProvider = TooltipProvider;
|
|
|
9326
10536
|
exports.TooltipTrigger = TooltipTrigger;
|
|
9327
10537
|
exports.UserAvatarsDropdown = UserAvatarsDropdown;
|
|
9328
10538
|
exports.VIEW_LABELS = VIEW_LABELS;
|
|
10539
|
+
exports.WeekCell = WeekCell;
|
|
10540
|
+
exports.WeekDetailDialog = WeekDetailDialog;
|
|
10541
|
+
exports.WeekHeader = WeekHeader;
|
|
9329
10542
|
exports.WeekView = WeekView;
|
|
9330
10543
|
exports.YearView = YearView;
|
|
9331
10544
|
exports.badgeVariants = badgeVariants;
|
|
@@ -9335,9 +10548,14 @@ exports.calculateDropDates = calculateDropDates;
|
|
|
9335
10548
|
exports.calculateMonthEventPositions = calculateMonthEventPositions;
|
|
9336
10549
|
exports.cardVariants = cardVariants;
|
|
9337
10550
|
exports.createDefaultEvent = createDefaultEvent;
|
|
9338
|
-
exports.
|
|
10551
|
+
exports.deliveryIndicatorVariants = deliveryIndicatorVariants;
|
|
10552
|
+
exports.formatDateRange = formatDateRange2;
|
|
10553
|
+
exports.formatProductionUnit = formatProductionUnit;
|
|
9339
10554
|
exports.formatTime = formatTime;
|
|
10555
|
+
exports.generateColumns = generateColumns;
|
|
9340
10556
|
exports.generateEventId = generateEventId;
|
|
10557
|
+
exports.generateWeekColumns = generateWeekColumns;
|
|
10558
|
+
exports.generateWeeks = generateWeeks;
|
|
9341
10559
|
exports.getCalendarCells = getCalendarCells;
|
|
9342
10560
|
exports.getCurrentEvents = getCurrentEvents;
|
|
9343
10561
|
exports.getDayHours = getDayHours;
|
|
@@ -9348,14 +10566,17 @@ exports.getEventsCount = getEventsCount;
|
|
|
9348
10566
|
exports.getEventsForDate = getEventsForDate;
|
|
9349
10567
|
exports.getEventsInRange = getEventsInRange;
|
|
9350
10568
|
exports.getHeaderLabel = getHeaderLabel;
|
|
10569
|
+
exports.getISOWeek = getISOWeek;
|
|
9351
10570
|
exports.getMonthCellEvents = getMonthCellEvents;
|
|
9352
10571
|
exports.getMonthDays = getMonthDays;
|
|
10572
|
+
exports.getSupplierColumn = getSupplierColumn;
|
|
9353
10573
|
exports.getTimeHeight = getTimeHeight;
|
|
9354
10574
|
exports.getTimePosition = getTimePosition;
|
|
9355
10575
|
exports.getViewDateRange = getViewDateRange;
|
|
9356
10576
|
exports.getVisibleHours = getVisibleHours;
|
|
9357
10577
|
exports.getWeekDayNames = getWeekDayNames;
|
|
9358
10578
|
exports.getWeekDays = getWeekDays;
|
|
10579
|
+
exports.getWeekKey = getWeekKey;
|
|
9359
10580
|
exports.getYearMonths = getYearMonths;
|
|
9360
10581
|
exports.groupEvents = groupEvents;
|
|
9361
10582
|
exports.isMultiDayEvent = isMultiDayEvent;
|