Skip to content
Snippets Groups Projects

Revert "refactorate prerecordedfield initialization & reinit in fast edition mode"

Merged Timothee P requested to merge revert-ee1cc30f into develop
1 file
+ 16
27
Compare changes
  • Side-by-side
  • Inline
@@ -375,15 +375,9 @@ export default {
},
watch: {
'field.value': function(newValue, oldValue) {
'field.value': function(newValue) {
if (newValue) {
this.error = null;
// In fast edition, prerecordedlist is not updated, thus the value stay the same
// in this case we renitialize the field. This doesn't impact usual behavior if user reselect the same option
if (this.field.field_type === 'pre_recorded_list' &&
newValue.label && newValue.label === oldValue.label) {
this.initPrerecordedField();
}
}
},
@@ -404,9 +398,22 @@ export default {
created() {
if (this.field) {
const { field_type, value } = this.field;
const { field_type, options, value } = this.field;
if (field_type === 'pre_recorded_list') {
this.initPrerecordedField();
this.loadingPrerecordedListValues = true;
this.GET_SELECTED_PRERECORDED_LIST_VALUES({
name: options[0],
pattern: ''
})
.then(() => {
this.loadingPrerecordedListValues = false;
})
.catch(() => {
this.loadingPrerecordedListValues = false;
});
if (value) {
this.selectedPrerecordedValue = { label: value.label ? value.label : value };
}
} else if (field_type === 'multi_choices_list' && value) {
this.selectedMultipleCheckbox = value;
}
@@ -429,24 +436,6 @@ export default {
'SET_EXTRA_FORMS',
]),
initPrerecordedField() {
const { options, value } = this.field;
this.loadingPrerecordedListValues = true;
this.GET_SELECTED_PRERECORDED_LIST_VALUES({
name: options[0],
pattern: ''
})
.then(() => {
this.loadingPrerecordedListValues = false;
})
.catch(() => {
this.loadingPrerecordedListValues = false;
});
if (value) {
this.selectedPrerecordedValue = { label: value.label ? value.label : value };
}
},
updateStore_extra_form(evt) {
if (this.field) {
let newValue;
Loading