taxtank-core 0.5.4 → 0.7.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.
Files changed (156) hide show
  1. package/bundles/taxtank-core.umd.js +443 -177
  2. package/bundles/taxtank-core.umd.js.map +1 -1
  3. package/esm2015/lib/collections/depreciation.collection.js +13 -2
  4. package/esm2015/lib/collections/property/property-sale/property-sale-tax-exemption-metadata.collection.js +20 -0
  5. package/esm2015/lib/collections/property/property.collection.js +72 -0
  6. package/esm2015/lib/db/Enums/property/property-category-list.enum.js +5 -0
  7. package/esm2015/lib/db/Enums/{property-depreciation-calculation.enum.js → property/property-depreciation-calculation.enum.js} +1 -1
  8. package/esm2015/lib/db/Enums/property/property-owner-access.enum.js +6 -0
  9. package/esm2015/lib/db/Enums/property/property-owner-status.enum.js +7 -0
  10. package/esm2015/lib/db/Enums/property/property-sale/tax-exemption-metadata.enum.js +9 -0
  11. package/esm2015/lib/db/Enums/property/property-sale/tax-exemption.enum.js +12 -0
  12. package/esm2015/lib/db/Models/bank-account-property.js +1 -1
  13. package/esm2015/lib/db/Models/depreciation-capital-project.js +1 -1
  14. package/esm2015/lib/db/Models/depreciation.js +1 -1
  15. package/esm2015/lib/db/Models/property/property-category-movement.js +3 -0
  16. package/esm2015/lib/db/Models/property/property-category.js +3 -0
  17. package/esm2015/lib/db/Models/property/property-document.js +3 -0
  18. package/esm2015/lib/db/Models/property/property-forecast.js +3 -0
  19. package/esm2015/lib/db/Models/property/property-owner.js +3 -0
  20. package/esm2015/lib/db/Models/property/property-sale/property-sale-tax-exemption-metadata.js +3 -0
  21. package/esm2015/lib/db/Models/property/property-sale/property-sale.js +3 -0
  22. package/esm2015/lib/db/Models/property/property-sale/tax-exemption-metadata.js +3 -0
  23. package/esm2015/lib/db/Models/property/property-sale/tax-exemption.js +3 -0
  24. package/esm2015/lib/db/Models/property/property-subscription.js +3 -0
  25. package/esm2015/lib/db/Models/property/property-valuation.js +3 -0
  26. package/esm2015/lib/db/Models/property/property.js +3 -0
  27. package/esm2015/lib/db/Models/transaction-base.js +1 -1
  28. package/esm2015/lib/db/Models/transaction.js +1 -1
  29. package/esm2015/lib/db/Models/user.js +1 -1
  30. package/esm2015/lib/forms/abstract.form.js +11 -0
  31. package/esm2015/lib/forms/index.js +7 -0
  32. package/esm2015/lib/forms/login/login.form.js +11 -0
  33. package/esm2015/lib/forms/register/register-client.form.js +29 -0
  34. package/esm2015/lib/forms/register/register-firm.form.js +26 -0
  35. package/esm2015/lib/forms/user/password.form.js +11 -0
  36. package/esm2015/lib/forms/user/reset-password.form.js +10 -0
  37. package/esm2015/lib/interceptors/corelogic-interceptor.js +2 -2
  38. package/esm2015/lib/models/depreciation/depreciation.js +5 -1
  39. package/esm2015/lib/models/endpoint/endpoints.const.js +1 -2
  40. package/esm2015/lib/models/property/property-category-movement.js +2 -2
  41. package/esm2015/lib/models/property/property-category.js +2 -2
  42. package/esm2015/lib/models/property/property-document.js +2 -2
  43. package/esm2015/lib/models/property/property-equity-chart-data.js +3 -3
  44. package/esm2015/lib/models/property/property-forecast.js +2 -2
  45. package/esm2015/lib/models/property/property-owner.js +3 -3
  46. package/esm2015/lib/models/property/property-sale/property-sale-tax-exemption-metadata.js +4 -0
  47. package/esm2015/lib/models/property/property-sale/property-sale.js +19 -0
  48. package/esm2015/lib/models/property/property-sale/tax-exemption-metadata.js +4 -0
  49. package/esm2015/lib/models/property/property-sale/tax-exemption.js +4 -0
  50. package/esm2015/lib/models/property/property-subscription.js +2 -2
  51. package/esm2015/lib/models/property/property-valuation.js +2 -2
  52. package/esm2015/lib/models/property/property.js +88 -4
  53. package/esm2015/lib/services/depreciation/depreciation.service.js +1 -1
  54. package/esm2015/lib/services/property/corelogic/corelogic.service.js +46 -0
  55. package/esm2015/lib/services/property/property-calculation/property-calculation.service.js +121 -0
  56. package/esm2015/lib/services/property/property-category/property-category.service.js +23 -0
  57. package/esm2015/lib/services/property/property-category-movement.service.js +1 -1
  58. package/esm2015/lib/services/property/property-document/property-document.service.js +70 -0
  59. package/esm2015/lib/services/property/{property-owner.service.js → property-owner/property-owner.service.js} +7 -7
  60. package/esm2015/lib/services/property/property-sale/property-sale.service.js +20 -0
  61. package/esm2015/lib/services/property/property-sale/tax-exemption/tax-exemption.service.js +21 -0
  62. package/esm2015/lib/services/property/property.service.js +1 -1
  63. package/esm2015/public-api.js +22 -14
  64. package/fesm2015/taxtank-core.js +361 -147
  65. package/fesm2015/taxtank-core.js.map +1 -1
  66. package/lib/collections/depreciation.collection.d.ts +4 -1
  67. package/lib/collections/property/property-sale/property-sale-tax-exemption-metadata.collection.d.ts +8 -0
  68. package/lib/collections/{property.collection.d.ts → property/property.collection.d.ts} +4 -4
  69. package/lib/db/Enums/property/property-category-list.enum.d.ts +3 -0
  70. package/lib/db/Enums/{property-depreciation-calculation.enum.d.ts → property/property-depreciation-calculation.enum.d.ts} +0 -0
  71. package/lib/db/Enums/{property-owner-access.enum.d.ts → property/property-owner-access.enum.d.ts} +0 -0
  72. package/lib/db/Enums/{property-owner-status.enum.d.ts → property/property-owner-status.enum.d.ts} +0 -0
  73. package/lib/db/Enums/property/property-sale/tax-exemption-metadata.enum.d.ts +5 -0
  74. package/lib/db/Enums/property/property-sale/tax-exemption.enum.d.ts +9 -0
  75. package/lib/db/Models/bank-account-property.d.ts +1 -1
  76. package/lib/db/Models/depreciation-capital-project.d.ts +1 -1
  77. package/lib/db/Models/depreciation.d.ts +1 -1
  78. package/lib/db/Models/{property-category-movement.d.ts → property/property-category-movement.d.ts} +1 -1
  79. package/lib/db/Models/{property-category.d.ts → property/property-category.d.ts} +1 -1
  80. package/lib/db/Models/{property-document.d.ts → property/property-document.d.ts} +1 -1
  81. package/lib/db/Models/{property-forecast.d.ts → property/property-forecast.d.ts} +0 -0
  82. package/lib/db/Models/{property-owner.d.ts → property/property-owner.d.ts} +4 -4
  83. package/lib/db/Models/property/property-sale/property-sale-tax-exemption-metadata.d.ts +8 -0
  84. package/lib/db/Models/property/property-sale/property-sale.d.ts +20 -0
  85. package/lib/db/Models/property/property-sale/tax-exemption-metadata.d.ts +6 -0
  86. package/lib/db/Models/property/property-sale/tax-exemption.d.ts +7 -0
  87. package/lib/db/Models/{property-subscription.d.ts → property/property-subscription.d.ts} +1 -1
  88. package/lib/db/Models/{property-valuation.d.ts → property/property-valuation.d.ts} +0 -0
  89. package/lib/db/Models/{property.d.ts → property/property.d.ts} +9 -8
  90. package/lib/db/Models/transaction-base.d.ts +1 -1
  91. package/lib/db/Models/transaction.d.ts +1 -1
  92. package/lib/db/Models/user.d.ts +3 -3
  93. package/lib/forms/abstract.form.d.ts +4 -0
  94. package/lib/forms/index.d.ts +6 -0
  95. package/lib/forms/login/login.form.d.ts +4 -0
  96. package/lib/forms/register/register-client.form.d.ts +5 -0
  97. package/lib/forms/register/register-firm.form.d.ts +7 -0
  98. package/lib/forms/user/password.form.d.ts +4 -0
  99. package/lib/forms/user/reset-password.form.d.ts +4 -0
  100. package/lib/interceptors/corelogic-interceptor.d.ts +1 -1
  101. package/lib/models/depreciation/depreciation.d.ts +1 -0
  102. package/lib/models/property/property-category-movement.d.ts +1 -1
  103. package/lib/models/property/property-category.d.ts +1 -1
  104. package/lib/models/property/property-document.d.ts +1 -1
  105. package/lib/models/property/property-equity-chart-data.d.ts +1 -1
  106. package/lib/models/property/property-forecast.d.ts +1 -1
  107. package/lib/models/property/property-owner.d.ts +1 -1
  108. package/lib/models/property/property-sale/property-sale-tax-exemption-metadata.d.ts +3 -0
  109. package/lib/models/property/property-sale/property-sale.d.ts +8 -0
  110. package/lib/models/property/property-sale/tax-exemption-metadata.d.ts +3 -0
  111. package/lib/models/property/property-sale/tax-exemption.d.ts +3 -0
  112. package/lib/models/property/property-subscription.d.ts +1 -1
  113. package/lib/models/property/property-valuation.d.ts +1 -1
  114. package/lib/models/property/property.d.ts +34 -3
  115. package/lib/services/property/{corelogic.service.d.ts → corelogic/corelogic.service.d.ts} +1 -1
  116. package/lib/services/property/{property-calculation.service.d.ts → property-calculation/property-calculation.service.d.ts} +5 -5
  117. package/lib/services/property/{property-category.service.d.ts → property-category/property-category.service.d.ts} +3 -3
  118. package/lib/services/property/property-category-movement.service.d.ts +1 -1
  119. package/lib/services/property/{property-document.service.d.ts → property-document/property-document.service.d.ts} +4 -4
  120. package/lib/services/property/{property-owner.service.d.ts → property-owner/property-owner.service.d.ts} +4 -4
  121. package/lib/services/property/property-sale/property-sale.service.d.ts +10 -0
  122. package/lib/services/property/property-sale/tax-exemption/tax-exemption.service.d.ts +11 -0
  123. package/lib/services/property/property.service.d.ts +1 -1
  124. package/package.json +2 -1
  125. package/public-api.d.ts +21 -13
  126. package/esm2015/lib/collections/property.collection.js +0 -72
  127. package/esm2015/lib/db/Enums/property-owner-access.enum.js +0 -6
  128. package/esm2015/lib/db/Enums/property-owner-status.enum.js +0 -7
  129. package/esm2015/lib/db/Models/capital-cost-property.js +0 -3
  130. package/esm2015/lib/db/Models/capital-cost.js +0 -3
  131. package/esm2015/lib/db/Models/property-capital-cost.js +0 -3
  132. package/esm2015/lib/db/Models/property-category-movement.js +0 -3
  133. package/esm2015/lib/db/Models/property-category.js +0 -3
  134. package/esm2015/lib/db/Models/property-document.js +0 -3
  135. package/esm2015/lib/db/Models/property-forecast.js +0 -3
  136. package/esm2015/lib/db/Models/property-owner.js +0 -3
  137. package/esm2015/lib/db/Models/property-sold.js +0 -3
  138. package/esm2015/lib/db/Models/property-subscription.js +0 -3
  139. package/esm2015/lib/db/Models/property-valuation.js +0 -3
  140. package/esm2015/lib/db/Models/property.js +0 -3
  141. package/esm2015/lib/models/property/property-capital-cost.js +0 -4
  142. package/esm2015/lib/models/property/property-sold.js +0 -12
  143. package/esm2015/lib/services/property/corelogic.service.js +0 -46
  144. package/esm2015/lib/services/property/property-calculation.service.js +0 -121
  145. package/esm2015/lib/services/property/property-capital-cost.service.js +0 -46
  146. package/esm2015/lib/services/property/property-category.service.js +0 -23
  147. package/esm2015/lib/services/property/property-document.service.js +0 -68
  148. package/esm2015/lib/services/property/property-sold.service.js +0 -23
  149. package/lib/db/Models/capital-cost-property.d.ts +0 -13
  150. package/lib/db/Models/capital-cost.d.ts +0 -4
  151. package/lib/db/Models/property-capital-cost.d.ts +0 -13
  152. package/lib/db/Models/property-sold.d.ts +0 -12
  153. package/lib/models/property/property-capital-cost.d.ts +0 -3
  154. package/lib/models/property/property-sold.d.ts +0 -5
  155. package/lib/services/property/property-capital-cost.service.d.ts +0 -20
  156. package/lib/services/property/property-sold.service.d.ts +0 -13
