taxtank-core 0.21.10 → 0.21.11
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/bundles/taxtank-core.umd.js +167 -120
- package/bundles/taxtank-core.umd.js.map +1 -1
- package/esm2015/lib/db/Models/bank/bank-account.js +1 -1
- package/esm2015/lib/db/Models/depreciation/depreciation.js +1 -1
- package/esm2015/lib/db/Models/sole/sole-business-allocation.js +4 -0
- package/esm2015/lib/db/Models/sole/sole-business-loss.js +4 -0
- package/esm2015/lib/db/Models/sole/sole-business.js +4 -0
- package/esm2015/lib/db/Models/sole/sole-contact.js +4 -0
- package/esm2015/lib/db/Models/sole/sole-forecast.js +1 -1
- package/esm2015/lib/db/Models/sole/sole-invoice-item.js +4 -0
- package/esm2015/lib/db/Models/sole/sole-invoice-template.js +4 -0
- package/esm2015/lib/db/Models/sole/sole-invoice.js +4 -0
- package/esm2015/lib/db/Models/transaction/transaction.js +1 -1
- package/esm2015/lib/db/Models/vehicle/vehicle-claim.js +1 -1
- package/esm2015/lib/db/Models/vehicle/vehicle.js +1 -1
- package/esm2015/lib/forms/abstract.form.js +6 -1
- package/esm2015/lib/forms/bank/bank-account/bank-account-add-manual.form.js +9 -42
- package/esm2015/lib/forms/bank/bank-account/bank-account-allocation.form.js +31 -0
- package/esm2015/lib/forms/bank/bank-account/bank-account-import.form.js +4 -30
- package/esm2015/lib/forms/bank/bank-account/bank-account-properties.form.js +28 -7
- package/esm2015/lib/forms/index.js +2 -1
- package/esm2015/lib/models/bank/bank-account.js +14 -4
- package/esm2015/lib/models/logbook/vehicle-claim.js +6 -3
- package/esm2015/lib/services/event/sse.service.js +2 -1
- package/esm2015/lib/validators/fields-sum.validator.js +26 -0
- package/fesm2015/taxtank-core.js +150 -115
- package/fesm2015/taxtank-core.js.map +1 -1
- package/lib/db/Models/bank/bank-account.d.ts +2 -2
- package/lib/db/Models/depreciation/depreciation.d.ts +2 -0
- package/lib/db/Models/sole/sole-business-allocation.d.ts +9 -0
- package/lib/db/Models/sole/sole-business-loss.d.ts +9 -0
- package/lib/db/Models/sole/sole-business.d.ts +26 -0
- package/lib/db/Models/sole/sole-contact.d.ts +17 -0
- package/lib/db/Models/sole/sole-invoice-item.d.ts +12 -0
- package/lib/db/Models/sole/sole-invoice-template.d.ts +10 -0
- package/lib/db/Models/sole/sole-invoice.d.ts +18 -0
- package/lib/db/Models/transaction/transaction.d.ts +2 -0
- package/lib/db/Models/vehicle/vehicle-claim.d.ts +2 -2
- package/lib/db/Models/vehicle/vehicle.d.ts +0 -2
- package/lib/forms/abstract.form.d.ts +4 -0
- package/lib/forms/bank/bank-account/bank-account-add-manual.form.d.ts +2 -6
- package/lib/forms/bank/bank-account/bank-account-allocation.form.d.ts +7 -0
- package/lib/forms/bank/bank-account/bank-account-import.form.d.ts +2 -8
- package/lib/forms/bank/bank-account/bank-account-properties.form.d.ts +1 -0
- package/lib/forms/index.d.ts +1 -0
- package/lib/models/bank/bank-account.d.ts +2 -0
- package/lib/models/logbook/vehicle-claim.d.ts +1 -0
- package/lib/services/event/sse.service.d.ts +1 -0
- package/lib/validators/fields-sum.validator.d.ts +8 -0
- package/package.json +1 -1
|
@@ -3376,20 +3376,34 @@
|
|
|
3376
3376
|
* check if bank account related to work tank
|
|
3377
3377
|
*/
|
|
3378
3378
|
BankAccount.prototype.isWorkTank = function () {
|
|
3379
|
-
return this.
|
|
3379
|
+
return !this.isPropertyTank() && !this.isSoleTank();
|
|
3380
3380
|
};
|
|
3381
3381
|
/**
|
|
3382
3382
|
* check if bank account related to work tank
|
|
3383
3383
|
*/
|
|
3384
3384
|
BankAccount.prototype.isPropertyTank = function () {
|
|
3385
|
-
return this.
|
|
3385
|
+
return !!this.bankAccountProperties.length;
|
|
3386
3386
|
};
|
|
3387
3387
|
/**
|
|
3388
3388
|
* check if bank account related to sole tank
|
|
3389
3389
|
*/
|
|
3390
3390
|
BankAccount.prototype.isSoleTank = function () {
|
|
3391
|
-
return this.
|
|
3391
|
+
return !!this.businessAllocations.length;
|
|
3392
3392
|
};
|
|
3393
|
+
Object.defineProperty(BankAccount.prototype, "tankType", {
|
|
3394
|
+
get: function () {
|
|
3395
|
+
switch (true) {
|
|
3396
|
+
case this.isPropertyTank():
|
|
3397
|
+
return exports.TankTypeEnum.PROPERTY;
|
|
3398
|
+
case this.isSoleTank():
|
|
3399
|
+
return exports.TankTypeEnum.SOLE;
|
|
3400
|
+
default:
|
|
3401
|
+
return exports.TankTypeEnum.WORK;
|
|
3402
|
+
}
|
|
3403
|
+
},
|
|
3404
|
+
enumerable: false,
|
|
3405
|
+
configurable: true
|
|
3406
|
+
});
|
|
3393
3407
|
/**
|
|
3394
3408
|
* Get Bank account property by id
|
|
3395
3409
|
* @param id Id of property
|
|
@@ -8749,11 +8763,18 @@
|
|
|
8749
8763
|
return this.method === exports.VehicleClaimMethodEnum.KMS;
|
|
8750
8764
|
};
|
|
8751
8765
|
VehicleClaim.prototype.isWorkTank = function () {
|
|
8752
|
-
return this.
|
|
8766
|
+
return !this.business;
|
|
8753
8767
|
};
|
|
8754
8768
|
VehicleClaim.prototype.isSoleTank = function () {
|
|
8755
|
-
return this.
|
|
8769
|
+
return !!this.business;
|
|
8756
8770
|
};
|
|
8771
|
+
Object.defineProperty(VehicleClaim.prototype, "tankType", {
|
|
8772
|
+
get: function () {
|
|
8773
|
+
return this.isSoleTank() ? exports.TankTypeEnum.SOLE : exports.TankTypeEnum.WORK;
|
|
8774
|
+
},
|
|
8775
|
+
enumerable: false,
|
|
8776
|
+
configurable: true
|
|
8777
|
+
});
|
|
8757
8778
|
/**
|
|
8758
8779
|
* Claim amount for KLMs method. Exists only for KLMs method.
|
|
8759
8780
|
*/
|
|
@@ -11814,6 +11835,7 @@
|
|
|
11814
11835
|
|
|
11815
11836
|
/**
|
|
11816
11837
|
* server sent events service
|
|
11838
|
+
* https://symfony.com/doc/current/mercure.html
|
|
11817
11839
|
*/
|
|
11818
11840
|
var SseService = /** @class */ (function () {
|
|
11819
11841
|
function SseService(zone, jwtService, environment) {
|
|
@@ -15006,6 +15028,7 @@
|
|
|
15006
15028
|
|
|
15007
15029
|
/**
|
|
15008
15030
|
* Abstract form class
|
|
15031
|
+
* @TODO rename to AbstractFormGroup
|
|
15009
15032
|
*/
|
|
15010
15033
|
var AbstractForm = /** @class */ (function (_super) {
|
|
15011
15034
|
__extends(AbstractForm, _super);
|
|
@@ -15032,6 +15055,10 @@
|
|
|
15032
15055
|
this.onSubmit.emit(model);
|
|
15033
15056
|
return model;
|
|
15034
15057
|
};
|
|
15058
|
+
AbstractForm.prototype.addControl = function (name, control, options) {
|
|
15059
|
+
_super.prototype.addControl.call(this, name, control, options);
|
|
15060
|
+
return this;
|
|
15061
|
+
};
|
|
15035
15062
|
AbstractForm.prototype.createModelInstance = function (data) {
|
|
15036
15063
|
if (data === void 0) { data = {}; }
|
|
15037
15064
|
return classTransformer.plainToClass(this.modelClass, data);
|
|
@@ -15039,30 +15066,61 @@
|
|
|
15039
15066
|
return AbstractForm;
|
|
15040
15067
|
}(forms.FormGroup));
|
|
15041
15068
|
|
|
15069
|
+
function conditionalValidator(condition, validator) {
|
|
15070
|
+
return function (control) {
|
|
15071
|
+
revalidateOnChanges(control);
|
|
15072
|
+
if (control && control.parent) {
|
|
15073
|
+
if (condition(control.parent)) {
|
|
15074
|
+
return validator(control);
|
|
15075
|
+
}
|
|
15076
|
+
}
|
|
15077
|
+
return null;
|
|
15078
|
+
};
|
|
15079
|
+
}
|
|
15042
15080
|
/**
|
|
15043
|
-
*
|
|
15081
|
+
* Conditional validator depends on other fields and should be updated on each form value change
|
|
15044
15082
|
*/
|
|
15045
|
-
|
|
15046
|
-
|
|
15047
|
-
|
|
15048
|
-
|
|
15049
|
-
|
|
15050
|
-
|
|
15051
|
-
|
|
15052
|
-
repaymentType: new forms.FormControl(loan.repaymentType, forms.Validators.required),
|
|
15053
|
-
interestRate: new forms.FormControl(loan.interestRate, [forms.Validators.required, forms.Validators.min(0), forms.Validators.max(100)]),
|
|
15054
|
-
interestType: new forms.FormControl(loan.interestType, forms.Validators.required),
|
|
15055
|
-
availableRedraw: new forms.FormControl(loan.availableRedraw, forms.Validators.required),
|
|
15056
|
-
commencementDate: new forms.FormControl(loan.commencementDate, forms.Validators.required),
|
|
15057
|
-
repaymentAmount: new forms.FormControl(loan.repaymentAmount, forms.Validators.required),
|
|
15058
|
-
repaymentFrequency: new forms.FormControl(loan.repaymentFrequency, forms.Validators.required)
|
|
15059
|
-
}, loan) || this;
|
|
15083
|
+
function revalidateOnChanges(control) {
|
|
15084
|
+
if (control && control.parent && !control['_revalidateOnChanges']) {
|
|
15085
|
+
control['_revalidateOnChanges'] = true;
|
|
15086
|
+
control.parent.valueChanges.pipe(operators.distinctUntilChanged(function (a, b) { return JSON.stringify(a) === JSON.stringify(b); }))
|
|
15087
|
+
.subscribe(function () {
|
|
15088
|
+
control.updateValueAndValidity({ emitEvent: false });
|
|
15089
|
+
});
|
|
15060
15090
|
}
|
|
15061
|
-
return
|
|
15062
|
-
}
|
|
15091
|
+
return;
|
|
15092
|
+
}
|
|
15093
|
+
|
|
15094
|
+
/**
|
|
15095
|
+
* Validator that check if sum amount of provided fields is greater than provided sum
|
|
15096
|
+
* @param field to check in each formArray element
|
|
15097
|
+
* @param summary to compare with fields sum
|
|
15098
|
+
* @param fieldAlias to show it in error message
|
|
15099
|
+
*/
|
|
15100
|
+
function fieldsSumValidator(field, summary, fieldAlias) {
|
|
15101
|
+
if (summary === void 0) { summary = 100; }
|
|
15102
|
+
return function (formArray) {
|
|
15103
|
+
// calculate sum of desired fields in formArray control
|
|
15104
|
+
var fieldsSum = formArray['controls']
|
|
15105
|
+
.reduce(function (acc, group) { return acc += group.get(field).value; }, 0);
|
|
15106
|
+
if (fieldsSum <= summary) {
|
|
15107
|
+
return null;
|
|
15108
|
+
}
|
|
15109
|
+
else {
|
|
15110
|
+
return {
|
|
15111
|
+
fieldsSum: {
|
|
15112
|
+
name: field,
|
|
15113
|
+
alias: fieldAlias,
|
|
15114
|
+
summary: summary
|
|
15115
|
+
}
|
|
15116
|
+
};
|
|
15117
|
+
}
|
|
15118
|
+
};
|
|
15119
|
+
}
|
|
15063
15120
|
|
|
15064
15121
|
/**
|
|
15065
15122
|
* Form array with bank account properties
|
|
15123
|
+
* @TODO create AbstractFormArray
|
|
15066
15124
|
*/
|
|
15067
15125
|
var BankAccountPropertiesForm = /** @class */ (function (_super) {
|
|
15068
15126
|
__extends(BankAccountPropertiesForm, _super);
|
|
@@ -15070,20 +15128,37 @@
|
|
|
15070
15128
|
if (bankAccountProperties === void 0) { bankAccountProperties = [classTransformer.plainToClass(BankAccountProperty, {})]; }
|
|
15071
15129
|
return _super.call(this, bankAccountProperties.map(function (bankAccountProperty) {
|
|
15072
15130
|
return new forms.FormGroup({
|
|
15073
|
-
property: new forms.FormControl(bankAccountProperty.property, forms.Validators.required),
|
|
15131
|
+
property: new forms.FormControl(bankAccountProperty === null || bankAccountProperty === void 0 ? void 0 : bankAccountProperty.property, forms.Validators.required),
|
|
15074
15132
|
percent: new forms.FormControl(bankAccountProperty.percent, forms.Validators.required)
|
|
15075
15133
|
});
|
|
15076
|
-
})
|
|
15134
|
+
}), [
|
|
15135
|
+
conditionalValidator(function (control) { return control.get('tankType').value === exports.TankTypeEnum.PROPERTY; }, forms.Validators.required),
|
|
15136
|
+
fieldsSumValidator('percent', 100)
|
|
15137
|
+
]) || this;
|
|
15077
15138
|
}
|
|
15078
15139
|
BankAccountPropertiesForm.prototype.add = function () {
|
|
15079
15140
|
this.push(new forms.FormGroup({
|
|
15080
15141
|
property: new forms.FormControl(null, forms.Validators.required),
|
|
15081
|
-
|
|
15082
|
-
|
|
15083
|
-
|
|
15084
|
-
|
|
15085
|
-
|
|
15086
|
-
|
|
15142
|
+
// @TODO disable for loans
|
|
15143
|
+
percent: new forms.FormControl({ value: 100, disabled: !this.at(0).contains('percent') }, forms.Validators.required),
|
|
15144
|
+
// @TODO enable for loans
|
|
15145
|
+
// amount: new FormControl(
|
|
15146
|
+
// {value: this.bankAccount.currentBalance * bankAccountProperty.percent / 100},
|
|
15147
|
+
// [Validators.required, Validators.max(Math.abs(this.bankAccount.currentBalance))]
|
|
15148
|
+
// ),
|
|
15149
|
+
}));
|
|
15150
|
+
};
|
|
15151
|
+
// @TODO enable for loans
|
|
15152
|
+
// /**
|
|
15153
|
+
// * Recalculate property percentage for current property form group and round to no more than 3 decimal places
|
|
15154
|
+
// * @param amount: new control value
|
|
15155
|
+
// * @param currentPropertyGroup for which amount will be recalculated
|
|
15156
|
+
// */
|
|
15157
|
+
// recalculatePropertyPercentage(amount: number, currentPropertyGroup: FormGroup): void {
|
|
15158
|
+
// currentPropertyGroup.get('percent').setValue(
|
|
15159
|
+
// roundTo(amount / this.bankAccount.currentBalance, 3)
|
|
15160
|
+
// );
|
|
15161
|
+
// }
|
|
15087
15162
|
BankAccountPropertiesForm.prototype.enablePercent = function () {
|
|
15088
15163
|
this.controls.forEach(function (propertyFormGroup) {
|
|
15089
15164
|
propertyFormGroup.get('percent').enable();
|
|
@@ -15097,6 +15172,57 @@
|
|
|
15097
15172
|
return BankAccountPropertiesForm;
|
|
15098
15173
|
}(forms.FormArray));
|
|
15099
15174
|
|
|
15175
|
+
var BankAccountAllocationForm = /** @class */ (function (_super) {
|
|
15176
|
+
__extends(BankAccountAllocationForm, _super);
|
|
15177
|
+
function BankAccountAllocationForm(bankAccount) {
|
|
15178
|
+
var _this = _super.call(this, {
|
|
15179
|
+
tankType: new forms.FormControl(bankAccount ? bankAccount.tankType : null, forms.Validators.required),
|
|
15180
|
+
}, classTransformer.plainToClass(BankAccount, bankAccount || {})) || this;
|
|
15181
|
+
_this.bankAccount = bankAccount;
|
|
15182
|
+
if (bankAccount === null || bankAccount === void 0 ? void 0 : bankAccount.isPropertyTank()) {
|
|
15183
|
+
_this.addControl('bankAccountProperties', new BankAccountPropertiesForm(bankAccount.bankAccountProperties));
|
|
15184
|
+
}
|
|
15185
|
+
_this.watchTankType();
|
|
15186
|
+
return _this;
|
|
15187
|
+
}
|
|
15188
|
+
BankAccountAllocationForm.prototype.watchTankType = function () {
|
|
15189
|
+
var _this = this;
|
|
15190
|
+
this.get('tankType').valueChanges.subscribe(function (tankType) {
|
|
15191
|
+
var _a;
|
|
15192
|
+
// @TODO vik add businessAllocation
|
|
15193
|
+
if (tankType === exports.TankTypeEnum.PROPERTY) {
|
|
15194
|
+
_this.addControl('bankAccountProperties', new BankAccountPropertiesForm((_a = _this.bankAccount) === null || _a === void 0 ? void 0 : _a.bankAccountProperties));
|
|
15195
|
+
}
|
|
15196
|
+
else {
|
|
15197
|
+
_this.removeControl('bankAccountProperties');
|
|
15198
|
+
}
|
|
15199
|
+
});
|
|
15200
|
+
};
|
|
15201
|
+
return BankAccountAllocationForm;
|
|
15202
|
+
}(AbstractForm));
|
|
15203
|
+
|
|
15204
|
+
/**
|
|
15205
|
+
* Form with bank account loan details
|
|
15206
|
+
*/
|
|
15207
|
+
var BankAccountLoanForm = /** @class */ (function (_super) {
|
|
15208
|
+
__extends(BankAccountLoanForm, _super);
|
|
15209
|
+
function BankAccountLoanForm(loan) {
|
|
15210
|
+
if (loan === void 0) { loan = classTransformer.plainToClass(Loan, {}); }
|
|
15211
|
+
return _super.call(this, {
|
|
15212
|
+
type: new forms.FormControl(loan.type, forms.Validators.required),
|
|
15213
|
+
amount: new forms.FormControl(loan.amount, forms.Validators.required),
|
|
15214
|
+
repaymentType: new forms.FormControl(loan.repaymentType, forms.Validators.required),
|
|
15215
|
+
interestRate: new forms.FormControl(loan.interestRate, [forms.Validators.required, forms.Validators.min(0), forms.Validators.max(100)]),
|
|
15216
|
+
interestType: new forms.FormControl(loan.interestType, forms.Validators.required),
|
|
15217
|
+
availableRedraw: new forms.FormControl(loan.availableRedraw, forms.Validators.required),
|
|
15218
|
+
commencementDate: new forms.FormControl(loan.commencementDate, forms.Validators.required),
|
|
15219
|
+
repaymentAmount: new forms.FormControl(loan.repaymentAmount, forms.Validators.required),
|
|
15220
|
+
repaymentFrequency: new forms.FormControl(loan.repaymentFrequency, forms.Validators.required)
|
|
15221
|
+
}, loan) || this;
|
|
15222
|
+
}
|
|
15223
|
+
return BankAccountLoanForm;
|
|
15224
|
+
}(AbstractForm));
|
|
15225
|
+
|
|
15100
15226
|
/**
|
|
15101
15227
|
* Form is using for import basiq bank accounts.
|
|
15102
15228
|
* Basiq accounts has all data except tank type, properties and loan partially
|
|
@@ -15104,40 +15230,16 @@
|
|
|
15104
15230
|
var BankAccountImportForm = /** @class */ (function (_super) {
|
|
15105
15231
|
__extends(BankAccountImportForm, _super);
|
|
15106
15232
|
function BankAccountImportForm(bankAccount) {
|
|
15107
|
-
var _this = _super.call(this,
|
|
15108
|
-
tankType: new forms.FormControl(bankAccount.tankType, forms.Validators.required),
|
|
15109
|
-
}, bankAccount) || this;
|
|
15233
|
+
var _this = _super.call(this, bankAccount) || this;
|
|
15110
15234
|
if (bankAccount.isLoan()) {
|
|
15111
15235
|
_this.addControl('loan', new BankAccountLoanForm(bankAccount.loan));
|
|
15112
15236
|
}
|
|
15113
15237
|
// basiq account import form should be disabled (unchecked) by default
|
|
15114
15238
|
_this.disable();
|
|
15115
|
-
_this.listenEvents();
|
|
15116
15239
|
return _this;
|
|
15117
15240
|
}
|
|
15118
|
-
BankAccountImportForm.prototype.listenEvents = function () {
|
|
15119
|
-
this.listenTankTypeChanges();
|
|
15120
|
-
};
|
|
15121
|
-
/**
|
|
15122
|
-
* Add/Remove bank account properties form depends on selected tank type
|
|
15123
|
-
*/
|
|
15124
|
-
BankAccountImportForm.prototype.listenTankTypeChanges = function () {
|
|
15125
|
-
var _this = this;
|
|
15126
|
-
this.get('tankType').valueChanges.subscribe(function (tankType) {
|
|
15127
|
-
if (tankType === exports.TankTypeEnum.PROPERTY) {
|
|
15128
|
-
_this.addControl('bankAccountProperties', new BankAccountPropertiesForm());
|
|
15129
|
-
// property percent allowed only for loan bank accounts
|
|
15130
|
-
if (!_this.contains('loan')) {
|
|
15131
|
-
_this.get('bankAccountProperties').disablePercent();
|
|
15132
|
-
}
|
|
15133
|
-
}
|
|
15134
|
-
else {
|
|
15135
|
-
_this.removeControl('bankAccountProperties');
|
|
15136
|
-
}
|
|
15137
|
-
});
|
|
15138
|
-
};
|
|
15139
15241
|
return BankAccountImportForm;
|
|
15140
|
-
}(
|
|
15242
|
+
}(BankAccountAllocationForm));
|
|
15141
15243
|
|
|
15142
15244
|
/**
|
|
15143
15245
|
* Form is using for single manual bank account creation (not Basiq)
|
|
@@ -15145,20 +15247,18 @@
|
|
|
15145
15247
|
var BankAccountAddManualForm = /** @class */ (function (_super) {
|
|
15146
15248
|
__extends(BankAccountAddManualForm, _super);
|
|
15147
15249
|
function BankAccountAddManualForm(connection) {
|
|
15148
|
-
var _this = _super.call(this
|
|
15149
|
-
type: new forms.FormControl(null, forms.Validators.required),
|
|
15150
|
-
accountName: new forms.FormControl(null, forms.Validators.required),
|
|
15151
|
-
currentBalance: new forms.FormControl(null, forms.Validators.required),
|
|
15152
|
-
accountNumber: new forms.FormControl(null, [forms.Validators.required, forms.Validators.pattern(BankAccountAddManualForm.accountNumberPattern)]),
|
|
15153
|
-
tankType: new forms.FormControl(null, forms.Validators.required),
|
|
15154
|
-
}, classTransformer.plainToClass(BankAccount, {})) || this;
|
|
15250
|
+
var _this = _super.call(this) || this;
|
|
15155
15251
|
_this.connection = connection;
|
|
15252
|
+
_this
|
|
15253
|
+
.addControl('type', new forms.FormControl(null, forms.Validators.required))
|
|
15254
|
+
.addControl('accountName', new forms.FormControl(null, forms.Validators.required))
|
|
15255
|
+
.addControl('currentBalance', new forms.FormControl(null, forms.Validators.required))
|
|
15256
|
+
.addControl('accountNumber', new forms.FormControl(null, [forms.Validators.required, forms.Validators.pattern(BankAccountAddManualForm.accountNumberPattern)]));
|
|
15156
15257
|
_this.listenEvents();
|
|
15157
15258
|
return _this;
|
|
15158
15259
|
}
|
|
15159
15260
|
BankAccountAddManualForm.prototype.listenEvents = function () {
|
|
15160
15261
|
this.listenTypeChanges();
|
|
15161
|
-
this.listenTankTypeChanges();
|
|
15162
15262
|
};
|
|
15163
15263
|
/**
|
|
15164
15264
|
* Add/Remove loan form depends on selected bank account type
|
|
@@ -15168,38 +15268,9 @@
|
|
|
15168
15268
|
this.get('type').valueChanges.subscribe(function (type) {
|
|
15169
15269
|
if (BankAccount.loanTypes.includes(type)) {
|
|
15170
15270
|
_this.addControl('loan', new BankAccountLoanForm());
|
|
15171
|
-
// property percent allowed only for loan bank accounts
|
|
15172
|
-
if (_this.contains('bankAccountProperties')) {
|
|
15173
|
-
_this.get('bankAccountProperties').enablePercent();
|
|
15174
|
-
}
|
|
15175
15271
|
}
|
|
15176
15272
|
else {
|
|
15177
15273
|
_this.removeControl('loan');
|
|
15178
|
-
// property percent allowed only for loan bank accounts
|
|
15179
|
-
if (_this.contains('bankAccountProperties')) {
|
|
15180
|
-
_this.get('bankAccountProperties').disablePercent();
|
|
15181
|
-
}
|
|
15182
|
-
}
|
|
15183
|
-
});
|
|
15184
|
-
};
|
|
15185
|
-
/**
|
|
15186
|
-
* Add/Remove bank account properties form depends on selected tank type
|
|
15187
|
-
*/
|
|
15188
|
-
BankAccountAddManualForm.prototype.listenTankTypeChanges = function () {
|
|
15189
|
-
var _this = this;
|
|
15190
|
-
this.get('tankType').valueChanges.subscribe(function (tankType) {
|
|
15191
|
-
if (tankType === exports.TankTypeEnum.PROPERTY) {
|
|
15192
|
-
_this.addControl('bankAccountProperties', new BankAccountPropertiesForm());
|
|
15193
|
-
// property percent allowed only for loan bank accounts
|
|
15194
|
-
if (_this.contains('loan')) {
|
|
15195
|
-
_this.get('bankAccountProperties').enablePercent();
|
|
15196
|
-
}
|
|
15197
|
-
else {
|
|
15198
|
-
_this.get('bankAccountProperties').disablePercent();
|
|
15199
|
-
}
|
|
15200
|
-
}
|
|
15201
|
-
else {
|
|
15202
|
-
_this.removeControl('bankAccountProperties');
|
|
15203
15274
|
}
|
|
15204
15275
|
});
|
|
15205
15276
|
};
|
|
@@ -15210,7 +15281,7 @@
|
|
|
15210
15281
|
return _super.prototype.submit.call(this, { bankConnection: this.connection });
|
|
15211
15282
|
};
|
|
15212
15283
|
return BankAccountAddManualForm;
|
|
15213
|
-
}(
|
|
15284
|
+
}(BankAccountAllocationForm));
|
|
15214
15285
|
BankAccountAddManualForm.accountNumberPattern = '^[0-9]{6}[ ]{1}[0-9]{1,}$';
|
|
15215
15286
|
|
|
15216
15287
|
/**
|
|
@@ -15343,31 +15414,6 @@
|
|
|
15343
15414
|
};
|
|
15344
15415
|
}
|
|
15345
15416
|
|
|
15346
|
-
function conditionalValidator(condition, validator) {
|
|
15347
|
-
return function (control) {
|
|
15348
|
-
revalidateOnChanges(control);
|
|
15349
|
-
if (control && control.parent) {
|
|
15350
|
-
if (condition(control.parent)) {
|
|
15351
|
-
return validator(control);
|
|
15352
|
-
}
|
|
15353
|
-
}
|
|
15354
|
-
return null;
|
|
15355
|
-
};
|
|
15356
|
-
}
|
|
15357
|
-
/**
|
|
15358
|
-
* Conditional validator depends on other fields and should be updated on each form value change
|
|
15359
|
-
*/
|
|
15360
|
-
function revalidateOnChanges(control) {
|
|
15361
|
-
if (control && control.parent && !control['_revalidateOnChanges']) {
|
|
15362
|
-
control['_revalidateOnChanges'] = true;
|
|
15363
|
-
control.parent.valueChanges.pipe(operators.distinctUntilChanged(function (a, b) { return JSON.stringify(a) === JSON.stringify(b); }))
|
|
15364
|
-
.subscribe(function () {
|
|
15365
|
-
control.updateValueAndValidity({ emitEvent: false });
|
|
15366
|
-
});
|
|
15367
|
-
}
|
|
15368
|
-
return;
|
|
15369
|
-
}
|
|
15370
|
-
|
|
15371
15417
|
/**
|
|
15372
15418
|
* Regular expressions that are used to check password strength and valid values
|
|
15373
15419
|
*/
|
|
@@ -16039,6 +16085,7 @@
|
|
|
16039
16085
|
exports.Bank = Bank;
|
|
16040
16086
|
exports.BankAccount = BankAccount;
|
|
16041
16087
|
exports.BankAccountAddManualForm = BankAccountAddManualForm;
|
|
16088
|
+
exports.BankAccountAllocationForm = BankAccountAllocationForm;
|
|
16042
16089
|
exports.BankAccountCalculationService = BankAccountCalculationService;
|
|
16043
16090
|
exports.BankAccountChartData = BankAccountChartData;
|
|
16044
16091
|
exports.BankAccountCollection = BankAccountCollection;
|