|
|
@ -269,29 +269,24 @@ export class EntityAutocompleteComponent implements ControlValueAccessor, OnInit |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
); |
|
|
); |
|
|
} else { |
|
|
} else if (value.entityType && value.id) { |
|
|
const targetEntityType = this.checkEntityType(value.entityType); |
|
|
const targetEntityType = this.checkEntityType(value.entityType); |
|
|
if (value.id) { |
|
|
this.entityService.getEntity(targetEntityType, value.id, {ignoreLoading: true, ignoreErrors: true}).subscribe( |
|
|
this.entityService.getEntity(targetEntityType, value.id, {ignoreLoading: true, ignoreErrors: true}).subscribe( |
|
|
(entity) => { |
|
|
(entity) => { |
|
|
this.modelValue = entity.id.id; |
|
|
this.modelValue = entity.id.id; |
|
|
this.selectEntityFormGroup.get('entity').patchValue(entity, {emitEvent: false}); |
|
|
this.selectEntityFormGroup.get('entity').patchValue(entity, {emitEvent: false}); |
|
|
}, |
|
|
}, |
|
|
() => { |
|
|
() => { |
|
|
this.modelValue = null; |
|
|
this.modelValue = null; |
|
|
this.selectEntityFormGroup.get('entity').patchValue('', {emitEvent: false}); |
|
|
this.selectEntityFormGroup.get('entity').patchValue('', {emitEvent: false}); |
|
|
if (value !== null) { |
|
|
if (value !== null) { |
|
|
this.propagateChange(this.modelValue); |
|
|
this.propagateChange(this.modelValue); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
} |
|
|
); |
|
|
|
|
|
} else { |
|
|
|
|
|
this.modelValue = null; |
|
|
|
|
|
this.selectEntityFormGroup.get('entity').patchValue('', {emitEvent: false}); |
|
|
|
|
|
if (value !== null) { |
|
|
|
|
|
this.propagateChange(this.modelValue); |
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
); |
|
|
|
|
|
} else { |
|
|
|
|
|
this.modelValue = null; |
|
|
|
|
|
this.selectEntityFormGroup.get('entity').patchValue('', {emitEvent: false}); |
|
|
} |
|
|
} |
|
|
} else { |
|
|
} else { |
|
|
this.modelValue = null; |
|
|
this.modelValue = null; |
|
|
|