From b6859bf86341a0fae6c4aab44fc1ce4d38a758b9 Mon Sep 17 00:00:00 2001 From: Josmar Soares Trigueiro Junior Date: Thu, 13 Jun 2024 12:25:28 -0300 Subject: [PATCH 1/6] fix: its possible show more organization options according to the search --- react/components/UserWidget.tsx | 135 +++++++++++++++++--------------- 1 file changed, 74 insertions(+), 61 deletions(-) diff --git a/react/components/UserWidget.tsx b/react/components/UserWidget.tsx index 354eb482..375d9fcc 100644 --- a/react/components/UserWidget.tsx +++ b/react/components/UserWidget.tsx @@ -86,7 +86,9 @@ const CustomOrganizationOption = (props: any) => { return ( - {prefix} + + {prefix} + {match} {suffix} @@ -108,10 +110,8 @@ const CustomOrganizationOption = (props: any) => { disabled={value.status !== 'active'} >
- {renderOptionHighlightedText()} - {typeof value !== 'string' && ( -
{value.caption}
- )} + {renderOptionHighlightedText()} + {typeof value !== 'string' &&
{value.caption}
}
) @@ -285,6 +285,25 @@ const UserWidget: VtexFunctionComponent = ({ setOrganizationsState({ ...organizationsState, organizationInput: text, + organizationOptions: + userWidgetData?.getOrganizationsByEmail + ?.filter((organization: any) => { + return organization?.organizationName + ?.toLowerCase() + .includes(text?.toLowerCase()) + }) + .map( + (organization: { + orgId: string + organizationName: string + organizationStatus: string + }) => ({ + value: organization.orgId, + label: organization.organizationName, + status: organization.organizationStatus, + }) + ) + .slice(0, 15) ?? [], }) }, placeholder: `${formatMessage(storeMessages.autocompleteSearching)}...`, @@ -354,17 +373,10 @@ const UserWidget: VtexFunctionComponent = ({ organizationInput: userWidgetData?.getOrganizationByIdStorefront?.name, organizationOptions: userWidgetData?.getOrganizationsByEmail .slice(0, 15) - .map( - (organization: { - orgId: string - organizationName: string - organizationStatus: string - }) => ({ - value: organization.orgId, - label: organization.organizationName, - status: organization.organizationStatus, - }) - ), + .map((organization: { orgId: string; organizationName: string }) => ({ + value: organization.orgId, + label: organization.organizationName, + })), currentRoleName: userWidgetData?.getOrganizationsByEmail?.find( (organizations: any) => organizations.costId === currentCostCenter )?.role?.name, @@ -429,10 +441,17 @@ const UserWidget: VtexFunctionComponent = ({ (organization: { orgId: string }) => organization.orgId === itemSelected.value ) - .map((organization: { costId: string; costCenterName: string }) => ({ - value: organization.costId, - label: organization.costCenterName, - })) as [], + .map( + (organization: { + costId: string + costCenterName: string + organizationStatus: string + }) => ({ + value: organization.costId, + label: organization.costCenterName, + status: organization.organizationStatus, + }) + ) as [], }) }, } @@ -604,14 +623,12 @@ const UserWidget: VtexFunctionComponent = ({
- {(!userWidgetData?.checkImpersonation?.email && - organizationsState.organizationOptions.length > 1 && - showDropdown && ( - - )) || ( + {(!userWidgetData?.checkImpersonation?.email && showDropdown && ( + + )) || ( {`${formatMessage(messages.organization)} ${ userWidgetData?.getOrganizationByIdStorefront?.name @@ -625,14 +642,12 @@ const UserWidget: VtexFunctionComponent = ({
- {(!userWidgetData?.checkImpersonation?.email && - organizationsState.organizationOptions.length > 1 && - showDropdown && ( - - )) || ( + {(!userWidgetData?.checkImpersonation?.email && showDropdown && ( + + )) || ( {`${formatMessage(messages.costCenter)} ${ userWidgetData?.getCostCenterByIdStorefront?.name @@ -640,33 +655,31 @@ const UserWidget: VtexFunctionComponent = ({ )}
- {!userWidgetData?.checkImpersonation?.email && - organizationsState.organizationOptions.length > 1 && - showDropdown && ( -
+ + {errorOrganization && ( +
- {formatMessage(messages.setCurrentOrganization)} - - {errorOrganization && ( -
- -
- )} -
- )} + +
+ )} +
+ )}
From db098c061932ff616bd78c6a3ccdbf36b43547a6 Mon Sep 17 00:00:00 2001 From: Josmar Soares Trigueiro Junior Date: Thu, 13 Jun 2024 12:55:37 -0300 Subject: [PATCH 2/6] doc: update change log file --- react/components/UserWidget.tsx | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/react/components/UserWidget.tsx b/react/components/UserWidget.tsx index 375d9fcc..43fc2ab3 100644 --- a/react/components/UserWidget.tsx +++ b/react/components/UserWidget.tsx @@ -86,9 +86,7 @@ const CustomOrganizationOption = (props: any) => { return ( - - {prefix} - + {prefix} {match} {suffix} From e39a66d1d2014bdd7a0c781bdb23d887986a19ae Mon Sep 17 00:00:00 2001 From: Josmar Soares Trigueiro Junior Date: Thu, 20 Jun 2024 11:45:23 -0300 Subject: [PATCH 3/6] doc: update change log file --- CHANGELOG.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 492690af..d928ca27 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,6 +11,10 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0. ### Fixed +- Adjusts list organization and research screening according to input at autocomplete + +### Fixed + - Pagination bug on admin organization details collections assignment UI ### Added From 9e356388f9a2efdedc08f9026cbdd9a6b32de26d Mon Sep 17 00:00:00 2001 From: Everton Ataide Date: Thu, 20 Jun 2024 14:11:31 -0300 Subject: [PATCH 4/6] Update CHANGELOG --- CHANGELOG.md | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index d928ca27..741b188f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,13 +6,11 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html). ## [Unreleased] - -## [1.31.3] - 2024-04-22 - ### Fixed - Adjusts list organization and research screening according to input at autocomplete +## [1.31.3] - 2024-04-22 ### Fixed - Pagination bug on admin organization details collections assignment UI From 4aa4218d8f672cdca36add6791f9ca20d1159056 Mon Sep 17 00:00:00 2001 From: Everton Ataide Date: Thu, 20 Jun 2024 14:26:27 -0300 Subject: [PATCH 5/6] Update CHANGELOG --- CHANGELOG.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 741b188f..b8e455e1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,7 +10,9 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0. - Adjusts list organization and research screening according to input at autocomplete + ## [1.31.3] - 2024-04-22 + ### Fixed - Pagination bug on admin organization details collections assignment UI From bf2e75932e90af7d61083c80701ffbe62b984048 Mon Sep 17 00:00:00 2001 From: Everton Ataide Date: Thu, 20 Jun 2024 14:29:43 -0300 Subject: [PATCH 6/6] Update CHANGELOG --- CHANGELOG.md | 6 ------ 1 file changed, 6 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index b8e455e1..fa9f9f23 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,12 +9,6 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0. ### Fixed - Adjusts list organization and research screening according to input at autocomplete - - -## [1.31.3] - 2024-04-22 - -### Fixed - - Pagination bug on admin organization details collections assignment UI ### Added