@@ -830,7 +830,6 @@
830
830
  BANK_TRANSACTIONS_DELETE: new Endpoint('DELETE', '\\/bank-transactions\\/\\d+'),
831
831
  BANK_TRANSACTIONS_IMPORT_POST: new Endpoint('POST', '\\/bank-transactions\\/\\d+\\/import'),
832
832
  BASIQ_ACCOUNTS_GET: new Endpoint('GET', '\\/basiq\\/\\accounts'),
833
- CAPITAL_COSTS_GET: new Endpoint('GET', '\\/capital-costs'),
834
833
  CHARTS_INCOME_GET: new Endpoint('GET', '\\/charts\\/\\incomes'),
835
834
  CHARTS_EXPENSES_GET: new Endpoint('GET', '\\/charts\\/\\expenses'),
836
835
  CHART_ACCOUNTS_GET: new Endpoint('GET', '\\/chart-accounts'),
@@ -1943,10 +1942,17 @@
1943
1942
  configurable: true
1944
1943
  });
1945
1944
  DepreciationCollection.prototype.getClaimAmountByYear = function (year) {
1945
+ if (year === void 0) { year = +localStorage.getItem('financialYear'); }
1946
1946
  return this.items.reduce(function (sum, depreciation) {
1947
1947
  return sum + depreciation.getClaimAmountByYear(year);
1948
1948
  }, 0);
1949
1949
  };
