diff --git a/app/javascript/dashboard/components/CustomAttribute.vue b/app/javascript/dashboard/components/CustomAttribute.vue index a6bbbcf18..8f70a9fa2 100644 --- a/app/javascript/dashboard/components/CustomAttribute.vue +++ b/app/javascript/dashboard/components/CustomAttribute.vue @@ -49,12 +49,12 @@ export default { if (this.isAttributeTypeDate) { return this.value ? new Date(this.value || new Date()).toLocaleDateString() - : ''; + : '---'; } if (this.isAttributeTypeCheckbox) { return this.value === 'false' ? false : this.value; } - return this.value; + return this.hasValue ? this.value : '---'; }, formattedValue() { return this.isAttributeTypeDate @@ -83,6 +83,9 @@ export default { isAttributeTypeDate() { return this.attributeType === 'date'; }, + hasValue() { + return this.value !== null && this.value !== ''; + }, urlValue() { return isValidURL(this.value) ? this.value : '---'; }, @@ -223,7 +226,7 @@ export default { /> - {{ displayValue || '---' }} + {{ displayValue }}

customAttributes.value, attribute.attribute_key ); - const isCheckbox = attribute.attribute_display_type === 'checkbox'; - const defaultValue = isCheckbox ? false : ''; return { ...attribute, type: 'custom_attribute', key: attribute.attribute_key, - // Set value from customAttributes if it exists, otherwise use default value - value: hasValue - ? customAttributes.value[attribute.attribute_key] - : defaultValue, + // Set value from customAttributes if it exists, otherwise use '' + value: hasValue ? customAttributes.value[attribute.attribute_key] : '', }; }) ); @@ -215,7 +211,7 @@ const onUpdate = async (key, value) => { } else { store.dispatch('contacts/update', { id: props.contactId, - custom_attributes: updatedAttributes, + customAttributes: updatedAttributes, }); } useAlert(t('CUSTOM_ATTRIBUTES.FORM.UPDATE.SUCCESS'));