@activecollab/components 2.0.576 → 2.0.578

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.
Files changed (156) hide show
  1. package/dist/cjs/presentation/myWork/MyWorkTasks.js +83 -30
  2. package/dist/cjs/presentation/myWork/MyWorkTasks.js.map +1 -1
  3. package/dist/cjs/presentation/myWork/agendaGrid.js +1095 -0
  4. package/dist/cjs/presentation/myWork/agendaGrid.js.map +1 -0
  5. package/dist/cjs/presentation/reports/allReports.js +6 -0
  6. package/dist/cjs/presentation/reports/allReports.js.map +1 -1
  7. package/dist/cjs/presentation/reports/controls.js +6 -3
  8. package/dist/cjs/presentation/reports/controls.js.map +1 -1
  9. package/dist/cjs/presentation/reports/expenses.js +946 -0
  10. package/dist/cjs/presentation/reports/expenses.js.map +1 -0
  11. package/dist/cjs/presentation/shared/settings.js +6 -2
  12. package/dist/cjs/presentation/shared/settings.js.map +1 -1
  13. package/dist/cjs/presentation/shared/tokens.js +8 -1
  14. package/dist/cjs/presentation/shared/tokens.js.map +1 -1
  15. package/dist/cjs/presentation/timeboxes/AdjustmentList.js +31 -0
  16. package/dist/cjs/presentation/timeboxes/AdjustmentList.js.map +1 -0
  17. package/dist/cjs/presentation/timeboxes/AgendaDayView.js +1722 -0
  18. package/dist/cjs/presentation/timeboxes/AgendaDayView.js.map +1 -0
  19. package/dist/cjs/presentation/timeboxes/CapacityBar.js +54 -0
  20. package/dist/cjs/presentation/timeboxes/CapacityBar.js.map +1 -0
  21. package/dist/cjs/presentation/timeboxes/SimulationCard.js +47 -0
  22. package/dist/cjs/presentation/timeboxes/SimulationCard.js.map +1 -0
  23. package/dist/cjs/presentation/timeboxes/SimulationPanel.js +319 -0
  24. package/dist/cjs/presentation/timeboxes/SimulationPanel.js.map +1 -0
  25. package/dist/cjs/presentation/timeboxes/TimeRecordsSection.js +206 -0
  26. package/dist/cjs/presentation/timeboxes/TimeRecordsSection.js.map +1 -0
  27. package/dist/cjs/presentation/timeboxes/WorkloadView.js +887 -0
  28. package/dist/cjs/presentation/timeboxes/WorkloadView.js.map +1 -0
  29. package/dist/cjs/presentation/timeboxes/__tests__/timeboxes.test.js +699 -0
  30. package/dist/cjs/presentation/timeboxes/__tests__/timeboxes.test.js.map +1 -0
  31. package/dist/cjs/presentation/timeboxes/changes.js +293 -0
  32. package/dist/cjs/presentation/timeboxes/changes.js.map +1 -0
  33. package/dist/cjs/presentation/timeboxes/mockData.js +320 -0
  34. package/dist/cjs/presentation/timeboxes/mockData.js.map +1 -0
  35. package/dist/cjs/presentation/timeboxes/model.js +186 -0
  36. package/dist/cjs/presentation/timeboxes/model.js.map +1 -0
  37. package/dist/cjs/presentation/timeboxes/pillLook.js +72 -0
  38. package/dist/cjs/presentation/timeboxes/pillLook.js.map +1 -0
  39. package/dist/cjs/presentation/timeboxes/plan.js +181 -0
  40. package/dist/cjs/presentation/timeboxes/plan.js.map +1 -0
  41. package/dist/cjs/presentation/timeboxes/reducer.js +763 -0
  42. package/dist/cjs/presentation/timeboxes/reducer.js.map +1 -0
  43. package/dist/cjs/presentation/timeboxes/scheduler.js +147 -0
  44. package/dist/cjs/presentation/timeboxes/scheduler.js.map +1 -0
  45. package/dist/cjs/presentation/timeboxes/store.js +65 -0
  46. package/dist/cjs/presentation/timeboxes/store.js.map +1 -0
  47. package/dist/cjs/presentation/timeboxes/timeBlocks.js +1931 -0
  48. package/dist/cjs/presentation/timeboxes/timeBlocks.js.map +1 -0
  49. package/dist/cjs/presentation/timeboxes/timeboxSettings.js +369 -0
  50. package/dist/cjs/presentation/timeboxes/timeboxSettings.js.map +1 -0
  51. package/dist/cjs/presentation/timeboxes/tracked.js +189 -0
  52. package/dist/cjs/presentation/timeboxes/tracked.js.map +1 -0
  53. package/dist/esm/presentation/myWork/MyWorkTasks.d.ts +81 -1
  54. package/dist/esm/presentation/myWork/MyWorkTasks.d.ts.map +1 -1
  55. package/dist/esm/presentation/myWork/MyWorkTasks.js +76 -23
  56. package/dist/esm/presentation/myWork/MyWorkTasks.js.map +1 -1
  57. package/dist/esm/presentation/myWork/agendaGrid.d.ts +341 -0
  58. package/dist/esm/presentation/myWork/agendaGrid.d.ts.map +1 -0
  59. package/dist/esm/presentation/myWork/agendaGrid.js +1001 -0
  60. package/dist/esm/presentation/myWork/agendaGrid.js.map +1 -0
  61. package/dist/esm/presentation/reports/allReports.d.ts.map +1 -1
  62. package/dist/esm/presentation/reports/allReports.js +6 -0
  63. package/dist/esm/presentation/reports/allReports.js.map +1 -1
  64. package/dist/esm/presentation/reports/controls.d.ts +3 -1
  65. package/dist/esm/presentation/reports/controls.d.ts.map +1 -1
  66. package/dist/esm/presentation/reports/controls.js +6 -3
  67. package/dist/esm/presentation/reports/controls.js.map +1 -1
  68. package/dist/esm/presentation/reports/expenses.d.ts +62 -0
  69. package/dist/esm/presentation/reports/expenses.d.ts.map +1 -0
  70. package/dist/esm/presentation/reports/expenses.js +849 -0
  71. package/dist/esm/presentation/reports/expenses.js.map +1 -0
  72. package/dist/esm/presentation/shared/settings.d.ts +2 -0
  73. package/dist/esm/presentation/shared/settings.d.ts.map +1 -1
  74. package/dist/esm/presentation/shared/settings.js +5 -1
  75. package/dist/esm/presentation/shared/settings.js.map +1 -1
  76. package/dist/esm/presentation/shared/tokens.d.ts +6 -0
  77. package/dist/esm/presentation/shared/tokens.d.ts.map +1 -1
  78. package/dist/esm/presentation/shared/tokens.js +7 -0
  79. package/dist/esm/presentation/shared/tokens.js.map +1 -1
  80. package/dist/esm/presentation/timeboxes/AdjustmentList.d.ts +11 -0
  81. package/dist/esm/presentation/timeboxes/AdjustmentList.d.ts.map +1 -0
  82. package/dist/esm/presentation/timeboxes/AdjustmentList.js +22 -0
  83. package/dist/esm/presentation/timeboxes/AdjustmentList.js.map +1 -0
  84. package/dist/esm/presentation/timeboxes/AgendaDayView.d.ts +15 -0
  85. package/dist/esm/presentation/timeboxes/AgendaDayView.d.ts.map +1 -0
  86. package/dist/esm/presentation/timeboxes/AgendaDayView.js +1524 -0
  87. package/dist/esm/presentation/timeboxes/AgendaDayView.js.map +1 -0
  88. package/dist/esm/presentation/timeboxes/CapacityBar.d.ts +15 -0
  89. package/dist/esm/presentation/timeboxes/CapacityBar.d.ts.map +1 -0
  90. package/dist/esm/presentation/timeboxes/CapacityBar.js +48 -0
  91. package/dist/esm/presentation/timeboxes/CapacityBar.js.map +1 -0
  92. package/dist/esm/presentation/timeboxes/SimulationCard.d.ts +13 -0
  93. package/dist/esm/presentation/timeboxes/SimulationCard.d.ts.map +1 -0
  94. package/dist/esm/presentation/timeboxes/SimulationCard.js +41 -0
  95. package/dist/esm/presentation/timeboxes/SimulationCard.js.map +1 -0
  96. package/dist/esm/presentation/timeboxes/SimulationPanel.d.ts +18 -0
  97. package/dist/esm/presentation/timeboxes/SimulationPanel.d.ts.map +1 -0
  98. package/dist/esm/presentation/timeboxes/SimulationPanel.js +267 -0
  99. package/dist/esm/presentation/timeboxes/SimulationPanel.js.map +1 -0
  100. package/dist/esm/presentation/timeboxes/TimeRecordsSection.d.ts +14 -0
  101. package/dist/esm/presentation/timeboxes/TimeRecordsSection.d.ts.map +1 -0
  102. package/dist/esm/presentation/timeboxes/TimeRecordsSection.js +159 -0
  103. package/dist/esm/presentation/timeboxes/TimeRecordsSection.js.map +1 -0
  104. package/dist/esm/presentation/timeboxes/WorkloadView.d.ts +9 -0
  105. package/dist/esm/presentation/timeboxes/WorkloadView.d.ts.map +1 -0
  106. package/dist/esm/presentation/timeboxes/WorkloadView.js +761 -0
  107. package/dist/esm/presentation/timeboxes/WorkloadView.js.map +1 -0
  108. package/dist/esm/presentation/timeboxes/__tests__/timeboxes.test.d.ts +2 -0
  109. package/dist/esm/presentation/timeboxes/__tests__/timeboxes.test.d.ts.map +1 -0
  110. package/dist/esm/presentation/timeboxes/__tests__/timeboxes.test.js +640 -0
  111. package/dist/esm/presentation/timeboxes/__tests__/timeboxes.test.js.map +1 -0
  112. package/dist/esm/presentation/timeboxes/changes.d.ts +72 -0
  113. package/dist/esm/presentation/timeboxes/changes.d.ts.map +1 -0
  114. package/dist/esm/presentation/timeboxes/changes.js +224 -0
  115. package/dist/esm/presentation/timeboxes/changes.js.map +1 -0
  116. package/dist/esm/presentation/timeboxes/mockData.d.ts +16 -0
  117. package/dist/esm/presentation/timeboxes/mockData.d.ts.map +1 -0
  118. package/dist/esm/presentation/timeboxes/mockData.js +297 -0
  119. package/dist/esm/presentation/timeboxes/mockData.js.map +1 -0
  120. package/dist/esm/presentation/timeboxes/model.d.ts +136 -0
  121. package/dist/esm/presentation/timeboxes/model.d.ts.map +1 -0
  122. package/dist/esm/presentation/timeboxes/model.js +129 -0
  123. package/dist/esm/presentation/timeboxes/model.js.map +1 -0
  124. package/dist/esm/presentation/timeboxes/pillLook.d.ts +40 -0
  125. package/dist/esm/presentation/timeboxes/pillLook.d.ts.map +1 -0
  126. package/dist/esm/presentation/timeboxes/pillLook.js +65 -0
  127. package/dist/esm/presentation/timeboxes/pillLook.js.map +1 -0
  128. package/dist/esm/presentation/timeboxes/plan.d.ts +62 -0
  129. package/dist/esm/presentation/timeboxes/plan.d.ts.map +1 -0
  130. package/dist/esm/presentation/timeboxes/plan.js +116 -0
  131. package/dist/esm/presentation/timeboxes/plan.js.map +1 -0
  132. package/dist/esm/presentation/timeboxes/reducer.d.ts +203 -0
  133. package/dist/esm/presentation/timeboxes/reducer.d.ts.map +1 -0
  134. package/dist/esm/presentation/timeboxes/reducer.js +616 -0
  135. package/dist/esm/presentation/timeboxes/reducer.js.map +1 -0
  136. package/dist/esm/presentation/timeboxes/scheduler.d.ts +63 -0
  137. package/dist/esm/presentation/timeboxes/scheduler.d.ts.map +1 -0
  138. package/dist/esm/presentation/timeboxes/scheduler.js +120 -0
  139. package/dist/esm/presentation/timeboxes/scheduler.js.map +1 -0
  140. package/dist/esm/presentation/timeboxes/store.d.ts +23 -0
  141. package/dist/esm/presentation/timeboxes/store.d.ts.map +1 -0
  142. package/dist/esm/presentation/timeboxes/store.js +46 -0
  143. package/dist/esm/presentation/timeboxes/store.js.map +1 -0
  144. package/dist/esm/presentation/timeboxes/timeBlocks.d.ts +10 -0
  145. package/dist/esm/presentation/timeboxes/timeBlocks.d.ts.map +1 -0
  146. package/dist/esm/presentation/timeboxes/timeBlocks.js +1767 -0
  147. package/dist/esm/presentation/timeboxes/timeBlocks.js.map +1 -0
  148. package/dist/esm/presentation/timeboxes/timeboxSettings.d.ts +71 -0
  149. package/dist/esm/presentation/timeboxes/timeboxSettings.d.ts.map +1 -0
  150. package/dist/esm/presentation/timeboxes/timeboxSettings.js +302 -0
  151. package/dist/esm/presentation/timeboxes/timeboxSettings.js.map +1 -0
  152. package/dist/esm/presentation/timeboxes/tracked.d.ts +51 -0
  153. package/dist/esm/presentation/timeboxes/tracked.d.ts.map +1 -0
  154. package/dist/esm/presentation/timeboxes/tracked.js +136 -0
  155. package/dist/esm/presentation/timeboxes/tracked.js.map +1 -0
  156. package/package.json +1 -1
