taxtank-core 0.27.2 → 0.27.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.
Files changed (54) hide show
  1. package/bundles/taxtank-core.umd.js +253 -69
  2. package/bundles/taxtank-core.umd.js.map +1 -1
  3. package/esm2015/lib/collections/depreciation.collection.js +10 -9
  4. package/esm2015/lib/db/Enums/depreciation-calculation.enum.js +2 -2
  5. package/esm2015/lib/db/Enums/sole-depreciation-method.enum.js +6 -0
  6. package/esm2015/lib/db/Models/sole/sole-business-activity.js +4 -0
  7. package/esm2015/lib/db/Models/sole/sole-business.js +1 -1
  8. package/esm2015/lib/db/Models/sole/sole-depreciation-method.js +4 -0
  9. package/esm2015/lib/db/Models/sole/sole-details.js +1 -1
  10. package/esm2015/lib/forms/sole/index.js +2 -1
  11. package/esm2015/lib/forms/sole/sole-business.form.js +3 -3
  12. package/esm2015/lib/forms/sole/sole-depreciation-method.form.js +10 -0
  13. package/esm2015/lib/models/depreciation/depreciation-group.enum.js +2 -1
  14. package/esm2015/lib/models/depreciation/depreciation-groups.const.js +7 -2
  15. package/esm2015/lib/models/depreciation/depreciation.js +32 -25
  16. package/esm2015/lib/models/endpoint/endpoints.const.js +6 -4
  17. package/esm2015/lib/models/event/app-event-type.enum.js +33 -31
  18. package/esm2015/lib/models/report/depreciation/depreciation-report-item.js +2 -2
  19. package/esm2015/lib/models/report/my-tax/my-tax-deductions/my-tax-deductions.js +2 -2
  20. package/esm2015/lib/models/sole/index.js +3 -1
  21. package/esm2015/lib/models/sole/sole-business-activity.js +4 -0
  22. package/esm2015/lib/models/sole/sole-business.js +5 -1
  23. package/esm2015/lib/models/sole/sole-depreciation-method.js +8 -0
  24. package/esm2015/lib/services/http/depreciation/depreciation.service.js +19 -1
  25. package/esm2015/lib/services/http/property/property.service.js +8 -1
  26. package/esm2015/lib/services/http/sole/index.js +3 -1
  27. package/esm2015/lib/services/http/sole/sole-business-activity/sole-business-activity.service.js +21 -0
  28. package/esm2015/lib/services/http/sole/sole-depreciation-method/sole-depreciation-method.service.js +62 -0
  29. package/esm2015/public-api.js +2 -1
  30. package/fesm2015/taxtank-core.js +213 -71
  31. package/fesm2015/taxtank-core.js.map +1 -1
  32. package/lib/collections/depreciation.collection.d.ts +2 -1
  33. package/lib/db/Enums/depreciation-calculation.enum.d.ts +2 -2
  34. package/lib/db/Enums/sole-depreciation-method.enum.d.ts +4 -0
  35. package/lib/db/Models/sole/sole-business-activity.d.ts +6 -0
  36. package/lib/db/Models/sole/sole-business.d.ts +2 -1
  37. package/lib/db/Models/sole/sole-depreciation-method.d.ts +10 -0
  38. package/lib/forms/sole/index.d.ts +1 -0
  39. package/lib/forms/sole/sole-business.form.d.ts +1 -1
  40. package/lib/forms/sole/sole-depreciation-method.form.d.ts +5 -0
  41. package/lib/models/depreciation/depreciation-group.enum.d.ts +2 -1
  42. package/lib/models/depreciation/depreciation.d.ts +9 -16
  43. package/lib/models/event/app-event-type.enum.d.ts +32 -30
  44. package/lib/models/sole/index.d.ts +2 -0
  45. package/lib/models/sole/sole-business-activity.d.ts +3 -0
  46. package/lib/models/sole/sole-business.d.ts +2 -0
  47. package/lib/models/sole/sole-depreciation-method.d.ts +4 -0
  48. package/lib/services/http/depreciation/depreciation.service.d.ts +8 -0
  49. package/lib/services/http/property/property.service.d.ts +1 -0
  50. package/lib/services/http/sole/index.d.ts +2 -0
  51. package/lib/services/http/sole/sole-business-activity/sole-business-activity.service.d.ts +11 -0
  52. package/lib/services/http/sole/sole-depreciation-method/sole-depreciation-method.service.d.ts +23 -0
  53. package/package.json +1 -1
  54. package/public-api.d.ts +1 -0
@@ -575,36 +575,38 @@
575
575
  AppEventTypeEnum[AppEventTypeEnum["MESSAGE_FILE_CREATED"] = 25] = "MESSAGE_FILE_CREATED";
576
576
  AppEventTypeEnum[AppEventTypeEnum["MESSAGE_FILE_DELETED"] = 26] = "MESSAGE_FILE_DELETED";
577
577
  AppEventTypeEnum[AppEventTypeEnum["NOTIFICATION_ADDED"] = 27] = "NOTIFICATION_ADDED";