1950
+ DepreciationCollection.prototype.getCloseBalanceByYear = function (year) {
1951
+ if (year === void 0) { year = +localStorage.getItem('financialYear'); }
1952
+ return this.items.reduce(function (sum, depreciation) {
1953
+ return sum + depreciation.getCloseBalanceByYear(year);
1954
+ }, 0);
1955
+ };
1950
1956
  DepreciationCollection.prototype.getCurrentYearForecastAmount = function () {
1951
1957
  return this.items.reduce(function (sum, depreciation) {
1952
1958
  return sum + depreciation.getCurrentYearForecastAmount();
@@ -1971,6 +1977,12 @@
1971
1977
  DepreciationCollection.prototype.getByPropertiesIds = function (ids) {
1972
1978
  return new DepreciationCollection(this.items.filter(function (depreciation) { var _a; return ids.includes((_a = depreciation.property) === null || _a === void 0 ? void 0 : _a.id); }));
1973
1979
  };
1980
+ DepreciationCollection.prototype.getWithCapitalProject = function () {
1981
+ return new DepreciationCollection(this.items.filter(function (depreciation) { return !!depreciation.depreciationCapitalProject; }));
1982
+ };
1983
+ DepreciationCollection.prototype.getWithoutCapitalProject = function () {
1984
+ return new DepreciationCollection(this.items.filter(function (depreciation) { return !depreciation.depreciationCapitalProject; }));
1985
+ };
1974
1986
  DepreciationCollection.prototype.getWithoutBorrowingExpenses = function () {
1975
1987
  return new DepreciationCollection(this.items.filter(function (depreciation) { return !depreciation.isBorrowingExpense(); }));
1976
1988
  };
@@ -2406,10 +2418,10 @@
2406
2418
  PropertyCollection.prototype.getOwnerOccupiedProperties = function () {
2407
2419
  return new PropertyCollection(this.items.filter(function (property) { return property.category.isOwnerOccupied(); }));
2408
2420
  };
2409
- Object.defineProperty(PropertyCollection.prototype, "earliestPurchaseDate", {
2421
+ Object.defineProperty(PropertyCollection.prototype, "earliestContractDate", {
2410
2422
  get: function () {
2411
2423
  return this.items.reduce(function (min, property) {
2412
- return min < property.purchaseDate ? min : property.purchaseDate;
2424
+ return min < property.contractDate ? min : property.contractDate;
2413
2425
  }, new FinancialYear(new Date()).startDate);
2414
2426
  },
2415
2427
  enumerable: false,
@@ -3589,6 +3601,15 @@
3589
3601
  VehicleLogbookPurposeEnum[VehicleLogbookPurposeEnum["PERSONAL"] = 2] = "PERSONAL";
3590
3602
  })(exports.VehicleLogbookPurposeEnum || (exports.VehicleLogbookPurposeEnum = {}));
3591
3603
 
3604
+ exports.TaxExemptionMetadataEnum = void 0;
3605
+ (function (TaxExemptionMetadataEnum) {
3606
+ // principle place of residence
3607
+ TaxExemptionMetadataEnum[TaxExemptionMetadataEnum["PPR_DAYS"] = 1] = "PPR_DAYS";
3608
+ // market value once it was moved, decimal
3609
+ TaxExemptionMetadataEnum[TaxExemptionMetadataEnum["MARKET_VALUE"] = 2] = "MARKET_VALUE";
3610
+ TaxExemptionMetadataEnum[TaxExemptionMetadataEnum["CLAIM_PERCENT"] = 3] = "CLAIM_PERCENT";
3611
+ })(exports.TaxExemptionMetadataEnum || (exports.TaxExemptionMetadataEnum = {}));
3612
+
3592
3613
  var Address$1 = /** @class */ (function () {
3593
3614
  function Address() {
3594
3615
  }
@@ -4509,6 +4530,49 @@
4509
4530
  classTransformer.Type(function () { return Date; })
4510
4531
  ], PropertyCategoryMovement.prototype, "toDate", void 0);
4511
4532
 
4533
+ var TaxExemptionEnum;
4534
+ (function (TaxExemptionEnum) {
4535
+ TaxExemptionEnum[TaxExemptionEnum["ONE_YEAR_RULE"] = 1] = "ONE_YEAR_RULE";
4536
+ // principle place of residence
4537
+ TaxExemptionEnum[TaxExemptionEnum["PPR"] = 2] = "PPR";
4538
+ TaxExemptionEnum[TaxExemptionEnum["SIX_YEARS_RULE"] = 3] = "SIX_YEARS_RULE";
4539
+ TaxExemptionEnum[TaxExemptionEnum["INVESTMENT_TO_PPR"] = 4] = "INVESTMENT_TO_PPR";
4540
+ TaxExemptionEnum[TaxExemptionEnum["PPR_TO_INVESTMENT"] = 5] = "PPR_TO_INVESTMENT";
4541
+ TaxExemptionEnum[TaxExemptionEnum["TRANSFER"] = 6] = "TRANSFER";
4542
+ TaxExemptionEnum[TaxExemptionEnum["OTHER"] = 7] = "OTHER";
4543
+ })(TaxExemptionEnum || (TaxExemptionEnum = {}));
4544
+
4545
+ var PropertyCategoryListEnum;
4546
+ (function (PropertyCategoryListEnum) {
4547
+ PropertyCategoryListEnum[PropertyCategoryListEnum["OWNER_OCCUPIED"] = 3] = "OWNER_OCCUPIED";
4548
+ })(PropertyCategoryListEnum || (PropertyCategoryListEnum = {}));
4549
+
4550
+ var PropertySaleTaxExemptionMetadataCollection = /** @class */ (function (_super) {
4551
+ __extends(PropertySaleTaxExemptionMetadataCollection, _super);
4552
+ function PropertySaleTaxExemptionMetadataCollection() {
4553
+ return _super !== null && _super.apply(this, arguments) || this;
4554
+ }
4555
+ PropertySaleTaxExemptionMetadataCollection.prototype.getPPRDays = function () {
4556
+ var _a, _b;
4557
+ return (_b = (_a = this.getByMetadataId(exports.TaxExemptionMetadataEnum.PPR_DAYS)) === null || _a === void 0 ? void 0 : _a.value) !== null && _b !== void 0 ? _b : 0;
4558
+ };
4559
+ PropertySaleTaxExemptionMetadataCollection.prototype.getMarketValue = function () {
4560
+ var _a, _b;
4561
+ return (_b = (_a = this.getByMetadataId(exports.TaxExemptionMetadataEnum.MARKET_VALUE)) === null || _a === void 0 ? void 0 : _a.value) !== null && _b !== void 0 ? _b : 0;
4562
+ };
4563
+ PropertySaleTaxExemptionMetadataCollection.prototype.getClaimPercent = function () {
4564
+ var _a, _b;
4565
+ return (_b = (_a = this.getByMetadataId(exports.TaxExemptionMetadataEnum.CLAIM_PERCENT)) === null || _a === void 0 ? void 0 : _a.value) !== null && _b !== void 0 ? _b : 100;
4566
+ };
4567
+ PropertySaleTaxExemptionMetadataCollection.prototype.getByMetadataId = function (id) {
4568
+ return this.items.find(function (metadata) { return metadata.metadata.id === id; });
4569
+ };
4570
+ return PropertySaleTaxExemptionMetadataCollection;
4571
+ }(Collection));
4572
+
4573
+ /**
4574
+ * propertySale docs - https://taxtank.atlassian.net/wiki/spaces/TAXTANK/pages/4209508353/Property+Sold+button
4575
+ */
4512
4576
  var Property = /** @class */ (function (_super) {
4513
4577
  __extends(Property, _super);
4514
4578
  function Property() {
@@ -4546,7 +4610,7 @@
4546
4610
  };
4547
4611
  Object.defineProperty(Property.prototype, "capitalCostsTotalAmount", {
4548
4612
  get: function () {
4549
- return this.capitalCosts.reduce(function (sum, capitalCost) { return sum + capitalCost.amount; }, 0);
4613
+ return this.stampDuty + this.legalFees + this.otherCapitalCosts;
4550
4614
  },
4551
4615
  enumerable: false,
4552
4616
  configurable: true
@@ -4664,11 +4728,89 @@
4664
4728
  enumerable: false,
4665
4729
  configurable: true
4666
4730
  });
4731
+ /**
4732
+ * purchase costs - claimed costs, except `ppr to investment` exemption,
4733
+ * in that case it's equal to market value, when property became an investment property
4734
+ */
4735
+ Property.prototype.calculateCostBase = function (sale) {
4736
+ var marketValue = new PropertySaleTaxExemptionMetadataCollection(sale.taxExemptionMetadata).getMarketValue();
4737
+ if (marketValue) {
4738
+ return marketValue;
4739
+ }
4740
+ return this.purchasePrice + this.capitalCostsTotalAmount + sale.structuralImprovementsWDV - sale.buildingAtCostClaimed;
4741
+ };
4742
+ /**
4743
+ * gross capital gain tax: sale costs - cost base
4744
+ */
4745
+ Property.prototype.calculateCGT = function (sale) {
4746
+ return sale.price - sale.saleCostsTotalAmount - sale.capitalLoss - this.calculateCostBase(sale);
4747
+ };
4748
+ /**
4749
+ * net capital gain tax (includes tax exemptions)
4750
+ */
4751
+ Property.prototype.calculateNetCGT = function (sale) {
4752
+ return this.getCGTExemptionRatio(sale) * this.calculateCGT(sale);
4753
+ };
4754
+ /**
4755
+ * guess tax exemption based on property details
4756
+ */
4757
+ Property.prototype.getCGTExemption = function (sale) {
4758
+ if (sale.taxExemption) {
4759
+ return sale.taxExemption.id;
4760
+ }
4761
+ switch (true) {
4762
+ // exemption for main residence properties
4763
+ case this.category.id === PropertyCategoryListEnum.OWNER_OCCUPIED:
4764
+ return TaxExemptionEnum.PPR;
4765
+ // exemption for investment properties owned for at least one year
4766
+ case this.getOwnershipDuration(sale, 'years') >= 1:
4767
+ return TaxExemptionEnum.ONE_YEAR_RULE;
4768
+ default:
4769
+ return null;
4770
+ }
4771
+ };
4772
+ /**
4773
+ * tax exemption can reduce cgt from 100% to less (up to zero)
4774
+ */
4775
+ Property.prototype.getCGTExemptionRatio = function (sale) {
4776
+ var _a;
4777
+ var metadata = new PropertySaleTaxExemptionMetadataCollection(sale.taxExemptionMetadata);
4778
+ switch ((_a = sale.taxExemption) === null || _a === void 0 ? void 0 : _a.id) {
4779
+ // 50% exemption for investments owned for at least one year
4780
+ case TaxExemptionEnum.ONE_YEAR_RULE:
4781
+ return 0.5;
4782
+ // investment property become main residence (exemption for main residence ownership duration)
4783
+ case TaxExemptionEnum.INVESTMENT_TO_PPR:
4784
+ var ownershipDays = this.getOwnershipDuration(sale);
4785
+ return (ownershipDays - metadata.getPPRDays()) / ownershipDays;
4786
+ // main residence become investment (exemption for home office percent usage)
4787
+ case TaxExemptionEnum.PPR_TO_INVESTMENT:
4788
+ // 1 year CGT discount can still apply (on the income producing % if used for 12 months or more)
4789
+ var ratio = this.getOwnershipDuration(sale, 'years') >= 1 ? 0.5 : 1;
4790
+ return metadata.getClaimPercent() / 100 * ratio;
4791
+ // full exemption
4792
+ case TaxExemptionEnum.PPR:
4793
+ case TaxExemptionEnum.SIX_YEARS_RULE:
4794
+ case TaxExemptionEnum.TRANSFER:
4795
+ case TaxExemptionEnum.OTHER:
4796
+ return 0;
4797
+ // no exemption
4798
+ default:
4799
+ return 1;
4800
+ }
4801
+ };
4802
+ /**
4803
+ * ownership duration from purchase till sale
4804
+ */
4805
+ Property.prototype.getOwnershipDuration = function (sale, unitOfTime) {
4806
+ if (unitOfTime === void 0) { unitOfTime = 'days'; }
4807
+ return moment__namespace(sale.contractDate).diff(moment__namespace(this.contractDate), unitOfTime);
4808
+ };
4667
4809
  return Property;
4668
4810
  }(Property$1));
4669
4811
  __decorate([
4670
4812
  classTransformer.Type(function () { return Date; })
4671
- ], Property.prototype, "purchaseDate", void 0);
4813
+ ], Property.prototype, "contractDate", void 0);
4672
4814
  __decorate([
4673
4815
  classTransformer.Type(function () { return Date; })
4674
4816
  ], Property.prototype, "settlementDate", void 0);
@@ -5525,6 +5667,10 @@
5525
5667
  var _a;
5526
5668
  return ((_a = this.getForecastByYear(year)) === null || _a === void 0 ? void 0 : _a.claimAmount) || 0;
5527
5669
  };
5670
+ Depreciation.prototype.getCloseBalanceByYear = function (year) {
5671
+ var _a;
5672
+ return ((_a = this.getForecastByYear(year)) === null || _a === void 0 ? void 0 : _a.closeBalance) || 0;
5673
+ };
5528
5674
  Object.defineProperty(Depreciation.prototype, "assetValue", {
5529
5675
  get: function () {
5530
5676
  var _a;
@@ -7164,20 +7310,6 @@
7164
7310
  OwnershipFilterOptionsEnum[OwnershipFilterOptionsEnum["SHARED_PROPERTIES"] = 3] = "SHARED_PROPERTIES";
7165
7311
  })(exports.OwnershipFilterOptionsEnum || (exports.OwnershipFilterOptionsEnum = {}));
7166
7312
 
7167
- var PropertyCapitalCost$1 = /** @class */ (function () {
7168
- function PropertyCapitalCost() {
7169
- }
7170
- return PropertyCapitalCost;
7171
- }());
7172
-
7173
- var PropertyCapitalCost = /** @class */ (function (_super) {
7174
- __extends(PropertyCapitalCost, _super);
7175
- function PropertyCapitalCost() {
7176
- return _super !== null && _super.apply(this, arguments) || this;
7177
- }
7178
- return PropertyCapitalCost;
7179
- }(PropertyCapitalCost$1));
7180
-
7181
7313
  /**
7182
7314
  * class contains equity information for passed financial year
7183
7315
  */
@@ -7343,14 +7475,14 @@
7343
7475
  }, 0);
7344
7476
  };
