Skip to content
Snippets Groups Projects
Commit e1b71f6d authored by Timothee P's avatar Timothee P :sunflower:
Browse files

preven

t same options and allow more than 2 options
parent 37419563
No related branches found
No related tags found
1 merge request!118REDMINE_ISSUE-12064
......@@ -231,13 +231,23 @@ export default {
},
// * create an array, because backend expects an array
set(newValue) {
this.form.options.errors = [];
this.form.options.value = this.trimWhiteSpace(newValue).split(",");
this.updateStore();
if (this.hasDuplicates(this.form.options.value)) {
this.form.options.errors = [
"Veuillez saisir des valeurs différentes",
];
} else {
this.updateStore();
}
},
},
},
methods: {
hasDuplicates(array) {
return new Set(array).size !== array.length;
},
fillCustomFormData(customFormData) {
for (let el in customFormData) {
if (el && this.form[el] && customFormData[el]) {
......
......@@ -277,10 +277,10 @@ export default {
set(newValue) {
console.log(newValue);
const newColorsStyle = {
colors: {
[newValue.options[0]]: "#000000",
[newValue.options[1]]: "#000000",
},
colors: newValue.options.reduce((obj, key) => {
obj[key] = "#000000";
return obj;
}, {}),
custom_field_name: newValue.value,
};
this.form.colors_style.value = newColorsStyle;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment