@burdenoff/microfe-proserviceworld 2026.827.1 → 2026.1009.1
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/index.js +4 -4
- package/dist/proserviceworld/components/ui.js +1 -1
- package/dist/proserviceworld/components/ui.js.map +1 -1
- package/dist/proserviceworld/hooks/useProServiceWorldApi.d.ts.map +1 -1
- package/dist/proserviceworld/hooks/useProServiceWorldApi.js.map +1 -1
- package/dist/proserviceworld/hooks/useTr.d.ts +19 -0
- package/dist/proserviceworld/hooks/useTr.d.ts.map +1 -0
- package/dist/proserviceworld/hooks/useTr.js +33 -0
- package/dist/proserviceworld/hooks/useTr.js.map +1 -0
- package/dist/proserviceworld/i18n/index.d.ts +1 -1
- package/dist/proserviceworld/i18n/index.d.ts.map +1 -1
- package/dist/proserviceworld/i18n/index.js +723 -18
- package/dist/proserviceworld/i18n/index.js.map +1 -1
- package/dist/proserviceworld/index.js +4 -4
- package/dist/proserviceworld/pages/ClientsPage.d.ts.map +1 -1
- package/dist/proserviceworld/pages/ClientsPage.js +166 -164
- package/dist/proserviceworld/pages/ClientsPage.js.map +1 -1
- package/dist/proserviceworld/pages/DashboardPage.d.ts.map +1 -1
- package/dist/proserviceworld/pages/DashboardPage.js +152 -142
- package/dist/proserviceworld/pages/DashboardPage.js.map +1 -1
- package/dist/proserviceworld/pages/EngagementsPage.d.ts.map +1 -1
- package/dist/proserviceworld/pages/EngagementsPage.js +135 -135
- package/dist/proserviceworld/pages/EngagementsPage.js.map +1 -1
- package/dist/proserviceworld/pages/MattersPage.d.ts.map +1 -1
- package/dist/proserviceworld/pages/MattersPage.js +204 -197
- package/dist/proserviceworld/pages/MattersPage.js.map +1 -1
- package/package.json +1 -1
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { useArchiveClient as e, useClients as t, useCreateClient as n, useUpdateClient as r } from "../hooks/useProServiceWorldApi.js";
|
|
2
2
|
import { useNav as i } from "../utils/nav.js";
|
|
3
3
|
import { cn as a } from "../utils/cn.js";
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
4
|
+
import { useTr as o } from "../hooks/useTr.js";
|
|
5
|
+
import { Banner as s, Empty as c, ErrorState as l, Field as u, LoadingBlock as d, Modal as f, NativeSelect as p, PageHeader as m, SectionCard as h, StatusPill as g, TableWrap as _, Td as v, TextArea as y, TextInput as b, Th as x, enumOptions as S, fmtDate as C } from "../components/ui.js";
|
|
6
6
|
import { useAnalytics as w } from "../hooks/useAnalytics.js";
|
|
7
7
|
import { impactFeedback as T } from "../utils/native.js";
|
|
8
8
|
import { TagPicker as E } from "../components/TagPicker.js";
|
|
@@ -31,62 +31,62 @@ var R = ["ORGANIZATION", "INDIVIDUAL"], z = [
|
|
|
31
31
|
contactPhone: "",
|
|
32
32
|
notes: ""
|
|
33
33
|
}, U = 25, W = () => {
|
|
34
|
-
let e = i(), { emitIntent:
|
|
34
|
+
let e = i(), n = o(), { emitIntent: a, emitFact: u } = w(), [f, y] = O(""), [k, P] = O(""), [R, B] = O(null), [H, W] = O(!1), [q, J] = O(null), [ie, Y] = O({
|
|
35
35
|
limit: U,
|
|
36
36
|
offset: 0
|
|
37
|
-
}), { data:
|
|
38
|
-
search:
|
|
39
|
-
status:
|
|
37
|
+
}), { data: X, isLoading: Z, error: Q, refetch: $ } = t({
|
|
38
|
+
search: f.trim() || void 0,
|
|
39
|
+
status: k || void 0,
|
|
40
40
|
pagination: ie
|
|
41
|
-
}),
|
|
41
|
+
}), ae = r(), oe = D(() => X?.items ?? [], [X]);
|
|
42
42
|
return /* @__PURE__ */ I("div", {
|
|
43
43
|
className: "space-y-6",
|
|
44
44
|
children: [
|
|
45
|
-
/* @__PURE__ */ F(
|
|
46
|
-
title:
|
|
47
|
-
subtitle:
|
|
45
|
+
/* @__PURE__ */ F(m, {
|
|
46
|
+
title: n("psw.clients.title", "Clients"),
|
|
47
|
+
subtitle: n("psw.clients.subtitle", "Every person or organization your firm serves."),
|
|
48
48
|
icon: /* @__PURE__ */ F(N, { className: "h-6 w-6" }),
|
|
49
49
|
actions: /* @__PURE__ */ I(L, {
|
|
50
50
|
onClick: () => {
|
|
51
|
-
T("light"),
|
|
51
|
+
T("light"), a("psw.client.create_clicked"), W(!0);
|
|
52
52
|
},
|
|
53
53
|
children: [
|
|
54
54
|
/* @__PURE__ */ F(M, { className: "mr-1.5 h-4 w-4" }),
|
|
55
55
|
" ",
|
|
56
|
-
|
|
56
|
+
n("psw.clients.new", "New client")
|
|
57
57
|
]
|
|
58
58
|
})
|
|
59
59
|
}),
|
|
60
|
-
|
|
61
|
-
tone:
|
|
62
|
-
onClose: () =>
|
|
63
|
-
children:
|
|
60
|
+
q && /* @__PURE__ */ F(s, {
|
|
61
|
+
tone: q.tone,
|
|
62
|
+
onClose: () => J(null),
|
|
63
|
+
children: q.text
|
|
64
64
|
}),
|
|
65
65
|
/* @__PURE__ */ I("div", {
|
|
66
66
|
className: "flex flex-col gap-2 sm:flex-row sm:items-center",
|
|
67
67
|
children: [/* @__PURE__ */ I("div", {
|
|
68
68
|
className: "relative flex-1",
|
|
69
|
-
children: [/* @__PURE__ */ F(ne, { className: "pointer-events-none absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-text-tertiary" }), /* @__PURE__ */ F(
|
|
70
|
-
placeholder:
|
|
71
|
-
value:
|
|
69
|
+
children: [/* @__PURE__ */ F(ne, { className: "pointer-events-none absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-text-tertiary" }), /* @__PURE__ */ F(b, {
|
|
70
|
+
placeholder: n("psw.clients.searchPlaceholder", "Search clients…"),
|
|
71
|
+
value: f,
|
|
72
72
|
onChange: (e) => {
|
|
73
|
-
|
|
73
|
+
y(e.target.value), Y({
|
|
74
74
|
limit: U,
|
|
75
75
|
offset: 0
|
|
76
76
|
});
|
|
77
77
|
},
|
|
78
78
|
onKeyDown: (e) => {
|
|
79
|
-
e.key === "Enter" &&
|
|
79
|
+
e.key === "Enter" && f.trim() && u("psw.search.performed", {
|
|
80
80
|
entityType: "client",
|
|
81
|
-
queryLength:
|
|
81
|
+
queryLength: f.trim().length
|
|
82
82
|
});
|
|
83
83
|
},
|
|
84
84
|
className: "pl-9"
|
|
85
85
|
})]
|
|
86
|
-
}), /* @__PURE__ */ I(
|
|
87
|
-
value:
|
|
86
|
+
}), /* @__PURE__ */ I(p, {
|
|
87
|
+
value: k,
|
|
88
88
|
onChange: (e) => {
|
|
89
|
-
|
|
89
|
+
P(e.target.value), Y({
|
|
90
90
|
limit: U,
|
|
91
91
|
offset: 0
|
|
92
92
|
});
|
|
@@ -94,31 +94,31 @@ var R = ["ORGANIZATION", "INDIVIDUAL"], z = [
|
|
|
94
94
|
className: "sm:w-48",
|
|
95
95
|
children: [/* @__PURE__ */ F("option", {
|
|
96
96
|
value: "",
|
|
97
|
-
children:
|
|
98
|
-
}),
|
|
97
|
+
children: n("psw.clients.allStatuses", "All statuses")
|
|
98
|
+
}), S(z)]
|
|
99
99
|
})]
|
|
100
100
|
}),
|
|
101
|
-
|
|
102
|
-
error:
|
|
103
|
-
onRetry: () => void
|
|
104
|
-
}) : !
|
|
105
|
-
title:
|
|
106
|
-
description:
|
|
101
|
+
Z ? /* @__PURE__ */ F(d, {}) : Q ? /* @__PURE__ */ F(l, {
|
|
102
|
+
error: Q,
|
|
103
|
+
onRetry: () => void $()
|
|
104
|
+
}) : !X || X.items.length === 0 ? /* @__PURE__ */ F(c, {
|
|
105
|
+
title: n("psw.clients.emptyTitle", "No clients yet"),
|
|
106
|
+
description: n("psw.clients.emptyDescription", "Add your first client to start scoping engagements and matters."),
|
|
107
107
|
icon: /* @__PURE__ */ F(N, { className: "h-8 w-8" }),
|
|
108
108
|
action: /* @__PURE__ */ I(L, {
|
|
109
|
-
onClick: () =>
|
|
109
|
+
onClick: () => W(!0),
|
|
110
110
|
children: [
|
|
111
111
|
/* @__PURE__ */ F(M, { className: "mr-1.5 h-4 w-4" }),
|
|
112
112
|
" ",
|
|
113
|
-
|
|
113
|
+
n("psw.clients.new", "New client")
|
|
114
114
|
]
|
|
115
115
|
})
|
|
116
|
-
}) : /* @__PURE__ */ I(
|
|
117
|
-
title:
|
|
116
|
+
}) : /* @__PURE__ */ I(h, {
|
|
117
|
+
title: X.totalCount === 1 ? n("psw.clients.count", "{{count}} client", { count: X.totalCount }) : n("psw.clients.countPlural", "{{count}} clients", { count: X.totalCount }),
|
|
118
118
|
children: [
|
|
119
119
|
/* @__PURE__ */ F("ul", {
|
|
120
120
|
className: "space-y-2.5 sm:hidden",
|
|
121
|
-
children:
|
|
121
|
+
children: X.items.map((t) => /* @__PURE__ */ I("li", {
|
|
122
122
|
className: "overflow-hidden rounded-xl border border-border-seam bg-bg-canvas",
|
|
123
123
|
children: [/* @__PURE__ */ I("button", {
|
|
124
124
|
type: "button",
|
|
@@ -140,14 +140,14 @@ var R = ["ORGANIZATION", "INDIVIDUAL"], z = [
|
|
|
140
140
|
}),
|
|
141
141
|
/* @__PURE__ */ F("span", {
|
|
142
142
|
className: "mt-0.5 block truncate text-sm text-text-secondary",
|
|
143
|
-
children: t.contactName || (t.type === "ORGANIZATION" ? "Organization" : "Individual")
|
|
143
|
+
children: t.contactName || (t.type === "ORGANIZATION" ? n("psw.clients.typeOrganization", "Organization") : n("psw.clients.typeIndividual", "Individual"))
|
|
144
144
|
}),
|
|
145
145
|
/* @__PURE__ */ I("span", {
|
|
146
146
|
className: "mt-1.5 flex items-center gap-2",
|
|
147
147
|
children: [/* @__PURE__ */ F("span", {
|
|
148
148
|
className: "truncate text-xs text-text-tertiary",
|
|
149
|
-
children: t.industry ||
|
|
150
|
-
}), /* @__PURE__ */ F(
|
|
149
|
+
children: t.industry || C(t.createdAt)
|
|
150
|
+
}), /* @__PURE__ */ F(g, { status: t.status })]
|
|
151
151
|
})
|
|
152
152
|
]
|
|
153
153
|
}),
|
|
@@ -162,10 +162,10 @@ var R = ["ORGANIZATION", "INDIVIDUAL"], z = [
|
|
|
162
162
|
entityId: t.id,
|
|
163
163
|
tags: t.tags ?? [],
|
|
164
164
|
onChange: async (e) => {
|
|
165
|
-
await
|
|
165
|
+
await ae.mutateAsync({
|
|
166
166
|
id: t.id,
|
|
167
167
|
input: { tags: e }
|
|
168
|
-
}),
|
|
168
|
+
}), $();
|
|
169
169
|
},
|
|
170
170
|
maxTags: 5
|
|
171
171
|
})
|
|
@@ -174,17 +174,18 @@ var R = ["ORGANIZATION", "INDIVIDUAL"], z = [
|
|
|
174
174
|
children: [/* @__PURE__ */ F(L, {
|
|
175
175
|
variant: "ghost",
|
|
176
176
|
size: "sm",
|
|
177
|
-
onClick: () =>
|
|
178
|
-
"aria-label":
|
|
177
|
+
onClick: () => B(t),
|
|
178
|
+
"aria-label": n("psw.common.edit", "Edit"),
|
|
179
179
|
children: /* @__PURE__ */ F(j, { className: "h-4 w-4" })
|
|
180
180
|
}), t.status !== "ARCHIVED" && /* @__PURE__ */ F(G, {
|
|
181
181
|
id: t.id,
|
|
182
|
-
|
|
182
|
+
name: t.name,
|
|
183
|
+
onDone: (e) => J(e ? {
|
|
183
184
|
tone: "success",
|
|
184
|
-
text:
|
|
185
|
+
text: n("psw.clients.archived", "{{name}} archived.", { name: t.name })
|
|
185
186
|
} : {
|
|
186
187
|
tone: "danger",
|
|
187
|
-
text: "Could not archive client."
|
|
188
|
+
text: n("psw.clients.archiveFailed", "Could not archive client.")
|
|
188
189
|
})
|
|
189
190
|
})]
|
|
190
191
|
})]
|
|
@@ -193,22 +194,22 @@ var R = ["ORGANIZATION", "INDIVIDUAL"], z = [
|
|
|
193
194
|
}),
|
|
194
195
|
/* @__PURE__ */ F("div", {
|
|
195
196
|
className: "hidden sm:block",
|
|
196
|
-
children: /* @__PURE__ */ I(
|
|
197
|
-
/* @__PURE__ */ F(
|
|
198
|
-
/* @__PURE__ */ F(
|
|
199
|
-
/* @__PURE__ */ F(
|
|
200
|
-
/* @__PURE__ */ F(
|
|
201
|
-
/* @__PURE__ */ F(
|
|
202
|
-
/* @__PURE__ */ F(
|
|
203
|
-
/* @__PURE__ */ F(
|
|
197
|
+
children: /* @__PURE__ */ I(_, { children: [/* @__PURE__ */ F("thead", { children: /* @__PURE__ */ I("tr", { children: [
|
|
198
|
+
/* @__PURE__ */ F(x, { children: n("psw.common.name", "Name") }),
|
|
199
|
+
/* @__PURE__ */ F(x, { children: n("psw.common.type", "Type") }),
|
|
200
|
+
/* @__PURE__ */ F(x, { children: n("psw.clients.tableIndustry", "Industry") }),
|
|
201
|
+
/* @__PURE__ */ F(x, { children: n("psw.common.status", "Status") }),
|
|
202
|
+
/* @__PURE__ */ F(x, { children: n("psw.common.added", "Added") }),
|
|
203
|
+
/* @__PURE__ */ F(x, { children: n("psw.clients.tableTags", "Tags") }),
|
|
204
|
+
/* @__PURE__ */ F(x, {
|
|
204
205
|
className: "text-right",
|
|
205
|
-
children:
|
|
206
|
+
children: n("psw.common.actions", "Actions")
|
|
206
207
|
})
|
|
207
|
-
] }) }), /* @__PURE__ */ F("tbody", { children:
|
|
208
|
+
] }) }), /* @__PURE__ */ F("tbody", { children: X.items.map((t) => /* @__PURE__ */ I("tr", {
|
|
208
209
|
className: "group cursor-pointer transition-colors hover:bg-bg-sunken/60",
|
|
209
210
|
onClick: () => e(`clients/${t.id}`),
|
|
210
211
|
children: [
|
|
211
|
-
/* @__PURE__ */ F(
|
|
212
|
+
/* @__PURE__ */ F(v, { children: /* @__PURE__ */ I("div", {
|
|
212
213
|
className: "flex items-center gap-3",
|
|
213
214
|
children: [/* @__PURE__ */ F(V, { name: t.name }), /* @__PURE__ */ I("div", {
|
|
214
215
|
className: "min-w-0",
|
|
@@ -224,17 +225,17 @@ var R = ["ORGANIZATION", "INDIVIDUAL"], z = [
|
|
|
224
225
|
}) : null]
|
|
225
226
|
})]
|
|
226
227
|
}) }),
|
|
227
|
-
/* @__PURE__ */ F(
|
|
228
|
+
/* @__PURE__ */ F(v, { children: /* @__PURE__ */ I("span", {
|
|
228
229
|
className: "inline-flex items-center gap-1.5 text-text-secondary",
|
|
229
|
-
children: [t.type === "ORGANIZATION" ? /* @__PURE__ */ F(te, { className: "h-3.5 w-3.5 text-text-tertiary" }) : /* @__PURE__ */ F(re, { className: "h-3.5 w-3.5 text-text-tertiary" }), t.type === "ORGANIZATION" ? "Organization" : "Individual"]
|
|
230
|
+
children: [t.type === "ORGANIZATION" ? /* @__PURE__ */ F(te, { className: "h-3.5 w-3.5 text-text-tertiary" }) : /* @__PURE__ */ F(re, { className: "h-3.5 w-3.5 text-text-tertiary" }), t.type === "ORGANIZATION" ? n("psw.clients.typeOrganization", "Organization") : n("psw.clients.typeIndividual", "Individual")]
|
|
230
231
|
}) }),
|
|
231
|
-
/* @__PURE__ */ F(
|
|
232
|
-
/* @__PURE__ */ F(
|
|
233
|
-
/* @__PURE__ */ F(
|
|
232
|
+
/* @__PURE__ */ F(v, { children: t.industry || n("psw.common.dash", "—") }),
|
|
233
|
+
/* @__PURE__ */ F(v, { children: /* @__PURE__ */ F(g, { status: t.status }) }),
|
|
234
|
+
/* @__PURE__ */ F(v, {
|
|
234
235
|
className: "whitespace-nowrap",
|
|
235
|
-
children:
|
|
236
|
+
children: C(t.createdAt)
|
|
236
237
|
}),
|
|
237
|
-
/* @__PURE__ */ F(
|
|
238
|
+
/* @__PURE__ */ F(v, { children: /* @__PURE__ */ F("div", {
|
|
238
239
|
onClick: (e) => e.stopPropagation(),
|
|
239
240
|
role: "presentation",
|
|
240
241
|
children: /* @__PURE__ */ F(E, {
|
|
@@ -242,15 +243,15 @@ var R = ["ORGANIZATION", "INDIVIDUAL"], z = [
|
|
|
242
243
|
entityId: t.id,
|
|
243
244
|
tags: t.tags ?? [],
|
|
244
245
|
onChange: async (e) => {
|
|
245
|
-
await
|
|
246
|
+
await ae.mutateAsync({
|
|
246
247
|
id: t.id,
|
|
247
248
|
input: { tags: e }
|
|
248
|
-
}),
|
|
249
|
+
}), $();
|
|
249
250
|
},
|
|
250
251
|
maxTags: 5
|
|
251
252
|
})
|
|
252
253
|
}) }),
|
|
253
|
-
/* @__PURE__ */ F(
|
|
254
|
+
/* @__PURE__ */ F(v, {
|
|
254
255
|
className: "text-right",
|
|
255
256
|
children: /* @__PURE__ */ I("div", {
|
|
256
257
|
className: "flex justify-end gap-1",
|
|
@@ -259,17 +260,18 @@ var R = ["ORGANIZATION", "INDIVIDUAL"], z = [
|
|
|
259
260
|
children: [/* @__PURE__ */ F(L, {
|
|
260
261
|
variant: "ghost",
|
|
261
262
|
size: "sm",
|
|
262
|
-
onClick: () =>
|
|
263
|
-
"aria-label": "Edit",
|
|
263
|
+
onClick: () => B(t),
|
|
264
|
+
"aria-label": n("psw.common.edit", "Edit"),
|
|
264
265
|
children: /* @__PURE__ */ F(j, { className: "h-4 w-4" })
|
|
265
266
|
}), t.status !== "ARCHIVED" && /* @__PURE__ */ F(G, {
|
|
266
267
|
id: t.id,
|
|
267
|
-
|
|
268
|
+
name: t.name,
|
|
269
|
+
onDone: (e) => J(e ? {
|
|
268
270
|
tone: "success",
|
|
269
|
-
text:
|
|
271
|
+
text: n("psw.clients.archived", "{{name}} archived.", { name: t.name })
|
|
270
272
|
} : {
|
|
271
273
|
tone: "danger",
|
|
272
|
-
text: "Could not archive client."
|
|
274
|
+
text: n("psw.clients.archiveFailed", "Could not archive client.")
|
|
273
275
|
})
|
|
274
276
|
})]
|
|
275
277
|
})
|
|
@@ -278,53 +280,53 @@ var R = ["ORGANIZATION", "INDIVIDUAL"], z = [
|
|
|
278
280
|
}, t.id)) })] })
|
|
279
281
|
}),
|
|
280
282
|
/* @__PURE__ */ F(ee, {
|
|
281
|
-
hasMore:
|
|
282
|
-
loading:
|
|
283
|
-
loadedCount:
|
|
284
|
-
totalCount:
|
|
285
|
-
onLoadMore: () =>
|
|
283
|
+
hasMore: X?.pageInfo?.hasMore ?? !1,
|
|
284
|
+
loading: Z,
|
|
285
|
+
loadedCount: oe.length,
|
|
286
|
+
totalCount: X?.totalCount ?? oe.length,
|
|
287
|
+
onLoadMore: () => Y((e) => ({
|
|
286
288
|
limit: U,
|
|
287
289
|
offset: e.offset + U
|
|
288
290
|
}))
|
|
289
291
|
})
|
|
290
292
|
]
|
|
291
293
|
}),
|
|
292
|
-
|
|
293
|
-
onClose: () =>
|
|
294
|
-
onSaved: (e) =>
|
|
294
|
+
H && /* @__PURE__ */ F(K, {
|
|
295
|
+
onClose: () => W(!1),
|
|
296
|
+
onSaved: (e) => J({
|
|
295
297
|
tone: "success",
|
|
296
|
-
text:
|
|
298
|
+
text: n("psw.clients.created", "{{name}} created.", { name: e })
|
|
297
299
|
})
|
|
298
300
|
}),
|
|
299
|
-
|
|
300
|
-
client:
|
|
301
|
-
onClose: () =>
|
|
302
|
-
onSaved: (e) =>
|
|
301
|
+
R && /* @__PURE__ */ F(K, {
|
|
302
|
+
client: R,
|
|
303
|
+
onClose: () => B(null),
|
|
304
|
+
onSaved: (e) => J({
|
|
303
305
|
tone: "success",
|
|
304
|
-
text:
|
|
306
|
+
text: n("psw.clients.updated", "{{name}} updated.", { name: e })
|
|
305
307
|
})
|
|
306
308
|
})
|
|
307
309
|
]
|
|
308
310
|
});
|
|
309
|
-
}, G = ({ id: t,
|
|
310
|
-
let
|
|
311
|
+
}, G = ({ id: t, name: n, onDone: r }) => {
|
|
312
|
+
let i = e(), a = o(), { emitFact: s } = w();
|
|
311
313
|
return /* @__PURE__ */ F(L, {
|
|
312
314
|
variant: "ghost",
|
|
313
315
|
size: "sm",
|
|
314
|
-
"aria-label": "Archive",
|
|
315
|
-
disabled:
|
|
316
|
+
"aria-label": a("psw.common.archive", "Archive"),
|
|
317
|
+
disabled: i.isPending,
|
|
316
318
|
onClick: () => {
|
|
317
|
-
window.confirm("Archive this client? Their engagements and matters remain.") &&
|
|
319
|
+
window.confirm(a("psw.clients.archiveConfirm", "Archive this client? Their engagements and matters remain.")) && i.mutate(t, {
|
|
318
320
|
onSuccess: (e) => {
|
|
319
|
-
|
|
321
|
+
s("psw.client.archived", { clientId: t }), r(!!e);
|
|
320
322
|
},
|
|
321
|
-
onError: () =>
|
|
323
|
+
onError: () => r(!1)
|
|
322
324
|
});
|
|
323
325
|
},
|
|
324
326
|
children: /* @__PURE__ */ F(k, { className: "h-4 w-4" })
|
|
325
327
|
});
|
|
326
328
|
}, K = ({ client: e, onClose: t, onSaved: i }) => {
|
|
327
|
-
let a = n(),
|
|
329
|
+
let a = o(), c = n(), l = r(), { emitFact: d } = w(), [m, h] = O(e ? {
|
|
328
330
|
name: e.name,
|
|
329
331
|
type: e.type,
|
|
330
332
|
status: e.status,
|
|
@@ -333,121 +335,121 @@ var R = ["ORGANIZATION", "INDIVIDUAL"], z = [
|
|
|
333
335
|
contactEmail: e.contactEmail ?? "",
|
|
334
336
|
contactPhone: e.contactPhone ?? "",
|
|
335
337
|
notes: e.notes ?? ""
|
|
336
|
-
} : H), [
|
|
338
|
+
} : H), [g, _] = O(null), v = (e) => (t) => h((n) => ({
|
|
337
339
|
...n,
|
|
338
340
|
[e]: t.target.value
|
|
339
|
-
})),
|
|
340
|
-
name:
|
|
341
|
-
type:
|
|
342
|
-
status:
|
|
343
|
-
industry:
|
|
344
|
-
contactName:
|
|
345
|
-
contactEmail:
|
|
346
|
-
contactPhone:
|
|
347
|
-
notes:
|
|
348
|
-
}), [
|
|
349
|
-
return /* @__PURE__ */ F(
|
|
341
|
+
})), x = c.isPending || l.isPending, C = D(() => ({
|
|
342
|
+
name: m.name.trim(),
|
|
343
|
+
type: m.type,
|
|
344
|
+
status: m.status,
|
|
345
|
+
industry: m.industry.trim() || null,
|
|
346
|
+
contactName: m.contactName.trim() || null,
|
|
347
|
+
contactEmail: m.contactEmail.trim() || null,
|
|
348
|
+
contactPhone: m.contactPhone.trim() || null,
|
|
349
|
+
notes: m.notes.trim() || null
|
|
350
|
+
}), [m]);
|
|
351
|
+
return /* @__PURE__ */ F(f, {
|
|
350
352
|
open: !0,
|
|
351
353
|
onClose: t,
|
|
352
|
-
title: e ? "Edit client" : "New client",
|
|
354
|
+
title: e ? a("psw.clients.edit", "Edit client") : a("psw.clients.newTitle", "New client"),
|
|
353
355
|
footer: /* @__PURE__ */ I(P, { children: [/* @__PURE__ */ F(L, {
|
|
354
356
|
variant: "outline",
|
|
355
357
|
onClick: t,
|
|
356
|
-
disabled:
|
|
357
|
-
children: "Cancel"
|
|
358
|
+
disabled: x,
|
|
359
|
+
children: a("psw.common.cancel", "Cancel")
|
|
358
360
|
}), /* @__PURE__ */ F(L, {
|
|
359
361
|
onClick: () => {
|
|
360
|
-
if (
|
|
361
|
-
let n = (e) =>
|
|
362
|
-
e ?
|
|
362
|
+
if (_(null), !C.name) return _(a("psw.clients.nameRequired", "Client name is required."));
|
|
363
|
+
let n = (e) => _(e instanceof Error ? e.message : a("psw.clients.saveFailed", "Save failed."));
|
|
364
|
+
e ? l.mutate({
|
|
363
365
|
id: e.id,
|
|
364
|
-
input:
|
|
366
|
+
input: C
|
|
365
367
|
}, {
|
|
366
368
|
onSuccess: () => {
|
|
367
|
-
|
|
369
|
+
d("psw.client.updated", { clientId: e.id }), i(C.name), t();
|
|
368
370
|
},
|
|
369
371
|
onError: n
|
|
370
|
-
}) :
|
|
372
|
+
}) : c.mutate(C, {
|
|
371
373
|
onSuccess: (e) => {
|
|
372
|
-
|
|
374
|
+
d("psw.client.created", { clientId: e.pswCreateClient.id }), i(C.name), t();
|
|
373
375
|
},
|
|
374
376
|
onError: n
|
|
375
377
|
});
|
|
376
378
|
},
|
|
377
|
-
disabled:
|
|
378
|
-
children:
|
|
379
|
+
disabled: x,
|
|
380
|
+
children: x ? a("psw.common.saving", "Saving…") : e ? a("psw.common.save", "Save changes") : a("psw.common.create", "Create client")
|
|
379
381
|
})] }),
|
|
380
382
|
children: /* @__PURE__ */ I("div", {
|
|
381
383
|
className: "space-y-3",
|
|
382
384
|
children: [
|
|
383
|
-
|
|
385
|
+
g && /* @__PURE__ */ F(s, {
|
|
384
386
|
tone: "danger",
|
|
385
|
-
children:
|
|
387
|
+
children: g
|
|
386
388
|
}),
|
|
387
|
-
/* @__PURE__ */ F(
|
|
388
|
-
label: "Name",
|
|
389
|
+
/* @__PURE__ */ F(u, {
|
|
390
|
+
label: a("psw.common.name", "Name"),
|
|
389
391
|
required: !0,
|
|
390
|
-
children: /* @__PURE__ */ F(
|
|
391
|
-
value:
|
|
392
|
-
onChange:
|
|
392
|
+
children: /* @__PURE__ */ F(b, {
|
|
393
|
+
value: m.name,
|
|
394
|
+
onChange: v("name"),
|
|
393
395
|
placeholder: "Acme Holdings Ltd."
|
|
394
396
|
})
|
|
395
397
|
}),
|
|
396
398
|
/* @__PURE__ */ I("div", {
|
|
397
399
|
className: "grid grid-cols-2 gap-3",
|
|
398
|
-
children: [/* @__PURE__ */ F(
|
|
399
|
-
label: "Type",
|
|
400
|
-
children: /* @__PURE__ */ F(
|
|
401
|
-
value:
|
|
402
|
-
onChange:
|
|
403
|
-
children:
|
|
400
|
+
children: [/* @__PURE__ */ F(u, {
|
|
401
|
+
label: a("psw.common.type", "Type"),
|
|
402
|
+
children: /* @__PURE__ */ F(p, {
|
|
403
|
+
value: m.type,
|
|
404
|
+
onChange: v("type"),
|
|
405
|
+
children: S(R)
|
|
404
406
|
})
|
|
405
|
-
}), /* @__PURE__ */ F(
|
|
406
|
-
label: "Status",
|
|
407
|
-
children: /* @__PURE__ */ F(
|
|
408
|
-
value:
|
|
409
|
-
onChange:
|
|
410
|
-
children:
|
|
407
|
+
}), /* @__PURE__ */ F(u, {
|
|
408
|
+
label: a("psw.common.status", "Status"),
|
|
409
|
+
children: /* @__PURE__ */ F(p, {
|
|
410
|
+
value: m.status,
|
|
411
|
+
onChange: v("status"),
|
|
412
|
+
children: S(z)
|
|
411
413
|
})
|
|
412
414
|
})]
|
|
413
415
|
}),
|
|
414
|
-
/* @__PURE__ */ F(
|
|
415
|
-
label: "Industry",
|
|
416
|
-
children: /* @__PURE__ */ F(
|
|
417
|
-
value:
|
|
418
|
-
onChange:
|
|
416
|
+
/* @__PURE__ */ F(u, {
|
|
417
|
+
label: a("psw.clients.industry", "Industry"),
|
|
418
|
+
children: /* @__PURE__ */ F(b, {
|
|
419
|
+
value: m.industry,
|
|
420
|
+
onChange: v("industry"),
|
|
419
421
|
placeholder: "Financial services"
|
|
420
422
|
})
|
|
421
423
|
}),
|
|
422
424
|
/* @__PURE__ */ I("div", {
|
|
423
425
|
className: "grid grid-cols-1 gap-3 sm:grid-cols-2",
|
|
424
|
-
children: [/* @__PURE__ */ F(
|
|
425
|
-
label: "Contact name",
|
|
426
|
-
children: /* @__PURE__ */ F(
|
|
427
|
-
value:
|
|
428
|
-
onChange:
|
|
426
|
+
children: [/* @__PURE__ */ F(u, {
|
|
427
|
+
label: a("psw.clients.contactName", "Contact name"),
|
|
428
|
+
children: /* @__PURE__ */ F(b, {
|
|
429
|
+
value: m.contactName,
|
|
430
|
+
onChange: v("contactName")
|
|
429
431
|
})
|
|
430
|
-
}), /* @__PURE__ */ F(
|
|
431
|
-
label: "Contact email",
|
|
432
|
-
children: /* @__PURE__ */ F(
|
|
432
|
+
}), /* @__PURE__ */ F(u, {
|
|
433
|
+
label: a("psw.clients.contactEmail", "Contact email"),
|
|
434
|
+
children: /* @__PURE__ */ F(b, {
|
|
433
435
|
type: "email",
|
|
434
|
-
value:
|
|
435
|
-
onChange:
|
|
436
|
+
value: m.contactEmail,
|
|
437
|
+
onChange: v("contactEmail")
|
|
436
438
|
})
|
|
437
439
|
})]
|
|
438
440
|
}),
|
|
439
|
-
/* @__PURE__ */ F(
|
|
440
|
-
label: "Contact phone",
|
|
441
|
-
children: /* @__PURE__ */ F(
|
|
442
|
-
value:
|
|
443
|
-
onChange:
|
|
441
|
+
/* @__PURE__ */ F(u, {
|
|
442
|
+
label: a("psw.clients.contactPhone", "Contact phone"),
|
|
443
|
+
children: /* @__PURE__ */ F(b, {
|
|
444
|
+
value: m.contactPhone,
|
|
445
|
+
onChange: v("contactPhone")
|
|
444
446
|
})
|
|
445
447
|
}),
|
|
446
|
-
/* @__PURE__ */ F(
|
|
447
|
-
label: "Notes",
|
|
448
|
-
children: /* @__PURE__ */ F(
|
|
449
|
-
value:
|
|
450
|
-
onChange:
|
|
448
|
+
/* @__PURE__ */ F(u, {
|
|
449
|
+
label: a("psw.clients.notes", "Notes"),
|
|
450
|
+
children: /* @__PURE__ */ F(y, {
|
|
451
|
+
value: m.notes,
|
|
452
|
+
onChange: v("notes")
|
|
451
453
|
})
|
|
452
454
|
})
|
|
453
455
|
]
|