7345
7477
  PropertyEquityChartData.prototype.getMarketValueForPropertyByYear = function (property, year) {
7346
- if (new FinancialYear(property.purchaseDate).year > year) {
7478
+ if (new FinancialYear(property.contractDate).year > year) {
7347
7479
  return 0;
7348
7480
  }
7349
7481
  return (property.getForecastByYear(year) || first__default["default"](property.forecasts)).marketValue;
7350
7482
  };
7351
7483
  PropertyEquityChartData.prototype.getLoanBalanceForPropertyByYear = function (property, year) {
7352
7484
  var _a;
7353
- if (new FinancialYear(property.purchaseDate).year > year) {
7485
+ if (new FinancialYear(property.contractDate).year > year) {
7354
7486
  return 0;
7355
7487
  }
7356
7488
  return ((_a = property.getForecastByYear(year)) === null || _a === void 0 ? void 0 : _a.loanBalance) || this.bankAccounts.getPropertyBalanceAmount(property.id);
@@ -7431,25 +7563,77 @@
7431
7563
  })
7432
7564
  ], PropertyOwner.prototype, "email", void 0);
7433
7565
 
7434
- var PropertySold$1 = /** @class */ (function () {
7435
- function PropertySold() {
7566
+ var PropertySale$1 = /** @class */ (function () {
7567
+ function PropertySale() {
7568
+ }
7569
+ return PropertySale;
7570
+ }());
7571
+
7572
+ var PropertySaleTaxExemptionMetadata$1 = /** @class */ (function () {
7573
+ function PropertySaleTaxExemptionMetadata() {
7436
7574
  }
7437
- return PropertySold;
7575
+ return PropertySaleTaxExemptionMetadata;
7438
7576
  }());
7439
7577
 
7440
- var PropertySold = /** @class */ (function (_super) {
7441
- __extends(PropertySold, _super);
7442
- function PropertySold() {
7578
+ var PropertySale = /** @class */ (function (_super) {
7579
+ __extends(PropertySale, _super);
7580
+ function PropertySale() {
7443
7581
  return _super !== null && _super.apply(this, arguments) || this;
7444
7582
  }
7445
- return PropertySold;
7446
- }(PropertySold$1));
7583
+ Object.defineProperty(PropertySale.prototype, "saleCostsTotalAmount", {
7584
+ get: function () {
7585
+ return this.commission + this.legalFees + this.otherCost;
7586
+ },
7587
+ enumerable: false,
7588
+ configurable: true
7589
+ });
7590
+ return PropertySale;
7591
+ }(PropertySale$1));
7447
7592
  __decorate([
7448
7593
  classTransformer.Type(function () { return Date; })
7449
- ], PropertySold.prototype, "date", void 0);
7594
+ ], PropertySale.prototype, "settlementDate", void 0);
7450
7595
  __decorate([
7451
7596
  classTransformer.Type(function () { return Date; })
7452
- ], PropertySold.prototype, "contractDate", void 0);
7597
+ ], PropertySale.prototype, "contractDate", void 0);
7598
+ __decorate([
7599
+ classTransformer.Type(function () { return PropertySaleTaxExemptionMetadata$1; })
7600
+ ], PropertySale.prototype, "taxExemptionMetadata", void 0);
7601
+
7602
+ var TaxExemption$1 = /** @class */ (function () {
7603
+ function TaxExemption() {
7604
+ }
7605
+ return TaxExemption;
7606
+ }());
7607
+
7608
+ var TaxExemption = /** @class */ (function (_super) {
7609
+ __extends(TaxExemption, _super);
7610
+ function TaxExemption() {
7611
+ return _super !== null && _super.apply(this, arguments) || this;
7612
+ }
7613
+ return TaxExemption;
7614
+ }(TaxExemption$1));
7615
+
7616
+ var TaxExemptionMetadata$1 = /** @class */ (function () {
7617
+ function TaxExemptionMetadata() {
7618
+ }
7619
+ return TaxExemptionMetadata;
7620
+ }());
7621
+
7622
+ var TaxExemptionMetadata = /** @class */ (function (_super) {
7623
+ __extends(TaxExemptionMetadata, _super);
7624
+ function TaxExemptionMetadata() {
7625
+ return _super !== null && _super.apply(this, arguments) || this;
7626
+ }
7627
+ return TaxExemptionMetadata;
7628
+ }(TaxExemptionMetadata$1));
7629
+
7630
+ var PropertySaleTaxExemptionMetadata = /** @class */ (function (_super) {
7631
+ __extends(PropertySaleTaxExemptionMetadata, _super);
7632
+ function PropertySaleTaxExemptionMetadata() {
7633
+ return _super !== null && _super.apply(this, arguments) || this;
7634
+ }
7635
+ return PropertySaleTaxExemptionMetadata;
7636
+ }(PropertySaleTaxExemptionMetadata$1));
7453
7637
 
