Support super manager access
This commit is contained in:
@@ -2,9 +2,9 @@
|
||||
import { useQuery } from '@vue/apollo-composable';
|
||||
import {
|
||||
ManagerBonusBalancesDocument,
|
||||
ReferralStatsDocument,
|
||||
ManagerWithdrawalRequestsDocument,
|
||||
type ManagerBonusBalancesQuery,
|
||||
type ReferralStatsQuery,
|
||||
type ManagerWithdrawalRequestsQuery,
|
||||
} from '~/composables/graphql/generated';
|
||||
|
||||
definePageMeta({
|
||||
@@ -12,14 +12,16 @@ definePageMeta({
|
||||
});
|
||||
|
||||
type BalanceItem = ManagerBonusBalancesQuery['managerBonusBalances'][number];
|
||||
type WithdrawalItem = ReferralStatsQuery['referralStats']['pendingWithdrawals'][number];
|
||||
type WithdrawalItem = ManagerWithdrawalRequestsQuery['managerWithdrawalRequests'][number];
|
||||
|
||||
const route = useRoute();
|
||||
const router = useRouter();
|
||||
const search = ref('');
|
||||
|
||||
const balancesQuery = useQuery(ManagerBonusBalancesDocument);
|
||||
const bonusQuery = useQuery(ReferralStatsDocument);
|
||||
const withdrawalsQuery = useQuery(ManagerWithdrawalRequestsDocument, {
|
||||
status: 'PENDING',
|
||||
});
|
||||
|
||||
const activeTab = computed<'balances' | 'withdrawals'>(() => (
|
||||
route.query.tab === 'withdrawals' ? 'withdrawals' : 'balances'
|
||||
@@ -35,7 +37,7 @@ function setTab(tab: 'balances' | 'withdrawals') {
|
||||
}
|
||||
|
||||
const balances = computed<BalanceItem[]>(() => balancesQuery.result.value?.managerBonusBalances ?? []);
|
||||
const withdrawals = computed<WithdrawalItem[]>(() => bonusQuery.result.value?.referralStats.pendingWithdrawals ?? []);
|
||||
const withdrawals = computed<WithdrawalItem[]>(() => withdrawalsQuery.result.value?.managerWithdrawalRequests ?? []);
|
||||
|
||||
const filteredBalances = computed(() => {
|
||||
const query = search.value.trim().toLowerCase();
|
||||
@@ -67,7 +69,9 @@ const filteredWithdrawals = computed(() => {
|
||||
}
|
||||
|
||||
return [
|
||||
item.requesterId,
|
||||
item.requesterFullName,
|
||||
item.requesterEmail,
|
||||
item.companyName || '',
|
||||
String(item.amount),
|
||||
item.status,
|
||||
item.reviewComment || '',
|
||||
@@ -133,7 +137,7 @@ const filteredWithdrawals = computed(() => {
|
||||
</template>
|
||||
|
||||
<template v-else>
|
||||
<div v-if="bonusQuery.loading.value" class="manager-empty-state">
|
||||
<div v-if="withdrawalsQuery.loading.value" class="manager-empty-state">
|
||||
Загружаем заявки...
|
||||
</div>
|
||||
<div v-else-if="filteredWithdrawals.length === 0" class="manager-empty-state">
|
||||
@@ -147,7 +151,9 @@ const filteredWithdrawals = computed(() => {
|
||||
>
|
||||
<div class="flex flex-col gap-3 md:flex-row md:items-start md:justify-between">
|
||||
<div class="space-y-1">
|
||||
<p class="text-sm font-semibold text-[#123824]">Пользователь: {{ withdrawal.requesterId }}</p>
|
||||
<p class="text-sm font-semibold text-[#123824]">{{ withdrawal.requesterFullName }}</p>
|
||||
<p class="text-sm text-[#355947]">{{ withdrawal.requesterEmail }}</p>
|
||||
<p v-if="withdrawal.companyName" class="text-sm text-[#355947]">{{ withdrawal.companyName }}</p>
|
||||
<p class="text-sm text-[#355947]">Сумма: {{ withdrawal.amount }}</p>
|
||||
<p class="text-xs text-[#5c7b69]">{{ new Date(withdrawal.createdAt).toLocaleString() }}</p>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user