import React from 'react'; import { Input, Form, Icon, Select, Alert } from 'antd'; import { SelectValue } from 'antd/lib/select'; import { PROPOSAL_CATEGORY, CATEGORY_UI } from 'api/constants'; import { ProposalDraft, RFP } from 'types'; import { getCreateErrors } from 'modules/create/utils'; import { typedKeys } from 'utils/ts'; import { Link } from 'react-router-dom'; interface State extends Partial { title: string; brief: string; category?: PROPOSAL_CATEGORY; target: string; rfp?: RFP; } interface Props { initialState?: Partial; updateForm(form: Partial): void; } export default class CreateFlowBasics extends React.Component { constructor(props: Props) { super(props); this.state = { title: '', brief: '', category: undefined, target: '', ...(props.initialState || {}), }; } handleInputChange = ( event: React.ChangeEvent, ) => { const { value, name } = event.currentTarget; this.setState({ [name]: value } as any, () => { this.props.updateForm(this.state); }); }; handleCategoryChange = (value: SelectValue) => { this.setState({ category: value as PROPOSAL_CATEGORY }, () => { this.props.updateForm(this.state); }); }; render() { const { title, brief, category, target, rfp } = this.state; const errors = getCreateErrors(this.state, true); return (
{rfp && ( This proposal is for the open request{' '} {rfp.title} . If you didn’t mean to do this, you can delete this proposal and create a new one. } style={{ marginBottom: '2rem' }} showIcon /> )} ); } }