taxtank-core 0.28.50 → 0.28.52

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.
@@ -1074,6 +1074,7 @@
1074
1074
  SOLE_BUSINESS_LOSSES_POST: new Endpoint('POST', '\\/sole-business-losses'),
1075
1075
  SOLE_BUSINESS_LOSSES_PUT: new Endpoint('PUT', '\\/sole-business-losses\\/\\d+'),
1076
1076
  SOLE_BUSINESS_LOSS_OFFSET_RULES_GET: new Endpoint('GET', '\\/sole-business-loss-offset-rules'),
1077
+ SOLE_BUSINESS_LOGO_POST: new Endpoint('POST', '\\/sole-businesses\\/\\d+\\/logo'),
1077
1078
  SOLE_CONTACTS_POST: new Endpoint('POST', '\\/sole-contacts'),
1078
1079
  SOLE_CONTACTS_PUT: new Endpoint('PUT', '\\/sole-contacts\\/\\d+'),
1079
1080
  BUSINESS_ACTIVITIES_GET: new Endpoint('GET', '\\/sole-business-activities'),
@@ -11190,6 +11191,7 @@
11190
11191
  this.businessActivities = uniqBy__default["default"](businesses.mapBy('activity'), 'id');
11191
11192
  this.businessABN = soleDetails === null || soleDetails === void 0 ? void 0 : soleDetails.abn;
11192
11193
  this.businessAddress = (_a = user.address) === null || _a === void 0 ? void 0 : _a.name;
11194
+ this.businesses = businesses;
11193
11195
  this.vehicleClaimDetails = vehicleClaimDetails;
11194
11196
  }
11195
11197
  return MyTaxBusinessDetails;
@@ -11300,7 +11302,7 @@
11300
11302
  * https://taxtank.atlassian.net/wiki/spaces/TAXTANK/pages/4644110466/Tax+Return+MyTax+-+Online+Form (section "Business income or losses")
11301
11303
  */
