diff --git a/js/components/whitelabel/wallet/components/market/market_buttons/market_submit_button.js b/js/components/whitelabel/wallet/components/market/market_buttons/market_submit_button.js index d8ef4c41..bd333850 100644 --- a/js/components/whitelabel/wallet/components/market/market_buttons/market_submit_button.js +++ b/js/components/whitelabel/wallet/components/market/market_buttons/market_submit_button.js @@ -3,6 +3,8 @@ import React from 'react'; import classNames from 'classnames'; +import MarketConsignError from '../market_consign_error'; + import MarketAdditionalDataForm from '../market_forms/market_additional_data_form'; import AclFormFactory from '../../../../../ascribe_forms/acl_form_factory'; @@ -12,6 +14,7 @@ import ModalWrapper from '../../../../../ascribe_modal/modal_wrapper'; import AclProxy from '../../../../../acl_proxy'; +import EditionListActions from '../../../../../../actions/edition_list_actions'; import PieceActions from '../../../../../../actions/piece_actions'; import WhitelabelActions from '../../../../../../actions/whitelabel_actions'; import WhitelabelStore from '../../../../../../stores/whitelabel_store'; @@ -89,6 +92,11 @@ let MarketSubmitButton = React.createClass({ this.refs.consignModal.show(); }, + handleConsignError() { + // Unselect failed editions + EditionListActions.clearAllEditionSelections(); + }, + render() { const { availableAcls, currentUser, className, editions, handleSuccess } = this.props; const { whitelabel: { name: whitelabelName = 'Market', user: whitelabelAdminEmail } } = this.state; @@ -120,27 +128,45 @@ let MarketSubmitButton = React.createClass({ ); if (solePieceId && !canSubmit) { - return ( - + if (availableAcls.acl_edit) { + return ( + + + + + + + {consignForm} + + + ); + } else { + // Oops, well this is a difficult situation... + // The user's likely already transferred another edition from the piece so + // they can't update the missing fields that are necessary for consignment + // to marketplaces. + // Let's show an error in response to explain the problem and let them + // contact the whitelabel themselves. + return ( - + handleSuccess={this.handleConsignError} + title={getLangText("Oops, we can't consign this piece to %s", whitelabelName)}> + - - - {consignForm} - - - ); + ); + } } else { return ( +
+

+ {getLangText('Unfortunately, %s requires you to provide more information ' + + "about this edition, but it appears that you don't have the " + + 'permissions to edit the piece associated with this edition.', whitelabelName)} +

+

+ {getLangText('Please contact us if you would still like to consign this piece to %s.', whitelabelName)} +

+
+ + + ); + } +}); + +export default MarketConsignError; diff --git a/sass/ascribe_form.scss b/sass/ascribe_form.scss index 1b265e91..84be8be9 100644 --- a/sass/ascribe_form.scss +++ b/sass/ascribe_form.scss @@ -23,4 +23,11 @@ @media (max-width: 550px) { width: 100%; } -} \ No newline at end of file +} + +.ascribe-form-error-popup { + .error-popup-content { + margin-bottom: 30px; + margin-top: 20px; + } +}