INSR-7930 Implement Client Possessive logic
This commit is contained in:
parent
0f9922e38d
commit
fd8e8ec3fc
4 changed files with 27 additions and 0 deletions
|
|
@ -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`
|
||||
}
|
||||
|
|
@ -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);
|
||||
|
|
|
|||
|
|
@ -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) {
|
||||
|
|
|
|||
|
|
@ -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.
|
||||
|
|
|
|||
Loading…
Reference in a new issue