taxtank-core 0.28.85 → 0.28.86

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.
@@ -6234,7 +6234,7 @@
6234
6234
  * https://taxtank.atlassian.net/wiki/spaces/TAXTANK/pages/217415928/Dashboard+Property
6235
6235
  */
6236
6236
  Property.prototype.getTaxPosition = function (transactions, depreciations) {
6237
- return transactions.cashPosition - Math.abs(depreciations.claimAmount);
6237
+ return transactions.grossClaimAmount - Math.abs(depreciations.claimAmount);
6238
6238
  };
6239
6239
  return Property;
6240
6240
  }(Property$1));
@@ -7955,18 +7955,6 @@
7955
7955
  return sum + transaction.getUnallocatedAmount(allocations.filterBy('transaction.id', transaction.id));
7956
7956
  }, 0);
7957
7957
  };
7958
- Object.defineProperty(TransactionCollection.prototype, "cashPosition", {
7959
- /**
7960
- * Get cash position
7961
- * Cash Position = Income - Expenses
7962
- * Cash position is equal to Total Amount because income is positive and expense is negative,
7963
- */
7964
- get: function () {
7965
- return this.grossAmount;
7966
- },
7967
- enumerable: false,
7968
- configurable: true
7969
- });
7970
7958
  /**
7971
7959
  * get date of the last transaction
7972
7960
  */
@@ -7974,15 +7962,19 @@
7974
7962
  return new Date(Math.max.apply(Math, this.items.map(function (transaction) { return transaction.date; })));
7975
7963
  };
7976
7964
  Object.defineProperty(TransactionCollection.prototype, "claimAmount", {
7977
- /**
7978
- * Get summary of claim amounts
7979
- */
7980
7965
  get: function () {
7981
7966
  return this.items.reduce(function (sum, transaction) { return sum + transaction.claimAmount; }, 0);
7982
7967
  },
7983
7968
  enumerable: false,
7984
7969
  configurable: true
7985
7970
  });
7971
+ Object.defineProperty(TransactionCollection.prototype, "grossClaimAmount", {
7972
+ get: function () {
7973
+ return this.items.reduce(function (sum, transaction) { return sum + transaction.grossClaimAmount; }, 0);
7974
+ },
7975
+ enumerable: false,
7976
+ configurable: true
7977
+ });
7986
7978
  Object.defineProperty(TransactionCollection.prototype, "grossAmount", {
7987
7979
  get: function () {
7988
7980
  return this.items.reduce(function (sum, transaction) { return sum + transaction.grossAmount; }, 0);
@@ -17092,7 +17084,7 @@
17092
17084
  }
17093
17085
  PropertyCalculationService.prototype.getTaxPosition = function (transactions, depreciations) {
17094
17086
  // @TODO hack: math abs added because we have mismatching of real values signs
17095
- return transactions.cashPosition - Math.abs(depreciations.claimAmount);
17087
+ return transactions.grossClaimAmount - Math.abs(depreciations.claimAmount);
17096
17088
  };
17097
17089
  PropertyCalculationService.prototype.getTaxPosition$ = function (transactions$, depreciations$) {
17098
17090
  var _this = this;
@@ -17234,7 +17226,7 @@
17234
17226
  if (!forecastedCashPosition) {
17235
17227
  return 0;
17236
17228
  }
17237
- return (transactions.cashPosition - forecastedCashPosition) / forecastedCashPosition;
17229
+ return (transactions.grossClaimAmount - forecastedCashPosition) / forecastedCashPosition;
17238
17230
  };
17239
17231
  /**
17240
17232
  * Get Badge for single property in collection
@@ -17600,22 +17592,26 @@
17600
17592
  }]
17601
17593
  }] });
17602
17594
 
17595
+ /**
17596
+ * @TODO Alex refactor
17597
+ */
17603
17598
  var SubscriptionService = /** @class */ (function () {
17604
- function SubscriptionService(http, eventDispatcherService, sseService, environment) {
17599
+ function SubscriptionService(http, eventDispatcherService, sseService, toastService, environment) {
17605
17600
  this.http = http;
17606
17601
  this.eventDispatcherService = eventDispatcherService;
17607
17602
  this.sseService = sseService;
17603
+ this.toastService = toastService;
17608
17604
  this.environment = environment;
17609
17605
  this.serviceSubscriptionSubject = new rxjs.ReplaySubject(1);
17610
- this.serviceSubscriptionsSubject = new rxjs.ReplaySubject(1);
17611
17606
  this.servicePaymentsSubject = new rxjs.ReplaySubject(1);
17612
- this.subscriptionChangeSubject = new rxjs.BehaviorSubject(null);
17613
17607
  this.listenSubscriptions();
17614
17608
  }
17615
17609
  SubscriptionService.prototype.getSubscription = function (force) {
17616
17610
  var _this = this;
17617
17611
  if (force === void 0) { force = false; }
17618
- if (!this._serviceSubscription || force) {
17612
+ if (this._serviceSubscription === undefined || force) {
17613
+ console.log('getSubscription');
17614
+ this._serviceSubscription = null;
17619
17615
  this.http.get(this.environment.apiV2 + "/subscriptions/last")
17620
17616
  .pipe(operators.map(function (response) {
17621
17617
  return classTransformer.plainToClass(ServiceSubscription, response);
@@ -17691,14 +17687,16 @@
17691
17687
  this.sseService.on("serviceSubscriptions")
17692
17688
  .pipe(operators.map(function (event) { return classTransformer.plainToClass(ServiceSubscription, event); }))
17693
17689
  .subscribe(function (subscription) {
17694
- _this.getSubscription(true).subscribe();
17695
- _this.subscriptionChangeSubject.next(subscription);
17690
+ _this._serviceSubscription = subscription;
17691
+ _this.serviceSubscriptionSubject.next(_this._serviceSubscription);
17696
17692
  _this.eventDispatcherService.dispatch(new AppEvent(exports.AppEventTypeEnum.SERVICE_SUBSCRIPTION_UPDATED, null));
17693
+ // @TODO move?
17694
+ _this.toastService.success('Subscription successfully updated');
17697
17695
  });
17698
17696
  };
17699
17697
  return SubscriptionService;
17700
17698
  }());
17701
- SubscriptionService.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: SubscriptionService, deps: [{ token: i1__namespace.HttpClient }, { token: EventDispatcherService }, { token: SseService }, { token: 'environment' }], target: i0__namespace.ɵɵFactoryTarget.Injectable });
17699
+ SubscriptionService.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: SubscriptionService, deps: [{ token: i1__namespace.HttpClient }, { token: EventDispatcherService }, { token: SseService }, { token: ToastService }, { token: 'environment' }], target: i0__namespace.ɵɵFactoryTarget.Injectable });
17702
17700
  SubscriptionService.ɵprov = i0__namespace.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: SubscriptionService, providedIn: 'root' });
17703
17701
  i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: SubscriptionService, decorators: [{
17704
17702
  type: i0.Injectable,
@@ -17706,7 +17704,7 @@
17706
17704
  providedIn: 'root'
17707
17705
  }]
17708
17706
  }], ctorParameters: function () {
17709
- return [{ type: i1__namespace.HttpClient }, { type: EventDispatcherService }, { type: SseService }, { type: undefined, decorators: [{
17707
+ return [{ type: i1__namespace.HttpClient }, { type: EventDispatcherService }, { type: SseService }, { type: ToastService }, { type: undefined, decorators: [{
17710
17708
  type: i0.Inject,
17711
17709
  args: ['environment']
17712
17710
  }] }];