Support super manager access
This commit is contained in:
@@ -1,8 +1,9 @@
|
||||
<script setup lang="ts">
|
||||
import { useMutation, useQuery } from '@vue/apollo-composable';
|
||||
import {
|
||||
ReferralStatsDocument,
|
||||
ManagerWithdrawalRequestsDocument,
|
||||
ReviewRewardWithdrawalDocument,
|
||||
type ManagerWithdrawalRequestsQuery,
|
||||
} from '~/composables/graphql/generated';
|
||||
|
||||
definePageMeta({
|
||||
@@ -11,8 +12,11 @@ definePageMeta({
|
||||
|
||||
const route = useRoute();
|
||||
const withdrawalId = computed(() => String(route.params.id || ''));
|
||||
type WithdrawalItem = ManagerWithdrawalRequestsQuery['managerWithdrawalRequests'][number];
|
||||
|
||||
const bonusQuery = useQuery(ReferralStatsDocument);
|
||||
const withdrawalsQuery = useQuery(ManagerWithdrawalRequestsDocument, {
|
||||
status: null,
|
||||
});
|
||||
const reviewMutation = useMutation(ReviewRewardWithdrawalDocument);
|
||||
|
||||
const decision = ref<'APPROVE' | 'REJECT'>('APPROVE');
|
||||
@@ -20,7 +24,7 @@ const reviewComment = ref('');
|
||||
const reviewResult = ref('');
|
||||
|
||||
const currentWithdrawal = computed(() =>
|
||||
(bonusQuery.result.value?.referralStats.pendingWithdrawals ?? []).find((item) => item.id === withdrawalId.value),
|
||||
(withdrawalsQuery.result.value?.managerWithdrawalRequests ?? []).find((item: WithdrawalItem) => item.id === withdrawalId.value),
|
||||
);
|
||||
|
||||
async function reviewWithdrawal() {
|
||||
@@ -37,7 +41,7 @@ async function reviewWithdrawal() {
|
||||
});
|
||||
|
||||
reviewResult.value = response?.data?.reviewRewardWithdrawal.status ?? '';
|
||||
await bonusQuery.refetch();
|
||||
await withdrawalsQuery.refetch({ status: null });
|
||||
}
|
||||
</script>
|
||||
|
||||
@@ -45,7 +49,7 @@ async function reviewWithdrawal() {
|
||||
<section class="space-y-6 max-w-3xl">
|
||||
<NuxtLink to="/bonus-system" class="text-sm font-semibold text-[#0d854a]">← Назад к бонусам</NuxtLink>
|
||||
|
||||
<div v-if="bonusQuery.loading.value" class="manager-empty-state">
|
||||
<div v-if="withdrawalsQuery.loading.value" class="manager-empty-state">
|
||||
Загружаем заявку на вывод...
|
||||
</div>
|
||||
|
||||
@@ -57,7 +61,9 @@ async function reviewWithdrawal() {
|
||||
<div class="manager-hero">
|
||||
<p class="manager-eyebrow">Вывод</p>
|
||||
<h1 class="manager-title">Проверка заявки на вывод</h1>
|
||||
<p class="manager-copy">Пользователь: {{ currentWithdrawal.requesterId }} · Сумма: {{ currentWithdrawal.amount }}</p>
|
||||
<p class="manager-copy">
|
||||
{{ currentWithdrawal.requesterFullName }} · {{ currentWithdrawal.requesterEmail }} · Сумма: {{ currentWithdrawal.amount }}
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<div class="surface-card rounded-3xl p-5 space-y-3">
|
||||
|
||||
Reference in New Issue
Block a user