taxtank-core 0.13.0 → 0.13.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.
@@ -13,14 +13,15 @@ import flatten from 'lodash/flatten';
13
13
  import hasIn from 'lodash/hasIn';
14
14
  import first from 'lodash/first';
15
15
  import last from 'lodash/last';
16
+ import compact from 'lodash/compact';
16
17
  import uniqBy from 'lodash/uniqBy';
17
18
  import concat from 'lodash/concat';
18
- import compact from 'lodash/compact';
19
19
  import { __decorate, __awaiter } from 'tslib';
20
20
  import * as moment from 'moment';
21
21
  import { DateRange } from 'moment-range';
22
22
  import cloneDeep$1 from 'lodash/cloneDeep';
23
23
  import { Validators, FormGroup, FormControl } from '@angular/forms';
24
+ import fromPairs from 'lodash/fromPairs';
24
25
  import _ from 'lodash';
25
26
  import { EventSourcePolyfill } from 'event-source-polyfill/src/eventsource.min.js';
26
27
  import * as i1$1 from '@angular/router';
@@ -959,8 +960,8 @@ class Collection {
959
960
  /**
960
961
  * Sort collection items by provided field
961
962
  */
962
- sortBy(filed = 'id', isDesc = true) {
963
- sort(this.items, filed, isDesc);
963
+ sortBy(field = 'id', isDesc = true) {
964
+ sort(this.items, field, isDesc);
964
965
  }
965
966
  getByDateRange(from, to, dateField = 'date') {
966
967
  return this.create(this.items.filter((item) => item[dateField] >= from && item[dateField] <= to));
@@ -969,7 +970,7 @@ class Collection {
969
970
 
970
971
  class AccountSetupItemCollection extends Collection {
971
972
  constructor(items) {
972
- super(items);
973
+ super(compact(items));
973
974
  this.sortBy('isCompleted', false);
974
975
  }
975
976
  isCompleted() {
@@ -2279,6 +2280,7 @@ var UserRolesEnum;
2279
2280
  UserRolesEnum["SUBSCRIPTION"] = "ROLE_USER_SUBSCRIPTION";
2280
2281
  UserRolesEnum["WORK_TANK"] = "ROLE_USER_WORK";
2281
2282
  UserRolesEnum["PROPERTY_TANK"] = "ROLE_USER_PROPERTY";
2283
+ UserRolesEnum["SOLE_TANK"] = "ROLE_USER_SOLE";
2282
2284
  UserRolesEnum["SWITCH_USER"] = "ROLE_PREVIOUS_ADMIN";
2283
2285
  })(UserRolesEnum || (UserRolesEnum = {}));
2284
2286
 
@@ -4030,6 +4032,37 @@ class PropertyReportItemDepreciationCollection extends PropertyReportItemCollect
4030
4032
  }
4031
4033
  }
4032
4034
 
4035
+ /**
4036
+ * Vehicle expense for logbook section
4037
+ */
4038
+ class VehicleExpense {
4039
+ constructor(amount, claimPercent, description) {
4040
+ this.amount = amount;
4041
+ this.claimPercent = claimPercent;
4042
+ this.description = description;
4043
+ }
4044
+ getClaimAmount() {
4045
+ return +(this.amount * (this.claimPercent / 100)).toFixed(2);
4046
+ }
4047
+ }
4048
+
4049
+ class VehicleExpenseCollection extends Collection {
4050
+ constructor(transactions, depreciations, vehicleClaim) {
4051
+ super();
4052
+ this.setItems(transactions, depreciations, vehicleClaim);
4053
+ }
4054
+ setItems(transactions, depreciations, vehicleClaim) {
4055
+ this.items = [];
4056
+ const transactionsByChartAccounts = new CollectionDictionary(transactions, 'chartAccounts.name');
4057
+ const transactionExpenses = transactionsByChartAccounts.keys.map((chartAccountsName) => {
4058
+ return new VehicleExpense(transactionsByChartAccounts.get(chartAccountsName).amount, vehicleClaim.workUsage, chartAccountsName);
4059
+ });
4060
+ // group all depreciations into one expense item
4061
+ const depreciationExpense = new VehicleExpense(depreciations.getCurrentYearForecastAmount(), vehicleClaim.workUsage, 'Depreciation');
4062
+ this.items.push(...[depreciationExpense, ...transactionExpenses]);
4063
+ }
4064
+ }
4065
+
4033
4066
  class ServiceSubscriptionCollection extends Collection {
4034
4067
  get individual() {
4035
4068
  return this.items.filter((subscription) => subscription.isIndividual())[0];
@@ -4865,6 +4898,9 @@ var VehicleLogbookPurposeEnum;
4865
4898
  * Account setup item instance is using for account setup checklist
4866
4899
  */
4867
4900
  class AccountSetupItem {
4901
+ constructor() {
4902
+ this.clientIncomeTypes = [];
4903
+ }
4868
4904
  }
4869
4905
 
4870
4906
  class Bank$1 extends AbstractModel {
@@ -6708,6 +6744,7 @@ const USER_ROLES = {
6708
6744
  ROLE_USER_SUBSCRIPTION: [UserRolesEnum.SUBSCRIPTION],
6709
6745
  ROLE_USER_WORK: [UserRolesEnum.WORK_TANK],
6710
6746
  ROLE_USER_PROPERTY: [UserRolesEnum.PROPERTY_TANK],
6747
+ ROLE_USER_SOLE: [UserRolesEnum.SOLE_TANK],
6711
6748
  ROLE_PREVIOUS_ADMIN: [UserRolesEnum.SWITCH_USER]
6712
6749
  };
6713
6750
 
@@ -6788,37 +6825,48 @@ const ACCOUNT_SETUP_ITEMS = {
6788
6825
  [AccountSetupItemsEnum.SALARY]: plainToClass(AccountSetupItem, {
6789
6826
  title: 'Add your work income forecast',
6790
6827
  description: 'One the most important steps is to add your salary or wage incomes so we can automatically calculate tax withheld and your forecasted tax position.',
6791
- url: '/client/work-tank/forecasting'
6828
+ url: '/client/work-tank/forecasting',
6829
+ urlFragment: 'salaryProductTour',
6830
+ clientIncomeTypes: ['salary']
6792
6831
  }),
6793
6832
  [AccountSetupItemsEnum.OTHER_INCOME]: plainToClass(AccountSetupItem, {
6794
6833
  title: 'Add any other expected incomes',
6795
6834
  description: 'To ensure an accurate tax position forecast, add estimates for any other income types, like dividends, interest, trusts, annuities, director payments etc.',
6796
- url: '/client/work-tank/forecasting'
6835
+ url: '/client/work-tank/forecasting',
6836
+ urlFragment: 'otherIncomeProductTour',
6837
+ clientIncomeTypes: ['dividends', 'other']
6797
6838
  }),
6798
6839
  [AccountSetupItemsEnum.PROPERTY]: plainToClass(AccountSetupItem, {
6799
6840
  title: 'Add your properties',
6800
6841
  description: 'Add your properties to seamlessly manage your rental incomes and expenses, whilst tracking your cash position, tax positions and equity forecasts in real time.',
6801
- url: '/client/property-tank'
6842
+ url: '/client/property-tank',
6843
+ urlFragment: 'productTour',
6844
+ clientIncomeTypes: ['property']
6802
6845
  }),
6803
6846
  [AccountSetupItemsEnum.BANK_FEEDS]: plainToClass(AccountSetupItem, {
6804
6847
  title: 'Link banks and select accounts',
6805
6848
  description: 'Link banks to automatically feed your account transactions to save you time and money. Allocating live transactions ensures nothing is missed, lost or forgotten!',
6806
- url: '/client/bank-feeds'
6849
+ url: '/client/bank-feeds',
6850
+ urlFragment: 'bankAccountProductTour',
6807
6851
  }),
6808
6852
  [AccountSetupItemsEnum.WORK_LOGBOOK]: plainToClass(AccountSetupItem, {
6809
6853
  title: 'Set up your logbook method',
6810
6854
  description: 'Do you use your vehicle for work? Select your method and the klms or logbook % to automate accurately all vehicle expenses throughout the year.',
6811
- url: '/client/work-tank/logbook'
6855
+ url: '/client/work-tank/logbook',
6856
+ urlFragment: 'productTour'
6812
6857
  }),
6813
6858
  [AccountSetupItemsEnum.SOLE_INCOME]: plainToClass(AccountSetupItem, {
6814
6859
  title: 'Add your business details',
6815
6860
  description: 'Add your business details, logo and payment terms to create invoice templates in minutes.',
6816
- url: '/client/sole-tank/forecasting'
6861
+ url: '/client/sole-tank/forecasting',
6862
+ urlFragment: 'productTour',
6863
+ clientIncomeTypes: ['sole']
6817
6864
  }),
6818
6865
  [AccountSetupItemsEnum.TRANSACTION]: plainToClass(AccountSetupItem, {
6819
6866
  title: 'Allocation transactions',
6820
6867
  description: 'Select one or multiple transactions, the category from the dropdown and attach your receipt. It’s that simple to capture every possible deduction, and keep organised all throughout the year.',
6821
- url: '/client/bank-feeds'
6868
+ url: '/client/bank-feeds',
6869
+ urlFragment: 'allocationProductTour',
6822
6870
  }),
6823
6871
  };
6824
6872
 
@@ -7482,7 +7530,11 @@ class TransactionAllocationService extends RestService {
7482
7530
  * Reset cache on transactions created
7483
7531
  */
7484
7532
  onTransactionsCreated() {
7485
- this.eventDispatcherService.on(AppEventTypeEnum.TRANSACTIONS_CREATED).subscribe(() => {
7533
+ this.eventDispatcherService.on(AppEventTypeEnum.TRANSACTIONS_CREATED).subscribe((transactions) => {
7534
+ // @TODO Alex hack: research and refactor cache update logic, dont reset cache each time transactions changed
7535
+ if (transactions[0].isTransfer) {
7536
+ return;
7537
+ }
7486
7538
  // Update allocations cache to synchronize data and fire subscriptions
7487
7539
  this.resetCache();
7488
7540
  });
@@ -7492,6 +7544,7 @@ class TransactionAllocationService extends RestService {
7492
7544
  */
7493
7545
  onDepreciationCreated() {
7494
7546
  this.eventDispatcherService.on(AppEventTypeEnum.DEPRECIATIONS_CREATED).subscribe(() => {
7547
+ // @TODO Alex hack: research and refactor cache update logic, dont reset cache each time depreciations changed
7495
7548
  // Update allocations cache to synchronize data and fire subscriptions
7496
7549
  this.resetCache();
7497
7550
  });
@@ -7501,6 +7554,7 @@ class TransactionAllocationService extends RestService {
7501
7554
  */
7502
7555
  onTransactionDeleted() {
7503
7556
  this.eventDispatcherService.on(AppEventTypeEnum.TRANSACTION_DELETED).subscribe(() => {
7557
+ // @TODO Alex hack: research and refactor cache update logic, dont reset cache each time transactions changed
7504
7558
  // Update allocations cache to synchronize data and fire subscriptions
7505
7559
  this.resetCache();
7506
7560
  });
@@ -7547,274 +7601,620 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImpo
7547
7601
  }]
7548
7602
  }] });
7549
7603
 
7604
+ function enumToList(data) {
7605
+ const list = [];
7606
+ for (const key in data) {
7607
+ if (Number(key) >= 0) {
7608
+ list.push({
7609
+ label: data[key],
7610
+ value: Number(key)
7611
+ });
7612
+ }
7613
+ }
7614
+ return list;
7615
+ }
7616
+
7617
+ var MessagesEnum;
7618
+ (function (MessagesEnum) {
7619
+ MessagesEnum["DELETED_MESSAGE"] = "Transaction deleted";
7620
+ MessagesEnum["UPDATED_MESSAGE"] = "Transaction updated";
7621
+ MessagesEnum["CREATED_MESSAGE"] = "Transaction(s) created";
7622
+ })(MessagesEnum || (MessagesEnum = {}));
7623
+
7550
7624
  /**
7551
- * Service handling user's account setup process.
7552
- * Checks required steps and their completion
7625
+ * Service for transactions business logic
7553
7626
  */
7554
- class AccountSetupService {
7555
- constructor(clientIncomeTypesService, propertyService, incomeSourceService, bankAccountsService, transactionAllocationService, vehicleClaimService) {
7556
- this.clientIncomeTypesService = clientIncomeTypesService;
7557
- this.propertyService = propertyService;
7558
- this.incomeSourceService = incomeSourceService;
7559
- this.bankAccountsService = bankAccountsService;
7560
- this.transactionAllocationService = transactionAllocationService;
7561
- this.vehicleClaimService = vehicleClaimService;
7562
- this.cacheSubject = new ReplaySubject(1);
7627
+ class TransactionService extends RestService {
7628
+ constructor() {
7629
+ super(...arguments);
7630
+ // url part for Transaction API
7631
+ this.url = 'transactions';
7632
+ this.modelClass = Transaction;
7633
+ this.transactionDeleted = new EventEmitter();
7563
7634
  }
7564
7635
  /**
7565
- * Get list of account setup items for current user
7636
+ * Listen events from Event Dispatcher services
7637
+ */
7638
+ listenEvents() {
7639
+ this.listenDepreciationChange();
7640
+ this.listenPropertyShareUpdate();
7641
+ }
7642
+ /**
7643
+ * get list of all user's TaxTank transactions
7566
7644
  */
7567
7645
  get() {
7568
7646
  if (!this.cache) {
7569
- this.clientIncomeTypesService.get().subscribe((incomeTypes) => {
7570
- combineLatest(this.createBatch(incomeTypes)).subscribe((items) => {
7571
- this.cache = new AccountSetupItemCollection(items);
7572
- this.cacheSubject.next(this.cache);
7573
- });
7647
+ // set cache as default empty array to avoid multiple backend requests
7648
+ this.cache = [];
7649
+ this.fetch()
7650
+ .subscribe((transactions) => {
7651
+ this.cache = transactions;
7652
+ this.updateCache();
7574
7653
  });
7575
7654
  }
7576
- return this.cacheSubject.asObservable();
7655
+ return this.cacheSubject.asObservable().pipe(
7656
+ // assign child transactions (fees) to parent transactions
7657
+ map((transactions) => {
7658
+ transactions.forEach((transaction) => {
7659
+ transaction.transactions = transactions
7660
+ // get list of child transactions
7661
+ .filter((t) => t.parentTransaction && t.parentTransaction.id === transaction.id);
7662
+ });
7663
+ sort(transactions, 'date', false);
7664
+ return transactions;
7665
+ }));
7577
7666
  }
7578
7667
  /**
7579
- * Get a single AccountSetupItem and check it's completion
7668
+ * Add single new transaction
7669
+ * @param model New Transaction instance for saving
7580
7670
  */
7581
- create(itemType, request) {
7582
- return request.pipe(map((result) => {
7583
- const item = ACCOUNT_SETUP_ITEMS[itemType];
7584
- if (result.length) {
7585
- item.isCompleted = true;
7586
- }
7587
- return item;
7671
+ add(model) {
7672
+ // we don't have POST API endpoint for single transaction
7673
+ return this.addBatch([model])
7674
+ .pipe(map((newTransactions) => {
7675
+ // @TODO alex
7676
+ this.eventDispatcherService.dispatch(new AppEvent(AppEventTypeEnum.TRANSACTION_CREATED, newTransactions[0]));
7677
+ return newTransactions[0];
7588
7678
  }));
7589
7679
  }
7590
7680
  /**
7591
- * Get batch of requests to get list of required AccountSetupItem's.
7592
- * Some items are optional and depends of user's client income types
7681
+ * get transactions related with property
7593
7682
  */
7594
- createBatch(incomeTypes) {
7595
- const batch = [];
7596
- // Salary item is completed when user added salary income source
7597
- if (incomeTypes.salary) {
7598
- batch.push(this.create(AccountSetupItemsEnum.SALARY, this.getIncomeSourcesByType(IncomeSourceTypeEnum.SALARY)));
7599
- }
7600
- // Other income item is completed when user added at least one other income source
7601
- if (incomeTypes.dividends || incomeTypes.other) {
7602
- batch.push(this.create(AccountSetupItemsEnum.OTHER_INCOME, this.getIncomeSourcesByType(IncomeSourceTypeEnum.OTHER)));
7603
- }
7604
- // Rental income item is completed when user added at least one property
7605
- if (incomeTypes.property) {
7606
- batch.push(this.create(AccountSetupItemsEnum.PROPERTY, this.propertyService.get()));
7607
- }
7608
- // Bank feeds item is completed when user added at least one bank account (basiq or manual)
7609
- batch.push(this.create(AccountSetupItemsEnum.BANK_FEEDS, this.bankAccountsService.get()));
7610
- // Logbook item is completed when user has at least one vehicle claim with any method (klms or logbook)
7611
- batch.push(this.create(AccountSetupItemsEnum.WORK_LOGBOOK, this.vehicleClaimService.get()));
7612
- // @TODO waiting for sole tank forecast page
7613
- // Sole item is completed when user added at least one sole income source
7614
- // if (incomeTypes.soleTrader) {
7615
- // batch.push(
7616
- // this.prepareItem(
7617
- // AccountSetupItemsEnum.SOLE_INCOME,
7618
- // this.getIncomeSourcesByType(IncomeSourceTypeEnum.SOLE)
7619
- // )
7620
- // );
7621
- // }
7622
- // Allocation item is completed when user added at least one transaction allocation
7623
- batch.push(this.create(AccountSetupItemsEnum.TRANSACTION, this.transactionAllocationService.get()));
7624
- return batch;
7683
+ getByPropertyId(propertyId) {
7684
+ return this.get()
7685
+ .pipe(map((transactions) => {
7686
+ return transactions.filter((transaction) => {
7687
+ var _a;
7688
+ return ((_a = transaction.property) === null || _a === void 0 ? void 0 : _a.id) === propertyId;
7689
+ });
7690
+ }));
7625
7691
  }
7626
7692
  /**
7627
- * @TODO work with collection when services refactored
7693
+ * get list of transactions with tank type 'Work'
7628
7694
  */
7629
- getIncomeSourcesByType(type) {
7630
- return this.incomeSourceService.get().pipe(map((incomeSources) => {
7631
- return new IncomeSourceCollection(incomeSources).getBy('type', type).toArray();
7695
+ getWorkTransactions() {
7696
+ return this.get()
7697
+ .pipe(map((transactions) => {
7698
+ return transactions.filter((transaction) => transaction.isWorkTank());
7632
7699
  }));
7633
7700
  }
7634
- }
7635
- AccountSetupService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: AccountSetupService, deps: [{ token: ClientIncomeTypesService }, { token: PropertyService }, { token: IncomeSourceService }, { token: BankAccountService }, { token: TransactionAllocationService }, { token: VehicleClaimService }], target: i0.ɵɵFactoryTarget.Injectable });
7636
- AccountSetupService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: AccountSetupService, providedIn: 'root' });
7637
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: AccountSetupService, decorators: [{
7638
- type: Injectable,
7639
- args: [{
7640
- providedIn: 'root'
7641
- }]
7642
- }], ctorParameters: function () { return [{ type: ClientIncomeTypesService }, { type: PropertyService }, { type: IncomeSourceService }, { type: BankAccountService }, { type: TransactionAllocationService }, { type: VehicleClaimService }]; } });
7643
-
7644
- class AddressService {
7645
- constructor(http, environment) {
7646
- this.http = http;
7647
- this.environment = environment;
7648
- this.countriesSubject = new ReplaySubject(1);
7649
- }
7650
- getCountries() {
7651
- if (!this._countries) {
7652
- this.http.get(`${this.environment.apiV2}/countries`)
7653
- .pipe(map((response) => {
7654
- return response['hydra:member'].map((item) => plainToClass(Country, item));
7655
- }))
7656
- .subscribe((countries) => {
7657
- this._countries = countries;
7658
- this.countriesSubject.next(countries);
7659
- });
7660
- }
7661
- return this.countriesSubject.asObservable();
7662
- }
7663
- }
7664
- AddressService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: AddressService, deps: [{ token: i1.HttpClient }, { token: 'environment' }], target: i0.ɵɵFactoryTarget.Injectable });
7665
- AddressService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: AddressService, providedIn: 'root' });
7666
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: AddressService, decorators: [{
7667
- type: Injectable,
7668
- args: [{
7669
- providedIn: 'root'
7670
- }]
7671
- }], ctorParameters: function () { return [{ type: i1.HttpClient }, { type: undefined, decorators: [{
7672
- type: Inject,
7673
- args: ['environment']
7674
- }] }]; } });
7675
-
7676
- /**
7677
- * Service to work with assets (documents, receipts, e.t.c.)
7678
- */
7679
- class AssetsService {
7680
- constructor(http, userSwitcherService, environment) {
7681
- this.http = http;
7682
- this.userSwitcherService = userSwitcherService;
7683
- this.environment = environment;
7684
- this.impersonatedClient = this.userSwitcherService.get();
7685
- }
7686
7701
  /**
7687
- * Get asset link
7688
- * @param asset to get the link for
7702
+ * Get list of property holding costs (transactions related to vacant land property)
7689
7703
  */
7690
- getLink(asset) {
7691
- return this.http.get(`${this.environment.apiV2}/assets/${asset.type}/${asset.id}`);
7704
+ getPropertyHoldingCosts(propertyId) {
7705
+ return this.http.get(`${this.environment.apiV2}/${this.url}?propertyId=${propertyId}&propertyCategoryId=${PropertyCategoryListEnum.VACANT_LAND}`)
7706
+ .pipe(map((transactionsBase) => {
7707
+ return transactionsBase.map((transactionBase) => plainToClass(Transaction, transactionBase));
7708
+ }));
7692
7709
  }
7693
7710
  /**
7694
- * Download asset
7695
- * @param asset which should be downloaded
7696
- * @TODO refactor
7711
+ * get list of taxable transactions with tank type 'Work'
7697
7712
  */
7698
- download(asset) {
7699
- return `${this.environment.apiV2}/assets/${asset.type}/${asset.id}/download?bearer=${localStorage.getItem('token')}${this.impersonatedClient ? `&_switch_user=${this.impersonatedClient}` : ''}`;
7713
+ getTaxableWorkTransactions() {
7714
+ return this.getWorkTransactions()
7715
+ .pipe(map((transactions) => {
7716
+ return transactions.filter((transaction) => !!transaction.chartAccounts.taxReturnItem);
7717
+ }));
7700
7718
  }
7701
- // @Todo refactor to event dispatcher
7702
7719
  /**
7703
- * Delete asset
7704
- * @param entityId: id of asset main entity (property, folder, transaction, e.t.c.)
7705
- * @param asset which should be deleted
7720
+ * add multiple transactions
7721
+ * @param transactions List of new Transaction instances for saving
7706
7722
  */
7707
- delete(entityId, asset) {
7708
- return this.http.delete(`${this.environment.apiV2}/${asset.entityType}/${entityId}/${asset.type}/${asset.id}`);
7709
- }
7710
- }
7711
- AssetsService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: AssetsService, deps: [{ token: i1.HttpClient }, { token: UserSwitcherService }, { token: 'environment' }], target: i0.ɵɵFactoryTarget.Injectable });
7712
- AssetsService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: AssetsService, providedIn: 'root' });
7713
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: AssetsService, decorators: [{
7714
- type: Injectable,
7715
- args: [{
7716
- providedIn: 'root'
7717
- }]
7718
- }], ctorParameters: function () { return [{ type: i1.HttpClient }, { type: UserSwitcherService }, { type: undefined, decorators: [{
7719
- type: Inject,
7720
- args: ['environment']
7721
- }] }]; } });
7722
-
7723
- /**
7724
- * Service that handling banks logic
7725
- */
7726
- class BankService extends RestService {
7727
- constructor() {
7728
- super(...arguments);
7729
- this.modelClass = Bank;
7730
- this.url = 'banks';
7731
- this.isHydra = true;
7723
+ addBatch(transactions) {
7724
+ transactions = _.cloneDeep(transactions);
7725
+ return this.http.post(`${this.environment.apiV2}/${this.url}`, transactions)
7726
+ .pipe(map((response) => {
7727
+ const addedTransactions = response.map((item) => plainToClass(Transaction, item));
7728
+ transactions.forEach((transaction, index) => {
7729
+ // @TODO backend: need to upload file in the same backend endpoint with transaction add/update
7730
+ // check if passed receipt and upload file
7731
+ if (transaction.file) {
7732
+ transaction.id = response[index].id;
7733
+ addedTransactions[index].file = transaction.file;
7734
+ this.uploadReceipt(addedTransactions[index]);
7735
+ }
7736
+ // @TODO Viktor: implement API for saving of nested transactions
7737
+ // add child transactions if exist
7738
+ if (transaction.transactions.length) {
7739
+ transaction.transactions.forEach((childTransaction) => {
7740
+ childTransaction.parentTransaction = plainToClass(Transaction, { id: addedTransactions[index].id });
7741
+ });
7742
+ this.addBatch(transaction.transactions).subscribe();
7743
+ }
7744
+ // add transfer transaction to cache
7745
+ if (transaction.operation === TransactionOperationEnum.TRANSFER) {
7746
+ addedTransactions.push(addedTransactions[0].transfer);
7747
+ }
7748
+ });
7749
+ if (this.cache) {
7750
+ this.cache.push(...addedTransactions);
7751
+ this.updateCache();
7752
+ }
7753
+ this.eventDispatcherService.dispatch(new AppEvent(AppEventTypeEnum.TRANSACTIONS_CREATED, addedTransactions));
7754
+ this.toastService.success(MessagesEnum.CREATED_MESSAGE);
7755
+ return addedTransactions;
7756
+ }));
7732
7757
  }
7733
- }
7734
- BankService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: BankService, deps: null, target: i0.ɵɵFactoryTarget.Injectable });
7735
- BankService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: BankService, providedIn: 'root' });
7736
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: BankService, decorators: [{
7737
- type: Injectable,
7738
- args: [{
7739
- providedIn: 'root'
7740
- }]
7741
- }] });
7742
-
7743
- /**
7744
- * @TODO move to collection
7745
- */
7746
- class BankTransactionCalculationService {
7747
7758
  /**
7748
- * Sum of allocations for passed bank transactions
7759
+ * update existing transaction
7760
+ * @param transaction Transaction instance for updating
7749
7761
  */
7750
- getAllocatedAmount(bankTransactions, allocations) {
7751
- return allocations.getByBankTransactionsIds(bankTransactions.getIds()).amount;
7762
+ update(transaction) {
7763
+ return this.http.put(`${this.environment.apiV2}/${this.url}/${transaction.id}`, transaction)
7764
+ .pipe(map((response) => {
7765
+ const updatedTransaction = plainToClass(Transaction, response);
7766
+ // @TODO need to upload file in the same backend endpoint with transaction add/update
7767
+ // check if passed new receipt and upload file
7768
+ if (transaction.file) {
7769
+ updatedTransaction.file = transaction.file;
7770
+ this.uploadReceipt(updatedTransaction);
7771
+ }
7772
+ // @TODO Viktor: implement API for saving of nested transactions
7773
+ if (transaction.transactions.length) {
7774
+ // add parent transaction to child transactions
7775
+ transaction.transactions.forEach((childTransaction) => {
7776
+ childTransaction.parentTransaction = plainToClass(Transaction, { id: updatedTransaction.id });
7777
+ });
7778
+ // separate child transactions by id existing to define add or update action.
7779
+ const childTransactionsToUpdate = transaction.transactions.filter((t) => t.id);
7780
+ const childTransactionsToAdd = transaction.transactions.filter((t) => !t.id);
7781
+ // update child transactions
7782
+ if (childTransactionsToUpdate.length) {
7783
+ this.updateBatch(childTransactionsToUpdate).subscribe();
7784
+ }
7785
+ // add child transactions
7786
+ if (childTransactionsToAdd.length) {
7787
+ this.addBatch(childTransactionsToAdd).subscribe();
7788
+ }
7789
+ }
7790
+ this.toastService.success(MessagesEnum.UPDATED_MESSAGE);
7791
+ replace(this.cache, updatedTransaction);
7792
+ this.updateCache();
7793
+ return updatedTransaction;
7794
+ }));
7752
7795
  }
7753
7796
  /**
7754
- * Difference between total bank transactions amount and sum of allocations for passed bank transactions
7797
+ * update multiple transactions
7798
+ * @param transactions list of transactions for updating
7755
7799
  */
7756
- getUnallocatedAmount(bankTransactionCollection, allocations) {
7757
- return bankTransactionCollection.getAmount() - allocations.amount;
7800
+ updateBatch(transactions) {
7801
+ return this.http.put(`${this.environment.apiV2}/${this.url}`, transactions)
7802
+ .pipe(map((response) => {
7803
+ const updatedTransactions = response.map((item) => plainToClass(Transaction, item));
7804
+ updatedTransactions.forEach((updatedTransaction) => {
7805
+ replace(this.cache, updatedTransaction);
7806
+ });
7807
+ this.updateCache();
7808
+ return updatedTransactions;
7809
+ }));
7758
7810
  }
7759
7811
  /**
7760
- * Check if bank transaction is allocated
7812
+ * delete transaction and related transactions
7813
+ * @param model
7761
7814
  */
7762
- isAllocated(bankTransaction, allocations) {
7763
- return bankTransaction.amount === this.getAllocatedAmount(new BankTransactionCollection([bankTransaction]), allocations);
7815
+ delete(model) {
7816
+ return this.http.delete(`${this.environment.apiV2}/${this.url}/${model.id}`)
7817
+ .pipe(map(() => {
7818
+ this.cache = this.cache.filter((transaction) => {
7819
+ var _a;
7820
+ // when delete transfer we delete actually 2 transactions
7821
+ if (model.isTransfer) {
7822
+ const ids = [model.id];
7823
+ // get id of related transfer transaction
7824
+ if (model.transfer) {
7825
+ // just take id if we delete source transaction
7826
+ ids.push(model.transfer.id);
7827
+ }
7828
+ else {
7829
+ // find source transaction id if we delete destination transaction
7830
+ ids.push(this.cache.find((t) => t.transfer.id === model.id).id);
7831
+ }
7832
+ return !ids.includes(transaction.id);
7833
+ }
7834
+ return transaction.id !== model.id && ((_a = transaction.parentTransaction) === null || _a === void 0 ? void 0 : _a.id) !== model.id;
7835
+ });
7836
+ this.eventDispatcherService.dispatch(new AppEvent(AppEventTypeEnum.TRANSACTION_DELETED, model));
7837
+ this.toastService.success(MessagesEnum.DELETED_MESSAGE);
7838
+ this.updateCache();
7839
+ this.transactionDeleted.emit(model);
7840
+ }));
7764
7841
  }
7765
7842
  /**
7766
- * Get collection of allocated bank transactions
7767
- * @TODO Alex: consider to move to collection
7843
+ * upload transaction receipt image
7844
+ * @param transaction Еhe transaction for which the receipt will be imported
7768
7845
  */
7769
- getAllocatedBankTransactions(bankTransactions, allocations) {
7770
- return new BankTransactionCollection(bankTransactions.items.filter((bankTransaction) => {
7771
- return this.isAllocated(bankTransaction, allocations);
7772
- }));
7846
+ uploadReceipt(transaction) {
7847
+ const formData = new FormData();
7848
+ formData.append('file', transaction.file);
7849
+ transaction.receipt = null;
7850
+ this.http.post(`${this.environment.apiV2}/${this.url}/${transaction.id}/receipts`, formData)
7851
+ .subscribe((receiptResponse) => {
7852
+ // we don't need to keep file after save
7853
+ transaction.file = null;
7854
+ transaction.receipt = plainToClass(TransactionReceipt, receiptResponse);
7855
+ replace(this.cache, transaction);
7856
+ this.updateCache();
7857
+ });
7773
7858
  }
7774
7859
  /**
7775
- * Get collection of unallocated bank transactions
7776
- * @TODO Alex: consider to move to collection
7860
+ * calculate gross income amount based on transaction amount and taxes (fees)
7861
+ * @param transaction Transaction instance for calculation
7777
7862
  */
7778
- getUnallocatedBankTransactions(bankTransactions, allocations) {
7779
- return new BankTransactionCollection(bankTransactions.items.filter((bankTransaction) => {
7780
- return !this.isAllocated(bankTransaction, allocations);
7781
- }));
7863
+ calculateGrossAmount(transaction) {
7864
+ let amount = transaction.amount || 0;
7865
+ // gross income amount includes amount of fees for property tank and tax for work tank
7866
+ if (transaction.isPropertyTank()) {
7867
+ amount += transaction.transactions.reduce((sum, item) => sum + item.amount, 0);
7868
+ }
7869
+ else {
7870
+ // @TODO Alex: fix logic after TT-641 ready
7871
+ amount += (transaction.tax || 0);
7872
+ }
7873
+ return amount;
7782
7874
  }
7783
7875
  /**
7784
- * Allocated sum of credit transactions
7876
+ * get label for transaction tax field depended of selected chart account.
7877
+ * tax type depends of chart account heading or category.
7785
7878
  */
7786
- getCreditAmount(bankTransactions, allocations) {
7787
- return allocations.getByBankTransactionsIds(bankTransactions.creditTransactions.getIds()).amount;
7879
+ getTaxLabel(chartAccounts) {
7880
+ var _a, _b;
7881
+ // get simple array of ids from enum with taxable chart accounts headings
7882
+ const taxableCAHeadingsIds = enumToList(ChartAccountsHeadingTaxableEnum)
7883
+ .map((item) => item.value);
7884
+ // get simple array of ids from enum with tax deductible chart accounts headings
7885
+ const deductibleCAHeadingsIds = enumToList(ChartAccountsHeadingTaxDeductibleEnum)
7886
+ .map((item) => item.value);
7887
+ // check if one of ids arrays includes current chart accounts heading id and set tax label
7888
+ // otherwise label is empty for this class
7889
+ switch (true) {
7890
+ case taxableCAHeadingsIds.includes((_a = chartAccounts.heading) === null || _a === void 0 ? void 0 : _a.id):
7891
+ return ChartAccountsTaxLabelsEnum.TAX_PAID;
7892
+ case deductibleCAHeadingsIds.includes((_b = chartAccounts.heading) === null || _b === void 0 ? void 0 : _b.id):
7893
+ return ChartAccountsTaxLabelsEnum.TAX_DEDUCTED;
7894
+ case CHART_ACCOUNTS_CATEGORIES.workIncome.includes(chartAccounts.category):
7895
+ return ChartAccountsTaxLabelsEnum.TAX_WITHHELD;
7896
+ default:
7897
+ return null;
7898
+ }
7788
7899
  }
7789
7900
  /**
7790
- * Allocated sum of debit transactions
7901
+ * Listen to EventDispatcherService event related to Depreciation changing
7791
7902
  */
7792
- getDebitAmount(bankTransactions, allocations) {
7793
- return allocations.getByBankTransactionsIds(bankTransactions.debitTransactions.getIds()).amount;
7903
+ listenDepreciationChange() {
7904
+ this.eventDispatcherService.on(AppEventTypeEnum.DEPRECIATION_DELETED).subscribe(() => {
7905
+ this.fetch()
7906
+ .subscribe((transactions) => {
7907
+ this.cache = transactions;
7908
+ this.updateCache();
7909
+ });
7910
+ });
7911
+ }
7912
+ /**
7913
+ * Listen to EventDispatcherService event related to Property Share changing
7914
+ */
7915
+ listenPropertyShareUpdate() {
7916
+ this.eventDispatcherService.on(AppEventTypeEnum.PROPERTY_SHARE_UPDATED).subscribe(() => this.resetCache());
7794
7917
  }
7795
7918
  }
7796
- BankTransactionCalculationService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: BankTransactionCalculationService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
7797
- BankTransactionCalculationService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: BankTransactionCalculationService, providedIn: 'root' });
7798
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: BankTransactionCalculationService, decorators: [{
7919
+ TransactionService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: TransactionService, deps: null, target: i0.ɵɵFactoryTarget.Injectable });
7920
+ TransactionService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: TransactionService, providedIn: 'root' });
7921
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: TransactionService, decorators: [{
7799
7922
  type: Injectable,
7800
7923
  args: [{
7801
7924
  providedIn: 'root'
7802
7925
  }]
7803
7926
  }] });
7804
7927
 
7805
- class BankAccountCalculationService {
7806
- constructor(bankTransactionCalculationService) {
7807
- this.bankTransactionCalculationService = bankTransactionCalculationService;
7928
+ /**
7929
+ * Service handling user's account setup process.
7930
+ * Checks required steps and their completion
7931
+ */
7932
+ class AccountSetupService {
7933
+ constructor(clientIncomeTypesService, propertyService, incomeSourceService, bankAccountsService, transactionAllocationService, vehicleClaimService, transactionService) {
7934
+ this.clientIncomeTypesService = clientIncomeTypesService;
7935
+ this.propertyService = propertyService;
7936
+ this.incomeSourceService = incomeSourceService;
7937
+ this.bankAccountsService = bankAccountsService;
7938
+ this.transactionAllocationService = transactionAllocationService;
7939
+ this.vehicleClaimService = vehicleClaimService;
7940
+ this.transactionService = transactionService;
7941
+ this.cacheSubject = new ReplaySubject(1);
7808
7942
  }
7809
7943
  /**
7810
- * Sum of bank accounts opening balances and their bank transactions allocated amounts
7944
+ * Get list of account setup items for current user
7811
7945
  */
7812
- getTaxTankBalance(bankAccounts, bankTransactions, allocations) {
7813
- return bankAccounts.getOpeningBalance() +
7814
- this.bankTransactionCalculationService.getAllocatedAmount(bankTransactions.getByBankAccountsIds(bankAccounts.getIds()), allocations);
7946
+ get() {
7947
+ if (!this.cache) {
7948
+ this.clientIncomeTypesService.get().subscribe((incomeTypes) => {
7949
+ this.clientIncomeTypesId = incomeTypes.id;
7950
+ combineLatest(this.createBatch(incomeTypes)).subscribe((items) => {
7951
+ this.cache = new AccountSetupItemCollection(items);
7952
+ this.cacheSubject.next(this.cache);
7953
+ });
7954
+ });
7955
+ }
7956
+ return this.cacheSubject.asObservable();
7815
7957
  }
7816
7958
  /**
7817
- * get difference between total loans amount and total cash amount
7959
+ * Prepare client income types to update to hide depended account setup items
7960
+ */
7961
+ prepareIncomeTypes(item) {
7962
+ return plainToClass(ClientIncomeTypes, Object.assign({ id: this.clientIncomeTypesId }, fromPairs(item.clientIncomeTypes.map((type) => [type, false]))));
7963
+ }
7964
+ /**
7965
+ * Get a single AccountSetupItem and check it's completion
7966
+ */
7967
+ create(itemType, request) {
7968
+ return request.pipe(map((result) => {
7969
+ const item = ACCOUNT_SETUP_ITEMS[itemType];
7970
+ if (result.length) {
7971
+ item.isCompleted = true;
7972
+ }
7973
+ return item;
7974
+ }));
7975
+ }
7976
+ /**
7977
+ * Get batch of requests to get list of required AccountSetupItem's.
7978
+ * Some items are optional and depends of user's client income types
7979
+ */
7980
+ createBatch(incomeTypes) {
7981
+ const batch = [];
7982
+ // Salary item is completed when user added salary income source
7983
+ if (incomeTypes.salary) {
7984
+ batch.push(this.create(AccountSetupItemsEnum.SALARY, this.getIncomeSourcesByType(IncomeSourceTypeEnum.SALARY)));
7985
+ }
7986
+ // Other income item is completed when user added at least one other income source
7987
+ if (incomeTypes.dividends || incomeTypes.other) {
7988
+ batch.push(this.create(AccountSetupItemsEnum.OTHER_INCOME, this.getIncomeSourcesByType(IncomeSourceTypeEnum.OTHER)));
7989
+ }
7990
+ // Rental income item is completed when user added at least one property
7991
+ if (incomeTypes.property) {
7992
+ batch.push(this.create(AccountSetupItemsEnum.PROPERTY, this.propertyService.get()));
7993
+ }
7994
+ // Bank feeds item is completed when user added at least one bank account (basiq or manual)
7995
+ batch.push(this.create(AccountSetupItemsEnum.BANK_FEEDS, this.bankAccountsService.get()));
7996
+ // Logbook item is completed when user has at least one vehicle claim with any method (klms or logbook)
7997
+ batch.push(this.getLogbookItem());
7998
+ // @TODO waiting for sole tank forecast page
7999
+ // Sole item is completed when user added at least one sole income source
8000
+ // if (incomeTypes.soleTrader) {
8001
+ // batch.push(
8002
+ // this.prepareItem(
8003
+ // AccountSetupItemsEnum.SOLE_INCOME,
8004
+ // this.getIncomeSourcesByType(IncomeSourceTypeEnum.SOLE)
8005
+ // )
8006
+ // );
8007
+ // }
8008
+ // Allocation item is completed when user added at least one transaction allocation
8009
+ batch.push(this.create(AccountSetupItemsEnum.TRANSACTION, this.transactionAllocationService.get()));
8010
+ return batch;
8011
+ }
8012
+ /**
8013
+ * @TODO work with collection when services refactored
8014
+ */
8015
+ getIncomeSourcesByType(type) {
8016
+ return this.incomeSourceService.get().pipe(map((incomeSources) => {
8017
+ return new IncomeSourceCollection(incomeSources).getBy('type', type).toArray();
8018
+ }));
8019
+ }
8020
+ /**
8021
+ * Show logbook item when user has at least 1 vehicle transaction
8022
+ */
8023
+ getLogbookItem() {
8024
+ return combineLatest([
8025
+ this.transactionService.get(),
8026
+ this.create(AccountSetupItemsEnum.WORK_LOGBOOK, this.vehicleClaimService.get())
8027
+ ]).pipe(map(([transactions, item]) => {
8028
+ if (new TransactionCollection(transactions).getVehicleTransactions().length) {
8029
+ return item;
8030
+ }
8031
+ return null;
8032
+ }));
8033
+ }
8034
+ }
8035
+ AccountSetupService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: AccountSetupService, deps: [{ token: ClientIncomeTypesService }, { token: PropertyService }, { token: IncomeSourceService }, { token: BankAccountService }, { token: TransactionAllocationService }, { token: VehicleClaimService }, { token: TransactionService }], target: i0.ɵɵFactoryTarget.Injectable });
8036
+ AccountSetupService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: AccountSetupService, providedIn: 'root' });
8037
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: AccountSetupService, decorators: [{
8038
+ type: Injectable,
8039
+ args: [{
8040
+ providedIn: 'root'
8041
+ }]
8042
+ }], ctorParameters: function () { return [{ type: ClientIncomeTypesService }, { type: PropertyService }, { type: IncomeSourceService }, { type: BankAccountService }, { type: TransactionAllocationService }, { type: VehicleClaimService }, { type: TransactionService }]; } });
8043
+
8044
+ class AddressService {
8045
+ constructor(http, environment) {
8046
+ this.http = http;
8047
+ this.environment = environment;
8048
+ this.countriesSubject = new ReplaySubject(1);
8049
+ }
8050
+ getCountries() {
8051
+ if (!this._countries) {
8052
+ this.http.get(`${this.environment.apiV2}/countries`)
8053
+ .pipe(map((response) => {
8054
+ return response['hydra:member'].map((item) => plainToClass(Country, item));
8055
+ }))
8056
+ .subscribe((countries) => {
8057
+ this._countries = countries;
8058
+ this.countriesSubject.next(countries);
8059
+ });
8060
+ }
8061
+ return this.countriesSubject.asObservable();
8062
+ }
8063
+ }
8064
+ AddressService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: AddressService, deps: [{ token: i1.HttpClient }, { token: 'environment' }], target: i0.ɵɵFactoryTarget.Injectable });
8065
+ AddressService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: AddressService, providedIn: 'root' });
8066
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: AddressService, decorators: [{
8067
+ type: Injectable,
8068
+ args: [{
8069
+ providedIn: 'root'
8070
+ }]
8071
+ }], ctorParameters: function () { return [{ type: i1.HttpClient }, { type: undefined, decorators: [{
8072
+ type: Inject,
8073
+ args: ['environment']
8074
+ }] }]; } });
8075
+
8076
+ /**
8077
+ * Service to work with assets (documents, receipts, e.t.c.)
8078
+ */
8079
+ class AssetsService {
8080
+ constructor(http, userSwitcherService, environment) {
8081
+ this.http = http;
8082
+ this.userSwitcherService = userSwitcherService;
8083
+ this.environment = environment;
8084
+ this.impersonatedClient = this.userSwitcherService.get();
8085
+ }
8086
+ /**
8087
+ * Get asset link
8088
+ * @param asset to get the link for
8089
+ */
8090
+ getLink(asset) {
8091
+ return this.http.get(`${this.environment.apiV2}/assets/${asset.type}/${asset.id}`);
8092
+ }
8093
+ /**
8094
+ * Download asset
8095
+ * @param asset which should be downloaded
8096
+ * @TODO refactor
8097
+ */
8098
+ download(asset) {
8099
+ return `${this.environment.apiV2}/assets/${asset.type}/${asset.id}/download?bearer=${localStorage.getItem('token')}${this.impersonatedClient ? `&_switch_user=${this.impersonatedClient}` : ''}`;
8100
+ }
8101
+ // @Todo refactor to event dispatcher
8102
+ /**
8103
+ * Delete asset
8104
+ * @param entityId: id of asset main entity (property, folder, transaction, e.t.c.)
8105
+ * @param asset which should be deleted
8106
+ */
8107
+ delete(entityId, asset) {
8108
+ return this.http.delete(`${this.environment.apiV2}/${asset.entityType}/${entityId}/${asset.type}/${asset.id}`);
8109
+ }
8110
+ }
8111
+ AssetsService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: AssetsService, deps: [{ token: i1.HttpClient }, { token: UserSwitcherService }, { token: 'environment' }], target: i0.ɵɵFactoryTarget.Injectable });
8112
+ AssetsService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: AssetsService, providedIn: 'root' });
8113
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: AssetsService, decorators: [{
8114
+ type: Injectable,
8115
+ args: [{
8116
+ providedIn: 'root'
8117
+ }]
8118
+ }], ctorParameters: function () { return [{ type: i1.HttpClient }, { type: UserSwitcherService }, { type: undefined, decorators: [{
8119
+ type: Inject,
8120
+ args: ['environment']
8121
+ }] }]; } });
8122
+
8123
+ /**
8124
+ * Service that handling banks logic
8125
+ */
8126
+ class BankService extends RestService {
8127
+ constructor() {
8128
+ super(...arguments);
8129
+ this.modelClass = Bank;
8130
+ this.url = 'banks';
8131
+ this.isHydra = true;
8132
+ }
8133
+ }
8134
+ BankService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: BankService, deps: null, target: i0.ɵɵFactoryTarget.Injectable });
8135
+ BankService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: BankService, providedIn: 'root' });
8136
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: BankService, decorators: [{
8137
+ type: Injectable,
8138
+ args: [{
8139
+ providedIn: 'root'
8140
+ }]
8141
+ }] });
8142
+
8143
+ /**
8144
+ * @TODO move to collection
8145
+ */
8146
+ class BankTransactionCalculationService {
8147
+ /**
8148
+ * Sum of allocations for passed bank transactions
8149
+ */
8150
+ getAllocatedAmount(bankTransactions, allocations) {
8151
+ return allocations.getByBankTransactionsIds(bankTransactions.getIds()).amount;
8152
+ }
8153
+ /**
8154
+ * Difference between total bank transactions amount and sum of allocations for passed bank transactions
8155
+ */
8156
+ getUnallocatedAmount(bankTransactionCollection, allocations) {
8157
+ return bankTransactionCollection.getAmount() - allocations.amount;
8158
+ }
8159
+ /**
8160
+ * Check if bank transaction is allocated
8161
+ */
8162
+ isAllocated(bankTransaction, allocations) {
8163
+ return bankTransaction.amount === this.getAllocatedAmount(new BankTransactionCollection([bankTransaction]), allocations);
8164
+ }
8165
+ /**
8166
+ * Get collection of allocated bank transactions
8167
+ * @TODO Alex: consider to move to collection
8168
+ */
8169
+ getAllocatedBankTransactions(bankTransactions, allocations) {
8170
+ return new BankTransactionCollection(bankTransactions.items.filter((bankTransaction) => {
8171
+ return this.isAllocated(bankTransaction, allocations);
8172
+ }));
8173
+ }
8174
+ /**
8175
+ * Get collection of unallocated bank transactions
8176
+ * @TODO Alex: consider to move to collection
8177
+ */
8178
+ getUnallocatedBankTransactions(bankTransactions, allocations) {
8179
+ return new BankTransactionCollection(bankTransactions.items.filter((bankTransaction) => {
8180
+ return !this.isAllocated(bankTransaction, allocations);
8181
+ }));
8182
+ }
8183
+ /**
8184
+ * Allocated sum of credit transactions
8185
+ */
8186
+ getCreditAmount(bankTransactions, allocations) {
8187
+ return allocations.getByBankTransactionsIds(bankTransactions.creditTransactions.getIds()).amount;
8188
+ }
8189
+ /**
8190
+ * Allocated sum of debit transactions
8191
+ */
8192
+ getDebitAmount(bankTransactions, allocations) {
8193
+ return allocations.getByBankTransactionsIds(bankTransactions.debitTransactions.getIds()).amount;
8194
+ }
8195
+ }
8196
+ BankTransactionCalculationService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: BankTransactionCalculationService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
8197
+ BankTransactionCalculationService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: BankTransactionCalculationService, providedIn: 'root' });
8198
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: BankTransactionCalculationService, decorators: [{
8199
+ type: Injectable,
8200
+ args: [{
8201
+ providedIn: 'root'
8202
+ }]
8203
+ }] });
8204
+
8205
+ class BankAccountCalculationService {
8206
+ constructor(bankTransactionCalculationService) {
8207
+ this.bankTransactionCalculationService = bankTransactionCalculationService;
8208
+ }
8209
+ /**
8210
+ * Sum of bank accounts opening balances and their bank transactions allocated amounts
8211
+ */
8212
+ getTaxTankBalance(bankAccounts, bankTransactions, allocations) {
8213
+ return bankAccounts.getOpeningBalance() +
8214
+ this.bankTransactionCalculationService.getAllocatedAmount(bankTransactions.getByBankAccountsIds(bankAccounts.getIds()), allocations);
8215
+ }
8216
+ /**
8217
+ * get difference between total loans amount and total cash amount
7818
8218
  */
7819
8219
  getNetPosition(bankAccounts, bankTransactions, allocations) {
7820
8220
  return bankAccounts.currentBalance - this.getTaxTankBalance(bankAccounts.getLoanAccounts(), bankTransactions, allocations);
@@ -9643,330 +10043,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImpo
9643
10043
  }]
