Skip to content

Commit

Permalink
feat: disable repeat rows option for transaction & budget
Browse files Browse the repository at this point in the history
  • Loading branch information
stephanoshadjipetrou committed Aug 11, 2020
1 parent c19e54b commit b972f3d
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,18 @@ export const OutputFragment = () => {
const transactionActive = store.get('rowFormat') === 'transaction';
const budgetActive = store.get('rowFormat') === 'budget';

function getRadioBtnGroupItems(group) {
if (
group.groupID === 'repeatRows' &&
store.get('rowFormat') !== 'activity'
) {
const items = group.items.slice();
items[1].disabled = true;
return items;
}
return group.items;
}

return (
<Grid
container
Expand All @@ -49,9 +61,9 @@ export const OutputFragment = () => {
)}
{group && (
<RadioButtonsGroup
items={group.items}
value={group.value}
onChange={group.onChange}
items={getRadioBtnGroupItems(group)}
/>
)}
</Grid>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,10 @@ export const fragmentConfig: FragmentModel = {
store.set('fields')([]);
store.set('rowFormat')(e.target.value);

if (e.target.value !== 'activity') {
store.set('repeatRows')('0');
}

// console.log(`onChange: ${e.target.value}`);
},
value: store.get('rowFormat'),
Expand Down

0 comments on commit b972f3d

Please sign in to comment.