randmarcomps 1.139.0 → 1.141.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 +7 -1
- package/dist/randmarcomps.js +1064 -1049
- package/dist/randmarcomps.umd.cjs +4 -4
- package/package.json +1 -3
package/dist/randmarcomps.js
CHANGED
|
@@ -6,7 +6,7 @@ import * as React from "react";
|
|
|
6
6
|
import React__default, { forwardRef, createElement, useState, useLayoutEffect, useEffect, isValidElement, Children, PureComponent, useRef, useImperativeHandle, useCallback, useMemo, cloneElement, useContext, createContext, Component, useDebugValue } from "react";
|
|
7
7
|
import * as ReactDOM from "react-dom";
|
|
8
8
|
import ReactDOM__default from "react-dom";
|
|
9
|
-
import { useLocation, useParams
|
|
9
|
+
import { Link, useLocation, useParams } from "react-router-dom";
|
|
10
10
|
var Bt = Object.defineProperty, At = Object.defineProperties, kt = Object.getOwnPropertyDescriptors, Y = Object.getOwnPropertySymbols, gt = Object.prototype.hasOwnProperty, Et = Object.prototype.propertyIsEnumerable, vt = (t, e, n) => e in t ? Bt(t, e, { enumerable: !0, configurable: !0, writable: !0, value: n }) : t[e] = n, St = (t, e) => {
|
|
11
11
|
for (var n in e || (e = {})) gt.call(e, n) && vt(t, n, e[n]);
|
|
12
12
|
if (Y) for (var n of Y(e)) Et.call(e, n) && vt(t, n, e[n]);
|
|
@@ -50163,10 +50163,10 @@ ${p.description}` : p.summary || `${f.toUpperCase()} ${m[m.length - 1]}`,
|
|
|
50163
50163
|
var R;
|
|
50164
50164
|
try {
|
|
50165
50165
|
let I = `https://api.randmar.io${l}`;
|
|
50166
|
-
|
|
50166
|
+
E.forEach((B) => {
|
|
50167
50167
|
const F = `{${B}}`, j = B;
|
|
50168
50168
|
I = I.replace(F, T[j]);
|
|
50169
|
-
})
|
|
50169
|
+
});
|
|
50170
50170
|
const M = localStorage.getItem("access_token"), A = {
|
|
50171
50171
|
method: f.toUpperCase(),
|
|
50172
50172
|
headers: {
|
|
@@ -50181,15 +50181,12 @@ ${p.description}` : p.summary || `${f.toUpperCase()} ${m[m.length - 1]}`,
|
|
|
50181
50181
|
const F = T[bodyKey];
|
|
50182
50182
|
F && (A.body = F);
|
|
50183
50183
|
}
|
|
50184
|
-
console.log(`[API Function] Making request to: ${I}`), console.log("[API Function] Request options:", A);
|
|
50185
50184
|
const D = await fetch(I, A);
|
|
50186
|
-
if (
|
|
50185
|
+
if (!D.ok) {
|
|
50187
50186
|
const B = await D.text();
|
|
50188
50187
|
throw console.error(`[API Function] Error response: ${B}`), new Error(`Error ${D.status}: ${B}`);
|
|
50189
50188
|
}
|
|
50190
|
-
const V = await D.json();
|
|
50191
|
-
console.log("[API Function] Response data:", V);
|
|
50192
|
-
const L = getComponent(l, V);
|
|
50189
|
+
const V = await D.json(), L = getComponent(l, V);
|
|
50193
50190
|
return L ? {
|
|
50194
50191
|
component: L,
|
|
50195
50192
|
summary: JSON.stringify(V, null, 2)
|
|
@@ -50201,7 +50198,7 @@ ${p.description}` : p.summary || `${f.toUpperCase()} ${m[m.length - 1]}`,
|
|
|
50201
50198
|
o.push({ declaration: C, handler: S });
|
|
50202
50199
|
}
|
|
50203
50200
|
}
|
|
50204
|
-
return
|
|
50201
|
+
return o;
|
|
50205
50202
|
} catch (n) {
|
|
50206
50203
|
return console.error("Error fetching API functions:", n), [];
|
|
50207
50204
|
}
|
|
@@ -50236,8 +50233,8 @@ function useAIAssistant({ userId: t, apiKey: e }) {
|
|
|
50236
50233
|
}, [o]), useEffect(() => {
|
|
50237
50234
|
(async () => {
|
|
50238
50235
|
try {
|
|
50239
|
-
const D = await (await fetch("https://docs.google.com/document/d/e/2PACX-1vT-f5SWSJ2BcRUcyiumzT1aPUeC8kyyV7ryJTTymWJWOcRbDRgV5nX6Wyh7HaSPf8rxTY9w63Q2C8rG/pub")).text(), F = new DOMParser().parseFromString(D, "text/html").querySelector(".doc-content").innerHTML.replace(/__user_id__/g, t);
|
|
50240
|
-
|
|
50236
|
+
const D = await (await fetch("https://docs.google.com/document/d/e/2PACX-1vT-f5SWSJ2BcRUcyiumzT1aPUeC8kyyV7ryJTTymWJWOcRbDRgV5nX6Wyh7HaSPf8rxTY9w63Q2C8rG/pub")).text(), F = new DOMParser().parseFromString(D, "text/html").querySelector(".doc-content").innerHTML.replace(/__user_id__/g, t).replace(/__today__/g, "" + /* @__PURE__ */ new Date());
|
|
50237
|
+
_(F);
|
|
50241
50238
|
} catch (O) {
|
|
50242
50239
|
console.error("Error fetching system instructions:", O), _("You are a helpful assistant, but cannot help the user right now. They should come back another time.");
|
|
50243
50240
|
}
|
|
@@ -50296,14 +50293,14 @@ function useAIAssistant({ userId: t, apiKey: e }) {
|
|
|
50296
50293
|
if (!(O in S))
|
|
50297
50294
|
return console.error(`Function ${O} not found`), "";
|
|
50298
50295
|
const D = S[O], V = N.args || {};
|
|
50299
|
-
if (
|
|
50296
|
+
if (!((B = m.find((F) => F.declaration.name === O)) == null ? void 0 : B.declaration))
|
|
50300
50297
|
return console.error(`[Function Call] Could not find declaration for ${O}`), "";
|
|
50301
50298
|
try {
|
|
50302
50299
|
p((U) => [...U, `Calling ${O} with:
|
|
50303
50300
|
${JSON.stringify(V, null, 2)}`]);
|
|
50304
50301
|
const F = await D(V);
|
|
50305
50302
|
let j, q = null, G = !1;
|
|
50306
|
-
return typeof F == "string" ? j = F : (j = F.summary, q = F.component, G = !0), p((U) => [...U, `${O} returned ${j.length} character(s).`]),
|
|
50303
|
+
return typeof F == "string" ? j = F : (j = F.summary, q = F.component, G = !0), p((U) => [...U, `${O} returned ${j.length} character(s).`]), o ? (G && q && I({
|
|
50307
50304
|
role: "assistant",
|
|
50308
50305
|
content: q,
|
|
50309
50306
|
timestamp: /* @__PURE__ */ new Date(),
|
|
@@ -52196,6 +52193,18 @@ function PartnerCard({ account: t, action: e, loading: n = !1, withVoice: i = !0
|
|
|
52196
52193
|
] })
|
|
52197
52194
|
] });
|
|
52198
52195
|
}
|
|
52196
|
+
const Textarea = React.forwardRef(({ className: t, ...e }, n) => /* @__PURE__ */ jsx(
|
|
52197
|
+
"textarea",
|
|
52198
|
+
{
|
|
52199
|
+
className: cn(
|
|
52200
|
+
"flex min-h-[60px] w-full rounded-md border border-input bg-transparent px-3 py-2 text-base shadow-xs placeholder:text-muted-foreground focus-visible:outline-hidden focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50 md:text-sm",
|
|
52201
|
+
t
|
|
52202
|
+
),
|
|
52203
|
+
ref: n,
|
|
52204
|
+
...e
|
|
52205
|
+
}
|
|
52206
|
+
));
|
|
52207
|
+
Textarea.displayName = "Textarea";
|
|
52199
52208
|
const ASSISTANT_ID = "RandmarAIChatAssistant", ChatLayout = forwardRef(
|
|
52200
52209
|
({ userId: t, userName: e, apiKey: n, inputRef: i }, o) => {
|
|
52201
52210
|
var ce, se, te;
|
|
@@ -52351,7 +52360,7 @@ const ASSISTANT_ID = "RandmarAIChatAssistant", ChatLayout = forwardRef(
|
|
|
52351
52360
|
}, ae = () => {
|
|
52352
52361
|
V((Z) => Z.map((de) => de.partner1 !== ASSISTANT_ID && de.partner2 !== ASSISTANT_ID ? de : { ...de, messages: [] })), C();
|
|
52353
52362
|
};
|
|
52354
|
-
return /* @__PURE__ */ jsxs("div", { className: "flex h-[
|
|
52363
|
+
return /* @__PURE__ */ jsxs("div", { className: "flex h-[85vh] overflow-hidden", children: [
|
|
52355
52364
|
/* @__PURE__ */ jsxs("div", { className: "w-[260px] p-4 pt-3 flex flex-col border-r", children: [
|
|
52356
52365
|
/* @__PURE__ */ jsx("div", { className: "p-4 font-semibold border-b", children: "Communications" }),
|
|
52357
52366
|
D.length > 1 && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
@@ -52403,14 +52412,16 @@ const ASSISTANT_ID = "RandmarAIChatAssistant", ChatLayout = forwardRef(
|
|
|
52403
52412
|
] }),
|
|
52404
52413
|
/* @__PURE__ */ jsxs("div", { className: "p-4 border-t flex", children: [
|
|
52405
52414
|
/* @__PURE__ */ jsx(
|
|
52406
|
-
|
|
52415
|
+
Textarea,
|
|
52407
52416
|
{
|
|
52408
52417
|
ref: W,
|
|
52409
52418
|
placeholder: "Type a message...",
|
|
52410
52419
|
value: M,
|
|
52411
52420
|
onChange: (Z) => A(Z.target.value),
|
|
52412
|
-
onKeyDown: (Z) =>
|
|
52413
|
-
|
|
52421
|
+
onKeyDown: (Z) => {
|
|
52422
|
+
Z.key !== "Enter" || Z.shiftKey || (Z.preventDefault(), ie());
|
|
52423
|
+
},
|
|
52424
|
+
className: "flex-1 resize-none"
|
|
52414
52425
|
}
|
|
52415
52426
|
),
|
|
52416
52427
|
/* @__PURE__ */ jsx(
|
|
@@ -52418,10 +52429,10 @@ const ASSISTANT_ID = "RandmarAIChatAssistant", ChatLayout = forwardRef(
|
|
|
52418
52429
|
{
|
|
52419
52430
|
size: "icon",
|
|
52420
52431
|
variant: "default",
|
|
52421
|
-
className: "ml-
|
|
52432
|
+
className: "ml-2 h-15 w-15",
|
|
52422
52433
|
disabled: E !== "",
|
|
52423
52434
|
onClick: ie,
|
|
52424
|
-
children: /* @__PURE__ */ jsx(Send, { className: "h-
|
|
52435
|
+
children: /* @__PURE__ */ jsx(Send, { className: "h-6 w-6" })
|
|
52425
52436
|
}
|
|
52426
52437
|
)
|
|
52427
52438
|
] })
|
|
@@ -52445,6 +52456,196 @@ function getActiveChatObject(t, e) {
|
|
|
52445
52456
|
function isAssistantChat(t) {
|
|
52446
52457
|
return (t == null ? void 0 : t[0]) == ASSISTANT_ID || (t == null ? void 0 : t[1]) == ASSISTANT_ID;
|
|
52447
52458
|
}
|
|
52459
|
+
function ManufacturerCard({
|
|
52460
|
+
manufacturer: t,
|
|
52461
|
+
link: e,
|
|
52462
|
+
actions: n,
|
|
52463
|
+
loading: i = !1
|
|
52464
|
+
}) {
|
|
52465
|
+
var p;
|
|
52466
|
+
if (i || !t)
|
|
52467
|
+
return /* @__PURE__ */ jsxs(Card, { children: [
|
|
52468
|
+
/* @__PURE__ */ jsx(CardHeader, { className: "flex flex-row items-start justify-between space-y-0 pb-2 pt-4", children: /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-3", children: [
|
|
52469
|
+
/* @__PURE__ */ jsx(Skeleton, { className: "h-12 w-12 rounded-md" }),
|
|
52470
|
+
/* @__PURE__ */ jsxs("div", { children: [
|
|
52471
|
+
/* @__PURE__ */ jsx(Skeleton, { className: "h-3 w-24 mb-2" }),
|
|
52472
|
+
/* @__PURE__ */ jsx(Skeleton, { className: "h-5 w-40 mb-1" }),
|
|
52473
|
+
/* @__PURE__ */ jsx(Skeleton, { className: "h-4 w-32 mb-1" }),
|
|
52474
|
+
/* @__PURE__ */ jsx(Skeleton, { className: "h-4 w-48" })
|
|
52475
|
+
] })
|
|
52476
|
+
] }) }),
|
|
52477
|
+
/* @__PURE__ */ jsx(CardContent, { className: "pb-2", children: /* @__PURE__ */ jsxs("div", { className: "flex flex-col space-y-2", children: [
|
|
52478
|
+
/* @__PURE__ */ jsxs("div", { className: "flex flex-wrap gap-2", children: [
|
|
52479
|
+
/* @__PURE__ */ jsx(Skeleton, { className: "h-5 w-16 rounded-full" }),
|
|
52480
|
+
/* @__PURE__ */ jsx(Skeleton, { className: "h-5 w-20 rounded-full" }),
|
|
52481
|
+
/* @__PURE__ */ jsx(Skeleton, { className: "h-5 w-14 rounded-full" })
|
|
52482
|
+
] }),
|
|
52483
|
+
/* @__PURE__ */ jsxs("div", { className: "space-y-1 pt-2", children: [
|
|
52484
|
+
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2", children: [
|
|
52485
|
+
/* @__PURE__ */ jsx(Skeleton, { className: "h-4 w-4" }),
|
|
52486
|
+
/* @__PURE__ */ jsx(Skeleton, { className: "h-4 w-32" })
|
|
52487
|
+
] }),
|
|
52488
|
+
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2", children: [
|
|
52489
|
+
/* @__PURE__ */ jsx(Skeleton, { className: "h-4 w-4" }),
|
|
52490
|
+
/* @__PURE__ */ jsx(Skeleton, { className: "h-4 w-40" })
|
|
52491
|
+
] }),
|
|
52492
|
+
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2", children: [
|
|
52493
|
+
/* @__PURE__ */ jsx(Skeleton, { className: "h-4 w-4" }),
|
|
52494
|
+
/* @__PURE__ */ jsx(Skeleton, { className: "h-4 w-36" })
|
|
52495
|
+
] })
|
|
52496
|
+
] })
|
|
52497
|
+
] }) }),
|
|
52498
|
+
/* @__PURE__ */ jsxs(CardFooter, { className: "flex justify-between pt-2 gap-2", children: [
|
|
52499
|
+
/* @__PURE__ */ jsx(Skeleton, { className: "h-9 w-24" }),
|
|
52500
|
+
/* @__PURE__ */ jsx(Skeleton, { className: "h-9 w-40" })
|
|
52501
|
+
] })
|
|
52502
|
+
] });
|
|
52503
|
+
const o = t.ManufacturerId || "N/A", l = t.PublicName || "N/A", u = [t.City, t.Province, t.Country].filter(Boolean), d = u.length > 0 ? u.join(", ") : "", f = ((p = t.Tags) == null ? void 0 : p.split(",").map((m) => m.trim()).filter(Boolean)) || [];
|
|
52504
|
+
return /* @__PURE__ */ jsxs(Card, { className: "manufacturer-theme", children: [
|
|
52505
|
+
/* @__PURE__ */ jsxs(CardHeader, { className: "flex flex-row items-start justify-between space-y-0 pb-2 pt-4", children: [
|
|
52506
|
+
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-3", children: [
|
|
52507
|
+
/* @__PURE__ */ jsx("div", { className: "h-12 w-12 overflow-hidden rounded-md", children: /* @__PURE__ */ jsx(
|
|
52508
|
+
"img",
|
|
52509
|
+
{
|
|
52510
|
+
src: `https://api.randmar.io/V4/Partner/${o}/Account/Logo?width=64&height=64`,
|
|
52511
|
+
alt: `${l}'s logo`,
|
|
52512
|
+
className: "max-h-10 w-auto object-contain"
|
|
52513
|
+
}
|
|
52514
|
+
) }),
|
|
52515
|
+
/* @__PURE__ */ jsxs("div", { children: [
|
|
52516
|
+
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2", children: [
|
|
52517
|
+
/* @__PURE__ */ jsx("span", { className: "text-xs text-primary", children: "Manufacturer" }),
|
|
52518
|
+
/* @__PURE__ */ jsx("span", { className: "text-xs text-muted-foreground", children: "|" }),
|
|
52519
|
+
/* @__PURE__ */ jsx("span", { className: "text-xs text-muted-foreground", children: o })
|
|
52520
|
+
] }),
|
|
52521
|
+
/* @__PURE__ */ jsx("h3", { className: "font-semibold", children: t.PublicName || "N/A" }),
|
|
52522
|
+
t.Name && /* @__PURE__ */ jsx("p", { className: "text-sm text-muted-foreground", children: t.Name }),
|
|
52523
|
+
d && /* @__PURE__ */ jsx("p", { className: "text-sm text-muted-foreground", children: d })
|
|
52524
|
+
] })
|
|
52525
|
+
] }),
|
|
52526
|
+
!!t.OnHold && t.OnHold !== 0 && /* @__PURE__ */ jsx(Badge, { variant: "warning", children: "On Hold" })
|
|
52527
|
+
] }),
|
|
52528
|
+
/* @__PURE__ */ jsx(CardContent, { className: "pb-2", children: /* @__PURE__ */ jsxs("div", { className: "flex flex-col space-y-2", children: [
|
|
52529
|
+
(!!t.OpenToWork || f.length > 0) && /* @__PURE__ */ jsxs("div", { className: "flex flex-wrap gap-2", children: [
|
|
52530
|
+
!!t.OpenToWork && /* @__PURE__ */ jsx(Badge, { variant: "success", children: "Open To Work" }),
|
|
52531
|
+
f.map((m, g) => /* @__PURE__ */ jsx(Badge, { children: m }, g))
|
|
52532
|
+
] }),
|
|
52533
|
+
/* @__PURE__ */ jsxs("div", { className: "space-y-1 pt-2", children: [
|
|
52534
|
+
t.Phone && /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2 text-sm text-muted-foreground", children: [
|
|
52535
|
+
/* @__PURE__ */ jsx(Phone, { className: "h-4 w-4" }),
|
|
52536
|
+
/* @__PURE__ */ jsx("span", { children: t.Phone })
|
|
52537
|
+
] }),
|
|
52538
|
+
t.PublicEmail && /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2 text-sm text-muted-foreground", children: [
|
|
52539
|
+
/* @__PURE__ */ jsx(Mail, { className: "h-4 w-4" }),
|
|
52540
|
+
/* @__PURE__ */ jsx("span", { children: t.PublicEmail })
|
|
52541
|
+
] }),
|
|
52542
|
+
t.Website && /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2 text-sm text-muted-foreground", children: [
|
|
52543
|
+
/* @__PURE__ */ jsx(Globe, { className: "h-4 w-4" }),
|
|
52544
|
+
/* @__PURE__ */ jsx("span", { children: t.Website })
|
|
52545
|
+
] }),
|
|
52546
|
+
t.CurrencyCode && /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2 text-sm text-muted-foreground", children: [
|
|
52547
|
+
/* @__PURE__ */ jsx(DollarSign, { className: "h-4 w-4" }),
|
|
52548
|
+
/* @__PURE__ */ jsx("span", { children: t.CurrencyCode })
|
|
52549
|
+
] })
|
|
52550
|
+
] })
|
|
52551
|
+
] }) }),
|
|
52552
|
+
(n || e) && /* @__PURE__ */ jsxs(CardFooter, { className: `flex pt-2 gap-2 ${n ? "justify-between" : "justify-end"}`, children: [
|
|
52553
|
+
n && n,
|
|
52554
|
+
e && /* @__PURE__ */ jsx(Button, { className: "flex items-center gap-1", asChild: !0, children: /* @__PURE__ */ jsxs(Link, { to: e, target: "_blank", children: [
|
|
52555
|
+
/* @__PURE__ */ jsx(ExternalLink, { className: "h-4 w-4" }),
|
|
52556
|
+
"Go to Manufacturer"
|
|
52557
|
+
] }) })
|
|
52558
|
+
] })
|
|
52559
|
+
] });
|
|
52560
|
+
}
|
|
52561
|
+
function ResellerCard({
|
|
52562
|
+
reseller: t,
|
|
52563
|
+
link: e,
|
|
52564
|
+
actions: n,
|
|
52565
|
+
loading: i = !1
|
|
52566
|
+
}) {
|
|
52567
|
+
if (i || !t)
|
|
52568
|
+
return /* @__PURE__ */ jsxs(Card, { children: [
|
|
52569
|
+
/* @__PURE__ */ jsx(CardHeader, { className: "flex flex-row items-start justify-between space-y-0 pb-2 pt-4", children: /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-3", children: [
|
|
52570
|
+
/* @__PURE__ */ jsx(Skeleton, { className: "h-12 w-12 rounded-md" }),
|
|
52571
|
+
/* @__PURE__ */ jsxs("div", { children: [
|
|
52572
|
+
/* @__PURE__ */ jsx(Skeleton, { className: "h-3 w-24 mb-2" }),
|
|
52573
|
+
/* @__PURE__ */ jsx(Skeleton, { className: "h-5 w-40 mb-1" }),
|
|
52574
|
+
/* @__PURE__ */ jsx(Skeleton, { className: "h-4 w-32 mb-1" }),
|
|
52575
|
+
/* @__PURE__ */ jsx(Skeleton, { className: "h-4 w-48" })
|
|
52576
|
+
] })
|
|
52577
|
+
] }) }),
|
|
52578
|
+
/* @__PURE__ */ jsx(CardContent, { className: "pb-2", children: /* @__PURE__ */ jsx("div", { className: "flex flex-col space-y-2", children: /* @__PURE__ */ jsxs("div", { className: "space-y-1 pt-2", children: [
|
|
52579
|
+
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2", children: [
|
|
52580
|
+
/* @__PURE__ */ jsx(Skeleton, { className: "h-4 w-4" }),
|
|
52581
|
+
/* @__PURE__ */ jsx(Skeleton, { className: "h-4 w-32" })
|
|
52582
|
+
] }),
|
|
52583
|
+
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2", children: [
|
|
52584
|
+
/* @__PURE__ */ jsx(Skeleton, { className: "h-4 w-4" }),
|
|
52585
|
+
/* @__PURE__ */ jsx(Skeleton, { className: "h-4 w-40" })
|
|
52586
|
+
] }),
|
|
52587
|
+
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2", children: [
|
|
52588
|
+
/* @__PURE__ */ jsx(Skeleton, { className: "h-4 w-4" }),
|
|
52589
|
+
/* @__PURE__ */ jsx(Skeleton, { className: "h-4 w-36" })
|
|
52590
|
+
] })
|
|
52591
|
+
] }) }) }),
|
|
52592
|
+
/* @__PURE__ */ jsxs(CardFooter, { className: "flex justify-between pt-2 gap-2", children: [
|
|
52593
|
+
/* @__PURE__ */ jsx(Skeleton, { className: "h-9 w-24" }),
|
|
52594
|
+
/* @__PURE__ */ jsx(Skeleton, { className: "h-9 w-40" })
|
|
52595
|
+
] })
|
|
52596
|
+
] });
|
|
52597
|
+
const o = t.ResellerId || "N/A", l = t.PublicName || "N/A", u = [t.City, t.Province, t.Country].filter(Boolean), d = u.length > 0 ? u.join(", ") : "Location not provided";
|
|
52598
|
+
return /* @__PURE__ */ jsxs(Card, { className: "reseller-theme", children: [
|
|
52599
|
+
/* @__PURE__ */ jsxs(CardHeader, { className: "flex flex-row items-start justify-between space-y-0 pb-2 pt-4", children: [
|
|
52600
|
+
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-3", children: [
|
|
52601
|
+
/* @__PURE__ */ jsx("div", { className: "h-12 w-12 overflow-hidden rounded-md", children: /* @__PURE__ */ jsx(
|
|
52602
|
+
"img",
|
|
52603
|
+
{
|
|
52604
|
+
src: `https://api.randmar.io/V4/Partner/${o}/Account/Logo?width=64&height=64`,
|
|
52605
|
+
alt: `${l}'s logo`,
|
|
52606
|
+
className: "max-h-10 w-auto object-contain"
|
|
52607
|
+
}
|
|
52608
|
+
) }),
|
|
52609
|
+
/* @__PURE__ */ jsxs("div", { children: [
|
|
52610
|
+
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2", children: [
|
|
52611
|
+
/* @__PURE__ */ jsx("span", { className: "text-xs text-primary", children: "Reseller" }),
|
|
52612
|
+
/* @__PURE__ */ jsx("span", { className: "text-xs text-muted-foreground", children: "|" }),
|
|
52613
|
+
/* @__PURE__ */ jsx("span", { className: "text-xs text-muted-foreground", children: o })
|
|
52614
|
+
] }),
|
|
52615
|
+
/* @__PURE__ */ jsx("h3", { className: "font-semibold", children: t.PublicName || "N/A" }),
|
|
52616
|
+
t.Name && /* @__PURE__ */ jsx("p", { className: "text-sm text-muted-foreground", children: t.Name }),
|
|
52617
|
+
/* @__PURE__ */ jsx("p", { className: "text-sm text-muted-foreground", children: d })
|
|
52618
|
+
] })
|
|
52619
|
+
] }),
|
|
52620
|
+
!!t.OnHold && t.OnHold !== 0 && /* @__PURE__ */ jsx(Badge, { variant: "warning", children: "On Hold" })
|
|
52621
|
+
] }),
|
|
52622
|
+
/* @__PURE__ */ jsx(CardContent, { className: "pb-2", children: /* @__PURE__ */ jsx("div", { className: "flex flex-col space-y-2", children: /* @__PURE__ */ jsxs("div", { className: "space-y-1 pt-2", children: [
|
|
52623
|
+
t.Phone && /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2 text-sm text-muted-foreground", children: [
|
|
52624
|
+
/* @__PURE__ */ jsx(Phone, { className: "h-4 w-4" }),
|
|
52625
|
+
/* @__PURE__ */ jsx("span", { children: t.Phone })
|
|
52626
|
+
] }),
|
|
52627
|
+
t.PublicEmail && /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2 text-sm text-muted-foreground", children: [
|
|
52628
|
+
/* @__PURE__ */ jsx(Mail, { className: "h-4 w-4" }),
|
|
52629
|
+
/* @__PURE__ */ jsx("span", { children: t.PublicEmail })
|
|
52630
|
+
] }),
|
|
52631
|
+
t.Website && /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2 text-sm text-muted-foreground", children: [
|
|
52632
|
+
/* @__PURE__ */ jsx(Globe, { className: "h-4 w-4" }),
|
|
52633
|
+
/* @__PURE__ */ jsx("span", { children: t.Website })
|
|
52634
|
+
] }),
|
|
52635
|
+
t.CurrencyCode && /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2 text-sm text-muted-foreground", children: [
|
|
52636
|
+
/* @__PURE__ */ jsx(DollarSign, { className: "h-4 w-4" }),
|
|
52637
|
+
/* @__PURE__ */ jsx("span", { children: t.CurrencyCode })
|
|
52638
|
+
] })
|
|
52639
|
+
] }) }) }),
|
|
52640
|
+
(n || e) && /* @__PURE__ */ jsxs(CardFooter, { className: `flex pt-2 gap-2 ${n ? "justify-between" : "justify-end"}`, children: [
|
|
52641
|
+
n && n,
|
|
52642
|
+
e && /* @__PURE__ */ jsx(Button, { className: "flex items-center gap-1", asChild: !0, children: /* @__PURE__ */ jsxs(Link, { to: e, target: "_blank", children: [
|
|
52643
|
+
/* @__PURE__ */ jsx(ExternalLink, { className: "h-4 w-4" }),
|
|
52644
|
+
"Go to Reseller"
|
|
52645
|
+
] }) })
|
|
52646
|
+
] })
|
|
52647
|
+
] });
|
|
52648
|
+
}
|
|
52448
52649
|
const Topbar = forwardRef(
|
|
52449
52650
|
({ onSignOut: t, handleValidSearch: e, rightMenu: n, searchPlaceholder: i }, o) => {
|
|
52450
52651
|
const [l, u] = useState(""), d = useLocation(), { toast: f } = useToast();
|
|
@@ -52502,6 +52703,105 @@ const Topbar = forwardRef(
|
|
|
52502
52703
|
}
|
|
52503
52704
|
);
|
|
52504
52705
|
Topbar.displayName = "Topbar";
|
|
52706
|
+
function ActiveOrdersCard({ orders: t, loading: e = !1 }) {
|
|
52707
|
+
const n = (l) => new Intl.NumberFormat("en-CA", {
|
|
52708
|
+
style: "currency",
|
|
52709
|
+
currency: "CAD",
|
|
52710
|
+
minimumFractionDigits: 2,
|
|
52711
|
+
maximumFractionDigits: 2
|
|
52712
|
+
}).format(l), i = useMemo(() => {
|
|
52713
|
+
if (!t || t.length === 0)
|
|
52714
|
+
return {
|
|
52715
|
+
all: { orders: 0, amount: 0 },
|
|
52716
|
+
processing: { orders: 0, amount: 0 },
|
|
52717
|
+
shipped: { orders: 0, amount: 0 },
|
|
52718
|
+
delayed: { orders: 0, amount: 0 }
|
|
52719
|
+
};
|
|
52720
|
+
const l = t.filter((T) => T.DocumentType === "Order"), u = t.filter((T) => T.DocumentType === "Shipment"), d = l.filter((T) => T.WarehouseCode !== "3PLE"), f = d.reduce((T, R) => T + (R.Quantity || 0), 0), p = d.reduce((T, R) => T + (R.ExtendedPrice || 0), 0), m = l.filter((T) => T.WarehouseCode === "3PLE"), g = m.reduce((T, R) => T + (R.Quantity || 0), 0), b = m.reduce((T, R) => T + (R.ExtendedPrice || 0), 0), _ = u.length, E = u.reduce((T, R) => T + (R.ExtendedPrice || 0), 0), C = f + g + _, S = p + b + E;
|
|
52721
|
+
return {
|
|
52722
|
+
all: { orders: C, amount: S },
|
|
52723
|
+
processing: { orders: f, amount: p },
|
|
52724
|
+
shipped: { orders: _, amount: E },
|
|
52725
|
+
delayed: { orders: g, amount: b }
|
|
52726
|
+
};
|
|
52727
|
+
}, [t]), o = [
|
|
52728
|
+
{
|
|
52729
|
+
name: "All",
|
|
52730
|
+
icon: Package,
|
|
52731
|
+
color: "bg-blue-500",
|
|
52732
|
+
textColor: "text-blue-600",
|
|
52733
|
+
orders: i.all.orders,
|
|
52734
|
+
amount: i.all.amount
|
|
52735
|
+
},
|
|
52736
|
+
{
|
|
52737
|
+
name: "Processing",
|
|
52738
|
+
icon: RefreshCcw,
|
|
52739
|
+
color: "bg-yellow-500",
|
|
52740
|
+
textColor: "text-yellow-600",
|
|
52741
|
+
orders: i.processing.orders,
|
|
52742
|
+
amount: i.processing.amount
|
|
52743
|
+
},
|
|
52744
|
+
{
|
|
52745
|
+
name: "Shipped",
|
|
52746
|
+
icon: Truck,
|
|
52747
|
+
color: "bg-green-500",
|
|
52748
|
+
textColor: "text-green-600",
|
|
52749
|
+
orders: i.shipped.orders,
|
|
52750
|
+
amount: i.shipped.amount
|
|
52751
|
+
},
|
|
52752
|
+
{
|
|
52753
|
+
name: "Delayed",
|
|
52754
|
+
icon: CircleAlert,
|
|
52755
|
+
color: "bg-red-500",
|
|
52756
|
+
textColor: "text-red-600",
|
|
52757
|
+
orders: i.delayed.orders,
|
|
52758
|
+
amount: i.delayed.amount
|
|
52759
|
+
}
|
|
52760
|
+
];
|
|
52761
|
+
return e ? /* @__PURE__ */ jsxs(Card, { children: [
|
|
52762
|
+
/* @__PURE__ */ jsx(CardHeader, { className: "pb-0", children: /* @__PURE__ */ jsx(CardTitle, { className: "text-lg font-bold", children: "Active Orders" }) }),
|
|
52763
|
+
/* @__PURE__ */ jsx("div", { className: "grid grid-cols-1 sm:grid-cols-2 gap-4 p-4", children: [1, 2, 3, 4].map((l) => /* @__PURE__ */ jsxs("div", { className: "overflow-hidden rounded-md border", children: [
|
|
52764
|
+
/* @__PURE__ */ jsx("div", { className: "bg-slate-200 dark:bg-slate-700 h-[3px]" }),
|
|
52765
|
+
/* @__PURE__ */ jsxs("div", { className: "p-6 border border-t-0", children: [
|
|
52766
|
+
/* @__PURE__ */ jsxs("div", { className: "flex justify-between items-center mb-4", children: [
|
|
52767
|
+
/* @__PURE__ */ jsx(Skeleton, { className: "h-5 w-24" }),
|
|
52768
|
+
/* @__PURE__ */ jsx(Skeleton, { className: "h-8 w-8 rounded-full" })
|
|
52769
|
+
] }),
|
|
52770
|
+
/* @__PURE__ */ jsxs("div", { className: "flex justify-between items-start", children: [
|
|
52771
|
+
/* @__PURE__ */ jsxs("div", { children: [
|
|
52772
|
+
/* @__PURE__ */ jsx(Skeleton, { className: "h-3 w-16 mb-2" }),
|
|
52773
|
+
/* @__PURE__ */ jsx(Skeleton, { className: "h-7 w-12" })
|
|
52774
|
+
] }),
|
|
52775
|
+
/* @__PURE__ */ jsxs("div", { className: "text-end", children: [
|
|
52776
|
+
/* @__PURE__ */ jsx(Skeleton, { className: "h-3 w-16 mb-2" }),
|
|
52777
|
+
/* @__PURE__ */ jsx(Skeleton, { className: "h-5 w-20" })
|
|
52778
|
+
] })
|
|
52779
|
+
] })
|
|
52780
|
+
] })
|
|
52781
|
+
] }, l)) })
|
|
52782
|
+
] }) : /* @__PURE__ */ jsxs(Card, { children: [
|
|
52783
|
+
/* @__PURE__ */ jsx(CardHeader, { className: "pb-0", children: /* @__PURE__ */ jsx(CardTitle, { className: "text-lg font-bold", children: "Active Orders" }) }),
|
|
52784
|
+
/* @__PURE__ */ jsx("div", { className: "grid grid-cols-1 sm:grid-cols-2 gap-4 p-4", children: o.map((l) => /* @__PURE__ */ jsxs("div", { className: "overflow-hidden rounded-md border", children: [
|
|
52785
|
+
/* @__PURE__ */ jsx("div", { className: `${l.color} bg-opacity-60 h-[3px]` }),
|
|
52786
|
+
/* @__PURE__ */ jsxs("div", { className: "p-6 border border-t-0", children: [
|
|
52787
|
+
/* @__PURE__ */ jsxs("div", { className: "flex justify-between items-center mb-4", children: [
|
|
52788
|
+
/* @__PURE__ */ jsx("h3", { className: "font-semibold text-base", children: l.name }),
|
|
52789
|
+
/* @__PURE__ */ jsx("div", { className: `${l.color} bg-opacity-90 p-2 rounded-full`, children: /* @__PURE__ */ jsx(l.icon, { className: "size-4 shrink-0 text-white" }) })
|
|
52790
|
+
] }),
|
|
52791
|
+
/* @__PURE__ */ jsxs("div", { className: "flex justify-between items-start", children: [
|
|
52792
|
+
/* @__PURE__ */ jsxs("div", { children: [
|
|
52793
|
+
/* @__PURE__ */ jsx("p", { className: "text-xs text-muted-foreground", children: "Total Orders" }),
|
|
52794
|
+
/* @__PURE__ */ jsx("p", { className: "text-xl font-bold", children: l.orders })
|
|
52795
|
+
] }),
|
|
52796
|
+
/* @__PURE__ */ jsxs("div", { className: "text-end", children: [
|
|
52797
|
+
/* @__PURE__ */ jsx("p", { className: "text-xs text-muted-foreground", children: "Total Amount" }),
|
|
52798
|
+
/* @__PURE__ */ jsx("p", { className: "text-base font-semibold", children: n(l.amount) })
|
|
52799
|
+
] })
|
|
52800
|
+
] })
|
|
52801
|
+
] })
|
|
52802
|
+
] }, l.name)) })
|
|
52803
|
+
] });
|
|
52804
|
+
}
|
|
52505
52805
|
const CountryFlag = ({ countryCode: t, className: e = "" }) => {
|
|
52506
52806
|
const [n, i] = useState(null), [o, l] = useState(!1);
|
|
52507
52807
|
return useEffect(() => {
|
|
@@ -52521,7 +52821,15 @@ const CountryFlag = ({ countryCode: t, className: e = "" }) => {
|
|
|
52521
52821
|
style: { width: "24px", height: "auto" }
|
|
52522
52822
|
}
|
|
52523
52823
|
);
|
|
52524
|
-
}
|
|
52824
|
+
};
|
|
52825
|
+
function GeneralDocumentCard({ document: t, loading: e = !1 }) {
|
|
52826
|
+
return e ? /* @__PURE__ */ jsx("div", { children: "loading..." }) : /* @__PURE__ */ jsxs("div", { children: [
|
|
52827
|
+
t == null ? void 0 : t.OrderNumber,
|
|
52828
|
+
" for P.O. ",
|
|
52829
|
+
t == null ? void 0 : t.PONumber
|
|
52830
|
+
] });
|
|
52831
|
+
}
|
|
52832
|
+
const Navbar = forwardRef(
|
|
52525
52833
|
({ routes: t, footer: e, dashboardTitle: n, withRandmarAssistant: i, chatUserName: o, chatApiKey: l }, u) => {
|
|
52526
52834
|
const { appID: d } = useParams(), f = t.filter((b) => b.showInNav), p = useRef(null), m = useRef(null), g = useRef(null);
|
|
52527
52835
|
return useImperativeHandle(u, () => ({
|
|
@@ -52617,759 +52925,6 @@ const CountryFlag = ({ countryCode: t, className: e = "" }) => {
|
|
|
52617
52925
|
] })
|
|
52618
52926
|
] }) }) }));
|
|
52619
52927
|
Layout.displayName = "Layout";
|
|
52620
|
-
const imgSizeMap = {
|
|
52621
|
-
sm: 100,
|
|
52622
|
-
md: 200,
|
|
52623
|
-
lg: 300,
|
|
52624
|
-
xl: 400
|
|
52625
|
-
};
|
|
52626
|
-
function ProductImage({ randmarSKU: t, size: e = "md", alt: n, secondaryContent: i }) {
|
|
52627
|
-
const [o, l] = React.useState(!1), [u, d] = React.useState(!1), [f, p] = React.useState(!1), [m, g] = React.useState(!1), b = `https://api.randmar.io/Product/${t}/Video`;
|
|
52628
|
-
React.useEffect(() => {
|
|
52629
|
-
(async () => {
|
|
52630
|
-
try {
|
|
52631
|
-
const I = await (await fetch(b + "/Exists")).json();
|
|
52632
|
-
d(I);
|
|
52633
|
-
} catch (R) {
|
|
52634
|
-
console.error("Error checking for video:", R), d(!1);
|
|
52635
|
-
}
|
|
52636
|
-
})();
|
|
52637
|
-
}, [t, b]);
|
|
52638
|
-
async function _() {
|
|
52639
|
-
if (u) {
|
|
52640
|
-
g(!0);
|
|
52641
|
-
try {
|
|
52642
|
-
const R = await (await fetch(b)).blob(), I = window.URL.createObjectURL(R), M = document.createElement("a");
|
|
52643
|
-
M.href = I, M.download = `${t || "product"}-video.mp4`, document.body.appendChild(M), M.click(), document.body.removeChild(M), window.URL.revokeObjectURL(I);
|
|
52644
|
-
} catch (T) {
|
|
52645
|
-
console.error("Error downloading video:", T);
|
|
52646
|
-
} finally {
|
|
52647
|
-
g(!1);
|
|
52648
|
-
}
|
|
52649
|
-
}
|
|
52650
|
-
}
|
|
52651
|
-
function E() {
|
|
52652
|
-
navigator.clipboard.writeText(b), p(!0), setTimeout(() => {
|
|
52653
|
-
p(!1);
|
|
52654
|
-
}, 2e3);
|
|
52655
|
-
}
|
|
52656
|
-
function C() {
|
|
52657
|
-
l(!0);
|
|
52658
|
-
}
|
|
52659
|
-
const S = imgSizeMap[e || "xl"];
|
|
52660
|
-
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
52661
|
-
/* @__PURE__ */ jsx(Dialog, { open: o, onOpenChange: l, children: /* @__PURE__ */ jsx(DialogContent, { className: "max-w-4xl p-0 overflow-hidden", children: i ? /* @__PURE__ */ jsxs("div", { className: "flex flex-row", children: [
|
|
52662
|
-
/* @__PURE__ */ jsxs(
|
|
52663
|
-
"video",
|
|
52664
|
-
{
|
|
52665
|
-
className: "w-full rounded-l-lg max-h-[720px] object-contain",
|
|
52666
|
-
controls: !0,
|
|
52667
|
-
autoPlay: !0,
|
|
52668
|
-
muted: !0,
|
|
52669
|
-
loop: !0,
|
|
52670
|
-
children: [
|
|
52671
|
-
/* @__PURE__ */ jsx("source", { src: b, type: "video/mp4" }),
|
|
52672
|
-
"Your browser does not support the video tag."
|
|
52673
|
-
]
|
|
52674
|
-
}
|
|
52675
|
-
),
|
|
52676
|
-
/* @__PURE__ */ jsx("div", { className: "flex-grow min-w-[400px] h-[70vh] p-6", children: i })
|
|
52677
|
-
] }) : /* @__PURE__ */ jsxs("div", { className: "w-full relative", children: [
|
|
52678
|
-
/* @__PURE__ */ jsxs("video", { className: "w-full max-h-[720px] object-contain", controls: !0, autoPlay: !0, children: [
|
|
52679
|
-
/* @__PURE__ */ jsx("source", { src: b, type: "video/mp4" }),
|
|
52680
|
-
"Your browser does not support the video tag."
|
|
52681
|
-
] }),
|
|
52682
|
-
/* @__PURE__ */ jsxs("div", { className: "absolute top-2 right-12 flex gap-1", children: [
|
|
52683
|
-
/* @__PURE__ */ jsx(TooltipProvider, { children: /* @__PURE__ */ jsxs(Tooltip$1, { children: [
|
|
52684
|
-
/* @__PURE__ */ jsx(TooltipTrigger, { asChild: !0, children: /* @__PURE__ */ jsx(
|
|
52685
|
-
Button,
|
|
52686
|
-
{
|
|
52687
|
-
variant: "secondary",
|
|
52688
|
-
size: "icon",
|
|
52689
|
-
onClick: E,
|
|
52690
|
-
children: f ? /* @__PURE__ */ jsx(Check, { className: "h-4 w-4" }) : /* @__PURE__ */ jsx(Copy, { className: "h-4 w-4" })
|
|
52691
|
-
}
|
|
52692
|
-
) }),
|
|
52693
|
-
/* @__PURE__ */ jsx(TooltipContent, { children: /* @__PURE__ */ jsx("p", { children: "Copy video link" }) })
|
|
52694
|
-
] }) }),
|
|
52695
|
-
/* @__PURE__ */ jsx(TooltipProvider, { children: /* @__PURE__ */ jsxs(Tooltip$1, { children: [
|
|
52696
|
-
/* @__PURE__ */ jsx(TooltipTrigger, { asChild: !0, children: /* @__PURE__ */ jsx(
|
|
52697
|
-
Button,
|
|
52698
|
-
{
|
|
52699
|
-
variant: "secondary",
|
|
52700
|
-
size: "icon",
|
|
52701
|
-
onClick: _,
|
|
52702
|
-
disabled: m,
|
|
52703
|
-
children: /* @__PURE__ */ jsx(Download, { className: "h-4 w-4" })
|
|
52704
|
-
}
|
|
52705
|
-
) }),
|
|
52706
|
-
/* @__PURE__ */ jsx(TooltipContent, { children: /* @__PURE__ */ jsx("p", { children: "Download video" }) })
|
|
52707
|
-
] }) })
|
|
52708
|
-
] })
|
|
52709
|
-
] }) }) }),
|
|
52710
|
-
/* @__PURE__ */ jsxs("div", { className: "relative w-max h-max", children: [
|
|
52711
|
-
/* @__PURE__ */ jsx(
|
|
52712
|
-
"img",
|
|
52713
|
-
{
|
|
52714
|
-
alt: n || `Product ${t}`,
|
|
52715
|
-
className: `rounded-md ${u ? "cursor-pointer" : ""}`,
|
|
52716
|
-
onClick: u ? C : void 0,
|
|
52717
|
-
src: `https://api.randmar.io/Product/${t}/Image?width=${S * 1.5}&height=${S * 1.5}`,
|
|
52718
|
-
width: S,
|
|
52719
|
-
height: S
|
|
52720
|
-
}
|
|
52721
|
-
),
|
|
52722
|
-
u && /* @__PURE__ */ jsx(TooltipProvider, { children: /* @__PURE__ */ jsxs(Tooltip$1, { children: [
|
|
52723
|
-
/* @__PURE__ */ jsx(TooltipTrigger, { asChild: !0, children: /* @__PURE__ */ jsx(
|
|
52724
|
-
Button,
|
|
52725
|
-
{
|
|
52726
|
-
variant: "secondary",
|
|
52727
|
-
size: "icon",
|
|
52728
|
-
className: "absolute top-2 right-2",
|
|
52729
|
-
onClick: C,
|
|
52730
|
-
children: /* @__PURE__ */ jsx(Play, { className: "h-4 w-4" })
|
|
52731
|
-
}
|
|
52732
|
-
) }),
|
|
52733
|
-
/* @__PURE__ */ jsx(TooltipContent, { children: /* @__PURE__ */ jsx("p", { children: "Play video" }) })
|
|
52734
|
-
] }) })
|
|
52735
|
-
] })
|
|
52736
|
-
] });
|
|
52737
|
-
}
|
|
52738
|
-
function ProductCard({
|
|
52739
|
-
item: t,
|
|
52740
|
-
addToCart: e = !1,
|
|
52741
|
-
syncToShopify: n = !1,
|
|
52742
|
-
customAction: i = /* @__PURE__ */ jsx(Fragment, {}),
|
|
52743
|
-
defaultOpportunityNumber: o = "",
|
|
52744
|
-
viewProductLink: l,
|
|
52745
|
-
addToCartAction: u,
|
|
52746
|
-
isAddToCartActionLoading: d = !1,
|
|
52747
|
-
syncToShopifyAction: f,
|
|
52748
|
-
isSyncToShopifyActionLoading: p = !1
|
|
52749
|
-
}) {
|
|
52750
|
-
var z, W, J, ne, oe, le, ie, ue, ae, ce, se;
|
|
52751
|
-
const [m, g] = useState(1), [b, _] = useState(null), [E, C] = useState(0), [S, T] = useState(!1), R = ((z = t == null ? void 0 : t.Distribution) == null ? void 0 : z.Cost) || 0, I = ((W = t == null ? void 0 : t.Distribution) == null ? void 0 : W.RegularPrice) || 0, M = ((J = t == null ? void 0 : t.Distribution) == null ? void 0 : J.Price) || 0;
|
|
52752
|
-
useEffect(() => {
|
|
52753
|
-
g(1), _(null), C(0), T(!1);
|
|
52754
|
-
}, [t == null ? void 0 : t.RandmarSKU]);
|
|
52755
|
-
const [A, N] = useState(null), [O, D] = useState(!1);
|
|
52756
|
-
useEffect(() => {
|
|
52757
|
-
const te = async () => {
|
|
52758
|
-
if (t != null && t.ManufacturerId) {
|
|
52759
|
-
D(!0);
|
|
52760
|
-
try {
|
|
52761
|
-
const Z = await fetch(
|
|
52762
|
-
`https://api.randmar.io/V4/Partner/${t.ManufacturerId}/Account/Logo?width=60&height=40`
|
|
52763
|
-
);
|
|
52764
|
-
if (Z.ok) {
|
|
52765
|
-
const K = await Z.blob();
|
|
52766
|
-
N(URL.createObjectURL(K));
|
|
52767
|
-
}
|
|
52768
|
-
} catch (Z) {
|
|
52769
|
-
console.error("Failed to load logo:", Z);
|
|
52770
|
-
} finally {
|
|
52771
|
-
D(!1);
|
|
52772
|
-
}
|
|
52773
|
-
}
|
|
52774
|
-
};
|
|
52775
|
-
t != null && t.ManufacturerId && te();
|
|
52776
|
-
}, [t == null ? void 0 : t.ManufacturerId]), useEffect(() => {
|
|
52777
|
-
var te;
|
|
52778
|
-
if (t && o) {
|
|
52779
|
-
const Z = (te = t.Opportunities) == null ? void 0 : te.find((K) => K.BidNumber == o);
|
|
52780
|
-
Z && _(Z);
|
|
52781
|
-
}
|
|
52782
|
-
}, [t, o]), useEffect(() => {
|
|
52783
|
-
if (!t) return;
|
|
52784
|
-
const te = b != null && b.Price ? b.Price : M;
|
|
52785
|
-
C(I > 0 ? Math.round((I - te) / I * 100) : 0);
|
|
52786
|
-
}, [t, b, M, I]), useEffect(() => {
|
|
52787
|
-
d || g(1);
|
|
52788
|
-
}, [d]);
|
|
52789
|
-
const V = (te) => {
|
|
52790
|
-
if (te.Active !== !0) return !1;
|
|
52791
|
-
const Z = (/* @__PURE__ */ new Date()).toISOString().split("T")[0];
|
|
52792
|
-
return !(te.EndDate && te.EndDate.split("T")[0] < Z || te.StartDate && te.StartDate.split("T")[0] > Z);
|
|
52793
|
-
};
|
|
52794
|
-
if (!t)
|
|
52795
|
-
return /* @__PURE__ */ jsx(Card, { children: /* @__PURE__ */ jsxs(CardContent, { className: "p-6", children: [
|
|
52796
|
-
/* @__PURE__ */ jsxs("div", { className: "flex justify-between items-start mb-3", children: [
|
|
52797
|
-
/* @__PURE__ */ jsx(Skeleton, { className: "h-7 w-3/4" }),
|
|
52798
|
-
/* @__PURE__ */ jsx("div", { className: "h-10 w-24 flex items-center justify-end ml-4", children: /* @__PURE__ */ jsx(Skeleton, { className: "h-10 w-24 rounded-md" }) })
|
|
52799
|
-
] }),
|
|
52800
|
-
/* @__PURE__ */ jsxs("div", { className: "flex flex-wrap gap-2 mb-4", children: [
|
|
52801
|
-
/* @__PURE__ */ jsx(Skeleton, { className: "h-6 w-20 rounded-full" }),
|
|
52802
|
-
/* @__PURE__ */ jsx(Skeleton, { className: "h-6 w-24 rounded-full" }),
|
|
52803
|
-
/* @__PURE__ */ jsx(Skeleton, { className: "h-6 w-28 rounded-full" })
|
|
52804
|
-
] }),
|
|
52805
|
-
/* @__PURE__ */ jsxs("div", { className: "flex gap-6", children: [
|
|
52806
|
-
/* @__PURE__ */ jsxs("div", { className: "grid grid-cols-2 gap-x-4 gap-y-6 flex-1", children: [
|
|
52807
|
-
/* @__PURE__ */ jsxs("div", { children: [
|
|
52808
|
-
/* @__PURE__ */ jsx(Skeleton, { className: "h-4 w-12 mb-1" }),
|
|
52809
|
-
/* @__PURE__ */ jsx(Skeleton, { className: "h-5 w-20" })
|
|
52810
|
-
] }),
|
|
52811
|
-
/* @__PURE__ */ jsxs("div", { children: [
|
|
52812
|
-
/* @__PURE__ */ jsx(Skeleton, { className: "h-4 w-12 mb-1" }),
|
|
52813
|
-
/* @__PURE__ */ jsx(Skeleton, { className: "h-5 w-24" })
|
|
52814
|
-
] }),
|
|
52815
|
-
/* @__PURE__ */ jsxs("div", { children: [
|
|
52816
|
-
/* @__PURE__ */ jsx(Skeleton, { className: "h-4 w-20 mb-1" }),
|
|
52817
|
-
/* @__PURE__ */ jsx(Skeleton, { className: "h-5 w-16" })
|
|
52818
|
-
] }),
|
|
52819
|
-
/* @__PURE__ */ jsxs("div", { children: [
|
|
52820
|
-
/* @__PURE__ */ jsx(Skeleton, { className: "h-4 w-12 mb-1" }),
|
|
52821
|
-
/* @__PURE__ */ jsx(Skeleton, { className: "h-5 w-20" })
|
|
52822
|
-
] })
|
|
52823
|
-
] }),
|
|
52824
|
-
/* @__PURE__ */ jsx("div", { className: "flex flex-col", children: /* @__PURE__ */ jsx("div", { className: "w-60 h-40", children: /* @__PURE__ */ jsx(Skeleton, { className: "w-full h-full rounded-lg" }) }) })
|
|
52825
|
-
] }),
|
|
52826
|
-
/* @__PURE__ */ jsxs("div", { className: "flex gap-6 mt-4", children: [
|
|
52827
|
-
/* @__PURE__ */ jsx("div", { className: "flex flex-1", children: /* @__PURE__ */ jsxs("div", { className: "w-full", children: [
|
|
52828
|
-
/* @__PURE__ */ jsx(Skeleton, { className: "h-4 w-24 mb-3" }),
|
|
52829
|
-
/* @__PURE__ */ jsx(Skeleton, { className: "h-16 w-full rounded-md" })
|
|
52830
|
-
] }) }),
|
|
52831
|
-
/* @__PURE__ */ jsxs("div", { className: "flex flex-col items-center", children: [
|
|
52832
|
-
/* @__PURE__ */ jsx(Skeleton, { className: "h-10 w-32 rounded-md" }),
|
|
52833
|
-
/* @__PURE__ */ jsx(Skeleton, { className: "h-5 w-24 mt-4" })
|
|
52834
|
-
] })
|
|
52835
|
-
] }),
|
|
52836
|
-
/* @__PURE__ */ jsxs("div", { className: "flex gap-6 mt-4", children: [
|
|
52837
|
-
/* @__PURE__ */ jsxs("div", { className: "flex flex-col items-start gap-1 mb-2", children: [
|
|
52838
|
-
/* @__PURE__ */ jsx(Skeleton, { className: "h-8 w-32" }),
|
|
52839
|
-
/* @__PURE__ */ jsx(Skeleton, { className: "h-6 w-24" })
|
|
52840
|
-
] }),
|
|
52841
|
-
/* @__PURE__ */ jsxs("div", { className: "flex flex-1 items-center gap-2", children: [
|
|
52842
|
-
/* @__PURE__ */ jsx(Skeleton, { className: "h-10 w-24 rounded-md" }),
|
|
52843
|
-
/* @__PURE__ */ jsx(Skeleton, { className: "h-10 flex-1 rounded-md" })
|
|
52844
|
-
] })
|
|
52845
|
-
] })
|
|
52846
|
-
] }) });
|
|
52847
|
-
const L = (t == null ? void 0 : t.Opportunities) || [], B = L.length > 0, F = () => {
|
|
52848
|
-
if (m == null) {
|
|
52849
|
-
g(1);
|
|
52850
|
-
return;
|
|
52851
|
-
}
|
|
52852
|
-
m > 1 && g(m - 1);
|
|
52853
|
-
}, j = () => {
|
|
52854
|
-
if (m == null) {
|
|
52855
|
-
g(1);
|
|
52856
|
-
return;
|
|
52857
|
-
}
|
|
52858
|
-
g(m + 1);
|
|
52859
|
-
}, q = (te) => {
|
|
52860
|
-
const Z = parseInt(te.target.value, 10);
|
|
52861
|
-
if (!isNaN(Z) && Z > 0) {
|
|
52862
|
-
g(Z);
|
|
52863
|
-
return;
|
|
52864
|
-
}
|
|
52865
|
-
g(void 0);
|
|
52866
|
-
}, G = () => {
|
|
52867
|
-
(m == null || m < 1) && g(1);
|
|
52868
|
-
}, U = ((oe = (ne = t.Distribution) == null ? void 0 : ne.Inventory) == null ? void 0 : oe.reduce((te, Z) => te + (Z.AvailableQuantity || 0), 0)) || 0, Q = (te) => {
|
|
52869
|
-
try {
|
|
52870
|
-
return new Date(te).toLocaleDateString("en-US", { year: "numeric", month: "short", day: "numeric" });
|
|
52871
|
-
} catch (Z) {
|
|
52872
|
-
return console.error(Z), te.split("T")[0] || "N/A";
|
|
52873
|
-
}
|
|
52874
|
-
}, H = () => {
|
|
52875
|
-
u && u({ quantity: m ?? 1, bidNumber: (b == null ? void 0 : b.BidNumber) ?? null });
|
|
52876
|
-
};
|
|
52877
|
-
return /* @__PURE__ */ jsx(Card, { className: "hover:shadow-lg transition-shadow", children: /* @__PURE__ */ jsxs(CardContent, { className: "p-6", children: [
|
|
52878
|
-
/* @__PURE__ */ jsxs("div", { className: "flex justify-between items-start mb-3", children: [
|
|
52879
|
-
/* @__PURE__ */ jsx("h3", { className: "font-semibold text-xl", children: t.Title || t.RandmarTitle }),
|
|
52880
|
-
/* @__PURE__ */ jsx("div", { className: "h-10 w-24 flex items-center justify-end ml-4", children: O ? /* @__PURE__ */ jsx(Skeleton, { className: "h-10 w-24 rounded-md" }) : A && /* @__PURE__ */ jsx(
|
|
52881
|
-
"img",
|
|
52882
|
-
{
|
|
52883
|
-
src: A,
|
|
52884
|
-
alt: t.ManufacturerName ?? "",
|
|
52885
|
-
className: "max-h-10 max-w-24 object-contain"
|
|
52886
|
-
}
|
|
52887
|
-
) })
|
|
52888
|
-
] }),
|
|
52889
|
-
/* @__PURE__ */ jsxs("div", { className: "flex gap-6", children: [
|
|
52890
|
-
/* @__PURE__ */ jsxs("div", { className: "flex-1", children: [
|
|
52891
|
-
/* @__PURE__ */ jsxs("div", { className: "flex flex-wrap gap-2 mb-4", children: [
|
|
52892
|
-
t.State && /* @__PURE__ */ jsxs(
|
|
52893
|
-
Badge,
|
|
52894
|
-
{
|
|
52895
|
-
variant: "outline",
|
|
52896
|
-
className: `rounded-full px-3 ${t.State === "Active" ? "bg-green-50 text-green-700 hover:bg-green-50" : "bg-red-50 text-red-700 hover:bg-red-50"}`,
|
|
52897
|
-
children: [
|
|
52898
|
-
/* @__PURE__ */ jsx(Check, { size: "12", className: "mr-1.5" }),
|
|
52899
|
-
" ",
|
|
52900
|
-
t.State
|
|
52901
|
-
]
|
|
52902
|
-
}
|
|
52903
|
-
),
|
|
52904
|
-
/* @__PURE__ */ jsxs(
|
|
52905
|
-
Badge,
|
|
52906
|
-
{
|
|
52907
|
-
variant: "outline",
|
|
52908
|
-
className: `rounded-full px-3 ${t.SerialNumber ? "bg-green-50 text-green-700 hover:bg-green-50" : "bg-yellow-50 text-yellow-700 hover:bg-yellow-50"}`,
|
|
52909
|
-
children: [
|
|
52910
|
-
/* @__PURE__ */ jsx(QrCode, { size: "12", className: "mr-1.5" }),
|
|
52911
|
-
" ",
|
|
52912
|
-
t.SerialNumber ? "Serialized" : "Unserialized"
|
|
52913
|
-
]
|
|
52914
|
-
}
|
|
52915
|
-
),
|
|
52916
|
-
t.TransparencyCode && /* @__PURE__ */ jsxs(Badge, { variant: "outline", className: "rounded-full px-3 bg-green-50 text-green-700 hover:bg-green-50", children: [
|
|
52917
|
-
/* @__PURE__ */ jsx(CircleDashed, { size: "12", className: "mr-1.5" }),
|
|
52918
|
-
" Transparency Code"
|
|
52919
|
-
] }),
|
|
52920
|
-
t.AvailableToBuy !== void 0 && /* @__PURE__ */ jsxs(
|
|
52921
|
-
Badge,
|
|
52922
|
-
{
|
|
52923
|
-
variant: "outline",
|
|
52924
|
-
className: `rounded-full px-3 ${t.AvailableToBuy ? "bg-green-50 text-green-700 hover:bg-green-50" : "bg-red-50 text-red-700 hover:bg-red-50"}`,
|
|
52925
|
-
children: [
|
|
52926
|
-
/* @__PURE__ */ jsx(ShoppingCart, { size: "12", className: "mr-1.5" }),
|
|
52927
|
-
" ",
|
|
52928
|
-
t.AvailableToBuy ? "Available" : "Unavailable"
|
|
52929
|
-
]
|
|
52930
|
-
}
|
|
52931
|
-
),
|
|
52932
|
-
t.ManufacturerCategory !== void 0 && /* @__PURE__ */ jsxs(
|
|
52933
|
-
Badge,
|
|
52934
|
-
{
|
|
52935
|
-
variant: "outline",
|
|
52936
|
-
className: `rounded-full px-3 ${(le = t.ManufacturerCategory) != null && le.QualificationRequired ? "bg-blue-50 text-blue-700 hover:bg-blue-50" : "bg-neutral-50 text-neutral-700 hover:bg-neutral-50"}`,
|
|
52937
|
-
children: [
|
|
52938
|
-
/* @__PURE__ */ jsx(ShieldCheck, { size: "12", className: "mr-1.5" }),
|
|
52939
|
-
" ",
|
|
52940
|
-
(ie = t.ManufacturerCategory) != null && ie.QualificationRequired ? "Qualified Only" : "Available to all"
|
|
52941
|
-
]
|
|
52942
|
-
}
|
|
52943
|
-
),
|
|
52944
|
-
t.ManufacturerId && /* @__PURE__ */ jsxs(
|
|
52945
|
-
Badge,
|
|
52946
|
-
{
|
|
52947
|
-
variant: "outline",
|
|
52948
|
-
className: `rounded-full px-3 ${t.AutoUpdate ? "bg-green-50 text-green-700 hover:bg-green-50" : "bg-red-50 text-red-700 hover:bg-red-50"}`,
|
|
52949
|
-
children: [
|
|
52950
|
-
/* @__PURE__ */ jsx(RefreshCw, { size: "12", className: "mr-1.5" }),
|
|
52951
|
-
" ",
|
|
52952
|
-
t.AutoUpdate ? `Automatic Reorder (${t.MasterCarton})` : "Manually Reorders"
|
|
52953
|
-
]
|
|
52954
|
-
}
|
|
52955
|
-
),
|
|
52956
|
-
/* @__PURE__ */ jsxs(
|
|
52957
|
-
Badge,
|
|
52958
|
-
{
|
|
52959
|
-
variant: "outline",
|
|
52960
|
-
className: `rounded-full px-3 ${t.BodyHTML && t.Title && t.MAP ? "bg-green-50 text-green-700 hover:bg-green-50" : "bg-red-50 text-red-700 hover:bg-red-50"}`,
|
|
52961
|
-
children: [
|
|
52962
|
-
/* @__PURE__ */ jsx(Store, { size: "12", className: "mr-1.5" }),
|
|
52963
|
-
" ",
|
|
52964
|
-
t.BodyHTML && t.Title && t.MAP ? "Shopify Ready" : "Not Shopify Ready"
|
|
52965
|
-
]
|
|
52966
|
-
}
|
|
52967
|
-
)
|
|
52968
|
-
] }),
|
|
52969
|
-
/* @__PURE__ */ jsxs("div", { className: "grid grid-cols-2 gap-x-4 gap-y-4 flex-1", children: [
|
|
52970
|
-
/* @__PURE__ */ jsxs("div", { children: [
|
|
52971
|
-
/* @__PURE__ */ jsx("div", { className: "text-sm text-muted-foreground", children: "MPN" }),
|
|
52972
|
-
/* @__PURE__ */ jsx("div", { className: "font-medium", children: t.MPN || "N/A" })
|
|
52973
|
-
] }),
|
|
52974
|
-
/* @__PURE__ */ jsxs("div", { children: [
|
|
52975
|
-
/* @__PURE__ */ jsx("div", { className: "text-sm text-muted-foreground", children: "UPC" }),
|
|
52976
|
-
/* @__PURE__ */ jsx("div", { className: "font-medium", children: t.UPC || "N/A" })
|
|
52977
|
-
] }),
|
|
52978
|
-
/* @__PURE__ */ jsxs("div", { children: [
|
|
52979
|
-
/* @__PURE__ */ jsx("div", { className: "text-sm text-muted-foreground", children: "Unit Weight" }),
|
|
52980
|
-
/* @__PURE__ */ jsx("div", { className: "font-medium", children: t.UnitWeight ? `${t.UnitWeight} lbs` : "N/A" })
|
|
52981
|
-
] }),
|
|
52982
|
-
/* @__PURE__ */ jsxs("div", { children: [
|
|
52983
|
-
/* @__PURE__ */ jsx("div", { className: "text-sm text-muted-foreground", children: "MAP" }),
|
|
52984
|
-
/* @__PURE__ */ jsx("div", { className: "font-medium", children: t.MAP ? "$" + t.MAP.toFixed(2) : "N/A" })
|
|
52985
|
-
] }),
|
|
52986
|
-
t.CountryCodeOfOrigin && /* @__PURE__ */ jsxs("div", { children: [
|
|
52987
|
-
/* @__PURE__ */ jsx("div", { className: "text-sm text-muted-foreground", children: "Origin" }),
|
|
52988
|
-
/* @__PURE__ */ jsxs("div", { className: "font-medium flex items-center", children: [
|
|
52989
|
-
/* @__PURE__ */ jsx(
|
|
52990
|
-
CountryFlag,
|
|
52991
|
-
{
|
|
52992
|
-
countryCode: t.CountryCodeOfOrigin,
|
|
52993
|
-
className: "mr-2"
|
|
52994
|
-
}
|
|
52995
|
-
),
|
|
52996
|
-
t.CountryCodeOfOrigin
|
|
52997
|
-
] })
|
|
52998
|
-
] })
|
|
52999
|
-
] })
|
|
53000
|
-
] }),
|
|
53001
|
-
/* @__PURE__ */ jsx("div", { className: "flex flex-col", children: /* @__PURE__ */ jsx(ProductImage, { randmarSKU: t.RandmarSKU || "", alt: t.RandmarTitle || "" }) })
|
|
53002
|
-
] }),
|
|
53003
|
-
/* @__PURE__ */ jsxs("div", { className: "flex gap-6 mt-4", children: [
|
|
53004
|
-
/* @__PURE__ */ jsx("div", { className: "flex flex-1", children: B && t.Distribution && /* @__PURE__ */ jsxs("div", { className: "w-full", children: [
|
|
53005
|
-
/* @__PURE__ */ jsx("div", { className: "flex items-center", children: "You have " + L.length + (L.length > 1 ? " opportunities" : " opportunity") + " for this product:" }),
|
|
53006
|
-
/* @__PURE__ */ jsx("div", { className: "space-y-2 max-h-[200px] overflow-y-auto p-2 mt-1", children: L.map((te, Z) => {
|
|
53007
|
-
var K;
|
|
53008
|
-
return /* @__PURE__ */ jsxs(
|
|
53009
|
-
"div",
|
|
53010
|
-
{
|
|
53011
|
-
className: `flex justify-between items-center rounded-lg transition-colors py-2 px-4 bg-purple-100 border border-muted
|
|
53012
|
-
${te.BidNumber == (b == null ? void 0 : b.BidNumber) ? "cursor-pointer border-2 border-purple-900" : V(te) ? "hover:bg-purple-200 cursor-pointer" : "!bg-neutral-50"}
|
|
53013
|
-
`,
|
|
53014
|
-
onClick: () => {
|
|
53015
|
-
V(te) && _(
|
|
53016
|
-
te.BidNumber != (b == null ? void 0 : b.BidNumber) ? te : null
|
|
53017
|
-
);
|
|
53018
|
-
},
|
|
53019
|
-
children: [
|
|
53020
|
-
/* @__PURE__ */ jsx("div", { className: "flex items-center", children: /* @__PURE__ */ jsxs("div", { className: "flex flex-col", children: [
|
|
53021
|
-
/* @__PURE__ */ jsx("span", { className: "font-medium text-sm", children: te.Opportunity }),
|
|
53022
|
-
/* @__PURE__ */ jsxs("span", { className: "text-xs text-neutral-900", children: [
|
|
53023
|
-
te.BidNumber,
|
|
53024
|
-
" ",
|
|
53025
|
-
!V(te) && /* @__PURE__ */ jsx(Badge, { variant: "outline", className: "text-xs mx-1 h-5 bg-gray-100", children: "Currently unavailable" })
|
|
53026
|
-
] })
|
|
53027
|
-
] }) }),
|
|
53028
|
-
/* @__PURE__ */ jsxs("div", { className: "flex flex-col items-end", children: [
|
|
53029
|
-
/* @__PURE__ */ jsxs("span", { className: "font-semibold", children: [
|
|
53030
|
-
"$",
|
|
53031
|
-
(K = te.Price) == null ? void 0 : K.toFixed(2)
|
|
53032
|
-
] }),
|
|
53033
|
-
te.Rebate && te.Rebate > 0 && /* @__PURE__ */ jsxs("span", { className: "text-xs text-green-600", children: [
|
|
53034
|
-
"Rebate: $",
|
|
53035
|
-
te.Rebate.toFixed(2)
|
|
53036
|
-
] }),
|
|
53037
|
-
te.EndDate && /* @__PURE__ */ jsxs("span", { className: "text-xs text-neutral-600", children: [
|
|
53038
|
-
"Ends: ",
|
|
53039
|
-
Q(te.EndDate)
|
|
53040
|
-
] })
|
|
53041
|
-
] })
|
|
53042
|
-
]
|
|
53043
|
-
},
|
|
53044
|
-
Z
|
|
53045
|
-
);
|
|
53046
|
-
}) })
|
|
53047
|
-
] }) }),
|
|
53048
|
-
/* @__PURE__ */ jsxs("div", { className: "flex flex-col items-center", children: [
|
|
53049
|
-
l && /* @__PURE__ */ jsx(Link, { to: l, children: /* @__PURE__ */ jsxs(Button, { variant: "secondary", children: [
|
|
53050
|
-
/* @__PURE__ */ jsx(Eye, { className: "mr-2" }),
|
|
53051
|
-
"View Product"
|
|
53052
|
-
] }) }),
|
|
53053
|
-
((ue = t.Distribution) == null ? void 0 : ue.Inventory) && /* @__PURE__ */ jsx("div", { className: "mt-4", children: /* @__PURE__ */ jsxs(Dialog, { open: S, onOpenChange: T, children: [
|
|
53054
|
-
/* @__PURE__ */ jsx(DialogTrigger, { asChild: !0, children: /* @__PURE__ */ jsxs(
|
|
53055
|
-
Button,
|
|
53056
|
-
{
|
|
53057
|
-
variant: "ghost",
|
|
53058
|
-
className: `flex items-center text-sm ${U > 0 ? "text-green-700" : "text-red-700"}`,
|
|
53059
|
-
children: [
|
|
53060
|
-
/* @__PURE__ */ jsx(Warehouse, { size: "16", className: "mr-2" }),
|
|
53061
|
-
U > 0 ? /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
53062
|
-
U,
|
|
53063
|
-
" in stock"
|
|
53064
|
-
] }) : /* @__PURE__ */ jsx(Fragment, { children: "Out of stock" })
|
|
53065
|
-
]
|
|
53066
|
-
}
|
|
53067
|
-
) }),
|
|
53068
|
-
/* @__PURE__ */ jsxs(DialogContent, { className: "max-w-4xl", children: [
|
|
53069
|
-
/* @__PURE__ */ jsx(DialogHeader, { children: /* @__PURE__ */ jsxs(DialogTitle, { className: "flex items-center", children: [
|
|
53070
|
-
/* @__PURE__ */ jsx(Warehouse, { className: "mr-2", size: 18 }),
|
|
53071
|
-
"Inventory Information"
|
|
53072
|
-
] }) }),
|
|
53073
|
-
/* @__PURE__ */ jsx(ProductInventoryGrid, { inventory: t.Distribution.Inventory })
|
|
53074
|
-
] })
|
|
53075
|
-
] }) })
|
|
53076
|
-
] })
|
|
53077
|
-
] }),
|
|
53078
|
-
t.Distribution && /* @__PURE__ */ jsxs("div", { className: "flex justify-between items-end mt-4", children: [
|
|
53079
|
-
/* @__PURE__ */ jsx("div", { className: "flex-shrink-1 flex flex-col items-start gap-1", children: R > 0 ? /* @__PURE__ */ jsx("div", { className: "flex items-center", children: /* @__PURE__ */ jsxs("span", { className: "text-2xl font-bold whitespace-nowrap", children: [
|
|
53080
|
-
/* @__PURE__ */ jsx("span", { children: "Cost: $" }),
|
|
53081
|
-
R.toFixed(2),
|
|
53082
|
-
/* @__PURE__ */ jsx("span", { children: " CAD" })
|
|
53083
|
-
] }) }) : /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
53084
|
-
/* @__PURE__ */ jsxs("div", { className: "flex items-center flex-wrap", children: [
|
|
53085
|
-
/* @__PURE__ */ jsxs("span", { className: "text-2xl font-bold whitespace-nowrap", children: [
|
|
53086
|
-
/* @__PURE__ */ jsx("span", { children: "$" }),
|
|
53087
|
-
b ? (ce = (ae = t.Opportunities) == null ? void 0 : ae.find((te) => te.BidNumber == b.BidNumber)) == null ? void 0 : ce.Price : M.toFixed(2),
|
|
53088
|
-
/* @__PURE__ */ jsx("span", { children: " CAD" })
|
|
53089
|
-
] }),
|
|
53090
|
-
E > 0 && /* @__PURE__ */ jsxs("span", { className: "text-muted-foreground line-through ml-2 whitespace-nowrap", children: [
|
|
53091
|
-
"$",
|
|
53092
|
-
I.toFixed(2)
|
|
53093
|
-
] })
|
|
53094
|
-
] }),
|
|
53095
|
-
E > 0 && /* @__PURE__ */ jsx("div", { className: "flex items-center", children: /* @__PURE__ */ jsxs(Badge, { variant: "outline", className: "bg-red-50 text-red-700 rounded-full px-3 whitespace-nowrap", children: [
|
|
53096
|
-
/* @__PURE__ */ jsxs("span", { children: [
|
|
53097
|
-
E,
|
|
53098
|
-
"% OFF"
|
|
53099
|
-
] }),
|
|
53100
|
-
((se = t.InstantRebate) == null ? void 0 : se.EndDate) && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
53101
|
-
/* @__PURE__ */ jsx("span", { className: "mx-1.5", children: "●" }),
|
|
53102
|
-
" Ends ",
|
|
53103
|
-
t.InstantRebate.EndDate.split("T")[0]
|
|
53104
|
-
] }),
|
|
53105
|
-
(b == null ? void 0 : b.EndDate) && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
53106
|
-
/* @__PURE__ */ jsx("span", { className: "mx-1.5", children: "●" }),
|
|
53107
|
-
" Ends ",
|
|
53108
|
-
b.EndDate.split("T")[0]
|
|
53109
|
-
] })
|
|
53110
|
-
] }) })
|
|
53111
|
-
] }) }),
|
|
53112
|
-
/* @__PURE__ */ jsxs("div", { className: "flex flex-shrink-0 gap-2 ml-4", children: [
|
|
53113
|
-
typeof e < "u" && e && /* @__PURE__ */ jsxs("div", { className: "flex items-center border rounded-md", children: [
|
|
53114
|
-
/* @__PURE__ */ jsx(
|
|
53115
|
-
Button,
|
|
53116
|
-
{
|
|
53117
|
-
variant: "ghost",
|
|
53118
|
-
size: "icon",
|
|
53119
|
-
className: "rounded-r-none",
|
|
53120
|
-
onClick: F,
|
|
53121
|
-
disabled: typeof m < "u" && (m <= 1 || !t.AvailableToBuy || d || !u),
|
|
53122
|
-
children: "-"
|
|
53123
|
-
}
|
|
53124
|
-
),
|
|
53125
|
-
/* @__PURE__ */ jsx(
|
|
53126
|
-
"input",
|
|
53127
|
-
{
|
|
53128
|
-
value: m,
|
|
53129
|
-
onChange: q,
|
|
53130
|
-
onBlur: G,
|
|
53131
|
-
onClick: (te) => te.currentTarget.select(),
|
|
53132
|
-
className: `w-12 text-center border-0 focus:ring-0 focus:outline-none ${!t.AvailableToBuy || d || !u ? "text-gray-400" : ""}`,
|
|
53133
|
-
disabled: !t.AvailableToBuy || d || !u
|
|
53134
|
-
}
|
|
53135
|
-
),
|
|
53136
|
-
/* @__PURE__ */ jsx(
|
|
53137
|
-
Button,
|
|
53138
|
-
{
|
|
53139
|
-
variant: "ghost",
|
|
53140
|
-
size: "icon",
|
|
53141
|
-
className: "rounded-l-none",
|
|
53142
|
-
onClick: j,
|
|
53143
|
-
disabled: !t.AvailableToBuy || d || !u,
|
|
53144
|
-
children: "+"
|
|
53145
|
-
}
|
|
53146
|
-
)
|
|
53147
|
-
] }),
|
|
53148
|
-
typeof e < "u" && e && /* @__PURE__ */ jsx(
|
|
53149
|
-
Button,
|
|
53150
|
-
{
|
|
53151
|
-
className: "gap-2 whitespace-nowrap",
|
|
53152
|
-
onClick: H,
|
|
53153
|
-
disabled: !t.AvailableToBuy || d || !u,
|
|
53154
|
-
children: d ? /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
53155
|
-
/* @__PURE__ */ jsx(LoaderCircle, { className: "h-4 w-4 animate-spin" }),
|
|
53156
|
-
"Adding..."
|
|
53157
|
-
] }) : /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
53158
|
-
/* @__PURE__ */ jsx(ShoppingCart, { className: "mr-2" }),
|
|
53159
|
-
"Add to Cart"
|
|
53160
|
-
] })
|
|
53161
|
-
}
|
|
53162
|
-
),
|
|
53163
|
-
n && /* @__PURE__ */ jsx(
|
|
53164
|
-
Button,
|
|
53165
|
-
{
|
|
53166
|
-
className: "gap-2 whitespace-nowrap bg-green-600 hover:bg-green-700",
|
|
53167
|
-
onClick: f,
|
|
53168
|
-
disabled: p || !f,
|
|
53169
|
-
children: p ? /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
53170
|
-
/* @__PURE__ */ jsx(LoaderCircle, { className: "h-4 w-4 animate-spin" }),
|
|
53171
|
-
"Syncing..."
|
|
53172
|
-
] }) : /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
53173
|
-
/* @__PURE__ */ jsx(ShoppingCart, { className: "mr-2" }),
|
|
53174
|
-
"Sync to Shopify"
|
|
53175
|
-
] })
|
|
53176
|
-
}
|
|
53177
|
-
),
|
|
53178
|
-
i
|
|
53179
|
-
] })
|
|
53180
|
-
] })
|
|
53181
|
-
] }) });
|
|
53182
|
-
}
|
|
53183
|
-
function ManufacturerCard({
|
|
53184
|
-
manufacturer: t,
|
|
53185
|
-
link: e,
|
|
53186
|
-
actions: n,
|
|
53187
|
-
loading: i = !1
|
|
53188
|
-
}) {
|
|
53189
|
-
var p;
|
|
53190
|
-
if (i || !t)
|
|
53191
|
-
return /* @__PURE__ */ jsxs(Card, { children: [
|
|
53192
|
-
/* @__PURE__ */ jsx(CardHeader, { className: "flex flex-row items-start justify-between space-y-0 pb-2 pt-4", children: /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-3", children: [
|
|
53193
|
-
/* @__PURE__ */ jsx(Skeleton, { className: "h-12 w-12 rounded-md" }),
|
|
53194
|
-
/* @__PURE__ */ jsxs("div", { children: [
|
|
53195
|
-
/* @__PURE__ */ jsx(Skeleton, { className: "h-3 w-24 mb-2" }),
|
|
53196
|
-
/* @__PURE__ */ jsx(Skeleton, { className: "h-5 w-40 mb-1" }),
|
|
53197
|
-
/* @__PURE__ */ jsx(Skeleton, { className: "h-4 w-32 mb-1" }),
|
|
53198
|
-
/* @__PURE__ */ jsx(Skeleton, { className: "h-4 w-48" })
|
|
53199
|
-
] })
|
|
53200
|
-
] }) }),
|
|
53201
|
-
/* @__PURE__ */ jsx(CardContent, { className: "pb-2", children: /* @__PURE__ */ jsxs("div", { className: "flex flex-col space-y-2", children: [
|
|
53202
|
-
/* @__PURE__ */ jsxs("div", { className: "flex flex-wrap gap-2", children: [
|
|
53203
|
-
/* @__PURE__ */ jsx(Skeleton, { className: "h-5 w-16 rounded-full" }),
|
|
53204
|
-
/* @__PURE__ */ jsx(Skeleton, { className: "h-5 w-20 rounded-full" }),
|
|
53205
|
-
/* @__PURE__ */ jsx(Skeleton, { className: "h-5 w-14 rounded-full" })
|
|
53206
|
-
] }),
|
|
53207
|
-
/* @__PURE__ */ jsxs("div", { className: "space-y-1 pt-2", children: [
|
|
53208
|
-
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2", children: [
|
|
53209
|
-
/* @__PURE__ */ jsx(Skeleton, { className: "h-4 w-4" }),
|
|
53210
|
-
/* @__PURE__ */ jsx(Skeleton, { className: "h-4 w-32" })
|
|
53211
|
-
] }),
|
|
53212
|
-
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2", children: [
|
|
53213
|
-
/* @__PURE__ */ jsx(Skeleton, { className: "h-4 w-4" }),
|
|
53214
|
-
/* @__PURE__ */ jsx(Skeleton, { className: "h-4 w-40" })
|
|
53215
|
-
] }),
|
|
53216
|
-
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2", children: [
|
|
53217
|
-
/* @__PURE__ */ jsx(Skeleton, { className: "h-4 w-4" }),
|
|
53218
|
-
/* @__PURE__ */ jsx(Skeleton, { className: "h-4 w-36" })
|
|
53219
|
-
] })
|
|
53220
|
-
] })
|
|
53221
|
-
] }) }),
|
|
53222
|
-
/* @__PURE__ */ jsxs(CardFooter, { className: "flex justify-between pt-2 gap-2", children: [
|
|
53223
|
-
/* @__PURE__ */ jsx(Skeleton, { className: "h-9 w-24" }),
|
|
53224
|
-
/* @__PURE__ */ jsx(Skeleton, { className: "h-9 w-40" })
|
|
53225
|
-
] })
|
|
53226
|
-
] });
|
|
53227
|
-
const o = t.ManufacturerId || "N/A", l = t.PublicName || "N/A", u = [t.City, t.Province, t.Country].filter(Boolean), d = u.length > 0 ? u.join(", ") : "Location not provided", f = ((p = t.Tags) == null ? void 0 : p.split(",").map((m) => m.trim()).filter(Boolean)) || [];
|
|
53228
|
-
return /* @__PURE__ */ jsxs(Card, { className: "manufacturer-theme", children: [
|
|
53229
|
-
/* @__PURE__ */ jsxs(CardHeader, { className: "flex flex-row items-start justify-between space-y-0 pb-2 pt-4", children: [
|
|
53230
|
-
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-3", children: [
|
|
53231
|
-
/* @__PURE__ */ jsx("div", { className: "h-12 w-12 overflow-hidden rounded-md", children: /* @__PURE__ */ jsx(
|
|
53232
|
-
"img",
|
|
53233
|
-
{
|
|
53234
|
-
src: `https://api.randmar.io/V4/Partner/${o}/Account/Logo?width=64&height=64`,
|
|
53235
|
-
alt: `${l}'s logo`,
|
|
53236
|
-
className: "max-h-10 w-auto object-contain"
|
|
53237
|
-
}
|
|
53238
|
-
) }),
|
|
53239
|
-
/* @__PURE__ */ jsxs("div", { children: [
|
|
53240
|
-
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2", children: [
|
|
53241
|
-
/* @__PURE__ */ jsx("span", { className: "text-xs text-primary", children: "Manufacturer" }),
|
|
53242
|
-
/* @__PURE__ */ jsx("span", { className: "text-xs text-muted-foreground", children: "|" }),
|
|
53243
|
-
/* @__PURE__ */ jsx("span", { className: "text-xs text-muted-foreground", children: o })
|
|
53244
|
-
] }),
|
|
53245
|
-
/* @__PURE__ */ jsx("h3", { className: "font-semibold", children: t.PublicName || "N/A" }),
|
|
53246
|
-
t.Name && /* @__PURE__ */ jsx("p", { className: "text-sm text-muted-foreground", children: t.Name }),
|
|
53247
|
-
/* @__PURE__ */ jsx("p", { className: "text-sm text-muted-foreground", children: d })
|
|
53248
|
-
] })
|
|
53249
|
-
] }),
|
|
53250
|
-
!!t.OnHold && t.OnHold !== 0 && /* @__PURE__ */ jsx(Badge, { variant: "warning", children: "On Hold" })
|
|
53251
|
-
] }),
|
|
53252
|
-
/* @__PURE__ */ jsx(CardContent, { className: "pb-2", children: /* @__PURE__ */ jsxs("div", { className: "flex flex-col space-y-2", children: [
|
|
53253
|
-
(!!t.OpenToWork || f.length > 0) && /* @__PURE__ */ jsxs("div", { className: "flex flex-wrap gap-2", children: [
|
|
53254
|
-
!!t.OpenToWork && /* @__PURE__ */ jsx(Badge, { variant: "success", children: "Open To Work" }),
|
|
53255
|
-
f.map((m, g) => /* @__PURE__ */ jsx(Badge, { children: m }, g))
|
|
53256
|
-
] }),
|
|
53257
|
-
/* @__PURE__ */ jsxs("div", { className: "space-y-1 pt-2", children: [
|
|
53258
|
-
t.Phone && /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2 text-sm text-muted-foreground", children: [
|
|
53259
|
-
/* @__PURE__ */ jsx(Phone, { className: "h-4 w-4" }),
|
|
53260
|
-
/* @__PURE__ */ jsx("span", { children: t.Phone })
|
|
53261
|
-
] }),
|
|
53262
|
-
t.PublicEmail && /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2 text-sm text-muted-foreground", children: [
|
|
53263
|
-
/* @__PURE__ */ jsx(Mail, { className: "h-4 w-4" }),
|
|
53264
|
-
/* @__PURE__ */ jsx("span", { children: t.PublicEmail })
|
|
53265
|
-
] }),
|
|
53266
|
-
t.Website && /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2 text-sm text-muted-foreground", children: [
|
|
53267
|
-
/* @__PURE__ */ jsx(Globe, { className: "h-4 w-4" }),
|
|
53268
|
-
/* @__PURE__ */ jsx("span", { children: t.Website })
|
|
53269
|
-
] }),
|
|
53270
|
-
t.CurrencyCode && /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2 text-sm text-muted-foreground", children: [
|
|
53271
|
-
/* @__PURE__ */ jsx(DollarSign, { className: "h-4 w-4" }),
|
|
53272
|
-
/* @__PURE__ */ jsx("span", { children: t.CurrencyCode })
|
|
53273
|
-
] })
|
|
53274
|
-
] })
|
|
53275
|
-
] }) }),
|
|
53276
|
-
(n || e) && /* @__PURE__ */ jsxs(CardFooter, { className: `flex pt-2 gap-2 ${n ? "justify-between" : "justify-end"}`, children: [
|
|
53277
|
-
n && n,
|
|
53278
|
-
e && /* @__PURE__ */ jsx(Button, { className: "flex items-center gap-1", asChild: !0, children: /* @__PURE__ */ jsxs(Link, { to: e, target: "_blank", children: [
|
|
53279
|
-
/* @__PURE__ */ jsx(ExternalLink, { className: "h-4 w-4" }),
|
|
53280
|
-
"Go to Manufacturer"
|
|
53281
|
-
] }) })
|
|
53282
|
-
] })
|
|
53283
|
-
] });
|
|
53284
|
-
}
|
|
53285
|
-
function ResellerCard({
|
|
53286
|
-
reseller: t,
|
|
53287
|
-
link: e,
|
|
53288
|
-
actions: n,
|
|
53289
|
-
loading: i = !1
|
|
53290
|
-
}) {
|
|
53291
|
-
if (i || !t)
|
|
53292
|
-
return /* @__PURE__ */ jsxs(Card, { children: [
|
|
53293
|
-
/* @__PURE__ */ jsx(CardHeader, { className: "flex flex-row items-start justify-between space-y-0 pb-2 pt-4", children: /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-3", children: [
|
|
53294
|
-
/* @__PURE__ */ jsx(Skeleton, { className: "h-12 w-12 rounded-md" }),
|
|
53295
|
-
/* @__PURE__ */ jsxs("div", { children: [
|
|
53296
|
-
/* @__PURE__ */ jsx(Skeleton, { className: "h-3 w-24 mb-2" }),
|
|
53297
|
-
/* @__PURE__ */ jsx(Skeleton, { className: "h-5 w-40 mb-1" }),
|
|
53298
|
-
/* @__PURE__ */ jsx(Skeleton, { className: "h-4 w-32 mb-1" }),
|
|
53299
|
-
/* @__PURE__ */ jsx(Skeleton, { className: "h-4 w-48" })
|
|
53300
|
-
] })
|
|
53301
|
-
] }) }),
|
|
53302
|
-
/* @__PURE__ */ jsx(CardContent, { className: "pb-2", children: /* @__PURE__ */ jsx("div", { className: "flex flex-col space-y-2", children: /* @__PURE__ */ jsxs("div", { className: "space-y-1 pt-2", children: [
|
|
53303
|
-
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2", children: [
|
|
53304
|
-
/* @__PURE__ */ jsx(Skeleton, { className: "h-4 w-4" }),
|
|
53305
|
-
/* @__PURE__ */ jsx(Skeleton, { className: "h-4 w-32" })
|
|
53306
|
-
] }),
|
|
53307
|
-
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2", children: [
|
|
53308
|
-
/* @__PURE__ */ jsx(Skeleton, { className: "h-4 w-4" }),
|
|
53309
|
-
/* @__PURE__ */ jsx(Skeleton, { className: "h-4 w-40" })
|
|
53310
|
-
] }),
|
|
53311
|
-
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2", children: [
|
|
53312
|
-
/* @__PURE__ */ jsx(Skeleton, { className: "h-4 w-4" }),
|
|
53313
|
-
/* @__PURE__ */ jsx(Skeleton, { className: "h-4 w-36" })
|
|
53314
|
-
] })
|
|
53315
|
-
] }) }) }),
|
|
53316
|
-
/* @__PURE__ */ jsxs(CardFooter, { className: "flex justify-between pt-2 gap-2", children: [
|
|
53317
|
-
/* @__PURE__ */ jsx(Skeleton, { className: "h-9 w-24" }),
|
|
53318
|
-
/* @__PURE__ */ jsx(Skeleton, { className: "h-9 w-40" })
|
|
53319
|
-
] })
|
|
53320
|
-
] });
|
|
53321
|
-
const o = t.ResellerId || "N/A", l = t.PublicName || "N/A", u = [t.City, t.Province, t.Country].filter(Boolean), d = u.length > 0 ? u.join(", ") : "Location not provided";
|
|
53322
|
-
return /* @__PURE__ */ jsxs(Card, { className: "reseller-theme", children: [
|
|
53323
|
-
/* @__PURE__ */ jsxs(CardHeader, { className: "flex flex-row items-start justify-between space-y-0 pb-2 pt-4", children: [
|
|
53324
|
-
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-3", children: [
|
|
53325
|
-
/* @__PURE__ */ jsx("div", { className: "h-12 w-12 overflow-hidden rounded-md", children: /* @__PURE__ */ jsx(
|
|
53326
|
-
"img",
|
|
53327
|
-
{
|
|
53328
|
-
src: `https://api.randmar.io/V4/Partner/${o}/Account/Logo?width=64&height=64`,
|
|
53329
|
-
alt: `${l}'s logo`,
|
|
53330
|
-
className: "max-h-10 w-auto object-contain"
|
|
53331
|
-
}
|
|
53332
|
-
) }),
|
|
53333
|
-
/* @__PURE__ */ jsxs("div", { children: [
|
|
53334
|
-
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2", children: [
|
|
53335
|
-
/* @__PURE__ */ jsx("span", { className: "text-xs text-primary", children: "Reseller" }),
|
|
53336
|
-
/* @__PURE__ */ jsx("span", { className: "text-xs text-muted-foreground", children: "|" }),
|
|
53337
|
-
/* @__PURE__ */ jsx("span", { className: "text-xs text-muted-foreground", children: o })
|
|
53338
|
-
] }),
|
|
53339
|
-
/* @__PURE__ */ jsx("h3", { className: "font-semibold", children: t.PublicName || "N/A" }),
|
|
53340
|
-
t.Name && /* @__PURE__ */ jsx("p", { className: "text-sm text-muted-foreground", children: t.Name }),
|
|
53341
|
-
/* @__PURE__ */ jsx("p", { className: "text-sm text-muted-foreground", children: d })
|
|
53342
|
-
] })
|
|
53343
|
-
] }),
|
|
53344
|
-
!!t.OnHold && t.OnHold !== 0 && /* @__PURE__ */ jsx(Badge, { variant: "warning", children: "On Hold" })
|
|
53345
|
-
] }),
|
|
53346
|
-
/* @__PURE__ */ jsx(CardContent, { className: "pb-2", children: /* @__PURE__ */ jsx("div", { className: "flex flex-col space-y-2", children: /* @__PURE__ */ jsxs("div", { className: "space-y-1 pt-2", children: [
|
|
53347
|
-
t.Phone && /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2 text-sm text-muted-foreground", children: [
|
|
53348
|
-
/* @__PURE__ */ jsx(Phone, { className: "h-4 w-4" }),
|
|
53349
|
-
/* @__PURE__ */ jsx("span", { children: t.Phone })
|
|
53350
|
-
] }),
|
|
53351
|
-
t.PublicEmail && /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2 text-sm text-muted-foreground", children: [
|
|
53352
|
-
/* @__PURE__ */ jsx(Mail, { className: "h-4 w-4" }),
|
|
53353
|
-
/* @__PURE__ */ jsx("span", { children: t.PublicEmail })
|
|
53354
|
-
] }),
|
|
53355
|
-
t.Website && /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2 text-sm text-muted-foreground", children: [
|
|
53356
|
-
/* @__PURE__ */ jsx(Globe, { className: "h-4 w-4" }),
|
|
53357
|
-
/* @__PURE__ */ jsx("span", { children: t.Website })
|
|
53358
|
-
] }),
|
|
53359
|
-
t.CurrencyCode && /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2 text-sm text-muted-foreground", children: [
|
|
53360
|
-
/* @__PURE__ */ jsx(DollarSign, { className: "h-4 w-4" }),
|
|
53361
|
-
/* @__PURE__ */ jsx("span", { children: t.CurrencyCode })
|
|
53362
|
-
] })
|
|
53363
|
-
] }) }) }),
|
|
53364
|
-
(n || e) && /* @__PURE__ */ jsxs(CardFooter, { className: `flex pt-2 gap-2 ${n ? "justify-between" : "justify-end"}`, children: [
|
|
53365
|
-
n && n,
|
|
53366
|
-
e && /* @__PURE__ */ jsx(Button, { className: "flex items-center gap-1", asChild: !0, children: /* @__PURE__ */ jsxs(Link, { to: e, target: "_blank", children: [
|
|
53367
|
-
/* @__PURE__ */ jsx(ExternalLink, { className: "h-4 w-4" }),
|
|
53368
|
-
"Go to Reseller"
|
|
53369
|
-
] }) })
|
|
53370
|
-
] })
|
|
53371
|
-
] });
|
|
53372
|
-
}
|
|
53373
52928
|
function usePrevious(t) {
|
|
53374
52929
|
const e = React.useRef({ value: t, previous: t });
|
|
53375
52930
|
return React.useMemo(() => (e.current.value !== t && (e.current.previous = e.current.value, e.current.value = t), e.current.previous), [t]);
|
|
@@ -54570,230 +54125,700 @@ function ManufacturerReorderingCard({
|
|
|
54570
54125
|
/* @__PURE__ */ jsx("span", { className: "ml-2 text-sm text-muted-foreground", children: "days" })
|
|
54571
54126
|
] })
|
|
54572
54127
|
] }),
|
|
54573
|
-
/* @__PURE__ */ jsxs("div", { className: "space-y-2", children: [
|
|
54574
|
-
/* @__PURE__ */ jsx(Label$2, { htmlFor: "maximum-inventory-value", children: "Default Maximum Inventory Value" }),
|
|
54575
|
-
/* @__PURE__ */ jsxs("div", { className: "flex items-center relative", children: [
|
|
54576
|
-
/* @__PURE__ */ jsx("span", { className: "absolute left-3 top-1/2 -translate-y-1/2", children: "$" }),
|
|
54577
|
-
/* @__PURE__ */ jsx(
|
|
54578
|
-
Input,
|
|
54579
|
-
{
|
|
54580
|
-
id: "maximum-inventory-value",
|
|
54581
|
-
type: "number",
|
|
54582
|
-
className: "pl-6",
|
|
54583
|
-
value: o.DefaultMaxInventoryValue || "",
|
|
54584
|
-
onChange: (b) => d("DefaultMaxInventoryValue", Number(b.target.value)),
|
|
54585
|
-
disabled: i
|
|
54586
|
-
}
|
|
54587
|
-
)
|
|
54128
|
+
/* @__PURE__ */ jsxs("div", { className: "space-y-2", children: [
|
|
54129
|
+
/* @__PURE__ */ jsx(Label$2, { htmlFor: "maximum-inventory-value", children: "Default Maximum Inventory Value" }),
|
|
54130
|
+
/* @__PURE__ */ jsxs("div", { className: "flex items-center relative", children: [
|
|
54131
|
+
/* @__PURE__ */ jsx("span", { className: "absolute left-3 top-1/2 -translate-y-1/2", children: "$" }),
|
|
54132
|
+
/* @__PURE__ */ jsx(
|
|
54133
|
+
Input,
|
|
54134
|
+
{
|
|
54135
|
+
id: "maximum-inventory-value",
|
|
54136
|
+
type: "number",
|
|
54137
|
+
className: "pl-6",
|
|
54138
|
+
value: o.DefaultMaxInventoryValue || "",
|
|
54139
|
+
onChange: (b) => d("DefaultMaxInventoryValue", Number(b.target.value)),
|
|
54140
|
+
disabled: i
|
|
54141
|
+
}
|
|
54142
|
+
)
|
|
54143
|
+
] })
|
|
54144
|
+
] }),
|
|
54145
|
+
/* @__PURE__ */ jsxs("div", { className: "space-y-2", children: [
|
|
54146
|
+
/* @__PURE__ */ jsx(Label$2, { htmlFor: "order-confirmations", children: "Send Order Confirmations To" }),
|
|
54147
|
+
/* @__PURE__ */ jsx(
|
|
54148
|
+
Input,
|
|
54149
|
+
{
|
|
54150
|
+
id: "order-confirmations",
|
|
54151
|
+
type: "email",
|
|
54152
|
+
value: o.POEmail || "",
|
|
54153
|
+
onChange: (b) => f("POEmail", b.target.value),
|
|
54154
|
+
placeholder: "email@example.com",
|
|
54155
|
+
disabled: i
|
|
54156
|
+
}
|
|
54157
|
+
)
|
|
54158
|
+
] })
|
|
54159
|
+
] })
|
|
54160
|
+
] }) }),
|
|
54161
|
+
/* @__PURE__ */ jsx(CardFooter, { className: "flex justify-end", children: n ? /* @__PURE__ */ jsx(Skeleton, { className: "h-10 w-20" }) : /* @__PURE__ */ jsxs(Button, { onClick: p, disabled: i, children: [
|
|
54162
|
+
i && /* @__PURE__ */ jsx(LoaderCircle, { className: "mr-2 h-4 w-4 animate-spin" }),
|
|
54163
|
+
"Save"
|
|
54164
|
+
] }) })
|
|
54165
|
+
] });
|
|
54166
|
+
}
|
|
54167
|
+
const imgSizeMap = {
|
|
54168
|
+
sm: 100,
|
|
54169
|
+
md: 200,
|
|
54170
|
+
lg: 300,
|
|
54171
|
+
xl: 400
|
|
54172
|
+
};
|
|
54173
|
+
function ProductImage({ randmarSKU: t, size: e = "md", alt: n, secondaryContent: i }) {
|
|
54174
|
+
const [o, l] = React.useState(!1), [u, d] = React.useState(!1), [f, p] = React.useState(!1), [m, g] = React.useState(!1), b = `https://api.randmar.io/Product/${t}/Video`;
|
|
54175
|
+
React.useEffect(() => {
|
|
54176
|
+
(async () => {
|
|
54177
|
+
try {
|
|
54178
|
+
const I = await (await fetch(b + "/Exists")).json();
|
|
54179
|
+
d(I);
|
|
54180
|
+
} catch (R) {
|
|
54181
|
+
console.error("Error checking for video:", R), d(!1);
|
|
54182
|
+
}
|
|
54183
|
+
})();
|
|
54184
|
+
}, [t, b]);
|
|
54185
|
+
async function _() {
|
|
54186
|
+
if (u) {
|
|
54187
|
+
g(!0);
|
|
54188
|
+
try {
|
|
54189
|
+
const R = await (await fetch(b)).blob(), I = window.URL.createObjectURL(R), M = document.createElement("a");
|
|
54190
|
+
M.href = I, M.download = `${t || "product"}-video.mp4`, document.body.appendChild(M), M.click(), document.body.removeChild(M), window.URL.revokeObjectURL(I);
|
|
54191
|
+
} catch (T) {
|
|
54192
|
+
console.error("Error downloading video:", T);
|
|
54193
|
+
} finally {
|
|
54194
|
+
g(!1);
|
|
54195
|
+
}
|
|
54196
|
+
}
|
|
54197
|
+
}
|
|
54198
|
+
function E() {
|
|
54199
|
+
navigator.clipboard.writeText(b), p(!0), setTimeout(() => {
|
|
54200
|
+
p(!1);
|
|
54201
|
+
}, 2e3);
|
|
54202
|
+
}
|
|
54203
|
+
function C() {
|
|
54204
|
+
l(!0);
|
|
54205
|
+
}
|
|
54206
|
+
const S = imgSizeMap[e || "xl"];
|
|
54207
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
54208
|
+
/* @__PURE__ */ jsx(Dialog, { open: o, onOpenChange: l, children: /* @__PURE__ */ jsx(DialogContent, { className: "max-w-4xl p-0 overflow-hidden", children: i ? /* @__PURE__ */ jsxs("div", { className: "flex flex-row", children: [
|
|
54209
|
+
/* @__PURE__ */ jsxs(
|
|
54210
|
+
"video",
|
|
54211
|
+
{
|
|
54212
|
+
className: "w-full rounded-l-lg max-h-[720px] object-contain",
|
|
54213
|
+
controls: !0,
|
|
54214
|
+
autoPlay: !0,
|
|
54215
|
+
muted: !0,
|
|
54216
|
+
loop: !0,
|
|
54217
|
+
children: [
|
|
54218
|
+
/* @__PURE__ */ jsx("source", { src: b, type: "video/mp4" }),
|
|
54219
|
+
"Your browser does not support the video tag."
|
|
54220
|
+
]
|
|
54221
|
+
}
|
|
54222
|
+
),
|
|
54223
|
+
/* @__PURE__ */ jsx("div", { className: "flex-grow min-w-[400px] h-[70vh] p-6", children: i })
|
|
54224
|
+
] }) : /* @__PURE__ */ jsxs("div", { className: "w-full relative", children: [
|
|
54225
|
+
/* @__PURE__ */ jsxs("video", { className: "w-full max-h-[720px] object-contain", controls: !0, autoPlay: !0, children: [
|
|
54226
|
+
/* @__PURE__ */ jsx("source", { src: b, type: "video/mp4" }),
|
|
54227
|
+
"Your browser does not support the video tag."
|
|
54228
|
+
] }),
|
|
54229
|
+
/* @__PURE__ */ jsxs("div", { className: "absolute top-2 right-12 flex gap-1", children: [
|
|
54230
|
+
/* @__PURE__ */ jsx(TooltipProvider, { children: /* @__PURE__ */ jsxs(Tooltip$1, { children: [
|
|
54231
|
+
/* @__PURE__ */ jsx(TooltipTrigger, { asChild: !0, children: /* @__PURE__ */ jsx(
|
|
54232
|
+
Button,
|
|
54233
|
+
{
|
|
54234
|
+
variant: "secondary",
|
|
54235
|
+
size: "icon",
|
|
54236
|
+
onClick: E,
|
|
54237
|
+
children: f ? /* @__PURE__ */ jsx(Check, { className: "h-4 w-4" }) : /* @__PURE__ */ jsx(Copy, { className: "h-4 w-4" })
|
|
54238
|
+
}
|
|
54239
|
+
) }),
|
|
54240
|
+
/* @__PURE__ */ jsx(TooltipContent, { children: /* @__PURE__ */ jsx("p", { children: "Copy video link" }) })
|
|
54241
|
+
] }) }),
|
|
54242
|
+
/* @__PURE__ */ jsx(TooltipProvider, { children: /* @__PURE__ */ jsxs(Tooltip$1, { children: [
|
|
54243
|
+
/* @__PURE__ */ jsx(TooltipTrigger, { asChild: !0, children: /* @__PURE__ */ jsx(
|
|
54244
|
+
Button,
|
|
54245
|
+
{
|
|
54246
|
+
variant: "secondary",
|
|
54247
|
+
size: "icon",
|
|
54248
|
+
onClick: _,
|
|
54249
|
+
disabled: m,
|
|
54250
|
+
children: /* @__PURE__ */ jsx(Download, { className: "h-4 w-4" })
|
|
54251
|
+
}
|
|
54252
|
+
) }),
|
|
54253
|
+
/* @__PURE__ */ jsx(TooltipContent, { children: /* @__PURE__ */ jsx("p", { children: "Download video" }) })
|
|
54254
|
+
] }) })
|
|
54255
|
+
] })
|
|
54256
|
+
] }) }) }),
|
|
54257
|
+
/* @__PURE__ */ jsxs("div", { className: "relative w-max h-max", children: [
|
|
54258
|
+
/* @__PURE__ */ jsx(
|
|
54259
|
+
"img",
|
|
54260
|
+
{
|
|
54261
|
+
alt: n || `Product ${t}`,
|
|
54262
|
+
className: `rounded-md ${u ? "cursor-pointer" : ""}`,
|
|
54263
|
+
onClick: u ? C : void 0,
|
|
54264
|
+
src: `https://api.randmar.io/Product/${t}/Image?width=${S * 1.5}&height=${S * 1.5}`,
|
|
54265
|
+
width: S,
|
|
54266
|
+
height: S
|
|
54267
|
+
}
|
|
54268
|
+
),
|
|
54269
|
+
u && /* @__PURE__ */ jsx(TooltipProvider, { children: /* @__PURE__ */ jsxs(Tooltip$1, { children: [
|
|
54270
|
+
/* @__PURE__ */ jsx(TooltipTrigger, { asChild: !0, children: /* @__PURE__ */ jsx(
|
|
54271
|
+
Button,
|
|
54272
|
+
{
|
|
54273
|
+
variant: "secondary",
|
|
54274
|
+
size: "icon",
|
|
54275
|
+
className: "absolute top-2 right-2",
|
|
54276
|
+
onClick: C,
|
|
54277
|
+
children: /* @__PURE__ */ jsx(Play, { className: "h-4 w-4" })
|
|
54278
|
+
}
|
|
54279
|
+
) }),
|
|
54280
|
+
/* @__PURE__ */ jsx(TooltipContent, { children: /* @__PURE__ */ jsx("p", { children: "Play video" }) })
|
|
54281
|
+
] }) })
|
|
54282
|
+
] })
|
|
54283
|
+
] });
|
|
54284
|
+
}
|
|
54285
|
+
function ProductCard({
|
|
54286
|
+
item: t,
|
|
54287
|
+
addToCart: e = !1,
|
|
54288
|
+
syncToShopify: n = !1,
|
|
54289
|
+
customAction: i = /* @__PURE__ */ jsx(Fragment, {}),
|
|
54290
|
+
defaultOpportunityNumber: o = "",
|
|
54291
|
+
viewProductLink: l,
|
|
54292
|
+
addToCartAction: u,
|
|
54293
|
+
isAddToCartActionLoading: d = !1,
|
|
54294
|
+
syncToShopifyAction: f,
|
|
54295
|
+
isSyncToShopifyActionLoading: p = !1
|
|
54296
|
+
}) {
|
|
54297
|
+
var z, W, J, ne, oe, le, ie, ue, ae, ce, se;
|
|
54298
|
+
const [m, g] = useState(1), [b, _] = useState(null), [E, C] = useState(0), [S, T] = useState(!1), R = ((z = t == null ? void 0 : t.Distribution) == null ? void 0 : z.Cost) || 0, I = ((W = t == null ? void 0 : t.Distribution) == null ? void 0 : W.RegularPrice) || 0, M = ((J = t == null ? void 0 : t.Distribution) == null ? void 0 : J.Price) || 0;
|
|
54299
|
+
useEffect(() => {
|
|
54300
|
+
g(1), _(null), C(0), T(!1);
|
|
54301
|
+
}, [t == null ? void 0 : t.RandmarSKU]);
|
|
54302
|
+
const [A, N] = useState(null), [O, D] = useState(!1);
|
|
54303
|
+
useEffect(() => {
|
|
54304
|
+
const te = async () => {
|
|
54305
|
+
if (t != null && t.ManufacturerId) {
|
|
54306
|
+
D(!0);
|
|
54307
|
+
try {
|
|
54308
|
+
const Z = await fetch(
|
|
54309
|
+
`https://api.randmar.io/V4/Partner/${t.ManufacturerId}/Account/Logo?width=60&height=40`
|
|
54310
|
+
);
|
|
54311
|
+
if (Z.ok) {
|
|
54312
|
+
const K = await Z.blob();
|
|
54313
|
+
N(URL.createObjectURL(K));
|
|
54314
|
+
}
|
|
54315
|
+
} catch (Z) {
|
|
54316
|
+
console.error("Failed to load logo:", Z);
|
|
54317
|
+
} finally {
|
|
54318
|
+
D(!1);
|
|
54319
|
+
}
|
|
54320
|
+
}
|
|
54321
|
+
};
|
|
54322
|
+
t != null && t.ManufacturerId && te();
|
|
54323
|
+
}, [t == null ? void 0 : t.ManufacturerId]), useEffect(() => {
|
|
54324
|
+
var te;
|
|
54325
|
+
if (t && o) {
|
|
54326
|
+
const Z = (te = t.Opportunities) == null ? void 0 : te.find((K) => K.BidNumber == o);
|
|
54327
|
+
Z && _(Z);
|
|
54328
|
+
}
|
|
54329
|
+
}, [t, o]), useEffect(() => {
|
|
54330
|
+
if (!t) return;
|
|
54331
|
+
const te = b != null && b.Price ? b.Price : M;
|
|
54332
|
+
C(I > 0 ? Math.round((I - te) / I * 100) : 0);
|
|
54333
|
+
}, [t, b, M, I]), useEffect(() => {
|
|
54334
|
+
d || g(1);
|
|
54335
|
+
}, [d]);
|
|
54336
|
+
const V = (te) => {
|
|
54337
|
+
if (te.Active !== !0) return !1;
|
|
54338
|
+
const Z = (/* @__PURE__ */ new Date()).toISOString().split("T")[0];
|
|
54339
|
+
return !(te.EndDate && te.EndDate.split("T")[0] < Z || te.StartDate && te.StartDate.split("T")[0] > Z);
|
|
54340
|
+
};
|
|
54341
|
+
if (!t)
|
|
54342
|
+
return /* @__PURE__ */ jsx(Card, { children: /* @__PURE__ */ jsxs(CardContent, { className: "p-6", children: [
|
|
54343
|
+
/* @__PURE__ */ jsxs("div", { className: "flex justify-between items-start mb-3", children: [
|
|
54344
|
+
/* @__PURE__ */ jsx(Skeleton, { className: "h-7 w-3/4" }),
|
|
54345
|
+
/* @__PURE__ */ jsx("div", { className: "h-10 w-24 flex items-center justify-end ml-4", children: /* @__PURE__ */ jsx(Skeleton, { className: "h-10 w-24 rounded-md" }) })
|
|
54346
|
+
] }),
|
|
54347
|
+
/* @__PURE__ */ jsxs("div", { className: "flex flex-wrap gap-2 mb-4", children: [
|
|
54348
|
+
/* @__PURE__ */ jsx(Skeleton, { className: "h-6 w-20 rounded-full" }),
|
|
54349
|
+
/* @__PURE__ */ jsx(Skeleton, { className: "h-6 w-24 rounded-full" }),
|
|
54350
|
+
/* @__PURE__ */ jsx(Skeleton, { className: "h-6 w-28 rounded-full" })
|
|
54351
|
+
] }),
|
|
54352
|
+
/* @__PURE__ */ jsxs("div", { className: "flex gap-6", children: [
|
|
54353
|
+
/* @__PURE__ */ jsxs("div", { className: "grid grid-cols-2 gap-x-4 gap-y-6 flex-1", children: [
|
|
54354
|
+
/* @__PURE__ */ jsxs("div", { children: [
|
|
54355
|
+
/* @__PURE__ */ jsx(Skeleton, { className: "h-4 w-12 mb-1" }),
|
|
54356
|
+
/* @__PURE__ */ jsx(Skeleton, { className: "h-5 w-20" })
|
|
54357
|
+
] }),
|
|
54358
|
+
/* @__PURE__ */ jsxs("div", { children: [
|
|
54359
|
+
/* @__PURE__ */ jsx(Skeleton, { className: "h-4 w-12 mb-1" }),
|
|
54360
|
+
/* @__PURE__ */ jsx(Skeleton, { className: "h-5 w-24" })
|
|
54361
|
+
] }),
|
|
54362
|
+
/* @__PURE__ */ jsxs("div", { children: [
|
|
54363
|
+
/* @__PURE__ */ jsx(Skeleton, { className: "h-4 w-20 mb-1" }),
|
|
54364
|
+
/* @__PURE__ */ jsx(Skeleton, { className: "h-5 w-16" })
|
|
54365
|
+
] }),
|
|
54366
|
+
/* @__PURE__ */ jsxs("div", { children: [
|
|
54367
|
+
/* @__PURE__ */ jsx(Skeleton, { className: "h-4 w-12 mb-1" }),
|
|
54368
|
+
/* @__PURE__ */ jsx(Skeleton, { className: "h-5 w-20" })
|
|
54369
|
+
] })
|
|
54370
|
+
] }),
|
|
54371
|
+
/* @__PURE__ */ jsx("div", { className: "flex flex-col", children: /* @__PURE__ */ jsx("div", { className: "w-60 h-40", children: /* @__PURE__ */ jsx(Skeleton, { className: "w-full h-full rounded-lg" }) }) })
|
|
54372
|
+
] }),
|
|
54373
|
+
/* @__PURE__ */ jsxs("div", { className: "flex gap-6 mt-4", children: [
|
|
54374
|
+
/* @__PURE__ */ jsx("div", { className: "flex flex-1", children: /* @__PURE__ */ jsxs("div", { className: "w-full", children: [
|
|
54375
|
+
/* @__PURE__ */ jsx(Skeleton, { className: "h-4 w-24 mb-3" }),
|
|
54376
|
+
/* @__PURE__ */ jsx(Skeleton, { className: "h-16 w-full rounded-md" })
|
|
54377
|
+
] }) }),
|
|
54378
|
+
/* @__PURE__ */ jsxs("div", { className: "flex flex-col items-center", children: [
|
|
54379
|
+
/* @__PURE__ */ jsx(Skeleton, { className: "h-10 w-32 rounded-md" }),
|
|
54380
|
+
/* @__PURE__ */ jsx(Skeleton, { className: "h-5 w-24 mt-4" })
|
|
54381
|
+
] })
|
|
54382
|
+
] }),
|
|
54383
|
+
/* @__PURE__ */ jsxs("div", { className: "flex gap-6 mt-4", children: [
|
|
54384
|
+
/* @__PURE__ */ jsxs("div", { className: "flex flex-col items-start gap-1 mb-2", children: [
|
|
54385
|
+
/* @__PURE__ */ jsx(Skeleton, { className: "h-8 w-32" }),
|
|
54386
|
+
/* @__PURE__ */ jsx(Skeleton, { className: "h-6 w-24" })
|
|
54387
|
+
] }),
|
|
54388
|
+
/* @__PURE__ */ jsxs("div", { className: "flex flex-1 items-center gap-2", children: [
|
|
54389
|
+
/* @__PURE__ */ jsx(Skeleton, { className: "h-10 w-24 rounded-md" }),
|
|
54390
|
+
/* @__PURE__ */ jsx(Skeleton, { className: "h-10 flex-1 rounded-md" })
|
|
54391
|
+
] })
|
|
54392
|
+
] })
|
|
54393
|
+
] }) });
|
|
54394
|
+
const L = (t == null ? void 0 : t.Opportunities) || [], B = L.length > 0, F = () => {
|
|
54395
|
+
if (m == null) {
|
|
54396
|
+
g(1);
|
|
54397
|
+
return;
|
|
54398
|
+
}
|
|
54399
|
+
m > 1 && g(m - 1);
|
|
54400
|
+
}, j = () => {
|
|
54401
|
+
if (m == null) {
|
|
54402
|
+
g(1);
|
|
54403
|
+
return;
|
|
54404
|
+
}
|
|
54405
|
+
g(m + 1);
|
|
54406
|
+
}, q = (te) => {
|
|
54407
|
+
const Z = parseInt(te.target.value, 10);
|
|
54408
|
+
if (!isNaN(Z) && Z > 0) {
|
|
54409
|
+
g(Z);
|
|
54410
|
+
return;
|
|
54411
|
+
}
|
|
54412
|
+
g(void 0);
|
|
54413
|
+
}, G = () => {
|
|
54414
|
+
(m == null || m < 1) && g(1);
|
|
54415
|
+
}, U = ((oe = (ne = t.Distribution) == null ? void 0 : ne.Inventory) == null ? void 0 : oe.reduce((te, Z) => te + (Z.AvailableQuantity || 0), 0)) || 0, Q = (te) => {
|
|
54416
|
+
try {
|
|
54417
|
+
return new Date(te).toLocaleDateString("en-US", { year: "numeric", month: "short", day: "numeric" });
|
|
54418
|
+
} catch (Z) {
|
|
54419
|
+
return console.error(Z), te.split("T")[0] || "N/A";
|
|
54420
|
+
}
|
|
54421
|
+
}, H = () => {
|
|
54422
|
+
u && u({ quantity: m ?? 1, bidNumber: (b == null ? void 0 : b.BidNumber) ?? null });
|
|
54423
|
+
};
|
|
54424
|
+
return /* @__PURE__ */ jsx(Card, { className: "hover:shadow-lg transition-shadow", children: /* @__PURE__ */ jsxs(CardContent, { className: "p-6", children: [
|
|
54425
|
+
/* @__PURE__ */ jsxs("div", { className: "flex justify-between items-start mb-3", children: [
|
|
54426
|
+
/* @__PURE__ */ jsx("h3", { className: "font-semibold text-xl", children: t.Title || t.RandmarTitle }),
|
|
54427
|
+
/* @__PURE__ */ jsx("div", { className: "h-10 w-24 flex items-center justify-end ml-4", children: O ? /* @__PURE__ */ jsx(Skeleton, { className: "h-10 w-24 rounded-md" }) : A && /* @__PURE__ */ jsx(
|
|
54428
|
+
"img",
|
|
54429
|
+
{
|
|
54430
|
+
src: A,
|
|
54431
|
+
alt: t.ManufacturerName ?? "",
|
|
54432
|
+
className: "max-h-10 max-w-24 object-contain"
|
|
54433
|
+
}
|
|
54434
|
+
) })
|
|
54435
|
+
] }),
|
|
54436
|
+
/* @__PURE__ */ jsxs("div", { className: "flex gap-6", children: [
|
|
54437
|
+
/* @__PURE__ */ jsxs("div", { className: "flex-1", children: [
|
|
54438
|
+
/* @__PURE__ */ jsxs("div", { className: "flex flex-wrap gap-2 mb-4", children: [
|
|
54439
|
+
t.State && /* @__PURE__ */ jsxs(
|
|
54440
|
+
Badge,
|
|
54441
|
+
{
|
|
54442
|
+
variant: "outline",
|
|
54443
|
+
className: `rounded-full px-3 ${t.State === "Active" ? "bg-green-50 text-green-700 hover:bg-green-50" : "bg-red-50 text-red-700 hover:bg-red-50"}`,
|
|
54444
|
+
children: [
|
|
54445
|
+
/* @__PURE__ */ jsx(Check, { size: "12", className: "mr-1.5" }),
|
|
54446
|
+
" ",
|
|
54447
|
+
t.State
|
|
54448
|
+
]
|
|
54449
|
+
}
|
|
54450
|
+
),
|
|
54451
|
+
/* @__PURE__ */ jsxs(
|
|
54452
|
+
Badge,
|
|
54453
|
+
{
|
|
54454
|
+
variant: "outline",
|
|
54455
|
+
className: `rounded-full px-3 ${t.SerialNumber ? "bg-green-50 text-green-700 hover:bg-green-50" : "bg-yellow-50 text-yellow-700 hover:bg-yellow-50"}`,
|
|
54456
|
+
children: [
|
|
54457
|
+
/* @__PURE__ */ jsx(QrCode, { size: "12", className: "mr-1.5" }),
|
|
54458
|
+
" ",
|
|
54459
|
+
t.SerialNumber ? "Serialized" : "Unserialized"
|
|
54460
|
+
]
|
|
54461
|
+
}
|
|
54462
|
+
),
|
|
54463
|
+
t.TransparencyCode && /* @__PURE__ */ jsxs(Badge, { variant: "outline", className: "rounded-full px-3 bg-green-50 text-green-700 hover:bg-green-50", children: [
|
|
54464
|
+
/* @__PURE__ */ jsx(CircleDashed, { size: "12", className: "mr-1.5" }),
|
|
54465
|
+
" Transparency Code"
|
|
54466
|
+
] }),
|
|
54467
|
+
t.AvailableToBuy !== void 0 && /* @__PURE__ */ jsxs(
|
|
54468
|
+
Badge,
|
|
54469
|
+
{
|
|
54470
|
+
variant: "outline",
|
|
54471
|
+
className: `rounded-full px-3 ${t.AvailableToBuy ? "bg-green-50 text-green-700 hover:bg-green-50" : "bg-red-50 text-red-700 hover:bg-red-50"}`,
|
|
54472
|
+
children: [
|
|
54473
|
+
/* @__PURE__ */ jsx(ShoppingCart, { size: "12", className: "mr-1.5" }),
|
|
54474
|
+
" ",
|
|
54475
|
+
t.AvailableToBuy ? "Available" : "Unavailable"
|
|
54476
|
+
]
|
|
54477
|
+
}
|
|
54478
|
+
),
|
|
54479
|
+
t.ManufacturerCategory !== void 0 && /* @__PURE__ */ jsxs(
|
|
54480
|
+
Badge,
|
|
54481
|
+
{
|
|
54482
|
+
variant: "outline",
|
|
54483
|
+
className: `rounded-full px-3 ${(le = t.ManufacturerCategory) != null && le.QualificationRequired ? "bg-blue-50 text-blue-700 hover:bg-blue-50" : "bg-neutral-50 text-neutral-700 hover:bg-neutral-50"}`,
|
|
54484
|
+
children: [
|
|
54485
|
+
/* @__PURE__ */ jsx(ShieldCheck, { size: "12", className: "mr-1.5" }),
|
|
54486
|
+
" ",
|
|
54487
|
+
(ie = t.ManufacturerCategory) != null && ie.QualificationRequired ? "Qualified Only" : "Available to all"
|
|
54488
|
+
]
|
|
54489
|
+
}
|
|
54490
|
+
),
|
|
54491
|
+
t.ManufacturerId && /* @__PURE__ */ jsxs(
|
|
54492
|
+
Badge,
|
|
54493
|
+
{
|
|
54494
|
+
variant: "outline",
|
|
54495
|
+
className: `rounded-full px-3 ${t.AutoUpdate ? "bg-green-50 text-green-700 hover:bg-green-50" : "bg-red-50 text-red-700 hover:bg-red-50"}`,
|
|
54496
|
+
children: [
|
|
54497
|
+
/* @__PURE__ */ jsx(RefreshCw, { size: "12", className: "mr-1.5" }),
|
|
54498
|
+
" ",
|
|
54499
|
+
t.AutoUpdate ? `Automatic Reorder (${t.MasterCarton})` : "Manually Reorders"
|
|
54500
|
+
]
|
|
54501
|
+
}
|
|
54502
|
+
),
|
|
54503
|
+
/* @__PURE__ */ jsxs(
|
|
54504
|
+
Badge,
|
|
54505
|
+
{
|
|
54506
|
+
variant: "outline",
|
|
54507
|
+
className: `rounded-full px-3 ${t.BodyHTML && t.Title && t.MAP ? "bg-green-50 text-green-700 hover:bg-green-50" : "bg-red-50 text-red-700 hover:bg-red-50"}`,
|
|
54508
|
+
children: [
|
|
54509
|
+
/* @__PURE__ */ jsx(Store, { size: "12", className: "mr-1.5" }),
|
|
54510
|
+
" ",
|
|
54511
|
+
t.BodyHTML && t.Title && t.MAP ? "Shopify Ready" : "Not Shopify Ready"
|
|
54512
|
+
]
|
|
54513
|
+
}
|
|
54514
|
+
)
|
|
54515
|
+
] }),
|
|
54516
|
+
/* @__PURE__ */ jsxs("div", { className: "grid grid-cols-2 gap-x-4 gap-y-4 flex-1", children: [
|
|
54517
|
+
/* @__PURE__ */ jsxs("div", { children: [
|
|
54518
|
+
/* @__PURE__ */ jsx("div", { className: "text-sm text-muted-foreground", children: "MPN" }),
|
|
54519
|
+
/* @__PURE__ */ jsx("div", { className: "font-medium", children: t.MPN || "N/A" })
|
|
54520
|
+
] }),
|
|
54521
|
+
/* @__PURE__ */ jsxs("div", { children: [
|
|
54522
|
+
/* @__PURE__ */ jsx("div", { className: "text-sm text-muted-foreground", children: "UPC" }),
|
|
54523
|
+
/* @__PURE__ */ jsx("div", { className: "font-medium", children: t.UPC || "N/A" })
|
|
54524
|
+
] }),
|
|
54525
|
+
/* @__PURE__ */ jsxs("div", { children: [
|
|
54526
|
+
/* @__PURE__ */ jsx("div", { className: "text-sm text-muted-foreground", children: "Unit Weight" }),
|
|
54527
|
+
/* @__PURE__ */ jsx("div", { className: "font-medium", children: t.UnitWeight ? `${t.UnitWeight} lbs` : "N/A" })
|
|
54528
|
+
] }),
|
|
54529
|
+
/* @__PURE__ */ jsxs("div", { children: [
|
|
54530
|
+
/* @__PURE__ */ jsx("div", { className: "text-sm text-muted-foreground", children: "MAP" }),
|
|
54531
|
+
/* @__PURE__ */ jsx("div", { className: "font-medium", children: t.MAP ? "$" + t.MAP.toFixed(2) : "N/A" })
|
|
54532
|
+
] }),
|
|
54533
|
+
t.CountryCodeOfOrigin && /* @__PURE__ */ jsxs("div", { children: [
|
|
54534
|
+
/* @__PURE__ */ jsx("div", { className: "text-sm text-muted-foreground", children: "Origin" }),
|
|
54535
|
+
/* @__PURE__ */ jsxs("div", { className: "font-medium flex items-center", children: [
|
|
54536
|
+
/* @__PURE__ */ jsx(
|
|
54537
|
+
CountryFlag,
|
|
54538
|
+
{
|
|
54539
|
+
countryCode: t.CountryCodeOfOrigin,
|
|
54540
|
+
className: "mr-2"
|
|
54541
|
+
}
|
|
54542
|
+
),
|
|
54543
|
+
t.CountryCodeOfOrigin
|
|
54544
|
+
] })
|
|
54545
|
+
] })
|
|
54546
|
+
] })
|
|
54547
|
+
] }),
|
|
54548
|
+
/* @__PURE__ */ jsx("div", { className: "flex flex-col", children: /* @__PURE__ */ jsx(ProductImage, { randmarSKU: t.RandmarSKU || "", alt: t.RandmarTitle || "" }) })
|
|
54549
|
+
] }),
|
|
54550
|
+
/* @__PURE__ */ jsxs("div", { className: "flex gap-6 mt-4", children: [
|
|
54551
|
+
/* @__PURE__ */ jsx("div", { className: "flex flex-1", children: B && t.Distribution && /* @__PURE__ */ jsxs("div", { className: "w-full", children: [
|
|
54552
|
+
/* @__PURE__ */ jsx("div", { className: "flex items-center", children: "You have " + L.length + (L.length > 1 ? " opportunities" : " opportunity") + " for this product:" }),
|
|
54553
|
+
/* @__PURE__ */ jsx("div", { className: "space-y-2 max-h-[200px] overflow-y-auto p-2 mt-1", children: L.map((te, Z) => {
|
|
54554
|
+
var K;
|
|
54555
|
+
return /* @__PURE__ */ jsxs(
|
|
54556
|
+
"div",
|
|
54557
|
+
{
|
|
54558
|
+
className: `flex justify-between items-center rounded-lg transition-colors py-2 px-4 bg-purple-100 border border-muted
|
|
54559
|
+
${te.BidNumber == (b == null ? void 0 : b.BidNumber) ? "cursor-pointer border-2 border-purple-900" : V(te) ? "hover:bg-purple-200 cursor-pointer" : "!bg-neutral-50"}
|
|
54560
|
+
`,
|
|
54561
|
+
onClick: () => {
|
|
54562
|
+
V(te) && _(
|
|
54563
|
+
te.BidNumber != (b == null ? void 0 : b.BidNumber) ? te : null
|
|
54564
|
+
);
|
|
54565
|
+
},
|
|
54566
|
+
children: [
|
|
54567
|
+
/* @__PURE__ */ jsx("div", { className: "flex items-center", children: /* @__PURE__ */ jsxs("div", { className: "flex flex-col", children: [
|
|
54568
|
+
/* @__PURE__ */ jsx("span", { className: "font-medium text-sm", children: te.Opportunity }),
|
|
54569
|
+
/* @__PURE__ */ jsxs("span", { className: "text-xs text-neutral-900", children: [
|
|
54570
|
+
te.BidNumber,
|
|
54571
|
+
" ",
|
|
54572
|
+
!V(te) && /* @__PURE__ */ jsx(Badge, { variant: "outline", className: "text-xs mx-1 h-5 bg-gray-100", children: "Currently unavailable" })
|
|
54573
|
+
] })
|
|
54574
|
+
] }) }),
|
|
54575
|
+
/* @__PURE__ */ jsxs("div", { className: "flex flex-col items-end", children: [
|
|
54576
|
+
/* @__PURE__ */ jsxs("span", { className: "font-semibold", children: [
|
|
54577
|
+
"$",
|
|
54578
|
+
(K = te.Price) == null ? void 0 : K.toFixed(2)
|
|
54579
|
+
] }),
|
|
54580
|
+
te.Rebate && te.Rebate > 0 && /* @__PURE__ */ jsxs("span", { className: "text-xs text-green-600", children: [
|
|
54581
|
+
"Rebate: $",
|
|
54582
|
+
te.Rebate.toFixed(2)
|
|
54583
|
+
] }),
|
|
54584
|
+
te.EndDate && /* @__PURE__ */ jsxs("span", { className: "text-xs text-neutral-600", children: [
|
|
54585
|
+
"Ends: ",
|
|
54586
|
+
Q(te.EndDate)
|
|
54587
|
+
] })
|
|
54588
|
+
] })
|
|
54589
|
+
]
|
|
54590
|
+
},
|
|
54591
|
+
Z
|
|
54592
|
+
);
|
|
54593
|
+
}) })
|
|
54594
|
+
] }) }),
|
|
54595
|
+
/* @__PURE__ */ jsxs("div", { className: "flex flex-col items-center", children: [
|
|
54596
|
+
l && /* @__PURE__ */ jsx(Link, { to: l, children: /* @__PURE__ */ jsxs(Button, { variant: "secondary", children: [
|
|
54597
|
+
/* @__PURE__ */ jsx(Eye, { className: "mr-2" }),
|
|
54598
|
+
"View Product"
|
|
54599
|
+
] }) }),
|
|
54600
|
+
((ue = t.Distribution) == null ? void 0 : ue.Inventory) && /* @__PURE__ */ jsx("div", { className: "mt-4", children: /* @__PURE__ */ jsxs(Dialog, { open: S, onOpenChange: T, children: [
|
|
54601
|
+
/* @__PURE__ */ jsx(DialogTrigger, { asChild: !0, children: /* @__PURE__ */ jsxs(
|
|
54602
|
+
Button,
|
|
54603
|
+
{
|
|
54604
|
+
variant: "ghost",
|
|
54605
|
+
className: `flex items-center text-sm ${U > 0 ? "text-green-700" : "text-red-700"}`,
|
|
54606
|
+
children: [
|
|
54607
|
+
/* @__PURE__ */ jsx(Warehouse, { size: "16", className: "mr-2" }),
|
|
54608
|
+
U > 0 ? /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
54609
|
+
U,
|
|
54610
|
+
" in stock"
|
|
54611
|
+
] }) : /* @__PURE__ */ jsx(Fragment, { children: "Out of stock" })
|
|
54612
|
+
]
|
|
54613
|
+
}
|
|
54614
|
+
) }),
|
|
54615
|
+
/* @__PURE__ */ jsxs(DialogContent, { className: "max-w-4xl", children: [
|
|
54616
|
+
/* @__PURE__ */ jsx(DialogHeader, { children: /* @__PURE__ */ jsxs(DialogTitle, { className: "flex items-center", children: [
|
|
54617
|
+
/* @__PURE__ */ jsx(Warehouse, { className: "mr-2", size: 18 }),
|
|
54618
|
+
"Inventory Information"
|
|
54619
|
+
] }) }),
|
|
54620
|
+
/* @__PURE__ */ jsx(ProductInventoryGrid, { inventory: t.Distribution.Inventory })
|
|
54621
|
+
] })
|
|
54622
|
+
] }) })
|
|
54623
|
+
] })
|
|
54624
|
+
] }),
|
|
54625
|
+
t.Distribution && /* @__PURE__ */ jsxs("div", { className: "flex justify-between items-end mt-4", children: [
|
|
54626
|
+
/* @__PURE__ */ jsx("div", { className: "flex-shrink-1 flex flex-col items-start gap-1", children: R > 0 ? /* @__PURE__ */ jsx("div", { className: "flex items-center", children: /* @__PURE__ */ jsxs("span", { className: "text-2xl font-bold whitespace-nowrap", children: [
|
|
54627
|
+
/* @__PURE__ */ jsx("span", { children: "Cost: $" }),
|
|
54628
|
+
R.toFixed(2),
|
|
54629
|
+
/* @__PURE__ */ jsx("span", { children: " CAD" })
|
|
54630
|
+
] }) }) : /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
54631
|
+
/* @__PURE__ */ jsxs("div", { className: "flex items-center flex-wrap", children: [
|
|
54632
|
+
/* @__PURE__ */ jsxs("span", { className: "text-2xl font-bold whitespace-nowrap", children: [
|
|
54633
|
+
/* @__PURE__ */ jsx("span", { children: "$" }),
|
|
54634
|
+
b ? (ce = (ae = t.Opportunities) == null ? void 0 : ae.find((te) => te.BidNumber == b.BidNumber)) == null ? void 0 : ce.Price : M.toFixed(2),
|
|
54635
|
+
/* @__PURE__ */ jsx("span", { children: " CAD" })
|
|
54636
|
+
] }),
|
|
54637
|
+
E > 0 && /* @__PURE__ */ jsxs("span", { className: "text-muted-foreground line-through ml-2 whitespace-nowrap", children: [
|
|
54638
|
+
"$",
|
|
54639
|
+
I.toFixed(2)
|
|
54640
|
+
] })
|
|
54641
|
+
] }),
|
|
54642
|
+
E > 0 && /* @__PURE__ */ jsx("div", { className: "flex items-center", children: /* @__PURE__ */ jsxs(Badge, { variant: "outline", className: "bg-red-50 text-red-700 rounded-full px-3 whitespace-nowrap", children: [
|
|
54643
|
+
/* @__PURE__ */ jsxs("span", { children: [
|
|
54644
|
+
E,
|
|
54645
|
+
"% OFF"
|
|
54646
|
+
] }),
|
|
54647
|
+
((se = t.InstantRebate) == null ? void 0 : se.EndDate) && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
54648
|
+
/* @__PURE__ */ jsx("span", { className: "mx-1.5", children: "●" }),
|
|
54649
|
+
" Ends ",
|
|
54650
|
+
t.InstantRebate.EndDate.split("T")[0]
|
|
54651
|
+
] }),
|
|
54652
|
+
(b == null ? void 0 : b.EndDate) && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
54653
|
+
/* @__PURE__ */ jsx("span", { className: "mx-1.5", children: "●" }),
|
|
54654
|
+
" Ends ",
|
|
54655
|
+
b.EndDate.split("T")[0]
|
|
54588
54656
|
] })
|
|
54589
|
-
] })
|
|
54590
|
-
|
|
54591
|
-
|
|
54657
|
+
] }) })
|
|
54658
|
+
] }) }),
|
|
54659
|
+
/* @__PURE__ */ jsxs("div", { className: "flex flex-shrink-0 gap-2 ml-4", children: [
|
|
54660
|
+
typeof e < "u" && e && /* @__PURE__ */ jsxs("div", { className: "flex items-center border rounded-md", children: [
|
|
54592
54661
|
/* @__PURE__ */ jsx(
|
|
54593
|
-
|
|
54662
|
+
Button,
|
|
54594
54663
|
{
|
|
54595
|
-
|
|
54596
|
-
|
|
54597
|
-
|
|
54598
|
-
|
|
54599
|
-
|
|
54600
|
-
|
|
54664
|
+
variant: "ghost",
|
|
54665
|
+
size: "icon",
|
|
54666
|
+
className: "rounded-r-none",
|
|
54667
|
+
onClick: F,
|
|
54668
|
+
disabled: typeof m < "u" && (m <= 1 || !t.AvailableToBuy || d || !u),
|
|
54669
|
+
children: "-"
|
|
54670
|
+
}
|
|
54671
|
+
),
|
|
54672
|
+
/* @__PURE__ */ jsx(
|
|
54673
|
+
"input",
|
|
54674
|
+
{
|
|
54675
|
+
value: m,
|
|
54676
|
+
onChange: q,
|
|
54677
|
+
onBlur: G,
|
|
54678
|
+
onClick: (te) => te.currentTarget.select(),
|
|
54679
|
+
className: `w-12 text-center border-0 focus:ring-0 focus:outline-none ${!t.AvailableToBuy || d || !u ? "text-gray-400" : ""}`,
|
|
54680
|
+
disabled: !t.AvailableToBuy || d || !u
|
|
54681
|
+
}
|
|
54682
|
+
),
|
|
54683
|
+
/* @__PURE__ */ jsx(
|
|
54684
|
+
Button,
|
|
54685
|
+
{
|
|
54686
|
+
variant: "ghost",
|
|
54687
|
+
size: "icon",
|
|
54688
|
+
className: "rounded-l-none",
|
|
54689
|
+
onClick: j,
|
|
54690
|
+
disabled: !t.AvailableToBuy || d || !u,
|
|
54691
|
+
children: "+"
|
|
54601
54692
|
}
|
|
54602
54693
|
)
|
|
54603
|
-
] })
|
|
54694
|
+
] }),
|
|
54695
|
+
typeof e < "u" && e && /* @__PURE__ */ jsx(
|
|
54696
|
+
Button,
|
|
54697
|
+
{
|
|
54698
|
+
className: "gap-2 whitespace-nowrap",
|
|
54699
|
+
onClick: H,
|
|
54700
|
+
disabled: !t.AvailableToBuy || d || !u,
|
|
54701
|
+
children: d ? /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
54702
|
+
/* @__PURE__ */ jsx(LoaderCircle, { className: "h-4 w-4 animate-spin" }),
|
|
54703
|
+
"Adding..."
|
|
54704
|
+
] }) : /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
54705
|
+
/* @__PURE__ */ jsx(ShoppingCart, { className: "mr-2" }),
|
|
54706
|
+
"Add to Cart"
|
|
54707
|
+
] })
|
|
54708
|
+
}
|
|
54709
|
+
),
|
|
54710
|
+
n && /* @__PURE__ */ jsx(
|
|
54711
|
+
Button,
|
|
54712
|
+
{
|
|
54713
|
+
className: "gap-2 whitespace-nowrap bg-green-600 hover:bg-green-700",
|
|
54714
|
+
onClick: f,
|
|
54715
|
+
disabled: p || !f,
|
|
54716
|
+
children: p ? /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
54717
|
+
/* @__PURE__ */ jsx(LoaderCircle, { className: "h-4 w-4 animate-spin" }),
|
|
54718
|
+
"Syncing..."
|
|
54719
|
+
] }) : /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
54720
|
+
/* @__PURE__ */ jsx(ShoppingCart, { className: "mr-2" }),
|
|
54721
|
+
"Sync to Shopify"
|
|
54722
|
+
] })
|
|
54723
|
+
}
|
|
54724
|
+
),
|
|
54725
|
+
i
|
|
54604
54726
|
] })
|
|
54605
|
-
] })
|
|
54606
|
-
|
|
54607
|
-
i && /* @__PURE__ */ jsx(LoaderCircle, { className: "mr-2 h-4 w-4 animate-spin" }),
|
|
54608
|
-
"Save"
|
|
54609
|
-
] }) })
|
|
54610
|
-
] });
|
|
54727
|
+
] })
|
|
54728
|
+
] }) });
|
|
54611
54729
|
}
|
|
54612
|
-
function
|
|
54613
|
-
|
|
54614
|
-
|
|
54615
|
-
|
|
54616
|
-
|
|
54617
|
-
|
|
54618
|
-
|
|
54619
|
-
|
|
54620
|
-
|
|
54621
|
-
|
|
54622
|
-
|
|
54623
|
-
|
|
54624
|
-
delayed: { orders: 0, amount: 0 }
|
|
54625
|
-
};
|
|
54626
|
-
const l = t.filter((T) => T.DocumentType === "Order"), u = t.filter((T) => T.DocumentType === "Shipment"), d = l.filter((T) => T.WarehouseCode !== "3PLE"), f = d.reduce((T, R) => T + (R.Quantity || 0), 0), p = d.reduce((T, R) => T + (R.ExtendedPrice || 0), 0), m = l.filter((T) => T.WarehouseCode === "3PLE"), g = m.reduce((T, R) => T + (R.Quantity || 0), 0), b = m.reduce((T, R) => T + (R.ExtendedPrice || 0), 0), _ = u.length, E = u.reduce((T, R) => T + (R.ExtendedPrice || 0), 0), C = f + g + _, S = p + b + E;
|
|
54627
|
-
return {
|
|
54628
|
-
all: { orders: C, amount: S },
|
|
54629
|
-
processing: { orders: f, amount: p },
|
|
54630
|
-
shipped: { orders: _, amount: E },
|
|
54631
|
-
delayed: { orders: g, amount: b }
|
|
54632
|
-
};
|
|
54633
|
-
}, [t]), o = [
|
|
54634
|
-
{
|
|
54635
|
-
name: "All",
|
|
54636
|
-
icon: Package,
|
|
54637
|
-
color: "bg-blue-500",
|
|
54638
|
-
textColor: "text-blue-600",
|
|
54639
|
-
orders: i.all.orders,
|
|
54640
|
-
amount: i.all.amount
|
|
54641
|
-
},
|
|
54642
|
-
{
|
|
54643
|
-
name: "Processing",
|
|
54644
|
-
icon: RefreshCcw,
|
|
54645
|
-
color: "bg-yellow-500",
|
|
54646
|
-
textColor: "text-yellow-600",
|
|
54647
|
-
orders: i.processing.orders,
|
|
54648
|
-
amount: i.processing.amount
|
|
54649
|
-
},
|
|
54650
|
-
{
|
|
54651
|
-
name: "Shipped",
|
|
54652
|
-
icon: Truck,
|
|
54653
|
-
color: "bg-green-500",
|
|
54654
|
-
textColor: "text-green-600",
|
|
54655
|
-
orders: i.shipped.orders,
|
|
54656
|
-
amount: i.shipped.amount
|
|
54657
|
-
},
|
|
54658
|
-
{
|
|
54659
|
-
name: "Delayed",
|
|
54660
|
-
icon: CircleAlert,
|
|
54661
|
-
color: "bg-red-500",
|
|
54662
|
-
textColor: "text-red-600",
|
|
54663
|
-
orders: i.delayed.orders,
|
|
54664
|
-
amount: i.delayed.amount
|
|
54665
|
-
}
|
|
54666
|
-
];
|
|
54667
|
-
return e ? /* @__PURE__ */ jsxs(Card, { children: [
|
|
54668
|
-
/* @__PURE__ */ jsx(CardHeader, { className: "pb-0", children: /* @__PURE__ */ jsx(CardTitle, { className: "text-lg font-bold", children: "Active Orders" }) }),
|
|
54669
|
-
/* @__PURE__ */ jsx("div", { className: "grid grid-cols-1 sm:grid-cols-2 gap-4 p-4", children: [1, 2, 3, 4].map((l) => /* @__PURE__ */ jsxs("div", { className: "overflow-hidden rounded-md border", children: [
|
|
54670
|
-
/* @__PURE__ */ jsx("div", { className: "bg-slate-200 dark:bg-slate-700 h-[3px]" }),
|
|
54671
|
-
/* @__PURE__ */ jsxs("div", { className: "p-6 border border-t-0", children: [
|
|
54672
|
-
/* @__PURE__ */ jsxs("div", { className: "flex justify-between items-center mb-4", children: [
|
|
54673
|
-
/* @__PURE__ */ jsx(Skeleton, { className: "h-5 w-24" }),
|
|
54674
|
-
/* @__PURE__ */ jsx(Skeleton, { className: "h-8 w-8 rounded-full" })
|
|
54675
|
-
] }),
|
|
54676
|
-
/* @__PURE__ */ jsxs("div", { className: "flex justify-between items-start", children: [
|
|
54677
|
-
/* @__PURE__ */ jsxs("div", { children: [
|
|
54678
|
-
/* @__PURE__ */ jsx(Skeleton, { className: "h-3 w-16 mb-2" }),
|
|
54679
|
-
/* @__PURE__ */ jsx(Skeleton, { className: "h-7 w-12" })
|
|
54730
|
+
function ResellerBillingOverviewCard({ reseller: t, actions: e, loading: n = !1 }) {
|
|
54731
|
+
return n || !t ? /* @__PURE__ */ jsx(ResellerBillingOverviewSkeleton, {}) : /* @__PURE__ */ jsx(ResellerBillingOverviewData, { reseller: t, actions: e });
|
|
54732
|
+
}
|
|
54733
|
+
function ResellerBillingOverviewSkeleton() {
|
|
54734
|
+
return /* @__PURE__ */ jsxs(Card, { children: [
|
|
54735
|
+
/* @__PURE__ */ jsx(CardHeader, { children: /* @__PURE__ */ jsx(CardTitle, { children: /* @__PURE__ */ jsx(Skeleton, { className: "h-6 w-40" }) }) }),
|
|
54736
|
+
/* @__PURE__ */ jsxs(CardContent, { children: [
|
|
54737
|
+
/* @__PURE__ */ jsxs("div", { className: "grid grid-cols-1 md:grid-cols-2 gap-4", children: [
|
|
54738
|
+
/* @__PURE__ */ jsx("div", { className: "space-y-4", children: Array(3).fill(0).map((t, e) => /* @__PURE__ */ jsxs("div", { className: "border rounded-lg p-4", children: [
|
|
54739
|
+
/* @__PURE__ */ jsxs("div", { className: "flex justify-between items-center mb-4", children: [
|
|
54740
|
+
/* @__PURE__ */ jsx(Skeleton, { className: "h-5 w-24" }),
|
|
54741
|
+
/* @__PURE__ */ jsx(Skeleton, { className: "h-9 w-9 rounded-full" })
|
|
54680
54742
|
] }),
|
|
54681
|
-
/* @__PURE__ */ jsxs("div", { className: "text-end", children: [
|
|
54682
|
-
/* @__PURE__ */ jsx(Skeleton, { className: "h-3 w-16 mb-2" }),
|
|
54683
|
-
/* @__PURE__ */ jsx(Skeleton, { className: "h-5 w-20" })
|
|
54684
|
-
] })
|
|
54685
|
-
] })
|
|
54686
|
-
] })
|
|
54687
|
-
] }, l)) })
|
|
54688
|
-
] }) : /* @__PURE__ */ jsxs(Card, { children: [
|
|
54689
|
-
/* @__PURE__ */ jsx(CardHeader, { className: "pb-0", children: /* @__PURE__ */ jsx(CardTitle, { className: "text-lg font-bold", children: "Active Orders" }) }),
|
|
54690
|
-
/* @__PURE__ */ jsx("div", { className: "grid grid-cols-1 sm:grid-cols-2 gap-4 p-4", children: o.map((l) => /* @__PURE__ */ jsxs("div", { className: "overflow-hidden rounded-md border", children: [
|
|
54691
|
-
/* @__PURE__ */ jsx("div", { className: `${l.color} bg-opacity-60 h-[3px]` }),
|
|
54692
|
-
/* @__PURE__ */ jsxs("div", { className: "p-6 border border-t-0", children: [
|
|
54693
|
-
/* @__PURE__ */ jsxs("div", { className: "flex justify-between items-center mb-4", children: [
|
|
54694
|
-
/* @__PURE__ */ jsx("h3", { className: "font-semibold text-base", children: l.name }),
|
|
54695
|
-
/* @__PURE__ */ jsx("div", { className: `${l.color} bg-opacity-90 p-2 rounded-full`, children: /* @__PURE__ */ jsx(l.icon, { className: "size-4 shrink-0 text-white" }) })
|
|
54696
|
-
] }),
|
|
54697
|
-
/* @__PURE__ */ jsxs("div", { className: "flex justify-between items-start", children: [
|
|
54698
54743
|
/* @__PURE__ */ jsxs("div", { children: [
|
|
54699
|
-
/* @__PURE__ */ jsx(
|
|
54700
|
-
/* @__PURE__ */ jsx(
|
|
54744
|
+
/* @__PURE__ */ jsx(Skeleton, { className: "h-4 w-20 mb-1" }),
|
|
54745
|
+
/* @__PURE__ */ jsx(Skeleton, { className: "h-7 w-28" })
|
|
54746
|
+
] })
|
|
54747
|
+
] }, e)) }),
|
|
54748
|
+
/* @__PURE__ */ jsx("div", { className: "space-y-4", children: Array(2).fill(0).map((t, e) => /* @__PURE__ */ jsxs("div", { className: "border rounded-lg p-4", children: [
|
|
54749
|
+
/* @__PURE__ */ jsxs("div", { className: "flex justify-between items-center mb-4", children: [
|
|
54750
|
+
/* @__PURE__ */ jsx(Skeleton, { className: "h-5 w-24" }),
|
|
54751
|
+
/* @__PURE__ */ jsx(Skeleton, { className: "h-9 w-9 rounded-full" })
|
|
54701
54752
|
] }),
|
|
54702
|
-
/* @__PURE__ */ jsxs("div", {
|
|
54703
|
-
/* @__PURE__ */ jsx(
|
|
54704
|
-
/* @__PURE__ */ jsx(
|
|
54753
|
+
/* @__PURE__ */ jsxs("div", { children: [
|
|
54754
|
+
/* @__PURE__ */ jsx(Skeleton, { className: "h-4 w-20 mb-1" }),
|
|
54755
|
+
/* @__PURE__ */ jsx(Skeleton, { className: "h-7 w-28" })
|
|
54705
54756
|
] })
|
|
54706
|
-
] })
|
|
54707
|
-
] })
|
|
54708
|
-
|
|
54709
|
-
] });
|
|
54710
|
-
}
|
|
54711
|
-
function SalesOverviewCard({ salesData: t, salesStatistics: e = [], loading: n = !1 }) {
|
|
54712
|
-
return n || !t ? /* @__PURE__ */ jsx(SalesOverviewSkeleton, {}) : /* @__PURE__ */ jsx(SalesOverviewData, { salesData: t, salesStatistics: e });
|
|
54713
|
-
}
|
|
54714
|
-
function SalesOverviewSkeleton() {
|
|
54715
|
-
return /* @__PURE__ */ jsxs(Card, { children: [
|
|
54716
|
-
/* @__PURE__ */ jsx(CardHeader, { className: "pb-0", children: /* @__PURE__ */ jsx(CardTitle, { className: "text-lg sm:text-xl", children: /* @__PURE__ */ jsx(Skeleton, { className: "h-7 w-40" }) }) }),
|
|
54717
|
-
/* @__PURE__ */ jsxs(CardContent, { className: "pt-4 px-3 sm:px-6", children: [
|
|
54718
|
-
/* @__PURE__ */ jsx("div", { className: "grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-4", children: Array(3).fill(0).map((t, e) => /* @__PURE__ */ jsxs("div", { className: "border rounded-lg p-4", children: [
|
|
54719
|
-
/* @__PURE__ */ jsxs("div", { className: "flex justify-between items-center mb-4", children: [
|
|
54720
|
-
/* @__PURE__ */ jsx(Skeleton, { className: "h-5 w-24" }),
|
|
54721
|
-
/* @__PURE__ */ jsx(Skeleton, { className: "h-9 w-9 rounded-full" })
|
|
54722
|
-
] }),
|
|
54723
|
-
/* @__PURE__ */ jsxs("div", { children: [
|
|
54724
|
-
/* @__PURE__ */ jsx(Skeleton, { className: "h-4 w-20 mb-1" }),
|
|
54725
|
-
/* @__PURE__ */ jsx(Skeleton, { className: "h-7 w-28" })
|
|
54726
|
-
] })
|
|
54727
|
-
] }, e)) }),
|
|
54728
|
-
/* @__PURE__ */ jsx("div", { className: "mt-6", children: /* @__PURE__ */ jsxs("div", { className: "space-y-3", children: [
|
|
54729
|
-
/* @__PURE__ */ jsx(Skeleton, { className: "h-5 w-32" }),
|
|
54730
|
-
/* @__PURE__ */ jsx(Skeleton, { className: "h-[250px] w-full rounded-lg" })
|
|
54731
|
-
] }) })
|
|
54757
|
+
] }, e)) })
|
|
54758
|
+
] }),
|
|
54759
|
+
/* @__PURE__ */ jsx("div", { className: "flex justify-end mt-4", children: /* @__PURE__ */ jsx(Skeleton, { className: "h-10 w-28 rounded-md" }) })
|
|
54732
54760
|
] })
|
|
54733
54761
|
] });
|
|
54734
54762
|
}
|
|
54735
|
-
function
|
|
54736
|
-
|
|
54737
|
-
salesStatistics: e = []
|
|
54738
|
-
}) {
|
|
54739
|
-
const n = (l) => new Intl.NumberFormat("en-CA", {
|
|
54763
|
+
function ResellerBillingOverviewData({ reseller: t, actions: e }) {
|
|
54764
|
+
const n = (u) => u === void 0 ? "$0.00" : new Intl.NumberFormat("en-CA", {
|
|
54740
54765
|
style: "currency",
|
|
54741
54766
|
currency: "CAD",
|
|
54742
54767
|
minimumFractionDigits: 2,
|
|
54743
54768
|
maximumFractionDigits: 2
|
|
54744
|
-
}).format(
|
|
54769
|
+
}).format(u), i = t.Statement || {}, o = [
|
|
54745
54770
|
{
|
|
54746
|
-
title: "
|
|
54747
|
-
amount:
|
|
54771
|
+
title: "0 - 30 Days",
|
|
54772
|
+
amount: i.Over0 || 0,
|
|
54748
54773
|
icon: /* @__PURE__ */ jsx(Calendar, { className: "h-5 w-5 text-white" }),
|
|
54749
|
-
color: "bg-
|
|
54774
|
+
color: "bg-primary"
|
|
54750
54775
|
},
|
|
54751
54776
|
{
|
|
54752
|
-
title: "
|
|
54753
|
-
amount:
|
|
54777
|
+
title: "31 - 45 Days",
|
|
54778
|
+
amount: i.Over30 || 0,
|
|
54754
54779
|
icon: /* @__PURE__ */ jsx(Calendar, { className: "h-5 w-5 text-white" }),
|
|
54755
|
-
color: "bg-
|
|
54780
|
+
color: "bg-primary"
|
|
54756
54781
|
},
|
|
54757
54782
|
{
|
|
54758
|
-
title: "
|
|
54759
|
-
amount:
|
|
54783
|
+
title: "45+ Days",
|
|
54784
|
+
amount: i.Over45 || 0,
|
|
54760
54785
|
icon: /* @__PURE__ */ jsx(Calendar, { className: "h-5 w-5 text-white" }),
|
|
54761
|
-
color: "bg-
|
|
54786
|
+
color: "bg-primary"
|
|
54762
54787
|
}
|
|
54763
|
-
],
|
|
54764
|
-
|
|
54765
|
-
|
|
54766
|
-
|
|
54767
|
-
|
|
54768
|
-
|
|
54769
|
-
|
|
54770
|
-
|
|
54771
|
-
|
|
54788
|
+
], l = [
|
|
54789
|
+
{
|
|
54790
|
+
title: "Total",
|
|
54791
|
+
amount: i.Total || 0,
|
|
54792
|
+
icon: /* @__PURE__ */ jsx(DollarSign, { className: "h-5 w-5 text-white" }),
|
|
54793
|
+
color: "bg-green-500"
|
|
54794
|
+
},
|
|
54795
|
+
{
|
|
54796
|
+
title: "Credit Limit",
|
|
54797
|
+
amount: t.CreditLimit || 0,
|
|
54798
|
+
icon: /* @__PURE__ */ jsx(CreditCard, { className: "h-5 w-5 text-white" }),
|
|
54799
|
+
color: "bg-blue-500"
|
|
54800
|
+
}
|
|
54801
|
+
];
|
|
54772
54802
|
return /* @__PURE__ */ jsxs(Card, { children: [
|
|
54773
|
-
/* @__PURE__ */ jsx(CardHeader, {
|
|
54774
|
-
/* @__PURE__ */ jsxs(CardContent, {
|
|
54775
|
-
/* @__PURE__ */
|
|
54776
|
-
/* @__PURE__ */ jsxs("div", { className: "
|
|
54777
|
-
/* @__PURE__ */
|
|
54778
|
-
|
|
54779
|
-
|
|
54780
|
-
|
|
54781
|
-
/* @__PURE__ */ jsx("p", { className: "text-
|
|
54782
|
-
|
|
54783
|
-
|
|
54784
|
-
|
|
54785
|
-
|
|
54786
|
-
|
|
54787
|
-
|
|
54788
|
-
|
|
54789
|
-
|
|
54790
|
-
|
|
54791
|
-
|
|
54792
|
-
unitsPosition: "left",
|
|
54793
|
-
height: 200
|
|
54794
|
-
}
|
|
54795
|
-
) })
|
|
54796
|
-
] }) })
|
|
54803
|
+
/* @__PURE__ */ jsx(CardHeader, { children: /* @__PURE__ */ jsx(CardTitle, { children: "Billing Overview" }) }),
|
|
54804
|
+
/* @__PURE__ */ jsxs(CardContent, { children: [
|
|
54805
|
+
/* @__PURE__ */ jsxs("div", { className: "grid grid-cols-1 md:grid-cols-2 gap-4", children: [
|
|
54806
|
+
/* @__PURE__ */ jsx("div", { className: "space-y-4", children: o.map((u, d) => /* @__PURE__ */ jsxs("div", { className: "border rounded-lg p-4", children: [
|
|
54807
|
+
/* @__PURE__ */ jsxs("div", { className: "flex justify-between items-center", children: [
|
|
54808
|
+
/* @__PURE__ */ jsx("h3", { className: "text-sm sm:text-base font-medium", children: u.title }),
|
|
54809
|
+
/* @__PURE__ */ jsx("div", { className: `p-2 rounded-full ${u.color}`, children: u.icon })
|
|
54810
|
+
] }),
|
|
54811
|
+
/* @__PURE__ */ jsx("div", { children: /* @__PURE__ */ jsx("p", { className: "text-base sm:text-lg font-bold", children: n(u.amount) }) })
|
|
54812
|
+
] }, d)) }),
|
|
54813
|
+
/* @__PURE__ */ jsx("div", { className: "space-y-4", children: l.map((u, d) => /* @__PURE__ */ jsxs("div", { className: "border rounded-lg p-4", children: [
|
|
54814
|
+
/* @__PURE__ */ jsxs("div", { className: "flex justify-between items-center", children: [
|
|
54815
|
+
/* @__PURE__ */ jsx("h3", { className: "text-sm sm:text-base font-medium", children: u.title }),
|
|
54816
|
+
/* @__PURE__ */ jsx("div", { className: `p-2 rounded-full ${u.color}`, children: u.icon })
|
|
54817
|
+
] }),
|
|
54818
|
+
/* @__PURE__ */ jsx("div", { children: /* @__PURE__ */ jsx("p", { className: "text-base sm:text-lg font-bold", children: n(u.amount) }) })
|
|
54819
|
+
] }, d)) })
|
|
54820
|
+
] }),
|
|
54821
|
+
e && /* @__PURE__ */ jsx("div", { className: "flex justify-end mt-4", children: e })
|
|
54797
54822
|
] })
|
|
54798
54823
|
] });
|
|
54799
54824
|
}
|
|
@@ -54870,105 +54895,92 @@ function ManufacturerLogo({ manufacturerId: t, opportunityNumber: e }) {
|
|
|
54870
54895
|
f && /* @__PURE__ */ jsx("div", { className: "text-red-500 text-xs mt-1", role: "alert", children: f })
|
|
54871
54896
|
] });
|
|
54872
54897
|
}
|
|
54873
|
-
function
|
|
54874
|
-
return
|
|
54875
|
-
t == null ? void 0 : t.OrderNumber,
|
|
54876
|
-
" for P.O. ",
|
|
54877
|
-
t == null ? void 0 : t.PONumber
|
|
54878
|
-
] });
|
|
54879
|
-
}
|
|
54880
|
-
function ResellerBillingOverviewCard({ reseller: t, actions: e, loading: n = !1 }) {
|
|
54881
|
-
return n || !t ? /* @__PURE__ */ jsx(ResellerBillingOverviewSkeleton, {}) : /* @__PURE__ */ jsx(ResellerBillingOverviewData, { reseller: t, actions: e });
|
|
54898
|
+
function SalesOverviewCard({ salesData: t, salesStatistics: e = [], loading: n = !1 }) {
|
|
54899
|
+
return n || !t ? /* @__PURE__ */ jsx(SalesOverviewSkeleton, {}) : /* @__PURE__ */ jsx(SalesOverviewData, { salesData: t, salesStatistics: e });
|
|
54882
54900
|
}
|
|
54883
|
-
function
|
|
54901
|
+
function SalesOverviewSkeleton() {
|
|
54884
54902
|
return /* @__PURE__ */ jsxs(Card, { children: [
|
|
54885
|
-
/* @__PURE__ */ jsx(CardHeader, { children: /* @__PURE__ */ jsx(CardTitle, { children: /* @__PURE__ */ jsx(Skeleton, { className: "h-
|
|
54886
|
-
/* @__PURE__ */ jsxs(CardContent, { children: [
|
|
54887
|
-
/* @__PURE__ */
|
|
54888
|
-
/* @__PURE__ */
|
|
54889
|
-
/* @__PURE__ */
|
|
54890
|
-
|
|
54891
|
-
|
|
54892
|
-
|
|
54893
|
-
/* @__PURE__ */
|
|
54894
|
-
|
|
54895
|
-
|
|
54896
|
-
|
|
54897
|
-
|
|
54898
|
-
/* @__PURE__ */ jsx(
|
|
54899
|
-
|
|
54900
|
-
|
|
54901
|
-
/* @__PURE__ */ jsx(Skeleton, { className: "h-9 w-9 rounded-full" })
|
|
54902
|
-
] }),
|
|
54903
|
-
/* @__PURE__ */ jsxs("div", { children: [
|
|
54904
|
-
/* @__PURE__ */ jsx(Skeleton, { className: "h-4 w-20 mb-1" }),
|
|
54905
|
-
/* @__PURE__ */ jsx(Skeleton, { className: "h-7 w-28" })
|
|
54906
|
-
] })
|
|
54907
|
-
] }, e)) })
|
|
54908
|
-
] }),
|
|
54909
|
-
/* @__PURE__ */ jsx("div", { className: "flex justify-end mt-4", children: /* @__PURE__ */ jsx(Skeleton, { className: "h-10 w-28 rounded-md" }) })
|
|
54903
|
+
/* @__PURE__ */ jsx(CardHeader, { className: "pb-0", children: /* @__PURE__ */ jsx(CardTitle, { className: "text-lg sm:text-xl", children: /* @__PURE__ */ jsx(Skeleton, { className: "h-7 w-40" }) }) }),
|
|
54904
|
+
/* @__PURE__ */ jsxs(CardContent, { className: "pt-4 px-3 sm:px-6", children: [
|
|
54905
|
+
/* @__PURE__ */ jsx("div", { className: "grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-4", children: Array(3).fill(0).map((t, e) => /* @__PURE__ */ jsxs("div", { className: "border rounded-lg p-4", children: [
|
|
54906
|
+
/* @__PURE__ */ jsxs("div", { className: "flex justify-between items-center mb-4", children: [
|
|
54907
|
+
/* @__PURE__ */ jsx(Skeleton, { className: "h-5 w-24" }),
|
|
54908
|
+
/* @__PURE__ */ jsx(Skeleton, { className: "h-9 w-9 rounded-full" })
|
|
54909
|
+
] }),
|
|
54910
|
+
/* @__PURE__ */ jsxs("div", { children: [
|
|
54911
|
+
/* @__PURE__ */ jsx(Skeleton, { className: "h-4 w-20 mb-1" }),
|
|
54912
|
+
/* @__PURE__ */ jsx(Skeleton, { className: "h-7 w-28" })
|
|
54913
|
+
] })
|
|
54914
|
+
] }, e)) }),
|
|
54915
|
+
/* @__PURE__ */ jsx("div", { className: "mt-6", children: /* @__PURE__ */ jsxs("div", { className: "space-y-3", children: [
|
|
54916
|
+
/* @__PURE__ */ jsx(Skeleton, { className: "h-5 w-32" }),
|
|
54917
|
+
/* @__PURE__ */ jsx(Skeleton, { className: "h-[250px] w-full rounded-lg" })
|
|
54918
|
+
] }) })
|
|
54910
54919
|
] })
|
|
54911
54920
|
] });
|
|
54912
54921
|
}
|
|
54913
|
-
function
|
|
54914
|
-
|
|
54922
|
+
function SalesOverviewData({
|
|
54923
|
+
salesData: t,
|
|
54924
|
+
salesStatistics: e = []
|
|
54925
|
+
}) {
|
|
54926
|
+
const n = (l) => new Intl.NumberFormat("en-CA", {
|
|
54915
54927
|
style: "currency",
|
|
54916
54928
|
currency: "CAD",
|
|
54917
54929
|
minimumFractionDigits: 2,
|
|
54918
54930
|
maximumFractionDigits: 2
|
|
54919
|
-
}).format(
|
|
54931
|
+
}).format(l), i = [
|
|
54920
54932
|
{
|
|
54921
|
-
title: "
|
|
54922
|
-
amount:
|
|
54933
|
+
title: "Last 30 days",
|
|
54934
|
+
amount: t.SalesLast30Days || 0,
|
|
54923
54935
|
icon: /* @__PURE__ */ jsx(Calendar, { className: "h-5 w-5 text-white" }),
|
|
54924
|
-
color: "bg-
|
|
54936
|
+
color: "bg-blue-500"
|
|
54925
54937
|
},
|
|
54926
54938
|
{
|
|
54927
|
-
title: "
|
|
54928
|
-
amount:
|
|
54939
|
+
title: "Last 3 months",
|
|
54940
|
+
amount: t.SalesLast3Months || 0,
|
|
54929
54941
|
icon: /* @__PURE__ */ jsx(Calendar, { className: "h-5 w-5 text-white" }),
|
|
54930
|
-
color: "bg-
|
|
54942
|
+
color: "bg-amber-500"
|
|
54931
54943
|
},
|
|
54932
54944
|
{
|
|
54933
|
-
title: "
|
|
54934
|
-
amount:
|
|
54945
|
+
title: "Year to date",
|
|
54946
|
+
amount: t.SalesYearToDay || 0,
|
|
54935
54947
|
icon: /* @__PURE__ */ jsx(Calendar, { className: "h-5 w-5 text-white" }),
|
|
54936
|
-
color: "bg-
|
|
54937
|
-
}
|
|
54938
|
-
], l = [
|
|
54939
|
-
{
|
|
54940
|
-
title: "Total",
|
|
54941
|
-
amount: i.Total || 0,
|
|
54942
|
-
icon: /* @__PURE__ */ jsx(DollarSign, { className: "h-5 w-5 text-white" }),
|
|
54943
|
-
color: "bg-green-500"
|
|
54944
|
-
},
|
|
54945
|
-
{
|
|
54946
|
-
title: "Credit Limit",
|
|
54947
|
-
amount: t.CreditLimit || 0,
|
|
54948
|
-
icon: /* @__PURE__ */ jsx(CreditCard, { className: "h-5 w-5 text-white" }),
|
|
54949
|
-
color: "bg-blue-500"
|
|
54948
|
+
color: "bg-emerald-500"
|
|
54950
54949
|
}
|
|
54951
|
-
]
|
|
54950
|
+
], o = [...e].sort((l, u) => (l.Day || 0) - (u.Day || 0)).map((l) => {
|
|
54951
|
+
var m;
|
|
54952
|
+
const u = ((m = l.Day) == null ? void 0 : m.toString()) || "", d = u.substring(4, 6), f = u.substring(6, 8);
|
|
54953
|
+
return {
|
|
54954
|
+
date: `${d}/${f}`,
|
|
54955
|
+
amount: l.ExtendedPrice || 0
|
|
54956
|
+
//quantity: stat.Quantity || 0,
|
|
54957
|
+
};
|
|
54958
|
+
});
|
|
54952
54959
|
return /* @__PURE__ */ jsxs(Card, { children: [
|
|
54953
|
-
/* @__PURE__ */ jsx(CardHeader, { children: /* @__PURE__ */ jsx(CardTitle, { children: "
|
|
54954
|
-
/* @__PURE__ */ jsxs(CardContent, { children: [
|
|
54955
|
-
/* @__PURE__ */
|
|
54956
|
-
/* @__PURE__ */
|
|
54957
|
-
/* @__PURE__ */
|
|
54958
|
-
|
|
54959
|
-
|
|
54960
|
-
|
|
54961
|
-
/* @__PURE__ */ jsx("
|
|
54962
|
-
|
|
54963
|
-
|
|
54964
|
-
|
|
54965
|
-
|
|
54966
|
-
|
|
54967
|
-
|
|
54968
|
-
|
|
54969
|
-
|
|
54970
|
-
|
|
54971
|
-
|
|
54960
|
+
/* @__PURE__ */ jsx(CardHeader, { className: "pb-0", children: /* @__PURE__ */ jsx(CardTitle, { className: "text-lg sm:text-xl", children: "Sales Overview" }) }),
|
|
54961
|
+
/* @__PURE__ */ jsxs(CardContent, { className: "pt-4 px-3 sm:px-6", children: [
|
|
54962
|
+
/* @__PURE__ */ jsx("div", { className: "grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-4", children: i.map((l, u) => /* @__PURE__ */ jsxs("div", { className: "border rounded-lg p-4", children: [
|
|
54963
|
+
/* @__PURE__ */ jsxs("div", { className: "flex justify-between items-center mb-4", children: [
|
|
54964
|
+
/* @__PURE__ */ jsx("h3", { className: "text-sm sm:text-base font-medium", children: l.title }),
|
|
54965
|
+
/* @__PURE__ */ jsx("div", { className: `p-2 rounded-full ${l.color}`, children: l.icon })
|
|
54966
|
+
] }),
|
|
54967
|
+
/* @__PURE__ */ jsxs("div", { children: [
|
|
54968
|
+
/* @__PURE__ */ jsx("p", { className: "text-xs text-muted-foreground", children: "Total Amount" }),
|
|
54969
|
+
/* @__PURE__ */ jsx("p", { className: "text-base sm:text-lg font-bold", children: n(l.amount) })
|
|
54970
|
+
] })
|
|
54971
|
+
] }, u)) }),
|
|
54972
|
+
/* @__PURE__ */ jsx("div", { className: "mt-6", children: e && e.length > 0 && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
54973
|
+
/* @__PURE__ */ jsx("h3", { className: "text-sm font-medium mb-4", children: "Sales Trend" }),
|
|
54974
|
+
/* @__PURE__ */ jsx("div", { className: "space-y-6", children: /* @__PURE__ */ jsx(
|
|
54975
|
+
AreaChart,
|
|
54976
|
+
{
|
|
54977
|
+
data: o,
|
|
54978
|
+
units: "$",
|
|
54979
|
+
unitsPosition: "left",
|
|
54980
|
+
height: 200
|
|
54981
|
+
}
|
|
54982
|
+
) })
|
|
54983
|
+
] }) })
|
|
54972
54984
|
] })
|
|
54973
54985
|
] });
|
|
54974
54986
|
}
|
|
@@ -55037,6 +55049,8 @@ export {
|
|
|
55037
55049
|
ScrollArea,
|
|
55038
55050
|
ScrollBar,
|
|
55039
55051
|
Select,
|
|
55052
|
+
SelectScrollDownButton,
|
|
55053
|
+
SelectScrollUpButton,
|
|
55040
55054
|
Separator$1 as Separator,
|
|
55041
55055
|
Sheet,
|
|
55042
55056
|
SheetClose,
|
|
@@ -55077,6 +55091,7 @@ export {
|
|
|
55077
55091
|
TabsContent,
|
|
55078
55092
|
TabsList,
|
|
55079
55093
|
TabsTrigger,
|
|
55094
|
+
Textarea,
|
|
55080
55095
|
Toast,
|
|
55081
55096
|
ToastAction,
|
|
55082
55097
|
ToastClose,
|