Merge manager tools into main cabinet

This commit is contained in:
Ruslan Bakiev
2026-04-03 19:01:22 +07:00
parent 541b264b95
commit 1c19b06451
21 changed files with 1483 additions and 77 deletions

View File

@@ -1,4 +1,7 @@
<script setup lang="ts">
import { useQuery } from '@vue/apollo-composable';
import { MeDocument } from '~/composables/graphql/generated';
type NavItem = {
to: string;
label: string;
@@ -6,11 +9,23 @@ type NavItem = {
const route = useRoute();
const { totalItems } = useClientCart();
const meQuery = useQuery(MeDocument);
const centerCapsule: NavItem[] = [
{ to: '/', label: 'Каталог' },
{ to: '/orders', label: 'Мои заказы' },
];
const centerCapsule = computed<NavItem[]>(() => {
const items: NavItem[] = [
{ to: '/', label: 'Каталог' },
{ to: '/orders', label: 'Мои заказы' },
];
if (meQuery.result.value?.me?.role === 'MANAGER') {
items.push(
{ to: '/clients', label: 'Клиенты' },
{ to: '/client-orders', label: 'Заказы клиентов' },
);
}
return items;
});
const rightCapsule: NavItem[] = [
{ to: '/cart', label: 'Корзина' },
@@ -24,6 +39,12 @@ function isActive(path: string) {
if (path === '/orders') {
return route.path === '/orders' || route.path.startsWith('/orders/');
}
if (path === '/clients') {
return route.path === '/clients' || route.path.startsWith('/clients/');
}
if (path === '/client-orders') {
return route.path === '/client-orders' || route.path.startsWith('/client-orders/');
}
return route.path === path;
}
</script>