@lighthouse/common 6.4.0-canary.5 → 6.5.0
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/constants.js +13 -7
- package/dist/errors/DomainError.js +4 -2
- package/dist/errors/ValidationError.js +8 -0
- package/dist/errors/index.js +5 -1
- package/dist/helpers/build-fetch-url/index.js +5 -0
- package/dist/helpers/fetch-image/index.js +32 -16
- package/dist/helpers/fetch-image-for-pdf-generator-service/index.js +44 -22
- package/dist/helpers/fetch-image-for-web/index.js +9 -0
- package/dist/helpers/fetch-lighthouse-logo/index.js +13 -2
- package/dist/helpers/floatify/index.js +1 -0
- package/dist/helpers/get-assignees-full-names/index.js +4 -0
- package/dist/helpers/get-audit-entry-details/index.js +3 -0
- package/dist/helpers/get-audit-items-data/index.js +6 -2
- package/dist/helpers/get-geometry-geocoded-string/index.js +3 -0
- package/dist/helpers/get-issue-details/index.js +9 -0
- package/dist/helpers/get-job-details/index.js +7 -0
- package/dist/helpers/get-location-reference/index.js +21 -18
- package/dist/helpers/get-pretty-duration/index.js +5 -0
- package/dist/helpers/get-reference-details/index.js +4 -0
- package/dist/helpers/get-status-details/index.js +9 -2
- package/dist/helpers/get-task-entry-details/index.js +3 -0
- package/dist/helpers/get-timezone-abbr/index.js +4 -0
- package/dist/helpers/get-timezone-datetime/index.js +5 -0
- package/dist/helpers/get-user-full-name/index.js +1 -0
- package/dist/helpers/get-value-as-percentage/index.js +1 -0
- package/dist/helpers/image-validators/index.js +9 -8
- package/dist/helpers/index.js +33 -16
- package/dist/images/index.js +9 -5
- package/dist/index.js +20 -4
- package/dist/pdf/activity-report/index.js +62 -41
- package/dist/pdf/audit/index.js +14 -0
- package/dist/pdf/helpers/build-audit-content/index.js +15 -4
- package/dist/pdf/helpers/build-audit-follow-ups/index.js +14 -4
- package/dist/pdf/helpers/build-location-scans-content/index.js +17 -4
- package/dist/pdf/helpers/build-template-content/index.js +14 -5
- package/dist/pdf/helpers/default-footer/index.js +3 -2
- package/dist/pdf/helpers/default-header/index.js +2 -0
- package/dist/pdf/helpers/default-styles/index.js +3 -2
- package/dist/pdf/helpers/fields/index.js +51 -21
- package/dist/pdf/helpers/format-location-address/index.js +3 -0
- package/dist/pdf/helpers/generate-definition/index.js +12 -0
- package/dist/pdf/helpers/horizontal-line/index.js +1 -0
- package/dist/pdf/helpers/html-transformer/index.js +23 -11
- package/dist/pdf/helpers/index.js +55 -40
- package/dist/pdf/helpers/parse-value/index.js +6 -2
- package/dist/pdf/helpers/table/index.js +31 -13
- package/dist/pdf/helpers/text/index.js +1 -0
- package/dist/pdf/icons/index.js +5 -3
- package/dist/pdf/index.js +10 -4
- package/dist/pdf/issue/index.js +14 -0
- package/dist/pdf/job/index.js +13 -1
- package/dist/pdf/shift-report/emptyFixtures.js +6 -4
- package/dist/pdf/shift-report/index.js +25 -2
- package/dist/pdf/task/index.js +13 -0
- package/dist/scheduling/generators/index.js +6 -0
- package/dist/scheduling/generators/occurrenceIntervalsGenerator.js +6 -1
- package/dist/scheduling/generators/scheduleIntervalsGenerator.js +5 -0
- package/dist/scheduling/generators/serviceIntervalsGenerator.js +27 -13
- package/dist/scheduling/helpers/convertToTimezone.js +6 -1
- package/dist/scheduling/helpers/generateNonRepeatingSchedule.js +9 -3
- package/dist/scheduling/helpers/generateRepeatingSchedule.js +18 -11
- package/dist/scheduling/helpers/generateScheduleEnd.js +8 -2
- package/dist/scheduling/helpers/hasValidStartAndEnd.js +6 -0
- package/dist/scheduling/helpers/index.js +28 -0
- package/dist/scheduling/helpers/intervalCovers.js +1 -0
- package/dist/scheduling/helpers/intervalIntersectsEnd.js +1 -0
- package/dist/scheduling/helpers/intervalIntersectsStart.js +1 -0
- package/dist/scheduling/helpers/intervalOnlyIntersectsEnd.js +3 -1
- package/dist/scheduling/helpers/intervalOnlyIntersectsStart.js +3 -0
- package/dist/scheduling/helpers/intervalOutside.js +1 -0
- package/dist/scheduling/helpers/intervalWithin.js +1 -0
- package/dist/scheduling/helpers/mergeIntervals.js +4 -0
- package/dist/scheduling/helpers/splitIntervals.js +3 -0
- package/dist/scheduling/index.js +6 -0
- package/dist/scheduling/scheduling.types.js +18 -10
- package/dist/scheduling/strategies/getNext.js +13 -2
- package/dist/scheduling/strategies/getNextExactDateOfMonth.js +12 -0
- package/dist/scheduling/strategies/getNextLastDayOfMonth.js +10 -0
- package/dist/scheduling/strategies/getNextLastWeekdayOfMonth.js +11 -0
- package/dist/scheduling/strategies/getNextNoRepeat.js +7 -0
- package/dist/scheduling/strategies/getNextWeekday.js +10 -0
- package/dist/scheduling/strategies/getNextXDayOfXWeekOfMonth.js +12 -0
- package/dist/scheduling/strategies/index.js +14 -0
- package/dist/schema/index.js +2 -0
- package/dist/schema/schema.js +7 -2
- package/dist/service-hours/__helpers__/calculate-hours.js +13 -4
- package/dist/service-hours/__helpers__/isOpen.js +9 -0
- package/dist/service-hours/index.js +4 -0
- package/dist/service-hours/schema.js +43 -20
- package/lib/constants.js.map +1 -1
- package/lib/errors/DomainError.js +47 -11
- package/lib/errors/DomainError.js.map +1 -1
- package/lib/errors/ValidationError.js +52 -15
- package/lib/errors/ValidationError.js.map +1 -1
- package/lib/errors/index.js.map +1 -1
- package/lib/helpers/build-fetch-url/index.js +20 -14
- package/lib/helpers/build-fetch-url/index.js.map +1 -1
- package/lib/helpers/fetch-image/index.js +27 -20
- package/lib/helpers/fetch-image/index.js.map +1 -1
- package/lib/helpers/fetch-image-for-pdf-generator-service/index.js +242 -201
- package/lib/helpers/fetch-image-for-pdf-generator-service/index.js.map +1 -1
- package/lib/helpers/fetch-image-for-web/index.js +66 -50
- package/lib/helpers/fetch-image-for-web/index.js.map +1 -1
- package/lib/helpers/fetch-lighthouse-logo/index.js +59 -47
- package/lib/helpers/fetch-lighthouse-logo/index.js.map +1 -1
- package/lib/helpers/floatify/index.js.map +1 -1
- package/lib/helpers/get-assignees-full-names/index.js +1 -0
- package/lib/helpers/get-assignees-full-names/index.js.map +1 -1
- package/lib/helpers/get-audit-entry-details/index.js +8 -8
- package/lib/helpers/get-audit-entry-details/index.js.map +1 -1
- package/lib/helpers/get-audit-items-data/index.js +19 -16
- package/lib/helpers/get-audit-items-data/index.js.map +1 -1
- package/lib/helpers/get-geometry-geocoded-string/index.js.map +1 -1
- package/lib/helpers/get-issue-details/index.js +12 -9
- package/lib/helpers/get-issue-details/index.js.map +1 -1
- package/lib/helpers/get-job-details/index.js +12 -12
- package/lib/helpers/get-job-details/index.js.map +1 -1
- package/lib/helpers/get-location-reference/index.js +36 -32
- package/lib/helpers/get-location-reference/index.js.map +1 -1
- package/lib/helpers/get-pretty-duration/index.js +4 -0
- package/lib/helpers/get-pretty-duration/index.js.map +1 -1
- package/lib/helpers/get-reference-details/index.js +3 -1
- package/lib/helpers/get-reference-details/index.js.map +1 -1
- package/lib/helpers/get-status-details/index.js +4 -0
- package/lib/helpers/get-status-details/index.js.map +1 -1
- package/lib/helpers/get-task-entry-details/index.js +5 -5
- package/lib/helpers/get-task-entry-details/index.js.map +1 -1
- package/lib/helpers/get-timezone-abbr/index.js.map +1 -1
- package/lib/helpers/get-timezone-datetime/index.js +6 -6
- package/lib/helpers/get-timezone-datetime/index.js.map +1 -1
- package/lib/helpers/get-user-full-name/index.js.map +1 -1
- package/lib/helpers/get-value-as-percentage/index.js.map +1 -1
- package/lib/helpers/image-validators/index.js +7 -8
- package/lib/helpers/image-validators/index.js.map +1 -1
- package/lib/helpers/index.js.map +1 -1
- package/lib/images/index.js.map +1 -1
- package/lib/index.js.map +1 -1
- package/lib/pdf/activity-report/index.js +416 -360
- package/lib/pdf/activity-report/index.js.map +1 -1
- package/lib/pdf/audit/index.js +36 -25
- package/lib/pdf/audit/index.js.map +1 -1
- package/lib/pdf/fonts/index.js.map +1 -1
- package/lib/pdf/helpers/build-audit-content/index.js +5 -3
- package/lib/pdf/helpers/build-audit-content/index.js.map +1 -1
- package/lib/pdf/helpers/build-audit-follow-ups/index.js +12 -5
- package/lib/pdf/helpers/build-audit-follow-ups/index.js.map +1 -1
- package/lib/pdf/helpers/build-location-scans-content/index.js +9 -4
- package/lib/pdf/helpers/build-location-scans-content/index.js.map +1 -1
- package/lib/pdf/helpers/build-template-content/index.js +9 -7
- package/lib/pdf/helpers/build-template-content/index.js.map +1 -1
- package/lib/pdf/helpers/default-footer/index.js +8 -9
- package/lib/pdf/helpers/default-footer/index.js.map +1 -1
- package/lib/pdf/helpers/default-header/index.js +5 -5
- package/lib/pdf/helpers/default-header/index.js.map +1 -1
- package/lib/pdf/helpers/default-styles/index.js.map +1 -1
- package/lib/pdf/helpers/fields/index.js +81 -48
- package/lib/pdf/helpers/fields/index.js.map +1 -1
- package/lib/pdf/helpers/format-location-address/index.js.map +1 -1
- package/lib/pdf/helpers/generate-definition/index.js +29 -22
- package/lib/pdf/helpers/generate-definition/index.js.map +1 -1
- package/lib/pdf/helpers/horizontal-line/index.js +1 -1
- package/lib/pdf/helpers/horizontal-line/index.js.map +1 -1
- package/lib/pdf/helpers/html-transformer/index.js +30 -19
- package/lib/pdf/helpers/html-transformer/index.js.map +1 -1
- package/lib/pdf/helpers/index.js.map +1 -1
- package/lib/pdf/helpers/parse-value/index.js +4 -2
- package/lib/pdf/helpers/parse-value/index.js.map +1 -1
- package/lib/pdf/helpers/table/index.js +84 -78
- package/lib/pdf/helpers/table/index.js.map +1 -1
- package/lib/pdf/helpers/text/index.js +5 -2
- package/lib/pdf/helpers/text/index.js.map +1 -1
- package/lib/pdf/icons/index.js.map +1 -1
- package/lib/pdf/index.js.map +1 -1
- package/lib/pdf/issue/index.js +28 -19
- package/lib/pdf/issue/index.js.map +1 -1
- package/lib/pdf/job/index.js +19 -12
- package/lib/pdf/job/index.js.map +1 -1
- package/lib/pdf/shift-report/emptyFixtures.js.map +1 -1
- package/lib/pdf/shift-report/index.js +374 -308
- package/lib/pdf/shift-report/index.js.map +1 -1
- package/lib/pdf/task/index.js +19 -11
- package/lib/pdf/task/index.js.map +1 -1
- package/lib/scheduling/generators/index.js.map +1 -1
- package/lib/scheduling/generators/occurrenceIntervalsGenerator.js +38 -27
- package/lib/scheduling/generators/occurrenceIntervalsGenerator.js.map +1 -1
- package/lib/scheduling/generators/scheduleIntervalsGenerator.js +30 -19
- package/lib/scheduling/generators/scheduleIntervalsGenerator.js.map +1 -1
- package/lib/scheduling/generators/serviceIntervalsGenerator.js +181 -139
- package/lib/scheduling/generators/serviceIntervalsGenerator.js.map +1 -1
- package/lib/scheduling/helpers/convertToTimezone.js +1 -1
- package/lib/scheduling/helpers/convertToTimezone.js.map +1 -1
- package/lib/scheduling/helpers/generateNonRepeatingSchedule.js +124 -84
- package/lib/scheduling/helpers/generateNonRepeatingSchedule.js.map +1 -1
- package/lib/scheduling/helpers/generateRepeatingSchedule.js +175 -107
- package/lib/scheduling/helpers/generateRepeatingSchedule.js.map +1 -1
- package/lib/scheduling/helpers/generateScheduleEnd.js +6 -6
- package/lib/scheduling/helpers/generateScheduleEnd.js.map +1 -1
- package/lib/scheduling/helpers/hasValidStartAndEnd.js +2 -1
- package/lib/scheduling/helpers/hasValidStartAndEnd.js.map +1 -1
- package/lib/scheduling/helpers/index.js.map +1 -1
- package/lib/scheduling/helpers/intervalCovers.js.map +1 -1
- package/lib/scheduling/helpers/intervalIntersectsEnd.js.map +1 -1
- package/lib/scheduling/helpers/intervalIntersectsStart.js.map +1 -1
- package/lib/scheduling/helpers/intervalOnlyIntersectsEnd.js +0 -1
- package/lib/scheduling/helpers/intervalOnlyIntersectsEnd.js.map +1 -1
- package/lib/scheduling/helpers/intervalOnlyIntersectsStart.js +1 -1
- package/lib/scheduling/helpers/intervalOnlyIntersectsStart.js.map +1 -1
- package/lib/scheduling/helpers/intervalOutside.js.map +1 -1
- package/lib/scheduling/helpers/intervalWithin.js.map +1 -1
- package/lib/scheduling/helpers/mergeIntervals.js +3 -0
- package/lib/scheduling/helpers/mergeIntervals.js.map +1 -1
- package/lib/scheduling/helpers/splitIntervals.js +1 -1
- package/lib/scheduling/helpers/splitIntervals.js.map +1 -1
- package/lib/scheduling/index.js.map +1 -1
- package/lib/scheduling/scheduling.types.js +14 -9
- package/lib/scheduling/scheduling.types.js.map +1 -1
- package/lib/scheduling/strategies/getNext.js +30 -22
- package/lib/scheduling/strategies/getNext.js.map +1 -1
- package/lib/scheduling/strategies/getNextExactDateOfMonth.js +31 -22
- package/lib/scheduling/strategies/getNextExactDateOfMonth.js.map +1 -1
- package/lib/scheduling/strategies/getNextLastDayOfMonth.js +28 -21
- package/lib/scheduling/strategies/getNextLastDayOfMonth.js.map +1 -1
- package/lib/scheduling/strategies/getNextLastWeekdayOfMonth.js +28 -21
- package/lib/scheduling/strategies/getNextLastWeekdayOfMonth.js.map +1 -1
- package/lib/scheduling/strategies/getNextNoRepeat.js +23 -15
- package/lib/scheduling/strategies/getNextNoRepeat.js.map +1 -1
- package/lib/scheduling/strategies/getNextWeekday.js +78 -43
- package/lib/scheduling/strategies/getNextWeekday.js.map +1 -1
- package/lib/scheduling/strategies/getNextXDayOfXWeekOfMonth.js +28 -21
- package/lib/scheduling/strategies/getNextXDayOfXWeekOfMonth.js.map +1 -1
- package/lib/scheduling/strategies/index.js.map +1 -1
- package/lib/schema/index.js.map +1 -1
- package/lib/schema/schema.js +30 -22
- package/lib/schema/schema.js.map +1 -1
- package/lib/service-hours/__helpers__/calculate-hours.js +13 -4
- package/lib/service-hours/__helpers__/calculate-hours.js.map +1 -1
- package/lib/service-hours/__helpers__/isOpen.js +7 -3
- package/lib/service-hours/__helpers__/isOpen.js.map +1 -1
- package/lib/service-hours/index.js.map +1 -1
- package/lib/service-hours/schema.js +36 -21
- package/lib/service-hours/schema.js.map +1 -1
- package/package.json +4 -5
- package/mise.toml +0 -6
|
@@ -1,9 +1,12 @@
|
|
|
1
1
|
import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray";
|
|
2
|
+
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
2
3
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
3
4
|
import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
|
|
4
|
-
|
|
5
|
-
function ownKeys(
|
|
6
|
-
|
|
5
|
+
|
|
6
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }
|
|
7
|
+
|
|
8
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
|
9
|
+
|
|
7
10
|
import Promise from 'bluebird';
|
|
8
11
|
import { each, filter, find, groupBy, isEmpty, map, size, sortBy, sum, toString, trim } from 'lodash';
|
|
9
12
|
import moment, { duration } from 'moment-timezone';
|
|
@@ -11,7 +14,6 @@ import { getLocationReference, getTimezoneAbbr, getTimezoneDatetime } from '../.
|
|
|
11
14
|
import { launchIcon } from '../../images';
|
|
12
15
|
import { generateDefinition, horizontalLine, summaryFieldsTable, summaryStatTable, summaryWrapperTable, table, text, threeColumnTable, zebraFillColor } from '../helpers';
|
|
13
16
|
var LIGHTHOUSE_BASE_URL = 'https://app.lighthouse.io';
|
|
14
|
-
|
|
15
17
|
/**
|
|
16
18
|
* buildActivityPdf
|
|
17
19
|
* @param {object} pdfOptions - the pdf options
|
|
@@ -45,91 +47,110 @@ var LIGHTHOUSE_BASE_URL = 'https://app.lighthouse.io';
|
|
|
45
47
|
export function buildShiftPdf(_x, _x2) {
|
|
46
48
|
return _buildShiftPdf.apply(this, arguments);
|
|
47
49
|
}
|
|
50
|
+
|
|
48
51
|
function _buildShiftPdf() {
|
|
49
|
-
_buildShiftPdf = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee(pdfOptions, data) {
|
|
52
|
+
_buildShiftPdf = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(pdfOptions, data) {
|
|
50
53
|
var timestamp, timezone, title, content;
|
|
51
|
-
return _regeneratorRuntime.wrap(function (_context) {
|
|
52
|
-
while (1)
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
content
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
54
|
+
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
|
55
|
+
while (1) {
|
|
56
|
+
switch (_context.prev = _context.next) {
|
|
57
|
+
case 0:
|
|
58
|
+
timestamp = data.timestamp, timezone = data.timezone;
|
|
59
|
+
title = 'Daily Shift Report';
|
|
60
|
+
_context.next = 4;
|
|
61
|
+
return generateContent(data);
|
|
62
|
+
|
|
63
|
+
case 4:
|
|
64
|
+
content = _context.sent;
|
|
65
|
+
return _context.abrupt("return", generateDefinition(_objectSpread({
|
|
66
|
+
content: content,
|
|
67
|
+
fileTitle: title,
|
|
68
|
+
timestamp: timestamp,
|
|
69
|
+
timezone: timezone,
|
|
70
|
+
type: 'Shift Report'
|
|
71
|
+
}, pdfOptions)));
|
|
72
|
+
|
|
73
|
+
case 6:
|
|
74
|
+
case "end":
|
|
75
|
+
return _context.stop();
|
|
76
|
+
}
|
|
70
77
|
}
|
|
71
78
|
}, _callee);
|
|
72
79
|
}));
|
|
73
80
|
return _buildShiftPdf.apply(this, arguments);
|
|
74
81
|
}
|
|
82
|
+
|
|
75
83
|
function generateContent(_x3) {
|
|
76
84
|
return _generateContent.apply(this, arguments);
|
|
77
85
|
}
|
|
86
|
+
|
|
78
87
|
function _generateContent() {
|
|
79
|
-
_generateContent = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee2(data) {
|
|
88
|
+
_generateContent = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2(data) {
|
|
80
89
|
var activitySection, summarySection, titleTable;
|
|
81
|
-
return _regeneratorRuntime.wrap(function (_context2) {
|
|
82
|
-
while (1)
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
90
|
+
return _regeneratorRuntime.wrap(function _callee2$(_context2) {
|
|
91
|
+
while (1) {
|
|
92
|
+
switch (_context2.prev = _context2.next) {
|
|
93
|
+
case 0:
|
|
94
|
+
_context2.next = 2;
|
|
95
|
+
return buildActivitySection(data);
|
|
96
|
+
|
|
97
|
+
case 2:
|
|
98
|
+
activitySection = _context2.sent;
|
|
99
|
+
summarySection = buildSummarySection(data);
|
|
100
|
+
titleTable = buildTitleTable(data);
|
|
101
|
+
return _context2.abrupt("return", [titleTable, summarySection, activitySection]);
|
|
102
|
+
|
|
103
|
+
case 6:
|
|
104
|
+
case "end":
|
|
105
|
+
return _context2.stop();
|
|
106
|
+
}
|
|
94
107
|
}
|
|
95
108
|
}, _callee2);
|
|
96
109
|
}));
|
|
97
110
|
return _generateContent.apply(this, arguments);
|
|
98
111
|
}
|
|
112
|
+
|
|
99
113
|
function buildActivitySection(_x4) {
|
|
100
114
|
return _buildActivitySection.apply(this, arguments);
|
|
101
115
|
}
|
|
116
|
+
|
|
102
117
|
function _buildActivitySection() {
|
|
103
|
-
_buildActivitySection = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee3(data) {
|
|
118
|
+
_buildActivitySection = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee3(data) {
|
|
104
119
|
var timeline, activitySummary;
|
|
105
|
-
return _regeneratorRuntime.wrap(function (_context3) {
|
|
106
|
-
while (1)
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
+
return _regeneratorRuntime.wrap(function _callee3$(_context3) {
|
|
121
|
+
while (1) {
|
|
122
|
+
switch (_context3.prev = _context3.next) {
|
|
123
|
+
case 0:
|
|
124
|
+
_context3.next = 2;
|
|
125
|
+
return buildTimelineTable(data);
|
|
126
|
+
|
|
127
|
+
case 2:
|
|
128
|
+
timeline = _context3.sent;
|
|
129
|
+
_context3.next = 5;
|
|
130
|
+
return buildActivitySummarySection(data);
|
|
131
|
+
|
|
132
|
+
case 5:
|
|
133
|
+
activitySummary = _context3.sent;
|
|
134
|
+
return _context3.abrupt("return", [timeline, activitySummary]);
|
|
135
|
+
|
|
136
|
+
case 7:
|
|
137
|
+
case "end":
|
|
138
|
+
return _context3.stop();
|
|
139
|
+
}
|
|
120
140
|
}
|
|
121
141
|
}, _callee3);
|
|
122
142
|
}));
|
|
123
143
|
return _buildActivitySection.apply(this, arguments);
|
|
124
144
|
}
|
|
145
|
+
|
|
125
146
|
function buildTitleTable(data) {
|
|
126
147
|
var shift = data.shift,
|
|
127
|
-
|
|
128
|
-
|
|
148
|
+
timezone = data.timezone,
|
|
149
|
+
user = data.user;
|
|
129
150
|
var breaks = shift.breaks,
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
151
|
+
duration = shift.duration,
|
|
152
|
+
end = shift.end,
|
|
153
|
+
start = shift.start;
|
|
133
154
|
var headerTitle = text('Daily Shift Report', {
|
|
134
155
|
style: 'title'
|
|
135
156
|
});
|
|
@@ -153,11 +174,12 @@ function buildTitleTable(data) {
|
|
|
153
174
|
style: 'titleTable'
|
|
154
175
|
});
|
|
155
176
|
}
|
|
177
|
+
|
|
156
178
|
function buildSummarySection(data) {
|
|
157
179
|
var audits = data.audits,
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
180
|
+
events = data.events,
|
|
181
|
+
issues = data.issues,
|
|
182
|
+
tasks = data.tasks;
|
|
161
183
|
var eventsByType = groupBy(events, 'type');
|
|
162
184
|
var enterEventsCount = size(eventsByType.enter);
|
|
163
185
|
var issuesCount = size(issues);
|
|
@@ -204,206 +226,227 @@ function buildSummarySection(data) {
|
|
|
204
226
|
});
|
|
205
227
|
return wrapperTable;
|
|
206
228
|
}
|
|
229
|
+
|
|
207
230
|
function buildActivitySummarySection(_x5) {
|
|
208
231
|
return _buildActivitySummarySection.apply(this, arguments);
|
|
209
232
|
}
|
|
233
|
+
|
|
210
234
|
function _buildActivitySummarySection() {
|
|
211
|
-
_buildActivitySummarySection = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee4(data) {
|
|
235
|
+
_buildActivitySummarySection = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee4(data) {
|
|
212
236
|
var audits, events, issues, settings, tasks, timezone, enterEvents, auditRows, issueRows, scanRows, taskRows, rows, sortedRows, title, header, hLine, activityTable, activitySummarySection;
|
|
213
|
-
return _regeneratorRuntime.wrap(function (_context4) {
|
|
214
|
-
while (1)
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
237
|
+
return _regeneratorRuntime.wrap(function _callee4$(_context4) {
|
|
238
|
+
while (1) {
|
|
239
|
+
switch (_context4.prev = _context4.next) {
|
|
240
|
+
case 0:
|
|
241
|
+
audits = data.audits, events = data.events, issues = data.issues, settings = data.settings, tasks = data.tasks, timezone = data.timezone;
|
|
242
|
+
enterEvents = filter(events, function (event) {
|
|
243
|
+
return event.type === 'enter';
|
|
244
|
+
});
|
|
245
|
+
auditRows = map(audits, getFormRowData('audits', data));
|
|
246
|
+
issueRows = map(issues, getFormRowData('issues', data));
|
|
247
|
+
scanRows = map(enterEvents, getScanRowData(data));
|
|
248
|
+
taskRows = map(tasks, getFormRowData('tasks', data));
|
|
249
|
+
rows = [].concat(_toConsumableArray(auditRows), _toConsumableArray(issueRows), _toConsumableArray(scanRows), _toConsumableArray(taskRows));
|
|
250
|
+
sortedRows = sortBy(rows, ['timestamp'], ['asc']);
|
|
251
|
+
title = text('Activity Summary', {
|
|
252
|
+
style: 'summarySectionHeader'
|
|
253
|
+
});
|
|
254
|
+
header = table({
|
|
255
|
+
body: [[title]],
|
|
256
|
+
layout: 'noBorders',
|
|
257
|
+
style: 'summaryHeaderTable'
|
|
258
|
+
});
|
|
259
|
+
hLine = horizontalLine();
|
|
260
|
+
_context4.next = 13;
|
|
261
|
+
return buildActivityTable({
|
|
262
|
+
rows: sortedRows,
|
|
263
|
+
settings: settings,
|
|
264
|
+
timezone: timezone
|
|
265
|
+
});
|
|
266
|
+
|
|
267
|
+
case 13:
|
|
268
|
+
activityTable = _context4.sent;
|
|
269
|
+
activitySummarySection = [header, hLine, activityTable];
|
|
270
|
+
return _context4.abrupt("return", activitySummarySection);
|
|
271
|
+
|
|
272
|
+
case 16:
|
|
273
|
+
case "end":
|
|
274
|
+
return _context4.stop();
|
|
275
|
+
}
|
|
248
276
|
}
|
|
249
277
|
}, _callee4);
|
|
250
278
|
}));
|
|
251
279
|
return _buildActivitySummarySection.apply(this, arguments);
|
|
252
280
|
}
|
|
281
|
+
|
|
253
282
|
function buildActivityTable(_x6) {
|
|
254
283
|
return _buildActivityTable.apply(this, arguments);
|
|
255
284
|
}
|
|
285
|
+
|
|
256
286
|
function _buildActivityTable() {
|
|
257
|
-
_buildActivityTable = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee6(_ref) {
|
|
287
|
+
_buildActivityTable = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee6(_ref) {
|
|
258
288
|
var rows, settings, timezone, timezoneAbbr, activityTableHeader, activityTableRows, activityTableBody, activityTable;
|
|
259
|
-
return _regeneratorRuntime.wrap(function (_context6) {
|
|
260
|
-
while (1)
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
var
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
fields: summaryFields,
|
|
312
|
-
settings: settings,
|
|
313
|
-
timezone: timezone
|
|
314
|
-
});
|
|
315
|
-
case 1:
|
|
316
|
-
fieldsTable = _context5.sent;
|
|
317
|
-
rows.push([fieldsTable]);
|
|
318
|
-
case 2:
|
|
319
|
-
activityTableRow = [table({
|
|
320
|
-
body: [].concat(rows),
|
|
321
|
-
colSpan: 5,
|
|
322
|
-
dontBreakRows: true,
|
|
323
|
-
headerRow: 0,
|
|
324
|
-
layout: {
|
|
325
|
-
hLineWidth: function hLineWidth() {
|
|
326
|
-
return 0;
|
|
327
|
-
},
|
|
328
|
-
paddingLeft: function paddingLeft() {
|
|
329
|
-
return 0;
|
|
330
|
-
},
|
|
331
|
-
paddingRight: function paddingRight() {
|
|
332
|
-
return 0;
|
|
333
|
-
},
|
|
334
|
-
paddingTop: function paddingTop() {
|
|
335
|
-
return 5;
|
|
336
|
-
},
|
|
337
|
-
paddingBottom: function paddingBottom() {
|
|
338
|
-
return 5;
|
|
339
|
-
},
|
|
340
|
-
vLineWidth: function vLineWidth() {
|
|
341
|
-
return 0;
|
|
289
|
+
return _regeneratorRuntime.wrap(function _callee6$(_context6) {
|
|
290
|
+
while (1) {
|
|
291
|
+
switch (_context6.prev = _context6.next) {
|
|
292
|
+
case 0:
|
|
293
|
+
rows = _ref.rows, settings = _ref.settings, timezone = _ref.timezone;
|
|
294
|
+
timezoneAbbr = getTimezoneAbbr(timezone);
|
|
295
|
+
activityTableHeader = [text('Activity', {
|
|
296
|
+
bold: true
|
|
297
|
+
}), {
|
|
298
|
+
text: ''
|
|
299
|
+
}, text('Location', {
|
|
300
|
+
bold: true
|
|
301
|
+
}), text("Timestamp (".concat(timezoneAbbr, ")"), {
|
|
302
|
+
alignment: 'right',
|
|
303
|
+
bold: true
|
|
304
|
+
})];
|
|
305
|
+
_context6.next = 5;
|
|
306
|
+
return Promise.map(rows, /*#__PURE__*/function () {
|
|
307
|
+
var _ref6 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee5(data) {
|
|
308
|
+
var link, location, icon, summaryFields, timestamp, title, timezoneHour, iconCell, rows, hasSummaryFields, fieldsTable, activityTableRow;
|
|
309
|
+
return _regeneratorRuntime.wrap(function _callee5$(_context5) {
|
|
310
|
+
while (1) {
|
|
311
|
+
switch (_context5.prev = _context5.next) {
|
|
312
|
+
case 0:
|
|
313
|
+
link = data.link, location = data.location, icon = data.icon, summaryFields = data.summaryFields, timestamp = data.timestamp, title = data.title;
|
|
314
|
+
timezoneHour = getTimezoneDatetime({
|
|
315
|
+
format: 'ddd DD h:mm a',
|
|
316
|
+
showTzAbbr: false,
|
|
317
|
+
timestamp: timestamp,
|
|
318
|
+
timezone: timezone
|
|
319
|
+
});
|
|
320
|
+
iconCell = icon ? {
|
|
321
|
+
alignment: 'center',
|
|
322
|
+
fit: [8, 8],
|
|
323
|
+
image: icon,
|
|
324
|
+
link: link
|
|
325
|
+
} : {
|
|
326
|
+
text: ''
|
|
327
|
+
};
|
|
328
|
+
rows = [[text(title, {
|
|
329
|
+
link: link
|
|
330
|
+
}), iconCell, text(location, {
|
|
331
|
+
link: link
|
|
332
|
+
}), text(timezoneHour, {
|
|
333
|
+
alignment: 'right',
|
|
334
|
+
link: link
|
|
335
|
+
})]];
|
|
336
|
+
hasSummaryFields = !isEmpty(summaryFields);
|
|
337
|
+
|
|
338
|
+
if (!hasSummaryFields) {
|
|
339
|
+
_context5.next = 10;
|
|
340
|
+
break;
|
|
342
341
|
}
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
342
|
+
|
|
343
|
+
_context5.next = 8;
|
|
344
|
+
return summaryFieldsTable({
|
|
345
|
+
fields: summaryFields,
|
|
346
|
+
settings: settings,
|
|
347
|
+
timezone: timezone
|
|
348
|
+
});
|
|
349
|
+
|
|
350
|
+
case 8:
|
|
351
|
+
fieldsTable = _context5.sent;
|
|
352
|
+
rows.push([fieldsTable]);
|
|
353
|
+
|
|
354
|
+
case 10:
|
|
355
|
+
activityTableRow = [table({
|
|
356
|
+
body: [].concat(rows),
|
|
357
|
+
colSpan: 5,
|
|
358
|
+
dontBreakRows: true,
|
|
359
|
+
headerRow: 0,
|
|
360
|
+
layout: {
|
|
361
|
+
hLineWidth: function hLineWidth() {
|
|
362
|
+
return 0;
|
|
363
|
+
},
|
|
364
|
+
paddingLeft: function paddingLeft() {
|
|
365
|
+
return 0;
|
|
366
|
+
},
|
|
367
|
+
paddingRight: function paddingRight() {
|
|
368
|
+
return 0;
|
|
369
|
+
},
|
|
370
|
+
paddingTop: function paddingTop() {
|
|
371
|
+
return 5;
|
|
372
|
+
},
|
|
373
|
+
paddingBottom: function paddingBottom() {
|
|
374
|
+
return 5;
|
|
375
|
+
},
|
|
376
|
+
vLineWidth: function vLineWidth() {
|
|
377
|
+
return 0;
|
|
378
|
+
}
|
|
379
|
+
},
|
|
380
|
+
widths: [120, 25, 200, 110, '*']
|
|
381
|
+
})];
|
|
382
|
+
return _context5.abrupt("return", activityTableRow);
|
|
383
|
+
|
|
384
|
+
case 12:
|
|
385
|
+
case "end":
|
|
386
|
+
return _context5.stop();
|
|
387
|
+
}
|
|
388
|
+
}
|
|
389
|
+
}, _callee5);
|
|
390
|
+
}));
|
|
391
|
+
|
|
392
|
+
return function (_x8) {
|
|
393
|
+
return _ref6.apply(this, arguments);
|
|
394
|
+
};
|
|
395
|
+
}());
|
|
396
|
+
|
|
397
|
+
case 5:
|
|
398
|
+
activityTableRows = _context6.sent;
|
|
399
|
+
activityTableBody = isEmpty(activityTableRows) ? [[text('No other activity', {
|
|
400
|
+
colSpan: 4
|
|
401
|
+
})]] : activityTableRows;
|
|
402
|
+
activityTable = table({
|
|
403
|
+
body: [activityTableHeader].concat(_toConsumableArray(activityTableBody)),
|
|
404
|
+
dontBreakRows: true,
|
|
405
|
+
layout: {
|
|
406
|
+
hLineWidth: function hLineWidth() {
|
|
407
|
+
return 0;
|
|
408
|
+
},
|
|
409
|
+
fillColor: zebraFillColor,
|
|
410
|
+
paddingLeft: function paddingLeft() {
|
|
411
|
+
return 5;
|
|
412
|
+
},
|
|
413
|
+
paddingRight: function paddingRight() {
|
|
414
|
+
return 5;
|
|
415
|
+
},
|
|
416
|
+
paddingTop: function paddingTop() {
|
|
417
|
+
return 5;
|
|
418
|
+
},
|
|
419
|
+
paddingBottom: function paddingBottom() {
|
|
420
|
+
return 5;
|
|
421
|
+
},
|
|
422
|
+
vLineWidth: function vLineWidth() {
|
|
423
|
+
return 0;
|
|
350
424
|
}
|
|
351
|
-
}, _callee5);
|
|
352
|
-
}));
|
|
353
|
-
return function (_x8) {
|
|
354
|
-
return _ref6.apply(this, arguments);
|
|
355
|
-
};
|
|
356
|
-
}());
|
|
357
|
-
case 1:
|
|
358
|
-
activityTableRows = _context6.sent;
|
|
359
|
-
activityTableBody = isEmpty(activityTableRows) ? [[text('No other activity', {
|
|
360
|
-
colSpan: 4
|
|
361
|
-
})]] : activityTableRows;
|
|
362
|
-
activityTable = table({
|
|
363
|
-
body: [activityTableHeader].concat(_toConsumableArray(activityTableBody)),
|
|
364
|
-
dontBreakRows: true,
|
|
365
|
-
layout: {
|
|
366
|
-
hLineWidth: function hLineWidth() {
|
|
367
|
-
return 0;
|
|
368
|
-
},
|
|
369
|
-
fillColor: zebraFillColor,
|
|
370
|
-
paddingLeft: function paddingLeft() {
|
|
371
|
-
return 5;
|
|
372
|
-
},
|
|
373
|
-
paddingRight: function paddingRight() {
|
|
374
|
-
return 5;
|
|
375
|
-
},
|
|
376
|
-
paddingTop: function paddingTop() {
|
|
377
|
-
return 5;
|
|
378
|
-
},
|
|
379
|
-
paddingBottom: function paddingBottom() {
|
|
380
|
-
return 5;
|
|
381
425
|
},
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
case "end":
|
|
391
|
-
return _context6.stop();
|
|
426
|
+
widths: [110, 15, 230, 80, '*']
|
|
427
|
+
});
|
|
428
|
+
return _context6.abrupt("return", activityTable);
|
|
429
|
+
|
|
430
|
+
case 9:
|
|
431
|
+
case "end":
|
|
432
|
+
return _context6.stop();
|
|
433
|
+
}
|
|
392
434
|
}
|
|
393
435
|
}, _callee6);
|
|
394
436
|
}));
|
|
395
437
|
return _buildActivityTable.apply(this, arguments);
|
|
396
438
|
}
|
|
439
|
+
|
|
397
440
|
function getFormRowData(collection, _ref2) {
|
|
398
441
|
var locations = _ref2.locations,
|
|
399
|
-
|
|
442
|
+
zones = _ref2.zones;
|
|
400
443
|
return function (document) {
|
|
401
444
|
var _id = document._id,
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
445
|
+
createdAt = document.createdAt,
|
|
446
|
+
_document$entry = document.entry,
|
|
447
|
+
entry = _document$entry === void 0 ? {} : _document$entry,
|
|
448
|
+
_document$title = document.title,
|
|
449
|
+
title = _document$title === void 0 ? 'Unknown' : _document$title;
|
|
407
450
|
var location = getLocationReference({
|
|
408
451
|
entity: document,
|
|
409
452
|
locations: locations,
|
|
@@ -422,12 +465,13 @@ function getFormRowData(collection, _ref2) {
|
|
|
422
465
|
};
|
|
423
466
|
};
|
|
424
467
|
}
|
|
468
|
+
|
|
425
469
|
function getScanRowData(_ref3) {
|
|
426
470
|
var zones = _ref3.zones;
|
|
427
471
|
return function (document) {
|
|
428
472
|
var timestamp = document.timestamp,
|
|
429
|
-
|
|
430
|
-
|
|
473
|
+
_document$zone = document.zone,
|
|
474
|
+
zone = _document$zone === void 0 ? '' : _document$zone;
|
|
431
475
|
var zoneDoc = zone && find(zones, function (doc) {
|
|
432
476
|
return doc._id.toString() === zone.toString();
|
|
433
477
|
});
|
|
@@ -441,131 +485,151 @@ function getScanRowData(_ref3) {
|
|
|
441
485
|
};
|
|
442
486
|
};
|
|
443
487
|
}
|
|
488
|
+
|
|
444
489
|
function buildTimelineTable(_x7) {
|
|
445
490
|
return _buildTimelineTable.apply(this, arguments);
|
|
446
491
|
}
|
|
492
|
+
|
|
447
493
|
function _buildTimelineTable() {
|
|
448
|
-
_buildTimelineTable = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee8(data) {
|
|
494
|
+
_buildTimelineTable = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee8(data) {
|
|
449
495
|
var timezone, timezoneAbbr, shiftRows, sortedRows, timeline, timelineHeaderRow, timelineTable, title, header, hLine, timelineSection;
|
|
450
|
-
return _regeneratorRuntime.wrap(function (_context8) {
|
|
451
|
-
while (1)
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
var
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
496
|
+
return _regeneratorRuntime.wrap(function _callee8$(_context8) {
|
|
497
|
+
while (1) {
|
|
498
|
+
switch (_context8.prev = _context8.next) {
|
|
499
|
+
case 0:
|
|
500
|
+
timezone = data.timezone;
|
|
501
|
+
timezoneAbbr = getTimezoneAbbr(timezone);
|
|
502
|
+
shiftRows = getShiftRowData(data);
|
|
503
|
+
sortedRows = sortBy(shiftRows, ['timestamp'], ['asc']);
|
|
504
|
+
_context8.next = 6;
|
|
505
|
+
return Promise.map(sortedRows, /*#__PURE__*/function () {
|
|
506
|
+
var _ref7 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee7(data) {
|
|
507
|
+
var location, timestamp, title, timezoneHour, rows;
|
|
508
|
+
return _regeneratorRuntime.wrap(function _callee7$(_context7) {
|
|
509
|
+
while (1) {
|
|
510
|
+
switch (_context7.prev = _context7.next) {
|
|
511
|
+
case 0:
|
|
512
|
+
location = data.location, timestamp = data.timestamp, title = data.title;
|
|
513
|
+
timezoneHour = getTimezoneDatetime({
|
|
514
|
+
format: 'ddd DD h:mm a',
|
|
515
|
+
showTzAbbr: false,
|
|
516
|
+
timestamp: timestamp,
|
|
517
|
+
timezone: timezone
|
|
518
|
+
});
|
|
519
|
+
rows = [text(title), text(location), text(timezoneHour, {
|
|
520
|
+
alignment: 'right'
|
|
521
|
+
})];
|
|
522
|
+
return _context7.abrupt("return", rows);
|
|
523
|
+
|
|
524
|
+
case 4:
|
|
525
|
+
case "end":
|
|
526
|
+
return _context7.stop();
|
|
527
|
+
}
|
|
528
|
+
}
|
|
529
|
+
}, _callee7);
|
|
530
|
+
}));
|
|
531
|
+
|
|
532
|
+
return function (_x9) {
|
|
533
|
+
return _ref7.apply(this, arguments);
|
|
534
|
+
};
|
|
535
|
+
}());
|
|
536
|
+
|
|
537
|
+
case 6:
|
|
538
|
+
timeline = _context8.sent;
|
|
539
|
+
timelineHeaderRow = [text('Activity', {
|
|
540
|
+
bold: true
|
|
541
|
+
}), text('Location', {
|
|
542
|
+
bold: true
|
|
543
|
+
}), text("Timestamp (".concat(timezoneAbbr, ")"), {
|
|
544
|
+
alignment: 'right',
|
|
545
|
+
bold: true
|
|
546
|
+
})];
|
|
547
|
+
timelineTable = threeColumnTable({
|
|
548
|
+
body: [timelineHeaderRow].concat(_toConsumableArray(timeline))
|
|
549
|
+
});
|
|
550
|
+
title = text('Timeline', {
|
|
551
|
+
style: 'timelineTitle'
|
|
552
|
+
});
|
|
553
|
+
header = table({
|
|
554
|
+
body: [[title]],
|
|
555
|
+
layout: 'noBorders',
|
|
556
|
+
style: 'summaryHeaderTable'
|
|
557
|
+
});
|
|
558
|
+
hLine = horizontalLine();
|
|
559
|
+
timelineSection = [header, hLine, timelineTable];
|
|
560
|
+
return _context8.abrupt("return", timelineSection);
|
|
561
|
+
|
|
562
|
+
case 14:
|
|
563
|
+
case "end":
|
|
564
|
+
return _context8.stop();
|
|
565
|
+
}
|
|
512
566
|
}
|
|
513
567
|
}, _callee8);
|
|
514
568
|
}));
|
|
515
569
|
return _buildTimelineTable.apply(this, arguments);
|
|
516
570
|
}
|
|
571
|
+
|
|
517
572
|
function getShiftRowData(_ref4) {
|
|
518
573
|
var locations = _ref4.locations,
|
|
519
|
-
|
|
520
|
-
|
|
574
|
+
shift = _ref4.shift,
|
|
575
|
+
zones = _ref4.zones;
|
|
521
576
|
var breaks = shift.breaks,
|
|
522
|
-
|
|
523
|
-
|
|
577
|
+
end = shift.end,
|
|
578
|
+
start = shift.start;
|
|
524
579
|
var startValues = getShiftValues(start, {
|
|
525
580
|
locations: locations,
|
|
526
581
|
shift: shift,
|
|
527
582
|
zones: zones
|
|
528
583
|
});
|
|
584
|
+
|
|
529
585
|
var startShift = _objectSpread({
|
|
530
586
|
title: 'Shift Started'
|
|
531
587
|
}, startValues);
|
|
588
|
+
|
|
532
589
|
var endValues = getShiftValues(end, {
|
|
533
590
|
locations: locations,
|
|
534
591
|
shift: shift,
|
|
535
592
|
zones: zones
|
|
536
593
|
});
|
|
594
|
+
|
|
537
595
|
var endShift = _objectSpread({
|
|
538
596
|
title: 'Shift Ended'
|
|
539
597
|
}, endValues);
|
|
598
|
+
|
|
540
599
|
var shiftData = [startShift, endShift];
|
|
541
600
|
each(breaks, function (data) {
|
|
542
601
|
var end = data.end,
|
|
543
|
-
|
|
602
|
+
start = data.start;
|
|
544
603
|
var startValues = getShiftValues(start, {
|
|
545
604
|
locations: locations,
|
|
546
605
|
shift: shift,
|
|
547
606
|
zones: zones
|
|
548
607
|
});
|
|
608
|
+
|
|
549
609
|
var startBreak = _objectSpread({
|
|
550
610
|
title: 'Break Started'
|
|
551
611
|
}, startValues);
|
|
612
|
+
|
|
552
613
|
var endValues = getShiftValues(end, {
|
|
553
614
|
locations: locations,
|
|
554
615
|
shift: shift,
|
|
555
616
|
zones: zones
|
|
556
617
|
});
|
|
618
|
+
|
|
557
619
|
var endBreak = _objectSpread({
|
|
558
620
|
title: 'Break Ended'
|
|
559
621
|
}, endValues);
|
|
622
|
+
|
|
560
623
|
shiftData.push(startBreak);
|
|
561
624
|
shiftData.push(endBreak);
|
|
562
625
|
});
|
|
563
626
|
return shiftData;
|
|
564
627
|
}
|
|
628
|
+
|
|
565
629
|
function getShiftValues(value, _ref5) {
|
|
566
630
|
var locations = _ref5.locations,
|
|
567
|
-
|
|
568
|
-
|
|
631
|
+
shift = _ref5.shift,
|
|
632
|
+
zones = _ref5.zones;
|
|
569
633
|
var locationName = getLocationReference({
|
|
570
634
|
entity: value,
|
|
571
635
|
locations: locations,
|
|
@@ -581,6 +645,7 @@ function getShiftValues(value, _ref5) {
|
|
|
581
645
|
location: location
|
|
582
646
|
};
|
|
583
647
|
}
|
|
648
|
+
|
|
584
649
|
export function getFineDuration(durationValue) {
|
|
585
650
|
var measurement = 'milliseconds';
|
|
586
651
|
var durationByMeasurement = duration(durationValue, measurement);
|
|
@@ -593,10 +658,11 @@ export function getFineDuration(durationValue) {
|
|
|
593
658
|
fineDuration += minutes !== 0 ? minutes + 'm' : '';
|
|
594
659
|
return trim(fineDuration);
|
|
595
660
|
}
|
|
661
|
+
|
|
596
662
|
function getBreakDuration(breaks) {
|
|
597
663
|
var duration = sum(map(breaks, function (data) {
|
|
598
664
|
var end = data.end,
|
|
599
|
-
|
|
665
|
+
start = data.start;
|
|
600
666
|
var endBreak = moment(end.time);
|
|
601
667
|
var startBreak = moment(start.time);
|
|
602
668
|
var breakDuration = endBreak.diff(startBreak);
|