578
- AppEventTypeEnum[AppEventTypeEnum["PROPERTY_UPDATED_WITH_DOCUMENT"] = 28] = "PROPERTY_UPDATED_WITH_DOCUMENT";
579
- AppEventTypeEnum[AppEventTypeEnum["PROPERTY_DOCUMENT_ADDED"] = 29] = "PROPERTY_DOCUMENT_ADDED";
580
- AppEventTypeEnum[AppEventTypeEnum["PROPERTY_MOVEMENT_CREATED"] = 30] = "PROPERTY_MOVEMENT_CREATED";
581
- AppEventTypeEnum[AppEventTypeEnum["PROPERTY_MOVEMENT_UPDATED"] = 31] = "PROPERTY_MOVEMENT_UPDATED";
582
- AppEventTypeEnum[AppEventTypeEnum["PROPERTY_MOVEMENT_DELETED"] = 32] = "PROPERTY_MOVEMENT_DELETED";
583
- AppEventTypeEnum[AppEventTypeEnum["PROPERTY_SHARE_UPDATED"] = 33] = "PROPERTY_SHARE_UPDATED";
584
- AppEventTypeEnum[AppEventTypeEnum["PROPERTY_SALE_ADDED"] = 34] = "PROPERTY_SALE_ADDED";
585
- AppEventTypeEnum[AppEventTypeEnum["PROPERTY_SALE_DELETED"] = 35] = "PROPERTY_SALE_DELETED";
586
- AppEventTypeEnum[AppEventTypeEnum["PROPERTY_SUBSCRIPTION_ADDED"] = 36] = "PROPERTY_SUBSCRIPTION_ADDED";
587
- AppEventTypeEnum[AppEventTypeEnum["PROPERTY_SUBSCRIPTION_DELETED"] = 37] = "PROPERTY_SUBSCRIPTION_DELETED";
588
- AppEventTypeEnum[AppEventTypeEnum["PROPERTY_VALUATION_DOCUMENT_CREATED"] = 38] = "PROPERTY_VALUATION_DOCUMENT_CREATED";
589
- AppEventTypeEnum[AppEventTypeEnum["SERVICE_SUBSCRIPTION_UPDATED"] = 39] = "SERVICE_SUBSCRIPTION_UPDATED";
590
- AppEventTypeEnum[AppEventTypeEnum["TAX_REVIEW_UPDATED"] = 40] = "TAX_REVIEW_UPDATED";
591
- AppEventTypeEnum[AppEventTypeEnum["TRANSACTION_CREATED"] = 41] = "TRANSACTION_CREATED";
592
- AppEventTypeEnum[AppEventTypeEnum["TRANSACTION_DELETED"] = 42] = "TRANSACTION_DELETED";
593
- AppEventTypeEnum[AppEventTypeEnum["TRANSACTION_UPDATED"] = 43] = "TRANSACTION_UPDATED";
594
- AppEventTypeEnum[AppEventTypeEnum["TRANSACTION_UPDATED_WITH_RECEIPT"] = 44] = "TRANSACTION_UPDATED_WITH_RECEIPT";
595
- AppEventTypeEnum[AppEventTypeEnum["TRANSACTION_UPDATED_WITH_DELETED_RECEIPT"] = 45] = "TRANSACTION_UPDATED_WITH_DELETED_RECEIPT";
596
- AppEventTypeEnum[AppEventTypeEnum["TRANSACTION_RECEIPT_CREATED"] = 46] = "TRANSACTION_RECEIPT_CREATED";
597
- AppEventTypeEnum[AppEventTypeEnum["TRANSACTION_RECEIPT_DELETED"] = 47] = "TRANSACTION_RECEIPT_DELETED";
598
- AppEventTypeEnum[AppEventTypeEnum["TRANSACTIONS_CREATED"] = 48] = "TRANSACTIONS_CREATED";
599
- AppEventTypeEnum[AppEventTypeEnum["USER_UPDATED"] = 49] = "USER_UPDATED";
600
- AppEventTypeEnum[AppEventTypeEnum["VEHICLE_CLAIM_UPDATED"] = 50] = "VEHICLE_CLAIM_UPDATED";
601
- AppEventTypeEnum[AppEventTypeEnum["VEHICLE_CLAIM_CREATED"] = 51] = "VEHICLE_CLAIM_CREATED";
602
- AppEventTypeEnum[AppEventTypeEnum["VEHICLE_CLAIM_DETAILS_UPDATED"] = 52] = "VEHICLE_CLAIM_DETAILS_UPDATED";
603
- AppEventTypeEnum[AppEventTypeEnum["VEHICLE_CLAIM_DETAILS_CREATED"] = 53] = "VEHICLE_CLAIM_DETAILS_CREATED";
604
- AppEventTypeEnum[AppEventTypeEnum["VEHICLE_LOGBOOK_CREATED"] = 54] = "VEHICLE_LOGBOOK_CREATED";
605
- AppEventTypeEnum[AppEventTypeEnum["VEHICLE_LOGBOOK_UPDATED"] = 55] = "VEHICLE_LOGBOOK_UPDATED";
606
- AppEventTypeEnum[AppEventTypeEnum["VEHICLE_LOGBOOK_DELETED"] = 56] = "VEHICLE_LOGBOOK_DELETED";
607
- AppEventTypeEnum[AppEventTypeEnum["VEHICLE_LOGBOOK_BEST_PERIOD_UPDATED"] = 57] = "VEHICLE_LOGBOOK_BEST_PERIOD_UPDATED";
578
+ AppEventTypeEnum[AppEventTypeEnum["PROPERTY_DEPRECIATION_CALCULATION_UPDATED"] = 28] = "PROPERTY_DEPRECIATION_CALCULATION_UPDATED";
579
+ AppEventTypeEnum[AppEventTypeEnum["PROPERTY_UPDATED_WITH_DOCUMENT"] = 29] = "PROPERTY_UPDATED_WITH_DOCUMENT";
580
+ AppEventTypeEnum[AppEventTypeEnum["PROPERTY_DOCUMENT_ADDED"] = 30] = "PROPERTY_DOCUMENT_ADDED";
581
+ AppEventTypeEnum[AppEventTypeEnum["PROPERTY_MOVEMENT_CREATED"] = 31] = "PROPERTY_MOVEMENT_CREATED";
582
+ AppEventTypeEnum[AppEventTypeEnum["PROPERTY_MOVEMENT_UPDATED"] = 32] = "PROPERTY_MOVEMENT_UPDATED";
583
+ AppEventTypeEnum[AppEventTypeEnum["PROPERTY_MOVEMENT_DELETED"] = 33] = "PROPERTY_MOVEMENT_DELETED";
584
+ AppEventTypeEnum[AppEventTypeEnum["PROPERTY_SHARE_UPDATED"] = 34] = "PROPERTY_SHARE_UPDATED";
585
+ AppEventTypeEnum[AppEventTypeEnum["PROPERTY_SALE_ADDED"] = 35] = "PROPERTY_SALE_ADDED";
586
+ AppEventTypeEnum[AppEventTypeEnum["PROPERTY_SALE_DELETED"] = 36] = "PROPERTY_SALE_DELETED";
587
+ AppEventTypeEnum[AppEventTypeEnum["PROPERTY_SUBSCRIPTION_ADDED"] = 37] = "PROPERTY_SUBSCRIPTION_ADDED";
588
+ AppEventTypeEnum[AppEventTypeEnum["PROPERTY_SUBSCRIPTION_DELETED"] = 38] = "PROPERTY_SUBSCRIPTION_DELETED";
589
+ AppEventTypeEnum[AppEventTypeEnum["PROPERTY_VALUATION_DOCUMENT_CREATED"] = 39] = "PROPERTY_VALUATION_DOCUMENT_CREATED";
590
+ AppEventTypeEnum[AppEventTypeEnum["SERVICE_SUBSCRIPTION_UPDATED"] = 40] = "SERVICE_SUBSCRIPTION_UPDATED";
591
+ AppEventTypeEnum[AppEventTypeEnum["SOLE_DEPRECIATION_METHOD_UPDATED"] = 41] = "SOLE_DEPRECIATION_METHOD_UPDATED";
592
+ AppEventTypeEnum[AppEventTypeEnum["TAX_REVIEW_UPDATED"] = 42] = "TAX_REVIEW_UPDATED";
593
+ AppEventTypeEnum[AppEventTypeEnum["TRANSACTION_CREATED"] = 43] = "TRANSACTION_CREATED";
594
+ AppEventTypeEnum[AppEventTypeEnum["TRANSACTION_DELETED"] = 44] = "TRANSACTION_DELETED";
595
+ AppEventTypeEnum[AppEventTypeEnum["TRANSACTION_UPDATED"] = 45] = "TRANSACTION_UPDATED";
596
+ AppEventTypeEnum[AppEventTypeEnum["TRANSACTION_UPDATED_WITH_RECEIPT"] = 46] = "TRANSACTION_UPDATED_WITH_RECEIPT";
597
+ AppEventTypeEnum[AppEventTypeEnum["TRANSACTION_UPDATED_WITH_DELETED_RECEIPT"] = 47] = "TRANSACTION_UPDATED_WITH_DELETED_RECEIPT";
598
+ AppEventTypeEnum[AppEventTypeEnum["TRANSACTION_RECEIPT_CREATED"] = 48] = "TRANSACTION_RECEIPT_CREATED";
599
+ AppEventTypeEnum[AppEventTypeEnum["TRANSACTION_RECEIPT_DELETED"] = 49] = "TRANSACTION_RECEIPT_DELETED";
600
+ AppEventTypeEnum[AppEventTypeEnum["TRANSACTIONS_CREATED"] = 50] = "TRANSACTIONS_CREATED";
601
+ AppEventTypeEnum[AppEventTypeEnum["USER_UPDATED"] = 51] = "USER_UPDATED";
602
+ AppEventTypeEnum[AppEventTypeEnum["VEHICLE_CLAIM_UPDATED"] = 52] = "VEHICLE_CLAIM_UPDATED";
603
+ AppEventTypeEnum[AppEventTypeEnum["VEHICLE_CLAIM_CREATED"] = 53] = "VEHICLE_CLAIM_CREATED";
604
+ AppEventTypeEnum[AppEventTypeEnum["VEHICLE_CLAIM_DETAILS_UPDATED"] = 54] = "VEHICLE_CLAIM_DETAILS_UPDATED";
605
+ AppEventTypeEnum[AppEventTypeEnum["VEHICLE_CLAIM_DETAILS_CREATED"] = 55] = "VEHICLE_CLAIM_DETAILS_CREATED";
606
+ AppEventTypeEnum[AppEventTypeEnum["VEHICLE_LOGBOOK_CREATED"] = 56] = "VEHICLE_LOGBOOK_CREATED";
607
+ AppEventTypeEnum[AppEventTypeEnum["VEHICLE_LOGBOOK_UPDATED"] = 57] = "VEHICLE_LOGBOOK_UPDATED";
608
+ AppEventTypeEnum[AppEventTypeEnum["VEHICLE_LOGBOOK_DELETED"] = 58] = "VEHICLE_LOGBOOK_DELETED";
609
+ AppEventTypeEnum[AppEventTypeEnum["VEHICLE_LOGBOOK_BEST_PERIOD_UPDATED"] = 59] = "VEHICLE_LOGBOOK_BEST_PERIOD_UPDATED";
608
610
  })(exports.AppEventTypeEnum || (exports.AppEventTypeEnum = {}));