@@ -0,0 +1,849 @@
1
+ import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
2
+ import _extends from "@babel/runtime/helpers/esm/extends";
3
+ const _excluded = ["active", "label", "value", "icon", "open"];
4
+ import React, { forwardRef, useMemo, useState } from "react";
5
+ import moment from "moment-timezone";
6
+ import styled from "styled-components";
7
+ import { ExportButton, IntervalStepper, SortableColumnHeader, StyledControlGroup, StyledReportToolbar, toFilterData } from "./controls";
8
+ import { CURRENCIES, PROJECT_FILTER_OPTIONS } from "./data";
9
+ import { Chip } from "../../components/Chip";
10
+ import { Filter } from "../../components/Filter";
11
+ import { HeaderControls } from "../../components/HeaderControls";
12
+ import { IconButton } from "../../components/IconButton";
13
+ import { ArrowCollapseMultipleIcon, ArrowExpandeMultipleIcon, CollapseExpandSingleIcon, DollarIcon, GroupByIcon } from "../../components/Icons";
14
+ import { NoResultsSlate } from "../../components/NoResultsSlate";
15
+ import { Paper } from "../../components/Paper";
16
+ import { Select } from "../../components/Select";
17
+ import { Tooltip } from "../../components/Tooltip";
18
+ import { Body2, Caption1 } from "../../components/Typography";
19
+ import { ValueButton } from "../../components/ValueButton";
20
+ import { formatNumber } from "../../utils";
21
+ import { AVATAR_COLORS, FloatingControls, MD, PageHeader, PresentationShell, RoundAvatar } from "../shared";
22
+
23
+ /* ------------------------------------------------------------------ */
24
+ /* Mock data */
25
+ /* ------------------------------------------------------------------ */
26
+
27
+ /**
28
+ * mirrors: `/reports/run?type=TrackingFilter&type_filter=expenses` records
29
+ * (TrackingFilter::run): `group_id`/`group_name` carry the expense category,
30
+ * `value` is in the project currency, `billable_status` 0..3.
31
+ */
32
+
33
+ export const BILLABLE_STATUS_LABELS = {
34
+ 0: "Non-Billable",
35
+ 1: "Billable",
36
+ 2: "Pending Payment",
37
+ 3: "Paid"
38
+ };
39
+ export const EXPENSE_CATEGORIES = [{
40
+ id: 1,
41
+ name: "General"
42
+ }, {
43
+ id: 2,
44
+ name: "Travel"
45
+ }, {
46
+ id: 3,
47
+ name: "Software"
48
+ }, {
49
+ id: 4,
50
+ name: "Equipment"
51
+ }, {
52
+ id: 5,
53
+ name: "Meals"
54
+ }];
55
+ export const EXPENSE_PEOPLE = [{
56
+ id: 5,
57
+ name: "Daniel Osei",
58
+ initials: "DO",
59
+ color: AVATAR_COLORS.blue
60
+ }, {
61
+ id: 6,
62
+ name: "Sofia Marchetti",
63
+ initials: "SM",
64
+ color: AVATAR_COLORS.purple
65
+ }, {
66
+ id: 3,
67
+ name: "Joshua Reyes",
68
+ initials: "JR",
69
+ color: AVATAR_COLORS.green
70
+ }, {
71
+ id: 4,
72
+ name: "Priya Anand",
73
+ initials: "PA",
74
+ color: AVATAR_COLORS.orange
75
+ }];
76
+ export const EXPENSE_PROJECTS = [{
77
+ id: 131,
78
+ name: "Website Redesign",
79
+ client_id: 3,
80
+ client_name: "Lumière Coffee",
81
+ currency_id: 1
82
+ }, {
83
+ id: 140,
84
+ name: "Brand Refresh 2026",
85
+ client_id: 4,
86
+ client_name: "Verdano",
87
+ currency_id: 1
88
+ }, {
89
+ id: 152,
90
+ name: "Spring Campaign",
91
+ client_id: 14,
92
+ client_name: "Northwind Outfitters",
93
+ currency_id: 2
94
+ }, {
95
+ id: 160,
96
+ name: "Office & Operations",
97
+ client_id: 1,
98
+ client_name: "Internal",
99
+ currency_id: 1
100
+ }];
101
+ export const EXPENSES_2026 = [{
102
+ id: 1,
103
+ value: 49,
104
+ category_id: 3,
105
+ user_id: 5,
106
+ project_id: 131,
107
+ parent_type: "Task",
108
+ parent_name: "Design the icon set",
109
+ task_number: 48,
110
+ summary: "Icon font license for one year",
111
+ billable_status: 1,
112
+ record_date: "2026-09-28",
113
+ attachments_count: 1
114
+ }, {
115
+ id: 2,
116
+ value: 420,
117
+ category_id: 2,
118
+ user_id: 6,
119
+ project_id: 131,
120
+ parent_type: "Task",
121
+ parent_name: "On-site workshop with the client",
122
+ task_number: 51,
123
+ summary: "Train tickets Milan – Paris, return",
124
+ billable_status: 1,
125
+ record_date: "2026-09-24",
126
+ attachments_count: 2
127
+ }, {
128
+ id: 3,
129
+ value: 86.4,
130
+ category_id: 5,
131
+ user_id: 6,
132
+ project_id: 131,
133
+ parent_type: "Task",
134
+ parent_name: "On-site workshop with the client",
135
+ task_number: 51,
136
+ summary: "Lunch with the client team",
137
+ billable_status: 0,
138
+ record_date: "2026-09-24",
139
+ attachments_count: 1
140
+ }, {
141
+ id: 4,
142
+ value: 1250,
143
+ category_id: 1,
144
+ user_id: 5,
145
+ project_id: 131,
146
+ parent_type: "Project",
147
+ parent_name: "Website Redesign",
148
+ summary: "Stock photography bundle",
149
+ billable_status: 2,
150
+ record_date: "2026-09-10",
151
+ attachments_count: 1,
152
+ invoice_number: "27-2026"
153
+ }, {
154
+ id: 5,
155
+ value: 2400,
156
+ category_id: 1,
157
+ user_id: 3,
158
+ project_id: 140,
159
+ parent_type: "Task",
160
+ parent_name: "Print the brand book",
161
+ task_number: 12,
162
+ summary: "Print run, 200 copies",
163
+ billable_status: 3,
164
+ record_date: "2026-09-16",
165
+ attachments_count: 1,
166
+ invoice_number: "25-2026"
167
+ }, {
168
+ id: 6,
169
+ value: 180,
170
+ category_id: 3,
171
+ user_id: 3,
172
+ project_id: 140,
173
+ parent_type: "Task",
174
+ parent_name: "Typeface selection",
175
+ task_number: 7,
176
+ summary: "Font family license, desktop + web",
177
+ billable_status: 1,
178
+ record_date: "2026-09-21",
179
+ attachments_count: 0
180
+ }, {
181
+ id: 7,
182
+ value: 64,
183
+ category_id: 2,
184
+ user_id: 4,
185
+ project_id: 140,
186
+ parent_type: "Project",
187
+ parent_name: "Brand Refresh 2026",
188
+ summary: "Taxi to the photo shoot",
189
+ billable_status: 1,
190
+ record_date: "2026-09-22",
191
+ attachments_count: 1
192
+ }, {
193
+ id: 8,
194
+ value: 3200,
195
+ category_id: 4,
196
+ user_id: 4,
197
+ project_id: 152,
198
+ parent_type: "Task",
199
+ parent_name: "Product photo shoot",
200
+ task_number: 23,
201
+ summary: "Camera and lighting rental, 2 days",
202
+ billable_status: 1,
203
+ record_date: "2026-09-25",
204
+ attachments_count: 3
205
+ }, {
206
+ id: 9,
207
+ value: 540,
208
+ category_id: 2,
209
+ user_id: 4,
210
+ project_id: 152,
211
+ parent_type: "Task",
212
+ parent_name: "Product photo shoot",
213
+ task_number: 23,
214
+ summary: "Flight to Portland",
215
+ billable_status: 2,
216
+ record_date: "2026-09-12",
217
+ attachments_count: 1,
218
+ invoice_number: "26-2026"
219
+ }, {
220
+ id: 10,
221
+ value: 29,
222
+ category_id: 3,
223
+ user_id: 5,
224
+ project_id: 160,
225
+ parent_type: "Project",
226
+ parent_name: "Office & Operations",
227
+ summary: "Team password manager, monthly",
228
+ billable_status: 0,
229
+ record_date: "2026-09-01",
230
+ attachments_count: 0
231
+ }, {
232
+ id: 11,
233
+ value: 312.5,
234
+ category_id: 4,
235
+ user_id: 6,
236
+ project_id: 160,
237
+ parent_type: "Project",
238
+ parent_name: "Office & Operations",
239
+ summary: "Second monitor for the design desk",
240
+ billable_status: 0,
241
+ record_date: "2026-09-08",
242
+ attachments_count: 1
243
+ }];
244
+
245
+ /* ------------------------------------------------------------------ */
246
+ /* Lookups & grouping */
247
+ /* ------------------------------------------------------------------ */
248
+
249
+ /* mirrors: TrackingFilter group_by values that apply to expenses ("dont" = DataFilter::DONT_GROUP) */
250
+ export const EXPENSE_GROUP_BY_OPTIONS = [{
251
+ id: "dont",
252
+ name: "No Grouping"
253
+ }, {
254
+ id: "project",
255
+ name: "Project"
256
+ }, {
257
+ id: "project_client",
258
+ name: "Client"
259
+ }, {
260
+ id: "expense_category",
261
+ name: "Category"
262
+ }, {
263
+ id: "user",
264
+ name: "Person"
265
+ }, {
266
+ id: "billable_status",
267
+ name: "Status"
268
+ }];
269
+ const EXPENSE_INTERVAL_OPTIONS = [{
270
+ id: "monthly",
271
+ name: "Monthly"
272
+ }, {
273
+ id: "quarterly",
274
+ name: "Quarterly"
275
+ }, {
276
+ id: "yearly",
277
+ name: "Yearly"
278
+ }, {
279
+ id: "custom",
280
+ name: "Custom"
281
+ }];
282
+ export const EXPENSES_FILTER_DATA = [toFilterData("project", "Project", "projects", EXPENSE_PROJECTS.map(_ref => {
283
+ let id = _ref.id,
284
+ name = _ref.name;
285
+ return {
286
+ id,
287
+ name
288
+ };
289
+ })), toFilterData("client", "Client", "clients", PROJECT_FILTER_OPTIONS.client), toFilterData("category", "Category", "categories", EXPENSE_CATEGORIES), toFilterData("user", "Person", "people", EXPENSE_PEOPLE.map(_ref2 => {
290
+ let id = _ref2.id,
291
+ name = _ref2.name;
292
+ return {
293
+ id,
294
+ name
295
+ };
296
+ })), toFilterData("status", "Status", "status", Object.keys(BILLABLE_STATUS_LABELS).map(id => ({
297
+ id: Number(id),
298
+ name: BILLABLE_STATUS_LABELS[id]
299
+ })))];
300
+ const projectOf = id => {
301
+ var _EXPENSE_PROJECTS$fin;
302
+ return (_EXPENSE_PROJECTS$fin = EXPENSE_PROJECTS.find(project => project.id === id)) != null ? _EXPENSE_PROJECTS$fin : EXPENSE_PROJECTS[0];
303
+ };
304
+ const personOf = id => {
305
+ var _EXPENSE_PEOPLE$find;
306
+ return (_EXPENSE_PEOPLE$find = EXPENSE_PEOPLE.find(person => person.id === id)) != null ? _EXPENSE_PEOPLE$find : EXPENSE_PEOPLE[0];
307
+ };
308
+ const categoryOf = id => {
309
+ var _EXPENSE_CATEGORIES$f, _EXPENSE_CATEGORIES$f2;
310
+ return (_EXPENSE_CATEGORIES$f = (_EXPENSE_CATEGORIES$f2 = EXPENSE_CATEGORIES.find(category => category.id === id)) == null ? void 0 : _EXPENSE_CATEGORIES$f2.name) != null ? _EXPENSE_CATEGORIES$f : "";
311
+ };
312
+
313
+ /* The DS Filter keeps the selected option ids as strings per filter id. */
314
+ const selectedIds = (filter, key) => {
315
+ var _filter$key;
316
+ return ((_filter$key = filter[key]) != null ? _filter$key : []).map(Number);
317
+ };
318
+ const matchesFilter = (row, project, filter) => {
319
+ const checks = [["project", row.project_id], ["client", project.client_id], ["category", row.category_id], ["user", row.user_id], ["status", row.billable_status]];
320
+ return checks.every(_ref3 => {
321
+ let key = _ref3[0],
322
+ value = _ref3[1];
323
+ const ids = selectedIds(filter, key);
324
+ return ids.length === 0 || ids.includes(value);
325
+ });
326
+ };
327
+ const money = (value, currencyId) => CURRENCIES[currencyId].code + " " + formatNumber(value, ",", ".", false, CURRENCIES[currencyId].decimal_spaces, "short", 10000);
328
+ const sumByCurrency = rows => rows.reduce((totals, row) => {
329
+ var _totals$currencyId;
330
+ const currencyId = projectOf(row.project_id).currency_id;
331
+ totals[currencyId] = ((_totals$currencyId = totals[currencyId]) != null ? _totals$currencyId : 0) + row.value;
332
+ return totals;
333
+ }, {});
334
+ const totalsText = totals => Object.entries(totals).map(_ref4 => {
335
+ let currencyId = _ref4[0],
336
+ value = _ref4[1];
337
+ return money(value, Number(currencyId));
338
+ }).join(" + ");
339
+ const groupKeyAndLabel = (row, groupBy) => {
340
+ const project = projectOf(row.project_id);
341
+ switch (groupBy) {
342
+ case "dont":
343
+ return ["all", "All Expenses"];
344
+ case "project":
345
+ return ["project-" + project.id, project.name];
346
+ case "project_client":
347
+ return ["client-" + project.client_id, project.client_name];
348
+ case "expense_category":
349
+ return ["expense-category-" + row.category_id, categoryOf(row.category_id)];
350
+ case "user":
351
+ return ["user-" + row.user_id, personOf(row.user_id).name];
352
+ case "billable_status":
353
+ default:
354
+ return ["billable-status-" + row.billable_status, BILLABLE_STATUS_LABELS[row.billable_status]];
355
+ }
356
+ };
357
+ /* mirrors: client-side sortReportData of the Time/Payments reports */
358
+ const sortExpenses = (rows, sortBy, direction) => {
359
+ const sign = direction === "asc" ? 1 : -1;
360
+ const text = row => {
361
+ var _row$invoice_number;
362
+ const project = projectOf(row.project_id);
363
+ switch (sortBy) {
364
+ case "category":
365
+ return categoryOf(row.category_id);
366
+ case "summary":
367
+ return row.summary;
368
+ case "client":
369
+ return project.client_name;
370
+ case "project":
371
+ return project.name;
372
+ case "task":
373
+ return row.parent_type === "Task" ? row.parent_name : "";
374
+ case "invoice":
375
+ return (_row$invoice_number = row.invoice_number) != null ? _row$invoice_number : "";
376
+ case "record_date":
377
+ default:
378
+ return row.record_date;
379
+ }
380
+ };
381
+ return [...rows].sort((a, b) => {
382
+ if (sortBy === "value") {
383
+ return sign * (a.value - b.value);
384
+ }
385
+ if (sortBy === "status") {
386
+ return sign * (a.billable_status - b.billable_status);
387
+ }
388
+ const result = text(a).localeCompare(text(b));
389
+ return result !== 0 ? sign * result : b.record_date.localeCompare(a.record_date);
390
+ });
391
+ };
392
+ const groupExpenses = (rows, groupBy, sortBy, direction) => {
393
+ const groups = new Map();
394
+ rows.forEach(row => {
395
+ var _groups$get;
396
+ const _groupKeyAndLabel = groupKeyAndLabel(row, groupBy),
397
+ key = _groupKeyAndLabel[0],
398
+ label = _groupKeyAndLabel[1];
399
+ const group = (_groups$get = groups.get(key)) != null ? _groups$get : {
400
+ key,
401
+ label,
402
+ records: [],
403
+ totals: {}
404
+ };
405
+ group.records.push(row);
406
+ groups.set(key, group);
407
+ });
408
+ const list = Array.from(groups.values()).map(group => _extends({}, group, {
409
+ records: sortExpenses(group.records, sortBy, direction),
410
+ totals: sumByCurrency(group.records)
411
+ }));
412
+ if (groupBy === "billable_status") {
413
+ return list.sort((a, b) => a.key.localeCompare(b.key));
414
+ }
415
+ return list.sort((a, b) => a.label.localeCompare(b.label));
416
+ };
417
+
418
+ /* ------------------------------------------------------------------ */
419
+ /* Styles */
420
+ /* ------------------------------------------------------------------ */
421
+
422
+ const StyledExpenses = styled(Paper).withConfig({
423
+ displayName: "expenses__StyledExpenses",
424
+ componentId: "sc-e8k2o8-0"
425
+ })(["display:flex;flex-direction:column;height:100%;margin-bottom:32px;.results-toolbar{position:sticky;top:0;z-index:2;display:flex;align-items:center;justify-content:space-between;gap:8px;height:40px;margin:8px 8px 0;padding:0 8px;box-sizing:border-box;border-bottom:1px solid var(--border-primary);background-color:var(--page-paper-main);}.results-toolbar-left{display:flex;align-items:center;gap:8px;min-width:0;}.expand-all{margin-left:calc(var(--c-btn-inset) * -1);}.scroll{position:relative;display:grid;grid-template-columns:minmax(max-content,1fr);align-content:start;max-height:100%;margin:4px 8px;overflow:auto;}.group{width:max-content;min-width:100%;margin-bottom:8px;}.head,.row,.group-total{display:flex;align-items:center;gap:8px;height:40px;box-sizing:border-box;}.row{border-radius:8px;background-color:var(--page-paper-main);}.row.striped{background-color:var(--color-theme-200);}.first{position:sticky;left:0;z-index:1;display:flex;align-items:center;gap:8px;width:168px;flex-shrink:0;height:40px;padding:0 8px;box-sizing:border-box;border-radius:8px;background-color:inherit;}.head .first{background-color:var(--page-paper-main);cursor:pointer;}.head .first.static{cursor:default;}.head .first.collapsed{flex:1;width:auto;min-width:168px;}.head .first.collapsed .group-label .c-typography{max-width:none;}.head .first:hover .expander{fill:var(--color-primary);}.expander{width:24px;height:24px;flex-shrink:0;fill:var(--color-theme-600);transition:transform 200ms;}.expander.collapsed{transform:rotate(180deg);}.group-label{display:flex;align-items:center;gap:8px;min-width:0;}.count-chip{flex-shrink:0;}.cols{display:flex;align-items:center;gap:8px;height:40px;padding-right:8px;}.link{overflow:hidden;text-decoration:none;cursor:pointer;}.amount{display:flex;justify-content:flex-end;width:96px;flex-shrink:0;}.avatar{flex-shrink:0;}.w-category{width:120px;flex-shrink:0;}.w-description{display:flex;align-items:center;gap:4px;width:240px;flex:1;min-width:0;}.w-date{width:88px;flex-shrink:0;}.w-client,.w-project{width:144px;flex-shrink:0;}.w-task{width:184px;flex-shrink:0;}.w-invoice{width:96px;flex-shrink:0;}.w-status{display:flex;justify-content:flex-end;width:128px;flex-shrink:0;margin-left:auto;}.group-total{padding:0 8px;border-radius:8px;background-color:var(--page-paper-main);}.group-total.striped{background-color:var(--color-theme-200);}.group-total-label{position:sticky;left:8px;}.group-sum{position:sticky;right:8px;margin-left:auto;padding-right:8px;}.grand-total{display:flex;align-items:center;justify-content:space-between;padding:12px 8px;border-top:1px solid var(--border-primary);}.grand-total-label{position:sticky;left:8px;}.totals{display:flex;align-items:center;gap:16px;}"]);
426
+
427
+ /* ------------------------------------------------------------------ */
428
+ /* Pieces */
429
+ /* ------------------------------------------------------------------ */
430
+
431
+ /* UserProfileProjectsSortByPicker.js: a ValueButton that gives way to an icon button on narrow screens.
432
+ It collapses at MD, where the Filter CounterButton drops its label too. */
433
+ const StyledCollapsingValueButton = styled.div.withConfig({
434
+ displayName: "expenses__StyledCollapsingValueButton",
435
+ componentId: "sc-e8k2o8-1"
436
+ })(["display:flex;flex-shrink:0;.collapsed-trigger{display:none;}@media (max-width:", "){.c-value-button{display:none;}.collapsed-trigger{display:flex;}}"], MD);
437
+ const CollapsingValueButton = /*#__PURE__*/forwardRef((_ref5, ref) => {
438
+ let active = _ref5.active,
439
+ label = _ref5.label,
440
+ value = _ref5.value,
441
+ icon = _ref5.icon,
442
+ _ref5$open = _ref5.open,
443
+ open = _ref5$open === void 0 ? false : _ref5$open,
444
+ rest = _objectWithoutPropertiesLoose(_ref5, _excluded);
445
+ return /*#__PURE__*/React.createElement(StyledCollapsingValueButton, _extends({
446
+ ref: ref
447
+ }, rest), /*#__PURE__*/React.createElement(ValueButton, {
448
+ active: active || open,
449
+ label: label,
450
+ value: value
451
+ }), /*#__PURE__*/React.createElement(IconButton, {
452
+ className: "collapsed-trigger",
453
+ variant: "text gray",
454
+ active: active || open,
455
+ title: label,
456
+ "aria-label": label + ": " + value
457
+ }, icon));
458
+ });
459
+ CollapsingValueButton.displayName = "CollapsingValueButton";
460
+ const ExpenseRow = _ref6 => {
461
+ let row = _ref6.row,
462
+ striped = _ref6.striped,
463
+ columns = _ref6.columns;
464
+ const project = projectOf(row.project_id);
465
+ const person = personOf(row.user_id);
466
+ return /*#__PURE__*/React.createElement("div", {
467
+ className: striped ? "row striped" : "row"
468
+ }, /*#__PURE__*/React.createElement("div", {
469
+ className: "first"
470
+ }, /*#__PURE__*/React.createElement(Caption1, {
471
+ weight: "bold",
472
+ color: "secondary",
473
+ align: "right",
474
+ className: "amount",
475
+ title: formatNumber(row.value, ",", ".", false, 2)
476
+ }, money(row.value, project.currency_id)), /*#__PURE__*/React.createElement(Tooltip, {
477
+ title: person.name
478
+ }, /*#__PURE__*/React.createElement(RoundAvatar, {
479
+ $bg: person.color,
480
+ $size: 24,
481
+ className: "avatar"
482
+ }, person.initials))), /*#__PURE__*/React.createElement("div", {
483
+ className: "cols"
484
+ }, columns.category ? /*#__PURE__*/React.createElement(Body2, {
485
+ overflow: "truncate",
486
+ whitespace: "no-wrap",
487
+ className: "w-category"
488
+ }, categoryOf(row.category_id)) : null, /*#__PURE__*/React.createElement("span", {
489
+ className: "w-description"
490
+ }, /*#__PURE__*/React.createElement(Body2, {
491
+ overflow: "truncate",
492
+ whitespace: "no-wrap"
493
+ }, row.summary)), /*#__PURE__*/React.createElement(Caption1, {
494
+ align: "right",
495
+ overflow: "truncate",
496
+ whitespace: "no-wrap",
497
+ className: "w-date"
498
+ }, moment.utc(row.record_date).format("MMM D.")), columns.client ? /*#__PURE__*/React.createElement(Body2, {
499
+ overflow: "truncate",
500
+ whitespace: "no-wrap",
501
+ className: "w-client"
502
+ }, project.client_name) : null, columns.project ? /*#__PURE__*/React.createElement("a", {
503
+ className: "link w-project"
504
+ }, /*#__PURE__*/React.createElement(Body2, {
505
+ color: "theme-primary",
506
+ overflow: "truncate",
507
+ whitespace: "no-wrap"
508
+ }, project.name)) : null, columns.task ? row.parent_type === "Task" ? /*#__PURE__*/React.createElement("a", {
509
+ className: "link w-task"
510
+ }, /*#__PURE__*/React.createElement(Body2, {
511
+ color: "theme-primary",
512
+ overflow: "truncate",
513
+ whitespace: "no-wrap"
514
+ }, "#" + row.task_number + " " + row.parent_name)) : /*#__PURE__*/React.createElement(Body2, {
515
+ color: "tertiary",
516
+ className: "w-task"
517
+ }, "Project") : null, columns.invoice ? row.invoice_number ? /*#__PURE__*/React.createElement("a", {
518
+ className: "link w-invoice"
519
+ }, /*#__PURE__*/React.createElement(Body2, {
520
+ color: "theme-primary",
521
+ overflow: "truncate",
522
+ whitespace: "no-wrap"
523
+ }, row.invoice_number)) : /*#__PURE__*/React.createElement("span", {
524
+ className: "w-invoice"
525
+ }) : null, /*#__PURE__*/React.createElement("span", {
526
+ className: "w-status"
527
+ }, /*#__PURE__*/React.createElement(Body2, {
528
+ align: "right",
529
+ overflow: "truncate",
530
+ whitespace: "no-wrap"
531
+ }, BILLABLE_STATUS_LABELS[row.billable_status]))));
532
+ };
533
+ const GroupBlock = _ref7 => {
534
+ let group = _ref7.group,
535
+ expanded = _ref7.expanded,
536
+ onToggle = _ref7.onToggle,
537
+ columns = _ref7.columns,
538
+ sortBy = _ref7.sortBy,
539
+ direction = _ref7.direction,
540
+ onSort = _ref7.onSort,
541
+ _ref7$flat = _ref7.flat,
542
+ flat = _ref7$flat === void 0 ? false : _ref7$flat;
543
+ return /*#__PURE__*/React.createElement("div", {
544
+ className: "group"
545
+ }, /*#__PURE__*/React.createElement("div", {
546
+ className: "head"
547
+ }, /*#__PURE__*/React.createElement("div", {
548
+ className: ["first", flat ? "static" : "", !flat && !expanded ? "collapsed" : ""].join(" "),
549
+ onClick: flat ? undefined : onToggle
550
+ }, flat ? null : /*#__PURE__*/React.createElement(CollapseExpandSingleIcon, {
551
+ className: expanded ? "expander" : "expander collapsed"
552
+ }), /*#__PURE__*/React.createElement("span", {
553
+ className: "group-label"
554
+ }, flat ? /*#__PURE__*/React.createElement(SortableColumnHeader, {
555
+ id: "value",
556
+ title: "Amount",
557
+ sortBy: sortBy,
558
+ direction: direction,
559
+ onSort: onSort
560
+ }) : /*#__PURE__*/React.createElement(Caption1, {
561
+ weight: "bold",
562
+ overflow: "truncate",
563
+ whitespace: "no-wrap"
564
+ }, group.label), /*#__PURE__*/React.createElement(Chip, {
565
+ label: String(group.records.length),
566
+ size: "small",
567
+ backgroundColor: "var(--color-theme-300)",
568
+ className: "count-chip",
569
+ typographyProps: {
570
+ variant: "Caption 1",
571
+ weight: "medium",
572
+ color: "secondary"
573
+ }
574
+ }))), !expanded && !flat ? /*#__PURE__*/React.createElement(Caption1, {
575
+ weight: "bold",
576
+ whitespace: "no-wrap",
577
+ className: "group-sum"
578
+ }, totalsText(group.totals)) : /*#__PURE__*/React.createElement("div", {
579
+ className: "cols"
580
+ }, columns.category ? /*#__PURE__*/React.createElement(SortableColumnHeader, {
581
+ id: "category",
582
+ title: "Category",
583
+ sortBy: sortBy,
584
+ direction: direction,
585
+ onSort: onSort,
586
+ className: "w-category"
587
+ }) : null, /*#__PURE__*/React.createElement(SortableColumnHeader, {
588
+ id: "summary",
589
+ title: "Description",
590
+ sortBy: sortBy,
591
+ direction: direction,
592
+ onSort: onSort,
593
+ className: "w-description"
594
+ }), /*#__PURE__*/React.createElement(SortableColumnHeader, {
595
+ id: "record_date",
596
+ title: "Date",
597
+ sortBy: sortBy,
598
+ direction: direction,
599
+ onSort: onSort,
600
+ position: "left",
601
+ className: "w-date"
602
+ }), columns.client ? /*#__PURE__*/React.createElement(SortableColumnHeader, {
603
+ id: "client",
604
+ title: "Client",
605
+ sortBy: sortBy,
606
+ direction: direction,
607
+ onSort: onSort,
608
+ className: "w-client"
609
+ }) : null, columns.project ? /*#__PURE__*/React.createElement(SortableColumnHeader, {
610
+ id: "project",
611
+ title: "Project",
612
+ sortBy: sortBy,
613
+ direction: direction,
614
+ onSort: onSort,
615
+ className: "w-project"
616
+ }) : null, columns.task ? /*#__PURE__*/React.createElement(SortableColumnHeader, {
617
+ id: "task",
618
+ title: "Task",
619
+ sortBy: sortBy,
620
+ direction: direction,
621
+ onSort: onSort,
622
+ className: "w-task"
623
+ }) : null, columns.invoice ? /*#__PURE__*/React.createElement(SortableColumnHeader, {
624
+ id: "invoice",
625
+ title: "Invoice #",
626
+ sortBy: sortBy,
627
+ direction: direction,
628
+ onSort: onSort,
629
+ className: "w-invoice"
630
+ }) : null, /*#__PURE__*/React.createElement(SortableColumnHeader, {
631
+ id: "status",
632
+ title: "Status",
633
+ sortBy: sortBy,
634
+ direction: direction,
635
+ onSort: onSort,
636
+ position: "left",
637
+ className: "w-status"
638
+ }))), expanded || flat ? group.records.map((row, index) => /*#__PURE__*/React.createElement(ExpenseRow, {
639
+ key: row.id,
640
+ row: row,
641
+ striped: index % 2 === 0,
642
+ columns: columns
643
+ })) : null, flat || !expanded ? null : /*#__PURE__*/React.createElement("div", {
644
+ className: group.records.length % 2 === 0 ? "group-total striped" : "group-total"
645
+ }, /*#__PURE__*/React.createElement(Caption1, {
646
+ weight: "bold",
647
+ className: "group-total-label",
648
+ overflow: "truncate",
649
+ whitespace: "no-wrap"
650
+ }, "Total: " + totalsText(group.totals))));
651
+ };
652
+
653
+ /* ------------------------------------------------------------------ */
654
+ /* Page */
655
+ /* ------------------------------------------------------------------ */
656
+
657
+ export const ExpensesPage = _ref8 => {
658
+ var _EXPENSE_GROUP_BY_OPT, _EXPENSE_GROUP_BY_OPT2, _currencyOptions$find, _currencyOptions$find2;
659
+ let look = _ref8.look,
660
+ _ref8$initialGroupBy = _ref8.initialGroupBy,
661
+ initialGroupBy = _ref8$initialGroupBy === void 0 ? "dont" : _ref8$initialGroupBy,
662
+ initialExpanded = _ref8.initialExpanded,
663
+ _ref8$records = _ref8.records,
664
+ records = _ref8$records === void 0 ? EXPENSES_2026 : _ref8$records;
665
+ const _useState = useState(initialGroupBy),
666
+ groupBy = _useState[0],
667
+ setGroupBy = _useState[1];
668
+ const _useState2 = useState(false),
669
+ groupByOpen = _useState2[0],
670
+ setGroupByOpen = _useState2[1];
671
+ const _useState3 = useState(0),
672
+ currency = _useState3[0],
673
+ setCurrency = _useState3[1];
674
+ const _useState4 = useState(false),
675
+ currencyOpen = _useState4[0],
676
+ setCurrencyOpen = _useState4[1];
677
+ const _useState5 = useState({}),
678
+ filter = _useState5[0],
679
+ setFilter = _useState5[1];
680
+ const _useState6 = useState("record_date"),
681
+ sortBy = _useState6[0],
682
+ setSortBy = _useState6[1];
683
+ const _useState7 = useState("desc"),
684
+ direction = _useState7[0],
685
+ setDirection = _useState7[1];
686
+ const _useState8 = useState([]),
687
+ collapsed = _useState8[0],
688
+ setCollapsed = _useState8[1];
689
+ const _useState9 = useState(false),
690
+ initialised = _useState9[0],
691
+ setInitialised = _useState9[1];
692
+ const visible = useMemo(() => records.filter(row => {
693
+ const project = projectOf(row.project_id);
694
+ if (currency && project.currency_id !== currency) {
695
+ return false;
696
+ }
697
+ return matchesFilter(row, project, filter);
698
+ }), [records, currency, filter]);
699
+ const groups = useMemo(() => groupExpenses(visible, groupBy, sortBy, direction), [visible, groupBy, sortBy, direction]);
700
+ if (!initialised && initialExpanded) {
701
+ setCollapsed(groups.map(group => group.key).filter(key => !initialExpanded.includes(key)));
702
+ setInitialised(true);
703
+ }
704
+ const byStatus = statuses => visible.filter(row => statuses.includes(row.billable_status));
705
+ const nonBillable = byStatus([0]);
706
+ const grandTotals = sumByCurrency(visible);
707
+ const hasFilter = currency !== 0 || Object.values(filter).some(ids => ids.length > 0);
708
+ const flat = groupBy === "dont";
709
+ const columns = {
710
+ category: groupBy !== "expense_category",
711
+ client: groupBy !== "project_client",
712
+ project: groupBy !== "project",
713
+ task: true,
714
+ invoice: true
715
+ };
716
+ const allExpanded = collapsed.length === 0;
717
+ const toggleAll = () => setCollapsed(allExpanded ? groups.map(group => group.key) : []);
718
+ const toggleGroup = key => setCollapsed(collapsed.includes(key) ? collapsed.filter(item => item !== key) : [...collapsed, key]);
719
+ const handleSort = id => {
720
+ if (id === sortBy) {
721
+ setDirection(direction === "asc" ? "desc" : "asc");
722
+ return;
723
+ }
724
+ setSortBy(id);
725
+ setDirection(id === "record_date" || id === "value" ? "desc" : "asc");
726
+ };
727
+ const currencyOptions = [{
728
+ id: 0,
729
+ name: "Any"
730
+ }, ...Object.entries(CURRENCIES).map(_ref9 => {
731
+ let id = _ref9[0],
732
+ value = _ref9[1];
733
+ return {
734
+ id: Number(id),
735
+ name: value.code
736
+ };
737
+ })];
738
+ return /*#__PURE__*/React.createElement(PresentationShell, {
739
+ look: look,
740
+ activeMenuItem: "Reports",
741
+ header: /*#__PURE__*/React.createElement(PageHeader, {
742
+ title: "Expenses",
743
+ back: true
744
+ }),
745
+ floating: /*#__PURE__*/React.createElement(FloatingControls, null)
746
+ }, /*#__PURE__*/React.createElement(StyledReportToolbar, null, /*#__PURE__*/React.createElement(StyledControlGroup, {
747
+ className: "toolbar-left"
748
+ }, /*#__PURE__*/React.createElement(IntervalStepper, {
749
+ options: EXPENSE_INTERVAL_OPTIONS,
750
+ pill: true
751
+ })), /*#__PURE__*/React.createElement(HeaderControls, null, /*#__PURE__*/React.createElement(HeaderControls, null, /*#__PURE__*/React.createElement(ExportButton, null)), /*#__PURE__*/React.createElement(HeaderControls, null, /*#__PURE__*/React.createElement(Select, {
752
+ options: EXPENSE_GROUP_BY_OPTIONS,
753
+ selected: groupBy,
754
+ onChange: value => setGroupBy(String(value)),
755
+ onSelectOpen: () => setGroupByOpen(true),
756
+ onSelectClose: () => setGroupByOpen(false),
757
+ forceCloseMenu: true,
758
+ disableSearch: true,
759
+ keepSameOptionsOrder: true,
760
+ disabledInternalSort: true,
761
+ target: /*#__PURE__*/React.createElement(CollapsingValueButton, {
762
+ active: groupByOpen,
763
+ icon: /*#__PURE__*/React.createElement(GroupByIcon, null),
764
+ label: "Group by",
765
+ value: (_EXPENSE_GROUP_BY_OPT = (_EXPENSE_GROUP_BY_OPT2 = EXPENSE_GROUP_BY_OPTIONS.find(option => option.id === groupBy)) == null ? void 0 : _EXPENSE_GROUP_BY_OPT2.name) != null ? _EXPENSE_GROUP_BY_OPT : "No Grouping"
766
+ })
767
+ }), /*#__PURE__*/React.createElement(Filter, {
768
+ data: EXPENSES_FILTER_DATA,
769
+ selected: filter,
770
+ label: "Filter",
771
+ clearAllText: "Clear All",
772
+ resetLabel: "Reset",
773
+ noResultText: "No results",
774
+ onChange: setFilter
775
+ }), /*#__PURE__*/React.createElement(Select, {
776
+ options: currencyOptions,
777
+ selected: currency,
778
+ onChange: value => setCurrency(Number(value)),
779
+ onSelectOpen: () => setCurrencyOpen(true),
780
+ onSelectClose: () => setCurrencyOpen(false),
781
+ forceCloseMenu: true,
782
+ disableSearch: true,
783
+ keepSameOptionsOrder: true,
784
+ disabledInternalSort: true,
785
+ target: /*#__PURE__*/React.createElement(CollapsingValueButton, {
786
+ active: currencyOpen,
787
+ icon: /*#__PURE__*/React.createElement(DollarIcon, null),
788
+ label: "Currency",
789
+ value: (_currencyOptions$find = (_currencyOptions$find2 = currencyOptions.find(option => option.id === currency)) == null ? void 0 : _currencyOptions$find2.name) != null ? _currencyOptions$find : "Any"
790
+ })
791
+ })))), /*#__PURE__*/React.createElement(StyledExpenses, null, visible.length === 0 ? /*#__PURE__*/React.createElement(NoResultsSlate, {
792
+ title: "No Expenses",
793
+ description: hasFilter ? "No expenses match the filter." : "No expenses were recorded in this period.",
794
+ clearLabel: hasFilter ? "Clear Filter" : undefined,
795
+ onClear: hasFilter ? () => {
796
+ setFilter({});
797
+ setCurrency(0);
798
+ } : undefined,
799
+ style: {
800
+ margin: "auto"
801
+ }
802
+ }) : /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("div", {
803
+ className: "results-toolbar"
804
+ }, /*#__PURE__*/React.createElement("div", {
805
+ className: "results-toolbar-left"
806
+ }, flat ? null : /*#__PURE__*/React.createElement(Tooltip, {
807
+ title: allExpanded ? "Collapse all" : "Expand all"
808
+ }, /*#__PURE__*/React.createElement(IconButton, {
809
+ variant: "text gray",
810
+ className: "expand-all",
811
+ onClick: toggleAll
812
+ }, allExpanded ? /*#__PURE__*/React.createElement(ArrowCollapseMultipleIcon, null) : /*#__PURE__*/React.createElement(ArrowExpandeMultipleIcon, null))), /*#__PURE__*/React.createElement(Caption1, {
813
+ weight: "bold",
814
+ overflow: "truncate",
815
+ whitespace: "no-wrap"
816
+ }, "Total: " + totalsText(grandTotals)), /*#__PURE__*/React.createElement(Caption1, {
817
+ color: "secondary",
818
+ overflow: "truncate",
819
+ whitespace: "no-wrap"
820
+ }, "(" + totalsText(sumByCurrency(byStatus([1, 2, 3]))) + " Billable / " + (totalsText(sumByCurrency(nonBillable)) || "0") + " Non-Billable)"))), /*#__PURE__*/React.createElement("div", {
821
+ className: "scroll"
822
+ }, groups.map(group => /*#__PURE__*/React.createElement(GroupBlock, {
823
+ key: group.key,
824
+ group: group,
825
+ expanded: !collapsed.includes(group.key),
826
+ onToggle: () => toggleGroup(group.key),
827
+ columns: columns,
828
+ sortBy: sortBy,
829
+ direction: direction,
830
+ onSort: handleSort,
831
+ flat: flat
832
+ })), /*#__PURE__*/React.createElement("div", {
833
+ className: "grand-total"
834
+ }, /*#__PURE__*/React.createElement(Caption1, {
835
+ weight: "bold",
836
+ className: "grand-total-label"
837
+ }, "Total:"), /*#__PURE__*/React.createElement("div", {
838
+ className: "totals"
839
+ }, Object.entries(grandTotals).map(_ref0 => {
840
+ let currencyId = _ref0[0],
841
+ value = _ref0[1];
842
+ return /*#__PURE__*/React.createElement(Caption1, {
843
+ key: currencyId,
844
+ weight: "bold",
845
+ align: "right"
846
+ }, money(value, Number(currencyId)));
847
+ })))))));
848
+ };
849
+ //# sourceMappingURL=expenses.js.map