WEB-705 Restrict Negative Values for Office Phone, MTN, and Airtel Fields in Datatable Forms (#3151)
This commit is contained in:
@@ -47,6 +47,13 @@ export class Datatables {
|
|||||||
const colName = column.columnName ? column.columnName.toLowerCase().replace(/[_\s]+/g, '') : '';
|
const colName = column.columnName ? column.columnName.toLowerCase().replace(/[_\s]+/g, '') : '';
|
||||||
const isMinSavingsAmount = colName.includes('minimumsavingsamountpermeeting');
|
const isMinSavingsAmount = colName.includes('minimumsavingsamountpermeeting');
|
||||||
const isPriceOneShare = colName.includes('priceofoneshare');
|
const isPriceOneShare = colName.includes('priceofoneshare');
|
||||||
|
const isRestrictedField = [
|
||||||
|
'mtn',
|
||||||
|
'airtel',
|
||||||
|
'officephone',
|
||||||
|
'office_phone',
|
||||||
|
'office phone'
|
||||||
|
].some((name) => colName.includes(name.replace(/[_\s]+/g, '')));
|
||||||
switch (column.columnDisplayType) {
|
switch (column.columnDisplayType) {
|
||||||
case 'INTEGER':
|
case 'INTEGER':
|
||||||
case 'STRING':
|
case 'STRING':
|
||||||
@@ -59,7 +66,7 @@ export class Datatables {
|
|||||||
type: column.columnDisplayType === 'INTEGER' || column.columnDisplayType === 'DECIMAL' ? 'number' : 'text',
|
type: column.columnDisplayType === 'INTEGER' || column.columnDisplayType === 'DECIMAL' ? 'number' : 'text',
|
||||||
required: column.isColumnNullable ? false : true
|
required: column.isColumnNullable ? false : true
|
||||||
};
|
};
|
||||||
if (isMinSavingsAmount || isPriceOneShare) {
|
if (isMinSavingsAmount || isPriceOneShare || isRestrictedField) {
|
||||||
inputOptions.min = 0;
|
inputOptions.min = 0;
|
||||||
}
|
}
|
||||||
return new InputBase(inputOptions);
|
return new InputBase(inputOptions);
|
||||||
|
|||||||
Reference in New Issue
Block a user