609
611
 
610
612
  var EventDispatcherService = /** @class */ (function () {
@@ -1054,11 +1056,13 @@
1054
1056
  SUBSCRIPTION_ITEMS_PUT: new Endpoint('PUT', '\\/subscriptions\\/items'),
1055
1057
  SOLE_BUSINESSES_GET: new Endpoint('GET', '\\/sole-businesses'),
1056
1058
  SOLE_BUSINESSES_POST: new Endpoint('POST', '\\/sole-businesses'),
1057
- SOLE_BUSINESSES_PUT: new Endpoint('PUT', '\\/sole-businesses\\d+'),
1059
+ SOLE_BUSINESSES_PUT: new Endpoint('PUT', '\\/sole-businesses\\/\\d+'),
1060
+ SOLE_DEPRECIATION_METHODS_GET: new Endpoint('GET', '\\/sole-depreciation-methods'),
1061
+ SOLE_DEPRECIATION_METHODS_PUT: new Endpoint('PUT', '\\/sole-depreciation-methods\\/\\d+'),
1058
1062
  SOLE_INVOICE_TEMPLATES_GET: new Endpoint('GET', '\\/sole-invoice-templates'),
1059
1063
  SOLE_INVOICE_TEMPLATES_POST: new Endpoint('POST', '\\/sole-invoice-templates'),
1060
- SOLE_INVOICE_TEMPLATES_PUT: new Endpoint('PUT', '\\/sole-invoice-templates\\d+'),
1061
- SOLE_INVOICE_TEMPLATES_DELETE: new Endpoint('DELETE', '\\/sole-invoice-templates\\d+'),
1064
+ SOLE_INVOICE_TEMPLATES_PUT: new Endpoint('PUT', '\\/sole-invoice-templates\\/\\d+'),
1065
+ SOLE_INVOICE_TEMPLATES_DELETE: new Endpoint('DELETE', '\\/sole-invoice-templates\\/\\d+'),
1062
1066
  TAX_CALCULATION_POST: new Endpoint('POST', '\\/tax-calculation'),
1063
1067
  TAX_REVIEWS_GET: new Endpoint('GET', '\\/tax-reviews'),
1064
1068
  TAX_REVIEWS_DELETE: new Endpoint('DELETE', '\\/tax-reviews\\/\\d+'),
@@ -3517,9 +3521,9 @@
3517
3521
  (function (DepreciationCalculationEnum) {
3518
3522
  DepreciationCalculationEnum[DepreciationCalculationEnum["PRIME_COST"] = 1] = "PRIME_COST";
3519
3523
  DepreciationCalculationEnum[DepreciationCalculationEnum["DIMINISHING"] = 2] = "DIMINISHING";
3520
- DepreciationCalculationEnum[DepreciationCalculationEnum["CAPITAL"] = 3] = "CAPITAL";
3521
3524
  DepreciationCalculationEnum[DepreciationCalculationEnum["LVP"] = 4] = "LVP";
3522
3525
  DepreciationCalculationEnum[DepreciationCalculationEnum["AMORTISATION"] = 5] = "AMORTISATION";
3526
+ DepreciationCalculationEnum[DepreciationCalculationEnum["SBP"] = 6] = "SBP";
3523
3527
  })(exports.DepreciationCalculationEnum || (exports.DepreciationCalculationEnum = {}));
3524
3528
 
3525
3529
  var DepreciationCapitalProject$1 = /** @class */ (function (_super) {
@@ -4314,6 +4318,9 @@
4314
4318
  classTransformer.Type(function () { return Date; })
4315
4319
  ], BankTransaction.prototype, "date", void 0);
4316
4320
 
4321
+ /**
4322
+ * @TODO Alex: clarify grouping rules and refactor
4323
+ */
4317
4324
  var Depreciation = /** @class */ (function (_super) {
4318
4325
  __extends(Depreciation, _super);
4319
4326
  function Depreciation() {
@@ -4326,6 +4333,7 @@
4326
4333
  _this.amount = 0;
4327
4334
  return _this;
4328
4335
  }
4336
+ // Type checking
4329
4337
  Depreciation.prototype.isCapital = function () {
4330
4338
  return this.type === exports.DepreciationTypeEnum.CAPITAL_WORKS;
4331
4339
  };
@@ -4335,30 +4343,9 @@
4335
4343
  Depreciation.prototype.isAsset = function () {
4336
4344
  return this.type === exports.DepreciationTypeEnum.PLANT_EQUIPMENT;
4337
4345
  };
4338
- /**
4339
- * check if depreciation should be displayed in written off category
4340
- * details in project documentation
4341
- * @TODO new FinancialYear(this.writeOffDate) === new FinancialYear()
4342
- */
4343
- Depreciation.prototype.isWrittenOff = function () {
4344
- return this.isAsset && this.writeOffDate && new FinancialYear(this.writeOffDate).year === this.financialYear;
4345
- };
4346
- /**
4347
- * Check if depreciation is Plant & Equipment
4348
- */
4349
- Depreciation.prototype.isPlantEquipment = function () {
4350
- return this.isAsset() && !this.isWrittenOff() && !this.isLowValuePool();
4351
- };
4352
- /**
4353
- * check if depreciation should be displayed in low value pool
4354
- * details in project documentation
4355
- * @TODO new FinancialYear(this.writeOffDate) === new FinancialYear()
4356
- */
4357
- Depreciation.prototype.isLowValuePool = function () {
4358
- return this.isAsset &&
4359
- this.calculation === exports.DepreciationCalculationEnum.DIMINISHING &&
4360
- this.amount > Depreciation.WRITTEN_OFF_THRESHOLD &&
4361
- this.amount <= Depreciation.LOW_VALUE_POOL_THRESHOLD;
4346
+ // Calculation checking
4347
+ Depreciation.prototype.isSBPCalculation = function () {
4348
+ return this.calculation === exports.DepreciationCalculationEnum.SBP;
4362
4349
  };
4363
4350
  Depreciation.prototype.isPrimeCost = function () {
4364
4351
  return this.calculation === exports.DepreciationCalculationEnum.PRIME_COST;
@@ -4366,6 +4353,34 @@
4366
4353
  Depreciation.prototype.isDiminishing = function () {
4367
4354
  return this.calculation === exports.DepreciationCalculationEnum.DIMINISHING;
4368
4355
  };
4356
+ // Pool checking
4357
+ Depreciation.prototype.isPlantEquipmentPool = function () {
4358
+ return this.isAsset() && !this.isSBPCalculation() && !this.isWrittenOff() && !this.isLVP();
4359
+ };
4360
+ Depreciation.prototype.isLVP = function () {
4361
+ return this.isAsset()
4362
+ && !this.isSBPCalculation()
4363
+ && this.isDiminishing()
4364
+ && this.currentYearForecast.closeBalance > Depreciation.WRITTEN_OFF_THRESHOLD
4365
+ && this.currentYearForecast.closeBalance <= Depreciation.LOW_VALUE_POOL_THRESHOLD;
4366
+ };
4367
+ Depreciation.prototype.isSBP = function () {
4368
+ return this.isAsset() && this.isSBPCalculation() && !this.isWrittenOff();
4369
+ };
4370
+ Depreciation.prototype.isWrittenOff = function () {
4371
+ return this.writeOffYear === new FinancialYear().year;
4372
+ };
4373
+ Object.defineProperty(Depreciation.prototype, "writeOffYear", {
4374
+ get: function () {
4375
+ var _a;
4376
+ if (!this.writeOffManualDate && !this.writeOffDate) {
4377
+ return null;
4378
+ }
4379
+ return (_a = new FinancialYear(this.writeOffManualDate || this.writeOffDate)) === null || _a === void 0 ? void 0 : _a.year;
4380
+ },
4381
+ enumerable: false,
4382
+ configurable: true
4383
+ });
4369
4384
  /**
4370
4385
  * Check if depreciation chart accounts heading related to vehicles category
4371
4386
  */
@@ -4479,6 +4494,14 @@
4479
4494
  classTransformer.Type(function () { return BankTransaction; })
4480
4495
  ], Depreciation.prototype, "bankTransaction", void 0);
4481
4496
 
4497
+ var SoleBusinessActivity$1 = /** @class */ (function (_super) {
4498
+ __extends(SoleBusinessActivity, _super);
4499
+ function SoleBusinessActivity() {
4500
+ return _super !== null && _super.apply(this, arguments) || this;
4501
+ }
4502
+ return SoleBusinessActivity;
4503
+ }(AbstractModel));
4504
+
4482
4505
  var SoleBusiness = /** @class */ (function (_super) {
4483
4506
  __extends(SoleBusiness, _super);
4484
4507
  function SoleBusiness() {
@@ -4520,6 +4543,42 @@
4520
4543
  __decorate([
4521
4544
  classTransformer.Type(function () { return Depreciation; })
4522
4545
  ], SoleBusiness.prototype, "depreciations", void 0);
4546
+ __decorate([
4547
+ classTransformer.Type(function () { return SoleBusinessActivity$1; })
4548
+ ], SoleBusiness.prototype, "activity", void 0);
4549
+
4550
+ var SoleBusinessActivity = /** @class */ (function (_super) {
4551
+ __extends(SoleBusinessActivity, _super);
4552
+ function SoleBusinessActivity() {
4553
+ return _super !== null && _super.apply(this, arguments) || this;
4554
+ }
4555
+ return SoleBusinessActivity;
4556
+ }(SoleBusinessActivity$1));
4557
+
4558
+ var SoleDepreciationMethod$1 = /** @class */ (function (_super) {
4559
+ __extends(SoleDepreciationMethod, _super);
4560
+ function SoleDepreciationMethod() {
4561
+ return _super !== null && _super.apply(this, arguments) || this;
4562
+ }
4563
+ return SoleDepreciationMethod;
4564
+ }(AbstractModel));
4565
+
4566
+ exports.SoleDepreciationMethodEnum = void 0;
4567
+ (function (SoleDepreciationMethodEnum) {
4568
+ SoleDepreciationMethodEnum[SoleDepreciationMethodEnum["SBP"] = 1] = "SBP";
4569
+ SoleDepreciationMethodEnum[SoleDepreciationMethodEnum["DEPRECIATION"] = 2] = "DEPRECIATION";
4570
+ })(exports.SoleDepreciationMethodEnum || (exports.SoleDepreciationMethodEnum = {}));
4571
+
4572
+ var SoleDepreciationMethod = /** @class */ (function (_super) {
4573
+ __extends(SoleDepreciationMethod, _super);
4574
+ function SoleDepreciationMethod() {
4575
+ return _super !== null && _super.apply(this, arguments) || this;
4576
+ }
4577
+ SoleDepreciationMethod.prototype.isSBP = function () {
4578
+ return this.method === exports.SoleDepreciationMethodEnum.SBP;
4579
+ };
4580
+ return SoleDepreciationMethod;
4581
+ }(SoleDepreciationMethod$1));
4523
4582
 
4524
4583
  var SoleDetails$1 = /** @class */ (function (_super) {
4525
4584
  __extends(SoleDetails, _super);
@@ -6832,19 +6891,22 @@
6832
6891
  return this.filter(function (depreciation) { return depreciation.isAsset(); });
6833
6892
  };
6834
6893
  DepreciationCollection.prototype.getPlantEquipment = function () {
6835
- return this.filter(function (depreciation) { return depreciation.isPlantEquipment(); });
6894
+ return this.filter(function (depreciation) { return depreciation.isPlantEquipmentPool(); });
6836
6895
  };
6837
6896
  DepreciationCollection.prototype.getCapitalDepreciations = function () {
6838
6897
  return this.filter(function (depreciation) { return depreciation.isCapital(); });
6839
6898
  };
6840
6899
  DepreciationCollection.prototype.getBorrowingExpenseDepreciations = function () {
6841
- return new DepreciationCollection(this.items.filter(function (depreciation) { return depreciation.isBorrowingExpense(); }));
6900
+ return this.filter(function (depreciation) { return depreciation.isBorrowingExpense(); });
6842
6901
  };
6843
6902
  DepreciationCollection.prototype.getWrittenOffDepreciations = function () {
6844
- return new DepreciationCollection(this.items.filter(function (depreciation) { return depreciation.isWrittenOff(); }));
6903
+ return this.filter(function (depreciation) { return depreciation.isWrittenOff(); });
6904
+ };
6905
+ DepreciationCollection.prototype.getLVPDepreciations = function () {
6906
+ return this.filter(function (depreciation) { return depreciation.isLVP(); });
6845
6907
  };
6846
- DepreciationCollection.prototype.getLowValuePoolDepreciations = function () {
6847
- return new DepreciationCollection(this.items.filter(function (depreciation) { return depreciation.isLowValuePool(); }));
6908
+ DepreciationCollection.prototype.getSBPDepreciations = function () {
6909
+ return this.filter(function (depreciation) { return depreciation.isSBP(); });
6848
6910
  };
6849
6911
  DepreciationCollection.prototype.getCapitalProjects = function () {
6850
6912
  return uniqBy__default["default"](compact__default["default"](this.items.map(function (depreciation) {
@@ -6855,9 +6917,7 @@
6855
6917
  * Get a new collection of depreciations related to vehicles
6856
6918
  */
6857
6919
  DepreciationCollection.prototype.getVehicleDepreciations = function () {
6858
- return this.create(this.items.filter(function (depreciation) {
6859
- return depreciation.isVehicleDepreciation();
6860
- }));
6920
+ return this.filter(function (depreciation) { return depreciation.isVehicleDepreciation(); });
6861
6921
  };
6862
6922
  DepreciationCollection.prototype.getByTankType = function (tankType) {
6863
6923
  return this.create(this.items.filter(function (depreciation) {
@@ -7274,7 +7334,7 @@
7274
7334
  Object.defineProperty(DepreciationReportItem.prototype, "categoryTitle", {
7275
7335
  get: function () {
7276
7336
  switch (true) {
7277
- case this.isPlantEquipment():
7337
+ case this.isPlantEquipmentPool():
7278
7338
  return 'Plant & Equipment';
7279
7339
  case this.isWrittenOff():
7280
7340
  return 'Written Off Items';
@@ -9127,6 +9187,7 @@
9127
9187
  DepreciationGroupEnum[DepreciationGroupEnum["LOW_VALUE_POOL"] = 2] = "LOW_VALUE_POOL";
9128
9188
  DepreciationGroupEnum[DepreciationGroupEnum["WRITTEN_OFF_ITEMS"] = 3] = "WRITTEN_OFF_ITEMS";
9129
9189
  DepreciationGroupEnum[DepreciationGroupEnum["BORROWING_EXPENSES"] = 4] = "BORROWING_EXPENSES";
9190
+ DepreciationGroupEnum[DepreciationGroupEnum["SMALL_BUSINESS_POOL"] = 5] = "SMALL_BUSINESS_POOL";
9130
9191
  })(exports.DepreciationGroupEnum || (exports.DepreciationGroupEnum = {}));
9131
9192
 
9132
9193
  /**
@@ -9190,6 +9251,11 @@
9190
9251
  description: 'Items below $300, replaced or obsolete are fully deductible',
9191
9252
  icon: 'cart'
9192
9253
  },
9254
+ _a$1[exports.DepreciationGroupEnum.SMALL_BUSINESS_POOL] = {
9255
+ label: 'Small business pool',
9256
+ description: 'The small business pool allows business owners to claim depreciation on plant and equipment items at an accelerated rate.',
9257
+ icon: 'portfolio'
9258
+ },
9193
9259
  _a$1);
9194
9260
 
9195
9261
  var DepreciationReceipt$1 = /** @class */ (function (_super) {
@@ -10076,7 +10142,7 @@
10076
10142
  exports.DeductionSelfEducationTypeEnum.IMPROVE_SKILLS_FOR_CURRENT_EARNINGS_K : null;
10077
10143
  this.workRelatedSelfEducationTotalAmount = this.workRelatedSelfEducationExpenses.sumBy('claimAmount');
10078
10144
  this.lowValuePoolDeductionTotalAmount = this.depreciations.getByTankType(exports.TankTypeEnum.WORK)
10079
- .getLowValuePoolDepreciations().sumBy('claimAmount');
10145
+ .getLVPDepreciations().sumBy('claimAmount');
10080
10146
  this.interestExpensesTotalAmount = this.transactions
10081
10147
  .filterBy('chartAccounts.heading.id', DEDUCTION_CATEGORIES.interestExpenses)
10082
10148
  .sumBy('claimAmount');
@@ -10954,6 +11020,26 @@
10954
11020
  }]
10955
11021
  }] });
10956
11022
 
11023
+ var SoleBusinessActivityService = /** @class */ (function (_super) {
11024
+ __extends(SoleBusinessActivityService, _super);
11025
+ function SoleBusinessActivityService() {
11026
+ var _this = _super.apply(this, __spreadArray([], __read(arguments))) || this;
11027
+ _this.modelClass = SoleBusinessActivity;
11028
+ _this.url = 'sole-business-activities';
11029
+ _this.isHydra = true;
11030
+ return _this;
11031
+ }
11032
+ return SoleBusinessActivityService;
11033
+ }(RestService));
11034
+ SoleBusinessActivityService.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: SoleBusinessActivityService, deps: null, target: i0__namespace.ɵɵFactoryTarget.Injectable });
11035
+ SoleBusinessActivityService.ɵprov = i0__namespace.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: SoleBusinessActivityService, providedIn: 'root' });
11036
+ i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: SoleBusinessActivityService, decorators: [{
11037
+ type: i0.Injectable,
11038
+ args: [{
11039
+ providedIn: 'root'
11040
+ }]
11041
+ }] });
11042
+
10957
11043
  var SoleContactService = /** @class */ (function (_super) {
10958
11044
  __extends(SoleContactService, _super);
10959
11045
  function SoleContactService() {
@@ -10974,6 +11060,61 @@
10974
11060
  }]
10975
11061
  }] });
10976
11062
 
11063
+ /**
11064
+ * @TODO Alex: extend rest service when refactored
11065
+ */
11066
+ var SoleDepreciationMethodService = /** @class */ (function () {
11067
+ function SoleDepreciationMethodService(http, environment, eventDispatcherService, toastService) {
11068
+ this.http = http;
11069
+ this.environment = environment;
11070
+ this.eventDispatcherService = eventDispatcherService;
11071
+ this.toastService = toastService;
11072
+ this.cacheSubject = new rxjs.ReplaySubject(1);
11073
+ this.url = 'sole-depreciation-methods';
11074
+ }
11075
+ SoleDepreciationMethodService.prototype.get = function () {
11076
+ var _this = this;
11077
+ if (!this.cache) {
11078
+ this.http.get(this.environment.apiV2 + "/" + this.url)
11079
+ .pipe(operators.map(function (response) { return classTransformer.plainToClass(SoleDepreciationMethod, response['hydra:member'][0]); }))
11080
+ .subscribe(function (soleDepreciationMethod) {
11081
+ _this.cache = soleDepreciationMethod;
11082
+ _this.cacheSubject.next(_this.cache);
11083
+ return soleDepreciationMethod;
11084
+ });
11085
+ }
11086
+ return this.cacheSubject.asObservable();
11087
+ };
11088
+ SoleDepreciationMethodService.prototype.update = function (soleDepreciationMethod) {
11089
+ var _this = this;
11090
+ return this.http.put(this.environment.apiV2 + "/" + this.url + "/" + soleDepreciationMethod.id, soleDepreciationMethod)
11091
+ .pipe(operators.map(function (soleDepreciationMethodBase) {
11092
+ var method = classTransformer.plainToClass(SoleDepreciationMethod, soleDepreciationMethodBase);
11093
+ _this.cache = method;
11094
+ _this.cacheSubject.next(_this.cache);
11095
+ _this.eventDispatcherService.dispatch(new AppEvent(exports.AppEventTypeEnum.SOLE_DEPRECIATION_METHOD_UPDATED, method));
11096
+ return _this.cache;
11097
+ }), operators.catchError(function (error) {
11098
+ _this.toastService.error(error.error['hydra:description']);
11099
+ return throwError.throwError(error);
11100
+ }));
11101
+ };
11102
+ return SoleDepreciationMethodService;
11103
+ }());
11104
+ SoleDepreciationMethodService.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: SoleDepreciationMethodService, deps: [{ token: i1__namespace.HttpClient }, { token: 'environment' }, { token: EventDispatcherService }, { token: ToastService }], target: i0__namespace.ɵɵFactoryTarget.Injectable });
11105
+ SoleDepreciationMethodService.ɵprov = i0__namespace.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: SoleDepreciationMethodService, providedIn: 'root' });
11106
+ i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: SoleDepreciationMethodService, decorators: [{
11107
+ type: i0.Injectable,
11108
+ args: [{
11109
+ providedIn: 'root'
11110
+ }]
11111
+ }], ctorParameters: function () {
11112
+ return [{ type: i1__namespace.HttpClient }, { type: undefined, decorators: [{
11113
+ type: i0.Inject,
11114
+ args: ['environment']
11115
+ }] }, { type: EventDispatcherService }, { type: ToastService }];
11116
+ } });
11117
+
10977
11118
  /**
10978
11119
  * @TODO TT-1777 Alex: extend from rest service when it refactored
10979
11120
  */
@@ -11647,6 +11788,14 @@
11647
11788
  return updatedProperty;
11648
11789
  }));