11302
11304
  var MyTaxBusinessLosses = /** @class */ (function () {
11303
- function MyTaxBusinessLosses(transactions, depreciations, businessLosses, currentLoss) {
11305
+ function MyTaxBusinessLosses(transactions, depreciations, businessLosses, currentLoss, taxSummary) {
11304
11306
  this.currentLoss = currentLoss;
11305
11307
  this.purchasesAndOtherCostsAmount = Math.abs(transactions.getExpenseTransactions()
11306
11308
  .filterBy('chartAccounts.id', exports.ChartAccountsListEnum.PURCHASES_STOCK_INVENTORY)
@@ -11327,14 +11329,22 @@
11327
11329
  .filterBy('chartAccounts.id', exports.ChartAccountsListEnum.INTEREST_EXPENSES_OVERSEAS)
11328
11330
  .sumBy('claimAmount'));
11329
11331
  this.kmsTravelledExpensesAmount = Math.abs(transactions
11330
- .filterBy('chartAccounts.heading.id', [exports.ChartAccountsHeadingListEnum.WORK_RELATED_CAR_EXPENSES, exports.ChartAccountsHeadingListEnum.DEPRECIATION_VEHICLES])
11331
- .sumBy('claimAmount'));
11332
+ .filterBy('chartAccounts.category', [exports.ChartAccountsListEnum.KLMS_TRAVELLED])
11333
+ .sumBy('claimAmount') +
11334
+ depreciations
11335
+ .filterBy('chartAccounts.category', [exports.ChartAccountsListEnum.KLMS_TRAVELLED])
11336
+ .sumBy('claimAmount'));
11337
+ this.logbookExpensesAmount = Math.abs(transactions.getVehicleTransactions().sumBy('claimAmount')) +
11338
+ depreciations.getVehicleDepreciations().sumBy('claimAmount');
11332
11339
  this.otherExpensesAmount = Math.abs(transactions
11333
11340
  .filterBy('chartAccounts.heading.id', exports.ChartAccountsHeadingListEnum.OTHER_EXPENSES)
11334
11341
  .sumBy('claimAmount'));
11335
11342
  this.totalNonPrimaryProductionExpensesAmount = Math.abs(transactions
11336
- .filterBy('chartAccounts.category', [exports.ChartAccountsCategoryEnum.SOLE_EXPENSE, exports.ChartAccountsCategoryEnum.SOLE_DEPRECIATION])
11337
- .sumBy('claimAmount'));
11343
+ .filterBy('chartAccounts.category', [exports.ChartAccountsCategoryEnum.SOLE_EXPENSE])
11344
+ .sumBy('claimAmount')) +
11345
+ depreciations
11346
+ .filterBy('chartAccounts.category', [exports.ChartAccountsCategoryEnum.SOLE_DEPRECIATION])
11347
+ .sumBy('claimAmount');
11338
11348
  // depreciations
11339
11349
  this.depreciationExpensesAmount = depreciations
11340
11350
  .filterBy('chartAccounts.heading.id', exports.ChartAccountsHeadingListEnum.DEPRECIATION_EXPENSES)
@@ -11345,21 +11355,14 @@
11345
11355
  this.deductionsForGeneralSmallBusinessPoolAmount = depreciations
11346
11356
  .getSBPDepreciations()
11347
11357
  .sumBy('claimAmount');
11348
- this.currentYearNetNonPrimaryIncomeOrLossesAmount = transactions.getIncomeTransactions()
11349
- .filterBy('chartAccounts.category', exports.ChartAccountsCategoryEnum.SOLE_INCOME)
11350
- .amount -
11351
- Math.abs(transactions
11352
- .filterBy('chartAccounts.category', [exports.ChartAccountsCategoryEnum.SOLE_EXPENSE, exports.ChartAccountsCategoryEnum.SOLE_DEPRECIATION])
11353
- .sumBy('claimAmount'));
11354
- this.priorYearsNonPrimaryLossesAmount = this.calculatePriorYearsOpenBalance(businessLosses);
11355
- this.netNonPrimaryIncomeOrLossesAmount = transactions.getIncomeTransactions()
11356
- .filterBy('chartAccounts.category', exports.ChartAccountsCategoryEnum.SOLE_INCOME)
11357
- .amount -
11358
+ this.currentYearNetNonPrimaryIncomeOrLossesAmount = +(transactions.sumBy('claimAmount') -
11359
+ depreciations.sumBy('claimAmount'))
11360
+ .toFixed(2);
11361
+ this.priorYearsNonPrimaryLossesAmount = businessLosses.sumBy('openBalance');
11362
+ this.netNonPrimaryIncomeOrLossesAmount = this.currentYearNetNonPrimaryIncomeOrLossesAmount -
11358
11363
  this.priorYearsNonPrimaryLossesAmount;
11364
+ this.deferredLossesAmount = taxSummary.sole.items.sumByCategoriesAndSection(TAX_RETURN_CATEGORIES.sole.lossCurrent, exports.TaxSummarySectionEnum.SOLE_TANK);
11359
11365
  }
11360
- MyTaxBusinessLosses.prototype.calculatePriorYearsOpenBalance = function (businessLosses) {
11361
- return businessLosses ? businessLosses.sumBy('openBalance') : 0;
11362
- };
11363
11366
  return MyTaxBusinessLosses;
11364
11367
  }());
11365
11368
 
@@ -12423,6 +12426,13 @@
12423
12426
  UserEventSettingFieldEnum["FREQUENCY"] = "frequency";
12424
12427
  })(exports.UserEventSettingFieldEnum || (exports.UserEventSettingFieldEnum = {}));
12425
12428
 
12429
+ var MessagesEnum$1;
12430
+ (function (MessagesEnum) {
12431
+ MessagesEnum["LOGO_UPDATED"] = "Logo updated successfully";
12432
+ MessagesEnum["LOGO_ERROR_FORMAT"] = "Wrong file format. Allowed extensions: jpg, img, png";
12433
+ MessagesEnum["LOGO_ERROR_SIZE"] = "The file is too big. Maximum size is 2mb";
12434
+ })(MessagesEnum$1 || (MessagesEnum$1 = {}));
12435
+
12426
12436
  var SoleBusinessService = /** @class */ (function (_super) {
12427
12437
  __extends(SoleBusinessService, _super);
12428
12438
  function SoleBusinessService() {
@@ -12439,6 +12449,25 @@
12439
12449
  return business;
12440
12450
  }));
12441
12451
  };
12452
+ SoleBusinessService.prototype.uploadLogo = function (business, file) {
12453
+ var _this = this;
12454
+ var formData = new FormData();
12455
+ formData.append('file', file);
12456
+ return this.http.post(this.environment.apiV2 + "/" + this.url + "/" + business.id + "/logo", formData)
12457
+ .pipe(operators.map(function (updatedBusiness) {
12458
+ var tempCache = cloneDeep__default["default"](_this.cache);
12459
+ replace(tempCache, classTransformer.plainToClass(SoleBusiness, updatedBusiness));
12460
+ _this.cache = tempCache;
12461
+ _this.cacheSubject.next(_this.cache);
12462
+ _this.toastService.success(MessagesEnum$1.LOGO_UPDATED);
12463
+ }), operators.catchError(function (error) {
12464
+ // Show error when user provided wrong image (format or size)
12465
+ if (error.status === 422) {
12466
+ _this.toastService.error(error.error.violations[0].message);
12467
+ }
12468
+ return throwError.throwError(error);
12469
+ }));
12470
+ };
12442
12471
  return SoleBusinessService;
12443
12472
  }(RestService));
12444
12473
  SoleBusinessService.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: SoleBusinessService, deps: null, target: i0__namespace.ɵɵFactoryTarget.Injectable });
@@ -19350,7 +19379,7 @@
19350
19379
  __extends(MyTaxBusinessDetailsForm, _super);
19351
19380
  function MyTaxBusinessDetailsForm(businessDetails) {
19352
19381
  var _this = this;
19353
- var _a, _b;
19382
+ var _a;
19354
19383
  _this = _super.call(this, {
19355
19384
  vehicleClaimMethod: new forms.FormControl({
19356
19385
  value: (_a = businessDetails.vehicleClaimDetails) === null || _a === void 0 ? void 0 : _a.method,
@@ -19359,11 +19388,10 @@
19359
19388
  businessType: new forms.FormControl({ value: exports.BusinessTypeEnum.SOLE_TRADER, disabled: true }),
19360
19389
  // business details
19361
19390
  mainBusinessActivity: new forms.FormControl(businessDetails.businessActivities[0]),
19362
- mainBusinessName: new forms.FormControl({ value: (_b = businessDetails.businesses) === null || _b === void 0 ? void 0 : _b.first.name, disabled: true }),
19391
+ mainBusinessName: new forms.FormControl({ value: businessDetails.businesses.first.name, disabled: true }),
19363
19392
  mainBusinessABN: new forms.FormControl({ value: businessDetails.businessABN, disabled: true }),
19364
19393
  mainBusinessAddress: new forms.FormControl({ value: businessDetails.businessAddress, disabled: true }),
19365
- // By default, we show it as 1, but user can change it
19366
- numberOfBusinessActivities: new forms.FormControl(1)
19394
+ numberOfBusinessActivities: new forms.FormControl(businessDetails.businessActivities.length)
19367
19395
  }) || this;
19368
19396
  _this.businessDetails = businessDetails;
19369
19397
  _this.listenEvents();
@@ -19504,6 +19532,10 @@
19504
19532
  value: businessLosses.kmsTravelledExpensesAmount,
19505
19533
  disabled: true
19506
19534
  }),
19535
+ logbookExpensesAmount: new forms.FormControl({
19536
+ value: businessLosses.logbookExpensesAmount,
19537
+ disabled: true
19538
+ }),
19507
19539
  otherExpensesAmount: new forms.FormControl({
19508
19540
  value: businessLosses.otherExpensesAmount,
19509
19541
  disabled: true