@dynamatix/gb-schemas 2.3.279 → 2.3.281
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.
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"applicant-welcome-call.model.d.ts","sourceRoot":"","sources":["../../applicants/applicant-welcome-call.model.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,OAAO,QAAQ,MAAM,UAAU,CAAC;
|
|
1
|
+
{"version":3,"file":"applicant-welcome-call.model.d.ts","sourceRoot":"","sources":["../../applicants/applicant-welcome-call.model.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,OAAO,QAAQ,MAAM,UAAU,CAAC;AAsrBhC,QAAA,MAAM,gBAAgB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAA4D,CAAC;AAEnF,eAAe,gBAAgB,CAAC"}
|
|
@@ -556,10 +556,18 @@ welcomeCallSchema.virtual('initialRatePercentage').get(function () {
|
|
|
556
556
|
// Virtual property for finance summary HTML
|
|
557
557
|
welcomeCallSchema.virtual('financeSummaryHtml').get(function () {
|
|
558
558
|
console.log('financeSummaryHtml virtual field called');
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
559
|
+
let application = null;
|
|
560
|
+
if (this.applicantId && typeof this.applicantId === 'object' && !(typeof this.applicantId.toHexString === 'function') && this.applicantId.applicationId) {
|
|
561
|
+
application = this.applicantId.applicationId;
|
|
562
|
+
}
|
|
563
|
+
else if (this.applicationId && typeof this.applicationId === 'object') {
|
|
564
|
+
application = this.applicationId;
|
|
565
|
+
}
|
|
566
|
+
else {
|
|
567
|
+
console.log('No application found');
|
|
568
|
+
return 'N/A';
|
|
569
|
+
}
|
|
570
|
+
if (application) {
|
|
563
571
|
console.log('Application data:', JSON.stringify(application, null, 2));
|
|
564
572
|
// Initialize summary data
|
|
565
573
|
let product = 'N/A';
|
|
@@ -569,34 +577,31 @@ welcomeCallSchema.virtual('financeSummaryHtml').get(function () {
|
|
|
569
577
|
let occupancy = 'N/A';
|
|
570
578
|
// Get product information (first 3 characters)
|
|
571
579
|
if (application.selectedProduct && typeof application.selectedProduct === 'string') {
|
|
572
|
-
product = application.selectedProduct
|
|
580
|
+
product = application.selectedProduct;
|
|
573
581
|
console.log('Product from selectedProduct:', product);
|
|
574
582
|
}
|
|
575
583
|
else if (application.productId && typeof application.productId === 'object' && application.productId.selectedProduct) {
|
|
576
|
-
product = application.productId.selectedProduct
|
|
584
|
+
product = application.productId.selectedProduct;
|
|
577
585
|
console.log('Product from productId:', product);
|
|
578
586
|
}
|
|
579
|
-
// Get finance term from
|
|
580
|
-
if (application.
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
if (productFeatures.fixedTerm) {
|
|
585
|
-
financeTerm = `${productFeatures.fixedTerm} year finance term`;
|
|
586
|
-
console.log('Finance term:', financeTerm);
|
|
587
|
-
}
|
|
588
|
-
// Get monthly finance from repayment
|
|
589
|
-
if (productFeatures.repayment) {
|
|
590
|
-
monthlyFinance = `£${productFeatures.repayment}`;
|
|
591
|
-
console.log('Monthly finance:', monthlyFinance);
|
|
587
|
+
// Get finance term from productId if available
|
|
588
|
+
if (application.productId && typeof application.productId === 'object') {
|
|
589
|
+
if (application.productId.numberOfYearsToRepay) {
|
|
590
|
+
financeTerm = `${application.productId.numberOfYearsToRepay} year finance term`;
|
|
591
|
+
console.log('Finance term from productId:', financeTerm);
|
|
592
592
|
}
|
|
593
593
|
}
|
|
594
594
|
else {
|
|
595
|
-
console.log('No
|
|
595
|
+
console.log('No productId found or not populated');
|
|
596
596
|
}
|
|
597
|
-
//
|
|
597
|
+
// Note: productFeatures is a separate collection that needs to be populated in form configuration
|
|
598
|
+
// If you need productFeatures data, it should be populated separately in the form config
|
|
599
|
+
// Get rental income from mortgage - mortgageId is at application level
|
|
600
|
+
let mortgage = null;
|
|
598
601
|
if (application.mortgageId && typeof application.mortgageId === 'object') {
|
|
599
|
-
|
|
602
|
+
mortgage = application.mortgageId;
|
|
603
|
+
}
|
|
604
|
+
if (mortgage) {
|
|
600
605
|
console.log('Mortgage data:', JSON.stringify(mortgage, null, 2));
|
|
601
606
|
if (mortgage.monthlyRentalIncome) {
|
|
602
607
|
// Format the rental income value
|
|
@@ -606,13 +611,7 @@ welcomeCallSchema.virtual('financeSummaryHtml').get(function () {
|
|
|
606
611
|
rentalIncome = `£${rentalValue}`;
|
|
607
612
|
console.log('Rental income:', rentalIncome);
|
|
608
613
|
}
|
|
609
|
-
|
|
610
|
-
else {
|
|
611
|
-
console.log('No mortgageId found or not populated');
|
|
612
|
-
}
|
|
613
|
-
// Get occupancy information from mortgage
|
|
614
|
-
if (application.mortgageId && typeof application.mortgageId === 'object') {
|
|
615
|
-
const mortgage = application.mortgageId;
|
|
614
|
+
// Get occupancy information from mortgage
|
|
616
615
|
if (mortgage.proposedTenantsLids && Array.isArray(mortgage.proposedTenantsLids)) {
|
|
617
616
|
// Get the first proposed tenant type
|
|
618
617
|
const firstTenant = mortgage.proposedTenantsLids[0];
|
|
@@ -622,6 +621,9 @@ welcomeCallSchema.virtual('financeSummaryHtml').get(function () {
|
|
|
622
621
|
}
|
|
623
622
|
}
|
|
624
623
|
}
|
|
624
|
+
else {
|
|
625
|
+
console.log('No mortgageId found or not populated');
|
|
626
|
+
}
|
|
625
627
|
// Create HTML content
|
|
626
628
|
const summaryContent = `
|
|
627
629
|
<div><p class="text-bold">Product:</p> <span>${product}</span></div>
|
|
@@ -633,7 +635,7 @@ welcomeCallSchema.virtual('financeSummaryHtml').get(function () {
|
|
|
633
635
|
console.log('Final summary content:', summaryContent);
|
|
634
636
|
return summaryContent;
|
|
635
637
|
}
|
|
636
|
-
console.log('No
|
|
638
|
+
console.log('No application found');
|
|
637
639
|
return 'N/A';
|
|
638
640
|
});
|
|
639
641
|
applyAuditMiddleware(welcomeCallSchema, "ApplicantWelcomeCall");
|