From 1c2070b8d8c812c8c012e490d3415b73ceec948a Mon Sep 17 00:00:00 2001 From: Ruslan Bakiev <572431+veikab@users.noreply.github.com> Date: Fri, 3 Apr 2026 19:23:08 +0700 Subject: [PATCH] Simplify manager cabinet flows --- app/components/ui/AppHeader.vue | 4 + app/composables/graphql/generated.ts | 51 +++ app/pages/bonus-system/index.vue | 139 +++++++ app/pages/bonus-system/referrals/new.vue | 49 +++ app/pages/bonus-system/transactions/new.vue | 64 +++ app/pages/bonus-system/withdrawals/[id].vue | 87 ++++ app/pages/client-orders.vue | 289 ------------- app/pages/client-orders/[id].vue | 197 +++++++++ app/pages/client-orders/index.vue | 126 ++++++ app/pages/clients.vue | 391 ------------------ app/pages/clients/[id].vue | 127 ++++++ app/pages/clients/index.vue | 127 ++++++ app/pages/clients/invite.vue | 78 ++++ .../operations/manager/referral-stats.graphql | 24 ++ 14 files changed, 1073 insertions(+), 680 deletions(-) create mode 100644 app/pages/bonus-system/index.vue create mode 100644 app/pages/bonus-system/referrals/new.vue create mode 100644 app/pages/bonus-system/transactions/new.vue create mode 100644 app/pages/bonus-system/withdrawals/[id].vue delete mode 100644 app/pages/client-orders.vue create mode 100644 app/pages/client-orders/[id].vue create mode 100644 app/pages/client-orders/index.vue delete mode 100644 app/pages/clients.vue create mode 100644 app/pages/clients/[id].vue create mode 100644 app/pages/clients/index.vue create mode 100644 app/pages/clients/invite.vue create mode 100644 graphql/operations/manager/referral-stats.graphql diff --git a/app/components/ui/AppHeader.vue b/app/components/ui/AppHeader.vue index 5e0f836..0b1c4fe 100644 --- a/app/components/ui/AppHeader.vue +++ b/app/components/ui/AppHeader.vue @@ -21,6 +21,7 @@ const centerCapsule = computed(() => { items.push( { to: '/clients', label: 'Клиенты' }, { to: '/client-orders', label: 'Заказы клиентов' }, + { to: '/bonus-system', label: 'Бонусы' }, ); } @@ -45,6 +46,9 @@ function isActive(path: string) { if (path === '/client-orders') { return route.path === '/client-orders' || route.path.startsWith('/client-orders/'); } + if (path === '/bonus-system') { + return route.path === '/bonus-system' || route.path.startsWith('/bonus-system/'); + } return route.path === path; } diff --git a/app/composables/graphql/generated.ts b/app/composables/graphql/generated.ts index f74f436..ef2316e 100644 --- a/app/composables/graphql/generated.ts +++ b/app/composables/graphql/generated.ts @@ -700,6 +700,11 @@ export type ManagerOrdersQueryVariables = Exact<{ export type ManagerOrdersQuery = { __typename?: 'Query', managerOrders: Array<{ __typename?: 'Order', id: string, code: string, status: OrderStatus, kind: OrderKind, customerId: string, deliveryAddress?: string | null, deliveryTerms?: string | null, deliveryFee?: number | null, totalPrice?: number | null, createdAt: any, items: Array<{ __typename?: 'OrderItem', id: string, productName: string, quantity: number }> }> }; +export type ReferralStatsQueryVariables = Exact<{ [key: string]: never; }>; + + +export type ReferralStatsQuery = { __typename?: 'Query', referralStats: { __typename?: 'ReferralStats', referrerId: string, availableBalance: number, referralsCount: number, transactions: Array<{ __typename?: 'BonusTransaction', id: string, userId: string, amount: number, reason: string, orderId?: string | null, createdAt: any }>, pendingWithdrawals: Array<{ __typename?: 'RewardWithdrawalRequest', id: string, requesterId: string, amount: number, status: WithdrawalStatus, reviewComment?: string | null, createdAt: any, updatedAt: any }> } }; + export type RegistrationRequestsQueryVariables = Exact<{ status?: InputMaybe; }>; @@ -1290,6 +1295,52 @@ export function useManagerOrdersLazyQuery(variables: ManagerOrdersQueryVariables return VueApolloComposable.useLazyQuery(ManagerOrdersDocument, variables, options); } export type ManagerOrdersQueryCompositionFunctionResult = VueApolloComposable.UseQueryReturn; +export const ReferralStatsDocument = gql` + query ReferralStats { + referralStats { + referrerId + availableBalance + referralsCount + transactions { + id + userId + amount + reason + orderId + createdAt + } + pendingWithdrawals { + id + requesterId + amount + status + reviewComment + createdAt + updatedAt + } + } +} + `; + +/** + * __useReferralStatsQuery__ + * + * To run a query within a Vue component, call `useReferralStatsQuery` and pass it any options that fit your needs. + * When your component renders, `useReferralStatsQuery` returns an object from Apollo Client that contains result, loading and error properties + * you can use to render your UI. + * + * @param options that will be passed into the query, supported options are listed on: https://v4.apollo.vuejs.org/guide-composable/query.html#options; + * + * @example + * const { result, loading, error } = useReferralStatsQuery(); + */ +export function useReferralStatsQuery(options: VueApolloComposable.UseQueryOptions | VueCompositionApi.Ref> | ReactiveFunction> = {}) { + return VueApolloComposable.useQuery(ReferralStatsDocument, {}, options); +} +export function useReferralStatsLazyQuery(options: VueApolloComposable.UseQueryOptions | VueCompositionApi.Ref> | ReactiveFunction> = {}) { + return VueApolloComposable.useLazyQuery(ReferralStatsDocument, {}, options); +} +export type ReferralStatsQueryCompositionFunctionResult = VueApolloComposable.UseQueryReturn; export const RegistrationRequestsDocument = gql` query RegistrationRequests($status: RegistrationStatus) { registrationRequests(status: $status) { diff --git a/app/pages/bonus-system/index.vue b/app/pages/bonus-system/index.vue new file mode 100644 index 0000000..04f41b8 --- /dev/null +++ b/app/pages/bonus-system/index.vue @@ -0,0 +1,139 @@ + + + diff --git a/app/pages/bonus-system/referrals/new.vue b/app/pages/bonus-system/referrals/new.vue new file mode 100644 index 0000000..3924659 --- /dev/null +++ b/app/pages/bonus-system/referrals/new.vue @@ -0,0 +1,49 @@ + + + diff --git a/app/pages/bonus-system/transactions/new.vue b/app/pages/bonus-system/transactions/new.vue new file mode 100644 index 0000000..3e03c35 --- /dev/null +++ b/app/pages/bonus-system/transactions/new.vue @@ -0,0 +1,64 @@ + + + diff --git a/app/pages/bonus-system/withdrawals/[id].vue b/app/pages/bonus-system/withdrawals/[id].vue new file mode 100644 index 0000000..7d51b49 --- /dev/null +++ b/app/pages/bonus-system/withdrawals/[id].vue @@ -0,0 +1,87 @@ + + +