diff --git a/src/helpers/text-helper.js b/src/helpers/text-helper.js index 1b54084f..379fa56e 100644 --- a/src/helpers/text-helper.js +++ b/src/helpers/text-helper.js @@ -133,3 +133,20 @@ export function formatDate(date, formatter) { } return ''; } + +/** + * @function toPossessive + * @param {string | null} input + * @returns {string} + */ +export function toPossessive(input) { + if (input == null || input.trim().length === 0) { + return input; + } + + if (input.toLowerCase().endsWith("s")) { + return `${input}'` + } + + return `${input}'s` +} \ No newline at end of file diff --git a/src/layouts/entry-page/entry-page.spec.js b/src/layouts/entry-page/entry-page.spec.js index afa28c8d..ee238737 100644 --- a/src/layouts/entry-page/entry-page.spec.js +++ b/src/layouts/entry-page/entry-page.spec.js @@ -144,6 +144,7 @@ describe('entry-page.vue', () => { TPAEnabled: true, ClientFullName: 'Full Name', ClientDisplayName: 'Display Name', + ClientPossessiveName: 'Display Name\'s', ClaimRegistrationRequired: true, EnableNoCompQuote: true }) @@ -153,6 +154,7 @@ describe('entry-page.vue', () => { expect(issConfig.clientName).toBe('TestClient'); expect(issConfig.clientFullName).toBe('Full Name'); expect(issConfig.clientDisplayName).toBe('Display Name'); + expect(issConfig.clientPossessiveName).toBe('Display Name\'s'); expect(issConfig.parentAccountNumber).toBe('12345'); expect(issConfig.styleSheet).toBe('test-style'); expect(issConfig.isCoverageEnabled).toBe(true); diff --git a/src/layouts/entry-page/entry-page.vue b/src/layouts/entry-page/entry-page.vue index 3918dc33..e9880117 100644 --- a/src/layouts/entry-page/entry-page.vue +++ b/src/layouts/entry-page/entry-page.vue @@ -14,6 +14,7 @@ import { getISSCookie, updateOrCreateISSCookie } from '@/helpers/cookie-helper.j import { useMainStore } from '@/store'; import showIssLoadingModal from '@/helpers/loading-modal-helper'; import applicationConfig from '@/constants/application-config'; +import { toPossessive } from '@/helpers/text-helper'; export default { name: 'entry-page', @@ -144,6 +145,7 @@ export default { this.mainStore.issConfig.clientName = data.accountName; this.mainStore.issConfig.clientFullName = data.accountName; // Defaults to use the client name. this.mainStore.issConfig.clientDisplayName = data.accountName; // Defaults to use the client name. + this.mainStore.issConfig.clientPossessiveName = toPossessive(data.accountName); // Defaults to use the client name. this.mainStore.issConfig.parentAccountNumber = data.parentAccountNumber; this.mainStore.issConfig.styleSheet = data.styleSheet; this.mainStore.issConfig.isCoverageEnabled = data.coverageEnabled; @@ -163,6 +165,11 @@ export default { if (clientFlags.ClientDisplayName != null) { this.mainStore.issConfig.clientDisplayName = clientFlags.ClientDisplayName; + this.mainStore.issConfig.clientPossessiveName = toPossessive(clientFlags.ClientDisplayName); + } + + if (clientFlags.ClientPossessiveName != null) { + this.mainStore.issConfig.clientPossessiveName = clientFlags.ClientPossessiveName; } if (clientFlags.ClaimRegistrationRequired) { diff --git a/src/store/index.js b/src/store/index.js index 74c3deb0..676fadb7 100644 --- a/src/store/index.js +++ b/src/store/index.js @@ -247,6 +247,7 @@ export const getDefaultState = () => ({ clientName: 'Generic Insurance', // this is the default and will be overriden by the client's name clientFullName: 'Generic Insurance', // this is the default and will be overriden by the client's name or client's full name. clientDisplayName: 'Generic Insurance', // this is the default and will be overridden by the client's name or client display name. + clientPossessiveName: 'Generic Insurance\'s', // this is the default and will be overridden by the client's name or client display name converted to possessive or the clients possessive name. clientHeader: {}, styleSheet: '', // Stylesheet used by the client. parentAccountNumber: 0, // Parent account number used by the client.