taxtank-core 0.27.7 → 0.28.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.
@@ -588,25 +588,26 @@
588
588
  AppEventTypeEnum[AppEventTypeEnum["PROPERTY_SUBSCRIPTION_DELETED"] = 38] = "PROPERTY_SUBSCRIPTION_DELETED";
589
589
  AppEventTypeEnum[AppEventTypeEnum["PROPERTY_VALUATION_DOCUMENT_CREATED"] = 39] = "PROPERTY_VALUATION_DOCUMENT_CREATED";
590
590
  AppEventTypeEnum[AppEventTypeEnum["SERVICE_SUBSCRIPTION_UPDATED"] = 40] = "SERVICE_SUBSCRIPTION_UPDATED";
591
- AppEventTypeEnum[AppEventTypeEnum["SOLE_DEPRECIATION_METHOD_UPDATED"] = 41] = "SOLE_DEPRECIATION_METHOD_UPDATED";
592
- AppEventTypeEnum[AppEventTypeEnum["TAX_REVIEW_UPDATED"] = 42] = "TAX_REVIEW_UPDATED";
593
- AppEventTypeEnum[AppEventTypeEnum["TRANSACTION_CREATED"] = 43] = "TRANSACTION_CREATED";
594
- AppEventTypeEnum[AppEventTypeEnum["TRANSACTION_DELETED"] = 44] = "TRANSACTION_DELETED";
595
- AppEventTypeEnum[AppEventTypeEnum["TRANSACTION_UPDATED"] = 45] = "TRANSACTION_UPDATED";
596
- AppEventTypeEnum[AppEventTypeEnum["TRANSACTION_UPDATED_WITH_RECEIPT"] = 46] = "TRANSACTION_UPDATED_WITH_RECEIPT";
597
- AppEventTypeEnum[AppEventTypeEnum["TRANSACTION_UPDATED_WITH_DELETED_RECEIPT"] = 47] = "TRANSACTION_UPDATED_WITH_DELETED_RECEIPT";
598
- AppEventTypeEnum[AppEventTypeEnum["TRANSACTION_RECEIPT_CREATED"] = 48] = "TRANSACTION_RECEIPT_CREATED";
599
- AppEventTypeEnum[AppEventTypeEnum["TRANSACTION_RECEIPT_DELETED"] = 49] = "TRANSACTION_RECEIPT_DELETED";
600
- AppEventTypeEnum[AppEventTypeEnum["TRANSACTIONS_CREATED"] = 50] = "TRANSACTIONS_CREATED";
601
- AppEventTypeEnum[AppEventTypeEnum["USER_UPDATED"] = 51] = "USER_UPDATED";
602
- AppEventTypeEnum[AppEventTypeEnum["VEHICLE_CLAIM_UPDATED"] = 52] = "VEHICLE_CLAIM_UPDATED";
603
- AppEventTypeEnum[AppEventTypeEnum["VEHICLE_CLAIM_CREATED"] = 53] = "VEHICLE_CLAIM_CREATED";
604
- AppEventTypeEnum[AppEventTypeEnum["VEHICLE_CLAIM_DETAILS_UPDATED"] = 54] = "VEHICLE_CLAIM_DETAILS_UPDATED";
605
- AppEventTypeEnum[AppEventTypeEnum["VEHICLE_CLAIM_DETAILS_CREATED"] = 55] = "VEHICLE_CLAIM_DETAILS_CREATED";
606
- AppEventTypeEnum[AppEventTypeEnum["VEHICLE_LOGBOOK_CREATED"] = 56] = "VEHICLE_LOGBOOK_CREATED";
607
- AppEventTypeEnum[AppEventTypeEnum["VEHICLE_LOGBOOK_UPDATED"] = 57] = "VEHICLE_LOGBOOK_UPDATED";
608
- AppEventTypeEnum[AppEventTypeEnum["VEHICLE_LOGBOOK_DELETED"] = 58] = "VEHICLE_LOGBOOK_DELETED";
609
- AppEventTypeEnum[AppEventTypeEnum["VEHICLE_LOGBOOK_BEST_PERIOD_UPDATED"] = 59] = "VEHICLE_LOGBOOK_BEST_PERIOD_UPDATED";
591
+ AppEventTypeEnum[AppEventTypeEnum["SOLE_BUSINESS_CREATED"] = 41] = "SOLE_BUSINESS_CREATED";
592
+ AppEventTypeEnum[AppEventTypeEnum["SOLE_DEPRECIATION_METHOD_UPDATED"] = 42] = "SOLE_DEPRECIATION_METHOD_UPDATED";
593
+ AppEventTypeEnum[AppEventTypeEnum["TAX_REVIEW_UPDATED"] = 43] = "TAX_REVIEW_UPDATED";
594
+ AppEventTypeEnum[AppEventTypeEnum["TRANSACTION_CREATED"] = 44] = "TRANSACTION_CREATED";
595
+ AppEventTypeEnum[AppEventTypeEnum["TRANSACTION_DELETED"] = 45] = "TRANSACTION_DELETED";
596
+ AppEventTypeEnum[AppEventTypeEnum["TRANSACTION_UPDATED"] = 46] = "TRANSACTION_UPDATED";
597
+ AppEventTypeEnum[AppEventTypeEnum["TRANSACTION_UPDATED_WITH_RECEIPT"] = 47] = "TRANSACTION_UPDATED_WITH_RECEIPT";
598
+ AppEventTypeEnum[AppEventTypeEnum["TRANSACTION_UPDATED_WITH_DELETED_RECEIPT"] = 48] = "TRANSACTION_UPDATED_WITH_DELETED_RECEIPT";
599
+ AppEventTypeEnum[AppEventTypeEnum["TRANSACTION_RECEIPT_CREATED"] = 49] = "TRANSACTION_RECEIPT_CREATED";
600
+ AppEventTypeEnum[AppEventTypeEnum["TRANSACTION_RECEIPT_DELETED"] = 50] = "TRANSACTION_RECEIPT_DELETED";
601
+ AppEventTypeEnum[AppEventTypeEnum["TRANSACTIONS_CREATED"] = 51] = "TRANSACTIONS_CREATED";
602
+ AppEventTypeEnum[AppEventTypeEnum["USER_UPDATED"] = 52] = "USER_UPDATED";
603
+ AppEventTypeEnum[AppEventTypeEnum["VEHICLE_CLAIM_UPDATED"] = 53] = "VEHICLE_CLAIM_UPDATED";
604
+ AppEventTypeEnum[AppEventTypeEnum["VEHICLE_CLAIM_CREATED"] = 54] = "VEHICLE_CLAIM_CREATED";
605
+ AppEventTypeEnum[AppEventTypeEnum["VEHICLE_CLAIM_DETAILS_UPDATED"] = 55] = "VEHICLE_CLAIM_DETAILS_UPDATED";
606
+ AppEventTypeEnum[AppEventTypeEnum["VEHICLE_CLAIM_DETAILS_CREATED"] = 56] = "VEHICLE_CLAIM_DETAILS_CREATED";
607
+ AppEventTypeEnum[AppEventTypeEnum["VEHICLE_LOGBOOK_CREATED"] = 57] = "VEHICLE_LOGBOOK_CREATED";
608
+ AppEventTypeEnum[AppEventTypeEnum["VEHICLE_LOGBOOK_UPDATED"] = 58] = "VEHICLE_LOGBOOK_UPDATED";
609
+ AppEventTypeEnum[AppEventTypeEnum["VEHICLE_LOGBOOK_DELETED"] = 59] = "VEHICLE_LOGBOOK_DELETED";
610
+ AppEventTypeEnum[AppEventTypeEnum["VEHICLE_LOGBOOK_BEST_PERIOD_UPDATED"] = 60] = "VEHICLE_LOGBOOK_BEST_PERIOD_UPDATED";
610
611
  })(exports.AppEventTypeEnum || (exports.AppEventTypeEnum = {}));