9644
10044
  }] });
9645
10045
 
9646
- function enumToList(data) {
9647
- const list = [];
9648
- for (const key in data) {
9649
- if (Number(key) >= 0) {
9650
- list.push({
9651
- label: data[key],
9652
- value: Number(key)
9653
- });
9654
- }
9655
- }
9656
- return list;
9657
- }
9658
-
9659
- var MessagesEnum;
9660
- (function (MessagesEnum) {
9661
- MessagesEnum["DELETED_MESSAGE"] = "Transaction deleted";
9662
- MessagesEnum["UPDATED_MESSAGE"] = "Transaction updated";
9663
- MessagesEnum["CREATED_MESSAGE"] = "Transaction(s) created";
9664
- })(MessagesEnum || (MessagesEnum = {}));
9665
-
9666
- /**
9667
- * Service for transactions business logic
9668
- */
9669
- class TransactionService extends RestService {
9670
- constructor() {
9671
- super(...arguments);
9672
- // url part for Transaction API
9673
- this.url = 'transactions';
9674
- this.modelClass = Transaction;
9675
- this.transactionDeleted = new EventEmitter();
9676
- }
9677
- /**
9678
- * Listen events from Event Dispatcher services
9679
- */
9680
- listenEvents() {
9681
- this.listenDepreciationChange();
9682
- this.listenPropertyShareUpdate();
9683
- }
9684
- /**
9685
- * get list of all user's TaxTank transactions
9686
- */
9687
- get() {
9688
- if (!this.cache) {
9689
- // set cache as default empty array to avoid multiple backend requests
9690
- this.cache = [];
9691
- this.fetch()
9692
- .subscribe((transactions) => {
9693
- this.cache = transactions;
9694
- this.updateCache();
9695
- });
9696
- }
9697
- return this.cacheSubject.asObservable().pipe(
9698
- // assign child transactions (fees) to parent transactions
9699
- map((transactions) => {
9700
- transactions.forEach((transaction) => {
9701
- transaction.transactions = transactions
9702
- // get list of child transactions
9703
- .filter((t) => t.parentTransaction && t.parentTransaction.id === transaction.id);
9704
- });
9705
- sort(transactions, 'date', false);
9706
- return transactions;
9707
- }));
9708
- }
9709
- /**
9710
- * Add single new transaction
9711
- * @param model New Transaction instance for saving
9712
- */
9713
- add(model) {
9714
- // we don't have POST API endpoint for single transaction
9715
- return this.addBatch([model])
9716
- .pipe(map((newTransactions) => {
9717
- // @TODO alex
9718
- this.eventDispatcherService.dispatch(new AppEvent(AppEventTypeEnum.TRANSACTION_CREATED, newTransactions[0]));
9719
- return newTransactions[0];
9720
- }));
9721
- }
9722
- /**
9723
- * get transactions related with property
9724
- */
9725
- getByPropertyId(propertyId) {
9726
- return this.get()
9727
- .pipe(map((transactions) => {
9728
- return transactions.filter((transaction) => {
9729
- var _a;
9730
- return ((_a = transaction.property) === null || _a === void 0 ? void 0 : _a.id) === propertyId;
9731
- });
9732
- }));
9733
- }
9734
- /**
9735
- * get list of transactions with tank type 'Work'
9736
- */
9737
- getWorkTransactions() {
9738
- return this.get()
9739
- .pipe(map((transactions) => {
9740
- return transactions.filter((transaction) => transaction.isWorkTank());
9741
- }));
9742
- }
9743
- /**
9744
- * Get list of property holding costs (transactions related to vacant land property)
9745
- */
9746
- getPropertyHoldingCosts(propertyId) {
9747
- return this.http.get(`${this.environment.apiV2}/${this.url}?propertyId=${propertyId}&propertyCategoryId=${PropertyCategoryListEnum.VACANT_LAND}`)
9748
- .pipe(map((transactionsBase) => {
9749
- return transactionsBase.map((transactionBase) => plainToClass(Transaction, transactionBase));
9750
- }));
9751
- }
9752
- /**
9753
- * get list of taxable transactions with tank type 'Work'
9754
- */
9755
- getTaxableWorkTransactions() {
9756
- return this.getWorkTransactions()
9757
- .pipe(map((transactions) => {
9758
- return transactions.filter((transaction) => !!transaction.chartAccounts.taxReturnItem);
9759
- }));
9760
- }
9761
- /**
9762
- * add multiple transactions
9763
- * @param transactions List of new Transaction instances for saving
9764
- */
9765
- addBatch(transactions) {
9766
- transactions = _.cloneDeep(transactions);
9767
- return this.http.post(`${this.environment.apiV2}/${this.url}`, transactions)
9768
- .pipe(map((response) => {
9769
- const addedTransactions = response.map((item) => plainToClass(Transaction, item));
9770
- transactions.forEach((transaction, index) => {
9771
- // @TODO backend: need to upload file in the same backend endpoint with transaction add/update
9772
- // check if passed receipt and upload file
9773
- if (transaction.file) {
9774
- transaction.id = response[index].id;
9775
- addedTransactions[index].file = transaction.file;
9776
- this.uploadReceipt(addedTransactions[index]);
9777
- }
9778
- // @TODO Viktor: implement API for saving of nested transactions
9779
- // add child transactions if exist
9780
- if (transaction.transactions.length) {
9781
- transaction.transactions.forEach((childTransaction) => {
9782
- childTransaction.parentTransaction = plainToClass(Transaction, { id: addedTransactions[index].id });
9783
- });
9784
- this.addBatch(transaction.transactions).subscribe();
9785
- }
9786
- // add transfer transaction to cache
9787
- if (transaction.operation === TransactionOperationEnum.TRANSFER) {
9788
- addedTransactions.push(addedTransactions[0].transfer);
9789
- }
9790
- });
9791
- if (this.cache) {
9792
- this.cache.push(...addedTransactions);
9793
- this.updateCache();
9794
- }
9795
- this.eventDispatcherService.dispatch(new AppEvent(AppEventTypeEnum.TRANSACTIONS_CREATED, addedTransactions));
9796
- this.toastService.success(MessagesEnum.CREATED_MESSAGE);
9797
- return addedTransactions;
9798
- }));
9799
- }
9800
- /**
9801
- * update existing transaction
9802
- * @param transaction Transaction instance for updating
9803
- */
9804
- update(transaction) {
9805
- return this.http.put(`${this.environment.apiV2}/${this.url}/${transaction.id}`, transaction)
9806
- .pipe(map((response) => {
9807
- const updatedTransaction = plainToClass(Transaction, response);
9808
- // @TODO need to upload file in the same backend endpoint with transaction add/update
9809
- // check if passed new receipt and upload file
9810
- if (transaction.file) {
9811
- updatedTransaction.file = transaction.file;
9812
- this.uploadReceipt(updatedTransaction);
9813
- }
9814
- // @TODO Viktor: implement API for saving of nested transactions
9815
- if (transaction.transactions.length) {
9816
- // add parent transaction to child transactions
9817
- transaction.transactions.forEach((childTransaction) => {
9818
- childTransaction.parentTransaction = plainToClass(Transaction, { id: updatedTransaction.id });
9819
- });
9820
- // separate child transactions by id existing to define add or update action.
9821
- const childTransactionsToUpdate = transaction.transactions.filter((t) => t.id);
9822
- const childTransactionsToAdd = transaction.transactions.filter((t) => !t.id);
9823
- // update child transactions
9824
- if (childTransactionsToUpdate.length) {
9825
- this.updateBatch(childTransactionsToUpdate).subscribe();
9826
- }
9827
- // add child transactions
9828
- if (childTransactionsToAdd.length) {
9829
- this.addBatch(childTransactionsToAdd).subscribe();
9830
- }
9831
- }
9832
- this.toastService.success(MessagesEnum.UPDATED_MESSAGE);
9833
- replace(this.cache, updatedTransaction);
9834
- this.updateCache();
9835
- return updatedTransaction;
9836
- }));
9837
- }
9838
- /**
9839
- * update multiple transactions
9840
- * @param transactions list of transactions for updating
9841
- */
9842
- updateBatch(transactions) {
9843
- return this.http.put(`${this.environment.apiV2}/${this.url}`, transactions)
9844
- .pipe(map((response) => {
9845
- const updatedTransactions = response.map((item) => plainToClass(Transaction, item));
9846
- updatedTransactions.forEach((updatedTransaction) => {
9847
- replace(this.cache, updatedTransaction);
9848
- });
9849
- this.updateCache();
9850
- return updatedTransactions;
9851
- }));
9852
- }
9853
- /**
9854
- * delete transaction and related transactions
9855
- * @param model
9856
- */
9857
- delete(model) {
9858
- return this.http.delete(`${this.environment.apiV2}/${this.url}/${model.id}`)
9859
- .pipe(map(() => {
9860
- this.cache = this.cache.filter((transaction) => {
9861
- var _a;
9862
- // when delete transfer we delete actually 2 transactions
9863
- if (model.isTransfer) {
9864
- const ids = [model.id];
9865
- // get id of related transfer transaction
9866
- if (model.transfer) {
9867
- // just take id if we delete source transaction
9868
- ids.push(model.transfer.id);
9869
- }
9870
- else {
9871
- // find source transaction id if we delete destination transaction
9872
- ids.push(this.cache.find((t) => t.transfer.id === model.id).id);
9873
- }
9874
- return !ids.includes(transaction.id);
9875
- }
9876
- return transaction.id !== model.id && ((_a = transaction.parentTransaction) === null || _a === void 0 ? void 0 : _a.id) !== model.id;
9877
- });
9878
- this.eventDispatcherService.dispatch(new AppEvent(AppEventTypeEnum.TRANSACTION_DELETED, model));
9879
- this.toastService.success(MessagesEnum.DELETED_MESSAGE);
9880
- this.updateCache();
9881
- this.transactionDeleted.emit(model);
9882
- }));
9883
- }
9884
- /**
9885
- * upload transaction receipt image
9886
- * @param transaction Еhe transaction for which the receipt will be imported
9887
- */
9888
- uploadReceipt(transaction) {
9889
- const formData = new FormData();
9890
- formData.append('file', transaction.file);
9891
- transaction.receipt = null;
9892
- this.http.post(`${this.environment.apiV2}/${this.url}/${transaction.id}/receipts`, formData)
9893
- .subscribe((receiptResponse) => {
9894
- // we don't need to keep file after save
9895
- transaction.file = null;
9896
- transaction.receipt = plainToClass(TransactionReceipt, receiptResponse);
9897
- replace(this.cache, transaction);
9898
- this.updateCache();
9899
- });
9900
- }
9901
- /**
9902
- * calculate gross income amount based on transaction amount and taxes (fees)
9903
- * @param transaction Transaction instance for calculation
9904
- */
9905
- calculateGrossAmount(transaction) {
9906
- let amount = transaction.amount || 0;
9907
- // gross income amount includes amount of fees for property tank and tax for work tank
9908
- if (transaction.isPropertyTank()) {
9909
- amount += transaction.transactions.reduce((sum, item) => sum + item.amount, 0);
9910
- }
9911
- else {
9912
- // @TODO Alex: fix logic after TT-641 ready
9913
- amount += (transaction.tax || 0);
9914
- }
9915
- return amount;
9916
- }
9917
- /**
9918
- * get label for transaction tax field depended of selected chart account.
9919
- * tax type depends of chart account heading or category.
9920
- */
9921
- getTaxLabel(chartAccounts) {
9922
- var _a, _b;
9923
- // get simple array of ids from enum with taxable chart accounts headings
9924
- const taxableCAHeadingsIds = enumToList(ChartAccountsHeadingTaxableEnum)
9925
- .map((item) => item.value);
9926
- // get simple array of ids from enum with tax deductible chart accounts headings
9927
- const deductibleCAHeadingsIds = enumToList(ChartAccountsHeadingTaxDeductibleEnum)
9928
- .map((item) => item.value);
9929
- // check if one of ids arrays includes current chart accounts heading id and set tax label
9930
- // otherwise label is empty for this class
9931
- switch (true) {
9932
- case taxableCAHeadingsIds.includes((_a = chartAccounts.heading) === null || _a === void 0 ? void 0 : _a.id):
9933
- return ChartAccountsTaxLabelsEnum.TAX_PAID;
9934
- case deductibleCAHeadingsIds.includes((_b = chartAccounts.heading) === null || _b === void 0 ? void 0 : _b.id):
9935
- return ChartAccountsTaxLabelsEnum.TAX_DEDUCTED;
9936
- case CHART_ACCOUNTS_CATEGORIES.workIncome.includes(chartAccounts.category):
9937
- return ChartAccountsTaxLabelsEnum.TAX_WITHHELD;
9938
- default:
9939
- return null;
9940
- }
9941
- }
9942
- /**
9943
- * Listen to EventDispatcherService event related to Depreciation changing
9944
- */
9945
- listenDepreciationChange() {
9946
- this.eventDispatcherService.on(AppEventTypeEnum.DEPRECIATION_DELETED).subscribe(() => {
9947
- this.fetch()
9948
- .subscribe((transactions) => {
9949
- this.cache = transactions;
9950
- this.updateCache();
9951
- });
9952
- });
9953
- }
9954
- /**
9955
- * Listen to EventDispatcherService event related to Property Share changing
9956
- */
9957
- listenPropertyShareUpdate() {
9958
- this.eventDispatcherService.on(AppEventTypeEnum.PROPERTY_SHARE_UPDATED).subscribe(() => this.resetCache());
9959
- }
9960
- }
9961
- TransactionService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: TransactionService, deps: null, target: i0.ɵɵFactoryTarget.Injectable });
9962
- TransactionService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: TransactionService, providedIn: 'root' });
9963
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: TransactionService, decorators: [{
9964
- type: Injectable,
9965
- args: [{
9966
- providedIn: 'root'
9967
- }]
9968
- }] });
9969
-
9970
10046
  /**
9971
10047
  * Service to handle Property transactions report items data (get income / expense report items, e.t.c.)
9972
10048
  */
