taxtank-core 0.32.123 → 0.32.125

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (28) hide show
  1. package/esm2022/lib/db/Models/bank/bank-account.mjs +1 -1
  2. package/esm2022/lib/db/Models/incomeSource/income-source-forecast.mjs +1 -1
  3. package/esm2022/lib/db/Models/incomeSource/salary-forecast.mjs +1 -1
  4. package/esm2022/lib/db/Models/property/property-forecast.mjs +1 -1
  5. package/esm2022/lib/db/Models/sole/sole-business-loss.mjs +1 -1
  6. package/esm2022/lib/db/Models/sole/sole-forecast.mjs +1 -1
  7. package/esm2022/lib/models/client/capital-loss.interface.mjs +1 -1
  8. package/esm2022/lib/models/client/capital-loss.mjs +5 -1
  9. package/esm2022/lib/models/holding/holding.mjs +4 -3
  10. package/esm2022/lib/models/income-source/salary-forecast.mjs +5 -1
  11. package/esm2022/lib/models/income-source/sole-forecast.mjs +5 -1
  12. package/esm2022/lib/models/property/property-forecast.mjs +6 -2
  13. package/esm2022/lib/models/sole/sole-business-loss.mjs +5 -1
  14. package/esm2022/lib/services/pdf/pdf-from-dom-element/file-settings.mjs +1 -2
  15. package/fesm2022/taxtank-core.mjs +610 -595
  16. package/fesm2022/taxtank-core.mjs.map +1 -1
  17. package/lib/db/Models/incomeSource/income-source-forecast.d.ts +1 -0
  18. package/lib/db/Models/incomeSource/salary-forecast.d.ts +2 -0
  19. package/lib/db/Models/property/property-forecast.d.ts +2 -0
  20. package/lib/db/Models/sole/sole-business-loss.d.ts +2 -0
  21. package/lib/db/Models/sole/sole-forecast.d.ts +2 -0
  22. package/lib/models/client/capital-loss.d.ts +2 -0
  23. package/lib/models/client/capital-loss.interface.d.ts +1 -1
  24. package/lib/models/income-source/salary-forecast.d.ts +2 -0
  25. package/lib/models/income-source/sole-forecast.d.ts +2 -0
  26. package/lib/models/property/property-forecast.d.ts +2 -0
  27. package/lib/models/sole/sole-business-loss.d.ts +2 -0
  28. package/package.json +1 -1
@@ -20,9 +20,9 @@ import orderBy from 'lodash/orderBy';
20
20
  import uniq from 'lodash/uniq';
21
21
  import moment from 'moment';
22
22
  import { DateRange } from 'moment-range';
23
+ import { Validators, FormGroup, FormArray, UntypedFormControl, UntypedFormArray, UntypedFormGroup, FormControl } from '@angular/forms';
23
24
  import ceil from 'lodash/ceil';
24
25
  import range from 'lodash/range';
25
- import { Validators, FormGroup, FormArray, UntypedFormControl, UntypedFormArray, UntypedFormGroup, FormControl } from '@angular/forms';
26
26
  import compact from 'lodash/compact';
27
27
  import concat from 'lodash/concat';
28
28
  import cloneDeep$1 from 'lodash/cloneDeep';
@@ -3728,565 +3728,166 @@ var SalaryForecastFrequencyEnum;
3728
3728
  SalaryForecastFrequencyEnum[SalaryForecastFrequencyEnum["WEEKLY"] = 52] = "WEEKLY";
3729
3729
  })(SalaryForecastFrequencyEnum || (SalaryForecastFrequencyEnum = {}));
3730
3730
 
