taxtank-core 0.33.80 → 0.33.82

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.
@@ -1026,6 +1026,7 @@ var ChartAccountsListEnum;
1026
1026
  ChartAccountsListEnum[ChartAccountsListEnum["FORESTRY_MANAGED_INVESTMENT_SCHEMES_DEDUCTION"] = 593] = "FORESTRY_MANAGED_INVESTMENT_SCHEMES_DEDUCTION";
1027
1027
  ChartAccountsListEnum[ChartAccountsListEnum["ASSESSABLE_AMOUNT_CAPPED_DEFINED_BENEFIT"] = 639] = "ASSESSABLE_AMOUNT_CAPPED_DEFINED_BENEFIT";
1028
1028
  ChartAccountsListEnum[ChartAccountsListEnum["CODE_A_SUPERANNUATION_INCOME_STREAMS_DEATH"] = 640] = "CODE_A_SUPERANNUATION_INCOME_STREAMS_DEATH";
1029
+ ChartAccountsListEnum[ChartAccountsListEnum["PRE_TAX_DEDUCTIONS_OTHER"] = 645] = "PRE_TAX_DEDUCTIONS_OTHER";
1029
1030
  ChartAccountsListEnum[ChartAccountsListEnum["TRANSFER"] = 615] = "TRANSFER";
1030
1031
  ChartAccountsListEnum[ChartAccountsListEnum["PERSONAL_EXPENSES"] = 628] = "PERSONAL_EXPENSES";
1031
1032
  ChartAccountsListEnum[ChartAccountsListEnum["PERSONAL_INCOME"] = 630] = "PERSONAL_INCOME";
@@ -6429,7 +6430,9 @@ class Transaction extends Transaction$1 {
6429
6430
  return grossAmount;
6430
6431
  }
6431
6432
  // included transactions affect parent transaction amount and as a result grossAmount, skip to avoid double sum
6432
- const adjustments = new Collection(this.transactions).filter(transaction => ![ChartAccountsAdjustmentIncludedListEnum.FUNDS_OVER_ADJUSTMENT, ChartAccountsAdjustmentIncludedListEnum.LANDLORD_REIMBURSEMENT].includes(transaction.chartAccounts?.id));
6433
+ const adjustments = new Collection(this.transactions)
6434
+ // @TODO move to enum when there are other exceptions
6435
+ .filter(transaction => !transaction.chartAccounts?.isAdjustmentIncluded() && transaction.chartAccounts?.id !== ChartAccountsListEnum.PRE_TAX_DEDUCTIONS_OTHER);
6433
6436
  const income = adjustments.filter(transaction => transaction.isIncome()).sumBy('amount');
6434
6437
  const expense = adjustments.filter(transaction => transaction.isExpense()).sumBy('amount', true);
6435
6438
  // all adjustments except property income increase grossIncome
