taxtank-core 0.1.5 → 0.2.3

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 (72) hide show
  1. package/bundles/taxtank-core.umd.js +383 -282
  2. package/bundles/taxtank-core.umd.js.map +1 -1
  3. package/esm2015/lib/collections/abstract.collection.js +19 -3
  4. package/esm2015/lib/collections/collection-dictionary.js +4 -1
  5. package/esm2015/lib/collections/user-event-setting.collection.js +3 -55
  6. package/esm2015/lib/db/Enums/chart-accounts-metadata-list.enum.js +2 -3
  7. package/esm2015/lib/db/Enums/user-event-status.enum.js +2 -1
  8. package/esm2015/lib/db/Enums/user-event-type-client-type.enum.js +29 -0
  9. package/esm2015/lib/db/Enums/user-event-type-employee-type.enum.js +17 -0
  10. package/esm2015/lib/db/Enums/user-event-type-frequency.enum.js +4 -5
  11. package/esm2015/lib/db/Enums/user-event-type-user-type.enum.js +7 -0
  12. package/esm2015/lib/db/Models/user-event-setting.js +1 -1
  13. package/esm2015/lib/db/Models/user-event-type-category.js +3 -0
  14. package/esm2015/lib/db/Models/user-event-type.js +1 -1
  15. package/esm2015/lib/db/Models/user-event.js +1 -1
  16. package/esm2015/lib/models/data-table/data-table-column.js +13 -0
  17. package/esm2015/lib/models/data-table/data-table.js +40 -0
  18. package/esm2015/lib/models/endpoint/endpoints.const.js +3 -1
  19. package/esm2015/lib/models/notification/notification.js +13 -37
  20. package/esm2015/lib/models/pdf/pdf-config.js +24 -0
  21. package/esm2015/lib/models/transaction/transaction.js +5 -5
  22. package/esm2015/lib/models/user-event/user-event-setting.js +3 -3
  23. package/esm2015/lib/models/user-event/user-event-type-category.js +4 -0
  24. package/esm2015/lib/models/user-event/user-event-type.js +13 -18
  25. package/esm2015/lib/services/bank/bank-connection.service.js +10 -1
  26. package/esm2015/lib/services/bank/bank-transaction.service.js +3 -3
  27. package/esm2015/lib/services/bank/basiq.service.js +3 -3
  28. package/esm2015/lib/services/firm/firm.service.js +2 -2
  29. package/esm2015/lib/services/pdf/pdf.service.js +55 -0
  30. package/esm2015/lib/services/xlsx/xlsx.service.js +54 -0
  31. package/esm2015/public-api.js +9 -7
  32. package/fesm2015/taxtank-core.js +336 -254
  33. package/fesm2015/taxtank-core.js.map +1 -1
  34. package/lib/collections/abstract.collection.d.ts +4 -1
  35. package/lib/collections/collection-dictionary.d.ts +4 -1
  36. package/lib/collections/user-event-setting.collection.d.ts +1 -23
  37. package/lib/db/Enums/chart-accounts-metadata-list.enum.d.ts +1 -2
  38. package/lib/db/Enums/user-event-status.enum.d.ts +2 -1
  39. package/lib/db/Enums/user-event-type-client-type.enum.d.ts +27 -0
  40. package/lib/db/Enums/user-event-type-employee-type.enum.d.ts +15 -0
  41. package/lib/db/Enums/user-event-type-frequency.enum.d.ts +3 -4
  42. package/lib/db/Enums/user-event-type-user-type.enum.d.ts +5 -0
  43. package/lib/db/Models/user-event-setting.d.ts +1 -1
  44. package/lib/db/Models/user-event-type-category.d.ts +4 -0
  45. package/lib/db/Models/user-event-type.d.ts +5 -3
  46. package/lib/db/Models/user-event.d.ts +3 -1
  47. package/lib/models/data-table/data-table-column.d.ts +20 -0
  48. package/lib/models/data-table/data-table.d.ts +24 -0
  49. package/lib/models/notification/notification.d.ts +4 -6
  50. package/lib/models/pdf/pdf-config.d.ts +8 -0
  51. package/lib/models/transaction/transaction.d.ts +1 -3
  52. package/lib/models/user-event/user-event-setting.d.ts +1 -1
  53. package/lib/models/user-event/user-event-type-category.d.ts +3 -0
  54. package/lib/models/user-event/user-event-type.d.ts +4 -2
  55. package/lib/services/bank/bank-connection.service.d.ts +2 -0
  56. package/lib/services/firm/firm.service.d.ts +1 -1
  57. package/lib/services/pdf/pdf.service.d.ts +14 -0
  58. package/lib/services/xlsx/xlsx.service.d.ts +11 -0
  59. package/package.json +6 -2
  60. package/public-api.d.ts +8 -6
  61. package/esm2015/lib/db/Enums/user-event-type-reminder-type.enum.js +0 -8
  62. package/esm2015/lib/db/Enums/user-event-type-reminder.enum.js +0 -7
  63. package/esm2015/lib/db/Enums/user-event-type-type.enum.js +0 -35
  64. package/esm2015/lib/models/notification/notification-event-types.const.js +0 -43
  65. package/esm2015/lib/models/user-event/user-event-category.enum.js +0 -11
  66. package/esm2015/lib/models/user-event/user-event-category.js +0 -6
  67. package/lib/db/Enums/user-event-type-reminder-type.enum.d.ts +0 -6
  68. package/lib/db/Enums/user-event-type-reminder.enum.d.ts +0 -5
  69. package/lib/db/Enums/user-event-type-type.enum.d.ts +0 -33
  70. package/lib/models/notification/notification-event-types.const.d.ts +0 -7
  71. package/lib/models/user-event/user-event-category.d.ts +0 -8
  72. package/lib/models/user-event/user-event-category.enum.d.ts +0 -9
@@ -10,7 +10,7 @@ import uniqBy from 'lodash/uniqBy';
10
10
  import concat from 'lodash/concat';
11
11
  import compact from 'lodash/compact';
12
12
  import { __decorate, __awaiter } from 'tslib';
13
- import { Type, plainToClass, Expose, Transform, Exclude, classToPlain } from 'class-transformer';
13
+ import { Type, plainToClass, Exclude, Transform, Expose, classToPlain } from 'class-transformer';
14
14
  import * as moment from 'moment';
15
15
  import { DateRange } from 'moment-range';
16
16
  import cloneDeep$1 from 'lodash/cloneDeep';
@@ -24,7 +24,11 @@ import { EventSourcePolyfill } from 'event-source-polyfill/src/eventsource.min.j
24
24
  import * as i1$1 from '@angular/router';
25
25
  import { NavigationEnd } from '@angular/router';
26
26
  import clone from 'lodash/clone';
27
+ import jsPDF from 'jspdf';
28
+ import autoTable from 'jspdf-autotable';
27
29
  import { loadStripe } from '@stripe/stripe-js';
30
+ import * as xlsx from 'xlsx';
31
+ import * as FileSaver from 'file-saver';
28
32
 
