Commit 6564859b authored by Roman's avatar Roman

BRCD-1681 feat(Play) - in reports load and show play options for play filed

parent d038dfa1
......@@ -119,6 +119,8 @@ export const getFileTypesOptions = () => dispatch => dispatch(getSettings('file_
export const getEventCodeOptions = () => dispatch => dispatch(getSettings('events'));
export const getPlayTypeOptions = () => dispatch => dispatch(getSettings('plays'));
export const getGroupsOptions = () => dispatch => apiBillRun(getAllGroupsQuery())
.then((success) => {
try {
......
......@@ -22,6 +22,7 @@ import {
getBucketsOptions,
getFileTypesOptions,
getEventCodeOptions,
getPlayTypeOptions,
} from '../../../actions/reportsActions';
......@@ -93,6 +94,8 @@ class ConditionValue extends Component {
break;
case 'getFileTypeOptions': this.props.dispatch(getFileTypesOptions());
break;
case 'getPlayTypeOptions': this.props.dispatch(getPlayTypeOptions());
break;
case 'getEventCodeOptions': this.props.dispatch(getEventCodeOptions());
break;
default: console.log('unsuported select options callback');
......
......@@ -72,8 +72,12 @@ export default {
{ id: 'sid', type: 'number' },
{ id: 'plan', inputConfig: { inputType: 'select', callback: 'getPlansOptions' } },
{ id: 'services', inputConfig: { inputType: 'select', callback: 'getServicesOptions' } },
{ id: 'plan_activation', type:'date' },
{ id: 'deactivation_date', type:'date' },
{ id: 'plan_activation', type: 'date' },
{ id: 'deactivation_date', type: 'date' },
{ id: 'play', inputConfig: {
inputType: 'select',
callback: 'getPlayTypeOptions',
} },
],
account: [
{ id: 'aid', type: 'number' },
......
......@@ -3,6 +3,9 @@ import Immutable from 'immutable';
import { sentenceCase } from 'change-case';
import { getCycleName } from '../components/Cycle/CycleUtil';
import { getConfig } from '../common/Util';
import {
availablePlaysLabelsSelector,
} from './settingsSelector';
const getEventRates = state => state.list.get('event_products', null);
......@@ -81,6 +84,13 @@ const selectPlansOptions = (options) => {
}));
};
const selectPlayTypeOptions = (options) => {
if (options === null) {
return undefined;
}
return options.map((label, value) => Immutable.Map({ label, value }));
};
const getGroupsOptions = state => state.list.get('available_groups', null);
const selectGroupsOptions = (options) => {
......@@ -164,6 +174,11 @@ export const plansOptionsSelector = createSelector(
selectPlansOptions,
);
export const getPlayTypeOptions = createSelector(
availablePlaysLabelsSelector,
selectPlayTypeOptions,
);
export const groupsOptionsSelector = createSelector(
getGroupsOptions,
selectGroupsOptions,
......
......@@ -30,6 +30,7 @@ import {
calcNameSelector,
bucketsNamesSelector,
bucketsExternalIdsSelector,
getPlayTypeOptions,
} from './listSelectors';
......@@ -278,6 +279,7 @@ const getOptionCallback = (state, props) => {
case 'getBucketsOptions': return bucketsNamesSelector(state, props);
case 'getBucketsExternalIdsOptions': return bucketsExternalIdsSelector(state, props);
case 'getFileTypeOptions': return fileTypeSelector(state, props);
case 'getPlayTypeOptions': return getPlayTypeOptions(state, props);
case 'getCalcNameOptions': return calcNameSelector(state, props);
case 'getEventCodeOptions': return eventCodeSelector(state, props);
default: return undefined;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment