@dynamatix/gb-schemas 2.3.291 → 2.3.293
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;AAytBhC,QAAA,MAAM,gBAAgB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAA4D,CAAC;AAEnF,eAAe,gBAAgB,CAAC"}
|
|
@@ -388,10 +388,10 @@ welcomeCallSchema.virtual('otherApplicantsNameAndDOB').get(function () {
|
|
|
388
388
|
const isLast = index === otherApplicants.length - 1;
|
|
389
389
|
const comma = isLast ? '' : ',';
|
|
390
390
|
// Format as an HTML line (with bold labels and inline values)
|
|
391
|
-
return `
|
|
392
|
-
<div class="applicant-line">
|
|
393
|
-
<span class="readonly-data">${fullFirstName}, ${lastName}, ${formattedDOB}${comma}</span>
|
|
394
|
-
</div>
|
|
391
|
+
return `
|
|
392
|
+
<div class="applicant-line">
|
|
393
|
+
<span class="readonly-data">${fullFirstName}, ${lastName}, ${formattedDOB}${comma}</span>
|
|
394
|
+
</div>
|
|
395
395
|
`;
|
|
396
396
|
}).filter((line) => line && line.trim() !== '');
|
|
397
397
|
// Join all applicants as HTML (no \n needed)
|
|
@@ -572,7 +572,7 @@ welcomeCallSchema.virtual('initialRatePercentage').get(function () {
|
|
|
572
572
|
return null;
|
|
573
573
|
});
|
|
574
574
|
// Virtual property for finance summary HTML
|
|
575
|
-
welcomeCallSchema.virtual('financeSummaryHtml').get(function () {
|
|
575
|
+
welcomeCallSchema.virtual('financeSummaryHtml').get(async function () {
|
|
576
576
|
let application = null;
|
|
577
577
|
if (this.applicantId && typeof this.applicantId === 'object' && !(typeof this.applicantId.toHexString === 'function') && this.applicantId.applicationId) {
|
|
578
578
|
application = this.applicantId.applicationId;
|
|
@@ -587,7 +587,7 @@ welcomeCallSchema.virtual('financeSummaryHtml').get(function () {
|
|
|
587
587
|
// Initialize summary data
|
|
588
588
|
let product = '';
|
|
589
589
|
let financeTerm = '';
|
|
590
|
-
let
|
|
590
|
+
let monthlyRepayment = '';
|
|
591
591
|
let rentalIncome = '';
|
|
592
592
|
let occupancy = '';
|
|
593
593
|
// Get product information (first 3 characters)
|
|
@@ -611,6 +611,25 @@ welcomeCallSchema.virtual('financeSummaryHtml').get(function () {
|
|
|
611
611
|
else {
|
|
612
612
|
financeTerm = '-';
|
|
613
613
|
}
|
|
614
|
+
// Get monthly repayment amount from productFeatures collection
|
|
615
|
+
try {
|
|
616
|
+
const ApplicationProductFeatures = mongoose.model('ApplicationProductFeatures');
|
|
617
|
+
const productFeatures = await ApplicationProductFeatures.findOne({
|
|
618
|
+
applicationId: application
|
|
619
|
+
});
|
|
620
|
+
if (productFeatures && productFeatures.repayment !== undefined && productFeatures.repayment !== null) {
|
|
621
|
+
const numericValue = Number(productFeatures.repayment);
|
|
622
|
+
const repaymentValue = isNaN(numericValue) ? '0.00' : numericValue.toFixed(2);
|
|
623
|
+
monthlyRepayment = `£${repaymentValue}`;
|
|
624
|
+
}
|
|
625
|
+
else {
|
|
626
|
+
monthlyRepayment = '-';
|
|
627
|
+
}
|
|
628
|
+
}
|
|
629
|
+
catch (error) {
|
|
630
|
+
console.log('Error fetching product features:', error);
|
|
631
|
+
monthlyRepayment = '-';
|
|
632
|
+
}
|
|
614
633
|
// Get rental income from mortgage - mortgageId is at application level
|
|
615
634
|
let mortgage = null;
|
|
616
635
|
if (application.mortgageId && typeof application.mortgageId === 'object') {
|
|
@@ -624,12 +643,6 @@ welcomeCallSchema.virtual('financeSummaryHtml').get(function () {
|
|
|
624
643
|
const rentalValue = isNaN(numericValue) ? '0.00' : numericValue.toFixed(2);
|
|
625
644
|
rentalIncome = `£${rentalValue}`;
|
|
626
645
|
}
|
|
627
|
-
// Get finance amount from loanRequired
|
|
628
|
-
if (mortgage.loanRequired !== undefined && mortgage.loanRequired !== null) {
|
|
629
|
-
const numericValue = Number(mortgage.loanRequired);
|
|
630
|
-
const financeValue = isNaN(numericValue) ? '0.00' : numericValue.toFixed(2);
|
|
631
|
-
monthlyFinance = `£${financeValue}`;
|
|
632
|
-
}
|
|
633
646
|
// Get occupancy information from mortgage
|
|
634
647
|
if (mortgage.proposedTenantsLids && Array.isArray(mortgage.proposedTenantsLids) && mortgage.proposedTenantsLids.length > 0) {
|
|
635
648
|
// Get the first proposed tenant type
|
|
@@ -646,15 +659,16 @@ welcomeCallSchema.virtual('financeSummaryHtml').get(function () {
|
|
|
646
659
|
const isBTL = application.lendingTypeLid &&
|
|
647
660
|
typeof application.lendingTypeLid === 'object' &&
|
|
648
661
|
application.lendingTypeLid.name === 'BTL';
|
|
662
|
+
const monthlyRepaymentClass = isBTL ? 'mb-2' : '';
|
|
649
663
|
// Create HTML content
|
|
650
|
-
let summaryContent = `
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
664
|
+
let summaryContent = `
|
|
665
|
+
<div class="flex align-items-center mb-2"><p class="text-bold m-0 readonly-data">Product:</p> <span class="readonly-data ml-2">${product}</span></div>
|
|
666
|
+
<div class="flex align-items-center mb-2"><p class="text-bold m-0 readonly-data">Finance Term:</p> <span class="readonly-data ml-2">${financeTerm}</span></div>
|
|
667
|
+
<div class="flex align-items-center ${monthlyRepaymentClass}"><p class="text-bold m-0 readonly-data">Monthly Repayment:</p> <span class="readonly-data ml-2">${monthlyRepayment}</span></div>`;
|
|
654
668
|
// Only show rental income and occupancy for BTL applications
|
|
655
669
|
if (isBTL) {
|
|
656
|
-
summaryContent += `
|
|
657
|
-
<div class="flex align-items-center mb-2"><p class="text-bold m-0 readonly-data">Rental Income:</p> <span class="readonly-data ml-2">${rentalIncome}</span></div>
|
|
670
|
+
summaryContent += `
|
|
671
|
+
<div class="flex align-items-center mb-2"><p class="text-bold m-0 readonly-data">Rental Income:</p> <span class="readonly-data ml-2">${rentalIncome}</span></div>
|
|
658
672
|
<div class="flex align-items-center"><p class="text-bold m-0 readonly-data">Occupancy:</p> <span class="readonly-data ml-2">${occupancy}</span></div>`;
|
|
659
673
|
}
|
|
660
674
|
return summaryContent;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dynamatix/gb-schemas",
|
|
3
|
-
"version": "2.3.
|
|
3
|
+
"version": "2.3.293",
|
|
4
4
|
"description": "All the schemas for gatehouse bank back-end",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -35,7 +35,7 @@
|
|
|
35
35
|
},
|
|
36
36
|
"homepage": "https://github.com/DynamatixAnalyticsPvtLtd/gb-schemas#readme",
|
|
37
37
|
"dependencies": {
|
|
38
|
-
"@dynamatix/cat-shared": "^0.0.
|
|
38
|
+
"@dynamatix/cat-shared": "^0.0.129",
|
|
39
39
|
"dotenv": "^16.4.5",
|
|
40
40
|
"mongodb": "^6.14.2",
|
|
41
41
|
"mongoose": "^8.9.5"
|