@dynamatix/cat-shared 0.0.139 → 0.0.141
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.
|
@@ -316,8 +316,23 @@ function applyAuditMiddleware(schema, collectionName) {
|
|
|
316
316
|
// --- Add pound prefix if needed ---
|
|
317
317
|
const dataType = fieldTypeMap[field];
|
|
318
318
|
if (dataType === 'pound') {
|
|
319
|
-
|
|
320
|
-
|
|
319
|
+
const formatPoundValue = (rawValue) => {
|
|
320
|
+
if (rawValue == null || rawValue === '') return rawValue;
|
|
321
|
+
const stringValue = typeof rawValue === 'string' ? rawValue.trim() : String(rawValue);
|
|
322
|
+
if (stringValue === '') return rawValue;
|
|
323
|
+
const valueSansSymbol = stringValue.startsWith('£') ? stringValue.slice(1) : stringValue;
|
|
324
|
+
const numericString = valueSansSymbol.replace(/,/g, '');
|
|
325
|
+
const numericValue = Number(numericString);
|
|
326
|
+
if (!Number.isFinite(numericValue)) return `£${valueSansSymbol}`;
|
|
327
|
+
const decimalPart = numericString.split('.')[1];
|
|
328
|
+
const formatted = numericValue.toLocaleString('en-GB', {
|
|
329
|
+
minimumFractionDigits: decimalPart ? decimalPart.length : 0,
|
|
330
|
+
maximumFractionDigits: decimalPart ? decimalPart.length : 20
|
|
331
|
+
});
|
|
332
|
+
return `£${formatted}`;
|
|
333
|
+
};
|
|
334
|
+
displayOldValue = formatPoundValue(displayOldValue);
|
|
335
|
+
displayNewValue = formatPoundValue(displayNewValue);
|
|
321
336
|
}
|
|
322
337
|
if (displayOldValue !== displayNewValue) {
|
|
323
338
|
const fieldDescription = await resolveDescription(field, result);
|
|
@@ -86,6 +86,10 @@ const formfieldSchema = new mongoose.Schema({
|
|
|
86
86
|
type: mongoose.Schema.Types.Mixed,
|
|
87
87
|
default: {}
|
|
88
88
|
}],
|
|
89
|
+
placeholder: {
|
|
90
|
+
type: String,
|
|
91
|
+
default: null
|
|
92
|
+
},
|
|
89
93
|
visibilityCondition: { // (LendingType=='BTL' || ApplicationType=='Company')
|
|
90
94
|
type: mongoose.Schema.Types.Mixed,
|
|
91
95
|
default: null
|