diff --git a/app/components/navigation/MainNavigation.vue b/app/components/navigation/MainNavigation.vue
index 0b25d1a..78c8052 100644
--- a/app/components/navigation/MainNavigation.vue
+++ b/app/components/navigation/MainNavigation.vue
@@ -42,6 +42,30 @@
>
{{ $t('cabinetNav.cabinet') }}
+
+
+
+
+
+
@@ -53,28 +77,34 @@
-
- {{ $t('cabinetNav.orders') }}
-
-
- {{ $t('cabinetNav.myOffers') }}
-
-
- {{ $t('cabinetNav.addresses') }}
-
+
+
+
+ {{ $t('cabinetNav.orders') }}
+
+
+ {{ $t('cabinetNav.addresses') }}
+
+
+
+
+
+
+ {{ $t('cabinetNav.myOffers') }}
+
+
@@ -330,6 +360,10 @@ const props = withDefaults(defineProps<{
teams?: Array<{ id?: string; name?: string; logtoOrgId?: string }>
} | null
isSeller?: boolean
+ // Role switching props
+ hasBuyerTeam?: boolean
+ hasSellerTeam?: boolean
+ currentRole?: string
// Search props
activeTokens?: Array<{ type: string; id: string; label: string; icon: string }>
availableChips?: Array<{ type: string; label: string }>
@@ -361,6 +395,7 @@ defineEmits([
'sign-out',
'sign-in',
'switch-team',
+ 'switch-role',
// Search events
'start-select',
'cancel-select',
diff --git a/app/layouts/topnav.vue b/app/layouts/topnav.vue
index cb602ef..45763d6 100644
--- a/app/layouts/topnav.vue
+++ b/app/layouts/topnav.vue
@@ -17,6 +17,9 @@
:theme="theme"
:user-data="userData"
:is-seller="isSeller"
+ :has-buyer-team="hasBuyerTeam"
+ :has-seller-team="hasSellerTeam"
+ :current-role="currentRole"
:active-tokens="activeTokens"
:available-chips="availableChips"
:select-mode="selectMode"
@@ -36,6 +39,7 @@
@sign-out="onClickSignOut"
@sign-in="signIn()"
@switch-team="switchToTeam"
+ @switch-role="switchToRole"
@start-select="startSelect"
@cancel-select="cancelSelect"
@edit-token="editFilter"
@@ -129,7 +133,7 @@ const userData = useState<{
avatarId?: string
activeTeam?: { name?: string; teamType?: string; logtoOrgId?: string; selectedLocation?: SelectedLocation | null }
activeTeamId?: string
- teams?: Array<{ id?: string; name?: string; logtoOrgId?: string }>
+ teams?: Array<{ id?: string; name?: string; logtoOrgId?: string; teamType?: string }>
} | null>('me', () => null)
const sessionChecked = ref(false)
@@ -140,6 +144,19 @@ const isSeller = computed(() => {
return userData.value?.activeTeam?.teamType === 'SELLER'
})
+// Role switching support
+const buyerTeam = computed(() =>
+ userData.value?.teams?.find(t => t?.teamType === 'BUYER')
+)
+const sellerTeam = computed(() =>
+ userData.value?.teams?.find(t => t?.teamType === 'SELLER')
+)
+const hasBuyerTeam = computed(() => !!buyerTeam.value)
+const hasSellerTeam = computed(() => !!sellerTeam.value)
+const currentRole = computed(() =>
+ userData.value?.activeTeam?.teamType || 'BUYER'
+)
+
const isLoggedIn = computed(() => loggedIn.value || !!userData.value?.id)
const userName = computed(() => {
@@ -252,7 +269,7 @@ watch(userData, () => {
await fetchSession().catch(() => {})
sessionChecked.value = true
-const switchToTeam = async (team: { id?: string; logtoOrgId?: string; name?: string }) => {
+const switchToTeam = async (team: { id?: string; logtoOrgId?: string; name?: string; teamType?: string }) => {
if (!team?.id) return
try {
@@ -271,6 +288,20 @@ const switchToTeam = async (team: { id?: string; logtoOrgId?: string; name?: str
}
}
+const switchToRole = async (role: 'BUYER' | 'SELLER') => {
+ const targetTeam = role === 'SELLER' ? sellerTeam.value : buyerTeam.value
+ if (targetTeam?.id) {
+ await switchToTeam(targetTeam)
+ // Redirect to appropriate page when in client area
+ if (isClientArea.value) {
+ const targetPath = role === 'SELLER'
+ ? '/clientarea/offers'
+ : '/clientarea/orders'
+ await navigateTo(localePath(targetPath))
+ }
+ }
+}
+
const onClickSignOut = () => {
signOut(siteUrl)
}
diff --git a/i18n/locales/en/cabinetNav.json b/i18n/locales/en/cabinetNav.json
index d2e3df6..e9548fa 100644
--- a/i18n/locales/en/cabinetNav.json
+++ b/i18n/locales/en/cabinetNav.json
@@ -14,6 +14,10 @@
"seller": "Seller",
"suppliers": "Suppliers",
"hubs": "Hubs",
- "ai": "AI assistant"
+ "ai": "AI assistant",
+ "roles": {
+ "client": "I'm a client",
+ "seller": "I'm a seller"
+ }
}
}
diff --git a/i18n/locales/ru/cabinetNav.json b/i18n/locales/ru/cabinetNav.json
index c9f667f..142c6cd 100644
--- a/i18n/locales/ru/cabinetNav.json
+++ b/i18n/locales/ru/cabinetNav.json
@@ -14,6 +14,10 @@
"seller": "Продавец",
"suppliers": "Поставщики",
"hubs": "Хабы",
- "ai": "AI ассистент"
+ "ai": "AI ассистент",
+ "roles": {
+ "client": "Я клиент",
+ "seller": "Я продавец"
+ }
}
}