Complete step form in add new app

merge-requests/185/head
Jayasanka 5 years ago
parent 69cad8c495
commit 2dcbf92124

@ -142,8 +142,7 @@ class AddNewAppFormComponent extends React.Component {
{!isError && (<Result {!isError && (<Result
status="success" status="success"
title="Successfully created the application!" title="Application created successfully!"
subTitle="Order number: 2017182818828182881 Cloud server configuration takes 1-5 minutes, please wait."
extra={[ extra={[
<Button type="primary" key="console" <Button type="primary" key="console"
onClick={() => this.props.history.push('/publisher/apps')}> onClick={() => this.props.history.push('/publisher/apps')}>

@ -234,24 +234,24 @@ class NewAppDetailsForm extends React.Component {
</Select> </Select>
)} )}
</Form.Item> </Form.Item>
<Form.Item {...formItemLayout} label="Meta Data"> {/*<Form.Item {...formItemLayout} label="Meta Data">*/}
<InputGroup> {/*<InputGroup>*/}
<Row gutter={8}> {/*<Row gutter={8}>*/}
<Col span={10}> {/*<Col span={10}>*/}
<Input placeholder="Key"/> {/*<Input placeholder="Key"/>*/}
</Col> {/*</Col>*/}
<Col span={12}> {/*<Col span={12}>*/}
<Input placeholder="value"/> {/*<Input placeholder="value"/>*/}
</Col> {/*</Col>*/}
<Col span={2}> {/*<Col span={2}>*/}
<Button type="dashed" shape="circle" icon="plus"/> {/*<Button type="dashed" shape="circle" icon="plus"/>*/}
</Col> {/*</Col>*/}
</Row> {/*</Row>*/}
</InputGroup> {/*</InputGroup>*/}
</Form.Item> {/*</Form.Item>*/}
<Form.Item style={{float: "right"}}> <Form.Item style={{float: "right"}}>
<Button type="primary" htmlType="submit"> <Button type="primary" htmlType="submit">
Submit Next
</Button> </Button>
</Form.Item> </Form.Item>
</Form> </Form>

@ -23,7 +23,8 @@ class NewAppUploadForm extends React.Component {
screenshots: [], screenshots: [],
loading: false, loading: false,
binaryFiles: [], binaryFiles: [],
application: null application: null,
isFree: true
} }
} }
@ -45,7 +46,9 @@ class NewAppUploadForm extends React.Component {
loading: true loading: true
}); });
const {name, description, categories, tags, price, isSharedWithAllTenants, binaryFile, icon, screenshots, releaseDescription, releaseType} = values; console.log(values);
const {price, isSharedWithAllTenants, binaryFile, icon, screenshots, releaseDescription, releaseType} = values;
//add release data //add release data
const release = { const release = {
@ -91,10 +94,17 @@ class NewAppUploadForm extends React.Component {
handleScreenshotChange = ({fileList}) => this.setState({screenshots: fileList}); handleScreenshotChange = ({fileList}) => this.setState({screenshots: fileList});
handlePriceTypeChange = (value) => {
this.setState({
isFree: (value === 'free')
})
};
render() { render() {
const {formConfig} = this.props; const {formConfig} = this.props;
const {getFieldDecorator} = this.props.form; const {getFieldDecorator} = this.props.form;
const {icons, screenshots, binaryFiles} = this.state; const {icons, screenshots, binaryFiles, isFree} = this.state;
return ( return (
@ -245,14 +255,32 @@ class NewAppUploadForm extends React.Component {
)} )}
</Form.Item> </Form.Item>
<Form.Item {...formItemLayout} label="Price Type">
{getFieldDecorator('select', {
rules: [{required: true, message: 'Please select price Type'}],
})(
<Select
placeholder="Please select a price type"
onChange={this.handlePriceTypeChange}>
<Option value="free">Free</Option>
<Option value="paid">Paid</Option>
</Select>,
)}
</Form.Item>
<Form.Item {...formItemLayout} label="Price"> <Form.Item {...formItemLayout} label="Price">
{getFieldDecorator('price', { {getFieldDecorator('price', {
rules: [{ rules: [{
required: false required: !isFree
}], }],
})( })(
<InputNumber <InputNumber
defaultValue={1000} disabled={isFree}
options={{
initialValue: 1
}}
min={0}
max={10000}
formatter={value => `$ ${value}`.replace(/\B(?=(\d{3})+(?!\d))/g, ',')} formatter={value => `$ ${value}`.replace(/\B(?=(\d{3})+(?!\d))/g, ',')}
parser={value => value.replace(/\$\s?|(,*)/g, '')} parser={value => value.replace(/\$\s?|(,*)/g, '')}
/> />

Loading…
Cancel
Save