11649
11790
  };
11791
+ PropertyService.prototype.updateDepreciationCalculation = function (property) {
11792
+ var _this = this;
11793
+ var propertyToUpdate = classTransformer.plainToClass(Property, { id: property.id, depreciationCalculation: property.depreciationCalculation });
11794
+ return this.update(propertyToUpdate).pipe(operators.map(function (updatedProperty) {
11795
+ _this.eventDispatcherService.dispatch(new AppEvent(exports.AppEventTypeEnum.PROPERTY_DEPRECIATION_CALCULATION_UPDATED, updatedProperty));
11796
+ return updatedProperty;
11797
+ }));
11798
+ };
11650
11799
  PropertyService.prototype.getByCategoryId = function (id) {
11651
11800
  return this.get().pipe(operators.map(function (properties) {
11652
11801
  return properties.filter(function (property) { return property.category.id === id; });
@@ -13735,6 +13884,8 @@
13735
13884
  this.listenReceiptDeleted();
13736
13885
  this.listenVehicleClaimChanges();
13737
13886
  this.listenToUpdatedBankAccount();
13887
+ this.listenSoleDepreciationMethodChanges();
13888
+ this.listenPropertyDepreciationCalculationChanges();
13738
13889
  };
13739
13890
  DepreciationService.prototype.getOpenBalance = function (depreciation) {
13740
13891
  return this.http.post(this.environment.apiV2 + "/" + this.url + "/opening-balance?financialYear=" + new FinancialYear().year, depreciation)
@@ -13798,6 +13949,24 @@
13798
13949
  replace(this.cache, depreciationToReplace);
13799
13950
  this.updateCache();
13800
13951
  };
13952
+ /**
13953
+ * @TODO Alex: create common method resetCacheOn(events: AppEventType[])
13954
+ */
13955
+ DepreciationService.prototype.listenSoleDepreciationMethodChanges = function () {
13956
+ var _this = this;
13957
+ this.eventDispatcherService.on(exports.AppEventTypeEnum.SOLE_DEPRECIATION_METHOD_UPDATED).subscribe(function () {
13958
+ _this.resetCache();
13959
+ });
13960
+ };
13961
+ /**
13962
+ * @TODO Alex: create common method resetCacheOn(events: AppEventType[])
13963
+ */
13964
+ DepreciationService.prototype.listenPropertyDepreciationCalculationChanges = function () {
13965
+ var _this = this;
13966
+ this.eventDispatcherService.on(exports.AppEventTypeEnum.PROPERTY_DEPRECIATION_CALCULATION_UPDATED).subscribe(function () {
13967
+ _this.resetCache();
13968
+ });
13969
+ };
13801
13970
  return DepreciationService;
13802
13971
  }(RestService));
13803
13972
  DepreciationService.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: DepreciationService, deps: [{ token: i1__namespace.HttpClient }, { token: EventDispatcherService }, { token: 'environment' }, { token: ToastService }, { token: DepreciationReceiptService }], target: i0__namespace.ɵɵFactoryTarget.Injectable });
