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) {
|
2022-10-07 22:13:42 +03:00
|
|
|
let name = model.name;
|
|
|
|
let hasValidated = model.hasValidated;
|
2021-06-21 11:34:33 +03:00
|
|
|
|
2021-06-28 12:49:54 +03:00
|
|
|
if (isBlank(name)) {
|
2022-10-07 22:13:42 +03:00
|
|
|
model.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
|
|
|
}
|
|
|
|
});
|