Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(header): move company roles into enum #1213

Merged
merged 4 commits into from
Oct 16, 2024
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@
- **Service Subscriptions**

- rename 'Configure' button to 'Activate' button [#1150](https://github.com/eclipse-tractusx/portal-frontend/pull/1150)
- **Header**
- moved company roles into enum [#1213](https://github.com/eclipse-tractusx/portal-frontend/pull/1213)
- **Application Request**
- add separate end points for downloading company credential document and registration document [#1229](https://github.com/eclipse-tractusx/portal-frontend/pull/1229)
- **Business Partner Invitation**
Expand Down
13 changes: 10 additions & 3 deletions src/components/shared/frame/Header/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,10 @@ import RegistrationReviewOverlay from './RegistrationReviewOverlay'
import './Header.scss'
import RegistrationReviewContent from './RegistrationReviewOverlay/RegistrationReviewContent'
import RegistrationDeclinedOverlay from './RegistrationDeclinedOverlay'
import { useFetchOwnCompanyDetailsQuery } from 'features/admin/userApiSlice'
import {
CompanyRoleEnum,
useFetchOwnCompanyDetailsQuery,
} from 'features/admin/userApiSlice'
import { PAGES } from 'types/Constants'

export const Header = ({
Expand Down Expand Up @@ -80,13 +83,17 @@ export const Header = ({
useEffect(() => {
if (!(companyData && companyDetails)) return
setSubmittedOverlayOpen(
!companyDetails?.companyRole.includes('OPERATOR') &&
!companyDetails?.companyRole.includes(CompanyRoleEnum.OPERATOR) &&
companyData?.applicationStatus === ApplicationStatus.SUBMITTED
)
}, [companyData, companyDetails])

useEffect(() => {
if (companyDetails?.companyRole.includes('ONBOARDING_SERVICE_PROVIDER')) {
if (
companyDetails?.companyRole.includes(
CompanyRoleEnum.ONBOARDING_SERVICE_PROVIDER
)
) {
setPages(user)
} else {
setPages(
Expand Down
2 changes: 2 additions & 0 deletions src/features/admin/userApiSlice.ts
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,8 @@ export type AdminData = {
export enum CompanyRoleEnum {
APP_PROVIDER = 'APP_PROVIDER',
SERVICE_PROVIDER = 'SERVICE_PROVIDER',
ONBOARDING_SERVICE_PROVIDER = 'ONBOARDING_SERVICE_PROVIDER',
OPERATOR = 'OPERATOR',
}

export interface CompanyDetails {
Expand Down
Loading