taxtank-core 2.0.65 → 2.0.67
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 +72 -22
- package/fesm2022/taxtank-core.mjs.map +1 -1
- package/index.d.ts +5 -3
- package/package.json +1 -1
|
@@ -9754,7 +9754,7 @@ class ClientPortfolioReportCollection extends Collection {
|
|
|
9754
9754
|
|
|
9755
9755
|
class FinancialGoalCollection extends Collection {
|
|
9756
9756
|
getActive() {
|
|
9757
|
-
return this.filterBy('status', FinancialGoalStatusEnum.ACTIVE);
|
|
9757
|
+
return this.filterBy('status', [FinancialGoalStatusEnum.ACTIVE, FinancialGoalStatusEnum.PAUSE]);
|
|
9758
9758
|
}
|
|
9759
9759
|
}
|
|
9760
9760
|
|
|
@@ -11504,12 +11504,15 @@ class FinancialGoal extends AbstractModel {
|
|
|
11504
11504
|
constructor() {
|
|
11505
11505
|
super(...arguments);
|
|
11506
11506
|
this.startDate = moment().startOf('day').toDate();
|
|
11507
|
-
this.
|
|
11508
|
-
this.
|
|
11507
|
+
this.inCalendar = false;
|
|
11508
|
+
this.properties = [];
|
|
11509
11509
|
}
|
|
11510
11510
|
isCompleted() {
|
|
11511
11511
|
return this.status === FinancialGoalStatusEnum.COMPLETE;
|
|
11512
11512
|
}
|
|
11513
|
+
isPropertyType() {
|
|
11514
|
+
return [FinancialGoalTypeEnum.PROPERTY_EQUITY, FinancialGoalTypeEnum.PROPERTY_LVR].includes(this.type);
|
|
11515
|
+
}
|
|
11513
11516
|
/**
|
|
11514
11517
|
* today's forecasted progress
|
|
11515
11518
|
*/
|
|
@@ -11523,6 +11526,9 @@ class FinancialGoal extends AbstractModel {
|
|
|
11523
11526
|
* How much user saved so far.
|
|
11524
11527
|
*/
|
|
11525
11528
|
get progress() {
|
|
11529
|
+
if (this.isPropertyType()) {
|
|
11530
|
+
return 0;
|
|
11531
|
+
}
|
|
11526
11532
|
return this.isCompleted()
|
|
11527
11533
|
? Math.abs(this.finalValue - this.initialValue)
|
|
11528
11534
|
: Math.abs(this.bankAccount.currentBalance - this.initialValue);
|
|
@@ -20652,11 +20658,12 @@ class PdfFromDomElementService {
|
|
|
20652
20658
|
merge(options, fileSettings);
|
|
20653
20659
|
}
|
|
20654
20660
|
// HTML container in which the exported DOM elements will be placed
|
|
20655
|
-
// const htmlWrapper: HTMLElement = document.createElement('div');
|
|
20656
20661
|
const iframe = document.getElementById('iframe-pdf-export');
|
|
20657
20662
|
const idoc = iframe.contentDocument;
|
|
20658
20663
|
const htmlWrapper = idoc.getElementById('pdf-export');
|
|
20659
20664
|
htmlWrapper.innerHTML = '';
|
|
20665
|
+
const scopeTokens = this.collectScopeTokens(elements);
|
|
20666
|
+
this.syncComponentStyles(idoc, scopeTokens);
|
|
20660
20667
|
elements.forEach((element) => {
|
|
20661
20668
|
htmlWrapper.append(element.cloneNode(true));
|
|
20662
20669
|
});
|
|
@@ -20672,6 +20679,42 @@ class PdfFromDomElementService {
|
|
|
20672
20679
|
.outputPdf('blob')
|
|
20673
20680
|
.then((blob) => new File([blob], filename, { type: 'application/pdf' })));
|
|
20674
20681
|
}
|
|
20682
|
+
collectScopeTokens(elements) {
|
|
20683
|
+
const scopes = new Set();
|
|
20684
|
+
const grabFromElement = (el) => {
|
|
20685
|
+
Array.from(el.attributes).forEach(attr => {
|
|
20686
|
+
const name = attr.name;
|
|
20687
|
+
if (name.startsWith('_ngcontent-') || name.startsWith('_nghost-')) {
|
|
20688
|
+
scopes.add(name);
|
|
20689
|
+
}
|
|
20690
|
+
});
|
|
20691
|
+
};
|
|
20692
|
+
elements.forEach(el => {
|
|
20693
|
+
grabFromElement(el);
|
|
20694
|
+
el.querySelectorAll('*').forEach(child => grabFromElement(child));
|
|
20695
|
+
});
|
|
20696
|
+
return Array.from(scopes);
|
|
20697
|
+
}
|
|
20698
|
+
syncComponentStyles(idoc, scopeTokens) {
|
|
20699
|
+
idoc.head
|
|
20700
|
+
.querySelectorAll('style[data-pdf-component-style="1"]')
|
|
20701
|
+
.forEach(el => el.remove());
|
|
20702
|
+
if (!scopeTokens.length) {
|
|
20703
|
+
return;
|
|
20704
|
+
}
|
|
20705
|
+
const parentDoc = document;
|
|
20706
|
+
const styleTags = parentDoc.head.querySelectorAll('style');
|
|
20707
|
+
styleTags.forEach(styleEl => {
|
|
20708
|
+
const cssText = styleEl.textContent || '';
|
|
20709
|
+
const matchesScope = scopeTokens.some(token => cssText.includes(token));
|
|
20710
|
+
if (!matchesScope) {
|
|
20711
|
+
return;
|
|
20712
|
+
}
|
|
20713
|
+
const clone = styleEl.cloneNode(true);
|
|
20714
|
+
clone.setAttribute('data-pdf-component-style', '1');
|
|
20715
|
+
idoc.head.appendChild(clone);
|
|
20716
|
+
});
|
|
20717
|
+
}
|
|
20675
20718
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.10", ngImport: i0, type: PdfFromDomElementService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
20676
20719
|
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.3.10", ngImport: i0, type: PdfFromDomElementService, providedIn: 'root' }); }
|
|
20677
20720
|
}
|
|
@@ -23228,7 +23271,7 @@ function greaterThanControlValidator(controlName) {
|
|
|
23228
23271
|
const group = control.parent;
|
|
23229
23272
|
const fieldToCompare = group.get(controlName);
|
|
23230
23273
|
const isLessThan = Number(fieldToCompare.value) > Number(control.value);
|
|
23231
|
-
return isLessThan ? {
|
|
23274
|
+
return isLessThan ? { greaterThanControl: { min: fieldToCompare.value, actual: control.value } } : null;
|
|
23232
23275
|
};
|
|
23233
23276
|
}
|
|
23234
23277
|
|
|
@@ -23418,34 +23461,34 @@ const END_DATE_VALIDATION_ERROR = 'Target date must be more than start date';
|
|
|
23418
23461
|
class FinancialGoalForm extends AbstractForm {
|
|
23419
23462
|
constructor(goal = plainToClass(FinancialGoal, {})) {
|
|
23420
23463
|
super({
|
|
23421
|
-
type: new FormControl({
|
|
23422
|
-
value: goal.type ?? FinancialGoalTypeEnum.DEBIT,
|
|
23423
|
-
disabled: !!goal.id
|
|
23424
|
-
}, Validators.required),
|
|
23464
|
+
type: new FormControl({ value: goal.type ?? FinancialGoalTypeEnum.DEBIT, disabled: !!goal.id }, Validators.required),
|
|
23425
23465
|
name: new FormControl(goal.name, Validators.required),
|
|
23426
23466
|
bankAccount: new FormControl({ value: goal.bankAccount, disabled: !!goal.id }, [
|
|
23427
|
-
conditionalValidator(() =>
|
|
23467
|
+
conditionalValidator(() => !this.isPropertyType(), Validators.required),
|
|
23428
23468
|
]),
|
|
23429
23469
|
targetValue: new FormControl(goal.targetValue, [
|
|
23430
|
-
conditionalValidator(() => this.value.type === FinancialGoalTypeEnum.DEBIT, Validators.min(0)),
|
|
23431
|
-
conditionalValidator(() => this.value.type === FinancialGoalTypeEnum.CREDIT, Validators.max(0)),
|
|
23432
23470
|
greaterThanControlValidator('initialValue'),
|
|
23433
23471
|
Validators.required
|
|
23434
23472
|
]),
|
|
23435
|
-
initialValue: new FormControl({ value: goal.initialValue, disabled:
|
|
23473
|
+
initialValue: new FormControl({ value: goal.initialValue, disabled: false }, Validators.required),
|
|
23436
23474
|
startDate: new FormControl({ value: goal.startDate, disabled: true }),
|
|
23437
23475
|
endDate: new FormControl(goal.endDate, [Validators.required, minDateValidator(goal.startDate, END_DATE_VALIDATION_ERROR)]),
|
|
23438
|
-
paymentFrequency: new FormControl(goal.paymentFrequency,
|
|
23439
|
-
|
|
23476
|
+
paymentFrequency: new FormControl(goal.paymentFrequency, [
|
|
23477
|
+
conditionalValidator(() => !this.isPropertyType(), Validators.required),
|
|
23478
|
+
]),
|
|
23479
|
+
paymentAmount: new FormControl(goal.paymentAmount, [
|
|
23480
|
+
conditionalValidator(() => !this.isPropertyType(), Validators.required),
|
|
23481
|
+
]),
|
|
23440
23482
|
inCalendar: new FormControl(goal.inCalendar),
|
|
23441
23483
|
file: new FormControl(goal.file),
|
|
23442
23484
|
description: new FormControl(goal.description),
|
|
23485
|
+
properties: new FormControl(goal.properties, [
|
|
23486
|
+
conditionalValidator(() => this.isPropertyType(), Validators.required),
|
|
23487
|
+
]),
|
|
23443
23488
|
}, goal);
|
|
23444
23489
|
this.includeDisabledFields = true;
|
|
23445
23490
|
this.bankAccountTypes = [];
|
|
23446
|
-
this.isDebit = true;
|
|
23447
23491
|
this.bankAccountTypes = this.getBankAccountTypes(goal.type);
|
|
23448
|
-
this.isDebit = this.getIsDebit(goal.type);
|
|
23449
23492
|
this.listenEvents();
|
|
23450
23493
|
}
|
|
23451
23494
|
listenEvents() {
|
|
@@ -23453,11 +23496,19 @@ class FinancialGoalForm extends AbstractForm {
|
|
|
23453
23496
|
this.listenBankAccountChanges();
|
|
23454
23497
|
this.listenPaymentChanges();
|
|
23455
23498
|
}
|
|
23499
|
+
isPropertyType() {
|
|
23500
|
+
return [FinancialGoalTypeEnum.PROPERTY_EQUITY, FinancialGoalTypeEnum.PROPERTY_LVR].includes(this.value.type);
|
|
23501
|
+
}
|
|
23456
23502
|
listenTypeChanges() {
|
|
23457
23503
|
this.get('type').valueChanges.subscribe((type) => {
|
|
23458
23504
|
this.get('bankAccount').setValue(null, { onlySelf: true });
|
|
23505
|
+
this.get('properties').setValue([], { onlySelf: true });
|
|
23506
|
+
if (this.isPropertyType()) {
|
|
23507
|
+
this.get('inCalendar').setValue(false, { onlySelf: true });
|
|
23508
|
+
this.get('paymentFrequency').setValue(false, { onlySelf: true });
|
|
23509
|
+
this.get('paymentAmount').setValue(false, { onlySelf: true });
|
|
23510
|
+
}
|
|
23459
23511
|
this.bankAccountTypes = this.getBankAccountTypes(type);
|
|
23460
|
-
this.isDebit = this.getIsDebit(type);
|
|
23461
23512
|
});
|
|
23462
23513
|
}
|
|
23463
23514
|
/**
|
|
@@ -23526,13 +23577,12 @@ class FinancialGoalForm extends AbstractForm {
|
|
|
23526
23577
|
switch (type) {
|
|
23527
23578
|
case FinancialGoalTypeEnum.CREDIT:
|
|
23528
23579
|
return [BankAccountTypeEnum.MORTGAGE, BankAccountTypeEnum.LOAN, BankAccountTypeEnum.CREDIT_CARD];
|
|
23529
|
-
|
|
23580
|
+
case FinancialGoalTypeEnum.DEBIT:
|
|
23530
23581
|
return [BankAccountTypeEnum.TRANSACTION, BankAccountTypeEnum.SAVINGS, BankAccountTypeEnum.OFFSET];
|
|
23582
|
+
default:
|
|
23583
|
+
return [];
|
|
23531
23584
|
}
|
|
23532
23585
|
}
|
|
23533
|
-
getIsDebit(type) {
|
|
23534
|
-
return type !== FinancialGoalTypeEnum.CREDIT;
|
|
23535
|
-
}
|
|
23536
23586
|
}
|
|
23537
23587
|
|
|
23538
23588
|
class FirmForm extends AbstractForm {
|