Use top-level manager tabs only
This commit is contained in:
35
app/app.vue
35
app/app.vue
@@ -44,12 +44,17 @@ const managerPageTabs = computed(() => {
|
||||
];
|
||||
}
|
||||
|
||||
if (route.path === '/bonus-system') {
|
||||
if (route.path === '/bonus-system' || route.path.startsWith('/bonus-system/')) {
|
||||
return [
|
||||
{
|
||||
key: 'balances',
|
||||
label: 'Балансы',
|
||||
active: route.query.tab !== 'withdrawals' && route.query.tab !== 'products' && route.query.tab !== 'manager',
|
||||
active: route.path !== '/bonus-system/withdrawals'
|
||||
&& !route.path.startsWith('/bonus-system/withdrawals/')
|
||||
&& route.query.tab !== 'withdrawals'
|
||||
&& route.query.tab !== 'rewards'
|
||||
&& route.query.tab !== 'products'
|
||||
&& route.query.tab !== 'manager',
|
||||
to: {
|
||||
path: '/bonus-system',
|
||||
query: {
|
||||
@@ -61,7 +66,9 @@ const managerPageTabs = computed(() => {
|
||||
{
|
||||
key: 'withdrawals',
|
||||
label: 'Заявки на выплату',
|
||||
active: route.query.tab === 'withdrawals',
|
||||
active: route.path === '/bonus-system/withdrawals'
|
||||
|| route.path.startsWith('/bonus-system/withdrawals/')
|
||||
|| route.query.tab === 'withdrawals',
|
||||
to: {
|
||||
path: '/bonus-system',
|
||||
query: {
|
||||
@@ -71,20 +78,34 @@ const managerPageTabs = computed(() => {
|
||||
},
|
||||
},
|
||||
{
|
||||
key: 'products',
|
||||
label: 'Товары',
|
||||
active: route.query.tab === 'products' || route.query.tab === 'manager',
|
||||
key: 'rewards',
|
||||
label: 'Вознаграждения',
|
||||
active: route.query.tab === 'rewards' || route.query.tab === 'products' || route.query.tab === 'manager',
|
||||
to: {
|
||||
path: '/bonus-system',
|
||||
query: {
|
||||
...route.query,
|
||||
tab: 'products',
|
||||
tab: 'rewards',
|
||||
},
|
||||
},
|
||||
},
|
||||
];
|
||||
}
|
||||
|
||||
if (route.path === '/messages') {
|
||||
return [
|
||||
{
|
||||
key: 'messages',
|
||||
label: 'Сообщения',
|
||||
active: true,
|
||||
to: {
|
||||
path: '/messages',
|
||||
query: {},
|
||||
},
|
||||
},
|
||||
];
|
||||
}
|
||||
|
||||
return [];
|
||||
});
|
||||
</script>
|
||||
|
||||
@@ -29,7 +29,6 @@ type ProductCard = {
|
||||
};
|
||||
|
||||
const route = useRoute();
|
||||
const router = useRouter();
|
||||
const search = ref('');
|
||||
const balancesQuery = useQuery(ManagerBonusBalancesDocument);
|
||||
const referralLinksQuery = useQuery(ManagerReferralLinksDocument);
|
||||
@@ -222,24 +221,6 @@ const WITHDRAWAL_DATE_FORMATTER = new Intl.DateTimeFormat('ru-RU', {
|
||||
minute: '2-digit',
|
||||
});
|
||||
|
||||
const bonusTabs = computed<Array<{ id: 'balances' | 'withdrawals' | 'rewards'; label: string }>>(() => [
|
||||
{ id: 'balances', label: 'Балансы' },
|
||||
{ id: 'withdrawals', label: 'Выплаты' },
|
||||
{ id: 'rewards', label: 'Вознаграждения' },
|
||||
]);
|
||||
|
||||
function setActiveTab(tab: 'balances' | 'withdrawals' | 'rewards') {
|
||||
const query = { ...route.query };
|
||||
|
||||
if (tab === 'balances') {
|
||||
delete query.tab;
|
||||
} else {
|
||||
query.tab = tab;
|
||||
}
|
||||
|
||||
void router.replace({ query });
|
||||
}
|
||||
|
||||
function userInitials(fullName: string) {
|
||||
const parts = fullName
|
||||
.trim()
|
||||
@@ -323,23 +304,6 @@ function productVisualLabel(product: ProductCard) {
|
||||
: 'Название или номинал'"
|
||||
/>
|
||||
|
||||
<div class="surface-card rounded-3xl p-2">
|
||||
<div class="flex flex-wrap gap-2">
|
||||
<button
|
||||
v-for="tab in bonusTabs"
|
||||
:key="tab.id"
|
||||
type="button"
|
||||
class="rounded-full px-4 py-2 text-sm font-semibold transition"
|
||||
:class="activeTab === tab.id
|
||||
? 'bg-[#123824] text-white'
|
||||
: 'bg-[#eef7f1] text-[#355947] hover:bg-[#e3f1e8]'"
|
||||
@click="setActiveTab(tab.id)"
|
||||
>
|
||||
{{ tab.label }}
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<template v-if="activeTab === 'balances'">
|
||||
<div v-if="balancesQuery.loading.value || referralLinksQuery.loading.value || usersQuery.loading.value" class="manager-empty-state">
|
||||
Загружаем балансы...
|
||||
|
||||
@@ -37,14 +37,6 @@ function channelLabel(channel: TemplateChannel['channel']) {
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<div class="surface-card rounded-3xl p-2">
|
||||
<div class="flex flex-wrap gap-2">
|
||||
<span class="rounded-full bg-[#123824] px-4 py-2 text-sm font-semibold text-white">
|
||||
Сообщения
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div v-if="templatesQuery.loading.value" class="manager-empty-state">
|
||||
Загружаем шаблоны...
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user