trotl-table 1.0.97 → 1.0.99
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/README.md +3 -1
- package/dist/Table.cjs.js +130 -34
- package/dist/Table.cjs.js.map +1 -1
- package/dist/Table.esm.js +130 -34
- package/dist/Table.esm.js.map +1 -1
- package/dist/WorkOrderAnalyticsByClient.cjs.js +417 -0
- package/dist/WorkOrderAnalyticsByClient.cjs.js.map +1 -0
- package/dist/WorkOrderAnalyticsByClient.esm.js +412 -0
- package/dist/WorkOrderAnalyticsByClient.esm.js.map +1 -0
- package/dist/index.css +1 -1
- package/dist/index.css.map +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,417 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
var React = require('react');
|
|
6
|
+
|
|
7
|
+
const COMPLETED_STATUS_ID = "3a861ce5-dfd5-451d-81f3-7e90788eff18";
|
|
8
|
+
const MONTH_NAMES = ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"];
|
|
9
|
+
function getDocuments(payload) {
|
|
10
|
+
if (Array.isArray(payload)) return payload;
|
|
11
|
+
if (Array.isArray(payload?.data)) return payload.data;
|
|
12
|
+
if (Array.isArray(payload?.documents)) return payload.documents;
|
|
13
|
+
if (Array.isArray(payload?.items)) return payload.items;
|
|
14
|
+
if (Array.isArray(payload?.results)) return payload.results;
|
|
15
|
+
return [];
|
|
16
|
+
}
|
|
17
|
+
function parseDateValue(raw) {
|
|
18
|
+
if (raw === undefined || raw === null || raw === "") return null;
|
|
19
|
+
const timestamp = typeof raw === "number" ? raw >= 1e12 ? raw : raw * 1000 : typeof raw === "string" && /^\d+$/.test(raw.trim()) ? Number(raw) >= 1e12 ? Number(raw) : Number(raw) * 1000 : raw;
|
|
20
|
+
const date = new Date(timestamp);
|
|
21
|
+
return Number.isNaN(date.getTime()) ? null : date;
|
|
22
|
+
}
|
|
23
|
+
function getWorkOrderDate(document) {
|
|
24
|
+
const value = document.completedAt || document.completedDate || document.createdAt || document.createdOn || document.creationDate || document.date || document.startDate || document.updatedAt;
|
|
25
|
+
return parseDateValue(value);
|
|
26
|
+
}
|
|
27
|
+
function getClientName(document) {
|
|
28
|
+
return document.clientLabel || document.clientName || document.clientId || "Unknown client";
|
|
29
|
+
}
|
|
30
|
+
function getTherapistName(document) {
|
|
31
|
+
return document.therapistLabel || document.therapistName || document.therapistId || "Unknown therapist";
|
|
32
|
+
}
|
|
33
|
+
function isFutureCalendarDate(date, referenceDate) {
|
|
34
|
+
const dateKey = date.getFullYear() * 10000 + (date.getMonth() + 1) * 100 + date.getDate();
|
|
35
|
+
const referenceKey = referenceDate.getFullYear() * 10000 + (referenceDate.getMonth() + 1) * 100 + referenceDate.getDate();
|
|
36
|
+
return dateKey > referenceKey;
|
|
37
|
+
}
|
|
38
|
+
function countBy(items, getKey) {
|
|
39
|
+
return items.reduce((counts, item) => {
|
|
40
|
+
const key = getKey(item);
|
|
41
|
+
counts[key] = (counts[key] || 0) + 1;
|
|
42
|
+
return counts;
|
|
43
|
+
}, {});
|
|
44
|
+
}
|
|
45
|
+
function formatNumber(value) {
|
|
46
|
+
return new Intl.NumberFormat().format(value);
|
|
47
|
+
}
|
|
48
|
+
function SummaryCard({
|
|
49
|
+
label,
|
|
50
|
+
value,
|
|
51
|
+
detail
|
|
52
|
+
}) {
|
|
53
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
54
|
+
className: "analytics-summary-card"
|
|
55
|
+
}, /*#__PURE__*/React.createElement("span", {
|
|
56
|
+
className: "analytics-summary-label"
|
|
57
|
+
}, label), /*#__PURE__*/React.createElement("strong", {
|
|
58
|
+
className: "analytics-summary-value"
|
|
59
|
+
}, value), detail && /*#__PURE__*/React.createElement("span", {
|
|
60
|
+
className: "analytics-summary-detail"
|
|
61
|
+
}, detail));
|
|
62
|
+
}
|
|
63
|
+
function BarChart({
|
|
64
|
+
rows,
|
|
65
|
+
labelKey,
|
|
66
|
+
valueKey,
|
|
67
|
+
color = "#2995A3"
|
|
68
|
+
}) {
|
|
69
|
+
const maximum = Math.max(...rows.map(row => row[valueKey]), 1);
|
|
70
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
71
|
+
className: "analytics-bar-chart"
|
|
72
|
+
}, rows.map(row => /*#__PURE__*/React.createElement("div", {
|
|
73
|
+
className: "analytics-bar-row",
|
|
74
|
+
key: row.key || row[labelKey]
|
|
75
|
+
}, /*#__PURE__*/React.createElement("span", {
|
|
76
|
+
className: "analytics-bar-label",
|
|
77
|
+
title: row[labelKey]
|
|
78
|
+
}, row[labelKey]), /*#__PURE__*/React.createElement("span", {
|
|
79
|
+
className: "analytics-bar-track"
|
|
80
|
+
}, /*#__PURE__*/React.createElement("span", {
|
|
81
|
+
className: "analytics-bar-fill",
|
|
82
|
+
style: {
|
|
83
|
+
width: `${row[valueKey] / maximum * 100}%`,
|
|
84
|
+
backgroundColor: color
|
|
85
|
+
}
|
|
86
|
+
})), /*#__PURE__*/React.createElement("strong", null, formatNumber(row[valueKey])))));
|
|
87
|
+
}
|
|
88
|
+
function MonthlyChart({
|
|
89
|
+
rows,
|
|
90
|
+
onMonthClick
|
|
91
|
+
}) {
|
|
92
|
+
const maximum = Math.max(...rows.map(row => row.orders), 1);
|
|
93
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
94
|
+
className: "analytics-month-chart",
|
|
95
|
+
role: "img",
|
|
96
|
+
"aria-label": "Completed WorkOrders by month"
|
|
97
|
+
}, rows.map(row => /*#__PURE__*/React.createElement("button", {
|
|
98
|
+
type: "button",
|
|
99
|
+
className: "analytics-month-column",
|
|
100
|
+
key: row.key,
|
|
101
|
+
onClick: () => onMonthClick(row),
|
|
102
|
+
title: `Open ${row.month} ${row.year} details`
|
|
103
|
+
}, /*#__PURE__*/React.createElement("span", {
|
|
104
|
+
className: "analytics-month-value"
|
|
105
|
+
}, row.orders), /*#__PURE__*/React.createElement("span", {
|
|
106
|
+
className: "analytics-month-bar",
|
|
107
|
+
style: {
|
|
108
|
+
height: `${Math.max(row.orders / maximum * 100, 3)}%`
|
|
109
|
+
}
|
|
110
|
+
}), /*#__PURE__*/React.createElement("span", {
|
|
111
|
+
className: "analytics-month-label"
|
|
112
|
+
}, row.month.slice(0, 3), " ", row.year))));
|
|
113
|
+
}
|
|
114
|
+
function AnalyticsTable({
|
|
115
|
+
columns,
|
|
116
|
+
rows,
|
|
117
|
+
emptyMessage = "No completed WorkOrders found."
|
|
118
|
+
}) {
|
|
119
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
120
|
+
className: "analytics-table-wrap"
|
|
121
|
+
}, /*#__PURE__*/React.createElement("table", {
|
|
122
|
+
className: "analytics-table"
|
|
123
|
+
}, /*#__PURE__*/React.createElement("thead", null, /*#__PURE__*/React.createElement("tr", null, columns.map(column => /*#__PURE__*/React.createElement("th", {
|
|
124
|
+
key: column.key
|
|
125
|
+
}, column.label)))), /*#__PURE__*/React.createElement("tbody", null, rows.length === 0 ? /*#__PURE__*/React.createElement("tr", null, /*#__PURE__*/React.createElement("td", {
|
|
126
|
+
colSpan: columns.length,
|
|
127
|
+
className: "analytics-empty"
|
|
128
|
+
}, emptyMessage)) : rows.map((row, index) => /*#__PURE__*/React.createElement("tr", {
|
|
129
|
+
key: row.key || index
|
|
130
|
+
}, columns.map(column => /*#__PURE__*/React.createElement("td", {
|
|
131
|
+
key: column.key
|
|
132
|
+
}, column.render ? column.render(row) : row[column.key])))))));
|
|
133
|
+
}
|
|
134
|
+
function getWorkOrderLabel(order) {
|
|
135
|
+
return order.workOrderLabel || order.documentNumber || order.orderNumber || order.name || order.id || "WorkOrder";
|
|
136
|
+
}
|
|
137
|
+
function getWorkOrderHref(order) {
|
|
138
|
+
return order.url || order.link || order.href || (order.id ? `/work-orders/${order.id}` : null);
|
|
139
|
+
}
|
|
140
|
+
function MonthDetailsModal({
|
|
141
|
+
month,
|
|
142
|
+
orders,
|
|
143
|
+
onClose
|
|
144
|
+
}) {
|
|
145
|
+
if (!month) return null;
|
|
146
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
147
|
+
className: "analytics-modal-backdrop",
|
|
148
|
+
role: "presentation",
|
|
149
|
+
onClick: onClose
|
|
150
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
151
|
+
className: "analytics-modal",
|
|
152
|
+
role: "dialog",
|
|
153
|
+
"aria-modal": "true",
|
|
154
|
+
"aria-labelledby": "month-details-title",
|
|
155
|
+
onClick: event => event.stopPropagation()
|
|
156
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
157
|
+
className: "analytics-modal-header"
|
|
158
|
+
}, /*#__PURE__*/React.createElement("h3", {
|
|
159
|
+
id: "month-details-title"
|
|
160
|
+
}, month.month, " ", month.year, " WorkOrders"), /*#__PURE__*/React.createElement("button", {
|
|
161
|
+
type: "button",
|
|
162
|
+
className: "analytics-modal-close",
|
|
163
|
+
onClick: onClose,
|
|
164
|
+
"aria-label": "Close"
|
|
165
|
+
}, "\xD7")), /*#__PURE__*/React.createElement("p", null, orders.length, " completed WorkOrder", orders.length === 1 ? "" : "s", " in this month."), /*#__PURE__*/React.createElement("div", {
|
|
166
|
+
className: "analytics-modal-list"
|
|
167
|
+
}, orders.length === 0 ? /*#__PURE__*/React.createElement("div", {
|
|
168
|
+
className: "analytics-empty"
|
|
169
|
+
}, "No WorkOrders found.") : orders.map((order, index) => {
|
|
170
|
+
const href = getWorkOrderHref(order);
|
|
171
|
+
const label = getWorkOrderLabel(order);
|
|
172
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
173
|
+
className: "analytics-work-order-item",
|
|
174
|
+
key: order.id || `${label}-${index}`
|
|
175
|
+
}, href ? /*#__PURE__*/React.createElement("a", {
|
|
176
|
+
href: href,
|
|
177
|
+
target: "_blank",
|
|
178
|
+
rel: "noreferrer"
|
|
179
|
+
}, label) : /*#__PURE__*/React.createElement("strong", null, label), /*#__PURE__*/React.createElement("span", null, order.client, " \xB7 ", order.therapist), order.date && /*#__PURE__*/React.createElement("small", null, order.date.toLocaleDateString()));
|
|
180
|
+
}))));
|
|
181
|
+
}
|
|
182
|
+
function WorkOrderAnalyticsByClient({
|
|
183
|
+
endpoint = "/api/documents?type=WorkOrder",
|
|
184
|
+
fetchDocuments,
|
|
185
|
+
currentDate = new Date()
|
|
186
|
+
}) {
|
|
187
|
+
const [documents, setDocuments] = React.useState([]);
|
|
188
|
+
const [loading, setLoading] = React.useState(true);
|
|
189
|
+
const [error, setError] = React.useState("");
|
|
190
|
+
const [refreshToken, setRefreshToken] = React.useState(0);
|
|
191
|
+
const [selectedMonth, setSelectedMonth] = React.useState(null);
|
|
192
|
+
React.useEffect(() => {
|
|
193
|
+
let cancelled = false;
|
|
194
|
+
const loadDocuments = async () => {
|
|
195
|
+
setLoading(true);
|
|
196
|
+
setError("");
|
|
197
|
+
try {
|
|
198
|
+
const result = fetchDocuments ? await fetchDocuments() : await fetch(endpoint, {
|
|
199
|
+
headers: {
|
|
200
|
+
"Content-Type": "application/json"
|
|
201
|
+
}
|
|
202
|
+
}).then(response => {
|
|
203
|
+
if (!response.ok) throw new Error(`Request failed (${response.status})`);
|
|
204
|
+
return response.json();
|
|
205
|
+
});
|
|
206
|
+
if (!cancelled) setDocuments(getDocuments(result));
|
|
207
|
+
} catch (loadError) {
|
|
208
|
+
if (!cancelled) setError(loadError.message || "Unable to load WorkOrders.");
|
|
209
|
+
} finally {
|
|
210
|
+
if (!cancelled) setLoading(false);
|
|
211
|
+
}
|
|
212
|
+
};
|
|
213
|
+
loadDocuments();
|
|
214
|
+
return () => {
|
|
215
|
+
cancelled = true;
|
|
216
|
+
};
|
|
217
|
+
}, [endpoint, fetchDocuments, refreshToken]);
|
|
218
|
+
const completedOrders = React.useMemo(() => documents.filter(document => document.type === "WorkOrder" || document.documentType === "WorkOrder" || !document.type).filter(document => document.statusId === COMPLETED_STATUS_ID).map(document => ({
|
|
219
|
+
...document,
|
|
220
|
+
date: getWorkOrderDate(document),
|
|
221
|
+
client: getClientName(document),
|
|
222
|
+
therapist: getTherapistName(document)
|
|
223
|
+
})).filter(document => document.date && !isFutureCalendarDate(document.date, currentDate)), [documents, currentDate]);
|
|
224
|
+
const currentYear = currentDate.getFullYear();
|
|
225
|
+
const years = React.useMemo(() => [...new Set(completedOrders.map(order => order.date.getFullYear()))].sort((a, b) => b - a), [completedOrders]);
|
|
226
|
+
const yearRows = years.map(year => ({
|
|
227
|
+
key: year,
|
|
228
|
+
year,
|
|
229
|
+
orders: completedOrders.filter(order => order.date.getFullYear() === year).length
|
|
230
|
+
}));
|
|
231
|
+
const monthRows = [...new Set(completedOrders.map(order => `${order.date.getFullYear()}-${order.date.getMonth()}`))].map(key => {
|
|
232
|
+
const [year, monthIndex] = key.split("-").map(Number);
|
|
233
|
+
return {
|
|
234
|
+
key,
|
|
235
|
+
year,
|
|
236
|
+
month: MONTH_NAMES[monthIndex],
|
|
237
|
+
monthIndex,
|
|
238
|
+
orders: completedOrders.filter(order => order.date.getFullYear() === year && order.date.getMonth() === monthIndex).length
|
|
239
|
+
};
|
|
240
|
+
}).sort((a, b) => b.year - a.year || MONTH_NAMES.indexOf(a.month) - MONTH_NAMES.indexOf(b.month));
|
|
241
|
+
const clientCounts = countBy(completedOrders, order => order.client);
|
|
242
|
+
const clientRows = Object.entries(clientCounts).map(([client, orders]) => ({
|
|
243
|
+
key: client,
|
|
244
|
+
client,
|
|
245
|
+
orders,
|
|
246
|
+
share: completedOrders.length ? `${Math.round(orders / completedOrders.length * 100)}%` : "0%"
|
|
247
|
+
})).sort((a, b) => b.orders - a.orders || a.client.localeCompare(b.client));
|
|
248
|
+
const clientYearRows = Object.entries(clientCounts).map(([client]) => {
|
|
249
|
+
const row = {
|
|
250
|
+
key: client,
|
|
251
|
+
client
|
|
252
|
+
};
|
|
253
|
+
years.forEach(year => {
|
|
254
|
+
row[year] = completedOrders.filter(order => order.client === client && order.date.getFullYear() === year).length;
|
|
255
|
+
});
|
|
256
|
+
row.total = clientCounts[client];
|
|
257
|
+
return row;
|
|
258
|
+
}).sort((a, b) => b.total - a.total || a.client.localeCompare(b.client));
|
|
259
|
+
const clientMonthRows = monthRows.flatMap(monthRow => Object.entries(clientCounts).map(([client]) => ({
|
|
260
|
+
key: `${monthRow.key}-${client}`,
|
|
261
|
+
year: monthRow.year,
|
|
262
|
+
month: monthRow.month,
|
|
263
|
+
client,
|
|
264
|
+
orders: completedOrders.filter(order => order.client === client && order.date.getFullYear() === monthRow.year && order.date.getMonth() === MONTH_NAMES.indexOf(monthRow.month)).length
|
|
265
|
+
})).filter(row => row.orders > 0));
|
|
266
|
+
const therapistCounts = countBy(completedOrders, order => order.therapist);
|
|
267
|
+
const topTherapist = Object.entries(therapistCounts).sort((a, b) => b[1] - a[1])[0];
|
|
268
|
+
const topClientRows = clientRows.slice(0, 8);
|
|
269
|
+
return /*#__PURE__*/React.createElement("section", {
|
|
270
|
+
className: "analytics-by-client"
|
|
271
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
272
|
+
className: "analytics-header"
|
|
273
|
+
}, /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("h2", null, "WorkOrder analytics by client"), /*#__PURE__*/React.createElement("p", null, "Completed WorkOrders grouped by client, year, and month."), /*#__PURE__*/React.createElement("small", {
|
|
274
|
+
className: "analytics-source"
|
|
275
|
+
}, "Source: ", /*#__PURE__*/React.createElement("code", null, endpoint), " \xB7 Completed status only")), /*#__PURE__*/React.createElement("div", {
|
|
276
|
+
className: "analytics-header-actions"
|
|
277
|
+
}, loading && /*#__PURE__*/React.createElement("span", {
|
|
278
|
+
className: "analytics-status"
|
|
279
|
+
}, "Loading..."), !loading && /*#__PURE__*/React.createElement("button", {
|
|
280
|
+
type: "button",
|
|
281
|
+
className: "analytics-refresh",
|
|
282
|
+
onClick: () => setRefreshToken(value => value + 1)
|
|
283
|
+
}, "Refresh data"))), error && /*#__PURE__*/React.createElement("div", {
|
|
284
|
+
className: "analytics-error",
|
|
285
|
+
role: "alert"
|
|
286
|
+
}, error), !loading && /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("div", {
|
|
287
|
+
className: "analytics-summary-grid"
|
|
288
|
+
}, /*#__PURE__*/React.createElement(SummaryCard, {
|
|
289
|
+
label: "Completed WorkOrders",
|
|
290
|
+
value: formatNumber(completedOrders.length)
|
|
291
|
+
}), /*#__PURE__*/React.createElement(SummaryCard, {
|
|
292
|
+
label: "Clients",
|
|
293
|
+
value: formatNumber(Object.keys(clientCounts).length)
|
|
294
|
+
}), /*#__PURE__*/React.createElement(SummaryCard, {
|
|
295
|
+
label: `${currentYear} orders`,
|
|
296
|
+
value: formatNumber(yearRows.find(row => row.year === currentYear)?.orders || 0)
|
|
297
|
+
}), /*#__PURE__*/React.createElement(SummaryCard, {
|
|
298
|
+
label: "Top therapist",
|
|
299
|
+
value: topTherapist?.[0] || "-",
|
|
300
|
+
detail: topTherapist ? `${formatNumber(topTherapist[1])} orders` : ""
|
|
301
|
+
})), /*#__PURE__*/React.createElement("div", {
|
|
302
|
+
className: "analytics-grid"
|
|
303
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
304
|
+
className: "analytics-panel"
|
|
305
|
+
}, /*#__PURE__*/React.createElement("h3", null, "Completed orders by year"), /*#__PURE__*/React.createElement(BarChart, {
|
|
306
|
+
rows: yearRows,
|
|
307
|
+
labelKey: "year",
|
|
308
|
+
valueKey: "orders"
|
|
309
|
+
})), /*#__PURE__*/React.createElement("div", {
|
|
310
|
+
className: "analytics-panel"
|
|
311
|
+
}, /*#__PURE__*/React.createElement("h3", null, "Top clients"), /*#__PURE__*/React.createElement(BarChart, {
|
|
312
|
+
rows: topClientRows,
|
|
313
|
+
labelKey: "client",
|
|
314
|
+
valueKey: "orders",
|
|
315
|
+
color: "#646cff"
|
|
316
|
+
}))), /*#__PURE__*/React.createElement("div", {
|
|
317
|
+
className: "analytics-panel"
|
|
318
|
+
}, /*#__PURE__*/React.createElement("h3", null, "Monthly trend"), monthRows.length ? /*#__PURE__*/React.createElement(MonthlyChart, {
|
|
319
|
+
rows: monthRows,
|
|
320
|
+
onMonthClick: setSelectedMonth
|
|
321
|
+
}) : /*#__PURE__*/React.createElement("p", {
|
|
322
|
+
className: "analytics-empty"
|
|
323
|
+
}, "No monthly data available.")), /*#__PURE__*/React.createElement("div", {
|
|
324
|
+
className: "analytics-grid"
|
|
325
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
326
|
+
className: "analytics-panel"
|
|
327
|
+
}, /*#__PURE__*/React.createElement("h3", null, "Totals by year"), /*#__PURE__*/React.createElement(AnalyticsTable, {
|
|
328
|
+
columns: [{
|
|
329
|
+
key: "year",
|
|
330
|
+
label: "Year"
|
|
331
|
+
}, {
|
|
332
|
+
key: "orders",
|
|
333
|
+
label: "Work orders",
|
|
334
|
+
render: row => formatNumber(row.orders)
|
|
335
|
+
}],
|
|
336
|
+
rows: yearRows
|
|
337
|
+
})), /*#__PURE__*/React.createElement("div", {
|
|
338
|
+
className: "analytics-panel"
|
|
339
|
+
}, /*#__PURE__*/React.createElement("h3", null, "Totals by month"), /*#__PURE__*/React.createElement(AnalyticsTable, {
|
|
340
|
+
columns: [{
|
|
341
|
+
key: "year",
|
|
342
|
+
label: "Year"
|
|
343
|
+
}, {
|
|
344
|
+
key: "month",
|
|
345
|
+
label: "Month",
|
|
346
|
+
render: row => /*#__PURE__*/React.createElement("button", {
|
|
347
|
+
type: "button",
|
|
348
|
+
className: "analytics-date-button",
|
|
349
|
+
onClick: () => setSelectedMonth(row)
|
|
350
|
+
}, row.month, " ", row.year)
|
|
351
|
+
}, {
|
|
352
|
+
key: "orders",
|
|
353
|
+
label: "Work orders",
|
|
354
|
+
render: row => formatNumber(row.orders)
|
|
355
|
+
}],
|
|
356
|
+
rows: monthRows
|
|
357
|
+
}))), /*#__PURE__*/React.createElement("div", {
|
|
358
|
+
className: "analytics-panel"
|
|
359
|
+
}, /*#__PURE__*/React.createElement("h3", null, "Totals by client"), /*#__PURE__*/React.createElement(AnalyticsTable, {
|
|
360
|
+
columns: [{
|
|
361
|
+
key: "client",
|
|
362
|
+
label: "Client"
|
|
363
|
+
}, {
|
|
364
|
+
key: "orders",
|
|
365
|
+
label: "Work orders",
|
|
366
|
+
render: row => formatNumber(row.orders)
|
|
367
|
+
}, {
|
|
368
|
+
key: "share",
|
|
369
|
+
label: "Share of completed orders"
|
|
370
|
+
}],
|
|
371
|
+
rows: clientRows
|
|
372
|
+
})), /*#__PURE__*/React.createElement("div", {
|
|
373
|
+
className: "analytics-grid"
|
|
374
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
375
|
+
className: "analytics-panel"
|
|
376
|
+
}, /*#__PURE__*/React.createElement("h3", null, "Work orders per client by year"), /*#__PURE__*/React.createElement(AnalyticsTable, {
|
|
377
|
+
columns: [{
|
|
378
|
+
key: "client",
|
|
379
|
+
label: "Client"
|
|
380
|
+
}, ...years.map(year => ({
|
|
381
|
+
key: year,
|
|
382
|
+
label: String(year),
|
|
383
|
+
render: row => formatNumber(row[year])
|
|
384
|
+
})), {
|
|
385
|
+
key: "total",
|
|
386
|
+
label: "Total",
|
|
387
|
+
render: row => formatNumber(row.total)
|
|
388
|
+
}],
|
|
389
|
+
rows: clientYearRows
|
|
390
|
+
})), /*#__PURE__*/React.createElement("div", {
|
|
391
|
+
className: "analytics-panel"
|
|
392
|
+
}, /*#__PURE__*/React.createElement("h3", null, "Work orders per client by month"), /*#__PURE__*/React.createElement(AnalyticsTable, {
|
|
393
|
+
columns: [{
|
|
394
|
+
key: "year",
|
|
395
|
+
label: "Year"
|
|
396
|
+
}, {
|
|
397
|
+
key: "month",
|
|
398
|
+
label: "Month"
|
|
399
|
+
}, {
|
|
400
|
+
key: "client",
|
|
401
|
+
label: "Client"
|
|
402
|
+
}, {
|
|
403
|
+
key: "orders",
|
|
404
|
+
label: "Work orders",
|
|
405
|
+
render: row => formatNumber(row.orders)
|
|
406
|
+
}],
|
|
407
|
+
rows: clientMonthRows
|
|
408
|
+
}))), /*#__PURE__*/React.createElement(MonthDetailsModal, {
|
|
409
|
+
month: selectedMonth,
|
|
410
|
+
orders: selectedMonth ? completedOrders.filter(order => order.date.getFullYear() === selectedMonth.year && order.date.getMonth() === selectedMonth.monthIndex) : [],
|
|
411
|
+
onClose: () => setSelectedMonth(null)
|
|
412
|
+
})));
|
|
413
|
+
}
|
|
414
|
+
|
|
415
|
+
exports.COMPLETED_STATUS_ID = COMPLETED_STATUS_ID;
|
|
416
|
+
exports.default = WorkOrderAnalyticsByClient;
|
|
417
|
+
//# sourceMappingURL=WorkOrderAnalyticsByClient.cjs.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"WorkOrderAnalyticsByClient.cjs.js","sources":["../src/components/WorkOrderAnalyticsByClient.jsx"],"sourcesContent":["import React, { useEffect, useMemo, useState } from \"react\";\r\n\r\nconst COMPLETED_STATUS_ID = \"3a861ce5-dfd5-451d-81f3-7e90788eff18\";\r\nconst MONTH_NAMES = [\r\n \"January\", \"February\", \"March\", \"April\", \"May\", \"June\",\r\n \"July\", \"August\", \"September\", \"October\", \"November\", \"December\"\r\n];\r\n\r\nfunction getDocuments(payload) {\r\n if (Array.isArray(payload)) return payload;\r\n if (Array.isArray(payload?.data)) return payload.data;\r\n if (Array.isArray(payload?.documents)) return payload.documents;\r\n if (Array.isArray(payload?.items)) return payload.items;\r\n if (Array.isArray(payload?.results)) return payload.results;\r\n return [];\r\n}\r\n\r\nfunction parseDateValue(raw) {\r\n if (raw === undefined || raw === null || raw === \"\") return null;\r\n const timestamp = typeof raw === \"number\"\r\n ? (raw >= 1e12 ? raw : raw * 1000)\r\n : (typeof raw === \"string\" && /^\\d+$/.test(raw.trim())\r\n ? (Number(raw) >= 1e12 ? Number(raw) : Number(raw) * 1000)\r\n : raw);\r\n const date = new Date(timestamp);\r\n return Number.isNaN(date.getTime()) ? null : date;\r\n}\r\n\r\nfunction getWorkOrderDate(document) {\r\n const value = document.completedAt || document.completedDate || document.createdAt\r\n || document.createdOn || document.creationDate || document.date || document.startDate || document.updatedAt;\r\n return parseDateValue(value);\r\n}\r\n\r\nfunction getClientName(document) {\r\n return document.clientLabel || document.clientName || document.clientId || \"Unknown client\";\r\n}\r\n\r\nfunction getTherapistName(document) {\r\n return document.therapistLabel || document.therapistName || document.therapistId || \"Unknown therapist\";\r\n}\r\n\r\nfunction isFutureCalendarDate(date, referenceDate) {\r\n const dateKey = date.getFullYear() * 10000 + (date.getMonth() + 1) * 100 + date.getDate();\r\n const referenceKey = referenceDate.getFullYear() * 10000\r\n + (referenceDate.getMonth() + 1) * 100\r\n + referenceDate.getDate();\r\n return dateKey > referenceKey;\r\n}\r\n\r\nfunction countBy(items, getKey) {\r\n return items.reduce((counts, item) => {\r\n const key = getKey(item);\r\n counts[key] = (counts[key] || 0) + 1;\r\n return counts;\r\n }, {});\r\n}\r\n\r\nfunction formatNumber(value) {\r\n return new Intl.NumberFormat().format(value);\r\n}\r\n\r\nfunction SummaryCard({ label, value, detail }) {\r\n return (\r\n <div className=\"analytics-summary-card\">\r\n <span className=\"analytics-summary-label\">{label}</span>\r\n <strong className=\"analytics-summary-value\">{value}</strong>\r\n {detail && <span className=\"analytics-summary-detail\">{detail}</span>}\r\n </div>\r\n );\r\n}\r\n\r\nfunction BarChart({ rows, labelKey, valueKey, color = \"#2995A3\" }) {\r\n const maximum = Math.max(...rows.map((row) => row[valueKey]), 1);\r\n return (\r\n <div className=\"analytics-bar-chart\">\r\n {rows.map((row) => (\r\n <div className=\"analytics-bar-row\" key={row.key || row[labelKey]}>\r\n <span className=\"analytics-bar-label\" title={row[labelKey]}>{row[labelKey]}</span>\r\n <span className=\"analytics-bar-track\">\r\n <span className=\"analytics-bar-fill\" style={{ width: `${(row[valueKey] / maximum) * 100}%`, backgroundColor: color }} />\r\n </span>\r\n <strong>{formatNumber(row[valueKey])}</strong>\r\n </div>\r\n ))}\r\n </div>\r\n );\r\n}\r\n\r\nfunction MonthlyChart({ rows, onMonthClick }) {\r\n const maximum = Math.max(...rows.map((row) => row.orders), 1);\r\n return (\r\n <div className=\"analytics-month-chart\" role=\"img\" aria-label=\"Completed WorkOrders by month\">\r\n {rows.map((row) => (\r\n <button type=\"button\" className=\"analytics-month-column\" key={row.key} onClick={() => onMonthClick(row)} title={`Open ${row.month} ${row.year} details`}>\r\n <span className=\"analytics-month-value\">{row.orders}</span>\r\n <span className=\"analytics-month-bar\" style={{ height: `${Math.max((row.orders / maximum) * 100, 3)}%` }} />\r\n <span className=\"analytics-month-label\">{row.month.slice(0, 3)} {row.year}</span>\r\n </button>\r\n ))}\r\n </div>\r\n );\r\n}\r\n\r\nfunction AnalyticsTable({ columns, rows, emptyMessage = \"No completed WorkOrders found.\" }) {\r\n return (\r\n <div className=\"analytics-table-wrap\">\r\n <table className=\"analytics-table\">\r\n <thead>\r\n <tr>{columns.map((column) => <th key={column.key}>{column.label}</th>)}</tr>\r\n </thead>\r\n <tbody>\r\n {rows.length === 0 ? (\r\n <tr><td colSpan={columns.length} className=\"analytics-empty\">{emptyMessage}</td></tr>\r\n ) : rows.map((row, index) => (\r\n <tr key={row.key || index}>\r\n {columns.map((column) => <td key={column.key}>{column.render ? column.render(row) : row[column.key]}</td>)}\r\n </tr>\r\n ))}\r\n </tbody>\r\n </table>\r\n </div>\r\n );\r\n}\r\n\r\nfunction getWorkOrderLabel(order) {\r\n return order.workOrderLabel || order.documentNumber || order.orderNumber || order.name || order.id || \"WorkOrder\";\r\n}\r\n\r\nfunction getWorkOrderHref(order) {\r\n return order.url || order.link || order.href || (order.id ? `/work-orders/${order.id}` : null);\r\n}\r\n\r\nfunction MonthDetailsModal({ month, orders, onClose }) {\r\n if (!month) return null;\r\n return (\r\n <div className=\"analytics-modal-backdrop\" role=\"presentation\" onClick={onClose}>\r\n <div className=\"analytics-modal\" role=\"dialog\" aria-modal=\"true\" aria-labelledby=\"month-details-title\" onClick={(event) => event.stopPropagation()}>\r\n <div className=\"analytics-modal-header\">\r\n <h3 id=\"month-details-title\">{month.month} {month.year} WorkOrders</h3>\r\n <button type=\"button\" className=\"analytics-modal-close\" onClick={onClose} aria-label=\"Close\">×</button>\r\n </div>\r\n <p>{orders.length} completed WorkOrder{orders.length === 1 ? \"\" : \"s\"} in this month.</p>\r\n <div className=\"analytics-modal-list\">\r\n {orders.length === 0 ? <div className=\"analytics-empty\">No WorkOrders found.</div> : orders.map((order, index) => {\r\n const href = getWorkOrderHref(order);\r\n const label = getWorkOrderLabel(order);\r\n return (\r\n <div className=\"analytics-work-order-item\" key={order.id || `${label}-${index}`}>\r\n {href ? (\r\n <a href={href} target=\"_blank\" rel=\"noreferrer\">{label}</a>\r\n ) : (\r\n <strong>{label}</strong>\r\n )}\r\n <span>{order.client} · {order.therapist}</span>\r\n {order.date && <small>{order.date.toLocaleDateString()}</small>}\r\n </div>\r\n );\r\n })}\r\n </div>\r\n </div>\r\n </div>\r\n );\r\n}\r\n\r\nexport default function WorkOrderAnalyticsByClient({\r\n endpoint = \"/api/documents?type=WorkOrder\",\r\n fetchDocuments,\r\n currentDate = new Date()\r\n}) {\r\n const [documents, setDocuments] = useState([]);\r\n const [loading, setLoading] = useState(true);\r\n const [error, setError] = useState(\"\");\r\n const [refreshToken, setRefreshToken] = useState(0);\r\n const [selectedMonth, setSelectedMonth] = useState(null);\r\n\r\n useEffect(() => {\r\n let cancelled = false;\r\n const loadDocuments = async () => {\r\n setLoading(true);\r\n setError(\"\");\r\n try {\r\n const result = fetchDocuments\r\n ? await fetchDocuments()\r\n : await fetch(endpoint, { headers: { \"Content-Type\": \"application/json\" } }).then((response) => {\r\n if (!response.ok) throw new Error(`Request failed (${response.status})`);\r\n return response.json();\r\n });\r\n if (!cancelled) setDocuments(getDocuments(result));\r\n } catch (loadError) {\r\n if (!cancelled) setError(loadError.message || \"Unable to load WorkOrders.\");\r\n } finally {\r\n if (!cancelled) setLoading(false);\r\n }\r\n };\r\n loadDocuments();\r\n return () => { cancelled = true; };\r\n }, [endpoint, fetchDocuments, refreshToken]);\r\n\r\n const completedOrders = useMemo(() => documents\r\n .filter((document) => document.type === \"WorkOrder\" || document.documentType === \"WorkOrder\" || !document.type)\r\n .filter((document) => document.statusId === COMPLETED_STATUS_ID)\r\n .map((document) => ({ ...document, date: getWorkOrderDate(document), client: getClientName(document), therapist: getTherapistName(document) }))\r\n .filter((document) => document.date && !isFutureCalendarDate(document.date, currentDate)), [documents, currentDate]);\r\n\r\n const currentYear = currentDate.getFullYear();\r\n const years = useMemo(() => [...new Set(completedOrders.map((order) => order.date.getFullYear()))].sort((a, b) => b - a), [completedOrders]);\r\n const yearRows = years.map((year) => ({\r\n key: year,\r\n year,\r\n orders: completedOrders.filter((order) => order.date.getFullYear() === year).length\r\n }));\r\n const monthRows = [...new Set(completedOrders.map((order) => `${order.date.getFullYear()}-${order.date.getMonth()}`))]\r\n .map((key) => {\r\n const [year, monthIndex] = key.split(\"-\").map(Number);\r\n return {\r\n key,\r\n year,\r\n month: MONTH_NAMES[monthIndex],\r\n monthIndex,\r\n orders: completedOrders.filter((order) => order.date.getFullYear() === year && order.date.getMonth() === monthIndex).length\r\n };\r\n })\r\n .sort((a, b) => b.year - a.year || MONTH_NAMES.indexOf(a.month) - MONTH_NAMES.indexOf(b.month));\r\n const clientCounts = countBy(completedOrders, (order) => order.client);\r\n const clientRows = Object.entries(clientCounts)\r\n .map(([client, orders]) => ({ key: client, client, orders, share: completedOrders.length ? `${Math.round((orders / completedOrders.length) * 100)}%` : \"0%\" }))\r\n .sort((a, b) => b.orders - a.orders || a.client.localeCompare(b.client));\r\n const clientYearRows = Object.entries(clientCounts)\r\n .map(([client]) => {\r\n const row = { key: client, client };\r\n years.forEach((year) => {\r\n row[year] = completedOrders.filter((order) => order.client === client && order.date.getFullYear() === year).length;\r\n });\r\n row.total = clientCounts[client];\r\n return row;\r\n })\r\n .sort((a, b) => b.total - a.total || a.client.localeCompare(b.client));\r\n const clientMonthRows = monthRows.flatMap((monthRow) => Object.entries(clientCounts)\r\n .map(([client]) => ({\r\n key: `${monthRow.key}-${client}`,\r\n year: monthRow.year,\r\n month: monthRow.month,\r\n client,\r\n orders: completedOrders.filter((order) => order.client === client\r\n && order.date.getFullYear() === monthRow.year\r\n && order.date.getMonth() === MONTH_NAMES.indexOf(monthRow.month)).length\r\n }))\r\n .filter((row) => row.orders > 0));\r\n const therapistCounts = countBy(completedOrders, (order) => order.therapist);\r\n const topTherapist = Object.entries(therapistCounts).sort((a, b) => b[1] - a[1])[0];\r\n const topClientRows = clientRows.slice(0, 8);\r\n\r\n return (\r\n <section className=\"analytics-by-client\">\r\n <div className=\"analytics-header\">\r\n <div>\r\n <h2>WorkOrder analytics by client</h2>\r\n <p>Completed WorkOrders grouped by client, year, and month.</p>\r\n <small className=\"analytics-source\">Source: <code>{endpoint}</code> · Completed status only</small>\r\n </div>\r\n <div className=\"analytics-header-actions\">\r\n {loading && <span className=\"analytics-status\">Loading...</span>}\r\n {!loading && <button type=\"button\" className=\"analytics-refresh\" onClick={() => setRefreshToken((value) => value + 1)}>Refresh data</button>}\r\n </div>\r\n </div>\r\n {error && <div className=\"analytics-error\" role=\"alert\">{error}</div>}\r\n {!loading && (\r\n <>\r\n <div className=\"analytics-summary-grid\">\r\n <SummaryCard label=\"Completed WorkOrders\" value={formatNumber(completedOrders.length)} />\r\n <SummaryCard label=\"Clients\" value={formatNumber(Object.keys(clientCounts).length)} />\r\n <SummaryCard label={`${currentYear} orders`} value={formatNumber(yearRows.find((row) => row.year === currentYear)?.orders || 0)} />\r\n <SummaryCard label=\"Top therapist\" value={topTherapist?.[0] || \"-\"} detail={topTherapist ? `${formatNumber(topTherapist[1])} orders` : \"\"} />\r\n </div>\r\n <div className=\"analytics-grid\">\r\n <div className=\"analytics-panel\">\r\n <h3>Completed orders by year</h3>\r\n <BarChart rows={yearRows} labelKey=\"year\" valueKey=\"orders\" />\r\n </div>\r\n <div className=\"analytics-panel\">\r\n <h3>Top clients</h3>\r\n <BarChart rows={topClientRows} labelKey=\"client\" valueKey=\"orders\" color=\"#646cff\" />\r\n </div>\r\n </div>\r\n <div className=\"analytics-panel\">\r\n <h3>Monthly trend</h3>\r\n {monthRows.length ? <MonthlyChart rows={monthRows} onMonthClick={setSelectedMonth} /> : <p className=\"analytics-empty\">No monthly data available.</p>}\r\n </div>\r\n <div className=\"analytics-grid\">\r\n <div className=\"analytics-panel\">\r\n <h3>Totals by year</h3>\r\n <AnalyticsTable columns={[\r\n { key: \"year\", label: \"Year\" },\r\n { key: \"orders\", label: \"Work orders\", render: (row) => formatNumber(row.orders) }\r\n ]} rows={yearRows} />\r\n </div>\r\n <div className=\"analytics-panel\">\r\n <h3>Totals by month</h3>\r\n <AnalyticsTable columns={[\r\n { key: \"year\", label: \"Year\" },\r\n { key: \"month\", label: \"Month\", render: (row) => (\r\n <button type=\"button\" className=\"analytics-date-button\" onClick={() => setSelectedMonth(row)}>{row.month} {row.year}</button>\r\n ) },\r\n { key: \"orders\", label: \"Work orders\", render: (row) => formatNumber(row.orders) }\r\n ]} rows={monthRows} />\r\n </div>\r\n </div>\r\n <div className=\"analytics-panel\">\r\n <h3>Totals by client</h3>\r\n <AnalyticsTable columns={[\r\n { key: \"client\", label: \"Client\" },\r\n { key: \"orders\", label: \"Work orders\", render: (row) => formatNumber(row.orders) },\r\n { key: \"share\", label: \"Share of completed orders\" }\r\n ]} rows={clientRows} />\r\n </div>\r\n <div className=\"analytics-grid\">\r\n <div className=\"analytics-panel\">\r\n <h3>Work orders per client by year</h3>\r\n <AnalyticsTable columns={[\r\n { key: \"client\", label: \"Client\" },\r\n ...years.map((year) => ({ key: year, label: String(year), render: (row) => formatNumber(row[year]) })),\r\n { key: \"total\", label: \"Total\", render: (row) => formatNumber(row.total) }\r\n ]} rows={clientYearRows} />\r\n </div>\r\n <div className=\"analytics-panel\">\r\n <h3>Work orders per client by month</h3>\r\n <AnalyticsTable columns={[\r\n { key: \"year\", label: \"Year\" },\r\n { key: \"month\", label: \"Month\" },\r\n { key: \"client\", label: \"Client\" },\r\n { key: \"orders\", label: \"Work orders\", render: (row) => formatNumber(row.orders) }\r\n ]} rows={clientMonthRows} />\r\n </div>\r\n </div>\r\n <MonthDetailsModal\r\n month={selectedMonth}\r\n orders={selectedMonth ? completedOrders.filter((order) => order.date.getFullYear() === selectedMonth.year && order.date.getMonth() === selectedMonth.monthIndex) : []}\r\n onClose={() => setSelectedMonth(null)}\r\n />\r\n </>\r\n )}\r\n </section>\r\n );\r\n}\r\n\r\nexport { COMPLETED_STATUS_ID };\r\n"],"names":["COMPLETED_STATUS_ID","MONTH_NAMES","getDocuments","payload","Array","isArray","data","documents","items","results","parseDateValue","raw","undefined","timestamp","test","trim","Number","date","Date","isNaN","getTime","getWorkOrderDate","document","value","completedAt","completedDate","createdAt","createdOn","creationDate","startDate","updatedAt","getClientName","clientLabel","clientName","clientId","getTherapistName","therapistLabel","therapistName","therapistId","isFutureCalendarDate","referenceDate","dateKey","getFullYear","getMonth","getDate","referenceKey","countBy","getKey","reduce","counts","item","key","formatNumber","Intl","NumberFormat","format","SummaryCard","label","detail","React","createElement","className","BarChart","rows","labelKey","valueKey","color","maximum","Math","max","map","row","title","style","width","backgroundColor","MonthlyChart","onMonthClick","orders","role","type","onClick","month","year","height","slice","AnalyticsTable","columns","emptyMessage","column","length","colSpan","index","render","getWorkOrderLabel","order","workOrderLabel","documentNumber","orderNumber","name","id","getWorkOrderHref","url","link","href","MonthDetailsModal","onClose","event","stopPropagation","target","rel","client","therapist","toLocaleDateString","WorkOrderAnalyticsByClient","endpoint","fetchDocuments","currentDate","setDocuments","useState","loading","setLoading","error","setError","refreshToken","setRefreshToken","selectedMonth","setSelectedMonth","useEffect","cancelled","loadDocuments","result","fetch","headers","then","response","ok","Error","status","json","loadError","message","completedOrders","useMemo","filter","documentType","statusId","currentYear","years","Set","sort","a","b","yearRows","monthRows","monthIndex","split","indexOf","clientCounts","clientRows","Object","entries","share","round","localeCompare","clientYearRows","forEach","total","clientMonthRows","flatMap","monthRow","therapistCounts","topTherapist","topClientRows","F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