From fb62d2d2e0461b2511eb38d55f333e11d9332916 Mon Sep 17 00:00:00 2001 From: Brett Sun Date: Fri, 6 Nov 2015 14:00:58 +0100 Subject: [PATCH] Check for completion of additional data on front end In the end, it made more sense to check if all the additional details have been filled in on the front end than receiving an acl or flag from the backend. --- .../lumenus_buttons/lumenus_submit_button.js | 28 +++++++++++++++---- 1 file changed, 23 insertions(+), 5 deletions(-) diff --git a/js/components/whitelabel/wallet/components/lumenus/lumenus_buttons/lumenus_submit_button.js b/js/components/whitelabel/wallet/components/lumenus/lumenus_buttons/lumenus_submit_button.js index 6722beb7..7046c069 100644 --- a/js/components/whitelabel/wallet/components/lumenus/lumenus_buttons/lumenus_submit_button.js +++ b/js/components/whitelabel/wallet/components/lumenus/lumenus_buttons/lumenus_submit_button.js @@ -12,6 +12,8 @@ import ConsignForm from '../../../../../ascribe_forms/form_consign'; import ModalWrapper from '../../../../../ascribe_modal/modal_wrapper'; +import AclProxy from '../../../../../acl_proxy'; + import PieceActions from '../../../../../../actions/piece_actions'; import WhitelabelActions from '../../../../../../actions/whitelabel_actions'; import WhitelabelStore from '../../../../../../stores/whitelabel_store'; @@ -48,6 +50,20 @@ let LumenusSubmitButton = React.createClass({ this.setState(state); }, + canEditionBeSubmitted(edition) { + if (edition && edition.extra_data && edition.other_data) { + const { extra_data, other_data } = edition; + + if (extra_data.artist_bio && extra_data.work_description && + extra_data.technology_details && extra_data.display_instructions && + other_data.length > 0) { + return true; + } + } + + return false; + }, + getFormDataId() { return getAclFormDataId(false, this.props.editions); }, @@ -60,11 +76,11 @@ let LumenusSubmitButton = React.createClass({ return editions.reduce((details, curEdition) => { return { solePieceId: details.solePieceId === curEdition.parent ? details.solePieceId : null, - canSubmit: details.canSubmit && curEdition.acl.acl_wallet_submit + canSubmit: details.canSubmit && this.canEditionBeSubmitted(curEdition) }; }, { solePieceId: editions.length > 0 ? editions[0].parent : null, - canSubmit: editions.length > 0 ? editions[0].acl.acl_wallet_submit : false + canSubmit: this.canEditionBeSubmitted(editions[0]) }); }, @@ -83,7 +99,9 @@ let LumenusSubmitButton = React.createClass({ if (solePieceId && !canSubmit) { return ( - + @@ -107,12 +125,12 @@ let LumenusSubmitButton = React.createClass({ pieceOrEditions={editions} showNotification /> - + ); } else { return (