taxtank-core 0.31.59 → 0.31.60

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 (149) hide show
  1. package/esm2020/lib/collections/vehicle/best-vehicle-logbook.collection.mjs +92 -0
  2. package/esm2020/lib/collections/vehicle/index.mjs +2 -1
  3. package/esm2020/lib/collections/vehicle/vehicle-logbook.collection.mjs +15 -58
  4. package/esm2020/lib/interceptors/basiq-client-id.interceptor.mjs +3 -3
  5. package/esm2020/lib/interceptors/basiq-token.interceptor.mjs +3 -3
  6. package/esm2020/lib/interceptors/corelogic-interceptor.mjs +3 -3
  7. package/esm2020/lib/interceptors/financial-year-interceptor.mjs +3 -3
  8. package/esm2020/lib/interceptors/interceptors.module.mjs +4 -4
  9. package/esm2020/lib/interceptors/jwt-interceptor.mjs +3 -3
  10. package/esm2020/lib/interceptors/preloader.interceptor.mjs +3 -3
  11. package/esm2020/lib/interceptors/user-switcher-interceptor.mjs +3 -3
  12. package/esm2020/lib/models/vehicle/index.mjs +1 -2
  13. package/esm2020/lib/models/vehicle/vehicle-logbook.mjs +1 -28
  14. package/esm2020/lib/pipes/app-currency.pipe.mjs +3 -3
  15. package/esm2020/lib/services/account-setup/account-setup.service.mjs +3 -3
  16. package/esm2020/lib/services/affiliate/rewardful/rewardful.service.mjs +3 -3
  17. package/esm2020/lib/services/asset/assets.service.mjs +3 -3
  18. package/esm2020/lib/services/auth/auth.service.mjs +3 -3
  19. package/esm2020/lib/services/auth/jwt.service.mjs +3 -3
  20. package/esm2020/lib/services/bank/bank-account-calculation.service.mjs +3 -3
  21. package/esm2020/lib/services/bank/bank-transaction-calculation.service.mjs +3 -3
  22. package/esm2020/lib/services/data.service.mjs +3 -3
  23. package/esm2020/lib/services/event/event-dispatcher.service.mjs +3 -3
  24. package/esm2020/lib/services/event/sse.service.mjs +3 -3
  25. package/esm2020/lib/services/export/export-formatter.service.mjs +3 -3
  26. package/esm2020/lib/services/header-title/header-title.service.mjs +3 -3
  27. package/esm2020/lib/services/http/address/address.service.mjs +3 -3
  28. package/esm2020/lib/services/http/bank/bank-account/bank-account.service.mjs +3 -3
  29. package/esm2020/lib/services/http/bank/bank-connection/bank-connection.service.mjs +3 -3
  30. package/esm2020/lib/services/http/bank/bank-transaction/bank-transaction.service.mjs +3 -3
  31. package/esm2020/lib/services/http/bank/bank.service.mjs +3 -3
  32. package/esm2020/lib/services/http/bank/basiq/basiq-token.service.mjs +3 -3
  33. package/esm2020/lib/services/http/bank/basiq/basiq.service.mjs +3 -3
  34. package/esm2020/lib/services/http/budget/budget.service.mjs +3 -3
  35. package/esm2020/lib/services/http/chart-accounts/chart-accounts-depreciations/chart-accounts-depreciations.service.mjs +3 -3
  36. package/esm2020/lib/services/http/chart-accounts/chart-accounts.service.mjs +3 -3
  37. package/esm2020/lib/services/http/chat/chat.service.mjs +3 -3
  38. package/esm2020/lib/services/http/chat/message-document.service.mjs +3 -3
  39. package/esm2020/lib/services/http/chat/message.service.mjs +3 -3
  40. package/esm2020/lib/services/http/client/capital-gain/annual-client-details.service.mjs +3 -3
  41. package/esm2020/lib/services/http/client/occupation/occupation.service.mjs +3 -3
  42. package/esm2020/lib/services/http/depreciation/depreciation-capital-project/depreciation-capital-project.service.mjs +3 -3
  43. package/esm2020/lib/services/http/depreciation/depreciation.service.mjs +3 -3
  44. package/esm2020/lib/services/http/document/document-folder/document-folder.service.mjs +3 -3
  45. package/esm2020/lib/services/http/document/document.service.mjs +3 -3
  46. package/esm2020/lib/services/http/facebook/facebook.service.mjs +3 -3
  47. package/esm2020/lib/services/http/file/file.service.mjs +3 -3
  48. package/esm2020/lib/services/http/firm/client-income/client-income-types.service.mjs +3 -3
  49. package/esm2020/lib/services/http/firm/client-invite/client-invite.service.mjs +3 -3
  50. package/esm2020/lib/services/http/firm/client-movement/client-movement.service.mjs +3 -3
  51. package/esm2020/lib/services/http/firm/employee/employee.service.mjs +3 -3
  52. package/esm2020/lib/services/http/firm/employee-invite/employee-invite.service.mjs +3 -3
  53. package/esm2020/lib/services/http/firm/firm.service.mjs +3 -3
  54. package/esm2020/lib/services/http/firm/portfolio-report/client-portfolio-report.service.mjs +3 -3
  55. package/esm2020/lib/services/http/google/google.service.mjs +3 -3
  56. package/esm2020/lib/services/http/holding/holding-sale.service.mjs +3 -3
  57. package/esm2020/lib/services/http/holding/holding-type.service.mjs +3 -3
  58. package/esm2020/lib/services/http/holding/holding.service.mjs +3 -3
  59. package/esm2020/lib/services/http/income-source/income-source-forecast/income-source-forecast.service.mjs +3 -3
  60. package/esm2020/lib/services/http/income-source/income-source.service.mjs +3 -3
  61. package/esm2020/lib/services/http/income-source/salary-forecast/salary-forecast.service.mjs +3 -3
  62. package/esm2020/lib/services/http/income-source/sole-forecast/sole-forecast.service.mjs +3 -3
  63. package/esm2020/lib/services/http/loan/borrowing-expense/borrowing-expense.service.mjs +3 -3
  64. package/esm2020/lib/services/http/loan/loan.service.mjs +3 -3
  65. package/esm2020/lib/services/http/property/borrowing-report/borrowing-report.service.mjs +3 -3
  66. package/esm2020/lib/services/http/property/property-category/property-category.service.mjs +3 -3
  67. package/esm2020/lib/services/http/property/property-category-movement/property-category-movement.service.mjs +3 -3
  68. package/esm2020/lib/services/http/property/property-document/property-document.service.mjs +3 -3
  69. package/esm2020/lib/services/http/property/property-sale/property-sale.service.mjs +3 -3
  70. package/esm2020/lib/services/http/property/property-share/property-share.service.mjs +3 -3
  71. package/esm2020/lib/services/http/property/property-valuation/property-valuation.service.mjs +3 -3
  72. package/esm2020/lib/services/http/property/property.service.mjs +3 -3
  73. package/esm2020/lib/services/http/rest/rest-old.service.mjs +3 -3
  74. package/esm2020/lib/services/http/rest/rest.service.mjs +3 -3
  75. package/esm2020/lib/services/http/service-notification/service-notification.service.mjs +3 -3
  76. package/esm2020/lib/services/http/setup-item/setup-item.service.mjs +3 -3
  77. package/esm2020/lib/services/http/sole/bas-report/bas-report.service.mjs +3 -3
  78. package/esm2020/lib/services/http/sole/sole-business/sole-business.service.mjs +3 -3
  79. package/esm2020/lib/services/http/sole/sole-business-activity/sole-business-activity.service.mjs +3 -3
  80. package/esm2020/lib/services/http/sole/sole-business-loss/sole-business-loss-rules/sole-business-loss-offset-rule.service.mjs +3 -3
  81. package/esm2020/lib/services/http/sole/sole-business-loss/sole-business-loss.service.mjs +3 -3
  82. package/esm2020/lib/services/http/sole/sole-contact/sole-contact.service.mjs +3 -3
  83. package/esm2020/lib/services/http/sole/sole-depreciation-method/sole-depreciation-method.service.mjs +3 -3
  84. package/esm2020/lib/services/http/sole/sole-details/sole-details.service.mjs +3 -3
  85. package/esm2020/lib/services/http/sole/sole-invoice/sole-invoice.service.mjs +3 -3
  86. package/esm2020/lib/services/http/sole/sole-invoice-template/sole-invoice-template.service.mjs +3 -3
  87. package/esm2020/lib/services/http/subscription/service-payment/service-payment.service.mjs +3 -3
  88. package/esm2020/lib/services/http/subscription/service-payment-method/service-payment-method.service.mjs +3 -3
  89. package/esm2020/lib/services/http/subscription/service-price/service-price.service.mjs +3 -3
  90. package/esm2020/lib/services/http/subscription/service-product/service-product.service.mjs +3 -3
  91. package/esm2020/lib/services/http/subscription/service-subscription/subscription.service.mjs +3 -3
  92. package/esm2020/lib/services/http/tax-review/tax-review-history/tax-review-history.service.mjs +3 -3
  93. package/esm2020/lib/services/http/tax-review/tax-review.service.mjs +3 -3
  94. package/esm2020/lib/services/http/tax-summary/tax-summary.service.mjs +3 -3
  95. package/esm2020/lib/services/http/transaction/transaction-allocation/allocation-rule/allocation-rule.service.mjs +3 -3
  96. package/esm2020/lib/services/http/transaction/transaction-allocation/transaction-allocation.service.mjs +3 -3
  97. package/esm2020/lib/services/http/transaction/transaction.service.mjs +3 -3
  98. package/esm2020/lib/services/http/tutorial-video/tutorial-video.service.mjs +3 -3
  99. package/esm2020/lib/services/http/user/financial-year/financial-year.service.mjs +3 -3
  100. package/esm2020/lib/services/http/user/user-event-setting/user-event-setting.service.mjs +3 -3
  101. package/esm2020/lib/services/http/user/user-event-type/user-event-type.service.mjs +3 -3
  102. package/esm2020/lib/services/http/user/user.service.mjs +3 -3
  103. package/esm2020/lib/services/http/user/users-invite/users-invite.service.mjs +3 -3
  104. package/esm2020/lib/services/http/vehicle/vehicle-claim-details.service.mjs +4 -21
  105. package/esm2020/lib/services/http/vehicle/vehicle-claim.service.mjs +6 -22
  106. package/esm2020/lib/services/http/vehicle/vehicle-logbook/vehicle-logbook.service.mjs +3 -3
  107. package/esm2020/lib/services/http/vehicle/vehicle.service.mjs +3 -3
  108. package/esm2020/lib/services/index.mjs +1 -2
  109. package/esm2020/lib/services/intercom/intercom.service.mjs +3 -3
  110. package/esm2020/lib/services/json/chart-accounts/chart-accounts-value.service.mjs +3 -3
  111. package/esm2020/lib/services/json/holding/holding-type-exchange.service.mjs +3 -3
  112. package/esm2020/lib/services/json/income-source/income-source-type.service.mjs +3 -3
  113. package/esm2020/lib/services/json/tax-exemption/tax-exemption.service.mjs +3 -3
  114. package/esm2020/lib/services/json/tax-return/tax-return-item.service.mjs +3 -3
  115. package/esm2020/lib/services/mixpanel/mixpanel.service.mjs +3 -3
  116. package/esm2020/lib/services/pdf/pdf-from-dom-element/pdf-from-dom-element.service.mjs +3 -3
  117. package/esm2020/lib/services/pdf/pdf-from-table/pdf-from-data-table/pdf-from-data-table.service.mjs +3 -3
  118. package/esm2020/lib/services/pdf/pdf-from-table/pdf-from-html-table/pdf-from-html-table.service.mjs +3 -3
  119. package/esm2020/lib/services/pdf/pdf-from-table/pdf-from-table.service.mjs +3 -3
  120. package/esm2020/lib/services/preloader/preloader.service.mjs +3 -3
  121. package/esm2020/lib/services/property/corelogic/corelogic.service.mjs +3 -3
  122. package/esm2020/lib/services/property/equity-position-chart/equity-position-chart.service.mjs +3 -3
  123. package/esm2020/lib/services/property/property-calculation/property-calculation.service.mjs +3 -3
  124. package/esm2020/lib/services/report/property/property-transaction-report.service.mjs +3 -3
  125. package/esm2020/lib/services/toast/toast.service.mjs +3 -3
  126. package/esm2020/lib/services/transaction/transaction-calculation.service.mjs +3 -3
  127. package/esm2020/lib/services/user/user-switcher.service.mjs +3 -3
  128. package/esm2020/lib/services/xlsx/xlsx.service.mjs +3 -3
  129. package/esm2020/lib/tt-core.module.mjs +4 -4
  130. package/esm2020/lib/validators/unique-email.validator.mjs +3 -3
  131. package/fesm2015/taxtank-core.mjs +503 -589
  132. package/fesm2015/taxtank-core.mjs.map +1 -1
  133. package/fesm2020/taxtank-core.mjs +503 -589
  134. package/fesm2020/taxtank-core.mjs.map +1 -1
  135. package/lib/collections/vehicle/best-vehicle-logbook.collection.d.ts +49 -0
  136. package/lib/collections/vehicle/index.d.ts +1 -0
  137. package/lib/collections/vehicle/vehicle-logbook.collection.d.ts +7 -13
  138. package/lib/models/vehicle/index.d.ts +0 -1
  139. package/lib/models/vehicle/vehicle-logbook.d.ts +0 -17
  140. package/lib/services/http/vehicle/vehicle-claim-details.service.d.ts +1 -8
  141. package/lib/services/http/vehicle/vehicle-claim.service.d.ts +0 -5
  142. package/lib/services/index.d.ts +0 -1
  143. package/package.json +1 -1
  144. package/esm2020/lib/models/vehicle/logbook-period.mjs +0 -25
  145. package/esm2020/lib/services/vehicle/index.mjs +0 -2
  146. package/esm2020/lib/services/vehicle/logbook-best-period.service.mjs +0 -71
  147. package/lib/models/vehicle/logbook-period.d.ts +0 -16
  148. package/lib/services/vehicle/index.d.ts +0 -1
  149. package/lib/services/vehicle/logbook-best-period.service.d.ts +0 -28
