randmarcomps 1.244.0 → 1.245.0
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/randmarcomps.d.ts +9 -2
- package/dist/randmarcomps.js +152 -147
- package/dist/randmarcomps.umd.cjs +1 -1
- package/package.json +1 -1
package/dist/randmarcomps.d.ts
CHANGED
|
@@ -412,7 +412,14 @@ declare interface IProps {
|
|
|
412
412
|
declare interface IProps_2 {
|
|
413
413
|
applicationId: string;
|
|
414
414
|
sku: string;
|
|
415
|
-
|
|
415
|
+
productDefaultOpportunityNumber?: string;
|
|
416
|
+
productOnAddToCart?: (state: {
|
|
417
|
+
quantity: number;
|
|
418
|
+
bidNumber: string | null;
|
|
419
|
+
}) => void;
|
|
420
|
+
productAddingToCart?: boolean;
|
|
421
|
+
productShopifyHostname?: string;
|
|
422
|
+
productCustomAction?: React.ReactNode;
|
|
416
423
|
}
|
|
417
424
|
|
|
418
425
|
export declare function Label({ className, ...props }: React_2.ComponentProps<typeof LabelPrimitive.Root>): JSX.Element;
|
|
@@ -582,7 +589,7 @@ declare interface ProductInventoryGridProps {
|
|
|
582
589
|
showBinLocation?: boolean;
|
|
583
590
|
}
|
|
584
591
|
|
|
585
|
-
export declare function ProductOverviewPage({ applicationId, sku,
|
|
592
|
+
export declare function ProductOverviewPage({ applicationId, sku, productDefaultOpportunityNumber, productOnAddToCart, productAddingToCart, productShopifyHostname, productCustomAction }: IProps_2): JSX.Element;
|
|
586
593
|
|
|
587
594
|
export declare const Progress: React_2.ForwardRefExoticComponent<Omit<ProgressPrimitive.ProgressProps & React_2.RefAttributes<HTMLDivElement>, "ref"> & React_2.RefAttributes<HTMLDivElement>>;
|
|
588
595
|
|
package/dist/randmarcomps.js
CHANGED
|
@@ -84420,17 +84420,21 @@ function ReceiptsTable({
|
|
|
84420
84420
|
function ProductOverviewPage({
|
|
84421
84421
|
applicationId: t,
|
|
84422
84422
|
sku: e,
|
|
84423
|
-
|
|
84423
|
+
productDefaultOpportunityNumber: n = "",
|
|
84424
|
+
productOnAddToCart: o,
|
|
84425
|
+
productAddingToCart: l = !1,
|
|
84426
|
+
productShopifyHostname: d,
|
|
84427
|
+
productCustomAction: f = /* @__PURE__ */ jsx(Fragment$1, {})
|
|
84424
84428
|
}) {
|
|
84425
84429
|
const {
|
|
84426
|
-
data:
|
|
84430
|
+
data: g
|
|
84427
84431
|
} = useGetV4PartnerByApplicationIdAccountQuery({
|
|
84428
84432
|
applicationId: t
|
|
84429
84433
|
}, {
|
|
84430
84434
|
skip: !t || !e
|
|
84431
84435
|
}), {
|
|
84432
|
-
data:
|
|
84433
|
-
isLoading:
|
|
84436
|
+
data: b,
|
|
84437
|
+
isLoading: S
|
|
84434
84438
|
} = useGetV4PartnerByRouteApplicationIdProductAndRandmarSkuQuery({
|
|
84435
84439
|
routeApplicationId: t,
|
|
84436
84440
|
randmarSku: e,
|
|
@@ -84438,164 +84442,165 @@ function ProductOverviewPage({
|
|
|
84438
84442
|
}, {
|
|
84439
84443
|
skip: !t || !e
|
|
84440
84444
|
}), {
|
|
84441
|
-
data:
|
|
84442
|
-
isLoading:
|
|
84445
|
+
data: _,
|
|
84446
|
+
isLoading: C
|
|
84443
84447
|
} = useGetV4PartnerByRouteApplicationIdProductAndRandmarSkuQuery({
|
|
84444
84448
|
routeApplicationId: t,
|
|
84445
84449
|
randmarSku: e,
|
|
84446
84450
|
withSpecification: !0
|
|
84447
84451
|
}, {
|
|
84448
|
-
skip: !
|
|
84452
|
+
skip: !b
|
|
84449
84453
|
});
|
|
84450
84454
|
return /* @__PURE__ */ jsxs(Fragment$1, { children: [
|
|
84451
|
-
/* @__PURE__ */
|
|
84452
|
-
|
|
84453
|
-
|
|
84454
|
-
|
|
84455
|
-
|
|
84455
|
+
/* @__PURE__ */ jsxs("div", { className: "grid gap-4 grid-cols-1 md:grid-cols-2 lg:grid-cols-3", children: [
|
|
84456
|
+
/* @__PURE__ */ jsx("div", { className: "lg:col-span-2", children: /* @__PURE__ */ jsx(
|
|
84457
|
+
ProductCard,
|
|
84458
|
+
{
|
|
84459
|
+
applicationId: t,
|
|
84460
|
+
product: _ || b,
|
|
84461
|
+
defaultOpportunityNumber: n,
|
|
84462
|
+
onAddToCart: o,
|
|
84463
|
+
addingToCart: l,
|
|
84464
|
+
shopifyHostname: d,
|
|
84465
|
+
customAction: f
|
|
84466
|
+
}
|
|
84467
|
+
) }),
|
|
84468
|
+
/* @__PURE__ */ jsxs(Card, { children: [
|
|
84469
|
+
/* @__PURE__ */ jsx(CardHeader, { children: /* @__PURE__ */ jsxs(CardTitle, { children: [
|
|
84470
|
+
/* @__PURE__ */ jsx(Info, { className: "h-5 w-5 inline mr-2" }),
|
|
84471
|
+
" Additionnal information"
|
|
84472
|
+
] }) }),
|
|
84473
|
+
/* @__PURE__ */ jsx(CardContent, { children: S ? /* @__PURE__ */ jsxs(Fragment$1, { children: [
|
|
84474
|
+
/* @__PURE__ */ jsxs("div", { className: "flex justify-between", children: [
|
|
84475
|
+
/* @__PURE__ */ jsx(Skeleton, { className: "h-5 w-32" }),
|
|
84476
|
+
/* @__PURE__ */ jsx(Skeleton, { className: "h-5 w-24" })
|
|
84477
|
+
] }),
|
|
84478
|
+
/* @__PURE__ */ jsxs("div", { className: "flex justify-between mt-2", children: [
|
|
84479
|
+
/* @__PURE__ */ jsx(Skeleton, { className: "h-5 w-32" }),
|
|
84480
|
+
/* @__PURE__ */ jsx(Skeleton, { className: "h-5 w-24" })
|
|
84481
|
+
] }),
|
|
84482
|
+
/* @__PURE__ */ jsxs("div", { className: "flex justify-between mt-2", children: [
|
|
84483
|
+
/* @__PURE__ */ jsx(Skeleton, { className: "h-5 w-32" }),
|
|
84484
|
+
/* @__PURE__ */ jsx(Skeleton, { className: "h-5 w-24" })
|
|
84485
|
+
] }),
|
|
84486
|
+
/* @__PURE__ */ jsxs("div", { className: "flex justify-between mt-2", children: [
|
|
84487
|
+
/* @__PURE__ */ jsx(Skeleton, { className: "h-5 w-32" }),
|
|
84488
|
+
/* @__PURE__ */ jsx(Skeleton, { className: "h-5 w-24" })
|
|
84489
|
+
] }),
|
|
84490
|
+
/* @__PURE__ */ jsx(Skeleton, { className: "h-1 w-full my-6" }),
|
|
84491
|
+
/* @__PURE__ */ jsx(Skeleton, { className: "h-5 w-24" }),
|
|
84492
|
+
/* @__PURE__ */ jsx(Skeleton, { className: "h-4 w-full mt-2" }),
|
|
84493
|
+
/* @__PURE__ */ jsx(Skeleton, { className: "h-4 w-full mt-1" })
|
|
84494
|
+
] }) : /* @__PURE__ */ jsxs(Fragment$1, { children: [
|
|
84495
|
+
/* @__PURE__ */ jsxs("div", { className: "flex justify-between", children: [
|
|
84496
|
+
/* @__PURE__ */ jsx("span", { className: "text-muted-foreground", children: "Cateory Name" }),
|
|
84497
|
+
/* @__PURE__ */ jsx("span", { className: "font-medium", children: (b == null ? void 0 : b.ProductType) || "N/A" })
|
|
84498
|
+
] }),
|
|
84499
|
+
/* @__PURE__ */ jsxs("div", { className: "flex justify-between mt-2", children: [
|
|
84500
|
+
/* @__PURE__ */ jsx("span", { className: "text-muted-foreground", children: "Master Carton" }),
|
|
84501
|
+
/* @__PURE__ */ jsx("span", { className: "font-medium", children: (b == null ? void 0 : b.MasterCarton) || "N/A" })
|
|
84502
|
+
] }),
|
|
84503
|
+
/* @__PURE__ */ jsxs("div", { className: "flex justify-between mt-2", children: [
|
|
84504
|
+
/* @__PURE__ */ jsx("span", { className: "text-muted-foreground", children: "Skid Quantity" }),
|
|
84505
|
+
/* @__PURE__ */ jsx("span", { className: "font-medium", children: (b == null ? void 0 : b.SkidQuantity) || "N/A" })
|
|
84506
|
+
] }),
|
|
84507
|
+
/* @__PURE__ */ jsxs("div", { className: "flex justify-between mt-2", children: [
|
|
84508
|
+
/* @__PURE__ */ jsx("span", { className: "text-muted-foreground", children: "Automatic Reorder" }),
|
|
84509
|
+
/* @__PURE__ */ jsx("span", { className: "font-medium", children: b != null && b.AutoUpdate ? "Yes" : "No" })
|
|
84510
|
+
] }),
|
|
84511
|
+
((b == null ? void 0 : b.VoiceoverCaption) || (b == null ? void 0 : b.BodyHTML)) && /* @__PURE__ */ jsxs(Fragment$1, { children: [
|
|
84512
|
+
/* @__PURE__ */ jsx("hr", { className: "my-6" }),
|
|
84513
|
+
/* @__PURE__ */ jsx("div", { className: "text-muted-foreground mb-2", children: "Description" }),
|
|
84514
|
+
/* @__PURE__ */ jsxs("div", { className: "max-h-44 overflow-scroll", children: [
|
|
84515
|
+
(b == null ? void 0 : b.VoiceoverCaption) && /* @__PURE__ */ jsx("div", { children: b == null ? void 0 : b.VoiceoverCaption }),
|
|
84516
|
+
(b == null ? void 0 : b.BodyHTML) && /* @__PURE__ */ jsx(
|
|
84517
|
+
"div",
|
|
84518
|
+
{
|
|
84519
|
+
className: "prose prose-sm max-w-none",
|
|
84520
|
+
dangerouslySetInnerHTML: { __html: (b == null ? void 0 : b.BodyHTML) ?? "" }
|
|
84521
|
+
}
|
|
84522
|
+
)
|
|
84523
|
+
] })
|
|
84524
|
+
] })
|
|
84525
|
+
] }) })
|
|
84526
|
+
] })
|
|
84527
|
+
] }),
|
|
84528
|
+
/* @__PURE__ */ jsx("div", { className: "my-4", children: S ? /* @__PURE__ */ jsx("div", { className: "mx-auto flex justify-center items-center h-32", children: /* @__PURE__ */ jsx(LoaderCircle, { className: "h-8 w-8 animate-spin text-primary" }) }) : /* @__PURE__ */ jsxs(Tabs, { defaultValue: "stats", children: [
|
|
84529
|
+
/* @__PURE__ */ jsxs(TabsList, { className: "inline-flex h-auto items-center justify-center rounded-none border-b bg-transparent p-0", children: [
|
|
84530
|
+
/* @__PURE__ */ jsx(
|
|
84531
|
+
TabsTrigger,
|
|
84456
84532
|
{
|
|
84457
|
-
|
|
84458
|
-
|
|
84459
|
-
|
|
84533
|
+
value: "stats",
|
|
84534
|
+
className: "relative h-12 rounded-none border-b-2 border-b-transparent bg-transparent px-4 pb-3 pt-2 text-sm font-medium text-muted-foreground shadow-none transition-none hover:text-foreground data-[state=active]:border-b-primary data-[state=active]:text-foreground data-[state=active]:shadow-none cursor-pointer",
|
|
84535
|
+
children: "Statistics"
|
|
84460
84536
|
}
|
|
84461
|
-
)
|
|
84462
|
-
/* @__PURE__ */
|
|
84463
|
-
|
|
84464
|
-
/* @__PURE__ */ jsx(Info, { className: "h-5 w-5 inline mr-2" }),
|
|
84465
|
-
" Additionnal information"
|
|
84466
|
-
] }) }),
|
|
84467
|
-
/* @__PURE__ */ jsx(CardContent, { children: d ? /* @__PURE__ */ jsxs(Fragment$1, { children: [
|
|
84468
|
-
/* @__PURE__ */ jsxs("div", { className: "flex justify-between", children: [
|
|
84469
|
-
/* @__PURE__ */ jsx(Skeleton, { className: "h-5 w-32" }),
|
|
84470
|
-
/* @__PURE__ */ jsx(Skeleton, { className: "h-5 w-24" })
|
|
84471
|
-
] }),
|
|
84472
|
-
/* @__PURE__ */ jsxs("div", { className: "flex justify-between mt-2", children: [
|
|
84473
|
-
/* @__PURE__ */ jsx(Skeleton, { className: "h-5 w-32" }),
|
|
84474
|
-
/* @__PURE__ */ jsx(Skeleton, { className: "h-5 w-24" })
|
|
84475
|
-
] }),
|
|
84476
|
-
/* @__PURE__ */ jsxs("div", { className: "flex justify-between mt-2", children: [
|
|
84477
|
-
/* @__PURE__ */ jsx(Skeleton, { className: "h-5 w-32" }),
|
|
84478
|
-
/* @__PURE__ */ jsx(Skeleton, { className: "h-5 w-24" })
|
|
84479
|
-
] }),
|
|
84480
|
-
/* @__PURE__ */ jsxs("div", { className: "flex justify-between mt-2", children: [
|
|
84481
|
-
/* @__PURE__ */ jsx(Skeleton, { className: "h-5 w-32" }),
|
|
84482
|
-
/* @__PURE__ */ jsx(Skeleton, { className: "h-5 w-24" })
|
|
84483
|
-
] }),
|
|
84484
|
-
/* @__PURE__ */ jsx(Skeleton, { className: "h-1 w-full my-6" }),
|
|
84485
|
-
/* @__PURE__ */ jsx(Skeleton, { className: "h-5 w-24" }),
|
|
84486
|
-
/* @__PURE__ */ jsx(Skeleton, { className: "h-4 w-full mt-2" }),
|
|
84487
|
-
/* @__PURE__ */ jsx(Skeleton, { className: "h-4 w-full mt-1" })
|
|
84488
|
-
] }) : /* @__PURE__ */ jsxs(Fragment$1, { children: [
|
|
84489
|
-
/* @__PURE__ */ jsxs("div", { className: "flex justify-between", children: [
|
|
84490
|
-
/* @__PURE__ */ jsx("span", { className: "text-muted-foreground", children: "Cateory Name" }),
|
|
84491
|
-
/* @__PURE__ */ jsx("span", { className: "font-medium", children: (l == null ? void 0 : l.ProductType) || "N/A" })
|
|
84492
|
-
] }),
|
|
84493
|
-
/* @__PURE__ */ jsxs("div", { className: "flex justify-between mt-2", children: [
|
|
84494
|
-
/* @__PURE__ */ jsx("span", { className: "text-muted-foreground", children: "Master Carton" }),
|
|
84495
|
-
/* @__PURE__ */ jsx("span", { className: "font-medium", children: (l == null ? void 0 : l.MasterCarton) || "N/A" })
|
|
84496
|
-
] }),
|
|
84497
|
-
/* @__PURE__ */ jsxs("div", { className: "flex justify-between mt-2", children: [
|
|
84498
|
-
/* @__PURE__ */ jsx("span", { className: "text-muted-foreground", children: "Skid Quantity" }),
|
|
84499
|
-
/* @__PURE__ */ jsx("span", { className: "font-medium", children: (l == null ? void 0 : l.SkidQuantity) || "N/A" })
|
|
84500
|
-
] }),
|
|
84501
|
-
/* @__PURE__ */ jsxs("div", { className: "flex justify-between mt-2", children: [
|
|
84502
|
-
/* @__PURE__ */ jsx("span", { className: "text-muted-foreground", children: "Automatic Reorder" }),
|
|
84503
|
-
/* @__PURE__ */ jsx("span", { className: "font-medium", children: l != null && l.AutoUpdate ? "Yes" : "No" })
|
|
84504
|
-
] }),
|
|
84505
|
-
((l == null ? void 0 : l.VoiceoverCaption) || (l == null ? void 0 : l.BodyHTML)) && /* @__PURE__ */ jsxs(Fragment$1, { children: [
|
|
84506
|
-
/* @__PURE__ */ jsx("hr", { className: "my-6" }),
|
|
84507
|
-
/* @__PURE__ */ jsx("div", { className: "text-muted-foreground mb-2", children: "Description" }),
|
|
84508
|
-
/* @__PURE__ */ jsxs("div", { className: "max-h-44 overflow-scroll", children: [
|
|
84509
|
-
(l == null ? void 0 : l.VoiceoverCaption) && /* @__PURE__ */ jsx("div", { children: l == null ? void 0 : l.VoiceoverCaption }),
|
|
84510
|
-
(l == null ? void 0 : l.BodyHTML) && /* @__PURE__ */ jsx(
|
|
84511
|
-
"div",
|
|
84512
|
-
{
|
|
84513
|
-
className: "prose prose-sm max-w-none",
|
|
84514
|
-
dangerouslySetInnerHTML: { __html: (l == null ? void 0 : l.BodyHTML) ?? "" }
|
|
84515
|
-
}
|
|
84516
|
-
)
|
|
84517
|
-
] })
|
|
84518
|
-
] })
|
|
84519
|
-
] }) })
|
|
84520
|
-
] })
|
|
84521
|
-
] }),
|
|
84522
|
-
/* @__PURE__ */ jsx("div", { className: "my-4", children: d ? /* @__PURE__ */ jsx("div", { className: "mx-auto flex justify-center items-center h-32", children: /* @__PURE__ */ jsx(LoaderCircle, { className: "h-8 w-8 animate-spin text-primary" }) }) : /* @__PURE__ */ jsxs(Tabs, { defaultValue: "stats", children: [
|
|
84523
|
-
/* @__PURE__ */ jsxs(TabsList, { className: "inline-flex h-auto items-center justify-center rounded-none border-b bg-transparent p-0", children: [
|
|
84524
|
-
/* @__PURE__ */ jsx(
|
|
84525
|
-
TabsTrigger,
|
|
84526
|
-
{
|
|
84527
|
-
value: "stats",
|
|
84528
|
-
className: "relative h-12 rounded-none border-b-2 border-b-transparent bg-transparent px-4 pb-3 pt-2 text-sm font-medium text-muted-foreground shadow-none transition-none hover:text-foreground data-[state=active]:border-b-primary data-[state=active]:text-foreground data-[state=active]:shadow-none cursor-pointer",
|
|
84529
|
-
children: "Statistics"
|
|
84530
|
-
}
|
|
84531
|
-
),
|
|
84532
|
-
(o == null ? void 0 : o.IsReseller) && /* @__PURE__ */ jsx(
|
|
84533
|
-
TabsTrigger,
|
|
84534
|
-
{
|
|
84535
|
-
value: "opportunities",
|
|
84536
|
-
className: "relative h-12 rounded-none border-b-2 border-b-transparent bg-transparent px-4 pb-3 pt-2 text-sm font-medium text-muted-foreground shadow-none transition-none hover:text-foreground data-[state=active]:border-b-primary data-[state=active]:text-foreground data-[state=active]:shadow-none cursor-pointer",
|
|
84537
|
-
children: "Opportunities"
|
|
84538
|
-
}
|
|
84539
|
-
),
|
|
84540
|
-
/* @__PURE__ */ jsx(
|
|
84541
|
-
TabsTrigger,
|
|
84542
|
-
{
|
|
84543
|
-
value: "orders",
|
|
84544
|
-
className: "relative h-12 rounded-none border-b-2 border-b-transparent bg-transparent px-4 pb-3 pt-2 text-sm font-medium text-muted-foreground shadow-none transition-none hover:text-foreground data-[state=active]:border-b-primary data-[state=active]:text-foreground data-[state=active]:shadow-none cursor-pointer",
|
|
84545
|
-
children: "Orders"
|
|
84546
|
-
}
|
|
84547
|
-
),
|
|
84548
|
-
/* @__PURE__ */ jsx(
|
|
84549
|
-
TabsTrigger,
|
|
84550
|
-
{
|
|
84551
|
-
value: "warehouse",
|
|
84552
|
-
className: "relative h-12 rounded-none border-b-2 border-b-transparent bg-transparent px-4 pb-3 pt-2 text-sm font-medium text-muted-foreground shadow-none transition-none hover:text-foreground data-[state=active]:border-b-primary data-[state=active]:text-foreground data-[state=active]:shadow-none cursor-pointer",
|
|
84553
|
-
children: "Latest Warehouse Receiving"
|
|
84554
|
-
}
|
|
84555
|
-
)
|
|
84556
|
-
] }),
|
|
84557
|
-
/* @__PURE__ */ jsx(TabsContent, { value: "stats", children: /* @__PURE__ */ jsx("div", { className: "mt-4", children: /* @__PURE__ */ jsx(
|
|
84558
|
-
SalesChart,
|
|
84537
|
+
),
|
|
84538
|
+
(g == null ? void 0 : g.IsReseller) && /* @__PURE__ */ jsx(
|
|
84539
|
+
TabsTrigger,
|
|
84559
84540
|
{
|
|
84560
|
-
|
|
84561
|
-
|
|
84541
|
+
value: "opportunities",
|
|
84542
|
+
className: "relative h-12 rounded-none border-b-2 border-b-transparent bg-transparent px-4 pb-3 pt-2 text-sm font-medium text-muted-foreground shadow-none transition-none hover:text-foreground data-[state=active]:border-b-primary data-[state=active]:text-foreground data-[state=active]:shadow-none cursor-pointer",
|
|
84543
|
+
children: "Opportunities"
|
|
84562
84544
|
}
|
|
84563
|
-
)
|
|
84564
|
-
|
|
84565
|
-
|
|
84545
|
+
),
|
|
84546
|
+
/* @__PURE__ */ jsx(
|
|
84547
|
+
TabsTrigger,
|
|
84566
84548
|
{
|
|
84567
|
-
|
|
84568
|
-
|
|
84569
|
-
|
|
84549
|
+
value: "orders",
|
|
84550
|
+
className: "relative h-12 rounded-none border-b-2 border-b-transparent bg-transparent px-4 pb-3 pt-2 text-sm font-medium text-muted-foreground shadow-none transition-none hover:text-foreground data-[state=active]:border-b-primary data-[state=active]:text-foreground data-[state=active]:shadow-none cursor-pointer",
|
|
84551
|
+
children: "Orders"
|
|
84570
84552
|
}
|
|
84571
|
-
)
|
|
84572
|
-
/* @__PURE__ */
|
|
84573
|
-
|
|
84574
|
-
OrdersTable,
|
|
84575
|
-
{
|
|
84576
|
-
title: "Open Orders",
|
|
84577
|
-
orders: f == null ? void 0 : f.Orders,
|
|
84578
|
-
loading: g
|
|
84579
|
-
}
|
|
84580
|
-
) }),
|
|
84581
|
-
/* @__PURE__ */ jsx("div", { className: "mt-4", children: /* @__PURE__ */ jsx(
|
|
84582
|
-
OrdersTable,
|
|
84583
|
-
{
|
|
84584
|
-
title: "Completed Orders",
|
|
84585
|
-
orders: f == null ? void 0 : f.CompletedOrderDetails,
|
|
84586
|
-
loading: g
|
|
84587
|
-
}
|
|
84588
|
-
) })
|
|
84589
|
-
] }),
|
|
84590
|
-
/* @__PURE__ */ jsx(TabsContent, { value: "warehouse", children: /* @__PURE__ */ jsx("div", { className: "mt-4", children: /* @__PURE__ */ jsx(
|
|
84591
|
-
ReceiptsTable,
|
|
84553
|
+
),
|
|
84554
|
+
/* @__PURE__ */ jsx(
|
|
84555
|
+
TabsTrigger,
|
|
84592
84556
|
{
|
|
84593
|
-
|
|
84594
|
-
|
|
84557
|
+
value: "warehouse",
|
|
84558
|
+
className: "relative h-12 rounded-none border-b-2 border-b-transparent bg-transparent px-4 pb-3 pt-2 text-sm font-medium text-muted-foreground shadow-none transition-none hover:text-foreground data-[state=active]:border-b-primary data-[state=active]:text-foreground data-[state=active]:shadow-none cursor-pointer",
|
|
84559
|
+
children: "Latest Warehouse Receiving"
|
|
84595
84560
|
}
|
|
84596
|
-
)
|
|
84597
|
-
] })
|
|
84598
|
-
|
|
84561
|
+
)
|
|
84562
|
+
] }),
|
|
84563
|
+
/* @__PURE__ */ jsx(TabsContent, { value: "stats", children: /* @__PURE__ */ jsx("div", { className: "mt-4", children: /* @__PURE__ */ jsx(
|
|
84564
|
+
SalesChart,
|
|
84565
|
+
{
|
|
84566
|
+
salesData: (_ == null ? void 0 : _.SalesStatistics) ?? [],
|
|
84567
|
+
isLoading: C
|
|
84568
|
+
}
|
|
84569
|
+
) }) }),
|
|
84570
|
+
(g == null ? void 0 : g.IsReseller) && /* @__PURE__ */ jsx(TabsContent, { value: "opportunities", children: /* @__PURE__ */ jsx("div", { className: "mt-4", children: /* @__PURE__ */ jsx(
|
|
84571
|
+
ResellerOpportunitiesTable,
|
|
84572
|
+
{
|
|
84573
|
+
applicationId: t,
|
|
84574
|
+
opportunities: b == null ? void 0 : b.Opportunities,
|
|
84575
|
+
loading: S
|
|
84576
|
+
}
|
|
84577
|
+
) }) }),
|
|
84578
|
+
/* @__PURE__ */ jsxs(TabsContent, { value: "orders", children: [
|
|
84579
|
+
/* @__PURE__ */ jsx("div", { className: "mt-4", children: /* @__PURE__ */ jsx(
|
|
84580
|
+
OrdersTable,
|
|
84581
|
+
{
|
|
84582
|
+
title: "Open Orders",
|
|
84583
|
+
orders: _ == null ? void 0 : _.ActiveOrderDetails,
|
|
84584
|
+
loading: C
|
|
84585
|
+
}
|
|
84586
|
+
) }),
|
|
84587
|
+
/* @__PURE__ */ jsx("div", { className: "mt-4", children: /* @__PURE__ */ jsx(
|
|
84588
|
+
OrdersTable,
|
|
84589
|
+
{
|
|
84590
|
+
title: "Completed Orders",
|
|
84591
|
+
orders: _ == null ? void 0 : _.CompletedOrderDetails,
|
|
84592
|
+
loading: C
|
|
84593
|
+
}
|
|
84594
|
+
) })
|
|
84595
|
+
] }),
|
|
84596
|
+
/* @__PURE__ */ jsx(TabsContent, { value: "warehouse", children: /* @__PURE__ */ jsx("div", { className: "mt-4", children: /* @__PURE__ */ jsx(
|
|
84597
|
+
ReceiptsTable,
|
|
84598
|
+
{
|
|
84599
|
+
receipts: _ == null ? void 0 : _.Receipts,
|
|
84600
|
+
loading: C
|
|
84601
|
+
}
|
|
84602
|
+
) }) })
|
|
84603
|
+
] }) })
|
|
84599
84604
|
] });
|
|
84600
84605
|
}
|
|
84601
84606
|
export {
|
|
@@ -1271,4 +1271,4 @@ img.ProseMirror-separator {
|
|
|
1271
1271
|
.ProseMirror p {
|
|
1272
1272
|
margin-bottom: 0.5em;
|
|
1273
1273
|
}
|
|
1274
|
-
`;function RichTextEditor({id:t,name:e,value:n,onChange:o,placeholder:l,className:d,...f}){const[g,b]=React.useState(!1),_=React.useRef(null),S=React.useRef(null),R=useEditor({extensions:[StarterKit,Underline],content:n,editorProps:{attributes:{class:"prose prose-sm sm:prose dark:prose-invert focus:outline-none",id:t??"",name:e??""}},onUpdate:({editor:j})=>{const q=j.getHTML();o({target:{id:t,name:e,value:q}})}});React.useEffect(()=>{R&&n!==R.getHTML()&&R.commands.setContent(n)},[n,R]);const C=React.useCallback(j=>{if(R)if(R.chain().focus(),j==="paragraph")R.chain().setParagraph().run();else{const q=Number.parseInt(j.slice(1));R.chain().setHeading({level:q}).run()}},[R]),E=React.useCallback(j=>{if(R)switch(R.chain().focus(),j){case"bold":R.chain().toggleBold().run();break;case"italic":R.chain().toggleItalic().run();break;case"underline":R.chain().toggleUnderline().run();break;case"strike":R.chain().toggleStrike().run();break;case"bulletList":R.chain().toggleBulletList().run();break;case"orderedList":R.chain().toggleOrderedList().run();break}},[R]),A=React.useCallback(()=>{b(j=>!j)},[]),I=React.useCallback(j=>{const q=j.target.value;R&&R.commands.setContent(q),o({target:{id:t,name:e,value:q}})},[o,R,t,e]),M=React.useCallback(()=>{!g&&R&&R.commands.focus()},[g,R]);return R?jsxRuntime.jsxs("div",{ref:S,className:cn("border border-input rounded-md overflow-hidden focus-within:outline-hidden focus-within:ring-1 focus-within:ring-ring",d),onClick:M,...f,children:[jsxRuntime.jsx("style",{children:editorStyles}),jsxRuntime.jsxs("div",{className:"flex flex-wrap items-center p-2 border-b border-input gap-2 bg-background",children:[jsxRuntime.jsxs(Select,{onValueChange:C,disabled:g,children:[jsxRuntime.jsx(SelectTrigger,{className:"w-[160px]",children:jsxRuntime.jsx(SelectValue,{placeholder:"Format"})}),jsxRuntime.jsx(SelectContent,{children:formatOptions.map(j=>jsxRuntime.jsx(SelectItem,{value:j.value,children:j.label},j.value))})]}),["bold","italic","underline","strike","bulletList","orderedList"].map(j=>jsxRuntime.jsxs(Button,{type:"button",variant:"ghost",size:"sm",onClick:()=>E(j),className:R.isActive(j)?"bg-muted":"",disabled:g,children:[j==="bold"&&jsxRuntime.jsx(Bold$1,{className:"h-4 w-4"}),j==="italic"&&jsxRuntime.jsx(Italic$1,{className:"h-4 w-4"}),j==="underline"&&jsxRuntime.jsx(Underline$1,{className:"h-4 w-4"}),j==="strike"&&jsxRuntime.jsx(Strikethrough,{className:"h-4 w-4"}),j==="bulletList"&&jsxRuntime.jsx(List$1,{className:"h-4 w-4"}),j==="orderedList"&&jsxRuntime.jsx(ListOrdered,{className:"h-4 w-4"})]},j)),jsxRuntime.jsx(Button,{type:"button",variant:"ghost",size:"sm",onClick:A,className:g?"bg-muted":"",children:jsxRuntime.jsx(Code$1,{className:"h-4 w-4"})})]}),jsxRuntime.jsx("div",{className:"p-3",children:g?jsxRuntime.jsx(Textarea,{ref:_,id:t,name:e,value:R.getHTML(),onChange:I,className:cn("min-h-[150px] font-mono text-sm resize-none border-0 focus-visible:ring-0 focus-visible:ring-offset-0",d),placeholder:l}):jsxRuntime.jsx(EditorContent,{editor:R})})]}):null}function SalesChart({salesData:t,chartHeight:e=300,units:n="$",unitsPosition:o="left",className:l,isLoading:d=!1}){const[f,g]=React.useState([]),[b,_]=React.useState(!0),S=!d&&!!t&&t.length>0;return React.useEffect(()=>{if(d||!t||t.length===0){g([]);return}const R=t.reduce((Q,F)=>{const V=F.Day??0,te=Math.floor(V).toString();if(te.length!==8||isNaN(Number.parseInt(te)))return console.warn(`Skipping invalid Day format: ${F.Day}`),Q;const ae=te.substring(0,4),se=te.substring(4,6),ge=`${ae}-${se}`;return Q[ge]=(Q[ge]||0)+(F.ExtendedPrice??0),Q},{}),C=Object.keys(R).sort(),E=new Date,A=E.getFullYear(),I=E.getMonth(),M=E.getDate(),j=`${A}-${(I+1).toString().padStart(2,"0")}`,q={...R};if(b&&C.length>0&&C[C.length-1]===j){const Q=q[j],F=new Date(A,I+1,0).getDate();if(M<F&&M>0){const te=Q/M*F;q[j]=te}}const z=C.map(Q=>{const F=q[Q],[V,te]=Q.split("-").map(Number);return{month:new Date(V,te-1).toLocaleString("default",{month:"short",year:"numeric"}),sales:F}});g(z)},[t,b,d]),d?jsxRuntime.jsxs(Card,{className:"w-full",children:[jsxRuntime.jsx(CardHeader,{children:jsxRuntime.jsx(Skeleton,{className:"h-6 w-24"})}),jsxRuntime.jsxs(CardContent,{children:[jsxRuntime.jsx("div",{style:{height:e},children:jsxRuntime.jsx(Skeleton,{className:"h-full w-full rounded-md"})}),jsxRuntime.jsxs("div",{className:"flex items-center space-x-2 my-1 pt-2",children:[jsxRuntime.jsx(Skeleton,{className:"h-5 w-10"}),jsxRuntime.jsx(Skeleton,{className:"h-4 w-20"})]}),jsxRuntime.jsx(Skeleton,{className:"h-4 w-3/4 mt-1"})]})]}):f.length===0?jsxRuntime.jsx("div",{style:{height:e},className:l||"p-4 text-center text-muted-foreground flex items-center justify-center",children:"No monthly sales data to display."}):jsxRuntime.jsxs(Card,{className:"w-full",children:[jsxRuntime.jsx(CardHeader,{children:jsxRuntime.jsx(CardTitle,{children:"Sales"})}),jsxRuntime.jsxs(CardContent,{children:[jsxRuntime.jsx(AreaChart,{data:f,units:n,unitsPosition:o,height:e,className:l}),S&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs("div",{className:"flex items-center space-x-2 my-1 pt-2",children:[jsxRuntime.jsx(Switch,{checked:b,onCheckedChange:_,id:"extrapolate-switch","aria-label":"Toggle sales extrapolation"}),jsxRuntime.jsx(Label$2,{htmlFor:"extrapolate-switch",children:"Extrapolate"})]}),b&&jsxRuntime.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:"* Sales for the current month are projected, not actual."})]})]})]})}function getEndDateStatus(t){if(!t)return{text:"No End Date",variant:"neutral",daysRemaining:null};const e=new Date(t);if(isNaN(e.getTime()))return{text:"Invalid Date",variant:"neutral",daysRemaining:null};const n=new Date,o=new Date(e.getFullYear(),e.getMonth(),e.getDate()),l=new Date(n.getFullYear(),n.getMonth(),n.getDate()),d=o.getTime()-l.getTime(),f=Math.ceil(d/(1e3*60*60*24));return f<0?{text:`Ended ${Math.abs(f)}d ago`,variant:"destructive",daysRemaining:f}:f===0?{text:"Ends today",variant:"destructive",daysRemaining:f}:f<=7?{text:`Ends in ${f}d`,variant:"destructive",daysRemaining:f}:f<=30?{text:`Ends in ${f}d`,variant:"warning",daysRemaining:f}:{text:`Ends in ${f}d`,variant:"neutral",daysRemaining:f}}const formatDate=t=>{if(!t)return"N/A";try{const e=new Date(t);return isNaN(e.getTime())?"Invalid Date":e.toLocaleDateString(void 0,{year:"numeric",month:"short",day:"numeric"})}catch{return"Invalid Date"}};function ResellerOpportunitiesTable({applicationId:t,opportunities:e=null,loading:n=!1}){var V;const{toast:o}=useToast(),[l,d]=React.useState({}),[f,g]=React.useState(!1),[b,_]=React.useState(""),[S,R]=React.useState(null),C=React.useCallback((te,ae,se)=>{d(ge=>({...ge,[te]:{...ge[te],[ae]:se}}))},[]),[E]=usePutV4ResellerByRouteResellerIdOpportunityAndManufacturerIdDefaultMutation(),A=React.useCallback(async te=>{if(!te.BidNumber){o({title:"Error",description:"Bid Number is missing, cannot set default.",variant:"destructive"});return}const ae=te.BidNumber;C(ae,"isSettingDefault",!0),E({routeResellerId:t,manufacturerId:te.ManufacturerId??"",opportunityNumber:ae}).unwrap().then(()=>{o({title:"Success",description:`Opportunity "${te.OpportunityName||te.Opportunity||ae}" was successfully set as default.`,variant:"success"})}).catch(se=>{var ge;console.error("Set as default error:",se),o({title:"Error",description:((ge=se.data)==null?void 0:ge.message)||se.message||"An error occurred while setting this opportunity as default.",variant:"destructive"})}).finally(()=>{C(ae,"isSettingDefault",!1)})},[t,E,o,C]),[I]=usePostV4ResellerByRouteResellerIdOpportunityAndManufacturerIdBidNumberEmailMutation(),M=React.useCallback(te=>{if(!te.BidNumber){o({title:"Error",description:"Bid Number is missing, cannot prepare report.",variant:"destructive"});return}R(te),_(""),g(!0)},[o]),j=React.useCallback(async()=>{if(!S||!S.BidNumber){o({title:"Error",description:"No opportunity selected or Bid Number is missing.",variant:"destructive"});return}if(!b.trim()||!/\S+@\S+\.\S+/.test(b)){o({title:"Validation Error",description:"Please enter a valid email address.",variant:"destructive"});return}const te=S.BidNumber;C(te,"isSendingReport",!0),I({routeResellerId:t,manufacturerId:S.ManufacturerId??"",bidNumber:te,emailAddress:b}).unwrap().then(()=>{o({title:"Success",description:`A report for "${S.OpportunityName||S.Opportunity||te}" was successfully sent to ${b}.`,variant:"success"}),g(!1)}).catch(ae=>{var se;console.error("Send report by email error:",ae),o({title:"Error",description:((se=ae.data)==null?void 0:se.message)||ae.message||"An error occurred while sending the report by email.",variant:"destructive"})}).finally(()=>{C(te,"isSendingReport",!1),f||(R(null),_(""))})},[S,b,t,I,o,C,g]),q=React.useMemo(()=>[{accessorKey:"ManufacturerId",header:"Manuf.",cell:({row:te})=>jsxRuntime.jsx("div",{className:"w-20 h-8",children:jsxRuntime.jsx(PartnerLogo,{id:te.original.ManufacturerId,width:80,height:32})}),enableSorting:!0,enableFiltering:!0},{id:"opportunityDisplay",accessorFn:te=>te.OpportunityName||te.Opportunity,header:"Opportunity",cell:({getValue:te})=>jsxRuntime.jsx("div",{className:"min-w-[150px]",children:te()??"N/A"}),enableSorting:!0,enableFiltering:!0},{accessorKey:"BidNumber",header:"Bid Number",cell:({row:te})=>te.original.BidNumber??"N/A",enableSorting:!0,enableFiltering:!0},{id:"statusInfo",header:"Status",cell:({row:te})=>{const ae=te.original,se=ae.Active===!0,ge=getEndDateStatus(ae.EndDate);let oe="border-gray-400 bg-gray-100 text-gray-600 dark:border-gray-600 dark:bg-gray-800/50 dark:text-gray-400";return ge.variant==="destructive"?oe="border-red-500 bg-red-100 text-red-700 dark:border-red-600 dark:bg-red-900/50 dark:text-red-400":ge.variant==="warning"&&(oe="border-yellow-500 bg-yellow-100 text-yellow-700 dark:border-yellow-600 dark:bg-yellow-900/50 dark:text-yellow-400"),jsxRuntime.jsxs("div",{className:"flex items-center space-x-2 min-w-[200px]",children:[jsxRuntime.jsx(Badge,{variant:"outline",className:se?"border-green-500 bg-green-100 text-green-700 dark:border-green-600 dark:bg-green-900/50 dark:text-green-400 font-medium":"border-gray-400 bg-gray-100 text-gray-600 dark:border-gray-600 dark:bg-gray-800/50 dark:text-gray-400 font-medium",children:se?"Active":"Inactive"}),ae.EndDate&&jsxRuntime.jsx(Badge,{variant:"outline",className:`${oe} font-medium`,children:ge.text}),jsxRuntime.jsx(TooltipProvider,{delayDuration:100,children:jsxRuntime.jsxs(Tooltip$1,{children:[jsxRuntime.jsx(TooltipTrigger,{asChild:!0,children:jsxRuntime.jsx(Button,{variant:"ghost",size:"icon",className:"h-6 w-6 p-0 data-[state=delayed-open]:bg-accent data-[state=instant-open]:bg-accent",children:jsxRuntime.jsx(Info,{className:"h-4 w-4 text-muted-foreground"})})}),jsxRuntime.jsx(TooltipContent,{side:"top",align:"center",className:"bg-popover text-popover-foreground p-2 rounded shadow-lg",children:jsxRuntime.jsxs("div",{className:"text-sm space-y-1",children:[jsxRuntime.jsxs("p",{children:[jsxRuntime.jsx("strong",{children:"Start:"})," ",formatDate(ae.StartDate)]}),jsxRuntime.jsxs("p",{children:[jsxRuntime.jsx("strong",{children:"End:"})," ",formatDate(ae.EndDate)]}),jsxRuntime.jsxs("p",{children:[jsxRuntime.jsx("strong",{children:"Updated:"})," ",formatDate(ae.LastUpdate)]})]})})]})})]})},enableFiltering:!1},{id:"actions",header:"Actions",cell:({row:te})=>{var je,$e;const ae=te.original;if(!ae.BidNumber)return jsxRuntime.jsx("span",{className:"text-xs text-muted-foreground",children:"Actions unavailable"});const se=ae.BidNumber,ge=(je=l[se])==null?void 0:je.isSettingDefault,oe=(S==null?void 0:S.BidNumber)===se&&(($e=l[se])==null?void 0:$e.isSendingReport),Ae=ge||oe,Ne=ae.CanBeSetAsDefault===!0;return jsxRuntime.jsxs("div",{className:"flex space-x-2",children:[jsxRuntime.jsx("a",{href:`https://reseller.randmar.io/${t}/Opportunity/${ae.ManufacturerId}/${ae.BidNumber}`,target:"_blank",children:jsxRuntime.jsxs(Button,{variant:"outline",size:"sm",className:"flex items-center",children:[jsxRuntime.jsx(Star,{className:"mr-2 h-4 w-4"})," View"]})}),jsxRuntime.jsxs(Button,{variant:"outline",size:"sm",onClick:()=>A(ae),disabled:Ae||!Ne,title:Ne?"Set as default":"This opportunity cannot be set as default",className:"flex items-center",children:[ge?jsxRuntime.jsx(LoaderCircle,{className:"mr-2 h-4 w-4 animate-spin"}):jsxRuntime.jsx(Star,{className:"mr-2 h-4 w-4"})," Set Default"]}),jsxRuntime.jsxs(Button,{variant:"outline",size:"sm",onClick:()=>M(ae),disabled:Ae,title:"Send report by email",className:"flex items-center",children:[oe?jsxRuntime.jsx(LoaderCircle,{className:"mr-2 h-4 w-4 animate-spin"}):jsxRuntime.jsx(Send,{className:"mr-2 h-4 w-4"})," Send Report"]})]})}}],[l,A,M,S]),z=React.useMemo(()=>{const te={};if(e){const ae=Array.from(new Set(e.map(ge=>ge.ManufacturerId).filter(ge=>ge!=null)));te.ManufacturerId=ae;const se=Array.from(new Set(e.map(ge=>ge.OpportunityName||ge.Opportunity).filter(ge=>ge!=null)));te.opportunityDisplay=se}return te},[e]),Q=e||[],F=S!=null&&S.BidNumber?(V=l[S.BidNumber])==null?void 0:V.isSendingReport:!1;return n?jsxRuntime.jsxs(Card,{className:"w-full",children:[jsxRuntime.jsxs(CardHeader,{children:[" ",jsxRuntime.jsx(Skeleton,{className:"h-7 w-48"})," "]}),jsxRuntime.jsxs(CardContent,{className:"space-y-4",children:[jsxRuntime.jsx(Skeleton,{className:"h-12 w-full rounded-md border"}),jsxRuntime.jsx(Skeleton,{className:"h-48 w-full rounded-md border"}),jsxRuntime.jsxs("div",{className:"flex items-center justify-between pt-4",children:[jsxRuntime.jsx(Skeleton,{className:"h-9 w-[130px]"}),jsxRuntime.jsxs("div",{className:"flex items-center space-x-2",children:[jsxRuntime.jsx(Skeleton,{className:"h-9 w-20"})," ",jsxRuntime.jsx(Skeleton,{className:"h-9 w-24"})," ",jsxRuntime.jsx(Skeleton,{className:"h-9 w-9"})," ",jsxRuntime.jsx(Skeleton,{className:"h-9 w-9"})]})]})]})]}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(Card,{className:"w-full",children:[jsxRuntime.jsxs(CardHeader,{children:[" ",jsxRuntime.jsx(CardTitle,{className:"text-1xl font-bold",children:"Opportunities"})," "]}),jsxRuntime.jsx(CardContent,{children:jsxRuntime.jsx(DataTable,{columns:q,data:Q,uniqueValues:z})})]}),jsxRuntime.jsx(Dialog,{open:f,onOpenChange:te=>{g(te),te||(R(null),_(""))},children:jsxRuntime.jsxs(DialogContent,{className:"sm:max-w-[425px]",children:[jsxRuntime.jsxs(DialogHeader,{children:[jsxRuntime.jsx(DialogTitle,{children:"Send Opportunity Report"}),jsxRuntime.jsxs(DialogDescription,{children:["Enter the email address to send the report for opportunity: ",jsxRuntime.jsx("br",{}),jsxRuntime.jsx("span",{className:"font-semibold",children:(S==null?void 0:S.OpportunityName)||(S==null?void 0:S.Opportunity)||"N/A"}),(S==null?void 0:S.BidNumber)&&jsxRuntime.jsxs("span",{className:"block text-sm text-muted-foreground",children:["Bid Number: ",S.BidNumber]})]})]}),jsxRuntime.jsx("div",{className:"grid gap-4 py-4",children:jsxRuntime.jsxs("div",{className:"grid grid-cols-4 items-center gap-4",children:[jsxRuntime.jsx(Label$2,{htmlFor:"email",className:"text-right",children:"Email"}),jsxRuntime.jsx(Input,{id:"email",type:"email",value:b,onChange:te=>_(te.target.value),placeholder:"recipient@example.com",className:"col-span-3",disabled:F})]})}),jsxRuntime.jsxs(DialogFooter,{children:[jsxRuntime.jsx(Button,{variant:"outline",onClick:()=>g(!1),disabled:F,children:"Cancel"}),jsxRuntime.jsxs(Button,{type:"submit",onClick:j,disabled:F,children:[F&&jsxRuntime.jsx(LoaderCircle,{className:"mr-2 h-4 w-4 animate-spin"})," Send Report"]})]})]})})]})}function formatYYYYMMDDIntToDateString$1(t){if(t===null||typeof t>"u")return"N/A";const e=t.toString();return e.length===8?`${e.substring(0,4)}-${e.substring(4,6)}-${e.substring(6,8)}`:e}function formatCurrency(t){return t===null||typeof t>"u"?"N/A":t.toLocaleString(void 0,{style:"currency",currency:"CAD"})}function OrdersTable({orders:t=null,loading:e=!1,title:n="Order Details"}){const o=React.useMemo(()=>[{accessorKey:"DocumentNumber",header:"Document Number",cell:({row:f})=>f.original.DocumentNumber??"N/A",enableSorting:!0,enableFiltering:!0},{accessorKey:"DocumentDate",header:"Document Date",cell:({row:f})=>formatYYYYMMDDIntToDateString$1(f.original.DocumentDate),enableSorting:!0,enableFiltering:!1},{accessorKey:"OrderNumber",header:"Order Number",cell:({row:f})=>f.original.OrderNumber??"N/A",enableSorting:!0,enableFiltering:!0},{accessorKey:"PONumber",header:"PO Number",cell:({row:f})=>f.original.PONumber??"N/A",enableSorting:!0,enableFiltering:!0},{accessorKey:"WarehouseCode",header:"Warehouse",cell:({row:f})=>f.original.WarehouseCode??"N/A",enableSorting:!0,enableFiltering:!0},{accessorKey:"Quantity",header:"Quantity",cell:({row:f})=>f.original.Quantity??"N/A",enableSorting:!0,enableFiltering:!1},{accessorKey:"ShipToName",header:"Name",cell:({row:f})=>jsxRuntime.jsx("div",{className:"min-w-[150px]",children:f.original.ShipToName??"N/A"}),enableSorting:!0,enableFiltering:!0},{accessorKey:"UnitPrice",header:"Unit Price",cell:({row:f})=>formatCurrency(f.original.UnitPrice),enableSorting:!0,enableFiltering:!1}],[]),l=React.useMemo(()=>{const f={};if(t){const g=Array.from(new Set(t.map(C=>C.WarehouseCode).filter(C=>C!=null)));f.WarehouseCode=g;const b=Array.from(new Set(t.map(C=>C.ShipToName).filter(C=>C!=null)));f.ShipToName=b;const _=Array.from(new Set(t.map(C=>C.DocumentNumber).filter(C=>C!=null)));f.DocumentNumber=_;const S=Array.from(new Set(t.map(C=>C.OrderNumber).filter(C=>C!=null)));f.OrderNumber=S;const R=Array.from(new Set(t.map(C=>C.PONumber).filter(C=>C!=null)));f.PONumber=R}return f},[t]),d=t||[];return e?jsxRuntime.jsxs(Card,{className:"w-full",children:[jsxRuntime.jsxs(CardHeader,{children:[" ",jsxRuntime.jsx(Skeleton,{className:"h-7 w-48"})," "]}),jsxRuntime.jsxs(CardContent,{className:"space-y-4",children:[jsxRuntime.jsx(Skeleton,{className:"h-12 w-full rounded-md border"}),jsxRuntime.jsx(Skeleton,{className:"h-10 w-full rounded-md border"}),jsxRuntime.jsx(Skeleton,{className:"h-10 w-full rounded-md border"}),jsxRuntime.jsx(Skeleton,{className:"h-10 w-full rounded-md border"}),jsxRuntime.jsxs("div",{className:"flex items-center justify-between pt-4",children:[jsxRuntime.jsx(Skeleton,{className:"h-9 w-[130px]"}),jsxRuntime.jsxs("div",{className:"flex items-center space-x-2",children:[jsxRuntime.jsx(Skeleton,{className:"h-9 w-20"}),jsxRuntime.jsx(Skeleton,{className:"h-9 w-24"}),jsxRuntime.jsx(Skeleton,{className:"h-9 w-9"}),jsxRuntime.jsx(Skeleton,{className:"h-9 w-9"})]})]})]})]}):jsxRuntime.jsxs(Card,{className:"w-full",children:[jsxRuntime.jsxs(CardHeader,{children:[" ",jsxRuntime.jsx(CardTitle,{className:"text-1xl font-bold",children:n})," "]}),jsxRuntime.jsx(CardContent,{children:jsxRuntime.jsx(DataTable,{columns:o,data:d,uniqueValues:l})})]})}function formatYYYYMMDDIntToDateString(t){if(t===null||typeof t>"u")return"N/A";const e=t.toString();return e.length===8?`${e.substring(0,4)}-${e.substring(4,6)}-${e.substring(6,8)}`:e}function ReceiptsTable({receipts:t=null,loading:e=!1,title:n="Latest Warehouse Receivings"}){const o=React.useMemo(()=>[{accessorKey:"Location",header:"Location",cell:({row:f})=>jsxRuntime.jsx("div",{className:"min-w-[150px]",children:f.original.Location??"N/A"}),enableSorting:!0,enableFiltering:!0},{accessorKey:"ReceiptDate",header:"Date",cell:({row:f})=>formatYYYYMMDDIntToDateString(f.original.ReceiptDate),enableSorting:!0,enableFiltering:!0},{accessorKey:"Quantity",header:"Quantity",cell:({row:f})=>f.original.Quantity??"N/A",enableSorting:!0,enableFiltering:!0}],[]),l=React.useMemo(()=>{const f={};if(t){const g=Array.from(new Set(t.map(_=>_.Location).filter(_=>_!=null)));f.Location=g;const b=Array.from(new Set(t.map(_=>formatYYYYMMDDIntToDateString(_.ReceiptDate)).filter(_=>_!=="N/A"&&_!=="Invalid Date"))).sort((_,S)=>new Date(S).getTime()-new Date(_).getTime());f.ReceiptDate=b}return f},[t]),d=t||[];return e?jsxRuntime.jsxs(Card,{className:"w-full",children:[jsxRuntime.jsxs(CardHeader,{children:[" ",jsxRuntime.jsx(Skeleton,{className:"h-7 w-56"})," "]}),jsxRuntime.jsxs(CardContent,{className:"space-y-4",children:[jsxRuntime.jsx(Skeleton,{className:"h-12 w-full rounded-md border"}),jsxRuntime.jsx(Skeleton,{className:"h-10 w-full rounded-md border"}),jsxRuntime.jsx(Skeleton,{className:"h-10 w-full rounded-md border"}),jsxRuntime.jsx(Skeleton,{className:"h-10 w-full rounded-md border"}),jsxRuntime.jsxs("div",{className:"flex items-center justify-between pt-4",children:[jsxRuntime.jsx(Skeleton,{className:"h-9 w-[130px]"}),jsxRuntime.jsxs("div",{className:"flex items-center space-x-2",children:[jsxRuntime.jsx(Skeleton,{className:"h-9 w-20"}),jsxRuntime.jsx(Skeleton,{className:"h-9 w-24"}),jsxRuntime.jsx(Skeleton,{className:"h-9 w-9"}),jsxRuntime.jsx(Skeleton,{className:"h-9 w-9"})]})]})]})]}):jsxRuntime.jsxs(Card,{className:"w-full",children:[jsxRuntime.jsxs(CardHeader,{children:[" ",jsxRuntime.jsx(CardTitle,{className:"text-1xl font-bold",children:n})," "]}),jsxRuntime.jsx(CardContent,{children:jsxRuntime.jsx(DataTable,{columns:o,data:d,uniqueValues:l})})]})}function ProductOverviewPage({applicationId:t,sku:e,shopifyHostName:n}){const{data:o}=useGetV4PartnerByApplicationIdAccountQuery({applicationId:t},{skip:!t||!e}),{data:l,isLoading:d}=useGetV4PartnerByRouteApplicationIdProductAndRandmarSkuQuery({routeApplicationId:t,randmarSku:e,withSpecification:!1},{skip:!t||!e}),{data:f,isLoading:g}=useGetV4PartnerByRouteApplicationIdProductAndRandmarSkuQuery({routeApplicationId:t,randmarSku:e,withSpecification:!0},{skip:!l});return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(PageHeader,{title:"Product Details",className:"max-w-6xl mx-auto"}),jsxRuntime.jsxs("div",{className:"max-w-6xl mx-auto",children:[jsxRuntime.jsxs("div",{className:"grid gap-4 grid-cols-1 md:grid-cols-2 lg:grid-cols-3",children:[jsxRuntime.jsx("div",{className:"lg:col-span-2",children:jsxRuntime.jsx(ProductCard,{applicationId:t,product:f||l,shopifyHostname:n})}),jsxRuntime.jsxs(Card,{children:[jsxRuntime.jsx(CardHeader,{children:jsxRuntime.jsxs(CardTitle,{children:[jsxRuntime.jsx(Info,{className:"h-5 w-5 inline mr-2"})," Additionnal information"]})}),jsxRuntime.jsx(CardContent,{children:d?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs("div",{className:"flex justify-between",children:[jsxRuntime.jsx(Skeleton,{className:"h-5 w-32"}),jsxRuntime.jsx(Skeleton,{className:"h-5 w-24"})]}),jsxRuntime.jsxs("div",{className:"flex justify-between mt-2",children:[jsxRuntime.jsx(Skeleton,{className:"h-5 w-32"}),jsxRuntime.jsx(Skeleton,{className:"h-5 w-24"})]}),jsxRuntime.jsxs("div",{className:"flex justify-between mt-2",children:[jsxRuntime.jsx(Skeleton,{className:"h-5 w-32"}),jsxRuntime.jsx(Skeleton,{className:"h-5 w-24"})]}),jsxRuntime.jsxs("div",{className:"flex justify-between mt-2",children:[jsxRuntime.jsx(Skeleton,{className:"h-5 w-32"}),jsxRuntime.jsx(Skeleton,{className:"h-5 w-24"})]}),jsxRuntime.jsx(Skeleton,{className:"h-1 w-full my-6"}),jsxRuntime.jsx(Skeleton,{className:"h-5 w-24"}),jsxRuntime.jsx(Skeleton,{className:"h-4 w-full mt-2"}),jsxRuntime.jsx(Skeleton,{className:"h-4 w-full mt-1"})]}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs("div",{className:"flex justify-between",children:[jsxRuntime.jsx("span",{className:"text-muted-foreground",children:"Cateory Name"}),jsxRuntime.jsx("span",{className:"font-medium",children:(l==null?void 0:l.ProductType)||"N/A"})]}),jsxRuntime.jsxs("div",{className:"flex justify-between mt-2",children:[jsxRuntime.jsx("span",{className:"text-muted-foreground",children:"Master Carton"}),jsxRuntime.jsx("span",{className:"font-medium",children:(l==null?void 0:l.MasterCarton)||"N/A"})]}),jsxRuntime.jsxs("div",{className:"flex justify-between mt-2",children:[jsxRuntime.jsx("span",{className:"text-muted-foreground",children:"Skid Quantity"}),jsxRuntime.jsx("span",{className:"font-medium",children:(l==null?void 0:l.SkidQuantity)||"N/A"})]}),jsxRuntime.jsxs("div",{className:"flex justify-between mt-2",children:[jsxRuntime.jsx("span",{className:"text-muted-foreground",children:"Automatic Reorder"}),jsxRuntime.jsx("span",{className:"font-medium",children:l!=null&&l.AutoUpdate?"Yes":"No"})]}),((l==null?void 0:l.VoiceoverCaption)||(l==null?void 0:l.BodyHTML))&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("hr",{className:"my-6"}),jsxRuntime.jsx("div",{className:"text-muted-foreground mb-2",children:"Description"}),jsxRuntime.jsxs("div",{className:"max-h-44 overflow-scroll",children:[(l==null?void 0:l.VoiceoverCaption)&&jsxRuntime.jsx("div",{children:l==null?void 0:l.VoiceoverCaption}),(l==null?void 0:l.BodyHTML)&&jsxRuntime.jsx("div",{className:"prose prose-sm max-w-none",dangerouslySetInnerHTML:{__html:(l==null?void 0:l.BodyHTML)??""}})]})]})]})})]})]}),jsxRuntime.jsx("div",{className:"my-4",children:d?jsxRuntime.jsx("div",{className:"mx-auto flex justify-center items-center h-32",children:jsxRuntime.jsx(LoaderCircle,{className:"h-8 w-8 animate-spin text-primary"})}):jsxRuntime.jsxs(Tabs,{defaultValue:"stats",children:[jsxRuntime.jsxs(TabsList,{className:"inline-flex h-auto items-center justify-center rounded-none border-b bg-transparent p-0",children:[jsxRuntime.jsx(TabsTrigger,{value:"stats",className:"relative h-12 rounded-none border-b-2 border-b-transparent bg-transparent px-4 pb-3 pt-2 text-sm font-medium text-muted-foreground shadow-none transition-none hover:text-foreground data-[state=active]:border-b-primary data-[state=active]:text-foreground data-[state=active]:shadow-none cursor-pointer",children:"Statistics"}),(o==null?void 0:o.IsReseller)&&jsxRuntime.jsx(TabsTrigger,{value:"opportunities",className:"relative h-12 rounded-none border-b-2 border-b-transparent bg-transparent px-4 pb-3 pt-2 text-sm font-medium text-muted-foreground shadow-none transition-none hover:text-foreground data-[state=active]:border-b-primary data-[state=active]:text-foreground data-[state=active]:shadow-none cursor-pointer",children:"Opportunities"}),jsxRuntime.jsx(TabsTrigger,{value:"orders",className:"relative h-12 rounded-none border-b-2 border-b-transparent bg-transparent px-4 pb-3 pt-2 text-sm font-medium text-muted-foreground shadow-none transition-none hover:text-foreground data-[state=active]:border-b-primary data-[state=active]:text-foreground data-[state=active]:shadow-none cursor-pointer",children:"Orders"}),jsxRuntime.jsx(TabsTrigger,{value:"warehouse",className:"relative h-12 rounded-none border-b-2 border-b-transparent bg-transparent px-4 pb-3 pt-2 text-sm font-medium text-muted-foreground shadow-none transition-none hover:text-foreground data-[state=active]:border-b-primary data-[state=active]:text-foreground data-[state=active]:shadow-none cursor-pointer",children:"Latest Warehouse Receiving"})]}),jsxRuntime.jsx(TabsContent,{value:"stats",children:jsxRuntime.jsx("div",{className:"mt-4",children:jsxRuntime.jsx(SalesChart,{salesData:(f==null?void 0:f.SalesStatistics)??[],isLoading:g})})}),(o==null?void 0:o.IsReseller)&&jsxRuntime.jsx(TabsContent,{value:"opportunities",children:jsxRuntime.jsx("div",{className:"mt-4",children:jsxRuntime.jsx(ResellerOpportunitiesTable,{applicationId:t,opportunities:l==null?void 0:l.ActiveOrderDetails,loading:d})})}),jsxRuntime.jsxs(TabsContent,{value:"orders",children:[jsxRuntime.jsx("div",{className:"mt-4",children:jsxRuntime.jsx(OrdersTable,{title:"Open Orders",orders:f==null?void 0:f.Orders,loading:g})}),jsxRuntime.jsx("div",{className:"mt-4",children:jsxRuntime.jsx(OrdersTable,{title:"Completed Orders",orders:f==null?void 0:f.CompletedOrderDetails,loading:g})})]}),jsxRuntime.jsx(TabsContent,{value:"warehouse",children:jsxRuntime.jsx("div",{className:"mt-4",children:jsxRuntime.jsx(ReceiptsTable,{receipts:f==null?void 0:f.Receipts,loading:g})})})]})})]})]})}exports.ActiveOrdersCard=ActiveOrdersCard,exports.AiGeneratedContent=AiGeneratedContent,exports.Alert=Alert,exports.AlertDescription=AlertDescription,exports.AlertDialog=AlertDialog,exports.AlertDialogAction=AlertDialogAction,exports.AlertDialogCancel=AlertDialogCancel,exports.AlertDialogContent=AlertDialogContent,exports.AlertDialogDescription=AlertDialogDescription,exports.AlertDialogFooter=AlertDialogFooter,exports.AlertDialogHeader=AlertDialogHeader,exports.AlertDialogTitle=AlertDialogTitle,exports.AlertDialogTrigger=AlertDialogTrigger,exports.AlertTitle=AlertTitle,exports.ApiKeyProvider=ApiKeyProvider,exports.AreaChart=AreaChart,exports.Avatar=Avatar,exports.AvatarFallback=AvatarFallback,exports.AvatarFooter=AvatarFooter,exports.AvatarImage=AvatarImage,exports.Badge=Badge,exports.Button=Button,exports.Card=Card,exports.CardContent=CardContent,exports.CardDescription=CardDescription,exports.CardFooter=CardFooter,exports.CardHeader=CardHeader,exports.CardTitle=CardTitle,exports.ChatLayout=ChatLayout,exports.ChatProvider=ChatProvider,exports.Checkbox=Checkbox,exports.Command=Command,exports.CommandDialog=CommandDialog,exports.CommandEmpty=CommandEmpty,exports.CommandGroup=CommandGroup,exports.CommandInput=CommandInput,exports.CommandItem=CommandItem,exports.CommandList=CommandList,exports.CommandSeparator=CommandSeparator,exports.CommandShortcut=CommandShortcut,exports.CountryFlag=CountryFlag,exports.DataTable=DataTable,exports.Dialog=Dialog,exports.DialogClose=DialogClose,exports.DialogContent=DialogContent,exports.DialogDescription=DialogDescription,exports.DialogFooter=DialogFooter,exports.DialogHeader=DialogHeader,exports.DialogOverlay=DialogOverlay,exports.DialogPortal=DialogPortal,exports.DialogTitle=DialogTitle,exports.DialogTrigger=DialogTrigger,exports.DropdownMenu=DropdownMenu,exports.DropdownMenuCheckboxItem=DropdownMenuCheckboxItem,exports.DropdownMenuContent=DropdownMenuContent,exports.DropdownMenuGroup=DropdownMenuGroup,exports.DropdownMenuItem=DropdownMenuItem,exports.DropdownMenuLabel=DropdownMenuLabel,exports.DropdownMenuPortal=DropdownMenuPortal,exports.DropdownMenuRadioGroup=DropdownMenuRadioGroup,exports.DropdownMenuRadioItem=DropdownMenuRadioItem,exports.DropdownMenuSeparator=DropdownMenuSeparator,exports.DropdownMenuShortcut=DropdownMenuShortcut,exports.DropdownMenuSub=DropdownMenuSub,exports.DropdownMenuSubContent=DropdownMenuSubContent,exports.DropdownMenuSubTrigger=DropdownMenuSubTrigger,exports.DropdownMenuTrigger=DropdownMenuTrigger,exports.ExploreManufacturers=ExploreManufacturers,exports.GeneralDocumentCard=GeneralDocumentCard,exports.Input=Input,exports.InputOTP=InputOTP,exports.InputOTPGroup=InputOTPGroup,exports.InputOTPSeparator=InputOTPSeparator,exports.InputOTPSlot=InputOTPSlot,exports.Label=Label$2,exports.Layout=Layout,exports.ManufacturerCard=ManufacturerCard,exports.ManufacturerGetStartedButton=ManufacturerGetStartedButton,exports.ManufacturerOverviewPage=ManufacturerOverviewPage,exports.ManufacturerReorderingCard=ManufacturerReorderingCard,exports.MultiSelect=MultiSelect,exports.Navbar=Navbar,exports.PageHeader=PageHeader,exports.PartnerCard=PartnerCard,exports.PartnerRelationshipPage=PartnerRelationshipPage,exports.Popover=Popover,exports.PopoverAnchor=PopoverAnchor,exports.PopoverContent=PopoverContent,exports.PopoverTrigger=PopoverTrigger,exports.Preloader=Preloader,exports.ProductCard=ProductCard,exports.ProductImage=ProductImage,exports.ProductInventoryGrid=ProductInventoryGrid,exports.ProductOverviewPage=ProductOverviewPage,exports.Progress=Progress,exports.RadioGroup=RadioGroup$1,exports.RadioGroupItem=RadioGroupItem,exports.ResellerBillingOverviewCard=ResellerBillingOverviewCard,exports.ResellerCard=ResellerCard,exports.ResellerOpportunitiesTable=ResellerOpportunitiesTable,exports.ResellerOverview=ResellerOverview,exports.ResellerQualificationsCard=ResellerQualificationsCard,exports.RichTextEditor=RichTextEditor,exports.SalesChart=SalesChart,exports.SalesOverviewCard=SalesOverviewCard,exports.ScrollArea=ScrollArea,exports.ScrollBar=ScrollBar,exports.Select=Select,exports.SelectContent=SelectContent,exports.SelectGroup=SelectGroup,exports.SelectItem=SelectItem,exports.SelectLabel=SelectLabel,exports.SelectScrollDownButton=SelectScrollDownButton,exports.SelectScrollUpButton=SelectScrollUpButton,exports.SelectTrigger=SelectTrigger,exports.SelectValue=SelectValue,exports.Separator=Separator$1,exports.Sheet=Sheet,exports.SheetClose=SheetClose,exports.SheetContent=SheetContent,exports.SheetDescription=SheetDescription,exports.SheetFooter=SheetFooter,exports.SheetHeader=SheetHeader,exports.SheetOverlay=SheetOverlay,exports.SheetPortal=SheetPortal,exports.SheetTitle=SheetTitle,exports.SheetTrigger=SheetTrigger,exports.Sidebar=Sidebar,exports.SidebarContent=SidebarContent,exports.SidebarFooter=SidebarFooter,exports.SidebarGroup=SidebarGroup,exports.SidebarGroupAction=SidebarGroupAction,exports.SidebarGroupContent=SidebarGroupContent,exports.SidebarGroupLabel=SidebarGroupLabel,exports.SidebarHeader=SidebarHeader,exports.SidebarInput=SidebarInput,exports.SidebarInset=SidebarInset,exports.SidebarMenu=SidebarMenu,exports.SidebarMenuAction=SidebarMenuAction,exports.SidebarMenuBadge=SidebarMenuBadge,exports.SidebarMenuButton=SidebarMenuButton,exports.SidebarMenuItem=SidebarMenuItem,exports.SidebarMenuSkeleton=SidebarMenuSkeleton,exports.SidebarMenuSub=SidebarMenuSub,exports.SidebarMenuSubButton=SidebarMenuSubButton,exports.SidebarMenuSubItem=SidebarMenuSubItem,exports.SidebarProvider=SidebarProvider,exports.SidebarRail=SidebarRail,exports.SidebarSeparator=SidebarSeparator,exports.SidebarTrigger=SidebarTrigger,exports.Skeleton=Skeleton,exports.Switch=Switch,exports.Table=Table,exports.TableBody=TableBody,exports.TableCaption=TableCaption,exports.TableCell=TableCell,exports.TableFooter=TableFooter,exports.TableHead=TableHead,exports.TableHeader=TableHeader,exports.TableRow=TableRow,exports.Tabs=Tabs,exports.TabsContent=TabsContent,exports.TabsList=TabsList,exports.TabsTrigger=TabsTrigger,exports.Textarea=Textarea,exports.Toast=Toast,exports.ToastAction=ToastAction,exports.ToastClose=ToastClose,exports.ToastDescription=ToastDescription,exports.ToastProvider=ToastProvider,exports.ToastTitle=ToastTitle,exports.ToastViewport=ToastViewport,exports.Toaster=Toaster,exports.Tooltip=Tooltip$1,exports.TooltipContent=TooltipContent,exports.TooltipProvider=TooltipProvider,exports.TooltipTrigger=TooltipTrigger,exports.Topbar=Topbar,exports.badgeVariants=badgeVariants,exports.buttonVariants=buttonVariants,exports.toast=toast,exports.useApiKey=useApiKey,exports.useChat=useChat,exports.useIsMobile=useIsMobile,exports.useSidebar=useSidebar,exports.useToast=useToast,Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"})});
|
|
1274
|
+
`;function RichTextEditor({id:t,name:e,value:n,onChange:o,placeholder:l,className:d,...f}){const[g,b]=React.useState(!1),_=React.useRef(null),S=React.useRef(null),R=useEditor({extensions:[StarterKit,Underline],content:n,editorProps:{attributes:{class:"prose prose-sm sm:prose dark:prose-invert focus:outline-none",id:t??"",name:e??""}},onUpdate:({editor:j})=>{const q=j.getHTML();o({target:{id:t,name:e,value:q}})}});React.useEffect(()=>{R&&n!==R.getHTML()&&R.commands.setContent(n)},[n,R]);const C=React.useCallback(j=>{if(R)if(R.chain().focus(),j==="paragraph")R.chain().setParagraph().run();else{const q=Number.parseInt(j.slice(1));R.chain().setHeading({level:q}).run()}},[R]),E=React.useCallback(j=>{if(R)switch(R.chain().focus(),j){case"bold":R.chain().toggleBold().run();break;case"italic":R.chain().toggleItalic().run();break;case"underline":R.chain().toggleUnderline().run();break;case"strike":R.chain().toggleStrike().run();break;case"bulletList":R.chain().toggleBulletList().run();break;case"orderedList":R.chain().toggleOrderedList().run();break}},[R]),A=React.useCallback(()=>{b(j=>!j)},[]),I=React.useCallback(j=>{const q=j.target.value;R&&R.commands.setContent(q),o({target:{id:t,name:e,value:q}})},[o,R,t,e]),M=React.useCallback(()=>{!g&&R&&R.commands.focus()},[g,R]);return R?jsxRuntime.jsxs("div",{ref:S,className:cn("border border-input rounded-md overflow-hidden focus-within:outline-hidden focus-within:ring-1 focus-within:ring-ring",d),onClick:M,...f,children:[jsxRuntime.jsx("style",{children:editorStyles}),jsxRuntime.jsxs("div",{className:"flex flex-wrap items-center p-2 border-b border-input gap-2 bg-background",children:[jsxRuntime.jsxs(Select,{onValueChange:C,disabled:g,children:[jsxRuntime.jsx(SelectTrigger,{className:"w-[160px]",children:jsxRuntime.jsx(SelectValue,{placeholder:"Format"})}),jsxRuntime.jsx(SelectContent,{children:formatOptions.map(j=>jsxRuntime.jsx(SelectItem,{value:j.value,children:j.label},j.value))})]}),["bold","italic","underline","strike","bulletList","orderedList"].map(j=>jsxRuntime.jsxs(Button,{type:"button",variant:"ghost",size:"sm",onClick:()=>E(j),className:R.isActive(j)?"bg-muted":"",disabled:g,children:[j==="bold"&&jsxRuntime.jsx(Bold$1,{className:"h-4 w-4"}),j==="italic"&&jsxRuntime.jsx(Italic$1,{className:"h-4 w-4"}),j==="underline"&&jsxRuntime.jsx(Underline$1,{className:"h-4 w-4"}),j==="strike"&&jsxRuntime.jsx(Strikethrough,{className:"h-4 w-4"}),j==="bulletList"&&jsxRuntime.jsx(List$1,{className:"h-4 w-4"}),j==="orderedList"&&jsxRuntime.jsx(ListOrdered,{className:"h-4 w-4"})]},j)),jsxRuntime.jsx(Button,{type:"button",variant:"ghost",size:"sm",onClick:A,className:g?"bg-muted":"",children:jsxRuntime.jsx(Code$1,{className:"h-4 w-4"})})]}),jsxRuntime.jsx("div",{className:"p-3",children:g?jsxRuntime.jsx(Textarea,{ref:_,id:t,name:e,value:R.getHTML(),onChange:I,className:cn("min-h-[150px] font-mono text-sm resize-none border-0 focus-visible:ring-0 focus-visible:ring-offset-0",d),placeholder:l}):jsxRuntime.jsx(EditorContent,{editor:R})})]}):null}function SalesChart({salesData:t,chartHeight:e=300,units:n="$",unitsPosition:o="left",className:l,isLoading:d=!1}){const[f,g]=React.useState([]),[b,_]=React.useState(!0),S=!d&&!!t&&t.length>0;return React.useEffect(()=>{if(d||!t||t.length===0){g([]);return}const R=t.reduce((Q,F)=>{const V=F.Day??0,te=Math.floor(V).toString();if(te.length!==8||isNaN(Number.parseInt(te)))return console.warn(`Skipping invalid Day format: ${F.Day}`),Q;const ae=te.substring(0,4),se=te.substring(4,6),ge=`${ae}-${se}`;return Q[ge]=(Q[ge]||0)+(F.ExtendedPrice??0),Q},{}),C=Object.keys(R).sort(),E=new Date,A=E.getFullYear(),I=E.getMonth(),M=E.getDate(),j=`${A}-${(I+1).toString().padStart(2,"0")}`,q={...R};if(b&&C.length>0&&C[C.length-1]===j){const Q=q[j],F=new Date(A,I+1,0).getDate();if(M<F&&M>0){const te=Q/M*F;q[j]=te}}const z=C.map(Q=>{const F=q[Q],[V,te]=Q.split("-").map(Number);return{month:new Date(V,te-1).toLocaleString("default",{month:"short",year:"numeric"}),sales:F}});g(z)},[t,b,d]),d?jsxRuntime.jsxs(Card,{className:"w-full",children:[jsxRuntime.jsx(CardHeader,{children:jsxRuntime.jsx(Skeleton,{className:"h-6 w-24"})}),jsxRuntime.jsxs(CardContent,{children:[jsxRuntime.jsx("div",{style:{height:e},children:jsxRuntime.jsx(Skeleton,{className:"h-full w-full rounded-md"})}),jsxRuntime.jsxs("div",{className:"flex items-center space-x-2 my-1 pt-2",children:[jsxRuntime.jsx(Skeleton,{className:"h-5 w-10"}),jsxRuntime.jsx(Skeleton,{className:"h-4 w-20"})]}),jsxRuntime.jsx(Skeleton,{className:"h-4 w-3/4 mt-1"})]})]}):f.length===0?jsxRuntime.jsx("div",{style:{height:e},className:l||"p-4 text-center text-muted-foreground flex items-center justify-center",children:"No monthly sales data to display."}):jsxRuntime.jsxs(Card,{className:"w-full",children:[jsxRuntime.jsx(CardHeader,{children:jsxRuntime.jsx(CardTitle,{children:"Sales"})}),jsxRuntime.jsxs(CardContent,{children:[jsxRuntime.jsx(AreaChart,{data:f,units:n,unitsPosition:o,height:e,className:l}),S&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs("div",{className:"flex items-center space-x-2 my-1 pt-2",children:[jsxRuntime.jsx(Switch,{checked:b,onCheckedChange:_,id:"extrapolate-switch","aria-label":"Toggle sales extrapolation"}),jsxRuntime.jsx(Label$2,{htmlFor:"extrapolate-switch",children:"Extrapolate"})]}),b&&jsxRuntime.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:"* Sales for the current month are projected, not actual."})]})]})]})}function getEndDateStatus(t){if(!t)return{text:"No End Date",variant:"neutral",daysRemaining:null};const e=new Date(t);if(isNaN(e.getTime()))return{text:"Invalid Date",variant:"neutral",daysRemaining:null};const n=new Date,o=new Date(e.getFullYear(),e.getMonth(),e.getDate()),l=new Date(n.getFullYear(),n.getMonth(),n.getDate()),d=o.getTime()-l.getTime(),f=Math.ceil(d/(1e3*60*60*24));return f<0?{text:`Ended ${Math.abs(f)}d ago`,variant:"destructive",daysRemaining:f}:f===0?{text:"Ends today",variant:"destructive",daysRemaining:f}:f<=7?{text:`Ends in ${f}d`,variant:"destructive",daysRemaining:f}:f<=30?{text:`Ends in ${f}d`,variant:"warning",daysRemaining:f}:{text:`Ends in ${f}d`,variant:"neutral",daysRemaining:f}}const formatDate=t=>{if(!t)return"N/A";try{const e=new Date(t);return isNaN(e.getTime())?"Invalid Date":e.toLocaleDateString(void 0,{year:"numeric",month:"short",day:"numeric"})}catch{return"Invalid Date"}};function ResellerOpportunitiesTable({applicationId:t,opportunities:e=null,loading:n=!1}){var V;const{toast:o}=useToast(),[l,d]=React.useState({}),[f,g]=React.useState(!1),[b,_]=React.useState(""),[S,R]=React.useState(null),C=React.useCallback((te,ae,se)=>{d(ge=>({...ge,[te]:{...ge[te],[ae]:se}}))},[]),[E]=usePutV4ResellerByRouteResellerIdOpportunityAndManufacturerIdDefaultMutation(),A=React.useCallback(async te=>{if(!te.BidNumber){o({title:"Error",description:"Bid Number is missing, cannot set default.",variant:"destructive"});return}const ae=te.BidNumber;C(ae,"isSettingDefault",!0),E({routeResellerId:t,manufacturerId:te.ManufacturerId??"",opportunityNumber:ae}).unwrap().then(()=>{o({title:"Success",description:`Opportunity "${te.OpportunityName||te.Opportunity||ae}" was successfully set as default.`,variant:"success"})}).catch(se=>{var ge;console.error("Set as default error:",se),o({title:"Error",description:((ge=se.data)==null?void 0:ge.message)||se.message||"An error occurred while setting this opportunity as default.",variant:"destructive"})}).finally(()=>{C(ae,"isSettingDefault",!1)})},[t,E,o,C]),[I]=usePostV4ResellerByRouteResellerIdOpportunityAndManufacturerIdBidNumberEmailMutation(),M=React.useCallback(te=>{if(!te.BidNumber){o({title:"Error",description:"Bid Number is missing, cannot prepare report.",variant:"destructive"});return}R(te),_(""),g(!0)},[o]),j=React.useCallback(async()=>{if(!S||!S.BidNumber){o({title:"Error",description:"No opportunity selected or Bid Number is missing.",variant:"destructive"});return}if(!b.trim()||!/\S+@\S+\.\S+/.test(b)){o({title:"Validation Error",description:"Please enter a valid email address.",variant:"destructive"});return}const te=S.BidNumber;C(te,"isSendingReport",!0),I({routeResellerId:t,manufacturerId:S.ManufacturerId??"",bidNumber:te,emailAddress:b}).unwrap().then(()=>{o({title:"Success",description:`A report for "${S.OpportunityName||S.Opportunity||te}" was successfully sent to ${b}.`,variant:"success"}),g(!1)}).catch(ae=>{var se;console.error("Send report by email error:",ae),o({title:"Error",description:((se=ae.data)==null?void 0:se.message)||ae.message||"An error occurred while sending the report by email.",variant:"destructive"})}).finally(()=>{C(te,"isSendingReport",!1),f||(R(null),_(""))})},[S,b,t,I,o,C,g]),q=React.useMemo(()=>[{accessorKey:"ManufacturerId",header:"Manuf.",cell:({row:te})=>jsxRuntime.jsx("div",{className:"w-20 h-8",children:jsxRuntime.jsx(PartnerLogo,{id:te.original.ManufacturerId,width:80,height:32})}),enableSorting:!0,enableFiltering:!0},{id:"opportunityDisplay",accessorFn:te=>te.OpportunityName||te.Opportunity,header:"Opportunity",cell:({getValue:te})=>jsxRuntime.jsx("div",{className:"min-w-[150px]",children:te()??"N/A"}),enableSorting:!0,enableFiltering:!0},{accessorKey:"BidNumber",header:"Bid Number",cell:({row:te})=>te.original.BidNumber??"N/A",enableSorting:!0,enableFiltering:!0},{id:"statusInfo",header:"Status",cell:({row:te})=>{const ae=te.original,se=ae.Active===!0,ge=getEndDateStatus(ae.EndDate);let oe="border-gray-400 bg-gray-100 text-gray-600 dark:border-gray-600 dark:bg-gray-800/50 dark:text-gray-400";return ge.variant==="destructive"?oe="border-red-500 bg-red-100 text-red-700 dark:border-red-600 dark:bg-red-900/50 dark:text-red-400":ge.variant==="warning"&&(oe="border-yellow-500 bg-yellow-100 text-yellow-700 dark:border-yellow-600 dark:bg-yellow-900/50 dark:text-yellow-400"),jsxRuntime.jsxs("div",{className:"flex items-center space-x-2 min-w-[200px]",children:[jsxRuntime.jsx(Badge,{variant:"outline",className:se?"border-green-500 bg-green-100 text-green-700 dark:border-green-600 dark:bg-green-900/50 dark:text-green-400 font-medium":"border-gray-400 bg-gray-100 text-gray-600 dark:border-gray-600 dark:bg-gray-800/50 dark:text-gray-400 font-medium",children:se?"Active":"Inactive"}),ae.EndDate&&jsxRuntime.jsx(Badge,{variant:"outline",className:`${oe} font-medium`,children:ge.text}),jsxRuntime.jsx(TooltipProvider,{delayDuration:100,children:jsxRuntime.jsxs(Tooltip$1,{children:[jsxRuntime.jsx(TooltipTrigger,{asChild:!0,children:jsxRuntime.jsx(Button,{variant:"ghost",size:"icon",className:"h-6 w-6 p-0 data-[state=delayed-open]:bg-accent data-[state=instant-open]:bg-accent",children:jsxRuntime.jsx(Info,{className:"h-4 w-4 text-muted-foreground"})})}),jsxRuntime.jsx(TooltipContent,{side:"top",align:"center",className:"bg-popover text-popover-foreground p-2 rounded shadow-lg",children:jsxRuntime.jsxs("div",{className:"text-sm space-y-1",children:[jsxRuntime.jsxs("p",{children:[jsxRuntime.jsx("strong",{children:"Start:"})," ",formatDate(ae.StartDate)]}),jsxRuntime.jsxs("p",{children:[jsxRuntime.jsx("strong",{children:"End:"})," ",formatDate(ae.EndDate)]}),jsxRuntime.jsxs("p",{children:[jsxRuntime.jsx("strong",{children:"Updated:"})," ",formatDate(ae.LastUpdate)]})]})})]})})]})},enableFiltering:!1},{id:"actions",header:"Actions",cell:({row:te})=>{var je,$e;const ae=te.original;if(!ae.BidNumber)return jsxRuntime.jsx("span",{className:"text-xs text-muted-foreground",children:"Actions unavailable"});const se=ae.BidNumber,ge=(je=l[se])==null?void 0:je.isSettingDefault,oe=(S==null?void 0:S.BidNumber)===se&&(($e=l[se])==null?void 0:$e.isSendingReport),Ae=ge||oe,Ne=ae.CanBeSetAsDefault===!0;return jsxRuntime.jsxs("div",{className:"flex space-x-2",children:[jsxRuntime.jsx("a",{href:`https://reseller.randmar.io/${t}/Opportunity/${ae.ManufacturerId}/${ae.BidNumber}`,target:"_blank",children:jsxRuntime.jsxs(Button,{variant:"outline",size:"sm",className:"flex items-center",children:[jsxRuntime.jsx(Star,{className:"mr-2 h-4 w-4"})," View"]})}),jsxRuntime.jsxs(Button,{variant:"outline",size:"sm",onClick:()=>A(ae),disabled:Ae||!Ne,title:Ne?"Set as default":"This opportunity cannot be set as default",className:"flex items-center",children:[ge?jsxRuntime.jsx(LoaderCircle,{className:"mr-2 h-4 w-4 animate-spin"}):jsxRuntime.jsx(Star,{className:"mr-2 h-4 w-4"})," Set Default"]}),jsxRuntime.jsxs(Button,{variant:"outline",size:"sm",onClick:()=>M(ae),disabled:Ae,title:"Send report by email",className:"flex items-center",children:[oe?jsxRuntime.jsx(LoaderCircle,{className:"mr-2 h-4 w-4 animate-spin"}):jsxRuntime.jsx(Send,{className:"mr-2 h-4 w-4"})," Send Report"]})]})}}],[l,A,M,S]),z=React.useMemo(()=>{const te={};if(e){const ae=Array.from(new Set(e.map(ge=>ge.ManufacturerId).filter(ge=>ge!=null)));te.ManufacturerId=ae;const se=Array.from(new Set(e.map(ge=>ge.OpportunityName||ge.Opportunity).filter(ge=>ge!=null)));te.opportunityDisplay=se}return te},[e]),Q=e||[],F=S!=null&&S.BidNumber?(V=l[S.BidNumber])==null?void 0:V.isSendingReport:!1;return n?jsxRuntime.jsxs(Card,{className:"w-full",children:[jsxRuntime.jsxs(CardHeader,{children:[" ",jsxRuntime.jsx(Skeleton,{className:"h-7 w-48"})," "]}),jsxRuntime.jsxs(CardContent,{className:"space-y-4",children:[jsxRuntime.jsx(Skeleton,{className:"h-12 w-full rounded-md border"}),jsxRuntime.jsx(Skeleton,{className:"h-48 w-full rounded-md border"}),jsxRuntime.jsxs("div",{className:"flex items-center justify-between pt-4",children:[jsxRuntime.jsx(Skeleton,{className:"h-9 w-[130px]"}),jsxRuntime.jsxs("div",{className:"flex items-center space-x-2",children:[jsxRuntime.jsx(Skeleton,{className:"h-9 w-20"})," ",jsxRuntime.jsx(Skeleton,{className:"h-9 w-24"})," ",jsxRuntime.jsx(Skeleton,{className:"h-9 w-9"})," ",jsxRuntime.jsx(Skeleton,{className:"h-9 w-9"})]})]})]})]}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(Card,{className:"w-full",children:[jsxRuntime.jsxs(CardHeader,{children:[" ",jsxRuntime.jsx(CardTitle,{className:"text-1xl font-bold",children:"Opportunities"})," "]}),jsxRuntime.jsx(CardContent,{children:jsxRuntime.jsx(DataTable,{columns:q,data:Q,uniqueValues:z})})]}),jsxRuntime.jsx(Dialog,{open:f,onOpenChange:te=>{g(te),te||(R(null),_(""))},children:jsxRuntime.jsxs(DialogContent,{className:"sm:max-w-[425px]",children:[jsxRuntime.jsxs(DialogHeader,{children:[jsxRuntime.jsx(DialogTitle,{children:"Send Opportunity Report"}),jsxRuntime.jsxs(DialogDescription,{children:["Enter the email address to send the report for opportunity: ",jsxRuntime.jsx("br",{}),jsxRuntime.jsx("span",{className:"font-semibold",children:(S==null?void 0:S.OpportunityName)||(S==null?void 0:S.Opportunity)||"N/A"}),(S==null?void 0:S.BidNumber)&&jsxRuntime.jsxs("span",{className:"block text-sm text-muted-foreground",children:["Bid Number: ",S.BidNumber]})]})]}),jsxRuntime.jsx("div",{className:"grid gap-4 py-4",children:jsxRuntime.jsxs("div",{className:"grid grid-cols-4 items-center gap-4",children:[jsxRuntime.jsx(Label$2,{htmlFor:"email",className:"text-right",children:"Email"}),jsxRuntime.jsx(Input,{id:"email",type:"email",value:b,onChange:te=>_(te.target.value),placeholder:"recipient@example.com",className:"col-span-3",disabled:F})]})}),jsxRuntime.jsxs(DialogFooter,{children:[jsxRuntime.jsx(Button,{variant:"outline",onClick:()=>g(!1),disabled:F,children:"Cancel"}),jsxRuntime.jsxs(Button,{type:"submit",onClick:j,disabled:F,children:[F&&jsxRuntime.jsx(LoaderCircle,{className:"mr-2 h-4 w-4 animate-spin"})," Send Report"]})]})]})})]})}function formatYYYYMMDDIntToDateString$1(t){if(t===null||typeof t>"u")return"N/A";const e=t.toString();return e.length===8?`${e.substring(0,4)}-${e.substring(4,6)}-${e.substring(6,8)}`:e}function formatCurrency(t){return t===null||typeof t>"u"?"N/A":t.toLocaleString(void 0,{style:"currency",currency:"CAD"})}function OrdersTable({orders:t=null,loading:e=!1,title:n="Order Details"}){const o=React.useMemo(()=>[{accessorKey:"DocumentNumber",header:"Document Number",cell:({row:f})=>f.original.DocumentNumber??"N/A",enableSorting:!0,enableFiltering:!0},{accessorKey:"DocumentDate",header:"Document Date",cell:({row:f})=>formatYYYYMMDDIntToDateString$1(f.original.DocumentDate),enableSorting:!0,enableFiltering:!1},{accessorKey:"OrderNumber",header:"Order Number",cell:({row:f})=>f.original.OrderNumber??"N/A",enableSorting:!0,enableFiltering:!0},{accessorKey:"PONumber",header:"PO Number",cell:({row:f})=>f.original.PONumber??"N/A",enableSorting:!0,enableFiltering:!0},{accessorKey:"WarehouseCode",header:"Warehouse",cell:({row:f})=>f.original.WarehouseCode??"N/A",enableSorting:!0,enableFiltering:!0},{accessorKey:"Quantity",header:"Quantity",cell:({row:f})=>f.original.Quantity??"N/A",enableSorting:!0,enableFiltering:!1},{accessorKey:"ShipToName",header:"Name",cell:({row:f})=>jsxRuntime.jsx("div",{className:"min-w-[150px]",children:f.original.ShipToName??"N/A"}),enableSorting:!0,enableFiltering:!0},{accessorKey:"UnitPrice",header:"Unit Price",cell:({row:f})=>formatCurrency(f.original.UnitPrice),enableSorting:!0,enableFiltering:!1}],[]),l=React.useMemo(()=>{const f={};if(t){const g=Array.from(new Set(t.map(C=>C.WarehouseCode).filter(C=>C!=null)));f.WarehouseCode=g;const b=Array.from(new Set(t.map(C=>C.ShipToName).filter(C=>C!=null)));f.ShipToName=b;const _=Array.from(new Set(t.map(C=>C.DocumentNumber).filter(C=>C!=null)));f.DocumentNumber=_;const S=Array.from(new Set(t.map(C=>C.OrderNumber).filter(C=>C!=null)));f.OrderNumber=S;const R=Array.from(new Set(t.map(C=>C.PONumber).filter(C=>C!=null)));f.PONumber=R}return f},[t]),d=t||[];return e?jsxRuntime.jsxs(Card,{className:"w-full",children:[jsxRuntime.jsxs(CardHeader,{children:[" ",jsxRuntime.jsx(Skeleton,{className:"h-7 w-48"})," "]}),jsxRuntime.jsxs(CardContent,{className:"space-y-4",children:[jsxRuntime.jsx(Skeleton,{className:"h-12 w-full rounded-md border"}),jsxRuntime.jsx(Skeleton,{className:"h-10 w-full rounded-md border"}),jsxRuntime.jsx(Skeleton,{className:"h-10 w-full rounded-md border"}),jsxRuntime.jsx(Skeleton,{className:"h-10 w-full rounded-md border"}),jsxRuntime.jsxs("div",{className:"flex items-center justify-between pt-4",children:[jsxRuntime.jsx(Skeleton,{className:"h-9 w-[130px]"}),jsxRuntime.jsxs("div",{className:"flex items-center space-x-2",children:[jsxRuntime.jsx(Skeleton,{className:"h-9 w-20"}),jsxRuntime.jsx(Skeleton,{className:"h-9 w-24"}),jsxRuntime.jsx(Skeleton,{className:"h-9 w-9"}),jsxRuntime.jsx(Skeleton,{className:"h-9 w-9"})]})]})]})]}):jsxRuntime.jsxs(Card,{className:"w-full",children:[jsxRuntime.jsxs(CardHeader,{children:[" ",jsxRuntime.jsx(CardTitle,{className:"text-1xl font-bold",children:n})," "]}),jsxRuntime.jsx(CardContent,{children:jsxRuntime.jsx(DataTable,{columns:o,data:d,uniqueValues:l})})]})}function formatYYYYMMDDIntToDateString(t){if(t===null||typeof t>"u")return"N/A";const e=t.toString();return e.length===8?`${e.substring(0,4)}-${e.substring(4,6)}-${e.substring(6,8)}`:e}function ReceiptsTable({receipts:t=null,loading:e=!1,title:n="Latest Warehouse Receivings"}){const o=React.useMemo(()=>[{accessorKey:"Location",header:"Location",cell:({row:f})=>jsxRuntime.jsx("div",{className:"min-w-[150px]",children:f.original.Location??"N/A"}),enableSorting:!0,enableFiltering:!0},{accessorKey:"ReceiptDate",header:"Date",cell:({row:f})=>formatYYYYMMDDIntToDateString(f.original.ReceiptDate),enableSorting:!0,enableFiltering:!0},{accessorKey:"Quantity",header:"Quantity",cell:({row:f})=>f.original.Quantity??"N/A",enableSorting:!0,enableFiltering:!0}],[]),l=React.useMemo(()=>{const f={};if(t){const g=Array.from(new Set(t.map(_=>_.Location).filter(_=>_!=null)));f.Location=g;const b=Array.from(new Set(t.map(_=>formatYYYYMMDDIntToDateString(_.ReceiptDate)).filter(_=>_!=="N/A"&&_!=="Invalid Date"))).sort((_,S)=>new Date(S).getTime()-new Date(_).getTime());f.ReceiptDate=b}return f},[t]),d=t||[];return e?jsxRuntime.jsxs(Card,{className:"w-full",children:[jsxRuntime.jsxs(CardHeader,{children:[" ",jsxRuntime.jsx(Skeleton,{className:"h-7 w-56"})," "]}),jsxRuntime.jsxs(CardContent,{className:"space-y-4",children:[jsxRuntime.jsx(Skeleton,{className:"h-12 w-full rounded-md border"}),jsxRuntime.jsx(Skeleton,{className:"h-10 w-full rounded-md border"}),jsxRuntime.jsx(Skeleton,{className:"h-10 w-full rounded-md border"}),jsxRuntime.jsx(Skeleton,{className:"h-10 w-full rounded-md border"}),jsxRuntime.jsxs("div",{className:"flex items-center justify-between pt-4",children:[jsxRuntime.jsx(Skeleton,{className:"h-9 w-[130px]"}),jsxRuntime.jsxs("div",{className:"flex items-center space-x-2",children:[jsxRuntime.jsx(Skeleton,{className:"h-9 w-20"}),jsxRuntime.jsx(Skeleton,{className:"h-9 w-24"}),jsxRuntime.jsx(Skeleton,{className:"h-9 w-9"}),jsxRuntime.jsx(Skeleton,{className:"h-9 w-9"})]})]})]})]}):jsxRuntime.jsxs(Card,{className:"w-full",children:[jsxRuntime.jsxs(CardHeader,{children:[" ",jsxRuntime.jsx(CardTitle,{className:"text-1xl font-bold",children:n})," "]}),jsxRuntime.jsx(CardContent,{children:jsxRuntime.jsx(DataTable,{columns:o,data:d,uniqueValues:l})})]})}function ProductOverviewPage({applicationId:t,sku:e,productDefaultOpportunityNumber:n="",productOnAddToCart:o,productAddingToCart:l=!1,productShopifyHostname:d,productCustomAction:f=jsxRuntime.jsx(jsxRuntime.Fragment,{})}){const{data:g}=useGetV4PartnerByApplicationIdAccountQuery({applicationId:t},{skip:!t||!e}),{data:b,isLoading:_}=useGetV4PartnerByRouteApplicationIdProductAndRandmarSkuQuery({routeApplicationId:t,randmarSku:e,withSpecification:!1},{skip:!t||!e}),{data:S,isLoading:R}=useGetV4PartnerByRouteApplicationIdProductAndRandmarSkuQuery({routeApplicationId:t,randmarSku:e,withSpecification:!0},{skip:!b});return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs("div",{className:"grid gap-4 grid-cols-1 md:grid-cols-2 lg:grid-cols-3",children:[jsxRuntime.jsx("div",{className:"lg:col-span-2",children:jsxRuntime.jsx(ProductCard,{applicationId:t,product:S||b,defaultOpportunityNumber:n,onAddToCart:o,addingToCart:l,shopifyHostname:d,customAction:f})}),jsxRuntime.jsxs(Card,{children:[jsxRuntime.jsx(CardHeader,{children:jsxRuntime.jsxs(CardTitle,{children:[jsxRuntime.jsx(Info,{className:"h-5 w-5 inline mr-2"})," Additionnal information"]})}),jsxRuntime.jsx(CardContent,{children:_?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs("div",{className:"flex justify-between",children:[jsxRuntime.jsx(Skeleton,{className:"h-5 w-32"}),jsxRuntime.jsx(Skeleton,{className:"h-5 w-24"})]}),jsxRuntime.jsxs("div",{className:"flex justify-between mt-2",children:[jsxRuntime.jsx(Skeleton,{className:"h-5 w-32"}),jsxRuntime.jsx(Skeleton,{className:"h-5 w-24"})]}),jsxRuntime.jsxs("div",{className:"flex justify-between mt-2",children:[jsxRuntime.jsx(Skeleton,{className:"h-5 w-32"}),jsxRuntime.jsx(Skeleton,{className:"h-5 w-24"})]}),jsxRuntime.jsxs("div",{className:"flex justify-between mt-2",children:[jsxRuntime.jsx(Skeleton,{className:"h-5 w-32"}),jsxRuntime.jsx(Skeleton,{className:"h-5 w-24"})]}),jsxRuntime.jsx(Skeleton,{className:"h-1 w-full my-6"}),jsxRuntime.jsx(Skeleton,{className:"h-5 w-24"}),jsxRuntime.jsx(Skeleton,{className:"h-4 w-full mt-2"}),jsxRuntime.jsx(Skeleton,{className:"h-4 w-full mt-1"})]}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs("div",{className:"flex justify-between",children:[jsxRuntime.jsx("span",{className:"text-muted-foreground",children:"Cateory Name"}),jsxRuntime.jsx("span",{className:"font-medium",children:(b==null?void 0:b.ProductType)||"N/A"})]}),jsxRuntime.jsxs("div",{className:"flex justify-between mt-2",children:[jsxRuntime.jsx("span",{className:"text-muted-foreground",children:"Master Carton"}),jsxRuntime.jsx("span",{className:"font-medium",children:(b==null?void 0:b.MasterCarton)||"N/A"})]}),jsxRuntime.jsxs("div",{className:"flex justify-between mt-2",children:[jsxRuntime.jsx("span",{className:"text-muted-foreground",children:"Skid Quantity"}),jsxRuntime.jsx("span",{className:"font-medium",children:(b==null?void 0:b.SkidQuantity)||"N/A"})]}),jsxRuntime.jsxs("div",{className:"flex justify-between mt-2",children:[jsxRuntime.jsx("span",{className:"text-muted-foreground",children:"Automatic Reorder"}),jsxRuntime.jsx("span",{className:"font-medium",children:b!=null&&b.AutoUpdate?"Yes":"No"})]}),((b==null?void 0:b.VoiceoverCaption)||(b==null?void 0:b.BodyHTML))&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("hr",{className:"my-6"}),jsxRuntime.jsx("div",{className:"text-muted-foreground mb-2",children:"Description"}),jsxRuntime.jsxs("div",{className:"max-h-44 overflow-scroll",children:[(b==null?void 0:b.VoiceoverCaption)&&jsxRuntime.jsx("div",{children:b==null?void 0:b.VoiceoverCaption}),(b==null?void 0:b.BodyHTML)&&jsxRuntime.jsx("div",{className:"prose prose-sm max-w-none",dangerouslySetInnerHTML:{__html:(b==null?void 0:b.BodyHTML)??""}})]})]})]})})]})]}),jsxRuntime.jsx("div",{className:"my-4",children:_?jsxRuntime.jsx("div",{className:"mx-auto flex justify-center items-center h-32",children:jsxRuntime.jsx(LoaderCircle,{className:"h-8 w-8 animate-spin text-primary"})}):jsxRuntime.jsxs(Tabs,{defaultValue:"stats",children:[jsxRuntime.jsxs(TabsList,{className:"inline-flex h-auto items-center justify-center rounded-none border-b bg-transparent p-0",children:[jsxRuntime.jsx(TabsTrigger,{value:"stats",className:"relative h-12 rounded-none border-b-2 border-b-transparent bg-transparent px-4 pb-3 pt-2 text-sm font-medium text-muted-foreground shadow-none transition-none hover:text-foreground data-[state=active]:border-b-primary data-[state=active]:text-foreground data-[state=active]:shadow-none cursor-pointer",children:"Statistics"}),(g==null?void 0:g.IsReseller)&&jsxRuntime.jsx(TabsTrigger,{value:"opportunities",className:"relative h-12 rounded-none border-b-2 border-b-transparent bg-transparent px-4 pb-3 pt-2 text-sm font-medium text-muted-foreground shadow-none transition-none hover:text-foreground data-[state=active]:border-b-primary data-[state=active]:text-foreground data-[state=active]:shadow-none cursor-pointer",children:"Opportunities"}),jsxRuntime.jsx(TabsTrigger,{value:"orders",className:"relative h-12 rounded-none border-b-2 border-b-transparent bg-transparent px-4 pb-3 pt-2 text-sm font-medium text-muted-foreground shadow-none transition-none hover:text-foreground data-[state=active]:border-b-primary data-[state=active]:text-foreground data-[state=active]:shadow-none cursor-pointer",children:"Orders"}),jsxRuntime.jsx(TabsTrigger,{value:"warehouse",className:"relative h-12 rounded-none border-b-2 border-b-transparent bg-transparent px-4 pb-3 pt-2 text-sm font-medium text-muted-foreground shadow-none transition-none hover:text-foreground data-[state=active]:border-b-primary data-[state=active]:text-foreground data-[state=active]:shadow-none cursor-pointer",children:"Latest Warehouse Receiving"})]}),jsxRuntime.jsx(TabsContent,{value:"stats",children:jsxRuntime.jsx("div",{className:"mt-4",children:jsxRuntime.jsx(SalesChart,{salesData:(S==null?void 0:S.SalesStatistics)??[],isLoading:R})})}),(g==null?void 0:g.IsReseller)&&jsxRuntime.jsx(TabsContent,{value:"opportunities",children:jsxRuntime.jsx("div",{className:"mt-4",children:jsxRuntime.jsx(ResellerOpportunitiesTable,{applicationId:t,opportunities:b==null?void 0:b.Opportunities,loading:_})})}),jsxRuntime.jsxs(TabsContent,{value:"orders",children:[jsxRuntime.jsx("div",{className:"mt-4",children:jsxRuntime.jsx(OrdersTable,{title:"Open Orders",orders:S==null?void 0:S.ActiveOrderDetails,loading:R})}),jsxRuntime.jsx("div",{className:"mt-4",children:jsxRuntime.jsx(OrdersTable,{title:"Completed Orders",orders:S==null?void 0:S.CompletedOrderDetails,loading:R})})]}),jsxRuntime.jsx(TabsContent,{value:"warehouse",children:jsxRuntime.jsx("div",{className:"mt-4",children:jsxRuntime.jsx(ReceiptsTable,{receipts:S==null?void 0:S.Receipts,loading:R})})})]})})]})}exports.ActiveOrdersCard=ActiveOrdersCard,exports.AiGeneratedContent=AiGeneratedContent,exports.Alert=Alert,exports.AlertDescription=AlertDescription,exports.AlertDialog=AlertDialog,exports.AlertDialogAction=AlertDialogAction,exports.AlertDialogCancel=AlertDialogCancel,exports.AlertDialogContent=AlertDialogContent,exports.AlertDialogDescription=AlertDialogDescription,exports.AlertDialogFooter=AlertDialogFooter,exports.AlertDialogHeader=AlertDialogHeader,exports.AlertDialogTitle=AlertDialogTitle,exports.AlertDialogTrigger=AlertDialogTrigger,exports.AlertTitle=AlertTitle,exports.ApiKeyProvider=ApiKeyProvider,exports.AreaChart=AreaChart,exports.Avatar=Avatar,exports.AvatarFallback=AvatarFallback,exports.AvatarFooter=AvatarFooter,exports.AvatarImage=AvatarImage,exports.Badge=Badge,exports.Button=Button,exports.Card=Card,exports.CardContent=CardContent,exports.CardDescription=CardDescription,exports.CardFooter=CardFooter,exports.CardHeader=CardHeader,exports.CardTitle=CardTitle,exports.ChatLayout=ChatLayout,exports.ChatProvider=ChatProvider,exports.Checkbox=Checkbox,exports.Command=Command,exports.CommandDialog=CommandDialog,exports.CommandEmpty=CommandEmpty,exports.CommandGroup=CommandGroup,exports.CommandInput=CommandInput,exports.CommandItem=CommandItem,exports.CommandList=CommandList,exports.CommandSeparator=CommandSeparator,exports.CommandShortcut=CommandShortcut,exports.CountryFlag=CountryFlag,exports.DataTable=DataTable,exports.Dialog=Dialog,exports.DialogClose=DialogClose,exports.DialogContent=DialogContent,exports.DialogDescription=DialogDescription,exports.DialogFooter=DialogFooter,exports.DialogHeader=DialogHeader,exports.DialogOverlay=DialogOverlay,exports.DialogPortal=DialogPortal,exports.DialogTitle=DialogTitle,exports.DialogTrigger=DialogTrigger,exports.DropdownMenu=DropdownMenu,exports.DropdownMenuCheckboxItem=DropdownMenuCheckboxItem,exports.DropdownMenuContent=DropdownMenuContent,exports.DropdownMenuGroup=DropdownMenuGroup,exports.DropdownMenuItem=DropdownMenuItem,exports.DropdownMenuLabel=DropdownMenuLabel,exports.DropdownMenuPortal=DropdownMenuPortal,exports.DropdownMenuRadioGroup=DropdownMenuRadioGroup,exports.DropdownMenuRadioItem=DropdownMenuRadioItem,exports.DropdownMenuSeparator=DropdownMenuSeparator,exports.DropdownMenuShortcut=DropdownMenuShortcut,exports.DropdownMenuSub=DropdownMenuSub,exports.DropdownMenuSubContent=DropdownMenuSubContent,exports.DropdownMenuSubTrigger=DropdownMenuSubTrigger,exports.DropdownMenuTrigger=DropdownMenuTrigger,exports.ExploreManufacturers=ExploreManufacturers,exports.GeneralDocumentCard=GeneralDocumentCard,exports.Input=Input,exports.InputOTP=InputOTP,exports.InputOTPGroup=InputOTPGroup,exports.InputOTPSeparator=InputOTPSeparator,exports.InputOTPSlot=InputOTPSlot,exports.Label=Label$2,exports.Layout=Layout,exports.ManufacturerCard=ManufacturerCard,exports.ManufacturerGetStartedButton=ManufacturerGetStartedButton,exports.ManufacturerOverviewPage=ManufacturerOverviewPage,exports.ManufacturerReorderingCard=ManufacturerReorderingCard,exports.MultiSelect=MultiSelect,exports.Navbar=Navbar,exports.PageHeader=PageHeader,exports.PartnerCard=PartnerCard,exports.PartnerRelationshipPage=PartnerRelationshipPage,exports.Popover=Popover,exports.PopoverAnchor=PopoverAnchor,exports.PopoverContent=PopoverContent,exports.PopoverTrigger=PopoverTrigger,exports.Preloader=Preloader,exports.ProductCard=ProductCard,exports.ProductImage=ProductImage,exports.ProductInventoryGrid=ProductInventoryGrid,exports.ProductOverviewPage=ProductOverviewPage,exports.Progress=Progress,exports.RadioGroup=RadioGroup$1,exports.RadioGroupItem=RadioGroupItem,exports.ResellerBillingOverviewCard=ResellerBillingOverviewCard,exports.ResellerCard=ResellerCard,exports.ResellerOpportunitiesTable=ResellerOpportunitiesTable,exports.ResellerOverview=ResellerOverview,exports.ResellerQualificationsCard=ResellerQualificationsCard,exports.RichTextEditor=RichTextEditor,exports.SalesChart=SalesChart,exports.SalesOverviewCard=SalesOverviewCard,exports.ScrollArea=ScrollArea,exports.ScrollBar=ScrollBar,exports.Select=Select,exports.SelectContent=SelectContent,exports.SelectGroup=SelectGroup,exports.SelectItem=SelectItem,exports.SelectLabel=SelectLabel,exports.SelectScrollDownButton=SelectScrollDownButton,exports.SelectScrollUpButton=SelectScrollUpButton,exports.SelectTrigger=SelectTrigger,exports.SelectValue=SelectValue,exports.Separator=Separator$1,exports.Sheet=Sheet,exports.SheetClose=SheetClose,exports.SheetContent=SheetContent,exports.SheetDescription=SheetDescription,exports.SheetFooter=SheetFooter,exports.SheetHeader=SheetHeader,exports.SheetOverlay=SheetOverlay,exports.SheetPortal=SheetPortal,exports.SheetTitle=SheetTitle,exports.SheetTrigger=SheetTrigger,exports.Sidebar=Sidebar,exports.SidebarContent=SidebarContent,exports.SidebarFooter=SidebarFooter,exports.SidebarGroup=SidebarGroup,exports.SidebarGroupAction=SidebarGroupAction,exports.SidebarGroupContent=SidebarGroupContent,exports.SidebarGroupLabel=SidebarGroupLabel,exports.SidebarHeader=SidebarHeader,exports.SidebarInput=SidebarInput,exports.SidebarInset=SidebarInset,exports.SidebarMenu=SidebarMenu,exports.SidebarMenuAction=SidebarMenuAction,exports.SidebarMenuBadge=SidebarMenuBadge,exports.SidebarMenuButton=SidebarMenuButton,exports.SidebarMenuItem=SidebarMenuItem,exports.SidebarMenuSkeleton=SidebarMenuSkeleton,exports.SidebarMenuSub=SidebarMenuSub,exports.SidebarMenuSubButton=SidebarMenuSubButton,exports.SidebarMenuSubItem=SidebarMenuSubItem,exports.SidebarProvider=SidebarProvider,exports.SidebarRail=SidebarRail,exports.SidebarSeparator=SidebarSeparator,exports.SidebarTrigger=SidebarTrigger,exports.Skeleton=Skeleton,exports.Switch=Switch,exports.Table=Table,exports.TableBody=TableBody,exports.TableCaption=TableCaption,exports.TableCell=TableCell,exports.TableFooter=TableFooter,exports.TableHead=TableHead,exports.TableHeader=TableHeader,exports.TableRow=TableRow,exports.Tabs=Tabs,exports.TabsContent=TabsContent,exports.TabsList=TabsList,exports.TabsTrigger=TabsTrigger,exports.Textarea=Textarea,exports.Toast=Toast,exports.ToastAction=ToastAction,exports.ToastClose=ToastClose,exports.ToastDescription=ToastDescription,exports.ToastProvider=ToastProvider,exports.ToastTitle=ToastTitle,exports.ToastViewport=ToastViewport,exports.Toaster=Toaster,exports.Tooltip=Tooltip$1,exports.TooltipContent=TooltipContent,exports.TooltipProvider=TooltipProvider,exports.TooltipTrigger=TooltipTrigger,exports.Topbar=Topbar,exports.badgeVariants=badgeVariants,exports.buttonVariants=buttonVariants,exports.toast=toast,exports.useApiKey=useApiKey,exports.useChat=useChat,exports.useIsMobile=useIsMobile,exports.useSidebar=useSidebar,exports.useToast=useToast,Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"})});
|