Make the default template the default selection on the campaign form

This commit is contained in:
Kailash Nadh 2018-11-27 11:54:23 +05:30
parent 1673cba964
commit 5ff0e446ed
1 changed files with 1 additions and 1 deletions

View File

@ -321,7 +321,7 @@ class TheFormDef extends React.PureComponent {
</Form.Item> </Form.Item>
<Form.Item {...formItemLayout} label="Template" extra="Template"> <Form.Item {...formItemLayout} label="Template" extra="Template">
{getFieldDecorator("template_id", { {getFieldDecorator("template_id", {
initialValue: record.template_id ? record.template_id : (this.props.data[cs.ModelTemplates].length === 1 ? this.props.data[cs.ModelTemplates][0].id : undefined), initialValue: record.template_id ? record.template_id : (this.props.data[cs.ModelTemplates].length > 0 ? this.props.data[cs.ModelTemplates].filter(t => t.is_default)[0].id : undefined),
rules: [{ required: true }] rules: [{ required: true }]
})( })(
<Select disabled={ this.props.formDisabled }> <Select disabled={ this.props.formDisabled }>