Modification des options OK

This commit is contained in:
Teddy Cornaut 2020-08-31 12:55:33 +02:00
parent 406202ddc4
commit 2d66888ed3
2 changed files with 8 additions and 6 deletions

View File

@ -51,16 +51,18 @@ export const OptionsSection: FunctionComponent<OptionsSectionProps> = ({ dsf, up
}
const onAddOptionClick = (evt: MouseEvent) => {
const option = newOption("Décision", "", "");
setState(state => ({ ...state, changed: true, section: { ...state.section, options: [ ...state.section.options, option ] }}));
var options = JSON.parse(JSON.stringify(state.section.options))
var option = newOption("Décision", "", "");
options.push(option);
setState(state => ({ ...state, changed: true, section: { ...state.section, options }}));
};
const onOptionChange = (id: string, attrName: string, evt: ChangeEvent<HTMLInputElement>) => {
const target = evt.currentTarget;
const value = target.hasOwnProperty('checked') ? target.checked : target.value;
var options = state.section.options;
var options = JSON.parse(JSON.stringify(state.section.options))
options[id][attrName] = value;
setState(state => ({ ...state, changed: true, section: { ...state.section, options: options }}));
setState(state => ({ ...state, changed: true, section: { ...state.section, options }}));
};
return (

View File

@ -7,7 +7,7 @@ export const QUERY_DECISION_SUPPORT_FILES = gql`
decisionSupportFiles(filter: $filter) {
id,
title,
sections
sections,
createdAt,
closedAt,
votedAt,
@ -18,7 +18,7 @@ export const QUERY_DECISION_SUPPORT_FILES = gql`
members {
id
}
}
},
}
}
`;