@nivaro/react 0.3.48 → 0.3.50
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/components/InlineGridField.js +166 -105
- package/dist/full.css +1 -1
- package/dist/hooks/useSessionRecorder.js +1 -1
- package/dist/index.d.ts +25 -1
- package/dist/shared/components/CellCopyLayer.js +81 -44
- package/dist/shared/components/CollectionBrowserView.js +306 -297
- package/dist/shared/components/DataTable.js +3 -3
- package/dist/shared/components/FulfilmentPill.js +98 -78
- package/dist/shared/components/ItemEditForm.js +4682 -4570
- package/dist/shared/components/NotificationSourcesCard.js +151 -147
- package/dist/shared/components/ProfileView.js +72 -70
- package/dist/shared/components/QueryTable.js +462 -333
- package/dist/shared/components/imports/ImportConsole.js +4 -4
- package/dist/shared/components/integrations/console/IntegrationsConsole.js +58 -50
- package/dist/shared/components/item-edit/CatalogPickerField.js +1144 -1127
- package/dist/shared/components/item-edit/CloneDialog.js +192 -142
- package/dist/shared/components/item-edit/FieldRenderer.js +127 -126
- package/dist/shared/components/item-edit/FieldRow.js +236 -226
- package/dist/shared/components/item-edit/HeaderTools.js +118 -113
- package/dist/shared/components/item-edit/InlineGridField.js +92 -90
- package/dist/shared/components/item-edit/InlineTableField.js +3091 -2942
- package/dist/shared/components/item-edit/MidairCollisionDialog.js +175 -0
- package/dist/shared/components/item-edit/PlanGrid.js +162 -162
- package/dist/shared/components/item-edit/PolishFields.js +169 -162
- package/dist/shared/components/item-edit/RelationCombobox.js +186 -181
- package/dist/shared/components/item-edit/SummaryPanel.js +148 -135
- package/dist/shared/components/item-edit/ValidationSummary.js +64 -47
- package/dist/shared/components/item-edit/helpers.js +181 -155
- package/dist/shared/components/item-edit/line-midair.js +201 -0
- package/dist/shared/components/item-edit/soft-rules.js +27 -0
- package/dist/shared/components/layout-editor/parity-keys.json.js +1 -1
- package/dist/shared/components/layout-editor/settings/ResolveSettings.js +65 -65
- package/dist/shared/components/layout-editor/settings/settings-registry.js +4 -4
- package/dist/shared/components/notifications/DeliveryChips.js +9 -9
- package/dist/shared/components/panels/ItemLockBanner.js +414 -358
- package/dist/shared/components/panels/PipelinePanel.js +1171 -975
- package/dist/shared/components/panels/RecordIntegrityBanner.js +1 -1
- package/dist/shared/components/panels/SlaBreachBanner.js +2 -2
- package/dist/shared/components/panels/TransitionRequirementsDialog.js +384 -380
- package/dist/shared/components/profile/PersonProfile.js +23 -21
- package/dist/shared/components/profile/SignedInDevices.js +126 -0
- package/dist/shared/components/queue/QueueItemSheet.js +38 -37
- package/dist/shared/components/queue/QueueWorklist.js +870 -827
- package/dist/shared/components/queue/column-chooser.js +21 -0
- package/dist/shared/components/queue/live-state-aspect.js +6 -0
- package/dist/shared/components/support/SupportView.js +1 -1
- package/dist/shared/components/ui/number-draft-input.js +93 -0
- package/dist/shared/components/widgets/ReviewListWidget.js +191 -166
- package/dist/shared/lib/edit-lock-fields.js +7 -0
- package/dist/shared/lib/error-hints.js +1 -0
- package/dist/shared/lib/reimport-visibility.js +10 -0
- package/package.json +1 -1
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { jsx as r, jsxs as a } from "react/jsx-runtime";
|
|
2
2
|
import { useState as b } from "react";
|
|
3
|
-
import { useItemEditAuth as
|
|
4
|
-
import { cn as
|
|
5
|
-
import { PermissionSummaryCard as
|
|
6
|
-
import { Tabs as
|
|
3
|
+
import { useItemEditAuth as w } from "../../context.js";
|
|
4
|
+
import { cn as n } from "../../lib/utils.js";
|
|
5
|
+
import { PermissionSummaryCard as I } from "../access/PermissionSummary.js";
|
|
6
|
+
import { Tabs as A, TabsList as S, TabsTrigger as P, TabsContent as i } from "../ui/tabs.js";
|
|
7
7
|
import { DayTimelineCard as T } from "./DayTimeline.js";
|
|
8
8
|
import { DelegationCard as D } from "./DelegationCard.js";
|
|
9
9
|
import { MyDefaultsCard as U } from "./MyDefaultsCard.js";
|
|
@@ -18,22 +18,23 @@ import { WorkingOnCard as Y, TeamLoadCard as Z, WhyCard as $ } from "./PersonExt
|
|
|
18
18
|
import { PersonHeader as ee } from "./PersonHeader.js";
|
|
19
19
|
import { AboutCard as re, PeopleCard as ae, AvailabilityCard as de, ResponsibilitiesCard as se } from "./PersonOverview.js";
|
|
20
20
|
import { PersonWeekCard as te } from "./PersonWeek.js";
|
|
21
|
-
import {
|
|
22
|
-
|
|
21
|
+
import { SignedInDevices as ie } from "./SignedInDevices.js";
|
|
22
|
+
import { usePersonProfile as oe, useInvalidatePerson as ne } from "./types.js";
|
|
23
|
+
function Ue({
|
|
23
24
|
userId: o,
|
|
24
|
-
className:
|
|
25
|
+
className: l,
|
|
25
26
|
initialTab: h = "overview"
|
|
26
27
|
}) {
|
|
27
28
|
var v, g, f;
|
|
28
|
-
const t =
|
|
29
|
-
if (y || !e && !x) return /* @__PURE__ */ r(le, { className:
|
|
29
|
+
const t = w(), s = !!(t != null && t.isAdmin), { data: e, isLoading: y, isError: x } = oe(o), N = ne(o), [u, C] = b(h), [c, k] = b("feed");
|
|
30
|
+
if (y || !e && !x) return /* @__PURE__ */ r(le, { className: l });
|
|
30
31
|
if (!e)
|
|
31
32
|
return /* @__PURE__ */ a(
|
|
32
33
|
"div",
|
|
33
34
|
{
|
|
34
|
-
className:
|
|
35
|
+
className: n(
|
|
35
36
|
"rounded-lg border border-slate-200 bg-white p-8 text-center dark:border-border dark:bg-card",
|
|
36
|
-
|
|
37
|
+
l
|
|
37
38
|
),
|
|
38
39
|
"data-person-missing": !0,
|
|
39
40
|
children: [
|
|
@@ -42,7 +43,7 @@ function Te({
|
|
|
42
43
|
]
|
|
43
44
|
}
|
|
44
45
|
);
|
|
45
|
-
const
|
|
46
|
+
const _ = !!(t != null && t.userId) && !!((v = e.manager) != null && v.id) && String(e.manager.id).toUpperCase() === String(t.userId).toUpperCase(), p = /* @__PURE__ */ a("div", { className: "grid gap-4 lg:grid-cols-2", children: [
|
|
46
47
|
/* @__PURE__ */ a("div", { className: "space-y-4", children: [
|
|
47
48
|
/* @__PURE__ */ r(re, { profile: e, isAdmin: s }),
|
|
48
49
|
/* @__PURE__ */ r(Y, { profile: e }),
|
|
@@ -79,15 +80,15 @@ function Te({
|
|
|
79
80
|
}
|
|
80
81
|
) : /* @__PURE__ */ r(de, { profile: e }),
|
|
81
82
|
/* @__PURE__ */ r(se, { profile: e, isAdmin: s }),
|
|
82
|
-
(s ||
|
|
83
|
+
(s || _) && /* @__PURE__ */ r(te, { profile: e })
|
|
83
84
|
] })
|
|
84
85
|
] });
|
|
85
|
-
return /* @__PURE__ */ a("div", { className:
|
|
86
|
+
return /* @__PURE__ */ a("div", { className: n("flex flex-col gap-4", l), "data-nvr-person": e.id, children: [
|
|
86
87
|
/* @__PURE__ */ r(ee, { profile: e, isAdmin: s }),
|
|
87
88
|
s && /* @__PURE__ */ r(F, { profile: e }),
|
|
88
|
-
s ? /* @__PURE__ */ a(
|
|
89
|
+
s ? /* @__PURE__ */ a(A, { value: u, onValueChange: (d) => C(d), children: [
|
|
89
90
|
/* @__PURE__ */ r(
|
|
90
|
-
|
|
91
|
+
S,
|
|
91
92
|
{
|
|
92
93
|
className: "h-9 w-full justify-start gap-1 rounded-lg border border-slate-200 bg-white p-1 dark:border-border dark:bg-card",
|
|
93
94
|
"data-person-tabs": !0,
|
|
@@ -98,7 +99,7 @@ function Te({
|
|
|
98
99
|
["did", "What they did"],
|
|
99
100
|
["tools", "Admin tools"]
|
|
100
101
|
].map(([d, m]) => /* @__PURE__ */ r(
|
|
101
|
-
|
|
102
|
+
P,
|
|
102
103
|
{
|
|
103
104
|
value: d,
|
|
104
105
|
"data-person-tab": d,
|
|
@@ -114,7 +115,7 @@ function Te({
|
|
|
114
115
|
/* @__PURE__ */ a("div", { className: "space-y-4", children: [
|
|
115
116
|
/* @__PURE__ */ r(M, { profile: e }),
|
|
116
117
|
/* @__PURE__ */ r(L, { userId: e.id }),
|
|
117
|
-
/* @__PURE__ */ r(
|
|
118
|
+
/* @__PURE__ */ r(I, { userId: e.id }),
|
|
118
119
|
/* @__PURE__ */ r(O, { userId: e.id }),
|
|
119
120
|
/* @__PURE__ */ r($, { profile: e }),
|
|
120
121
|
/* @__PURE__ */ r(Q, { profile: e })
|
|
@@ -122,6 +123,7 @@ function Te({
|
|
|
122
123
|
/* @__PURE__ */ a("div", { className: "space-y-4", children: [
|
|
123
124
|
/* @__PURE__ */ r(W, { profile: e }),
|
|
124
125
|
/* @__PURE__ */ r(j, { userId: e.id }),
|
|
126
|
+
/* @__PURE__ */ r(ie, { userId: e.id, name: e.first_name ?? e.name }),
|
|
125
127
|
/* @__PURE__ */ r(E, { profile: e })
|
|
126
128
|
] })
|
|
127
129
|
] }) }),
|
|
@@ -143,7 +145,7 @@ function Te({
|
|
|
143
145
|
"aria-pressed": c === d,
|
|
144
146
|
"data-person-activity-view": d,
|
|
145
147
|
onClick: () => k(d),
|
|
146
|
-
className:
|
|
148
|
+
className: n(
|
|
147
149
|
"h-6 rounded-md px-3 text-[11.5px] font-medium",
|
|
148
150
|
c === d ? "bg-nvr-cyan/10 text-nvr-navy dark:text-nvr-cyan" : "text-slate-500 hover:text-slate-800 dark:text-slate-400 dark:hover:text-slate-200"
|
|
149
151
|
),
|
|
@@ -182,7 +184,7 @@ function Te({
|
|
|
182
184
|
] });
|
|
183
185
|
}
|
|
184
186
|
function le({ className: o }) {
|
|
185
|
-
return /* @__PURE__ */ a("div", { className:
|
|
187
|
+
return /* @__PURE__ */ a("div", { className: n("flex animate-pulse flex-col gap-4", o), "aria-busy": "true", children: [
|
|
186
188
|
/* @__PURE__ */ a("div", { className: "flex items-center gap-5 rounded-lg border border-slate-200 bg-white p-5 dark:border-border dark:bg-card", children: [
|
|
187
189
|
/* @__PURE__ */ r("div", { className: "h-[76px] w-[76px] rounded-full bg-slate-100 dark:bg-muted" }),
|
|
188
190
|
/* @__PURE__ */ a("div", { className: "flex-1 space-y-2.5", children: [
|
|
@@ -198,5 +200,5 @@ function le({ className: o }) {
|
|
|
198
200
|
] });
|
|
199
201
|
}
|
|
200
202
|
export {
|
|
201
|
-
|
|
203
|
+
Ue as PersonProfile
|
|
202
204
|
};
|
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
import { jsx as t, jsxs as s } from "react/jsx-runtime";
|
|
2
|
+
import { useQueryClient as b, useQuery as y, useMutation as k } from "@tanstack/react-query";
|
|
3
|
+
import { Smartphone as x, LogOut as S } from "lucide-react";
|
|
4
|
+
import { toast as w } from "sonner";
|
|
5
|
+
import { useNivaroClient as _ } from "../../context.js";
|
|
6
|
+
import { get as $, del as C } from "../../lib/commands.js";
|
|
7
|
+
import { toastError as L } from "../../lib/error-toast.js";
|
|
8
|
+
import { formatRelative as R, formatDate as q } from "../../lib/utils.js";
|
|
9
|
+
import { ErrorNotice as E } from "../ErrorNotice.js";
|
|
10
|
+
import { useOverflowTip as f } from "../TipLayer.js";
|
|
11
|
+
import { Skeleton as g } from "../ui/skeleton.js";
|
|
12
|
+
import { SectionCard as O, EmptyLine as P, ConfirmButton as T } from "./primitives.js";
|
|
13
|
+
const j = { ios: "iPhone", android: "Android phone" }, u = (e) => e.platform ? j[e.platform] : "Phone";
|
|
14
|
+
function W({ userId: e, name: r }) {
|
|
15
|
+
const c = _(), o = b(), d = e ? `/users/${e}/devices` : "/auth/devices", l = ["nvr-signed-in-devices", e ?? "me"], n = y({
|
|
16
|
+
queryKey: l,
|
|
17
|
+
queryFn: () => c.request($(d)).then((i) => i.data ?? []),
|
|
18
|
+
staleTime: 3e4
|
|
19
|
+
}), m = k({
|
|
20
|
+
mutationFn: (i) => c.request(C(`${d}/${i.id}`)),
|
|
21
|
+
onSuccess: (i, a) => {
|
|
22
|
+
o.setQueryData(l, (p) => p == null ? void 0 : p.filter((N) => N.id !== a.id)), w.success(`${a.device_name ?? u(a)} is signed out`);
|
|
23
|
+
},
|
|
24
|
+
onError: (i) => L(i, "Could not sign that phone out")
|
|
25
|
+
}), h = n.data ?? [], v = (r == null ? void 0 : r.trim()) || "This person";
|
|
26
|
+
return /* @__PURE__ */ t(
|
|
27
|
+
O,
|
|
28
|
+
{
|
|
29
|
+
icon: /* @__PURE__ */ t(x, { className: "h-4 w-4" }),
|
|
30
|
+
title: "Signed-in phones",
|
|
31
|
+
hint: e ? "Signing a phone out ends its sign-in and stops its alerts" : "Phones signed in to the Nivaro app. Signing one out also stops its alerts",
|
|
32
|
+
testId: "signed-in-phones",
|
|
33
|
+
children: n.isLoading ? /* @__PURE__ */ s("div", { className: "space-y-3", "aria-hidden": !0, children: [
|
|
34
|
+
/* @__PURE__ */ t(g, { className: "h-9 w-full" }),
|
|
35
|
+
/* @__PURE__ */ t(g, { className: "h-9 w-2/3" })
|
|
36
|
+
] }) : n.isError ? /* @__PURE__ */ t(E, { error: n.error, what: "signed-in phones", onRetry: () => n.refetch() }) : h.length === 0 ? /* @__PURE__ */ s("div", { "data-devices-empty": !0, children: [
|
|
37
|
+
/* @__PURE__ */ t(P, { children: "No phones signed in." }),
|
|
38
|
+
/* @__PURE__ */ t("p", { className: "mt-1 text-[11.5px] text-slate-500 dark:text-slate-400", children: e ? `${v} has not signed in from the Nivaro app.` : "Sign in from the Nivaro app on your phone and it shows up here." })
|
|
39
|
+
] }) : /* @__PURE__ */ t("ul", { className: "-my-2 divide-y divide-slate-100 dark:divide-border/60", children: h.map((i) => {
|
|
40
|
+
var a;
|
|
41
|
+
return /* @__PURE__ */ t(
|
|
42
|
+
D,
|
|
43
|
+
{
|
|
44
|
+
device: i,
|
|
45
|
+
pending: m.isPending && ((a = m.variables) == null ? void 0 : a.id) === i.id,
|
|
46
|
+
onSignOut: () => m.mutate(i)
|
|
47
|
+
},
|
|
48
|
+
i.id
|
|
49
|
+
);
|
|
50
|
+
}) })
|
|
51
|
+
}
|
|
52
|
+
);
|
|
53
|
+
}
|
|
54
|
+
function D({
|
|
55
|
+
device: e,
|
|
56
|
+
pending: r,
|
|
57
|
+
onSignOut: c
|
|
58
|
+
}) {
|
|
59
|
+
const o = e.device_name ?? u(e), d = [
|
|
60
|
+
e.device_name ? u(e) : null,
|
|
61
|
+
`${e.client_name} app`,
|
|
62
|
+
e.last_used_at ? `Last used ${R(e.last_used_at)}` : "Not used since sign-in",
|
|
63
|
+
`Signed in ${q(e.created_at)}`
|
|
64
|
+
].filter(Boolean).join(" · "), l = f(o), n = f(d);
|
|
65
|
+
return /* @__PURE__ */ s("li", { "data-device-row": e.id, className: "flex items-center gap-3 py-2.5", children: [
|
|
66
|
+
/* @__PURE__ */ t("span", { className: "flex h-8 w-8 shrink-0 items-center justify-center rounded-md bg-slate-100 text-slate-500 dark:bg-muted dark:text-slate-300", children: /* @__PURE__ */ t(x, { className: "h-4 w-4", "aria-hidden": !0 }) }),
|
|
67
|
+
/* @__PURE__ */ s("div", { className: "min-w-0 flex-1", children: [
|
|
68
|
+
/* @__PURE__ */ s("p", { className: "flex min-w-0 items-center gap-2", children: [
|
|
69
|
+
/* @__PURE__ */ t(
|
|
70
|
+
"span",
|
|
71
|
+
{
|
|
72
|
+
ref: l,
|
|
73
|
+
"data-device-name": !0,
|
|
74
|
+
className: "truncate text-[12.5px] font-medium text-slate-800 dark:text-slate-100",
|
|
75
|
+
children: o
|
|
76
|
+
}
|
|
77
|
+
),
|
|
78
|
+
e.current && /* @__PURE__ */ t(
|
|
79
|
+
"span",
|
|
80
|
+
{
|
|
81
|
+
"data-device-current": !0,
|
|
82
|
+
className: "shrink-0 rounded-full bg-nvr-cyan/10 px-1.5 py-px text-[10.5px] font-medium text-sky-700 dark:text-nvr-cyan",
|
|
83
|
+
children: "This phone"
|
|
84
|
+
}
|
|
85
|
+
)
|
|
86
|
+
] }),
|
|
87
|
+
/* @__PURE__ */ t(
|
|
88
|
+
"p",
|
|
89
|
+
{
|
|
90
|
+
ref: n,
|
|
91
|
+
className: "mt-0.5 truncate text-[11.5px] text-slate-500 dark:text-slate-400",
|
|
92
|
+
children: d
|
|
93
|
+
}
|
|
94
|
+
)
|
|
95
|
+
] }),
|
|
96
|
+
e.current ? (
|
|
97
|
+
// Signing out the phone you are on belongs in the app: it also forgets its push
|
|
98
|
+
// registration there, which a web button cannot do.
|
|
99
|
+
/* @__PURE__ */ t(
|
|
100
|
+
"span",
|
|
101
|
+
{
|
|
102
|
+
"data-device-sign-out-in-app": !0,
|
|
103
|
+
className: "shrink-0 text-[11.5px] text-slate-500 dark:text-slate-400",
|
|
104
|
+
children: "Sign out from the app"
|
|
105
|
+
}
|
|
106
|
+
)
|
|
107
|
+
) : /* @__PURE__ */ t("span", { "data-device-sign-out": !0, className: "contents", children: /* @__PURE__ */ s(
|
|
108
|
+
T,
|
|
109
|
+
{
|
|
110
|
+
title: `Sign out ${o}`,
|
|
111
|
+
onConfirm: c,
|
|
112
|
+
confirmLabel: "Sign it out?",
|
|
113
|
+
disabled: r,
|
|
114
|
+
className: "inline-flex h-7 shrink-0 items-center gap-1.5 rounded-md border border-slate-200 px-2.5 text-[11.5px] font-medium text-slate-600 transition-colors hover:border-red-300 hover:text-red-600 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-nvr-cyan/50 disabled:opacity-40 dark:border-border dark:text-slate-300 dark:hover:border-red-500/40 dark:hover:text-red-400",
|
|
115
|
+
armedClassName: "border-red-300 font-semibold text-red-600 dark:border-red-500/40 dark:text-red-400",
|
|
116
|
+
children: [
|
|
117
|
+
/* @__PURE__ */ t(S, { className: "h-3 w-3", "aria-hidden": !0 }),
|
|
118
|
+
r ? "Signing out…" : "Sign out"
|
|
119
|
+
]
|
|
120
|
+
}
|
|
121
|
+
) })
|
|
122
|
+
] });
|
|
123
|
+
}
|
|
124
|
+
export {
|
|
125
|
+
W as SignedInDevices
|
|
126
|
+
};
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { jsxs as a, jsx as r, Fragment as U } from "react/jsx-runtime";
|
|
2
|
-
import { useQueryClient as W, useQuery as
|
|
3
|
-
import { ExternalLink as z, ArrowRight as
|
|
4
|
-
import { useState as
|
|
2
|
+
import { useQueryClient as W, useQuery as T, useMutation as A } from "@tanstack/react-query";
|
|
3
|
+
import { ExternalLink as z, ArrowRight as M } from "lucide-react";
|
|
4
|
+
import { useState as j } from "react";
|
|
5
5
|
import { toast as k } from "sonner";
|
|
6
6
|
import { useNivaroClient as G, useItemNavigation as J } from "../../context.js";
|
|
7
|
-
import { get as
|
|
7
|
+
import { get as E, post as Q } from "../../lib/commands.js";
|
|
8
8
|
import { formatMultiValue as X } from "../../lib/format-value.js";
|
|
9
9
|
import { useLiveRecord as Y, batchTouches as K, LIVE_ASPECTS as P } from "../../lib/live.js";
|
|
10
10
|
import { userErrorMessage as Z } from "../../lib/safe-error.js";
|
|
@@ -18,17 +18,17 @@ function ce(e) {
|
|
|
18
18
|
return te(e);
|
|
19
19
|
}
|
|
20
20
|
function me(e) {
|
|
21
|
-
return e.split(".").map((
|
|
21
|
+
return e.split(".").map((m) => m.replace(/_/g, " ").replace(/\b\w/g, (h) => h.toUpperCase())).join(" → ");
|
|
22
22
|
}
|
|
23
|
-
function
|
|
23
|
+
function c({ label: e, children: m }) {
|
|
24
24
|
return /* @__PURE__ */ a("div", { className: "bg-white px-3 py-2.5 dark:bg-card", children: [
|
|
25
25
|
/* @__PURE__ */ r("p", { className: "mb-0.5 text-[10px] font-medium uppercase tracking-wide text-slate-400 dark:text-muted-foreground", children: e }),
|
|
26
|
-
/* @__PURE__ */ r("div", { className: "text-[12px] text-slate-700 dark:text-slate-200", children:
|
|
26
|
+
/* @__PURE__ */ r("div", { className: "text-[12px] text-slate-700 dark:text-slate-200", children: m })
|
|
27
27
|
] });
|
|
28
28
|
}
|
|
29
|
-
function
|
|
29
|
+
function Ie({
|
|
30
30
|
item: e,
|
|
31
|
-
onOpenChange:
|
|
31
|
+
onOpenChange: m,
|
|
32
32
|
onClaim: h,
|
|
33
33
|
onRelease: $,
|
|
34
34
|
workNextActive: O,
|
|
@@ -41,16 +41,16 @@ function Re({
|
|
|
41
41
|
width: D,
|
|
42
42
|
itemLayout: F
|
|
43
43
|
}) {
|
|
44
|
-
var
|
|
45
|
-
const p = W(), x = G(), { open: H } = J(), [f, _] =
|
|
44
|
+
var I;
|
|
45
|
+
const p = W(), x = G(), { open: H } = J(), [f, _] = j(""), [d, y] = j(null), o = e == null ? void 0 : e.collection, s = e == null ? void 0 : e.item_id, { data: i } = T({
|
|
46
46
|
queryKey: ["queue-sheet-instance", o, s],
|
|
47
|
-
queryFn: () => x.request(
|
|
47
|
+
queryFn: () => x.request(E(`/pipelines/instance/${o}/${s}`)).then((t) => t.data),
|
|
48
48
|
enabled: !!o && !!s
|
|
49
|
-
}), { data:
|
|
49
|
+
}), { data: l } = T({
|
|
50
50
|
queryKey: ["queue-sheet-comments", o, s],
|
|
51
|
-
queryFn: () => x.request(
|
|
51
|
+
queryFn: () => x.request(E("/comments", { collection: o, item: s })).then((t) => ({ data: (t.data ?? []).filter((n) => !n.deleted) })).catch(() => ({ data: [] })),
|
|
52
52
|
enabled: !!o && !!s
|
|
53
|
-
}), b =
|
|
53
|
+
}), b = A({
|
|
54
54
|
mutationFn: (t) => x.request(
|
|
55
55
|
Q(`/pipelines/instance/${o}/${s}/transition`, {
|
|
56
56
|
transition_id: t
|
|
@@ -60,10 +60,10 @@ function Re({
|
|
|
60
60
|
y(null), p.invalidateQueries({ queryKey: ["queue-sheet-instance", o, s] }), w(), k.success("Transitioned");
|
|
61
61
|
},
|
|
62
62
|
onError: (t, n) => {
|
|
63
|
-
const
|
|
64
|
-
if (
|
|
63
|
+
const R = re(t);
|
|
64
|
+
if (R) {
|
|
65
65
|
y((v) => ({
|
|
66
|
-
payload:
|
|
66
|
+
payload: R,
|
|
67
67
|
transitionId: n,
|
|
68
68
|
revision: ((v == null ? void 0 : v.revision) ?? 0) + 1
|
|
69
69
|
}));
|
|
@@ -71,7 +71,7 @@ function Re({
|
|
|
71
71
|
}
|
|
72
72
|
k.error(Z(t, "Transition failed"));
|
|
73
73
|
}
|
|
74
|
-
}), C =
|
|
74
|
+
}), C = A({
|
|
75
75
|
mutationFn: (t) => x.request(Q("/comments", { collection: o, item: s, text: t })),
|
|
76
76
|
onSuccess: () => {
|
|
77
77
|
_(""), p.invalidateQueries({ queryKey: ["queue-sheet-comments", o, s] });
|
|
@@ -81,8 +81,8 @@ function Re({
|
|
|
81
81
|
Y(o, s, (t) => {
|
|
82
82
|
K(t, P.state) && (p.invalidateQueries({ queryKey: ["queue-sheet-instance", o, s] }), t.own || w()), K(t, P.comments) && p.invalidateQueries({ queryKey: ["queue-sheet-comments", o, s] });
|
|
83
83
|
});
|
|
84
|
-
const S = (
|
|
85
|
-
return /* @__PURE__ */ a(oe, { open: !!e, onOpenChange:
|
|
84
|
+
const S = (i == null ? void 0 : i.available_transitions) ?? [], V = new Map(((i == null ? void 0 : i.states) ?? []).map((t) => [t.id, t]));
|
|
85
|
+
return /* @__PURE__ */ a(oe, { open: !!e, onOpenChange: m, children: [
|
|
86
86
|
/* @__PURE__ */ r(
|
|
87
87
|
se,
|
|
88
88
|
{
|
|
@@ -127,9 +127,9 @@ function Re({
|
|
|
127
127
|
] }) }),
|
|
128
128
|
/* @__PURE__ */ a("div", { className: "flex-1 overflow-y-auto px-5 py-4", children: [
|
|
129
129
|
/* @__PURE__ */ a("div", { className: "mb-4 grid grid-cols-2 gap-px overflow-hidden rounded-lg border border-slate-200 bg-slate-200 dark:border-border dark:bg-border", children: [
|
|
130
|
-
/* @__PURE__ */ r(
|
|
131
|
-
/* @__PURE__ */ r(
|
|
132
|
-
/* @__PURE__ */ r(
|
|
130
|
+
/* @__PURE__ */ r(c, { label: "Owners", children: /* @__PURE__ */ r(le, { owners: e.owners, max: 6 }) }),
|
|
131
|
+
/* @__PURE__ */ r(c, { label: "Claimed by", children: ((I = e.claimed_by) == null ? void 0 : I.name) ?? "—" }),
|
|
132
|
+
/* @__PURE__ */ r(c, { label: "SLA", children: e.sla_status ? /* @__PURE__ */ r(
|
|
133
133
|
"span",
|
|
134
134
|
{
|
|
135
135
|
className: L(
|
|
@@ -139,9 +139,9 @@ function Re({
|
|
|
139
139
|
children: e.sla_status
|
|
140
140
|
}
|
|
141
141
|
) : "—" }),
|
|
142
|
-
/* @__PURE__ */ r(
|
|
143
|
-
e.at_risk && /* @__PURE__ */ r(
|
|
144
|
-
Object.entries(e.extra ?? {}).map(([t, n]) => /* @__PURE__ */ r(
|
|
142
|
+
/* @__PURE__ */ r(c, { label: "Aging", children: ce(e.aging_hours) }),
|
|
143
|
+
e.at_risk && /* @__PURE__ */ r(c, { label: "Risk", children: /* @__PURE__ */ r("span", { className: "text-red-500", children: "⚑ At risk" }) }),
|
|
144
|
+
Object.entries(e.extra ?? {}).map(([t, n]) => /* @__PURE__ */ r(c, { label: me(t), children: n == null || n === "" ? "—" : u != null && u[t] ? X(String(n), u[t]) : String(n) }, t))
|
|
145
145
|
] }),
|
|
146
146
|
S.length > 0 && /* @__PURE__ */ a("div", { className: "mb-4", children: [
|
|
147
147
|
/* @__PURE__ */ r("p", { className: "mb-1.5 text-[11px] font-medium uppercase tracking-wide text-slate-400 dark:text-muted-foreground", children: "Transitions" }),
|
|
@@ -156,7 +156,7 @@ function Re({
|
|
|
156
156
|
className: "flex items-center gap-1 rounded-md border border-slate-200 bg-white px-2.5 py-1.5 text-[12px] font-medium text-slate-700 hover:border-nvr-cyan hover:text-nvr-navy disabled:opacity-50 dark:border-border dark:bg-card dark:text-slate-200 dark:hover:text-nvr-cyan",
|
|
157
157
|
children: [
|
|
158
158
|
t.label || (n == null ? void 0 : n.label) || (n == null ? void 0 : n.key) || "Move",
|
|
159
|
-
/* @__PURE__ */ r(
|
|
159
|
+
/* @__PURE__ */ r(M, { className: "h-3 w-3 text-slate-400" })
|
|
160
160
|
]
|
|
161
161
|
},
|
|
162
162
|
t.id
|
|
@@ -175,14 +175,14 @@ function Re({
|
|
|
175
175
|
/* @__PURE__ */ a("div", { children: [
|
|
176
176
|
/* @__PURE__ */ r("p", { className: "mb-1.5 text-[11px] font-medium uppercase tracking-wide text-slate-400 dark:text-muted-foreground", children: "Comments" }),
|
|
177
177
|
/* @__PURE__ */ a("div", { className: "space-y-2.5", children: [
|
|
178
|
-
((
|
|
178
|
+
((l == null ? void 0 : l.data) ?? []).map((t) => /* @__PURE__ */ a("div", { className: "rounded-md bg-slate-50 px-3 py-2 dark:bg-muted/40", children: [
|
|
179
179
|
/* @__PURE__ */ a("p", { className: "text-[11px] font-medium text-slate-500 dark:text-muted-foreground", children: [
|
|
180
180
|
[t.first_name, t.last_name].filter(Boolean).join(" ") || t.email || "—",
|
|
181
181
|
/* @__PURE__ */ r("span", { className: "ml-1.5 font-normal text-slate-400", children: ee(t.created_at) })
|
|
182
182
|
] }),
|
|
183
183
|
/* @__PURE__ */ r("p", { className: "mt-0.5 whitespace-pre-wrap text-[12px] text-slate-700 dark:text-slate-200", children: t.text })
|
|
184
184
|
] }, t.id)),
|
|
185
|
-
((
|
|
185
|
+
((l == null ? void 0 : l.data) ?? []).length === 0 && /* @__PURE__ */ r("p", { className: "text-[12px] text-slate-400", children: "No comments yet." })
|
|
186
186
|
] }),
|
|
187
187
|
/* @__PURE__ */ a("div", { className: "mt-2.5", children: [
|
|
188
188
|
/* @__PURE__ */ r(
|
|
@@ -216,26 +216,27 @@ function Re({
|
|
|
216
216
|
className: "flex w-full items-center justify-center gap-1.5 rounded-md bg-nvr-cyan px-3 py-2 text-[13px] font-semibold text-white hover:bg-nvr-cyan/90",
|
|
217
217
|
children: [
|
|
218
218
|
"Next ",
|
|
219
|
-
/* @__PURE__ */ r(
|
|
219
|
+
/* @__PURE__ */ r(M, { className: "h-3.5 w-3.5" })
|
|
220
220
|
]
|
|
221
221
|
}
|
|
222
222
|
) })
|
|
223
223
|
] })
|
|
224
224
|
}
|
|
225
225
|
),
|
|
226
|
-
|
|
226
|
+
d && /* @__PURE__ */ r(
|
|
227
227
|
ae,
|
|
228
228
|
{
|
|
229
|
-
payload:
|
|
230
|
-
|
|
231
|
-
|
|
229
|
+
payload: d.payload,
|
|
230
|
+
transitionId: d.transitionId,
|
|
231
|
+
isRetry: d.revision > 1,
|
|
232
|
+
onSubmitted: () => b.mutate(d.transitionId),
|
|
232
233
|
executing: b.isPending,
|
|
233
234
|
onClose: () => y(null)
|
|
234
235
|
},
|
|
235
|
-
|
|
236
|
+
d.revision
|
|
236
237
|
)
|
|
237
238
|
] });
|
|
238
239
|
}
|
|
239
240
|
export {
|
|
240
|
-
|
|
241
|
+
Ie as QueueItemSheet
|
|
241
242
|
};
|