3731
- class SalaryForecast extends SalaryForecast$1 {
3732
- get grossAmount() {
3733
- return this.netPay + this.tax;
3734
- }
3735
- get taxWithheld() {
3736
- return this.grossAmount - this.netPay;
3737
- }
3738
- get monthlyAmount() {
3739
- switch (this.frequency) {
3740
- case SalaryForecastFrequencyEnum.ANNUAL:
3741
- return this.netPay / FinancialYear.monthsInYear;
3742
- case SalaryForecastFrequencyEnum.FORTNIGHTLY:
3743
- return this.netPay * FinancialYear.weeksInYear / FinancialYear.monthsInYear / 2;
3744
- case SalaryForecastFrequencyEnum.WEEKLY:
3745
- return this.netPay * FinancialYear.weeksInYear / FinancialYear.monthsInYear;
3746
- default:
3747
- return this.netPay;
3748
- }
3749
- }
3731
+ var MyAccountHistoryInitiatedByEnum;
3732
+ (function (MyAccountHistoryInitiatedByEnum) {
3733
+ MyAccountHistoryInitiatedByEnum[MyAccountHistoryInitiatedByEnum["OWNER"] = 0] = "OWNER";
3734
+ MyAccountHistoryInitiatedByEnum[MyAccountHistoryInitiatedByEnum["ACCOUNTANT"] = 1] = "ACCOUNTANT";
3735
+ })(MyAccountHistoryInitiatedByEnum || (MyAccountHistoryInitiatedByEnum = {}));
3736
+
3737
+ var MyAccountHistoryStatusEnum;
3738
+ (function (MyAccountHistoryStatusEnum) {
3739
+ MyAccountHistoryStatusEnum[MyAccountHistoryStatusEnum["SUCCESS"] = 0] = "SUCCESS";
3740
+ MyAccountHistoryStatusEnum[MyAccountHistoryStatusEnum["ERROR"] = 1] = "ERROR";
3741
+ })(MyAccountHistoryStatusEnum || (MyAccountHistoryStatusEnum = {}));
3742
+
3743
+ var MyAccountHistoryTypeEnum;
3744
+ (function (MyAccountHistoryTypeEnum) {
3745
+ MyAccountHistoryTypeEnum[MyAccountHistoryTypeEnum["REVIEW"] = 0] = "REVIEW";
3746
+ MyAccountHistoryTypeEnum[MyAccountHistoryTypeEnum["UPGRADE_PLAN"] = 1] = "UPGRADE_PLAN";
3747
+ MyAccountHistoryTypeEnum[MyAccountHistoryTypeEnum["UPLOAD_DOCUMENT"] = 2] = "UPLOAD_DOCUMENT";
3748
+ })(MyAccountHistoryTypeEnum || (MyAccountHistoryTypeEnum = {}));
3749
+
3750
+ class MyAccountHistory {
3750
3751
  }
3751
- __decorate([
3752
- Type(() => Number)
3753
- ], SalaryForecast.prototype, "tax", void 0);
3754
- __decorate([
3755
- Type(() => Number)
3756
- ], SalaryForecast.prototype, "netPay", void 0);
3757
- __decorate([
3758
- Type(() => IncomeSource)
3759
- ], SalaryForecast.prototype, "incomeSource", void 0);
3760
3752
 
3761
- class SoleForecast extends SoleForecast$1 {
3762
- get netPay() {
3763
- return this.amount;
3764
- }
3753
+ class Occupation extends Occupation$1 {
3765
3754
  }
3766
- __decorate([
3767
- Type(() => IncomeSource)
3768
- ], SoleForecast.prototype, "incomeSource", void 0);
3769
3755
 
3770
- var IncomeSourceForecastTrustTypeEnum;
3771
- (function (IncomeSourceForecastTrustTypeEnum) {
3772
- IncomeSourceForecastTrustTypeEnum[IncomeSourceForecastTrustTypeEnum["SPECIAL_DISABILITY_TRUST"] = 1] = "SPECIAL_DISABILITY_TRUST";
3773
- IncomeSourceForecastTrustTypeEnum[IncomeSourceForecastTrustTypeEnum["DECEASED_ESTATE"] = 2] = "DECEASED_ESTATE";
3774
- IncomeSourceForecastTrustTypeEnum[IncomeSourceForecastTrustTypeEnum["FIXED_TRUST"] = 3] = "FIXED_TRUST";
3775
- IncomeSourceForecastTrustTypeEnum[IncomeSourceForecastTrustTypeEnum["HYBRID_TRUST"] = 4] = "HYBRID_TRUST";
3776
- IncomeSourceForecastTrustTypeEnum[IncomeSourceForecastTrustTypeEnum["DISCRETIONARY_SERVICE_TRUST"] = 5] = "DISCRETIONARY_SERVICE_TRUST";
3777
- IncomeSourceForecastTrustTypeEnum[IncomeSourceForecastTrustTypeEnum["DISCRETIONARY_TRADING_TRUST"] = 6] = "DISCRETIONARY_TRADING_TRUST";
3778
- IncomeSourceForecastTrustTypeEnum[IncomeSourceForecastTrustTypeEnum["DISCRETIONARY_INVESTMENT_TRUST"] = 7] = "DISCRETIONARY_INVESTMENT_TRUST";
3779
- IncomeSourceForecastTrustTypeEnum[IncomeSourceForecastTrustTypeEnum["CASH_MANAGEMENT_UNIT_TRUST"] = 8] = "CASH_MANAGEMENT_UNIT_TRUST";
3780
- IncomeSourceForecastTrustTypeEnum[IncomeSourceForecastTrustTypeEnum["PUBLIC_UNIT_TRUST_LISTED"] = 9] = "PUBLIC_UNIT_TRUST_LISTED";
3781
- IncomeSourceForecastTrustTypeEnum[IncomeSourceForecastTrustTypeEnum["PUBLIC_UNIT_TRUST_UNLISTED"] = 10] = "PUBLIC_UNIT_TRUST_UNLISTED";
3782
- IncomeSourceForecastTrustTypeEnum[IncomeSourceForecastTrustTypeEnum["TESTAMENTARY_TRUST"] = 11] = "TESTAMENTARY_TRUST";
3783
- })(IncomeSourceForecastTrustTypeEnum || (IncomeSourceForecastTrustTypeEnum = {}));
3756
+ var UserRolesEnum;
3757
+ (function (UserRolesEnum) {
3758
+ UserRolesEnum["FIRM_OWNER"] = "ROLE_FIRM_OWNER";
3759
+ UserRolesEnum["FIRM_MANAGER"] = "ROLE_FIRM_MANAGER";
3760
+ UserRolesEnum["FIRM_TOP_MANAGER"] = "ROLE_FIRM_TOP_MANAGER";
3761
+ UserRolesEnum["CLIENT"] = "ROLE_CLIENT";
3762
+ UserRolesEnum["EMPLOYEE"] = "ROLE_EMPLOYEE";
3763
+ UserRolesEnum["ACCOUNTANT"] = "ROLE_ACCOUNTANT";
3764
+ UserRolesEnum["ADVISOR"] = "ROLE_ADVISOR";
3765
+ UserRolesEnum["USER"] = "ROLE_USER";
3766
+ UserRolesEnum["SUBSCRIPTION"] = "ROLE_USER_SUBSCRIPTION";
3767
+ UserRolesEnum["WORK_TANK"] = "ROLE_USER_WORK";
3768
+ UserRolesEnum["PROPERTY_TANK"] = "ROLE_USER_PROPERTY";
3769
+ UserRolesEnum["SOLE_TANK"] = "ROLE_USER_SOLE";
3770
+ UserRolesEnum["HOLDING_TANK"] = "ROLE_USER_HOLDING";
3771
+ UserRolesEnum["SWITCH_USER"] = "IS_IMPERSONATOR";
3772
+ })(UserRolesEnum || (UserRolesEnum = {}));
3784
3773
 
3785
- var IncomeSourceTypeListOtherEnum;
3786
- (function (IncomeSourceTypeListOtherEnum) {
3787
- IncomeSourceTypeListOtherEnum[IncomeSourceTypeListOtherEnum["PSI"] = 6] = "PSI";
3788
- IncomeSourceTypeListOtherEnum[IncomeSourceTypeListOtherEnum["SOLE_TRADER"] = 7] = "SOLE_TRADER";
3789
- IncomeSourceTypeListOtherEnum[IncomeSourceTypeListOtherEnum["TRUSTS"] = 9] = "TRUSTS";
3790
- IncomeSourceTypeListOtherEnum[IncomeSourceTypeListOtherEnum["OTHER_INCOME"] = 10] = "OTHER_INCOME";
3791
- IncomeSourceTypeListOtherEnum[IncomeSourceTypeListOtherEnum["PARTNERSHIPS"] = 12] = "PARTNERSHIPS";
3792
- })(IncomeSourceTypeListOtherEnum || (IncomeSourceTypeListOtherEnum = {}));
3774
+ /**
3775
+ * role hierarchy
3776
+ */
3777
+ const USER_ROLES = {
3778
+ ROLE_FIRM_OWNER: [UserRolesEnum.FIRM_OWNER, UserRolesEnum.FIRM_MANAGER, UserRolesEnum.ACCOUNTANT, UserRolesEnum.ADVISOR],
3779
+ ROLE_FIRM_MANAGER: [UserRolesEnum.FIRM_MANAGER, UserRolesEnum.ACCOUNTANT, UserRolesEnum.ADVISOR],
3780
+ ROLE_EMPLOYEE: [UserRolesEnum.ACCOUNTANT, UserRolesEnum.ADVISOR],
3781
+ ROLE_ACCOUNTANT: [UserRolesEnum.ACCOUNTANT],
3782
+ ROLE_ADVISOR: [UserRolesEnum.ADVISOR],
3783
+ // @TODO makes no sense, these roles can't be hierarchical
3784
+ ROLE_CLIENT: [UserRolesEnum.CLIENT],
3785
+ ROLE_USER_SUBSCRIPTION: [UserRolesEnum.SUBSCRIPTION],
3786
+ ROLE_USER_WORK: [UserRolesEnum.WORK_TANK],
3787
+ ROLE_USER_PROPERTY: [UserRolesEnum.PROPERTY_TANK],
3788
+ ROLE_USER_SOLE: [UserRolesEnum.SOLE_TANK],
3789
+ ROLE_USER_HOLDING: [UserRolesEnum.HOLDING_TANK],
3790
+ ROLE_PREVIOUS_ADMIN: [UserRolesEnum.SWITCH_USER],
3791
+ };
3793
3792
 
3794
- var IncomeSourceTypeListSoleEnum;
3795
- (function (IncomeSourceTypeListSoleEnum) {
3796
- IncomeSourceTypeListSoleEnum[IncomeSourceTypeListSoleEnum["SOLE_TRADER"] = 7] = "SOLE_TRADER";
3797
- })(IncomeSourceTypeListSoleEnum || (IncomeSourceTypeListSoleEnum = {}));
3793
+ /**
3794
+ * Class with basic information about registering user
3795
+ */
3796
+ class UserToRegister {
3797
+ }
3798
3798
 
3799
- var IncomeSourceTypeListWorkEnum;
3800
- (function (IncomeSourceTypeListWorkEnum) {
3801
- IncomeSourceTypeListWorkEnum[IncomeSourceTypeListWorkEnum["BONUSES"] = 1] = "BONUSES";
3802
- IncomeSourceTypeListWorkEnum[IncomeSourceTypeListWorkEnum["DIRECTOR_FEES"] = 2] = "DIRECTOR_FEES";
3803
- IncomeSourceTypeListWorkEnum[IncomeSourceTypeListWorkEnum["INTEREST"] = 4] = "INTEREST";
3804
- IncomeSourceTypeListWorkEnum[IncomeSourceTypeListWorkEnum["PENSIONS_AND_ALLOWANCES"] = 5] = "PENSIONS_AND_ALLOWANCES";
3805
- IncomeSourceTypeListWorkEnum[IncomeSourceTypeListWorkEnum["SUPERANNUATION"] = 8] = "SUPERANNUATION";
3806
- IncomeSourceTypeListWorkEnum[IncomeSourceTypeListWorkEnum["ATTRIBUTED_P_S_I"] = 11] = "ATTRIBUTED_P_S_I";
3807
- })(IncomeSourceTypeListWorkEnum || (IncomeSourceTypeListWorkEnum = {}));
3799
+ const USER_WORK_POSITION = {
3800
+ [UserRolesEnum.EMPLOYEE]: 'Employee',
3801
+ [UserRolesEnum.FIRM_MANAGER]: 'Manager',
3802
+ [UserRolesEnum.FIRM_OWNER]: 'Firm Owner'
3803
+ };
3808
3804
 
3809
- var IncomeSourceTypeListHoldingEnum;
3810
- (function (IncomeSourceTypeListHoldingEnum) {
3811
- IncomeSourceTypeListHoldingEnum[IncomeSourceTypeListHoldingEnum["DIVIDENDS"] = 3] = "DIVIDENDS";
3812
- IncomeSourceTypeListHoldingEnum[IncomeSourceTypeListHoldingEnum["INTEREST"] = 4] = "INTEREST";
3813
- IncomeSourceTypeListHoldingEnum[IncomeSourceTypeListHoldingEnum["TRUSTS"] = 9] = "TRUSTS";
3814
- IncomeSourceTypeListHoldingEnum[IncomeSourceTypeListHoldingEnum["OTHER_INCOME"] = 10] = "OTHER_INCOME";
3815
- IncomeSourceTypeListHoldingEnum[IncomeSourceTypeListHoldingEnum["PARTNERSHIPS"] = 12] = "PARTNERSHIPS";
3816
- })(IncomeSourceTypeListHoldingEnum || (IncomeSourceTypeListHoldingEnum = {}));
3805
+ var UserStatusEnum;
3806
+ (function (UserStatusEnum) {
3807
+ UserStatusEnum[UserStatusEnum["INACTIVE"] = 0] = "INACTIVE";
3808
+ UserStatusEnum[UserStatusEnum["ON_BOARDING"] = 1] = "ON_BOARDING";
3809
+ UserStatusEnum[UserStatusEnum["ACTIVE"] = 2] = "ACTIVE";
3810
+ })(UserStatusEnum || (UserStatusEnum = {}));
3817
3811
 
3818
- class IncomeSourceType extends IncomeSourceType$1 {
3819
- isBonuses() {
3820
- return this.id === IncomeSourceTypeListWorkEnum.BONUSES;
3821
- }
3822
- isWork() {
3823
- return !!IncomeSourceTypeListWorkEnum[this.id];
3824
- }
3825
- isOther() {
3826
- return !!IncomeSourceTypeListOtherEnum[this.id];
3812
+ class ClientDetails extends ClientDetails$1 {
3813
+ /**
3814
+ * reminder to sign basiq consent after x days before the expiration
3815
+ */
3816
+ static { this.consentExpiryReminderDays = 30; }
3817
+ get taxFileNumberMasked() {
3818
+ const maskedLength = this.taxFileNumber.length - 4;
3819
+ const maskedPart = '*'.repeat(maskedLength);
3820
+ const lastFour = this.taxFileNumber.slice(-4);
3821
+ return maskedPart + lastFour;
3827
3822
  }
3828
- isHolding() {
3829
- return !!IncomeSourceTypeListHoldingEnum[this.id];
3823
+ isBasiqConsentExpiring() {
3824
+ if (!this.basiqConsentExpiryDate || this.isBasiqConsentExpired()) {
3825
+ return false;
3826
+ }
3827
+ const reminderDate = new Date(this.basiqConsentExpiryDate);
3828
+ reminderDate.setDate(this.basiqConsentExpiryDate.getDate() - ClientDetails.consentExpiryReminderDays);
3829
+ return new Date() >= reminderDate;
3830
3830
  }
3831
- isSole() {
3832
- return !!IncomeSourceTypeListSoleEnum[this.id];
3831
+ isBasiqConsentExpired() {
3832
+ return this.basiqConsentExpiryDate && new Date() >= this.basiqConsentExpiryDate;
3833
3833
  }
3834
3834
  }
3835
+ __decorate([
3836
+ Type(() => Date)
3837
+ ], ClientDetails.prototype, "basiqConsentExpiryDate", void 0);
3835
3838
 
3836
- class IncomeSourceForecast extends IncomeSourceForecast$1 {
3839
+ class AnnualClientDetails extends AbstractModel {
3837
3840
  constructor() {
3838
3841
  super(...arguments);
3839
- this.paygIncome = 0;
3840
- this.frequency = SalaryForecastFrequencyEnum.ANNUAL;
3841
- this.isTaxFree = false;
3842
- }
3843
- /**
3844
- * Sometimes Income source has Salary & Income source forecasts,
3845
- * and we need these fields to work with Income source forecasts like with Salary Forecasts
3846
- */
3847
- get netPay() {
3848
- return this.amount;
3842
+ this.spouseAnnualIncome = 0;
3843
+ this.financialYear = new FinancialYear().year;
3849
3844
  }
3850
- get grossAmount() {
3851
- return this.amount + this.tax + this.taxInstalments + this.frankingCredits;
3845
+ get spouseMonthlyIncome() {
3846
+ return this.spouseAnnualIncome / 12;
3852
3847
  }
3853
- get monthlyAmount() {
3854
- return this.amount / 12;
3848
+ }
3849
+ __decorate([
3850
+ Type(() => ClientDetails)
3851
+ ], AnnualClientDetails.prototype, "clientDetails", void 0);
3852
+
3853
+ var ClientInviteStatusEnum;
3854
+ (function (ClientInviteStatusEnum) {
3855
+ ClientInviteStatusEnum[ClientInviteStatusEnum["PENDING"] = 1] = "PENDING";
3856
+ ClientInviteStatusEnum[ClientInviteStatusEnum["REJECTED"] = 2] = "REJECTED";
3857
+ })(ClientInviteStatusEnum || (ClientInviteStatusEnum = {}));
3858
+
3859
+ var ClientInviteTypeEnum;
3860
+ (function (ClientInviteTypeEnum) {
3861
+ ClientInviteTypeEnum[ClientInviteTypeEnum["FROM_CLIENT"] = 1] = "FROM_CLIENT";
3862
+ ClientInviteTypeEnum[ClientInviteTypeEnum["FROM_EMPLOYEE"] = 2] = "FROM_EMPLOYEE";
3863
+ })(ClientInviteTypeEnum || (ClientInviteTypeEnum = {}));
3864
+
3865
+ class RegistrationInvite extends RegistrationInvite$1 {
3866
+ get fullName() {
3867
+ return `${this.firstName} ${this.lastName}`;
3855
3868
  }
3856
3869
  }
3857
3870
  __decorate([
3858
- Type(() => IncomeSourceType)
3859
- ], IncomeSourceForecast.prototype, "incomeSourceType", void 0);
3871
+ Type(() => AppFile)
3872
+ ], RegistrationInvite.prototype, "file", void 0);
3860
3873
  __decorate([
3861
- Type(() => IncomeSource)
3862
- ], IncomeSourceForecast.prototype, "incomeSource", void 0);
3874
+ Type(() => User)
3875
+ ], RegistrationInvite.prototype, "user", void 0);
3863
3876
 
3864
- class IncomeSource extends IncomeSource$1 {
3865
- isSoleIncome() {
3866
- return this.type === IncomeSourceTypeEnum.SOLE;
3867
- }
3868
- isWorkIncome() {
3869
- return this.type === IncomeSourceTypeEnum.WORK;
3877
+ var PhoneTypeEnum;
3878
+ (function (PhoneTypeEnum) {
3879
+ PhoneTypeEnum[PhoneTypeEnum["MOBILE"] = 1] = "MOBILE";
3880
+ PhoneTypeEnum[PhoneTypeEnum["OFFICE"] = 2] = "OFFICE";
3881
+ })(PhoneTypeEnum || (PhoneTypeEnum = {}));
3882
+
3883
+ class Phone extends Phone$1 {
3884
+ constructor() {
3885
+ super(...arguments);
3886
+ this.country = Country.australia;
3887
+ this.type = PhoneTypeEnum.MOBILE;
3870
3888
  }
3871
- isOtherIncome() {
3872
- return this.type === IncomeSourceTypeEnum.OTHER;
3873
- }
3874
- isHolding() {
3875
- return this.type === IncomeSourceTypeEnum.HOLDING;
3876
- }
3877
- /**
3878
- * Get salary and other income forecasts
3879
- */
3880
- get forecasts() {
3881
- return [...this.salaryForecasts, ...this.incomeSourceForecasts, ...this.soleForecasts];
3882
- }
3883
- /**
3884
- * Get actual (1st from the list) forecast
3885
- */
3886
- get actualForecast() {
3887
- return this.forecasts[0];
3888
- }
3889
- /**
3890
- * Check if user was working in month taken by the index
3891
- * @param monthIndex by which month should be taken
3892
- */
3893
- isWorkedInMonth(monthIndex) {
3894
- const monthDate = new FinancialYear().getMonthDate(monthIndex);
3895
- return (!this.dateFrom || monthDate >= this.dateFrom) && (!this.dateTo || monthDate < this.dateTo);
3896
- }
3897
- }
3898
- __decorate([
3899
- Type(() => SalaryForecast)
3900
- ], IncomeSource.prototype, "salaryForecasts", void 0);
3901
- __decorate([
3902
- Type(() => SoleForecast)
3903
- ], IncomeSource.prototype, "soleForecasts", void 0);
3904
- __decorate([
3905
- Type(() => IncomeSourceForecast)
3906
- ], IncomeSource.prototype, "incomeSourceForecasts", void 0);
3907
- __decorate([
3908
- Type(() => Date)
3909
- ], IncomeSource.prototype, "dateFrom", void 0);
3910
- __decorate([
3911
- Type(() => Date)
3912
- ], IncomeSource.prototype, "dateTo", void 0);
3913
-
3914
- /**
3915
- * Income sources chart data
3916
- */
3917
- class IncomeSourceChartData {
3918
- constructor(forecastedIncomeAmount, transactions) {
3919
- this.forecastedIncomeAmount = forecastedIncomeAmount;
3920
- this.transactions = transactions;
3921
- }
3922
- /**
3923
- * Get prepared data for income sources chart
3924
- */
3925
- get() {
3926
- const chartData = [{
3927
- id: 'actualIncome',
3928
- name: 'Actual Income',
3929
- data: [],
3930
- // display future actual incomes with dash line and past actual incomes with solid line
3931
- zones: [{
3932
- // line style after current month
3933
- value: new FinancialYear().getMonthDate(new Date().getMonth()).getTime(),
3934
- dashStyle: 'Solid'
3935
- }, {
3936
- // default line style
3937
- dashStyle: 'Dash'
3938
- }]
3939
- }, {
3940
- id: 'forecastedIncome',
3941
- name: 'Forecasted Income',
3942
- data: [],
3943
- }];
3944
- for (const key in MonthNameShortEnum) {
3945
- if (MonthNameShortEnum.hasOwnProperty(key)) {
3946
- // transaction collection for provided month
3947
- const monthTransactionCollection = this.transactions.getByMonth(+MonthNumberEnum[key]);
3948
- chartData[0].data.push([new FinancialYear().getMonthDate(+MonthNumberEnum[key]).getTime(), monthTransactionCollection.amount]);
3949
- chartData[1].data.push([new FinancialYear().getMonthDate(+MonthNumberEnum[key]).getTime(), this.forecastedIncomeAmount / 12]);
3950
- }
3951
- }
3952
- return chartData;
3953
- }
3954
- }
3955
-
3956
- var TransactionSourceEnum;
3957
- (function (TransactionSourceEnum) {
3958
- TransactionSourceEnum[TransactionSourceEnum["CASH"] = 1] = "CASH";
3959
- TransactionSourceEnum[TransactionSourceEnum["BANK_TRANSACTION"] = 2] = "BANK_TRANSACTION";
3960
- })(TransactionSourceEnum || (TransactionSourceEnum = {}));
3961
-
3962
- class AllocationRuleTransaction extends AllocationRuleTransaction$1 {
3963
- constructor() {
3964
- super(...arguments);
3965
- this.claimPercent = 100;
3966
- this.tax = 0;
3967
- this.amount = null;
3968
- }
3969
- get amountPercentCoefficient() {
3970
- return this.amountPercent ? this.amountPercent / 100 : 1;
3971
- }
3972
- calculateClaimPercent() {
3973
- if (!this.chartAccounts) {
3974
- return null;
3975
- }
3976
- let claimPercent = this.chartAccounts.taxablePercent;
3977
- // Property claim (ownership% x shared%) for property expenses, taxable percent for others
3978
- if (this.chartAccounts?.isProperty() && this.property) {
3979
- if (this.chartAccounts.isPropertyExpense() && this.chartAccounts.id !== ChartAccountsListEnum.PLATFORM_FEES) {
3980
- claimPercent *= this.property?.claimCoefficient;
3981
- }
3982
- }
3983
- return claimPercent;
3984
- }
3985
- /**
3986
- * If rule transaction has amount then split enabled. There is 0 when split disabled
3987
- */
3988
- isSplit() {
3989
- return !!this.amountPercent;
3990
- }
3991
- /**
3992
- * Create Transaction instance based on passed bank transaction and rule transaction
3993
- */
3994
- toTransaction(bankTransaction = null) {
3995
- const transaction = bankTransaction ? bankTransaction.toTransaction(this.isGST) : plainToClass(Transaction, {});
3996
- Object.assign(transaction, {
3997
- isGST: this.isGST,
3998
- tax: this.tax,
3999
- claimPercent: this.claimPercent,
4000
- chartAccounts: this.chartAccounts,
4001
- property: this.property,
4002
- loan: this.loan,
4003
- incomeSource: this.incomeSource,
4004
- metaFields: this.metaFields,
4005
- business: this.business,
4006
- source: TransactionSourceEnum.BANK_TRANSACTION,
4007
- operation: TransactionOperationEnum.ALLOCATE,
4008
- transactions: [],
4009
- });
4010
- // split allocation
4011
- if (this.amountPercent) {
4012
- transaction.amount = bankTransaction.amount * this.amountPercentCoefficient / this.gstCoefficient;
4013
- }
4014
- // child transactions inherit most of the fields from parent transaction
4015
- this.childTransactions.forEach((childRuleTransaction) => {
4016
- const childTransaction = childRuleTransaction.toTransaction();
4017
- childTransaction.amount = childRuleTransaction.amount;
4018
- childTransaction.setParent(transaction);
4019
- transaction.transactions.push(childTransaction);
4020
- });
4021
- return transaction;
4022
- }
4023
- }
4024
- __decorate([
4025
- Type(() => ChartAccounts)
4026
- // @TODO Alex: Create custom decorator for this transform
4027
- ,
4028
- Transform(({ value }) => ({ id: value.id }), { toPlainOnly: true })
4029
- ], AllocationRuleTransaction.prototype, "chartAccounts", void 0);
4030
- __decorate([
4031
- Type(() => Property),
4032
- Transform(({ value }) => value ? { id: value.id } : null, { toPlainOnly: true })
4033
- ], AllocationRuleTransaction.prototype, "property", void 0);
4034
- __decorate([
4035
- Type(() => Loan),
4036
- Transform(({ value }) => value ? { id: value.id } : null, { toPlainOnly: true })
4037
- ], AllocationRuleTransaction.prototype, "loan", void 0);
4038
- __decorate([
4039
- Type(() => IncomeSource),
4040
- Transform(({ value }) => value ? { id: value.id } : null, { toPlainOnly: true })
4041
- ], AllocationRuleTransaction.prototype, "incomeSource", void 0);
4042
- __decorate([
4043
- Type(() => SoleBusiness),
4044
- Transform(({ value }) => value ? { id: value.id } : null, { toPlainOnly: true })
4045
- ], AllocationRuleTransaction.prototype, "business", void 0);
4046
- __decorate([
4047
- Type(() => AllocationRuleTransactionMetaField)
4048
- ], AllocationRuleTransaction.prototype, "metaFields", void 0);
4049
- __decorate([
4050
- Type(() => AllocationRuleTransaction)
4051
- ], AllocationRuleTransaction.prototype, "parentTransaction", void 0);
4052
- __decorate([
4053
- Type(() => AllocationRuleTransaction)
4054
- ], AllocationRuleTransaction.prototype, "childTransactions", void 0);
4055
- __decorate([
4056
- Type(() => Number)
4057
- ], AllocationRuleTransaction.prototype, "claimPercent", void 0);
4058
- __decorate([
4059
- Type(() => Number)
4060
- ], AllocationRuleTransaction.prototype, "tax", void 0);
4061
-
4062
- var TransactionTypeEnum;
4063
- (function (TransactionTypeEnum) {
4064
- TransactionTypeEnum[TransactionTypeEnum["DEBIT"] = 1] = "DEBIT";
4065
- TransactionTypeEnum[TransactionTypeEnum["CREDIT"] = 2] = "CREDIT";
4066
- })(TransactionTypeEnum || (TransactionTypeEnum = {}));
4067
-
4068
- class TaxExemption extends TaxExemption$1 {
4069
- isPartial() {
4070
- return [TaxExemptionEnum.INVESTMENT_TO_PPR, TaxExemptionEnum.PPR_TO_INVESTMENT].includes(this.id);
4071
- }
4072
- }
4073
-
4074
- class AssetSale extends ObservableModel {
4075
- static { this.className = 'AssetSale'; }
4076
- }
4077
- __decorate([
4078
- Type(() => Date)
4079
- ], AssetSale.prototype, "date", void 0);
4080
-
4081
- class PropertySale extends AssetSale {
4082
- get saleCostsTotalAmount() {
4083
- return this.commission + this.legalFees + this.otherCost;
4084
- }
4085
- /**
4086
- * CGT is not applicable for sales with "Principle place of residence" exemption type.
4087
- * https://taxtank.atlassian.net/wiki/spaces/TAXTANK/pages/4644110466/Tax+Return+MyTax+-+Online+Form ("Capital gains or losses" section)
4088
- */
4089
- isCGTApplicable() {
4090
- return this.taxExemption?.id !== TaxExemptionEnum.PPR;
4091
- }
4092
- get netPrice() {
4093
- return this.price - this.saleCostsTotalAmount;
4094
- }
4095
- }
4096
- __decorate([
4097
- Type(() => Number)
4098
- ], PropertySale.prototype, "holdingCosts", void 0);
4099
- __decorate([
4100
- Type(() => Number)
4101
- ], PropertySale.prototype, "structuralImprovementsWDV", void 0);
4102
- __decorate([
4103
- Type(() => Number)
4104
- ], PropertySale.prototype, "buildingAtCostClaimed", void 0);
4105
- __decorate([
4106
- Type(() => Number)
4107
- ], PropertySale.prototype, "price", void 0);
4108
- __decorate([
4109
- Type(() => Number)
4110
- ], PropertySale.prototype, "commission", void 0);
4111
- __decorate([
4112
- Type(() => Number)
4113
- ], PropertySale.prototype, "legalFees", void 0);
4114
- __decorate([
4115
- Type(() => Number)
4116
- ], PropertySale.prototype, "otherCost", void 0);
4117
- __decorate([
4118
- Type(() => Date)
4119
- ], PropertySale.prototype, "settlementDate", void 0);
4120
- __decorate([
4121
- Type(() => Date)
4122
- ], PropertySale.prototype, "date", void 0);
4123
- __decorate([
4124
- Type(() => TaxExemption)
4125
- ], PropertySale.prototype, "taxExemption", void 0);
4126
- __decorate([
4127
- Type(() => PropertySaleTaxExemptionMetaField$1)
4128
- ], PropertySale.prototype, "taxExemptionMetaFields", void 0);
4129
-
4130
- var MyAccountHistoryInitiatedByEnum;
4131
- (function (MyAccountHistoryInitiatedByEnum) {
4132
- MyAccountHistoryInitiatedByEnum[MyAccountHistoryInitiatedByEnum["OWNER"] = 0] = "OWNER";
4133
- MyAccountHistoryInitiatedByEnum[MyAccountHistoryInitiatedByEnum["ACCOUNTANT"] = 1] = "ACCOUNTANT";
4134
- })(MyAccountHistoryInitiatedByEnum || (MyAccountHistoryInitiatedByEnum = {}));
4135
-
4136
- var MyAccountHistoryStatusEnum;
4137
- (function (MyAccountHistoryStatusEnum) {
4138
- MyAccountHistoryStatusEnum[MyAccountHistoryStatusEnum["SUCCESS"] = 0] = "SUCCESS";
4139
- MyAccountHistoryStatusEnum[MyAccountHistoryStatusEnum["ERROR"] = 1] = "ERROR";
4140
- })(MyAccountHistoryStatusEnum || (MyAccountHistoryStatusEnum = {}));
4141
-
4142
- var MyAccountHistoryTypeEnum;
4143
- (function (MyAccountHistoryTypeEnum) {
4144
- MyAccountHistoryTypeEnum[MyAccountHistoryTypeEnum["REVIEW"] = 0] = "REVIEW";
4145
- MyAccountHistoryTypeEnum[MyAccountHistoryTypeEnum["UPGRADE_PLAN"] = 1] = "UPGRADE_PLAN";
4146
- MyAccountHistoryTypeEnum[MyAccountHistoryTypeEnum["UPLOAD_DOCUMENT"] = 2] = "UPLOAD_DOCUMENT";
4147
- })(MyAccountHistoryTypeEnum || (MyAccountHistoryTypeEnum = {}));
4148
-
4149
- class MyAccountHistory {
4150
- }
4151
-
4152
- class Occupation extends Occupation$1 {
4153
- }
4154
-
4155
- var UserRolesEnum;
4156
- (function (UserRolesEnum) {
4157
- UserRolesEnum["FIRM_OWNER"] = "ROLE_FIRM_OWNER";
4158
- UserRolesEnum["FIRM_MANAGER"] = "ROLE_FIRM_MANAGER";
4159
- UserRolesEnum["FIRM_TOP_MANAGER"] = "ROLE_FIRM_TOP_MANAGER";
4160
- UserRolesEnum["CLIENT"] = "ROLE_CLIENT";
4161
- UserRolesEnum["EMPLOYEE"] = "ROLE_EMPLOYEE";
4162
- UserRolesEnum["ACCOUNTANT"] = "ROLE_ACCOUNTANT";
4163
- UserRolesEnum["ADVISOR"] = "ROLE_ADVISOR";
4164
- UserRolesEnum["USER"] = "ROLE_USER";
4165
- UserRolesEnum["SUBSCRIPTION"] = "ROLE_USER_SUBSCRIPTION";
4166
- UserRolesEnum["WORK_TANK"] = "ROLE_USER_WORK";
4167
- UserRolesEnum["PROPERTY_TANK"] = "ROLE_USER_PROPERTY";
4168
- UserRolesEnum["SOLE_TANK"] = "ROLE_USER_SOLE";
4169
- UserRolesEnum["HOLDING_TANK"] = "ROLE_USER_HOLDING";
4170
- UserRolesEnum["SWITCH_USER"] = "IS_IMPERSONATOR";
4171
- })(UserRolesEnum || (UserRolesEnum = {}));
4172
-
4173
- /**
4174
- * role hierarchy
4175
- */
4176
- const USER_ROLES = {
4177
- ROLE_FIRM_OWNER: [UserRolesEnum.FIRM_OWNER, UserRolesEnum.FIRM_MANAGER, UserRolesEnum.ACCOUNTANT, UserRolesEnum.ADVISOR],
4178
- ROLE_FIRM_MANAGER: [UserRolesEnum.FIRM_MANAGER, UserRolesEnum.ACCOUNTANT, UserRolesEnum.ADVISOR],
4179
- ROLE_EMPLOYEE: [UserRolesEnum.ACCOUNTANT, UserRolesEnum.ADVISOR],
4180
- ROLE_ACCOUNTANT: [UserRolesEnum.ACCOUNTANT],
4181
- ROLE_ADVISOR: [UserRolesEnum.ADVISOR],
4182
- // @TODO makes no sense, these roles can't be hierarchical
4183
- ROLE_CLIENT: [UserRolesEnum.CLIENT],
4184
- ROLE_USER_SUBSCRIPTION: [UserRolesEnum.SUBSCRIPTION],
4185
- ROLE_USER_WORK: [UserRolesEnum.WORK_TANK],
4186
- ROLE_USER_PROPERTY: [UserRolesEnum.PROPERTY_TANK],
4187
- ROLE_USER_SOLE: [UserRolesEnum.SOLE_TANK],
4188
- ROLE_USER_HOLDING: [UserRolesEnum.HOLDING_TANK],
4189
- ROLE_PREVIOUS_ADMIN: [UserRolesEnum.SWITCH_USER],
4190
- };
4191
-
4192
- /**
4193
- * Class with basic information about registering user
4194
- */
4195
- class UserToRegister {
4196
- }
4197
-
4198
- const USER_WORK_POSITION = {
4199
- [UserRolesEnum.EMPLOYEE]: 'Employee',
4200
- [UserRolesEnum.FIRM_MANAGER]: 'Manager',
4201
- [UserRolesEnum.FIRM_OWNER]: 'Firm Owner'
4202
- };
4203
-
4204
- var UserStatusEnum;
4205
- (function (UserStatusEnum) {
4206
- UserStatusEnum[UserStatusEnum["INACTIVE"] = 0] = "INACTIVE";
4207
- UserStatusEnum[UserStatusEnum["ON_BOARDING"] = 1] = "ON_BOARDING";
4208
- UserStatusEnum[UserStatusEnum["ACTIVE"] = 2] = "ACTIVE";
4209
- })(UserStatusEnum || (UserStatusEnum = {}));
4210
-
4211
- class ClientDetails extends ClientDetails$1 {
4212
- /**
4213
- * reminder to sign basiq consent after x days before the expiration
4214
- */
4215
- static { this.consentExpiryReminderDays = 30; }
4216
- get taxFileNumberMasked() {
4217
- const maskedLength = this.taxFileNumber.length - 4;
4218
- const maskedPart = '*'.repeat(maskedLength);
4219
- const lastFour = this.taxFileNumber.slice(-4);
4220
- return maskedPart + lastFour;
4221
- }
4222
- isBasiqConsentExpiring() {
4223
- if (!this.basiqConsentExpiryDate || this.isBasiqConsentExpired()) {
4224
- return false;
4225
- }
4226
- const reminderDate = new Date(this.basiqConsentExpiryDate);
4227
- reminderDate.setDate(this.basiqConsentExpiryDate.getDate() - ClientDetails.consentExpiryReminderDays);
4228
- return new Date() >= reminderDate;
4229
- }
4230
- isBasiqConsentExpired() {
4231
- return this.basiqConsentExpiryDate && new Date() >= this.basiqConsentExpiryDate;
4232
- }
4233
- }
4234
- __decorate([
4235
- Type(() => Date)
4236
- ], ClientDetails.prototype, "basiqConsentExpiryDate", void 0);
4237
-
4238
- class AnnualClientDetails extends AbstractModel {
4239
- constructor() {
4240
- super(...arguments);
4241
- this.spouseAnnualIncome = 0;
4242
- this.financialYear = new FinancialYear().year;
4243
- }
4244
- get spouseMonthlyIncome() {
4245
- return this.spouseAnnualIncome / 12;
4246
- }
4247
- }
4248
- __decorate([
4249
- Type(() => ClientDetails)
4250
- ], AnnualClientDetails.prototype, "clientDetails", void 0);
4251
-
4252
- var ClientInviteStatusEnum;
4253
- (function (ClientInviteStatusEnum) {
4254
- ClientInviteStatusEnum[ClientInviteStatusEnum["PENDING"] = 1] = "PENDING";
4255
- ClientInviteStatusEnum[ClientInviteStatusEnum["REJECTED"] = 2] = "REJECTED";
4256
- })(ClientInviteStatusEnum || (ClientInviteStatusEnum = {}));
4257
-
4258
- var ClientInviteTypeEnum;
4259
- (function (ClientInviteTypeEnum) {
4260
- ClientInviteTypeEnum[ClientInviteTypeEnum["FROM_CLIENT"] = 1] = "FROM_CLIENT";
4261
- ClientInviteTypeEnum[ClientInviteTypeEnum["FROM_EMPLOYEE"] = 2] = "FROM_EMPLOYEE";
4262
- })(ClientInviteTypeEnum || (ClientInviteTypeEnum = {}));
4263
-
4264
- class RegistrationInvite extends RegistrationInvite$1 {
4265
- get fullName() {
4266
- return `${this.firstName} ${this.lastName}`;
4267
- }
4268
- }
4269
- __decorate([
4270
- Type(() => AppFile)
4271
- ], RegistrationInvite.prototype, "file", void 0);
4272
- __decorate([
4273
- Type(() => User)
4274
- ], RegistrationInvite.prototype, "user", void 0);
4275
-
4276
- var PhoneTypeEnum;
4277
- (function (PhoneTypeEnum) {
4278
- PhoneTypeEnum[PhoneTypeEnum["MOBILE"] = 1] = "MOBILE";
4279
- PhoneTypeEnum[PhoneTypeEnum["OFFICE"] = 2] = "OFFICE";
4280
- })(PhoneTypeEnum || (PhoneTypeEnum = {}));
4281
-
4282
- class Phone extends Phone$1 {
4283
- constructor() {
4284
- super(...arguments);
4285
- this.country = Country.australia;
4286
- this.type = PhoneTypeEnum.MOBILE;
4287
- }
4288
- toString() {
4289
- return `+${this.country.callingCode} ${this.number}`;
3889
+ toString() {
3890
+ return `+${this.country.callingCode} ${this.number}`;
4290
3891
  }
4291
3892
  }
4292
3893
  __decorate([
@@ -4496,6 +4097,9 @@ class CapitalLoss extends AbstractModel {
4496
4097
  __decorate([
4497
4098
  Type(() => ClientDetails)
4498
4099
  ], CapitalLoss.prototype, "clientDetails", void 0);
4100
+ __decorate([
4101
+ Type(() => User)
4102
+ ], CapitalLoss.prototype, "updatedBy", void 0);
4499
4103
 
4500
4104
  class EmployeeDetails extends EmployeeDetails$1 {
4501
4105
  get firmBranchNames() {
@@ -4932,6 +4536,15 @@ __decorate([
4932
4536
  __decorate([
4933
4537
  Type(() => SoleBusinessLossOffsetRule)
4934
4538
  ], SoleBusinessLoss.prototype, "offsetRule", void 0);
4539
+ __decorate([
4540
+ Type(() => User)
4541
+ ], SoleBusinessLoss.prototype, "updatedBy", void 0);
4542
+
4543
+ var TransactionSourceEnum;
4544
+ (function (TransactionSourceEnum) {
4545
+ TransactionSourceEnum[TransactionSourceEnum["CASH"] = 1] = "CASH";
4546
+ TransactionSourceEnum[TransactionSourceEnum["BANK_TRANSACTION"] = 2] = "BANK_TRANSACTION";
4547
+ })(TransactionSourceEnum || (TransactionSourceEnum = {}));
4935
4548
 
4936
4549
  var SoleInvoiceTaxTypeEnum;
4937
4550
  (function (SoleInvoiceTaxTypeEnum) {
@@ -5595,92 +5208,491 @@ class User extends User$1 {
5595
5208
  isAdvisor() {
5596
5209
  return this.roles.includes(UserRolesEnum.ADVISOR);
5597
5210
  }
5598
- isImpersonator() {
5599
- return this.roles.includes(UserRolesEnum.SWITCH_USER);
5211
+ isImpersonator() {
5212
+ return this.roles.includes(UserRolesEnum.SWITCH_USER);
5213
+ }
5214
+ /**
5215
+ * Check if current user is firm owner
5216
+ */
5217
+ isFirmOwner() {
5218
+ return this.roles.includes(UserRolesEnum.FIRM_OWNER);
5219
+ }
5220
+ isTopManager() {
5221
+ return this.roles.includes(UserRolesEnum.FIRM_TOP_MANAGER) || this.roles.includes(UserRolesEnum.FIRM_OWNER);
5222
+ }
5223
+ isManager() {
5224
+ return this.roles.includes(UserRolesEnum.FIRM_MANAGER) || this.roles.includes(UserRolesEnum.FIRM_TOP_MANAGER) || this.roles.includes(UserRolesEnum.FIRM_OWNER);
5225
+ }
5226
+ /**
5227
+ * check if user has property tank access
5228
+ */
5229
+ hasPropertyTank() {
5230
+ return this.roles ?
5231
+ this.roles.includes(UserRolesEnum.PROPERTY_TANK) :
5232
+ !!this.getSubscriptionRole(UserRolesEnum.PROPERTY_TANK);
5233
+ }
5234
+ /**
5235
+ * check if user has property tank access
5236
+ */
5237
+ hasWorkTank() {
5238
+ return this.roles ?
5239
+ this.roles.includes(UserRolesEnum.WORK_TANK) :
5240
+ !!this.getSubscriptionRole(UserRolesEnum.WORK_TANK);
5241
+ }
5242
+ /**
5243
+ * Get user subscription role by provided role type
5244
+ * @param roleType by which role should be returned
5245
+ */
5246
+ getSubscriptionRole(roleType) {
5247
+ /**
5248
+ * Add @TODO for Alex to check if we should use getLastSubscription here
5249
+ */
5250
+ return this.activeSubscription?.items
5251
+ .find((subscriptionItem) => subscriptionItem.price.product.role.includes(roleType));
5252
+ }
5253
+ isCurrentFinancialYear() {
5254
+ return new FinancialYear(new Date()).year === this.financialYear;
5255
+ }
5256
+ /**
5257
+ * financial years available in the app for user
5258
+ * starts from 2022 for new users and registeredYear - 1 for old users
5259
+ */
5260
+ get financialYears() {
5261
+ return range(Math.min(FinancialYear.toFinYear(this.createdAt) - 1, 2022), FinancialYear.toFinYear(new Date()) + 1);
5262
+ }
5263
+ get firmBranchNames() {
5264
+ return this.employeeDetails.firmBranchNames;
5265
+ }
5266
+ }
5267
+ __decorate([
5268
+ Type(() => ServiceSubscription)
5269
+ ], User.prototype, "subscriptions", void 0);
5270
+ __decorate([
5271
+ Type(() => ClientDetails)
5272
+ ], User.prototype, "clientDetails", void 0);
5273
+ __decorate([
5274
+ Type(() => EmployeeDetails)
5275
+ ], User.prototype, "employeeDetails", void 0);
5276
+ __decorate([
5277
+ Type(() => SoleDetails)
5278
+ ], User.prototype, "soleDetails", void 0);
5279
+ __decorate([
5280
+ Type(() => Address)
5281
+ ], User.prototype, "address", void 0);
5282
+ __decorate([
5283
+ Type(() => Phone)
5284
+ ], User.prototype, "phone", void 0);
5285
+ __decorate([
5286
+ Type(() => Date)
5287
+ ], User.prototype, "createdAt", void 0);
5288
+ __decorate([
5289
+ Type(() => User)
5290
+ ], User.prototype, "clients", void 0);
5291
+ __decorate([
5292
+ Type(() => AppFile)
5293
+ ], User.prototype, "file", void 0);
5294
+ __decorate([
5295
+ Type(() => AccountSetupItem)
5296
+ ], User.prototype, "blacklistSetupItems", void 0);
5297
+
5298
+ class SalaryForecast extends SalaryForecast$1 {
5299
+ get grossAmount() {
5300
+ return this.netPay + this.tax;
5301
+ }
5302
+ get taxWithheld() {
5303
+ return this.grossAmount - this.netPay;
5304
+ }
5305
+ get monthlyAmount() {
5306
+ switch (this.frequency) {
5307
+ case SalaryForecastFrequencyEnum.ANNUAL:
5308
+ return this.netPay / FinancialYear.monthsInYear;
5309
+ case SalaryForecastFrequencyEnum.FORTNIGHTLY:
5310
+ return this.netPay * FinancialYear.weeksInYear / FinancialYear.monthsInYear / 2;
5311
+ case SalaryForecastFrequencyEnum.WEEKLY:
5312
+ return this.netPay * FinancialYear.weeksInYear / FinancialYear.monthsInYear;
5313
+ default:
5314
+ return this.netPay;
5315
+ }
5316
+ }
5317
+ }
5318
+ __decorate([
5319
+ Type(() => Number)
5320
+ ], SalaryForecast.prototype, "tax", void 0);
5321
+ __decorate([
5322
+ Type(() => Number)
5323
+ ], SalaryForecast.prototype, "netPay", void 0);
5324
+ __decorate([
5325
+ Type(() => IncomeSource)
5326
+ ], SalaryForecast.prototype, "incomeSource", void 0);
5327
+ __decorate([
5328
+ Type(() => User)
5329
+ ], SalaryForecast.prototype, "updatedBy", void 0);
5330
+
5331
+ class SoleForecast extends SoleForecast$1 {
5332
+ get netPay() {
5333
+ return this.amount;
5334
+ }
5335
+ }
5336
+ __decorate([
5337
+ Type(() => IncomeSource)
5338
+ ], SoleForecast.prototype, "incomeSource", void 0);
5339
+ __decorate([
5340
+ Type(() => User)
5341
+ ], SoleForecast.prototype, "updatedBy", void 0);
5342
+
5343
+ var IncomeSourceForecastTrustTypeEnum;
5344
+ (function (IncomeSourceForecastTrustTypeEnum) {
5345
+ IncomeSourceForecastTrustTypeEnum[IncomeSourceForecastTrustTypeEnum["SPECIAL_DISABILITY_TRUST"] = 1] = "SPECIAL_DISABILITY_TRUST";
5346
+ IncomeSourceForecastTrustTypeEnum[IncomeSourceForecastTrustTypeEnum["DECEASED_ESTATE"] = 2] = "DECEASED_ESTATE";
5347
+ IncomeSourceForecastTrustTypeEnum[IncomeSourceForecastTrustTypeEnum["FIXED_TRUST"] = 3] = "FIXED_TRUST";
5348
+ IncomeSourceForecastTrustTypeEnum[IncomeSourceForecastTrustTypeEnum["HYBRID_TRUST"] = 4] = "HYBRID_TRUST";
5349
+ IncomeSourceForecastTrustTypeEnum[IncomeSourceForecastTrustTypeEnum["DISCRETIONARY_SERVICE_TRUST"] = 5] = "DISCRETIONARY_SERVICE_TRUST";
5350
+ IncomeSourceForecastTrustTypeEnum[IncomeSourceForecastTrustTypeEnum["DISCRETIONARY_TRADING_TRUST"] = 6] = "DISCRETIONARY_TRADING_TRUST";
5351
+ IncomeSourceForecastTrustTypeEnum[IncomeSourceForecastTrustTypeEnum["DISCRETIONARY_INVESTMENT_TRUST"] = 7] = "DISCRETIONARY_INVESTMENT_TRUST";
5352
+ IncomeSourceForecastTrustTypeEnum[IncomeSourceForecastTrustTypeEnum["CASH_MANAGEMENT_UNIT_TRUST"] = 8] = "CASH_MANAGEMENT_UNIT_TRUST";
5353
+ IncomeSourceForecastTrustTypeEnum[IncomeSourceForecastTrustTypeEnum["PUBLIC_UNIT_TRUST_LISTED"] = 9] = "PUBLIC_UNIT_TRUST_LISTED";
5354
+ IncomeSourceForecastTrustTypeEnum[IncomeSourceForecastTrustTypeEnum["PUBLIC_UNIT_TRUST_UNLISTED"] = 10] = "PUBLIC_UNIT_TRUST_UNLISTED";
5355
+ IncomeSourceForecastTrustTypeEnum[IncomeSourceForecastTrustTypeEnum["TESTAMENTARY_TRUST"] = 11] = "TESTAMENTARY_TRUST";
5356
+ })(IncomeSourceForecastTrustTypeEnum || (IncomeSourceForecastTrustTypeEnum = {}));
5357
+
5358
+ var IncomeSourceTypeListOtherEnum;
5359
+ (function (IncomeSourceTypeListOtherEnum) {
5360
+ IncomeSourceTypeListOtherEnum[IncomeSourceTypeListOtherEnum["PSI"] = 6] = "PSI";
5361
+ IncomeSourceTypeListOtherEnum[IncomeSourceTypeListOtherEnum["SOLE_TRADER"] = 7] = "SOLE_TRADER";
5362
+ IncomeSourceTypeListOtherEnum[IncomeSourceTypeListOtherEnum["TRUSTS"] = 9] = "TRUSTS";
5363
+ IncomeSourceTypeListOtherEnum[IncomeSourceTypeListOtherEnum["OTHER_INCOME"] = 10] = "OTHER_INCOME";
5364
+ IncomeSourceTypeListOtherEnum[IncomeSourceTypeListOtherEnum["PARTNERSHIPS"] = 12] = "PARTNERSHIPS";
5365
+ })(IncomeSourceTypeListOtherEnum || (IncomeSourceTypeListOtherEnum = {}));
5366
+
5367
+ var IncomeSourceTypeListSoleEnum;
5368
+ (function (IncomeSourceTypeListSoleEnum) {
5369
+ IncomeSourceTypeListSoleEnum[IncomeSourceTypeListSoleEnum["SOLE_TRADER"] = 7] = "SOLE_TRADER";
5370
+ })(IncomeSourceTypeListSoleEnum || (IncomeSourceTypeListSoleEnum = {}));
5371
+
5372
+ var IncomeSourceTypeListWorkEnum;
5373
+ (function (IncomeSourceTypeListWorkEnum) {
5374
+ IncomeSourceTypeListWorkEnum[IncomeSourceTypeListWorkEnum["BONUSES"] = 1] = "BONUSES";
5375
+ IncomeSourceTypeListWorkEnum[IncomeSourceTypeListWorkEnum["DIRECTOR_FEES"] = 2] = "DIRECTOR_FEES";
5376
+ IncomeSourceTypeListWorkEnum[IncomeSourceTypeListWorkEnum["INTEREST"] = 4] = "INTEREST";
5377
+ IncomeSourceTypeListWorkEnum[IncomeSourceTypeListWorkEnum["PENSIONS_AND_ALLOWANCES"] = 5] = "PENSIONS_AND_ALLOWANCES";
5378
+ IncomeSourceTypeListWorkEnum[IncomeSourceTypeListWorkEnum["SUPERANNUATION"] = 8] = "SUPERANNUATION";
5379
+ IncomeSourceTypeListWorkEnum[IncomeSourceTypeListWorkEnum["ATTRIBUTED_P_S_I"] = 11] = "ATTRIBUTED_P_S_I";
5380
+ })(IncomeSourceTypeListWorkEnum || (IncomeSourceTypeListWorkEnum = {}));
5381
+
5382
+ var IncomeSourceTypeListHoldingEnum;
5383
+ (function (IncomeSourceTypeListHoldingEnum) {
5384
+ IncomeSourceTypeListHoldingEnum[IncomeSourceTypeListHoldingEnum["DIVIDENDS"] = 3] = "DIVIDENDS";
5385
+ IncomeSourceTypeListHoldingEnum[IncomeSourceTypeListHoldingEnum["INTEREST"] = 4] = "INTEREST";
5386
+ IncomeSourceTypeListHoldingEnum[IncomeSourceTypeListHoldingEnum["TRUSTS"] = 9] = "TRUSTS";
5387
+ IncomeSourceTypeListHoldingEnum[IncomeSourceTypeListHoldingEnum["OTHER_INCOME"] = 10] = "OTHER_INCOME";
5388
+ IncomeSourceTypeListHoldingEnum[IncomeSourceTypeListHoldingEnum["PARTNERSHIPS"] = 12] = "PARTNERSHIPS";
5389
+ })(IncomeSourceTypeListHoldingEnum || (IncomeSourceTypeListHoldingEnum = {}));
5390
+
5391
+ class IncomeSourceType extends IncomeSourceType$1 {
5392
+ isBonuses() {
5393
+ return this.id === IncomeSourceTypeListWorkEnum.BONUSES;
5394
+ }
5395
+ isWork() {
5396
+ return !!IncomeSourceTypeListWorkEnum[this.id];
5397
+ }
5398
+ isOther() {
5399
+ return !!IncomeSourceTypeListOtherEnum[this.id];
5400
+ }
5401
+ isHolding() {
5402
+ return !!IncomeSourceTypeListHoldingEnum[this.id];
5403
+ }
5404
+ isSole() {
5405
+ return !!IncomeSourceTypeListSoleEnum[this.id];
5406
+ }
5407
+ }
5408
+
5409
+ class IncomeSourceForecast extends IncomeSourceForecast$1 {
5410
+ constructor() {
5411
+ super(...arguments);
5412
+ this.paygIncome = 0;
5413
+ this.frequency = SalaryForecastFrequencyEnum.ANNUAL;
5414
+ this.isTaxFree = false;
5415
+ }
5416
+ /**
5417
+ * Sometimes Income source has Salary & Income source forecasts,
5418
+ * and we need these fields to work with Income source forecasts like with Salary Forecasts
5419
+ */
5420
+ get netPay() {
5421
+ return this.amount;
5422
+ }
5423
+ get grossAmount() {
5424
+ return this.amount + this.tax + this.taxInstalments + this.frankingCredits;
5425
+ }
5426
+ get monthlyAmount() {
5427
+ return this.amount / 12;
5428
+ }
5429
+ }
5430
+ __decorate([
5431
+ Type(() => IncomeSourceType)
5432
+ ], IncomeSourceForecast.prototype, "incomeSourceType", void 0);
5433
+ __decorate([
5434
+ Type(() => IncomeSource)
5435
+ ], IncomeSourceForecast.prototype, "incomeSource", void 0);
5436
+
5437
+ class IncomeSource extends IncomeSource$1 {
5438
+ isSoleIncome() {
5439
+ return this.type === IncomeSourceTypeEnum.SOLE;
5440
+ }
5441
+ isWorkIncome() {
5442
+ return this.type === IncomeSourceTypeEnum.WORK;
5443
+ }
5444
+ isOtherIncome() {
5445
+ return this.type === IncomeSourceTypeEnum.OTHER;
5446
+ }
5447
+ isHolding() {
5448
+ return this.type === IncomeSourceTypeEnum.HOLDING;
5449
+ }
5450
+ /**
5451
+ * Get salary and other income forecasts
5452
+ */
5453
+ get forecasts() {
5454
+ return [...this.salaryForecasts, ...this.incomeSourceForecasts, ...this.soleForecasts];
5455
+ }
5456
+ /**
5457
+ * Get actual (1st from the list) forecast
5458
+ */
5459
+ get actualForecast() {
5460
+ return this.forecasts[0];
5461
+ }
5462
+ /**
5463
+ * Check if user was working in month taken by the index
5464
+ * @param monthIndex by which month should be taken
5465
+ */
5466
+ isWorkedInMonth(monthIndex) {
5467
+ const monthDate = new FinancialYear().getMonthDate(monthIndex);
5468
+ return (!this.dateFrom || monthDate >= this.dateFrom) && (!this.dateTo || monthDate < this.dateTo);
5469
+ }
5470
+ }
5471
+ __decorate([
5472
+ Type(() => SalaryForecast)
5473
+ ], IncomeSource.prototype, "salaryForecasts", void 0);
5474
+ __decorate([
5475
+ Type(() => SoleForecast)
5476
+ ], IncomeSource.prototype, "soleForecasts", void 0);
5477
+ __decorate([
5478
+ Type(() => IncomeSourceForecast)
5479
+ ], IncomeSource.prototype, "incomeSourceForecasts", void 0);
5480
+ __decorate([
5481
+ Type(() => Date)
5482
+ ], IncomeSource.prototype, "dateFrom", void 0);
5483
+ __decorate([
5484
+ Type(() => Date)
5485
+ ], IncomeSource.prototype, "dateTo", void 0);
5486
+
5487
+ /**
5488
+ * Income sources chart data
5489
+ */
5490
+ class IncomeSourceChartData {
5491
+ constructor(forecastedIncomeAmount, transactions) {
5492
+ this.forecastedIncomeAmount = forecastedIncomeAmount;
5493
+ this.transactions = transactions;
5600
5494
  }
5601
5495
  /**
5602
- * Check if current user is firm owner
5496
+ * Get prepared data for income sources chart
5603
5497
  */
5604
- isFirmOwner() {
5605
- return this.roles.includes(UserRolesEnum.FIRM_OWNER);
5498
+ get() {
5499
+ const chartData = [{
5500
+ id: 'actualIncome',
5501
+ name: 'Actual Income',
5502
+ data: [],
5503
+ // display future actual incomes with dash line and past actual incomes with solid line
5504
+ zones: [{
5505
+ // line style after current month
5506
+ value: new FinancialYear().getMonthDate(new Date().getMonth()).getTime(),
5507
+ dashStyle: 'Solid'
5508
+ }, {
5509
+ // default line style
5510
+ dashStyle: 'Dash'
5511
+ }]
5512
+ }, {
5513
+ id: 'forecastedIncome',
5514
+ name: 'Forecasted Income',
5515
+ data: [],
5516
+ }];
5517
+ for (const key in MonthNameShortEnum) {
5518
+ if (MonthNameShortEnum.hasOwnProperty(key)) {
5519
+ // transaction collection for provided month
5520
+ const monthTransactionCollection = this.transactions.getByMonth(+MonthNumberEnum[key]);
5521
+ chartData[0].data.push([new FinancialYear().getMonthDate(+MonthNumberEnum[key]).getTime(), monthTransactionCollection.amount]);
5522
+ chartData[1].data.push([new FinancialYear().getMonthDate(+MonthNumberEnum[key]).getTime(), this.forecastedIncomeAmount / 12]);
5523
+ }
5524
+ }
5525
+ return chartData;
5606
5526
  }
5607
- isTopManager() {
5608
- return this.roles.includes(UserRolesEnum.FIRM_TOP_MANAGER) || this.roles.includes(UserRolesEnum.FIRM_OWNER);
5527
+ }
5528
+
5529
+ class AllocationRuleTransaction extends AllocationRuleTransaction$1 {
5530
+ constructor() {
5531
+ super(...arguments);
5532
+ this.claimPercent = 100;
5533
+ this.tax = 0;
5534
+ this.amount = null;
5609
5535
  }
5610
- isManager() {
5611
- return this.roles.includes(UserRolesEnum.FIRM_MANAGER) || this.roles.includes(UserRolesEnum.FIRM_TOP_MANAGER) || this.roles.includes(UserRolesEnum.FIRM_OWNER);
5536
+ get amountPercentCoefficient() {
5537
+ return this.amountPercent ? this.amountPercent / 100 : 1;
5612
5538
  }
5613
- /**
5614
- * check if user has property tank access
5615
- */
5616
- hasPropertyTank() {
5617
- return this.roles ?
5618
- this.roles.includes(UserRolesEnum.PROPERTY_TANK) :
5619
- !!this.getSubscriptionRole(UserRolesEnum.PROPERTY_TANK);
5539
+ calculateClaimPercent() {
5540
+ if (!this.chartAccounts) {
5541
+ return null;
5542
+ }
5543
+ let claimPercent = this.chartAccounts.taxablePercent;
5544
+ // Property claim (ownership% x shared%) for property expenses, taxable percent for others
5545
+ if (this.chartAccounts?.isProperty() && this.property) {
5546
+ if (this.chartAccounts.isPropertyExpense() && this.chartAccounts.id !== ChartAccountsListEnum.PLATFORM_FEES) {
5547
+ claimPercent *= this.property?.claimCoefficient;
5548
+ }
5549
+ }
5550
+ return claimPercent;
5620
5551
  }
5621
5552
  /**
5622
- * check if user has property tank access
5553
+ * If rule transaction has amount then split enabled. There is 0 when split disabled
5623
5554
  */
5624
- hasWorkTank() {
5625
- return this.roles ?
5626
- this.roles.includes(UserRolesEnum.WORK_TANK) :
5627
- !!this.getSubscriptionRole(UserRolesEnum.WORK_TANK);
5555
+ isSplit() {
5556
+ return !!this.amountPercent;
5628
5557
  }
5629
5558
  /**
5630
- * Get user subscription role by provided role type
5631
- * @param roleType by which role should be returned
5559
+ * Create Transaction instance based on passed bank transaction and rule transaction
5632
5560
  */
5633
- getSubscriptionRole(roleType) {
5634
- /**
5635
- * Add @TODO for Alex to check if we should use getLastSubscription here
5636
- */
5637
- return this.activeSubscription?.items
5638
- .find((subscriptionItem) => subscriptionItem.price.product.role.includes(roleType));
5561
+ toTransaction(bankTransaction = null) {
5562
+ const transaction = bankTransaction ? bankTransaction.toTransaction(this.isGST) : plainToClass(Transaction, {});
5563
+ Object.assign(transaction, {
5564
+ isGST: this.isGST,
5565
+ tax: this.tax,
5566
+ claimPercent: this.claimPercent,
5567
+ chartAccounts: this.chartAccounts,
5568
+ property: this.property,
5569
+ loan: this.loan,
5570
+ incomeSource: this.incomeSource,
5571
+ metaFields: this.metaFields,
5572
+ business: this.business,
5573
+ source: TransactionSourceEnum.BANK_TRANSACTION,
5574
+ operation: TransactionOperationEnum.ALLOCATE,
5575
+ transactions: [],
5576
+ });
5577
+ // split allocation
5578
+ if (this.amountPercent) {
5579
+ transaction.amount = bankTransaction.amount * this.amountPercentCoefficient / this.gstCoefficient;
5580
+ }
5581
+ // child transactions inherit most of the fields from parent transaction
5582
+ this.childTransactions.forEach((childRuleTransaction) => {
5583
+ const childTransaction = childRuleTransaction.toTransaction();
5584
+ childTransaction.amount = childRuleTransaction.amount;
5585
+ childTransaction.setParent(transaction);
5586
+ transaction.transactions.push(childTransaction);
5587
+ });
5588
+ return transaction;
5639
5589
  }
5640
- isCurrentFinancialYear() {
5641
- return new FinancialYear(new Date()).year === this.financialYear;
5590
+ }
5591
+ __decorate([
5592
+ Type(() => ChartAccounts)
5593
+ // @TODO Alex: Create custom decorator for this transform
5594
+ ,
5595
+ Transform(({ value }) => ({ id: value.id }), { toPlainOnly: true })
5596
+ ], AllocationRuleTransaction.prototype, "chartAccounts", void 0);
5597
+ __decorate([
5598
+ Type(() => Property),
5599
+ Transform(({ value }) => value ? { id: value.id } : null, { toPlainOnly: true })
5600
+ ], AllocationRuleTransaction.prototype, "property", void 0);
5601
+ __decorate([
5602
+ Type(() => Loan),
5603
+ Transform(({ value }) => value ? { id: value.id } : null, { toPlainOnly: true })
5604
+ ], AllocationRuleTransaction.prototype, "loan", void 0);
5605
+ __decorate([
5606
+ Type(() => IncomeSource),
5607
+ Transform(({ value }) => value ? { id: value.id } : null, { toPlainOnly: true })
5608
+ ], AllocationRuleTransaction.prototype, "incomeSource", void 0);
5609
+ __decorate([
5610
+ Type(() => SoleBusiness),
5611
+ Transform(({ value }) => value ? { id: value.id } : null, { toPlainOnly: true })
5612
+ ], AllocationRuleTransaction.prototype, "business", void 0);
5613
+ __decorate([
5614
+ Type(() => AllocationRuleTransactionMetaField)
5615
+ ], AllocationRuleTransaction.prototype, "metaFields", void 0);
5616
+ __decorate([
5617
+ Type(() => AllocationRuleTransaction)
5618
+ ], AllocationRuleTransaction.prototype, "parentTransaction", void 0);
5619
+ __decorate([
5620
+ Type(() => AllocationRuleTransaction)
5621
+ ], AllocationRuleTransaction.prototype, "childTransactions", void 0);
5622
+ __decorate([
5623
+ Type(() => Number)
5624
+ ], AllocationRuleTransaction.prototype, "claimPercent", void 0);
5625
+ __decorate([
5626
+ Type(() => Number)
5627
+ ], AllocationRuleTransaction.prototype, "tax", void 0);
5628
+
5629
+ var TransactionTypeEnum;
5630
+ (function (TransactionTypeEnum) {
5631
+ TransactionTypeEnum[TransactionTypeEnum["DEBIT"] = 1] = "DEBIT";
5632
+ TransactionTypeEnum[TransactionTypeEnum["CREDIT"] = 2] = "CREDIT";
5633
+ })(TransactionTypeEnum || (TransactionTypeEnum = {}));
5634
+
5635
+ class TaxExemption extends TaxExemption$1 {
5636
+ isPartial() {
5637
+ return [TaxExemptionEnum.INVESTMENT_TO_PPR, TaxExemptionEnum.PPR_TO_INVESTMENT].includes(this.id);
5638
+ }
5639
+ }
5640
+
5641
+ class AssetSale extends ObservableModel {
5642
+ static { this.className = 'AssetSale'; }
5643
+ }
5644
+ __decorate([
5645
+ Type(() => Date)
5646
+ ], AssetSale.prototype, "date", void 0);
5647
+
5648
+ class PropertySale extends AssetSale {
5649
+ get saleCostsTotalAmount() {
5650
+ return this.commission + this.legalFees + this.otherCost;
5642
5651
  }
5643
5652
  /**
5644
- * financial years available in the app for user
5645
- * starts from 2022 for new users and registeredYear - 1 for old users
5653
+ * CGT is not applicable for sales with "Principle place of residence" exemption type.
5654
+ * https://taxtank.atlassian.net/wiki/spaces/TAXTANK/pages/4644110466/Tax+Return+MyTax+-+Online+Form ("Capital gains or losses" section)
5646
5655
  */
5647
- get financialYears() {
5648
- return range(Math.min(FinancialYear.toFinYear(this.createdAt) - 1, 2022), FinancialYear.toFinYear(new Date()) + 1);
5656
+ isCGTApplicable() {
5657
+ return this.taxExemption?.id !== TaxExemptionEnum.PPR;
5649
5658
  }
5650
- get firmBranchNames() {
5651
- return this.employeeDetails.firmBranchNames;
5659
+ get netPrice() {
5660
+ return this.price - this.saleCostsTotalAmount;
5652
5661
  }
5653
5662
  }
5654
5663
  __decorate([
5655
- Type(() => ServiceSubscription)
5656
- ], User.prototype, "subscriptions", void 0);
5664
+ Type(() => Number)
5665
+ ], PropertySale.prototype, "holdingCosts", void 0);
5657
5666
  __decorate([
5658
- Type(() => ClientDetails)
5659
- ], User.prototype, "clientDetails", void 0);
5667
+ Type(() => Number)
5668
+ ], PropertySale.prototype, "structuralImprovementsWDV", void 0);
5660
5669
  __decorate([
5661
- Type(() => EmployeeDetails)
5662
- ], User.prototype, "employeeDetails", void 0);
5670
+ Type(() => Number)
5671
+ ], PropertySale.prototype, "buildingAtCostClaimed", void 0);
5663
5672
  __decorate([
5664
- Type(() => SoleDetails)
5665
- ], User.prototype, "soleDetails", void 0);
5673
+ Type(() => Number)
5674
+ ], PropertySale.prototype, "price", void 0);
5666
5675
  __decorate([
5667
- Type(() => Address)
5668
- ], User.prototype, "address", void 0);
5676
+ Type(() => Number)
5677
+ ], PropertySale.prototype, "commission", void 0);
5669
5678
  __decorate([
5670
- Type(() => Phone)
5671
- ], User.prototype, "phone", void 0);
5679
+ Type(() => Number)
5680
+ ], PropertySale.prototype, "legalFees", void 0);
5681
+ __decorate([
5682
+ Type(() => Number)
5683
+ ], PropertySale.prototype, "otherCost", void 0);
5672
5684
  __decorate([
5673
5685
  Type(() => Date)
5674
- ], User.prototype, "createdAt", void 0);
5686
+ ], PropertySale.prototype, "settlementDate", void 0);
5675
5687
  __decorate([
5676
- Type(() => User)
5677
- ], User.prototype, "clients", void 0);
5688
+ Type(() => Date)
5689
+ ], PropertySale.prototype, "date", void 0);
5678
5690
  __decorate([
5679
- Type(() => AppFile)
5680
- ], User.prototype, "file", void 0);
5691
+ Type(() => TaxExemption)
5692
+ ], PropertySale.prototype, "taxExemption", void 0);
5681
5693
  __decorate([
5682
- Type(() => AccountSetupItem)
5683
- ], User.prototype, "blacklistSetupItems", void 0);
5694
+ Type(() => PropertySaleTaxExemptionMetaField$1)
5695
+ ], PropertySale.prototype, "taxExemptionMetaFields", void 0);
5684
5696
 
5685
5697
  class PropertySubscription extends PropertySubscription$1 {
5686
5698
  }
@@ -5804,6 +5816,9 @@ __decorate([
5804
5816
  __decorate([
5805
5817
  Transform(({ value }) => +value)
5806
5818
  ], PropertyForecast.prototype, "marketValue", void 0);
5819
+ __decorate([
5820
+ Type(() => User)
5821
+ ], PropertyForecast.prototype, "updatedBy", void 0);
5807
5822
 
5808
5823
  /**
5809
5824
  * propertySale docs - https://taxtank.atlassian.net/wiki/spaces/TAXTANK/pages/4209508353/Property+Sold+button
@@ -10599,11 +10614,12 @@ class Holding extends AbstractModel {
10599
10614
  * Get total purchasing price
10600
10615
  */
10601
10616
  get purchaseValue() {
10617
+ const quantity = this.currentQuantity ?? this.quantity;
10602
10618
  // Price and entity may be empty when we use HoldingForm.currentValue
10603
- if (!this.price || !this.currentQuantity) {
10619
+ if (!this.price || !this.quantity) {
10604
10620
  return 0;
10605
10621
  }
10606
- return this.price * this.currentQuantity;
10622
+ return this.price * quantity;
10607
10623
  }
10608
10624
  /**
10609
10625
  * Get current market price
@@ -18925,7 +18941,6 @@ class JsPdf extends jsPDF {
18925
18941
  const FILE_SETTINGS$1 = {
18926
18942
  margin: 10,
18927
18943
  filename: 'export.pdf',
18928
- image: { type: 'jpeg', quality: 0.20 },
18929
18944
  html2canvas: {
18930
18945
  scale: 2,
18931
18946
  useCORS: true,