taxtank-core 0.27.1 → 0.27.4

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 (60) hide show
  1. package/bundles/taxtank-core.umd.js +383 -159
  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/db/Models/user/user.js +1 -1
  11. package/esm2015/lib/forms/sole/index.js +2 -1
  12. package/esm2015/lib/forms/sole/sole-business.form.js +3 -3
  13. package/esm2015/lib/forms/sole/sole-depreciation-method.form.js +10 -0
  14. package/esm2015/lib/models/depreciation/depreciation-group.enum.js +2 -1
  15. package/esm2015/lib/models/depreciation/depreciation-groups.const.js +7 -2
  16. package/esm2015/lib/models/depreciation/depreciation.js +32 -25
  17. package/esm2015/lib/models/endpoint/endpoints.const.js +6 -4
  18. package/esm2015/lib/models/event/app-event-type.enum.js +33 -31
  19. package/esm2015/lib/models/report/depreciation/depreciation-report-item.js +2 -2
  20. package/esm2015/lib/models/report/my-tax/my-tax-deductions/my-tax-deductions.js +2 -2
  21. package/esm2015/lib/models/sole/index.js +3 -1
  22. package/esm2015/lib/models/sole/sole-business-activity.js +4 -0
  23. package/esm2015/lib/models/sole/sole-business.js +10 -2
  24. package/esm2015/lib/models/sole/sole-depreciation-method.js +8 -0
  25. package/esm2015/lib/services/affiliate/rewardful/rewardful.service.js +34 -0
  26. package/esm2015/lib/services/http/depreciation/depreciation.service.js +19 -1
  27. package/esm2015/lib/services/http/property/property.service.js +8 -1
  28. package/esm2015/lib/services/http/sole/index.js +3 -1
  29. package/esm2015/lib/services/http/sole/sole-business-activity/sole-business-activity.service.js +21 -0
  30. package/esm2015/lib/services/http/sole/sole-depreciation-method/sole-depreciation-method.service.js +62 -0
  31. package/esm2015/lib/services/index.js +2 -1
  32. package/esm2015/public-api.js +2 -1
  33. package/fesm2015/taxtank-core.js +308 -131
  34. package/fesm2015/taxtank-core.js.map +1 -1
  35. package/lib/collections/depreciation.collection.d.ts +2 -1
  36. package/lib/db/Enums/depreciation-calculation.enum.d.ts +2 -2
  37. package/lib/db/Enums/sole-depreciation-method.enum.d.ts +4 -0
  38. package/lib/db/Models/sole/sole-business-activity.d.ts +6 -0
  39. package/lib/db/Models/sole/sole-business.d.ts +2 -1
  40. package/lib/db/Models/sole/sole-depreciation-method.d.ts +10 -0
  41. package/lib/db/Models/user/user.d.ts +1 -0
  42. package/lib/forms/sole/index.d.ts +1 -0
  43. package/lib/forms/sole/sole-business.form.d.ts +1 -1
  44. package/lib/forms/sole/sole-depreciation-method.form.d.ts +5 -0
  45. package/lib/models/depreciation/depreciation-group.enum.d.ts +2 -1
  46. package/lib/models/depreciation/depreciation.d.ts +9 -16
  47. package/lib/models/event/app-event-type.enum.d.ts +32 -30
  48. package/lib/models/sole/index.d.ts +2 -0
  49. package/lib/models/sole/sole-business-activity.d.ts +3 -0
  50. package/lib/models/sole/sole-business.d.ts +7 -1
  51. package/lib/models/sole/sole-depreciation-method.d.ts +4 -0
  52. package/lib/services/affiliate/rewardful/rewardful.service.d.ts +13 -0
  53. package/lib/services/http/depreciation/depreciation.service.d.ts +8 -0
  54. package/lib/services/http/property/property.service.d.ts +1 -0
  55. package/lib/services/http/sole/index.d.ts +2 -0
  56. package/lib/services/http/sole/sole-business-activity/sole-business-activity.service.d.ts +11 -0
  57. package/lib/services/http/sole/sole-depreciation-method/sole-depreciation-method.service.d.ts +23 -0
  58. package/lib/services/index.d.ts +1 -0
  59. package/package.json +1 -1
  60. 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+'),