7454
7638
  /**
7455
7639
  * Constant with list of URLs
@@ -10599,47 +10783,6 @@
10599
10783
  }]
10600
10784
  }] });
10601
10785
 
10602
- /**
10603
- * Service for get property equity position half-year history chart data
10604
- */
10605
- var EquityPositionChartService = /** @class */ (function () {
10606
- function EquityPositionChartService(http, environment) {
10607
- this.http = http;
10608
- this.environment = environment;
10609
- }
10610
- EquityPositionChartService.prototype.get = function () {
10611
- // @TODO refactor backend
10612
- return this.http.get(this.environment.apiV2 + "/properties/categories/equity")
10613
- .pipe(operators.map(function (response) {
10614
- return response.map(function (item) {
10615
- return classTransformer.plainToClass(ChartData, {
10616
- name: item.category.name,
10617
- data: item.equity.map(function (serie) {
10618
- return classTransformer.plainToClass(ChartSerie, {
10619
- label: serie.date,
10620
- value: serie.amount
10621
- });
10622
- })
10623
- });
10624
- });
10625
- }));
10626
- };
10627
- return EquityPositionChartService;
10628
- }());
10629
- EquityPositionChartService.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: EquityPositionChartService, deps: [{ token: i1__namespace.HttpClient }, { token: 'environment' }], target: i0__namespace.ɵɵFactoryTarget.Injectable });
10630
- EquityPositionChartService.ɵprov = i0__namespace.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: EquityPositionChartService, providedIn: 'root' });
10631
- i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: EquityPositionChartService, decorators: [{
10632
- type: i0.Injectable,
10633
- args: [{
10634
- providedIn: 'root'
10635
- }]
10636
- }], ctorParameters: function () {
10637
- return [{ type: i1__namespace.HttpClient }, { type: undefined, decorators: [{
10638
- type: i0.Inject,
10639
- args: ['environment']
10640
- }] }];
10641
- } });
10642
-
10643
10786
  /**
10644
10787
  * Service for work with Property
10645
10788
  */
@@ -10896,49 +11039,6 @@
10896
11039
  }]
10897
11040
  }] });
10898
11041
 
