taxtank-core 0.21.11 → 0.21.14

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.
Files changed (26) hide show
  1. package/bundles/taxtank-core.umd.js +85 -40
  2. package/bundles/taxtank-core.umd.js.map +1 -1
  3. package/esm2015/lib/collections/property/property.collection.js +2 -8
  4. package/esm2015/lib/forms/bank/bank-account/bank-account-allocation.form.js +1 -1
  5. package/esm2015/lib/forms/bank/bank-account/bank-account-properties.form.js +4 -3
  6. package/esm2015/lib/forms/report/my-tax/my-tax-deductions.form.js +2 -2
  7. package/esm2015/lib/models/property/property.js +5 -1
  8. package/esm2015/lib/models/report/my-tax/my-tax-deductions/deduction-fields.const.js +2 -3
  9. package/esm2015/lib/models/report/my-tax/my-tax-deductions/my-tax-deductions.js +3 -3
  10. package/esm2015/lib/models/report/my-tax/my-tax-rent/my-tax-rent.js +8 -10
  11. package/esm2015/lib/services/http/transaction/transaction.service.js +5 -3
  12. package/esm2015/lib/services/http/tutorial-video/tutorial-video-response.interface.js +2 -0
  13. package/esm2015/lib/services/http/tutorial-video/tutorial-video.service.js +29 -0
  14. package/esm2015/lib/services/http/tutorial-video/video-source.interface.js +5 -0
  15. package/esm2015/lib/services/property/property-calculation/property-calculation.service.js +31 -8
  16. package/esm2015/public-api.js +3 -1
  17. package/fesm2015/taxtank-core.js +83 -33
  18. package/fesm2015/taxtank-core.js.map +1 -1
  19. package/lib/collections/property/property.collection.d.ts +0 -2
  20. package/lib/models/property/property.d.ts +1 -0
  21. package/lib/services/http/tutorial-video/tutorial-video-response.interface.d.ts +4 -0
  22. package/lib/services/http/tutorial-video/tutorial-video.service.d.ts +14 -0
  23. package/lib/services/http/tutorial-video/video-source.interface.d.ts +8 -0
  24. package/lib/services/property/property-calculation/property-calculation.service.d.ts +8 -0
  25. package/package.json +1 -1
  26. package/public-api.d.ts +2 -0
@@ -2991,6 +2991,14 @@
2991
2991
  enumerable: false,
2992
2992
  configurable: true
2993
2993
  });
