taxtank-core 2.1.6 → 2.1.8
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.
- package/fesm2022/taxtank-core.mjs +138 -71
- package/fesm2022/taxtank-core.mjs.map +1 -1
- package/index.d.ts +32 -17
- package/package.json +1 -1
|
@@ -477,7 +477,11 @@ let IncomeSourceForecast$1 = class IncomeSourceForecast extends AbstractModel {
|
|
|
477
477
|
let IncomeSourceType$1 = class IncomeSourceType extends AbstractModel {
|
|
478
478
|
};
|
|
479
479
|
|
|
480
|
-
let IncomeSource$1 = class IncomeSource extends
|
|
480
|
+
let IncomeSource$1 = class IncomeSource extends ObservableModel {
|
|
481
|
+
constructor() {
|
|
482
|
+
super(...arguments);
|
|
483
|
+
this.className = 'IncomeSource';
|
|
484
|
+
}
|
|
481
485
|
};
|
|
482
486
|
|
|
483
487
|
let SalaryForecast$1 = class SalaryForecast extends AbstractModel {
|
|
@@ -1447,6 +1451,7 @@ var CalendarEventTypeEnum;
|
|
|
1447
1451
|
CalendarEventTypeEnum[CalendarEventTypeEnum["INCOMES"] = 1] = "INCOMES";
|
|
1448
1452
|
CalendarEventTypeEnum[CalendarEventTypeEnum["EXPENSES"] = 2] = "EXPENSES";
|
|
1449
1453
|
CalendarEventTypeEnum[CalendarEventTypeEnum["GOALS"] = 3] = "GOALS";
|
|
1454
|
+
CalendarEventTypeEnum[CalendarEventTypeEnum["REMINDERS"] = 4] = "REMINDERS";
|
|
1450
1455
|
})(CalendarEventTypeEnum || (CalendarEventTypeEnum = {}));
|
|
1451
1456
|
|
|
1452
1457
|
var CalendarReminderTypeEnum;
|
|
@@ -2413,9 +2418,6 @@ class LoanCollection extends Collection {
|
|
|
2413
2418
|
class CalendarEventCollection extends Collection {
|
|
2414
2419
|
}
|
|
2415
2420
|
|
|
2416
|
-
class CalendarReminderCollection extends Collection {
|
|
2417
|
-
}
|
|
2418
|
-
|
|
2419
2421
|
class MoneyCalendarEventCollection extends CalendarEventCollection {
|
|
2420
2422
|
constructor(items) {
|
|
2421
2423
|
super(items);
|
|
@@ -2438,6 +2440,19 @@ class MoneyCalendarEventCollection extends CalendarEventCollection {
|
|
|
2438
2440
|
}
|
|
2439
2441
|
}
|
|
2440
2442
|
|
|
2443
|
+
class CalendarReminderCollection extends Collection {
|
|
2444
|
+
getCalendarEvents() {
|
|
2445
|
+
return new MoneyCalendarEventCollection(this.map(reminder => reminder.getCalendarEvents().items).flat());
|
|
2446
|
+
}
|
|
2447
|
+
getByDate(dateFrom, dateTo) {
|
|
2448
|
+
return this.filter(reminder => !!reminder.getCalendarEvents().filterByDate(dateFrom, dateTo).length);
|
|
2449
|
+
}
|
|
2450
|
+
filterByProperties(properties) {
|
|
2451
|
+
const propertyIds = properties.map(property => property.id);
|
|
2452
|
+
return this.filter(reminder => propertyIds.includes(reminder.property?.id));
|
|
2453
|
+
}
|
|
2454
|
+
}
|
|
2455
|
+
|
|
2441
2456
|
class PropertySaleCollection extends Collection {
|
|
2442
2457
|
/**
|
|
2443
2458
|
* Property sales are CGT applicable unless it has "Principle place of residence" exemption type
|
|
@@ -11347,14 +11362,77 @@ class MoneyCalendarEvent extends CalendarEvent {
|
|
|
11347
11362
|
}
|
|
11348
11363
|
}
|
|
11349
11364
|
|
|
11365
|
+
/**
|
|
11366
|
+
* Generates a list of recurring dates between a start and end date
|
|
11367
|
+
* based on a given frequency (monthly, weekly, fortnightly).
|
|
11368
|
+
*
|
|
11369
|
+
* - Uses WEEKLY as the default recurrence pattern.
|
|
11370
|
+
* - Converts both start and end dates to "start of day" to avoid time drift.
|
|
11371
|
+
* - Iteratively adds the appropriate duration (week/month) until the end date is reached.
|
|
11372
|
+
* - Returns all occurrence dates including the start date and the last valid recurrence.
|
|
11373
|
+
*/
|
|
11374
|
+
function recurringDates(frequency, startDate, endDate) {
|
|
11375
|
+
endDate = endDate ?? new FinancialYear().endDate;
|
|
11376
|
+
let duration;
|
|
11377
|
+
let amount = 1;
|
|
11378
|
+
switch (frequency) {
|
|
11379
|
+
case AnnualFrequencyEnum.DAILY:
|
|
11380
|
+
duration = 'day';
|
|
11381
|
+
break;
|
|
11382
|
+
case AnnualFrequencyEnum.WEEKLY:
|
|
11383
|
+
duration = 'week';
|
|
11384
|
+
break;
|
|
11385
|
+
case AnnualFrequencyEnum.FORTNIGHTLY:
|
|
11386
|
+
duration = 'week';
|
|
11387
|
+
amount = 2;
|
|
11388
|
+
break;
|
|
11389
|
+
case AnnualFrequencyEnum.MONTHLY:
|
|
11390
|
+
duration = 'month';
|
|
11391
|
+
break;
|
|
11392
|
+
case AnnualFrequencyEnum.QUARTERLY:
|
|
11393
|
+
duration = 'quarters';
|
|
11394
|
+
break;
|
|
11395
|
+
default:
|
|
11396
|
+
duration = 'year';
|
|
11397
|
+
break;
|
|
11398
|
+
}
|
|
11399
|
+
const dates = [];
|
|
11400
|
+
let current = moment$1(startDate).startOf('day');
|
|
11401
|
+
const end = moment$1(endDate).startOf('day');
|
|
11402
|
+
while (current.isSameOrBefore(end)) {
|
|
11403
|
+
dates.push(current.toDate());
|
|
11404
|
+
current = current.add(amount, duration);
|
|
11405
|
+
}
|
|
11406
|
+
return dates;
|
|
11407
|
+
}
|
|
11408
|
+
|
|
11350
11409
|
class CalendarReminder extends AbstractModel {
|
|
11351
11410
|
static { this.className = 'CalendarReminder'; }
|
|
11411
|
+
/**
|
|
11412
|
+
* creates recurring calendar events based on frequency
|
|
11413
|
+
*/
|
|
11414
|
+
getCalendarEvents() {
|
|
11415
|
+
const paymentDates = recurringDates(this.frequency, this.startDate, this.endDate);
|
|
11416
|
+
return new MoneyCalendarEventCollection(paymentDates.map(date => plainToClass(MoneyCalendarEvent, {
|
|
11417
|
+
title: this.name,
|
|
11418
|
+
subTitle: this.property?.name ?? this.business?.name ?? this.incomeSource?.name ?? '',
|
|
11419
|
+
date: date,
|
|
11420
|
+
extendedProps: {
|
|
11421
|
+
date: date,
|
|
11422
|
+
model: this,
|
|
11423
|
+
type: CalendarEventTypeEnum.REMINDERS,
|
|
11424
|
+
tankType: this.tankType,
|
|
11425
|
+
propertyId: this.property?.id,
|
|
11426
|
+
businessId: this.business?.id,
|
|
11427
|
+
}
|
|
11428
|
+
})));
|
|
11429
|
+
}
|
|
11352
11430
|
}
|
|
11353
11431
|
__decorate([
|
|
11354
|
-
|
|
11432
|
+
TransformDate()
|
|
11355
11433
|
], CalendarReminder.prototype, "startDate", void 0);
|
|
11356
11434
|
__decorate([
|
|
11357
|
-
|
|
11435
|
+
TransformDate()
|
|
11358
11436
|
], CalendarReminder.prototype, "endDate", void 0);
|
|
11359
11437
|
__decorate([
|
|
11360
11438
|
Type(() => AppFile)
|
|
@@ -11820,51 +11898,6 @@ var SharesightPortfolioMessages;
|
|
|
11820
11898
|
SharesightPortfolioMessages["PUT"] = "We\u2019re syncing your Sharesight trades, which might take a few minutes. We\u2019ll let you know when they\u2019re ready.";
|
|
11821
11899
|
})(SharesightPortfolioMessages || (SharesightPortfolioMessages = {}));
|
|
11822
11900
|
|
|
11823
|
-
/**
|
|
11824
|
-
* Generates a list of recurring dates between a start and end date
|
|
11825
|
-
* based on a given frequency (monthly, weekly, fortnightly).
|
|
11826
|
-
*
|
|
11827
|
-
* - Uses WEEKLY as the default recurrence pattern.
|
|
11828
|
-
* - Converts both start and end dates to "start of day" to avoid time drift.
|
|
11829
|
-
* - Iteratively adds the appropriate duration (week/month) until the end date is reached.
|
|
11830
|
-
* - Returns all occurrence dates including the start date and the last valid recurrence.
|
|
11831
|
-
*/
|
|
11832
|
-
function recurringDates(frequency, startDate, endDate) {
|
|
11833
|
-
endDate = endDate ?? new FinancialYear().endDate;
|
|
11834
|
-
let duration;
|
|
11835
|
-
let amount;
|
|
11836
|
-
switch (frequency) {
|
|
11837
|
-
case AnnualFrequencyEnum.WEEKLY:
|
|
11838
|
-
duration = 'week';
|
|
11839
|
-
amount = 1;
|
|
11840
|
-
break;
|
|
11841
|
-
case AnnualFrequencyEnum.FORTNIGHTLY:
|
|
11842
|
-
duration = 'week';
|
|
11843
|
-
amount = 2;
|
|
11844
|
-
break;
|
|
11845
|
-
case AnnualFrequencyEnum.MONTHLY:
|
|
11846
|
-
duration = 'month';
|
|
11847
|
-
amount = 1;
|
|
11848
|
-
break;
|
|
11849
|
-
case AnnualFrequencyEnum.QUARTERLY:
|
|
11850
|
-
duration = 'quarters';
|
|
11851
|
-
amount = 1;
|
|
11852
|
-
break;
|
|
11853
|
-
default:
|
|
11854
|
-
duration = 'year';
|
|
11855
|
-
amount = 1;
|
|
11856
|
-
break;
|
|
11857
|
-
}
|
|
11858
|
-
const dates = [];
|
|
11859
|
-
let current = moment$1(startDate).startOf('day');
|
|
11860
|
-
const end = moment$1(endDate).startOf('day');
|
|
11861
|
-
while (current.isSameOrBefore(end)) {
|
|
11862
|
-
dates.push(current.toDate());
|
|
11863
|
-
current = current.add(amount, duration);
|
|
11864
|
-
}
|
|
11865
|
-
return dates;
|
|
11866
|
-
}
|
|
11867
|
-
|
|
11868
11901
|
class BudgetRule extends BudgetRule$1 {
|
|
11869
11902
|
constructor() {
|
|
11870
11903
|
super(...arguments);
|
|
@@ -11884,10 +11917,12 @@ class BudgetRule extends BudgetRule$1 {
|
|
|
11884
11917
|
return new MoneyCalendarEventCollection(paymentDates.map((date) => plainToClass(MoneyCalendarEvent, {
|
|
11885
11918
|
date: date,
|
|
11886
11919
|
title: this.chartAccounts.name,
|
|
11920
|
+
subTitle: this.property?.name ?? this.business?.name ?? this.incomeSource?.name ?? '',
|
|
11887
11921
|
extendedProps: {
|
|
11888
|
-
|
|
11889
|
-
class: BudgetRule.className,
|
|
11922
|
+
type: this.chartAccounts.isIncome() ? CalendarEventTypeEnum.INCOMES : CalendarEventTypeEnum.EXPENSES,
|
|
11890
11923
|
amount: this.amount,
|
|
11924
|
+
model: this,
|
|
11925
|
+
date: date,
|
|
11891
11926
|
chartAccounts: this.chartAccounts,
|
|
11892
11927
|
tankType: this.chartAccounts.tankType,
|
|
11893
11928
|
isIncome: this.chartAccounts.isIncome(),
|
|
@@ -11913,10 +11948,10 @@ __decorate([
|
|
|
11913
11948
|
Type(() => ChartAccounts)
|
|
11914
11949
|
], BudgetRule.prototype, "chartAccounts", void 0);
|
|
11915
11950
|
__decorate([
|
|
11916
|
-
|
|
11951
|
+
TransformDate()
|
|
11917
11952
|
], BudgetRule.prototype, "startDate", void 0);
|
|
11918
11953
|
__decorate([
|
|
11919
|
-
|
|
11954
|
+
TransformDate()
|
|
11920
11955
|
], BudgetRule.prototype, "endDate", void 0);
|
|
11921
11956
|
__decorate([
|
|
11922
11957
|
Type(() => BankAccount)
|
|
@@ -12142,8 +12177,9 @@ class FinancialGoal extends ObservableModel {
|
|
|
12142
12177
|
title: this.name,
|
|
12143
12178
|
date: date,
|
|
12144
12179
|
extendedProps: {
|
|
12145
|
-
|
|
12146
|
-
|
|
12180
|
+
model: this,
|
|
12181
|
+
date: date,
|
|
12182
|
+
type: CalendarEventTypeEnum.GOALS,
|
|
12147
12183
|
amount: this.paymentAmount
|
|
12148
12184
|
}
|
|
12149
12185
|
})));
|
|
@@ -13959,14 +13995,22 @@ var FinancialGoalMessagesEnum;
|
|
|
13959
13995
|
FinancialGoalMessagesEnum["CONFIRM_COMPLETE"] = "Are you sure? Complete goals can not be made active again. Would you like to continue?";
|
|
13960
13996
|
})(FinancialGoalMessagesEnum || (FinancialGoalMessagesEnum = {}));
|
|
13961
13997
|
|
|
13998
|
+
/**
|
|
13999
|
+
* CalendarReminder need to show information from SoleBusiness, IncomeSource
|
|
14000
|
+
* service helps to keep information updated by listening of their change events
|
|
14001
|
+
*/
|
|
13962
14002
|
class CalendarReminderService extends RestService$1 {
|
|
13963
|
-
constructor() {
|
|
13964
|
-
super(
|
|
14003
|
+
constructor(environment) {
|
|
14004
|
+
super(environment);
|
|
14005
|
+
this.environment = environment;
|
|
13965
14006
|
this.endpointUri = 'calendar-reminders';
|
|
13966
14007
|
this.modelClass = CalendarReminder;
|
|
13967
14008
|
this.collectionClass = CalendarReminderCollection;
|
|
14009
|
+
this.roles = [UserRolesEnum.MONEY_TANK];
|
|
14010
|
+
this.listenCSE(SoleBusiness, this.refreshCache, ['put']);
|
|
14011
|
+
this.listenCSE(IncomeSource, this.refreshCache, ['put']);
|
|
13968
14012
|
}
|
|
13969
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.10", ngImport: i0, type: CalendarReminderService, deps:
|
|
14013
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.10", ngImport: i0, type: CalendarReminderService, deps: [{ token: 'environment' }], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
13970
14014
|
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.3.10", ngImport: i0, type: CalendarReminderService, providedIn: 'root' }); }
|
|
13971
14015
|
}
|
|
13972
14016
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.10", ngImport: i0, type: CalendarReminderService, decorators: [{
|
|
@@ -13974,7 +14018,10 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.10", ngImpo
|
|
|
13974
14018
|
args: [{
|
|
13975
14019
|
providedIn: 'root',
|
|
13976
14020
|
}]
|
|
13977
|
-
}]
|
|
14021
|
+
}], ctorParameters: () => [{ type: undefined, decorators: [{
|
|
14022
|
+
type: Inject,
|
|
14023
|
+
args: ['environment']
|
|
14024
|
+
}] }] });
|
|
13978
14025
|
|
|
13979
14026
|
var CalendarReminderMessagesEnum;
|
|
13980
14027
|
(function (CalendarReminderMessagesEnum) {
|
|
@@ -23975,7 +24022,7 @@ class CalendarReminderForm extends AbstractForm {
|
|
|
23975
24022
|
tankType: new UntypedFormControl(reminder.tankType ?? TankTypeEnum.PERSONAL, Validators.required),
|
|
23976
24023
|
type: new UntypedFormControl(reminder.type, Validators.required),
|
|
23977
24024
|
startDate: new FormControl(reminder.startDate, Validators.required),
|
|
23978
|
-
endDate: new FormControl({ value: reminder.endDate, disabled: !reminder.frequency }, [
|
|
24025
|
+
endDate: new FormControl({ value: reminder.endDate, disabled: !reminder.frequency }, [conditionalValidator(() => this.get('frequency').value, compareWithControlValidator('startDate', '>', 'Reminder start date'))]),
|
|
23979
24026
|
frequency: new FormControl(reminder.frequency),
|
|
23980
24027
|
description: new UntypedFormControl(reminder.description),
|
|
23981
24028
|
file: new UntypedFormControl(reminder.file),
|
|
@@ -23987,6 +24034,14 @@ class CalendarReminderForm extends AbstractForm {
|
|
|
23987
24034
|
}
|
|
23988
24035
|
listenEvents() {
|
|
23989
24036
|
this.listenFrequency();
|
|
24037
|
+
this.listenTankType();
|
|
24038
|
+
}
|
|
24039
|
+
listenTankType() {
|
|
24040
|
+
this.get('tankType').valueChanges.subscribe(() => {
|
|
24041
|
+
this.get('business').reset();
|
|
24042
|
+
this.get('property').reset();
|
|
24043
|
+
this.get('incomeSource').reset();
|
|
24044
|
+
});
|
|
23990
24045
|
}
|
|
23991
24046
|
listenFrequency() {
|
|
23992
24047
|
this.get('frequency').valueChanges.subscribe((value) => {
|
|
@@ -24132,17 +24187,11 @@ class MoneyScheduleFilterForm extends AbstractForm {
|
|
|
24132
24187
|
// calendar year start and FinYear start are different. we need to convert FinYear to regular one
|
|
24133
24188
|
this.onFilter.emit(new Date(new FinancialYear().getYearByMonth(monthIndex), monthIndex, 1));
|
|
24134
24189
|
let filteredEvents = calendarEvents;
|
|
24135
|
-
if (value.eventType
|
|
24136
|
-
filteredEvents = filteredEvents.filterBy('extendedProps.
|
|
24137
|
-
}
|
|
24138
|
-
if (value.eventType === CalendarEventTypeEnum.EXPENSES) {
|
|
24139
|
-
filteredEvents = filteredEvents.filter(event => event.extendedProps.chartAccounts?.isExpense());
|
|
24140
|
-
}
|
|
24141
|
-
if (value.eventType === CalendarEventTypeEnum.INCOMES) {
|
|
24142
|
-
filteredEvents = filteredEvents.filter(event => event.extendedProps.chartAccounts?.isIncome());
|
|
24190
|
+
if (value.eventType !== CalendarEventTypeEnum.ALL) {
|
|
24191
|
+
filteredEvents = filteredEvents.filterBy('extendedProps.type', value.eventType);
|
|
24143
24192
|
}
|
|
24144
24193
|
if (value.tankType) {
|
|
24145
|
-
filteredEvents = filteredEvents.filterBy('extendedProps.
|
|
24194
|
+
filteredEvents = filteredEvents.filterBy('extendedProps.tankType', value.tankType);
|
|
24146
24195
|
}
|
|
24147
24196
|
if (value.business) {
|
|
24148
24197
|
filteredEvents = filteredEvents.filterBy('extendedProps.businessId', this.get('business').value.id);
|
|
@@ -27182,6 +27231,7 @@ class HoldingExpenseForm extends TransactionForm {
|
|
|
27182
27231
|
class TransactionBaseFilter {
|
|
27183
27232
|
}
|
|
27184
27233
|
|
|
27234
|
+
// @todo: vik refactor filterBudgetRules + filterCalendarReminders placement
|
|
27185
27235
|
class TransactionBaseFilterForm extends FormGroup {
|
|
27186
27236
|
constructor(model = plainToClass(TransactionBaseFilter, {})) {
|
|
27187
27237
|
super({
|
|
@@ -27256,6 +27306,23 @@ class TransactionBaseFilterForm extends FormGroup {
|
|
|
27256
27306
|
}
|
|
27257
27307
|
return rules;
|
|
27258
27308
|
}
|
|
27309
|
+
filterCalendarReminders(reminders) {
|
|
27310
|
+
const value = this.value;
|
|
27311
|
+
const [dateFrom, dateTo] = value.dateRange || [];
|
|
27312
|
+
if (value.tankType) {
|
|
27313
|
+
reminders = reminders.filterBy('tankType', value.tankType);
|
|
27314
|
+
}
|
|
27315
|
+
if (dateFrom || dateTo) {
|
|
27316
|
+
reminders = reminders.getByDate(dateFrom, dateTo);
|
|
27317
|
+
}
|
|
27318
|
+
if (value.properties?.length) {
|
|
27319
|
+
reminders = reminders.filterByProperties(value.properties);
|
|
27320
|
+
}
|
|
27321
|
+
if (value.business) {
|
|
27322
|
+
reminders = reminders.filterBy('business.id', value.business.id);
|
|
27323
|
+
}
|
|
27324
|
+
return reminders;
|
|
27325
|
+
}
|
|
27259
27326
|
}
|
|
27260
27327
|
|
|
27261
27328
|
class DepreciationForm extends TransactionBaseForm {
|