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.
- package/bundles/taxtank-core.umd.js +24 -26
- package/bundles/taxtank-core.umd.js.map +1 -1
- package/esm2015/lib/collections/transaction/transaction.collection.js +4 -12
- package/esm2015/lib/models/property/property.js +2 -2
- package/esm2015/lib/services/http/subscription/subscription.service.js +17 -10
- package/esm2015/lib/services/property/property-calculation/property-calculation.service.js +3 -3
- package/fesm2015/taxtank-core.js +20 -22
- package/fesm2015/taxtank-core.js.map +1 -1
- package/lib/collections/transaction/transaction.collection.d.ts +1 -9
- package/lib/services/http/subscription/subscription.service.d.ts +7 -5
- package/package.json +1 -1
package/fesm2015/taxtank-core.js
CHANGED
|
@@ -4749,7 +4749,7 @@ class Property extends Property$1 {
|
|
|
4749
4749
|
* https://taxtank.atlassian.net/wiki/spaces/TAXTANK/pages/217415928/Dashboard+Property
|
|
4750
4750
|
*/
|
|
4751
4751
|
getTaxPosition(transactions, depreciations) {
|
|
4752
|
-
return transactions.
|
|
4752
|
+
return transactions.grossClaimAmount - Math.abs(depreciations.claimAmount);
|
|
4753
4753
|
}
|
|
4754
4754
|
}
|
|
4755
4755
|
/**
|
|
@@ -6263,26 +6263,18 @@ class TransactionCollection extends ExportableCollection {
|
|
|
6263
6263
|
return sum + transaction.getUnallocatedAmount(allocations.filterBy('transaction.id', transaction.id));
|
|
6264
6264
|
}, 0);
|
|
6265
6265
|
}
|
|
6266
|
-
/**
|
|
6267
|
-
* Get cash position
|
|
6268
|
-
* Cash Position = Income - Expenses
|
|
6269
|
-
* Cash position is equal to Total Amount because income is positive and expense is negative,
|
|
6270
|
-
*/
|
|
6271
|
-
get cashPosition() {
|
|
6272
|
-
return this.grossAmount;
|
|
6273
|
-
}
|
|
6274
6266
|
/**
|
|
6275
6267
|
* get date of the last transaction
|
|
6276
6268
|
*/
|
|
6277
6269
|
getLastTransactionDate() {
|
|
6278
6270
|
return new Date(Math.max.apply(Math, this.items.map((transaction) => transaction.date)));
|
|
6279
6271
|
}
|
|
6280
|
-
/**
|
|
6281
|
-
* Get summary of claim amounts
|
|
6282
|
-
*/
|
|
6283
6272
|
get claimAmount() {
|
|
6284
6273
|
return this.items.reduce((sum, transaction) => sum + transaction.claimAmount, 0);
|
|
6285
6274
|
}
|
|
6275
|
+
get grossClaimAmount() {
|
|
6276
|
+
return this.items.reduce((sum, transaction) => sum + transaction.grossClaimAmount, 0);
|
|
6277
|
+
}
|
|
6286
6278
|
get grossAmount() {
|
|
6287
6279
|
return this.items.reduce((sum, transaction) => sum + transaction.grossAmount, 0);
|
|
6288
6280
|
}
|
|
@@ -14293,7 +14285,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImpo
|
|
|
14293
14285
|
class PropertyCalculationService {
|
|
14294
14286
|
getTaxPosition(transactions, depreciations) {
|
|
14295
14287
|
// @TODO hack: math abs added because we have mismatching of real values signs
|
|
14296
|
-
return transactions.
|
|
14288
|
+
return transactions.grossClaimAmount - Math.abs(depreciations.claimAmount);
|
|
14297
14289
|
}
|
|
14298
14290
|
getTaxPosition$(transactions$, depreciations$) {
|
|
14299
14291
|
return combineLatest([
|
|
@@ -14424,7 +14416,7 @@ class PropertyCalculationService {
|
|
|
14424
14416
|
if (!forecastedCashPosition) {
|
|
14425
14417
|
return 0;
|
|
14426
14418
|
}
|
|
14427
|
-
return (transactions.
|
|
14419
|
+
return (transactions.grossClaimAmount - forecastedCashPosition) / forecastedCashPosition;
|
|
14428
14420
|
}
|
|
14429
14421
|
/**
|
|
14430
14422
|
* Get Badge for single property in collection
|
|
@@ -14759,20 +14751,24 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImpo
|
|
|
14759
14751
|
}]
|
|
14760
14752
|
}] });
|
|
14761
14753
|
|
|
14754
|
+
/**
|
|
14755
|
+
* @TODO Alex refactor
|
|
14756
|
+
*/
|
|
14762
14757
|
class SubscriptionService {
|
|
14763
|
-
constructor(http, eventDispatcherService, sseService, environment) {
|
|
14758
|
+
constructor(http, eventDispatcherService, sseService, toastService, environment) {
|
|
14764
14759
|
this.http = http;
|
|
14765
14760
|
this.eventDispatcherService = eventDispatcherService;
|
|
14766
14761
|
this.sseService = sseService;
|
|
14762
|
+
this.toastService = toastService;
|
|
14767
14763
|
this.environment = environment;
|
|
14768
14764
|
this.serviceSubscriptionSubject = new ReplaySubject(1);
|
|
14769
|
-
this.serviceSubscriptionsSubject = new ReplaySubject(1);
|
|
14770
14765
|
this.servicePaymentsSubject = new ReplaySubject(1);
|
|
14771
|
-
this.subscriptionChangeSubject = new BehaviorSubject(null);
|
|
14772
14766
|
this.listenSubscriptions();
|
|
14773
14767
|
}
|
|
14774
14768
|
getSubscription(force = false) {
|
|
14775
|
-
if (
|
|
14769
|
+
if (this._serviceSubscription === undefined || force) {
|
|
14770
|
+
console.log('getSubscription');
|
|
14771
|
+
this._serviceSubscription = null;
|
|
14776
14772
|
this.http.get(`${this.environment.apiV2}/subscriptions/last`)
|
|
14777
14773
|
.pipe(map((response) => {
|
|
14778
14774
|
return plainToClass(ServiceSubscription, response);
|
|
@@ -14838,20 +14834,22 @@ class SubscriptionService {
|
|
|
14838
14834
|
this.sseService.on(`serviceSubscriptions`)
|
|
14839
14835
|
.pipe(map((event) => plainToClass(ServiceSubscription, event)))
|
|
14840
14836
|
.subscribe((subscription) => {
|
|
14841
|
-
this.
|
|
14842
|
-
this.
|
|
14837
|
+
this._serviceSubscription = subscription;
|
|
14838
|
+
this.serviceSubscriptionSubject.next(this._serviceSubscription);
|
|
14843
14839
|
this.eventDispatcherService.dispatch(new AppEvent(AppEventTypeEnum.SERVICE_SUBSCRIPTION_UPDATED, null));
|
|
14840
|
+
// @TODO move?
|
|
14841
|
+
this.toastService.success('Subscription successfully updated');
|
|
14844
14842
|
});
|
|
14845
14843
|
}
|
|
14846
14844
|
}
|
|
14847
|
-
SubscriptionService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: SubscriptionService, deps: [{ token: i1.HttpClient }, { token: EventDispatcherService }, { token: SseService }, { token: 'environment' }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
14845
|
+
SubscriptionService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: SubscriptionService, deps: [{ token: i1.HttpClient }, { token: EventDispatcherService }, { token: SseService }, { token: ToastService }, { token: 'environment' }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
14848
14846
|
SubscriptionService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: SubscriptionService, providedIn: 'root' });
|
|
14849
14847
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: SubscriptionService, decorators: [{
|
|
14850
14848
|
type: Injectable,
|
|
14851
14849
|
args: [{
|
|
14852
14850
|
providedIn: 'root'
|
|
14853
14851
|
}]
|
|
14854
|
-
}], ctorParameters: function () { return [{ type: i1.HttpClient }, { type: EventDispatcherService }, { type: SseService }, { type: undefined, decorators: [{
|
|
14852
|
+
}], ctorParameters: function () { return [{ type: i1.HttpClient }, { type: EventDispatcherService }, { type: SseService }, { type: ToastService }, { type: undefined, decorators: [{
|
|
14855
14853
|
type: Inject,
|
|
14856
14854
|
args: ['environment']
|
|
14857
14855
|
}] }]; } });
|