taxtank-core 0.29.31 → 0.29.33

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.
@@ -3681,6 +3681,9 @@
3681
3681
  ChartAccounts.prototype.isSalaryIncluded = function () {
3682
3682
  return this.id in exports.ChartAccountsSalaryIncludedListEnum;
3683
3683
  };
3684
+ ChartAccounts.prototype.isPropertyCapitalWorks = function () {
3685
+ return this.category === exports.ChartAccountsCategoryEnum.PROPERTY_CAPITAL_WORKS;
3686
+ };
3684
3687
  return ChartAccounts;
3685
3688
  }(ChartAccounts$1));
3686
3689
  /**
@@ -5010,7 +5013,7 @@
5010
5013
  amount: this.amount,
5011
5014
  chartAccounts: this.chartAccounts,
5012
5015
  description: this.description,
5013
- type: exports.DepreciationTypeEnum.PLANT_EQUIPMENT,
5016
+ type: this.chartAccounts.isPropertyCapitalWorks() ? exports.DepreciationTypeEnum.CAPITAL_WORKS : exports.DepreciationTypeEnum.PLANT_EQUIPMENT,
5014
5017
  claimPercent: this.claimPercent,
5015
5018
  property: this.property,
5016
5019
  calculation: this.property ? this.property.depreciationCalculation : exports.DepreciationCalculationEnum.PRIME_COST
@@ -6198,6 +6201,17 @@
6198
6201
  return SoleInvoiceCollection;
6199
6202
  }(Collection));
6200
6203
 
6204
+ var ServiceProductCollection = /** @class */ (function (_super) {
6205
+ __extends(ServiceProductCollection, _super);
6206
+ function ServiceProductCollection() {
6207
+ return _super !== null && _super.apply(this, arguments) || this;
6208
+ }
6209
+ ServiceProductCollection.prototype.getActive = function () {
6210
+ return this.filterBy('status', exports.ServiceProductStatusEnum.ACTIVE);
6211
+ };
6212
+ return ServiceProductCollection;
6213
+ }(Collection));
6214
+
6201
6215
  /**
6202
6216
  * @TODO vik refactor
6203
6217
  */
@@ -6265,20 +6279,16 @@
6265
6279
  }
6266
6280
  return this.filterBy('type', type).findBy('product.id', exports.ServiceProductIdEnum.PROPERTIES);
6267
6281
  };
6282
+ Object.defineProperty(ServicePriceCollection.prototype, "products", {
6283
+ get: function () {
6284
+ return new ServiceProductCollection(this.mapBy('product'));
6285
+ },
6286
+ enumerable: false,
6287
+ configurable: true
6288
+ });
6268
6289
  return ServicePriceCollection;
6269
6290
  }(Collection));
6270
6291
 
