@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.
Files changed (243) hide show
  1. package/dist/constants.js +13 -7
  2. package/dist/errors/DomainError.js +4 -2
  3. package/dist/errors/ValidationError.js +8 -0
  4. package/dist/errors/index.js +5 -1
  5. package/dist/helpers/build-fetch-url/index.js +5 -0
  6. package/dist/helpers/fetch-image/index.js +32 -16
  7. package/dist/helpers/fetch-image-for-pdf-generator-service/index.js +44 -22
  8. package/dist/helpers/fetch-image-for-web/index.js +9 -0
  9. package/dist/helpers/fetch-lighthouse-logo/index.js +13 -2
  10. package/dist/helpers/floatify/index.js +1 -0
  11. package/dist/helpers/get-assignees-full-names/index.js +4 -0
  12. package/dist/helpers/get-audit-entry-details/index.js +3 -0
  13. package/dist/helpers/get-audit-items-data/index.js +6 -2
  14. package/dist/helpers/get-geometry-geocoded-string/index.js +3 -0
  15. package/dist/helpers/get-issue-details/index.js +9 -0
  16. package/dist/helpers/get-job-details/index.js +7 -0
  17. package/dist/helpers/get-location-reference/index.js +21 -18
  18. package/dist/helpers/get-pretty-duration/index.js +5 -0
  19. package/dist/helpers/get-reference-details/index.js +4 -0
  20. package/dist/helpers/get-status-details/index.js +9 -2
  21. package/dist/helpers/get-task-entry-details/index.js +3 -0
  22. package/dist/helpers/get-timezone-abbr/index.js +4 -0
  23. package/dist/helpers/get-timezone-datetime/index.js +5 -0
  24. package/dist/helpers/get-user-full-name/index.js +1 -0
  25. package/dist/helpers/get-value-as-percentage/index.js +1 -0
  26. package/dist/helpers/image-validators/index.js +9 -8
  27. package/dist/helpers/index.js +33 -16
  28. package/dist/images/index.js +9 -5
  29. package/dist/index.js +20 -4
  30. package/dist/pdf/activity-report/index.js +62 -41
  31. package/dist/pdf/audit/index.js +14 -0
  32. package/dist/pdf/helpers/build-audit-content/index.js +15 -4
  33. package/dist/pdf/helpers/build-audit-follow-ups/index.js +14 -4
  34. package/dist/pdf/helpers/build-location-scans-content/index.js +17 -4
  35. package/dist/pdf/helpers/build-template-content/index.js +14 -5
  36. package/dist/pdf/helpers/default-footer/index.js +3 -2
  37. package/dist/pdf/helpers/default-header/index.js +2 -0
  38. package/dist/pdf/helpers/default-styles/index.js +3 -2
  39. package/dist/pdf/helpers/fields/index.js +51 -21
  40. package/dist/pdf/helpers/format-location-address/index.js +3 -0
  41. package/dist/pdf/helpers/generate-definition/index.js +12 -0
  42. package/dist/pdf/helpers/horizontal-line/index.js +1 -0
  43. package/dist/pdf/helpers/html-transformer/index.js +23 -11
  44. package/dist/pdf/helpers/index.js +55 -40
  45. package/dist/pdf/helpers/parse-value/index.js +6 -2
  46. package/dist/pdf/helpers/table/index.js +31 -13
  47. package/dist/pdf/helpers/text/index.js +1 -0
  48. package/dist/pdf/icons/index.js +5 -3
  49. package/dist/pdf/index.js +10 -4
  50. package/dist/pdf/issue/index.js +14 -0
  51. package/dist/pdf/job/index.js +13 -1
  52. package/dist/pdf/shift-report/emptyFixtures.js +6 -4
  53. package/dist/pdf/shift-report/index.js +25 -2
  54. package/dist/pdf/task/index.js +13 -0
  55. package/dist/scheduling/generators/index.js +6 -0
  56. package/dist/scheduling/generators/occurrenceIntervalsGenerator.js +6 -1
  57. package/dist/scheduling/generators/scheduleIntervalsGenerator.js +5 -0
  58. package/dist/scheduling/generators/serviceIntervalsGenerator.js +27 -13
  59. package/dist/scheduling/helpers/convertToTimezone.js +6 -1
  60. package/dist/scheduling/helpers/generateNonRepeatingSchedule.js +9 -3
  61. package/dist/scheduling/helpers/generateRepeatingSchedule.js +18 -11
  62. package/dist/scheduling/helpers/generateScheduleEnd.js +8 -2
  63. package/dist/scheduling/helpers/hasValidStartAndEnd.js +6 -0
  64. package/dist/scheduling/helpers/index.js +28 -0
  65. package/dist/scheduling/helpers/intervalCovers.js +1 -0
  66. package/dist/scheduling/helpers/intervalIntersectsEnd.js +1 -0
  67. package/dist/scheduling/helpers/intervalIntersectsStart.js +1 -0
  68. package/dist/scheduling/helpers/intervalOnlyIntersectsEnd.js +3 -1
  69. package/dist/scheduling/helpers/intervalOnlyIntersectsStart.js +3 -0
  70. package/dist/scheduling/helpers/intervalOutside.js +1 -0
  71. package/dist/scheduling/helpers/intervalWithin.js +1 -0
  72. package/dist/scheduling/helpers/mergeIntervals.js +4 -0
  73. package/dist/scheduling/helpers/splitIntervals.js +3 -0
  74. package/dist/scheduling/index.js +6 -0
  75. package/dist/scheduling/scheduling.types.js +18 -10
  76. package/dist/scheduling/strategies/getNext.js +13 -2
  77. package/dist/scheduling/strategies/getNextExactDateOfMonth.js +12 -0
  78. package/dist/scheduling/strategies/getNextLastDayOfMonth.js +10 -0
  79. package/dist/scheduling/strategies/getNextLastWeekdayOfMonth.js +11 -0
  80. package/dist/scheduling/strategies/getNextNoRepeat.js +7 -0
  81. package/dist/scheduling/strategies/getNextWeekday.js +10 -0
  82. package/dist/scheduling/strategies/getNextXDayOfXWeekOfMonth.js +12 -0
  83. package/dist/scheduling/strategies/index.js +14 -0
  84. package/dist/schema/index.js +2 -0
  85. package/dist/schema/schema.js +7 -2
  86. package/dist/service-hours/__helpers__/calculate-hours.js +13 -4
  87. package/dist/service-hours/__helpers__/isOpen.js +9 -0
  88. package/dist/service-hours/index.js +4 -0
  89. package/dist/service-hours/schema.js +43 -20
  90. package/lib/constants.js.map +1 -1
  91. package/lib/errors/DomainError.js +47 -11
  92. package/lib/errors/DomainError.js.map +1 -1
  93. package/lib/errors/ValidationError.js +52 -15
  94. package/lib/errors/ValidationError.js.map +1 -1
  95. package/lib/errors/index.js.map +1 -1
  96. package/lib/helpers/build-fetch-url/index.js +20 -14
  97. package/lib/helpers/build-fetch-url/index.js.map +1 -1
  98. package/lib/helpers/fetch-image/index.js +27 -20
  99. package/lib/helpers/fetch-image/index.js.map +1 -1
  100. package/lib/helpers/fetch-image-for-pdf-generator-service/index.js +242 -201
  101. package/lib/helpers/fetch-image-for-pdf-generator-service/index.js.map +1 -1
  102. package/lib/helpers/fetch-image-for-web/index.js +66 -50
  103. package/lib/helpers/fetch-image-for-web/index.js.map +1 -1
  104. package/lib/helpers/fetch-lighthouse-logo/index.js +59 -47
  105. package/lib/helpers/fetch-lighthouse-logo/index.js.map +1 -1
  106. package/lib/helpers/floatify/index.js.map +1 -1
  107. package/lib/helpers/get-assignees-full-names/index.js +1 -0
  108. package/lib/helpers/get-assignees-full-names/index.js.map +1 -1
  109. package/lib/helpers/get-audit-entry-details/index.js +8 -8
  110. package/lib/helpers/get-audit-entry-details/index.js.map +1 -1
  111. package/lib/helpers/get-audit-items-data/index.js +19 -16
  112. package/lib/helpers/get-audit-items-data/index.js.map +1 -1
  113. package/lib/helpers/get-geometry-geocoded-string/index.js.map +1 -1
  114. package/lib/helpers/get-issue-details/index.js +12 -9
  115. package/lib/helpers/get-issue-details/index.js.map +1 -1
  116. package/lib/helpers/get-job-details/index.js +12 -12
  117. package/lib/helpers/get-job-details/index.js.map +1 -1
  118. package/lib/helpers/get-location-reference/index.js +36 -32
  119. package/lib/helpers/get-location-reference/index.js.map +1 -1
  120. package/lib/helpers/get-pretty-duration/index.js +4 -0
  121. package/lib/helpers/get-pretty-duration/index.js.map +1 -1
  122. package/lib/helpers/get-reference-details/index.js +3 -1
  123. package/lib/helpers/get-reference-details/index.js.map +1 -1
  124. package/lib/helpers/get-status-details/index.js +4 -0
  125. package/lib/helpers/get-status-details/index.js.map +1 -1
  126. package/lib/helpers/get-task-entry-details/index.js +5 -5
  127. package/lib/helpers/get-task-entry-details/index.js.map +1 -1
  128. package/lib/helpers/get-timezone-abbr/index.js.map +1 -1
  129. package/lib/helpers/get-timezone-datetime/index.js +6 -6
  130. package/lib/helpers/get-timezone-datetime/index.js.map +1 -1
  131. package/lib/helpers/get-user-full-name/index.js.map +1 -1
  132. package/lib/helpers/get-value-as-percentage/index.js.map +1 -1
  133. package/lib/helpers/image-validators/index.js +7 -8
  134. package/lib/helpers/image-validators/index.js.map +1 -1
  135. package/lib/helpers/index.js.map +1 -1
  136. package/lib/images/index.js.map +1 -1
  137. package/lib/index.js.map +1 -1
  138. package/lib/pdf/activity-report/index.js +416 -360
  139. package/lib/pdf/activity-report/index.js.map +1 -1
  140. package/lib/pdf/audit/index.js +36 -25
  141. package/lib/pdf/audit/index.js.map +1 -1
  142. package/lib/pdf/fonts/index.js.map +1 -1
  143. package/lib/pdf/helpers/build-audit-content/index.js +5 -3
  144. package/lib/pdf/helpers/build-audit-content/index.js.map +1 -1
  145. package/lib/pdf/helpers/build-audit-follow-ups/index.js +12 -5
  146. package/lib/pdf/helpers/build-audit-follow-ups/index.js.map +1 -1
  147. package/lib/pdf/helpers/build-location-scans-content/index.js +9 -4
  148. package/lib/pdf/helpers/build-location-scans-content/index.js.map +1 -1
  149. package/lib/pdf/helpers/build-template-content/index.js +9 -7
  150. package/lib/pdf/helpers/build-template-content/index.js.map +1 -1
  151. package/lib/pdf/helpers/default-footer/index.js +8 -9
  152. package/lib/pdf/helpers/default-footer/index.js.map +1 -1
  153. package/lib/pdf/helpers/default-header/index.js +5 -5
  154. package/lib/pdf/helpers/default-header/index.js.map +1 -1
  155. package/lib/pdf/helpers/default-styles/index.js.map +1 -1
  156. package/lib/pdf/helpers/fields/index.js +81 -48
  157. package/lib/pdf/helpers/fields/index.js.map +1 -1
  158. package/lib/pdf/helpers/format-location-address/index.js.map +1 -1
  159. package/lib/pdf/helpers/generate-definition/index.js +29 -22
  160. package/lib/pdf/helpers/generate-definition/index.js.map +1 -1
  161. package/lib/pdf/helpers/horizontal-line/index.js +1 -1
  162. package/lib/pdf/helpers/horizontal-line/index.js.map +1 -1
  163. package/lib/pdf/helpers/html-transformer/index.js +30 -19
  164. package/lib/pdf/helpers/html-transformer/index.js.map +1 -1
  165. package/lib/pdf/helpers/index.js.map +1 -1
  166. package/lib/pdf/helpers/parse-value/index.js +4 -2
  167. package/lib/pdf/helpers/parse-value/index.js.map +1 -1
  168. package/lib/pdf/helpers/table/index.js +84 -78
  169. package/lib/pdf/helpers/table/index.js.map +1 -1
  170. package/lib/pdf/helpers/text/index.js +5 -2
  171. package/lib/pdf/helpers/text/index.js.map +1 -1
  172. package/lib/pdf/icons/index.js.map +1 -1
  173. package/lib/pdf/index.js.map +1 -1
  174. package/lib/pdf/issue/index.js +28 -19
  175. package/lib/pdf/issue/index.js.map +1 -1
  176. package/lib/pdf/job/index.js +19 -12
  177. package/lib/pdf/job/index.js.map +1 -1
  178. package/lib/pdf/shift-report/emptyFixtures.js.map +1 -1
  179. package/lib/pdf/shift-report/index.js +374 -308
  180. package/lib/pdf/shift-report/index.js.map +1 -1
  181. package/lib/pdf/task/index.js +19 -11
  182. package/lib/pdf/task/index.js.map +1 -1
  183. package/lib/scheduling/generators/index.js.map +1 -1
  184. package/lib/scheduling/generators/occurrenceIntervalsGenerator.js +38 -27
  185. package/lib/scheduling/generators/occurrenceIntervalsGenerator.js.map +1 -1
  186. package/lib/scheduling/generators/scheduleIntervalsGenerator.js +30 -19
  187. package/lib/scheduling/generators/scheduleIntervalsGenerator.js.map +1 -1
  188. package/lib/scheduling/generators/serviceIntervalsGenerator.js +181 -139
  189. package/lib/scheduling/generators/serviceIntervalsGenerator.js.map +1 -1
  190. package/lib/scheduling/helpers/convertToTimezone.js +1 -1
  191. package/lib/scheduling/helpers/convertToTimezone.js.map +1 -1
  192. package/lib/scheduling/helpers/generateNonRepeatingSchedule.js +124 -84
  193. package/lib/scheduling/helpers/generateNonRepeatingSchedule.js.map +1 -1
  194. package/lib/scheduling/helpers/generateRepeatingSchedule.js +175 -107
  195. package/lib/scheduling/helpers/generateRepeatingSchedule.js.map +1 -1
  196. package/lib/scheduling/helpers/generateScheduleEnd.js +6 -6
  197. package/lib/scheduling/helpers/generateScheduleEnd.js.map +1 -1
  198. package/lib/scheduling/helpers/hasValidStartAndEnd.js +2 -1
  199. package/lib/scheduling/helpers/hasValidStartAndEnd.js.map +1 -1
  200. package/lib/scheduling/helpers/index.js.map +1 -1
  201. package/lib/scheduling/helpers/intervalCovers.js.map +1 -1
  202. package/lib/scheduling/helpers/intervalIntersectsEnd.js.map +1 -1
  203. package/lib/scheduling/helpers/intervalIntersectsStart.js.map +1 -1
  204. package/lib/scheduling/helpers/intervalOnlyIntersectsEnd.js +0 -1
  205. package/lib/scheduling/helpers/intervalOnlyIntersectsEnd.js.map +1 -1
  206. package/lib/scheduling/helpers/intervalOnlyIntersectsStart.js +1 -1
  207. package/lib/scheduling/helpers/intervalOnlyIntersectsStart.js.map +1 -1
  208. package/lib/scheduling/helpers/intervalOutside.js.map +1 -1
  209. package/lib/scheduling/helpers/intervalWithin.js.map +1 -1
  210. package/lib/scheduling/helpers/mergeIntervals.js +3 -0
  211. package/lib/scheduling/helpers/mergeIntervals.js.map +1 -1
  212. package/lib/scheduling/helpers/splitIntervals.js +1 -1
  213. package/lib/scheduling/helpers/splitIntervals.js.map +1 -1
  214. package/lib/scheduling/index.js.map +1 -1
  215. package/lib/scheduling/scheduling.types.js +14 -9
  216. package/lib/scheduling/scheduling.types.js.map +1 -1
  217. package/lib/scheduling/strategies/getNext.js +30 -22
  218. package/lib/scheduling/strategies/getNext.js.map +1 -1
  219. package/lib/scheduling/strategies/getNextExactDateOfMonth.js +31 -22
  220. package/lib/scheduling/strategies/getNextExactDateOfMonth.js.map +1 -1
  221. package/lib/scheduling/strategies/getNextLastDayOfMonth.js +28 -21
  222. package/lib/scheduling/strategies/getNextLastDayOfMonth.js.map +1 -1
  223. package/lib/scheduling/strategies/getNextLastWeekdayOfMonth.js +28 -21
  224. package/lib/scheduling/strategies/getNextLastWeekdayOfMonth.js.map +1 -1
  225. package/lib/scheduling/strategies/getNextNoRepeat.js +23 -15
  226. package/lib/scheduling/strategies/getNextNoRepeat.js.map +1 -1
  227. package/lib/scheduling/strategies/getNextWeekday.js +78 -43
  228. package/lib/scheduling/strategies/getNextWeekday.js.map +1 -1
  229. package/lib/scheduling/strategies/getNextXDayOfXWeekOfMonth.js +28 -21
  230. package/lib/scheduling/strategies/getNextXDayOfXWeekOfMonth.js.map +1 -1
  231. package/lib/scheduling/strategies/index.js.map +1 -1
  232. package/lib/schema/index.js.map +1 -1
  233. package/lib/schema/schema.js +30 -22
  234. package/lib/schema/schema.js.map +1 -1
  235. package/lib/service-hours/__helpers__/calculate-hours.js +13 -4
  236. package/lib/service-hours/__helpers__/calculate-hours.js.map +1 -1
  237. package/lib/service-hours/__helpers__/isOpen.js +7 -3
  238. package/lib/service-hours/__helpers__/isOpen.js.map +1 -1
  239. package/lib/service-hours/index.js.map +1 -1
  240. package/lib/service-hours/schema.js +36 -21
  241. package/lib/service-hours/schema.js.map +1 -1
  242. package/package.json +4 -5
  243. 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
