@activecollab/components 2.0.579 → 2.0.580

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.
@@ -1,6 +1,7 @@
1
1
  import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
2
2
  import _extends from "@babel/runtime/helpers/esm/extends";
3
- const _excluded = ["active", "label", "value", "icon", "open"];
3
+ const _excluded = ["count", "open"],
4
+ _excluded2 = ["active", "label", "value", "icon", "open"];
4
5
  import React, { forwardRef, useMemo, useState } from "react";
5
6
  import moment from "moment-timezone";
6
7
  import styled from "styled-components";
@@ -10,7 +11,9 @@ import { Chip } from "../../components/Chip";
10
11
  import { Filter } from "../../components/Filter";
11
12
  import { HeaderControls } from "../../components/HeaderControls";
12
13
  import { IconButton } from "../../components/IconButton";
13
- import { ArrowCollapseMultipleIcon, ArrowExpandeMultipleIcon, CollapseExpandSingleIcon, DollarIcon, GroupByIcon } from "../../components/Icons";
14
+ import { ArrowCollapseMultipleIcon, ArrowExpandeMultipleIcon, AttachmentIcon, CollapseExpandSingleIcon, DollarIcon, GroupByIcon } from "../../components/Icons";
15
+ import { List, ListItem } from "../../components/List";
16
+ import { Menu } from "../../components/Menu";
14
17
  import { NoResultsSlate } from "../../components/NoResultsSlate";
15
18
  import { Paper } from "../../components/Paper";
16
19
  import { Select } from "../../components/Select";
@@ -18,7 +21,8 @@ import { Tooltip } from "../../components/Tooltip";
18
21
  import { Body2, Caption1 } from "../../components/Typography";
19
22
  import { ValueButton } from "../../components/ValueButton";
20
23
  import { formatNumber } from "../../utils";
21
- import { AVATAR_COLORS, FloatingControls, MD, PageHeader, PresentationShell, RoundAvatar } from "../shared";
24
+ import { AVATAR_COLORS, FileTypeTile, FloatingControls, MD, PageHeader, PresentationShell, RoundAvatar } from "../shared";
25
+ import { formatFileSize } from "../whiteboard/fileElement";
22
26
 
23
27
  /* ------------------------------------------------------------------ */
24
28
  /* Mock data */
