mattwr18 e8c6941142 Follow @roschaefer's PR review suggestions
- disable button if form.reasonCategory is falsy
- extract valuesReasonCategoryOptions to global constant
- extract reasonCategoryOptions to created lifecycle hook to keep data()
clean and use map
- extract formSchema to components/utils and test
- remove validator from formSchema and validate based on "Deep Rules" https://github.com/yiminghe/async-validator#deep-rules
- Use v-model to update reasonCategory and reasonDescription
- default to error message in English from backend
- Update template slot to use new syntax
2019-10-15 20:28:25 +02:00

26 lines
567 B
JavaScript

import { valuesReasonCategoryOptions } from '~/constants/modals.js'
export default function validReport({ translate }) {
return {
formSchema: {
reasonCategory: {
type: 'object',
required: true,
fields: {
value: {
type: 'enum',
enum: valuesReasonCategoryOptions,
required: true,
message: translate('report.reason.category.invalid'),
},
},
},
reasonDescription: {
type: 'string',
min: 0,
max: 200,
},
},
}
}