@nivaro/react 0.3.9 → 0.3.11
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/fields/FileField.js +20 -19
- package/dist/full.css +1 -1
- package/dist/hooks/useNivaroForm.js +129 -126
- package/dist/hooks/useSessionRecorder.js +1 -1
- package/dist/index.d.ts +103 -4
- package/dist/index.js +512 -501
- package/dist/shared/components/CollectionBrowserView.js +1632 -1564
- package/dist/shared/components/ConformanceView.js +36 -35
- package/dist/shared/components/ForceReloadBanner.js +58 -34
- package/dist/shared/components/ItemEditForm.js +4386 -4142
- package/dist/shared/components/JsonMapEditor.js +18 -17
- package/dist/shared/components/MatrixEditor.js +8 -7
- package/dist/shared/components/MyWorkView.js +32 -31
- package/dist/shared/components/PageRenderer.js +527 -479
- package/dist/shared/components/QueryStatStrip.js +74 -70
- package/dist/shared/components/RecordGridEditor.js +76 -75
- package/dist/shared/components/ReportView.js +818 -827
- package/dist/shared/components/SheetHeaderBody.js +16 -14
- package/dist/shared/components/ai/AiMemorySuggestions.js +15 -14
- package/dist/shared/components/ai/AskPanel.js +55 -54
- package/dist/shared/components/bulk/BulkActionButtons.js +30 -29
- package/dist/shared/components/bulk/PushBulkButtons.js +57 -56
- package/dist/shared/components/chat/SlashCommands.js +30 -29
- package/dist/shared/components/chat/chat-outbox.js +76 -75
- package/dist/shared/components/help-videos/recorder/useLeaveWarning.js +6 -5
- package/dist/shared/components/integrations/console/SignalCard.js +124 -123
- package/dist/shared/components/integrations/console/SnoozeMenu.js +24 -23
- package/dist/shared/components/item-edit/CatalogPickerField.js +1029 -933
- package/dist/shared/components/item-edit/CloneDialog.js +85 -78
- package/dist/shared/components/item-edit/FieldRenderer.js +161 -156
- package/dist/shared/components/item-edit/FieldRow.js +20 -19
- package/dist/shared/components/item-edit/FilePickerField.js +52 -40
- package/dist/shared/components/item-edit/GroupSection.js +221 -221
- package/dist/shared/components/item-edit/InlineGridField.js +41 -41
- package/dist/shared/components/item-edit/InlineTableField.js +2287 -2275
- package/dist/shared/components/item-edit/M2MCombobox.js +46 -44
- package/dist/shared/components/item-edit/MembershipSetField.js +24 -23
- package/dist/shared/components/item-edit/NestedRelationEditor.js +11 -11
- package/dist/shared/components/item-edit/QuickCreateButton.js +8 -7
- package/dist/shared/components/item-edit/QuickPicker.js +263 -216
- package/dist/shared/components/item-edit/RecordLiveSync.js +101 -100
- package/dist/shared/components/item-edit/RelationCombobox.js +285 -245
- package/dist/shared/components/item-edit/RichTextEditorImpl.js +42 -32
- package/dist/shared/components/item-edit/RowHistorySheet.js +130 -134
- package/dist/shared/components/item-edit/SummaryPanel.js +305 -279
- package/dist/shared/components/item-edit/helpers.js +133 -134
- package/dist/shared/components/item-edit/line-qty.js +57 -0
- package/dist/shared/components/item-edit/option-disambiguate.js +53 -0
- package/dist/shared/components/item-edit/staged-links.js +86 -0
- package/dist/shared/components/layout-editor/LayoutEditor.js +275 -274
- package/dist/shared/components/layout-editor/editors/cascade-rule-row.js +18 -17
- package/dist/shared/components/layout-editor/inspector/HelpTab.js +37 -36
- package/dist/shared/components/layout-editor/matrix/FieldStateMatrix.js +50 -49
- package/dist/shared/components/panels/AddendumLinesDiff.js +87 -90
- package/dist/shared/components/panels/CommentPanel.js +350 -315
- package/dist/shared/components/panels/ItemLockBanner.js +297 -230
- package/dist/shared/components/panels/PipelinePanel.js +719 -701
- package/dist/shared/components/profile/AiMemoryCard.js +15 -14
- package/dist/shared/components/profile/PersonAdminTools.js +70 -67
- package/dist/shared/components/queue/QueueItemSheet.js +36 -35
- package/dist/shared/components/queue/QueueQuickFilters.js +43 -41
- package/dist/shared/components/queue/QueueWorklist.js +1026 -957
- package/dist/shared/components/widgets/ReviewListWidget.js +99 -93
- package/dist/shared/lib/client-version.js +63 -0
- package/dist/shared/lib/force-reload.js +36 -0
- package/dist/shared/lib/load-error.js +11 -10
- package/dist/shared/lib/obligation-banner.js +14 -13
- package/dist/shared/lib/obligation-reason-text.js +13 -0
- package/dist/shared/lib/presence-live.js +54 -35
- package/dist/shared/lib/query-filter-seed.js +34 -11
- package/dist/shared/lib/record-outbox.js +76 -75
- package/dist/shared/lib/safe-error.js +39 -0
- package/dist/shared/lib/sanitize-html.js +24 -15
- package/dist/shared/lib/server-clock.js +11 -7
- package/dist/shared/lib/sheet-def.js +38 -22
- package/dist/shared/lib/unique-options.js +10 -0
- package/dist/shared/lib/unsaved-work.js +62 -0
- package/dist/shared/lib/utils.js +57 -43
- package/dist/shared/lib/validation-rules.js +58 -34
- package/package.json +1 -1
|
@@ -1,23 +1,23 @@
|
|
|
1
|
-
import { jsx as e, jsxs as n, Fragment as
|
|
2
|
-
import { useQueryClient as
|
|
3
|
-
import { ArrowRight as
|
|
4
|
-
import { useState as
|
|
5
|
-
import { toast as
|
|
6
|
-
import { useNivaroClient as
|
|
7
|
-
import { get as
|
|
1
|
+
import { jsx as e, jsxs as n, Fragment as ae } from "react/jsx-runtime";
|
|
2
|
+
import { useQueryClient as De, useQuery as Z, useMutation as ue } from "@tanstack/react-query";
|
|
3
|
+
import { ArrowRight as Ae, Loader2 as te, Check as ve, GitBranch as _e, AlertTriangle as ft, ChevronDown as oe, Users as Ge, Minus as ht, UserPlus as xt, X as Je, Zap as Ze, Search as bt } from "lucide-react";
|
|
4
|
+
import { useState as U, useRef as se, useEffect as de, useMemo as He, Suspense as Ye, lazy as gt } from "react";
|
|
5
|
+
import { toast as X } from "sonner";
|
|
6
|
+
import { useNivaroClient as ce } from "../../context.js";
|
|
7
|
+
import { get as Y, post as be, del as yt } from "../../lib/commands.js";
|
|
8
8
|
import { useRecordSignalWhile as et, useRecordSignalPeers as wt, signalSentence as vt } from "../../lib/presence-signals.js";
|
|
9
|
-
import { RUN_TRANSITION_EVENT as
|
|
9
|
+
import { RUN_TRANSITION_EVENT as ge } from "../../lib/run-transition.js";
|
|
10
10
|
import { serverNow as Nt } from "../../lib/server-clock.js";
|
|
11
|
-
import { cn as
|
|
11
|
+
import { cn as pe, formatRelative as tt, humanHours as kt } from "../../lib/utils.js";
|
|
12
12
|
import { PushReadinessChip as _t } from "../integrations/RecordIntegrationPreview.js";
|
|
13
|
-
import { invalidateRecordInsights as
|
|
14
|
-
import { OwnerAvatars as
|
|
15
|
-
import { UserAvatar as
|
|
16
|
-
import { Button as
|
|
13
|
+
import { invalidateRecordInsights as ye, invalidateRecordData as we } from "../item-edit/RecordInsights.js";
|
|
14
|
+
import { OwnerAvatars as Ct } from "../queue/OwnerAvatars.js";
|
|
15
|
+
import { UserAvatar as St } from "../UserAvatar.js";
|
|
16
|
+
import { Button as V } from "../ui/button.js";
|
|
17
17
|
import { DropdownMenu as nt, DropdownMenuTrigger as rt, DropdownMenuContent as at, DropdownMenuItem as st } from "../ui/dropdown-menu.js";
|
|
18
|
-
import { Popover as
|
|
19
|
-
import { Skeleton as
|
|
20
|
-
import { TooltipProvider as it, Tooltip as
|
|
18
|
+
import { Popover as Re, PopoverTrigger as je, PopoverContent as Oe } from "../ui/popover.js";
|
|
19
|
+
import { Skeleton as ne } from "../ui/skeleton.js";
|
|
20
|
+
import { TooltipProvider as it, Tooltip as Se, TooltipTrigger as $e, TooltipContent as qe } from "../ui/tooltip.js";
|
|
21
21
|
import { isAccessRefusal as lt, deniedToastAction as ot, WhyOwnersButton as $t } from "./AccessInsights.js";
|
|
22
22
|
import { BranchLanes as qt } from "./BranchLanes.js";
|
|
23
23
|
import { SlaClockLine as Tt } from "./SlaClock.js";
|
|
@@ -27,35 +27,35 @@ const dt = gt(
|
|
|
27
27
|
}))
|
|
28
28
|
);
|
|
29
29
|
function ct(r, t) {
|
|
30
|
-
const
|
|
31
|
-
return t.on_behalf_of_name ? `${
|
|
30
|
+
const u = r || "System";
|
|
31
|
+
return t.on_behalf_of_name ? `${u}, for ${t.on_behalf_of_name}` : u;
|
|
32
32
|
}
|
|
33
33
|
function Pt(r) {
|
|
34
34
|
if (r.transition) return null;
|
|
35
35
|
const t = (r.comment ?? "").trim();
|
|
36
36
|
if (!t.startsWith("{")) return null;
|
|
37
37
|
try {
|
|
38
|
-
const
|
|
39
|
-
if (
|
|
40
|
-
return `Split into ${Array.isArray(
|
|
41
|
-
if (
|
|
42
|
-
if (
|
|
38
|
+
const u = JSON.parse(t);
|
|
39
|
+
if (u.action === "split")
|
|
40
|
+
return `Split into ${Array.isArray(u.children) ? u.children.length : "parallel"} branches`;
|
|
41
|
+
if (u.action === "join") return "Every branch finished — joined";
|
|
42
|
+
if (u.action === "branch") return "Started as a parallel branch";
|
|
43
43
|
} catch {
|
|
44
44
|
}
|
|
45
45
|
return null;
|
|
46
46
|
}
|
|
47
|
-
function
|
|
47
|
+
function xe(r) {
|
|
48
48
|
return !(r.first_name || r.last_name || r.user_email);
|
|
49
49
|
}
|
|
50
|
-
function
|
|
50
|
+
function Te(r) {
|
|
51
51
|
const t = (r.comment ?? "").trim().toLowerCase();
|
|
52
52
|
return r.origin === "import" || t.startsWith("import:") ? "Imported" : r.origin === "integration" ? "By an integration" : /-state-sync$/.test(t) || t.startsWith("legacy-") ? "Synced from another system" : t === "state-merge" || t === "instance-migration" ? "Moved by an admin script" : "Moved automatically";
|
|
53
53
|
}
|
|
54
|
-
function
|
|
54
|
+
function Pe(r) {
|
|
55
55
|
if (r.transition_text) return r.transition_text;
|
|
56
56
|
if (r.transition_label) return `Rule: ${r.transition_label}`;
|
|
57
|
-
const t = (r.comment ?? "").trim(),
|
|
58
|
-
return
|
|
57
|
+
const t = (r.comment ?? "").trim(), u = /^auto: (.+)$/i.exec(t);
|
|
58
|
+
return u ? `Rule: ${u[1]}` : /-state-sync$/i.test(t) ? "The state was copied in from the system that owned this record" : /^instance-migration/i.test(t) ? "Moved when the pipeline was reshaped" : /^state-merge/i.test(t) ? "Moved when two states were merged" : null;
|
|
59
59
|
}
|
|
60
60
|
const Ve = {
|
|
61
61
|
validation: "the partner refused what we sent",
|
|
@@ -76,13 +76,13 @@ function At({ held: r }) {
|
|
|
76
76
|
className: "space-y-2 border-b border-amber-100 bg-amber-50 px-5 py-3 dark:border-amber-500/20 dark:bg-amber-500/10",
|
|
77
77
|
"data-pipeline-auto-held": !0,
|
|
78
78
|
children: r.map((t) => {
|
|
79
|
-
const
|
|
79
|
+
const u = t.transition_label ?? "An automatic move", i = Ve[t.error_class ?? "unknown"] ?? Ve.unknown;
|
|
80
80
|
return /* @__PURE__ */ n("div", { className: "text-[12px] text-amber-800 dark:text-amber-300", children: [
|
|
81
81
|
/* @__PURE__ */ n("p", { className: "font-medium", children: [
|
|
82
82
|
"Needs a person: ",
|
|
83
|
-
|
|
83
|
+
u,
|
|
84
84
|
" stopped retrying — ",
|
|
85
|
-
|
|
85
|
+
i,
|
|
86
86
|
"."
|
|
87
87
|
] }),
|
|
88
88
|
t.error && /* @__PURE__ */ e(
|
|
@@ -104,19 +104,19 @@ function At({ held: r }) {
|
|
|
104
104
|
);
|
|
105
105
|
}
|
|
106
106
|
function mt(r) {
|
|
107
|
-
var
|
|
107
|
+
var u;
|
|
108
108
|
const t = r;
|
|
109
|
-
return (t == null ? void 0 : t.status) === 422 && ((
|
|
109
|
+
return (t == null ? void 0 : t.status) === 422 && ((u = t.response) == null ? void 0 : u.error) === "TRANSITION_REQUIREMENTS" ? t.response.requirements ?? [] : null;
|
|
110
110
|
}
|
|
111
|
-
function
|
|
111
|
+
function re({
|
|
112
112
|
label: r,
|
|
113
113
|
color: t,
|
|
114
|
-
small:
|
|
114
|
+
small: u
|
|
115
115
|
}) {
|
|
116
116
|
return /* @__PURE__ */ e(
|
|
117
117
|
"span",
|
|
118
118
|
{
|
|
119
|
-
className: `nvr-state-pulse inline-flex items-center gap-1.5 rounded-full font-medium transition-colors duration-300 ${
|
|
119
|
+
className: `nvr-state-pulse inline-flex items-center gap-1.5 rounded-full font-medium transition-colors duration-300 ${u ? "px-2 py-0.5 text-[11px]" : "px-2.5 py-1 text-[12px]"}`,
|
|
120
120
|
style: {
|
|
121
121
|
backgroundColor: t ? `${t}22` : "#f1f5f9",
|
|
122
122
|
color: t ?? "#475569",
|
|
@@ -127,7 +127,7 @@ function Y({
|
|
|
127
127
|
r
|
|
128
128
|
);
|
|
129
129
|
}
|
|
130
|
-
function
|
|
130
|
+
function Ce(r) {
|
|
131
131
|
const t = Math.floor(r / 6e4);
|
|
132
132
|
return t < 60 ? `${Math.max(1, t)}m` : kt(r / 36e5);
|
|
133
133
|
}
|
|
@@ -135,37 +135,37 @@ function Rt({
|
|
|
135
135
|
history: r,
|
|
136
136
|
completedAt: t
|
|
137
137
|
}) {
|
|
138
|
-
const
|
|
138
|
+
const u = [...r].sort(
|
|
139
139
|
(x, b) => new Date(x.timestamp).getTime() - new Date(b.timestamp).getTime()
|
|
140
140
|
);
|
|
141
|
-
if (
|
|
142
|
-
const
|
|
143
|
-
const
|
|
141
|
+
if (u.length === 0) return null;
|
|
142
|
+
const i = t ? new Date(t).getTime() : Date.now(), C = u.map((x, b) => {
|
|
143
|
+
const T = new Date(x.timestamp).getTime(), P = b + 1 < u.length ? new Date(u[b + 1].timestamp).getTime() : i;
|
|
144
144
|
return {
|
|
145
145
|
key: x.id,
|
|
146
146
|
label: x.to_state_label,
|
|
147
147
|
color: x.to_state_color,
|
|
148
|
-
ms: Math.max(0,
|
|
149
|
-
current: b ===
|
|
148
|
+
ms: Math.max(0, P - T),
|
|
149
|
+
current: b === u.length - 1 && !t
|
|
150
150
|
};
|
|
151
151
|
}).filter((x) => x.ms > 0 || x.current);
|
|
152
|
-
if (
|
|
153
|
-
const
|
|
154
|
-
return
|
|
152
|
+
if (C.length < 2) return null;
|
|
153
|
+
const p = C.reduce((x, b) => x + b.ms, 0);
|
|
154
|
+
return p <= 0 ? null : /* @__PURE__ */ n("div", { "data-state-timeline": !0, children: [
|
|
155
155
|
/* @__PURE__ */ n("div", { className: "mb-1 flex items-center justify-between", children: [
|
|
156
156
|
/* @__PURE__ */ e("p", { className: "text-[10px] font-semibold uppercase tracking-wide text-slate-400 dark:text-slate-500", children: "Time in step" }),
|
|
157
157
|
/* @__PURE__ */ n("p", { className: "text-[10px] tabular-nums text-slate-400 dark:text-slate-500", children: [
|
|
158
|
-
|
|
158
|
+
Ce(p),
|
|
159
159
|
" total",
|
|
160
160
|
t ? "" : " · so far"
|
|
161
161
|
] })
|
|
162
162
|
] }),
|
|
163
|
-
/* @__PURE__ */ e("div", { className: "flex h-4 w-full overflow-hidden rounded", children:
|
|
164
|
-
const b = x.ms /
|
|
163
|
+
/* @__PURE__ */ e("div", { className: "flex h-4 w-full overflow-hidden rounded", children: C.map((x) => {
|
|
164
|
+
const b = x.ms / p * 100;
|
|
165
165
|
return /* @__PURE__ */ n(
|
|
166
166
|
"div",
|
|
167
167
|
{
|
|
168
|
-
"data-tip": `${x.label} — ${
|
|
168
|
+
"data-tip": `${x.label} — ${Ce(x.ms)}${x.current ? " (current)" : ""}`,
|
|
169
169
|
className: "relative flex min-w-[8px] items-center overflow-hidden border-r border-white/60 last:border-r-0 dark:border-black/30",
|
|
170
170
|
style: {
|
|
171
171
|
width: `${b}%`,
|
|
@@ -175,7 +175,7 @@ function Rt({
|
|
|
175
175
|
b >= 14 && /* @__PURE__ */ n("span", { className: "truncate px-1.5 text-[9.5px] font-medium leading-none text-slate-700 dark:text-slate-200", children: [
|
|
176
176
|
x.label,
|
|
177
177
|
" · ",
|
|
178
|
-
|
|
178
|
+
Ce(x.ms)
|
|
179
179
|
] }),
|
|
180
180
|
x.current && /* @__PURE__ */ e(
|
|
181
181
|
"span",
|
|
@@ -194,109 +194,109 @@ function Rt({
|
|
|
194
194
|
function jt({
|
|
195
195
|
states: r,
|
|
196
196
|
allTransitions: t,
|
|
197
|
-
availableTransitions:
|
|
198
|
-
currentStateId:
|
|
199
|
-
history:
|
|
200
|
-
onPathIds:
|
|
197
|
+
availableTransitions: u,
|
|
198
|
+
currentStateId: i,
|
|
199
|
+
history: C,
|
|
200
|
+
onPathIds: p,
|
|
201
201
|
skippedStates: x
|
|
202
202
|
}) {
|
|
203
|
-
var
|
|
204
|
-
const b = new Set(
|
|
205
|
-
|
|
206
|
-
const
|
|
207
|
-
|
|
208
|
-
const
|
|
209
|
-
if (
|
|
210
|
-
return r.filter((s) =>
|
|
203
|
+
var E;
|
|
204
|
+
const b = new Set(C.map((l) => l.to_state)), T = r.find((l) => l.is_initial);
|
|
205
|
+
T && T.id !== i && b.add(T.id);
|
|
206
|
+
const P = (E = C[0]) == null ? void 0 : E.from_state;
|
|
207
|
+
P && P !== i && b.add(P);
|
|
208
|
+
const h = (() => {
|
|
209
|
+
if (p)
|
|
210
|
+
return r.filter((s) => p.has(s.id) || b.has(s.id) || s.id === i).filter((s) => {
|
|
211
211
|
const a = s.stage_visibility ?? "always";
|
|
212
|
-
return a === "hide" ? !1 : a === "hide_unless_active" ? b.has(s.id) || s.id ===
|
|
212
|
+
return a === "hide" ? !1 : a === "hide_unless_active" ? b.has(s.id) || s.id === i : !0;
|
|
213
213
|
}).sort((s, a) => s.sort - a.sort);
|
|
214
214
|
if (t.length === 0) {
|
|
215
215
|
const s = /* @__PURE__ */ new Set([...b]);
|
|
216
|
-
return
|
|
216
|
+
return i && s.add(i), r.filter((a) => s.has(a.id)).sort((a, A) => a.sort - A.sort);
|
|
217
217
|
}
|
|
218
|
-
const
|
|
219
|
-
|
|
220
|
-
),
|
|
221
|
-
for (const s of
|
|
218
|
+
const l = new Set(
|
|
219
|
+
C.filter((s) => s.from_state).map((s) => `${s.from_state}:${s.to_state}`)
|
|
220
|
+
), v = new Set(C.map((s) => s.from_state).filter(Boolean)), c = t.filter((s) => s.from_state !== null), o = /* @__PURE__ */ new Map();
|
|
221
|
+
for (const s of c) {
|
|
222
222
|
const a = s.from_state;
|
|
223
|
-
if (
|
|
224
|
-
const
|
|
225
|
-
|
|
223
|
+
if (v.has(a) && !l.has(`${a}:${s.to_state}`)) continue;
|
|
224
|
+
const A = o.get(a) ?? [];
|
|
225
|
+
A.push(s.to_state), o.set(a, A);
|
|
226
226
|
}
|
|
227
|
-
if (
|
|
228
|
-
const s =
|
|
229
|
-
|
|
230
|
-
.../* @__PURE__ */ new Set([...
|
|
227
|
+
if (i) {
|
|
228
|
+
const s = c.filter((a) => a.from_state === i).map((a) => a.to_state);
|
|
229
|
+
o.set(i, [
|
|
230
|
+
.../* @__PURE__ */ new Set([...u.map((a) => a.to_state), ...s])
|
|
231
231
|
]);
|
|
232
232
|
}
|
|
233
|
-
const
|
|
234
|
-
for (;
|
|
235
|
-
const s =
|
|
236
|
-
if (!
|
|
237
|
-
|
|
238
|
-
for (const a of
|
|
233
|
+
const g = /* @__PURE__ */ new Set(), f = r.filter((s) => s.is_initial).map((s) => s.id);
|
|
234
|
+
for (; f.length; ) {
|
|
235
|
+
const s = f.shift();
|
|
236
|
+
if (!g.has(s)) {
|
|
237
|
+
g.add(s);
|
|
238
|
+
for (const a of o.get(s) ?? []) g.has(a) || f.push(a);
|
|
239
239
|
}
|
|
240
240
|
}
|
|
241
|
-
const
|
|
242
|
-
return
|
|
241
|
+
const y = /* @__PURE__ */ new Set([...g, ...b]);
|
|
242
|
+
return i && y.add(i), r.filter((s) => y.has(s.id)).filter((s) => {
|
|
243
243
|
const a = s.stage_visibility ?? "always";
|
|
244
|
-
return a === "hide" ? !1 : a === "hide_unless_active" ? b.has(s.id) || s.id ===
|
|
244
|
+
return a === "hide" ? !1 : a === "hide_unless_active" ? b.has(s.id) || s.id === i : !0;
|
|
245
245
|
}).sort((s, a) => s.sort - a.sort);
|
|
246
246
|
})();
|
|
247
|
-
if (
|
|
248
|
-
const
|
|
249
|
-
function
|
|
250
|
-
const
|
|
251
|
-
return
|
|
252
|
-
if (!
|
|
253
|
-
const
|
|
254
|
-
return
|
|
255
|
-
}).sort((
|
|
247
|
+
if (h.length < 2) return null;
|
|
248
|
+
const N = new Map(h.map((l, v) => [l.id, v])), q = new Map(r.map((l) => [l.id, l.label]));
|
|
249
|
+
function F(l, v) {
|
|
250
|
+
const c = N.get(l);
|
|
251
|
+
return c == null ? [] : [...C].filter((o) => {
|
|
252
|
+
if (!o.from_state) return !1;
|
|
253
|
+
const g = N.get(o.from_state), f = N.get(o.to_state);
|
|
254
|
+
return g == null || f == null ? !1 : g === c && f > c || f === c && g > c;
|
|
255
|
+
}).sort((o, g) => new Date(o.timestamp).getTime() - new Date(g.timestamp).getTime());
|
|
256
256
|
}
|
|
257
|
-
function
|
|
258
|
-
var
|
|
259
|
-
return
|
|
257
|
+
function k(l) {
|
|
258
|
+
var v, c, o, g;
|
|
259
|
+
return xe(l) ? /* @__PURE__ */ e(Ze, { className: "inline h-2.5 w-2.5", "aria-label": Te(l) }) : ((((v = l.first_name) == null ? void 0 : v[0]) ?? "") + (((c = l.last_name) == null ? void 0 : c[0]) ?? "")).toUpperCase() || ((g = (o = l.user_email) == null ? void 0 : o[0]) == null ? void 0 : g.toUpperCase()) || "?";
|
|
260
260
|
}
|
|
261
|
-
function
|
|
262
|
-
return ct([
|
|
261
|
+
function $(l) {
|
|
262
|
+
return ct([l.first_name, l.last_name].filter(Boolean).join(" ") || l.user_email, l);
|
|
263
263
|
}
|
|
264
|
-
const
|
|
265
|
-
for (const
|
|
266
|
-
(
|
|
264
|
+
const D = /* @__PURE__ */ new Map();
|
|
265
|
+
for (const l of [...C].sort(
|
|
266
|
+
(v, c) => new Date(v.timestamp).getTime() - new Date(c.timestamp).getTime()
|
|
267
267
|
)) {
|
|
268
|
-
if (!
|
|
269
|
-
const
|
|
270
|
-
if (!(
|
|
271
|
-
for (let
|
|
272
|
-
const
|
|
273
|
-
!b.has(
|
|
268
|
+
if (!l.from_state) continue;
|
|
269
|
+
const v = N.get(l.from_state), c = N.get(l.to_state);
|
|
270
|
+
if (!(v == null || c == null || c <= v + 1))
|
|
271
|
+
for (let o = v + 1; o < c; o++) {
|
|
272
|
+
const g = h[o].id;
|
|
273
|
+
!b.has(g) && !D.has(g) && D.set(g, l);
|
|
274
274
|
}
|
|
275
275
|
}
|
|
276
|
-
function
|
|
277
|
-
const
|
|
278
|
-
return `Passed over on ${new Date(
|
|
276
|
+
function w(l) {
|
|
277
|
+
const v = q.get(l.from_state ?? "") ?? "the previous step", c = q.get(l.to_state) ?? "the next step", o = xe(l) ? "it moved automatically" : `${$(l)} moved it`;
|
|
278
|
+
return `Passed over on ${new Date(l.timestamp).toLocaleString()} — ${o} straight from ${v} to ${c}`;
|
|
279
279
|
}
|
|
280
|
-
return /* @__PURE__ */ e(it, { delayDuration: 200, children: /* @__PURE__ */ e("div", { className: "flex w-full items-start", children:
|
|
281
|
-
const
|
|
280
|
+
return /* @__PURE__ */ e(it, { delayDuration: 200, children: /* @__PURE__ */ e("div", { className: "flex w-full items-start", children: h.map((l, v) => {
|
|
281
|
+
const c = l.id === i, o = b.has(l.id), g = o && !c, f = !o && !c ? D.get(l.id) : void 0, y = !o && !c ? x == null ? void 0 : x.get(l.id) : void 0, s = f || y ? [...f ? [w(f)] : [], ...y ?? []] : void 0, a = s !== void 0, A = l.color ?? "#94a3b8", M = v === h.length - 1, ee = M ? null : h[v + 1], R = ee ? F(l.id, ee.id) : [];
|
|
282
282
|
return /* @__PURE__ */ n("div", { className: "flex min-w-[48px] flex-1 items-start", children: [
|
|
283
283
|
/* @__PURE__ */ n("div", { className: "flex min-w-0 flex-1 flex-col items-center gap-1.5 px-1", children: [
|
|
284
284
|
/* @__PURE__ */ e(
|
|
285
285
|
"div",
|
|
286
286
|
{
|
|
287
|
-
className: `flex h-7 w-7 shrink-0 items-center justify-center rounded-full ${
|
|
288
|
-
"data-tip":
|
|
287
|
+
className: `flex h-7 w-7 shrink-0 items-center justify-center rounded-full ${c || g ? "nvr-fill-sweep" : ""}`,
|
|
288
|
+
"data-tip": l.description || void 0,
|
|
289
289
|
style: {
|
|
290
|
-
backgroundColor:
|
|
291
|
-
border:
|
|
292
|
-
boxShadow:
|
|
290
|
+
backgroundColor: c || g ? A : a ? "transparent" : "#f1f5f9",
|
|
291
|
+
border: c || g ? "none" : a ? "1.5px dashed #cbd5e1" : "1.5px solid #e2e8f0",
|
|
292
|
+
boxShadow: c ? `0 0 0 3px white, 0 0 0 5px ${A}` : void 0
|
|
293
293
|
},
|
|
294
|
-
children:
|
|
294
|
+
children: g ? /* @__PURE__ */ e(ve, { className: "h-3.5 w-3.5 text-white", strokeWidth: 2.5 }) : c ? /* @__PURE__ */ e("div", { className: "h-2.5 w-2.5 rounded-full bg-white/80" }) : a ? /* @__PURE__ */ e(ht, { className: "h-3 w-3 text-slate-400", strokeWidth: 2.5 }) : /* @__PURE__ */ e("div", { className: "h-2 w-2 rounded-full bg-slate-300" })
|
|
295
295
|
},
|
|
296
|
-
|
|
296
|
+
c ? "cur" : g ? "done" : a ? "skip" : "todo"
|
|
297
297
|
),
|
|
298
|
-
a ? /* @__PURE__ */ n(
|
|
299
|
-
/* @__PURE__ */ e(
|
|
298
|
+
a ? /* @__PURE__ */ n(Se, { children: [
|
|
299
|
+
/* @__PURE__ */ e($e, { asChild: !0, children: /* @__PURE__ */ e(
|
|
300
300
|
"span",
|
|
301
301
|
{
|
|
302
302
|
className: "w-full cursor-help break-words text-center leading-snug",
|
|
@@ -308,12 +308,12 @@ function jt({
|
|
|
308
308
|
textDecoration: "line-through",
|
|
309
309
|
textDecorationColor: "#cbd5e1"
|
|
310
310
|
},
|
|
311
|
-
children:
|
|
311
|
+
children: l.label
|
|
312
312
|
}
|
|
313
313
|
) }),
|
|
314
|
-
/* @__PURE__ */ n(
|
|
314
|
+
/* @__PURE__ */ n(qe, { className: "max-w-[260px]", children: [
|
|
315
315
|
/* @__PURE__ */ e("p", { className: "text-[11px] font-medium", children: "Skipped for this record" }),
|
|
316
|
-
s.length > 0 ? /* @__PURE__ */ e("ul", { className: "mt-1 space-y-0.5 text-[11px] opacity-90", children: s.map((
|
|
316
|
+
s.length > 0 ? /* @__PURE__ */ e("ul", { className: "mt-1 space-y-0.5 text-[11px] opacity-90", children: s.map((S) => /* @__PURE__ */ e("li", { children: S }, S)) }) : /* @__PURE__ */ e("p", { className: "mt-1 text-[11px] opacity-90", children: "Its skip conditions are met." })
|
|
317
317
|
] })
|
|
318
318
|
] }) : /* @__PURE__ */ e(
|
|
319
319
|
"span",
|
|
@@ -321,23 +321,23 @@ function jt({
|
|
|
321
321
|
className: "w-full break-words text-center leading-snug",
|
|
322
322
|
style: {
|
|
323
323
|
fontSize: "11px",
|
|
324
|
-
color:
|
|
325
|
-
fontWeight:
|
|
324
|
+
color: c ? A : g ? "#475569" : "#94a3b8",
|
|
325
|
+
fontWeight: c ? 600 : g ? 500 : 400,
|
|
326
326
|
wordBreak: "break-word"
|
|
327
327
|
},
|
|
328
|
-
children:
|
|
328
|
+
children: l.label
|
|
329
329
|
}
|
|
330
330
|
)
|
|
331
331
|
] }),
|
|
332
|
-
!
|
|
332
|
+
!M && /* @__PURE__ */ n("div", { className: "mt-[13px] flex w-10 shrink-0 flex-col items-center gap-1.5", children: [
|
|
333
333
|
(() => {
|
|
334
|
-
const
|
|
334
|
+
const S = g ? `${A}55` : "#e8ecf0";
|
|
335
335
|
return /* @__PURE__ */ n("div", { className: "flex w-full shrink-0 items-center", children: [
|
|
336
336
|
/* @__PURE__ */ e(
|
|
337
337
|
"div",
|
|
338
338
|
{
|
|
339
339
|
className: "h-0.5 flex-1 rounded-l-sm",
|
|
340
|
-
style: { backgroundColor:
|
|
340
|
+
style: { backgroundColor: S }
|
|
341
341
|
}
|
|
342
342
|
),
|
|
343
343
|
/* @__PURE__ */ e(
|
|
@@ -348,69 +348,69 @@ function jt({
|
|
|
348
348
|
height: 0,
|
|
349
349
|
borderTop: "3px solid transparent",
|
|
350
350
|
borderBottom: "3px solid transparent",
|
|
351
|
-
borderLeft: `5px solid ${
|
|
351
|
+
borderLeft: `5px solid ${S}`
|
|
352
352
|
}
|
|
353
353
|
}
|
|
354
354
|
)
|
|
355
355
|
] });
|
|
356
356
|
})(),
|
|
357
|
-
|
|
358
|
-
const
|
|
359
|
-
(
|
|
360
|
-
) > 1 ?
|
|
361
|
-
return /* @__PURE__ */ n(
|
|
362
|
-
/* @__PURE__ */ e(
|
|
357
|
+
R.map((S) => {
|
|
358
|
+
const B = S.from_state !== l.id, I = Math.abs(
|
|
359
|
+
(N.get(S.to_state) ?? 0) - (N.get(S.from_state ?? "") ?? 0)
|
|
360
|
+
) > 1 ? q.get(S.to_state) ?? "" : null;
|
|
361
|
+
return /* @__PURE__ */ n(Se, { children: [
|
|
362
|
+
/* @__PURE__ */ e($e, { asChild: !0, children: /* @__PURE__ */ n("div", { className: "flex w-full cursor-default flex-col items-center gap-0.5", children: [
|
|
363
363
|
/* @__PURE__ */ n(
|
|
364
364
|
"span",
|
|
365
365
|
{
|
|
366
366
|
className: "text-center font-mono text-[9px] font-semibold leading-none",
|
|
367
|
-
style: { color:
|
|
367
|
+
style: { color: B ? "#d97706" : "#475569" },
|
|
368
368
|
children: [
|
|
369
|
-
|
|
370
|
-
|
|
369
|
+
B && "↩ ",
|
|
370
|
+
k(S)
|
|
371
371
|
]
|
|
372
372
|
}
|
|
373
373
|
),
|
|
374
|
-
/* @__PURE__ */ e("span", { className: "text-[8.5px] leading-none text-slate-400", children: tt(
|
|
374
|
+
/* @__PURE__ */ e("span", { className: "text-[8.5px] leading-none text-slate-400", children: tt(S.timestamp) })
|
|
375
375
|
] }) }),
|
|
376
|
-
/* @__PURE__ */ n(
|
|
377
|
-
|
|
376
|
+
/* @__PURE__ */ n(qe, { side: "top", className: "space-y-0.5 text-[12px]", children: [
|
|
377
|
+
xe(S) ? /* @__PURE__ */ n(ae, { children: [
|
|
378
378
|
/* @__PURE__ */ n("p", { className: "font-medium", children: [
|
|
379
|
-
|
|
380
|
-
|
|
379
|
+
B ? "↩ Sent back · " : "",
|
|
380
|
+
Te(S)
|
|
381
381
|
] }),
|
|
382
|
-
|
|
382
|
+
Pe(S) && /* @__PURE__ */ e("p", { className: "max-w-[280px] text-muted-foreground", children: Pe(S) })
|
|
383
383
|
] }) : /* @__PURE__ */ n("p", { className: "font-medium", children: [
|
|
384
|
-
|
|
384
|
+
B ? "↩ Sent back by" : "Approved by",
|
|
385
385
|
" ",
|
|
386
|
-
|
|
386
|
+
$(S)
|
|
387
387
|
] }),
|
|
388
|
-
|
|
388
|
+
I && /* @__PURE__ */ n("p", { className: "text-muted-foreground", children: [
|
|
389
389
|
"→ straight to ",
|
|
390
|
-
|
|
390
|
+
I
|
|
391
391
|
] }),
|
|
392
|
-
/* @__PURE__ */ e("p", { className: "text-muted-foreground", children: new Date(
|
|
392
|
+
/* @__PURE__ */ e("p", { className: "text-muted-foreground", children: new Date(S.timestamp).toLocaleString() })
|
|
393
393
|
] })
|
|
394
|
-
] },
|
|
394
|
+
] }, S.id);
|
|
395
395
|
})
|
|
396
396
|
] })
|
|
397
|
-
] },
|
|
397
|
+
] }, l.id);
|
|
398
398
|
}) }) });
|
|
399
399
|
}
|
|
400
400
|
function Ot({ history: r }) {
|
|
401
401
|
return r.length === 0 ? /* @__PURE__ */ e("p", { className: "text-[12px] text-slate-400 italic", children: "No transitions yet." }) : /* @__PURE__ */ e("div", { className: "space-y-3", children: r.map((t) => {
|
|
402
|
-
const
|
|
402
|
+
const u = xe(t), i = u ? Te(t) : ct([t.first_name, t.last_name].filter(Boolean).join(" ") || t.user_email, t), C = Pt(t), p = t.comment && !u && !C ? t.comment : null, x = C ?? (u ? Pe(t) : null);
|
|
403
403
|
return /* @__PURE__ */ n("div", { className: "flex items-start gap-2.5 text-[12px]", children: [
|
|
404
404
|
/* @__PURE__ */ e("div", { className: "mt-1.5 h-1.5 w-1.5 shrink-0 rounded-full bg-slate-200" }),
|
|
405
405
|
/* @__PURE__ */ n("div", { className: "flex-1 min-w-0", children: [
|
|
406
406
|
/* @__PURE__ */ n("div", { className: "flex items-center gap-1.5 flex-wrap", children: [
|
|
407
|
-
t.from_state_label ? /* @__PURE__ */ e(
|
|
408
|
-
/* @__PURE__ */ e(
|
|
409
|
-
/* @__PURE__ */ e(
|
|
407
|
+
t.from_state_label ? /* @__PURE__ */ e(re, { label: t.from_state_label, color: t.from_state_color, small: !0 }) : /* @__PURE__ */ e("span", { className: "text-[11px] text-slate-400 italic", children: "started" }),
|
|
408
|
+
/* @__PURE__ */ e(Ae, { className: "h-3 w-3 shrink-0 text-slate-300" }),
|
|
409
|
+
/* @__PURE__ */ e(re, { label: t.to_state_label, color: t.to_state_color, small: !0 })
|
|
410
410
|
] }),
|
|
411
|
-
|
|
411
|
+
p && /* @__PURE__ */ n("p", { className: "mt-1 text-slate-500 italic", children: [
|
|
412
412
|
'"',
|
|
413
|
-
|
|
413
|
+
p,
|
|
414
414
|
'"'
|
|
415
415
|
] }),
|
|
416
416
|
/* @__PURE__ */ n(
|
|
@@ -419,8 +419,8 @@ function Ot({ history: r }) {
|
|
|
419
419
|
className: "mt-0.5 text-slate-400",
|
|
420
420
|
"data-history-on-behalf": t.on_behalf_of_name ? t.on_behalf_of ?? "" : void 0,
|
|
421
421
|
children: [
|
|
422
|
-
|
|
423
|
-
|
|
422
|
+
u && /* @__PURE__ */ e(Ze, { className: "mr-1 inline h-3 w-3", "aria-hidden": !0 }),
|
|
423
|
+
i,
|
|
424
424
|
x ? ` · ${x}` : "",
|
|
425
425
|
" · ",
|
|
426
426
|
tt(t.timestamp)
|
|
@@ -432,42 +432,42 @@ function Ot({ history: r }) {
|
|
|
432
432
|
}) });
|
|
433
433
|
}
|
|
434
434
|
function Lt({ value: r, onChange: t }) {
|
|
435
|
-
const
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
var
|
|
439
|
-
return (
|
|
435
|
+
const u = ce(), [i, C] = U(!1), [p, x] = U(""), [b, T] = U(""), P = se(null), h = se(null);
|
|
436
|
+
de(() => {
|
|
437
|
+
i ? setTimeout(() => {
|
|
438
|
+
var w;
|
|
439
|
+
return (w = P.current) == null ? void 0 : w.focus();
|
|
440
440
|
}, 50) : x("");
|
|
441
|
-
}, [
|
|
442
|
-
|
|
443
|
-
}), [
|
|
444
|
-
const { data:
|
|
441
|
+
}, [i]), de(() => (h.current && clearTimeout(h.current), h.current = setTimeout(() => T(p), 250), () => {
|
|
442
|
+
h.current && clearTimeout(h.current);
|
|
443
|
+
}), [p]);
|
|
444
|
+
const { data: N, isLoading: q } = Z({
|
|
445
445
|
queryKey: ["users", "async-search", b],
|
|
446
|
-
queryFn: () =>
|
|
447
|
-
|
|
446
|
+
queryFn: () => u.request(
|
|
447
|
+
Y("/users", {
|
|
448
448
|
limit: 50,
|
|
449
449
|
sort: "first_name",
|
|
450
450
|
...b ? { search: b } : {}
|
|
451
451
|
})
|
|
452
|
-
).then((
|
|
453
|
-
enabled:
|
|
452
|
+
).then((w) => w.data),
|
|
453
|
+
enabled: i,
|
|
454
454
|
staleTime: 3e4
|
|
455
|
-
}), { data:
|
|
455
|
+
}), { data: F } = Z({
|
|
456
456
|
queryKey: ["users", "single", r],
|
|
457
|
-
queryFn: () =>
|
|
457
|
+
queryFn: () => u.request(Y(`/users/${r}`)).then((w) => w.data),
|
|
458
458
|
enabled: !!r,
|
|
459
459
|
staleTime: 5 * 6e4
|
|
460
|
-
}),
|
|
461
|
-
return /* @__PURE__ */ n(
|
|
460
|
+
}), k = F ? [F.first_name, F.last_name].filter(Boolean).join(" ").trim() || F.email : r || null, $ = N ?? [], D = (w) => [w.first_name, w.last_name].filter(Boolean).join(" ").trim();
|
|
461
|
+
return /* @__PURE__ */ n(Re, { open: i, onOpenChange: C, children: [
|
|
462
462
|
/* @__PURE__ */ n("div", { className: "relative flex h-8 w-full", children: [
|
|
463
|
-
/* @__PURE__ */ e(
|
|
463
|
+
/* @__PURE__ */ e(je, { asChild: !0, children: /* @__PURE__ */ n(
|
|
464
464
|
"button",
|
|
465
465
|
{
|
|
466
466
|
type: "button",
|
|
467
467
|
className: "flex h-full w-full items-center justify-between gap-1.5 rounded-md border border-slate-200 bg-white px-2.5 text-left text-[13px] text-slate-700 hover:border-slate-300",
|
|
468
468
|
children: [
|
|
469
|
-
/* @__PURE__ */ e("span", { className: `flex-1 truncate ${
|
|
470
|
-
/* @__PURE__ */ e(
|
|
469
|
+
/* @__PURE__ */ e("span", { className: `flex-1 truncate ${k ? "" : "text-slate-400"}`, children: k ?? "Select a user…" }),
|
|
470
|
+
/* @__PURE__ */ e(oe, { className: "h-3.5 w-3.5 shrink-0 text-slate-400" })
|
|
471
471
|
]
|
|
472
472
|
}
|
|
473
473
|
) }),
|
|
@@ -475,52 +475,52 @@ function Lt({ value: r, onChange: t }) {
|
|
|
475
475
|
"button",
|
|
476
476
|
{
|
|
477
477
|
type: "button",
|
|
478
|
-
onClick: (
|
|
479
|
-
|
|
478
|
+
onClick: (w) => {
|
|
479
|
+
w.stopPropagation(), t("");
|
|
480
480
|
},
|
|
481
481
|
className: "absolute right-6 top-1/2 -translate-y-1/2 flex h-5 w-5 items-center justify-center rounded text-slate-400 hover:bg-slate-100 hover:text-slate-600 dark:hover:bg-muted dark:hover:text-slate-300",
|
|
482
482
|
children: /* @__PURE__ */ e(Je, { className: "h-3 w-3" })
|
|
483
483
|
}
|
|
484
484
|
)
|
|
485
485
|
] }),
|
|
486
|
-
/* @__PURE__ */ n(
|
|
486
|
+
/* @__PURE__ */ n(Oe, { align: "start", className: "w-72 p-0", sideOffset: 4, children: [
|
|
487
487
|
/* @__PURE__ */ e("div", { className: "border-b border-slate-100 px-2 py-1.5", children: /* @__PURE__ */ n("div", { className: "relative", children: [
|
|
488
488
|
/* @__PURE__ */ e(bt, { className: "absolute left-2 top-1/2 h-3.5 w-3.5 -translate-y-1/2 text-slate-400" }),
|
|
489
489
|
/* @__PURE__ */ e(
|
|
490
490
|
"input",
|
|
491
491
|
{
|
|
492
|
-
ref:
|
|
493
|
-
value:
|
|
494
|
-
onChange: (
|
|
492
|
+
ref: P,
|
|
493
|
+
value: p,
|
|
494
|
+
onChange: (w) => x(w.target.value),
|
|
495
495
|
placeholder: "Search users…",
|
|
496
496
|
className: "h-7 w-full rounded-md bg-slate-50 pl-7 pr-2 text-[12px] placeholder-slate-400 focus:outline-none focus:ring-1 focus:ring-nvr-cyan/40"
|
|
497
497
|
}
|
|
498
498
|
)
|
|
499
499
|
] }) }),
|
|
500
|
-
/* @__PURE__ */ e("div", { className: "max-h-56 overflow-y-auto py-1", children:
|
|
501
|
-
/* @__PURE__ */ e(
|
|
500
|
+
/* @__PURE__ */ e("div", { className: "max-h-56 overflow-y-auto py-1", children: q ? /* @__PURE__ */ n("div", { className: "flex items-center gap-2 px-3 py-2 text-[12px] text-slate-400", children: [
|
|
501
|
+
/* @__PURE__ */ e(te, { className: "h-3.5 w-3.5 animate-spin" }),
|
|
502
502
|
"Loading…"
|
|
503
|
-
] }) :
|
|
504
|
-
const
|
|
503
|
+
] }) : $.length === 0 ? /* @__PURE__ */ e("div", { className: "px-3 py-2 text-[12px] text-slate-400", children: "No results" }) : $.map((w) => {
|
|
504
|
+
const E = D(w), l = E ? `${E} (${w.email})` : w.email, v = w.id === r;
|
|
505
505
|
return /* @__PURE__ */ n(
|
|
506
506
|
"button",
|
|
507
507
|
{
|
|
508
508
|
type: "button",
|
|
509
509
|
onClick: () => {
|
|
510
|
-
t(
|
|
510
|
+
t(w.id), C(!1);
|
|
511
511
|
},
|
|
512
|
-
className: `flex w-full items-center gap-2 px-3 py-1.5 text-left text-[12px] hover:bg-slate-50 ${
|
|
512
|
+
className: `flex w-full items-center gap-2 px-3 py-1.5 text-left text-[12px] hover:bg-slate-50 ${v ? "font-medium text-slate-800" : "text-slate-600"}`,
|
|
513
513
|
children: [
|
|
514
514
|
/* @__PURE__ */ e(
|
|
515
|
-
|
|
515
|
+
ve,
|
|
516
516
|
{
|
|
517
|
-
className: `h-3.5 w-3.5 shrink-0 ${
|
|
517
|
+
className: `h-3.5 w-3.5 shrink-0 ${v ? "text-nvr-cyan" : "opacity-0"}`
|
|
518
518
|
}
|
|
519
519
|
),
|
|
520
|
-
|
|
520
|
+
l
|
|
521
521
|
]
|
|
522
522
|
},
|
|
523
|
-
|
|
523
|
+
w.id
|
|
524
524
|
);
|
|
525
525
|
}) })
|
|
526
526
|
] })
|
|
@@ -529,67 +529,75 @@ function Lt({ value: r, onChange: t }) {
|
|
|
529
529
|
function Ft({
|
|
530
530
|
collection: r,
|
|
531
531
|
item: t,
|
|
532
|
-
states:
|
|
533
|
-
currentStateId:
|
|
532
|
+
states: u,
|
|
533
|
+
currentStateId: i,
|
|
534
|
+
returned: C = !1
|
|
534
535
|
}) {
|
|
535
|
-
var
|
|
536
|
-
const
|
|
537
|
-
queryKey:
|
|
538
|
-
queryFn: () =>
|
|
539
|
-
|
|
540
|
-
).then((
|
|
541
|
-
}), { data:
|
|
536
|
+
var S, B, I;
|
|
537
|
+
const p = ce(), x = De(), [b, T] = U(!1), [P, h] = U(""), [N, q] = U(""), [F, k] = U(!1), $ = ["pipeline-instance-owners", r, t], { data: D, isLoading: w } = Z({
|
|
538
|
+
queryKey: $,
|
|
539
|
+
queryFn: () => p.request(
|
|
540
|
+
Y(`/pipelines/instance/${r}/${t}/owners`)
|
|
541
|
+
).then((m) => m.data)
|
|
542
|
+
}), { data: E, isLoading: l } = Z({
|
|
542
543
|
queryKey: ["pipeline-all-owners", r, t],
|
|
543
|
-
queryFn: () =>
|
|
544
|
-
|
|
545
|
-
).then((
|
|
546
|
-
enabled: !!
|
|
544
|
+
queryFn: () => p.request(
|
|
545
|
+
Y(`/pipelines/instance/${r}/${t}/owners/all`)
|
|
546
|
+
).then((m) => m.data ?? null),
|
|
547
|
+
enabled: !!i,
|
|
547
548
|
staleTime: 3e4
|
|
548
|
-
}),
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
549
|
+
}), v = new Set((D ?? []).map((m) => m.user)), c = i ? (((S = E == null ? void 0 : E[i]) == null ? void 0 : S.owners) ?? []).filter((m) => !v.has(m.id)) : [], o = c.length + ((D == null ? void 0 : D.length) ?? 0), g = !!((B = u.find((m) => m.id === i)) != null && B.is_initial), f = !w && !l, { data: y } = Z({
|
|
550
|
+
queryKey: ["pipeline-record-creator", r, t],
|
|
551
|
+
queryFn: () => p.request(
|
|
552
|
+
Y(`/pipelines/instance/${r}/${t}/creator`)
|
|
553
|
+
).then((m) => m.data ?? null),
|
|
554
|
+
enabled: g && f && o === 0,
|
|
555
|
+
staleTime: 6e4
|
|
556
|
+
}), s = g && o === 0 && (y != null && y.name) ? y : null, a = () => {
|
|
557
|
+
x.invalidateQueries({ queryKey: $ }), x.invalidateQueries({ queryKey: ["pipeline-instance", r, t] });
|
|
558
|
+
}, A = ue({
|
|
559
|
+
mutationFn: () => p.request(
|
|
560
|
+
be(`/pipelines/instance/${r}/${t}/owners`, {
|
|
561
|
+
user: P,
|
|
562
|
+
state: N || void 0
|
|
555
563
|
})
|
|
556
564
|
),
|
|
557
565
|
onSuccess: () => {
|
|
558
|
-
|
|
566
|
+
a(), h(""), q(""), T(!1), X.success("Owner added");
|
|
559
567
|
},
|
|
560
|
-
onError: () =>
|
|
561
|
-
}),
|
|
562
|
-
mutationFn: (
|
|
568
|
+
onError: () => X.error("Failed to add owner")
|
|
569
|
+
}), M = ue({
|
|
570
|
+
mutationFn: (m) => p.request(yt(`/pipelines/instance-owners/${m}`)),
|
|
563
571
|
onSuccess: () => {
|
|
564
|
-
|
|
572
|
+
a(), X.success("Owner removed");
|
|
565
573
|
},
|
|
566
|
-
onError: () =>
|
|
567
|
-
}),
|
|
568
|
-
var
|
|
569
|
-
const
|
|
570
|
-
return (`${
|
|
571
|
-
},
|
|
572
|
-
var
|
|
573
|
-
return
|
|
574
|
+
onError: () => X.error("Failed to remove owner")
|
|
575
|
+
}), ee = (m) => {
|
|
576
|
+
var z, Q;
|
|
577
|
+
const H = ((z = m.first_name) == null ? void 0 : z[0]) ?? "", j = ((Q = m.last_name) == null ? void 0 : Q[0]) ?? "";
|
|
578
|
+
return (`${H}${j}`.trim() || m.email[0] || "?").toUpperCase();
|
|
579
|
+
}, R = (m) => {
|
|
580
|
+
var H;
|
|
581
|
+
return m ? ((H = u.find((j) => j.id === m || j.key === m)) == null ? void 0 : H.label) ?? m : null;
|
|
574
582
|
};
|
|
575
583
|
return /* @__PURE__ */ n("div", { children: [
|
|
576
584
|
/* @__PURE__ */ n("div", { className: "mb-3 flex items-center justify-between", children: [
|
|
577
585
|
/* @__PURE__ */ n("span", { className: "flex items-center gap-1.5 text-[11px] font-medium text-slate-400", children: [
|
|
578
586
|
/* @__PURE__ */ e(Ge, { className: "h-3.5 w-3.5" }),
|
|
579
587
|
"Owners",
|
|
580
|
-
|
|
588
|
+
w || l ? /* @__PURE__ */ e("span", { className: "inline-block h-3 w-4 animate-pulse rounded bg-slate-200 dark:bg-[hsl(var(--nvr-skeleton))]" }) : s ? null : /* @__PURE__ */ n("span", { className: "text-slate-300", children: [
|
|
581
589
|
"(",
|
|
582
|
-
|
|
590
|
+
o,
|
|
583
591
|
")"
|
|
584
592
|
] })
|
|
585
593
|
] }),
|
|
586
594
|
/* @__PURE__ */ n("span", { className: "flex items-center gap-3", children: [
|
|
587
|
-
|
|
588
|
-
!
|
|
595
|
+
i && /* @__PURE__ */ e($t, { collection: r, itemId: String(t) }),
|
|
596
|
+
!b && /* @__PURE__ */ n(
|
|
589
597
|
"button",
|
|
590
598
|
{
|
|
591
599
|
type: "button",
|
|
592
|
-
onClick: () =>
|
|
600
|
+
onClick: () => T(!0),
|
|
593
601
|
className: "flex items-center gap-1 text-[11px] text-slate-400 transition-colors hover:text-nvr-cyan",
|
|
594
602
|
children: [
|
|
595
603
|
/* @__PURE__ */ e(xt, { className: "h-3 w-3" }),
|
|
@@ -599,121 +607,125 @@ function Ft({
|
|
|
599
607
|
)
|
|
600
608
|
] })
|
|
601
609
|
] }),
|
|
602
|
-
|
|
603
|
-
/* @__PURE__ */ e(
|
|
610
|
+
w || l ? /* @__PURE__ */ n("div", { className: "flex items-center gap-2 py-1.5 text-[12px] text-slate-400", children: [
|
|
611
|
+
/* @__PURE__ */ e(te, { className: "h-3.5 w-3.5 animate-spin" }),
|
|
604
612
|
"Resolving owners…"
|
|
605
|
-
] }) :
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
613
|
+
] }) : s ? /* @__PURE__ */ n("p", { className: "text-[12px] text-slate-500 dark:text-muted-foreground", children: [
|
|
614
|
+
C ? "Back with" : "With",
|
|
615
|
+
" ",
|
|
616
|
+
/* @__PURE__ */ e("span", { className: "font-medium text-slate-700 dark:text-foreground", children: s.name })
|
|
617
|
+
] }) : o === 0 ? /* @__PURE__ */ e("p", { className: "text-[12px] text-slate-400", children: "No owners assigned." }) : /* @__PURE__ */ n("div", { className: "space-y-px", children: [
|
|
618
|
+
c.map((m) => {
|
|
619
|
+
var z, Q;
|
|
620
|
+
const H = [m.first_name, m.last_name].filter(Boolean).join(" ") || m.email, j = (`${((z = m.first_name) == null ? void 0 : z[0]) ?? ""}${((Q = m.last_name) == null ? void 0 : Q[0]) ?? ""}`.trim() || m.email[0] || "?").toUpperCase();
|
|
609
621
|
return /* @__PURE__ */ n(
|
|
610
622
|
"div",
|
|
611
623
|
{
|
|
612
624
|
className: "-mx-2 flex items-center gap-2.5 rounded-md px-2 py-1.5 transition-colors hover:bg-slate-50",
|
|
613
625
|
children: [
|
|
614
626
|
/* @__PURE__ */ e(
|
|
615
|
-
|
|
627
|
+
St,
|
|
616
628
|
{
|
|
617
|
-
userId:
|
|
618
|
-
alt:
|
|
629
|
+
userId: m.id,
|
|
630
|
+
alt: H,
|
|
619
631
|
className: "h-6 w-6",
|
|
620
|
-
fallback: /* @__PURE__ */ e("span", { className: "flex h-6 w-6 shrink-0 select-none items-center justify-center rounded-full bg-nvr-cyan/10 text-[10px] font-semibold text-nvr-navy/80", children:
|
|
632
|
+
fallback: /* @__PURE__ */ e("span", { className: "flex h-6 w-6 shrink-0 select-none items-center justify-center rounded-full bg-nvr-cyan/10 text-[10px] font-semibold text-nvr-navy/80", children: j })
|
|
621
633
|
}
|
|
622
634
|
),
|
|
623
635
|
/* @__PURE__ */ n("div", { className: "min-w-0 flex-1", children: [
|
|
624
|
-
/* @__PURE__ */ e("span", { className: "block truncate text-[12px] font-medium text-slate-700", children:
|
|
625
|
-
/* @__PURE__ */ e("span", { className: "block truncate text-[11px] text-slate-400", children:
|
|
636
|
+
/* @__PURE__ */ e("span", { className: "block truncate text-[12px] font-medium text-slate-700", children: H }),
|
|
637
|
+
/* @__PURE__ */ e("span", { className: "block truncate text-[11px] text-slate-400", children: m.email })
|
|
626
638
|
] }),
|
|
627
639
|
/* @__PURE__ */ e("span", { className: "shrink-0 rounded-full bg-nvr-cyan/10 px-1.5 py-0.5 text-[10px] font-medium text-nvr-navy/70 dark:text-nvr-cyan", children: "owner group" })
|
|
628
640
|
]
|
|
629
641
|
},
|
|
630
|
-
`group-${
|
|
642
|
+
`group-${m.id}`
|
|
631
643
|
);
|
|
632
644
|
}),
|
|
633
|
-
(
|
|
645
|
+
(D ?? []).map((m) => /* @__PURE__ */ n(
|
|
634
646
|
"div",
|
|
635
647
|
{
|
|
636
648
|
className: "group -mx-2 flex items-center gap-2.5 rounded-md px-2 py-1.5 transition-colors hover:bg-slate-50",
|
|
637
649
|
children: [
|
|
638
|
-
/* @__PURE__ */ e("span", { className: "flex h-6 w-6 shrink-0 select-none items-center justify-center rounded-full bg-nvr-cyan/10 text-[10px] font-semibold text-nvr-navy/80", children:
|
|
650
|
+
/* @__PURE__ */ e("span", { className: "flex h-6 w-6 shrink-0 select-none items-center justify-center rounded-full bg-nvr-cyan/10 text-[10px] font-semibold text-nvr-navy/80", children: ee(m) }),
|
|
639
651
|
/* @__PURE__ */ n("div", { className: "min-w-0 flex-1", children: [
|
|
640
|
-
/* @__PURE__ */ e("span", { className: "block truncate text-[12px] font-medium text-slate-700", children: [
|
|
641
|
-
/* @__PURE__ */ e("span", { className: "block truncate text-[11px] text-slate-400", children:
|
|
652
|
+
/* @__PURE__ */ e("span", { className: "block truncate text-[12px] font-medium text-slate-700", children: [m.first_name, m.last_name].filter(Boolean).join(" ") || m.email }),
|
|
653
|
+
/* @__PURE__ */ e("span", { className: "block truncate text-[11px] text-slate-400", children: m.email })
|
|
642
654
|
] }),
|
|
643
655
|
/* @__PURE__ */ e("span", { className: "shrink-0 rounded-full bg-amber-50 px-1.5 py-0.5 text-[10px] font-medium text-amber-700 dark:bg-amber-500/10 dark:text-amber-400", children: "manual" }),
|
|
644
|
-
/* @__PURE__ */ e("span", { className: "shrink-0 rounded-full bg-slate-100 px-1.5 py-0.5 text-[10px] text-slate-500", children:
|
|
656
|
+
/* @__PURE__ */ e("span", { className: "shrink-0 rounded-full bg-slate-100 px-1.5 py-0.5 text-[10px] text-slate-500", children: m.state ? R(m.state) : "all states" }),
|
|
645
657
|
/* @__PURE__ */ e(
|
|
646
658
|
"button",
|
|
647
659
|
{
|
|
648
660
|
type: "button",
|
|
649
|
-
onClick: () =>
|
|
661
|
+
onClick: () => M.mutate(m.id),
|
|
650
662
|
className: "shrink-0 rounded p-0.5 text-slate-300 opacity-0 transition-all hover:text-red-500 group-hover:opacity-100",
|
|
651
663
|
children: /* @__PURE__ */ e(Je, { className: "h-3 w-3" })
|
|
652
664
|
}
|
|
653
665
|
)
|
|
654
666
|
]
|
|
655
667
|
},
|
|
656
|
-
|
|
668
|
+
m.id
|
|
657
669
|
))
|
|
658
670
|
] }),
|
|
659
|
-
|
|
671
|
+
b && /* @__PURE__ */ n("div", { className: "mt-3 space-y-2 rounded-lg border border-slate-200 bg-slate-50 dark:bg-slate-900/30 dark:border-border p-3", children: [
|
|
660
672
|
/* @__PURE__ */ e("p", { className: "text-[11px] font-semibold text-slate-500", children: "Add owner" }),
|
|
661
|
-
/* @__PURE__ */ e(Lt, { value:
|
|
662
|
-
/* @__PURE__ */ n(
|
|
663
|
-
/* @__PURE__ */ e(
|
|
673
|
+
/* @__PURE__ */ e(Lt, { value: P, onChange: h }),
|
|
674
|
+
/* @__PURE__ */ n(Re, { open: F, onOpenChange: k, children: [
|
|
675
|
+
/* @__PURE__ */ e(je, { asChild: !0, children: /* @__PURE__ */ n(
|
|
664
676
|
"button",
|
|
665
677
|
{
|
|
666
678
|
type: "button",
|
|
667
679
|
className: "flex h-8 w-full items-center justify-between rounded-md border border-slate-200 bg-white px-2.5 text-left text-[13px] text-slate-700 transition-colors hover:border-slate-300 dark:border-border dark:bg-transparent dark:text-slate-300",
|
|
668
680
|
children: [
|
|
669
|
-
/* @__PURE__ */ e("span", { className: "truncate", children:
|
|
670
|
-
/* @__PURE__ */ e(
|
|
681
|
+
/* @__PURE__ */ e("span", { className: "truncate", children: N ? ((I = u.find((m) => m.id === N)) == null ? void 0 : I.label) ?? N : "All states" }),
|
|
682
|
+
/* @__PURE__ */ e(oe, { className: "h-3.5 w-3.5 shrink-0 text-slate-400" })
|
|
671
683
|
]
|
|
672
684
|
}
|
|
673
685
|
) }),
|
|
674
|
-
/* @__PURE__ */ e(
|
|
675
|
-
var
|
|
676
|
-
const
|
|
686
|
+
/* @__PURE__ */ e(Oe, { align: "start", sideOffset: 4, className: "w-52 p-1", children: ["", ...u.map((m) => m.id)].map((m) => {
|
|
687
|
+
var z;
|
|
688
|
+
const H = m === "" ? "All states" : ((z = u.find((Q) => Q.id === m)) == null ? void 0 : z.label) ?? m;
|
|
677
689
|
return /* @__PURE__ */ e(
|
|
678
690
|
"button",
|
|
679
691
|
{
|
|
680
692
|
type: "button",
|
|
681
|
-
className:
|
|
693
|
+
className: pe(
|
|
682
694
|
"flex w-full rounded px-2.5 py-1.5 text-left text-[13px] transition-colors hover:bg-slate-50 dark:hover:bg-white/5",
|
|
683
|
-
|
|
695
|
+
N === m && "font-medium text-slate-800 dark:text-slate-200"
|
|
684
696
|
),
|
|
685
697
|
onClick: () => {
|
|
686
|
-
|
|
698
|
+
q(m), k(!1);
|
|
687
699
|
},
|
|
688
|
-
children:
|
|
700
|
+
children: H
|
|
689
701
|
},
|
|
690
|
-
|
|
702
|
+
m
|
|
691
703
|
);
|
|
692
704
|
}) })
|
|
693
705
|
] }),
|
|
694
706
|
/* @__PURE__ */ n("div", { className: "flex items-center justify-end gap-2 pt-0.5", children: [
|
|
695
707
|
/* @__PURE__ */ e(
|
|
696
|
-
|
|
708
|
+
V,
|
|
697
709
|
{
|
|
698
710
|
type: "button",
|
|
699
711
|
size: "sm",
|
|
700
712
|
variant: "ghost",
|
|
701
713
|
className: "h-7 text-[12px]",
|
|
702
714
|
onClick: () => {
|
|
703
|
-
|
|
715
|
+
T(!1), h(""), q("");
|
|
704
716
|
},
|
|
705
717
|
children: "Cancel"
|
|
706
718
|
}
|
|
707
719
|
),
|
|
708
720
|
/* @__PURE__ */ e(
|
|
709
|
-
|
|
721
|
+
V,
|
|
710
722
|
{
|
|
711
723
|
type: "button",
|
|
712
724
|
size: "sm",
|
|
713
725
|
className: "h-7 text-[12px]",
|
|
714
|
-
disabled: !
|
|
715
|
-
onClick: () =>
|
|
716
|
-
children:
|
|
726
|
+
disabled: !P || A.isPending,
|
|
727
|
+
onClick: () => A.mutate(),
|
|
728
|
+
children: A.isPending ? /* @__PURE__ */ e(te, { className: "h-3.5 w-3.5 animate-spin" }) : "Add"
|
|
717
729
|
}
|
|
718
730
|
)
|
|
719
731
|
] })
|
|
@@ -728,99 +740,99 @@ const Xe = {
|
|
|
728
740
|
function Mt({
|
|
729
741
|
collection: r,
|
|
730
742
|
item: t,
|
|
731
|
-
states:
|
|
732
|
-
currentStateId:
|
|
743
|
+
states: u,
|
|
744
|
+
currentStateId: i
|
|
733
745
|
}) {
|
|
734
|
-
const
|
|
746
|
+
const C = ce(), [p, x] = U(!1), { data: b, isLoading: T } = Z({
|
|
735
747
|
queryKey: ["pipeline-all-owners", r, t],
|
|
736
|
-
queryFn: () =>
|
|
737
|
-
|
|
738
|
-
).then((
|
|
739
|
-
enabled:
|
|
748
|
+
queryFn: () => C.request(
|
|
749
|
+
Y(`/pipelines/instance/${r}/${t}/owners/all`)
|
|
750
|
+
).then((h) => h.data ?? null),
|
|
751
|
+
enabled: p,
|
|
740
752
|
staleTime: 3e4
|
|
741
|
-
}),
|
|
742
|
-
var
|
|
743
|
-
return !b || ((
|
|
744
|
-
}).sort((
|
|
745
|
-
return /* @__PURE__ */ n(
|
|
746
|
-
/* @__PURE__ */ e(
|
|
753
|
+
}), P = [...u].filter((h) => {
|
|
754
|
+
var N;
|
|
755
|
+
return !b || ((N = b[h.id]) == null ? void 0 : N.on_path) !== !1;
|
|
756
|
+
}).sort((h, N) => h.sort - N.sort);
|
|
757
|
+
return /* @__PURE__ */ n(Re, { open: p, onOpenChange: x, children: [
|
|
758
|
+
/* @__PURE__ */ e(je, { asChild: !0, children: /* @__PURE__ */ e(
|
|
747
759
|
"button",
|
|
748
760
|
{
|
|
749
761
|
type: "button",
|
|
750
762
|
title: "View approval chain",
|
|
751
763
|
className: "flex h-6 w-6 items-center justify-center rounded text-slate-400 transition-colors hover:bg-slate-100 hover:text-slate-600 dark:hover:bg-muted dark:hover:text-slate-300",
|
|
752
|
-
onClick: (
|
|
764
|
+
onClick: (h) => h.stopPropagation(),
|
|
753
765
|
children: /* @__PURE__ */ e(Ge, { className: "h-3.5 w-3.5" })
|
|
754
766
|
}
|
|
755
767
|
) }),
|
|
756
|
-
/* @__PURE__ */ n(
|
|
768
|
+
/* @__PURE__ */ n(Oe, { align: "end", sideOffset: 6, className: "w-[576px] p-0 overflow-hidden", children: [
|
|
757
769
|
/* @__PURE__ */ n("div", { className: "border-b border-slate-100 px-4 py-3", children: [
|
|
758
770
|
/* @__PURE__ */ e("p", { className: "text-[12px] font-semibold text-slate-700", children: "Approval Chain" }),
|
|
759
771
|
/* @__PURE__ */ e("p", { className: "text-[11px] text-slate-400 mt-0.5", children: "Owners per pipeline state" })
|
|
760
772
|
] }),
|
|
761
|
-
/* @__PURE__ */ e("div", { className: "max-h-[504px] overflow-y-auto", children:
|
|
762
|
-
var
|
|
763
|
-
const
|
|
764
|
-
id:
|
|
765
|
-
name: [
|
|
766
|
-
})),
|
|
773
|
+
/* @__PURE__ */ e("div", { className: "max-h-[504px] overflow-y-auto", children: T ? /* @__PURE__ */ e("div", { className: "space-y-px p-3", children: [1, 2, 3].map((h) => /* @__PURE__ */ e(ne, { className: "h-10 w-full" }, h)) }) : b ? /* @__PURE__ */ e("div", { className: "divide-y divide-slate-100 dark:divide-border/60", children: P.map((h) => {
|
|
774
|
+
var w, E, l, v, c;
|
|
775
|
+
const N = (((w = b[h.id]) == null ? void 0 : w.owners) ?? []).map((o) => ({
|
|
776
|
+
id: o.id,
|
|
777
|
+
name: [o.first_name, o.last_name].filter(Boolean).join(" ") || o.email
|
|
778
|
+
})), q = h.id === i, F = ((E = b[h.id]) == null ? void 0 : E.skipped) === !0 && !q, k = (((l = b[h.id]) == null ? void 0 : l.skip_reasons) ?? []).filter(Boolean), $ = ((v = b[h.id]) == null ? void 0 : v.unavailable) ?? [], D = ((c = b[h.id]) == null ? void 0 : c.blocked) === !0 && !F;
|
|
767
779
|
return /* @__PURE__ */ n(
|
|
768
780
|
"div",
|
|
769
781
|
{
|
|
770
|
-
className:
|
|
782
|
+
className: pe(
|
|
771
783
|
"flex items-center gap-3 px-4 py-2.5",
|
|
772
784
|
// Hex-with-alpha rather than bg-nvr-cyan/N — the
|
|
773
785
|
// nvr-cyan token is an opaque var() so Tailwind silently
|
|
774
786
|
// drops opacity modifiers on it. Kept very light so the
|
|
775
787
|
// tint doesn't clash with the state badge's own color.
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
788
|
+
q && "bg-nvr-cyan/[0.06] dark:bg-nvr-cyan/[0.11]",
|
|
789
|
+
F && "opacity-60",
|
|
790
|
+
D && "bg-red-50 dark:bg-red-500/10"
|
|
779
791
|
),
|
|
780
|
-
"data-chain-blocked":
|
|
792
|
+
"data-chain-blocked": D ? "" : void 0,
|
|
781
793
|
children: [
|
|
782
|
-
/* @__PURE__ */ e(
|
|
783
|
-
/* @__PURE__ */ e("div", { className: "flex min-w-0 flex-1 flex-wrap items-center gap-x-2 gap-y-0.5", children:
|
|
794
|
+
/* @__PURE__ */ e(re, { label: h.label, color: h.color, small: !0 }),
|
|
795
|
+
/* @__PURE__ */ e("div", { className: "flex min-w-0 flex-1 flex-wrap items-center gap-x-2 gap-y-0.5", children: F ? (
|
|
784
796
|
// Radix tooltip with zero delay — native `title` waits on
|
|
785
797
|
// the OS hover timer, and a truncated reason needs its
|
|
786
798
|
// full text the moment the cursor lands on it.
|
|
787
|
-
/* @__PURE__ */ e(it, { delayDuration: 0, children: /* @__PURE__ */ n(
|
|
788
|
-
/* @__PURE__ */ e(
|
|
799
|
+
/* @__PURE__ */ e(it, { delayDuration: 0, children: /* @__PURE__ */ n(Se, { children: [
|
|
800
|
+
/* @__PURE__ */ e($e, { asChild: !0, children: /* @__PURE__ */ n("div", { className: "flex min-w-0 flex-1 cursor-default items-center gap-2", children: [
|
|
789
801
|
/* @__PURE__ */ e("span", { className: "inline-flex shrink-0 items-center gap-1 rounded-full border border-dashed border-slate-300 px-2 py-0.5 text-[10.5px] font-medium text-slate-400 dark:border-slate-600 dark:text-slate-500", children: "Skipped" }),
|
|
790
|
-
|
|
802
|
+
k.length > 0 && /* @__PURE__ */ e("span", { className: "min-w-0 flex-1 truncate text-[11px] text-slate-400 dark:text-slate-500", children: k.join(" · ") })
|
|
791
803
|
] }) }),
|
|
792
804
|
/* @__PURE__ */ n(
|
|
793
|
-
|
|
805
|
+
qe,
|
|
794
806
|
{
|
|
795
807
|
side: "bottom",
|
|
796
808
|
align: "start",
|
|
797
809
|
className: "max-w-[420px] space-y-0.5 text-[11.5px] leading-snug",
|
|
798
810
|
children: [
|
|
799
811
|
/* @__PURE__ */ e("p", { className: "text-slate-500 dark:text-slate-400", children: "The pipeline will pass through this state without stopping:" }),
|
|
800
|
-
|
|
812
|
+
k.length > 0 ? k.map((o) => /* @__PURE__ */ e("p", { children: o }, o)) : /* @__PURE__ */ e("p", { children: "Skip criteria currently match" })
|
|
801
813
|
]
|
|
802
814
|
}
|
|
803
815
|
)
|
|
804
816
|
] }) })
|
|
805
|
-
) : /* @__PURE__ */ n(
|
|
806
|
-
/* @__PURE__ */ e(
|
|
807
|
-
|
|
817
|
+
) : /* @__PURE__ */ n(ae, { children: [
|
|
818
|
+
/* @__PURE__ */ e(Ct, { owners: N, max: 10, emptyLabel: "—" }),
|
|
819
|
+
$.map((o) => /* @__PURE__ */ n(
|
|
808
820
|
"span",
|
|
809
821
|
{
|
|
810
|
-
"data-tip": `${
|
|
811
|
-
className:
|
|
822
|
+
"data-tip": `${o.name} is ${Xe[o.reason] ?? o.reason}${o.delegate ? ` — ${o.delegate.name} covers${o.delegate.expires_at ? ` until ${new Date(o.delegate.expires_at).toLocaleDateString()}` : ""}` : " and nobody is covering"}`,
|
|
823
|
+
className: pe(
|
|
812
824
|
"inline-flex items-center gap-1 rounded-full border px-1.5 py-0.5 text-[10.5px] font-medium",
|
|
813
|
-
|
|
825
|
+
o.delegate ? "border-amber-200 bg-amber-50 text-amber-800 dark:border-amber-500/30 dark:bg-amber-500/10 dark:text-amber-200" : "border-red-200 bg-red-50 text-red-700 dark:border-red-500/30 dark:bg-red-500/10 dark:text-red-300"
|
|
814
826
|
),
|
|
815
827
|
children: [
|
|
816
|
-
|
|
817
|
-
|
|
828
|
+
o.name,
|
|
829
|
+
o.delegate ? /* @__PURE__ */ n(ae, { children: [
|
|
818
830
|
" → ",
|
|
819
|
-
|
|
820
|
-
|
|
831
|
+
o.delegate.name,
|
|
832
|
+
o.delegate.expires_at && /* @__PURE__ */ n("span", { className: "opacity-70", children: [
|
|
821
833
|
", until",
|
|
822
834
|
" ",
|
|
823
|
-
new Date(
|
|
835
|
+
new Date(o.delegate.expires_at).toLocaleDateString(
|
|
824
836
|
void 0,
|
|
825
837
|
{
|
|
826
838
|
month: "short",
|
|
@@ -831,17 +843,17 @@ function Mt({
|
|
|
831
843
|
] }) : /* @__PURE__ */ n("span", { className: "opacity-80", children: [
|
|
832
844
|
" ",
|
|
833
845
|
"· ",
|
|
834
|
-
Xe[
|
|
846
|
+
Xe[o.reason] ?? o.reason
|
|
835
847
|
] })
|
|
836
848
|
]
|
|
837
849
|
},
|
|
838
|
-
|
|
850
|
+
o.id
|
|
839
851
|
)),
|
|
840
|
-
|
|
852
|
+
D && /* @__PURE__ */ e("span", { className: "inline-flex items-center gap-1 rounded-full bg-red-600 px-2 py-0.5 text-[10.5px] font-semibold text-white", children: "No one can act here" })
|
|
841
853
|
] }) })
|
|
842
854
|
]
|
|
843
855
|
},
|
|
844
|
-
|
|
856
|
+
h.id
|
|
845
857
|
);
|
|
846
858
|
}) }) : /* @__PURE__ */ e("p", { className: "px-4 py-3 text-[12px] text-slate-400", children: "No pipeline configured." }) })
|
|
847
859
|
] })
|
|
@@ -850,45 +862,45 @@ function Mt({
|
|
|
850
862
|
function mn({
|
|
851
863
|
collection: r,
|
|
852
864
|
item: t,
|
|
853
|
-
defaultExpanded:
|
|
854
|
-
title:
|
|
855
|
-
showApprovalChain:
|
|
856
|
-
hideActionsCollapsed:
|
|
865
|
+
defaultExpanded: u,
|
|
866
|
+
title: i,
|
|
867
|
+
showApprovalChain: C,
|
|
868
|
+
hideActionsCollapsed: p,
|
|
857
869
|
hideActionsExpanded: x,
|
|
858
870
|
onBeforeTransition: b,
|
|
859
|
-
addendumPending:
|
|
860
|
-
addendumView:
|
|
861
|
-
asRole:
|
|
871
|
+
addendumPending: T,
|
|
872
|
+
addendumView: P,
|
|
873
|
+
asRole: h
|
|
862
874
|
}) {
|
|
863
875
|
return t === "new" ? null : /* @__PURE__ */ e(
|
|
864
876
|
Bt,
|
|
865
877
|
{
|
|
866
878
|
collection: r,
|
|
867
879
|
item: t,
|
|
868
|
-
defaultExpanded:
|
|
869
|
-
title:
|
|
870
|
-
showApprovalChain:
|
|
871
|
-
hideActionsCollapsed:
|
|
880
|
+
defaultExpanded: u,
|
|
881
|
+
title: i,
|
|
882
|
+
showApprovalChain: C,
|
|
883
|
+
hideActionsCollapsed: p,
|
|
872
884
|
hideActionsExpanded: x,
|
|
873
885
|
onBeforeTransition: b,
|
|
874
|
-
addendumPending:
|
|
875
|
-
addendumView:
|
|
876
|
-
asRole:
|
|
886
|
+
addendumPending: T,
|
|
887
|
+
addendumView: P,
|
|
888
|
+
asRole: h
|
|
877
889
|
},
|
|
878
890
|
`${r}:${t}`
|
|
879
891
|
);
|
|
880
892
|
}
|
|
881
893
|
function ut({ collection: r, item: t }) {
|
|
882
|
-
const
|
|
894
|
+
const u = ce(), { data: i } = Z({
|
|
883
895
|
queryKey: ["approval-brief", r, String(t)],
|
|
884
|
-
queryFn: () =>
|
|
896
|
+
queryFn: () => u.request(Y(`/pipelines/instance/${r}/${t}/approval-brief`)).then((p) => p.data),
|
|
885
897
|
staleTime: 3e4,
|
|
886
898
|
retry: !1
|
|
887
899
|
});
|
|
888
|
-
if (!
|
|
889
|
-
const
|
|
890
|
-
if (
|
|
891
|
-
const x = String(
|
|
900
|
+
if (!i) return null;
|
|
901
|
+
const C = (p) => {
|
|
902
|
+
if (p == null || p === "") return "—";
|
|
903
|
+
const x = String(p);
|
|
892
904
|
return x.length > 36 ? `${x.slice(0, 36)}…` : x;
|
|
893
905
|
};
|
|
894
906
|
return /* @__PURE__ */ n("div", { className: "rounded-md border border-slate-200 bg-white px-3 py-2 text-[11.5px] dark:border-border dark:bg-card", children: [
|
|
@@ -896,117 +908,117 @@ function ut({ collection: r, item: t }) {
|
|
|
896
908
|
/* @__PURE__ */ e("span", { className: "font-medium text-slate-700 dark:text-foreground", children: "Since entering this state" }),
|
|
897
909
|
" ",
|
|
898
910
|
"(",
|
|
899
|
-
|
|
911
|
+
i.days_in_state,
|
|
900
912
|
"d ago):",
|
|
901
913
|
" ",
|
|
902
|
-
|
|
903
|
-
|
|
904
|
-
|
|
914
|
+
i.changed_total === 0 && i.comments === 0 && i.addendums.count === 0 ? /* @__PURE__ */ e("span", { children: "no changes to this record." }) : /* @__PURE__ */ n(ae, { children: [
|
|
915
|
+
i.changed_total > 0 && /* @__PURE__ */ n("span", { children: [
|
|
916
|
+
i.changed_total,
|
|
905
917
|
" field",
|
|
906
|
-
|
|
918
|
+
i.changed_total === 1 ? "" : "s",
|
|
907
919
|
" changed",
|
|
908
|
-
|
|
920
|
+
i.edited_by.length > 0 ? ` by ${i.edited_by.join(", ")}` : ""
|
|
909
921
|
] }),
|
|
910
|
-
|
|
911
|
-
|
|
912
|
-
|
|
922
|
+
i.comments > 0 && /* @__PURE__ */ n("span", { children: [
|
|
923
|
+
i.changed_total > 0 ? " · " : "",
|
|
924
|
+
i.comments,
|
|
913
925
|
" comment",
|
|
914
|
-
|
|
926
|
+
i.comments === 1 ? "" : "s"
|
|
915
927
|
] }),
|
|
916
|
-
|
|
928
|
+
i.addendums.count > 0 && /* @__PURE__ */ n("span", { children: [
|
|
917
929
|
" · ",
|
|
918
|
-
|
|
930
|
+
i.addendums.count,
|
|
919
931
|
" addendum",
|
|
920
|
-
|
|
921
|
-
|
|
932
|
+
i.addendums.count === 1 ? "" : "s",
|
|
933
|
+
i.addendums.cost_impact !== 0 ? ` (${i.addendums.cost_impact > 0 ? "+" : ""}$${Math.abs(i.addendums.cost_impact).toLocaleString()})` : ""
|
|
922
934
|
] })
|
|
923
935
|
] })
|
|
924
936
|
] }),
|
|
925
|
-
|
|
926
|
-
|
|
937
|
+
i.field_changes.length > 0 && /* @__PURE__ */ n("div", { className: "mt-1 space-y-0.5", children: [
|
|
938
|
+
i.field_changes.slice(0, 5).map((p) => /* @__PURE__ */ n(
|
|
927
939
|
"p",
|
|
928
940
|
{
|
|
929
941
|
className: "font-mono text-[10.5px] text-slate-500 dark:text-muted-foreground",
|
|
930
942
|
children: [
|
|
931
|
-
|
|
943
|
+
p.field,
|
|
932
944
|
":",
|
|
933
945
|
" ",
|
|
934
|
-
|
|
935
|
-
/* @__PURE__ */ e("span", { className: "text-red-600 line-through dark:text-red-400", children:
|
|
946
|
+
p.old !== void 0 && /* @__PURE__ */ n(ae, { children: [
|
|
947
|
+
/* @__PURE__ */ e("span", { className: "text-red-600 line-through dark:text-red-400", children: C(p.old) }),
|
|
936
948
|
" "
|
|
937
949
|
] }),
|
|
938
|
-
/* @__PURE__ */ e("span", { className: "text-emerald-600 dark:text-emerald-400", children:
|
|
950
|
+
/* @__PURE__ */ e("span", { className: "text-emerald-600 dark:text-emerald-400", children: C(p.new) })
|
|
939
951
|
]
|
|
940
952
|
},
|
|
941
|
-
|
|
953
|
+
p.field
|
|
942
954
|
)),
|
|
943
|
-
|
|
955
|
+
i.field_changes.length > 5 && /* @__PURE__ */ n("p", { className: "text-[10.5px] text-slate-400", children: [
|
|
944
956
|
"+",
|
|
945
|
-
|
|
957
|
+
i.field_changes.length - 5,
|
|
946
958
|
" more — see History for the full trail"
|
|
947
959
|
] })
|
|
948
960
|
] }),
|
|
949
|
-
(
|
|
961
|
+
(i.lines ?? []).map((p) => /* @__PURE__ */ n(
|
|
950
962
|
"p",
|
|
951
963
|
{
|
|
952
|
-
"data-brief-line":
|
|
964
|
+
"data-brief-line": p.label,
|
|
953
965
|
className: "mt-1 text-slate-500 dark:text-muted-foreground",
|
|
954
966
|
children: [
|
|
955
|
-
/* @__PURE__ */ e("span", { className: "font-medium text-slate-700 dark:text-foreground", children:
|
|
967
|
+
/* @__PURE__ */ e("span", { className: "font-medium text-slate-700 dark:text-foreground", children: p.label }),
|
|
956
968
|
" ",
|
|
957
969
|
/* @__PURE__ */ e(
|
|
958
970
|
"span",
|
|
959
971
|
{
|
|
960
|
-
className:
|
|
961
|
-
children:
|
|
972
|
+
className: p.tone === "danger" ? "text-red-700 dark:text-red-300" : p.tone === "warn" ? "text-amber-700 dark:text-amber-300" : "",
|
|
973
|
+
children: p.text
|
|
962
974
|
}
|
|
963
975
|
)
|
|
964
976
|
]
|
|
965
977
|
},
|
|
966
|
-
`${
|
|
978
|
+
`${p.label}:${p.text}`
|
|
967
979
|
))
|
|
968
980
|
] });
|
|
969
981
|
}
|
|
970
982
|
function Bt({
|
|
971
983
|
collection: r,
|
|
972
984
|
item: t,
|
|
973
|
-
defaultExpanded:
|
|
974
|
-
title:
|
|
975
|
-
showApprovalChain:
|
|
976
|
-
hideActionsCollapsed:
|
|
985
|
+
defaultExpanded: u,
|
|
986
|
+
title: i,
|
|
987
|
+
showApprovalChain: C,
|
|
988
|
+
hideActionsCollapsed: p,
|
|
977
989
|
hideActionsExpanded: x,
|
|
978
990
|
onBeforeTransition: b,
|
|
979
|
-
addendumPending:
|
|
980
|
-
addendumView:
|
|
981
|
-
asRole:
|
|
991
|
+
addendumPending: T,
|
|
992
|
+
addendumView: P,
|
|
993
|
+
asRole: h
|
|
982
994
|
}) {
|
|
983
995
|
var Be, Ee, Ie;
|
|
984
|
-
const
|
|
985
|
-
et(r, t, "transition",
|
|
986
|
-
const
|
|
987
|
-
|
|
988
|
-
!
|
|
989
|
-
}, [
|
|
990
|
-
const
|
|
991
|
-
if (
|
|
992
|
-
|
|
996
|
+
const N = ce(), q = De(), [F, k] = U(""), [$, D] = U(null), [w, E] = U(!1), [l, v] = U(!1), [c, o] = U(null);
|
|
997
|
+
et(r, t, "transition", !!$ || !!c);
|
|
998
|
+
const g = wt(r, t, "transition"), f = se(!1);
|
|
999
|
+
de(() => {
|
|
1000
|
+
!f.current && u !== void 0 && (f.current = !0, v(u));
|
|
1001
|
+
}, [u]);
|
|
1002
|
+
const y = async (d) => {
|
|
1003
|
+
if ($ === d) {
|
|
1004
|
+
D(null);
|
|
993
1005
|
return;
|
|
994
1006
|
}
|
|
995
1007
|
if (b && !await b()) return;
|
|
996
|
-
const
|
|
1008
|
+
const _ = (z ?? []).find((O) => O.id === d), L = String((_ == null ? void 0 : _.comment_mode) ?? "none");
|
|
997
1009
|
if (L !== "optional" && L !== "required") {
|
|
998
|
-
|
|
1010
|
+
I.mutate({ transition_id: d });
|
|
999
1011
|
return;
|
|
1000
1012
|
}
|
|
1001
|
-
|
|
1002
|
-
}, s =
|
|
1013
|
+
D(d);
|
|
1014
|
+
}, s = h ? ["pipeline-instance", r, t, h] : ["pipeline-instance", r, t], { data: a, isLoading: A } = Z({
|
|
1003
1015
|
queryKey: s,
|
|
1004
|
-
queryFn: () =>
|
|
1005
|
-
|
|
1006
|
-
`/pipelines/instance/${r}/${t}${
|
|
1016
|
+
queryFn: () => N.request(
|
|
1017
|
+
Y(
|
|
1018
|
+
`/pipelines/instance/${r}/${t}${h ? `?as_role=${encodeURIComponent(h)}` : ""}`
|
|
1007
1019
|
)
|
|
1008
1020
|
).then(
|
|
1009
|
-
(
|
|
1021
|
+
(d) => d.data ?? {
|
|
1010
1022
|
instance: null,
|
|
1011
1023
|
states: [],
|
|
1012
1024
|
available_transitions: [],
|
|
@@ -1017,176 +1029,176 @@ function Bt({
|
|
|
1017
1029
|
),
|
|
1018
1030
|
staleTime: 1e4
|
|
1019
1031
|
});
|
|
1020
|
-
|
|
1021
|
-
() =>
|
|
1022
|
-
if (
|
|
1023
|
-
const
|
|
1024
|
-
Array.isArray(
|
|
1032
|
+
de(
|
|
1033
|
+
() => q.getQueryCache().subscribe((d) => {
|
|
1034
|
+
if (d.type !== "updated" || d.action.type !== "success") return;
|
|
1035
|
+
const _ = d.query.queryKey;
|
|
1036
|
+
Array.isArray(_) && _[0] === "item" && _[1] === r && String(_[2]) === t && q.invalidateQueries({ queryKey: ["pipeline-instance", r, t] });
|
|
1025
1037
|
}),
|
|
1026
|
-
[
|
|
1038
|
+
[q, r, t]
|
|
1027
1039
|
);
|
|
1028
|
-
const { data:
|
|
1040
|
+
const { data: M, isLoading: ee } = Z({
|
|
1029
1041
|
queryKey: ["pipeline-all-owners", r, t],
|
|
1030
|
-
queryFn: () =>
|
|
1031
|
-
|
|
1032
|
-
).then((
|
|
1033
|
-
enabled:
|
|
1042
|
+
queryFn: () => N.request(
|
|
1043
|
+
Y(`/pipelines/instance/${r}/${t}/owners/all`)
|
|
1044
|
+
).then((d) => d.data ?? null),
|
|
1045
|
+
enabled: l && !!(a != null && a.instance),
|
|
1034
1046
|
staleTime: 3e4
|
|
1035
|
-
}),
|
|
1036
|
-
if (!
|
|
1037
|
-
const
|
|
1038
|
-
return
|
|
1039
|
-
}, [
|
|
1040
|
-
if (!
|
|
1041
|
-
const
|
|
1042
|
-
for (const [
|
|
1043
|
-
L.skipped &&
|
|
1044
|
-
return
|
|
1045
|
-
}, [
|
|
1046
|
-
mutationFn: () =>
|
|
1047
|
+
}), R = He(() => {
|
|
1048
|
+
if (!M) return null;
|
|
1049
|
+
const d = Object.entries(M);
|
|
1050
|
+
return d.length === 0 || d.every(([, _]) => _.on_path === void 0) ? null : new Set(d.filter(([, _]) => _.on_path !== !1).map(([_]) => _));
|
|
1051
|
+
}, [M]), S = He(() => {
|
|
1052
|
+
if (!M) return null;
|
|
1053
|
+
const d = /* @__PURE__ */ new Map();
|
|
1054
|
+
for (const [_, L] of Object.entries(M))
|
|
1055
|
+
L.skipped && d.set(_, L.skip_reasons ?? []);
|
|
1056
|
+
return d;
|
|
1057
|
+
}, [M]), B = ue({
|
|
1058
|
+
mutationFn: () => N.request(be(`/pipelines/instance/${r}/${t}/start`, {})),
|
|
1047
1059
|
onSuccess: () => {
|
|
1048
|
-
|
|
1060
|
+
q.invalidateQueries({ queryKey: s }), X.success("Pipeline started");
|
|
1049
1061
|
},
|
|
1050
|
-
onError: () =>
|
|
1051
|
-
}),
|
|
1062
|
+
onError: () => X.error("Failed to start pipeline")
|
|
1063
|
+
}), I = ue({
|
|
1052
1064
|
mutationFn: ({
|
|
1053
|
-
transition_id:
|
|
1054
|
-
comment:
|
|
1065
|
+
transition_id: d,
|
|
1066
|
+
comment: _,
|
|
1055
1067
|
reviewed: L
|
|
1056
|
-
}) =>
|
|
1057
|
-
|
|
1058
|
-
transition_id:
|
|
1059
|
-
comment:
|
|
1068
|
+
}) => N.request(
|
|
1069
|
+
be(`/pipelines/instance/${r}/${t}/transition`, {
|
|
1070
|
+
transition_id: d,
|
|
1071
|
+
comment: _,
|
|
1060
1072
|
...L ? { reviewed: !0 } : {}
|
|
1061
1073
|
})
|
|
1062
1074
|
),
|
|
1063
1075
|
onSuccess: () => {
|
|
1064
|
-
|
|
1076
|
+
q.invalidateQueries({ queryKey: s }), r === "nivaro_addendums" && q.invalidateQueries({ queryKey: ["addendums"] }), ye(q, r, String(t)), we(q, r, String(t)), k(""), D(null), o(null), X.success("Transition executed");
|
|
1065
1077
|
},
|
|
1066
|
-
onError: (
|
|
1067
|
-
var
|
|
1068
|
-
const L = mt(
|
|
1078
|
+
onError: (d, _) => {
|
|
1079
|
+
var W;
|
|
1080
|
+
const L = mt(d);
|
|
1069
1081
|
if (L) {
|
|
1070
|
-
|
|
1082
|
+
o((G) => ({
|
|
1071
1083
|
payload: L,
|
|
1072
|
-
transitionId:
|
|
1073
|
-
comment:
|
|
1074
|
-
revision: ((
|
|
1084
|
+
transitionId: _.transition_id,
|
|
1085
|
+
comment: _.comment,
|
|
1086
|
+
revision: ((G == null ? void 0 : G.revision) ?? 0) + 1
|
|
1075
1087
|
}));
|
|
1076
1088
|
return;
|
|
1077
1089
|
}
|
|
1078
|
-
const
|
|
1079
|
-
|
|
1090
|
+
const O = d == null ? void 0 : d.response;
|
|
1091
|
+
X.error((O == null ? void 0 : O.error) ?? ((W = O == null ? void 0 : O.data) == null ? void 0 : W.error) ?? "Failed to execute transition", {
|
|
1080
1092
|
duration: 12e3,
|
|
1081
1093
|
// #1867: a refusal carries "Why?" — the role, owner or access rule
|
|
1082
1094
|
// that stopped it, and who can change it.
|
|
1083
|
-
...lt(
|
|
1084
|
-
action: ot(
|
|
1095
|
+
...lt(d) ? {
|
|
1096
|
+
action: ot(N, {
|
|
1085
1097
|
collection: r,
|
|
1086
1098
|
itemId: String(t),
|
|
1087
1099
|
action: "transition",
|
|
1088
|
-
transitionId:
|
|
1100
|
+
transitionId: _.transition_id
|
|
1089
1101
|
})
|
|
1090
1102
|
} : {}
|
|
1091
|
-
}),
|
|
1103
|
+
}), o(null), D(null), ye(q, r, String(t)), we(q, r, String(t)), (O == null ? void 0 : O.status) === 409 && q.invalidateQueries({ queryKey: s });
|
|
1092
1104
|
}
|
|
1093
|
-
}),
|
|
1094
|
-
|
|
1095
|
-
const
|
|
1096
|
-
if (
|
|
1097
|
-
const
|
|
1098
|
-
const L =
|
|
1105
|
+
}), m = se(y);
|
|
1106
|
+
m.current = y;
|
|
1107
|
+
const H = se((a == null ? void 0 : a.available_transitions) ?? []);
|
|
1108
|
+
if (H.current = (a == null ? void 0 : a.available_transitions) ?? [], de(() => {
|
|
1109
|
+
const d = (_) => {
|
|
1110
|
+
const L = _.detail;
|
|
1099
1111
|
if (!L || L.claimed || L.collection !== r || String(L.item) !== String(t)) return;
|
|
1100
1112
|
L.claimed = !0;
|
|
1101
|
-
const
|
|
1102
|
-
if (!
|
|
1103
|
-
|
|
1113
|
+
const O = String(L.transition_id).toUpperCase(), W = H.current.find((G) => String(G.id).toUpperCase() === O);
|
|
1114
|
+
if (!W) {
|
|
1115
|
+
X.error("That step is not available from where the record is now");
|
|
1104
1116
|
return;
|
|
1105
1117
|
}
|
|
1106
|
-
|
|
1118
|
+
m.current(W.id);
|
|
1107
1119
|
};
|
|
1108
|
-
return window.addEventListener(
|
|
1109
|
-
}, [r, t]),
|
|
1120
|
+
return window.addEventListener(ge, d), () => window.removeEventListener(ge, d);
|
|
1121
|
+
}, [r, t]), A)
|
|
1110
1122
|
return /* @__PURE__ */ e("div", { className: "overflow-hidden rounded-xl border border-slate-200 bg-white dark:border-border dark:bg-card", children: /* @__PURE__ */ n("div", { className: "flex w-full items-center gap-2.5 px-5 py-3.5", children: [
|
|
1111
|
-
/* @__PURE__ */ e(
|
|
1112
|
-
/* @__PURE__ */ e(
|
|
1113
|
-
/* @__PURE__ */ e(
|
|
1114
|
-
/* @__PURE__ */ e(
|
|
1123
|
+
/* @__PURE__ */ e(ne, { className: "h-3.5 w-3.5 shrink-0 rounded" }),
|
|
1124
|
+
/* @__PURE__ */ e(ne, { className: "h-4 w-20" }),
|
|
1125
|
+
/* @__PURE__ */ e(ne, { className: "h-[22px] w-40 rounded-full" }),
|
|
1126
|
+
/* @__PURE__ */ e(ne, { className: "ml-auto h-3.5 w-3.5 rounded" })
|
|
1115
1127
|
] }) });
|
|
1116
1128
|
if (!(a != null && a.binding)) return null;
|
|
1117
|
-
const { instance:
|
|
1118
|
-
(
|
|
1119
|
-
) : null,
|
|
1129
|
+
const { instance: j, available_transitions: z, history: Q, states: me } = a, fe = new Map((me ?? []).map((d) => [d.id, d])), ie = (j == null ? void 0 : j.current_state_obj) ?? null, J = $ ? (z ?? []).find((d) => d.id === $) : null, Ne = J ? fe.get(J.to_state) : null, pt = j != null && j.completed_at && z ? z.filter(
|
|
1130
|
+
(d) => d.from_state && String(d.from_state).toUpperCase() === String(j.current_state).toUpperCase()
|
|
1131
|
+
) : null, ke = j != null && j.completed_at ? pt ?? [] : z ?? [], Le = ke.length > 0, Fe = (d, _ = !1) => {
|
|
1120
1132
|
const L = /* @__PURE__ */ new Map();
|
|
1121
|
-
for (const
|
|
1122
|
-
const
|
|
1123
|
-
|
|
1133
|
+
for (const O of d) {
|
|
1134
|
+
const W = L.get(O.label) ?? [];
|
|
1135
|
+
W.push(O), L.set(O.label, W);
|
|
1124
1136
|
}
|
|
1125
|
-
return Array.from(L.entries()).map(([
|
|
1137
|
+
return Array.from(L.entries()).map(([O, W]) => {
|
|
1126
1138
|
var ze, Ke;
|
|
1127
|
-
const
|
|
1128
|
-
if (
|
|
1129
|
-
const
|
|
1139
|
+
const G = ((ze = W[0]) == null ? void 0 : ze.color) ?? null, he = W.some((K) => K.id === $), Ue = (K) => G ? K ? { backgroundColor: G, borderColor: G } : { borderColor: G, color: G } : void 0;
|
|
1140
|
+
if (W.length === 1) {
|
|
1141
|
+
const K = W[0], le = I.isPending && ((Ke = I.variables) == null ? void 0 : Ke.transition_id) === K.id;
|
|
1130
1142
|
return /* @__PURE__ */ n(
|
|
1131
|
-
|
|
1143
|
+
V,
|
|
1132
1144
|
{
|
|
1133
1145
|
size: "sm",
|
|
1134
|
-
variant:
|
|
1135
|
-
className: `${
|
|
1136
|
-
style: Ue(
|
|
1137
|
-
disabled:
|
|
1138
|
-
onClick: () =>
|
|
1146
|
+
variant: he ? "default" : "outline",
|
|
1147
|
+
className: `${_ ? "h-7 text-[11px]" : "text-[12px]"} gap-1.5`,
|
|
1148
|
+
style: Ue(he),
|
|
1149
|
+
disabled: I.isPending,
|
|
1150
|
+
onClick: () => y(K.id),
|
|
1139
1151
|
children: [
|
|
1140
|
-
|
|
1141
|
-
|
|
1152
|
+
le && /* @__PURE__ */ e(te, { className: "h-3 w-3 animate-spin" }),
|
|
1153
|
+
O
|
|
1142
1154
|
]
|
|
1143
1155
|
},
|
|
1144
|
-
|
|
1156
|
+
O
|
|
1145
1157
|
);
|
|
1146
1158
|
}
|
|
1147
1159
|
return /* @__PURE__ */ n(nt, { children: [
|
|
1148
1160
|
/* @__PURE__ */ e(rt, { asChild: !0, children: /* @__PURE__ */ n(
|
|
1149
|
-
|
|
1161
|
+
V,
|
|
1150
1162
|
{
|
|
1151
1163
|
size: "sm",
|
|
1152
|
-
variant:
|
|
1153
|
-
className: `${
|
|
1154
|
-
style: Ue(
|
|
1155
|
-
disabled:
|
|
1164
|
+
variant: he ? "default" : "outline",
|
|
1165
|
+
className: `${_ ? "h-7 text-[11px]" : "text-[12px]"} gap-1.5`,
|
|
1166
|
+
style: Ue(he),
|
|
1167
|
+
disabled: I.isPending,
|
|
1156
1168
|
children: [
|
|
1157
|
-
|
|
1158
|
-
/* @__PURE__ */ e(
|
|
1169
|
+
O,
|
|
1170
|
+
/* @__PURE__ */ e(oe, { className: "h-3 w-3" })
|
|
1159
1171
|
]
|
|
1160
1172
|
}
|
|
1161
1173
|
) }),
|
|
1162
|
-
/* @__PURE__ */ e(at, { align: "start", children: [...
|
|
1163
|
-
(
|
|
1174
|
+
/* @__PURE__ */ e(at, { align: "start", children: [...W].sort(
|
|
1175
|
+
(K, le) => {
|
|
1164
1176
|
var Qe, We;
|
|
1165
|
-
return (((Qe =
|
|
1177
|
+
return (((Qe = fe.get(K.to_state)) == null ? void 0 : Qe.sort) ?? 999) - (((We = fe.get(le.to_state)) == null ? void 0 : We.sort) ?? 999);
|
|
1166
1178
|
}
|
|
1167
|
-
).map((
|
|
1168
|
-
var
|
|
1169
|
-
return /* @__PURE__ */ n(st, { onSelect: () =>
|
|
1170
|
-
|
|
1179
|
+
).map((K) => {
|
|
1180
|
+
var le;
|
|
1181
|
+
return /* @__PURE__ */ n(st, { onSelect: () => y(K.id), children: [
|
|
1182
|
+
K.color && /* @__PURE__ */ e(
|
|
1171
1183
|
"span",
|
|
1172
1184
|
{
|
|
1173
1185
|
className: "mr-2 inline-block h-2 w-2 shrink-0 rounded-full",
|
|
1174
|
-
style: { backgroundColor:
|
|
1186
|
+
style: { backgroundColor: K.color }
|
|
1175
1187
|
}
|
|
1176
1188
|
),
|
|
1177
|
-
((
|
|
1178
|
-
] },
|
|
1189
|
+
((le = fe.get(K.to_state)) == null ? void 0 : le.label) ?? K.to_state
|
|
1190
|
+
] }, K.id);
|
|
1179
1191
|
}) })
|
|
1180
|
-
] },
|
|
1192
|
+
] }, O);
|
|
1181
1193
|
});
|
|
1182
1194
|
}, Me = /* @__PURE__ */ n("div", { className: "space-y-3 rounded-lg border border-slate-200 bg-slate-50 dark:bg-slate-900/30 dark:border-border p-3.5", children: [
|
|
1183
1195
|
/* @__PURE__ */ n("div", { className: "flex flex-wrap items-center gap-2", children: [
|
|
1184
1196
|
/* @__PURE__ */ e("span", { className: "text-[11px] font-semibold text-slate-400", children: "Confirming" }),
|
|
1185
|
-
|
|
1186
|
-
|
|
1187
|
-
/* @__PURE__ */ e(
|
|
1188
|
-
/* @__PURE__ */ e(
|
|
1189
|
-
/* @__PURE__ */ e(
|
|
1197
|
+
J && /* @__PURE__ */ e("span", { className: "text-[12px] font-medium text-slate-700", children: J.label }),
|
|
1198
|
+
ie && Ne && /* @__PURE__ */ n("div", { className: "ml-auto flex items-center gap-1.5", children: [
|
|
1199
|
+
/* @__PURE__ */ e(re, { label: ie.label, color: ie.color, small: !0 }),
|
|
1200
|
+
/* @__PURE__ */ e(Ae, { className: "h-3 w-3 shrink-0 text-slate-300" }),
|
|
1201
|
+
/* @__PURE__ */ e(re, { label: Ne.label, color: Ne.color, small: !0 })
|
|
1190
1202
|
] })
|
|
1191
1203
|
] }),
|
|
1192
1204
|
/* @__PURE__ */ e(ut, { collection: r, item: t }),
|
|
@@ -1194,68 +1206,68 @@ function Bt({
|
|
|
1194
1206
|
"input",
|
|
1195
1207
|
{
|
|
1196
1208
|
type: "text",
|
|
1197
|
-
value:
|
|
1198
|
-
onChange: (
|
|
1199
|
-
placeholder: String((
|
|
1209
|
+
value: F,
|
|
1210
|
+
onChange: (d) => k(d.target.value),
|
|
1211
|
+
placeholder: String((J == null ? void 0 : J.comment_mode) ?? "") === "required" ? "Add a note (required)" : "Add a comment (optional)",
|
|
1200
1212
|
className: "w-full rounded-md border border-slate-200 bg-white px-3 py-1.5 text-[13px] placeholder-slate-400 focus:outline-none focus:ring-2 focus:ring-nvr-cyan/30"
|
|
1201
1213
|
}
|
|
1202
1214
|
),
|
|
1203
1215
|
/* @__PURE__ */ n("div", { className: "flex items-center justify-end gap-2", children: [
|
|
1204
1216
|
/* @__PURE__ */ e(
|
|
1205
|
-
|
|
1217
|
+
V,
|
|
1206
1218
|
{
|
|
1207
1219
|
type: "button",
|
|
1208
1220
|
size: "sm",
|
|
1209
1221
|
variant: "ghost",
|
|
1210
1222
|
className: "h-7 text-[12px]",
|
|
1211
|
-
onClick: () =>
|
|
1223
|
+
onClick: () => D(null),
|
|
1212
1224
|
children: "Cancel"
|
|
1213
1225
|
}
|
|
1214
1226
|
),
|
|
1215
1227
|
/* @__PURE__ */ e(
|
|
1216
|
-
|
|
1228
|
+
V,
|
|
1217
1229
|
{
|
|
1218
1230
|
type: "button",
|
|
1219
1231
|
size: "sm",
|
|
1220
1232
|
className: "h-7 gap-1.5 text-[12px]",
|
|
1221
|
-
disabled:
|
|
1222
|
-
onClick: () =>
|
|
1223
|
-
transition_id:
|
|
1224
|
-
comment:
|
|
1233
|
+
disabled: I.isPending || String((J == null ? void 0 : J.comment_mode) ?? "") === "required" && F.trim() === "",
|
|
1234
|
+
onClick: () => I.mutate({
|
|
1235
|
+
transition_id: $,
|
|
1236
|
+
comment: F.trim() || void 0
|
|
1225
1237
|
}),
|
|
1226
|
-
children:
|
|
1238
|
+
children: I.isPending ? /* @__PURE__ */ e(te, { className: "h-3.5 w-3.5 animate-spin" }) : /* @__PURE__ */ n(ae, { children: [
|
|
1227
1239
|
/* @__PURE__ */ e("span", { children: "Confirm" }),
|
|
1228
|
-
/* @__PURE__ */ e(
|
|
1240
|
+
/* @__PURE__ */ e(ve, { className: "h-3 w-3" })
|
|
1229
1241
|
] })
|
|
1230
1242
|
}
|
|
1231
1243
|
)
|
|
1232
1244
|
] })
|
|
1233
1245
|
] });
|
|
1234
|
-
return /* @__PURE__ */ n(
|
|
1246
|
+
return /* @__PURE__ */ n(ae, { children: [
|
|
1235
1247
|
/* @__PURE__ */ n(
|
|
1236
1248
|
"div",
|
|
1237
1249
|
{
|
|
1238
|
-
className: `overflow-hidden rounded-xl border bg-white dark:bg-card ${
|
|
1250
|
+
className: `overflow-hidden rounded-xl border bg-white dark:bg-card ${P ? "border-amber-300 dark:border-amber-600/50" : "border-slate-200 dark:border-border"}`,
|
|
1239
1251
|
children: [
|
|
1240
1252
|
/* @__PURE__ */ n(
|
|
1241
1253
|
"div",
|
|
1242
1254
|
{
|
|
1243
1255
|
role: "button",
|
|
1244
1256
|
tabIndex: 0,
|
|
1245
|
-
onClick: () =>
|
|
1246
|
-
onKeyDown: (
|
|
1257
|
+
onClick: () => v((d) => !d),
|
|
1258
|
+
onKeyDown: (d) => (d.key === "Enter" || d.key === " ") && v((_) => !_),
|
|
1247
1259
|
className: "flex w-full cursor-pointer items-center gap-2.5 px-5 py-3.5 transition-colors hover:bg-slate-50/50 dark:hover:bg-white/[0.02]",
|
|
1248
1260
|
children: [
|
|
1249
|
-
/* @__PURE__ */ e(
|
|
1250
|
-
/* @__PURE__ */ e("span", { className: "text-[13px] font-medium text-slate-800 dark:text-slate-200", children:
|
|
1261
|
+
/* @__PURE__ */ e(_e, { className: "h-3.5 w-3.5 shrink-0 text-slate-400" }),
|
|
1262
|
+
/* @__PURE__ */ e("span", { className: "text-[13px] font-medium text-slate-800 dark:text-slate-200", children: i || "Pipeline" }),
|
|
1251
1263
|
/* @__PURE__ */ n("div", { className: "flex items-center gap-1.5", children: [
|
|
1252
|
-
|
|
1253
|
-
|
|
1264
|
+
P && /* @__PURE__ */ e("span", { className: "flex items-center gap-1 rounded-full border border-amber-200 bg-amber-50 px-2 py-0.5 text-[11px] font-medium text-amber-700 dark:border-amber-500/20 dark:bg-amber-500/10 dark:text-amber-400", children: "Addendum workflow" }),
|
|
1265
|
+
ie && /* @__PURE__ */ e(re, { label: ie.label, color: ie.color }),
|
|
1254
1266
|
(((Be = a == null ? void 0 : a.auto_held) == null ? void 0 : Be.length) ?? 0) > 0 && /* @__PURE__ */ n(
|
|
1255
1267
|
"span",
|
|
1256
1268
|
{
|
|
1257
1269
|
className: "flex items-center gap-1 rounded-full border border-amber-200 bg-amber-50 px-2 py-0.5 text-[11px] font-medium text-amber-700 dark:border-amber-500/20 dark:bg-amber-500/10 dark:text-amber-400",
|
|
1258
|
-
"data-tip": ((a == null ? void 0 : a.auto_held) ?? []).map((
|
|
1270
|
+
"data-tip": ((a == null ? void 0 : a.auto_held) ?? []).map((d) => `${d.transition_label ?? "Automatic move"}: ${d.error ?? "refused"}`).join(`
|
|
1259
1271
|
`),
|
|
1260
1272
|
"data-pipeline-auto-held-pill": !0,
|
|
1261
1273
|
children: [
|
|
@@ -1264,119 +1276,125 @@ function Bt({
|
|
|
1264
1276
|
]
|
|
1265
1277
|
}
|
|
1266
1278
|
),
|
|
1267
|
-
|
|
1279
|
+
T && /* @__PURE__ */ n("span", { className: "flex items-center gap-1 rounded-full bg-amber-50 px-2 py-0.5 text-[11px] font-medium text-amber-700 border border-amber-200 dark:bg-amber-500/10 dark:text-amber-400 dark:border-amber-500/20", children: [
|
|
1268
1280
|
/* @__PURE__ */ e("span", { className: "h-1.5 w-1.5 rounded-full bg-amber-400 animate-pulse shrink-0" }),
|
|
1269
1281
|
"Addendum in review"
|
|
1270
1282
|
] }),
|
|
1271
|
-
|
|
1283
|
+
g.length > 0 && /* @__PURE__ */ n(
|
|
1272
1284
|
"span",
|
|
1273
1285
|
{
|
|
1274
1286
|
className: "flex items-center gap-1 rounded-full border border-sky-200 bg-sky-50 px-2 py-0.5 text-[11px] font-medium text-sky-700 dark:border-sky-500/20 dark:bg-sky-500/10 dark:text-sky-300",
|
|
1275
1287
|
"data-pipeline-approving": !0,
|
|
1276
1288
|
children: [
|
|
1277
1289
|
/* @__PURE__ */ e("span", { className: "h-1.5 w-1.5 shrink-0 animate-pulse rounded-full bg-sky-400" }),
|
|
1278
|
-
vt(
|
|
1290
|
+
vt(g, "approving")
|
|
1279
1291
|
]
|
|
1280
1292
|
}
|
|
1281
1293
|
)
|
|
1282
1294
|
] }),
|
|
1283
|
-
/* @__PURE__ */ n("div", { className: "ml-auto flex items-center gap-2", onClick: (
|
|
1284
|
-
!
|
|
1285
|
-
!
|
|
1286
|
-
|
|
1295
|
+
/* @__PURE__ */ n("div", { className: "ml-auto flex items-center gap-2", onClick: (d) => d.stopPropagation(), children: [
|
|
1296
|
+
!l && Le && !p && /* @__PURE__ */ e("div", { className: "flex flex-wrap items-center gap-1.5", children: Fe(ke, !0) }),
|
|
1297
|
+
!l && !j && (a == null ? void 0 : a.binding) && /* @__PURE__ */ n(
|
|
1298
|
+
V,
|
|
1287
1299
|
{
|
|
1288
1300
|
size: "sm",
|
|
1289
1301
|
variant: "outline",
|
|
1290
1302
|
className: "h-7 gap-1.5 text-[11px]",
|
|
1291
|
-
onClick: (
|
|
1292
|
-
|
|
1303
|
+
onClick: (d) => {
|
|
1304
|
+
d.stopPropagation(), B.mutate();
|
|
1293
1305
|
},
|
|
1294
|
-
disabled:
|
|
1306
|
+
disabled: B.isPending,
|
|
1295
1307
|
children: [
|
|
1296
|
-
|
|
1308
|
+
B.isPending ? /* @__PURE__ */ e(te, { className: "h-3 w-3 animate-spin" }) : /* @__PURE__ */ e(_e, { className: "h-3 w-3" }),
|
|
1297
1309
|
"Start"
|
|
1298
1310
|
]
|
|
1299
1311
|
}
|
|
1300
1312
|
),
|
|
1301
|
-
|
|
1313
|
+
C && ((a == null ? void 0 : a.binding) || (a == null ? void 0 : a.instance)) && /* @__PURE__ */ e(
|
|
1302
1314
|
Mt,
|
|
1303
1315
|
{
|
|
1304
1316
|
collection: r,
|
|
1305
1317
|
item: t,
|
|
1306
|
-
states:
|
|
1318
|
+
states: me ?? [],
|
|
1307
1319
|
currentStateId: ((Ee = a == null ? void 0 : a.instance) == null ? void 0 : Ee.current_state) ?? null
|
|
1308
1320
|
}
|
|
1309
1321
|
)
|
|
1310
1322
|
] }),
|
|
1311
1323
|
/* @__PURE__ */ e(
|
|
1312
|
-
|
|
1324
|
+
oe,
|
|
1313
1325
|
{
|
|
1314
|
-
className:
|
|
1326
|
+
className: pe(
|
|
1315
1327
|
"h-3.5 w-3.5 shrink-0 text-slate-400 transition-transform duration-150",
|
|
1316
|
-
|
|
1328
|
+
l && "rotate-180"
|
|
1317
1329
|
)
|
|
1318
1330
|
}
|
|
1319
1331
|
)
|
|
1320
1332
|
]
|
|
1321
1333
|
}
|
|
1322
1334
|
),
|
|
1323
|
-
!
|
|
1324
|
-
|
|
1335
|
+
!l && $ && /* @__PURE__ */ e("div", { className: "border-t border-slate-100 dark:border-border/60 px-4 py-3", children: Me }),
|
|
1336
|
+
l && /* @__PURE__ */ n("div", { className: "border-t border-slate-100 dark:border-border/60", children: [
|
|
1325
1337
|
/* @__PURE__ */ e(At, { held: (a == null ? void 0 : a.auto_held) ?? [] }),
|
|
1326
|
-
|
|
1338
|
+
T && /* @__PURE__ */ n("div", { className: "flex items-center gap-2 border-b border-amber-100 bg-amber-50 px-5 py-2.5 dark:border-amber-500/20 dark:bg-amber-500/10", children: [
|
|
1327
1339
|
/* @__PURE__ */ e("span", { className: "h-1.5 w-1.5 rounded-full bg-amber-400 shrink-0" }),
|
|
1328
1340
|
/* @__PURE__ */ e("p", { className: "text-[12px] text-amber-700 dark:text-amber-400", children: "An addendum is in review — coordinate transitions carefully." })
|
|
1329
1341
|
] }),
|
|
1330
|
-
|
|
1331
|
-
(
|
|
1332
|
-
|
|
1342
|
+
j ? /* @__PURE__ */ n("div", { className: "divide-y divide-slate-100 dark:divide-border/60", children: [
|
|
1343
|
+
(me ?? []).length > 1 && /* @__PURE__ */ n("div", { className: "space-y-3 px-5 py-4", children: [
|
|
1344
|
+
ee ? (
|
|
1333
1345
|
// Path pruning arrives with the owners query — rendering
|
|
1334
1346
|
// the UNPRUNED track first meant every state briefly
|
|
1335
1347
|
// showed, then snapped into formation. Hold a same-height
|
|
1336
1348
|
// placeholder until the real shape is known.
|
|
1337
1349
|
/* @__PURE__ */ n("div", { className: "flex h-[52px] items-center gap-2", children: [
|
|
1338
|
-
[0, 1, 2, 3, 4].map((
|
|
1339
|
-
/* @__PURE__ */ e(
|
|
1340
|
-
|
|
1341
|
-
] },
|
|
1342
|
-
/* @__PURE__ */ e(
|
|
1350
|
+
[0, 1, 2, 3, 4].map((d) => /* @__PURE__ */ n("span", { className: "flex items-center gap-2", children: [
|
|
1351
|
+
/* @__PURE__ */ e(ne, { className: "h-7 w-7 rounded-full" }),
|
|
1352
|
+
d < 4 && /* @__PURE__ */ e(ne, { className: "h-0.5 w-10" })
|
|
1353
|
+
] }, d)),
|
|
1354
|
+
/* @__PURE__ */ e(ne, { className: "ml-2 h-3 w-24" })
|
|
1343
1355
|
] })
|
|
1344
1356
|
) : /* @__PURE__ */ e(
|
|
1345
1357
|
jt,
|
|
1346
1358
|
{
|
|
1347
|
-
states:
|
|
1359
|
+
states: me,
|
|
1348
1360
|
allTransitions: (a == null ? void 0 : a.all_transitions) ?? [],
|
|
1349
|
-
availableTransitions:
|
|
1350
|
-
currentStateId:
|
|
1351
|
-
history:
|
|
1352
|
-
onPathIds:
|
|
1353
|
-
skippedStates:
|
|
1361
|
+
availableTransitions: z ?? [],
|
|
1362
|
+
currentStateId: j.current_state,
|
|
1363
|
+
history: Q ?? [],
|
|
1364
|
+
onPathIds: R,
|
|
1365
|
+
skippedStates: S
|
|
1354
1366
|
}
|
|
1355
1367
|
),
|
|
1356
1368
|
(a == null ? void 0 : a.branches) && /* @__PURE__ */ e(qt, { data: a.branches }),
|
|
1357
1369
|
/* @__PURE__ */ e(
|
|
1358
1370
|
Rt,
|
|
1359
1371
|
{
|
|
1360
|
-
history:
|
|
1361
|
-
completedAt:
|
|
1372
|
+
history: Q ?? [],
|
|
1373
|
+
completedAt: j.completed_at
|
|
1362
1374
|
}
|
|
1363
1375
|
)
|
|
1364
1376
|
] }),
|
|
1365
1377
|
/* @__PURE__ */ n("div", { className: "space-y-3 px-5 py-4", children: [
|
|
1366
|
-
!
|
|
1378
|
+
!j.completed_at && /* @__PURE__ */ e(Tt, { collection: r, itemId: String(t) }),
|
|
1367
1379
|
/* @__PURE__ */ e(
|
|
1368
1380
|
Ft,
|
|
1369
1381
|
{
|
|
1370
1382
|
collection: r,
|
|
1371
1383
|
item: t,
|
|
1372
|
-
states:
|
|
1373
|
-
currentStateId: ((Ie = a == null ? void 0 : a.instance) == null ? void 0 : Ie.current_state) ?? null
|
|
1384
|
+
states: me ?? [],
|
|
1385
|
+
currentStateId: ((Ie = a == null ? void 0 : a.instance) == null ? void 0 : Ie.current_state) ?? null,
|
|
1386
|
+
returned: ((a == null ? void 0 : a.history) ?? []).some(
|
|
1387
|
+
(d) => {
|
|
1388
|
+
var _;
|
|
1389
|
+
return !!d.from_state && d.to_state === ((_ = a == null ? void 0 : a.instance) == null ? void 0 : _.current_state);
|
|
1390
|
+
}
|
|
1391
|
+
)
|
|
1374
1392
|
}
|
|
1375
1393
|
)
|
|
1376
1394
|
] }),
|
|
1377
1395
|
Le && !x && /* @__PURE__ */ n("div", { className: "space-y-3 px-5 py-4", children: [
|
|
1378
|
-
/* @__PURE__ */ e("div", { className: "flex flex-wrap justify-end gap-2", children: Fe(
|
|
1379
|
-
|
|
1396
|
+
/* @__PURE__ */ e("div", { className: "flex flex-wrap justify-end gap-2", children: Fe(ke) }),
|
|
1397
|
+
$ && Me
|
|
1380
1398
|
] }),
|
|
1381
1399
|
/* @__PURE__ */ n("div", { className: "px-5 py-3", children: [
|
|
1382
1400
|
/* @__PURE__ */ n(
|
|
@@ -1384,14 +1402,14 @@ function Bt({
|
|
|
1384
1402
|
{
|
|
1385
1403
|
type: "button",
|
|
1386
1404
|
className: "flex items-center gap-1.5 text-[12px] text-slate-400 transition-colors hover:text-slate-600",
|
|
1387
|
-
onClick: () =>
|
|
1405
|
+
onClick: () => E((d) => !d),
|
|
1388
1406
|
children: [
|
|
1389
1407
|
/* @__PURE__ */ e(
|
|
1390
|
-
|
|
1408
|
+
oe,
|
|
1391
1409
|
{
|
|
1392
|
-
className:
|
|
1410
|
+
className: pe(
|
|
1393
1411
|
"h-3.5 w-3.5 transition-transform duration-200",
|
|
1394
|
-
|
|
1412
|
+
w && "rotate-180"
|
|
1395
1413
|
)
|
|
1396
1414
|
}
|
|
1397
1415
|
),
|
|
@@ -1399,26 +1417,26 @@ function Bt({
|
|
|
1399
1417
|
" ",
|
|
1400
1418
|
/* @__PURE__ */ n("span", { className: "tabular-nums", children: [
|
|
1401
1419
|
"(",
|
|
1402
|
-
(
|
|
1420
|
+
(Q == null ? void 0 : Q.length) ?? 0,
|
|
1403
1421
|
")"
|
|
1404
1422
|
] })
|
|
1405
1423
|
]
|
|
1406
1424
|
}
|
|
1407
1425
|
),
|
|
1408
|
-
|
|
1426
|
+
w && /* @__PURE__ */ e("div", { className: "mt-3", children: /* @__PURE__ */ e(Ot, { history: Q ?? [] }) })
|
|
1409
1427
|
] })
|
|
1410
1428
|
] }) : /* @__PURE__ */ n("div", { className: "flex items-center justify-between gap-4 px-5 py-4", children: [
|
|
1411
1429
|
/* @__PURE__ */ e("p", { className: "text-[13px] text-slate-500", children: "Pipeline not started for this record." }),
|
|
1412
1430
|
/* @__PURE__ */ n(
|
|
1413
|
-
|
|
1431
|
+
V,
|
|
1414
1432
|
{
|
|
1415
1433
|
size: "sm",
|
|
1416
1434
|
variant: "outline",
|
|
1417
1435
|
className: "shrink-0 gap-1.5 text-[12px]",
|
|
1418
|
-
onClick: () =>
|
|
1419
|
-
disabled:
|
|
1436
|
+
onClick: () => B.mutate(),
|
|
1437
|
+
disabled: B.isPending,
|
|
1420
1438
|
children: [
|
|
1421
|
-
|
|
1439
|
+
B.isPending ? /* @__PURE__ */ e(te, { className: "h-3.5 w-3.5 animate-spin" }) : /* @__PURE__ */ e(_e, { className: "h-3.5 w-3.5" }),
|
|
1422
1440
|
"Start Pipeline"
|
|
1423
1441
|
]
|
|
1424
1442
|
}
|
|
@@ -1428,70 +1446,70 @@ function Bt({
|
|
|
1428
1446
|
]
|
|
1429
1447
|
}
|
|
1430
1448
|
),
|
|
1431
|
-
|
|
1449
|
+
c && /* @__PURE__ */ e(Ye, { fallback: null, children: /* @__PURE__ */ e(
|
|
1432
1450
|
dt,
|
|
1433
1451
|
{
|
|
1434
|
-
payload:
|
|
1435
|
-
isRetry:
|
|
1452
|
+
payload: c.payload,
|
|
1453
|
+
isRetry: c.revision > 1,
|
|
1436
1454
|
onSubmitted: () => (
|
|
1437
1455
|
// mutateAsync so the dialog can stay busy until the transition
|
|
1438
1456
|
// settles; the mutation's own onError/onSuccess handle the outcome.
|
|
1439
|
-
|
|
1440
|
-
transition_id:
|
|
1441
|
-
comment:
|
|
1457
|
+
I.mutateAsync({
|
|
1458
|
+
transition_id: c.transitionId,
|
|
1459
|
+
comment: c.comment,
|
|
1442
1460
|
reviewed: !0
|
|
1443
1461
|
}).catch(() => {
|
|
1444
1462
|
})
|
|
1445
1463
|
),
|
|
1446
|
-
executing:
|
|
1447
|
-
onClose: () =>
|
|
1464
|
+
executing: I.isPending,
|
|
1465
|
+
onClose: () => o(null)
|
|
1448
1466
|
},
|
|
1449
|
-
|
|
1467
|
+
c.revision
|
|
1450
1468
|
) })
|
|
1451
1469
|
] });
|
|
1452
1470
|
}
|
|
1453
1471
|
function un({
|
|
1454
1472
|
collection: r,
|
|
1455
1473
|
item: t,
|
|
1456
|
-
onBeforeTransition:
|
|
1457
|
-
wrap:
|
|
1474
|
+
onBeforeTransition: u,
|
|
1475
|
+
wrap: i = !0
|
|
1458
1476
|
}) {
|
|
1459
1477
|
return t === "new" ? null : /* @__PURE__ */ e(
|
|
1460
1478
|
Et,
|
|
1461
1479
|
{
|
|
1462
1480
|
collection: r,
|
|
1463
1481
|
item: t,
|
|
1464
|
-
onBeforeTransition:
|
|
1465
|
-
wrap:
|
|
1482
|
+
onBeforeTransition: u,
|
|
1483
|
+
wrap: i
|
|
1466
1484
|
}
|
|
1467
1485
|
);
|
|
1468
1486
|
}
|
|
1469
1487
|
function Et({
|
|
1470
1488
|
collection: r,
|
|
1471
1489
|
item: t,
|
|
1472
|
-
onBeforeTransition:
|
|
1473
|
-
wrap:
|
|
1490
|
+
onBeforeTransition: u,
|
|
1491
|
+
wrap: i = !0
|
|
1474
1492
|
}) {
|
|
1475
|
-
const
|
|
1476
|
-
et(r, t, "transition", !!
|
|
1477
|
-
const
|
|
1478
|
-
if (
|
|
1479
|
-
|
|
1493
|
+
const C = ce(), p = De(), [x, b] = U(""), [T, P] = U(null), [h, N] = U(null);
|
|
1494
|
+
et(r, t, "transition", !!T || !!h);
|
|
1495
|
+
const q = async (f) => {
|
|
1496
|
+
if (T === f) {
|
|
1497
|
+
P(null);
|
|
1480
1498
|
return;
|
|
1481
1499
|
}
|
|
1482
|
-
if (
|
|
1483
|
-
const
|
|
1500
|
+
if (u && !await u()) return;
|
|
1501
|
+
const y = (E ?? []).find((a) => a.id === f), s = String((y == null ? void 0 : y.comment_mode) ?? "none");
|
|
1484
1502
|
if (s !== "optional" && s !== "required") {
|
|
1485
|
-
|
|
1503
|
+
$.mutate({ transition_id: f });
|
|
1486
1504
|
return;
|
|
1487
1505
|
}
|
|
1488
|
-
|
|
1489
|
-
},
|
|
1490
|
-
queryKey:
|
|
1491
|
-
queryFn: () =>
|
|
1492
|
-
|
|
1506
|
+
P(f);
|
|
1507
|
+
}, F = ["pipeline-instance", r, t], { data: k } = Z({
|
|
1508
|
+
queryKey: F,
|
|
1509
|
+
queryFn: () => C.request(
|
|
1510
|
+
Y(`/pipelines/instance/${r}/${t}`)
|
|
1493
1511
|
).then(
|
|
1494
|
-
(
|
|
1512
|
+
(f) => f.data ?? {
|
|
1495
1513
|
instance: null,
|
|
1496
1514
|
states: [],
|
|
1497
1515
|
available_transitions: [],
|
|
@@ -1501,158 +1519,158 @@ function Et({
|
|
|
1501
1519
|
}
|
|
1502
1520
|
),
|
|
1503
1521
|
staleTime: 1e4
|
|
1504
|
-
}),
|
|
1522
|
+
}), $ = ue({
|
|
1505
1523
|
mutationFn: ({
|
|
1506
|
-
transition_id:
|
|
1507
|
-
comment:
|
|
1524
|
+
transition_id: f,
|
|
1525
|
+
comment: y,
|
|
1508
1526
|
reviewed: s
|
|
1509
|
-
}) =>
|
|
1510
|
-
|
|
1511
|
-
transition_id:
|
|
1512
|
-
comment:
|
|
1527
|
+
}) => C.request(
|
|
1528
|
+
be(`/pipelines/instance/${r}/${t}/transition`, {
|
|
1529
|
+
transition_id: f,
|
|
1530
|
+
comment: y,
|
|
1513
1531
|
...s ? { reviewed: !0 } : {}
|
|
1514
1532
|
})
|
|
1515
1533
|
),
|
|
1516
1534
|
onSuccess: () => {
|
|
1517
|
-
|
|
1535
|
+
p.invalidateQueries({ queryKey: F }), r === "nivaro_addendums" && p.invalidateQueries({ queryKey: ["addendums"] }), ye(p, r, String(t)), we(p, r, String(t)), b(""), P(null), N(null), X.success("Transition executed");
|
|
1518
1536
|
},
|
|
1519
|
-
onError: (
|
|
1520
|
-
var
|
|
1521
|
-
const s = mt(
|
|
1537
|
+
onError: (f, y) => {
|
|
1538
|
+
var A;
|
|
1539
|
+
const s = mt(f);
|
|
1522
1540
|
if (s) {
|
|
1523
|
-
|
|
1541
|
+
N((M) => ({
|
|
1524
1542
|
payload: s,
|
|
1525
|
-
transitionId:
|
|
1526
|
-
comment:
|
|
1527
|
-
revision: ((
|
|
1543
|
+
transitionId: y.transition_id,
|
|
1544
|
+
comment: y.comment,
|
|
1545
|
+
revision: ((M == null ? void 0 : M.revision) ?? 0) + 1
|
|
1528
1546
|
}));
|
|
1529
1547
|
return;
|
|
1530
1548
|
}
|
|
1531
|
-
const a =
|
|
1532
|
-
|
|
1549
|
+
const a = f == null ? void 0 : f.response;
|
|
1550
|
+
X.error((a == null ? void 0 : a.error) ?? ((A = a == null ? void 0 : a.data) == null ? void 0 : A.error) ?? "Failed to execute transition", {
|
|
1533
1551
|
duration: 12e3,
|
|
1534
1552
|
// #1867: a refusal carries "Why?" — the role, owner or access rule
|
|
1535
1553
|
// that stopped it, and who can change it.
|
|
1536
|
-
...lt(
|
|
1537
|
-
action: ot(
|
|
1554
|
+
...lt(f) ? {
|
|
1555
|
+
action: ot(C, {
|
|
1538
1556
|
collection: r,
|
|
1539
1557
|
itemId: String(t),
|
|
1540
1558
|
action: "transition",
|
|
1541
|
-
transitionId:
|
|
1559
|
+
transitionId: y.transition_id
|
|
1542
1560
|
})
|
|
1543
1561
|
} : {}
|
|
1544
|
-
}),
|
|
1562
|
+
}), N(null), P(null), ye(p, r, String(t)), we(p, r, String(t)), (a == null ? void 0 : a.status) === 409 && p.invalidateQueries({ queryKey: F });
|
|
1545
1563
|
}
|
|
1546
|
-
}),
|
|
1547
|
-
|
|
1548
|
-
const
|
|
1549
|
-
if (
|
|
1550
|
-
const
|
|
1551
|
-
const s =
|
|
1564
|
+
}), D = se(q);
|
|
1565
|
+
D.current = q;
|
|
1566
|
+
const w = se((k == null ? void 0 : k.available_transitions) ?? []);
|
|
1567
|
+
if (w.current = (k == null ? void 0 : k.available_transitions) ?? [], de(() => {
|
|
1568
|
+
const f = (y) => {
|
|
1569
|
+
const s = y.detail;
|
|
1552
1570
|
if (!s || s.claimed || s.collection !== r || String(s.item) !== String(t)) return;
|
|
1553
1571
|
s.claimed = !0;
|
|
1554
|
-
const a = String(s.transition_id).toUpperCase(),
|
|
1555
|
-
if (!
|
|
1556
|
-
|
|
1572
|
+
const a = String(s.transition_id).toUpperCase(), A = w.current.find((M) => String(M.id).toUpperCase() === a);
|
|
1573
|
+
if (!A) {
|
|
1574
|
+
X.error("That step is not available from where the record is now");
|
|
1557
1575
|
return;
|
|
1558
1576
|
}
|
|
1559
|
-
|
|
1577
|
+
D.current(A.id);
|
|
1560
1578
|
};
|
|
1561
|
-
return window.addEventListener(
|
|
1562
|
-
}, [r, t]), !(
|
|
1563
|
-
const
|
|
1564
|
-
(
|
|
1579
|
+
return window.addEventListener(ge, f), () => window.removeEventListener(ge, f);
|
|
1580
|
+
}, [r, t]), !(k != null && k.binding) || !(k != null && k.instance)) return null;
|
|
1581
|
+
const E = (k.available_transitions ?? []).filter(
|
|
1582
|
+
(f) => !k.instance.completed_at || f.from_state && String(f.from_state).toUpperCase() === String(k.instance.current_state).toUpperCase()
|
|
1565
1583
|
);
|
|
1566
|
-
if (
|
|
1567
|
-
const
|
|
1568
|
-
for (const
|
|
1569
|
-
const
|
|
1570
|
-
|
|
1584
|
+
if (E.length === 0) return null;
|
|
1585
|
+
const l = new Map((k.states ?? []).map((f) => [f.id, f])), v = k.instance.current_state_obj ?? null, c = T ? E.find((f) => f.id === T) : null, o = c ? l.get(c.to_state) : null, g = /* @__PURE__ */ new Map();
|
|
1586
|
+
for (const f of E) {
|
|
1587
|
+
const y = g.get(f.label) ?? [];
|
|
1588
|
+
y.push(f), g.set(f.label, y);
|
|
1571
1589
|
}
|
|
1572
1590
|
return /* @__PURE__ */ n("div", { className: "relative", children: [
|
|
1573
1591
|
/* @__PURE__ */ e(
|
|
1574
1592
|
"div",
|
|
1575
1593
|
{
|
|
1576
|
-
className:
|
|
1577
|
-
children: Array.from(
|
|
1578
|
-
var
|
|
1579
|
-
const s = ((
|
|
1580
|
-
if (
|
|
1581
|
-
const
|
|
1582
|
-
|
|
1594
|
+
className: i ? "flex flex-wrap justify-end gap-2" : "flex shrink-0 items-center justify-end gap-2",
|
|
1595
|
+
children: Array.from(g.entries()).map(([f, y]) => {
|
|
1596
|
+
var M, ee;
|
|
1597
|
+
const s = ((M = y[0]) == null ? void 0 : M.color) ?? null, a = y.some((R) => R.id === T), A = (R) => s ? R ? { backgroundColor: s, borderColor: s } : { borderColor: s, color: s } : void 0;
|
|
1598
|
+
if (y.length === 1) {
|
|
1599
|
+
const R = y[0], S = $.isPending && ((ee = $.variables) == null ? void 0 : ee.transition_id) === R.id, B = /* @__PURE__ */ n(
|
|
1600
|
+
V,
|
|
1583
1601
|
{
|
|
1584
1602
|
size: "sm",
|
|
1585
1603
|
variant: a ? "default" : "outline",
|
|
1586
1604
|
className: "gap-1.5 text-[12px]",
|
|
1587
|
-
style:
|
|
1588
|
-
disabled:
|
|
1589
|
-
onClick: () =>
|
|
1605
|
+
style: A(a),
|
|
1606
|
+
disabled: $.isPending,
|
|
1607
|
+
onClick: () => q(R.id),
|
|
1590
1608
|
children: [
|
|
1591
|
-
|
|
1592
|
-
|
|
1609
|
+
S && /* @__PURE__ */ e(te, { className: "h-3 w-3 animate-spin" }),
|
|
1610
|
+
f
|
|
1593
1611
|
]
|
|
1594
1612
|
},
|
|
1595
|
-
|
|
1613
|
+
f
|
|
1596
1614
|
);
|
|
1597
|
-
return
|
|
1598
|
-
|
|
1615
|
+
return R.pushes && R.pushes > 0 ? /* @__PURE__ */ n("span", { className: "relative inline-flex", children: [
|
|
1616
|
+
B,
|
|
1599
1617
|
/* @__PURE__ */ e(
|
|
1600
1618
|
_t,
|
|
1601
1619
|
{
|
|
1602
1620
|
collection: r,
|
|
1603
1621
|
itemId: t,
|
|
1604
|
-
transitionId:
|
|
1605
|
-
label:
|
|
1622
|
+
transitionId: R.id,
|
|
1623
|
+
label: f,
|
|
1606
1624
|
compact: !0
|
|
1607
1625
|
}
|
|
1608
1626
|
)
|
|
1609
|
-
] },
|
|
1627
|
+
] }, f) : B;
|
|
1610
1628
|
}
|
|
1611
1629
|
return /* @__PURE__ */ n(nt, { children: [
|
|
1612
1630
|
/* @__PURE__ */ e(rt, { asChild: !0, children: /* @__PURE__ */ n(
|
|
1613
|
-
|
|
1631
|
+
V,
|
|
1614
1632
|
{
|
|
1615
1633
|
size: "sm",
|
|
1616
1634
|
variant: a ? "default" : "outline",
|
|
1617
1635
|
className: "gap-1.5 text-[12px]",
|
|
1618
|
-
style:
|
|
1619
|
-
disabled:
|
|
1636
|
+
style: A(a),
|
|
1637
|
+
disabled: $.isPending,
|
|
1620
1638
|
children: [
|
|
1621
|
-
|
|
1622
|
-
/* @__PURE__ */ e(
|
|
1639
|
+
f,
|
|
1640
|
+
/* @__PURE__ */ e(oe, { className: "h-3 w-3" })
|
|
1623
1641
|
]
|
|
1624
1642
|
}
|
|
1625
1643
|
) }),
|
|
1626
|
-
/* @__PURE__ */ e(at, { align: "start", children: [...
|
|
1627
|
-
(
|
|
1628
|
-
var
|
|
1629
|
-
return (((
|
|
1644
|
+
/* @__PURE__ */ e(at, { align: "start", children: [...y].sort(
|
|
1645
|
+
(R, S) => {
|
|
1646
|
+
var B, I;
|
|
1647
|
+
return (((B = l.get(R.to_state)) == null ? void 0 : B.sort) ?? 999) - (((I = l.get(S.to_state)) == null ? void 0 : I.sort) ?? 999);
|
|
1630
1648
|
}
|
|
1631
|
-
).map((
|
|
1632
|
-
var
|
|
1633
|
-
return /* @__PURE__ */ n(st, { onSelect: () =>
|
|
1634
|
-
|
|
1649
|
+
).map((R) => {
|
|
1650
|
+
var S;
|
|
1651
|
+
return /* @__PURE__ */ n(st, { onSelect: () => q(R.id), children: [
|
|
1652
|
+
R.color && /* @__PURE__ */ e(
|
|
1635
1653
|
"span",
|
|
1636
1654
|
{
|
|
1637
1655
|
className: "mr-2 inline-block h-2 w-2 shrink-0 rounded-full",
|
|
1638
|
-
style: { backgroundColor:
|
|
1656
|
+
style: { backgroundColor: R.color }
|
|
1639
1657
|
}
|
|
1640
1658
|
),
|
|
1641
|
-
((
|
|
1642
|
-
] },
|
|
1659
|
+
((S = l.get(R.to_state)) == null ? void 0 : S.label) ?? R.to_state
|
|
1660
|
+
] }, R.id);
|
|
1643
1661
|
}) })
|
|
1644
|
-
] },
|
|
1662
|
+
] }, f);
|
|
1645
1663
|
})
|
|
1646
1664
|
}
|
|
1647
1665
|
),
|
|
1648
|
-
|
|
1666
|
+
T && /* @__PURE__ */ n("div", { className: "absolute right-0 top-full z-50 mt-1 w-[600px] space-y-3 rounded-lg border border-slate-200 bg-white shadow-lg dark:bg-card dark:border-border p-3.5", children: [
|
|
1649
1667
|
/* @__PURE__ */ n("div", { className: "flex flex-wrap items-center gap-2", children: [
|
|
1650
1668
|
/* @__PURE__ */ e("span", { className: "text-[11px] font-semibold text-slate-400", children: "Confirming" }),
|
|
1651
|
-
|
|
1652
|
-
|
|
1653
|
-
/* @__PURE__ */ e(
|
|
1654
|
-
/* @__PURE__ */ e(
|
|
1655
|
-
/* @__PURE__ */ e(
|
|
1669
|
+
c && /* @__PURE__ */ e("span", { className: "text-[12px] font-medium text-slate-700", children: c.label }),
|
|
1670
|
+
v && o && /* @__PURE__ */ n("div", { className: "ml-auto flex items-center gap-1.5", children: [
|
|
1671
|
+
/* @__PURE__ */ e(re, { label: v.label, color: v.color, small: !0 }),
|
|
1672
|
+
/* @__PURE__ */ e(Ae, { className: "h-3 w-3 shrink-0 text-slate-300" }),
|
|
1673
|
+
/* @__PURE__ */ e(re, { label: o.label, color: o.color, small: !0 })
|
|
1656
1674
|
] })
|
|
1657
1675
|
] }),
|
|
1658
1676
|
/* @__PURE__ */ e(ut, { collection: r, item: t }),
|
|
@@ -1661,61 +1679,61 @@ function Et({
|
|
|
1661
1679
|
{
|
|
1662
1680
|
type: "text",
|
|
1663
1681
|
value: x,
|
|
1664
|
-
onChange: (
|
|
1665
|
-
placeholder: String((
|
|
1682
|
+
onChange: (f) => b(f.target.value),
|
|
1683
|
+
placeholder: String((c == null ? void 0 : c.comment_mode) ?? "") === "required" ? "Add a note (required)" : "Add a comment (optional)",
|
|
1666
1684
|
className: "w-full rounded-md border border-slate-200 bg-white px-3 py-1.5 text-[13px] placeholder-slate-400 focus:outline-none focus:ring-2 focus:ring-nvr-cyan/30"
|
|
1667
1685
|
}
|
|
1668
1686
|
),
|
|
1669
1687
|
/* @__PURE__ */ n("div", { className: "flex items-center justify-end gap-2", children: [
|
|
1670
1688
|
/* @__PURE__ */ e(
|
|
1671
|
-
|
|
1689
|
+
V,
|
|
1672
1690
|
{
|
|
1673
1691
|
type: "button",
|
|
1674
1692
|
size: "sm",
|
|
1675
1693
|
variant: "ghost",
|
|
1676
1694
|
className: "h-7 text-[12px]",
|
|
1677
|
-
onClick: () =>
|
|
1695
|
+
onClick: () => P(null),
|
|
1678
1696
|
children: "Cancel"
|
|
1679
1697
|
}
|
|
1680
1698
|
),
|
|
1681
1699
|
/* @__PURE__ */ e(
|
|
1682
|
-
|
|
1700
|
+
V,
|
|
1683
1701
|
{
|
|
1684
1702
|
type: "button",
|
|
1685
1703
|
size: "sm",
|
|
1686
1704
|
className: "h-7 gap-1.5 text-[12px]",
|
|
1687
|
-
disabled:
|
|
1688
|
-
onClick: () =>
|
|
1689
|
-
transition_id:
|
|
1705
|
+
disabled: $.isPending || String((c == null ? void 0 : c.comment_mode) ?? "") === "required" && x.trim() === "",
|
|
1706
|
+
onClick: () => $.mutate({
|
|
1707
|
+
transition_id: T,
|
|
1690
1708
|
comment: x.trim() || void 0
|
|
1691
1709
|
}),
|
|
1692
|
-
children:
|
|
1710
|
+
children: $.isPending ? /* @__PURE__ */ e(te, { className: "h-3.5 w-3.5 animate-spin" }) : /* @__PURE__ */ n(ae, { children: [
|
|
1693
1711
|
/* @__PURE__ */ e("span", { children: "Confirm" }),
|
|
1694
|
-
/* @__PURE__ */ e(
|
|
1712
|
+
/* @__PURE__ */ e(ve, { className: "h-3 w-3" })
|
|
1695
1713
|
] })
|
|
1696
1714
|
}
|
|
1697
1715
|
)
|
|
1698
1716
|
] })
|
|
1699
1717
|
] }),
|
|
1700
|
-
|
|
1718
|
+
h && /* @__PURE__ */ e(Ye, { fallback: null, children: /* @__PURE__ */ e(
|
|
1701
1719
|
dt,
|
|
1702
1720
|
{
|
|
1703
|
-
payload:
|
|
1704
|
-
isRetry:
|
|
1721
|
+
payload: h.payload,
|
|
1722
|
+
isRetry: h.revision > 1,
|
|
1705
1723
|
onSubmitted: () => (
|
|
1706
1724
|
// mutateAsync so the dialog can stay busy until the transition
|
|
1707
1725
|
// settles; the mutation's own onError/onSuccess handle the outcome.
|
|
1708
|
-
|
|
1709
|
-
transition_id:
|
|
1710
|
-
comment:
|
|
1726
|
+
$.mutateAsync({
|
|
1727
|
+
transition_id: h.transitionId,
|
|
1728
|
+
comment: h.comment,
|
|
1711
1729
|
reviewed: !0
|
|
1712
1730
|
}).catch(() => {
|
|
1713
1731
|
})
|
|
1714
1732
|
),
|
|
1715
|
-
executing:
|
|
1716
|
-
onClose: () =>
|
|
1733
|
+
executing: $.isPending,
|
|
1734
|
+
onClose: () => N(null)
|
|
1717
1735
|
},
|
|
1718
|
-
|
|
1736
|
+
h.revision
|
|
1719
1737
|
) })
|
|
1720
1738
|
] });
|
|
1721
1739
|
}
|