From 2dcbf92124814e4e7f13611b9f527608e03ae45a Mon Sep 17 00:00:00 2001 From: Jayasanka Date: Fri, 26 Jul 2019 16:09:31 +0530 Subject: [PATCH] Complete step form in add new app --- .../src/components/new-app/AddNewAppForm.js | 3 +- .../new-app/subForms/NewAppDetailsForm.js | 32 ++++++++-------- .../new-app/subForms/NewAppUploadForm.js | 38 ++++++++++++++++--- 3 files changed, 50 insertions(+), 23 deletions(-) diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/react-app/src/components/new-app/AddNewAppForm.js b/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/react-app/src/components/new-app/AddNewAppForm.js index 5a25c80ae98..a2ada796461 100644 --- a/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/react-app/src/components/new-app/AddNewAppForm.js +++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/react-app/src/components/new-app/AddNewAppForm.js @@ -142,8 +142,7 @@ class AddNewAppFormComponent extends React.Component { {!isError && ( this.props.history.push('/publisher/apps')}> diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/react-app/src/components/new-app/subForms/NewAppDetailsForm.js b/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/react-app/src/components/new-app/subForms/NewAppDetailsForm.js index 446659a43dc..5b5520c7732 100644 --- a/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/react-app/src/components/new-app/subForms/NewAppDetailsForm.js +++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/react-app/src/components/new-app/subForms/NewAppDetailsForm.js @@ -234,24 +234,24 @@ class NewAppDetailsForm extends React.Component { )} - - - - - - - - - - - diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/react-app/src/components/new-app/subForms/NewAppUploadForm.js b/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/react-app/src/components/new-app/subForms/NewAppUploadForm.js index 3a103f9ac75..86c63f2b250 100644 --- a/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/react-app/src/components/new-app/subForms/NewAppUploadForm.js +++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/react-app/src/components/new-app/subForms/NewAppUploadForm.js @@ -23,7 +23,8 @@ class NewAppUploadForm extends React.Component { screenshots: [], loading: false, binaryFiles: [], - application: null + application: null, + isFree: true } } @@ -45,7 +46,9 @@ class NewAppUploadForm extends React.Component { 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 const release = { @@ -91,10 +94,17 @@ class NewAppUploadForm extends React.Component { handleScreenshotChange = ({fileList}) => this.setState({screenshots: fileList}); + handlePriceTypeChange = (value) => { + this.setState({ + isFree: (value === 'free') + }) + + }; + render() { const {formConfig} = this.props; const {getFieldDecorator} = this.props.form; - const {icons, screenshots, binaryFiles} = this.state; + const {icons, screenshots, binaryFiles, isFree} = this.state; return ( @@ -245,14 +255,32 @@ class NewAppUploadForm extends React.Component { )} + + {getFieldDecorator('select', { + rules: [{required: true, message: 'Please select price Type'}], + })( + , + )} + + {getFieldDecorator('price', { rules: [{ - required: false + required: !isFree }], })( `$ ${value}`.replace(/\B(?=(\d{3})+(?!\d))/g, ',')} parser={value => value.replace(/\$\s?|(,*)/g, '')} />