Modification des options OK
This commit is contained in:
parent
406202ddc4
commit
2d66888ed3
|
@ -51,16 +51,18 @@ export const OptionsSection: FunctionComponent<OptionsSectionProps> = ({ dsf, up
|
||||||
}
|
}
|
||||||
|
|
||||||
const onAddOptionClick = (evt: MouseEvent) => {
|
const onAddOptionClick = (evt: MouseEvent) => {
|
||||||
const option = newOption("Décision", "", "");
|
var options = JSON.parse(JSON.stringify(state.section.options))
|
||||||
setState(state => ({ ...state, changed: true, section: { ...state.section, options: [ ...state.section.options, option ] }}));
|
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 onOptionChange = (id: string, attrName: string, evt: ChangeEvent<HTMLInputElement>) => {
|
||||||
const target = evt.currentTarget;
|
const target = evt.currentTarget;
|
||||||
const value = target.hasOwnProperty('checked') ? target.checked : target.value;
|
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;
|
options[id][attrName] = value;
|
||||||
setState(state => ({ ...state, changed: true, section: { ...state.section, options: options }}));
|
setState(state => ({ ...state, changed: true, section: { ...state.section, options }}));
|
||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|
|
@ -7,7 +7,7 @@ export const QUERY_DECISION_SUPPORT_FILES = gql`
|
||||||
decisionSupportFiles(filter: $filter) {
|
decisionSupportFiles(filter: $filter) {
|
||||||
id,
|
id,
|
||||||
title,
|
title,
|
||||||
sections
|
sections,
|
||||||
createdAt,
|
createdAt,
|
||||||
closedAt,
|
closedAt,
|
||||||
votedAt,
|
votedAt,
|
||||||
|
@ -18,7 +18,7 @@ export const QUERY_DECISION_SUPPORT_FILES = gql`
|
||||||
members {
|
members {
|
||||||
id
|
id
|
||||||
}
|
}
|
||||||
}
|
},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
`;
|
`;
|
||||||
|
|
Loading…
Reference in New Issue