mirror of
https://github.com/kingomarnajjar/flex-template-web.git
synced 2026-07-28 12:43:11 +10:00
Remove old Stripe payout info fields
This commit is contained in:
parent
c1f5b1be6a
commit
36bc69a45b
3 changed files with 40 additions and 76 deletions
|
|
@ -1,41 +1,48 @@
|
|||
import React, { PropTypes } from 'react';
|
||||
import React, { Component, PropTypes } from 'react';
|
||||
import classNames from 'classnames';
|
||||
import { FormattedMessage } from 'react-intl';
|
||||
import { EditListingPhotosForm } from '../../containers';
|
||||
|
||||
import css from './EditListingPhotosPanel.css';
|
||||
|
||||
const EditListingPhotosPanel = props => {
|
||||
const {
|
||||
className,
|
||||
rootClassName,
|
||||
images,
|
||||
onImageUpload,
|
||||
onSubmit,
|
||||
onUpdateImageOrder,
|
||||
stripeConnected,
|
||||
} = props;
|
||||
class EditListingPhotosPanel extends Component {
|
||||
constructor(props) {
|
||||
super(props);
|
||||
this.handleSubmit = this.handleSubmit.bind(this);
|
||||
}
|
||||
handleSubmit(values) {
|
||||
console.log('EditListingPhotosPanel.handleSubmit():', values); // eslint-disable-line
|
||||
const { onSubmit } = this.props;
|
||||
onSubmit(values);
|
||||
}
|
||||
render() {
|
||||
const {
|
||||
className,
|
||||
rootClassName,
|
||||
images,
|
||||
onImageUpload,
|
||||
onUpdateImageOrder,
|
||||
stripeConnected,
|
||||
} = this.props;
|
||||
|
||||
const rootClass = rootClassName || css.root;
|
||||
const classes = classNames(rootClass, className);
|
||||
const rootClass = rootClassName || css.root;
|
||||
const classes = classNames(rootClass, className);
|
||||
|
||||
// TODO This will be defined in the stripe popup form later.
|
||||
const country = 'US';
|
||||
|
||||
return (
|
||||
<div className={classes}>
|
||||
<h1><FormattedMessage id="EditListingPhotosPanel.title" /></h1>
|
||||
<EditListingPhotosForm
|
||||
initialValues={{ country, images }}
|
||||
images={images}
|
||||
onImageUpload={onImageUpload}
|
||||
onSubmit={onSubmit}
|
||||
onUpdateImageOrder={onUpdateImageOrder}
|
||||
stripeConnected={stripeConnected}
|
||||
/>
|
||||
</div>
|
||||
);
|
||||
};
|
||||
return (
|
||||
<div className={classes}>
|
||||
<h1><FormattedMessage id="EditListingPhotosPanel.title" /></h1>
|
||||
<EditListingPhotosForm
|
||||
initialValues={{ images }}
|
||||
images={images}
|
||||
onImageUpload={onImageUpload}
|
||||
onSubmit={this.handleSubmit}
|
||||
onUpdateImageOrder={onUpdateImageOrder}
|
||||
stripeConnected={stripeConnected}
|
||||
/>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
const { array, bool, func, string } = PropTypes;
|
||||
|
||||
|
|
|
|||
|
|
@ -4,15 +4,8 @@ import { Field, reduxForm, propTypes as formPropTypes } from 'redux-form';
|
|||
import { intlShape, injectIntl } from 'react-intl';
|
||||
import { isEqual } from 'lodash';
|
||||
import { arrayMove } from 'react-sortable-hoc';
|
||||
import config from '../../config';
|
||||
import { noEmptyArray, required } from '../../util/validators';
|
||||
import {
|
||||
AddImages,
|
||||
Button,
|
||||
Input,
|
||||
StripeBankAccountToken,
|
||||
ValidationError,
|
||||
} from '../../components';
|
||||
import { noEmptyArray } from '../../util/validators';
|
||||
import { AddImages, Button, Input, ValidationError } from '../../components';
|
||||
|
||||
import css from './EditListingPhotosForm.css';
|
||||
|
||||
|
|
@ -33,7 +26,7 @@ const RenderAddImage = props => {
|
|||
);
|
||||
};
|
||||
|
||||
const { bool, func, object, shape, string } = PropTypes;
|
||||
const { func, object, shape, string } = PropTypes;
|
||||
|
||||
RenderAddImage.propTypes = {
|
||||
accept: string.isRequired,
|
||||
|
|
@ -80,19 +73,9 @@ export class EditListingPhotosFormComponent extends Component {
|
|||
invalid,
|
||||
saveActionMsg,
|
||||
submitting,
|
||||
stripeConnected,
|
||||
} = this.props;
|
||||
|
||||
const imageRequiredMessage = intl.formatMessage({ id: 'EditListingPhotosForm.imageRequired' });
|
||||
const bankAccountNumberRequiredMessage = intl.formatMessage({
|
||||
id: 'EditListingPhotosForm.bankAccountNumberRequired',
|
||||
});
|
||||
|
||||
// TODO This will be defined in the stripe popup form later.
|
||||
// When that's ready, remove country from initialValues and hidden field.
|
||||
const country = this.props.initialValues.country;
|
||||
const showBankAccountField = !stripeConnected;
|
||||
const currency = config.currencyConfig.currency;
|
||||
|
||||
return (
|
||||
<form onSubmit={handleSubmit}>
|
||||
|
|
@ -123,16 +106,6 @@ export class EditListingPhotosFormComponent extends Component {
|
|||
/>
|
||||
</AddImages>
|
||||
|
||||
<Field component="input" name="country" type="hidden" value={country} />
|
||||
{showBankAccountField
|
||||
? <Field
|
||||
name="bankAccountToken"
|
||||
component={StripeBankAccountToken}
|
||||
props={{ country, currency }}
|
||||
validate={required(bankAccountNumberRequiredMessage)}
|
||||
/>
|
||||
: null}
|
||||
|
||||
<Button
|
||||
className={css.submitButton}
|
||||
type="submit"
|
||||
|
|
@ -154,7 +127,6 @@ EditListingPhotosFormComponent.propTypes = {
|
|||
onUpdateImageOrder: func.isRequired,
|
||||
onSubmit: func.isRequired,
|
||||
saveActionMsg: string,
|
||||
stripeConnected: bool.isRequired,
|
||||
};
|
||||
|
||||
const formName = 'EditListingPhotosForm';
|
||||
|
|
|
|||
|
|
@ -21,21 +21,6 @@ exports[`EditListingPhotosForm matches snapshot 1`] = `
|
|||
]
|
||||
} />
|
||||
</AddImages>
|
||||
<Field
|
||||
component="input"
|
||||
name="country"
|
||||
type="hidden"
|
||||
value="US" />
|
||||
<Field
|
||||
component={[Function]}
|
||||
name="bankAccountToken"
|
||||
props={
|
||||
Object {
|
||||
"country": "US",
|
||||
"currency": "USD",
|
||||
}
|
||||
}
|
||||
validate={[Function]} />
|
||||
<Button
|
||||
className={null}
|
||||
rootClassName=""
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue