taxtank-core 0.30.20 → 0.30.22

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.
@@ -3425,18 +3425,6 @@ class AllocationRule extends AllocationRule$1 {
3425
3425
  return 'transfer';
3426
3426
  }
3427
3427
  }
3428
- get tankTypeLabel() {
3429
- switch (this.transaction.tankType) {
3430
- case TankTypeEnum.WORK:
3431
- return 'work';
3432
- case TankTypeEnum.PROPERTY:
3433
- return 'property';
3434
- case TankTypeEnum.SOLE:
3435
- return 'sole';
3436
- default:
3437
- return 'personal';
3438
- }
3439
- }
3440
3428
  isIncome() {
3441
3429
  return this.type === AllocationRuleTypeEnum.INCOME;
3442
3430
  }
@@ -8786,6 +8774,9 @@ const ENDPOINTS = {
8786
8774
  SOLE_CONTACTS_GET: new Endpoint('GET', '\\/sole-contacts'),
8787
8775
  SOLE_CONTACTS_POST: new Endpoint('POST', '\\/sole-contacts'),
8788
8776
  SOLE_CONTACTS_PUT: new Endpoint('PUT', '\\/sole-contacts\\/\\d+'),
8777
+ BAS_REPORTS_GET: new Endpoint('GET', '\\/bas-reports'),
8778
+ BAS_REPORTS_POST: new Endpoint('POST', '\\/bas-reports'),
8779
+ BAS_REPORTS_PUT: new Endpoint('PUT', '\\/bas-reports\\/\\d+'),
8789
8780
  BUSINESS_ACTIVITIES_GET: new Endpoint('GET', '\\/sole-business-activities'),
8790
8781
  SOLE_DEPRECIATION_METHODS_GET: new Endpoint('GET', '\\/sole-depreciation-methods'),
8791
8782
  SOLE_DEPRECIATION_METHODS_PUT: new Endpoint('PUT', '\\/sole-depreciation-methods\\/\\d+'),
@@ -10314,6 +10305,12 @@ class Badge extends AbstractModel {
10314
10305
  }
10315
10306
 
10316
10307
  class ClientIncomeTypes extends ClientIncomeTypes$1 {
10308
+ /**
10309
+ * Get count of selected income types
10310
+ */
10311
+ get length() {
10312
+ return Object.values(this).filter((value) => typeof value === 'boolean' && value).length;
10313
+ }
10317
10314
  }
10318
10315
 
10319
10316
  class ClientInvite extends ClientInvite$1 {
@@ -16948,6 +16945,14 @@ class AbstractForm extends UntypedFormGroup {
16948
16945
  createModelInstance(data = {}) {
16949
16946
  return plainToClass(this.modelClass, data);
16950
16947
  }
16948
+ /**
16949
+ * emit current form values
16950
+ */
16951
+ emitValues() {
16952
+ Object.values(this.controls).forEach((control) => {
16953
+ control.updateValueAndValidity({ onlySelf: false, emitEvent: true });
16954
+ });
16955
+ }
16951
16956
  listenValueChanges() {
16952
16957
  this.valueChanges.subscribe(() => {
16953
16958
  !!this.model && !!this.model['id'] && isEqual(this.value, this.initialValue) ? this.markAsSaved() : this.markAsUnsaved();
@@ -17878,6 +17883,10 @@ class BasReportForm extends AbstractForm {
17878
17883
  ]).subscribe(([incomeGST, expenseGST, taxWithheldTotal, paygTaxInstalment, fuelTaxCredit]) => {
17879
17884
  this.get('gst').setValue(incomeGST - expenseGST + taxWithheldTotal + paygTaxInstalment - fuelTaxCredit);
17880
17885
  });
17886
+ // emit init values to calculate dynamic fields
17887
+ if (report.id) {
17888
+ this.emitValues();
17889
+ }
17881
17890
  }
17882
17891
  submit(data = {}) {
17883
17892
  return super.submit(data, true);
@@ -19287,9 +19296,21 @@ class AllocationRuleForm extends AbstractForm {
19287
19296
  return;
19288
19297
  }
19289
19298
  const excludedCategories = [...CHART_ACCOUNTS_CATEGORIES.depreciation];
19290
- this.chartAccountsCategories = intersection(CHART_ACCOUNTS_CATEGORIES[this.currentValue.typeLabel], CHART_ACCOUNTS_CATEGORIES[this.currentValue.tankTypeLabel])
19299
+ this.chartAccountsCategories = intersection(CHART_ACCOUNTS_CATEGORIES[this.currentValue.typeLabel], CHART_ACCOUNTS_CATEGORIES[this.tankTypeLabel])
19291
19300
  .filter((category) => !excludedCategories.includes(category));
19292
19301
  }
19302
+ get tankTypeLabel() {
19303
+ switch (this.transactionFormGroup.get('tankType').value) {
19304
+ case TankTypeEnum.WORK:
19305
+ return 'work';
19306
+ case TankTypeEnum.PROPERTY:
19307
+ return 'property';
19308
+ case TankTypeEnum.SOLE:
19309
+ return 'sole';
19310
+ default:
19311
+ return 'personal';
19312
+ }
19313
+ }
19293
19314
  setupFieldsByType(type) {
19294
19315
  switch (type) {
19295
19316
  case AllocationRuleTypeEnum.EXPENSE: