2021-06-21 11:34:33 +03:00
|
|
|
import BaseValidator from './base';
|
|
|
|
import {isBlank} from '@ember/utils';
|
|
|
|
|
|
|
|
export default BaseValidator.create({
|
2021-06-28 12:49:54 +03:00
|
|
|
properties: ['name'],
|
2021-06-21 11:34:33 +03:00
|
|
|
|
2021-06-28 12:49:54 +03:00
|
|
|
name(model) {
|
|
|
|
let name = model.get('name');
|
2021-06-21 11:34:33 +03:00
|
|
|
let hasValidated = model.get('hasValidated');
|
|
|
|
|
2021-06-28 12:49:54 +03:00
|
|
|
if (isBlank(name)) {
|
2021-09-01 11:14:50 +03:00
|
|
|
model.get('errors').add('name', 'Please enter a benefit');
|
2021-06-21 11:34:33 +03:00
|
|
|
this.invalidate();
|
|
|
|
}
|
|
|
|
|
2021-06-28 12:49:54 +03:00
|
|
|
hasValidated.addObject('name');
|
2021-06-21 11:34:33 +03:00
|
|
|
}
|
|
|
|
});
|