10899
- /**
10900
- * Service to work with capital costs
10901
- */
10902
- var PropertyCapitalCostService = /** @class */ (function (_super) {
10903
- __extends(PropertyCapitalCostService, _super);
10904
- function PropertyCapitalCostService() {
10905
- var _this = _super.apply(this, __spreadArray([], __read(arguments))) || this;
10906
- _this.url = 'capital-costs';
10907
- _this.modelClass = PropertyCapitalCost;
10908
- return _this;
10909
- }
10910
- /**
10911
- * Get property capital costs
10912
- * @param property which params will be taken for list of property capital costs
10913
- */
10914
- PropertyCapitalCostService.prototype.getByProperty = function (property) {
10915
- // get list of capital costs items
10916
- return this.get()
10917
- .pipe(operators.map(function (capitalCosts) {
10918
- // property capital costs array
10919
- return capitalCosts.map(function (capitalCost) {
10920
- var _a;
10921
- // return new Property capital cost object with capital cost and amount
10922
- return classTransformer.plainToClass(PropertyCapitalCost, {
10923
- capitalCost: capitalCost,
10924
- amount: ((_a = property.capitalCosts.find(function (existingCapitalCost) {
10925
- return existingCapitalCost.capitalCost.id === capitalCost.id;
10926
- })) === null || _a === void 0 ? void 0 : _a.amount) || null
10927
- });
10928
- });
10929
- }));
10930
- };
10931
- return PropertyCapitalCostService;
10932
- }(BaseRestService));
10933
- PropertyCapitalCostService.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: PropertyCapitalCostService, deps: null, target: i0__namespace.ɵɵFactoryTarget.Injectable });
10934
- PropertyCapitalCostService.ɵprov = i0__namespace.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: PropertyCapitalCostService, providedIn: 'root' });
10935
- i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: PropertyCapitalCostService, decorators: [{
10936
- type: i0.Injectable,
10937
- args: [{
10938
- providedIn: 'root'
10939
- }]
10940
- }] });
10941
-
10942
11042
  /**
10943
11043
  * Service for work with Property Categories
10944
11044
  */
@@ -10961,52 +11061,6 @@
10961
11061
  }]
10962
11062
  }] });
10963
11063
 
10964
- var PropertyCategoryMovementService = /** @class */ (function (_super) {
10965
- __extends(PropertyCategoryMovementService, _super);
10966
- function PropertyCategoryMovementService() {
10967
- var _this = _super.apply(this, __spreadArray([], __read(arguments))) || this;
10968
- _this.modelClass = PropertyCategoryMovement;
10969
- _this.url = 'properties/category-movements';
10970
- return _this;
10971
- }
10972
- PropertyCategoryMovementService.prototype.add = function (model) {
10973
- var _this = this;
10974
- return _super.prototype.add.call(this, model).pipe(operators.map(function (newMovement) {
10975
- // @TODO Alex: we need to teach restService to dispatch events + limit list of methods (not all services have all 4 or even more considering batch requests) + collections
10976
- _this.eventDispatcherService.dispatch(new AppEvent(exports.AppEventTypeEnum.PROPERTY_MOVEMENT_CREATED, null));
10977
- return newMovement;
10978
- }));
10979
- };
10980
- PropertyCategoryMovementService.prototype.update = function (model) {
10981
- var _this = this;
10982
- return _super.prototype.update.call(this, model).pipe(operators.map(function (updatedMovement) {
10983
- _this.eventDispatcherService.dispatch(new AppEvent(exports.AppEventTypeEnum.PROPERTY_MOVEMENT_CREATED, null));
10984
- return updatedMovement;
10985
- }));
10986
- };
10987
- PropertyCategoryMovementService.prototype.delete = function (model) {
10988
- var _this = this;
10989
- return _super.prototype.delete.call(this, model).pipe(operators.map(function () {
10990
- _this.eventDispatcherService.dispatch(new AppEvent(exports.AppEventTypeEnum.PROPERTY_MOVEMENT_CREATED, null));
10991
- }));
10992
- };
10993
- // @TODO Alex: Move to collection
10994
- PropertyCategoryMovementService.prototype.getByPropertyId = function (id) {
10995
- return this.get().pipe(operators.map(function (movements) {
10996
- return movements.filter(function (movement) { return movement.property.id === id; });
10997
- }));
10998
- };
10999
- return PropertyCategoryMovementService;
11000
- }(BaseRestService));
11001
- PropertyCategoryMovementService.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: PropertyCategoryMovementService, deps: null, target: i0__namespace.ɵɵFactoryTarget.Injectable });
11002
- PropertyCategoryMovementService.ɵprov = i0__namespace.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: PropertyCategoryMovementService, providedIn: 'root' });
11003
- i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: PropertyCategoryMovementService, decorators: [{
11004
- type: i0.Injectable,
11005
- args: [{
11006
- providedIn: 'root'
11007
- }]
11008
- }] });
11009
-
11010
11064
  /**
11011
11065
  * Class for work with Property Documents
11012
11066
  */
@@ -11032,8 +11086,10 @@
11032
11086
  formDataDocument.append('file', file);
11033
11087
  return this.http.post(this.environment.apiV2 + "/properties/" + propertyId + "/documents", formDataDocument).pipe(operators.map(function (documentBase) {
11034
11088
  var newDocument = classTransformer.plainToClass(PropertyDocument, documentBase);
11035
- _this.cache.push(newDocument);
11036
- _this.updateCache();
11089
+ if (_this.cache) {
11090
+ _this.cache.push(newDocument);
11091
+ _this.updateCache();
11092
+ }
11037
11093
  return newDocument;
11038
11094
  }));
11039
11095
  };
@@ -11193,22 +11249,106 @@
11193
11249
  }] }];
11194
11250
  } });
11195
11251
 
11252
+ var PropertySaleService = /** @class */ (function (_super) {
11253
+ __extends(PropertySaleService, _super);
11254
+ function PropertySaleService() {
11255
+ var _this = _super.apply(this, __spreadArray([], __read(arguments))) || this;
11256
+ _this.modelClass = PropertySale;
11257
+ _this.url = 'properties/sales';
11258
+ return _this;
11259
+ }
11260
+ return PropertySaleService;
11261
+ }(BaseRestService));
11262
+ PropertySaleService.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: PropertySaleService, deps: null, target: i0__namespace.ɵɵFactoryTarget.Injectable });
11263
+ PropertySaleService.ɵprov = i0__namespace.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: PropertySaleService, providedIn: 'root' });
11264
+ i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: PropertySaleService, decorators: [{
11265
+ type: i0.Injectable,
11266
+ args: [{
11267
+ providedIn: 'root'
11268
+ }]
11269
+ }] });
11270
+
11196
11271
  /**
11197
- * Service for work with Property Sold
11272
+ * Service for get property equity position half-year history chart data
11198
11273
  */