@@ -110,7 +114,7 @@ export const EXPENSES_2026 = [{
110
114
  summary: "Icon font license for one year",
111
115
  billable_status: 1,
112
116
  record_date: "2026-09-28",
113
- attachments_count: 1
117
+ attachments_count: 0
114
118
  }, {
115
119
  id: 2,
116
120
  value: 420,
@@ -136,7 +140,7 @@ export const EXPENSES_2026 = [{
136
140
  summary: "Lunch with the client team",
137
141
  billable_status: 0,
138
142
  record_date: "2026-09-24",
139
- attachments_count: 1
143
+ attachments_count: 0
140
144
  }, {
141
145
  id: 4,
142
146
  value: 1250,
@@ -148,7 +152,7 @@ export const EXPENSES_2026 = [{
148
152
  summary: "Stock photography bundle",
149
153
  billable_status: 2,
150
154
  record_date: "2026-09-10",
151
- attachments_count: 1,
155
+ attachments_count: 0,
152
156
  invoice_number: "27-2026"
153
157
  }, {
154
158
  id: 5,
@@ -188,7 +192,7 @@ export const EXPENSES_2026 = [{
188
192
  summary: "Taxi to the photo shoot",
189
193
  billable_status: 1,
190
194
  record_date: "2026-09-22",
191
- attachments_count: 1
195
+ attachments_count: 0
192
196
  }, {
193
197
  id: 8,
194
198
  value: 3200,
@@ -242,6 +246,84 @@ export const EXPENSES_2026 = [{
242
246
  attachments_count: 1
243
247
  }];
244
248
 
249
+ /**
250
+ * mirrors: an attachment of `getAllAttachmentsByParent(state, "Expense", id)`, which Expenses/AttachmentMenu.js
251
+ * loads with `fetchExpense` when the menu opens (`name`, `extension`, `mime_type`, `size` in bytes,
252
+ * `created_by_id`, `created_on`). Keyed by expense id; each list is as long as that expense's `attachments_count`.
253
+ */
254
+
255
+ export const EXPENSE_ATTACHMENTS = {
256
+ 2: [{
257
+ id: 201,
258
+ name: "trenitalia-milan-paris-outbound.pdf",
259
+ extension: "pdf",
260
+ mime_type: "application/pdf",
261
+ size: 186204,
262
+ created_by_id: 6,
263
+ created_on: "2026-09-24T09:12:00Z"
264
+ }, {
265
+ id: 202,
266
+ name: "trenitalia-milan-paris-return.pdf",
267
+ extension: "pdf",
268
+ mime_type: "application/pdf",
269
+ size: 184977,
270
+ created_by_id: 6,
271
+ created_on: "2026-09-24T09:14:00Z"
272
+ }],
273
+ 5: [{
274
+ id: 501,
275
+ name: "print-run-200-copies-invoice.pdf",
276
+ extension: "pdf",
277
+ mime_type: "application/pdf",
278
+ size: 808305,
279
+ created_by_id: 3,
280
+ created_on: "2026-09-16T14:40:00Z"
281
+ }],
282
+ 8: [{
283
+ id: 801,
284
+ name: "camera-rental-agreement.pdf",
285
+ extension: "pdf",
286
+ mime_type: "application/pdf",
287
+ size: 412390,
288
+ created_by_id: 4,
289
+ created_on: "2026-09-25T08:05:00Z"
290
+ }, {
291
+ id: 802,
292
+ name: "lighting-kit-equipment-list.docx",
293
+ extension: "docx",
294
+ mime_type: "application/vnd.openxmlformats-officedocument.wordprocessingml.document",
295
+ size: 38912,
296
+ created_by_id: 4,
297
+ created_on: "2026-09-25T08:07:00Z"
298
+ }, {
299
+ id: 803,
300
+ name: "rental-receipt-photo.jpg",
301
+ extension: "jpg",
302
+ mime_type: "image/jpeg",
303
+ size: 98836,
304
+ created_by_id: 4,
305
+ created_on: "2026-09-26T17:30:00Z"
306
+ }],
307
+ 9: [{
308
+ id: 901,
309
+ name: "flight-to-portland-e-ticket.pdf",
310
+ extension: "pdf",
311
+ mime_type: "application/pdf",
312
+ size: 251084,
313
+ created_by_id: 4,
314
+ created_on: "2026-09-12T06:45:00Z"
315
+ }],
316
+ 11: [{
317
+ id: 1101,
318
+ name: "monitor-receipt.png",
319
+ extension: "png",
320
+ mime_type: "image/png",
321
+ size: 1245184,
322
+ created_by_id: 6,
323
+ created_on: "2026-09-08T11:20:00Z"
324
+ }]
325
+ };
326
+
245
327
  /* ------------------------------------------------------------------ */
246
328
  /* Lookups & grouping */
247
329
  /* ------------------------------------------------------------------ */
@@ -361,6 +443,8 @@ const sortExpenses = (rows, sortBy, direction) => {
361
443
  var _row$invoice_number;
362
444
  const project = projectOf(row.project_id);
363
445
  switch (sortBy) {
446
+ case "user":
447
+ return personOf(row.user_id).name;
364
448
  case "category":
365
449
  return categoryOf(row.category_id);
366
450
  case "summary":
@@ -422,26 +506,116 @@ const groupExpenses = (rows, groupBy, sortBy, direction) => {
422
506
  const StyledExpenses = styled(Paper).withConfig({
423
507
  displayName: "expenses__StyledExpenses",
424
508
  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;}"]);
509
+ })(["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{display:flex;align-items:center;gap:8px;width:168px;flex-shrink:0;height:40px;padding:0 8px;box-sizing:border-box;}.head .first:not(.static){position:sticky;left:0;z-index:1;border-radius:8px;background-color:var(--page-paper-main);cursor:pointer;}.head .first.collapsed{flex:none;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;flex:1;align-items:center;gap:8px;height:40px;padding-right:8px;}.link{overflow:hidden;text-decoration:none;cursor:pointer;}.w-amount{position:sticky;right:0;z-index:1;display:flex;align-items:center;justify-content:flex-end;width:112px;height:40px;flex-shrink:0;padding:0 8px;box-sizing:border-box;border-radius:8px;background-color:inherit;}.head .w-amount{background-color:var(--page-paper-main);}.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{justify-content:flex-end;border-radius:8px;background-color:var(--page-paper-main);}.group-total.striped{background-color:var(--color-theme-200);}.group-total-label{position:sticky;right:0;padding:0 8px;}.group-sum{position:sticky;right:0;z-index:2;margin-left:auto;padding:0 8px;background-color:var(--page-paper-main);}"]);
426
510
 
427
511
  /* ------------------------------------------------------------------ */
428
512
  /* Pieces */
429
513
  /* ------------------------------------------------------------------ */
430
514
 
515
+ /* utils/fileType getFileType, narrowed to the tiles the shared FileTypeTile draws */
516
+ const fileTypeOf = mimeType => {
517
+ if (mimeType.startsWith("image/")) {
518
+ return "image";
519
+ }
520
+ return mimeType === "application/pdf" ? "pdf" : "docs";
521
+ };
522
+
523
+ /* UserNameContainer shortName: first name and the initial of the last one */
524
+ const shortNameOf = id => {
525
+ const _personOf$name$split = personOf(id).name.split(" "),
526
+ first = _personOf$name$split[0],
527
+ last = _personOf$name$split[1];
528
+ return last ? first + " " + last[0] + "." : first;
529
+ };
530
+
531
+ /* Expenses/AttachmentMenu.js Target: a small gray paperclip, active while the menu is open */
532
+ const AttachmentTarget = /*#__PURE__*/forwardRef((_ref5, ref) => {
533
+ let count = _ref5.count,
534
+ _ref5$open = _ref5.open,
535
+ open = _ref5$open === void 0 ? false : _ref5$open,
536
+ rest = _objectWithoutPropertiesLoose(_ref5, _excluded);
537
+ return /*#__PURE__*/React.createElement(Tooltip, {
538
+ title: count === 1 ? "1 attachment" : count + " attachments"
539
+ }, /*#__PURE__*/React.createElement(IconButton, _extends({}, rest, {
540
+ ref: ref,
541
+ type: "button",
542
+ variant: "text gray",
543
+ size: "small",
544
+ active: open,
545
+ "aria-label": count === 1 ? "1 attachment" : count + " attachments"
546
+ }), /*#__PURE__*/React.createElement(AttachmentIcon, null)));
547
+ });
548
+ AttachmentTarget.displayName = "AttachmentTarget";
549
+
550
+ /* AttachmentList.js + ExpenseAttachmentWrapper.js for a reader who cannot edit: 48px tile, name, "author, size";
551
+ no trash buttons and no "+ Attach Files" footer. */
552
+ const StyledAttachmentList = styled.div.withConfig({
553
+ displayName: "expenses__StyledAttachmentList",
554
+ componentId: "sc-e8k2o8-1"
555
+ })(["max-height:304px;padding:12px 0;overflow:auto;.attachment{gap:12px;margin:0;padding-top:4px;padding-bottom:4px;}.attachment-tile{width:48px;height:48px;flex-shrink:0;}.attachment-meta{display:flex;flex-direction:column;min-width:0;}.attachment-name{display:flex;min-width:0;}.attachment-base{overflow:hidden;white-space:nowrap;text-overflow:ellipsis;}.attachment-extension{flex-shrink:0;}"]);
556
+ const ExpenseAttachmentMenu = _ref6 => {
557
+ var _EXPENSE_ATTACHMENTS$;
558
+ let expenseId = _ref6.expenseId,
559
+ count = _ref6.count;
560
+ const _useState = useState(false),
561
+ open = _useState[0],
562
+ setOpen = _useState[1];
563
+ const attachments = [...((_EXPENSE_ATTACHMENTS$ = EXPENSE_ATTACHMENTS[expenseId]) != null ? _EXPENSE_ATTACHMENTS$ : [])].sort((a, b) => b.created_on.localeCompare(a.created_on));
564
+ return /*#__PURE__*/React.createElement(Menu, {
565
+ open: open,
566
+ onOpen: () => setOpen(true),
567
+ onClose: () => setOpen(false),
568
+ position: "bottom-start",
569
+ mode: "wider",
570
+ target: /*#__PURE__*/React.createElement(AttachmentTarget, {
571
+ count: count
572
+ })
573
+ }, /*#__PURE__*/React.createElement(StyledAttachmentList, null, /*#__PURE__*/React.createElement(List, null, attachments.map(attachment => {
574
+ const base = attachment.name.endsWith("." + attachment.extension) ? attachment.name.slice(0, -attachment.extension.length - 1) : attachment.name;
575
+ return /*#__PURE__*/React.createElement(ListItem, {
576
+ key: attachment.id,
577
+ className: "attachment"
578
+ }, /*#__PURE__*/React.createElement("span", {
579
+ className: "attachment-tile"
580
+ }, /*#__PURE__*/React.createElement(FileTypeTile, {
581
+ compact: true,
582
+ file: {
583
+ id: attachment.id,
584
+ name: attachment.name,
585
+ extension: attachment.extension,
586
+ file_type: fileTypeOf(attachment.mime_type),
587
+ size: formatFileSize(attachment.size)
588
+ }
589
+ })), /*#__PURE__*/React.createElement("span", {
590
+ className: "attachment-meta"
591
+ }, /*#__PURE__*/React.createElement(Body2, {
592
+ className: "attachment-name"
593
+ }, /*#__PURE__*/React.createElement("span", {
594
+ className: "attachment-base"
595
+ }, base + "."), /*#__PURE__*/React.createElement("span", {
596
+ className: "attachment-extension"
597
+ }, attachment.extension)), /*#__PURE__*/React.createElement(Caption1, {
598
+ color: "tertiary",
599
+ overflow: "truncate",
600
+ whitespace: "no-wrap"
601
+ }, shortNameOf(attachment.created_by_id) + ", " + formatFileSize(attachment.size))));
602
+ }))));
603
+ };
604
+
431
605
  /* UserProfileProjectsSortByPicker.js: a ValueButton that gives way to an icon button on narrow screens.
432
606
  It collapses at MD, where the Filter CounterButton drops its label too. */
433
607
  const StyledCollapsingValueButton = styled.div.withConfig({
434
608
  displayName: "expenses__StyledCollapsingValueButton",
435
- componentId: "sc-e8k2o8-1"
609
+ componentId: "sc-e8k2o8-2"
436
610
  })(["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);
611
+ const CollapsingValueButton = /*#__PURE__*/forwardRef((_ref7, ref) => {
612
+ let active = _ref7.active,
613
+ label = _ref7.label,
614
+ value = _ref7.value,
615
+ icon = _ref7.icon,
616
+ _ref7$open = _ref7.open,
617
+ open = _ref7$open === void 0 ? false : _ref7$open,
618
+ rest = _objectWithoutPropertiesLoose(_ref7, _excluded2);
445
619
  return /*#__PURE__*/React.createElement(StyledCollapsingValueButton, _extends({
446
620
  ref: ref
447
621
  }, rest), /*#__PURE__*/React.createElement(ValueButton, {
@@ -457,29 +631,24 @@ const CollapsingValueButton = /*#__PURE__*/forwardRef((_ref5, ref) => {
457
631
  }, icon));
458
632
  });
459
633
  CollapsingValueButton.displayName = "CollapsingValueButton";
460
- const ExpenseRow = _ref6 => {
461
- let row = _ref6.row,
462
- striped = _ref6.striped,
463
- columns = _ref6.columns;
634
+ const ExpenseRow = _ref8 => {
635
+ let row = _ref8.row,
636
+ striped = _ref8.striped,
637
+ columns = _ref8.columns;
464
638
  const project = projectOf(row.project_id);
465
639
  const person = personOf(row.user_id);
466
640
  return /*#__PURE__*/React.createElement("div", {
467
641
  className: striped ? "row striped" : "row"
468
642
  }, /*#__PURE__*/React.createElement("div", {
469
643
  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
644
  }, /*#__PURE__*/React.createElement(RoundAvatar, {
479
645
  $bg: person.color,
480
646
  $size: 24,
481
647
  className: "avatar"
482
- }, person.initials))), /*#__PURE__*/React.createElement("div", {
648
+ }, person.initials), /*#__PURE__*/React.createElement(Body2, {
649
+ overflow: "truncate",
650
+ whitespace: "no-wrap"
651
+ }, person.name)), /*#__PURE__*/React.createElement("div", {
483
652
  className: "cols"
484
653
  }, columns.category ? /*#__PURE__*/React.createElement(Body2, {
485
654
  overflow: "truncate",
@@ -490,16 +659,18 @@ const ExpenseRow = _ref6 => {
490
659
  }, /*#__PURE__*/React.createElement(Body2, {
491
660
  overflow: "truncate",
492
661
  whitespace: "no-wrap"
493
- }, row.summary)), /*#__PURE__*/React.createElement(Caption1, {
494
- align: "right",
662
+ }, row.summary), row.attachments_count > 0 ? /*#__PURE__*/React.createElement(ExpenseAttachmentMenu, {
663
+ expenseId: row.id,
664
+ count: row.attachments_count
665
+ }) : null), columns.client ? /*#__PURE__*/React.createElement(Body2, {
495
666
  overflow: "truncate",
496
667
  whitespace: "no-wrap",
497
- className: "w-date"
498
- }, moment.utc(row.record_date).format("MMM D.")), columns.client ? /*#__PURE__*/React.createElement(Body2, {
668
+ className: "w-client"
669
+ }, project.client_name) : null, /*#__PURE__*/React.createElement(Caption1, {
499
670
  overflow: "truncate",
500
671
  whitespace: "no-wrap",
501
- className: "w-client"
502
- }, project.client_name) : null, columns.project ? /*#__PURE__*/React.createElement("a", {
672
+ className: "w-date"
673
+ }, moment.utc(row.record_date).format("MMM D.")), columns.project ? /*#__PURE__*/React.createElement("a", {
503
674
  className: "link w-project"
504
675
  }, /*#__PURE__*/React.createElement(Body2, {
505
676
  color: "theme-primary",
@@ -528,18 +699,26 @@ const ExpenseRow = _ref6 => {
528
699
  align: "right",
529
700
  overflow: "truncate",
530
701
  whitespace: "no-wrap"
531
- }, BILLABLE_STATUS_LABELS[row.billable_status]))));
702
+ }, BILLABLE_STATUS_LABELS[row.billable_status]))), /*#__PURE__*/React.createElement("div", {
703
+ className: "w-amount"
704
+ }, /*#__PURE__*/React.createElement(Caption1, {
705
+ weight: "bold",
706
+ color: "secondary",
707
+ align: "right",
708
+ whitespace: "no-wrap",
709
+ title: formatNumber(row.value, ",", ".", false, 2)
710
+ }, money(row.value, project.currency_id))));
532
711
  };
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;
712
+ const GroupBlock = _ref9 => {
713
+ let group = _ref9.group,
714
+ expanded = _ref9.expanded,
715
+ onToggle = _ref9.onToggle,
716
+ columns = _ref9.columns,
717
+ sortBy = _ref9.sortBy,
718
+ direction = _ref9.direction,
719
+ onSort = _ref9.onSort,
720
+ _ref9$flat = _ref9.flat,
721
+ flat = _ref9$flat === void 0 ? false : _ref9$flat;
543
722
  return /*#__PURE__*/React.createElement("div", {
544
723
  className: "group"
545
724
  }, /*#__PURE__*/React.createElement("div", {
@@ -552,8 +731,8 @@ const GroupBlock = _ref7 => {
552
731
  }), /*#__PURE__*/React.createElement("span", {
553
732
  className: "group-label"
554
733
  }, flat ? /*#__PURE__*/React.createElement(SortableColumnHeader, {
555
- id: "value",
556
- title: "Amount",
734
+ id: "user",
735
+ title: "Person",
557
736
  sortBy: sortBy,
558
737
  direction: direction,
559
738
  onSort: onSort
@@ -591,14 +770,6 @@ const GroupBlock = _ref7 => {
591
770
  direction: direction,
592
771
  onSort: onSort,
593
772
  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
773
  }), columns.client ? /*#__PURE__*/React.createElement(SortableColumnHeader, {
603
774
  id: "client",
604
775
  title: "Client",
@@ -606,7 +777,14 @@ const GroupBlock = _ref7 => {
606
777
  direction: direction,
607
778
  onSort: onSort,
608
779
  className: "w-client"
609
- }) : null, columns.project ? /*#__PURE__*/React.createElement(SortableColumnHeader, {
780
+ }) : null, /*#__PURE__*/React.createElement(SortableColumnHeader, {
781
+ id: "record_date",
782
+ title: "Date",
783
+ sortBy: sortBy,
784
+ direction: direction,
785
+ onSort: onSort,
786
+ className: "w-date"
787
+ }), columns.project ? /*#__PURE__*/React.createElement(SortableColumnHeader, {
610
788
  id: "project",
611
789
  title: "Project",
612
790
  sortBy: sortBy,
@@ -635,6 +813,15 @@ const GroupBlock = _ref7 => {
635
813
  onSort: onSort,
636
814
  position: "left",
637
815
  className: "w-status"
816
+ })), !expanded && !flat ? null : /*#__PURE__*/React.createElement("div", {
817
+ className: "w-amount"
818
+ }, /*#__PURE__*/React.createElement(SortableColumnHeader, {
819
+ id: "value",
820
+ title: "Amount",
821
+ sortBy: sortBy,
822
+ direction: direction,
823
+ onSort: onSort,
824
+ position: "left"
638
825
  }))), expanded || flat ? group.records.map((row, index) => /*#__PURE__*/React.createElement(ExpenseRow, {
639
826
  key: row.id,
640
827
  row: row,
@@ -654,41 +841,41 @@ const GroupBlock = _ref7 => {
654
841
  /* Page */
655
842
  /* ------------------------------------------------------------------ */
656
843
 
657
- export const ExpensesPage = _ref8 => {
844
+ export const ExpensesPage = _ref0 => {
658
845
  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];
846
+ let look = _ref0.look,
847
+ _ref0$initialGroupBy = _ref0.initialGroupBy,
848
+ initialGroupBy = _ref0$initialGroupBy === void 0 ? "dont" : _ref0$initialGroupBy,
849
+ initialExpanded = _ref0.initialExpanded,
850
+ _ref0$records = _ref0.records,
851
+ records = _ref0$records === void 0 ? EXPENSES_2026 : _ref0$records;
852
+ const _useState2 = useState(initialGroupBy),
853
+ groupBy = _useState2[0],
854
+ setGroupBy = _useState2[1];
855
+ const _useState3 = useState(false),
856
+ groupByOpen = _useState3[0],
857
+ setGroupByOpen = _useState3[1];
858
+ const _useState4 = useState(0),
859
+ currency = _useState4[0],
860
+ setCurrency = _useState4[1];
861
+ const _useState5 = useState(false),
862
+ currencyOpen = _useState5[0],
863
+ setCurrencyOpen = _useState5[1];
864
+ const _useState6 = useState({}),
865
+ filter = _useState6[0],
866
+ setFilter = _useState6[1];
867
+ const _useState7 = useState("record_date"),
868
+ sortBy = _useState7[0],
869
+ setSortBy = _useState7[1];
870
+ const _useState8 = useState("desc"),
871
+ direction = _useState8[0],
872
+ setDirection = _useState8[1];
873
+ const _useState9 = useState([]),
874
+ collapsed = _useState9[0],
875
+ setCollapsed = _useState9[1];
876
+ const _useState0 = useState(false),
877
+ initialised = _useState0[0],
878
+ setInitialised = _useState0[1];
692
879
  const visible = useMemo(() => records.filter(row => {
693
880
  const project = projectOf(row.project_id);
694
881
  if (currency && project.currency_id !== currency) {
@@ -727,9 +914,9 @@ export const ExpensesPage = _ref8 => {
727
914
  const currencyOptions = [{
728
915
  id: 0,
729
916
  name: "Any"
730
- }, ...Object.entries(CURRENCIES).map(_ref9 => {
731
- let id = _ref9[0],
732
- value = _ref9[1];
917
+ }, ...Object.entries(CURRENCIES).map(_ref1 => {
918
+ let id = _ref1[0],
919
+ value = _ref1[1];
733
920
  return {
734
921
  id: Number(id),
735
922
  name: value.code
@@ -748,7 +935,15 @@ export const ExpensesPage = _ref8 => {
748
935
  }, /*#__PURE__*/React.createElement(IntervalStepper, {
749
936
  options: EXPENSE_INTERVAL_OPTIONS,
750
937
  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, {
938
+ })), /*#__PURE__*/React.createElement(HeaderControls, null, /*#__PURE__*/React.createElement(HeaderControls, null, /*#__PURE__*/React.createElement(ExportButton, null)), /*#__PURE__*/React.createElement(HeaderControls, null, /*#__PURE__*/React.createElement(Filter, {
939
+ data: EXPENSES_FILTER_DATA,
940
+ selected: filter,
941
+ label: "Filter",
942
+ clearAllText: "Clear All",
943
+ resetLabel: "Reset",
944
+ noResultText: "No results",
945
+ onChange: setFilter
946
+ }), /*#__PURE__*/React.createElement(Select, {
752
947
  options: EXPENSE_GROUP_BY_OPTIONS,
753
948
  selected: groupBy,
754
949
  onChange: value => setGroupBy(String(value)),
@@ -761,17 +956,9 @@ export const ExpensesPage = _ref8 => {
761
956
  target: /*#__PURE__*/React.createElement(CollapsingValueButton, {
762
957
  active: groupByOpen,
763
958
  icon: /*#__PURE__*/React.createElement(GroupByIcon, null),
764
- label: "Group by",
959
+ label: "Group",
765
960
  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
961
  })
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
962
  }), /*#__PURE__*/React.createElement(Select, {
776
963
  options: currencyOptions,
777
964
  selected: currency,
@@ -829,21 +1016,6 @@ export const ExpensesPage = _ref8 => {
829
1016
  direction: direction,
830
1017
  onSort: handleSort,
831
1018
  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
- })))))));
1019
+ }))))));
848
1020
  };
849
1021
  //# sourceMappingURL=expenses.js.map