taxtank-core 0.28.85 → 0.28.87
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 +77 -44
- package/bundles/taxtank-core.umd.js.map +1 -1
- package/esm2015/lib/collections/property/property-category-movement.collection.js +2 -2
- package/esm2015/lib/collections/transaction/transaction.collection.js +4 -12
- package/esm2015/lib/models/event/app-event-type.enum.js +20 -18
- package/esm2015/lib/models/property/property.js +2 -2
- package/esm2015/lib/services/http/sole/sole-invoice/sole-invoice.service.js +12 -1
- package/esm2015/lib/services/http/subscription/subscription.service.js +16 -10
- package/esm2015/lib/services/http/transaction/transaction-allocation/transaction-allocation.service.js +21 -1
- package/esm2015/lib/services/property/property-calculation/property-calculation.service.js +3 -3
- package/fesm2015/taxtank-core.js +69 -40
- package/fesm2015/taxtank-core.js.map +1 -1
- package/lib/collections/transaction/transaction.collection.d.ts +1 -9
- package/lib/models/event/app-event-type.enum.d.ts +19 -17
- package/lib/services/http/sole/sole-invoice/sole-invoice.service.d.ts +4 -1
- package/lib/services/http/subscription/subscription.service.d.ts +7 -5
- package/lib/services/http/transaction/transaction-allocation/transaction-allocation.service.d.ts +3 -0
- package/package.json +1 -1
|
@@ -600,23 +600,25 @@
|
|
|
600
600
|
AppEventTypeEnum[AppEventTypeEnum["SOLE_DETAILS_UPDATED"] = 49] = "SOLE_DETAILS_UPDATED";
|
|
601
601
|
AppEventTypeEnum[AppEventTypeEnum["SOLE_INVOICE_PUBLISHED"] = 50] = "SOLE_INVOICE_PUBLISHED";
|
|
602
602
|
AppEventTypeEnum[AppEventTypeEnum["TAX_REVIEW_UPDATED"] = 51] = "TAX_REVIEW_UPDATED";
|
|
603
|
-
AppEventTypeEnum[AppEventTypeEnum["
|
|
604
|
-
AppEventTypeEnum[AppEventTypeEnum["
|
|
605
|
-
AppEventTypeEnum[AppEventTypeEnum["
|
|
606
|
-
AppEventTypeEnum[AppEventTypeEnum["
|
|
607
|
-
AppEventTypeEnum[AppEventTypeEnum["
|
|
608
|
-
AppEventTypeEnum[AppEventTypeEnum["
|
|
609
|
-
AppEventTypeEnum[AppEventTypeEnum["
|
|
610
|
-
AppEventTypeEnum[AppEventTypeEnum["
|
|
611
|
-
AppEventTypeEnum[AppEventTypeEnum["
|
|
612
|
-
AppEventTypeEnum[AppEventTypeEnum["
|
|
613
|
-
AppEventTypeEnum[AppEventTypeEnum["
|
|
614
|
-
AppEventTypeEnum[AppEventTypeEnum["
|
|
615
|
-
AppEventTypeEnum[AppEventTypeEnum["
|
|
616
|
-
AppEventTypeEnum[AppEventTypeEnum["
|
|
617
|
-
AppEventTypeEnum[AppEventTypeEnum["
|
|
618
|
-
AppEventTypeEnum[AppEventTypeEnum["
|
|
619
|
-
AppEventTypeEnum[AppEventTypeEnum["
|
|
603
|
+
AppEventTypeEnum[AppEventTypeEnum["TRANSACTION_ALLOCATION_CREATED"] = 52] = "TRANSACTION_ALLOCATION_CREATED";
|
|
604
|
+
AppEventTypeEnum[AppEventTypeEnum["TRANSACTION_ALLOCATION_DELETED"] = 53] = "TRANSACTION_ALLOCATION_DELETED";
|
|
605
|
+
AppEventTypeEnum[AppEventTypeEnum["TRANSACTION_CREATED"] = 54] = "TRANSACTION_CREATED";
|
|
606
|
+
AppEventTypeEnum[AppEventTypeEnum["TRANSACTION_DELETED"] = 55] = "TRANSACTION_DELETED";
|
|
607
|
+
AppEventTypeEnum[AppEventTypeEnum["TRANSACTION_UPDATED"] = 56] = "TRANSACTION_UPDATED";
|
|
608
|
+
AppEventTypeEnum[AppEventTypeEnum["TRANSACTION_UPDATED_WITH_RECEIPT"] = 57] = "TRANSACTION_UPDATED_WITH_RECEIPT";
|
|
609
|
+
AppEventTypeEnum[AppEventTypeEnum["TRANSACTION_UPDATED_WITH_DELETED_RECEIPT"] = 58] = "TRANSACTION_UPDATED_WITH_DELETED_RECEIPT";
|
|
610
|
+
AppEventTypeEnum[AppEventTypeEnum["TRANSACTION_RECEIPT_CREATED"] = 59] = "TRANSACTION_RECEIPT_CREATED";
|
|
611
|
+
AppEventTypeEnum[AppEventTypeEnum["TRANSACTION_RECEIPT_DELETED"] = 60] = "TRANSACTION_RECEIPT_DELETED";
|
|
612
|
+
AppEventTypeEnum[AppEventTypeEnum["TRANSACTIONS_CREATED"] = 61] = "TRANSACTIONS_CREATED";
|
|
613
|
+
AppEventTypeEnum[AppEventTypeEnum["USER_UPDATED"] = 62] = "USER_UPDATED";
|
|
614
|
+
AppEventTypeEnum[AppEventTypeEnum["VEHICLE_CLAIM_UPDATED"] = 63] = "VEHICLE_CLAIM_UPDATED";
|
|
615
|
+
AppEventTypeEnum[AppEventTypeEnum["VEHICLE_CLAIM_CREATED"] = 64] = "VEHICLE_CLAIM_CREATED";
|
|
616
|
+
AppEventTypeEnum[AppEventTypeEnum["VEHICLE_CLAIM_DETAILS_UPDATED"] = 65] = "VEHICLE_CLAIM_DETAILS_UPDATED";
|
|
617
|
+
AppEventTypeEnum[AppEventTypeEnum["VEHICLE_CLAIM_DETAILS_CREATED"] = 66] = "VEHICLE_CLAIM_DETAILS_CREATED";
|
|
618
|
+
AppEventTypeEnum[AppEventTypeEnum["VEHICLE_LOGBOOK_CREATED"] = 67] = "VEHICLE_LOGBOOK_CREATED";
|
|
619
|
+
AppEventTypeEnum[AppEventTypeEnum["VEHICLE_LOGBOOK_UPDATED"] = 68] = "VEHICLE_LOGBOOK_UPDATED";
|
|
620
|
+
AppEventTypeEnum[AppEventTypeEnum["VEHICLE_LOGBOOK_DELETED"] = 69] = "VEHICLE_LOGBOOK_DELETED";
|
|
621
|
+
AppEventTypeEnum[AppEventTypeEnum["VEHICLE_LOGBOOK_BEST_PERIOD_UPDATED"] = 70] = "VEHICLE_LOGBOOK_BEST_PERIOD_UPDATED";
|
|
620
622
|
})(exports.AppEventTypeEnum || (exports.AppEventTypeEnum = {}));
|
|
621
623
|
|
|
622
624
|
var EventDispatcherService = /** @class */ (function () {
|
|
@@ -6234,7 +6236,7 @@
|
|
|
6234
6236
|
* https://taxtank.atlassian.net/wiki/spaces/TAXTANK/pages/217415928/Dashboard+Property
|
|
6235
6237
|
*/
|
|
6236
6238
|
Property.prototype.getTaxPosition = function (transactions, depreciations) {
|
|
6237
|
-
return transactions.
|
|
6239
|
+
return transactions.grossClaimAmount - Math.abs(depreciations.claimAmount);
|
|
6238
6240
|
};
|
|
6239
6241
|
return Property;
|
|
6240
6242
|
}(Property$1));
|
|
@@ -7888,7 +7890,7 @@
|
|
|
7888
7890
|
PropertyCategoryMovementCollection.prototype.getByForecast = function (property, forecast) {
|
|
7889
7891
|
var financialYear = new FinancialYear(forecast.financialYear);
|
|
7890
7892
|
return this.filterBy('property.id', property.id).filter(function (movement) {
|
|
7891
|
-
return movement.fromDate <= financialYear.endDate && movement.toDate >= financialYear.startDate;
|
|
7893
|
+
return movement.fromDate <= financialYear.endDate && !movement.toDate || movement.toDate >= financialYear.startDate;
|
|
7892
7894
|
});
|
|
7893
7895
|
};
|
|
7894
7896
|
PropertyCategoryMovementCollection.prototype.hasCategory = function (categoryId) {
|
|
@@ -7955,18 +7957,6 @@
|
|
|
7955
7957
|
return sum + transaction.getUnallocatedAmount(allocations.filterBy('transaction.id', transaction.id));
|
|
7956
7958
|
}, 0);
|
|
7957
7959
|
};
|
|
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
7960
|
/**
|
|
7971
7961
|
* get date of the last transaction
|
|
7972
7962
|
*/
|
|
@@ -7974,15 +7964,19 @@
|
|
|
7974
7964
|
return new Date(Math.max.apply(Math, this.items.map(function (transaction) { return transaction.date; })));
|
|
7975
7965
|
};
|
|
7976
7966
|
Object.defineProperty(TransactionCollection.prototype, "claimAmount", {
|
|
7977
|
-
/**
|
|
7978
|
-
* Get summary of claim amounts
|
|
7979
|
-
*/
|
|
7980
7967
|
get: function () {
|
|
7981
7968
|
return this.items.reduce(function (sum, transaction) { return sum + transaction.claimAmount; }, 0);
|
|
7982
7969
|
},
|
|
7983
7970
|
enumerable: false,
|
|
7984
7971
|
configurable: true
|
|
7985
7972
|
});
|
|
7973
|
+
Object.defineProperty(TransactionCollection.prototype, "grossClaimAmount", {
|
|
7974
|
+
get: function () {
|
|
7975
|
+
return this.items.reduce(function (sum, transaction) { return sum + transaction.grossClaimAmount; }, 0);
|
|
7976
|
+
},
|
|
7977
|
+
enumerable: false,
|
|
7978
|
+
configurable: true
|
|
7979
|
+
});
|
|
7986
7980
|
Object.defineProperty(TransactionCollection.prototype, "grossAmount", {
|
|
7987
7981
|
get: function () {
|
|
7988
7982
|
return this.items.reduce(function (sum, transaction) { return sum + transaction.grossAmount; }, 0);
|
|
@@ -12990,6 +12984,9 @@
|
|
|
12990
12984
|
_this.isHydra = true;
|
|
12991
12985
|
return _this;
|
|
12992
12986
|
}
|
|
12987
|
+
SoleInvoiceService.prototype.listenEvents = function () {
|
|
12988
|
+
this.listenAllocations();
|
|
12989
|
+
};
|
|
12993
12990
|
SoleInvoiceService.prototype.add = function (invoice) {
|
|
12994
12991
|
var _this = this;
|
|
12995
12992
|
return _super.prototype.add.call(this, invoice).pipe(operators.map(function (newInvoice) {
|
|
@@ -13038,6 +13035,15 @@
|
|
|
13038
13035
|
var number = (_b = (_a = last__default["default"](this.cache)) === null || _a === void 0 ? void 0 : _a.number) !== null && _b !== void 0 ? _b : 0;
|
|
13039
13036
|
return number + 1;
|
|
13040
13037
|
};
|
|
13038
|
+
SoleInvoiceService.prototype.listenAllocations = function () {
|
|
13039
|
+
var _this = this;
|
|
13040
|
+
this.eventDispatcherService.on([
|
|
13041
|
+
exports.AppEventTypeEnum.TRANSACTION_ALLOCATION_CREATED,
|
|
13042
|
+
exports.AppEventTypeEnum.TRANSACTION_ALLOCATION_DELETED
|
|
13043
|
+
]).subscribe(function () {
|
|
13044
|
+
_this.resetCache();
|
|
13045
|
+
});
|
|
13046
|
+
};
|
|
13041
13047
|
return SoleInvoiceService;
|
|
13042
13048
|
}(RestService));
|
|
13043
13049
|
SoleInvoiceService.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: SoleInvoiceService, deps: null, target: i0__namespace.ɵɵFactoryTarget.Injectable });
|
|
@@ -14133,6 +14139,28 @@
|
|
|
14133
14139
|
TransactionAllocationService.prototype.add = function (allocation) {
|
|
14134
14140
|
return this.addBatch([allocation]).pipe(operators.map(function (newAllocations) { return newAllocations[0]; }));
|
|
14135
14141
|
};
|
|
14142
|
+
TransactionAllocationService.prototype.addBatch = function (models, queryParams) {
|
|
14143
|
+
var _this = this;
|
|
14144
|
+
return _super.prototype.addBatch.call(this, models, queryParams)
|
|
14145
|
+
.pipe(operators.map(function (allocations) {
|
|
14146
|
+
_this.eventDispatcherService.dispatch(new AppEvent(exports.AppEventTypeEnum.TRANSACTION_ALLOCATION_CREATED, allocations));
|
|
14147
|
+
return allocations;
|
|
14148
|
+
}));
|
|
14149
|
+
};
|
|
14150
|
+
TransactionAllocationService.prototype.delete = function (model) {
|
|
14151
|
+
var _this = this;
|
|
14152
|
+
return _super.prototype.delete.call(this, model)
|
|
14153
|
+
.pipe(operators.map(function () {
|
|
14154
|
+
_this.eventDispatcherService.dispatch(new AppEvent(exports.AppEventTypeEnum.TRANSACTION_ALLOCATION_DELETED, null));
|
|
14155
|
+
}));
|
|
14156
|
+
};
|
|
14157
|
+
TransactionAllocationService.prototype.deleteBatch = function (models) {
|
|
14158
|
+
var _this = this;
|
|
14159
|
+
return _super.prototype.deleteBatch.call(this, models)
|
|
14160
|
+
.pipe(operators.map(function () {
|
|
14161
|
+
_this.eventDispatcherService.dispatch(new AppEvent(exports.AppEventTypeEnum.TRANSACTION_ALLOCATION_DELETED, null));
|
|
14162
|
+
}));
|
|
14163
|
+
};
|
|
14136
14164
|
/**
|
|
14137
14165
|
* get list of transactions allocations related with passed bank transactions list
|
|
14138
14166
|
*/
|
|
@@ -17092,7 +17120,7 @@
|
|
|
17092
17120
|
}
|
|
17093
17121
|
PropertyCalculationService.prototype.getTaxPosition = function (transactions, depreciations) {
|
|
17094
17122
|
// @TODO hack: math abs added because we have mismatching of real values signs
|
|
17095
|
-
return transactions.
|
|
17123
|
+
return transactions.grossClaimAmount - Math.abs(depreciations.claimAmount);
|
|
17096
17124
|
};
|
|
17097
17125
|
PropertyCalculationService.prototype.getTaxPosition$ = function (transactions$, depreciations$) {
|
|
17098
17126
|
var _this = this;
|
|
@@ -17234,7 +17262,7 @@
|
|
|
17234
17262
|
if (!forecastedCashPosition) {
|
|
17235
17263
|
return 0;
|
|
17236
17264
|
}
|
|
17237
|
-
return (transactions.
|
|
17265
|
+
return (transactions.grossClaimAmount - forecastedCashPosition) / forecastedCashPosition;
|
|
17238
17266
|
};
|
|
17239
17267
|
/**
|
|
17240
17268
|
* Get Badge for single property in collection
|
|
@@ -17600,22 +17628,25 @@
|
|
|
17600
17628
|
}]
|
|
17601
17629
|
}] });
|
|
17602
17630
|
|
|
17631
|
+
/**
|
|
17632
|
+
* @TODO Alex refactor
|
|
17633
|
+
*/
|
|
17603
17634
|
var SubscriptionService = /** @class */ (function () {
|
|
17604
|
-
function SubscriptionService(http, eventDispatcherService, sseService, environment) {
|
|
17635
|
+
function SubscriptionService(http, eventDispatcherService, sseService, toastService, environment) {
|
|
17605
17636
|
this.http = http;
|
|
17606
17637
|
this.eventDispatcherService = eventDispatcherService;
|
|
17607
17638
|
this.sseService = sseService;
|
|
17639
|
+
this.toastService = toastService;
|
|
17608
17640
|
this.environment = environment;
|
|
17609
17641
|
this.serviceSubscriptionSubject = new rxjs.ReplaySubject(1);
|
|
17610
|
-
this.serviceSubscriptionsSubject = new rxjs.ReplaySubject(1);
|
|
17611
17642
|
this.servicePaymentsSubject = new rxjs.ReplaySubject(1);
|
|
17612
|
-
this.subscriptionChangeSubject = new rxjs.BehaviorSubject(null);
|
|
17613
17643
|
this.listenSubscriptions();
|
|
17614
17644
|
}
|
|
17615
17645
|
SubscriptionService.prototype.getSubscription = function (force) {
|
|
17616
17646
|
var _this = this;
|
|
17617
17647
|
if (force === void 0) { force = false; }
|
|
17618
|
-
if (
|
|
17648
|
+
if (this._serviceSubscription === undefined || force) {
|
|
17649
|
+
this._serviceSubscription = null;
|
|
17619
17650
|
this.http.get(this.environment.apiV2 + "/subscriptions/last")
|
|
17620
17651
|
.pipe(operators.map(function (response) {
|
|
17621
17652
|
return classTransformer.plainToClass(ServiceSubscription, response);
|
|
@@ -17691,14 +17722,16 @@
|
|
|
17691
17722
|
this.sseService.on("serviceSubscriptions")
|
|
17692
17723
|
.pipe(operators.map(function (event) { return classTransformer.plainToClass(ServiceSubscription, event); }))
|
|
17693
17724
|
.subscribe(function (subscription) {
|
|
17694
|
-
_this.
|
|
17695
|
-
_this.
|
|
17725
|
+
_this._serviceSubscription = subscription;
|
|
17726
|
+
_this.serviceSubscriptionSubject.next(_this._serviceSubscription);
|
|
17696
17727
|
_this.eventDispatcherService.dispatch(new AppEvent(exports.AppEventTypeEnum.SERVICE_SUBSCRIPTION_UPDATED, null));
|
|
17728
|
+
// @TODO move?
|
|
17729
|
+
_this.toastService.success('Subscription successfully updated');
|
|
17697
17730
|
});
|
|
17698
17731
|
};
|
|
17699
17732
|
return SubscriptionService;
|
|
17700
17733
|
}());
|
|
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 });
|
|
17734
|
+
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
17735
|
SubscriptionService.ɵprov = i0__namespace.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: SubscriptionService, providedIn: 'root' });
|
|
17703
17736
|
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: SubscriptionService, decorators: [{
|
|
17704
17737
|
type: i0.Injectable,
|
|
@@ -17706,7 +17739,7 @@
|
|
|
17706
17739
|
providedIn: 'root'
|
|
17707
17740
|
}]
|
|
17708
17741
|
}], ctorParameters: function () {
|
|
17709
|
-
return [{ type: i1__namespace.HttpClient }, { type: EventDispatcherService }, { type: SseService }, { type: undefined, decorators: [{
|
|
17742
|
+
return [{ type: i1__namespace.HttpClient }, { type: EventDispatcherService }, { type: SseService }, { type: ToastService }, { type: undefined, decorators: [{
|
|
17710
17743
|
type: i0.Inject,
|
|
17711
17744
|
args: ['environment']
|
|
17712
17745
|
}] }];
|