@activecollab/components 2.0.578 → 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.
- package/dist/cjs/components/ViewSwitcher/useApplyToAllOffer.js +3 -1
- package/dist/cjs/components/ViewSwitcher/useApplyToAllOffer.js.map +1 -1
- package/dist/cjs/presentation/reports/expenses.js +302 -123
- package/dist/cjs/presentation/reports/expenses.js.map +1 -1
- package/dist/esm/components/ViewSwitcher/useApplyToAllOffer.d.ts.map +1 -1
- package/dist/esm/components/ViewSwitcher/useApplyToAllOffer.js +4 -2
- package/dist/esm/components/ViewSwitcher/useApplyToAllOffer.js.map +1 -1
- package/dist/esm/presentation/reports/expenses.d.ts +16 -1
- package/dist/esm/presentation/reports/expenses.d.ts.map +1 -1
- package/dist/esm/presentation/reports/expenses.js +293 -121
- package/dist/esm/presentation/reports/expenses.js.map +1 -1
- package/dist/index.js +3 -1
- package/dist/index.js.map +1 -1
- package/dist/index.min.js +1 -1
- package/dist/index.min.js.map +1 -1
- package/package.json +1 -1
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.ExpensesPage = exports.EXPENSE_PROJECTS = exports.EXPENSE_PEOPLE = exports.EXPENSE_GROUP_BY_OPTIONS = exports.EXPENSE_CATEGORIES = exports.EXPENSES_FILTER_DATA = exports.EXPENSES_2026 = exports.BILLABLE_STATUS_LABELS = void 0;
|
|
6
|
+
exports.ExpensesPage = exports.EXPENSE_PROJECTS = exports.EXPENSE_PEOPLE = exports.EXPENSE_GROUP_BY_OPTIONS = exports.EXPENSE_CATEGORIES = exports.EXPENSE_ATTACHMENTS = exports.EXPENSES_FILTER_DATA = exports.EXPENSES_2026 = exports.BILLABLE_STATUS_LABELS = void 0;
|
|
7
7
|
var _react = _interopRequireWildcard(require("react"));
|
|
8
8
|
var _momentTimezone = _interopRequireDefault(require("moment-timezone"));
|
|
9
9
|
var _styledComponents = _interopRequireDefault(require("styled-components"));
|
|
@@ -14,6 +14,8 @@ var _Filter = require("../../components/Filter");
|
|
|
14
14
|
var _HeaderControls = require("../../components/HeaderControls");
|
|
15
15
|
var _IconButton = require("../../components/IconButton");
|
|
16
16
|
var _Icons = require("../../components/Icons");
|
|
17
|
+
var _List = require("../../components/List");
|
|
18
|
+
var _Menu = require("../../components/Menu");
|
|
17
19
|
var _NoResultsSlate = require("../../components/NoResultsSlate");
|
|
18
20
|
var _Paper = require("../../components/Paper");
|
|
19
21
|
var _Select = require("../../components/Select");
|
|
@@ -22,7 +24,9 @@ var _Typography = require("../../components/Typography");
|
|
|
22
24
|
var _ValueButton = require("../../components/ValueButton");
|
|
23
25
|
var _utils = require("../../utils");
|
|
24
26
|
var _shared = require("../shared");
|
|
25
|
-
var
|
|
27
|
+
var _fileElement = require("../whiteboard/fileElement");
|
|
28
|
+
var _excluded = ["count", "open"],
|
|
29
|
+
_excluded2 = ["active", "label", "value", "icon", "open"];
|
|
26
30
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
27
31
|
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t in e) "default" !== _t && {}.hasOwnProperty.call(e, _t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t)) && (i.get || i.set) ? o(f, _t, i) : f[_t] = e[_t]); return f; })(e, t); }
|
|
28
32
|
function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
|
|
@@ -129,7 +133,7 @@ var EXPENSES_2026 = exports.EXPENSES_2026 = [{
|
|
|
129
133
|
summary: "Icon font license for one year",
|
|
130
134
|
billable_status: 1,
|
|
131
135
|
record_date: "2026-09-28",
|
|
132
|
-
attachments_count:
|
|
136
|
+
attachments_count: 0
|
|
133
137
|
}, {
|
|
134
138
|
id: 2,
|
|
135
139
|
value: 420,
|
|
@@ -155,7 +159,7 @@ var EXPENSES_2026 = exports.EXPENSES_2026 = [{
|
|
|
155
159
|
summary: "Lunch with the client team",
|
|
156
160
|
billable_status: 0,
|
|
157
161
|
record_date: "2026-09-24",
|
|
158
|
-
attachments_count:
|
|
162
|
+
attachments_count: 0
|
|
159
163
|
}, {
|
|
160
164
|
id: 4,
|
|
161
165
|
value: 1250,
|
|
@@ -167,7 +171,7 @@ var EXPENSES_2026 = exports.EXPENSES_2026 = [{
|
|
|
167
171
|
summary: "Stock photography bundle",
|
|
168
172
|
billable_status: 2,
|
|
169
173
|
record_date: "2026-09-10",
|
|
170
|
-
attachments_count:
|
|
174
|
+
attachments_count: 0,
|
|
171
175
|
invoice_number: "27-2026"
|
|
172
176
|
}, {
|
|
173
177
|
id: 5,
|
|
@@ -207,7 +211,7 @@ var EXPENSES_2026 = exports.EXPENSES_2026 = [{
|
|
|
207
211
|
summary: "Taxi to the photo shoot",
|
|
208
212
|
billable_status: 1,
|
|
209
213
|
record_date: "2026-09-22",
|
|
210
|
-
attachments_count:
|
|
214
|
+
attachments_count: 0
|
|
211
215
|
}, {
|
|
212
216
|
id: 8,
|
|
213
217
|
value: 3200,
|
|
@@ -261,6 +265,84 @@ var EXPENSES_2026 = exports.EXPENSES_2026 = [{
|
|
|
261
265
|
attachments_count: 1
|
|
262
266
|
}];
|
|
263
267
|
|
|
268
|
+
/**
|
|
269
|
+
* mirrors: an attachment of `getAllAttachmentsByParent(state, "Expense", id)`, which Expenses/AttachmentMenu.js
|
|
270
|
+
* loads with `fetchExpense` when the menu opens (`name`, `extension`, `mime_type`, `size` in bytes,
|
|
271
|
+
* `created_by_id`, `created_on`). Keyed by expense id; each list is as long as that expense's `attachments_count`.
|
|
272
|
+
*/
|
|
273
|
+
|
|
274
|
+
var EXPENSE_ATTACHMENTS = exports.EXPENSE_ATTACHMENTS = {
|
|
275
|
+
2: [{
|
|
276
|
+
id: 201,
|
|
277
|
+
name: "trenitalia-milan-paris-outbound.pdf",
|
|
278
|
+
extension: "pdf",
|
|
279
|
+
mime_type: "application/pdf",
|
|
280
|
+
size: 186204,
|
|
281
|
+
created_by_id: 6,
|
|
282
|
+
created_on: "2026-09-24T09:12:00Z"
|
|
283
|
+
}, {
|
|
284
|
+
id: 202,
|
|
285
|
+
name: "trenitalia-milan-paris-return.pdf",
|
|
286
|
+
extension: "pdf",
|
|
287
|
+
mime_type: "application/pdf",
|
|
288
|
+
size: 184977,
|
|
289
|
+
created_by_id: 6,
|
|
290
|
+
created_on: "2026-09-24T09:14:00Z"
|
|
291
|
+
}],
|
|
292
|
+
5: [{
|
|
293
|
+
id: 501,
|
|
294
|
+
name: "print-run-200-copies-invoice.pdf",
|
|
295
|
+
extension: "pdf",
|
|
296
|
+
mime_type: "application/pdf",
|
|
297
|
+
size: 808305,
|
|
298
|
+
created_by_id: 3,
|
|
299
|
+
created_on: "2026-09-16T14:40:00Z"
|
|
300
|
+
}],
|
|
301
|
+
8: [{
|
|
302
|
+
id: 801,
|
|
303
|
+
name: "camera-rental-agreement.pdf",
|
|
304
|
+
extension: "pdf",
|
|
305
|
+
mime_type: "application/pdf",
|
|
306
|
+
size: 412390,
|
|
307
|
+
created_by_id: 4,
|
|
308
|
+
created_on: "2026-09-25T08:05:00Z"
|
|
309
|
+
}, {
|
|
310
|
+
id: 802,
|
|
311
|
+
name: "lighting-kit-equipment-list.docx",
|
|
312
|
+
extension: "docx",
|
|
313
|
+
mime_type: "application/vnd.openxmlformats-officedocument.wordprocessingml.document",
|
|
314
|
+
size: 38912,
|
|
315
|
+
created_by_id: 4,
|
|
316
|
+
created_on: "2026-09-25T08:07:00Z"
|
|
317
|
+
}, {
|
|
318
|
+
id: 803,
|
|
319
|
+
name: "rental-receipt-photo.jpg",
|
|
320
|
+
extension: "jpg",
|
|
321
|
+
mime_type: "image/jpeg",
|
|
322
|
+
size: 98836,
|
|
323
|
+
created_by_id: 4,
|
|
324
|
+
created_on: "2026-09-26T17:30:00Z"
|
|
325
|
+
}],
|
|
326
|
+
9: [{
|
|
327
|
+
id: 901,
|
|
328
|
+
name: "flight-to-portland-e-ticket.pdf",
|
|
329
|
+
extension: "pdf",
|
|
330
|
+
mime_type: "application/pdf",
|
|
331
|
+
size: 251084,
|
|
332
|
+
created_by_id: 4,
|
|
333
|
+
created_on: "2026-09-12T06:45:00Z"
|
|
334
|
+
}],
|
|
335
|
+
11: [{
|
|
336
|
+
id: 1101,
|
|
337
|
+
name: "monitor-receipt.png",
|
|
338
|
+
extension: "png",
|
|
339
|
+
mime_type: "image/png",
|
|
340
|
+
size: 1245184,
|
|
341
|
+
created_by_id: 6,
|
|
342
|
+
created_on: "2026-09-08T11:20:00Z"
|
|
343
|
+
}]
|
|
344
|
+
};
|
|
345
|
+
|
|
264
346
|
/* ------------------------------------------------------------------ */
|
|
265
347
|
/* Lookups & grouping */
|
|
266
348
|
/* ------------------------------------------------------------------ */
|
|
@@ -396,6 +478,8 @@ var sortExpenses = function sortExpenses(rows, sortBy, direction) {
|
|
|
396
478
|
var _row$invoice_number;
|
|
397
479
|
var project = projectOf(row.project_id);
|
|
398
480
|
switch (sortBy) {
|
|
481
|
+
case "user":
|
|
482
|
+
return personOf(row.user_id).name;
|
|
399
483
|
case "category":
|
|
400
484
|
return categoryOf(row.category_id);
|
|
401
485
|
case "summary":
|
|
@@ -464,26 +548,124 @@ var groupExpenses = function groupExpenses(rows, groupBy, sortBy, direction) {
|
|
|
464
548
|
var StyledExpenses = (0, _styledComponents.default)(_Paper.Paper).withConfig({
|
|
465
549
|
displayName: "expenses__StyledExpenses",
|
|
466
550
|
componentId: "sc-e8k2o8-0"
|
|
467
|
-
})(["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{
|
|
551
|
+
})(["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);}"]);
|
|
468
552
|
|
|
469
553
|
/* ------------------------------------------------------------------ */
|
|
470
554
|
/* Pieces */
|
|
471
555
|
/* ------------------------------------------------------------------ */
|
|
472
556
|
|
|
557
|
+
/* utils/fileType getFileType, narrowed to the tiles the shared FileTypeTile draws */
|
|
558
|
+
var fileTypeOf = function fileTypeOf(mimeType) {
|
|
559
|
+
if (mimeType.startsWith("image/")) {
|
|
560
|
+
return "image";
|
|
561
|
+
}
|
|
562
|
+
return mimeType === "application/pdf" ? "pdf" : "docs";
|
|
563
|
+
};
|
|
564
|
+
|
|
565
|
+
/* UserNameContainer shortName: first name and the initial of the last one */
|
|
566
|
+
var shortNameOf = function shortNameOf(id) {
|
|
567
|
+
var _personOf$name$split = personOf(id).name.split(" "),
|
|
568
|
+
_personOf$name$split2 = _slicedToArray(_personOf$name$split, 2),
|
|
569
|
+
first = _personOf$name$split2[0],
|
|
570
|
+
last = _personOf$name$split2[1];
|
|
571
|
+
return last ? "".concat(first, " ").concat(last[0], ".") : first;
|
|
572
|
+
};
|
|
573
|
+
|
|
574
|
+
/* Expenses/AttachmentMenu.js Target: a small gray paperclip, active while the menu is open */
|
|
575
|
+
var AttachmentTarget = /*#__PURE__*/(0, _react.forwardRef)(function (_ref7, ref) {
|
|
576
|
+
var count = _ref7.count,
|
|
577
|
+
_ref7$open = _ref7.open,
|
|
578
|
+
open = _ref7$open === void 0 ? false : _ref7$open,
|
|
579
|
+
rest = _objectWithoutProperties(_ref7, _excluded);
|
|
580
|
+
return /*#__PURE__*/_react.default.createElement(_Tooltip.Tooltip, {
|
|
581
|
+
title: count === 1 ? "1 attachment" : "".concat(count, " attachments")
|
|
582
|
+
}, /*#__PURE__*/_react.default.createElement(_IconButton.IconButton, _extends({}, rest, {
|
|
583
|
+
ref: ref,
|
|
584
|
+
type: "button",
|
|
585
|
+
variant: "text gray",
|
|
586
|
+
size: "small",
|
|
587
|
+
active: open,
|
|
588
|
+
"aria-label": count === 1 ? "1 attachment" : "".concat(count, " attachments")
|
|
589
|
+
}), /*#__PURE__*/_react.default.createElement(_Icons.AttachmentIcon, null)));
|
|
590
|
+
});
|
|
591
|
+
AttachmentTarget.displayName = "AttachmentTarget";
|
|
592
|
+
|
|
593
|
+
/* AttachmentList.js + ExpenseAttachmentWrapper.js for a reader who cannot edit: 48px tile, name, "author, size";
|
|
594
|
+
no trash buttons and no "+ Attach Files" footer. */
|
|
595
|
+
var StyledAttachmentList = _styledComponents.default.div.withConfig({
|
|
596
|
+
displayName: "expenses__StyledAttachmentList",
|
|
597
|
+
componentId: "sc-e8k2o8-1"
|
|
598
|
+
})(["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;}"]);
|
|
599
|
+
var ExpenseAttachmentMenu = function ExpenseAttachmentMenu(_ref8) {
|
|
600
|
+
var _EXPENSE_ATTACHMENTS$;
|
|
601
|
+
var expenseId = _ref8.expenseId,
|
|
602
|
+
count = _ref8.count;
|
|
603
|
+
var _useState = (0, _react.useState)(false),
|
|
604
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
605
|
+
open = _useState2[0],
|
|
606
|
+
setOpen = _useState2[1];
|
|
607
|
+
var attachments = [...((_EXPENSE_ATTACHMENTS$ = EXPENSE_ATTACHMENTS[expenseId]) !== null && _EXPENSE_ATTACHMENTS$ !== void 0 ? _EXPENSE_ATTACHMENTS$ : [])].sort(function (a, b) {
|
|
608
|
+
return b.created_on.localeCompare(a.created_on);
|
|
609
|
+
});
|
|
610
|
+
return /*#__PURE__*/_react.default.createElement(_Menu.Menu, {
|
|
611
|
+
open: open,
|
|
612
|
+
onOpen: function onOpen() {
|
|
613
|
+
return setOpen(true);
|
|
614
|
+
},
|
|
615
|
+
onClose: function onClose() {
|
|
616
|
+
return setOpen(false);
|
|
617
|
+
},
|
|
618
|
+
position: "bottom-start",
|
|
619
|
+
mode: "wider",
|
|
620
|
+
target: /*#__PURE__*/_react.default.createElement(AttachmentTarget, {
|
|
621
|
+
count: count
|
|
622
|
+
})
|
|
623
|
+
}, /*#__PURE__*/_react.default.createElement(StyledAttachmentList, null, /*#__PURE__*/_react.default.createElement(_List.List, null, attachments.map(function (attachment) {
|
|
624
|
+
var base = attachment.name.endsWith(".".concat(attachment.extension)) ? attachment.name.slice(0, -attachment.extension.length - 1) : attachment.name;
|
|
625
|
+
return /*#__PURE__*/_react.default.createElement(_List.ListItem, {
|
|
626
|
+
key: attachment.id,
|
|
627
|
+
className: "attachment"
|
|
628
|
+
}, /*#__PURE__*/_react.default.createElement("span", {
|
|
629
|
+
className: "attachment-tile"
|
|
630
|
+
}, /*#__PURE__*/_react.default.createElement(_shared.FileTypeTile, {
|
|
631
|
+
compact: true,
|
|
632
|
+
file: {
|
|
633
|
+
id: attachment.id,
|
|
634
|
+
name: attachment.name,
|
|
635
|
+
extension: attachment.extension,
|
|
636
|
+
file_type: fileTypeOf(attachment.mime_type),
|
|
637
|
+
size: (0, _fileElement.formatFileSize)(attachment.size)
|
|
638
|
+
}
|
|
639
|
+
})), /*#__PURE__*/_react.default.createElement("span", {
|
|
640
|
+
className: "attachment-meta"
|
|
641
|
+
}, /*#__PURE__*/_react.default.createElement(_Typography.Body2, {
|
|
642
|
+
className: "attachment-name"
|
|
643
|
+
}, /*#__PURE__*/_react.default.createElement("span", {
|
|
644
|
+
className: "attachment-base"
|
|
645
|
+
}, "".concat(base, ".")), /*#__PURE__*/_react.default.createElement("span", {
|
|
646
|
+
className: "attachment-extension"
|
|
647
|
+
}, attachment.extension)), /*#__PURE__*/_react.default.createElement(_Typography.Caption1, {
|
|
648
|
+
color: "tertiary",
|
|
649
|
+
overflow: "truncate",
|
|
650
|
+
whitespace: "no-wrap"
|
|
651
|
+
}, "".concat(shortNameOf(attachment.created_by_id), ", ").concat((0, _fileElement.formatFileSize)(attachment.size)))));
|
|
652
|
+
}))));
|
|
653
|
+
};
|
|
654
|
+
|
|
473
655
|
/* UserProfileProjectsSortByPicker.js: a ValueButton that gives way to an icon button on narrow screens.
|
|
474
656
|
It collapses at MD, where the Filter CounterButton drops its label too. */
|
|
475
657
|
var StyledCollapsingValueButton = _styledComponents.default.div.withConfig({
|
|
476
658
|
displayName: "expenses__StyledCollapsingValueButton",
|
|
477
|
-
componentId: "sc-e8k2o8-
|
|
659
|
+
componentId: "sc-e8k2o8-2"
|
|
478
660
|
})(["display:flex;flex-shrink:0;.collapsed-trigger{display:none;}@media (max-width:", "){.c-value-button{display:none;}.collapsed-trigger{display:flex;}}"], _shared.MD);
|
|
479
|
-
var CollapsingValueButton = /*#__PURE__*/(0, _react.forwardRef)(function (
|
|
480
|
-
var active =
|
|
481
|
-
label =
|
|
482
|
-
value =
|
|
483
|
-
icon =
|
|
484
|
-
|
|
485
|
-
open =
|
|
486
|
-
rest = _objectWithoutProperties(
|
|
661
|
+
var CollapsingValueButton = /*#__PURE__*/(0, _react.forwardRef)(function (_ref9, ref) {
|
|
662
|
+
var active = _ref9.active,
|
|
663
|
+
label = _ref9.label,
|
|
664
|
+
value = _ref9.value,
|
|
665
|
+
icon = _ref9.icon,
|
|
666
|
+
_ref9$open = _ref9.open,
|
|
667
|
+
open = _ref9$open === void 0 ? false : _ref9$open,
|
|
668
|
+
rest = _objectWithoutProperties(_ref9, _excluded2);
|
|
487
669
|
return /*#__PURE__*/_react.default.createElement(StyledCollapsingValueButton, _extends({
|
|
488
670
|
ref: ref
|
|
489
671
|
}, rest), /*#__PURE__*/_react.default.createElement(_ValueButton.ValueButton, {
|
|
@@ -499,29 +681,24 @@ var CollapsingValueButton = /*#__PURE__*/(0, _react.forwardRef)(function (_ref7,
|
|
|
499
681
|
}, icon));
|
|
500
682
|
});
|
|
501
683
|
CollapsingValueButton.displayName = "CollapsingValueButton";
|
|
502
|
-
var ExpenseRow = function ExpenseRow(
|
|
503
|
-
var row =
|
|
504
|
-
striped =
|
|
505
|
-
columns =
|
|
684
|
+
var ExpenseRow = function ExpenseRow(_ref0) {
|
|
685
|
+
var row = _ref0.row,
|
|
686
|
+
striped = _ref0.striped,
|
|
687
|
+
columns = _ref0.columns;
|
|
506
688
|
var project = projectOf(row.project_id);
|
|
507
689
|
var person = personOf(row.user_id);
|
|
508
690
|
return /*#__PURE__*/_react.default.createElement("div", {
|
|
509
691
|
className: striped ? "row striped" : "row"
|
|
510
692
|
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
511
693
|
className: "first"
|
|
512
|
-
}, /*#__PURE__*/_react.default.createElement(_Typography.Caption1, {
|
|
513
|
-
weight: "bold",
|
|
514
|
-
color: "secondary",
|
|
515
|
-
align: "right",
|
|
516
|
-
className: "amount",
|
|
517
|
-
title: (0, _utils.formatNumber)(row.value, ",", ".", false, 2)
|
|
518
|
-
}, money(row.value, project.currency_id)), /*#__PURE__*/_react.default.createElement(_Tooltip.Tooltip, {
|
|
519
|
-
title: person.name
|
|
520
694
|
}, /*#__PURE__*/_react.default.createElement(_shared.RoundAvatar, {
|
|
521
695
|
$bg: person.color,
|
|
522
696
|
$size: 24,
|
|
523
697
|
className: "avatar"
|
|
524
|
-
}, person.initials)
|
|
698
|
+
}, person.initials), /*#__PURE__*/_react.default.createElement(_Typography.Body2, {
|
|
699
|
+
overflow: "truncate",
|
|
700
|
+
whitespace: "no-wrap"
|
|
701
|
+
}, person.name)), /*#__PURE__*/_react.default.createElement("div", {
|
|
525
702
|
className: "cols"
|
|
526
703
|
}, columns.category ? /*#__PURE__*/_react.default.createElement(_Typography.Body2, {
|
|
527
704
|
overflow: "truncate",
|
|
@@ -532,16 +709,18 @@ var ExpenseRow = function ExpenseRow(_ref8) {
|
|
|
532
709
|
}, /*#__PURE__*/_react.default.createElement(_Typography.Body2, {
|
|
533
710
|
overflow: "truncate",
|
|
534
711
|
whitespace: "no-wrap"
|
|
535
|
-
}, row.summary)
|
|
536
|
-
|
|
712
|
+
}, row.summary), row.attachments_count > 0 ? /*#__PURE__*/_react.default.createElement(ExpenseAttachmentMenu, {
|
|
713
|
+
expenseId: row.id,
|
|
714
|
+
count: row.attachments_count
|
|
715
|
+
}) : null), columns.client ? /*#__PURE__*/_react.default.createElement(_Typography.Body2, {
|
|
537
716
|
overflow: "truncate",
|
|
538
717
|
whitespace: "no-wrap",
|
|
539
|
-
className: "w-
|
|
540
|
-
},
|
|
718
|
+
className: "w-client"
|
|
719
|
+
}, project.client_name) : null, /*#__PURE__*/_react.default.createElement(_Typography.Caption1, {
|
|
541
720
|
overflow: "truncate",
|
|
542
721
|
whitespace: "no-wrap",
|
|
543
|
-
className: "w-
|
|
544
|
-
},
|
|
722
|
+
className: "w-date"
|
|
723
|
+
}, _momentTimezone.default.utc(row.record_date).format("MMM D.")), columns.project ? /*#__PURE__*/_react.default.createElement("a", {
|
|
545
724
|
className: "link w-project"
|
|
546
725
|
}, /*#__PURE__*/_react.default.createElement(_Typography.Body2, {
|
|
547
726
|
color: "theme-primary",
|
|
@@ -570,18 +749,26 @@ var ExpenseRow = function ExpenseRow(_ref8) {
|
|
|
570
749
|
align: "right",
|
|
571
750
|
overflow: "truncate",
|
|
572
751
|
whitespace: "no-wrap"
|
|
573
|
-
}, BILLABLE_STATUS_LABELS[row.billable_status])))
|
|
752
|
+
}, BILLABLE_STATUS_LABELS[row.billable_status]))), /*#__PURE__*/_react.default.createElement("div", {
|
|
753
|
+
className: "w-amount"
|
|
754
|
+
}, /*#__PURE__*/_react.default.createElement(_Typography.Caption1, {
|
|
755
|
+
weight: "bold",
|
|
756
|
+
color: "secondary",
|
|
757
|
+
align: "right",
|
|
758
|
+
whitespace: "no-wrap",
|
|
759
|
+
title: (0, _utils.formatNumber)(row.value, ",", ".", false, 2)
|
|
760
|
+
}, money(row.value, project.currency_id))));
|
|
574
761
|
};
|
|
575
|
-
var GroupBlock = function GroupBlock(
|
|
576
|
-
var group =
|
|
577
|
-
expanded =
|
|
578
|
-
onToggle =
|
|
579
|
-
columns =
|
|
580
|
-
sortBy =
|
|
581
|
-
direction =
|
|
582
|
-
onSort =
|
|
583
|
-
|
|
584
|
-
flat =
|
|
762
|
+
var GroupBlock = function GroupBlock(_ref1) {
|
|
763
|
+
var group = _ref1.group,
|
|
764
|
+
expanded = _ref1.expanded,
|
|
765
|
+
onToggle = _ref1.onToggle,
|
|
766
|
+
columns = _ref1.columns,
|
|
767
|
+
sortBy = _ref1.sortBy,
|
|
768
|
+
direction = _ref1.direction,
|
|
769
|
+
onSort = _ref1.onSort,
|
|
770
|
+
_ref1$flat = _ref1.flat,
|
|
771
|
+
flat = _ref1$flat === void 0 ? false : _ref1$flat;
|
|
585
772
|
return /*#__PURE__*/_react.default.createElement("div", {
|
|
586
773
|
className: "group"
|
|
587
774
|
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
@@ -594,8 +781,8 @@ var GroupBlock = function GroupBlock(_ref9) {
|
|
|
594
781
|
}), /*#__PURE__*/_react.default.createElement("span", {
|
|
595
782
|
className: "group-label"
|
|
596
783
|
}, flat ? /*#__PURE__*/_react.default.createElement(_controls.SortableColumnHeader, {
|
|
597
|
-
id: "
|
|
598
|
-
title: "
|
|
784
|
+
id: "user",
|
|
785
|
+
title: "Person",
|
|
599
786
|
sortBy: sortBy,
|
|
600
787
|
direction: direction,
|
|
601
788
|
onSort: onSort
|
|
@@ -633,14 +820,6 @@ var GroupBlock = function GroupBlock(_ref9) {
|
|
|
633
820
|
direction: direction,
|
|
634
821
|
onSort: onSort,
|
|
635
822
|
className: "w-description"
|
|
636
|
-
}), /*#__PURE__*/_react.default.createElement(_controls.SortableColumnHeader, {
|
|
637
|
-
id: "record_date",
|
|
638
|
-
title: "Date",
|
|
639
|
-
sortBy: sortBy,
|
|
640
|
-
direction: direction,
|
|
641
|
-
onSort: onSort,
|
|
642
|
-
position: "left",
|
|
643
|
-
className: "w-date"
|
|
644
823
|
}), columns.client ? /*#__PURE__*/_react.default.createElement(_controls.SortableColumnHeader, {
|
|
645
824
|
id: "client",
|
|
646
825
|
title: "Client",
|
|
@@ -648,7 +827,14 @@ var GroupBlock = function GroupBlock(_ref9) {
|
|
|
648
827
|
direction: direction,
|
|
649
828
|
onSort: onSort,
|
|
650
829
|
className: "w-client"
|
|
651
|
-
}) : null,
|
|
830
|
+
}) : null, /*#__PURE__*/_react.default.createElement(_controls.SortableColumnHeader, {
|
|
831
|
+
id: "record_date",
|
|
832
|
+
title: "Date",
|
|
833
|
+
sortBy: sortBy,
|
|
834
|
+
direction: direction,
|
|
835
|
+
onSort: onSort,
|
|
836
|
+
className: "w-date"
|
|
837
|
+
}), columns.project ? /*#__PURE__*/_react.default.createElement(_controls.SortableColumnHeader, {
|
|
652
838
|
id: "project",
|
|
653
839
|
title: "Project",
|
|
654
840
|
sortBy: sortBy,
|
|
@@ -677,6 +863,15 @@ var GroupBlock = function GroupBlock(_ref9) {
|
|
|
677
863
|
onSort: onSort,
|
|
678
864
|
position: "left",
|
|
679
865
|
className: "w-status"
|
|
866
|
+
})), !expanded && !flat ? null : /*#__PURE__*/_react.default.createElement("div", {
|
|
867
|
+
className: "w-amount"
|
|
868
|
+
}, /*#__PURE__*/_react.default.createElement(_controls.SortableColumnHeader, {
|
|
869
|
+
id: "value",
|
|
870
|
+
title: "Amount",
|
|
871
|
+
sortBy: sortBy,
|
|
872
|
+
direction: direction,
|
|
873
|
+
onSort: onSort,
|
|
874
|
+
position: "left"
|
|
680
875
|
}))), expanded || flat ? group.records.map(function (row, index) {
|
|
681
876
|
return /*#__PURE__*/_react.default.createElement(ExpenseRow, {
|
|
682
877
|
key: row.id,
|
|
@@ -698,50 +893,50 @@ var GroupBlock = function GroupBlock(_ref9) {
|
|
|
698
893
|
/* Page */
|
|
699
894
|
/* ------------------------------------------------------------------ */
|
|
700
895
|
|
|
701
|
-
var ExpensesPage = exports.ExpensesPage = function ExpensesPage(
|
|
896
|
+
var ExpensesPage = exports.ExpensesPage = function ExpensesPage(_ref10) {
|
|
702
897
|
var _EXPENSE_GROUP_BY_OPT, _EXPENSE_GROUP_BY_OPT2, _currencyOptions$find, _currencyOptions$find2;
|
|
703
|
-
var look =
|
|
704
|
-
|
|
705
|
-
initialGroupBy =
|
|
706
|
-
initialExpanded =
|
|
707
|
-
|
|
708
|
-
records =
|
|
709
|
-
var
|
|
710
|
-
_useState2 = _slicedToArray(_useState, 2),
|
|
711
|
-
groupBy = _useState2[0],
|
|
712
|
-
setGroupBy = _useState2[1];
|
|
713
|
-
var _useState3 = (0, _react.useState)(false),
|
|
898
|
+
var look = _ref10.look,
|
|
899
|
+
_ref10$initialGroupBy = _ref10.initialGroupBy,
|
|
900
|
+
initialGroupBy = _ref10$initialGroupBy === void 0 ? "dont" : _ref10$initialGroupBy,
|
|
901
|
+
initialExpanded = _ref10.initialExpanded,
|
|
902
|
+
_ref10$records = _ref10.records,
|
|
903
|
+
records = _ref10$records === void 0 ? EXPENSES_2026 : _ref10$records;
|
|
904
|
+
var _useState3 = (0, _react.useState)(initialGroupBy),
|
|
714
905
|
_useState4 = _slicedToArray(_useState3, 2),
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
var _useState5 = (0, _react.useState)(
|
|
906
|
+
groupBy = _useState4[0],
|
|
907
|
+
setGroupBy = _useState4[1];
|
|
908
|
+
var _useState5 = (0, _react.useState)(false),
|
|
718
909
|
_useState6 = _slicedToArray(_useState5, 2),
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
var _useState7 = (0, _react.useState)(
|
|
910
|
+
groupByOpen = _useState6[0],
|
|
911
|
+
setGroupByOpen = _useState6[1];
|
|
912
|
+
var _useState7 = (0, _react.useState)(0),
|
|
722
913
|
_useState8 = _slicedToArray(_useState7, 2),
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
var _useState9 = (0, _react.useState)(
|
|
914
|
+
currency = _useState8[0],
|
|
915
|
+
setCurrency = _useState8[1];
|
|
916
|
+
var _useState9 = (0, _react.useState)(false),
|
|
726
917
|
_useState0 = _slicedToArray(_useState9, 2),
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
var _useState1 = (0, _react.useState)(
|
|
918
|
+
currencyOpen = _useState0[0],
|
|
919
|
+
setCurrencyOpen = _useState0[1];
|
|
920
|
+
var _useState1 = (0, _react.useState)({}),
|
|
730
921
|
_useState10 = _slicedToArray(_useState1, 2),
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
var _useState11 = (0, _react.useState)("
|
|
922
|
+
filter = _useState10[0],
|
|
923
|
+
setFilter = _useState10[1];
|
|
924
|
+
var _useState11 = (0, _react.useState)("record_date"),
|
|
734
925
|
_useState12 = _slicedToArray(_useState11, 2),
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
var _useState13 = (0, _react.useState)(
|
|
926
|
+
sortBy = _useState12[0],
|
|
927
|
+
setSortBy = _useState12[1];
|
|
928
|
+
var _useState13 = (0, _react.useState)("desc"),
|
|
738
929
|
_useState14 = _slicedToArray(_useState13, 2),
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
var _useState15 = (0, _react.useState)(
|
|
930
|
+
direction = _useState14[0],
|
|
931
|
+
setDirection = _useState14[1];
|
|
932
|
+
var _useState15 = (0, _react.useState)([]),
|
|
742
933
|
_useState16 = _slicedToArray(_useState15, 2),
|
|
743
|
-
|
|
744
|
-
|
|
934
|
+
collapsed = _useState16[0],
|
|
935
|
+
setCollapsed = _useState16[1];
|
|
936
|
+
var _useState17 = (0, _react.useState)(false),
|
|
937
|
+
_useState18 = _slicedToArray(_useState17, 2),
|
|
938
|
+
initialised = _useState18[0],
|
|
939
|
+
setInitialised = _useState18[1];
|
|
745
940
|
var visible = (0, _react.useMemo)(function () {
|
|
746
941
|
return records.filter(function (row) {
|
|
747
942
|
var project = projectOf(row.project_id);
|
|
@@ -802,10 +997,10 @@ var ExpensesPage = exports.ExpensesPage = function ExpensesPage(_ref0) {
|
|
|
802
997
|
var currencyOptions = [{
|
|
803
998
|
id: 0,
|
|
804
999
|
name: "Any"
|
|
805
|
-
}, ...Object.entries(_data.CURRENCIES).map(function (
|
|
806
|
-
var
|
|
807
|
-
id =
|
|
808
|
-
value =
|
|
1000
|
+
}, ...Object.entries(_data.CURRENCIES).map(function (_ref11) {
|
|
1001
|
+
var _ref12 = _slicedToArray(_ref11, 2),
|
|
1002
|
+
id = _ref12[0],
|
|
1003
|
+
value = _ref12[1];
|
|
809
1004
|
return {
|
|
810
1005
|
id: Number(id),
|
|
811
1006
|
name: value.code
|
|
@@ -824,7 +1019,15 @@ var ExpensesPage = exports.ExpensesPage = function ExpensesPage(_ref0) {
|
|
|
824
1019
|
}, /*#__PURE__*/_react.default.createElement(_controls.IntervalStepper, {
|
|
825
1020
|
options: EXPENSE_INTERVAL_OPTIONS,
|
|
826
1021
|
pill: true
|
|
827
|
-
})), /*#__PURE__*/_react.default.createElement(_HeaderControls.HeaderControls, null, /*#__PURE__*/_react.default.createElement(_HeaderControls.HeaderControls, null, /*#__PURE__*/_react.default.createElement(_controls.ExportButton, null)), /*#__PURE__*/_react.default.createElement(_HeaderControls.HeaderControls, null, /*#__PURE__*/_react.default.createElement(
|
|
1022
|
+
})), /*#__PURE__*/_react.default.createElement(_HeaderControls.HeaderControls, null, /*#__PURE__*/_react.default.createElement(_HeaderControls.HeaderControls, null, /*#__PURE__*/_react.default.createElement(_controls.ExportButton, null)), /*#__PURE__*/_react.default.createElement(_HeaderControls.HeaderControls, null, /*#__PURE__*/_react.default.createElement(_Filter.Filter, {
|
|
1023
|
+
data: EXPENSES_FILTER_DATA,
|
|
1024
|
+
selected: filter,
|
|
1025
|
+
label: "Filter",
|
|
1026
|
+
clearAllText: "Clear All",
|
|
1027
|
+
resetLabel: "Reset",
|
|
1028
|
+
noResultText: "No results",
|
|
1029
|
+
onChange: setFilter
|
|
1030
|
+
}), /*#__PURE__*/_react.default.createElement(_Select.Select, {
|
|
828
1031
|
options: EXPENSE_GROUP_BY_OPTIONS,
|
|
829
1032
|
selected: groupBy,
|
|
830
1033
|
onChange: function onChange(value) {
|
|
@@ -843,19 +1046,11 @@ var ExpensesPage = exports.ExpensesPage = function ExpensesPage(_ref0) {
|
|
|
843
1046
|
target: /*#__PURE__*/_react.default.createElement(CollapsingValueButton, {
|
|
844
1047
|
active: groupByOpen,
|
|
845
1048
|
icon: /*#__PURE__*/_react.default.createElement(_Icons.GroupByIcon, null),
|
|
846
|
-
label: "Group
|
|
1049
|
+
label: "Group",
|
|
847
1050
|
value: (_EXPENSE_GROUP_BY_OPT = (_EXPENSE_GROUP_BY_OPT2 = EXPENSE_GROUP_BY_OPTIONS.find(function (option) {
|
|
848
1051
|
return option.id === groupBy;
|
|
849
1052
|
})) === null || _EXPENSE_GROUP_BY_OPT2 === void 0 ? void 0 : _EXPENSE_GROUP_BY_OPT2.name) !== null && _EXPENSE_GROUP_BY_OPT !== void 0 ? _EXPENSE_GROUP_BY_OPT : "No Grouping"
|
|
850
1053
|
})
|
|
851
|
-
}), /*#__PURE__*/_react.default.createElement(_Filter.Filter, {
|
|
852
|
-
data: EXPENSES_FILTER_DATA,
|
|
853
|
-
selected: filter,
|
|
854
|
-
label: "Filter",
|
|
855
|
-
clearAllText: "Clear All",
|
|
856
|
-
resetLabel: "Reset",
|
|
857
|
-
noResultText: "No results",
|
|
858
|
-
onChange: setFilter
|
|
859
1054
|
}), /*#__PURE__*/_react.default.createElement(_Select.Select, {
|
|
860
1055
|
options: currencyOptions,
|
|
861
1056
|
selected: currency,
|
|
@@ -925,22 +1120,6 @@ var ExpensesPage = exports.ExpensesPage = function ExpensesPage(_ref0) {
|
|
|
925
1120
|
onSort: handleSort,
|
|
926
1121
|
flat: flat
|
|
927
1122
|
});
|
|
928
|
-
})
|
|
929
|
-
className: "grand-total"
|
|
930
|
-
}, /*#__PURE__*/_react.default.createElement(_Typography.Caption1, {
|
|
931
|
-
weight: "bold",
|
|
932
|
-
className: "grand-total-label"
|
|
933
|
-
}, "Total:"), /*#__PURE__*/_react.default.createElement("div", {
|
|
934
|
-
className: "totals"
|
|
935
|
-
}, Object.entries(grandTotals).map(function (_ref11) {
|
|
936
|
-
var _ref12 = _slicedToArray(_ref11, 2),
|
|
937
|
-
currencyId = _ref12[0],
|
|
938
|
-
value = _ref12[1];
|
|
939
|
-
return /*#__PURE__*/_react.default.createElement(_Typography.Caption1, {
|
|
940
|
-
key: currencyId,
|
|
941
|
-
weight: "bold",
|
|
942
|
-
align: "right"
|
|
943
|
-
}, money(value, Number(currencyId)));
|
|
944
|
-
})))))));
|
|
1123
|
+
})))));
|
|
945
1124
|
};
|
|
946
1125
|
//# sourceMappingURL=expenses.js.map
|