@@ -11320,7 +11323,7 @@ const HTTP_ERROR_MESSAGES = {
11320
11323
  405: 'Method Not Allowed – The request method is not supported by the server. Please, connect with technical support',
11321
11324
  408: 'Request Timeout – The request took too long to complete. Please try again.',
11322
11325
  429: 'Too Many Requests – Too many requests were made. Please wait and try again later.',
11323
- 500: 'Internal Server Error The server encountered an error. Please try again later.',
11326
+ 500: 'Oops! Something went wrong. Please try again in a moment, or contact support if the issue keeps happening.',
11324
11327
  502: 'Bad Gateway – The server received an invalid response. Please try again.',
11325
11328
  503: 'Service Unavailable – The server is currently unavailable. Please try again later.',
11326
11329
  504: 'Gateway Timeout – The server timed out waiting for a response. Please try again.'
@@ -11535,7 +11538,12 @@ let RestService$1 = class RestService extends DataService {
11535
11538
  handleError(error) {
11536
11539
  if (error instanceof HttpErrorResponse) {
11537
11540
  if (this.useBackendError) {
11538
- this.toastService.error(error.error.map((error) => error.message).join(' '));
11541
+ if (error.error.detail) {
11542
+ this.toastService.error(error.error.detail);
11543
+ }
11544
+ else {
11545
+ this.toastService.error(error.error.map((error) => error.message).join(' '));
11546
+ }
11539
11547
  }
11540
11548
  else {
11541
11549
  this.toastService.error(this.httpErrorMessages[error.status] || 'Unexpected error occurred.');
@@ -12830,6 +12838,7 @@ class ClientInviteService extends RestService$1 {
12830
12838
  this.endpointUri = 'client-invites';
12831
12839
  this.collectionClass = ClientInviteCollection;
12832
12840
  this.modelClass = ClientInvite;
12841
+ this.useBackendError = true;
12833
12842
  this.listenEvents();
12834
12843
  }
12835
12844
  listenEvents() {
@@ -12886,16 +12895,7 @@ class ClientInviteService extends RestService$1 {
12886
12895
  * Send invitation from client to firm
12887
12896
  */
12888
12897
  inviteFirmByUser(invite) {
12889
- return super.post(invite, `${this.environment.apiV2}/firm-invites`)
12890
- .pipe(catchError((error) => {
12891
- if (error.error.email) {
12892
- this.toastService.error(error.error.email[0]);
12893
- }
12894
- else {
12895
- this.toastService.error(error.error);
12896
- }
12897
- return throwError(error);
12898
- }));
12898
+ return super.post(invite, `${this.environment.apiV2}/firm-invites`);
12899
12899
  }
12900
12900
  listenNotifications() {
12901
12901
  this.eventDispatcherService.on(AppEventTypeEnum.NOTIFICATION_ADDED).subscribe((notification) => {
@@ -24336,15 +24336,15 @@ class WorkTransactionForm extends TransactionForm {
24336
24336
  class WorkIncomeForm extends WorkTransactionForm {
24337
24337
  constructor(transaction, registeredForGst, allocations) {
24338
24338
  super(transaction, registeredForGst, allocations, {
24339
- netAmount: new UntypedFormControl(transaction.netAmount, Validators.required),
24340
24339
  tax: new UntypedFormControl({
24341
24340
  value: transaction.tax,
24342
24341
  disabled: !transaction.chartAccounts || transaction.chartAccounts.isNRAS(),
24343
24342
  }, Validators.required),
24344
24343
  incomeSource: new UntypedFormControl(transaction.incomeSource, [Validators.required, autocompleteValidator()]),
24345
24344
  });
24346
- if (allocations.length) {
24347
- this.get('netAmount').disable();
24345
+ // @TODO we use amount field as netAmount to avoid extra watcher for amount recalculation
24346
+ if (transaction.id) {
24347
+ this.get('amount').setValue(transaction.netAmount);
24348
24348
  }
24349
24349
  // forbid to edit some fields for allocated transaction
24350
24350
  if (allocations.length) {
@@ -24368,12 +24368,6 @@ class WorkIncomeForm extends WorkTransactionForm {
24368
24368
  listenEvents() {
24369
24369
  super.listenEvents();
24370
24370
  this.watchIncomeSource();
24371
- this.watchNetAmount();
24372
- }
24373
- watchNetAmount() {
24374
- this.get('netAmount').valueChanges.subscribe(() => {
24375
- this.get('amount').setValue(this.getAmount());
24376
- });
24377
24371
  }
24378
24372
  watchIncomeSource() {
24379
24373
  this.get('incomeSource').valueChanges.subscribe((incomeSource) => {
@@ -24414,10 +24408,13 @@ class WorkIncomeForm extends WorkTransactionForm {
24414
24408
  * ie bankTransaction=1000$ with 900$ salary and 100$ tips will create 2 transactions with 900$ and 100$
24415
24409
  */
24416
24410
  getAmount() {
24417
- return this.get('netAmount').value - new Collection(this.currentValue.transactions)
24411
+ return this.get('amount').value - new Collection(this.currentValue.transactions)
24418
24412
  .filter((t) => t.chartAccounts?.isAdjustmentIncluded())
24419
24413
  .sumBy('amount');
24420
24414
  }
24415
+ submit(data = {}) {
24416
+ return super.submit(Object.assign(data, { amount: this.getAmount() }));
24417
+ }
24421
24418
  }
24422
24419
 
24423
24420
  class WorkExpenseForm extends WorkTransactionForm {