11199
- var PropertySoldService = /** @class */ (function (_super) {
11200
- __extends(PropertySoldService, _super);
11201
- function PropertySoldService() {
11274
+ var EquityPositionChartService = /** @class */ (function () {
11275
+ function EquityPositionChartService(http, environment) {
11276
+ this.http = http;
11277
+ this.environment = environment;
11278
+ }
11279
+ EquityPositionChartService.prototype.get = function () {
11280
+ // @TODO refactor backend
11281
+ return this.http.get(this.environment.apiV2 + "/properties/categories/equity")
11282
+ .pipe(operators.map(function (response) {
11283
+ return response.map(function (item) {
11284
+ return classTransformer.plainToClass(ChartData, {
11285
+ name: item.category.name,
11286
+ data: item.equity.map(function (serie) {
11287
+ return classTransformer.plainToClass(ChartSerie, {
11288
+ label: serie.date,
11289
+ value: serie.amount
11290
+ });
11291
+ })
11292
+ });
11293
+ });
11294
+ }));
11295
+ };
11296
+ return EquityPositionChartService;
11297
+ }());
11298
+ EquityPositionChartService.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: EquityPositionChartService, deps: [{ token: i1__namespace.HttpClient }, { token: 'environment' }], target: i0__namespace.ɵɵFactoryTarget.Injectable });
11299
+ EquityPositionChartService.ɵprov = i0__namespace.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: EquityPositionChartService, providedIn: 'root' });
11300
+ i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: EquityPositionChartService, decorators: [{
11301
+ type: i0.Injectable,
11302
+ args: [{
11303
+ providedIn: 'root'
11304
+ }]
11305
+ }], ctorParameters: function () {
11306
+ return [{ type: i1__namespace.HttpClient }, { type: undefined, decorators: [{
11307
+ type: i0.Inject,
11308
+ args: ['environment']
11309
+ }] }];
11310
+ } });
11311
+
11312
+ var PropertyCategoryMovementService = /** @class */ (function (_super) {
11313
+ __extends(PropertyCategoryMovementService, _super);
11314
+ function PropertyCategoryMovementService() {
11202
11315
  var _this = _super.apply(this, __spreadArray([], __read(arguments))) || this;
11203
- _this.modelClass = PropertySold;
11204
- _this.url = 'properties/sold';
11316
+ _this.modelClass = PropertyCategoryMovement;
11317
+ _this.url = 'properties/category-movements';
11205
11318
  return _this;
11206
11319
  }
11207
- return PropertySoldService;
11320
+ PropertyCategoryMovementService.prototype.add = function (model) {
11321
+ var _this = this;
11322
+ return _super.prototype.add.call(this, model).pipe(operators.map(function (newMovement) {
11323
+ // @TODO Alex: we need to teach restService to dispatch events + limit list of methods (not all services have all 4 or even more considering batch requests) + collections
11324
+ _this.eventDispatcherService.dispatch(new AppEvent(exports.AppEventTypeEnum.PROPERTY_MOVEMENT_CREATED, null));
11325
+ return newMovement;
11326
+ }));
11327
+ };
11328
+ PropertyCategoryMovementService.prototype.update = function (model) {
11329
+ var _this = this;
11330
+ return _super.prototype.update.call(this, model).pipe(operators.map(function (updatedMovement) {
11331
+ _this.eventDispatcherService.dispatch(new AppEvent(exports.AppEventTypeEnum.PROPERTY_MOVEMENT_CREATED, null));
11332
+ return updatedMovement;
11333
+ }));
11334
+ };
11335
+ PropertyCategoryMovementService.prototype.delete = function (model) {
11336
+ var _this = this;
11337
+ return _super.prototype.delete.call(this, model).pipe(operators.map(function () {
11338
+ _this.eventDispatcherService.dispatch(new AppEvent(exports.AppEventTypeEnum.PROPERTY_MOVEMENT_CREATED, null));
11339
+ }));
11340
+ };
11341
+ // @TODO Alex: Move to collection
11342
+ PropertyCategoryMovementService.prototype.getByPropertyId = function (id) {
11343
+ return this.get().pipe(operators.map(function (movements) {
11344
+ return movements.filter(function (movement) { return movement.property.id === id; });
11345
+ }));
11346
+ };
11347
+ return PropertyCategoryMovementService;
11208
11348
  }(BaseRestService));
11209
- PropertySoldService.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: PropertySoldService, deps: null, target: i0__namespace.ɵɵFactoryTarget.Injectable });
11210
- PropertySoldService.ɵprov = i0__namespace.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: PropertySoldService, providedIn: 'root' });
11211
- i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: PropertySoldService, decorators: [{
11349
+ PropertyCategoryMovementService.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: PropertyCategoryMovementService, deps: null, target: i0__namespace.ɵɵFactoryTarget.Injectable });
11350
+ PropertyCategoryMovementService.ɵprov = i0__namespace.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: PropertyCategoryMovementService, providedIn: 'root' });
11351
+ i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: PropertyCategoryMovementService, decorators: [{
11212
11352
  type: i0.Injectable,
11213
11353
  args: [{
11214
11354
  providedIn: 'root'
@@ -12548,6 +12688,26 @@
12548
12688
  }]
12549
12689
  }] });
12550
12690
 
12691
+ var TaxExemptionService = /** @class */ (function (_super) {
12692
+ __extends(TaxExemptionService, _super);
12693
+ function TaxExemptionService() {
12694
+ var _this = _super.apply(this, __spreadArray([], __read(arguments))) || this;
12695
+ _this.modelClass = TaxExemption;
12696
+ _this.url = 'tax-exemptions';
12697
+ _this.isHydra = true;
12698
+ return _this;
12699
+ }
12700
+ return TaxExemptionService;
12701
+ }(BaseRestService));
12702
+ TaxExemptionService.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: TaxExemptionService, deps: null, target: i0__namespace.ɵɵFactoryTarget.Injectable });
12703
+ TaxExemptionService.ɵprov = i0__namespace.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: TaxExemptionService, providedIn: 'root' });
12704
+ i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: TaxExemptionService, decorators: [{
12705
+ type: i0.Injectable,
12706
+ args: [{
12707
+ providedIn: 'root'
12708
+ }]
12709
+ }] });
12710
+
12551
12711
  // deep clone for entity
12552
12712
  function cloneDeep(array) {
12553
12713
  return JSON.parse(JSON.stringify(array));
@@ -12619,6 +12779,104 @@
12619
12779
  data.employee.fullName.toLowerCase().includes(filter);
12620
12780
  }
12621
12781
 
12782
+ var AbstractForm = /** @class */ (function (_super) {
12783
+ __extends(AbstractForm, _super);
12784
+ function AbstractForm() {
12785
+ return _super !== null && _super.apply(this, arguments) || this;
12786
+ }
12787
+ AbstractForm.prototype.submit = function () {
12788
+ this.markAllAsTouched();
12789
+ if (!this.valid) {
12790
+ return null;
12791
+ }
12792
+ return this.value;
12793
+ };
12794
+ return AbstractForm;
12795
+ }(forms.FormGroup));
12796
+
12797
+ var LoginForm = /** @class */ (function (_super) {
12798
+ __extends(LoginForm, _super);
12799
+ function LoginForm() {
12800
+ return _super.call(this, {
12801
+ email: new forms.FormControl(null, [forms.Validators.required, forms.Validators.email]),
12802
+ password: new forms.FormControl(null, forms.Validators.required)
12803
+ }) || this;
12804
+ }
12805
+ return LoginForm;
12806
+ }(AbstractForm));
12807
+
12808
+ var PasswordForm = /** @class */ (function (_super) {
12809
+ __extends(PasswordForm, _super);
12810
+ function PasswordForm() {
12811
+ return _super.call(this, {
12812
+ password: new forms.FormControl('', forms.Validators.required),
12813
+ confirm: new forms.FormControl('', forms.Validators.required),
12814
+ }) || this;
12815
+ }
12816
+ return PasswordForm;
12817
+ }(AbstractForm));
12818
+
12819
+ var RegisterClientForm = /** @class */ (function (_super) {
12820
+ __extends(RegisterClientForm, _super);
12821
+ function RegisterClientForm(referenceCode) {
12822
+ return _super.call(this, {
12823
+ firstName: new forms.FormControl('', [forms.Validators.required]),
12824
+ lastName: new forms.FormControl('', [forms.Validators.required]),
12825
+ email: new forms.FormControl('', [forms.Validators.required, forms.Validators.email]),
12826
+ password: new PasswordForm(),
12827
+ acceptTerms: new forms.FormControl(false, [forms.Validators.requiredTrue]),
12828
+ referenceCode: new forms.FormControl(referenceCode)
12829
+ }) || this;
12830
+ }
12831
+ RegisterClientForm.prototype.submit = function () {
12832
+ this.markAllAsTouched();
12833
+ if (!this.valid) {
12834
+ return null;
12835
+ }
12836
+ return {
12837
+ firstName: this.value.firstName,
12838
+ lastName: this.value.lastName,
12839
+ email: this.value.email,
12840
+ password: this.value.password.password,
12841
+ referenceCode: this.value.referenceCode
12842
+ };
12843
+ };
12844
+ return RegisterClientForm;
12845
+ }(AbstractForm));
12846
+
12847
+ var RegisterFirmForm = /** @class */ (function (_super) {
12848
+ __extends(RegisterFirmForm, _super);
12849
+ function RegisterFirmForm(firmType, referenceCode) {
12850
+ var _this = _super.call(this, {
12851
+ name: new forms.FormControl('', forms.Validators.required),
12852
+ abn: new forms.FormControl('', forms.Validators.required),
12853
+ tan: new forms.FormControl({ value: '', disabled: firmType !== exports.FirmTypeEnum.ACCOUNTANT }, forms.Validators.required),
12854
+ owner: new RegisterClientForm(referenceCode),
12855
+ type: new forms.FormControl(firmType)
12856
+ }) || this;
12857
+ _this.firmType = firmType;
12858
+ return _this;
12859
+ }
12860
+ RegisterFirmForm.prototype.submit = function () {
12861
+ this.markAllAsTouched();
12862
+ if (!this.valid) {
12863
+ return null;
12864
+ }
12865
+ return classTransformer.plainToClass(Firm, Object.assign({}, this.value, { owner: this.get('owner').submit() }));
12866
+ };
12867
+ return RegisterFirmForm;
12868
+ }(AbstractForm));
12869
+
12870
+ var ResetPasswordForm = /** @class */ (function (_super) {
12871
+ __extends(ResetPasswordForm, _super);
12872
+ function ResetPasswordForm() {
12873
+ return _super.call(this, {
12874
+ email: new forms.FormControl(null, [forms.Validators.required, forms.Validators.email]),
12875
+ }) || this;
12876
+ }
12877
+ return ResetPasswordForm;
12878
+ }(AbstractForm));
12879
+
12622
12880
  /**
12623
12881
  * Public API Surface of tt-core
12624
12882
  */
@@ -12627,6 +12885,7 @@
12627
12885
  * Generated bundle index. Do not edit.
12628
12886
  */
12629
12887
 
12888
+ exports.AbstractForm = AbstractForm;
12630
12889
  exports.Address = Address;
12631
12890
  exports.AddressService = AddressService;
12632
12891
  exports.AppEvent = AppEvent;
@@ -12732,6 +12991,7 @@
12732
12991
  exports.LoanService = LoanService;
12733
12992
  exports.LogbookCollection = LogbookCollection;
12734
12993
  exports.LogbookPeriod = LogbookPeriod;
12994
+ exports.LoginForm = LoginForm;
12735
12995
  exports.MODULE_URL_LIST = MODULE_URL_LIST;
12736
12996
  exports.MONTHS = MONTHS;
12737
12997
  exports.Message = Message;
@@ -12745,13 +13005,12 @@
12745
13005
  exports.NotificationService = NotificationService;
12746
13006
  exports.Occupation = Occupation;
12747
13007
  exports.OccupationService = OccupationService;
13008
+ exports.PasswordForm = PasswordForm;
12748
13009
  exports.PdfService = PdfService;
12749
13010
  exports.Phone = Phone;
12750
13011
  exports.PreloaderService = PreloaderService;
12751
13012
  exports.Property = Property;
12752
13013
  exports.PropertyCalculationService = PropertyCalculationService;
12753
- exports.PropertyCapitalCost = PropertyCapitalCost;
12754
- exports.PropertyCapitalCostService = PropertyCapitalCostService;
12755
13014
  exports.PropertyCategory = PropertyCategory;
12756
13015
  exports.PropertyCategoryMovement = PropertyCategoryMovement;
12757
13016
  exports.PropertyCategoryMovementService = PropertyCategoryMovementService;
@@ -12764,12 +13023,16 @@
12764
13023
  exports.PropertyForecast = PropertyForecast;
12765
13024
  exports.PropertyOwner = PropertyOwner;
12766
13025
  exports.PropertyOwnerService = PropertyOwnerService;
13026
+ exports.PropertySale = PropertySale;
13027
+ exports.PropertySaleService = PropertySaleService;
13028
+ exports.PropertySaleTaxExemptionMetadata = PropertySaleTaxExemptionMetadata;
12767
13029
  exports.PropertyService = PropertyService;
12768
- exports.PropertySold = PropertySold;
12769
- exports.PropertySoldService = PropertySoldService;
12770
13030
  exports.PropertySubscription = PropertySubscription;
12771
13031
  exports.PropertyValuation = PropertyValuation;
13032
+ exports.RegisterClientForm = RegisterClientForm;
13033
+ exports.RegisterFirmForm = RegisterFirmForm;
12772
13034
  exports.RegistrationInvite = RegistrationInvite;
13035
+ exports.ResetPasswordForm = ResetPasswordForm;
12773
13036
  exports.SUBSCRIPTION_DESCRIPTION = SUBSCRIPTION_DESCRIPTION;
12774
13037
  exports.SUBSCRIPTION_TITLE = SUBSCRIPTION_TITLE;
12775
13038
  exports.SalaryForecast = SalaryForecast;
@@ -12786,6 +13049,9 @@
12786
13049
  exports.SseService = SseService;
12787
13050
  exports.SubscriptionService = SubscriptionService;
12788
13051
  exports.TYPE_LOAN = TYPE_LOAN;
13052
+ exports.TaxExemption = TaxExemption;
13053
+ exports.TaxExemptionMetadata = TaxExemptionMetadata;
13054
+ exports.TaxExemptionService = TaxExemptionService;
12789
13055
  exports.TaxReturnCategoryItem = TaxReturnCategoryItem;
12790
13056
  exports.TaxReturnCategoryItemCollection = TaxReturnCategoryItemCollection;
12791
13057
  exports.TaxReturnCategoryItemDetails = TaxReturnCategoryItemDetails;