From f901544cc29f2d48b8b9c298a283ec4b6012913e Mon Sep 17 00:00:00 2001 From: Mythily Mudunuru <102122005+mythilytm@users.noreply.github.com> Date: Fri, 8 Dec 2023 13:31:39 -0500 Subject: [PATCH] CHI-2453 fix edit sections (duplicate PR) (#1929) * fix: corrections to bug causing labels; chore:add cl prfileForm Sections * fix: edit page use of form details * translation: add profile translations * fix: corrections to bug causing labels; chore:add cl prfileForm Sections * cleanup: update nz form defintions * fix: clean up translations file * update cl profile section definition --------- Co-authored-by: Robert Bo Davis --- .../as/v1/profileForms/Sections.json | 19 +++++++++++-------- .../cl/v1/profileForms/Sections.json | 11 +++++++++++ .../nz/v1/profileForms/Sections.json | 19 +++++++++++-------- .../src/formDefinition/loadDefinition.ts | 4 ++-- .../src/formDefinition/types.ts | 5 +++-- .../src/components/profile/ProfileDetails.tsx | 17 +++++++++-------- .../profile/section/ProfileSectionEdit.tsx | 3 +-- .../profile/section/ProfileSectionView.tsx | 6 +++--- .../hooks/useProfileSectionTypes.ts | 4 ++-- .../src/translations/en-NZ/flexUI.json | 1 + .../src/translations/en-US/flexUI.json | 14 +++++++------- .../src/translations/es-CL/flexUI.json | 4 +++- 12 files changed, 64 insertions(+), 43 deletions(-) create mode 100644 hrm-form-definitions/form-definitions/cl/v1/profileForms/Sections.json diff --git a/hrm-form-definitions/form-definitions/as/v1/profileForms/Sections.json b/hrm-form-definitions/form-definitions/as/v1/profileForms/Sections.json index c12177c085..ed3f60b20b 100644 --- a/hrm-form-definitions/form-definitions/as/v1/profileForms/Sections.json +++ b/hrm-form-definitions/form-definitions/as/v1/profileForms/Sections.json @@ -1,26 +1,29 @@ [ { "name": "summary", - "label": "Summary ", + "label": "Summary", + "editLabel": "Edit Summary", "type": "textarea", "rows": 20, - "width": 300, - "placeholder": "Enter a summary of the case" + "width": 500, + "placeholder": "Enter a summary of the client" }, { - "name": "recommended approach", + "name": "recommendedApproach", "label": "Recommended Approach", + "editLabel": "Edit Recommended Approach", "type": "textarea", "rows": 20, - "width": 300, - "placeholder": "Enter recommended approach " + "width": 500, + "placeholder": "Enter recommended approach" }, { "name": "details", "label": "Details", + "editLabel": "Edit Details", "type": "textarea", "rows": 20, - "width": 300, + "width": 500, "placeholder": "Enter Details" } -] \ No newline at end of file +] diff --git a/hrm-form-definitions/form-definitions/cl/v1/profileForms/Sections.json b/hrm-form-definitions/form-definitions/cl/v1/profileForms/Sections.json new file mode 100644 index 0000000000..27d3135126 --- /dev/null +++ b/hrm-form-definitions/form-definitions/cl/v1/profileForms/Sections.json @@ -0,0 +1,11 @@ +[ + { + "name": "summary", + "label": "Summary", + "editLabel": "Edit Summary", + "type": "textarea", + "rows": 20, + "width": 500, + "placeholder": "Ingrese un resumen del cliente" + } +] diff --git a/hrm-form-definitions/form-definitions/nz/v1/profileForms/Sections.json b/hrm-form-definitions/form-definitions/nz/v1/profileForms/Sections.json index c12177c085..ed3f60b20b 100644 --- a/hrm-form-definitions/form-definitions/nz/v1/profileForms/Sections.json +++ b/hrm-form-definitions/form-definitions/nz/v1/profileForms/Sections.json @@ -1,26 +1,29 @@ [ { "name": "summary", - "label": "Summary ", + "label": "Summary", + "editLabel": "Edit Summary", "type": "textarea", "rows": 20, - "width": 300, - "placeholder": "Enter a summary of the case" + "width": 500, + "placeholder": "Enter a summary of the client" }, { - "name": "recommended approach", + "name": "recommendedApproach", "label": "Recommended Approach", + "editLabel": "Edit Recommended Approach", "type": "textarea", "rows": 20, - "width": 300, - "placeholder": "Enter recommended approach " + "width": 500, + "placeholder": "Enter recommended approach" }, { "name": "details", "label": "Details", + "editLabel": "Edit Details", "type": "textarea", "rows": 20, - "width": 300, + "width": 500, "placeholder": "Enter Details" } -] \ No newline at end of file +] diff --git a/hrm-form-definitions/src/formDefinition/loadDefinition.ts b/hrm-form-definitions/src/formDefinition/loadDefinition.ts index 8d670b6d3d..fc71b750a4 100644 --- a/hrm-form-definitions/src/formDefinition/loadDefinition.ts +++ b/hrm-form-definitions/src/formDefinition/loadDefinition.ts @@ -30,7 +30,7 @@ import { isSelectDefinitionWithReferenceOptions, LayoutVersion, CategoriesDefinition, - ProfileSection, + ProfileSectionDefinition, } from './types'; import { OneToManyConfigSpecs, OneToOneConfigSpec } from './insightsConfig'; @@ -197,7 +197,7 @@ export async function loadDefinition(baseUrl: string): Promise>('ReferenceData.json', {}), fetchDefinition('BlockedEmojis.json', []), - fetchDefinition('profileForms/Sections.json', []), + fetchDefinition('profileForms/Sections.json', []), ]); const { helplines } = helplineInformation; diff --git a/hrm-form-definitions/src/formDefinition/types.ts b/hrm-form-definitions/src/formDefinition/types.ts index 02c96cb087..7ecefe0fa1 100644 --- a/hrm-form-definitions/src/formDefinition/types.ts +++ b/hrm-form-definitions/src/formDefinition/types.ts @@ -188,9 +188,10 @@ type CustomContactComponentDefinition = ItemBase & props?: Record; }; -export declare type ProfileSection = { +export declare type ProfileSectionDefinition = { name: string; label: string; + editLabel: string; type: string; rows: number; placeholder: string; @@ -338,5 +339,5 @@ export type DefinitionVersion = { }; referenceData?: Record; blockedEmojis: string[]; - profileForms?: { Sections: ProfileSection[] }; + profileForms?: { Sections: ProfileSectionDefinition[] }; }; diff --git a/plugin-hrm-form/src/components/profile/ProfileDetails.tsx b/plugin-hrm-form/src/components/profile/ProfileDetails.tsx index 4264c374f1..d6e6f221c5 100644 --- a/plugin-hrm-form/src/components/profile/ProfileDetails.tsx +++ b/plugin-hrm-form/src/components/profile/ProfileDetails.tsx @@ -17,7 +17,7 @@ import React from 'react'; import { connect, ConnectedProps } from 'react-redux'; import { Icon, Template } from '@twilio/flex-ui'; -import { ProfileSection } from 'hrm-form-definitions'; +import { ProfileSectionDefinition } from 'hrm-form-definitions'; import { Box, HiddenText, Row, HorizontalLine } from '../../styles/HrmStyles'; import { newOpenModalAction } from '../../states/routing/actions'; @@ -37,8 +37,7 @@ import ProfileSectionView from './section/ProfileSectionView'; type OwnProps = ProfileCommonProps; type Section = { - titleCode?: string; - title?: string; + titleCode: string; renderComponent: () => React.ReactNode; handleEdit?: () => void; inInlineEditMode?: boolean; @@ -66,12 +65,12 @@ const ProfileDetails: React.FC = ({ profileId, task, openSectionEditModal }, ]; - const sectionTypesForms: ProfileSection[] = useProfileSectionTypes(); + const sectionTypesForms = useProfileSectionTypes(); const sectionSections: Section[] = sectionTypesForms.map(sectionType => ({ - title: `${sectionType.name}`, + titleCode: sectionType.label, renderComponent: () => , - handleEdit: () => openSectionEditModal(sectionType.label), + handleEdit: () => openSectionEditModal(sectionType.name), })); const renderEditButton = section => { @@ -86,7 +85,9 @@ const ProfileDetails: React.FC = ({ profileId, task, openSectionEditModal {icon && } {!icon &&