611
612
 
612
613
  var EventDispatcherService = /** @class */ (function () {
@@ -4673,6 +4674,9 @@
4673
4674
  __decorate([
4674
4675
  classTransformer.Type(function () { return SoleBusinessActivity$1; })
4675
4676
  ], SoleBusiness.prototype, "activity", void 0);
4677
+ __decorate([
4678
+ classTransformer.Type(function () { return IncomeSource; })
4679
+ ], SoleBusiness.prototype, "incomeSource", void 0);
4676
4680
 
4677
4681
  var SoleBusinessActivity = /** @class */ (function (_super) {
4678
4682
  __extends(SoleBusinessActivity, _super);
@@ -7114,6 +7118,9 @@
7114
7118
  IncomeSourceCollection.prototype.getSalary = function () {
7115
7119
  return this.items.filter(function (incomeSource) { return incomeSource.isSalaryIncome(); });
7116
7120
  };
7121
+ IncomeSourceCollection.prototype.getOther = function () {
7122
+ return this.items.filter(function (incomeSource) { return incomeSource.isOtherIncome(); });
7123
+ };
7117
7124
  Object.defineProperty(IncomeSourceCollection.prototype, "forecasts", {
7118
7125
  /**
7119
7126
  * Get income sources list of forecasts
@@ -11111,6 +11118,13 @@
11111
11118
  _this.isHydra = true;
11112
11119
  return _this;
11113
11120
  }
11121
+ SoleBusinessService.prototype.add = function (soleBusiness) {
11122
+ var _this = this;
11123
+ return _super.prototype.add.call(this, soleBusiness).pipe(operators.map(function (business) {
11124
+ _this.eventDispatcherService.dispatch(new AppEvent(exports.AppEventTypeEnum.SOLE_BUSINESS_CREATED, business));
11125
+ return business;
11126
+ }));
11127
+ };
11114
11128
  return SoleBusinessService;
11115
11129
  }(RestService));
11116
11130
  SoleBusinessService.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: SoleBusinessService, deps: null, target: i0__namespace.ɵɵFactoryTarget.Injectable });
@@ -12033,6 +12047,9 @@
12033
12047
  _this.incomeSourceTypeSubject = new rxjs.ReplaySubject(1);
12034
12048
  return _this;
12035
12049
  }
12050
+ IncomeSourceService.prototype.listenEvents = function () {
12051
+ this.listenSoleBusinessCreated();
12052
+ };
12036
12053
  /**
12037
12054
  * Get income sources tax calculation
12038
12055
  * @param salaryForecast for which tax should be calculated
@@ -12107,6 +12124,15 @@
12107
12124
  }
12108
12125
  return this.incomeSourceTypeSubject.asObservable();
12109
12126
  };
12127
+ /**
12128
+ * Sole businesses create together with income source
12129
+ */
12130
+ IncomeSourceService.prototype.listenSoleBusinessCreated = function () {
12131
+ var _this = this;
12132
+ this.eventDispatcherService.on(exports.AppEventTypeEnum.SOLE_BUSINESS_CREATED).subscribe(function () {
12133
+ _this.resetCache();
12134
+ });
12135
+ };
12110
12136
  return IncomeSourceService;
12111
12137
  }(RestService));
12112
12138
  IncomeSourceService.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: IncomeSourceService, deps: null, target: i0__namespace.ɵɵFactoryTarget.Injectable });
@@ -16937,13 +16963,37 @@
16937
16963
  __extends(SoleBusinessForm, _super);
16938
16964
  function SoleBusinessForm(business) {
16939
16965
  if (business === void 0) { business = classTransformer.plainToClass(SoleBusiness, {}); }
16940
- return _super.call(this, {
16966
+ var _this = _super.call(this, {
16941
16967
  name: new forms.FormControl(business.name, forms.Validators.required),
16942
16968
  activity: new forms.FormControl(business.activity, forms.Validators.required),
16943
16969
  description: new forms.FormControl(business.description),
16944
- website: new forms.FormControl(business.website)
16970
+ website: new forms.FormControl(business.website),
16945
16971
  }, business) || this;
16972
+ // User have to create income source with new business.
16973
+ // Income source is not able for edit business
16974
+ if (!business.id) {
16975
+ // @TODO Alex: move to separated form class
16976
+ _this.addControl('incomeSource', new forms.FormGroup({
16977
+ type: new forms.FormControl(exports.IncomeSourceTypeEnum.SOLE, forms.Validators.required),
16978
+ name: new forms.FormControl(null, forms.Validators.required),
16979
+ soleForecasts: new forms.FormArray([
16980
+ new forms.FormGroup({
16981
+ financialYear: new forms.FormControl(new FinancialYear().year, forms.Validators.required),
16982
+ amount: new forms.FormControl(null, forms.Validators.required),
16983
+ taxInstalments: new forms.FormControl(null, forms.Validators.required)
16984
+ })
16985
+ ])
16986
+ }));
16987
+ }
16988
+ return _this;
16946
16989
  }
16990
+ Object.defineProperty(SoleBusinessForm.prototype, "forecastFormGroup", {
16991
+ get: function () {
16992
+ return this.get('incomeSource').get('soleForecasts').at(0);
16993
+ },
16994
+ enumerable: false,
16995
+ configurable: true
16996
+ });
16947
16997
  return SoleBusinessForm;
16948
16998
  }(AbstractForm));
16949
16999