taxtank-core 0.21.19 → 0.22.0
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 +92 -15
- package/bundles/taxtank-core.umd.js.map +1 -1
- package/esm2015/lib/collections/property/property.collection.js +4 -1
- package/esm2015/lib/db/Models/property/property-share.js +1 -1
- package/esm2015/lib/models/event/app-event-type.enum.js +18 -16
- package/esm2015/lib/models/property/property.js +4 -1
- package/esm2015/lib/services/http/property/property-sale/property-sale.service.js +21 -1
- package/esm2015/lib/services/http/property/property-share/property-share.service.js +23 -1
- package/esm2015/lib/services/http/property/property.service.js +24 -1
- package/esm2015/lib/services/http/rest/rest.service.js +4 -1
- package/fesm2015/taxtank-core.js +86 -15
- package/fesm2015/taxtank-core.js.map +1 -1
- package/lib/collections/property/property.collection.d.ts +1 -0
- package/lib/db/Models/property/property-share.d.ts +2 -0
- package/lib/models/event/app-event-type.enum.d.ts +17 -15
- package/lib/models/property/property.d.ts +1 -0
- package/lib/services/http/property/property-sale/property-sale.service.d.ts +9 -0
- package/lib/services/http/property/property-share/property-share.service.d.ts +5 -0
- package/lib/services/http/property/property.service.d.ts +6 -0
- package/lib/services/http/rest/rest.service.d.ts +1 -0
- package/package.json +1 -1
|
@@ -575,21 +575,23 @@
|
|
|
575
575
|
AppEventTypeEnum[AppEventTypeEnum["PROPERTY_MOVEMENT_UPDATED"] = 27] = "PROPERTY_MOVEMENT_UPDATED";
|
|
576
576
|
AppEventTypeEnum[AppEventTypeEnum["PROPERTY_MOVEMENT_DELETED"] = 28] = "PROPERTY_MOVEMENT_DELETED";
|
|
577
577
|
AppEventTypeEnum[AppEventTypeEnum["PROPERTY_SHARE_UPDATED"] = 29] = "PROPERTY_SHARE_UPDATED";
|
|
578
|
-
AppEventTypeEnum[AppEventTypeEnum["
|
|
579
|
-
AppEventTypeEnum[AppEventTypeEnum["
|
|
580
|
-
AppEventTypeEnum[AppEventTypeEnum["
|
|
581
|
-
AppEventTypeEnum[AppEventTypeEnum["
|
|
582
|
-
AppEventTypeEnum[AppEventTypeEnum["
|
|
583
|
-
AppEventTypeEnum[AppEventTypeEnum["
|
|
584
|
-
AppEventTypeEnum[AppEventTypeEnum["
|
|
585
|
-
AppEventTypeEnum[AppEventTypeEnum["
|
|
586
|
-
AppEventTypeEnum[AppEventTypeEnum["
|
|
587
|
-
AppEventTypeEnum[AppEventTypeEnum["
|
|
588
|
-
AppEventTypeEnum[AppEventTypeEnum["
|
|
589
|
-
AppEventTypeEnum[AppEventTypeEnum["
|
|
590
|
-
AppEventTypeEnum[AppEventTypeEnum["
|
|
591
|
-
AppEventTypeEnum[AppEventTypeEnum["
|
|
592
|
-
AppEventTypeEnum[AppEventTypeEnum["
|
|
578
|
+
AppEventTypeEnum[AppEventTypeEnum["PROPERTY_SALE_ADDED"] = 30] = "PROPERTY_SALE_ADDED";
|
|
579
|
+
AppEventTypeEnum[AppEventTypeEnum["PROPERTY_SALE_DELETED"] = 31] = "PROPERTY_SALE_DELETED";
|
|
580
|
+
AppEventTypeEnum[AppEventTypeEnum["PROPERTY_SUBSCRIPTION_ADDED"] = 32] = "PROPERTY_SUBSCRIPTION_ADDED";
|
|
581
|
+
AppEventTypeEnum[AppEventTypeEnum["PROPERTY_SUBSCRIPTION_DELETED"] = 33] = "PROPERTY_SUBSCRIPTION_DELETED";
|
|
582
|
+
AppEventTypeEnum[AppEventTypeEnum["PROPERTY_VALUATION_DOCUMENT_CREATED"] = 34] = "PROPERTY_VALUATION_DOCUMENT_CREATED";
|
|
583
|
+
AppEventTypeEnum[AppEventTypeEnum["SERVICE_SUBSCRIPTION_UPDATED"] = 35] = "SERVICE_SUBSCRIPTION_UPDATED";
|
|
584
|
+
AppEventTypeEnum[AppEventTypeEnum["TAX_REVIEW_UPDATED"] = 36] = "TAX_REVIEW_UPDATED";
|
|
585
|
+
AppEventTypeEnum[AppEventTypeEnum["TRANSACTION_CREATED"] = 37] = "TRANSACTION_CREATED";
|
|
586
|
+
AppEventTypeEnum[AppEventTypeEnum["TRANSACTION_DELETED"] = 38] = "TRANSACTION_DELETED";
|
|
587
|
+
AppEventTypeEnum[AppEventTypeEnum["TRANSACTION_UPDATED"] = 39] = "TRANSACTION_UPDATED";
|
|
588
|
+
AppEventTypeEnum[AppEventTypeEnum["TRANSACTIONS_CREATED"] = 40] = "TRANSACTIONS_CREATED";
|
|
589
|
+
AppEventTypeEnum[AppEventTypeEnum["USER_UPDATED"] = 41] = "USER_UPDATED";
|
|
590
|
+
AppEventTypeEnum[AppEventTypeEnum["VEHICLE_CLAIM_UPDATED"] = 42] = "VEHICLE_CLAIM_UPDATED";
|
|
591
|
+
AppEventTypeEnum[AppEventTypeEnum["VEHICLE_CLAIM_CREATED"] = 43] = "VEHICLE_CLAIM_CREATED";
|
|
592
|
+
AppEventTypeEnum[AppEventTypeEnum["VEHICLE_LOGBOOK_CREATED"] = 44] = "VEHICLE_LOGBOOK_CREATED";
|
|
593
|
+
AppEventTypeEnum[AppEventTypeEnum["VEHICLE_LOGBOOK_UPDATED"] = 45] = "VEHICLE_LOGBOOK_UPDATED";
|
|
594
|
+
AppEventTypeEnum[AppEventTypeEnum["VEHICLE_LOGBOOK_DELETED"] = 46] = "VEHICLE_LOGBOOK_DELETED";
|
|
593
595
|
})(exports.AppEventTypeEnum || (exports.AppEventTypeEnum = {}));
|
|
594
596
|
|
|
595
597
|
var EventDispatcherService = /** @class */ (function () {
|
|
@@ -1316,6 +1318,9 @@
|
|
|
1316
1318
|
return items.find(function (item) { return item['id'] === id; });
|
|
1317
1319
|
}));
|
|
1318
1320
|
};
|
|
1321
|
+
RestService.prototype.find = function (id) {
|
|
1322
|
+
return this.cache.find(function (item) { return item['id'] === id; });
|
|
1323
|
+
};
|
|
1319
1324
|
/**
|
|
1320
1325
|
* add new instance and update cache
|
|
1321
1326
|
* @TODO rename to post
|
|
@@ -2934,6 +2939,9 @@
|
|
|
2934
2939
|
Property.prototype.isOwn = function () {
|
|
2935
2940
|
return this.user.id === +localStorage.getItem('userId');
|
|
2936
2941
|
};
|
|
2942
|
+
Property.prototype.isSold = function () {
|
|
2943
|
+
return !!this.myShare.sale;
|
|
2944
|
+
};
|
|
2937
2945
|
/**
|
|
2938
2946
|
* Get initials of property. Required by Photoable interface
|
|
2939
2947
|
*/
|
|
@@ -4939,6 +4947,9 @@
|
|
|
4939
4947
|
PropertyCollection.prototype.getSharedProperties = function () {
|
|
4940
4948
|
return new PropertyCollection(this.items.filter(function (property) { return !property.isOwn(); }));
|
|
4941
4949
|
};
|
|
4950
|
+
PropertyCollection.prototype.getUnsold = function () {
|
|
4951
|
+
return this.create(this.items.filter(function (property) { return !property.isSold(); }));
|
|
4952
|
+
};
|
|
4942
4953
|
Object.defineProperty(PropertyCollection.prototype, "purchasePrice", {
|
|
4943
4954
|
/**
|
|
4944
4955
|
* Get total purchase price for all properties in the collection
|
|
@@ -10445,6 +10456,7 @@
|
|
|
10445
10456
|
} });
|
|
10446
10457
|
|
|
10447
10458
|
/**
|
|
10459
|
+
* @Todo Alex remove functionality related to PropertyShare
|
|
10448
10460
|
* Service for work with Property
|
|
10449
10461
|
*/
|
|
10450
10462
|
var PropertyService = /** @class */ (function (_super) {
|
|
@@ -10459,6 +10471,8 @@
|
|
|
10459
10471
|
this.listenShareInviteAccepted();
|
|
10460
10472
|
// @TODO Alex: consider to refactor property movements logic similar to client-movements
|
|
10461
10473
|
this.listenMovementsChanged();
|
|
10474
|
+
this.listenSalesAdded();
|
|
10475
|
+
this.listenSalesDeleted();
|
|
10462
10476
|
};
|
|
10463
10477
|
/**
|
|
10464
10478
|
* Update cache when share invitation accepted
|
|
@@ -10477,6 +10491,27 @@
|
|
|
10477
10491
|
this.eventDispatcherService.on(exports.AppEventTypeEnum.PROPERTY_MOVEMENT_UPDATED).subscribe(function () { return _this.resetCache(); });
|
|
10478
10492
|
this.eventDispatcherService.on(exports.AppEventTypeEnum.PROPERTY_MOVEMENT_DELETED).subscribe(function () { return _this.resetCache(); });
|
|
10479
10493
|
};
|
|
10494
|
+
/**
|
|
10495
|
+
* @Todo Alex refactor after PropertyShare will be cleared up
|
|
10496
|
+
*/
|
|
10497
|
+
PropertyService.prototype.listenSalesAdded = function () {
|
|
10498
|
+
var _this = this;
|
|
10499
|
+
this.eventDispatcherService.on(exports.AppEventTypeEnum.PROPERTY_SALE_ADDED).subscribe(function (propertySale) {
|
|
10500
|
+
var propertyToReplace = _this.cache.find(function (property) { return property.myShare.id === propertySale.share.id; });
|
|
10501
|
+
propertyToReplace.myShare.sale = classTransformer.plainToClass(PropertySale, { id: propertySale.id });
|
|
10502
|
+
replace(_this.cache, propertyToReplace);
|
|
10503
|
+
_this.updateCache();
|
|
10504
|
+
});
|
|
10505
|
+
};
|
|
10506
|
+
PropertyService.prototype.listenSalesDeleted = function () {
|
|
10507
|
+
var _this = this;
|
|
10508
|
+
this.eventDispatcherService.on(exports.AppEventTypeEnum.PROPERTY_SALE_DELETED).subscribe(function (propertySale) {
|
|
10509
|
+
var propertyToReplace = _this.cache.find(function (property) { return property.myShare.id === propertySale.share.id; });
|
|
10510
|
+
propertyToReplace.myShare.sale = null;
|
|
10511
|
+
replace(_this.cache, propertyToReplace);
|
|
10512
|
+
_this.updateCache();
|
|
10513
|
+
});
|
|
10514
|
+
};
|
|
10480
10515
|
PropertyService.prototype.update = function (property) {
|
|
10481
10516
|
var _this = this;
|
|
10482
10517
|
return _super.prototype.update.call(this, property).pipe(operators.map(function (updatedProperty) {
|
|
@@ -13853,6 +13888,8 @@
|
|
|
13853
13888
|
*/
|
|
13854
13889
|
PropertyShareService.prototype.listenEvents = function () {
|
|
13855
13890
|
this.listenUserUpdated();
|
|
13891
|
+
this.listenSalesAdded();
|
|
13892
|
+
this.listenSalesDeleted();
|
|
13856
13893
|
};
|
|
13857
13894
|
/**
|
|
13858
13895
|
* Updated loan
|
|
@@ -13930,6 +13967,27 @@
|
|
|
13930
13967
|
});
|
|
13931
13968
|
});
|
|
13932
13969
|
};
|
|
13970
|
+
/**
|
|
13971
|
+
* @Todo Alex refactor after PropertyShare functionality in PropertyService will be cleared up
|
|
13972
|
+
*/
|
|
13973
|
+
PropertyShareService.prototype.listenSalesAdded = function () {
|
|
13974
|
+
var _this = this;
|
|
13975
|
+
this.eventDispatcherService.on(exports.AppEventTypeEnum.PROPERTY_SALE_ADDED).subscribe(function (propertySale) {
|
|
13976
|
+
var shareToReplace = _this.find(propertySale.share.id);
|
|
13977
|
+
shareToReplace.sale = classTransformer.plainToClass(PropertySale, { id: propertySale.id });
|
|
13978
|
+
replace(_this.cache, shareToReplace);
|
|
13979
|
+
_this.updateCache();
|
|
13980
|
+
});
|
|
13981
|
+
};
|
|
13982
|
+
PropertyShareService.prototype.listenSalesDeleted = function () {
|
|
13983
|
+
var _this = this;
|
|
13984
|
+
this.eventDispatcherService.on(exports.AppEventTypeEnum.PROPERTY_SALE_DELETED).subscribe(function (propertySale) {
|
|
13985
|
+
var shareToReplace = _this.find(propertySale.share.id);
|
|
13986
|
+
shareToReplace.sale = null;
|
|
13987
|
+
replace(_this.cache, shareToReplace);
|
|
13988
|
+
_this.updateCache();
|
|
13989
|
+
});
|
|
13990
|
+
};
|
|
13933
13991
|
return PropertyShareService;
|
|
13934
13992
|
}(RestService));
|
|
13935
13993
|
PropertyShareService.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: PropertyShareService, deps: null, target: i0__namespace.ɵɵFactoryTarget.Injectable });
|
|
@@ -13949,6 +14007,25 @@
|
|
|
13949
14007
|
_this.url = 'properties/sales';
|
|
13950
14008
|
return _this;
|
|
13951
14009
|
}
|
|
14010
|
+
/**
|
|
14011
|
+
* @Todo should be extended from the RestService
|
|
14012
|
+
*/
|
|
14013
|
+
PropertySaleService.prototype.add = function (model) {
|
|
14014
|
+
var _this = this;
|
|
14015
|
+
return _super.prototype.add.call(this, model).pipe(operators.map(function (newPropertySale) {
|
|
14016
|
+
_this.eventDispatcherService.dispatch(new AppEvent(exports.AppEventTypeEnum.PROPERTY_SALE_ADDED, newPropertySale));
|
|
14017
|
+
return newPropertySale;
|
|
14018
|
+
}));
|
|
14019
|
+
};
|
|
14020
|
+
/**
|
|
14021
|
+
* @Todo should be extended from the RestService
|
|
14022
|
+
*/
|
|
14023
|
+
PropertySaleService.prototype.delete = function (model) {
|
|
14024
|
+
var _this = this;
|
|
14025
|
+
return _super.prototype.delete.call(this, model).pipe(operators.map(function () {
|
|
14026
|
+
_this.eventDispatcherService.dispatch(new AppEvent(exports.AppEventTypeEnum.PROPERTY_SALE_DELETED, model));
|
|
14027
|
+
}));
|
|
14028
|
+
};
|
|
13952
14029
|
return PropertySaleService;
|
|
13953
14030
|
}(RestService));
|
|
13954
14031
|
PropertySaleService.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: PropertySaleService, deps: null, target: i0__namespace.ɵɵFactoryTarget.Injectable });
|