@@ -16603,7 +16772,7 @@
16603
16772
  if (business === void 0) { business = classTransformer.plainToClass(SoleBusiness, {}); }
16604
16773
  return _super.call(this, {
16605
16774
  name: new forms.FormControl(business.name, forms.Validators.required),
16606
- code: new forms.FormControl(business.code, forms.Validators.required),
16775
+ activity: new forms.FormControl(business.activity, forms.Validators.required),
16607
16776
  description: new forms.FormControl(business.description),
16608
16777
  website: new forms.FormControl(business.website)
16609
16778
  }, business) || this;
@@ -16692,6 +16861,16 @@
16692
16861
  return SoleContactForm;
16693
16862
  }(AbstractForm));
16694
16863
 
16864
+ var SoleDepreciationMethodForm = /** @class */ (function (_super) {
16865
+ __extends(SoleDepreciationMethodForm, _super);
16866
+ function SoleDepreciationMethodForm(soleDepreciationMethod) {
16867
+ return _super.call(this, {
16868
+ method: new forms.FormControl(soleDepreciationMethod.method)
16869
+ }, soleDepreciationMethod) || this;
16870
+ }
16871
+ return SoleDepreciationMethodForm;
16872
+ }(AbstractForm));
16873
+
16695
16874
  var SoleDetailsForm = /** @class */ (function (_super) {
16696
16875
  __extends(SoleDetailsForm, _super);
16697
16876
  function SoleDetailsForm(soleDetails) {
@@ -17798,6 +17977,8 @@
17798
17977
  exports.ServiceSubscriptionCollection = ServiceSubscriptionCollection;
17799
17978
  exports.ServiceSubscriptionItem = ServiceSubscriptionItem;
17800
17979
  exports.SoleBusiness = SoleBusiness;
17980
+ exports.SoleBusinessActivity = SoleBusinessActivity;
17981
+ exports.SoleBusinessActivityService = SoleBusinessActivityService;
17801
17982
  exports.SoleBusinessAllocation = SoleBusinessAllocation;
17802
17983
  exports.SoleBusinessAllocationsForm = SoleBusinessAllocationsForm;
17803
17984
  exports.SoleBusinessForm = SoleBusinessForm;
@@ -17806,6 +17987,9 @@
17806
17987
  exports.SoleContact = SoleContact;
17807
17988
  exports.SoleContactForm = SoleContactForm;
17808
17989
  exports.SoleContactService = SoleContactService;
17990
+ exports.SoleDepreciationMethod = SoleDepreciationMethod;
17991
+ exports.SoleDepreciationMethodForm = SoleDepreciationMethodForm;
17992
+ exports.SoleDepreciationMethodService = SoleDepreciationMethodService;
17809
17993
  exports.SoleDetails = SoleDetails;
17810
17994
  exports.SoleDetailsForm = SoleDetailsForm;
17811
17995
  exports.SoleDetailsService = SoleDetailsService;