@burdenoff/microfe-timecampus 2026.1031.9 → 2026.1031.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/generated/wspace-operations.d.ts +45 -0
- package/dist/generated/wspace-operations.d.ts.map +1 -1
- package/dist/generated/wspace-operations.js +710 -672
- package/dist/generated/wspace-operations.js.map +1 -1
- package/dist/generated/wspace-types.d.ts +731 -0
- package/dist/generated/wspace-types.d.ts.map +1 -1
- package/dist/generated/wspace-types.js +14 -12
- package/dist/generated/wspace-types.js.map +1 -1
- package/dist/index.js +7 -7
- package/dist/timecampus/analytics/index.d.ts +3 -0
- package/dist/timecampus/analytics/index.d.ts.map +1 -0
- package/dist/timecampus/analytics/index.js +3 -0
- package/dist/timecampus/analytics/timecampusAnalytics.d.ts +83 -0
- package/dist/timecampus/analytics/timecampusAnalytics.d.ts.map +1 -0
- package/dist/timecampus/analytics/timecampusAnalytics.js +175 -0
- package/dist/timecampus/analytics/timecampusAnalytics.js.map +1 -0
- package/dist/timecampus/analytics/useTimeCampusAnalytics.d.ts +16 -0
- package/dist/timecampus/analytics/useTimeCampusAnalytics.d.ts.map +1 -0
- package/dist/timecampus/analytics/useTimeCampusAnalytics.js +48 -0
- package/dist/timecampus/analytics/useTimeCampusAnalytics.js.map +1 -0
- package/dist/timecampus/components/ActivationCard.d.ts +3 -0
- package/dist/timecampus/components/ActivationCard.d.ts.map +1 -0
- package/dist/timecampus/components/ActivationCard.js +156 -0
- package/dist/timecampus/components/ActivationCard.js.map +1 -0
- package/dist/timecampus/index.js +7 -7
- package/dist/timecampus/pages/HomePage.d.ts.map +1 -1
- package/dist/timecampus/pages/HomePage.js +142 -139
- package/dist/timecampus/pages/HomePage.js.map +1 -1
- package/dist/timecampus/pages/client-portal/ClientPortalPage.d.ts.map +1 -1
- package/dist/timecampus/pages/client-portal/ClientPortalPage.js +244 -228
- package/dist/timecampus/pages/client-portal/ClientPortalPage.js.map +1 -1
- package/dist/timecampus/pages/dashboard/AnalyticsPage.d.ts.map +1 -1
- package/dist/timecampus/pages/dashboard/AnalyticsPage.js +117 -112
- package/dist/timecampus/pages/dashboard/AnalyticsPage.js.map +1 -1
- package/dist/timecampus/pages/dashboard/ReportsPage.d.ts.map +1 -1
- package/dist/timecampus/pages/dashboard/ReportsPage.js +105 -102
- package/dist/timecampus/pages/dashboard/ReportsPage.js.map +1 -1
- package/dist/timecampus/pages/expense-tracking/ExpenseTrackingPage.d.ts.map +1 -1
- package/dist/timecampus/pages/expense-tracking/ExpenseTrackingPage.js +209 -192
- package/dist/timecampus/pages/expense-tracking/ExpenseTrackingPage.js.map +1 -1
- package/dist/timecampus/pages/focus-score/FocusScorePage.d.ts.map +1 -1
- package/dist/timecampus/pages/focus-score/FocusScorePage.js +71 -68
- package/dist/timecampus/pages/focus-score/FocusScorePage.js.map +1 -1
- package/dist/timecampus/pages/invoicing/InvoicingPage.d.ts.map +1 -1
- package/dist/timecampus/pages/invoicing/InvoicingPage.js +157 -150
- package/dist/timecampus/pages/invoicing/InvoicingPage.js.map +1 -1
- package/dist/timecampus/pages/meetings/MeetingCreatePage.d.ts.map +1 -1
- package/dist/timecampus/pages/meetings/MeetingCreatePage.js +58 -52
- package/dist/timecampus/pages/meetings/MeetingCreatePage.js.map +1 -1
- package/dist/timecampus/pages/meetings/MeetingsPage.d.ts.map +1 -1
- package/dist/timecampus/pages/meetings/MeetingsPage.js +51 -45
- package/dist/timecampus/pages/meetings/MeetingsPage.js.map +1 -1
- package/dist/timecampus/pages/pomodoro/PomodoroPage.d.ts.map +1 -1
- package/dist/timecampus/pages/pomodoro/PomodoroPage.js +55 -51
- package/dist/timecampus/pages/pomodoro/PomodoroPage.js.map +1 -1
- package/dist/timecampus/pages/projects/ProjectCreatePage.d.ts.map +1 -1
- package/dist/timecampus/pages/projects/ProjectCreatePage.js +59 -49
- package/dist/timecampus/pages/projects/ProjectCreatePage.js.map +1 -1
- package/dist/timecampus/pages/projects/ProjectsPage.d.ts.map +1 -1
- package/dist/timecampus/pages/projects/ProjectsPage.js +165 -155
- package/dist/timecampus/pages/projects/ProjectsPage.js.map +1 -1
- package/dist/timecampus/pages/time/TimeEntriesPage.d.ts.map +1 -1
- package/dist/timecampus/pages/time/TimeEntriesPage.js +194 -186
- package/dist/timecampus/pages/time/TimeEntriesPage.js.map +1 -1
- package/dist/timecampus/pages/time/TimeTrackingPage.d.ts.map +1 -1
- package/dist/timecampus/pages/time/TimeTrackingPage.js +139 -126
- package/dist/timecampus/pages/time/TimeTrackingPage.js.map +1 -1
- package/dist/timecampus/pages/time/TimerPage.d.ts.map +1 -1
- package/dist/timecampus/pages/time/TimerPage.js +48 -35
- package/dist/timecampus/pages/time/TimerPage.js.map +1 -1
- package/dist/timecampus/pages/time-approval/TimeApprovalPage.d.ts.map +1 -1
- package/dist/timecampus/pages/time-approval/TimeApprovalPage.js +60 -50
- package/dist/timecampus/pages/time-approval/TimeApprovalPage.js.map +1 -1
- package/dist/timecampus/pages/timeline/TimelinePage.d.ts.map +1 -1
- package/dist/timecampus/pages/timeline/TimelinePage.js +223 -219
- package/dist/timecampus/pages/timeline/TimelinePage.js.map +1 -1
- package/dist/timecampus/pages/work-patterns/WorkPatternsPage.d.ts.map +1 -1
- package/dist/timecampus/pages/work-patterns/WorkPatternsPage.js +1 -5
- package/dist/timecampus/pages/work-patterns/WorkPatternsPage.js.map +1 -1
- package/package.json +1 -1
|
@@ -3,23 +3,25 @@ import { formatCurrency as t, formatDate as n } from "../../utils/helpers.js";
|
|
|
3
3
|
import { StatCard as r } from "../../components/StatCard.js";
|
|
4
4
|
import { LoadingSkeleton as i } from "../../components/LoadingSkeleton.js";
|
|
5
5
|
import { EmptyState as a } from "../../components/EmptyState.js";
|
|
6
|
-
import { useDeleteInvoiceDraftMutation as o, useGenerateInvoiceDraftMutation as ee, useGetInvoiceStatsQuery as
|
|
7
|
-
import {
|
|
8
|
-
import
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
6
|
+
import { useDeleteInvoiceDraftMutation as o, useGenerateInvoiceDraftMutation as ee, useGetInvoiceStatsQuery as te, useListInvoicesQuery as ne, useUpdateInvoiceStatusMutation as re } from "../../../generated/wspace-operations.js";
|
|
7
|
+
import { useTimeCampusAnalytics as ie } from "../../analytics/useTimeCampusAnalytics.js";
|
|
8
|
+
import "../../analytics/index.js";
|
|
9
|
+
import { PageLayout as s } from "../../components/PageLayout.js";
|
|
10
|
+
import { StatusBadge as ae } from "../../components/StatusBadge.js";
|
|
11
|
+
import { Modal as c } from "../../components/Modal.js";
|
|
12
|
+
import { ToastContainer as oe, useToast as l } from "../../components/Toast.js";
|
|
11
13
|
import { TimeCampusInvoiceStatus as u } from "../../../generated/wspace-types.js";
|
|
12
14
|
import { useState as d } from "react";
|
|
13
|
-
import { AlertTriangle as
|
|
15
|
+
import { AlertTriangle as se, CheckCircle2 as ce, DollarSign as le, Download as f, Eye as ue, FileText as p, Plus as de, Send as fe, Trash2 as pe } from "lucide-react";
|
|
14
16
|
import { gql as m } from "@apollo/client";
|
|
15
17
|
import { useApolloClient as h } from "@apollo/client/react";
|
|
16
18
|
import { Fragment as g, jsx as _, jsxs as v } from "react/jsx-runtime";
|
|
17
19
|
//#region src/timecampus/pages/invoicing/InvoicingPage.tsx
|
|
18
|
-
var y = 25, b = "mt-1 w-full rounded-md border border-border-subtle bg-bg-surface px-3 py-2 text-sm text-text-primary placeholder:text-text-secondary",
|
|
20
|
+
var y = 25, b = "mt-1 w-full rounded-md border border-border-subtle bg-bg-surface px-3 py-2 text-sm text-text-primary placeholder:text-text-secondary", me = m`
|
|
19
21
|
query TimeCampusInvoicing_GetInvoiceHtml($id: ID!, $workspaceId: ID!) {
|
|
20
22
|
timeCampusInvoiceHtml(id: $id, workspaceId: $workspaceId)
|
|
21
23
|
}
|
|
22
|
-
`,
|
|
24
|
+
`, he = m`
|
|
23
25
|
query TimeCampusInvoicing_GetInvoicePdf($id: ID!, $workspaceId: ID!) {
|
|
24
26
|
timeCampusInvoicePdf(id: $id, workspaceId: $workspaceId)
|
|
25
27
|
}
|
|
@@ -43,14 +45,14 @@ var C = {
|
|
|
43
45
|
notes: "",
|
|
44
46
|
projectIds: ""
|
|
45
47
|
};
|
|
46
|
-
function
|
|
48
|
+
function ge(e, t) {
|
|
47
49
|
let n = atob(e), r = new Uint8Array(n.length);
|
|
48
50
|
for (let e = 0; e < n.length; e++) r[e] = n.charCodeAt(e);
|
|
49
51
|
let i = new Blob([r], { type: "application/pdf" }), a = URL.createObjectURL(i), o = document.createElement("a");
|
|
50
52
|
o.href = a, o.download = t, document.body.appendChild(o), o.click(), o.remove(), URL.revokeObjectURL(a);
|
|
51
53
|
}
|
|
52
54
|
function w() {
|
|
53
|
-
let { workspaceId: m = "" } = e(), { toasts: w, addToast: T, dismissToast:
|
|
55
|
+
let { workspaceId: m = "" } = e(), { toasts: w, addToast: T, dismissToast: _e } = l(), E = h(), { data: D, loading: O, error: ve, refetch: ye, fetchMore: be } = ne({
|
|
54
56
|
variables: {
|
|
55
57
|
workspaceId: m,
|
|
56
58
|
pagination: {
|
|
@@ -59,17 +61,17 @@ function w() {
|
|
|
59
61
|
}
|
|
60
62
|
},
|
|
61
63
|
notifyOnNetworkStatusChange: !0
|
|
62
|
-
}), { data:
|
|
63
|
-
await Promise.all([
|
|
64
|
-
},
|
|
65
|
-
|
|
64
|
+
}), { data: xe, loading: Se, refetch: Ce } = te({ variables: { workspaceId: m } }), [k, { loading: A }] = ee(), we = ie(), [j] = re(), [Te, { loading: M }] = o(), N = D?.timeCampusInvoices?.items ?? [], Ee = D?.timeCampusInvoices?.total ?? 0, P = xe?.timeCampusInvoiceStats, [F, I] = d(!1), [De, Oe] = d(!0), [ke, L] = d(!1), [R, z] = d(C), [B, V] = d(null), [H, U] = d(null), [Ae, W] = d(!1), [G, K] = d(null), [q, J] = d(null), [je, Y] = d(null), X = async () => {
|
|
65
|
+
await Promise.all([ye(), Ce()]);
|
|
66
|
+
}, Me = () => {
|
|
67
|
+
z({
|
|
66
68
|
...C,
|
|
67
69
|
periodStart: S(),
|
|
68
70
|
periodEnd: x()
|
|
69
|
-
}),
|
|
70
|
-
},
|
|
71
|
-
if (!
|
|
72
|
-
let e = Number(
|
|
71
|
+
}), L(!0);
|
|
72
|
+
}, Z = () => L(!1), Ne = async () => {
|
|
73
|
+
if (!R.clientName.trim() || !R.periodStart || !R.periodEnd) return;
|
|
74
|
+
let e = Number(R.taxRatePercent || "0") / 100;
|
|
73
75
|
if (Number.isNaN(e) || e < 0 || e > 1) {
|
|
74
76
|
T({
|
|
75
77
|
title: "Tax rate must be between 0 and 100%",
|
|
@@ -78,106 +80,111 @@ function w() {
|
|
|
78
80
|
return;
|
|
79
81
|
}
|
|
80
82
|
try {
|
|
81
|
-
await
|
|
83
|
+
let t = (await k({ variables: { input: {
|
|
82
84
|
workspaceId: m,
|
|
83
|
-
clientName:
|
|
84
|
-
clientEmail:
|
|
85
|
-
clientAddress:
|
|
86
|
-
periodStart: new Date(
|
|
87
|
-
periodEnd: (/* @__PURE__ */ new Date(new Date(
|
|
85
|
+
clientName: R.clientName.trim(),
|
|
86
|
+
clientEmail: R.clientEmail.trim() || void 0,
|
|
87
|
+
clientAddress: R.clientAddress.trim() || void 0,
|
|
88
|
+
periodStart: new Date(R.periodStart).toISOString(),
|
|
89
|
+
periodEnd: (/* @__PURE__ */ new Date(new Date(R.periodEnd).getTime() + 864e5 - 1)).toISOString(),
|
|
88
90
|
taxRate: e,
|
|
89
|
-
currency:
|
|
90
|
-
dueDate:
|
|
91
|
-
notes:
|
|
92
|
-
projectIds:
|
|
93
|
-
} } })
|
|
91
|
+
currency: R.currency.trim() || "USD",
|
|
92
|
+
dueDate: R.dueDate ? new Date(R.dueDate).toISOString() : void 0,
|
|
93
|
+
notes: R.notes.trim() || void 0,
|
|
94
|
+
projectIds: R.projectIds.trim() ? R.projectIds.split(",").map((e) => e.trim()).filter(Boolean) : void 0
|
|
95
|
+
} } })).data?.generateTimeCampusInvoiceDraft;
|
|
96
|
+
if (!t) throw Error("Failed to generate invoice — check the billing period has un-invoiced billable time");
|
|
97
|
+
we.invoiceCreated({
|
|
98
|
+
invoiceId: t.id,
|
|
99
|
+
lineItemCount: t.lineItems?.length ?? 0
|
|
100
|
+
}), T({
|
|
94
101
|
title: "Draft invoice generated",
|
|
95
102
|
variant: "success"
|
|
96
|
-
}),
|
|
103
|
+
}), Z(), await X();
|
|
97
104
|
} catch (e) {
|
|
98
105
|
T({
|
|
99
106
|
title: e instanceof Error ? e.message : "Failed to generate invoice — check the billing period has un-invoiced billable time",
|
|
100
107
|
variant: "error"
|
|
101
108
|
});
|
|
102
109
|
}
|
|
103
|
-
},
|
|
104
|
-
|
|
110
|
+
}, Pe = async (e) => {
|
|
111
|
+
Y(e.id);
|
|
105
112
|
try {
|
|
106
|
-
await
|
|
113
|
+
await j({ variables: { input: {
|
|
107
114
|
id: e.id,
|
|
108
115
|
workspaceId: m,
|
|
109
116
|
status: u.Sent
|
|
110
117
|
} } }), T({
|
|
111
118
|
title: "Invoice marked as sent",
|
|
112
119
|
variant: "success"
|
|
113
|
-
}), await
|
|
120
|
+
}), await X();
|
|
114
121
|
} catch {
|
|
115
122
|
T({
|
|
116
123
|
title: "Failed to update invoice status",
|
|
117
124
|
variant: "error"
|
|
118
125
|
});
|
|
119
126
|
} finally {
|
|
120
|
-
|
|
127
|
+
Y(null);
|
|
121
128
|
}
|
|
122
|
-
},
|
|
123
|
-
|
|
129
|
+
}, Fe = async (e) => {
|
|
130
|
+
Y(e.id);
|
|
124
131
|
try {
|
|
125
|
-
await
|
|
132
|
+
await j({ variables: { input: {
|
|
126
133
|
id: e.id,
|
|
127
134
|
workspaceId: m,
|
|
128
135
|
status: u.Paid
|
|
129
136
|
} } }), T({
|
|
130
137
|
title: "Invoice marked as paid",
|
|
131
138
|
variant: "success"
|
|
132
|
-
}), await
|
|
139
|
+
}), await X();
|
|
133
140
|
} catch {
|
|
134
141
|
T({
|
|
135
142
|
title: "Failed to update invoice status",
|
|
136
143
|
variant: "error"
|
|
137
144
|
});
|
|
138
145
|
} finally {
|
|
139
|
-
|
|
146
|
+
Y(null);
|
|
140
147
|
}
|
|
141
|
-
},
|
|
142
|
-
if (
|
|
143
|
-
await
|
|
144
|
-
id:
|
|
148
|
+
}, Ie = async () => {
|
|
149
|
+
if (q) try {
|
|
150
|
+
await Te({ variables: {
|
|
151
|
+
id: q.id,
|
|
145
152
|
workspaceId: m
|
|
146
153
|
} }), T({
|
|
147
154
|
title: "Draft invoice deleted",
|
|
148
155
|
variant: "success"
|
|
149
|
-
}),
|
|
156
|
+
}), J(null), await X();
|
|
150
157
|
} catch {
|
|
151
158
|
T({
|
|
152
159
|
title: "Failed to delete invoice",
|
|
153
160
|
variant: "error"
|
|
154
161
|
});
|
|
155
162
|
}
|
|
156
|
-
},
|
|
157
|
-
|
|
163
|
+
}, Le = async (e) => {
|
|
164
|
+
V(e), U(null), W(!0);
|
|
158
165
|
try {
|
|
159
166
|
let { data: t } = await E.query({
|
|
160
|
-
query:
|
|
167
|
+
query: me,
|
|
161
168
|
variables: {
|
|
162
169
|
id: e.id,
|
|
163
170
|
workspaceId: m
|
|
164
171
|
},
|
|
165
172
|
fetchPolicy: "no-cache"
|
|
166
173
|
}), n = t?.timeCampusInvoiceHtml;
|
|
167
|
-
|
|
174
|
+
U(n ?? null);
|
|
168
175
|
} catch {
|
|
169
176
|
T({
|
|
170
177
|
title: "Failed to load invoice preview",
|
|
171
178
|
variant: "error"
|
|
172
179
|
});
|
|
173
180
|
} finally {
|
|
174
|
-
|
|
181
|
+
W(!1);
|
|
175
182
|
}
|
|
176
183
|
}, Q = async (e) => {
|
|
177
|
-
|
|
184
|
+
K(e.id);
|
|
178
185
|
try {
|
|
179
186
|
let { data: t } = await E.query({
|
|
180
|
-
query:
|
|
187
|
+
query: he,
|
|
181
188
|
variables: {
|
|
182
189
|
id: e.id,
|
|
183
190
|
workspaceId: m
|
|
@@ -185,24 +192,24 @@ function w() {
|
|
|
185
192
|
fetchPolicy: "no-cache"
|
|
186
193
|
}), n = t?.timeCampusInvoicePdf;
|
|
187
194
|
if (!n) throw Error("Empty PDF payload");
|
|
188
|
-
|
|
195
|
+
ge(n, `${e.invoiceNumber}.pdf`);
|
|
189
196
|
} catch {
|
|
190
197
|
T({
|
|
191
198
|
title: "Failed to download PDF",
|
|
192
199
|
variant: "error"
|
|
193
200
|
});
|
|
194
201
|
} finally {
|
|
195
|
-
|
|
202
|
+
K(null);
|
|
196
203
|
}
|
|
197
|
-
},
|
|
198
|
-
|
|
204
|
+
}, Re = async () => {
|
|
205
|
+
I(!0);
|
|
199
206
|
try {
|
|
200
|
-
((await
|
|
207
|
+
((await be({
|
|
201
208
|
variables: {
|
|
202
209
|
workspaceId: m,
|
|
203
210
|
pagination: {
|
|
204
211
|
limit: y,
|
|
205
|
-
offset:
|
|
212
|
+
offset: N.length
|
|
206
213
|
}
|
|
207
214
|
},
|
|
208
215
|
updateQuery: (e, { fetchMoreResult: t }) => t ? {
|
|
@@ -212,12 +219,12 @@ function w() {
|
|
|
212
219
|
items: [...e.timeCampusInvoices.items, ...t.timeCampusInvoices.items]
|
|
213
220
|
}
|
|
214
221
|
} : e
|
|
215
|
-
})).data?.timeCampusInvoices?.items?.length ?? 0) < y &&
|
|
222
|
+
})).data?.timeCampusInvoices?.items?.length ?? 0) < y && Oe(!1);
|
|
216
223
|
} finally {
|
|
217
|
-
|
|
224
|
+
I(!1);
|
|
218
225
|
}
|
|
219
226
|
};
|
|
220
|
-
if (O &&
|
|
227
|
+
if (O && Se && N.length === 0) return /* @__PURE__ */ _(s, {
|
|
221
228
|
title: "Invoicing",
|
|
222
229
|
description: "Bill clients for billable time",
|
|
223
230
|
children: /* @__PURE__ */ _(i, {
|
|
@@ -225,7 +232,7 @@ function w() {
|
|
|
225
232
|
count: 4
|
|
226
233
|
})
|
|
227
234
|
});
|
|
228
|
-
if (
|
|
235
|
+
if (ve) return /* @__PURE__ */ _(s, {
|
|
229
236
|
title: "Invoicing",
|
|
230
237
|
description: "Bill clients for billable time",
|
|
231
238
|
children: /* @__PURE__ */ _("div", {
|
|
@@ -234,11 +241,11 @@ function w() {
|
|
|
234
241
|
})
|
|
235
242
|
});
|
|
236
243
|
let $ = /* @__PURE__ */ v("button", {
|
|
237
|
-
onClick:
|
|
244
|
+
onClick: Me,
|
|
238
245
|
className: "inline-flex items-center gap-1.5 rounded-md bg-action-primary-bg px-3 py-2 text-sm font-medium text-action-primary-text hover:bg-action-primary-bg/90",
|
|
239
|
-
children: [/* @__PURE__ */ _(
|
|
246
|
+
children: [/* @__PURE__ */ _(de, { className: "h-4 w-4" }), "Generate Invoice"]
|
|
240
247
|
});
|
|
241
|
-
return /* @__PURE__ */ v(
|
|
248
|
+
return /* @__PURE__ */ v(s, {
|
|
242
249
|
title: "Invoicing",
|
|
243
250
|
description: "Bill clients for billable time",
|
|
244
251
|
purpose: "Turn logged, billable hours into a real invoice — pick a client and a billing period, and TimeCampus aggregates every un-invoiced billable time entry by project and task, applying each entry's own rate, into a draft you can review, send, and mark paid.",
|
|
@@ -250,28 +257,28 @@ function w() {
|
|
|
250
257
|
/* @__PURE__ */ _(r, {
|
|
251
258
|
featured: !0,
|
|
252
259
|
title: "Total Invoiced",
|
|
253
|
-
value: t(
|
|
254
|
-
icon: /* @__PURE__ */ _(
|
|
260
|
+
value: t(P?.totalInvoiced ?? 0),
|
|
261
|
+
icon: /* @__PURE__ */ _(le, { className: "h-5 w-5" })
|
|
255
262
|
}),
|
|
256
263
|
/* @__PURE__ */ _(r, {
|
|
257
264
|
title: "Outstanding",
|
|
258
|
-
value: t(
|
|
259
|
-
description: `${
|
|
265
|
+
value: t(P?.totalOutstanding ?? 0),
|
|
266
|
+
description: `${P?.sentCount ?? 0} sent, awaiting payment`
|
|
260
267
|
}),
|
|
261
268
|
/* @__PURE__ */ _(r, {
|
|
262
269
|
title: "Paid",
|
|
263
|
-
value: t(
|
|
264
|
-
description: `${
|
|
270
|
+
value: t(P?.totalPaid ?? 0),
|
|
271
|
+
description: `${P?.paidCount ?? 0} invoices paid`
|
|
265
272
|
}),
|
|
266
273
|
/* @__PURE__ */ _(r, {
|
|
267
274
|
title: "Drafts",
|
|
268
|
-
value: String(
|
|
275
|
+
value: String(P?.draftCount ?? 0),
|
|
269
276
|
icon: /* @__PURE__ */ _(p, { className: "h-5 w-5" }),
|
|
270
277
|
description: "not yet sent"
|
|
271
278
|
})
|
|
272
279
|
]
|
|
273
280
|
}),
|
|
274
|
-
|
|
281
|
+
N.length === 0 && !O ? /* @__PURE__ */ _(a, {
|
|
275
282
|
illustration: "empty-data",
|
|
276
283
|
title: "No invoices yet",
|
|
277
284
|
description: "Generate a draft invoice from real billable time entries to bill a client.",
|
|
@@ -280,8 +287,8 @@ function w() {
|
|
|
280
287
|
className: "mt-4 rounded-xl border border-border-seam bg-gloss-card shadow-pop",
|
|
281
288
|
children: /* @__PURE__ */ _("div", {
|
|
282
289
|
className: "divide-y divide-border",
|
|
283
|
-
children:
|
|
284
|
-
let r =
|
|
290
|
+
children: N.map((e) => {
|
|
291
|
+
let r = je === e.id, i = e.status === u.Draft, a = e.status === u.Sent;
|
|
285
292
|
return /* @__PURE__ */ v("div", {
|
|
286
293
|
className: "flex flex-col gap-3 p-4 hover:bg-bg-sunken/50 transition-colors sm:flex-row sm:items-center sm:justify-between",
|
|
287
294
|
children: [/* @__PURE__ */ v("div", {
|
|
@@ -310,28 +317,28 @@ function w() {
|
|
|
310
317
|
className: "text-sm font-medium text-text-primary",
|
|
311
318
|
children: t(e.total, e.currency)
|
|
312
319
|
}),
|
|
313
|
-
/* @__PURE__ */ _(
|
|
320
|
+
/* @__PURE__ */ _(ae, {
|
|
314
321
|
label: e.status.toLowerCase(),
|
|
315
322
|
status: e.status.toLowerCase()
|
|
316
323
|
}),
|
|
317
324
|
e.isOverdue && /* @__PURE__ */ v("span", {
|
|
318
325
|
title: "Past due date",
|
|
319
326
|
className: "inline-flex items-center gap-1 text-xs font-medium text-status-error-text",
|
|
320
|
-
children: [/* @__PURE__ */ _(
|
|
327
|
+
children: [/* @__PURE__ */ _(se, { className: "h-3.5 w-3.5" }), "Overdue"]
|
|
321
328
|
}),
|
|
322
329
|
/* @__PURE__ */ v("div", {
|
|
323
330
|
className: "flex items-center gap-1",
|
|
324
331
|
children: [
|
|
325
332
|
/* @__PURE__ */ _("button", {
|
|
326
333
|
type: "button",
|
|
327
|
-
onClick: () => void
|
|
334
|
+
onClick: () => void Le(e),
|
|
328
335
|
title: "View invoice",
|
|
329
336
|
className: "rounded-md p-1.5 text-text-secondary hover:bg-bg-sunken",
|
|
330
|
-
children: /* @__PURE__ */ _(
|
|
337
|
+
children: /* @__PURE__ */ _(ue, { className: "h-4 w-4" })
|
|
331
338
|
}),
|
|
332
339
|
/* @__PURE__ */ _("button", {
|
|
333
340
|
type: "button",
|
|
334
|
-
disabled:
|
|
341
|
+
disabled: G === e.id,
|
|
335
342
|
onClick: () => void Q(e),
|
|
336
343
|
title: "Download PDF",
|
|
337
344
|
className: "rounded-md p-1.5 text-text-secondary hover:bg-bg-sunken disabled:opacity-50",
|
|
@@ -340,25 +347,25 @@ function w() {
|
|
|
340
347
|
i && /* @__PURE__ */ _("button", {
|
|
341
348
|
type: "button",
|
|
342
349
|
disabled: r,
|
|
343
|
-
onClick: () =>
|
|
350
|
+
onClick: () => Pe(e),
|
|
344
351
|
title: "Mark as sent",
|
|
345
352
|
className: "rounded-md p-1.5 text-status-info-text hover:bg-status-info-bg disabled:opacity-50",
|
|
346
|
-
children: /* @__PURE__ */ _(
|
|
353
|
+
children: /* @__PURE__ */ _(fe, { className: "h-4 w-4" })
|
|
347
354
|
}),
|
|
348
355
|
a && /* @__PURE__ */ _("button", {
|
|
349
356
|
type: "button",
|
|
350
357
|
disabled: r,
|
|
351
|
-
onClick: () =>
|
|
358
|
+
onClick: () => Fe(e),
|
|
352
359
|
title: "Mark as paid",
|
|
353
360
|
className: "rounded-md p-1.5 text-status-success-text hover:bg-status-success-bg disabled:opacity-50",
|
|
354
|
-
children: /* @__PURE__ */ _(
|
|
361
|
+
children: /* @__PURE__ */ _(ce, { className: "h-4 w-4" })
|
|
355
362
|
}),
|
|
356
363
|
i && /* @__PURE__ */ _("button", {
|
|
357
364
|
type: "button",
|
|
358
|
-
onClick: () =>
|
|
365
|
+
onClick: () => J(e),
|
|
359
366
|
title: "Delete draft",
|
|
360
367
|
className: "rounded-md p-1.5 text-status-error-text hover:bg-status-error-bg",
|
|
361
|
-
children: /* @__PURE__ */ _(
|
|
368
|
+
children: /* @__PURE__ */ _(pe, { className: "h-4 w-4" })
|
|
362
369
|
})
|
|
363
370
|
]
|
|
364
371
|
})
|
|
@@ -367,29 +374,29 @@ function w() {
|
|
|
367
374
|
}, e.id);
|
|
368
375
|
})
|
|
369
376
|
})
|
|
370
|
-
}),
|
|
377
|
+
}), De && N.length < Ee && /* @__PURE__ */ _("div", {
|
|
371
378
|
className: "mt-4 flex justify-center",
|
|
372
379
|
children: /* @__PURE__ */ _("button", {
|
|
373
|
-
onClick:
|
|
374
|
-
disabled:
|
|
380
|
+
onClick: Re,
|
|
381
|
+
disabled: F,
|
|
375
382
|
className: "rounded-md border border-border-subtle px-4 py-2 text-sm font-medium text-text-primary hover:bg-bg-sunken/50 disabled:opacity-50",
|
|
376
|
-
children:
|
|
383
|
+
children: F ? "Loading..." : "Load more"
|
|
377
384
|
})
|
|
378
385
|
})] }),
|
|
379
|
-
/* @__PURE__ */ _(
|
|
380
|
-
open:
|
|
381
|
-
onClose:
|
|
386
|
+
/* @__PURE__ */ _(c, {
|
|
387
|
+
open: ke,
|
|
388
|
+
onClose: Z,
|
|
382
389
|
title: "Generate Invoice",
|
|
383
390
|
description: "Aggregates every billable, un-invoiced time entry in the selected period into a draft invoice.",
|
|
384
391
|
footer: /* @__PURE__ */ v(g, { children: [/* @__PURE__ */ _("button", {
|
|
385
|
-
onClick:
|
|
392
|
+
onClick: Z,
|
|
386
393
|
className: "rounded-md border border-border-subtle px-4 py-2 text-sm font-medium text-text-primary hover:bg-bg-sunken/50",
|
|
387
394
|
children: "Cancel"
|
|
388
395
|
}), /* @__PURE__ */ _("button", {
|
|
389
|
-
onClick:
|
|
390
|
-
disabled:
|
|
396
|
+
onClick: Ne,
|
|
397
|
+
disabled: A || !R.clientName.trim() || !R.periodStart || !R.periodEnd,
|
|
391
398
|
className: "rounded-md bg-action-primary-bg px-4 py-2 text-sm font-medium text-action-primary-text hover:bg-action-primary-bg/90 disabled:opacity-50",
|
|
392
|
-
children:
|
|
399
|
+
children: A ? "Generating..." : "Generate Draft"
|
|
393
400
|
})] }),
|
|
394
401
|
children: /* @__PURE__ */ v("div", {
|
|
395
402
|
className: "space-y-4",
|
|
@@ -400,9 +407,9 @@ function w() {
|
|
|
400
407
|
}), /* @__PURE__ */ _("input", {
|
|
401
408
|
type: "text",
|
|
402
409
|
placeholder: "Acme Corp",
|
|
403
|
-
value:
|
|
404
|
-
onChange: (e) =>
|
|
405
|
-
...
|
|
410
|
+
value: R.clientName,
|
|
411
|
+
onChange: (e) => z({
|
|
412
|
+
...R,
|
|
406
413
|
clientName: e.target.value
|
|
407
414
|
}),
|
|
408
415
|
className: b
|
|
@@ -415,9 +422,9 @@ function w() {
|
|
|
415
422
|
}), /* @__PURE__ */ _("input", {
|
|
416
423
|
type: "email",
|
|
417
424
|
placeholder: "billing@acme.com",
|
|
418
|
-
value:
|
|
419
|
-
onChange: (e) =>
|
|
420
|
-
...
|
|
425
|
+
value: R.clientEmail,
|
|
426
|
+
onChange: (e) => z({
|
|
427
|
+
...R,
|
|
421
428
|
clientEmail: e.target.value
|
|
422
429
|
}),
|
|
423
430
|
className: b
|
|
@@ -427,9 +434,9 @@ function w() {
|
|
|
427
434
|
}), /* @__PURE__ */ _("input", {
|
|
428
435
|
type: "text",
|
|
429
436
|
placeholder: "USD",
|
|
430
|
-
value:
|
|
431
|
-
onChange: (e) =>
|
|
432
|
-
...
|
|
437
|
+
value: R.currency,
|
|
438
|
+
onChange: (e) => z({
|
|
439
|
+
...R,
|
|
433
440
|
currency: e.target.value
|
|
434
441
|
}),
|
|
435
442
|
className: b
|
|
@@ -441,9 +448,9 @@ function w() {
|
|
|
441
448
|
}), /* @__PURE__ */ _("input", {
|
|
442
449
|
type: "text",
|
|
443
450
|
placeholder: "Optional billing address",
|
|
444
|
-
value:
|
|
445
|
-
onChange: (e) =>
|
|
446
|
-
...
|
|
451
|
+
value: R.clientAddress,
|
|
452
|
+
onChange: (e) => z({
|
|
453
|
+
...R,
|
|
447
454
|
clientAddress: e.target.value
|
|
448
455
|
}),
|
|
449
456
|
className: b
|
|
@@ -455,9 +462,9 @@ function w() {
|
|
|
455
462
|
children: "Billing period start"
|
|
456
463
|
}), /* @__PURE__ */ _("input", {
|
|
457
464
|
type: "date",
|
|
458
|
-
value:
|
|
459
|
-
onChange: (e) =>
|
|
460
|
-
...
|
|
465
|
+
value: R.periodStart,
|
|
466
|
+
onChange: (e) => z({
|
|
467
|
+
...R,
|
|
461
468
|
periodStart: e.target.value
|
|
462
469
|
}),
|
|
463
470
|
className: b
|
|
@@ -466,9 +473,9 @@ function w() {
|
|
|
466
473
|
children: "Billing period end"
|
|
467
474
|
}), /* @__PURE__ */ _("input", {
|
|
468
475
|
type: "date",
|
|
469
|
-
value:
|
|
470
|
-
onChange: (e) =>
|
|
471
|
-
...
|
|
476
|
+
value: R.periodEnd,
|
|
477
|
+
onChange: (e) => z({
|
|
478
|
+
...R,
|
|
472
479
|
periodEnd: e.target.value
|
|
473
480
|
}),
|
|
474
481
|
className: b
|
|
@@ -484,9 +491,9 @@ function w() {
|
|
|
484
491
|
min: 0,
|
|
485
492
|
max: 100,
|
|
486
493
|
step: "0.1",
|
|
487
|
-
value:
|
|
488
|
-
onChange: (e) =>
|
|
489
|
-
...
|
|
494
|
+
value: R.taxRatePercent,
|
|
495
|
+
onChange: (e) => z({
|
|
496
|
+
...R,
|
|
490
497
|
taxRatePercent: e.target.value
|
|
491
498
|
}),
|
|
492
499
|
className: b
|
|
@@ -495,9 +502,9 @@ function w() {
|
|
|
495
502
|
children: "Due date"
|
|
496
503
|
}), /* @__PURE__ */ _("input", {
|
|
497
504
|
type: "date",
|
|
498
|
-
value:
|
|
499
|
-
onChange: (e) =>
|
|
500
|
-
...
|
|
505
|
+
value: R.dueDate,
|
|
506
|
+
onChange: (e) => z({
|
|
507
|
+
...R,
|
|
501
508
|
dueDate: e.target.value
|
|
502
509
|
}),
|
|
503
510
|
className: b
|
|
@@ -509,9 +516,9 @@ function w() {
|
|
|
509
516
|
}), /* @__PURE__ */ _("input", {
|
|
510
517
|
type: "text",
|
|
511
518
|
placeholder: "Optional, comma-separated. Leave blank for all projects.",
|
|
512
|
-
value:
|
|
513
|
-
onChange: (e) =>
|
|
514
|
-
...
|
|
519
|
+
value: R.projectIds,
|
|
520
|
+
onChange: (e) => z({
|
|
521
|
+
...R,
|
|
515
522
|
projectIds: e.target.value
|
|
516
523
|
}),
|
|
517
524
|
className: b
|
|
@@ -522,9 +529,9 @@ function w() {
|
|
|
522
529
|
}), /* @__PURE__ */ _("textarea", {
|
|
523
530
|
rows: 2,
|
|
524
531
|
placeholder: "Optional notes printed on the invoice",
|
|
525
|
-
value:
|
|
526
|
-
onChange: (e) =>
|
|
527
|
-
...
|
|
532
|
+
value: R.notes,
|
|
533
|
+
onChange: (e) => z({
|
|
534
|
+
...R,
|
|
528
535
|
notes: e.target.value
|
|
529
536
|
}),
|
|
530
537
|
className: b
|
|
@@ -532,28 +539,28 @@ function w() {
|
|
|
532
539
|
]
|
|
533
540
|
})
|
|
534
541
|
}),
|
|
535
|
-
/* @__PURE__ */ _(
|
|
536
|
-
open:
|
|
537
|
-
onClose: () =>
|
|
538
|
-
title:
|
|
539
|
-
description:
|
|
542
|
+
/* @__PURE__ */ _(c, {
|
|
543
|
+
open: B !== null,
|
|
544
|
+
onClose: () => V(null),
|
|
545
|
+
title: B ? `Invoice ${B.invoiceNumber}` : "Invoice",
|
|
546
|
+
description: B?.clientName,
|
|
540
547
|
size: "xl",
|
|
541
|
-
footer:
|
|
542
|
-
onClick: () =>
|
|
548
|
+
footer: B && /* @__PURE__ */ v(g, { children: [/* @__PURE__ */ _("button", {
|
|
549
|
+
onClick: () => V(null),
|
|
543
550
|
className: "rounded-md border border-border-subtle px-4 py-2 text-sm font-medium text-text-primary hover:bg-bg-sunken/50",
|
|
544
551
|
children: "Close"
|
|
545
552
|
}), /* @__PURE__ */ v("button", {
|
|
546
|
-
onClick: () => void Q(
|
|
547
|
-
disabled:
|
|
553
|
+
onClick: () => void Q(B),
|
|
554
|
+
disabled: G === B.id,
|
|
548
555
|
className: "inline-flex items-center gap-1.5 rounded-md bg-action-primary-bg px-4 py-2 text-sm font-medium text-action-primary-text hover:bg-action-primary-bg/90 disabled:opacity-50",
|
|
549
|
-
children: [/* @__PURE__ */ _(f, { className: "h-4 w-4" }),
|
|
556
|
+
children: [/* @__PURE__ */ _(f, { className: "h-4 w-4" }), G === B.id ? "Downloading..." : "Download PDF"]
|
|
550
557
|
})] }),
|
|
551
|
-
children:
|
|
558
|
+
children: Ae ? /* @__PURE__ */ _(i, {
|
|
552
559
|
variant: "detail",
|
|
553
560
|
count: 1
|
|
554
|
-
}) :
|
|
561
|
+
}) : H ? /* @__PURE__ */ _("iframe", {
|
|
555
562
|
title: "Invoice preview",
|
|
556
|
-
srcDoc:
|
|
563
|
+
srcDoc: H,
|
|
557
564
|
sandbox: "",
|
|
558
565
|
className: "h-[60vh] w-full rounded-md border border-border-subtle bg-white"
|
|
559
566
|
}) : /* @__PURE__ */ _("p", {
|
|
@@ -561,30 +568,30 @@ function w() {
|
|
|
561
568
|
children: "Failed to load invoice preview."
|
|
562
569
|
})
|
|
563
570
|
}),
|
|
564
|
-
/* @__PURE__ */ _(
|
|
565
|
-
open:
|
|
566
|
-
onClose: () =>
|
|
571
|
+
/* @__PURE__ */ _(c, {
|
|
572
|
+
open: q !== null,
|
|
573
|
+
onClose: () => J(null),
|
|
567
574
|
title: "Delete draft invoice?",
|
|
568
|
-
description:
|
|
575
|
+
description: q ? `${q.invoiceNumber} · ${t(q.total, q.currency)} will be removed and its time entries released back to the un-invoiced pool.` : void 0,
|
|
569
576
|
size: "sm",
|
|
570
577
|
footer: /* @__PURE__ */ v(g, { children: [/* @__PURE__ */ _("button", {
|
|
571
|
-
onClick: () =>
|
|
578
|
+
onClick: () => J(null),
|
|
572
579
|
className: "rounded-md border border-border-subtle px-4 py-2 text-sm font-medium text-text-primary hover:bg-bg-sunken/50",
|
|
573
580
|
children: "Cancel"
|
|
574
581
|
}), /* @__PURE__ */ _("button", {
|
|
575
|
-
onClick:
|
|
576
|
-
disabled:
|
|
582
|
+
onClick: Ie,
|
|
583
|
+
disabled: M,
|
|
577
584
|
className: "rounded-md bg-status-error-bg px-4 py-2 text-sm font-medium text-status-error-text hover:bg-status-error-bg/80 disabled:opacity-50",
|
|
578
|
-
children:
|
|
585
|
+
children: M ? "Deleting..." : "Delete"
|
|
579
586
|
})] }),
|
|
580
587
|
children: /* @__PURE__ */ _("p", {
|
|
581
588
|
className: "text-sm text-text-secondary",
|
|
582
589
|
children: "This permanently removes the draft. This action cannot be undone."
|
|
583
590
|
})
|
|
584
591
|
}),
|
|
585
|
-
/* @__PURE__ */ _(
|
|
592
|
+
/* @__PURE__ */ _(oe, {
|
|
586
593
|
toasts: w,
|
|
587
|
-
onDismiss:
|
|
594
|
+
onDismiss: _e
|
|
588
595
|
})
|
|
589
596
|
]
|
|
590
597
|
});
|