@@ -0,0 +1,49 @@
1
+ import { VehicleClaim } from '../../models';
2
+ import { VehicleLogbookCollection } from './vehicle-logbook.collection';
3
+ import { DateRange } from 'moment-range';
4
+ /**
5
+ * Special logbook collection that contains logbooks from date period with the highest work usage percent
6
+ * Docs: https://taxtank.atlassian.net/wiki/spaces/TAXTANK/pages/211517441/Logbook+Vehicle
7
+ */
8
+ export declare class BestVehicleLogbookCollection extends VehicleLogbookCollection {
9
+ /**
10
+ * Logbook claimable period duration in milliseconds.
11
+ * https://taxtank.atlassian.net/wiki/spaces/TAXTANK/pages/211517441/Logbook+Vehicle
12
+ */
13
+ static periodDuration: number;
14
+ /**
15
+ * Date range with the biggest work usage percent
16
+ */
17
+ period: DateRange;
18
+ /**
19
+ * constructor is private because we want to prevent collection initialization via 'new' operator.
20
+ * We should create instances only with fromLogbooks method
21
+ */
22
+ private constructor();
23
+ /**
24
+ * Best period may be calculated only when user has logbooks minimum for VehicleLogbook.bestPeriodWeeks
25
+ */
26
+ isBestPeriodExist(logbooks?: VehicleLogbookCollection): boolean;
27
+ getWorkUsageByClaim(claim: VehicleClaim): number;
28
+ /**
29
+ * Set Date Range with the biggest work usage percent
30
+ * Range duration is defined as BestVehicleLogbookCollection.periodDuration by the ATO
31
+ *
32
+ * Algorithm:
33
+ * Claimable logbooks or claimable trips - work/business logbook items.
34
+ * We should work with dates from the first to the last trip (include personal trips).
35
+ * Get date ranges starts on each claimable trip, all other ranges are definetily worst.
36
+ * Also get extra date range which ends with the last claimable trip.
37
+ * Get all trips included to each date range.
38
+ * Find and return range with the biggest workUsage percent.
39
+ */
40
+ private calculateBestPeriod;
41
+ private getPeriods;
42
+ /**
43
+ * Get claimable date range for passed logbook
44
+ * @param logbook logbook instance for range calculation
45
+ * @param isBackward Flag false - range for logbook + duration; flag true - range for logbook - duration. Used for extra case, when we should add an extra date range for the last logbook
46
+ */
47
+ private getPeriodByLogbook;
48
+ static fromLogbooks(logbooks: VehicleLogbookCollection): BestVehicleLogbookCollection | null;
49
+ }
@@ -1,2 +1,3 @@
1
+ export * from './best-vehicle-logbook.collection';
1
2
  export * from './vehicle-claim.collection';