@@ -3229,6 +3233,96 @@
3229
3233
  classTransformer.Type(function () { return SoleInvoiceTemplate; })
3230
3234
  ], SoleInvoice.prototype, "template", void 0);
3231
3235
 
3236
+ /**
3237
+ * Class contains traveled kilometers and work usage percent in 12 weeks date range
3238
+ * @TODO Vik: Best period: move this and related logic to backend
3239
+ */
3240
+ var LogbookPeriod = /** @class */ (function () {
3241
+ function LogbookPeriod() {
3242
+ }
3243
+ LogbookPeriod.prototype.isEndOfYear = function () {
3244
+ return this.to === new FinancialYear().endDate;
3245
+ };
3246
+ LogbookPeriod.prototype.getWorkUsageByClaim = function (claim) {
3247
+ var claimKilometers = this.logbooks.getByVehicleClaim(claim).getClaimableLogbooks().kilometers;
3248
+ return Math.round(this.workUsage * (claimKilometers / this.kilometers));
3249
+ };
3250
+ return LogbookPeriod;
3251
+ }());
3252
+ __decorate([
3253
+ classTransformer.Type(function () { return Date; })
3254
+ ], LogbookPeriod.prototype, "from", void 0);
3255
+ __decorate([
3256
+ classTransformer.Type(function () { return Date; })
3257
+ ], LogbookPeriod.prototype, "to", void 0);
3258
+
3259
+ var Vehicle$1 = /** @class */ (function (_super) {
3260
+ __extends(Vehicle, _super);
3261
+ function Vehicle() {
3262
+ return _super !== null && _super.apply(this, arguments) || this;
3263
+ }
3264
+ return Vehicle;
3265
+ }(AbstractModel));
3266
+
3267
+ var VehicleLogbook$1 = /** @class */ (function (_super) {
3268
+ __extends(VehicleLogbook, _super);
3269
+ function VehicleLogbook() {
3270
+ return _super !== null && _super.apply(this, arguments) || this;
3271
+ }
3272
+ return VehicleLogbook;
3273
+ }(AbstractModel));
3274
+
3275
+ var VehicleLogbook = /** @class */ (function (_super) {
3276
+ __extends(VehicleLogbook, _super);
3277
+ function VehicleLogbook() {
3278
+ return _super !== null && _super.apply(this, arguments) || this;
3279
+ }
3280
+ Object.defineProperty(VehicleLogbook.prototype, "kilometers", {
3281
+ get: function () {
3282
+ return this.odometerEnd - this.odometerStart;
3283
+ },
3284
+ enumerable: false,
3285
+ configurable: true
3286
+ });
3287
+ Object.defineProperty(VehicleLogbook.prototype, "tankType", {
3288
+ get: function () {
3289
+ return this.isSoleTank() ? exports.TankTypeEnum.SOLE : exports.TankTypeEnum.WORK;
3290
+ },
3291
+ enumerable: false,
3292
+ configurable: true
3293
+ });
3294
+ VehicleLogbook.prototype.isWorkTank = function () {
3295
+ return !this.business;
3296
+ };
3297
+ VehicleLogbook.prototype.isSoleTank = function () {
3298
+ return !!this.business;
3299
+ };
3300
+ return VehicleLogbook;
3301
+ }(VehicleLogbook$1));
3302
+ /**
3303
+ * 12 weeks in milliseconds
3304
+ * "To work out your business-use percentage, you need to keep a logbook and the odometer readings for the logbook period.
3305
+ * The logbook period is a minimum continuous period of 12 weeks." © Nicole Kelly
3306
+ */
3307
+ VehicleLogbook.periodDuration = 7257600000;
3308
+ __decorate([
3309
+ classTransformer.Type(function () { return Date; })
3310
+ ], VehicleLogbook.prototype, "date", void 0);
3311
+ __decorate([
3312
+ classTransformer.Type(function () { return SoleBusiness; })
3313
+ ], VehicleLogbook.prototype, "business", void 0);
3314
+
3315
+ var Vehicle = /** @class */ (function (_super) {
3316
+ __extends(Vehicle, _super);
3317
+ function Vehicle() {
3318
+ return _super !== null && _super.apply(this, arguments) || this;
3319
+ }
3320
+ return Vehicle;
3321
+ }(Vehicle$1));
3322
+ __decorate([
3323
+ classTransformer.Type(function () { return VehicleLogbook; })
3324
+ ], Vehicle.prototype, "logbook", void 0);
3325
+
3232
3326
  var VehicleClaim$1 = /** @class */ (function (_super) {
3233
3327
  __extends(VehicleClaim, _super);
3234
3328
  function VehicleClaim() {
@@ -3427,9 +3521,9 @@
3427
3521
  (function (DepreciationCalculationEnum) {
3428
3522
  DepreciationCalculationEnum[DepreciationCalculationEnum["PRIME_COST"] = 1] = "PRIME_COST";
3429
3523
  DepreciationCalculationEnum[DepreciationCalculationEnum["DIMINISHING"] = 2] = "DIMINISHING";
3430
- DepreciationCalculationEnum[DepreciationCalculationEnum["CAPITAL"] = 3] = "CAPITAL";
3431
3524
  DepreciationCalculationEnum[DepreciationCalculationEnum["LVP"] = 4] = "LVP";
3432
3525
  DepreciationCalculationEnum[DepreciationCalculationEnum["AMORTISATION"] = 5] = "AMORTISATION";
3526
+ DepreciationCalculationEnum[DepreciationCalculationEnum["SBP"] = 6] = "SBP";
3433
3527
  })(exports.DepreciationCalculationEnum || (exports.DepreciationCalculationEnum = {}));
3434
3528
 
3435
3529
  var DepreciationCapitalProject$1 = /** @class */ (function (_super) {
@@ -4224,6 +4318,9 @@
4224
4318
  classTransformer.Type(function () { return Date; })
4225
4319
  ], BankTransaction.prototype, "date", void 0);
4226
4320
 
4321
+ /**
4322
+ * @TODO Alex: clarify grouping rules and refactor
4323
+ */
4227
4324
  var Depreciation = /** @class */ (function (_super) {
4228
4325
  __extends(Depreciation, _super);
4229
4326
  function Depreciation() {
@@ -4236,6 +4333,7 @@
4236
4333
  _this.amount = 0;
4237
4334
  return _this;
4238
4335
  }
4336
+ // Type checking
4239
4337
  Depreciation.prototype.isCapital = function () {
4240
4338
  return this.type === exports.DepreciationTypeEnum.CAPITAL_WORKS;
4241
4339
  };
@@ -4245,30 +4343,9 @@
4245
4343
  Depreciation.prototype.isAsset = function () {
4246
4344
  return this.type === exports.DepreciationTypeEnum.PLANT_EQUIPMENT;
4247
4345
  };
4248
- /**
4249
- * check if depreciation should be displayed in written off category
4250
- * details in project documentation
4251
- * @TODO new FinancialYear(this.writeOffDate) === new FinancialYear()
4252
- */
4253
- Depreciation.prototype.isWrittenOff = function () {
4254
- return this.isAsset && this.writeOffDate && new FinancialYear(this.writeOffDate).year === this.financialYear;
4255
- };
4256
- /**
4257
- * Check if depreciation is Plant & Equipment
4258
- */
4259
- Depreciation.prototype.isPlantEquipment = function () {
4260
- return this.isAsset() && !this.isWrittenOff() && !this.isLowValuePool();
4261
- };
4262
- /**
4263
- * check if depreciation should be displayed in low value pool
4264
- * details in project documentation
4265
- * @TODO new FinancialYear(this.writeOffDate) === new FinancialYear()
4266
- */
4267
- Depreciation.prototype.isLowValuePool = function () {
4268
- return this.isAsset &&
4269
- this.calculation === exports.DepreciationCalculationEnum.DIMINISHING &&
4270
- this.amount > Depreciation.WRITTEN_OFF_THRESHOLD &&
4271
- this.amount <= Depreciation.LOW_VALUE_POOL_THRESHOLD;
4346
+ // Calculation checking
4347
+ Depreciation.prototype.isSBPCalculation = function () {
4348
+ return this.calculation === exports.DepreciationCalculationEnum.SBP;
4272
4349
  };
4273
4350
  Depreciation.prototype.isPrimeCost = function () {
4274
4351
  return this.calculation === exports.DepreciationCalculationEnum.PRIME_COST;
@@ -4276,6 +4353,34 @@
4276
4353
  Depreciation.prototype.isDiminishing = function () {
4277
4354
  return this.calculation === exports.DepreciationCalculationEnum.DIMINISHING;
4278
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
+ });
4279
4384
  /**
4280
4385
  * Check if depreciation chart accounts heading related to vehicles category
4281
4386
  */
@@ -4389,6 +4494,14 @@
4389
4494
  classTransformer.Type(function () { return BankTransaction; })
4390
4495
  ], Depreciation.prototype, "bankTransaction", void 0);
4391
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
+
4392
4505
  var SoleBusiness = /** @class */ (function (_super) {
4393
4506
  __extends(SoleBusiness, _super);
4394
4507
  function SoleBusiness() {
@@ -4402,6 +4515,10 @@
4402
4515
  };
4403
4516
  return SoleBusiness;
4404
4517
  }(SoleBusiness$1));
4518
+ /**
4519
+ * Maximum number of businesses that a person can have, according to the ATO
4520
+ */
4521
+ SoleBusiness.businessesLimit = 6;
4405
4522
  __decorate([
4406
4523
  classTransformer.Type(function () { return User; })
4407
4524
  ], SoleBusiness.prototype, "user", void 0);
@@ -4426,6 +4543,42 @@
4426
4543
  __decorate([
4427
4544
  classTransformer.Type(function () { return Depreciation; })
4428
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));
4429
4582
 
4430
4583
  var SoleDetails$1 = /** @class */ (function (_super) {
4431
4584
  __extends(SoleDetails, _super);
@@ -5990,96 +6143,6 @@
5990
6143
  }]
5991
6144
  }] });
5992
6145
 
5993
- /**
5994
- * Class contains traveled kilometers and work usage percent in 12 weeks date range
5995
- * @TODO Vik: Best period: move this and related logic to backend
5996
- */
5997
- var LogbookPeriod = /** @class */ (function () {
5998
- function LogbookPeriod() {
5999
- }
6000
- LogbookPeriod.prototype.isEndOfYear = function () {
6001
- return this.to === new FinancialYear().endDate;
6002
- };
6003
- LogbookPeriod.prototype.getWorkUsageByClaim = function (claim) {
6004
- var claimKilometers = this.logbooks.getByVehicleClaim(claim).getClaimableLogbooks().kilometers;
6005
- return Math.round(this.workUsage * (claimKilometers / this.kilometers));
6006
- };
6007
- return LogbookPeriod;
6008
- }());
6009
- __decorate([
6010
- classTransformer.Type(function () { return Date; })
6011
- ], LogbookPeriod.prototype, "from", void 0);
6012
- __decorate([
6013
- classTransformer.Type(function () { return Date; })
6014
- ], LogbookPeriod.prototype, "to", void 0);
6015
-
6016
- var Vehicle$1 = /** @class */ (function (_super) {
6017
- __extends(Vehicle, _super);
6018
- function Vehicle() {
6019
- return _super !== null && _super.apply(this, arguments) || this;
6020
- }
6021
- return Vehicle;
6022
- }(AbstractModel));
6023
-
6024
- var VehicleLogbook$1 = /** @class */ (function (_super) {
6025
- __extends(VehicleLogbook, _super);
6026
- function VehicleLogbook() {
6027
- return _super !== null && _super.apply(this, arguments) || this;
6028
- }
6029
- return VehicleLogbook;
6030
- }(AbstractModel));
6031
-
6032
- var VehicleLogbook = /** @class */ (function (_super) {
6033
- __extends(VehicleLogbook, _super);
6034
- function VehicleLogbook() {
6035
- return _super !== null && _super.apply(this, arguments) || this;
6036
- }
6037
- Object.defineProperty(VehicleLogbook.prototype, "kilometers", {
6038
- get: function () {
6039
- return this.odometerEnd - this.odometerStart;
6040
- },
6041
- enumerable: false,
6042
- configurable: true
6043
- });
6044
- Object.defineProperty(VehicleLogbook.prototype, "tankType", {
6045
- get: function () {
6046
- return this.isSoleTank() ? exports.TankTypeEnum.SOLE : exports.TankTypeEnum.WORK;
6047
- },
6048
- enumerable: false,
6049
- configurable: true
6050
- });
6051
- VehicleLogbook.prototype.isWorkTank = function () {
6052
- return !this.business;
6053
- };
6054
- VehicleLogbook.prototype.isSoleTank = function () {
6055
- return !!this.business;
6056
- };
6057
- return VehicleLogbook;
6058
- }(VehicleLogbook$1));
6059
- /**
6060
- * 12 weeks in milliseconds
6061
- * "To work out your business-use percentage, you need to keep a logbook and the odometer readings for the logbook period.
6062
- * The logbook period is a minimum continuous period of 12 weeks." © Nicole Kelly
6063
- */
6064
- VehicleLogbook.periodDuration = 7257600000;
6065
- __decorate([
6066
- classTransformer.Type(function () { return Date; })
6067
- ], VehicleLogbook.prototype, "date", void 0);
6068
- __decorate([
6069
- classTransformer.Type(function () { return SoleBusiness; })
6070
- ], VehicleLogbook.prototype, "business", void 0);
6071
-
6072
- var Vehicle = /** @class */ (function (_super) {
6073
- __extends(Vehicle, _super);
6074
- function Vehicle() {
6075
- return _super !== null && _super.apply(this, arguments) || this;
6076
- }
6077
- return Vehicle;
6078
- }(Vehicle$1));
6079
- __decorate([
6080
- classTransformer.Type(function () { return VehicleLogbook; })
6081
- ], Vehicle.prototype, "logbook", void 0);
6082
-
6083
6146
  var VehicleClaimCollection = /** @class */ (function (_super) {
6084
6147
  __extends(VehicleClaimCollection, _super);
6085
6148
  function VehicleClaimCollection() {
@@ -6828,19 +6891,22 @@
6828
6891
  return this.filter(function (depreciation) { return depreciation.isAsset(); });
6829
6892
  };
6830
6893
  DepreciationCollection.prototype.getPlantEquipment = function () {
6831
- return this.filter(function (depreciation) { return depreciation.isPlantEquipment(); });
6894
+ return this.filter(function (depreciation) { return depreciation.isPlantEquipmentPool(); });
6832
6895
  };
6833
6896
  DepreciationCollection.prototype.getCapitalDepreciations = function () {
6834
6897
  return this.filter(function (depreciation) { return depreciation.isCapital(); });
6835
6898
  };
6836
6899
  DepreciationCollection.prototype.getBorrowingExpenseDepreciations = function () {
6837
- return new DepreciationCollection(this.items.filter(function (depreciation) { return depreciation.isBorrowingExpense(); }));
6900
+ return this.filter(function (depreciation) { return depreciation.isBorrowingExpense(); });
6838
6901
  };
6839
6902
  DepreciationCollection.prototype.getWrittenOffDepreciations = function () {
6840
- 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(); });
6841
6907
  };
6842
- DepreciationCollection.prototype.getLowValuePoolDepreciations = function () {
6843
- 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(); });
6844
6910
  };
6845
6911
  DepreciationCollection.prototype.getCapitalProjects = function () {
6846
6912
  return uniqBy__default["default"](compact__default["default"](this.items.map(function (depreciation) {
@@ -6851,9 +6917,7 @@
6851
6917
  * Get a new collection of depreciations related to vehicles
6852
6918
  */
6853
6919
  DepreciationCollection.prototype.getVehicleDepreciations = function () {
6854
- return this.create(this.items.filter(function (depreciation) {
6855
- return depreciation.isVehicleDepreciation();
6856
- }));
6920
+ return this.filter(function (depreciation) { return depreciation.isVehicleDepreciation(); });
6857
6921
  };
6858
6922
  DepreciationCollection.prototype.getByTankType = function (tankType) {
6859
6923
  return this.create(this.items.filter(function (depreciation) {
@@ -7270,7 +7334,7 @@
7270
7334
  Object.defineProperty(DepreciationReportItem.prototype, "categoryTitle", {
7271
7335
  get: function () {
7272
7336
  switch (true) {
7273
- case this.isPlantEquipment():
7337
+ case this.isPlantEquipmentPool():
7274
7338
  return 'Plant & Equipment';
7275
7339
  case this.isWrittenOff():
7276
7340
  return 'Written Off Items';
@@ -9123,6 +9187,7 @@
9123
9187
  DepreciationGroupEnum[DepreciationGroupEnum["LOW_VALUE_POOL"] = 2] = "LOW_VALUE_POOL";
9124
9188
  DepreciationGroupEnum[DepreciationGroupEnum["WRITTEN_OFF_ITEMS"] = 3] = "WRITTEN_OFF_ITEMS";
9125
9189
  DepreciationGroupEnum[DepreciationGroupEnum["BORROWING_EXPENSES"] = 4] = "BORROWING_EXPENSES";
9190
+ DepreciationGroupEnum[DepreciationGroupEnum["SMALL_BUSINESS_POOL"] = 5] = "SMALL_BUSINESS_POOL";
9126
9191
  })(exports.DepreciationGroupEnum || (exports.DepreciationGroupEnum = {}));
9127
9192
 
9128
9193
  /**
@@ -9186,6 +9251,11 @@
9186
9251
  description: 'Items below $300, replaced or obsolete are fully deductible',
9187
9252
  icon: 'cart'
9188
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
+ },
9189
9259
  _a$1);
9190
9260
 
9191
9261
  var DepreciationReceipt$1 = /** @class */ (function (_super) {
@@ -10072,7 +10142,7 @@
10072
10142
  exports.DeductionSelfEducationTypeEnum.IMPROVE_SKILLS_FOR_CURRENT_EARNINGS_K : null;
10073
10143
  this.workRelatedSelfEducationTotalAmount = this.workRelatedSelfEducationExpenses.sumBy('claimAmount');
10074
10144
  this.lowValuePoolDeductionTotalAmount = this.depreciations.getByTankType(exports.TankTypeEnum.WORK)
10075
- .getLowValuePoolDepreciations().sumBy('claimAmount');
10145
+ .getLVPDepreciations().sumBy('claimAmount');
10076
10146
  this.interestExpensesTotalAmount = this.transactions
10077
10147
  .filterBy('chartAccounts.heading.id', DEDUCTION_CATEGORIES.interestExpenses)
10078
10148
  .sumBy('claimAmount');
@@ -10950,6 +11020,26 @@
10950
11020
  }]
10951
11021
  }] });
10952
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
+
10953
11043
  var SoleContactService = /** @class */ (function (_super) {
10954
11044
  __extends(SoleContactService, _super);
10955
11045
  function SoleContactService() {
@@ -10970,6 +11060,61 @@
10970
11060
  }]
10971
11061
  }] });
10972
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
+
10973
11118
  /**
10974
11119
  * @TODO TT-1777 Alex: extend from rest service when it refactored
10975
11120
  */
@@ -11394,6 +11539,41 @@
11394
11539
  }]
11395
11540
  }] });
11396
11541
 
11542
+ /**
11543
+ * Service to work with Rewardful (affiliate program) API
11544
+ * https://developers.rewardful.com/javascript-api/overview#executing-code-when-rewardful-loads
11545
+ */
11546
+ var RewardfulService = /** @class */ (function () {
11547
+ function RewardfulService(environment) {
11548
+ this.environment = environment;
11549
+ }
11550
+ RewardfulService.prototype.getReferralCode = function () {
11551
+ var _this = this;
11552
+ return new rxjs.Observable(function (observer) {
11553
+ if (!_this.environment.rewardfulId) {
11554
+ return observer.next(null);
11555
+ }
11556
+ window['rewardful']('ready', function () {
11557
+ observer.next(window['Rewardful'].referral);
11558
+ });
11559
+ });
11560
+ };
11561
+ return RewardfulService;
11562
+ }());
11563
+ RewardfulService.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: RewardfulService, deps: [{ token: 'environment' }], target: i0__namespace.ɵɵFactoryTarget.Injectable });
11564
+ RewardfulService.ɵprov = i0__namespace.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: RewardfulService, providedIn: 'root' });
11565
+ i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: RewardfulService, decorators: [{
11566
+ type: i0.Injectable,
11567
+ args: [{
11568
+ providedIn: 'root'
11569
+ }]
11570
+ }], ctorParameters: function () {
11571
+ return [{ type: undefined, decorators: [{
11572
+ type: i0.Inject,
11573
+ args: ['environment']
11574
+ }] }];
11575
+ } });
11576
+
11397
11577
  /**
11398
11578
  * Service for logbook best period calculation
11399
11579
  * @TODO Vik: improve structure for such cases (TT-2043)
@@ -11643,6 +11823,14 @@
11643
11823
  return updatedProperty;
11644
11824
  }));
11645
11825
  };
11826
+ PropertyService.prototype.updateDepreciationCalculation = function (property) {
11827
+ var _this = this;
11828
+ var propertyToUpdate = classTransformer.plainToClass(Property, { id: property.id, depreciationCalculation: property.depreciationCalculation });
11829
+ return this.update(propertyToUpdate).pipe(operators.map(function (updatedProperty) {
11830
+ _this.eventDispatcherService.dispatch(new AppEvent(exports.AppEventTypeEnum.PROPERTY_DEPRECIATION_CALCULATION_UPDATED, updatedProperty));
11831
+ return updatedProperty;
11832
+ }));
11833
+ };
11646
11834
  PropertyService.prototype.getByCategoryId = function (id) {
11647
11835
  return this.get().pipe(operators.map(function (properties) {
11648
11836
  return properties.filter(function (property) { return property.category.id === id; });
@@ -13731,6 +13919,8 @@
13731
13919
  this.listenReceiptDeleted();
13732
13920
  this.listenVehicleClaimChanges();
13733
13921
  this.listenToUpdatedBankAccount();
13922
+ this.listenSoleDepreciationMethodChanges();
13923
+ this.listenPropertyDepreciationCalculationChanges();
13734
13924
  };
13735
13925
  DepreciationService.prototype.getOpenBalance = function (depreciation) {
13736
13926
  return this.http.post(this.environment.apiV2 + "/" + this.url + "/opening-balance?financialYear=" + new FinancialYear().year, depreciation)
@@ -13794,6 +13984,24 @@
13794
13984
  replace(this.cache, depreciationToReplace);
13795
13985
  this.updateCache();
13796
13986
  };
13987
+ /**
13988
+ * @TODO Alex: create common method resetCacheOn(events: AppEventType[])
13989
+ */
13990
+ DepreciationService.prototype.listenSoleDepreciationMethodChanges = function () {
13991
+ var _this = this;
13992
+ this.eventDispatcherService.on(exports.AppEventTypeEnum.SOLE_DEPRECIATION_METHOD_UPDATED).subscribe(function () {
13993
+ _this.resetCache();
13994
+ });
13995
+ };
13996
+ /**
13997
+ * @TODO Alex: create common method resetCacheOn(events: AppEventType[])
13998
+ */
13999
+ DepreciationService.prototype.listenPropertyDepreciationCalculationChanges = function () {
14000
+ var _this = this;
14001
+ this.eventDispatcherService.on(exports.AppEventTypeEnum.PROPERTY_DEPRECIATION_CALCULATION_UPDATED).subscribe(function () {
14002
+ _this.resetCache();
14003
+ });
14004
+ };
13797
14005
  return DepreciationService;
13798
14006
  }(RestService));
13799
14007
  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 });
@@ -16599,7 +16807,7 @@
16599
16807
  if (business === void 0) { business = classTransformer.plainToClass(SoleBusiness, {}); }
16600
16808
  return _super.call(this, {
16601
16809
  name: new forms.FormControl(business.name, forms.Validators.required),
16602
- code: new forms.FormControl(business.code, forms.Validators.required),
16810
+ activity: new forms.FormControl(business.activity, forms.Validators.required),
16603
16811
  description: new forms.FormControl(business.description),
16604
16812
  website: new forms.FormControl(business.website)
16605
16813
  }, business) || this;
@@ -16688,6 +16896,16 @@
16688
16896
  return SoleContactForm;
16689
16897
  }(AbstractForm));
16690
16898
 
16899
+ var SoleDepreciationMethodForm = /** @class */ (function (_super) {
16900
+ __extends(SoleDepreciationMethodForm, _super);
16901
+ function SoleDepreciationMethodForm(soleDepreciationMethod) {
16902
+ return _super.call(this, {
16903
+ method: new forms.FormControl(soleDepreciationMethod.method)
16904
+ }, soleDepreciationMethod) || this;
16905
+ }
16906
+ return SoleDepreciationMethodForm;
16907
+ }(AbstractForm));
16908
+
16691
16909
  var SoleDetailsForm = /** @class */ (function (_super) {
16692
16910
  __extends(SoleDetailsForm, _super);
16693
16911
  function SoleDetailsForm(soleDetails) {
@@ -17781,6 +17999,7 @@
17781
17999
  exports.ReportItemCollection = ReportItemCollection;
17782
18000
  exports.ReportItemDetails = ReportItemDetails;
17783
18001
  exports.ResetPasswordForm = ResetPasswordForm;
18002
+ exports.RewardfulService = RewardfulService;
17784
18003
  exports.SUBSCRIPTION_DESCRIPTION = SUBSCRIPTION_DESCRIPTION;
17785
18004
  exports.SUBSCRIPTION_TITLE = SUBSCRIPTION_TITLE;
17786
18005
  exports.SalaryForecast = SalaryForecast;
@@ -17794,6 +18013,8 @@
17794
18013
  exports.ServiceSubscriptionCollection = ServiceSubscriptionCollection;
17795
18014
  exports.ServiceSubscriptionItem = ServiceSubscriptionItem;
17796
18015
  exports.SoleBusiness = SoleBusiness;
18016
+ exports.SoleBusinessActivity = SoleBusinessActivity;
18017
+ exports.SoleBusinessActivityService = SoleBusinessActivityService;
17797
18018
  exports.SoleBusinessAllocation = SoleBusinessAllocation;
17798
18019
  exports.SoleBusinessAllocationsForm = SoleBusinessAllocationsForm;
17799
18020
  exports.SoleBusinessForm = SoleBusinessForm;
@@ -17802,6 +18023,9 @@
17802
18023
  exports.SoleContact = SoleContact;
17803
18024
  exports.SoleContactForm = SoleContactForm;
17804
18025
  exports.SoleContactService = SoleContactService;
18026
+ exports.SoleDepreciationMethod = SoleDepreciationMethod;
18027
+ exports.SoleDepreciationMethodForm = SoleDepreciationMethodForm;
18028
+ exports.SoleDepreciationMethodService = SoleDepreciationMethodService;
17805
18029
  exports.SoleDetails = SoleDetails;
17806
18030
  exports.SoleDetailsForm = SoleDetailsForm;
17807
18031
  exports.SoleDetailsService = SoleDetailsService;