6271
- var ServiceProductCollection = /** @class */ (function (_super) {
6272
- __extends(ServiceProductCollection, _super);
6273
- function ServiceProductCollection() {
6274
- return _super !== null && _super.apply(this, arguments) || this;
6275
- }
6276
- ServiceProductCollection.prototype.getActive = function () {
6277
- return this.filterBy('status', exports.ServiceProductStatusEnum.ACTIVE);
6278
- };
6279
- return ServiceProductCollection;
6280
- }(Collection));
6281
-
6282
6292
  var SubscriptionItemCollection = /** @class */ (function (_super) {
6283
6293
  __extends(SubscriptionItemCollection, _super);
6284
6294
  function SubscriptionItemCollection() {
@@ -6301,9 +6311,13 @@
6301
6311
  SubscriptionItemCollection.prototype.hasProduct = function (product) {
6302
6312
  return !!this.findBy('price.product.id', product.id);
6303
6313
  };
6304
- SubscriptionItemCollection.prototype.getPrices = function () {
6305
- return new ServicePriceCollection(this.mapBy('price'));
6306
- };
6314
+ Object.defineProperty(SubscriptionItemCollection.prototype, "prices", {
6315
+ get: function () {
6316
+ return new ServicePriceCollection(this.mapBy('price'));
6317
+ },
6318
+ enumerable: false,
6319
+ configurable: true
6320
+ });
6307
6321
  return SubscriptionItemCollection;
6308
6322
  }(Collection));
6309
6323
 
@@ -6315,14 +6329,18 @@
6315
6329
  ServiceSubscriptionCollection.prototype.getActive = function () {
6316
6330
  return this.filter(function (subscription) { return subscription.isActive; });
6317
6331
  };
6332
+ ServiceSubscriptionCollection.prototype.getInactive = function () {
6333
+ return this.filter(function (subscription) { return !subscription.isActive; });
6334
+ };
6318
6335
  ServiceSubscriptionCollection.prototype.getTrials = function () {
6319
6336
  return this.filterBy('stripeId', null);
6320
6337
  };
6321
6338
  ServiceSubscriptionCollection.prototype.getActiveTrials = function () {
6322
6339
  return this.getActive().getTrials();
6323
6340
  };
6324
- ServiceSubscriptionCollection.prototype.getExpiringTrials = function () {
6325
- return this.getActiveTrials().filter(function (subscription) { return subscription.isTrialExpiring(); });
6341
+ ServiceSubscriptionCollection.prototype.getExpiredTrials = function () {
6342
+ // @TODO vik remove paid products
6343
+ return this.getInactive().getTrials();
6326
6344
  };
6327
6345
  ServiceSubscriptionCollection.prototype.getPaid = function () {
6328
6346
  return this.filter(function (subscription) { return !!subscription.stripeId; });
@@ -7462,10 +7480,7 @@
7462
7480
  var ServiceSubscription = /** @class */ (function (_super) {
7463
7481
  __extends(ServiceSubscription, _super);
7464
7482
  function ServiceSubscription() {
7465
- var _this = _super.apply(this, __spreadArray([], __read(arguments))) || this;
7466
- // Number of days after which the trial time will be expired
7467
- _this.lastTrialDays = 4;
7468
- return _this;
7483
+ return _super !== null && _super.apply(this, arguments) || this;
7469
7484
  }
7470
7485
  Object.defineProperty(ServiceSubscription.prototype, "frequency", {
7471
7486
  get: function () {
@@ -7517,23 +7532,6 @@
7517
7532
  enumerable: false,
7518
7533
  configurable: true
7519
7534
  });
7520
- Object.defineProperty(ServiceSubscription.prototype, "daysRemain", {
7521
- get: function () {
7522
- var daysRemains = Math.round((new Date(this.endDate).getTime() - new Date().getTime()) / (1000 * 3600 * 24));
7523
- return daysRemains > 0 ? daysRemains : 0;
7524
- },
7525
- enumerable: false,
7526
- configurable: true
7527
- });
7528
- /**
7529
- * Check if trial expired
7530
- */
7531
- ServiceSubscription.prototype.isTrialExpired = function () {
7532
- return this.daysRemain && this.daysRemain <= 0;
7533
- };
7534
- ServiceSubscription.prototype.isTrialExpiring = function () {
7535
- return this.daysRemain > 0 && this.daysRemain <= this.lastTrialDays;
7536
- };
7537
7535
  ServiceSubscription.prototype.isRenewable = function () {
7538
7536
  return !this.isTrial && this.isActive;
7539
7537
  };
@@ -7601,7 +7599,7 @@
7601
7599
  return this.items.length === ServiceProduct.quantity;
7602
7600
  };
7603
7601
  ServiceSubscription.prototype.isAnnual = function () {
7604
- return !!(this.getItems().getPrices().annual.length || this.getItems().getPrices().annualPackage.length);
7602
+ return !!(this.getItems().prices.annual.length || this.getItems().prices.annualPackage.length);
7605
7603
  };
7606
7604
  /**
7607
7605
  * Recommended number of properties to buy,
@@ -17661,12 +17659,10 @@
17661
17659
  AccountSetupService.prototype.createBatch = function (incomeTypes) {
17662
17660
  var batch = [];
17663
17661
  // Salary item is completed when user added salary income source
17664
- if (incomeTypes.salary) {
17665
- batch.push(this.create(AccountSetupItemsEnum.SALARY, this.getIncomeSources(true)));
17666
- }
17667
- // Other income item is completed when user added at least one other income source
17668
- if (incomeTypes.dividends || incomeTypes.other) {
17669
- batch.push(this.create(AccountSetupItemsEnum.OTHER_INCOME, this.getIncomeSources()));
17662
+ if (incomeTypes.work) {
17663
+ batch.push(this.create(AccountSetupItemsEnum.SALARY, this.getIncomeSources(true)),
17664
+ // Other income is a part of work tank, completed when user added at least one other income source
17665
+ this.create(AccountSetupItemsEnum.OTHER_INCOME, this.getIncomeSources()));
17670
17666
  }
17671
17667
  // Rental income item is completed when user added at least one property
17672
17668
  if (incomeTypes.property) {
@@ -20079,11 +20075,10 @@
20079
20075
  function ClientIncomeTypesForm(clientIncomeTypes) {
20080
20076
  if (clientIncomeTypes === void 0) { clientIncomeTypes = classTransformer.plainToClass(ClientIncomeTypes, {}); }
20081
20077
  var _this = _super.call(this, {
20082
- salary: new forms.FormControl(clientIncomeTypes.salary),
20078
+ work: new forms.FormControl(clientIncomeTypes.work),
20083
20079
  property: new forms.FormControl(clientIncomeTypes.property),
20084
20080
  sole: new forms.FormControl(clientIncomeTypes.sole),
20085
- dividends: new forms.FormControl(clientIncomeTypes.dividends),
20086
- other: new forms.FormControl(clientIncomeTypes.other)
20081
+ holdings: new forms.FormControl({ value: clientIncomeTypes.holdings, disabled: true })
20087
20082
  }, clientIncomeTypes, atLeastOneCheckedValidator()) || this;
20088
20083
  _this.clientIncomeTypes = clientIncomeTypes;
20089
20084
  return _this;