2
3
  export * from './vehicle-logbook.collection';
@@ -1,22 +1,12 @@
1
1
  import { Collection } from '../collection';
2
- import { LogbookPeriod, VehicleClaim, VehicleLogbook } from '../../models';
2
+ import { VehicleClaim, VehicleLogbook } from '../../models';
3
+ import { BestVehicleLogbookCollection } from './best-vehicle-logbook.collection';
3
4
  export declare class VehicleLogbookCollection extends Collection<VehicleLogbook> {
4
- /**
5
- * Best period may be calculated only when user has logbooks minimum for VehicleLogbook.bestPeriodWeeks
6
- * @TODO Vik: Best period: move this and related logic to backend
7
- */
8
- isBestPeriodExist(): boolean;
9
5
  /**
10
6
  * Get collection of non-personal logbooks (work-related, sole-related).
11
7
  * @TODO Vik: Best period: move this and related logic to backend
12
8
  */
13
9
  getClaimableLogbooks(): this;
14
- /**
15
- * Get Logbook Period with the biggest work usage percent
16
- * Best period duration is defined as VehicleLogbook.bestPeriodWeeks by the ATO
17
- * @TODO Vik: Best period: move this and related logic to backend
18
- */
19
- getBestPeriod(): LogbookPeriod;
20
10
  /**
21
11
  * Calculate total kilometers traveled
22
12
  */
@@ -25,9 +15,13 @@ export declare class VehicleLogbookCollection extends Collection<VehicleLogbook>
25
15
  * Calculate work usage (percent of business-related kilometers from total kilometers)
26
16
  * @TODO Alex: TT-2089 replace with getter
27
17
  */
28
- getWorkUsage(): number;
18
+ get workUsage(): number;
29
19
  /**
30
20
  * Get list of logbooks related to passed vehicle claim
31
21
  */
32
22
  getByVehicleClaim(vehicleClaim: VehicleClaim): this;
23
+ /**
24
+ * get collection of logbooks with the biggest work usage for {@link BestVehicleLogbookCollection.periodDuration}
25
+ */
26
+ getBest(): BestVehicleLogbookCollection | null;
33
27
  }