@@ -11493,5 +11569,5 @@ class VehicleClaimForm extends AbstractForm {
11493
11569
  * Generated bundle index. Do not edit.
11494
11570
  */
11495
11571
 
11496
- export { AbstractForm, AccountSetupItem, AccountSetupItemCollection, AccountSetupService, Address, AddressService, AddressTypeEnum, AlphabetColorsEnum, AppEvent, AppEventTypeEnum, AssetEntityTypeEnum, AssetTypeEnum, AssetsService, AuthService, BANK_ACCOUNT_TYPES, Bank, BankAccount, BankAccountCalculationService, BankAccountChartData, BankAccountCollection, BankAccountProperty, BankAccountService, BankAccountStatusEnum, BankAccountTypeEnum, BankConnection, BankConnectionService, BankConnectionStatusEnum, BankService, BankTransaction, BankTransactionCalculationService, BankTransactionChartData, BankTransactionCollection, BankTransactionService, BankTransactionSummaryFieldsEnum, BankTransactionTypeEnum, BasiqConfig, BasiqJob, BasiqService, BasiqToken, BorrowingExpense, BorrowingExpenseLoan, BorrowingExpenseService, CAPITAL_COSTS_ITEMS, CHART_ACCOUNTS_CATEGORIES, CalculationFormItem, CalculationFormTypeEnum, ChartAccounts, ChartAccountsCategoryEnum, ChartAccountsDepreciation, ChartAccountsDepreciationService, ChartAccountsEtpEnum, ChartAccountsHeading, ChartAccountsHeadingTaxDeductibleEnum, ChartAccountsHeadingTaxableEnum, ChartAccountsHeadingVehicleListEnum, ChartAccountsListEnum, ChartAccountsMetadata, ChartAccountsMetadataListEnum, ChartAccountsMetadataTypeEnum, ChartAccountsService, ChartAccountsTaxLabelsEnum, ChartAccountsTypeEnum, ChartAccountsValue, ChartData, ChartSerie, Chat, ChatService, ChatStatusEnum, ChatViewTypeEnum, ClientCollection, ClientDetails, ClientDetailsMedicareExemptionEnum, ClientDetailsWorkDepreciationCalculationEnum, ClientDetailsWorkingHolidayMakerEnum, ClientIncomeTypes, ClientIncomeTypesForm, ClientIncomeTypesService, ClientInvite, ClientInviteService, ClientInviteStatusEnum, ClientInviteTypeEnum, ClientMovement, ClientMovementCollection, ClientMovementService, ClientPortfolioChartData, ClientPortfolioReport, ClientPortfolioReportCollection, ClientPortfolioReportService, Collection, CollectionDictionary, CorelogicService, CorelogicSuggestion, Country, DEFAULT_VEHICLE_EXPENSE, DEPRECIATION_GROUPS, DOCUMENT_FILE_TYPES, Depreciation, DepreciationCalculationEnum, DepreciationCalculationPercentEnum, DepreciationCapitalProject, DepreciationCapitalProjectService, DepreciationCollection, DepreciationForecast, DepreciationForecastCollection, DepreciationGroup, DepreciationGroupEnum, DepreciationGroupItem, DepreciationLvpAssetTypeEnum, DepreciationLvpReportItem, DepreciationLvpReportItemCollection, DepreciationReceipt, DepreciationReportItem, DepreciationReportItemCollection, DepreciationService, DepreciationTypeEnum, DepreciationWriteOffAmountEnum, Document, DocumentApiUrlPrefixEnum, DocumentFolder, DocumentFolderService, ENDPOINTS, EmployeeCollection, EmployeeDetails, EmployeeInvite, EmployeeInviteService, EmployeeService, Endpoint, EquityPositionChartService, EventDispatcherService, ExportDataTable, ExportFormatEnum, FinancialYear, Firm, FirmService, FirmTypeEnum, HeaderTitleService, IconsFileEnum, IncomeAmountTypeEnum, IncomePosition, IncomeSource, IncomeSourceChartData, IncomeSourceCollection, IncomeSourceForecast, IncomeSourceForecastService, IncomeSourceService, IncomeSourceType, IncomeSourceTypeEnum, IncomeSourceTypeListOtherEnum, IncomeSourceTypeListSalaryEnum, IncomeSourceTypeListWorkEnum, InterceptorsModule, IntercomService, InviteStatusEnum, JwtService, KompassifyService, Loan, LoanBankTypeEnum, LoanCollection, LoanFrequencyEnum, LoanInterestTypeEnum, LoanMaxNumberOfPaymentsEnum, LoanPayment, LoanPayout, LoanPayoutTypeEnum, LoanRepaymentFrequencyEnum, LoanRepaymentTypeEnum, LoanService, LoanTypeEnum, LoanVehicleTypeEnum, LogbookPeriod, LoginForm, MODULE_URL_LIST, MONTHS, Message, MessageCollection, MessageDocument, MessageDocumentCollection, MessageDocumentService, MessageService, MonthNameShortEnum, MonthNumberEnum, MyAccountHistory, MyAccountHistoryInitiatedByEnum, MyAccountHistoryStatusEnum, MyAccountHistoryTypeEnum, Notification, Occupation, OccupationService, PasswordForm, PdfOrientationEnum, PdfService, PdfSettings, Phone, PhoneTypeEnum, PreloaderService, Property, PropertyCalculationService, PropertyCategory, PropertyCategoryListEnum, PropertyCategoryMovement, PropertyCategoryMovementService, PropertyCategoryService, PropertyCollection, PropertyDepreciationCalculationEnum, PropertyDocument, PropertyDocumentService, PropertyEquityChartData, PropertyEquityChartItem, PropertyForecast, PropertyHoldingCostsService, PropertyReportItem, PropertyReportItemCollection, PropertyReportItemDepreciationCollection, PropertyReportItemTransaction, PropertyReportItemTransactionCollection, PropertySale, PropertySaleService, PropertySaleTaxExemptionMetadata, PropertyService, PropertyShare, PropertyShareAccessEnum, PropertyShareService, PropertyShareStatusEnum, PropertySubscription, PropertyTransactionReportService, PropertyValuation, RegisterClientForm, RegisterFirmForm, RegistrationInvite, RegistrationInviteStatusEnum, ReportItem, ReportItemCollection, ReportItemDetails, ResetPasswordForm, SUBSCRIPTION_DESCRIPTION, SUBSCRIPTION_TITLE, SalaryForecast, SalaryForecastFrequencyEnum, SalaryForecastService, ServiceNotificationService, ServiceNotificationStatusEnum, ServiceNotificationTypeEnum, ServicePayment, ServicePaymentStatusEnum, ServicePrice, ServicePriceRecurringIntervalEnum, ServicePriceService, ServicePriceTypeEnum, ServiceProduct, ServiceProductStatusEnum, ServiceSubscription, ServiceSubscriptionCollection, ServiceSubscriptionItem, ServiceSubscriptionStatusEnum, ShareFilterOptionsEnum, SoleForecast, SoleForecastService, SpareDocumentSpareTypeEnum, SseService, SubscriptionService, SubscriptionTypeEnum, TYPE_LOAN, TankTypeEnum, TaxCalculationMedicareExemptionEnum, TaxCalculationTypeEnum, TaxExemption, TaxExemptionEnum, TaxExemptionMetadata, TaxExemptionMetadataEnum, TaxExemptionService, TaxReturnCategoryListEnum, TaxReturnCategorySectionEnum, TaxReview, TaxReviewCollection, TaxReviewHistoryService, TaxReviewService, TaxReviewStatusEnum, TaxSummary, TaxSummaryListEnum, TaxSummarySection, TaxSummarySectionEnum, TaxSummaryService, TaxSummaryTaxSummaryEnum, TaxSummaryTypeEnum, TicketFeedbackEnum, TicketStatusEnum, TicketTypesEnum, Toast, ToastService, ToastTypeEnum, Transaction, TransactionAllocation, TransactionAllocationCollection, TransactionAllocationService, TransactionBase, TransactionCalculationService, TransactionCollection, TransactionMetadata, TransactionOperationEnum, TransactionReceipt, TransactionService, TransactionSourceEnum, TransactionTypeEnum, TtCoreModule, USER_ROLES, USER_WORK_POSITION, User, UserEventSetting, UserEventSettingCollection, UserEventSettingFieldEnum, UserEventSettingService, UserEventStatusEnum, UserEventType, UserEventTypeCategory, UserEventTypeClientTypeEnum, UserEventTypeEmployeeTypeEnum, UserEventTypeFrequencyEnum, UserEventTypeService, UserEventTypeUserTypeEnum, UserMedicareExemptionEnum, UserRolesEnum, UserService, UserStatusEnum, UserSwitcherService, UserTitleEnum, UserToRegister, UserWorkDepreciationCalculationEnum, UserWorkingHolidayMakerEnum, Vehicle, VehicleClaim, VehicleClaimForm, VehicleClaimMethodEnum, VehicleClaimService, VehicleCollection, VehicleForm, VehicleLogbook, VehicleLogbookCollection, VehicleLogbookPurposeEnum, VehicleLogbookService, VehicleService, WORK_TANK_LOGBOOK_PURPOSE_OPTIONS, XlsxService, cloneDeep, compare, compareMatOptions, createDate, displayMatOptions, enumToList, getDocIcon, replace, roundTo, sort, sortDeep, taxReviewFilterPredicate };
11572
+ export { AbstractForm, AccountSetupItem, AccountSetupItemCollection, AccountSetupService, Address, AddressService, AddressTypeEnum, AlphabetColorsEnum, AppEvent, AppEventTypeEnum, AssetEntityTypeEnum, AssetTypeEnum, AssetsService, AuthService, BANK_ACCOUNT_TYPES, Bank, BankAccount, BankAccountCalculationService, BankAccountChartData, BankAccountCollection, BankAccountProperty, BankAccountService, BankAccountStatusEnum, BankAccountTypeEnum, BankConnection, BankConnectionService, BankConnectionStatusEnum, BankService, BankTransaction, BankTransactionCalculationService, BankTransactionChartData, BankTransactionCollection, BankTransactionService, BankTransactionSummaryFieldsEnum, BankTransactionTypeEnum, BasiqConfig, BasiqJob, BasiqService, BasiqToken, BorrowingExpense, BorrowingExpenseLoan, BorrowingExpenseService, CAPITAL_COSTS_ITEMS, CHART_ACCOUNTS_CATEGORIES, CalculationFormItem, CalculationFormTypeEnum, ChartAccounts, ChartAccountsCategoryEnum, ChartAccountsDepreciation, ChartAccountsDepreciationService, ChartAccountsEtpEnum, ChartAccountsHeading, ChartAccountsHeadingTaxDeductibleEnum, ChartAccountsHeadingTaxableEnum, ChartAccountsHeadingVehicleListEnum, ChartAccountsListEnum, ChartAccountsMetadata, ChartAccountsMetadataListEnum, ChartAccountsMetadataTypeEnum, ChartAccountsService, ChartAccountsTaxLabelsEnum, ChartAccountsTypeEnum, ChartAccountsValue, ChartData, ChartSerie, Chat, ChatService, ChatStatusEnum, ChatViewTypeEnum, ClientCollection, ClientDetails, ClientDetailsMedicareExemptionEnum, ClientDetailsWorkDepreciationCalculationEnum, ClientDetailsWorkingHolidayMakerEnum, ClientIncomeTypes, ClientIncomeTypesForm, ClientIncomeTypesService, ClientInvite, ClientInviteService, ClientInviteStatusEnum, ClientInviteTypeEnum, ClientMovement, ClientMovementCollection, ClientMovementService, ClientPortfolioChartData, ClientPortfolioReport, ClientPortfolioReportCollection, ClientPortfolioReportService, Collection, CollectionDictionary, CorelogicService, CorelogicSuggestion, Country, DEFAULT_VEHICLE_EXPENSE, DEPRECIATION_GROUPS, DOCUMENT_FILE_TYPES, Depreciation, DepreciationCalculationEnum, DepreciationCalculationPercentEnum, DepreciationCapitalProject, DepreciationCapitalProjectService, DepreciationCollection, DepreciationForecast, DepreciationForecastCollection, DepreciationGroup, DepreciationGroupEnum, DepreciationGroupItem, DepreciationLvpAssetTypeEnum, DepreciationLvpReportItem, DepreciationLvpReportItemCollection, DepreciationReceipt, DepreciationReportItem, DepreciationReportItemCollection, DepreciationService, DepreciationTypeEnum, DepreciationWriteOffAmountEnum, Document, DocumentApiUrlPrefixEnum, DocumentFolder, DocumentFolderService, ENDPOINTS, EmployeeCollection, EmployeeDetails, EmployeeInvite, EmployeeInviteService, EmployeeService, Endpoint, EquityPositionChartService, EventDispatcherService, ExportDataTable, ExportFormatEnum, FinancialYear, Firm, FirmService, FirmTypeEnum, HeaderTitleService, IconsFileEnum, IncomeAmountTypeEnum, IncomePosition, IncomeSource, IncomeSourceChartData, IncomeSourceCollection, IncomeSourceForecast, IncomeSourceForecastService, IncomeSourceService, IncomeSourceType, IncomeSourceTypeEnum, IncomeSourceTypeListOtherEnum, IncomeSourceTypeListSalaryEnum, IncomeSourceTypeListWorkEnum, InterceptorsModule, IntercomService, InviteStatusEnum, JwtService, KompassifyService, Loan, LoanBankTypeEnum, LoanCollection, LoanFrequencyEnum, LoanInterestTypeEnum, LoanMaxNumberOfPaymentsEnum, LoanPayment, LoanPayout, LoanPayoutTypeEnum, LoanRepaymentFrequencyEnum, LoanRepaymentTypeEnum, LoanService, LoanTypeEnum, LoanVehicleTypeEnum, LogbookPeriod, LoginForm, MODULE_URL_LIST, MONTHS, Message, MessageCollection, MessageDocument, MessageDocumentCollection, MessageDocumentService, MessageService, MonthNameShortEnum, MonthNumberEnum, MyAccountHistory, MyAccountHistoryInitiatedByEnum, MyAccountHistoryStatusEnum, MyAccountHistoryTypeEnum, Notification, Occupation, OccupationService, PasswordForm, PdfOrientationEnum, PdfService, PdfSettings, Phone, PhoneTypeEnum, PreloaderService, Property, PropertyCalculationService, PropertyCategory, PropertyCategoryListEnum, PropertyCategoryMovement, PropertyCategoryMovementService, PropertyCategoryService, PropertyCollection, PropertyDepreciationCalculationEnum, PropertyDocument, PropertyDocumentService, PropertyEquityChartData, PropertyEquityChartItem, PropertyForecast, PropertyHoldingCostsService, PropertyReportItem, PropertyReportItemCollection, PropertyReportItemDepreciationCollection, PropertyReportItemTransaction, PropertyReportItemTransactionCollection, PropertySale, PropertySaleService, PropertySaleTaxExemptionMetadata, PropertyService, PropertyShare, PropertyShareAccessEnum, PropertyShareService, PropertyShareStatusEnum, PropertySubscription, PropertyTransactionReportService, PropertyValuation, RegisterClientForm, RegisterFirmForm, RegistrationInvite, RegistrationInviteStatusEnum, ReportItem, ReportItemCollection, ReportItemDetails, ResetPasswordForm, SUBSCRIPTION_DESCRIPTION, SUBSCRIPTION_TITLE, SalaryForecast, SalaryForecastFrequencyEnum, SalaryForecastService, ServiceNotificationService, ServiceNotificationStatusEnum, ServiceNotificationTypeEnum, ServicePayment, ServicePaymentStatusEnum, ServicePrice, ServicePriceRecurringIntervalEnum, ServicePriceService, ServicePriceTypeEnum, ServiceProduct, ServiceProductStatusEnum, ServiceSubscription, ServiceSubscriptionCollection, ServiceSubscriptionItem, ServiceSubscriptionStatusEnum, ShareFilterOptionsEnum, SoleForecast, SoleForecastService, SpareDocumentSpareTypeEnum, SseService, SubscriptionService, SubscriptionTypeEnum, TYPE_LOAN, TankTypeEnum, TaxCalculationMedicareExemptionEnum, TaxCalculationTypeEnum, TaxExemption, TaxExemptionEnum, TaxExemptionMetadata, TaxExemptionMetadataEnum, TaxExemptionService, TaxReturnCategoryListEnum, TaxReturnCategorySectionEnum, TaxReview, TaxReviewCollection, TaxReviewHistoryService, TaxReviewService, TaxReviewStatusEnum, TaxSummary, TaxSummaryListEnum, TaxSummarySection, TaxSummarySectionEnum, TaxSummaryService, TaxSummaryTaxSummaryEnum, TaxSummaryTypeEnum, TicketFeedbackEnum, TicketStatusEnum, TicketTypesEnum, Toast, ToastService, ToastTypeEnum, Transaction, TransactionAllocation, TransactionAllocationCollection, TransactionAllocationService, TransactionBase, TransactionCalculationService, TransactionCollection, TransactionMetadata, TransactionOperationEnum, TransactionReceipt, TransactionService, TransactionSourceEnum, TransactionTypeEnum, TtCoreModule, USER_ROLES, USER_WORK_POSITION, User, UserEventSetting, UserEventSettingCollection, UserEventSettingFieldEnum, UserEventSettingService, UserEventStatusEnum, UserEventType, UserEventTypeCategory, UserEventTypeClientTypeEnum, UserEventTypeEmployeeTypeEnum, UserEventTypeFrequencyEnum, UserEventTypeService, UserEventTypeUserTypeEnum, UserMedicareExemptionEnum, UserRolesEnum, UserService, UserStatusEnum, UserSwitcherService, UserTitleEnum, UserToRegister, UserWorkDepreciationCalculationEnum, UserWorkingHolidayMakerEnum, Vehicle, VehicleClaim, VehicleClaimForm, VehicleClaimMethodEnum, VehicleClaimService, VehicleCollection, VehicleExpense, VehicleExpenseCollection, VehicleForm, VehicleLogbook, VehicleLogbookCollection, VehicleLogbookPurposeEnum, VehicleLogbookService, VehicleService, WORK_TANK_LOGBOOK_PURPOSE_OPTIONS, XlsxService, cloneDeep, compare, compareMatOptions, createDate, displayMatOptions, enumToList, getDocIcon, replace, roundTo, sort, sortDeep, taxReviewFilterPredicate };
11497
11573
  //# sourceMappingURL=taxtank-core.js.map