taxtank-core 0.23.0 → 0.23.1

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.
@@ -2862,22 +2862,33 @@
2862
2862
  * Check if current tank is Property
2863
2863
  */
2864
2864
  TransactionBase.prototype.isPropertyTank = function () {
2865
- var _a;
2866
- return CHART_ACCOUNTS_CATEGORIES.property.includes((_a = this.chartAccounts) === null || _a === void 0 ? void 0 : _a.category);
2865
+ // chart accounts may be empty for new instances
2866
+ if (this.chartAccounts) {
2867
+ return CHART_ACCOUNTS_CATEGORIES.property.includes(this.chartAccounts.category);
2868
+ }
2869
+ return !!this.property;
2867
2870
  };
2868
2871
  /**
2869
2872
  * Check if current tank is Work
2870
2873
  */
2871
2874
  TransactionBase.prototype.isWorkTank = function () {
2872
2875
  var _a;
2873
- return CHART_ACCOUNTS_CATEGORIES.work.includes((_a = this.chartAccounts) === null || _a === void 0 ? void 0 : _a.category);
2876
+ // chart accounts may be empty for new instances
2877
+ if (this.chartAccounts) {
2878
+ return CHART_ACCOUNTS_CATEGORIES.work.includes((_a = this.chartAccounts) === null || _a === void 0 ? void 0 : _a.category);
2879
+ }
2880
+ return !this.isPropertyTank() && !this.isSoleTank();
2874
2881
  };
2875
2882
  /**
2876
2883
  * Check if current tank is Sole
2877
2884
  */
2878
2885
  TransactionBase.prototype.isSoleTank = function () {
2879
2886
  var _a;
2880
- return CHART_ACCOUNTS_CATEGORIES.sole.includes((_a = this.chartAccounts) === null || _a === void 0 ? void 0 : _a.category);
2887
+ // chart accounts may be empty for new instances
2888
+ if (this.chartAccounts) {
2889
+ return CHART_ACCOUNTS_CATEGORIES.sole.includes((_a = this.chartAccounts) === null || _a === void 0 ? void 0 : _a.category);
2890
+ }
2891
+ return !!this.business;
2881
2892
  };
2882
2893
  return TransactionBase;
2883
2894
  }(AbstractModel));
@@ -7501,6 +7512,56 @@
7501
7512
  return VehicleCollection;
7502
7513
  }(Collection));
7503
7514
 
7515
+ /**
7516
+ * @TODO Alex/Vik: think and create some new collection type
7517
+ * @TODO Alex: research all constants and make the same structure
7518
+ */
7519
+ var ChartAccountsCategoryECollection = /** @class */ (function () {
7520
+ function ChartAccountsCategoryECollection(items) {
7521
+ this.items = items || [
7522
+ exports.ChartAccountsCategoryEnum.PROPERTY_INCOME,
7523
+ exports.ChartAccountsCategoryEnum.PROPERTY_EXPENSE,
7524
+ exports.ChartAccountsCategoryEnum.PROPERTY_DEPRECIATION,
7525
+ exports.ChartAccountsCategoryEnum.PROPERTY_CAPITAL_WORKS,
7526
+ exports.ChartAccountsCategoryEnum.WORK_DEPRECIATION,
7527
+ exports.ChartAccountsCategoryEnum.WORK_INCOME,
7528
+ exports.ChartAccountsCategoryEnum.WORK_EXPENSE,
7529
+ exports.ChartAccountsCategoryEnum.OTHER_INCOME,
7530
+ exports.ChartAccountsCategoryEnum.OTHER_EXPENSE,
7531
+ exports.ChartAccountsCategoryEnum.PERSONAL_INCOME,
7532
+ exports.ChartAccountsCategoryEnum.PERSONAL_EXPENSE,
7533
+ exports.ChartAccountsCategoryEnum.SOLE_INCOME,
7534
+ exports.ChartAccountsCategoryEnum.SOLE_EXPENSE,
7535
+ exports.ChartAccountsCategoryEnum.SOLE_DEPRECIATION
7536
+ ];
7537
+ }
7538
+ ChartAccountsCategoryECollection.prototype.getByType = function (types) {
7539
+ var _this = this;
7540
+ if (!Array.isArray(types)) {
7541
+ types = [types];
7542
+ }
7543
+ var items = [];
7544
+ types.forEach(function (type) {
7545
+ var filtered = _this.items.filter(function (item) { return exports.ChartAccountsCategoryEnum[item].includes(type.toUpperCase()); });
7546
+ items.push.apply(items, __spreadArray([], __read(filtered)));
7547
+ });
7548
+ return new ChartAccountsCategoryECollection(items);
7549
+ };
7550
+ ChartAccountsCategoryECollection.prototype.getByTankType = function (tankTypes) {
7551
+ var _this = this;
7552
+ if (!Array.isArray(tankTypes)) {
7553
+ tankTypes = [tankTypes];
7554
+ }
7555
+ var items = [];
7556
+ tankTypes.forEach(function (tankType) {
7557
+ var filtered = _this.items.filter(function (item) { return exports.ChartAccountsCategoryEnum[item].includes(tankType.toUpperCase()); });
7558
+ items.push.apply(items, __spreadArray([], __read(filtered)));
7559
+ });
7560
+ return new ChartAccountsCategoryECollection(items);
7561
+ };
7562
+ return ChartAccountsCategoryECollection;
7563
+ }());
7564
+
7504
7565
  exports.ChartAccountsEtpEnum = void 0;
7505
7566
  (function (ChartAccountsEtpEnum) {
7506
7567
  ChartAccountsEtpEnum[ChartAccountsEtpEnum["ETP_R"] = 549] = "ETP_R";
@@ -16577,9 +16638,7 @@
16577
16638
  return SoleDetailsForm;
16578
16639
  }(AbstractForm));
16579
16640
 
16580
- /**
16581
- * Public API Surface of tt-core
16582
- */
16641
+ // @TODO Alex: Create indexes everywhere and break this file to imports from indexes
16583
16642
 
16584
16643
  /**
16585
16644
  * Generated bundle index. Do not edit.
@@ -16631,6 +16690,7 @@
16631
16690
  exports.CHART_ACCOUNTS_CATEGORIES = CHART_ACCOUNTS_CATEGORIES;
16632
16691
  exports.CalculationFormItem = CalculationFormItem;
16633
16692
  exports.ChartAccounts = ChartAccounts;
16693
+ exports.ChartAccountsCategoryECollection = ChartAccountsCategoryECollection;
16634
16694
  exports.ChartAccountsCollection = ChartAccountsCollection;
16635
16695
  exports.ChartAccountsDepreciation = ChartAccountsDepreciation;
16636
16696
  exports.ChartAccountsDepreciationService = ChartAccountsDepreciationService;