29
33
  class TtCoreModule {
30
34
  static forRoot(environment) {
@@ -110,6 +114,9 @@ class CollectionDictionary {
110
114
  createCollection(items = []) {
111
115
  return new this.collectionConstructor(items);
112
116
  }
117
+ length() {
118
+ return this.keys.length;
119
+ }
113
120
  /**
114
121
  * Group collection items by passed path into items object
115
122
  */
@@ -135,6 +142,7 @@ class CollectionDictionary {
135
142
  }
136
143
  }
137
144
 
145
+ const DEFAULT_INDEX = 'other';
138
146
  /**
139
147
  * collection abstract class. Contains common properties and methods for all collections
140
148
  */
@@ -142,8 +150,22 @@ class AbstractCollection {
142
150
  constructor(items = []) {
143
151
  this.items = items;
144
152
  }
145
- groupBy(prop) {
146
- return new CollectionDictionary(this, prop);
153
+ create(items = []) {
154
+ return new this.constructor(items);
155
+ }
156
+ getBy(field, value) {
157
+ return this.create(this.items.filter((item) => item[field] === value));
158
+ }
159
+ groupBy(path = '') {
160
+ return new CollectionDictionary(this, path);
161
+ }
162
+ indexBy(path) {
163
+ // Create empty initial object for groups
164
+ const result = {};
165
+ this.toArray().forEach((model) => {
166
+ result[get(model, path, DEFAULT_INDEX)] = model;
167
+ });
168
+ return result;
147
169
  }
148
170
  /**
149
171
  * Iterator that allow to iterate collection items
@@ -1348,117 +1370,12 @@ class TransactionCollection extends AbstractCollection {
1348
1370
  }
1349
1371
  }
1350
1372
 
1351
- class UserEventSetting$1 {
1352
- }
1353
-
1354
- class UserEventType$1 {
1355
- }
1356
-
1357
- /**
1358
- * Category of user event type
1359
- */
1360
- class UserEventCategory {
1361
- }
1362
-
1363
- /**
1364
- * Enum with user event categories
1365
- */
1366
- var UserEventCategoryEnum;
1367
- (function (UserEventCategoryEnum) {
1368
- UserEventCategoryEnum[UserEventCategoryEnum["USER"] = 1] = "USER";
1369
- UserEventCategoryEnum[UserEventCategoryEnum["CO_OWNER"] = 2] = "CO_OWNER";
1370
- UserEventCategoryEnum[UserEventCategoryEnum["FIRM"] = 3] = "FIRM";
1371
- UserEventCategoryEnum[UserEventCategoryEnum["BASIQ"] = 4] = "BASIQ";
1372
- })(UserEventCategoryEnum || (UserEventCategoryEnum = {}));
1373
-
1374
- class UserEventType extends UserEventType$1 {
1375
- }
1376
- __decorate([
1377
- Expose({ toClassOnly: true }),
1378
- Transform(({ obj }) => {
1379
- switch (true) {
1380
- case String(obj.type).startsWith('1'):
1381
- return plainToClass(UserEventCategory, { name: 'User\'s events', type: UserEventCategoryEnum.USER });
1382
- case String(obj.type).startsWith('2'):
1383
- return plainToClass(UserEventCategory, { name: 'Co-owner\'s events', type: UserEventCategoryEnum.CO_OWNER });
1384
- case String(obj.type).startsWith('3'):
1385
- return plainToClass(UserEventCategory, { name: 'Firm\'s events', type: UserEventCategoryEnum.FIRM });
1386
- default:
1387
- return plainToClass(UserEventCategory, { name: 'Basiq events', type: UserEventCategoryEnum.BASIQ });
1388
- }
1389
- }),
1390
- Type(() => UserEventCategory)
1391
- ], UserEventType.prototype, "category", void 0);
1392
-
1393
- class UserEventSetting extends UserEventSetting$1 {
1394
- constructor() {
1395
- super(...arguments);
1396
- // flag indicates that the setting is updating now saved or not
1397
- this.isUpdating = false;
1398
- }
1399
- }
1400
- __decorate([
1401
- Type(() => UserEventType)
1402
- ], UserEventSetting.prototype, "userEventType", void 0);
1403
- __decorate([
1404
- Exclude({ toPlainOnly: true })
1405
- ], UserEventSetting.prototype, "isUpdating", void 0);
1406
-
1407
1373
  /**
1408
1374
  * Collection of user event settings
1409
1375
  */
1410
1376
  class UserEventSettingCollection extends AbstractCollection {
1411
- constructor(items, userEventTypes) {
1412
- super(items);
1413
- this.setItems(userEventTypes);
1414
- }
1415
- /**
1416
- * Flag that indicates if all settings are selected for provided field
1417
- */
1418
- isAllSelected(field) {
1419
- return !this.items.find((item) => !item[field]);
1420
- }
1421
- /**
1422
- * Flag that indicates if all settings are deselected for provided field
1423
- */
1424
- isAllDeselected(field) {
1425
- return !this.items.find((item) => item[field]);
1426
- }
1427
- /**
1428
- * Check is any setting is updating by 'isUpdating' flag
1429
- */
1430
- isAnyUpdating() {
1431
- return this.items.some((item) => item.isUpdating);
1432
- }
1433
- /**
1434
- * Get frequency type based on each collection item 'frequency' field value
1435
- */
1436
- get commonFrequencyType() {
1437
- const frequencyDictionary = new CollectionDictionary(this, '', 'frequency');
1438
- return +Object.keys(frequencyDictionary).find((key) => frequencyDictionary[key].length === this.length) || false;
1439
- }
1440
- /**
1441
- * Rewrite collection items with provided user event types
1442
- */
1443
- setItems(userEventTypes) {
1444
- if (!userEventTypes) {
1445
- return;
1446
- }
1447
- this.items = userEventTypes.map((userEventType) => {
1448
- // find existing setting by user event type id
1449
- const existingSetting = this.items.find((setting) => setting.userEventType.id === userEventType.id);
1450
- // if setting exist - return new UserEventSetting instance based on existing setting and default user event type
1451
- if (existingSetting) {
1452
- return plainToClass(UserEventSetting, Object.assign(existingSetting, { userEventType }));
1453
- }
1454
- // ...or return new UserEventSetting instance based on default user event type
1455
- return plainToClass(UserEventSetting, {
1456
- byEmail: userEventType.byEmail,
1457
- byNotification: userEventType.byNotification,
1458
- frequency: userEventType.frequency,
1459
- userEventType
1460
- });
1461
- });
1377
+ getConfigurableBy(field) {
1378
+ return new UserEventSettingCollection(this.items.filter((setting) => setting[field] !== null));
1462
1379
  }
1463
1380
  }
1464
1381
 
@@ -1664,8 +1581,7 @@ var ChartAccountsMetadataListEnum;
1664
1581
  ChartAccountsMetadataListEnum[ChartAccountsMetadataListEnum["TAX_OFFSETS"] = 8] = "TAX_OFFSETS";
1665
1582
  ChartAccountsMetadataListEnum[ChartAccountsMetadataListEnum["HOURS"] = 11] = "HOURS";
1666
1583
  ChartAccountsMetadataListEnum[ChartAccountsMetadataListEnum["TAX_PAID"] = 13] = "TAX_PAID";
1667
- ChartAccountsMetadataListEnum[ChartAccountsMetadataListEnum["REDUNDANCY"] = 17] = "REDUNDANCY";
1668
- ChartAccountsMetadataListEnum[ChartAccountsMetadataListEnum["NON_REDUNDANCY"] = 18] = "NON_REDUNDANCY";
1584
+ ChartAccountsMetadataListEnum[ChartAccountsMetadataListEnum["TAX_FREE_COMPONENT"] = 18] = "TAX_FREE_COMPONENT";
1669
1585
  ChartAccountsMetadataListEnum[ChartAccountsMetadataListEnum["YEARS_OF_SERVICE"] = 19] = "YEARS_OF_SERVICE";
1670
1586
  ChartAccountsMetadataListEnum[ChartAccountsMetadataListEnum["UNTAXED_ELEMENT"] = 24] = "UNTAXED_ELEMENT";
1671
1587
  ChartAccountsMetadataListEnum[ChartAccountsMetadataListEnum["FRANKED"] = 26] = "FRANKED";
@@ -2058,65 +1974,68 @@ var UserEventStatusEnum;
2058
1974
  UserEventStatusEnum[UserEventStatusEnum["NEED_ACTION"] = 2] = "NEED_ACTION";
2059
1975
  UserEventStatusEnum[UserEventStatusEnum["DONE"] = 3] = "DONE";
2060
1976
  UserEventStatusEnum[UserEventStatusEnum["REFUSED"] = 4] = "REFUSED";
1977
+ UserEventStatusEnum[UserEventStatusEnum["OUTDATED"] = 5] = "OUTDATED";
2061
1978
  })(UserEventStatusEnum || (UserEventStatusEnum = {}));
2062
1979
 
2063
1980
  var UserEventTypeFrequencyEnum;
2064
1981
  (function (UserEventTypeFrequencyEnum) {
2065
- UserEventTypeFrequencyEnum[UserEventTypeFrequencyEnum["ONCE"] = 1] = "ONCE";
2066
- UserEventTypeFrequencyEnum[UserEventTypeFrequencyEnum["DAILY"] = 2] = "DAILY";
2067
- UserEventTypeFrequencyEnum[UserEventTypeFrequencyEnum["WEEKLY"] = 3] = "WEEKLY";
2068
- UserEventTypeFrequencyEnum[UserEventTypeFrequencyEnum["MONTHLY"] = 4] = "MONTHLY";
1982
+ UserEventTypeFrequencyEnum[UserEventTypeFrequencyEnum["DAILY"] = 1] = "DAILY";
1983
+ UserEventTypeFrequencyEnum[UserEventTypeFrequencyEnum["WEEKLY"] = 2] = "WEEKLY";
1984
+ UserEventTypeFrequencyEnum[UserEventTypeFrequencyEnum["MONTHLY"] = 3] = "MONTHLY";
2069
1985
  })(UserEventTypeFrequencyEnum || (UserEventTypeFrequencyEnum = {}));
2070
1986
 
2071
- var UserEventTypeReminderEnum;
2072
- (function (UserEventTypeReminderEnum) {
2073
- UserEventTypeReminderEnum[UserEventTypeReminderEnum["ONCE"] = 1] = "ONCE";
2074
- UserEventTypeReminderEnum[UserEventTypeReminderEnum["TWICE"] = 2] = "TWICE";
2075
- UserEventTypeReminderEnum[UserEventTypeReminderEnum["EVERY_DAY"] = 3] = "EVERY_DAY";
2076
- })(UserEventTypeReminderEnum || (UserEventTypeReminderEnum = {}));
2077
-
2078
- var UserEventTypeReminderTypeEnum;
2079
- (function (UserEventTypeReminderTypeEnum) {
2080
- UserEventTypeReminderTypeEnum[UserEventTypeReminderTypeEnum["NEVER"] = 0] = "NEVER";
2081
- UserEventTypeReminderTypeEnum[UserEventTypeReminderTypeEnum["ONCE"] = 1] = "ONCE";
2082
- UserEventTypeReminderTypeEnum[UserEventTypeReminderTypeEnum["TWICE"] = 2] = "TWICE";
2083
- UserEventTypeReminderTypeEnum[UserEventTypeReminderTypeEnum["EVERY_DAY"] = 3] = "EVERY_DAY";
2084
- })(UserEventTypeReminderTypeEnum || (UserEventTypeReminderTypeEnum = {}));
2085
-
2086
- var UserEventTypeTypeEnum;
2087
- (function (UserEventTypeTypeEnum) {
2088
- UserEventTypeTypeEnum[UserEventTypeTypeEnum["USER_INVITE"] = 101] = "USER_INVITE";
2089
- UserEventTypeTypeEnum[UserEventTypeTypeEnum["USER_CONFIRMATION"] = 102] = "USER_CONFIRMATION";
2090
- UserEventTypeTypeEnum[UserEventTypeTypeEnum["USER_RESET_PASSWORD"] = 103] = "USER_RESET_PASSWORD";
2091
- UserEventTypeTypeEnum[UserEventTypeTypeEnum["USER_SUBSCRIBED"] = 104] = "USER_SUBSCRIBED";
2092
- UserEventTypeTypeEnum[UserEventTypeTypeEnum["USER_UPGRADE_SUBSCRIPTION"] = 105] = "USER_UPGRADE_SUBSCRIPTION";
2093
- UserEventTypeTypeEnum[UserEventTypeTypeEnum["USER_DOWNGRADE_SUBSCRIPTION"] = 106] = "USER_DOWNGRADE_SUBSCRIPTION";
2094
- UserEventTypeTypeEnum[UserEventTypeTypeEnum["USER_CANCEL_SUBSCRIPTION"] = 107] = "USER_CANCEL_SUBSCRIPTION";
2095
- UserEventTypeTypeEnum[UserEventTypeTypeEnum["CO_OWNER_INVITE_SEND"] = 201] = "CO_OWNER_INVITE_SEND";
2096
- UserEventTypeTypeEnum[UserEventTypeTypeEnum["CO_OWNER_INVITE_ACCEPT"] = 202] = "CO_OWNER_INVITE_ACCEPT";
2097
- UserEventTypeTypeEnum[UserEventTypeTypeEnum["CO_OWNER_INVITE_REJECT"] = 203] = "CO_OWNER_INVITE_REJECT";
2098
- UserEventTypeTypeEnum[UserEventTypeTypeEnum["CO_OWNER_REGISTER"] = 204] = "CO_OWNER_REGISTER";
2099
- UserEventTypeTypeEnum[UserEventTypeTypeEnum["CO_OWNER_CHANGES_OFFER"] = 210] = "CO_OWNER_CHANGES_OFFER";
2100
- UserEventTypeTypeEnum[UserEventTypeTypeEnum["CO_OWNER_CHANGES_ACCEPT"] = 211] = "CO_OWNER_CHANGES_ACCEPT";
2101
- UserEventTypeTypeEnum[UserEventTypeTypeEnum["CO_OWNER_CHANGES_REJECT"] = 212] = "CO_OWNER_CHANGES_REJECT";
2102
- UserEventTypeTypeEnum[UserEventTypeTypeEnum["CLIENT_INVITE_TO_JOIN"] = 301] = "CLIENT_INVITE_TO_JOIN";
2103
- UserEventTypeTypeEnum[UserEventTypeTypeEnum["CLIENT_INVITE_TO_JOIN_ACCEPTED"] = 302] = "CLIENT_INVITE_TO_JOIN_ACCEPTED";
2104
- UserEventTypeTypeEnum[UserEventTypeTypeEnum["CLIENT_INVITE_TO_JOIN_REJECTED"] = 303] = "CLIENT_INVITE_TO_JOIN_REJECTED";
2105
- UserEventTypeTypeEnum[UserEventTypeTypeEnum["CLIENT_INVITE_TO_REGISTER"] = 304] = "CLIENT_INVITE_TO_REGISTER";
2106
- UserEventTypeTypeEnum[UserEventTypeTypeEnum["CLIENT_LEFT_FIRM"] = 305] = "CLIENT_LEFT_FIRM";
2107
- UserEventTypeTypeEnum[UserEventTypeTypeEnum["EMPLOYEE_INVITE_TO_JOIN"] = 320] = "EMPLOYEE_INVITE_TO_JOIN";
2108
- UserEventTypeTypeEnum[UserEventTypeTypeEnum["EMPLOYEE_INVITE_TO_JOIN_ACCEPTED"] = 321] = "EMPLOYEE_INVITE_TO_JOIN_ACCEPTED";
2109
- UserEventTypeTypeEnum[UserEventTypeTypeEnum["EMPLOYEE_INVITE_TO_JOIN_REJECTED"] = 322] = "EMPLOYEE_INVITE_TO_JOIN_REJECTED";
2110
- UserEventTypeTypeEnum[UserEventTypeTypeEnum["EMPLOYEE_INVITE_TO_REGISTER"] = 325] = "EMPLOYEE_INVITE_TO_REGISTER";
2111
- UserEventTypeTypeEnum[UserEventTypeTypeEnum["EMPLOYEE_INVITE_TO_REGISTER_ACCEPTED"] = 326] = "EMPLOYEE_INVITE_TO_REGISTER_ACCEPTED";
2112
- UserEventTypeTypeEnum[UserEventTypeTypeEnum["EMPLOYEE_LOST_CLIENT"] = 330] = "EMPLOYEE_LOST_CLIENT";
2113
- UserEventTypeTypeEnum[UserEventTypeTypeEnum["EMPLOYEE_RECEIVED_CLIENT"] = 331] = "EMPLOYEE_RECEIVED_CLIENT";
2114
- UserEventTypeTypeEnum[UserEventTypeTypeEnum["FIRM_INVITE_TO_REGISTER"] = 340] = "FIRM_INVITE_TO_REGISTER";
2115
- UserEventTypeTypeEnum[UserEventTypeTypeEnum["FIRM_INVITE_TO_REGISTER_ACCEPTED"] = 341] = "FIRM_INVITE_TO_REGISTER_ACCEPTED";
2116
- UserEventTypeTypeEnum[UserEventTypeTypeEnum["BASIQ_NEW_ACCOUNTS"] = 501] = "BASIQ_NEW_ACCOUNTS";
2117
- UserEventTypeTypeEnum[UserEventTypeTypeEnum["BASIQ_FIRST_IMPORT_COMPLETE"] = 502] = "BASIQ_FIRST_IMPORT_COMPLETE";
2118
- UserEventTypeTypeEnum[UserEventTypeTypeEnum["BASIQ_AUTHORIZATION_FAIL"] = 503] = "BASIQ_AUTHORIZATION_FAIL";
2119
- })(UserEventTypeTypeEnum || (UserEventTypeTypeEnum = {}));
1987
+ var UserEventTypeUserTypeEnum;
1988
+ (function (UserEventTypeUserTypeEnum) {
1989
+ UserEventTypeUserTypeEnum[UserEventTypeUserTypeEnum["REGISTERED"] = 1000] = "REGISTERED";
1990
+ UserEventTypeUserTypeEnum[UserEventTypeUserTypeEnum["PASSWORD_RESET"] = 1001] = "PASSWORD_RESET";
1991
+ UserEventTypeUserTypeEnum[UserEventTypeUserTypeEnum["APP_FEATURES"] = 1010] = "APP_FEATURES";
1992
+ })(UserEventTypeUserTypeEnum || (UserEventTypeUserTypeEnum = {}));
1993
+
1994
+ var UserEventTypeEmployeeTypeEnum;
1995
+ (function (UserEventTypeEmployeeTypeEnum) {
1996
+ UserEventTypeEmployeeTypeEnum[UserEventTypeEmployeeTypeEnum["FIRM_INVITE_TO_REGISTER"] = 3000] = "FIRM_INVITE_TO_REGISTER";
1997
+ UserEventTypeEmployeeTypeEnum[UserEventTypeEmployeeTypeEnum["FIRM_INVITE"] = 3001] = "FIRM_INVITE";
1998
+ UserEventTypeEmployeeTypeEnum[UserEventTypeEmployeeTypeEnum["CLIENT_INVITE_ACCEPTED"] = 3002] = "CLIENT_INVITE_ACCEPTED";
1999
+ UserEventTypeEmployeeTypeEnum[UserEventTypeEmployeeTypeEnum["CLIENT_INVITE_REJECTED"] = 3003] = "CLIENT_INVITE_REJECTED";
2000
+ UserEventTypeEmployeeTypeEnum[UserEventTypeEmployeeTypeEnum["CLIENT_INVITE_REGISTERED"] = 3004] = "CLIENT_INVITE_REGISTERED";
2001
+ UserEventTypeEmployeeTypeEnum[UserEventTypeEmployeeTypeEnum["FIRM_NEW_CLIENT"] = 3005] = "FIRM_NEW_CLIENT";
2002
+ UserEventTypeEmployeeTypeEnum[UserEventTypeEmployeeTypeEnum["FIRM_LOST_CLIENT"] = 3006] = "FIRM_LOST_CLIENT";
2003
+ UserEventTypeEmployeeTypeEnum[UserEventTypeEmployeeTypeEnum["EMPLOYEE_INVITE"] = 3010] = "EMPLOYEE_INVITE";
2004
+ UserEventTypeEmployeeTypeEnum[UserEventTypeEmployeeTypeEnum["EMPLOYEE_LOST_CLIENT"] = 3011] = "EMPLOYEE_LOST_CLIENT";
2005
+ UserEventTypeEmployeeTypeEnum[UserEventTypeEmployeeTypeEnum["EMPLOYEE_NEW_CLIENT"] = 3012] = "EMPLOYEE_NEW_CLIENT";
2006
+ UserEventTypeEmployeeTypeEnum[UserEventTypeEmployeeTypeEnum["EMPLOYEE_INVITE_ACCEPTED"] = 3013] = "EMPLOYEE_INVITE_ACCEPTED";
2007
+ UserEventTypeEmployeeTypeEnum[UserEventTypeEmployeeTypeEnum["EMAIL_CONFIRMED"] = 3020] = "EMAIL_CONFIRMED";
2008
+ UserEventTypeEmployeeTypeEnum[UserEventTypeEmployeeTypeEnum["TAX_REVIEW_REQUESTED"] = 3030] = "TAX_REVIEW_REQUESTED";
2009
+ })(UserEventTypeEmployeeTypeEnum || (UserEventTypeEmployeeTypeEnum = {}));
2010
+
2011
+ var UserEventTypeClientTypeEnum;
2012
+ (function (UserEventTypeClientTypeEnum) {
2013
+ UserEventTypeClientTypeEnum[UserEventTypeClientTypeEnum["SUBSCRIBED"] = 2000] = "SUBSCRIBED";
2014
+ UserEventTypeClientTypeEnum[UserEventTypeClientTypeEnum["UNSUBSCRIBED"] = 2001] = "UNSUBSCRIBED";
2015
+ UserEventTypeClientTypeEnum[UserEventTypeClientTypeEnum["SUBSCRIPTION_UPDATE"] = 2004] = "SUBSCRIPTION_UPDATE";
2016
+ UserEventTypeClientTypeEnum[UserEventTypeClientTypeEnum["SUBSCRIPTION_TRIAL_UPDATE"] = 2005] = "SUBSCRIPTION_TRIAL_UPDATE";
2017
+ UserEventTypeClientTypeEnum[UserEventTypeClientTypeEnum["CLIENT_INVITE"] = 2010] = "CLIENT_INVITE";
2018
+ UserEventTypeClientTypeEnum[UserEventTypeClientTypeEnum["CLIENT_INVITE_TO_REGISTER"] = 2011] = "CLIENT_INVITE_TO_REGISTER";
2019
+ UserEventTypeClientTypeEnum[UserEventTypeClientTypeEnum["FIRM_INVITE_ACCEPTED"] = 2012] = "FIRM_INVITE_ACCEPTED";
2020
+ UserEventTypeClientTypeEnum[UserEventTypeClientTypeEnum["FIRM_INVITE_REJECTED"] = 2013] = "FIRM_INVITE_REJECTED";
2021
+ UserEventTypeClientTypeEnum[UserEventTypeClientTypeEnum["FIRM_INVITE_REGISTERED"] = 2014] = "FIRM_INVITE_REGISTERED";
2022
+ UserEventTypeClientTypeEnum[UserEventTypeClientTypeEnum["CO_OWNER_INVITE"] = 2020] = "CO_OWNER_INVITE";
2023
+ UserEventTypeClientTypeEnum[UserEventTypeClientTypeEnum["CO_OWNER_INVITE_TO_REGISTER"] = 2021] = "CO_OWNER_INVITE_TO_REGISTER";
2024
+ UserEventTypeClientTypeEnum[UserEventTypeClientTypeEnum["CO_OWNER_INVITE_ACCEPTED"] = 2022] = "CO_OWNER_INVITE_ACCEPTED";
2025
+ UserEventTypeClientTypeEnum[UserEventTypeClientTypeEnum["CO_OWNER_INVITE_REJECTED"] = 2023] = "CO_OWNER_INVITE_REJECTED";
2026
+ UserEventTypeClientTypeEnum[UserEventTypeClientTypeEnum["CO_OWNER_INVITE_REGISTERED"] = 2024] = "CO_OWNER_INVITE_REGISTERED";
2027
+ UserEventTypeClientTypeEnum[UserEventTypeClientTypeEnum["CO_OWNER_CHANGE_REQUESTED"] = 2025] = "CO_OWNER_CHANGE_REQUESTED";
2028
+ UserEventTypeClientTypeEnum[UserEventTypeClientTypeEnum["CO_OWNER_CHANGE_ACCEPTED"] = 2026] = "CO_OWNER_CHANGE_ACCEPTED";
2029
+ UserEventTypeClientTypeEnum[UserEventTypeClientTypeEnum["CO_OWNER_CHANGE_REJECTED"] = 2027] = "CO_OWNER_CHANGE_REJECTED";
2030
+ UserEventTypeClientTypeEnum[UserEventTypeClientTypeEnum["BASIQ_NEW_ACCOUNTS"] = 2030] = "BASIQ_NEW_ACCOUNTS";
2031
+ UserEventTypeClientTypeEnum[UserEventTypeClientTypeEnum["BASIQ_FIRST_IMPORT_COMPLETE"] = 2031] = "BASIQ_FIRST_IMPORT_COMPLETE";
2032
+ UserEventTypeClientTypeEnum[UserEventTypeClientTypeEnum["BASIQ_AUTHORIZATION_FAIL"] = 2032] = "BASIQ_AUTHORIZATION_FAIL";
2033
+ UserEventTypeClientTypeEnum[UserEventTypeClientTypeEnum["TRANSACTION_ALLOCATE_REMINDER"] = 2033] = "TRANSACTION_ALLOCATE_REMINDER";
2034
+ UserEventTypeClientTypeEnum[UserEventTypeClientTypeEnum["REGISTRATION_INVITE"] = 2040] = "REGISTRATION_INVITE";
2035
+ UserEventTypeClientTypeEnum[UserEventTypeClientTypeEnum["REGISTRATION_INVITE_ACCEPTED"] = 2041] = "REGISTRATION_INVITE_ACCEPTED";
2036
+ UserEventTypeClientTypeEnum[UserEventTypeClientTypeEnum["EMAIL_CONFIRMED"] = 2050] = "EMAIL_CONFIRMED";
2037
+ UserEventTypeClientTypeEnum[UserEventTypeClientTypeEnum["TAX_REVIEW_REQUESTED"] = 2060] = "TAX_REVIEW_REQUESTED";
2038
+ })(UserEventTypeClientTypeEnum || (UserEventTypeClientTypeEnum = {}));
2120
2039
 
2121
2040
  var UserMedicareExemptionEnum;
2122
2041
  (function (UserMedicareExemptionEnum) {
@@ -3692,9 +3611,9 @@ class Transaction extends Transaction$1 {
3692
3611
  // @TODO fix hack while transactions refactoring (use class-transformer)
3693
3612
  return +(Math.round(this.getIncomeAmountByType(IncomeAmountTypeEnum.GROSS) * 100) / 100).toFixed(2);
3694
3613
  }
3695
- /**
3696
- * find franking credits metadata and return value
3697
- */
3614
+ get taxFreeComponent() {
3615
+ return this.getMetadataFieldValue(ChartAccountsMetadataListEnum.TAX_FREE_COMPONENT);
3616
+ }
3698
3617
  get frankingCredit() {
3699
3618
  return this.getMetadataFieldValue(ChartAccountsMetadataListEnum.FRANKING_CREDIT);
3700
3619
  }
@@ -3731,7 +3650,7 @@ class Transaction extends Transaction$1 {
3731
3650
  (this.transactions
3732
3651
  .reduce((sum, transaction) => sum + Math.abs(transaction.amount), 0) * modifier);
3733
3652
  case this.isWorkTank():
3734
- return this.amount + ((this.tax + this.frankingCredit) * modifier);
3653
+ return this.amount + ((this.tax + this.frankingCredit - this.taxFreeComponent) * modifier);
3735
3654
  default:
3736
3655
  return this.amount || 0;
3737
3656
  }
@@ -4326,6 +4245,59 @@ class ClientPortfolioChartData {
4326
4245
  class ClientPortfolioReport {
4327
4246
  }
4328
4247
 
4248
+ /**
4249
+ * Class to generate data-table structure based on provided collection.
4250
+ * Use to work with HTML/PDF/XLSX tables
4251
+ */
4252
+ class DataTable {
4253
+ constructor(collection, columns, caption, footerCaption) {
4254
+ this.caption = caption;
4255
+ this.columns = columns;
4256
+ this.setRows(collection);
4257
+ if (footerCaption) {
4258
+ this.setFooterRow(collection, footerCaption);
4259
+ }
4260
+ }
4261
+ setRows(collection) {
4262
+ this.rows = collection.items.map((item) => {
4263
+ // parse table columns to return items based on column properties
4264
+ return this.columns.map((column) => {
4265
+ // if the pipe is provided - transform the return value
4266
+ if (column.pipe) {
4267
+ return column.pipe.transform(item[column.key]);
4268
+ }
4269
+ return (item[column.key] ? item[column.key] : '-').toString();
4270
+ });
4271
+ });
4272
+ }
4273
+ setFooterRow(collection, footerCaption) {
4274
+ this.footerRow = this.columns.map((column, index) => {
4275
+ if (index === 0) {
4276
+ return footerCaption.toString();
4277
+ }
4278
+ if (!column.total) {
4279
+ return '';
4280
+ }
4281
+ return collection.items
4282
+ .reduce((sum, item) => sum + Number(item[column.key]), 0)
4283
+ .toString();
4284
+ });
4285
+ }
4286
+ }
4287
+
4288
+ class DataTableColumn {
4289
+ constructor(name, key, total, pipe) {
4290
+ /**
4291
+ * Flag that shows should the column be in the total calculation or not
4292
+ */
4293
+ this.total = false;
4294
+ this.name = name;
4295
+ this.key = key;
4296
+ this.total = total;
4297
+ this.pipe = pipe;
4298
+ }
4299
+ }
4300
+
4329
4301
  var DepreciationGroupEnum;
4330
4302
  (function (DepreciationGroupEnum) {
4331
4303
  DepreciationGroupEnum[DepreciationGroupEnum["BUILDING_IMPROVEMENTS"] = 0] = "BUILDING_IMPROVEMENTS";
@@ -4635,6 +4607,8 @@ const ENDPOINTS = {
4635
4607
  USER_UPDATE_PHOTO_POST: new Endpoint('POST', '\\/users\\/photo\.\*'),
4636
4608
  USER_STATUS_PUT: new Endpoint('PUT', '\\/users\\/status'),
4637
4609
  VEHICLES_GET: new Endpoint('GET', '\\/vehicles'),
4610
+ VEHICLES_POST: new Endpoint('POST', '\\/vehicles'),
4611
+ VEHICLES_PUT: new Endpoint('PUT', '\\/vehicles\\/\\d+'),
4638
4612
  VEHICLE_CLAIMS_GET: new Endpoint('GET', '\\/vehicle-claims'),
4639
4613
  VEHICLE_CLAIMS_POST: new Endpoint('POST', '\\/vehicle-claims'),
4640
4614
  VEHICLE_LOGBOOK_POST: new Endpoint('POST', '\\/vehicles\\/\\d+\\/logbooks'),
@@ -4860,75 +4834,9 @@ class VehicleClaim extends VehicleClaim$1 {
4860
4834
  class ServiceNotification {
4861
4835
  }
4862
4836
 
4863
- /**
4864
- * Notification events grouped by types
4865
- */
4866
- const NOTIFICATION_EVENT_TYPES = {
4867
- // events from employees to clients
4868
- employeeInvite: [
4869
- UserEventTypeTypeEnum.EMPLOYEE_INVITE_TO_REGISTER_ACCEPTED,
4870
- UserEventTypeTypeEnum.EMPLOYEE_INVITE_TO_JOIN_ACCEPTED,
4871
- UserEventTypeTypeEnum.EMPLOYEE_INVITE_TO_JOIN_REJECTED,
4872
- UserEventTypeTypeEnum.EMPLOYEE_INVITE_TO_REGISTER,
4873
- UserEventTypeTypeEnum.CLIENT_INVITE_TO_JOIN,
4874
- ],
4875
- // events from clients to employee
4876
- employeeInviteFromClient: [
4877
- UserEventTypeTypeEnum.EMPLOYEE_INVITE_TO_JOIN,
4878
- ],
4879
- bankConnection: [
4880
- UserEventTypeTypeEnum.BASIQ_NEW_ACCOUNTS,
4881
- UserEventTypeTypeEnum.BASIQ_FIRST_IMPORT_COMPLETE,
4882
- UserEventTypeTypeEnum.BASIQ_AUTHORIZATION_FAIL
4883
- ],
4884
- clientInvite: [
4885
- UserEventTypeTypeEnum.CLIENT_INVITE_TO_JOIN_ACCEPTED,
4886
- UserEventTypeTypeEnum.CLIENT_INVITE_TO_JOIN_REJECTED,
4887
- UserEventTypeTypeEnum.CLIENT_INVITE_TO_REGISTER
4888
- ],
4889
- clientMovement: [
4890
- UserEventTypeTypeEnum.CLIENT_LEFT_FIRM,
4891
- UserEventTypeTypeEnum.EMPLOYEE_LOST_CLIENT,
4892
- UserEventTypeTypeEnum.EMPLOYEE_RECEIVED_CLIENT
4893
- ],
4894
- propertyOwner: [
4895
- UserEventTypeTypeEnum.CO_OWNER_INVITE_SEND,
4896
- UserEventTypeTypeEnum.CO_OWNER_INVITE_ACCEPT,
4897
- UserEventTypeTypeEnum.CO_OWNER_INVITE_REJECT,
4898
- UserEventTypeTypeEnum.CO_OWNER_REGISTER,
4899
- UserEventTypeTypeEnum.CO_OWNER_CHANGES_OFFER,
4900
- UserEventTypeTypeEnum.CO_OWNER_CHANGES_ACCEPT,
4901
- UserEventTypeTypeEnum.CO_OWNER_CHANGES_REJECT
4902
- ]
4903
- };
4904
-
4905
4837
  class Notification extends ServiceNotification {
4906
4838
  get eventType() {
4907
- return this.userEvent.userEventType.type;
4908
- }
4909
- /**
4910
- * Set redirection link based on current event type
4911
- */
4912
- setRedirectionLink() {
4913
- switch (true) {
4914
- case NOTIFICATION_EVENT_TYPES.employeeInvite.includes(this.eventType):
4915
- this.redirectionLink = '/client/users/firms';
4916
- break;
4917
- case NOTIFICATION_EVENT_TYPES.bankConnection.includes(this.eventType):
4918
- this.redirectionLink = '/client/bank-feeds';
4919
- break;
4920
- case NOTIFICATION_EVENT_TYPES.clientInvite.includes(this.eventType):
4921
- this.redirectionLink = '/client/users/invitations';
4922
- break;
4923
- case NOTIFICATION_EVENT_TYPES.propertyOwner.includes(this.eventType):
4924
- this.redirectionLink = '/client/users/co-owners';
4925
- break;
4926
- case NOTIFICATION_EVENT_TYPES.employeeInviteFromClient.includes(this.eventType):
4927
- this.redirectionLink = '/firm/clients/invites';
4928
- break;
4929
- default:
4930
- this.redirectionLink = '';
4931
- }
4839
+ return this.userEvent.type.type;
4932
4840
  }
4933
4841
  /**
4934
4842
  * Check if notification is from user or not
@@ -4944,16 +4852,17 @@ __decorate([
4944
4852
  Expose({ toClassOnly: true }),
4945
4853
  Transform(({ obj }) => {
4946
4854
  switch (true) {
4947
- case NOTIFICATION_EVENT_TYPES.employeeInvite.includes(obj.eventType):
4948
- return '/client/users/firms';
4949
- case NOTIFICATION_EVENT_TYPES.bankConnection.includes(obj.eventType):
4950
- return '/client/bank-feeds';
4951
- case NOTIFICATION_EVENT_TYPES.clientInvite.includes(obj.eventType):
4952
- return '/client/users/invitations';
4953
- case NOTIFICATION_EVENT_TYPES.propertyOwner.includes(obj.eventType):
4954
- return '/client/users/co-owners';
4955
- case NOTIFICATION_EVENT_TYPES.employeeInviteFromClient.includes(obj.eventType):
4956
- return '/firm/clients/invites';
4855
+ // @TODO vik
4856
+ // case NOTIFICATION_EVENT_TYPES.employeeInvite.includes(obj.eventType):
4857
+ // return '/client/users/firms';
4858
+ // case NOTIFICATION_EVENT_TYPES.bankConnection.includes(obj.eventType):
4859
+ // return '/client/bank-feeds';
4860
+ // case NOTIFICATION_EVENT_TYPES.clientInvite.includes(obj.eventType):
4861
+ // return '/client/users/invitations';
4862
+ // case NOTIFICATION_EVENT_TYPES.propertyOwner.includes(obj.eventType):
4863
+ // return '/client/users/co-owners';
4864
+ // case NOTIFICATION_EVENT_TYPES.employeeInviteFromClient.includes(obj.eventType):
4865
+ // return '/firm/clients/invites';
4957
4866
  default:
4958
4867
  return '';
4959
4868
  }
@@ -5572,6 +5481,46 @@ const USER_ROLES = {
5572
5481
  class UserToRegister {
5573
5482
  }
5574
5483
 
5484
+ class UserEventTypeCategory$1 {
5485
+ }
5486
+
5487
+ class UserEventTypeCategory extends UserEventTypeCategory$1 {
5488
+ }
5489
+
5490
+ class UserEventSetting$1 {
5491
+ }
5492
+
5493
+ class UserEventType$1 {
5494
+ }
5495
+
5496
+ class UserEventType extends UserEventType$1 {
5497
+ toSetting() {
5498
+ return plainToClass(UserEventSetting, {
5499
+ byEmail: this.byEmail,
5500
+ byNotification: this.byNotification,
5501
+ frequency: this.frequency,
5502
+ type: this
5503
+ });
5504
+ }
5505
+ }
5506
+ __decorate([
5507
+ Type(() => UserEventTypeCategory)
5508
+ ], UserEventType.prototype, "category", void 0);
5509
+
5510
+ class UserEventSetting extends UserEventSetting$1 {
5511
+ constructor() {
5512
+ super(...arguments);
5513
+ // flag indicates that the setting is updating now saved or not
5514
+ this.isUpdating = false;
5515
+ }
5516
+ }
5517
+ __decorate([
5518
+ Type(() => UserEventType)
5519
+ ], UserEventSetting.prototype, "type", void 0);
5520
+ __decorate([
5521
+ Exclude({ toPlainOnly: true })
5522
+ ], UserEventSetting.prototype, "isUpdating", void 0);
5523
+
5575
5524
  /**
5576
5525
  * Enum with user event setting fields
5577
5526
  */
@@ -6239,6 +6188,10 @@ class BankConnectionService extends BaseRestService {
6239
6188
  this.environment = environment;
6240
6189
  this.modelClass = BankConnection;
6241
6190
  this.url = 'bank-connections';
6191
+ this.listenEvents();
6192
+ }
6193
+ listenEvents() {
6194
+ this.listenToAddedBankAccounts();
6242
6195
  }
6243
6196
  post(bankConnection) {
6244
6197
  return this.http.post(`${this.environment.apiV2}/${this.url}`, bankConnection)
@@ -6247,6 +6200,11 @@ class BankConnectionService extends BaseRestService {
6247
6200
  return plainToClass(BankConnection, bankConnectionBase);
6248
6201
  }));
6249
6202
  }
6203
+ listenToAddedBankAccounts() {
6204
+ this.eventDispatcherService.on(AppEventTypeEnum.BANK_ACCOUNT_CREATED).subscribe(() => {
6205
+ this.resetCache();
6206
+ });
6207
+ }
6250
6208
  }
6251
6209
  BankConnectionService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: BankConnectionService, deps: [{ token: i1.HttpClient }, { token: EventDispatcherService }, { token: 'environment' }], target: i0.ɵɵFactoryTarget.Injectable });
6252
6210
  BankConnectionService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: BankConnectionService, providedIn: 'root' });
@@ -6320,7 +6278,7 @@ class BankTransactionService extends BaseRestService {
6320
6278
  }
6321
6279
  listenBankTransactionsImport() {
6322
6280
  this.eventDispatcherService.on(AppEventTypeEnum.NOTIFICATION_ADDED).subscribe((notification) => {
6323
- if (!notification.isRead && notification.eventType === UserEventTypeTypeEnum.BASIQ_FIRST_IMPORT_COMPLETE) {
6281
+ if (!notification.isRead && notification.eventType === UserEventTypeClientTypeEnum.BASIQ_FIRST_IMPORT_COMPLETE) {
6324
6282
  this.resetCache();
6325
6283
  }
6326
6284
  });
@@ -6402,7 +6360,7 @@ class BasiqService extends BaseRestService {
6402
6360
  */
6403
6361
  listenNotifications() {
6404
6362
  this.eventDispatcherService.on(AppEventTypeEnum.NOTIFICATION_ADDED).subscribe((notification) => {
6405
- if (!notification.isRead && notification.eventType === UserEventTypeTypeEnum.BASIQ_NEW_ACCOUNTS) {
6363
+ if (!notification.isRead && notification.eventType === UserEventTypeClientTypeEnum.BASIQ_NEW_ACCOUNTS) {
6406
6364
  this.resetCache();
6407
6365
  this.get().subscribe();
6408
6366
  }
@@ -7425,14 +7383,14 @@ class FirmService {
7425
7383
  register(data) {
7426
7384
  return this.http.post(`${this.environment.apiV2}/firms/registration`, data)
7427
7385
  .pipe(map((firm) => {
7428
- return plainToClass(Firm$1, firm);
7386
+ return plainToClass(Firm, firm);
7429
7387
  }));
7430
7388
  }
7431
7389
  get() {
7432
7390
  if (!this.firm) {
7433
7391
  this.http.get(`${this.environment.apiV2}/firms/current`)
7434
7392
  .pipe(map((firm) => {
7435
- return plainToClass(Firm$1, firm);
7393
+ return plainToClass(Firm, firm);
7436
7394
  }))
7437
7395
  .subscribe((firm) => {
7438
7396
  this.firm = firm;
@@ -7444,7 +7402,7 @@ class FirmService {
7444
7402
  update(firm) {
7445
7403
  return this.http.put(`${this.environment.apiV2}/firms/current`, firm)
7446
7404
  .pipe(map((updatedItem) => {
7447
- const updatedInstance = plainToClass(Firm$1, updatedItem);
7405
+ const updatedInstance = plainToClass(Firm, updatedItem);
7448
7406
  this.firmSubject.next(updatedInstance);
7449
7407
  }));
7450
7408
  }
@@ -7454,7 +7412,7 @@ class FirmService {
7454
7412
  getAll() {
7455
7413
  return this.http.get(`${this.environment.apiV2}/firms`)
7456
7414
  .pipe(map((response) => {
7457
- return response['hydra:member'].map((firmBase) => plainToClass(Firm$1, firmBase));
7415
+ return response['hydra:member'].map((firmBase) => plainToClass(Firm, firmBase));
7458
7416
  }));
7459
7417
  }
7460
7418
  getByType(type) {
@@ -7465,7 +7423,7 @@ class FirmService {
7465
7423
  updatePhoto(firm, photo) {
7466
7424
  return this.http.post(`${this.environment.apiV2}/firms/photo?_method=PUT`, photo)
7467
7425
  .pipe(map((firmPhoto) => {
7468
- this.firm = plainToClass(Firm$1, Object.assign(firm, { photo: firmPhoto }));
7426
+ this.firm = plainToClass(Firm, Object.assign(firm, { photo: firmPhoto }));
7469
7427
  this.firmSubject.next(this.firm);
7470
7428
  return firm;
7471
7429
  }));
@@ -7984,6 +7942,80 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImpo
7984
7942
  args: ['environment']
7985
7943
  }] }, { type: SseService }]; } });
7986
7944
 
7945
+ /**
7946
+ * Configuration file with the settings to generate PDF file
7947
+ */
7948
+ const PDF_CONFIG = {
7949
+ text: {
7950
+ fontSize: 18,
7951
+ fontName: 'helvetica',
7952
+ fontStyle: '',
7953
+ fontWeight: 'bold',
7954
+ positionX: 14,
7955
+ positionY: 10,
7956
+ fillColor: 255,
7957
+ textColor: 0
7958
+ },
7959
+ // coords for file section title (group, table, e.t.c.)
7960
+ contentTitleCoords: {
7961
+ marginTop: 20
7962
+ },
7963
+ contentCoords: {
7964
+ marginTop: 15,
7965
+ marginLeft: 14
7966
+ }
7967
+ };
7968
+
7969
+ /**
7970
+ * Service to work with PDF (generate, download, e.t.c.)
7971
+ */
7972
+ class PdfService {
7973
+ // @Todo remove 'any' type
7974
+ /**
7975
+ * Download generated PDF file
7976
+ */
7977
+ download(tables, title, fileName) {
7978
+ const document = this.generatePdfFile(tables, title);
7979
+ document.save(`${fileName}.pdf`);
7980
+ }
7981
+ /**
7982
+ * Generate PDF file from provided data
7983
+ */
7984
+ generatePdfFile(tables, title) {
7985
+ const pdf = new jsPDF();
7986
+ // set document title
7987
+ pdf.setFontSize(PDF_CONFIG.text.fontSize);
7988
+ pdf.setFont(PDF_CONFIG.text.fontName, PDF_CONFIG.text.fontStyle, PDF_CONFIG.text.fontWeight);
7989
+ pdf.text(title, PDF_CONFIG.text.positionX, PDF_CONFIG.text.positionY);
7990
+ tables.forEach((table) => {
7991
+ // coords of last table
7992
+ const lastTableCoords = pdf['lastAutoTable'].finalY || PDF_CONFIG.contentCoords.marginTop;
7993
+ pdf.text(table.caption, PDF_CONFIG.contentCoords.marginLeft, lastTableCoords + PDF_CONFIG.contentCoords.marginTop);
7994
+ // table options
7995
+ const options = {
7996
+ startY: lastTableCoords + PDF_CONFIG.contentTitleCoords.marginTop,
7997
+ head: [table['columns'].map((column) => column.name)],
7998
+ body: table['rows'],
7999
+ foot: [table['footerRow']],
8000
+ footStyles: {
8001
+ fillColor: PDF_CONFIG.text.fillColor,
8002
+ textColor: PDF_CONFIG.text.textColor
8003
+ }
8004
+ };
8005
+ autoTable(pdf, options);
8006
+ });
8007
+ return pdf;
8008
+ }
8009
+ }
8010
+ PdfService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: PdfService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
8011
+ PdfService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: PdfService, providedIn: 'root' });
8012
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: PdfService, decorators: [{
8013
+ type: Injectable,
8014
+ args: [{
8015
+ providedIn: 'root'
8016
+ }]
8017
+ }] });
8018
+
7987
8019
  class PreloaderService {
7988
8020
  constructor() {
7989
8021
  this.activePreloaders = new BehaviorSubject([]);
@@ -9699,6 +9731,56 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImpo
9699
9731
  args: ['environment']
9700
9732
  }] }]; } });
9701
9733
 
9734
+ /**
9735
+ * Service to work with XLSX (generate, download, e.t.c.)
9736
+ */
9737
+ class XlsxService {
9738
+ // @Todo remove 'any' type
9739
+ /**s
9740
+ * Download generated Excel file
9741
+ */
9742
+ download(tables, title, fileName) {
9743
+ const excelFile = this.generateFile(tables, title);
9744
+ const data = new Blob([excelFile], {
9745
+ type: 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet;charset=UTF-8'
9746
+ });
9747
+ FileSaver.saveAs(data, `${fileName}.xlsx`);
9748
+ }
9749
+ generateFile(tables, title) {
9750
+ // create new workbook
9751
+ const workbook = xlsx.utils.book_new();
9752
+ // create empty worksheet
9753
+ const worksheet = {
9754
+ SheetNames: [],
9755
+ Sheets: {}
9756
+ };
9757
+ const sheetData = tables.map((table) => {
9758
+ // add caption, columns, rows and footer rows
9759
+ return [
9760
+ [table.caption],
9761
+ table.columns.map((column) => column.name),
9762
+ ...table.rows,
9763
+ table.footerRow,
9764
+ ];
9765
+ });
9766
+ sheetData.forEach((data) => {
9767
+ xlsx.utils.sheet_add_json(worksheet, data, { origin: -1, skipHeader: true });
9768
+ // set empty row after each table
9769
+ xlsx.utils.sheet_add_json(worksheet, [], { origin: -1 });
9770
+ });
9771
+ xlsx.utils.book_append_sheet(workbook, worksheet);
9772
+ return xlsx.write(workbook, { bookType: 'xlsx', type: 'array' });
9773
+ }
9774
+ }
9775
+ XlsxService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: XlsxService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
9776
+ XlsxService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: XlsxService, providedIn: 'root' });
9777
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: XlsxService, decorators: [{
9778
+ type: Injectable,
9779
+ args: [{
9780
+ providedIn: 'root'
9781
+ }]
9782
+ }] });
9783
+
9702
9784
  // deep clone for entity
9703
9785
  function cloneDeep(array) {
9704
9786
  return JSON.parse(JSON.stringify(array));
@@ -9777,5 +9859,5 @@ function taxReviewFilterPredicate(data, filter) {
9777
9859
  * Generated bundle index. Do not edit.
9778
9860
  */
9779
9861
 
9780
- export { AbstractCollection, Address, AddressService, AddressTypeEnum, AppEvent, AppEventTypeEnum, AssetEntityTypeEnum, AssetTypeEnum, AssetsService, AuthService, BANK_ACCOUNT_TYPES, Bank, BankAccount, BankAccountCalculationService, BankAccountChartData, BankAccountCollection, BankAccountProperty, BankAccountService, BankAccountStatusEnum, BankAccountTypeEnum, BankConnection, BankConnectionService, BankConnectionStatusEnum, BankService, BankTransaction, BankTransactionCalculationService, BankTransactionChartData, BankTransactionCollection, BankTransactionService, BankTransactionSummaryFieldsEnum, BankTransactionTypeEnum, BasiqJob, BasiqService, BasiqToken, BorrowingExpense, BorrowingExpenseLoan, BorrowingExpenseService, CAPITAL_COSTS_ITEMS, CHART_ACCOUNTS_CATEGORIES, CalculationFormItem, CalculationFormTypeEnum, CapitalProjectService, ChartAccounts, ChartAccountsCategoryEnum, ChartAccountsDepreciation, ChartAccountsDepreciationService, ChartAccountsEtpEnum, ChartAccountsHeading, ChartAccountsHeadingTaxDeductibleEnum, ChartAccountsHeadingTaxableEnum, ChartAccountsHeadingVehicleListEnum, ChartAccountsListEnum, ChartAccountsMetadata, ChartAccountsMetadataListEnum, ChartAccountsMetadataTypeEnum, ChartAccountsService, ChartAccountsTaxLabelsEnum, ChartAccountsTypeEnum, ChartData, ChartSerie, Chat, ChatService, ChatStatusEnum, ChatViewTypeEnum, ClientCollection, ClientDetails, ClientDetailsMedicareExemptionEnum, ClientDetailsWorkDepreciationCalculationEnum, ClientDetailsWorkingHolidayMakerEnum, ClientInvite, ClientInviteService, ClientInviteStatusEnum, ClientInviteTypeEnum, ClientMovement, ClientMovementCollection, ClientMovementService, ClientPortfolioChartData, ClientPortfolioReport, ClientPortfolioReportCollection, ClientPortfolioReportService, CollectionDictionary, CorelogicService, CorelogicSuggestion, Country, DEFAULT_VEHICLE_EXPENSE, DEPRECIATION_GROUPS, DOCUMENT_FILE_TYPES, Depreciation, DepreciationCalculationEnum, DepreciationCalculationPercentEnum, DepreciationCapitalProject, DepreciationCollection, DepreciationForecast, DepreciationForecastCollection, DepreciationGroup, DepreciationGroupEnum, DepreciationGroupItem, DepreciationReceipt, DepreciationService, DepreciationTypeEnum, DepreciationWriteOffAmountEnum, Document, DocumentApiUrlPrefixEnum, DocumentFolder, DocumentFolderService, ENDPOINTS, EmployeeCollection, EmployeeDetails, EmployeeInvite, EmployeeInviteService, EmployeeService, Endpoint, EventDispatcherService, FinancialYear, Firm, FirmService, FirmTypeEnum, HeaderTitleService, IconsFileEnum, IncomeAmountTypeEnum, IncomePosition, IncomeSource, IncomeSourceChartData, IncomeSourceCollection, IncomeSourceForecast, IncomeSourceForecastService, IncomeSourceService, IncomeSourceType, IncomeSourceTypeEnum, IncomeSourceTypeListOtherEnum, IncomeSourceTypeListSalaryEnum, IncomeSourceTypeListWorkEnum, IntercomService, InviteStatusEnum, JwtService, Loan, LoanBankTypeEnum, LoanCollection, LoanFrequencyEnum, LoanInterestTypeEnum, LoanMaxNumberOfPaymentsEnum, LoanPayment, LoanPayout, LoanPayoutTypeEnum, LoanRepaymentFrequencyEnum, LoanRepaymentTypeEnum, LoanService, LoanTypeEnum, LoanVehicleTypeEnum, LogbookCollection, LogbookPeriod, MODULE_URL_LIST, MONTHS, Message, MessageCollection, MessageDocument, MessageDocumentCollection, MessageDocumentService, MessageService, MonthNameShortEnum, MonthNumberEnum, MyAccountHistory, MyAccountHistoryInitiatedByEnum, MyAccountHistoryStatusEnum, MyAccountHistoryTypeEnum, NOTIFICATION_EVENT_TYPES, Notification, NotificationService, Occupation, OccupationService, OwnershipFilterOptionsEnum, Phone, PhoneTypeEnum, PreloaderService, Property, PropertyCalculationService, PropertyCapitalCost, PropertyCapitalCostService, PropertyCategory, PropertyCategoryMovement, PropertyCategoryService, PropertyCollection, PropertyDepreciationCalculationEnum, PropertyDocument, PropertyDocumentService, PropertyEquityChartData, PropertyEquityChartItem, PropertyForecast, PropertyOwner, PropertyOwnerAccessEnum, PropertyOwnerService, PropertyOwnerStatusEnum, PropertyService, PropertySold, PropertySoldService, PropertySubscription, PropertyValuation, RegistrationInvite, RegistrationInviteStatusEnum, SUBSCRIPTION_DESCRIPTION, SUBSCRIPTION_TITLE, SalaryForecast, SalaryForecastFrequencyEnum, SalaryForecastService, ServiceNotificationStatusEnum, ServiceNotificationTypeEnum, ServicePayment, ServicePaymentStatusEnum, ServicePrice, ServicePriceCollection, ServicePriceRecurringIntervalEnum, ServicePriceTypeEnum, ServiceProduct, ServiceSubscription, ServiceSubscriptionCollection, ServiceSubscriptionItem, ServiceSubscriptionStatusEnum, SpareDocumentSpareTypeEnum, SseService, SubscriptionService, SubscriptionTypeEnum, TYPE_LOAN, TankTypeEnum, TaxCalculationMedicareExemptionEnum, TaxCalculationTypeEnum, TaxReturnCategoryItem, TaxReturnCategoryItemCollection, TaxReturnCategoryItemDetails, TaxReturnCategoryListEnum, TaxReturnCategorySectionEnum, TaxReview, TaxReviewCollection, TaxReviewHistoryService, TaxReviewService, TaxReviewStatusEnum, TaxSummary, TaxSummaryListEnum, TaxSummarySection, TaxSummarySectionEnum, TaxSummaryService, TaxSummaryTaxSummaryEnum, TaxSummaryTypeEnum, TicketFeedbackEnum, TicketStatusEnum, TicketTypesEnum, Transaction, TransactionAllocation, TransactionAllocationCollection, TransactionAllocationService, TransactionBase, TransactionCalculationService, TransactionCollection, TransactionMetadata, TransactionOperationEnum, TransactionReceipt, TransactionService, TransactionSourceEnum, TransactionTypeEnum, TtCoreModule, USER_ROLES, USER_WORK_POSITION, User, UserEventCategory, UserEventCategoryEnum, UserEventSetting, UserEventSettingCollection, UserEventSettingFieldEnum, UserEventSettingService, UserEventStatusEnum, UserEventType, UserEventTypeFrequencyEnum, UserEventTypeReminderEnum, UserEventTypeReminderTypeEnum, UserEventTypeService, UserEventTypeTypeEnum, UserMedicareExemptionEnum, UserRolesEnum, UserService, UserStatusEnum, UserSwitcherService, UserTitleEnum, UserToRegister, UserWorkDepreciationCalculationEnum, UserWorkingHolidayMakerEnum, Vehicle, VehicleClaim, VehicleClaimMethodEnum, VehicleLogbook, VehicleLogbookPurposeEnum, WORK_TANK_LOGBOOK_PURPOSE_OPTIONS, WorkTankService, cloneDeep, compare, compareMatOptions, createDate, displayMatOptions, enumToList, getDocIcon, replace, roundTo, sort, sortDeep, taxReviewFilterPredicate };
9862
+ export { AbstractCollection, Address, AddressService, AddressTypeEnum, AppEvent, AppEventTypeEnum, AssetEntityTypeEnum, AssetTypeEnum, AssetsService, AuthService, BANK_ACCOUNT_TYPES, Bank, BankAccount, BankAccountCalculationService, BankAccountChartData, BankAccountCollection, BankAccountProperty, BankAccountService, BankAccountStatusEnum, BankAccountTypeEnum, BankConnection, BankConnectionService, BankConnectionStatusEnum, BankService, BankTransaction, BankTransactionCalculationService, BankTransactionChartData, BankTransactionCollection, BankTransactionService, BankTransactionSummaryFieldsEnum, BankTransactionTypeEnum, BasiqJob, BasiqService, BasiqToken, BorrowingExpense, BorrowingExpenseLoan, BorrowingExpenseService, CAPITAL_COSTS_ITEMS, CHART_ACCOUNTS_CATEGORIES, CalculationFormItem, CalculationFormTypeEnum, CapitalProjectService, ChartAccounts, ChartAccountsCategoryEnum, ChartAccountsDepreciation, ChartAccountsDepreciationService, ChartAccountsEtpEnum, ChartAccountsHeading, ChartAccountsHeadingTaxDeductibleEnum, ChartAccountsHeadingTaxableEnum, ChartAccountsHeadingVehicleListEnum, ChartAccountsListEnum, ChartAccountsMetadata, ChartAccountsMetadataListEnum, ChartAccountsMetadataTypeEnum, ChartAccountsService, ChartAccountsTaxLabelsEnum, ChartAccountsTypeEnum, ChartData, ChartSerie, Chat, ChatService, ChatStatusEnum, ChatViewTypeEnum, ClientCollection, ClientDetails, ClientDetailsMedicareExemptionEnum, ClientDetailsWorkDepreciationCalculationEnum, ClientDetailsWorkingHolidayMakerEnum, ClientInvite, ClientInviteService, ClientInviteStatusEnum, ClientInviteTypeEnum, ClientMovement, ClientMovementCollection, ClientMovementService, ClientPortfolioChartData, ClientPortfolioReport, ClientPortfolioReportCollection, ClientPortfolioReportService, CollectionDictionary, CorelogicService, CorelogicSuggestion, Country, DEFAULT_VEHICLE_EXPENSE, DEPRECIATION_GROUPS, DOCUMENT_FILE_TYPES, DataTable, DataTableColumn, Depreciation, DepreciationCalculationEnum, DepreciationCalculationPercentEnum, DepreciationCapitalProject, DepreciationCollection, DepreciationForecast, DepreciationForecastCollection, DepreciationGroup, DepreciationGroupEnum, DepreciationGroupItem, DepreciationReceipt, DepreciationService, DepreciationTypeEnum, DepreciationWriteOffAmountEnum, Document, DocumentApiUrlPrefixEnum, DocumentFolder, DocumentFolderService, ENDPOINTS, EmployeeCollection, EmployeeDetails, EmployeeInvite, EmployeeInviteService, EmployeeService, Endpoint, EventDispatcherService, FinancialYear, Firm, FirmService, FirmTypeEnum, HeaderTitleService, IconsFileEnum, IncomeAmountTypeEnum, IncomePosition, IncomeSource, IncomeSourceChartData, IncomeSourceCollection, IncomeSourceForecast, IncomeSourceForecastService, IncomeSourceService, IncomeSourceType, IncomeSourceTypeEnum, IncomeSourceTypeListOtherEnum, IncomeSourceTypeListSalaryEnum, IncomeSourceTypeListWorkEnum, IntercomService, InviteStatusEnum, JwtService, Loan, LoanBankTypeEnum, LoanCollection, LoanFrequencyEnum, LoanInterestTypeEnum, LoanMaxNumberOfPaymentsEnum, LoanPayment, LoanPayout, LoanPayoutTypeEnum, LoanRepaymentFrequencyEnum, LoanRepaymentTypeEnum, LoanService, LoanTypeEnum, LoanVehicleTypeEnum, LogbookCollection, LogbookPeriod, MODULE_URL_LIST, MONTHS, Message, MessageCollection, MessageDocument, MessageDocumentCollection, MessageDocumentService, MessageService, MonthNameShortEnum, MonthNumberEnum, MyAccountHistory, MyAccountHistoryInitiatedByEnum, MyAccountHistoryStatusEnum, MyAccountHistoryTypeEnum, Notification, NotificationService, Occupation, OccupationService, OwnershipFilterOptionsEnum, PdfService, Phone, PhoneTypeEnum, PreloaderService, Property, PropertyCalculationService, PropertyCapitalCost, PropertyCapitalCostService, PropertyCategory, PropertyCategoryMovement, PropertyCategoryService, PropertyCollection, PropertyDepreciationCalculationEnum, PropertyDocument, PropertyDocumentService, PropertyEquityChartData, PropertyEquityChartItem, PropertyForecast, PropertyOwner, PropertyOwnerAccessEnum, PropertyOwnerService, PropertyOwnerStatusEnum, PropertyService, PropertySold, PropertySoldService, PropertySubscription, PropertyValuation, RegistrationInvite, RegistrationInviteStatusEnum, SUBSCRIPTION_DESCRIPTION, SUBSCRIPTION_TITLE, SalaryForecast, SalaryForecastFrequencyEnum, SalaryForecastService, ServiceNotificationStatusEnum, ServiceNotificationTypeEnum, ServicePayment, ServicePaymentStatusEnum, ServicePrice, ServicePriceCollection, ServicePriceRecurringIntervalEnum, ServicePriceTypeEnum, ServiceProduct, ServiceSubscription, ServiceSubscriptionCollection, ServiceSubscriptionItem, ServiceSubscriptionStatusEnum, SpareDocumentSpareTypeEnum, SseService, SubscriptionService, SubscriptionTypeEnum, TYPE_LOAN, TankTypeEnum, TaxCalculationMedicareExemptionEnum, TaxCalculationTypeEnum, TaxReturnCategoryItem, TaxReturnCategoryItemCollection, TaxReturnCategoryItemDetails, TaxReturnCategoryListEnum, TaxReturnCategorySectionEnum, TaxReview, TaxReviewCollection, TaxReviewHistoryService, TaxReviewService, TaxReviewStatusEnum, TaxSummary, TaxSummaryListEnum, TaxSummarySection, TaxSummarySectionEnum, TaxSummaryService, TaxSummaryTaxSummaryEnum, TaxSummaryTypeEnum, TicketFeedbackEnum, TicketStatusEnum, TicketTypesEnum, Transaction, TransactionAllocation, TransactionAllocationCollection, TransactionAllocationService, TransactionBase, TransactionCalculationService, TransactionCollection, TransactionMetadata, TransactionOperationEnum, TransactionReceipt, TransactionService, TransactionSourceEnum, TransactionTypeEnum, TtCoreModule, USER_ROLES, USER_WORK_POSITION, User, UserEventSetting, UserEventSettingCollection, UserEventSettingFieldEnum, UserEventSettingService, UserEventStatusEnum, UserEventType, UserEventTypeCategory, UserEventTypeClientTypeEnum, UserEventTypeEmployeeTypeEnum, UserEventTypeFrequencyEnum, UserEventTypeService, UserEventTypeUserTypeEnum, UserMedicareExemptionEnum, UserRolesEnum, UserService, UserStatusEnum, UserSwitcherService, UserTitleEnum, UserToRegister, UserWorkDepreciationCalculationEnum, UserWorkingHolidayMakerEnum, Vehicle, VehicleClaim, VehicleClaimMethodEnum, VehicleLogbook, VehicleLogbookPurposeEnum, WORK_TANK_LOGBOOK_PURPOSE_OPTIONS, WorkTankService, XlsxService, cloneDeep, compare, compareMatOptions, createDate, displayMatOptions, enumToList, getDocIcon, replace, roundTo, sort, sortDeep, taxReviewFilterPredicate };
9781
9863
  //# sourceMappingURL=taxtank-core.js.map