- import _regeneratorRuntime from "@babel/runtime/regenerator";
5
- function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
6
- function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
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) switch (_context.prev = _context.next) {
53
- case 0:
54
- timestamp = data.timestamp, timezone = data.timezone;
55
- title = 'Daily Shift Report';
56
- _context.next = 1;
57
- return generateContent(data);
58
- case 1:
59
- content = _context.sent;
60
- return _context.abrupt("return", generateDefinition(_objectSpread({
61
- content: content,
62
- fileTitle: title,
63
- timestamp: timestamp,
64
- timezone: timezone,
65
- type: 'Shift Report'
66
- }, pdfOptions)));
67
- case 2:
68
- case "end":
69
- return _context.stop();
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) switch (_context2.prev = _context2.next) {
83
- case 0:
84
- _context2.next = 1;
85
- return buildActivitySection(data);
86
- case 1:
87
- activitySection = _context2.sent;
88
- summarySection = buildSummarySection(data);
89
- titleTable = buildTitleTable(data);
90
- return _context2.abrupt("return", [titleTable, summarySection, activitySection]);
91
- case 2:
92
- case "end":
93
- return _context2.stop();
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) switch (_context3.prev = _context3.next) {
107
- case 0:
108
- _context3.next = 1;
109
- return buildTimelineTable(data);
110
- case 1:
111
- timeline = _context3.sent;
112
- _context3.next = 2;
113
- return buildActivitySummarySection(data);
114
- case 2:
115
- activitySummary = _context3.sent;
116
- return _context3.abrupt("return", [timeline, activitySummary]);
117
- case 3:
118
- case "end":
119
- return _context3.stop();
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
- timezone = data.timezone,
128
- user = data.user;
148
+ timezone = data.timezone,
149
+ user = data.user;
129
150
  var breaks = shift.breaks,
130
- duration = shift.duration,
131
- end = shift.end,
132
- start = shift.start;
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
- events = data.events,
159
- issues = data.issues,
160
- tasks = data.tasks;
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) switch (_context4.prev = _context4.next) {
215
- case 0:
216
- audits = data.audits, events = data.events, issues = data.issues, settings = data.settings, tasks = data.tasks, timezone = data.timezone;
217
- enterEvents = filter(events, function (event) {
218
- return event.type === 'enter';
219
- });
220
- auditRows = map(audits, getFormRowData('audits', data));
221
- issueRows = map(issues, getFormRowData('issues', data));
222
- scanRows = map(enterEvents, getScanRowData(data));
223
- taskRows = map(tasks, getFormRowData('tasks', data));
224
- rows = [].concat(_toConsumableArray(auditRows), _toConsumableArray(issueRows), _toConsumableArray(scanRows), _toConsumableArray(taskRows));
225
- sortedRows = sortBy(rows, ['timestamp'], ['asc']);
226
- title = text('Activity Summary', {
227
- style: 'summarySectionHeader'
228
- });
229
- header = table({
230
- body: [[title]],
231
- layout: 'noBorders',
232
- style: 'summaryHeaderTable'
233
- });
234
- hLine = horizontalLine();
235
- _context4.next = 1;
236
- return buildActivityTable({
237
- rows: sortedRows,
238
- settings: settings,
239
- timezone: timezone
240
- });
241
- case 1:
242
- activityTable = _context4.sent;
243
- activitySummarySection = [header, hLine, activityTable];
244
- return _context4.abrupt("return", activitySummarySection);
245
- case 2:
246
- case "end":
247
- return _context4.stop();
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) switch (_context6.prev = _context6.next) {
261
- case 0:
262
- rows = _ref.rows, settings = _ref.settings, timezone = _ref.timezone;
263
- timezoneAbbr = getTimezoneAbbr(timezone);
264
- activityTableHeader = [text('Activity', {
265
- bold: true
266
- }), {
267
- text: ''
268
- }, text('Location', {
269
- bold: true
270
- }), text("Timestamp (".concat(timezoneAbbr, ")"), {
271
- alignment: 'right',
272
- bold: true
273
- })];
274
- _context6.next = 1;
275
- return Promise.map(rows, /*#__PURE__*/function () {
276
- var _ref6 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee5(data) {
277
- var link, location, icon, summaryFields, timestamp, title, timezoneHour, iconCell, rows, hasSummaryFields, fieldsTable, activityTableRow;
278
- return _regeneratorRuntime.wrap(function (_context5) {
279
- while (1) switch (_context5.prev = _context5.next) {
280
- case 0:
281
- link = data.link, location = data.location, icon = data.icon, summaryFields = data.summaryFields, timestamp = data.timestamp, title = data.title;
282
- timezoneHour = getTimezoneDatetime({
283
- format: 'ddd DD h:mm a',
284
- showTzAbbr: false,
285
- timestamp: timestamp,
286
- timezone: timezone
287
- });
288
- iconCell = icon ? {
289
- alignment: 'center',
290
- fit: [8, 8],
291
- image: icon,
292
- link: link
293
- } : {
294
- text: ''
295
- };
296
- rows = [[text(title, {
297
- link: link
298
- }), iconCell, text(location, {
299
- link: link
300
- }), text(timezoneHour, {
301
- alignment: 'right',
302
- link: link
303
- })]];
304
- hasSummaryFields = !isEmpty(summaryFields);
305
- if (!hasSummaryFields) {
306
- _context5.next = 2;
307
- break;
308
- }
309
- _context5.next = 1;
310
- return summaryFieldsTable({
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
- widths: [120, 25, 200, 110, '*']
345
- })];
346
- return _context5.abrupt("return", activityTableRow);
347
- case 3:
348
- case "end":
349
- return _context5.stop();
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
- vLineWidth: function vLineWidth() {
383
- return 0;
384
- }
385
- },
386
- widths: [110, 15, 230, 80, '*']
387
- });
388
- return _context6.abrupt("return", activityTable);
389
- case 2:
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
- zones = _ref2.zones;
442
+ zones = _ref2.zones;
400
443
  return function (document) {
401
444
  var _id = document._id,
402
- createdAt = document.createdAt,
403
- _document$entry = document.entry,
404
- entry = _document$entry === void 0 ? {} : _document$entry,
405
- _document$title = document.title,
406
- title = _document$title === void 0 ? 'Unknown' : _document$title;
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
- _document$zone = document.zone,
430
- zone = _document$zone === void 0 ? '' : _document$zone;
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) switch (_context8.prev = _context8.next) {
452
- case 0:
453
- timezone = data.timezone;
454
- timezoneAbbr = getTimezoneAbbr(timezone);
455
- shiftRows = getShiftRowData(data);
456
- sortedRows = sortBy(shiftRows, ['timestamp'], ['asc']);
457
- _context8.next = 1;
458
- return Promise.map(sortedRows, /*#__PURE__*/function () {
459
- var _ref7 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee7(data) {
460
- var location, timestamp, title, timezoneHour, rows;
461
- return _regeneratorRuntime.wrap(function (_context7) {
462
- while (1) switch (_context7.prev = _context7.next) {
463
- case 0:
464
- location = data.location, timestamp = data.timestamp, title = data.title;
465
- timezoneHour = getTimezoneDatetime({
466
- format: 'ddd DD h:mm a',
467
- showTzAbbr: false,
468
- timestamp: timestamp,
469
- timezone: timezone
470
- });
471
- rows = [text(title), text(location), text(timezoneHour, {
472
- alignment: 'right'
473
- })];
474
- return _context7.abrupt("return", rows);
475
- case 1:
476
- case "end":
477
- return _context7.stop();
478
- }
479
- }, _callee7);
480
- }));
481
- return function (_x9) {
482
- return _ref7.apply(this, arguments);
483
- };
484
- }());
485
- case 1:
486
- timeline = _context8.sent;
487
- timelineHeaderRow = [text('Activity', {
488
- bold: true
489
- }), text('Location', {
490
- bold: true
491
- }), text("Timestamp (".concat(timezoneAbbr, ")"), {
492
- alignment: 'right',
493
- bold: true
494
- })];
495
- timelineTable = threeColumnTable({
496
- body: [timelineHeaderRow].concat(_toConsumableArray(timeline))
497
- });
498
- title = text('Timeline', {
499
- style: 'timelineTitle'
500
- });
501
- header = table({
502
- body: [[title]],
503
- layout: 'noBorders',
504
- style: 'summaryHeaderTable'
505
- });
506
- hLine = horizontalLine();
507
- timelineSection = [header, hLine, timelineTable];
508
- return _context8.abrupt("return", timelineSection);
509
- case 2:
510
- case "end":
511
- return _context8.stop();
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
- shift = _ref4.shift,
520
- zones = _ref4.zones;
574
+ shift = _ref4.shift,
575
+ zones = _ref4.zones;
521
576
  var breaks = shift.breaks,
522
- end = shift.end,
523
- start = shift.start;
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
- start = data.start;
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
- shift = _ref5.shift,
568
- zones = _ref5.zones;
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
- start = data.start;
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);