@@ -1,4 +1,3 @@
1
- export * from './logbook-period';
2
1
  export * from './vehicle';
3
2
  export * from './vehicle-claim';
4
3
  export * from './vehicle-claim-details';
@@ -1,28 +1,11 @@
1
1
  import { VehicleLogbook as VehicleLogbookBase } from '../../db/Models/vehicle/vehicle-logbook';
2
2
  import { SoleBusiness } from '../sole';
3
3
  import { TankTypeEnum } from '../../db/Enums/tank-type.enum';
4
- /**
5
- * moment js import for date range
6
- * Hack: The library is using not by documentation, but works
7
- * https://github.com/rotaready/moment-range
8
- * extendMoment(Moment) cause errors since we updated to Typescript 4 (https://github.com/rotaready/moment-range/issues/238)
9
- * @TODO Alex: move this import to some global const if we will need it one more time
10
- */
11
- import { DateRange } from 'moment-range';
12
4
  export declare class VehicleLogbook extends VehicleLogbookBase {
13
- /**
14
- * Logbook period duration in milliseconds.
15
- * https://taxtank.atlassian.net/wiki/spaces/TAXTANK/pages/211517441/Logbook+Vehicle
16
- */
17
- static bestPeriodDuration: number;
18
5
  date: Date;
19
6
  business: SoleBusiness;
20
7
  get kilometers(): number;
21
8
  get tankType(): TankTypeEnum;
22
9
  isWorkTank(): boolean;
23
10
  isSoleTank(): boolean;
24
- /**
25
- * Get logbook period date range from logbook date and weeksInPeriod duration
26
- */
27
- getPeriod(): DateRange;
28
11
  }
