@nivaro/react 0.3.111 → 0.3.113
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/full.css +1 -1
- package/dist/hooks/useSessionRecorder.js +1 -1
- package/dist/index.d.ts +207 -3
- package/dist/index.js +745 -728
- package/dist/shared/components/CollectionBrowserView.js +3133 -2954
- package/dist/shared/components/CollectionImportBanner.js +135 -0
- package/dist/shared/components/ItemEditForm.js +2235 -2218
- package/dist/shared/components/JobsTray.js +54 -47
- package/dist/shared/components/ViewAsPersonButton.js +109 -0
- package/dist/shared/components/bulk/BulkFieldUpdate.js +228 -150
- package/dist/shared/components/bulk/BulkFieldUpdateButton.js +35 -41
- package/dist/shared/components/bulk/BulkLinksValue.js +91 -0
- package/dist/shared/components/bulk/bulk-field-options.js +20 -19
- package/dist/shared/components/bulk/bulk-update-preview.js +39 -0
- package/dist/shared/components/cbv/ColumnHeaderMenu.js +130 -0
- package/dist/shared/components/cbv/column-totals.js +163 -0
- package/dist/shared/components/collections-directory/CollectionHoverCard.js +108 -81
- package/dist/shared/components/collections-directory/CollectionRow.js +164 -148
- package/dist/shared/components/collections-directory/CollectionsDirectory.js +167 -166
- package/dist/shared/components/collections-directory/directory-data.js +70 -58
- package/dist/shared/components/imports/CollectionImportPanel.js +120 -118
- package/dist/shared/components/imports/DefinitionsPanel.js +24 -24
- package/dist/shared/components/imports/ImportDuplicatesNotice.js +65 -0
- package/dist/shared/components/item-edit/CatalogPickerField.js +631 -639
- package/dist/shared/components/item-edit/DuplicateNotice.js +168 -0
- package/dist/shared/components/item-edit/FieldRow.js +248 -246
- package/dist/shared/components/item-edit/InlineGridField.js +34 -33
- package/dist/shared/components/item-edit/InlineTableField.js +3002 -2825
- package/dist/shared/components/item-edit/MembershipSetField.js +165 -169
- package/dist/shared/components/item-edit/NestedRelationEditor.js +184 -189
- package/dist/shared/components/item-edit/PlanGrid.js +2 -1
- package/dist/shared/components/item-edit/QuickPickerDialog.js +35 -34
- package/dist/shared/components/item-edit/RecordLiveSync.js +32 -30
- package/dist/shared/components/item-edit/RelationCombobox.js +101 -100
- package/dist/shared/components/item-edit/RowHistorySheet.js +28 -27
- package/dist/shared/components/item-edit/SummaryPanel.js +133 -135
- package/dist/shared/components/item-edit/UserChip.js +262 -239
- package/dist/shared/components/item-edit/ViewAsRole.js +129 -52
- package/dist/shared/components/item-edit/grid-search.js +375 -0
- package/dist/shared/components/item-edit/render-stability.js +61 -54
- package/dist/shared/components/notifications/NotificationRulesEditor.js +25 -20
- package/dist/shared/components/ops-report/DigestSections.js +163 -144
- package/dist/shared/components/ops-report/drill.js +97 -97
- package/dist/shared/components/panels/AddendumLinesDiff.js +52 -51
- package/dist/shared/components/panels/AddendumPanel.js +92 -91
- package/dist/shared/components/panels/AsyncUserPicker.js +108 -0
- package/dist/shared/components/panels/CommentPanel.js +265 -252
- package/dist/shared/components/panels/OwnersSlot.js +47 -35
- package/dist/shared/components/panels/PipelineInsight.js +186 -0
- package/dist/shared/components/panels/PipelinePanel.js +1440 -1397
- package/dist/shared/components/panels/RecordIntegrityBanner.js +39 -38
- package/dist/shared/components/panels/RevisionsPanel.js +261 -260
- package/dist/shared/components/panels/StandInReason.js +69 -0
- package/dist/shared/components/pipeline/FieldPicker.js +41 -40
- package/dist/shared/components/pipeline/OwnerMatrix.js +829 -700
- package/dist/shared/components/pipeline/OwnerRecordTrial.js +362 -0
- package/dist/shared/components/pipeline/PipelineEditorView.js +483 -467
- package/dist/shared/components/pipeline/PipelineStateOwners.js +65 -64
- package/dist/shared/components/pipeline/owner-matrix-draft.js +178 -0
- package/dist/shared/components/profile/MyDefaultsCard.js +36 -35
- package/dist/shared/components/profile/PersonHeader.js +29 -29
- package/dist/shared/components/profile/PersonProfile.js +30 -28
- package/dist/shared/components/profile/SlowScreensCard.js +286 -0
- package/dist/shared/components/queue/QueueWorklist.js +1090 -1071
- package/dist/shared/components/quick-filters/useQuickFilterEditing.js +45 -44
- package/dist/shared/components/support/TicketDetailSheet.js +25 -16
- package/dist/shared/components/support/TicketSlowScreens.js +32 -0
- package/dist/shared/lib/activity-sentence.js +224 -178
- package/dist/shared/lib/collection-import-banner.js +27 -0
- package/dist/shared/lib/crash-report.js +112 -0
- package/dist/shared/lib/export-runs.js +99 -0
- package/dist/shared/lib/jobs-tray.js +89 -67
- package/dist/shared/lib/list-link.js +76 -69
- package/dist/shared/lib/nav-trail.js +180 -76
- package/dist/shared/lib/query-keys.js +26 -0
- package/dist/shared/lib/view-as.js +16 -11
- package/package.json +1 -1
|
@@ -1,74 +1,78 @@
|
|
|
1
|
-
import { jsxs as l, jsx as t, Fragment as
|
|
2
|
-
import { useQuery as
|
|
3
|
-
import { Loader2 as te, Users2 as
|
|
4
|
-
import { useState as
|
|
5
|
-
import { createPortal as
|
|
6
|
-
import { toast as
|
|
7
|
-
import { useNivaroClient as
|
|
8
|
-
import { get as
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
1
|
+
import { jsxs as l, jsx as t, Fragment as je } from "react/jsx-runtime";
|
|
2
|
+
import { useQuery as V, useQueries as qe, useQueryClient as tt, useMutation as G } from "@tanstack/react-query";
|
|
3
|
+
import { Loader2 as te, FilePen as Xe, Users2 as xe, Plus as ge, X as ye, ChevronDown as Ie, Search as Te, Check as Je } from "lucide-react";
|
|
4
|
+
import { useState as T, useMemo as de, useEffect as ve, Fragment as rt, useRef as ue } from "react";
|
|
5
|
+
import { createPortal as gt } from "react-dom";
|
|
6
|
+
import { toast as O } from "sonner";
|
|
7
|
+
import { useNivaroClient as re } from "../../context.js";
|
|
8
|
+
import { get as K, post as A, del as ce, patch as Fe } from "../../lib/commands.js";
|
|
9
|
+
import { queryKeys as be } from "../../lib/query-keys.js";
|
|
10
|
+
import { toastError as yt } from "../../lib/error-toast.js";
|
|
11
|
+
import { UserAvatar as Oe } from "../UserAvatar.js";
|
|
12
|
+
import { Button as Se } from "../ui/button.js";
|
|
13
|
+
import { Popover as Pe, PopoverTrigger as Ee, PopoverContent as Ke } from "../ui/popover.js";
|
|
14
|
+
import { OwnerRecordTrial as vt } from "./OwnerRecordTrial.js";
|
|
15
|
+
import { draftDelta as Nt, draftAddUser as wt, draftAddTeam as kt, draftRemoveTeam as _t, draftCreateGroup as qt, draftPatchGroup as Ye, draftRemoveUser as Ft, draftSaveOps as Ct, cloneGroupsMap as $t } from "./owner-matrix-draft.js";
|
|
16
|
+
import { findM2ORelation as Ce, findO2MRelation as Ze, renderDisplayTemplate as $e } from "./relations.js";
|
|
17
|
+
import { TeamScopeEditor as St } from "./TeamScopeEditor.js";
|
|
18
|
+
import { useScopeDimensions as jt, rankTeamForFilters as at, tierOrder as et } from "./teamScopes.js";
|
|
19
|
+
function It(f) {
|
|
20
|
+
return [...f].sort((b, v) => {
|
|
21
|
+
const o = Number(b.label), N = Number(v.label);
|
|
22
|
+
return !Number.isNaN(o) && !Number.isNaN(N) ? o - N : b.label.localeCompare(v.label, void 0, { sensitivity: "base" });
|
|
19
23
|
});
|
|
20
24
|
}
|
|
21
|
-
function
|
|
22
|
-
label:
|
|
23
|
-
value:
|
|
24
|
-
options:
|
|
25
|
-
onChange:
|
|
26
|
-
onSearch:
|
|
27
|
-
loading:
|
|
25
|
+
function Tt({
|
|
26
|
+
label: f,
|
|
27
|
+
value: b,
|
|
28
|
+
options: v,
|
|
29
|
+
onChange: o,
|
|
30
|
+
onSearch: N,
|
|
31
|
+
loading: c
|
|
28
32
|
}) {
|
|
29
|
-
var
|
|
30
|
-
const [
|
|
31
|
-
x.current =
|
|
32
|
-
|
|
33
|
+
var m;
|
|
34
|
+
const [y, _] = T(!1), [$, F] = T(""), j = ue(null), w = ue(null), C = de(() => It(v), [v]), x = ue(N);
|
|
35
|
+
x.current = N, ve(() => {
|
|
36
|
+
y ? setTimeout(() => {
|
|
33
37
|
var u;
|
|
34
|
-
return (u =
|
|
35
|
-
}, 50) : (
|
|
36
|
-
}, [
|
|
37
|
-
const
|
|
38
|
-
|
|
39
|
-
},
|
|
40
|
-
return /* @__PURE__ */ l(
|
|
41
|
-
/* @__PURE__ */ t(
|
|
38
|
+
return (u = j.current) == null ? void 0 : u.focus();
|
|
39
|
+
}, 50) : (F(""), x.current(""));
|
|
40
|
+
}, [y]);
|
|
41
|
+
const E = (u) => {
|
|
42
|
+
F(u), w.current && clearTimeout(w.current), w.current = setTimeout(() => N(u.trim()), 300);
|
|
43
|
+
}, W = b ? ((m = v.find((u) => u.value === b)) == null ? void 0 : m.label) ?? b : null;
|
|
44
|
+
return /* @__PURE__ */ l(Pe, { open: y, onOpenChange: _, children: [
|
|
45
|
+
/* @__PURE__ */ t(Ee, { asChild: !0, children: /* @__PURE__ */ l(
|
|
42
46
|
"button",
|
|
43
47
|
{
|
|
44
48
|
type: "button",
|
|
45
|
-
className: `flex h-7 items-center gap-1 rounded-md border pl-2.5 text-[12px] transition-colors ${
|
|
49
|
+
className: `flex h-7 items-center gap-1 rounded-md border pl-2.5 text-[12px] transition-colors ${b ? "border-nvr-cyan/50 bg-nvr-cyan/5 font-medium text-nvr-cyan pr-1" : "border-slate-200 bg-white text-slate-600 hover:border-slate-300 pr-2.5"}`,
|
|
46
50
|
children: [
|
|
47
|
-
/* @__PURE__ */ t("span", { children:
|
|
48
|
-
|
|
51
|
+
/* @__PURE__ */ t("span", { children: W ?? `All ${f}` }),
|
|
52
|
+
b ? /* @__PURE__ */ t(
|
|
49
53
|
"button",
|
|
50
54
|
{
|
|
51
55
|
type: "button",
|
|
52
56
|
onClick: (u) => {
|
|
53
|
-
u.stopPropagation(),
|
|
57
|
+
u.stopPropagation(), o(""), N("");
|
|
54
58
|
},
|
|
55
59
|
className: "flex h-5 w-5 items-center justify-center rounded hover:bg-nvr-cyan/20",
|
|
56
|
-
children: /* @__PURE__ */ t(
|
|
60
|
+
children: /* @__PURE__ */ t(ye, { className: "h-3 w-3" })
|
|
57
61
|
}
|
|
58
|
-
) :
|
|
62
|
+
) : c ? /* @__PURE__ */ t(te, { className: "h-3 w-3 animate-spin opacity-50" }) : /* @__PURE__ */ t(Ie, { className: "h-3 w-3 opacity-50" })
|
|
59
63
|
]
|
|
60
64
|
}
|
|
61
65
|
) }),
|
|
62
|
-
/* @__PURE__ */ l(
|
|
66
|
+
/* @__PURE__ */ l(Ke, { align: "start", className: "w-56 p-0", sideOffset: 4, children: [
|
|
63
67
|
/* @__PURE__ */ t("div", { className: "border-b border-slate-100 px-2 py-1.5", children: /* @__PURE__ */ l("div", { className: "relative", children: [
|
|
64
|
-
/* @__PURE__ */ t(
|
|
68
|
+
/* @__PURE__ */ t(Te, { className: "absolute left-2 top-1/2 h-3.5 w-3.5 -translate-y-1/2 text-slate-400" }),
|
|
65
69
|
/* @__PURE__ */ t(
|
|
66
70
|
"input",
|
|
67
71
|
{
|
|
68
|
-
ref:
|
|
69
|
-
value:
|
|
70
|
-
onChange: (u) =>
|
|
71
|
-
placeholder: `Search ${
|
|
72
|
+
ref: j,
|
|
73
|
+
value: $,
|
|
74
|
+
onChange: (u) => E(u.target.value),
|
|
75
|
+
placeholder: `Search ${f.toLowerCase()}…`,
|
|
72
76
|
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"
|
|
73
77
|
}
|
|
74
78
|
)
|
|
@@ -79,28 +83,28 @@ function ut({
|
|
|
79
83
|
{
|
|
80
84
|
type: "button",
|
|
81
85
|
onClick: () => {
|
|
82
|
-
|
|
86
|
+
o(""), _(!1);
|
|
83
87
|
},
|
|
84
|
-
className: `flex w-full items-center gap-2 px-3 py-1.5 text-[12px] hover:bg-slate-50 ${
|
|
88
|
+
className: `flex w-full items-center gap-2 px-3 py-1.5 text-[12px] hover:bg-slate-50 ${b ? "text-slate-500" : "font-medium text-slate-800"}`,
|
|
85
89
|
children: [
|
|
86
|
-
/* @__PURE__ */ t(
|
|
90
|
+
/* @__PURE__ */ t(Je, { className: `h-3.5 w-3.5 shrink-0 ${b ? "opacity-0" : "text-nvr-cyan"}` }),
|
|
87
91
|
"All"
|
|
88
92
|
]
|
|
89
93
|
}
|
|
90
94
|
),
|
|
91
|
-
|
|
95
|
+
C.map((u) => /* @__PURE__ */ l(
|
|
92
96
|
"button",
|
|
93
97
|
{
|
|
94
98
|
type: "button",
|
|
95
99
|
onClick: () => {
|
|
96
|
-
|
|
100
|
+
o(u.value), _(!1);
|
|
97
101
|
},
|
|
98
|
-
className: `flex w-full items-center gap-2 px-3 py-1.5 text-[12px] hover:bg-slate-50 ${
|
|
102
|
+
className: `flex w-full items-center gap-2 px-3 py-1.5 text-[12px] hover:bg-slate-50 ${b === u.value ? "font-medium text-slate-800" : "text-slate-600"}`,
|
|
99
103
|
children: [
|
|
100
104
|
/* @__PURE__ */ t(
|
|
101
|
-
|
|
105
|
+
Je,
|
|
102
106
|
{
|
|
103
|
-
className: `h-3.5 w-3.5 shrink-0 ${
|
|
107
|
+
className: `h-3.5 w-3.5 shrink-0 ${b === u.value ? "text-nvr-cyan" : "opacity-0"}`
|
|
104
108
|
}
|
|
105
109
|
),
|
|
106
110
|
u.label
|
|
@@ -108,512 +112,633 @@ function ut({
|
|
|
108
112
|
},
|
|
109
113
|
u.value
|
|
110
114
|
)),
|
|
111
|
-
|
|
115
|
+
C.length === 0 && /* @__PURE__ */ t("div", { className: "px-3 py-2 text-[12px] text-slate-400", children: "No results" })
|
|
112
116
|
] })
|
|
113
117
|
] })
|
|
114
118
|
] });
|
|
115
119
|
}
|
|
116
|
-
function
|
|
117
|
-
const
|
|
120
|
+
function le(f, b, v, o) {
|
|
121
|
+
const N = f.field.split("."), c = N.length > 1 ? N[N.length - 1] : f.field, _ = [...v ?? [], ...o ?? []].find((F) => String(F[c] ?? "") === b);
|
|
118
122
|
if (!_) return null;
|
|
119
|
-
const
|
|
120
|
-
return typeof
|
|
123
|
+
const $ = _.id;
|
|
124
|
+
return typeof $ == "number" ? $ : typeof $ == "string" && Number($) || null;
|
|
121
125
|
}
|
|
122
|
-
function
|
|
123
|
-
const
|
|
124
|
-
let
|
|
125
|
-
for (let
|
|
126
|
-
return
|
|
126
|
+
function Ot(f, b, v) {
|
|
127
|
+
const o = f.split(".");
|
|
128
|
+
let N = { _eq: v };
|
|
129
|
+
for (let c = o.length - 1; c >= 1; c--) N = { [o[c]]: N };
|
|
130
|
+
return b ? { [o[0]]: { _some: N } } : o.length > 1 ? { [o[0]]: N } : { [o[0]]: { _eq: v } };
|
|
127
131
|
}
|
|
128
|
-
function
|
|
129
|
-
const
|
|
130
|
-
return [
|
|
132
|
+
function nt(f, b) {
|
|
133
|
+
const v = f.role ? (b == null ? void 0 : b.get(String(f.role).toUpperCase())) ?? null : null;
|
|
134
|
+
return [f.title || v, f.department].filter(Boolean).join(" · ") || f.email;
|
|
131
135
|
}
|
|
132
|
-
function
|
|
133
|
-
const
|
|
136
|
+
function st() {
|
|
137
|
+
const f = re(), { data: b } = V({
|
|
134
138
|
queryKey: ["roles-name-map"],
|
|
135
|
-
queryFn: () =>
|
|
139
|
+
queryFn: () => f.request(K("/roles")).then((v) => new Map(v.data.map((o) => [String(o.id).toUpperCase(), o.name]))).catch(() => null),
|
|
136
140
|
staleTime: 5 * 6e4
|
|
137
141
|
});
|
|
138
|
-
return
|
|
142
|
+
return b ?? null;
|
|
139
143
|
}
|
|
140
|
-
function
|
|
141
|
-
const
|
|
142
|
-
queryKey: ["people-search",
|
|
143
|
-
queryFn: () =>
|
|
144
|
-
|
|
145
|
-
).then((
|
|
144
|
+
function Pt(f) {
|
|
145
|
+
const b = re(), v = f.trim(), { data: o, isFetching: N } = V({
|
|
146
|
+
queryKey: ["people-search", v],
|
|
147
|
+
queryFn: () => b.request(
|
|
148
|
+
K("/users", { limit: 50, sort: "first_name", search: v || void 0 })
|
|
149
|
+
).then((c) => c.data),
|
|
146
150
|
staleTime: 6e4
|
|
147
151
|
});
|
|
148
|
-
return { people:
|
|
152
|
+
return { people: o ?? [], isFetching: N };
|
|
149
153
|
}
|
|
150
|
-
function
|
|
151
|
-
const
|
|
152
|
-
return
|
|
154
|
+
function Be(f) {
|
|
155
|
+
const b = [f.first_name, f.last_name].filter(Boolean);
|
|
156
|
+
return b.length ? b.map((v) => v[0]).join("").toUpperCase() : f.email[0].toUpperCase();
|
|
153
157
|
}
|
|
154
|
-
function
|
|
155
|
-
var
|
|
156
|
-
const
|
|
157
|
-
queryKey: ["pipeline-all-owner-groups",
|
|
158
|
-
queryFn: () =>
|
|
159
|
-
}), [
|
|
160
|
-
queryKey:
|
|
161
|
-
queryFn: () =>
|
|
162
|
-
enabled: !!
|
|
163
|
-
}),
|
|
164
|
-
(e) => e.many_collection ===
|
|
165
|
-
) ?? null : null,
|
|
166
|
-
(e) => e.one_collection ===
|
|
167
|
-
) ?? null : null,
|
|
168
|
-
(e) => e.many_collection ===
|
|
169
|
-
) ?? null : null,
|
|
170
|
-
const
|
|
158
|
+
function sr({ templateId: f, states: b, bindings: v }) {
|
|
159
|
+
var He;
|
|
160
|
+
const o = re(), N = v.flatMap((e) => e.dimensions ?? []), c = N.find((e) => e.is_row_axis) ?? null, y = N.filter((e) => !e.is_row_axis), { data: _, isLoading: $ } = V({
|
|
161
|
+
queryKey: ["pipeline-all-owner-groups", f],
|
|
162
|
+
queryFn: () => o.request(K(`/pipelines/${f}/owner-groups`)).then((e) => e.data)
|
|
163
|
+
}), [F, j] = T(!1), [w, C] = T(null), x = w ?? _, E = de(() => Nt(_, w), [_, w]), W = jt(), m = ((He = v[0]) == null ? void 0 : He.collection) ?? "", { data: u } = V({
|
|
164
|
+
queryKey: be.collectionMeta(m),
|
|
165
|
+
queryFn: () => o.request(K(`/collections/${m}`)).then((e) => e.data),
|
|
166
|
+
enabled: !!m && (!!c || y.length > 0)
|
|
167
|
+
}), q = (u == null ? void 0 : u.relations) ?? [], Q = c ? c.field.split(".") : [], B = Q[0] ?? "", ae = Q[1] ?? null, R = c ? Ce(q, m, B) ?? null : null, M = !R && c ? q.find(
|
|
168
|
+
(e) => e.many_collection === m && e.many_field === B && e.junction_field !== null && e.one_collection
|
|
169
|
+
) ?? null : null, H = !R && !M && c ? q.find(
|
|
170
|
+
(e) => e.one_collection === m && e.one_field === B && e.junction_field !== null
|
|
171
|
+
) ?? null : null, Z = H ? q.find(
|
|
172
|
+
(e) => e.many_collection === H.many_collection && e.many_field === H.junction_field && e.one_collection
|
|
173
|
+
) ?? null : null, ne = !R && !M && !H && c ? Ze(q, m, B) ?? null : null, p = (R == null ? void 0 : R.one_collection) ?? (M == null ? void 0 : M.one_collection) ?? (Z == null ? void 0 : Z.one_collection) ?? (H == null ? void 0 : H.many_collection) ?? (ne == null ? void 0 : ne.many_collection) ?? null, ie = !!c && Q.length === 1 && !p, Ne = p ?? (ie ? m : null), me = ae ?? (ie ? B : null), we = y.map((e) => {
|
|
174
|
+
const a = e.field.split(".");
|
|
171
175
|
return {
|
|
172
|
-
baseField:
|
|
176
|
+
baseField: a[0],
|
|
173
177
|
// segments between base and leaf for 3+ part paths
|
|
174
|
-
midFields:
|
|
178
|
+
midFields: a.length > 2 ? a.slice(1, -1) : [],
|
|
175
179
|
// leaf = sub-field to display/filter by; null when path is a direct relation field
|
|
176
|
-
leafField:
|
|
180
|
+
leafField: a.length > 1 ? a[a.length - 1] : null
|
|
177
181
|
};
|
|
178
|
-
}),
|
|
179
|
-
const
|
|
180
|
-
if (r != null && r.one_collection) return r.one_collection;
|
|
181
|
-
const a = j.find(
|
|
182
|
-
(o) => o.many_collection === k && o.many_field === e && o.junction_field !== null && o.one_collection
|
|
183
|
-
);
|
|
182
|
+
}), Ue = we.map(({ baseField: e }) => {
|
|
183
|
+
const a = Ce(q, m, e);
|
|
184
184
|
if (a != null && a.one_collection) return a.one_collection;
|
|
185
|
-
const
|
|
186
|
-
(
|
|
185
|
+
const r = q.find(
|
|
186
|
+
(d) => d.many_collection === m && d.many_field === e && d.junction_field !== null && d.one_collection
|
|
187
187
|
);
|
|
188
|
-
if (
|
|
189
|
-
|
|
190
|
-
|
|
188
|
+
if (r != null && r.one_collection) return r.one_collection;
|
|
189
|
+
const n = q.find(
|
|
190
|
+
(d) => d.one_collection === m && d.one_field === e && d.junction_field !== null
|
|
191
|
+
);
|
|
192
|
+
if (n) {
|
|
193
|
+
const d = q.find(
|
|
194
|
+
(g) => g.many_collection === n.many_collection && g.many_field === n.junction_field && g.one_collection
|
|
191
195
|
);
|
|
192
|
-
if (
|
|
196
|
+
if (d != null && d.one_collection) return d.one_collection;
|
|
193
197
|
}
|
|
194
|
-
const
|
|
195
|
-
return
|
|
196
|
-
}),
|
|
197
|
-
queries:
|
|
198
|
-
const
|
|
199
|
-
return !
|
|
200
|
-
queryKey: ["noop-inter",
|
|
198
|
+
const i = Ze(q, m, e);
|
|
199
|
+
return i != null && i.many_collection ? i.many_collection : null;
|
|
200
|
+
}), lt = qe({
|
|
201
|
+
queries: we.map((e, a) => {
|
|
202
|
+
const r = Ue[a];
|
|
203
|
+
return !r || e.midFields.length === 0 ? {
|
|
204
|
+
queryKey: ["noop-inter", a],
|
|
201
205
|
queryFn: async () => null,
|
|
202
206
|
enabled: !1
|
|
203
207
|
} : {
|
|
204
|
-
queryKey:
|
|
205
|
-
queryFn: () =>
|
|
208
|
+
queryKey: be.collectionMeta(r),
|
|
209
|
+
queryFn: () => o.request(K(`/collections/${r}`)).then((n) => n.data)
|
|
206
210
|
};
|
|
207
211
|
})
|
|
208
|
-
}),
|
|
209
|
-
var
|
|
210
|
-
const
|
|
211
|
-
if (!
|
|
212
|
+
}), pe = we.map((e, a) => {
|
|
213
|
+
var g;
|
|
214
|
+
const r = Ue[a];
|
|
215
|
+
if (!r) return null;
|
|
212
216
|
if (e.midFields.length === 0)
|
|
213
|
-
return { relatedCollection:
|
|
214
|
-
const
|
|
215
|
-
if (!
|
|
216
|
-
let
|
|
217
|
-
const
|
|
218
|
-
for (const
|
|
219
|
-
const
|
|
220
|
-
(
|
|
217
|
+
return { relatedCollection: r, subField: e.leafField };
|
|
218
|
+
const n = (g = lt[a]) == null ? void 0 : g.data;
|
|
219
|
+
if (!n) return null;
|
|
220
|
+
let i = r;
|
|
221
|
+
const d = n.relations ?? [];
|
|
222
|
+
for (const s of e.midFields) {
|
|
223
|
+
const k = Ce(d, i, s) ?? d.find(
|
|
224
|
+
(h) => h.many_collection === i && h.many_field === s && h.one_collection
|
|
221
225
|
) ?? null;
|
|
222
|
-
if (!
|
|
223
|
-
|
|
226
|
+
if (!k) return null;
|
|
227
|
+
i = k.one_collection ?? i;
|
|
224
228
|
}
|
|
225
|
-
return { relatedCollection:
|
|
226
|
-
}), [
|
|
227
|
-
const
|
|
228
|
-
return
|
|
229
|
-
}).join("&"),
|
|
230
|
-
queries:
|
|
231
|
-
const
|
|
232
|
-
if (
|
|
233
|
-
const
|
|
229
|
+
return { relatedCollection: i, subField: e.leafField };
|
|
230
|
+
}), [P, it] = T({}), [ot, dt] = T({}), ct = (e) => (e.cascade ?? []).map((a) => {
|
|
231
|
+
const r = y.find((n) => n.field === a.parent_field);
|
|
232
|
+
return r ? `${a.parent_field}=${P[r.id] ?? ""}` : "";
|
|
233
|
+
}).join("&"), oe = qe({
|
|
234
|
+
queries: y.map((e, a) => {
|
|
235
|
+
const r = pe[a], n = ot[e.id] ?? "";
|
|
236
|
+
if (r != null && r.relatedCollection) {
|
|
237
|
+
const i = ct(e);
|
|
234
238
|
return {
|
|
235
|
-
queryKey: ["items-picker",
|
|
239
|
+
queryKey: ["items-picker", r.relatedCollection, n, i],
|
|
236
240
|
queryFn: async () => {
|
|
237
|
-
const
|
|
238
|
-
for (const
|
|
239
|
-
const
|
|
240
|
-
if (
|
|
241
|
-
const
|
|
242
|
-
if (!
|
|
243
|
-
const
|
|
244
|
-
let
|
|
245
|
-
if (
|
|
246
|
-
const
|
|
247
|
-
|
|
241
|
+
const d = [];
|
|
242
|
+
for (const g of e.cascade ?? []) {
|
|
243
|
+
const s = y.findIndex((I) => I.field === g.parent_field);
|
|
244
|
+
if (s < 0) continue;
|
|
245
|
+
const k = P[y[s].id];
|
|
246
|
+
if (!k) continue;
|
|
247
|
+
const h = pe[s];
|
|
248
|
+
let S = k;
|
|
249
|
+
if (h != null && h.relatedCollection && h.subField) {
|
|
250
|
+
const I = await o.request(
|
|
251
|
+
K(`/items/${h.relatedCollection}`, {
|
|
248
252
|
limit: 1,
|
|
249
253
|
fields: "id",
|
|
250
|
-
filter: JSON.stringify({ [
|
|
254
|
+
filter: JSON.stringify({ [h.subField]: { _eq: k } })
|
|
251
255
|
})
|
|
252
|
-
).then((
|
|
253
|
-
if (
|
|
254
|
-
|
|
256
|
+
).then((D) => D.data).catch(() => []);
|
|
257
|
+
if (I.length === 0) continue;
|
|
258
|
+
S = I[0].id;
|
|
255
259
|
}
|
|
256
|
-
|
|
260
|
+
d.push(Ot(g.filter, g.via_many, S));
|
|
257
261
|
}
|
|
258
|
-
return
|
|
259
|
-
|
|
262
|
+
return o.request(
|
|
263
|
+
K(`/items/${r.relatedCollection}`, {
|
|
260
264
|
limit: 100,
|
|
261
|
-
...
|
|
262
|
-
...
|
|
265
|
+
...n ? { search: n } : {},
|
|
266
|
+
...d.length > 0 ? { filter: JSON.stringify({ _and: d }) } : {}
|
|
263
267
|
})
|
|
264
|
-
).then((
|
|
268
|
+
).then((g) => g.data);
|
|
265
269
|
}
|
|
266
270
|
};
|
|
267
271
|
}
|
|
268
272
|
return {
|
|
269
|
-
queryKey: ["noop-items",
|
|
273
|
+
queryKey: ["noop-items", a],
|
|
270
274
|
queryFn: async () => [],
|
|
271
275
|
enabled: !1
|
|
272
276
|
};
|
|
273
277
|
})
|
|
274
|
-
}),
|
|
275
|
-
queries:
|
|
276
|
-
const
|
|
277
|
-
return !(
|
|
278
|
+
}), ut = qe({
|
|
279
|
+
queries: y.map((e, a) => {
|
|
280
|
+
const r = pe[a];
|
|
281
|
+
return !(r != null && r.relatedCollection) || r.subField ? {
|
|
278
282
|
queryKey: ["noop-meta", e.id],
|
|
279
283
|
queryFn: async () => null,
|
|
280
284
|
enabled: !1
|
|
281
285
|
} : {
|
|
282
|
-
queryKey:
|
|
283
|
-
queryFn: () =>
|
|
286
|
+
queryKey: be.collectionMeta(r.relatedCollection),
|
|
287
|
+
queryFn: () => o.request(K(`/collections/${r.relatedCollection}`)).then((n) => n.data)
|
|
284
288
|
};
|
|
285
289
|
})
|
|
286
|
-
}), { data:
|
|
287
|
-
queryKey: ["items-picker",
|
|
288
|
-
queryFn: () =>
|
|
289
|
-
|
|
290
|
+
}), { data: X } = V({
|
|
291
|
+
queryKey: ["items-picker", Ne],
|
|
292
|
+
queryFn: () => o.request(
|
|
293
|
+
K(`/items/${Ne}`, { limit: 500 })
|
|
290
294
|
).then((e) => e.data),
|
|
291
|
-
enabled: !!
|
|
292
|
-
}), { data:
|
|
293
|
-
queryKey:
|
|
294
|
-
queryFn: () =>
|
|
295
|
-
enabled: !!
|
|
296
|
-
}), [
|
|
295
|
+
enabled: !!Ne
|
|
296
|
+
}), { data: ee } = V({
|
|
297
|
+
queryKey: be.collectionMeta(p),
|
|
298
|
+
queryFn: () => o.request(K(`/collections/${p}`)).then((e) => e.data),
|
|
299
|
+
enabled: !!p && !ae
|
|
300
|
+
}), [L, ke] = T(
|
|
297
301
|
null
|
|
298
302
|
);
|
|
299
|
-
|
|
300
|
-
if (!
|
|
301
|
-
const e = (
|
|
302
|
-
const
|
|
303
|
-
|
|
303
|
+
ve(() => {
|
|
304
|
+
if (!L) return;
|
|
305
|
+
const e = (a) => {
|
|
306
|
+
const r = a.target;
|
|
307
|
+
r && (r.closest("[data-omx-editor]") || r.closest("[data-omx-overlay]") || r.closest("[data-radix-popper-content-wrapper]") || r.closest("[data-nvr-combobox-panel]") || r.closest('[role="dialog"]') || ke(null));
|
|
304
308
|
};
|
|
305
309
|
return document.addEventListener("mousedown", e), () => document.removeEventListener("mousedown", e);
|
|
306
|
-
}, [
|
|
307
|
-
const
|
|
308
|
-
if (!
|
|
310
|
+
}, [L]);
|
|
311
|
+
const Ae = de(() => {
|
|
312
|
+
if (!c || !x) return [];
|
|
309
313
|
const e = /* @__PURE__ */ new Map();
|
|
310
|
-
for (const
|
|
311
|
-
for (const
|
|
312
|
-
for (const
|
|
313
|
-
|
|
314
|
-
return [...e.entries()].map(([
|
|
315
|
-
}, [
|
|
316
|
-
const e = [],
|
|
317
|
-
|
|
314
|
+
for (const a of Object.values(x))
|
|
315
|
+
for (const r of a)
|
|
316
|
+
for (const n of r.filters ?? [])
|
|
317
|
+
n.field === c.field && n.op === "eq" && !e.has(String(n.value)) && e.set(String(n.value), String(n.value));
|
|
318
|
+
return [...e.entries()].map(([a, r]) => ({ value: a, label: r }));
|
|
319
|
+
}, [c, x]), De = de(() => {
|
|
320
|
+
const e = [], a = (n) => {
|
|
321
|
+
n.value !== "" && !e.some((i) => i.value === n.value) && e.push(n);
|
|
318
322
|
};
|
|
319
|
-
if (
|
|
320
|
-
if (
|
|
321
|
-
const
|
|
322
|
-
...new Set(
|
|
323
|
+
if (X)
|
|
324
|
+
if (me) {
|
|
325
|
+
const n = [
|
|
326
|
+
...new Set(X.map((i) => String(i[me] ?? "")).filter(Boolean))
|
|
323
327
|
];
|
|
324
|
-
|
|
325
|
-
for (const
|
|
328
|
+
n.sort((i, d) => i.localeCompare(d));
|
|
329
|
+
for (const i of n) a({ value: i, label: i });
|
|
326
330
|
} else {
|
|
327
|
-
const
|
|
328
|
-
for (const
|
|
329
|
-
|
|
331
|
+
const n = (ee == null ? void 0 : ee.display_template) ?? null;
|
|
332
|
+
for (const i of X)
|
|
333
|
+
a({ value: String(i.id), label: $e(n, i) });
|
|
330
334
|
}
|
|
331
|
-
for (const
|
|
332
|
-
if (
|
|
333
|
-
const
|
|
334
|
-
return e.map((
|
|
335
|
-
const
|
|
336
|
-
return
|
|
335
|
+
for (const n of Ae) a(n);
|
|
336
|
+
if (me || !p || !X) return e;
|
|
337
|
+
const r = (ee == null ? void 0 : ee.display_template) ?? null;
|
|
338
|
+
return e.map((n) => {
|
|
339
|
+
const i = X.find((d) => String(d.id) === n.value);
|
|
340
|
+
return i ? { value: n.value, label: $e(r, i) } : n;
|
|
337
341
|
});
|
|
338
|
-
}, [
|
|
339
|
-
function
|
|
340
|
-
if (!
|
|
341
|
-
const
|
|
342
|
-
for (const
|
|
343
|
-
|
|
344
|
-
const
|
|
345
|
-
const
|
|
346
|
-
return
|
|
347
|
-
(
|
|
348
|
-
) ?
|
|
349
|
-
(
|
|
342
|
+
}, [Ae, me, p, X, ee]);
|
|
343
|
+
function se(e, a) {
|
|
344
|
+
if (!c || !x) return { group: null, isInherited: !1 };
|
|
345
|
+
const r = x[e] ?? [], n = { [c.field]: a };
|
|
346
|
+
for (const h of y)
|
|
347
|
+
P[h.id] && (n[h.field] = P[h.id]);
|
|
348
|
+
const i = r.filter((h) => {
|
|
349
|
+
const S = h.filters ?? [];
|
|
350
|
+
return S.some(
|
|
351
|
+
(I) => I.field === c.field && I.op === "eq" && String(I.value) === a
|
|
352
|
+
) ? S.every(
|
|
353
|
+
(I) => I.op === "eq" && n[I.field] !== void 0 && String(n[I.field]) === String(I.value)
|
|
350
354
|
) : !1;
|
|
351
355
|
});
|
|
352
|
-
if (
|
|
353
|
-
const
|
|
354
|
-
const
|
|
355
|
-
return
|
|
356
|
-
})[0],
|
|
357
|
-
(
|
|
358
|
-
var
|
|
359
|
-
return (
|
|
356
|
+
if (i.length === 0) return { group: null, isInherited: !1 };
|
|
357
|
+
const g = [...i].sort((h, S) => {
|
|
358
|
+
const I = (S.filters ?? []).length - (h.filters ?? []).length;
|
|
359
|
+
return I !== 0 ? I : (h.priority ?? 0) - (S.priority ?? 0);
|
|
360
|
+
})[0], s = y.filter((h) => !h.required && P[h.id]), k = s.length > 0 && !s.every(
|
|
361
|
+
(h) => {
|
|
362
|
+
var S;
|
|
363
|
+
return (S = g.filters) == null ? void 0 : S.some((I) => I.field === h.field && String(I.value) === P[h.id]);
|
|
360
364
|
}
|
|
361
365
|
);
|
|
362
|
-
return { group:
|
|
366
|
+
return { group: g, isInherited: k };
|
|
363
367
|
}
|
|
364
|
-
function
|
|
365
|
-
if (!
|
|
366
|
-
const
|
|
367
|
-
return
|
|
368
|
-
(
|
|
368
|
+
function mt(e, a) {
|
|
369
|
+
if (!c || !x) return !1;
|
|
370
|
+
const r = x[e] ?? [], n = new Set(y.filter((i) => !i.required).map((i) => i.field));
|
|
371
|
+
return n.size === 0 ? !1 : r.some(
|
|
372
|
+
(i) => (i.filters ?? []).some((d) => d.field === c.field && String(d.value) === a) && (i.filters ?? []).some((d) => n.has(d.field))
|
|
369
373
|
);
|
|
370
374
|
}
|
|
371
|
-
const
|
|
375
|
+
const fe = tt(), z = () => fe.invalidateQueries({ queryKey: ["pipeline-all-owner-groups", f] }), U = "drafted", Me = (e, a) => {
|
|
376
|
+
const { group: r, isInherited: n } = se(e, a);
|
|
377
|
+
return !n && r ? r.id : null;
|
|
378
|
+
}, Le = G({
|
|
372
379
|
mutationFn: async ({
|
|
373
380
|
stateId: e,
|
|
374
|
-
rowValue:
|
|
375
|
-
userId:
|
|
381
|
+
rowValue: a,
|
|
382
|
+
userId: r,
|
|
383
|
+
user: n
|
|
376
384
|
}) => {
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
385
|
+
if (w) {
|
|
386
|
+
const s = Me(e, a), k = J(e, a), h = n ? {
|
|
387
|
+
id: String(n.id),
|
|
388
|
+
first_name: n.first_name ?? null,
|
|
389
|
+
last_name: n.last_name ?? null,
|
|
390
|
+
email: n.email
|
|
391
|
+
} : { id: r, first_name: null, last_name: null, email: r };
|
|
392
|
+
return C((S) => S && wt(S, { stateId: e, groupId: s, filters: k, user: h })), U;
|
|
393
|
+
}
|
|
394
|
+
const { group: i, isInherited: d } = se(e, a);
|
|
395
|
+
let g = d ? null : i;
|
|
396
|
+
if (!g) {
|
|
397
|
+
const s = oe.flatMap(
|
|
398
|
+
(D) => D.data ?? []
|
|
399
|
+
), k = {
|
|
400
|
+
field: (c == null ? void 0 : c.field) ?? "",
|
|
384
401
|
op: "eq",
|
|
385
|
-
value:
|
|
386
|
-
id_value:
|
|
387
|
-
},
|
|
388
|
-
field:
|
|
402
|
+
value: a,
|
|
403
|
+
id_value: c ? le(c, a, X, void 0) : void 0
|
|
404
|
+
}, h = y.filter((D) => P[D.id]).map((D) => ({
|
|
405
|
+
field: D.field,
|
|
389
406
|
op: "eq",
|
|
390
|
-
value:
|
|
391
|
-
id_value:
|
|
392
|
-
})),
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
filters:
|
|
407
|
+
value: P[D.id],
|
|
408
|
+
id_value: le(D, P[D.id], void 0, s)
|
|
409
|
+
})), S = [k, ...h];
|
|
410
|
+
g = (await o.request(
|
|
411
|
+
A(`/pipelines/states/${e}/owner-groups`, {
|
|
412
|
+
filters: S,
|
|
396
413
|
is_default: !1,
|
|
397
414
|
sort: 0,
|
|
398
415
|
priority: 0
|
|
399
416
|
})
|
|
400
417
|
)).data;
|
|
401
418
|
}
|
|
402
|
-
return
|
|
419
|
+
return o.request(A(`/pipelines/owner-groups/${g.id}/users`, { user: r }));
|
|
403
420
|
},
|
|
404
|
-
onSuccess: () => {
|
|
405
|
-
z(),
|
|
421
|
+
onSuccess: (e) => {
|
|
422
|
+
e !== U && (z(), O.success("Owner added"));
|
|
406
423
|
},
|
|
407
|
-
onError: () =>
|
|
408
|
-
}),
|
|
409
|
-
const
|
|
410
|
-
(
|
|
411
|
-
),
|
|
412
|
-
field: (
|
|
424
|
+
onError: () => O.error("Failed to add owner")
|
|
425
|
+
}), J = (e, a) => {
|
|
426
|
+
const r = oe.flatMap(
|
|
427
|
+
(d) => d.data ?? []
|
|
428
|
+
), n = {
|
|
429
|
+
field: (c == null ? void 0 : c.field) ?? "",
|
|
413
430
|
op: "eq",
|
|
414
|
-
value:
|
|
415
|
-
id_value:
|
|
416
|
-
},
|
|
417
|
-
field:
|
|
431
|
+
value: a,
|
|
432
|
+
id_value: c ? le(c, a, X, void 0) : void 0
|
|
433
|
+
}, i = y.filter((d) => P[d.id]).map((d) => ({
|
|
434
|
+
field: d.field,
|
|
418
435
|
op: "eq",
|
|
419
|
-
value:
|
|
420
|
-
id_value:
|
|
436
|
+
value: P[d.id],
|
|
437
|
+
id_value: le(d, P[d.id], void 0, r)
|
|
421
438
|
}));
|
|
422
|
-
return [
|
|
423
|
-
}, { data:
|
|
439
|
+
return [n, ...i];
|
|
440
|
+
}, { data: Qe } = V({
|
|
424
441
|
queryKey: ["user-groups-teams"],
|
|
425
|
-
queryFn: () =>
|
|
442
|
+
queryFn: () => o.request(K("/user-groups")).then((e) => e.data),
|
|
426
443
|
staleTime: 6e4
|
|
427
|
-
}),
|
|
444
|
+
}), Re = G({
|
|
428
445
|
mutationFn: async ({
|
|
429
446
|
stateId: e,
|
|
430
|
-
rowValue:
|
|
431
|
-
teamId:
|
|
447
|
+
rowValue: a,
|
|
448
|
+
teamId: r
|
|
432
449
|
}) => {
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
450
|
+
if (w) {
|
|
451
|
+
const g = (Qe ?? []).find((h) => h.id === r) ?? {
|
|
452
|
+
id: r,
|
|
453
|
+
name: `Team ${r}`,
|
|
454
|
+
slug: "",
|
|
455
|
+
member_count: 0
|
|
456
|
+
}, s = Me(e, a), k = J(e, a);
|
|
457
|
+
return C((h) => h && kt(h, { stateId: e, groupId: s, filters: k, team: g })), U;
|
|
458
|
+
}
|
|
459
|
+
const { group: n, isInherited: i } = se(e, a);
|
|
460
|
+
let d = i ? null : n;
|
|
461
|
+
return d || (d = (await o.request(
|
|
462
|
+
A(`/pipelines/states/${e}/owner-groups`, {
|
|
463
|
+
filters: J(e, a),
|
|
438
464
|
is_default: !1,
|
|
439
465
|
sort: 0,
|
|
440
466
|
priority: 0
|
|
441
467
|
})
|
|
442
|
-
)).data),
|
|
468
|
+
)).data), o.request(A(`/pipelines/owner-groups/${d.id}/teams`, { team_id: r }));
|
|
443
469
|
},
|
|
444
|
-
onSuccess: () => {
|
|
445
|
-
z(),
|
|
470
|
+
onSuccess: (e) => {
|
|
471
|
+
e !== U && (z(), O.success("Team assigned"));
|
|
446
472
|
},
|
|
447
|
-
onError: () =>
|
|
448
|
-
}),
|
|
449
|
-
mutationFn: ({ groupId: e, teamId:
|
|
450
|
-
onSuccess: () => {
|
|
451
|
-
z(),
|
|
473
|
+
onError: () => O.error("Failed to assign team")
|
|
474
|
+
}), pt = G({
|
|
475
|
+
mutationFn: async ({ groupId: e, teamId: a }) => w ? (C((r) => r && _t(r, e, a)), U) : o.request(ce(`/pipelines/owner-groups/${e}/teams/${a}`)),
|
|
476
|
+
onSuccess: (e) => {
|
|
477
|
+
e !== U && (z(), O.success("Team unassigned"));
|
|
452
478
|
},
|
|
453
|
-
onError: () =>
|
|
454
|
-
}), [
|
|
479
|
+
onError: () => O.error("Failed to unassign team")
|
|
480
|
+
}), [ze, _e] = T(null), Ge = G({
|
|
455
481
|
mutationFn: async ({
|
|
456
482
|
stateId: e,
|
|
457
|
-
rowValue:
|
|
458
|
-
name:
|
|
483
|
+
rowValue: a,
|
|
484
|
+
name: r
|
|
459
485
|
}) => {
|
|
460
|
-
const
|
|
461
|
-
|
|
462
|
-
), { group:
|
|
463
|
-
let
|
|
464
|
-
return
|
|
465
|
-
|
|
466
|
-
filters:
|
|
486
|
+
const n = await o.request(
|
|
487
|
+
A("/user-groups", { name: r })
|
|
488
|
+
), { group: i, isInherited: d } = se(e, a);
|
|
489
|
+
let g = d ? null : i;
|
|
490
|
+
return g || (g = (await o.request(
|
|
491
|
+
A(`/pipelines/states/${e}/owner-groups`, {
|
|
492
|
+
filters: J(e, a),
|
|
467
493
|
is_default: !1,
|
|
468
494
|
sort: 0,
|
|
469
495
|
priority: 0
|
|
470
496
|
})
|
|
471
|
-
)).data), await
|
|
472
|
-
|
|
473
|
-
),
|
|
497
|
+
)).data), await o.request(
|
|
498
|
+
A(`/pipelines/owner-groups/${g.id}/teams`, { team_id: n.data.id })
|
|
499
|
+
), n.data;
|
|
474
500
|
},
|
|
475
501
|
onSuccess: (e) => {
|
|
476
|
-
z(),
|
|
502
|
+
z(), fe.invalidateQueries({ queryKey: ["user-groups-teams"] }), O.success(`Team "${e.name}" created and assigned — add its members`), _e({ id: e.id, name: e.name });
|
|
477
503
|
},
|
|
478
504
|
onError: (e) => {
|
|
479
|
-
var
|
|
480
|
-
return
|
|
481
|
-
((
|
|
505
|
+
var a;
|
|
506
|
+
return O.error(
|
|
507
|
+
((a = e == null ? void 0 : e.response) == null ? void 0 : a.error) ?? "Failed to create team"
|
|
482
508
|
);
|
|
483
509
|
}
|
|
484
|
-
}),
|
|
485
|
-
mutationFn: async ({ stateId: e, rowValue:
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
510
|
+
}), Ve = G({
|
|
511
|
+
mutationFn: async ({ stateId: e, rowValue: a }) => {
|
|
512
|
+
if (w) {
|
|
513
|
+
const g = J(e, a);
|
|
514
|
+
return C((s) => s && qt(s, e, g)), U;
|
|
515
|
+
}
|
|
516
|
+
const r = oe.flatMap(
|
|
517
|
+
(g) => g.data ?? []
|
|
518
|
+
), n = {
|
|
519
|
+
field: (c == null ? void 0 : c.field) ?? "",
|
|
490
520
|
op: "eq",
|
|
491
|
-
value:
|
|
492
|
-
id_value:
|
|
493
|
-
},
|
|
494
|
-
field:
|
|
521
|
+
value: a,
|
|
522
|
+
id_value: le(c, a, X, void 0)
|
|
523
|
+
}, i = y.filter((g) => P[g.id]).map((g) => ({
|
|
524
|
+
field: g.field,
|
|
495
525
|
op: "eq",
|
|
496
|
-
value:
|
|
497
|
-
id_value:
|
|
498
|
-
})),
|
|
499
|
-
return
|
|
500
|
-
|
|
501
|
-
filters:
|
|
526
|
+
value: P[g.id],
|
|
527
|
+
id_value: le(g, P[g.id], void 0, r)
|
|
528
|
+
})), d = [n, ...i];
|
|
529
|
+
return o.request(
|
|
530
|
+
A(`/pipelines/states/${e}/owner-groups`, {
|
|
531
|
+
filters: d,
|
|
502
532
|
is_default: !1,
|
|
503
533
|
sort: 0,
|
|
504
534
|
priority: 0
|
|
505
535
|
})
|
|
506
536
|
);
|
|
507
537
|
},
|
|
508
|
-
onSuccess: () => {
|
|
509
|
-
z(),
|
|
538
|
+
onSuccess: (e) => {
|
|
539
|
+
e !== U && (z(), O.success("Override created"));
|
|
540
|
+
},
|
|
541
|
+
onError: () => O.error("Failed to create override")
|
|
542
|
+
}), ft = G({
|
|
543
|
+
mutationFn: async ({ groupId: e, priority: a }) => w ? (C((r) => r && Ye(r, e, { priority: a })), U) : o.request(Fe(`/pipelines/owner-groups/${e}`, { priority: a })),
|
|
544
|
+
onSuccess: (e) => {
|
|
545
|
+
e !== U && z();
|
|
546
|
+
},
|
|
547
|
+
onError: () => O.error("Failed to update priority")
|
|
548
|
+
}), ht = G({
|
|
549
|
+
mutationFn: async ({ groupId: e, maxWip: a }) => w ? (C((r) => r && Ye(r, e, { max_wip: a })), U) : o.request(Fe(`/pipelines/owner-groups/${e}`, { max_wip: a })),
|
|
550
|
+
onSuccess: (e) => {
|
|
551
|
+
e !== U && z();
|
|
552
|
+
},
|
|
553
|
+
onError: () => O.error("Failed to update WIP limit")
|
|
554
|
+
}), bt = G({
|
|
555
|
+
mutationFn: async (e) => w ? (C((a) => a && Ft(a, e)), U) : o.request(ce(`/pipelines/owner-group-users/${e}`)),
|
|
556
|
+
onSuccess: (e) => {
|
|
557
|
+
e !== U && (z(), O.success("Owner removed"));
|
|
558
|
+
},
|
|
559
|
+
onError: () => O.error("Failed to remove owner")
|
|
560
|
+
}), he = G({
|
|
561
|
+
mutationFn: async (e) => {
|
|
562
|
+
const a = /* @__PURE__ */ new Map(), r = (n) => a.get(n) ?? n;
|
|
563
|
+
for (const n of e)
|
|
564
|
+
if (n.kind === "create") {
|
|
565
|
+
const i = await o.request(
|
|
566
|
+
A(`/pipelines/states/${n.stateId}/owner-groups`, {
|
|
567
|
+
filters: n.filters ?? [],
|
|
568
|
+
is_default: !1,
|
|
569
|
+
sort: 0,
|
|
570
|
+
priority: n.priority
|
|
571
|
+
})
|
|
572
|
+
);
|
|
573
|
+
a.set(n.draftId, i.data.id);
|
|
574
|
+
} else n.kind === "patch" ? await o.request(Fe(`/pipelines/owner-groups/${r(n.group)}`, n.body)) : n.kind === "add-user" ? await o.request(
|
|
575
|
+
A(`/pipelines/owner-groups/${r(n.group)}/users`, { user: n.user })
|
|
576
|
+
) : n.kind === "remove-user" ? await o.request(ce(`/pipelines/owner-group-users/${n.linkId}`)) : n.kind === "add-team" ? await o.request(
|
|
577
|
+
A(`/pipelines/owner-groups/${r(n.group)}/teams`, { team_id: n.team })
|
|
578
|
+
) : await o.request(ce(`/pipelines/owner-groups/${r(n.group)}/teams/${n.team}`));
|
|
579
|
+
return e.length;
|
|
510
580
|
},
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
mutationFn: ({ groupId: e, priority: r }) => c.request(Ae(`/pipelines/owner-groups/${e}`, { priority: r })),
|
|
514
|
-
onSuccess: () => z(),
|
|
515
|
-
onError: () => P.error("Failed to update priority")
|
|
516
|
-
}), at = V({
|
|
517
|
-
mutationFn: ({ groupId: e, maxWip: r }) => c.request(Ae(`/pipelines/owner-groups/${e}`, { max_wip: r })),
|
|
518
|
-
onSuccess: () => z(),
|
|
519
|
-
onError: () => P.error("Failed to update WIP limit")
|
|
520
|
-
}), nt = V({
|
|
521
|
-
mutationFn: (e) => c.request(Ne(`/pipelines/owner-group-users/${e}`)),
|
|
522
|
-
onSuccess: () => {
|
|
523
|
-
z(), P.success("Owner removed");
|
|
581
|
+
onSuccess: (e) => {
|
|
582
|
+
C(null), z(), O.success(`Draft saved — ${e} change${e === 1 ? "" : "s"} written`);
|
|
524
583
|
},
|
|
525
|
-
onError: () =>
|
|
526
|
-
|
|
527
|
-
|
|
584
|
+
onError: (e) => {
|
|
585
|
+
z(), yt(e, "Could not save the draft");
|
|
586
|
+
}
|
|
587
|
+
}), We = de(() => Ct(_, w), [_, w]), Y = y.filter((e) => e.required && !P[e.id]);
|
|
588
|
+
return c ? $ ? /* @__PURE__ */ l("div", { className: "flex items-center gap-2 py-4 text-[13px] text-slate-400", children: [
|
|
528
589
|
/* @__PURE__ */ t(te, { className: "h-4 w-4 animate-spin" }),
|
|
529
590
|
"Loading matrix…"
|
|
530
591
|
] }) : /* @__PURE__ */ l("div", { className: "space-y-4", children: [
|
|
531
|
-
|
|
532
|
-
|
|
592
|
+
ze && /* @__PURE__ */ t(
|
|
593
|
+
Ut,
|
|
533
594
|
{
|
|
534
|
-
team:
|
|
595
|
+
team: ze,
|
|
535
596
|
onClose: () => {
|
|
536
|
-
|
|
597
|
+
_e(null), z(), fe.invalidateQueries({ queryKey: ["user-groups-teams"] });
|
|
537
598
|
}
|
|
538
599
|
}
|
|
539
600
|
),
|
|
540
|
-
|
|
541
|
-
|
|
601
|
+
F && /* @__PURE__ */ t(
|
|
602
|
+
Bt,
|
|
542
603
|
{
|
|
543
|
-
templateId:
|
|
604
|
+
templateId: f,
|
|
544
605
|
groupsMap: _ ?? {},
|
|
545
|
-
states:
|
|
546
|
-
onClose: () =>
|
|
606
|
+
states: b,
|
|
607
|
+
onClose: () => j(!1),
|
|
547
608
|
onDone: () => {
|
|
548
|
-
|
|
609
|
+
j(!1), fe.invalidateQueries({ queryKey: ["pipeline-all-owner-groups", f] });
|
|
549
610
|
}
|
|
550
611
|
}
|
|
551
612
|
),
|
|
552
|
-
/* @__PURE__ */ l("div", { className: "flex flex-wrap items-center gap-4 rounded-lg border border-slate-200 bg-slate-50 px-4 py-2.5 dark:border-border dark:bg-muted/40", children: [
|
|
553
|
-
|
|
613
|
+
(y.length > 0 || !w) && /* @__PURE__ */ l("div", { className: "flex flex-wrap items-center gap-4 rounded-lg border border-slate-200 bg-slate-50 px-4 py-2.5 dark:border-border dark:bg-muted/40", children: [
|
|
614
|
+
y.length > 0 && /* @__PURE__ */ l(je, { children: [
|
|
554
615
|
/* @__PURE__ */ t("span", { className: "text-[11px] font-medium text-slate-400 uppercase tracking-wide shrink-0 dark:text-muted-foreground", children: "Filter" }),
|
|
555
|
-
|
|
556
|
-
var
|
|
557
|
-
const
|
|
558
|
-
if (
|
|
559
|
-
const
|
|
560
|
-
return { value:
|
|
616
|
+
y.map((e, a) => {
|
|
617
|
+
var g, s, k;
|
|
618
|
+
const r = pe[a], n = ((g = oe[a]) == null ? void 0 : g.data) ?? [], i = (s = ut[a]) == null ? void 0 : s.data, d = r != null && r.relatedCollection ? n.map((h) => {
|
|
619
|
+
if (r.subField) {
|
|
620
|
+
const S = String(h[r.subField] ?? "");
|
|
621
|
+
return { value: S, label: S };
|
|
561
622
|
}
|
|
562
623
|
return {
|
|
563
|
-
value: String(
|
|
564
|
-
label:
|
|
624
|
+
value: String(h.id),
|
|
625
|
+
label: $e((i == null ? void 0 : i.display_template) ?? null, h)
|
|
565
626
|
};
|
|
566
627
|
}) : [];
|
|
567
628
|
return /* @__PURE__ */ l("div", { className: "flex items-center gap-1.5", children: [
|
|
568
629
|
/* @__PURE__ */ t("span", { className: "text-[12px] font-medium text-slate-600", children: e.label }),
|
|
569
630
|
/* @__PURE__ */ t(
|
|
570
|
-
|
|
631
|
+
Tt,
|
|
571
632
|
{
|
|
572
633
|
label: e.label,
|
|
573
|
-
value:
|
|
574
|
-
options:
|
|
575
|
-
onChange: (
|
|
576
|
-
const
|
|
577
|
-
for (const
|
|
578
|
-
(
|
|
579
|
-
return
|
|
634
|
+
value: P[e.id] ?? "",
|
|
635
|
+
options: d,
|
|
636
|
+
onChange: (h) => it((S) => {
|
|
637
|
+
const I = { ...S, [e.id]: h };
|
|
638
|
+
for (const D of y)
|
|
639
|
+
(D.cascade ?? []).some((xt) => xt.parent_field === e.field) && (I[D.id] = "");
|
|
640
|
+
return I;
|
|
580
641
|
}),
|
|
581
|
-
onSearch: (
|
|
582
|
-
loading: (
|
|
642
|
+
onSearch: (h) => dt((S) => ({ ...S, [e.id]: h })),
|
|
643
|
+
loading: (k = oe[a]) == null ? void 0 : k.isLoading
|
|
583
644
|
}
|
|
584
645
|
)
|
|
585
646
|
] }, e.id);
|
|
586
647
|
})
|
|
587
648
|
] }),
|
|
588
|
-
/* @__PURE__ */
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
649
|
+
/* @__PURE__ */ l("div", { className: "ml-auto flex shrink-0 items-center gap-2", children: [
|
|
650
|
+
!w && /* @__PURE__ */ t(
|
|
651
|
+
"button",
|
|
652
|
+
{
|
|
653
|
+
type: "button",
|
|
654
|
+
onClick: () => j((e) => !e),
|
|
655
|
+
className: "shrink-0 rounded-md border border-slate-300 bg-white px-2.5 py-1 text-[12px] font-medium text-slate-600 transition-colors hover:border-nvr-cyan/50 hover:text-nvr-cyan-dark dark:border-border dark:bg-card dark:text-slate-300 dark:hover:text-nvr-cyan",
|
|
656
|
+
children: "+ Add a user to many cells…"
|
|
657
|
+
}
|
|
658
|
+
),
|
|
659
|
+
!w && /* @__PURE__ */ l(
|
|
660
|
+
"button",
|
|
661
|
+
{
|
|
662
|
+
type: "button",
|
|
663
|
+
"data-tip": "Edit the matrix without saving, and try the changes on a record first",
|
|
664
|
+
onClick: () => {
|
|
665
|
+
j(!1), C($t(_));
|
|
666
|
+
},
|
|
667
|
+
className: "inline-flex shrink-0 items-center gap-1.5 rounded-md border border-violet-300 bg-white px-2.5 py-1 text-[12px] font-medium text-violet-700 transition-colors hover:bg-violet-50 dark:border-violet-500/40 dark:bg-card dark:text-violet-300 dark:hover:bg-violet-500/10",
|
|
668
|
+
children: [
|
|
669
|
+
/* @__PURE__ */ t(Xe, { className: "h-3.5 w-3.5" }),
|
|
670
|
+
"Draft changes"
|
|
671
|
+
]
|
|
672
|
+
}
|
|
673
|
+
)
|
|
674
|
+
] })
|
|
597
675
|
] }),
|
|
598
|
-
|
|
676
|
+
w && /* @__PURE__ */ l(
|
|
677
|
+
"div",
|
|
678
|
+
{
|
|
679
|
+
"data-owner-draft-bar": !0,
|
|
680
|
+
className: "flex flex-wrap items-center gap-x-3 gap-y-2 rounded-lg border border-violet-300 bg-violet-50 px-4 py-2 text-[12px] text-violet-900 dark:border-violet-500/40 dark:bg-violet-500/10 dark:text-violet-200",
|
|
681
|
+
children: [
|
|
682
|
+
/* @__PURE__ */ t(Xe, { className: "h-3.5 w-3.5 shrink-0" }),
|
|
683
|
+
/* @__PURE__ */ t("span", { className: "font-semibold", children: "Draft mode" }),
|
|
684
|
+
/* @__PURE__ */ t("span", { className: "text-violet-800/80 dark:text-violet-200/80", children: E.length === 0 ? "Edit cells as usual — nothing is saved until you say so." : `${E.length} owner group${E.length === 1 ? "" : "s"} changed, not saved yet.` }),
|
|
685
|
+
/* @__PURE__ */ l("div", { className: "ml-auto flex items-center gap-2", children: [
|
|
686
|
+
/* @__PURE__ */ t(
|
|
687
|
+
Se,
|
|
688
|
+
{
|
|
689
|
+
size: "sm",
|
|
690
|
+
variant: "outline",
|
|
691
|
+
className: "h-7 text-[12px]",
|
|
692
|
+
disabled: he.isPending,
|
|
693
|
+
onClick: () => C(null),
|
|
694
|
+
children: E.length === 0 ? "Leave draft mode" : "Discard draft"
|
|
695
|
+
}
|
|
696
|
+
),
|
|
697
|
+
/* @__PURE__ */ l(
|
|
698
|
+
Se,
|
|
699
|
+
{
|
|
700
|
+
size: "sm",
|
|
701
|
+
className: "h-7 bg-nvr-cyan text-[12px] text-white",
|
|
702
|
+
disabled: We.length === 0 || he.isPending,
|
|
703
|
+
onClick: () => he.mutate(We),
|
|
704
|
+
children: [
|
|
705
|
+
he.isPending && /* @__PURE__ */ t(te, { className: "mr-1 h-3 w-3 animate-spin" }),
|
|
706
|
+
"Save draft"
|
|
707
|
+
]
|
|
708
|
+
}
|
|
709
|
+
)
|
|
710
|
+
] })
|
|
711
|
+
]
|
|
712
|
+
}
|
|
713
|
+
),
|
|
714
|
+
/* @__PURE__ */ t(
|
|
715
|
+
vt,
|
|
716
|
+
{
|
|
717
|
+
templateId: f,
|
|
718
|
+
collections: [...new Set(v.map((e) => e.collection))],
|
|
719
|
+
draft: w ? E : null,
|
|
720
|
+
displayTemplates: { [m]: (u == null ? void 0 : u.display_template) ?? null }
|
|
721
|
+
}
|
|
722
|
+
),
|
|
723
|
+
Y.length > 0 && /* @__PURE__ */ l("div", { className: "rounded-md border border-amber-200 bg-amber-50 px-3 py-2 text-[12px] text-amber-700 dark:border-amber-500/30 dark:bg-amber-500/10 dark:text-amber-400", children: [
|
|
599
724
|
/* @__PURE__ */ t("span", { className: "font-medium", children: "Select a value for " }),
|
|
600
|
-
|
|
725
|
+
Y.map((e, a) => /* @__PURE__ */ l("span", { children: [
|
|
601
726
|
/* @__PURE__ */ t("span", { className: "font-semibold", children: e.label }),
|
|
602
|
-
|
|
727
|
+
a < Y.length - 2 ? ", " : a === Y.length - 2 ? " and " : ""
|
|
603
728
|
] }, e.id)),
|
|
604
729
|
/* @__PURE__ */ t("span", { children: " before managing owners." })
|
|
605
730
|
] }),
|
|
606
731
|
/* @__PURE__ */ t("div", { className: "overflow-x-auto rounded-lg border border-slate-200 bg-white dark:border-border dark:bg-card", children: /* @__PURE__ */ l("table", { className: "min-w-full border-collapse text-[12px]", children: [
|
|
607
732
|
/* @__PURE__ */ t("thead", { children: /* @__PURE__ */ l("tr", { className: "bg-slate-50", children: [
|
|
608
|
-
/* @__PURE__ */ t("th", { className: "sticky left-0 z-10 bg-slate-50 dark:bg-muted border-b border-r border-slate-200 dark:border-border px-3 py-2 text-left text-[12px] font-semibold text-slate-700 dark:text-slate-200 min-w-[100px]", children:
|
|
609
|
-
|
|
610
|
-
const
|
|
733
|
+
/* @__PURE__ */ t("th", { className: "sticky left-0 z-10 bg-slate-50 dark:bg-muted border-b border-r border-slate-200 dark:border-border px-3 py-2 text-left text-[12px] font-semibold text-slate-700 dark:text-slate-200 min-w-[100px]", children: c.label }),
|
|
734
|
+
b.map((e) => {
|
|
735
|
+
const a = /^waiting on\s+/i.test(e.label), r = a ? e.label.replace(/^waiting on\s+/i, "") : e.label;
|
|
611
736
|
return /* @__PURE__ */ l(
|
|
612
737
|
"th",
|
|
613
738
|
{
|
|
614
739
|
className: "min-w-[110px] border-b border-r border-slate-200 bg-slate-50 px-3 py-2 text-left align-bottom last:border-r-0 dark:border-border dark:bg-muted",
|
|
615
740
|
children: [
|
|
616
|
-
|
|
741
|
+
a && /* @__PURE__ */ t("span", { className: "block text-[9px] font-medium uppercase tracking-[0.06em] leading-tight text-slate-400", children: "Waiting on" }),
|
|
617
742
|
/* @__PURE__ */ l("span", { className: "flex items-center gap-1.5", children: [
|
|
618
743
|
/* @__PURE__ */ t(
|
|
619
744
|
"span",
|
|
@@ -622,7 +747,7 @@ function Tt({ templateId: m, states: f, bindings: N }) {
|
|
|
622
747
|
style: { backgroundColor: e.color ?? "#94a3b8" }
|
|
623
748
|
}
|
|
624
749
|
),
|
|
625
|
-
/* @__PURE__ */ t("span", { className: "whitespace-nowrap text-[11.5px] font-semibold leading-tight text-slate-700 dark:text-slate-200", children:
|
|
750
|
+
/* @__PURE__ */ t("span", { className: "whitespace-nowrap text-[11.5px] font-semibold leading-tight text-slate-700 dark:text-slate-200", children: r })
|
|
626
751
|
] })
|
|
627
752
|
]
|
|
628
753
|
},
|
|
@@ -631,68 +756,68 @@ function Tt({ templateId: m, states: f, bindings: N }) {
|
|
|
631
756
|
})
|
|
632
757
|
] }) }),
|
|
633
758
|
/* @__PURE__ */ l("tbody", { children: [
|
|
634
|
-
|
|
759
|
+
De.map((e) => /* @__PURE__ */ l(rt, { children: [
|
|
635
760
|
/* @__PURE__ */ l("tr", { className: "hover:bg-slate-50/50", children: [
|
|
636
761
|
/* @__PURE__ */ t("td", { className: "sticky left-0 z-10 bg-white dark:bg-card border-b border-r border-slate-200 dark:border-border px-3 py-2 font-medium text-slate-700 dark:text-slate-200 text-[13px]", children: e.label }),
|
|
637
|
-
|
|
638
|
-
const { group:
|
|
762
|
+
b.map((a) => {
|
|
763
|
+
const { group: r, isInherited: n } = se(a.id, e.value), i = (r == null ? void 0 : r.users) ?? [], d = (L == null ? void 0 : L.stateId) === a.id && (L == null ? void 0 : L.rowValue) === e.value, g = !n && y.some((s) => !s.required) && y.every((s) => s.required || !P[s.id]) && mt(a.id, e.value);
|
|
639
764
|
return /* @__PURE__ */ t(
|
|
640
765
|
"td",
|
|
641
766
|
{
|
|
642
767
|
className: `border-b border-r border-slate-200 bg-white px-2 py-1.5 last:border-r-0 transition-colors dark:border-border dark:bg-card ${// Locked (required filters unset): gate the INTERACTION,
|
|
643
768
|
// not the contrast — the banner above explains why, and
|
|
644
769
|
// an opacity fade made the whole grid illegible.
|
|
645
|
-
|
|
770
|
+
Y.length > 0 ? "cursor-not-allowed select-none" : "cursor-pointer hover:bg-nvr-cyan/5"} ${d ? "bg-nvr-cyan/5" : ""}`,
|
|
646
771
|
onClick: () => {
|
|
647
|
-
|
|
648
|
-
|
|
772
|
+
Y.length > 0 || ke(
|
|
773
|
+
d ? null : { stateId: a.id, rowValue: e.value }
|
|
649
774
|
);
|
|
650
775
|
},
|
|
651
|
-
onKeyDown: (
|
|
652
|
-
if (
|
|
653
|
-
if (
|
|
654
|
-
|
|
655
|
-
|
|
776
|
+
onKeyDown: (s) => {
|
|
777
|
+
if (s.key === "Enter" || s.key === " ") {
|
|
778
|
+
if (Y.length > 0) return;
|
|
779
|
+
ke(
|
|
780
|
+
d ? null : { stateId: a.id, rowValue: e.value }
|
|
656
781
|
);
|
|
657
782
|
}
|
|
658
783
|
},
|
|
659
|
-
tabIndex:
|
|
784
|
+
tabIndex: Y.length > 0 ? -1 : 0,
|
|
660
785
|
children: /* @__PURE__ */ l("div", { className: "flex flex-wrap items-center gap-1", children: [
|
|
661
|
-
((
|
|
786
|
+
((r == null ? void 0 : r.teams) ?? []).map((s) => /* @__PURE__ */ l(
|
|
662
787
|
"span",
|
|
663
788
|
{
|
|
664
|
-
"data-tip": `Team · ${
|
|
665
|
-
className: `inline-flex h-6 items-center gap-1 rounded-full px-2 text-[10.5px] font-semibold ${
|
|
789
|
+
"data-tip": `Team · ${s.member_count} member${s.member_count === 1 ? "" : "s"}`,
|
|
790
|
+
className: `inline-flex h-6 items-center gap-1 rounded-full px-2 text-[10.5px] font-semibold ${n ? "bg-slate-100 text-slate-400" : "bg-violet-100 text-violet-700 dark:bg-violet-500/15 dark:text-violet-300"}`,
|
|
666
791
|
children: [
|
|
667
|
-
/* @__PURE__ */ t(
|
|
668
|
-
|
|
792
|
+
/* @__PURE__ */ t(xe, { className: "h-3 w-3" }),
|
|
793
|
+
s.name
|
|
669
794
|
]
|
|
670
795
|
},
|
|
671
|
-
`t${
|
|
796
|
+
`t${s.link_id}`
|
|
672
797
|
)),
|
|
673
|
-
|
|
674
|
-
|
|
798
|
+
i.length === 0 && ((r == null ? void 0 : r.teams) ?? []).length === 0 ? /* @__PURE__ */ t("span", { className: "text-slate-400 text-[11px] dark:text-slate-500", children: "—" }) : i.slice(0, 4).map((s) => /* @__PURE__ */ t(
|
|
799
|
+
Oe,
|
|
675
800
|
{
|
|
676
|
-
userId:
|
|
677
|
-
className: `h-6 w-6 ${
|
|
678
|
-
alt: [
|
|
801
|
+
userId: s.user,
|
|
802
|
+
className: `h-6 w-6 ${n ? "opacity-50" : ""}`,
|
|
803
|
+
alt: [s.first_name, s.last_name].filter(Boolean).join(" ") || s.email,
|
|
679
804
|
fallback: /* @__PURE__ */ t(
|
|
680
805
|
"span",
|
|
681
806
|
{
|
|
682
|
-
title: [
|
|
683
|
-
className: `inline-flex h-6 w-6 items-center justify-center rounded-full text-[10px] font-semibold ${
|
|
684
|
-
children:
|
|
807
|
+
title: [s.first_name, s.last_name].filter(Boolean).join(" ") || s.email,
|
|
808
|
+
className: `inline-flex h-6 w-6 items-center justify-center rounded-full text-[10px] font-semibold ${n ? "bg-slate-100 text-slate-400" : "bg-nvr-cyan/10 text-nvr-cyan"}`,
|
|
809
|
+
children: Be(s)
|
|
685
810
|
}
|
|
686
811
|
)
|
|
687
812
|
},
|
|
688
|
-
|
|
813
|
+
s.link_id
|
|
689
814
|
)),
|
|
690
|
-
|
|
815
|
+
i.length > 4 && /* @__PURE__ */ l("span", { className: "inline-flex h-6 items-center px-1 text-[10px] text-slate-400", children: [
|
|
691
816
|
"+",
|
|
692
|
-
|
|
817
|
+
i.length - 4
|
|
693
818
|
] }),
|
|
694
|
-
|
|
695
|
-
|
|
819
|
+
n && i.length > 0 && /* @__PURE__ */ t("span", { className: "text-[10px] text-slate-400 italic", children: "inherited" }),
|
|
820
|
+
g && /* @__PURE__ */ t(
|
|
696
821
|
"span",
|
|
697
822
|
{
|
|
698
823
|
title: "Has context-specific overrides",
|
|
@@ -701,63 +826,63 @@ function Tt({ templateId: m, states: f, bindings: N }) {
|
|
|
701
826
|
)
|
|
702
827
|
] })
|
|
703
828
|
},
|
|
704
|
-
|
|
829
|
+
a.id
|
|
705
830
|
);
|
|
706
831
|
})
|
|
707
832
|
] }),
|
|
708
|
-
(
|
|
833
|
+
(L == null ? void 0 : L.rowValue) === e.value && /* @__PURE__ */ l("tr", { children: [
|
|
709
834
|
/* @__PURE__ */ t("td", { className: "sticky left-0 z-10 bg-slate-50 dark:bg-muted border-b border-r border-slate-200 dark:border-border" }),
|
|
710
|
-
|
|
711
|
-
if (
|
|
835
|
+
b.map((a) => {
|
|
836
|
+
if (L.stateId !== a.id)
|
|
712
837
|
return /* @__PURE__ */ t(
|
|
713
838
|
"td",
|
|
714
839
|
{
|
|
715
840
|
className: "border-b border-r border-slate-200 last:border-r-0 bg-slate-50/50"
|
|
716
841
|
},
|
|
717
|
-
|
|
842
|
+
a.id
|
|
718
843
|
);
|
|
719
|
-
const { group:
|
|
720
|
-
(
|
|
721
|
-
).length,
|
|
844
|
+
const { group: r, isInherited: n } = se(a.id, e.value), i = (r == null ? void 0 : r.users) ?? [], d = i.filter(
|
|
845
|
+
(s) => s.is_out_of_office
|
|
846
|
+
).length, g = i.length > 0 && d === i.length ? "bg-amber-100/80 dark:bg-amber-500/15" : d > 0 ? "bg-amber-50/70 dark:bg-amber-500/8" : "bg-nvr-cyan/5";
|
|
722
847
|
return /* @__PURE__ */ t(
|
|
723
848
|
"td",
|
|
724
849
|
{
|
|
725
850
|
"data-omx-editor": !0,
|
|
726
|
-
"data-tip":
|
|
727
|
-
className: `border-b border-r border-slate-200 px-3 py-2 last:border-r-0 ${
|
|
728
|
-
onClick: (
|
|
729
|
-
onKeyDown: (
|
|
730
|
-
children:
|
|
851
|
+
"data-tip": d > 0 ? `${d}/${i.length} member(s) out of office` : void 0,
|
|
852
|
+
className: `border-b border-r border-slate-200 px-3 py-2 last:border-r-0 ${g}`,
|
|
853
|
+
onClick: (s) => s.stopPropagation(),
|
|
854
|
+
onKeyDown: (s) => s.stopPropagation(),
|
|
855
|
+
children: n ? /* @__PURE__ */ l("div", { className: "space-y-2 min-w-[200px]", children: [
|
|
731
856
|
/* @__PURE__ */ t("div", { className: "rounded bg-amber-50 px-2 py-1 text-[11px] text-amber-700 border border-amber-200", children: "Inherited from base level" }),
|
|
732
|
-
|
|
857
|
+
i.map((s) => /* @__PURE__ */ t(
|
|
733
858
|
"div",
|
|
734
859
|
{
|
|
735
860
|
className: "flex items-center gap-1.5 opacity-60",
|
|
736
|
-
children: /* @__PURE__ */ t("span", { className: "flex-1 text-[12px] text-slate-600", children: [
|
|
861
|
+
children: /* @__PURE__ */ t("span", { className: "flex-1 text-[12px] text-slate-600", children: [s.first_name, s.last_name].filter(Boolean).join(" ") || s.email })
|
|
737
862
|
},
|
|
738
|
-
|
|
863
|
+
s.link_id
|
|
739
864
|
)),
|
|
740
|
-
|
|
865
|
+
i.length === 0 && /* @__PURE__ */ t("span", { className: "text-[12px] text-slate-400", children: "No owners at base level" }),
|
|
741
866
|
/* @__PURE__ */ l(
|
|
742
867
|
"button",
|
|
743
868
|
{
|
|
744
869
|
type: "button",
|
|
745
|
-
disabled:
|
|
746
|
-
onClick: () =>
|
|
870
|
+
disabled: Ve.isPending,
|
|
871
|
+
onClick: () => Ve.mutate({ stateId: a.id, rowValue: e.value }),
|
|
747
872
|
className: "flex w-full items-center justify-center gap-1 rounded border border-dashed border-slate-300 px-2 py-1.5 text-[12px] text-slate-500 hover:border-nvr-cyan/50 hover:text-nvr-cyan disabled:opacity-40",
|
|
748
873
|
children: [
|
|
749
|
-
/* @__PURE__ */ t(
|
|
874
|
+
/* @__PURE__ */ t(ge, { className: "h-3.5 w-3.5" }),
|
|
750
875
|
"Create override for this context"
|
|
751
876
|
]
|
|
752
877
|
}
|
|
753
878
|
)
|
|
754
879
|
] }) : /* @__PURE__ */ l("div", { className: "space-y-2 min-w-[200px]", children: [
|
|
755
|
-
((
|
|
756
|
-
const
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
880
|
+
((r == null ? void 0 : r.teams) ?? []).map((s) => {
|
|
881
|
+
const k = at(
|
|
882
|
+
s.scopes,
|
|
883
|
+
J(a.id, e.value),
|
|
884
|
+
W,
|
|
885
|
+
m || null
|
|
761
886
|
);
|
|
762
887
|
return /* @__PURE__ */ l("div", { className: "flex items-center gap-1.5", children: [
|
|
763
888
|
/* @__PURE__ */ l(
|
|
@@ -765,20 +890,20 @@ function Tt({ templateId: m, states: f, bindings: N }) {
|
|
|
765
890
|
{
|
|
766
891
|
type: "button",
|
|
767
892
|
"data-tip": "Manage this team’s members and scope",
|
|
768
|
-
onClick: () =>
|
|
893
|
+
onClick: () => _e({ id: s.id, name: s.name }),
|
|
769
894
|
className: "flex flex-1 items-center gap-1.5 text-left text-[12px] font-medium text-violet-700 hover:underline dark:text-violet-300",
|
|
770
895
|
children: [
|
|
771
|
-
/* @__PURE__ */ t(
|
|
772
|
-
|
|
896
|
+
/* @__PURE__ */ t(xe, { className: "h-3.5 w-3.5" }),
|
|
897
|
+
s.name,
|
|
773
898
|
/* @__PURE__ */ l("span", { className: "font-normal tabular-nums text-slate-400", children: [
|
|
774
|
-
|
|
899
|
+
s.member_count,
|
|
775
900
|
" member",
|
|
776
|
-
|
|
901
|
+
s.member_count === 1 ? "" : "s"
|
|
777
902
|
] }),
|
|
778
|
-
|
|
903
|
+
k.tier === "out" && /* @__PURE__ */ t(
|
|
779
904
|
"span",
|
|
780
905
|
{
|
|
781
|
-
"data-tip": `Assigned outside its scope — ${
|
|
906
|
+
"data-tip": `Assigned outside its scope — ${k.mismatches.join("; ")}`,
|
|
782
907
|
className: "rounded bg-amber-100 px-1 py-px text-[9px] font-semibold uppercase text-amber-700 dark:bg-amber-500/15 dark:text-amber-400",
|
|
783
908
|
children: "out of scope"
|
|
784
909
|
}
|
|
@@ -791,114 +916,118 @@ function Tt({ templateId: m, states: f, bindings: N }) {
|
|
|
791
916
|
{
|
|
792
917
|
type: "button",
|
|
793
918
|
"data-tip": "Unassign this team from the cell (the team itself is untouched)",
|
|
794
|
-
onClick: () =>
|
|
919
|
+
onClick: () => r && pt.mutate({ groupId: r.id, teamId: s.id }),
|
|
795
920
|
className: "text-slate-400 hover:text-red-500",
|
|
796
|
-
children: /* @__PURE__ */ t(
|
|
921
|
+
children: /* @__PURE__ */ t(ye, { className: "h-3 w-3" })
|
|
797
922
|
}
|
|
798
923
|
)
|
|
799
|
-
] }, `t${
|
|
924
|
+
] }, `t${s.link_id}`);
|
|
800
925
|
}),
|
|
801
|
-
|
|
926
|
+
i.map((s) => /* @__PURE__ */ l("div", { className: "flex items-center gap-1.5", children: [
|
|
802
927
|
/* @__PURE__ */ l("span", { className: "flex-1 text-[12px] text-slate-700", children: [
|
|
803
|
-
[
|
|
804
|
-
|
|
928
|
+
[s.first_name, s.last_name].filter(Boolean).join(" ") || s.email,
|
|
929
|
+
s.is_out_of_office && /* @__PURE__ */ t("span", { className: "ml-1 rounded bg-amber-100 px-1 py-px text-[9.5px] font-medium text-amber-700 dark:bg-amber-500/15 dark:text-amber-300", children: "OOO" })
|
|
805
930
|
] }),
|
|
806
931
|
/* @__PURE__ */ t(
|
|
807
932
|
"button",
|
|
808
933
|
{
|
|
809
934
|
type: "button",
|
|
810
|
-
onClick: () =>
|
|
935
|
+
onClick: () => bt.mutate(s.link_id),
|
|
811
936
|
className: "text-slate-400 hover:text-red-500",
|
|
812
|
-
children: /* @__PURE__ */ t(
|
|
937
|
+
children: /* @__PURE__ */ t(ye, { className: "h-3 w-3" })
|
|
813
938
|
}
|
|
814
939
|
)
|
|
815
|
-
] },
|
|
940
|
+
] }, s.link_id)),
|
|
816
941
|
/* @__PURE__ */ t(
|
|
817
|
-
|
|
942
|
+
Et,
|
|
818
943
|
{
|
|
819
|
-
templateId:
|
|
820
|
-
stateId:
|
|
821
|
-
buildFilters: () =>
|
|
944
|
+
templateId: f,
|
|
945
|
+
stateId: a.id,
|
|
946
|
+
buildFilters: () => J(a.id, e.value)
|
|
822
947
|
}
|
|
823
948
|
),
|
|
824
949
|
/* @__PURE__ */ t(
|
|
825
|
-
|
|
950
|
+
Kt,
|
|
826
951
|
{
|
|
827
|
-
stateId:
|
|
952
|
+
stateId: a.id,
|
|
828
953
|
rowValue: e.value,
|
|
829
|
-
existingUserIds:
|
|
830
|
-
teams: (
|
|
831
|
-
(
|
|
954
|
+
existingUserIds: i.map((s) => String(s.user ?? s.id)),
|
|
955
|
+
teams: (Qe ?? []).filter(
|
|
956
|
+
(s) => !((r == null ? void 0 : r.teams) ?? []).some((k) => k.id === s.id)
|
|
832
957
|
),
|
|
833
|
-
cellFilters:
|
|
834
|
-
scopeDims:
|
|
835
|
-
boundCollection:
|
|
836
|
-
onAdd: (
|
|
837
|
-
stateId:
|
|
958
|
+
cellFilters: J(a.id, e.value),
|
|
959
|
+
scopeDims: W,
|
|
960
|
+
boundCollection: m || null,
|
|
961
|
+
onAdd: (s, k) => Le.mutate({
|
|
962
|
+
stateId: a.id,
|
|
838
963
|
rowValue: e.value,
|
|
839
|
-
userId:
|
|
964
|
+
userId: s,
|
|
965
|
+
user: k
|
|
840
966
|
}),
|
|
841
|
-
onAddTeam: (
|
|
842
|
-
stateId:
|
|
967
|
+
onAddTeam: (s) => Re.mutate({
|
|
968
|
+
stateId: a.id,
|
|
843
969
|
rowValue: e.value,
|
|
844
|
-
teamId:
|
|
970
|
+
teamId: s
|
|
845
971
|
}),
|
|
846
|
-
onCreateTeam: (
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
|
|
972
|
+
onCreateTeam: (
|
|
973
|
+
// A new team is a real write — not offered in Draft mode.
|
|
974
|
+
w ? void 0 : (s) => Ge.mutate({
|
|
975
|
+
stateId: a.id,
|
|
976
|
+
rowValue: e.value,
|
|
977
|
+
name: s
|
|
978
|
+
})
|
|
979
|
+
),
|
|
980
|
+
isPending: Le.isPending || Re.isPending || Ge.isPending
|
|
852
981
|
}
|
|
853
982
|
),
|
|
854
|
-
|
|
983
|
+
r && /* @__PURE__ */ l("div", { className: "flex items-center gap-2 border-t border-slate-100 pt-2", children: [
|
|
855
984
|
/* @__PURE__ */ t("span", { className: "text-[11px] text-slate-400 shrink-0", children: "Priority" }),
|
|
856
985
|
/* @__PURE__ */ t(
|
|
857
986
|
"input",
|
|
858
987
|
{
|
|
859
988
|
type: "number",
|
|
860
|
-
defaultValue:
|
|
989
|
+
defaultValue: r.priority ?? 0,
|
|
861
990
|
min: 0,
|
|
862
991
|
className: "h-6 w-14 rounded border border-slate-200 px-1 text-[12px] text-center focus:border-nvr-cyan/50 focus:outline-none",
|
|
863
|
-
onBlur: (
|
|
864
|
-
const
|
|
865
|
-
!Number.isNaN(
|
|
992
|
+
onBlur: (s) => {
|
|
993
|
+
const k = Number.parseInt(s.target.value, 10);
|
|
994
|
+
!Number.isNaN(k) && k !== (r.priority ?? 0) && ft.mutate({ groupId: r.id, priority: k });
|
|
866
995
|
}
|
|
867
996
|
},
|
|
868
|
-
|
|
997
|
+
r.id
|
|
869
998
|
),
|
|
870
999
|
/* @__PURE__ */ t("span", { className: "text-[10px] text-slate-400", children: "lower = higher" })
|
|
871
1000
|
] }),
|
|
872
|
-
|
|
1001
|
+
r && /* @__PURE__ */ l("div", { className: "flex items-center gap-2 border-t border-slate-100 pt-2", children: [
|
|
873
1002
|
/* @__PURE__ */ t("span", { className: "text-[11px] text-slate-400 shrink-0", children: "Max WIP" }),
|
|
874
1003
|
/* @__PURE__ */ t(
|
|
875
1004
|
"input",
|
|
876
1005
|
{
|
|
877
1006
|
type: "number",
|
|
878
|
-
defaultValue:
|
|
1007
|
+
defaultValue: r.max_wip ?? "",
|
|
879
1008
|
min: 0,
|
|
880
1009
|
placeholder: "—",
|
|
881
1010
|
className: "h-6 w-14 rounded border border-slate-200 px-1 text-[12px] text-center focus:border-nvr-cyan/50 focus:outline-none",
|
|
882
|
-
onBlur: (
|
|
883
|
-
const
|
|
884
|
-
(
|
|
1011
|
+
onBlur: (s) => {
|
|
1012
|
+
const k = s.target.value.trim(), h = k === "" ? null : Number.parseInt(k, 10), S = r.max_wip ?? null;
|
|
1013
|
+
(h === null || !Number.isNaN(h)) && h !== S && ht.mutate({ groupId: r.id, maxWip: h });
|
|
885
1014
|
}
|
|
886
1015
|
},
|
|
887
|
-
`${
|
|
1016
|
+
`${r.id}-wip`
|
|
888
1017
|
),
|
|
889
1018
|
/* @__PURE__ */ t("span", { className: "text-[10px] text-slate-400", children: "blank = unlimited" })
|
|
890
1019
|
] })
|
|
891
1020
|
] })
|
|
892
1021
|
},
|
|
893
|
-
|
|
1022
|
+
a.id
|
|
894
1023
|
);
|
|
895
1024
|
})
|
|
896
1025
|
] })
|
|
897
1026
|
] }, e.value)),
|
|
898
|
-
|
|
1027
|
+
De.length === 0 && /* @__PURE__ */ t("tr", { children: /* @__PURE__ */ t(
|
|
899
1028
|
"td",
|
|
900
1029
|
{
|
|
901
|
-
colSpan:
|
|
1030
|
+
colSpan: b.length + 1,
|
|
902
1031
|
className: "px-4 py-6 text-center text-[13px] text-slate-400",
|
|
903
1032
|
children: "No rows yet — the axis fills in automatically once the row dimension's collection has records."
|
|
904
1033
|
}
|
|
@@ -907,37 +1036,37 @@ function Tt({ templateId: m, states: f, bindings: N }) {
|
|
|
907
1036
|
] }) })
|
|
908
1037
|
] }) : null;
|
|
909
1038
|
}
|
|
910
|
-
function
|
|
911
|
-
templateId:
|
|
912
|
-
stateId:
|
|
913
|
-
buildFilters:
|
|
1039
|
+
function Et({
|
|
1040
|
+
templateId: f,
|
|
1041
|
+
stateId: b,
|
|
1042
|
+
buildFilters: v
|
|
914
1043
|
}) {
|
|
915
|
-
const
|
|
1044
|
+
const o = re(), [N, c] = T(null), [y, _] = T(!1), $ = async () => {
|
|
916
1045
|
_(!0);
|
|
917
1046
|
try {
|
|
918
|
-
const
|
|
919
|
-
|
|
920
|
-
state_id:
|
|
921
|
-
filters:
|
|
1047
|
+
const F = await o.request(
|
|
1048
|
+
A(`/pipelines/${f}/owner-impact`, {
|
|
1049
|
+
state_id: b,
|
|
1050
|
+
filters: v()
|
|
922
1051
|
})
|
|
923
1052
|
);
|
|
924
|
-
|
|
1053
|
+
c(F.data);
|
|
925
1054
|
} catch {
|
|
926
|
-
|
|
1055
|
+
c(null);
|
|
927
1056
|
} finally {
|
|
928
1057
|
_(!1);
|
|
929
1058
|
}
|
|
930
1059
|
};
|
|
931
|
-
return /* @__PURE__ */ t("div", { className: "mt-1 text-[10.5px]", children:
|
|
1060
|
+
return /* @__PURE__ */ t("div", { className: "mt-1 text-[10.5px]", children: N ? /* @__PURE__ */ l(
|
|
932
1061
|
"span",
|
|
933
1062
|
{
|
|
934
1063
|
className: "text-slate-500 dark:text-muted-foreground",
|
|
935
|
-
title:
|
|
1064
|
+
title: N.sample.map((F) => F.label).join(", "),
|
|
936
1065
|
children: [
|
|
937
1066
|
"Governs ",
|
|
938
|
-
|
|
1067
|
+
N.matched.toLocaleString(),
|
|
939
1068
|
" of ",
|
|
940
|
-
|
|
1069
|
+
N.total_in_state.toLocaleString(),
|
|
941
1070
|
" live record(s) in this state"
|
|
942
1071
|
]
|
|
943
1072
|
}
|
|
@@ -945,50 +1074,50 @@ function ft({
|
|
|
945
1074
|
"button",
|
|
946
1075
|
{
|
|
947
1076
|
type: "button",
|
|
948
|
-
disabled:
|
|
949
|
-
onClick: () => void
|
|
1077
|
+
disabled: y,
|
|
1078
|
+
onClick: () => void $(),
|
|
950
1079
|
className: "text-slate-400 underline decoration-dotted hover:text-slate-600 disabled:opacity-50",
|
|
951
|
-
children:
|
|
1080
|
+
children: y ? "Checking…" : "Preview impact"
|
|
952
1081
|
}
|
|
953
1082
|
) });
|
|
954
1083
|
}
|
|
955
|
-
function
|
|
956
|
-
stateId:
|
|
957
|
-
rowValue:
|
|
958
|
-
existingUserIds:
|
|
959
|
-
teams:
|
|
960
|
-
cellFilters:
|
|
961
|
-
scopeDims:
|
|
962
|
-
boundCollection:
|
|
1084
|
+
function Kt({
|
|
1085
|
+
stateId: f,
|
|
1086
|
+
rowValue: b,
|
|
1087
|
+
existingUserIds: v,
|
|
1088
|
+
teams: o = [],
|
|
1089
|
+
cellFilters: N = [],
|
|
1090
|
+
scopeDims: c = [],
|
|
1091
|
+
boundCollection: y = null,
|
|
963
1092
|
onAdd: _,
|
|
964
|
-
onAddTeam:
|
|
965
|
-
onCreateTeam:
|
|
966
|
-
isPending:
|
|
1093
|
+
onAddTeam: $,
|
|
1094
|
+
onCreateTeam: F,
|
|
1095
|
+
isPending: j
|
|
967
1096
|
}) {
|
|
968
|
-
const [
|
|
969
|
-
|
|
970
|
-
|
|
1097
|
+
const [w, C] = T(!1), [x, E] = T(""), [W, m] = T(!1), [u, q] = T(""), Q = ue(null);
|
|
1098
|
+
ve(() => {
|
|
1099
|
+
w ? setTimeout(() => {
|
|
971
1100
|
var p;
|
|
972
|
-
return (p =
|
|
973
|
-
}, 50) : (
|
|
974
|
-
}, [
|
|
975
|
-
const B =
|
|
1101
|
+
return (p = Q.current) == null ? void 0 : p.focus();
|
|
1102
|
+
}, 50) : (E(""), m(!1), q(""));
|
|
1103
|
+
}, [w]);
|
|
1104
|
+
const B = st(), { people: ae } = Pt(w ? x : ""), R = x.trim().toLowerCase(), M = (p) => [p.first_name, p.last_name].filter(Boolean).join(" ") || p.email, H = new Set(v.filter(Boolean).map((p) => String(p).toUpperCase())), Z = (R ? o.filter((p) => p.name.toLowerCase().includes(R)) : o).map((p) => ({
|
|
976
1105
|
...p,
|
|
977
|
-
rank:
|
|
1106
|
+
rank: at(p.scopes, N, c, y)
|
|
978
1107
|
})).sort(
|
|
979
|
-
(p,
|
|
980
|
-
),
|
|
981
|
-
return
|
|
1108
|
+
(p, ie) => et(p.rank.tier) - et(ie.rank.tier) || p.name.localeCompare(ie.name, void 0, { sensitivity: "base" })
|
|
1109
|
+
), ne = ae.filter((p) => !H.has(String(p.id).toUpperCase()));
|
|
1110
|
+
return W ? /* @__PURE__ */ l("div", { className: "flex items-center gap-1.5", children: [
|
|
982
1111
|
/* @__PURE__ */ t(
|
|
983
1112
|
"input",
|
|
984
1113
|
{
|
|
985
1114
|
autoFocus: !0,
|
|
986
1115
|
value: u,
|
|
987
|
-
onChange: (p) =>
|
|
1116
|
+
onChange: (p) => q(p.target.value),
|
|
988
1117
|
placeholder: "New team name…",
|
|
989
1118
|
className: "h-7 flex-1 rounded border border-slate-200 bg-white px-1.5 text-[12px] focus:outline-none focus:ring-1 focus:ring-violet-400/50 dark:border-border dark:bg-card",
|
|
990
1119
|
onKeyDown: (p) => {
|
|
991
|
-
p.key === "Enter" && u.trim() && (
|
|
1120
|
+
p.key === "Enter" && u.trim() && (F == null || F(u.trim()), m(!1), q("")), p.key === "Escape" && m(!1);
|
|
992
1121
|
}
|
|
993
1122
|
}
|
|
994
1123
|
),
|
|
@@ -996,68 +1125,68 @@ function bt({
|
|
|
996
1125
|
"button",
|
|
997
1126
|
{
|
|
998
1127
|
type: "button",
|
|
999
|
-
disabled: !u.trim() ||
|
|
1128
|
+
disabled: !u.trim() || j,
|
|
1000
1129
|
onClick: () => {
|
|
1001
|
-
|
|
1130
|
+
F == null || F(u.trim()), m(!1), q("");
|
|
1002
1131
|
},
|
|
1003
1132
|
className: "h-7 rounded bg-violet-600 px-2 text-[11px] font-medium text-white disabled:opacity-40",
|
|
1004
|
-
children:
|
|
1133
|
+
children: j ? /* @__PURE__ */ t(te, { className: "h-3 w-3 animate-spin" }) : "Create"
|
|
1005
1134
|
}
|
|
1006
1135
|
),
|
|
1007
1136
|
/* @__PURE__ */ t(
|
|
1008
1137
|
"button",
|
|
1009
1138
|
{
|
|
1010
1139
|
type: "button",
|
|
1011
|
-
onClick: () =>
|
|
1140
|
+
onClick: () => m(!1),
|
|
1012
1141
|
className: "h-7 rounded px-1.5 text-[11px] text-slate-400 hover:text-slate-600",
|
|
1013
1142
|
children: "✕"
|
|
1014
1143
|
}
|
|
1015
1144
|
)
|
|
1016
|
-
] }) : /* @__PURE__ */ l(
|
|
1017
|
-
/* @__PURE__ */ t(
|
|
1145
|
+
] }) : /* @__PURE__ */ l(Pe, { open: w, onOpenChange: C, children: [
|
|
1146
|
+
/* @__PURE__ */ t(Ee, { asChild: !0, children: /* @__PURE__ */ l(
|
|
1018
1147
|
"button",
|
|
1019
1148
|
{
|
|
1020
1149
|
type: "button",
|
|
1021
|
-
disabled:
|
|
1150
|
+
disabled: j,
|
|
1022
1151
|
className: "flex h-7 w-full items-center justify-between rounded border border-slate-200 bg-white px-2 text-[12px] text-slate-500 transition-colors hover:border-slate-300 disabled:opacity-50 dark:border-border dark:bg-card dark:text-slate-300",
|
|
1023
1152
|
children: [
|
|
1024
1153
|
/* @__PURE__ */ l("span", { className: "flex items-center gap-1.5", children: [
|
|
1025
|
-
|
|
1154
|
+
j ? /* @__PURE__ */ t(te, { className: "h-3 w-3 animate-spin" }) : /* @__PURE__ */ t(ge, { className: "h-3 w-3" }),
|
|
1026
1155
|
"Add owner…"
|
|
1027
1156
|
] }),
|
|
1028
|
-
/* @__PURE__ */ t(
|
|
1157
|
+
/* @__PURE__ */ t(Ie, { className: "h-3 w-3 opacity-50" })
|
|
1029
1158
|
]
|
|
1030
1159
|
}
|
|
1031
1160
|
) }),
|
|
1032
|
-
/* @__PURE__ */ l(
|
|
1161
|
+
/* @__PURE__ */ l(Ke, { align: "start", className: "w-96 p-0", sideOffset: 4, children: [
|
|
1033
1162
|
/* @__PURE__ */ t("div", { className: "border-b border-slate-100 px-2 py-1.5 dark:border-border", children: /* @__PURE__ */ l("div", { className: "relative", children: [
|
|
1034
|
-
/* @__PURE__ */ t(
|
|
1163
|
+
/* @__PURE__ */ t(Te, { className: "absolute left-2 top-1/2 h-3.5 w-3.5 -translate-y-1/2 text-slate-400" }),
|
|
1035
1164
|
/* @__PURE__ */ t(
|
|
1036
1165
|
"input",
|
|
1037
1166
|
{
|
|
1038
|
-
ref:
|
|
1167
|
+
ref: Q,
|
|
1039
1168
|
value: x,
|
|
1040
|
-
onChange: (p) =>
|
|
1169
|
+
onChange: (p) => E(p.target.value),
|
|
1041
1170
|
placeholder: "Search teams and people…",
|
|
1042
1171
|
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 dark:bg-muted"
|
|
1043
1172
|
}
|
|
1044
1173
|
)
|
|
1045
1174
|
] }) }),
|
|
1046
1175
|
/* @__PURE__ */ l("div", { className: "max-h-64 overflow-y-auto py-1", children: [
|
|
1047
|
-
|
|
1176
|
+
$ && (Z.length > 0 || F) && /* @__PURE__ */ l(je, { children: [
|
|
1048
1177
|
/* @__PURE__ */ t("p", { className: "px-3 pb-0.5 pt-1 text-[10px] font-semibold uppercase tracking-wide text-slate-400", children: "Teams" }),
|
|
1049
|
-
|
|
1178
|
+
Z.map((p) => /* @__PURE__ */ l(
|
|
1050
1179
|
"button",
|
|
1051
1180
|
{
|
|
1052
1181
|
type: "button",
|
|
1053
1182
|
"data-tip": p.rank.tier === "out" ? `Outside this cell's scope — ${p.rank.mismatches.join("; ")}. Adding it is an override.` : p.rank.tier === "suggested" ? "Scoped to this combination" : void 0,
|
|
1054
1183
|
onClick: () => {
|
|
1055
|
-
|
|
1184
|
+
$(p.id), C(!1);
|
|
1056
1185
|
},
|
|
1057
1186
|
className: "flex w-full items-center gap-2 whitespace-nowrap px-3 py-1.5 text-left text-[12px] text-slate-700 hover:bg-muted dark:text-slate-200",
|
|
1058
1187
|
children: [
|
|
1059
1188
|
/* @__PURE__ */ t(
|
|
1060
|
-
|
|
1189
|
+
xe,
|
|
1061
1190
|
{
|
|
1062
1191
|
className: `h-3.5 w-3.5 shrink-0 ${p.rank.tier === "out" ? "text-amber-500" : "text-violet-500"}`
|
|
1063
1192
|
}
|
|
@@ -1073,99 +1202,99 @@ function bt({
|
|
|
1073
1202
|
},
|
|
1074
1203
|
p.id
|
|
1075
1204
|
)),
|
|
1076
|
-
|
|
1205
|
+
F && /* @__PURE__ */ l(
|
|
1077
1206
|
"button",
|
|
1078
1207
|
{
|
|
1079
1208
|
type: "button",
|
|
1080
1209
|
onClick: () => {
|
|
1081
|
-
|
|
1210
|
+
C(!1), m(!0), q(x.trim());
|
|
1082
1211
|
},
|
|
1083
1212
|
className: "flex w-full items-center gap-2 px-3 py-1.5 text-left text-[12px] text-violet-700 hover:bg-muted dark:text-violet-300",
|
|
1084
1213
|
children: [
|
|
1085
|
-
/* @__PURE__ */ t(
|
|
1214
|
+
/* @__PURE__ */ t(ge, { className: "h-3.5 w-3.5 shrink-0" }),
|
|
1086
1215
|
"New team…"
|
|
1087
1216
|
]
|
|
1088
1217
|
}
|
|
1089
1218
|
)
|
|
1090
1219
|
] }),
|
|
1091
1220
|
/* @__PURE__ */ t("p", { className: "px-3 pb-0.5 pt-1 text-[10px] font-semibold uppercase tracking-wide text-slate-400", children: "People" }),
|
|
1092
|
-
|
|
1221
|
+
ne.map((p) => /* @__PURE__ */ l(
|
|
1093
1222
|
"button",
|
|
1094
1223
|
{
|
|
1095
1224
|
type: "button",
|
|
1096
1225
|
onClick: () => {
|
|
1097
|
-
_(p.id),
|
|
1226
|
+
_(p.id, p), C(!1);
|
|
1098
1227
|
},
|
|
1099
1228
|
className: "flex w-full items-center gap-2 whitespace-nowrap px-3 py-1.5 text-left text-[12px] text-slate-700 hover:bg-muted dark:text-slate-200",
|
|
1100
1229
|
children: [
|
|
1101
1230
|
/* @__PURE__ */ t(
|
|
1102
|
-
|
|
1231
|
+
Oe,
|
|
1103
1232
|
{
|
|
1104
1233
|
userId: p.id,
|
|
1105
1234
|
className: "h-6 w-6",
|
|
1106
|
-
fallback: /* @__PURE__ */ t("span", { className: "flex h-6 w-6 shrink-0 items-center justify-center rounded-full bg-nvr-cyan/10 text-[9.5px] font-semibold text-slate-600 dark:text-slate-300", children:
|
|
1235
|
+
fallback: /* @__PURE__ */ t("span", { className: "flex h-6 w-6 shrink-0 items-center justify-center rounded-full bg-nvr-cyan/10 text-[9.5px] font-semibold text-slate-600 dark:text-slate-300", children: Be(p) })
|
|
1107
1236
|
}
|
|
1108
1237
|
),
|
|
1109
|
-
/* @__PURE__ */ t("span", { className: "min-w-0 flex-1 truncate font-medium", children:
|
|
1110
|
-
/* @__PURE__ */ t("span", { className: "max-w-[55%] shrink-0 truncate text-[11px] text-slate-400", children:
|
|
1238
|
+
/* @__PURE__ */ t("span", { className: "min-w-0 flex-1 truncate font-medium", children: M(p) }),
|
|
1239
|
+
/* @__PURE__ */ t("span", { className: "max-w-[55%] shrink-0 truncate text-[11px] text-slate-400", children: nt(p, B) })
|
|
1111
1240
|
]
|
|
1112
1241
|
},
|
|
1113
1242
|
p.id
|
|
1114
1243
|
)),
|
|
1115
|
-
|
|
1244
|
+
ne.length === 0 && Z.length === 0 && /* @__PURE__ */ t("p", { className: "px-3 py-2 text-[12px] text-slate-400", children: "No matches — people already in this cell are hidden" })
|
|
1116
1245
|
] })
|
|
1117
1246
|
] })
|
|
1118
1247
|
] });
|
|
1119
1248
|
}
|
|
1120
|
-
function
|
|
1121
|
-
templateId:
|
|
1122
|
-
groupsMap:
|
|
1123
|
-
states:
|
|
1124
|
-
onClose:
|
|
1125
|
-
onDone:
|
|
1249
|
+
function Bt({
|
|
1250
|
+
templateId: f,
|
|
1251
|
+
groupsMap: b,
|
|
1252
|
+
states: v,
|
|
1253
|
+
onClose: o,
|
|
1254
|
+
onDone: N
|
|
1126
1255
|
}) {
|
|
1127
|
-
const
|
|
1128
|
-
queryKey: ["bulk-matrix-users",
|
|
1129
|
-
queryFn: () =>
|
|
1130
|
-
}),
|
|
1131
|
-
x(!0),
|
|
1132
|
-
|
|
1133
|
-
user_id:
|
|
1134
|
-
group_ids: [
|
|
1256
|
+
const c = re(), [y, _] = T(""), [$, F] = T(""), [j, w] = T(/* @__PURE__ */ new Set()), [C, x] = T(!1), { data: E = [] } = V({
|
|
1257
|
+
queryKey: ["bulk-matrix-users", y.trim()],
|
|
1258
|
+
queryFn: () => c.request(K("/users", { limit: 50, sort: "first_name", search: y.trim() || void 0 })).then((u) => u.data)
|
|
1259
|
+
}), W = E.slice(0, 8), m = () => {
|
|
1260
|
+
x(!0), c.request(
|
|
1261
|
+
A(`/pipelines/${f}/owner-groups/bulk-add`, {
|
|
1262
|
+
user_id: $,
|
|
1263
|
+
group_ids: [...j]
|
|
1135
1264
|
})
|
|
1136
1265
|
).then((u) => {
|
|
1137
|
-
|
|
1138
|
-
}).catch(() =>
|
|
1266
|
+
O.success(`Added to ${u.data.added} group(s)`), N();
|
|
1267
|
+
}).catch(() => O.error("Bulk add failed")).finally(() => x(!1));
|
|
1139
1268
|
};
|
|
1140
1269
|
return /* @__PURE__ */ l("div", { className: "space-y-2 rounded-lg border border-slate-200 bg-slate-50/70 p-3 dark:border-border dark:bg-muted/30", children: [
|
|
1141
1270
|
/* @__PURE__ */ t("p", { className: "text-[12.5px] font-medium", children: "Add one user to many owner-matrix cells" }),
|
|
1142
|
-
|
|
1271
|
+
$ ? /* @__PURE__ */ l(je, { children: [
|
|
1143
1272
|
/* @__PURE__ */ l("p", { className: "text-[12px] text-slate-500", children: [
|
|
1144
1273
|
"Adding",
|
|
1145
1274
|
" ",
|
|
1146
1275
|
/* @__PURE__ */ t("b", { children: (() => {
|
|
1147
|
-
const u =
|
|
1148
|
-
return u ? [u.first_name, u.last_name].filter(Boolean).join(" ") || u.email :
|
|
1276
|
+
const u = E.find((q) => q.id === $);
|
|
1277
|
+
return u ? [u.first_name, u.last_name].filter(Boolean).join(" ") || u.email : $;
|
|
1149
1278
|
})() }),
|
|
1150
1279
|
" ",
|
|
1151
1280
|
"— pick the groups:"
|
|
1152
1281
|
] }),
|
|
1153
|
-
/* @__PURE__ */ t("div", { className: "max-h-64 space-y-2 overflow-y-auto", children:
|
|
1154
|
-
const
|
|
1155
|
-
return
|
|
1282
|
+
/* @__PURE__ */ t("div", { className: "max-h-64 space-y-2 overflow-y-auto", children: v.map((u) => {
|
|
1283
|
+
const q = b[u.id] ?? [];
|
|
1284
|
+
return q.length === 0 ? null : /* @__PURE__ */ l("div", { children: [
|
|
1156
1285
|
/* @__PURE__ */ t("p", { className: "text-[10.5px] font-semibold uppercase tracking-wide text-slate-400", children: u.label }),
|
|
1157
|
-
/* @__PURE__ */ t("div", { className: "mt-0.5 flex flex-wrap gap-1", children:
|
|
1158
|
-
const B = Number(
|
|
1286
|
+
/* @__PURE__ */ t("div", { className: "mt-0.5 flex flex-wrap gap-1", children: q.slice(0, 60).map((Q) => {
|
|
1287
|
+
const B = Number(Q.id), ae = j.has(B);
|
|
1159
1288
|
return /* @__PURE__ */ t(
|
|
1160
1289
|
"button",
|
|
1161
1290
|
{
|
|
1162
1291
|
type: "button",
|
|
1163
|
-
onClick: () =>
|
|
1164
|
-
const
|
|
1165
|
-
return
|
|
1292
|
+
onClick: () => w((R) => {
|
|
1293
|
+
const M = new Set(R);
|
|
1294
|
+
return M.has(B) ? M.delete(B) : M.add(B), M;
|
|
1166
1295
|
}),
|
|
1167
|
-
className:
|
|
1168
|
-
children:
|
|
1296
|
+
className: ae ? "rounded-full bg-nvr-cyan/15 px-2 py-0.5 text-[11px] font-medium text-nvr-navy dark:text-nvr-cyan" : "rounded-full border border-slate-200 px-2 py-0.5 text-[11px] text-slate-500 hover:border-nvr-cyan/50 dark:border-border",
|
|
1297
|
+
children: Q.name ?? `group ${B}`
|
|
1169
1298
|
},
|
|
1170
1299
|
B
|
|
1171
1300
|
);
|
|
@@ -1176,17 +1305,17 @@ function ht({
|
|
|
1176
1305
|
/* @__PURE__ */ t(
|
|
1177
1306
|
"input",
|
|
1178
1307
|
{
|
|
1179
|
-
value:
|
|
1308
|
+
value: y,
|
|
1180
1309
|
onChange: (u) => _(u.target.value),
|
|
1181
1310
|
placeholder: "Search people…",
|
|
1182
1311
|
className: "h-8 w-[280px] rounded-md border border-slate-200 bg-background px-2.5 text-[12.5px] dark:border-border"
|
|
1183
1312
|
}
|
|
1184
1313
|
),
|
|
1185
|
-
/* @__PURE__ */ t("div", { className: "mt-1 flex flex-wrap gap-1.5", children:
|
|
1314
|
+
/* @__PURE__ */ t("div", { className: "mt-1 flex flex-wrap gap-1.5", children: y && W.map((u) => /* @__PURE__ */ t(
|
|
1186
1315
|
"button",
|
|
1187
1316
|
{
|
|
1188
1317
|
type: "button",
|
|
1189
|
-
onClick: () =>
|
|
1318
|
+
onClick: () => F(u.id),
|
|
1190
1319
|
className: "rounded-full border border-slate-200 px-2.5 py-0.5 text-[12px] hover:border-nvr-cyan/60 dark:border-border",
|
|
1191
1320
|
children: [u.first_name, u.last_name].filter(Boolean).join(" ") || u.email
|
|
1192
1321
|
},
|
|
@@ -1198,7 +1327,7 @@ function ht({
|
|
|
1198
1327
|
"button",
|
|
1199
1328
|
{
|
|
1200
1329
|
type: "button",
|
|
1201
|
-
onClick:
|
|
1330
|
+
onClick: o,
|
|
1202
1331
|
className: "rounded-md px-2.5 py-1 text-[12px] text-slate-500 hover:bg-white dark:hover:bg-muted",
|
|
1203
1332
|
children: "Cancel"
|
|
1204
1333
|
}
|
|
@@ -1207,49 +1336,49 @@ function ht({
|
|
|
1207
1336
|
"button",
|
|
1208
1337
|
{
|
|
1209
1338
|
type: "button",
|
|
1210
|
-
onClick:
|
|
1211
|
-
disabled:
|
|
1339
|
+
onClick: m,
|
|
1340
|
+
disabled: C || !$ || j.size === 0,
|
|
1212
1341
|
className: "rounded-md bg-nvr-cyan px-3 py-1 text-[12px] font-semibold text-white disabled:opacity-50",
|
|
1213
|
-
children:
|
|
1342
|
+
children: C ? "Adding…" : `Add to ${j.size} group(s)`
|
|
1214
1343
|
}
|
|
1215
1344
|
)
|
|
1216
1345
|
] })
|
|
1217
1346
|
] });
|
|
1218
1347
|
}
|
|
1219
|
-
function
|
|
1220
|
-
team:
|
|
1221
|
-
onClose:
|
|
1348
|
+
function Ut({
|
|
1349
|
+
team: f,
|
|
1350
|
+
onClose: b
|
|
1222
1351
|
}) {
|
|
1223
|
-
var
|
|
1224
|
-
const
|
|
1225
|
-
queryKey: ["team-members",
|
|
1226
|
-
queryFn: () =>
|
|
1227
|
-
}),
|
|
1228
|
-
|
|
1229
|
-
}, _ =
|
|
1230
|
-
mutationFn: (x) =>
|
|
1231
|
-
onSuccess:
|
|
1232
|
-
onError: () =>
|
|
1233
|
-
}),
|
|
1234
|
-
mutationFn: (x) =>
|
|
1235
|
-
onSuccess:
|
|
1236
|
-
onError: () =>
|
|
1237
|
-
}),
|
|
1352
|
+
var C;
|
|
1353
|
+
const v = re(), o = tt(), { data: N, isLoading: c } = V({
|
|
1354
|
+
queryKey: ["team-members", f.id],
|
|
1355
|
+
queryFn: () => v.request(K(`/user-groups/${f.id}/members`)).then((x) => x.data)
|
|
1356
|
+
}), y = () => {
|
|
1357
|
+
o.invalidateQueries({ queryKey: ["team-members", f.id] }), o.invalidateQueries({ queryKey: ["user-groups-teams"] });
|
|
1358
|
+
}, _ = G({
|
|
1359
|
+
mutationFn: (x) => v.request(A(`/user-groups/${f.id}/members`, { user_ids: [x] })),
|
|
1360
|
+
onSuccess: y,
|
|
1361
|
+
onError: () => O.error("Failed to add member")
|
|
1362
|
+
}), $ = G({
|
|
1363
|
+
mutationFn: (x) => v.request(ce(`/user-groups/${f.id}/members/${x}`)),
|
|
1364
|
+
onSuccess: y,
|
|
1365
|
+
onError: () => O.error("Failed to remove member")
|
|
1366
|
+
}), F = new Set((N ?? []).map((x) => String(x.id).toUpperCase())), { data: j } = V({
|
|
1238
1367
|
queryKey: ["user-groups-teams"],
|
|
1239
|
-
queryFn: () =>
|
|
1240
|
-
|
|
1368
|
+
queryFn: () => v.request(
|
|
1369
|
+
K("/user-groups")
|
|
1241
1370
|
).then((x) => x.data),
|
|
1242
1371
|
staleTime: 6e4
|
|
1243
|
-
}),
|
|
1244
|
-
return
|
|
1372
|
+
}), w = ((C = j == null ? void 0 : j.find((x) => x.id === f.id)) == null ? void 0 : C.scopes) ?? {};
|
|
1373
|
+
return gt(
|
|
1245
1374
|
/* @__PURE__ */ t(
|
|
1246
1375
|
"div",
|
|
1247
1376
|
{
|
|
1248
1377
|
"data-omx-overlay": !0,
|
|
1249
1378
|
className: "fixed inset-0 z-[130] flex items-center justify-center bg-black/40 p-4",
|
|
1250
|
-
onClick:
|
|
1379
|
+
onClick: b,
|
|
1251
1380
|
onKeyDown: (x) => {
|
|
1252
|
-
x.key === "Escape" &&
|
|
1381
|
+
x.key === "Escape" && b();
|
|
1253
1382
|
},
|
|
1254
1383
|
children: /* @__PURE__ */ l(
|
|
1255
1384
|
"div",
|
|
@@ -1258,43 +1387,43 @@ function xt({
|
|
|
1258
1387
|
onClick: (x) => x.stopPropagation(),
|
|
1259
1388
|
children: [
|
|
1260
1389
|
/* @__PURE__ */ l("div", { className: "mb-1 flex items-center gap-2", children: [
|
|
1261
|
-
/* @__PURE__ */ t(
|
|
1262
|
-
/* @__PURE__ */ t("h2", { className: "text-[14px] font-semibold text-slate-900 dark:text-foreground", children:
|
|
1390
|
+
/* @__PURE__ */ t(xe, { className: "h-4 w-4 text-violet-500" }),
|
|
1391
|
+
/* @__PURE__ */ t("h2", { className: "text-[14px] font-semibold text-slate-900 dark:text-foreground", children: f.name }),
|
|
1263
1392
|
/* @__PURE__ */ l("span", { className: "ml-auto text-[11px] tabular-nums text-slate-400", children: [
|
|
1264
|
-
(
|
|
1393
|
+
(N ?? []).length,
|
|
1265
1394
|
" member",
|
|
1266
|
-
(
|
|
1395
|
+
(N ?? []).length === 1 ? "" : "s"
|
|
1267
1396
|
] })
|
|
1268
1397
|
] }),
|
|
1269
1398
|
/* @__PURE__ */ t("p", { className: "mb-3 text-[11.5px] text-slate-500 dark:text-muted-foreground", children: "Roster edits apply everywhere this team is assigned." }),
|
|
1270
|
-
|
|
1271
|
-
(
|
|
1399
|
+
c ? /* @__PURE__ */ t("div", { className: "flex justify-center py-4", children: /* @__PURE__ */ t(te, { className: "h-4 w-4 animate-spin text-slate-400" }) }) : /* @__PURE__ */ l("div", { className: "mb-2 max-h-56 divide-y divide-slate-100 overflow-y-auto dark:divide-border/60", children: [
|
|
1400
|
+
(N ?? []).map((x) => /* @__PURE__ */ l("div", { className: "flex items-center gap-1.5 py-1.5", children: [
|
|
1272
1401
|
/* @__PURE__ */ t("span", { className: "flex-1 truncate text-[12.5px] text-slate-700 dark:text-slate-200", children: [x.first_name, x.last_name].filter(Boolean).join(" ") || x.email }),
|
|
1273
1402
|
/* @__PURE__ */ t(
|
|
1274
1403
|
"button",
|
|
1275
1404
|
{
|
|
1276
1405
|
type: "button",
|
|
1277
1406
|
"aria-label": "Remove from team",
|
|
1278
|
-
disabled:
|
|
1279
|
-
onClick: () =>
|
|
1407
|
+
disabled: $.isPending,
|
|
1408
|
+
onClick: () => $.mutate(x.id),
|
|
1280
1409
|
className: "text-slate-400 hover:text-red-500",
|
|
1281
|
-
children: /* @__PURE__ */ t(
|
|
1410
|
+
children: /* @__PURE__ */ t(ye, { className: "h-3.5 w-3.5" })
|
|
1282
1411
|
}
|
|
1283
1412
|
)
|
|
1284
1413
|
] }, x.id)),
|
|
1285
|
-
(
|
|
1414
|
+
(N ?? []).length === 0 && /* @__PURE__ */ t("p", { className: "py-2 text-[12px] text-slate-400", children: "No members yet — add people below." })
|
|
1286
1415
|
] }),
|
|
1287
1416
|
/* @__PURE__ */ t(
|
|
1288
|
-
|
|
1417
|
+
Dt,
|
|
1289
1418
|
{
|
|
1290
|
-
teamId:
|
|
1291
|
-
excludeIds: [...
|
|
1419
|
+
teamId: f.id,
|
|
1420
|
+
excludeIds: [...F],
|
|
1292
1421
|
isPending: _.isPending,
|
|
1293
1422
|
onPick: (x) => _.mutate(x)
|
|
1294
1423
|
}
|
|
1295
1424
|
),
|
|
1296
|
-
/* @__PURE__ */ t("div", { className: "mt-3 border-t border-slate-100 pt-3 dark:border-border/60", children: /* @__PURE__ */ t(
|
|
1297
|
-
/* @__PURE__ */ t("div", { className: "mt-3 flex justify-end", children: /* @__PURE__ */ t(
|
|
1425
|
+
/* @__PURE__ */ t("div", { className: "mt-3 border-t border-slate-100 pt-3 dark:border-border/60", children: /* @__PURE__ */ t(St, { teamId: f.id, scopes: w }) }),
|
|
1426
|
+
/* @__PURE__ */ t("div", { className: "mt-3 flex justify-end", children: /* @__PURE__ */ t(Se, { size: "sm", variant: "outline", className: "h-7 text-[12px]", onClick: b, children: "Done" }) })
|
|
1298
1427
|
]
|
|
1299
1428
|
}
|
|
1300
1429
|
)
|
|
@@ -1303,110 +1432,110 @@ function xt({
|
|
|
1303
1432
|
document.body
|
|
1304
1433
|
);
|
|
1305
1434
|
}
|
|
1306
|
-
const
|
|
1435
|
+
const At = {
|
|
1307
1436
|
match: "Matches team scope",
|
|
1308
1437
|
unrestricted: "No restrictions",
|
|
1309
1438
|
mismatch: "Outside team scope"
|
|
1310
1439
|
};
|
|
1311
|
-
function
|
|
1312
|
-
teamId:
|
|
1313
|
-
excludeIds:
|
|
1314
|
-
isPending:
|
|
1315
|
-
onPick:
|
|
1440
|
+
function Dt({
|
|
1441
|
+
teamId: f,
|
|
1442
|
+
excludeIds: b,
|
|
1443
|
+
isPending: v,
|
|
1444
|
+
onPick: o
|
|
1316
1445
|
}) {
|
|
1317
|
-
const
|
|
1318
|
-
|
|
1319
|
-
|
|
1320
|
-
var
|
|
1321
|
-
return (
|
|
1322
|
-
}, 50) :
|
|
1323
|
-
}, [
|
|
1324
|
-
const
|
|
1325
|
-
queryKey: ["team-candidates",
|
|
1326
|
-
queryFn: () =>
|
|
1327
|
-
|
|
1328
|
-
).then((
|
|
1329
|
-
enabled:
|
|
1446
|
+
const N = re(), [c, y] = T(!1), [_, $] = T(""), F = ue(null);
|
|
1447
|
+
ve(() => {
|
|
1448
|
+
c ? setTimeout(() => {
|
|
1449
|
+
var m;
|
|
1450
|
+
return (m = F.current) == null ? void 0 : m.focus();
|
|
1451
|
+
}, 50) : $("");
|
|
1452
|
+
}, [c]);
|
|
1453
|
+
const j = st(), { data: w } = V({
|
|
1454
|
+
queryKey: ["team-candidates", f, _.trim()],
|
|
1455
|
+
queryFn: () => N.request(
|
|
1456
|
+
K(`/user-groups/${f}/candidates`, { search: _.trim() || void 0 })
|
|
1457
|
+
).then((m) => m.data),
|
|
1458
|
+
enabled: c,
|
|
1330
1459
|
staleTime: 6e4
|
|
1331
|
-
}),
|
|
1332
|
-
return /* @__PURE__ */ l(
|
|
1333
|
-
/* @__PURE__ */ t(
|
|
1460
|
+
}), C = (m) => [m.first_name, m.last_name].filter(Boolean).join(" ") || m.email, x = new Set(b.map((m) => m.toUpperCase())), E = ((w == null ? void 0 : w.users) ?? []).filter((m) => !x.has(String(m.id).toUpperCase())), W = !!(w != null && w.ranked);
|
|
1461
|
+
return /* @__PURE__ */ l(Pe, { open: c, onOpenChange: y, children: [
|
|
1462
|
+
/* @__PURE__ */ t(Ee, { asChild: !0, children: /* @__PURE__ */ l(
|
|
1334
1463
|
"button",
|
|
1335
1464
|
{
|
|
1336
1465
|
type: "button",
|
|
1337
|
-
disabled:
|
|
1466
|
+
disabled: v,
|
|
1338
1467
|
className: "flex h-7 w-full items-center justify-between rounded border border-slate-200 bg-white px-2 text-[12px] text-slate-500 transition-colors hover:border-slate-300 disabled:opacity-50 dark:border-border dark:bg-card dark:text-slate-300",
|
|
1339
1468
|
children: [
|
|
1340
1469
|
/* @__PURE__ */ l("span", { className: "flex items-center gap-1.5", children: [
|
|
1341
|
-
|
|
1470
|
+
v ? /* @__PURE__ */ t(te, { className: "h-3 w-3 animate-spin" }) : /* @__PURE__ */ t(ge, { className: "h-3 w-3" }),
|
|
1342
1471
|
"Add member…"
|
|
1343
1472
|
] }),
|
|
1344
|
-
/* @__PURE__ */ t(
|
|
1473
|
+
/* @__PURE__ */ t(Ie, { className: "h-3 w-3 opacity-50" })
|
|
1345
1474
|
]
|
|
1346
1475
|
}
|
|
1347
1476
|
) }),
|
|
1348
|
-
/* @__PURE__ */ l(
|
|
1477
|
+
/* @__PURE__ */ l(Ke, { align: "start", className: "z-[140] w-96 p-0", sideOffset: 4, children: [
|
|
1349
1478
|
/* @__PURE__ */ t("div", { className: "border-b border-slate-100 px-2 py-1.5 dark:border-border", children: /* @__PURE__ */ l("div", { className: "relative", children: [
|
|
1350
|
-
/* @__PURE__ */ t(
|
|
1479
|
+
/* @__PURE__ */ t(Te, { className: "absolute left-2 top-1/2 h-3.5 w-3.5 -translate-y-1/2 text-slate-400" }),
|
|
1351
1480
|
/* @__PURE__ */ t(
|
|
1352
1481
|
"input",
|
|
1353
1482
|
{
|
|
1354
|
-
ref:
|
|
1483
|
+
ref: F,
|
|
1355
1484
|
value: _,
|
|
1356
|
-
onChange: (
|
|
1485
|
+
onChange: (m) => $(m.target.value),
|
|
1357
1486
|
placeholder: "Search people…",
|
|
1358
1487
|
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-violet-400/40 dark:bg-muted"
|
|
1359
1488
|
}
|
|
1360
1489
|
)
|
|
1361
1490
|
] }) }),
|
|
1362
1491
|
/* @__PURE__ */ l("div", { className: "max-h-56 overflow-y-auto py-1", children: [
|
|
1363
|
-
|
|
1364
|
-
const
|
|
1365
|
-
return /* @__PURE__ */ l(
|
|
1366
|
-
|
|
1492
|
+
E.map((m, u) => {
|
|
1493
|
+
const q = m.scope_tier ?? "unrestricted", Q = W && (u === 0 || (E[u - 1].scope_tier ?? "unrestricted") !== q);
|
|
1494
|
+
return /* @__PURE__ */ l(rt, { children: [
|
|
1495
|
+
Q && /* @__PURE__ */ t(
|
|
1367
1496
|
"p",
|
|
1368
1497
|
{
|
|
1369
|
-
className: `px-3 pb-0.5 pt-1.5 text-[10px] font-semibold uppercase tracking-wide ${
|
|
1370
|
-
children:
|
|
1498
|
+
className: `px-3 pb-0.5 pt-1.5 text-[10px] font-semibold uppercase tracking-wide ${q === "mismatch" ? "text-amber-500" : q === "match" ? "text-emerald-600 dark:text-emerald-400" : "text-slate-400"}`,
|
|
1499
|
+
children: At[q]
|
|
1371
1500
|
}
|
|
1372
1501
|
),
|
|
1373
1502
|
/* @__PURE__ */ l(
|
|
1374
1503
|
"button",
|
|
1375
1504
|
{
|
|
1376
1505
|
type: "button",
|
|
1377
|
-
"data-tip":
|
|
1506
|
+
"data-tip": q === "mismatch" && (m.scope_mismatch ?? []).length > 0 ? `Restricted elsewhere on ${(m.scope_mismatch ?? []).join(", ")} — adding is an override` : void 0,
|
|
1378
1507
|
onClick: () => {
|
|
1379
|
-
|
|
1508
|
+
o(m.id), y(!1);
|
|
1380
1509
|
},
|
|
1381
1510
|
className: "flex w-full items-center gap-2 whitespace-nowrap px-3 py-1.5 text-left text-[12px] text-slate-700 hover:bg-muted dark:text-slate-200",
|
|
1382
1511
|
children: [
|
|
1383
1512
|
/* @__PURE__ */ t(
|
|
1384
|
-
|
|
1513
|
+
Oe,
|
|
1385
1514
|
{
|
|
1386
|
-
userId:
|
|
1515
|
+
userId: m.id,
|
|
1387
1516
|
className: "h-6 w-6",
|
|
1388
1517
|
fallback: /* @__PURE__ */ t(
|
|
1389
1518
|
"span",
|
|
1390
1519
|
{
|
|
1391
|
-
className: `flex h-6 w-6 shrink-0 items-center justify-center rounded-full text-[9.5px] font-semibold ${
|
|
1392
|
-
children:
|
|
1520
|
+
className: `flex h-6 w-6 shrink-0 items-center justify-center rounded-full text-[9.5px] font-semibold ${q === "mismatch" ? "bg-amber-100 text-amber-700 dark:bg-amber-500/15 dark:text-amber-400" : "bg-violet-100 text-violet-700 dark:bg-violet-500/15 dark:text-violet-300"}`,
|
|
1521
|
+
children: Be(m)
|
|
1393
1522
|
}
|
|
1394
1523
|
)
|
|
1395
1524
|
}
|
|
1396
1525
|
),
|
|
1397
|
-
/* @__PURE__ */ t("span", { className: "min-w-0 flex-1 truncate font-medium", children:
|
|
1398
|
-
/* @__PURE__ */ t("span", { className: "max-w-[55%] shrink-0 truncate text-[11px] text-slate-400", children:
|
|
1526
|
+
/* @__PURE__ */ t("span", { className: "min-w-0 flex-1 truncate font-medium", children: C(m) }),
|
|
1527
|
+
/* @__PURE__ */ t("span", { className: "max-w-[55%] shrink-0 truncate text-[11px] text-slate-400", children: nt(m, j) })
|
|
1399
1528
|
]
|
|
1400
1529
|
}
|
|
1401
1530
|
)
|
|
1402
|
-
] },
|
|
1531
|
+
] }, m.id);
|
|
1403
1532
|
}),
|
|
1404
|
-
|
|
1533
|
+
E.length === 0 && /* @__PURE__ */ t("p", { className: "px-3 py-2 text-[12px] text-slate-400", children: "No matches — people already on the team are hidden" })
|
|
1405
1534
|
] })
|
|
1406
1535
|
] })
|
|
1407
1536
|
] });
|
|
1408
1537
|
}
|
|
1409
1538
|
export {
|
|
1410
|
-
|
|
1411
|
-
|
|
1539
|
+
Dt as MemberPickerCombobox,
|
|
1540
|
+
sr as OwnerMatrix
|
|
1412
1541
|
};
|