diff --git a/ui/react/components/Dialog/Section/Splits/index.js b/ui/react/components/Dialog/Section/Splits/index.js index 5bf15260..685d6e58 100644 --- a/ui/react/components/Dialog/Section/Splits/index.js +++ b/ui/react/components/Dialog/Section/Splits/index.js @@ -47,16 +47,16 @@ const Splits = React.createClass({ self.props.deleteSplitRow(index); }; }, - getTagData() { + getTagData(itemsEnabled) { return [ // {key: 'acquirer', name: 'Acquirer'}, - {key: 'fee', name: 'Fee'}, - {key: 'vat', name: 'VAT'}, - {key: 'wth', name: 'WHT'}, - {key: 'otherTax', name: 'Other Tax'}, - {key: 'realtime', name: 'Real Time'}, - {key: 'agentCommission', name: 'Delayed'}, - {key: 'commission', name: 'Commission real time'} + { key: 'fee', name: 'Fee', disabled: itemsEnabled['fee'] }, + { key: 'vat', name: 'VAT', disabled: itemsEnabled['vat'] }, + { key: 'wth', name: 'WHT', disabled: itemsEnabled['wth'] }, + { key: 'otherTax', name: 'Other Tax', disabled: itemsEnabled['otherTax'] }, + { key: 'realtime', name: 'Real Time', disabled: itemsEnabled['realtime'] }, + { key: 'agentCommission', name: 'Delayed', disabled: itemsEnabled['agentCommission'] }, + { key: 'commission', name: 'Commission real time', disabled: itemsEnabled['commission'] } // {key: 'issuer', name: 'Issuer'}, // {key: 'commission', name: 'Commission'}, // {key: 'pending', name: 'Authorization required'}, @@ -84,8 +84,18 @@ const Splits = React.createClass({ createSplitRows() { var self = this; - return this.props.data.map((split, index) => ( -
+ return this.props.data.map((split, index, splits) => { + let itemsEnabled = {}; + if (splits.length) { + splits.map((existingSplit, currentIndex) => { + if (currentIndex !== index) { + let tagsArray = existingSplit.splitName.tag; + tagsArray.map((tag) => (itemsEnabled[tag.key] = true)); + } + }); + } + + return (
@@ -132,8 +142,8 @@ const Splits = React.createClass({ -
- )); +
); + }); }, render() { return (