taxtank-core 0.22.0 → 0.22.3

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.
@@ -166,7 +166,8 @@
166
166
  });
167
167
  // clone request to add new parameters
168
168
  var clonedReq = request.clone();
169
- if (!params.get('financialYear')) {
169
+ // @TODO query params should be passed using second param of get request and HttpParams object
170
+ if (!params.get('financialYear') && !request.urlWithParams.includes('?financialYear') && !request.urlWithParams.includes('&financialYear')) {
170
171
  params = params.set('financialYear', localStorage.getItem('financialYear'));
171
172
  clonedReq = request.clone({
172
173
  params: params
@@ -10077,6 +10078,10 @@
10077
10078
  });
10078
10079
  Object.defineProperty(TaxSummary.prototype, "taxPercent", {
10079
10080
  get: function () {
10081
+ // Check if netAmount is not 0 to avoid division by zero
10082
+ if (!this.summary.netAmount) {
10083
+ return 0;
10084
+ }
10080
10085
  return this.summary.items.findByCategory(exports.TaxReturnCategoryListEnum.GROSS_TAX_PAYABLE).amount / this.summary.netAmount;
10081
10086
  },
10082
10087
  enumerable: false,
@@ -14667,11 +14672,11 @@
14667
14672
  _this.cacheSubject.next(_this.cache);
14668
14673
  }));
14669
14674
  };
14670
- /**
14671
- * Run forecast update script on backend when user switched financial year
14672
- */
14673
- UserService.prototype.switchFinancialYear = function () {
14674
- return this.http.get(this.environment.apiV2 + "/financial-year/switch");
14675
+ UserService.prototype.switchFinancialYear = function (year) {
14676
+ return this.http.get(this.environment.apiV2 + "/financial-year/switch", { params: new i1.HttpParams({ fromString: "financialYear=" + year }) }).pipe(operators.map(function () {
14677
+ localStorage.setItem('financialYear', year.toString());
14678
+ window.location.reload();
14679
+ }));
14675
14680
  };
14676
14681
  /**
14677
14682
  * clear service cache
@@ -15637,11 +15642,8 @@
15637
15642
  }
15638
15643
  RegisterClientForm.prototype.submit = function (data) {
15639
15644
  if (data === void 0) { data = {}; }
15640
- return _super.prototype.submit.call(this, { password: this.get('password').submit().password });
15641
- var formValue = _super.prototype.submit.call(this);
15642
- if (!formValue) {
15643
- return null;
15644
- }
15645
+ var _a;
15646
+ return _super.prototype.submit.call(this, { password: (_a = this.get('password').submit()) === null || _a === void 0 ? void 0 : _a.password });
15645
15647
  };
15646
15648
  return RegisterClientForm;
15647
15649
  }(AbstractForm));