From 1b546122c5c2e96498108a97eac4a0bf313faf0e Mon Sep 17 00:00:00 2001 From: Kristian Garza Date: Mon, 11 May 2020 17:29:40 +0200 Subject: [PATCH 1/2] fix: :bug: enable setting values for when nametype is not devined/unknown --- app/components/person-base-component.js | 48 ++++++++++++++----------- 1 file changed, 28 insertions(+), 20 deletions(-) diff --git a/app/components/person-base-component.js b/app/components/person-base-component.js index c101c8490..9da128b2a 100644 --- a/app/components/person-base-component.js +++ b/app/components/person-base-component.js @@ -58,27 +58,35 @@ export default Component.extend({ this.set('isReadonlyNameParts', false); this.set('isReadonlyNameType', false); } + switch (true) { + case this.fragment.get('nameType') === 'Personal': + this.set('isReadonly', true); - if (this.fragment.get('nameType') === 'Personal') { - this.set('isReadonly', true); - - this.fragment.set('givenName', options.givenName); - this.fragment.set('familyName', options.familyName); - - if (options.givenName && options.familyName) { - this.fragment.set('name', options.familyName + ', ' + options.givenName); - } else if (options.givenName) { - this.fragment.set('name', options.givenName); - } else if (options.familyName) { - this.fragment.set('name', options.familyName); - } else { - this.fragment.set('name', ''); - } - } else { - this.fragment.set('givenName', null); - this.fragment.set('familyName', null); - this.fragment.set('name', options.name); - this.set('isReadonly', false); + this.fragment.set('givenName', options.givenName); + this.fragment.set('familyName', options.familyName); + + if (options.givenName && options.familyName) { + this.fragment.set('name', options.familyName + ', ' + options.givenName); + } else if (options.givenName) { + this.fragment.set('name', options.givenName); + } else if (options.familyName) { + this.fragment.set('name', options.familyName); + } else { + this.fragment.set('name', ''); + } + return true; + case this.fragment.get('nameType') === 'Organizational': + this.fragment.set('givenName', null); + this.fragment.set('familyName', null); + this.fragment.set('name', options.name); + this.set('isReadonly', false); + return true; + default: + this.fragment.set('givenName', options.givenName); + this.fragment.set('familyName', options.familyName); + this.fragment.set('name', options.name); + this.set('isReadonly', false); + return true; } }, selectNameType(value) { From 9f646cebb8b687e78a4ee9b6cb2dbf53a58d6cc7 Mon Sep 17 00:00:00 2001 From: Kristian Garza Date: Mon, 11 May 2020 18:10:09 +0200 Subject: [PATCH 2/2] lint space --- app/components/person-base-component.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/components/person-base-component.js b/app/components/person-base-component.js index 9da128b2a..edab9ca9a 100644 --- a/app/components/person-base-component.js +++ b/app/components/person-base-component.js @@ -64,7 +64,7 @@ export default Component.extend({ this.fragment.set('givenName', options.givenName); this.fragment.set('familyName', options.familyName); - + if (options.givenName && options.familyName) { this.fragment.set('name', options.familyName + ', ' + options.givenName); } else if (options.givenName) {