2994
+ Object.defineProperty(Property.prototype, "forecastedCashPosition", {
2995
+ get: function () {
2996
+ var _a;
2997
+ return ((_a = this.currentYearForecast) === null || _a === void 0 ? void 0 : _a.cashPosition) || 0;
2998
+ },
2999
+ enumerable: false,
3000
+ configurable: true
3001
+ });
2994
3002
  Object.defineProperty(Property.prototype, "firstForecastYear", {
2995
3003
  get: function () {
2996
3004
  return this.forecasts.reduce(function (min, forecast) {
@@ -4949,20 +4957,6 @@
4949
4957
  enumerable: false,
4950
4958
  configurable: true
4951
4959
  });
4952
- Object.defineProperty(PropertyCollection.prototype, "forecastedRentalReturn", {
4953
- get: function () {
4954
- return this.sumBy('forecastedRentalReturn');
4955
- },
4956
- enumerable: false,
4957
- configurable: true
4958
- });
4959
- Object.defineProperty(PropertyCollection.prototype, "forecastedTaxPosition", {
4960
- get: function () {
4961
- return this.sumBy('forecastedTaxPosition');
4962
- },
4963
- enumerable: false,
4964
- configurable: true
4965
- });
4966
4960
  Object.defineProperty(PropertyCollection.prototype, "firstForecastYear", {
4967
4961
  get: function () {
4968
4962
  return this.items.reduce(function (min, property) {
@@ -4975,7 +4969,7 @@
4975
4969
  });
4976
4970
  Object.defineProperty(PropertyCollection.prototype, "marketValueGrowth", {
4977
4971
  get: function () {
4978
- return this.sumBy('marketValueGrowth');
4972
+ return (this.marketValue - this.purchasePrice) / this.purchasePrice;
4979
4973
  },
4980
4974
  enumerable: false,
4981
4975
  configurable: true
@@ -9365,8 +9359,7 @@
9365
9359
  workRelatedClothingExpenses: [
9366
9360
  exports.ChartAccountsHeadingListEnum.COMPULSORY_WORK_UNIFORM,
9367
9361
  exports.ChartAccountsHeadingListEnum.PROTECTION_CLOTHING,
9368
- exports.ChartAccountsHeadingListEnum.OCCUPATIONAL_SPECIFIC_CLOTHING,
9369
- exports.ChartAccountsHeadingListEnum.SELF_EDUCATIONAL_EXPENSES
9362
+ exports.ChartAccountsHeadingListEnum.OCCUPATIONAL_SPECIFIC_CLOTHING
9370
9363
  ],
9371
9364
  otherIncomeRelatedExpenses: [
9372
9365
  exports.ChartAccountsHeadingListEnum.OTHER_WORK_RELATED_EXPENSES,
@@ -9504,7 +9497,7 @@
9504
9497
  };
9505
9498
  MyTaxDeductions.prototype.setVehicleClaimData = function () {
9506
9499
  this.klmsMethodClaimAmount = this.vehicleClaim.getKLMsClaimAmount(this.vehicleClaimRate);
9507
- this.totalExpensesAmount = new VehicleExpenseCollection(this.transactions.getByTankType(this.vehicleClaim.tankType), this.depreciations.getByTankType(this.vehicleClaim.tankType), this.vehicleClaim).sumBy('claimAmount');
9500
+ this.totalExpensesAmount = new VehicleExpenseCollection(this.transactions.getByTankType(this.vehicleClaim.tankType), this.depreciations.getByTankType(this.vehicleClaim.tankType), this.vehicleClaim).sumBy('amount');
9508
9501
  };
9509
9502
  /**
9510
9503
  * Total amount from Other work related expenses and Tools & equipment depreciations
@@ -9512,7 +9505,7 @@
9512
9505
  MyTaxDeductions.prototype.setOtherWorkRelatedExpensesTotalAmount = function () {
9513
9506
  var otherIncomeRelatedExpenses = this.transactions
9514
9507
  .filterBy('chartAccounts.heading.id', DEDUCTION_CATEGORIES.otherIncomeRelatedExpenses);
9515
- this.otherWorkRelatedExpensesTotalAmount = Math.abs(otherIncomeRelatedExpenses.sumBy('claimAmount')) +
9508
+ this.otherWorkRelatedExpensesTotalAmount = -Math.abs(otherIncomeRelatedExpenses.sumBy('claimAmount')) +
9516
9509
  this.depreciations.filterBy('chartAccounts.heading.id', exports.ChartAccountsHeadingListEnum.TOOLS_EQUIPMENT).sumBy('claimAmount');
9517
9510
  };
9518
9511
  return MyTaxDeductions;
@@ -9813,15 +9806,13 @@
9813
9806
  * property contract date, e.t.c.). Details in the TT-2009 task
9814
9807
  */
9815
9808
  MyTaxRent.prototype.calculateOtherRentalDeductionsAmount = function () {
9816
- var plantAndEquipmentAmount = Math.abs(this.taxSummaryPropertySection.items
9817
- .findBy('taxReturnCategory.id', exports.TaxReturnCategoryListEnum.DEPRECIATION)
9818
- .amount);
9819
- var borrowingExpensesAmount = Math.abs(this.taxSummaryPropertySection.items
9820
- .findBy('taxReturnCategory.id', exports.TaxReturnCategoryListEnum.BORROWING_EXPENSES)
9821
- .amount);
9822
- var otherRentalDeductionsAmount = Math.abs(this.taxSummaryPropertySection.items
9823
- .findBy('taxReturnCategory.id', exports.TaxReturnCategoryListEnum.OTHER_RENTAL_DEDUCTIONS)
9824
- .amount);
9809
+ var _a, _b, _c;
9810
+ var plantAndEquipmentAmount = Math.abs(((_a = this.taxSummaryPropertySection.items
9811
+ .findBy('taxReturnCategory.id', exports.TaxReturnCategoryListEnum.DEPRECIATION)) === null || _a === void 0 ? void 0 : _a.amount) || 0);
9812
+ var borrowingExpensesAmount = Math.abs(((_b = this.taxSummaryPropertySection.items
9813
+ .findBy('taxReturnCategory.id', exports.TaxReturnCategoryListEnum.BORROWING_EXPENSES)) === null || _b === void 0 ? void 0 : _b.amount) || 0);
9814
+ var otherRentalDeductionsAmount = Math.abs(((_c = this.taxSummaryPropertySection.items
9815
+ .findBy('taxReturnCategory.id', exports.TaxReturnCategoryListEnum.OTHER_RENTAL_DEDUCTIONS)) === null || _c === void 0 ? void 0 : _c.amount) || 0);
9825
9816
  return +Math.floor(plantAndEquipmentAmount + borrowingExpensesAmount + otherRentalDeductionsAmount).toFixed(2);
9826
9817
  };
9827
9818
  return MyTaxRent;
@@ -11008,7 +10999,8 @@
11008
10999
  transactions.forEach(function (transaction, index) {
11009
11000
  // @TODO backend: need to upload file in the same backend endpoint with transaction add/update
11010
11001
  // check if passed receipt and upload file
11011
- if (transaction.file) {
11002
+ // @TODO Alex: refactor. Move receipt to separated service and use event dispatcher to handle it
11003
+ if (transaction.file && (transaction.file instanceof File)) {
11012
11004
  transaction.id = response[index].id;
11013
11005
  addedTransactions[index].file = transaction.file;
11014
11006
  _this.uploadReceipt(addedTransactions[index]);
@@ -11046,7 +11038,8 @@
11046
11038
  var updatedTransaction = classTransformer.plainToClass(Transaction, response);
11047
11039
  // @TODO need to upload file in the same backend endpoint with transaction add/update
11048
11040
  // check if passed new receipt and upload file
11049
- if (transaction.file) {
11041
+ // @TODO Alex: refactor. Move receipt to separated service and use event dispatcher to handle it
11042
+ if (transaction.file && (transaction.file instanceof File)) {
11050
11043
  updatedTransaction.file = transaction.file;
11051
11044
  _this.uploadReceipt(updatedTransaction);
11052
11045
  }
@@ -13590,12 +13583,12 @@
13590
13583
  }));
13591
13584
  };
13592
13585
  PropertyCalculationService.prototype.taxPositionGrowth = function (properties, transactions, depreciations) {
13593
- var taxPosition = this.getTaxPosition(transactions, depreciations);
13594
- // check if taxPosition = 0 to avoid division by zero
13595
- if (!taxPosition) {
13586
+ var forecastedTaxPosition = properties.sumBy('forecastedTaxPosition');
13587
+ // check if forecastedTaxPosition = 0 to avoid division by zero
13588
+ if (!forecastedTaxPosition) {
13596
13589
  return 0;
13597
13590
  }
13598
- return (taxPosition - properties.forecastedTaxPosition) / taxPosition;
13591
+ return (this.getTaxPosition(transactions, depreciations) - forecastedTaxPosition) / forecastedTaxPosition;
13599
13592
  };
13600
13593
  PropertyCalculationService.prototype.taxPositionGrowth$ = function (properties$, transactions$, depreciations$) {
13601
13594
  var _this = this;
@@ -13662,11 +13655,12 @@
13662
13655
  };
13663
13656
  PropertyCalculationService.prototype.getLvrGrowth = function (properties, bankAccounts, loans) {
13664
13657
  var lvr = this.getLvr(properties, bankAccounts);
13665
- if (!lvr) {
13666
- // check if lvr = 0 to avoid division by zero
13658
+ var lvrCommencement = this.getLvrCommencement(properties, loans, bankAccounts);
13659
+ if (!lvrCommencement) {
13660
+ // check if lvrCommencement = 0 to avoid division by zero
13667
13661
  return 0;
13668
13662
  }
13669
- return (lvr - this.getLvrCommencement(properties, loans, bankAccounts)) / lvr;
13663
+ return (this.getLvr(properties, bankAccounts) - lvrCommencement) / lvrCommencement;
13670
13664
  };
13671
13665
  PropertyCalculationService.prototype.getLvrGrowth$ = function (properties$, bankAccounts$, loans$) {
13672
13666
  var _this = this;
@@ -13679,14 +13673,28 @@
13679
13673
  return _this.getLvrGrowth(properties, bankAccounts, loans);
13680
13674
  }));
13681
13675
  };
13676
+ /**
13677
+ * Equity position = Market value - current loan value
13678
+ */
13682
13679
  PropertyCalculationService.prototype.getEquityPosition = function (properties, bankAccounts) {
13683
13680
  // Math abs is required for correct percentage calculation
13684
13681
  return properties.marketValue - Math.abs(this.getLoanValue(properties, bankAccounts));
13685
13682
  };
13683
+ /**
13684
+ * Purchase Equity = Purchase price - initial loan value
13685
+ */
13686
13686
  PropertyCalculationService.prototype.getPurchaseEquity = function (properties, bankAccounts, loans) {
13687
13687
  // Math abs is required for correct percentage calculation
13688
13688
  return properties.purchasePrice - Math.abs(this.getLoanAmount(properties, bankAccounts, loans));
13689
13689
  };
13690
+ PropertyCalculationService.prototype.getEquityGrowth = function (properties, bankAccounts, loans) {
13691
+ var purchaseEquity = this.getPurchaseEquity(properties, bankAccounts, loans);
13692
+ // check if purchaseEquity = 0 to avoid division by zero
13693
+ if (!purchaseEquity) {
13694
+ return 0;
13695
+ }
13696
+ return (this.getEquityPosition(properties, bankAccounts) - purchaseEquity) / purchaseEquity;
13697
+ };
13690
13698
  /**
13691
13699
  * Get dictionary of badges for each property in collection
13692
13700
  */
@@ -13698,6 +13706,14 @@
13698
13706
  });
13699
13707
  return badgesByProperty;
13700
13708
  };
13709
+ PropertyCalculationService.prototype.getCashPositionGrowth = function (properties, transactions) {
13710
+ var forecastedCashPosition = properties.sumBy('forecastedCashPosition');
13711
+ // check if forecastedCashPosition = 0 to avoid division by zero
13712
+ if (!forecastedCashPosition) {
13713
+ return 0;
13714
+ }
13715
+ return (transactions.cashPosition - forecastedCashPosition) / forecastedCashPosition;
13716
+ };
13701
13717
  /**
13702
13718
  * Get Badge for single property in collection
13703
13719
  */
@@ -14952,6 +14968,34 @@
14952
14968
  }] }];
14953
14969
  } });
14954
14970
 
14971
+ // @TODO Artem: implement cache and extend rest?
14972
+ var TutorialVideoService = /** @class */ (function () {
14973
+ function TutorialVideoService(http, environment) {
14974
+ this.http = http;
14975
+ this.environment = environment;
14976
+ }
14977
+ TutorialVideoService.prototype.get = function () {
14978
+ return this.http.get(TutorialVideoService.googleUrl + "&q='" + TutorialVideoService.parents + "'+in+parents&key=" + this.environment.googleDriveId)
14979
+ .pipe(operators.map(function (response) { return response.files; }));
14980
+ };
14981
+ return TutorialVideoService;
14982
+ }());
14983
+ TutorialVideoService.googleUrl = "https://www.googleapis.com/drive/v3/files?fields=*&mimeType='video/mp4'&orderBy=name";
14984
+ TutorialVideoService.parents = '1uLMLzi8WUy2go9xhfzJEwgFwOM43dukM';
14985
+ TutorialVideoService.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: TutorialVideoService, deps: [{ token: i1__namespace.HttpClient }, { token: 'environment' }], target: i0__namespace.ɵɵFactoryTarget.Injectable });
14986
+ TutorialVideoService.ɵprov = i0__namespace.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: TutorialVideoService, providedIn: 'root' });
14987
+ i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: TutorialVideoService, decorators: [{
14988
+ type: i0.Injectable,
14989
+ args: [{
14990
+ providedIn: 'root'
14991
+ }]
14992
+ }], ctorParameters: function () {
14993
+ return [{ type: i1__namespace.HttpClient }, { type: undefined, decorators: [{
14994
+ type: i0.Inject,
14995
+ args: ['environment']
14996
+ }] }];
14997
+ } });
14998
+
14955
14999
  // deep clone for entity