@@ -2,12 +2,11 @@ import { VehicleClaimDetails } from '../../../models';
2
2
  import { Observable, ReplaySubject } from 'rxjs';
3
3
  import { HttpClient } from '@angular/common/http';
4
4
  import { EventDispatcherService } from '../../event/event-dispatcher.service';
5
- import { IEventListener } from '../../../interfaces/event-listener.interface';
6
5
  import * as i0 from "@angular/core";
7
6
  /**
8
7
  * @TODO TT-1777 Alex: extend from rest service when it refactored
9
8
  */
10
- export declare class VehicleClaimDetailsService implements IEventListener {
9
+ export declare class VehicleClaimDetailsService {
11
10
  protected environment: any;
12
11
  private http;
13
12
  private eventDispatcherService;
@@ -15,15 +14,9 @@ export declare class VehicleClaimDetailsService implements IEventListener {
15
14
  cacheSubject: ReplaySubject<VehicleClaimDetails>;
16
15
  url: string;
17
16
  constructor(environment: any, http: HttpClient, eventDispatcherService: EventDispatcherService);
18
- listenEvents(): void;
19
17
  get(): Observable<VehicleClaimDetails>;
20
18
  add(details: VehicleClaimDetails): Observable<VehicleClaimDetails>;
21
19
  update(details: VehicleClaimDetails): Observable<VehicleClaimDetails>;
22
- /**
23
- * Listen logbook best period updates
24
- * @TODO Vik: Best period move this and related logic to backend
25
- */
26
- private listenBestPeriodChanges;
27
20
  /**
28
21
  * Set vehicle claim details as manual
29
22
  * @TODO Vik: Best period move this and related logic to backend
@@ -17,11 +17,6 @@ export declare class VehicleClaimService extends RestService<VehicleClaimBase, V
17
17
  * when details method changed, all claims current values become 0
18
18
  */
19
19
  private listenVehicleClaimDetailsChanges;
20
- /**
21
- * Best period changes affect to claims workUsage
22
- * @TODO Vik: Best period move this and related logic to backend
23
- */
24
- private listenBestPeriodChanges;
25
20
  /**
26
21
  * Update workUsage for all vehicle claims if logbook best period changed
27
22
  * @TODO Vik: Best period move this and related logic to backend
@@ -17,5 +17,4 @@ export * from './report';
17
17
  export * from './toast';
18
18
  export * from './transaction';
19
19
  export * from './user';
20
- export * from './vehicle';
21
20
  export * from './xlsx';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "taxtank-core",
3
- "version": "0.31.59",
3
+ "version": "0.31.60",
4
4
  "private": false,
5
5
  "peerDependencies": {
6
6
  "@angular/compiler": "^15.1.5",
@@ -1,25 +0,0 @@
1
- import { __decorate } from "tslib";
2
- import { Type } from 'class-transformer';
3
- import { FinancialYear } from '../financial-year';
4
- import round from 'lodash/round';
5
- /**
6
- * Class contains traveled kilometers and work usage percent in 12 weeks date range
7
- * @TODO Vik: Best period: move this and related logic to backend
8
- * @TODO Alex: check if we need this class when calculation refactored with backend
9
- */
10
- export class LogbookPeriod {
11
- isEndOfYear() {
12
- return this.to === new FinancialYear().endDate;
13
- }
14
- getWorkUsageByClaim(claim) {
15
- const claimKilometers = this.logbooks.getByVehicleClaim(claim).getClaimableLogbooks().kilometers;
16
- return round(this.workUsage * (claimKilometers / this.kilometers), 2);
17
- }
18
- }
19
- __decorate([
20
- Type(() => Date)
21
- ], LogbookPeriod.prototype, "from", void 0);
22
- __decorate([
23
- Type(() => Date)
24
- ], LogbookPeriod.prototype, "to", void 0);
25
- //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibG9nYm9vay1wZXJpb2QuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi8uLi8uLi8uLi9wcm9qZWN0cy90dC1jb3JlL3NyYy9saWIvbW9kZWxzL3ZlaGljbGUvbG9nYm9vay1wZXJpb2QudHMiXSwibmFtZXMiOltd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bG9tZXRlcnMpLCAyKTtcbiAgfVxufVxuIl19
@@ -1,2 +0,0 @@
1
- export * from './logbook-best-period.service';
2
- //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi8uLi8uLi8uLi9wcm9qZWN0cy90dC1jb3JlL3NyYy9saWIvc2VydmljZXMvdmVoaWNsZS9pbmRleC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSxjQUFjLCtCQUErQixDQUFDIiwic291cmNlc0NvbnRlbnQiOlsiZXhwb3J0ICogZnJvbSAnLi9sb2dib29rLWJlc3QtcGVyaW9kLnNlcnZpY2UnO1xuIl19
@@ -1,71 +0,0 @@
1
- import { Injectable } from '@angular/core';
2
- import { ReplaySubject, combineLatest } from 'rxjs';
3
- import { skip } from 'rxjs/operators';
4
- import { AppEvent } from '../../models/event/app-event';
5
- import { AppEventTypeEnum } from '../../models/event/app-event-type.enum';
6
- import isEqual from 'lodash/isEqual';
7
- import * as i0 from "@angular/core";
8
- import * as i1 from "../http";
9
- import * as i2 from "../event/event-dispatcher.service";
10
- /**
11
- * Service for logbook best period calculation
12
- * @TODO Vik: improve structure for such cases (TT-2043)
13
- * @TODO Vik: Best period move this and related logic to backend
14
- */
15
- export class LogbookBestPeriodService {
16
- constructor(vehicleClaimDetailsService, vehicleClaimService, vehicleLogbookService, eventDispatcherService) {
17
- this.vehicleClaimDetailsService = vehicleClaimDetailsService;
18
- this.vehicleClaimService = vehicleClaimService;
19
- this.vehicleLogbookService = vehicleLogbookService;
20
- this.eventDispatcherService = eventDispatcherService;
21
- this.cacheSubject = new ReplaySubject();
22
- this.listenEvents();
23
- }
24
- listenEvents() {
25
- this.listenCacheUpdates();
26
- }
27
- get() {
28
- if (!this.cache) {
29
- combineLatest([
30
- this.vehicleClaimDetailsService.get(),
31
- this.vehicleLogbookService.get()
32
- ])
33
- .subscribe(([details, logbooks]) => {
34
- let period;
35
- // calculate current initial best period
36
- if (details?.isManual || !details?.isLogbookMethod() || !logbooks.isBestPeriodExist()) {
37
- period = null;
38
- }
39
- else {
40
- period = logbooks.getBestPeriod();
41
- }
42
- // update cache only when best period changed
43
- if (!isEqual(this.cache, period)) {
44
- this.cache = period;
45
- this.cacheSubject.next(this.cache);
46
- }
47
- });
48
- }
49
- return this.cacheSubject.asObservable();
50
- }
51
- /**
52
- * Dispatch event when logbook best period changed
53
- */
54
- listenCacheUpdates() {
55
- // Skip initial calculation and fire event only when subject changed
56
- this.cacheSubject
57
- .pipe(skip(1))
58
- .subscribe((period) => {
59
- this.eventDispatcherService.dispatch(new AppEvent(AppEventTypeEnum.VEHICLE_LOGBOOK_BEST_PERIOD_UPDATED, period));
60
- });
61
- }
62
- }
63
- LogbookBestPeriodService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.5", ngImport: i0, type: LogbookBestPeriodService, deps: [{ token: i1.VehicleClaimDetailsService }, { token: i1.VehicleClaimService }, { token: i1.VehicleLogbookService }, { token: i2.EventDispatcherService }], target: i0.ɵɵFactoryTarget.Injectable });
64
- LogbookBestPeriodService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.1.5", ngImport: i0, type: LogbookBestPeriodService, providedIn: 'root' });
65
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.5", ngImport: i0, type: LogbookBestPeriodService, decorators: [{
66
- type: Injectable,
67
- args: [{
68
- providedIn: 'root'
69
- }]
70
- }], ctorParameters: function () { return [{ type: i1.VehicleClaimDetailsService }, { type: i1.VehicleClaimService }, { type: i1.VehicleLogbookService }, { type: i2.EventDispatcherService }]; } });
71
- //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibG9nYm9vay1iZXN0LXBlcmlvZC5zZXJ2aWNlLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMi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gICAgICAgIH1cbiAgICAgICAgfSlcbiAgICB9XG5cbiAgICByZXR1cm4gdGhpcy5jYWNoZVN1YmplY3QuYXNPYnNlcnZhYmxlKCk7XG4gIH1cblxuICAvKipcbiAgICogRGlzcGF0Y2ggZXZlbnQgd2hlbiBsb2dib29rIGJlc3QgcGVyaW9kIGNoYW5nZWRcbiAgICovXG4gIHByaXZhdGUgbGlzdGVuQ2FjaGVVcGRhdGVzKCkge1xuICAgIC8vIFNraXAgaW5pdGlhbCBjYWxjdWxhdGlvbiBhbmQgZmlyZSBldmVudCBvbmx5IHdoZW4gc3ViamVjdCBjaGFuZ2VkXG4gICAgdGhpcy5jYWNoZVN1YmplY3RcbiAgICAgIC5waXBlKHNraXAoMSkpXG4gICAgICAuc3Vic2NyaWJlKChwZXJpb2Q6IExvZ2Jvb2tQZXJpb2QpID0+IHtcbiAgICAgICAgdGhpcy5ldmVudERpc3BhdGNoZXJTZXJ2aWNlLmRpc3BhdGNoKG5ldyBBcHBFdmVudChBcHBFdmVudFR5cGVFbnVtLlZFSElDTEVfTE9HQk9PS19CRVNUX1BFUklPRF9VUERBVEVELCBwZXJpb2QpKVxuICAgICAgfSlcbiAgfVxufVxuIl19
@@ -1,16 +0,0 @@
1
- import { VehicleLogbookCollection } from '../../collections';
2
- import { VehicleClaim } from './vehicle-claim';
3
- /**
4
- * Class contains traveled kilometers and work usage percent in 12 weeks date range
5
- * @TODO Vik: Best period: move this and related logic to backend
6
- * @TODO Alex: check if we need this class when calculation refactored with backend
7
- */
8
- export declare class LogbookPeriod {
9
- from: Date;
10
- to: Date;
11
- kilometers: number;
12
- workUsage: number;
13
- logbooks: VehicleLogbookCollection;
14
- isEndOfYear(): boolean;
15
- getWorkUsageByClaim(claim: VehicleClaim): number;
16
- }
@@ -1 +0,0 @@
1
- export * from './logbook-best-period.service';
@@ -1,28 +0,0 @@
1
- import { Observable, ReplaySubject } from 'rxjs';
2
- import { VehicleClaimDetailsService, VehicleClaimService, VehicleLogbookService } from '../http';
3
- import { LogbookPeriod } from '../../models';
4
- import { EventDispatcherService } from '../event/event-dispatcher.service';
5
- import { IEventListener } from '../../interfaces/event-listener.interface';
6
- import * as i0 from "@angular/core";
7
- /**
8
- * Service for logbook best period calculation
9
- * @TODO Vik: improve structure for such cases (TT-2043)
10
- * @TODO Vik: Best period move this and related logic to backend
11
- */
12
- export declare class LogbookBestPeriodService implements IEventListener {
13
- private vehicleClaimDetailsService;
14
- private vehicleClaimService;
15
- private vehicleLogbookService;
16
- private eventDispatcherService;
17
- cache: LogbookPeriod;
18
- cacheSubject: ReplaySubject<LogbookPeriod>;
19
- constructor(vehicleClaimDetailsService: VehicleClaimDetailsService, vehicleClaimService: VehicleClaimService, vehicleLogbookService: VehicleLogbookService, eventDispatcherService: EventDispatcherService);
20
- listenEvents(): void;
21
- get(): Observable<LogbookPeriod>;
22
- /**
23
- * Dispatch event when logbook best period changed
24
- */
25
- private listenCacheUpdates;
26
- static ɵfac: i0.ɵɵFactoryDeclaration<LogbookBestPeriodService, never>;
27
- static ɵprov: i0.ɵɵInjectableDeclaration<LogbookBestPeriodService>;
28
- }