@burdenoff/microfe-proserviceworld 2026.720.1 → 2026.728.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.
@@ -0,0 +1,603 @@
1
+ import { useClients as e, useCreateTrustAccount as t, useCreateTrustTransfer as n, useReconcileTrustAccount as r, useRecordTrustDeposit as i, useRecordTrustWithdrawal as a, useTrustAccounts as o, useTrustClientBalance as s, useTrustTransactions as c } from "../hooks/useProServiceWorldApi.js";
2
+ import { cn as l } from "../utils/cn.js";
3
+ import { Banner as u, Empty as d, ErrorState as f, Field as p, LoadingBlock as m, MetricCard as h, Modal as g, NativeSelect as _, PageHeader as v, SectionCard as y, StatusPill as b, TableWrap as x, Td as S, TextArea as C, TextInput as w, Th as T, fmtDate as E, fmtMoney as D } from "../components/ui.js";
4
+ import { useMemo as O, useState as k } from "react";
5
+ import { ArrowDownCircle as A, ArrowUpCircle as j, ClipboardCheck as M, Plus as N, Repeat as P, ShieldAlert as F, Wallet as I } from "lucide-react";
6
+ import { Fragment as L, jsx as R, jsxs as z } from "react/jsx-runtime";
7
+ import { Button as B } from "@burdenoff/fe-libs/ui";
8
+ //#region src/proserviceworld/pages/TrustPage.tsx
9
+ var V = () => {
10
+ let [t, n] = k(""), [r, i] = k(""), [a, p] = k(null), [g, C] = k(null), [w, V] = k(null), K = o(), q = e({ pagination: { limit: 100 } }), J = O(() => new Map((q.data?.items ?? []).map((e) => [e.id, e.name])), [q.data]), Y = t || K.data?.items[0]?.id || "", X = c({ trustAccountId: Y || void 0 }), Z = s(Y || void 0, r || void 0);
11
+ if (K.isLoading) return /* @__PURE__ */ R(m, {});
12
+ if (K.error) return /* @__PURE__ */ R(f, {
13
+ error: K.error,
14
+ onRetry: () => void K.refetch()
15
+ });
16
+ let Q = K.data?.items.find((e) => e.id === Y);
17
+ return /* @__PURE__ */ z("div", {
18
+ className: "space-y-6",
19
+ children: [
20
+ /* @__PURE__ */ R(v, {
21
+ title: "Trust Accounting",
22
+ subtitle: "IOLTA-style trust ledger — client funds held separately from the firm's operating money, reconciled against the bank statement.",
23
+ icon: /* @__PURE__ */ R(I, { className: "h-6 w-6" }),
24
+ actions: /* @__PURE__ */ z(B, {
25
+ onClick: () => p("account"),
26
+ children: [/* @__PURE__ */ R(N, { className: "mr-1.5 h-4 w-4" }), "New trust account"]
27
+ })
28
+ }),
29
+ g && /* @__PURE__ */ R(u, {
30
+ tone: g.tone,
31
+ onClose: () => C(null),
32
+ children: g.text
33
+ }),
34
+ !K.data || K.data.items.length === 0 ? /* @__PURE__ */ R(d, {
35
+ title: "No trust accounts yet",
36
+ description: "Open a trust (IOLTA) account to start holding client funds separately from operating money.",
37
+ icon: /* @__PURE__ */ R(I, { className: "h-8 w-8" }),
38
+ action: /* @__PURE__ */ z(B, {
39
+ onClick: () => p("account"),
40
+ children: [/* @__PURE__ */ R(N, { className: "mr-1.5 h-4 w-4" }), "New trust account"]
41
+ })
42
+ }) : /* @__PURE__ */ z(L, { children: [
43
+ /* @__PURE__ */ z("div", {
44
+ className: "flex flex-wrap items-center justify-between gap-3",
45
+ children: [/* @__PURE__ */ z("div", {
46
+ className: "flex flex-wrap items-center gap-2",
47
+ children: [
48
+ /* @__PURE__ */ R(_, {
49
+ value: Y,
50
+ onChange: (e) => n(e.target.value),
51
+ className: "sm:w-64",
52
+ children: K.data.items.map((e) => /* @__PURE__ */ z("option", {
53
+ value: e.id,
54
+ children: [
55
+ e.name,
56
+ " ",
57
+ e.status === "CLOSED" ? "(closed)" : ""
58
+ ]
59
+ }, e.id))
60
+ }),
61
+ Q && /* @__PURE__ */ R(b, { status: Q.status }),
62
+ /* @__PURE__ */ z(_, {
63
+ value: r,
64
+ onChange: (e) => i(e.target.value),
65
+ className: "sm:w-56",
66
+ children: [/* @__PURE__ */ R("option", {
67
+ value: "",
68
+ children: "All clients"
69
+ }), q.data?.items.map((e) => /* @__PURE__ */ R("option", {
70
+ value: e.id,
71
+ children: e.name
72
+ }, e.id))]
73
+ })
74
+ ]
75
+ }), /* @__PURE__ */ z("div", {
76
+ className: "flex flex-wrap gap-2",
77
+ children: [
78
+ /* @__PURE__ */ z(B, {
79
+ variant: "outline",
80
+ size: "sm",
81
+ onClick: () => p("deposit"),
82
+ children: [/* @__PURE__ */ R(A, { className: "mr-1.5 h-4 w-4" }), "Deposit"]
83
+ }),
84
+ /* @__PURE__ */ z(B, {
85
+ variant: "outline",
86
+ size: "sm",
87
+ onClick: () => p("withdrawal"),
88
+ children: [/* @__PURE__ */ R(j, { className: "mr-1.5 h-4 w-4" }), "Withdrawal"]
89
+ }),
90
+ /* @__PURE__ */ z(B, {
91
+ variant: "outline",
92
+ size: "sm",
93
+ onClick: () => p("transfer"),
94
+ children: [/* @__PURE__ */ R(P, { className: "mr-1.5 h-4 w-4" }), "Transfer to operating"]
95
+ }),
96
+ /* @__PURE__ */ z(B, {
97
+ variant: "outline",
98
+ size: "sm",
99
+ onClick: () => p("reconcile"),
100
+ children: [/* @__PURE__ */ R(M, { className: "mr-1.5 h-4 w-4" }), "Reconcile"]
101
+ })
102
+ ]
103
+ })]
104
+ }),
105
+ /* @__PURE__ */ z("div", {
106
+ className: "grid grid-cols-1 gap-3 sm:grid-cols-3",
107
+ children: [
108
+ /* @__PURE__ */ R(h, {
109
+ label: "Trust accounts",
110
+ value: K.data.totalCount,
111
+ icon: /* @__PURE__ */ R(I, { className: "h-4 w-4" })
112
+ }),
113
+ /* @__PURE__ */ R(h, {
114
+ label: "Currency",
115
+ value: Q?.currency ?? "—",
116
+ icon: /* @__PURE__ */ R(I, { className: "h-4 w-4" })
117
+ }),
118
+ r ? /* @__PURE__ */ R(h, {
119
+ label: `Balance — ${J.get(r) ?? "client"}`,
120
+ value: Z.isLoading ? "…" : D(Z.data?.balance ?? 0, Q?.currency),
121
+ icon: /* @__PURE__ */ R(I, { className: "h-4 w-4" }),
122
+ tone: (Z.data?.balance ?? 0) < 0 ? "danger" : "success"
123
+ }) : /* @__PURE__ */ R(h, {
124
+ label: "Ledger entries",
125
+ value: X.data?.totalCount ?? 0,
126
+ icon: /* @__PURE__ */ R(M, { className: "h-4 w-4" })
127
+ })
128
+ ]
129
+ }),
130
+ w && /* @__PURE__ */ z(y, {
131
+ title: "Reconciliation result",
132
+ children: [
133
+ /* @__PURE__ */ z("div", {
134
+ className: "grid grid-cols-1 gap-3 sm:grid-cols-4",
135
+ children: [
136
+ /* @__PURE__ */ R(h, {
137
+ label: "Book balance",
138
+ value: D(w.bookBalance, Q?.currency),
139
+ icon: /* @__PURE__ */ R(I, { className: "h-4 w-4" })
140
+ }),
141
+ /* @__PURE__ */ R(h, {
142
+ label: "Statement balance",
143
+ value: w.statementBalance == null ? "—" : D(w.statementBalance, Q?.currency),
144
+ icon: /* @__PURE__ */ R(M, { className: "h-4 w-4" })
145
+ }),
146
+ /* @__PURE__ */ R(h, {
147
+ label: "Difference",
148
+ value: w.difference == null ? "—" : D(w.difference, Q?.currency),
149
+ tone: w.inBalance ? "success" : "danger",
150
+ icon: w.inBalance ? /* @__PURE__ */ R(M, { className: "h-4 w-4" }) : /* @__PURE__ */ R(F, { className: "h-4 w-4" })
151
+ }),
152
+ /* @__PURE__ */ R(h, {
153
+ label: "Reconciled entries",
154
+ value: w.reconciledCount,
155
+ icon: /* @__PURE__ */ R(M, { className: "h-4 w-4" })
156
+ })
157
+ ]
158
+ }),
159
+ !w.inBalance && /* @__PURE__ */ R("div", {
160
+ className: "mt-3",
161
+ children: /* @__PURE__ */ R(u, {
162
+ tone: "danger",
163
+ children: "Out of balance — the bank statement does not match the book balance. Investigate before closing this reconciliation period."
164
+ })
165
+ }),
166
+ w.clientBalances.length > 0 && /* @__PURE__ */ R("div", {
167
+ className: "mt-3",
168
+ children: /* @__PURE__ */ z(x, { children: [/* @__PURE__ */ R("thead", { children: /* @__PURE__ */ z("tr", { children: [
169
+ /* @__PURE__ */ R(T, { children: "Client" }),
170
+ /* @__PURE__ */ R(T, { children: "Matter" }),
171
+ /* @__PURE__ */ R(T, {
172
+ className: "text-right",
173
+ children: "Balance"
174
+ })
175
+ ] }) }), /* @__PURE__ */ R("tbody", { children: w.clientBalances.map((e, t) => /* @__PURE__ */ z("tr", { children: [
176
+ /* @__PURE__ */ R(S, { children: J.get(e.clientId) ?? e.clientId }),
177
+ /* @__PURE__ */ R(S, { children: e.matterId ?? "—" }),
178
+ /* @__PURE__ */ R(S, {
179
+ className: "text-right font-medium",
180
+ children: D(e.balance, Q?.currency)
181
+ })
182
+ ] }, `${e.clientId}-${e.matterId ?? "none"}-${t}`)) })] })
183
+ })
184
+ ]
185
+ }),
186
+ X.isLoading ? /* @__PURE__ */ R(m, {}) : X.error ? /* @__PURE__ */ R(f, {
187
+ error: X.error,
188
+ onRetry: () => void X.refetch()
189
+ }) : !X.data || X.data.items.length === 0 ? /* @__PURE__ */ R(d, {
190
+ title: "No trust ledger entries yet",
191
+ icon: /* @__PURE__ */ R(I, { className: "h-8 w-8" })
192
+ }) : /* @__PURE__ */ R(y, {
193
+ title: "Trust ledger",
194
+ children: /* @__PURE__ */ z(x, { children: [/* @__PURE__ */ R("thead", { children: /* @__PURE__ */ z("tr", { children: [
195
+ /* @__PURE__ */ R(T, { children: "Date" }),
196
+ /* @__PURE__ */ R(T, { children: "Client" }),
197
+ /* @__PURE__ */ R(T, { children: "Type" }),
198
+ /* @__PURE__ */ R(T, {
199
+ className: "text-right",
200
+ children: "Amount"
201
+ }),
202
+ /* @__PURE__ */ R(T, {
203
+ className: "text-right",
204
+ children: "Balance after"
205
+ }),
206
+ /* @__PURE__ */ R(T, { children: "Reference" }),
207
+ /* @__PURE__ */ R(T, { children: "Reconciled" })
208
+ ] }) }), /* @__PURE__ */ R("tbody", { children: X.data.items.map((e) => /* @__PURE__ */ z("tr", {
209
+ className: "transition-colors hover:bg-bg-sunken/60",
210
+ children: [
211
+ /* @__PURE__ */ R(S, {
212
+ className: "whitespace-nowrap",
213
+ children: E(e.createdAt)
214
+ }),
215
+ /* @__PURE__ */ R(S, { children: J.get(e.clientId) ?? e.clientId }),
216
+ /* @__PURE__ */ R(S, { children: /* @__PURE__ */ R(b, { status: e.type }) }),
217
+ /* @__PURE__ */ R(S, {
218
+ className: l("text-right font-medium whitespace-nowrap", e.amount < 0 ? "text-status-error-text" : "text-status-success-text"),
219
+ children: D(e.amount, Q?.currency)
220
+ }),
221
+ /* @__PURE__ */ R(S, {
222
+ className: "text-right whitespace-nowrap",
223
+ children: D(e.balanceAfter, Q?.currency)
224
+ }),
225
+ /* @__PURE__ */ R(S, { children: e.reference ?? "—" }),
226
+ /* @__PURE__ */ R(S, { children: e.reconciled ? /* @__PURE__ */ R(b, { status: "RECONCILED" }) : "—" })
227
+ ]
228
+ }, e.id)) })] })
229
+ })
230
+ ] }),
231
+ a === "account" && /* @__PURE__ */ R(H, {
232
+ onClose: () => p(null),
233
+ onSaved: (e) => C({
234
+ tone: "success",
235
+ text: `${e} created.`
236
+ })
237
+ }),
238
+ a === "deposit" && Y && /* @__PURE__ */ R(U, {
239
+ kind: "deposit",
240
+ trustAccountId: Y,
241
+ currency: Q?.currency,
242
+ onClose: () => p(null),
243
+ onSaved: () => C({
244
+ tone: "success",
245
+ text: "Deposit recorded."
246
+ })
247
+ }),
248
+ a === "withdrawal" && Y && /* @__PURE__ */ R(U, {
249
+ kind: "withdrawal",
250
+ trustAccountId: Y,
251
+ currency: Q?.currency,
252
+ onClose: () => p(null),
253
+ onSaved: () => C({
254
+ tone: "success",
255
+ text: "Withdrawal recorded."
256
+ })
257
+ }),
258
+ a === "transfer" && Y && /* @__PURE__ */ R(W, {
259
+ trustAccountId: Y,
260
+ currency: Q?.currency,
261
+ onClose: () => p(null),
262
+ onSaved: () => C({
263
+ tone: "success",
264
+ text: "Transfer to operating recorded."
265
+ })
266
+ }),
267
+ a === "reconcile" && Y && /* @__PURE__ */ R(G, {
268
+ trustAccountId: Y,
269
+ onClose: () => p(null),
270
+ onSaved: (e) => {
271
+ V(e), C({
272
+ tone: e.inBalance ? "success" : "danger",
273
+ text: e.inBalance ? `Reconciled — ${e.reconciledCount} entries, in balance.` : `Reconciled with a difference of ${D(e.difference ?? 0, Q?.currency)} — review before closing the period.`
274
+ });
275
+ }
276
+ })
277
+ ]
278
+ });
279
+ }, H = ({ onClose: e, onSaved: n }) => {
280
+ let r = t(), [i, a] = k({
281
+ name: "",
282
+ institutionName: "",
283
+ accountNumberLast4: "",
284
+ currency: "USD"
285
+ }), [o, s] = k(null), c = (e) => (t) => a((n) => ({
286
+ ...n,
287
+ [e]: t.target.value
288
+ }));
289
+ return /* @__PURE__ */ R(g, {
290
+ open: !0,
291
+ onClose: e,
292
+ title: "New trust account",
293
+ footer: /* @__PURE__ */ z(L, { children: [/* @__PURE__ */ R(B, {
294
+ variant: "outline",
295
+ onClick: e,
296
+ disabled: r.isPending,
297
+ children: "Cancel"
298
+ }), /* @__PURE__ */ R(B, {
299
+ onClick: () => {
300
+ if (s(null), !i.name.trim()) return s("Account name is required.");
301
+ r.mutate({
302
+ name: i.name.trim(),
303
+ institutionName: i.institutionName.trim() || null,
304
+ accountNumberLast4: i.accountNumberLast4.trim() || null,
305
+ currency: i.currency || "USD"
306
+ }, {
307
+ onSuccess: () => {
308
+ n(i.name.trim()), e();
309
+ },
310
+ onError: (e) => s(e instanceof Error ? e.message : "Failed.")
311
+ });
312
+ },
313
+ disabled: r.isPending,
314
+ children: r.isPending ? "Creating…" : "Create account"
315
+ })] }),
316
+ children: /* @__PURE__ */ z("div", {
317
+ className: "space-y-3",
318
+ children: [
319
+ o && /* @__PURE__ */ R(u, {
320
+ tone: "danger",
321
+ children: o
322
+ }),
323
+ /* @__PURE__ */ R(p, {
324
+ label: "Name",
325
+ required: !0,
326
+ children: /* @__PURE__ */ R(w, {
327
+ value: i.name,
328
+ onChange: c("name"),
329
+ placeholder: "IOLTA Main"
330
+ })
331
+ }),
332
+ /* @__PURE__ */ z("div", {
333
+ className: "grid grid-cols-2 gap-3",
334
+ children: [/* @__PURE__ */ R(p, {
335
+ label: "Institution (optional)",
336
+ children: /* @__PURE__ */ R(w, {
337
+ value: i.institutionName,
338
+ onChange: c("institutionName")
339
+ })
340
+ }), /* @__PURE__ */ R(p, {
341
+ label: "Currency",
342
+ children: /* @__PURE__ */ R(w, {
343
+ value: i.currency,
344
+ onChange: c("currency"),
345
+ maxLength: 3
346
+ })
347
+ })]
348
+ }),
349
+ /* @__PURE__ */ R(p, {
350
+ label: "Last 4 of account number (optional)",
351
+ children: /* @__PURE__ */ R(w, {
352
+ value: i.accountNumberLast4,
353
+ onChange: c("accountNumberLast4"),
354
+ maxLength: 4
355
+ })
356
+ })
357
+ ]
358
+ })
359
+ });
360
+ }, U = ({ kind: t, trustAccountId: n, currency: r, onClose: o, onSaved: s }) => {
361
+ let c = i(), l = a(), d = t === "deposit" ? c : l, f = e({ pagination: { limit: 100 } }), [m, h] = k({
362
+ clientId: "",
363
+ matterId: "",
364
+ amount: "",
365
+ reference: "",
366
+ description: ""
367
+ }), [v, y] = k(null), b = (e) => (t) => h((n) => ({
368
+ ...n,
369
+ [e]: t.target.value
370
+ }));
371
+ return /* @__PURE__ */ R(g, {
372
+ open: !0,
373
+ onClose: o,
374
+ title: t === "deposit" ? "Record trust deposit" : "Record trust withdrawal",
375
+ footer: /* @__PURE__ */ z(L, { children: [/* @__PURE__ */ R(B, {
376
+ variant: "outline",
377
+ onClick: o,
378
+ disabled: d.isPending,
379
+ children: "Cancel"
380
+ }), /* @__PURE__ */ R(B, {
381
+ onClick: () => {
382
+ if (y(null), !m.clientId) return y("Select a client.");
383
+ let e = Number(m.amount);
384
+ if (!(e > 0)) return y("Amount must be greater than zero.");
385
+ d.mutate({
386
+ trustAccountId: n,
387
+ clientId: m.clientId,
388
+ matterId: m.matterId || null,
389
+ amount: e,
390
+ reference: m.reference.trim() || null,
391
+ description: m.description.trim() || null
392
+ }, {
393
+ onSuccess: () => {
394
+ s(), o();
395
+ },
396
+ onError: (e) => y(e instanceof Error ? e.message : "Failed.")
397
+ });
398
+ },
399
+ disabled: d.isPending,
400
+ children: d.isPending ? "Saving…" : t === "deposit" ? "Record deposit" : "Record withdrawal"
401
+ })] }),
402
+ children: /* @__PURE__ */ z("div", {
403
+ className: "space-y-3",
404
+ children: [
405
+ v && /* @__PURE__ */ R(u, {
406
+ tone: "danger",
407
+ children: v
408
+ }),
409
+ t === "withdrawal" && /* @__PURE__ */ R(u, {
410
+ tone: "info",
411
+ children: "A withdrawal that would take this client’s trust balance below zero is rejected — trust funds are never allowed to go negative."
412
+ }),
413
+ /* @__PURE__ */ R(p, {
414
+ label: "Client",
415
+ required: !0,
416
+ children: /* @__PURE__ */ z(_, {
417
+ value: m.clientId,
418
+ onChange: b("clientId"),
419
+ children: [/* @__PURE__ */ R("option", {
420
+ value: "",
421
+ children: "Select…"
422
+ }), f.data?.items.map((e) => /* @__PURE__ */ R("option", {
423
+ value: e.id,
424
+ children: e.name
425
+ }, e.id))]
426
+ })
427
+ }),
428
+ /* @__PURE__ */ z("div", {
429
+ className: "grid grid-cols-2 gap-3",
430
+ children: [/* @__PURE__ */ R(p, {
431
+ label: "Amount",
432
+ required: !0,
433
+ children: /* @__PURE__ */ R(w, {
434
+ type: "number",
435
+ min: "0.01",
436
+ step: "0.01",
437
+ value: m.amount,
438
+ onChange: b("amount")
439
+ })
440
+ }), /* @__PURE__ */ R(p, {
441
+ label: "Reference (optional)",
442
+ children: /* @__PURE__ */ R(w, {
443
+ value: m.reference,
444
+ onChange: b("reference"),
445
+ placeholder: "CHK-1042"
446
+ })
447
+ })]
448
+ }),
449
+ m.amount && /* @__PURE__ */ R("div", {
450
+ className: "rounded-lg bg-bg-sunken px-3 py-2 text-sm text-text-secondary",
451
+ children: D(Number(m.amount) || 0, r)
452
+ }),
453
+ /* @__PURE__ */ R(p, {
454
+ label: "Description (optional)",
455
+ children: /* @__PURE__ */ R(C, {
456
+ value: m.description,
457
+ onChange: b("description")
458
+ })
459
+ })
460
+ ]
461
+ })
462
+ });
463
+ }, W = ({ trustAccountId: t, onClose: r, onSaved: i }) => {
464
+ let a = n(), o = e({ pagination: { limit: 100 } }), [s, c] = k({
465
+ clientId: "",
466
+ amount: "",
467
+ reason: ""
468
+ }), [l, d] = k(null), f = (e) => (t) => c((n) => ({
469
+ ...n,
470
+ [e]: t.target.value
471
+ }));
472
+ return /* @__PURE__ */ R(g, {
473
+ open: !0,
474
+ onClose: r,
475
+ title: "Transfer to operating",
476
+ footer: /* @__PURE__ */ z(L, { children: [/* @__PURE__ */ R(B, {
477
+ variant: "outline",
478
+ onClick: r,
479
+ disabled: a.isPending,
480
+ children: "Cancel"
481
+ }), /* @__PURE__ */ R(B, {
482
+ onClick: () => {
483
+ if (d(null), !s.clientId) return d("Select a client.");
484
+ let e = Number(s.amount);
485
+ if (!(e > 0)) return d("Amount must be greater than zero.");
486
+ a.mutate({
487
+ trustAccountId: t,
488
+ clientId: s.clientId,
489
+ amount: e,
490
+ reason: s.reason.trim() || null
491
+ }, {
492
+ onSuccess: () => {
493
+ i(), r();
494
+ },
495
+ onError: (e) => d(e instanceof Error ? e.message : "Failed.")
496
+ });
497
+ },
498
+ disabled: a.isPending,
499
+ children: a.isPending ? "Transferring…" : "Transfer"
500
+ })] }),
501
+ children: /* @__PURE__ */ z("div", {
502
+ className: "space-y-3",
503
+ children: [
504
+ l && /* @__PURE__ */ R(u, {
505
+ tone: "danger",
506
+ children: l
507
+ }),
508
+ /* @__PURE__ */ R(u, {
509
+ tone: "info",
510
+ children: "Moves earned fees from this client’s trust ledger to the firm’s operating account. Rejected if it would take the client’s trust balance below zero."
511
+ }),
512
+ /* @__PURE__ */ R(p, {
513
+ label: "Client",
514
+ required: !0,
515
+ children: /* @__PURE__ */ z(_, {
516
+ value: s.clientId,
517
+ onChange: f("clientId"),
518
+ children: [/* @__PURE__ */ R("option", {
519
+ value: "",
520
+ children: "Select…"
521
+ }), o.data?.items.map((e) => /* @__PURE__ */ R("option", {
522
+ value: e.id,
523
+ children: e.name
524
+ }, e.id))]
525
+ })
526
+ }),
527
+ /* @__PURE__ */ R(p, {
528
+ label: "Amount",
529
+ required: !0,
530
+ children: /* @__PURE__ */ R(w, {
531
+ type: "number",
532
+ min: "0.01",
533
+ step: "0.01",
534
+ value: s.amount,
535
+ onChange: f("amount")
536
+ })
537
+ }),
538
+ /* @__PURE__ */ R(p, {
539
+ label: "Reason (optional)",
540
+ children: /* @__PURE__ */ R(C, {
541
+ value: s.reason,
542
+ onChange: f("reason"),
543
+ placeholder: "Invoice INV-2026-0001 paid from trust"
544
+ })
545
+ })
546
+ ]
547
+ })
548
+ });
549
+ }, G = ({ trustAccountId: e, onClose: t, onSaved: n }) => {
550
+ let i = r(), [a, o] = k(""), [s, c] = k(null);
551
+ return /* @__PURE__ */ R(g, {
552
+ open: !0,
553
+ onClose: t,
554
+ title: "Reconcile trust account",
555
+ footer: /* @__PURE__ */ z(L, { children: [/* @__PURE__ */ R(B, {
556
+ variant: "outline",
557
+ onClick: t,
558
+ disabled: i.isPending,
559
+ children: "Cancel"
560
+ }), /* @__PURE__ */ R(B, {
561
+ onClick: () => {
562
+ c(null), i.mutate({
563
+ trustAccountId: e,
564
+ statementBalance: a.trim() ? Number(a) : null
565
+ }, {
566
+ onSuccess: (e) => {
567
+ n(e), t();
568
+ },
569
+ onError: (e) => c(e instanceof Error ? e.message : "Failed.")
570
+ });
571
+ },
572
+ disabled: i.isPending,
573
+ children: i.isPending ? "Reconciling…" : "Reconcile"
574
+ })] }),
575
+ children: /* @__PURE__ */ z("div", {
576
+ className: "space-y-3",
577
+ children: [
578
+ s && /* @__PURE__ */ R(u, {
579
+ tone: "danger",
580
+ children: s
581
+ }),
582
+ /* @__PURE__ */ R(u, {
583
+ tone: "info",
584
+ children: "Computes the book balance and every client’s subsidiary-ledger balance as of now, compares it against the bank statement balance below, and marks every not-yet-reconciled entry as reconciled."
585
+ }),
586
+ /* @__PURE__ */ R(p, {
587
+ label: "Bank statement balance (optional)",
588
+ children: /* @__PURE__ */ R(w, {
589
+ type: "number",
590
+ step: "0.01",
591
+ value: a,
592
+ onChange: (e) => o(e.target.value),
593
+ placeholder: "Leave blank to skip the bank-balance check"
594
+ })
595
+ })
596
+ ]
597
+ })
598
+ });
599
+ };
600
+ //#endregion
601
+ export { V as TrustPage };
602
+
603
+ //# sourceMappingURL=TrustPage.js.map