14956
15000
  function cloneDeep(array) {
14957
15001
  return JSON.parse(JSON.stringify(array));
@@ -15125,8 +15169,8 @@
15125
15169
  var BankAccountPropertiesForm = /** @class */ (function (_super) {
15126
15170
  __extends(BankAccountPropertiesForm, _super);
15127
15171
  function BankAccountPropertiesForm(bankAccountProperties) {
15128
- if (bankAccountProperties === void 0) { bankAccountProperties = [classTransformer.plainToClass(BankAccountProperty, {})]; }
15129
- return _super.call(this, bankAccountProperties.map(function (bankAccountProperty) {
15172
+ return _super.call(this, ((bankAccountProperties === null || bankAccountProperties === void 0 ? void 0 : bankAccountProperties.length) ? bankAccountProperties : [classTransformer.plainToClass(BankAccountProperty, {})])
15173
+ .map(function (bankAccountProperty) {
15130
15174
  return new forms.FormGroup({
15131
15175
  property: new forms.FormControl(bankAccountProperty === null || bankAccountProperty === void 0 ? void 0 : bankAccountProperty.property, forms.Validators.required),
15132
15176
  percent: new forms.FormControl(bankAccountProperty.percent, forms.Validators.required)
@@ -15745,7 +15789,7 @@
15745
15789
  disabled: true
15746
15790
  }),
15747
15791
  fundName: new forms.FormControl(''),
15748
- hasFund: new forms.FormControl(false),
15792
+ hasFund: new forms.FormControl(true),
15749
15793
  fundABN: new forms.FormControl(''),
15750
15794
  fundTFN: new forms.FormControl(''),
15751
15795
  fundAccountNumber: new forms.FormControl(''),
@@ -16325,6 +16369,7 @@
16325
16369
  exports.TransactionReceipt = TransactionReceipt;
16326
16370
  exports.TransactionService = TransactionService;
16327
16371
  exports.TtCoreModule = TtCoreModule;
16372
+ exports.TutorialVideoService = TutorialVideoService;
16328
16373
  exports.USER_ROLES = USER_ROLES;
16329
16374
  exports.USER_WORK_POSITION = USER_WORK_POSITION;
16330
16375
  exports.User = User;