Merge manager tools into main cabinet
This commit is contained in:
@@ -114,6 +114,123 @@ body {
|
||||
box-shadow: 0 14px 32px rgba(24, 66, 44, 0.1);
|
||||
}
|
||||
|
||||
.surface-subcard {
|
||||
border: 0;
|
||||
border-radius: 1.5rem;
|
||||
background: color-mix(in oklab, #ffffff 78%, var(--brand-surface));
|
||||
}
|
||||
|
||||
.manager-hero {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 0.75rem;
|
||||
max-width: 52rem;
|
||||
}
|
||||
|
||||
.manager-eyebrow {
|
||||
font-size: 0.72rem;
|
||||
font-weight: 800;
|
||||
letter-spacing: 0.16em;
|
||||
text-transform: uppercase;
|
||||
color: color-mix(in oklab, var(--brand-primary) 76%, #355947);
|
||||
}
|
||||
|
||||
.manager-title {
|
||||
font-size: clamp(2rem, 3.5vw, 3.35rem);
|
||||
line-height: 1;
|
||||
font-weight: 800;
|
||||
letter-spacing: -0.04em;
|
||||
color: var(--brand-ink);
|
||||
}
|
||||
|
||||
.manager-copy {
|
||||
max-width: 42rem;
|
||||
font-size: 1rem;
|
||||
line-height: 1.65;
|
||||
color: color-mix(in oklab, var(--brand-ink) 72%, #60786b);
|
||||
}
|
||||
|
||||
.manager-stat-card {
|
||||
border: 0;
|
||||
border-radius: 1.5rem;
|
||||
background: #fff;
|
||||
padding: 1rem 1.1rem;
|
||||
}
|
||||
|
||||
.manager-stat-label {
|
||||
font-size: 0.8rem;
|
||||
font-weight: 700;
|
||||
color: #5c7b69;
|
||||
}
|
||||
|
||||
.manager-stat-value {
|
||||
margin-top: 0.35rem;
|
||||
font-size: 1.5rem;
|
||||
line-height: 1;
|
||||
font-weight: 800;
|
||||
color: #123824;
|
||||
}
|
||||
|
||||
.manager-helper {
|
||||
font-size: 0.9rem;
|
||||
line-height: 1.55;
|
||||
color: #5c7b69;
|
||||
}
|
||||
|
||||
.manager-field.input,
|
||||
.manager-field.select,
|
||||
.manager-field.textarea {
|
||||
border: 0;
|
||||
border-radius: 1.2rem;
|
||||
background: color-mix(in oklab, white 76%, var(--brand-surface));
|
||||
box-shadow: none;
|
||||
}
|
||||
|
||||
.manager-field.input:focus,
|
||||
.manager-field.select:focus,
|
||||
.manager-field.textarea:focus,
|
||||
.manager-field.input:focus-visible,
|
||||
.manager-field.select:focus-visible,
|
||||
.manager-field.textarea:focus-visible {
|
||||
outline: 0;
|
||||
box-shadow: 0 0 0 2px rgba(19, 153, 87, 0.16);
|
||||
}
|
||||
|
||||
.manager-mini-card {
|
||||
border: 0;
|
||||
border-radius: 1.2rem;
|
||||
background: color-mix(in oklab, white 72%, var(--brand-muted));
|
||||
padding: 0.9rem 1rem;
|
||||
}
|
||||
|
||||
.manager-channel-chip {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
gap: 0.55rem;
|
||||
border-radius: 999px;
|
||||
background: color-mix(in oklab, white 86%, var(--brand-surface));
|
||||
padding: 0.35rem 0.75rem 0.35rem 0.4rem;
|
||||
}
|
||||
|
||||
.manager-channel-dot {
|
||||
display: inline-flex;
|
||||
height: 2rem;
|
||||
width: 2rem;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
border-radius: 999px;
|
||||
font-size: 0.72rem;
|
||||
font-weight: 800;
|
||||
color: white;
|
||||
}
|
||||
|
||||
.manager-empty-state {
|
||||
border-radius: 1.4rem;
|
||||
background: color-mix(in oklab, white 70%, var(--brand-surface));
|
||||
padding: 1rem 1.1rem;
|
||||
color: #557562;
|
||||
}
|
||||
|
||||
.fregat-header-glass {
|
||||
background: transparent;
|
||||
}
|
||||
|
||||
@@ -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[] = [
|
||||
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>
|
||||
|
||||
@@ -622,7 +622,7 @@ export type ConsumeLoginTokenMutation = { __typename?: 'Mutation', consumeLoginT
|
||||
export type MeQueryVariables = Exact<{ [key: string]: never; }>;
|
||||
|
||||
|
||||
export type MeQuery = { __typename?: 'Query', me?: { __typename?: 'User', id: string, email: string, fullName: string } | null };
|
||||
export type MeQuery = { __typename?: 'Query', me?: { __typename?: 'User', id: string, email: string, fullName: string, role: UserRole } | null };
|
||||
|
||||
export type RegisterSelfMutationVariables = Exact<{
|
||||
input: RegisterSelfInput;
|
||||
@@ -650,6 +650,100 @@ export type ClientProductsQueryVariables = Exact<{ [key: string]: never; }>;
|
||||
|
||||
export type ClientProductsQuery = { __typename?: 'Query', clientProducts: Array<{ __typename?: 'Product', id: string, sku: string, name: string, description?: string | null, productType?: string | null, widthMm?: number | null, lengthM?: number | null, thicknessMicron?: number | null, sleeveBrand?: string | null, quantityPerBox?: string | null, isCustomizable: boolean, availableInWarehouses: Array<{ __typename?: 'ProductWarehouseBalance', availableQty: number, warehouse: { __typename?: 'Warehouse', id: string, code: string, name: string } }> }> };
|
||||
|
||||
export type AddBonusTransactionMutationVariables = Exact<{
|
||||
input: AddBonusTransactionInput;
|
||||
}>;
|
||||
|
||||
|
||||
export type AddBonusTransactionMutation = { __typename?: 'Mutation', addBonusTransaction: { __typename?: 'BonusTransaction', id: string, userId: string, amount: number, reason: string, createdAt: any } };
|
||||
|
||||
export type BlockOrderMutationVariables = Exact<{
|
||||
input: BlockOrderInput;
|
||||
}>;
|
||||
|
||||
|
||||
export type BlockOrderMutation = { __typename?: 'Mutation', blockOrder: { __typename?: 'Order', id: string, status: OrderStatus, blockReason?: string | null } };
|
||||
|
||||
export type CompleteOrderMutationVariables = Exact<{
|
||||
orderId: Scalars['ID']['input'];
|
||||
}>;
|
||||
|
||||
|
||||
export type CompleteOrderMutation = { __typename?: 'Mutation', completeOrder: { __typename?: 'Order', id: string, status: OrderStatus } };
|
||||
|
||||
export type CreateInvitationMutationVariables = Exact<{
|
||||
input: CreateInvitationInput;
|
||||
}>;
|
||||
|
||||
|
||||
export type CreateInvitationMutation = { __typename?: 'Mutation', createInvitation: { __typename?: 'Invitation', id: string, token: string, email: string, companyName: string, expiresAt: any } };
|
||||
|
||||
export type CreateReferralMutationVariables = Exact<{
|
||||
input: CreateReferralInput;
|
||||
}>;
|
||||
|
||||
|
||||
export type CreateReferralMutation = { __typename?: 'Mutation', createReferral: { __typename?: 'ReferralLink', id: string, referrerId: string, refereeId: string, createdAt: any } };
|
||||
|
||||
export type ManagerFinalizeOrderMutationVariables = Exact<{
|
||||
orderId: Scalars['ID']['input'];
|
||||
decision: Decision;
|
||||
}>;
|
||||
|
||||
|
||||
export type ManagerFinalizeOrderMutation = { __typename?: 'Mutation', managerFinalizeOrder: { __typename?: 'Order', id: string, status: OrderStatus, managerApproved?: boolean | null } };
|
||||
|
||||
export type ManagerOrdersQueryVariables = Exact<{
|
||||
status?: InputMaybe<OrderStatus>;
|
||||
}>;
|
||||
|
||||
|
||||
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 RegistrationRequestsQueryVariables = Exact<{
|
||||
status?: InputMaybe<RegistrationStatus>;
|
||||
}>;
|
||||
|
||||
|
||||
export type RegistrationRequestsQuery = { __typename?: 'Query', registrationRequests: Array<{ __typename?: 'RegistrationRequest', id: string, companyName: string, contactName: string, email: string, status: RegistrationStatus, createdAt: any }> };
|
||||
|
||||
export type ReviewRegistrationRequestMutationVariables = Exact<{
|
||||
input: ReviewRegistrationRequestInput;
|
||||
}>;
|
||||
|
||||
|
||||
export type ReviewRegistrationRequestMutation = { __typename?: 'Mutation', reviewRegistrationRequest: { __typename?: 'RegistrationRequest', id: string, status: RegistrationStatus, rejectionReason?: string | null, reviewedById?: string | null } };
|
||||
|
||||
export type ReviewRewardWithdrawalMutationVariables = Exact<{
|
||||
input: ReviewRewardWithdrawalInput;
|
||||
}>;
|
||||
|
||||
|
||||
export type ReviewRewardWithdrawalMutation = { __typename?: 'Mutation', reviewRewardWithdrawal: { __typename?: 'RewardWithdrawalRequest', id: string, status: WithdrawalStatus, reviewComment?: string | null, reviewedById?: string | null } };
|
||||
|
||||
export type ManagerSetOrderOfferMutationVariables = Exact<{
|
||||
input: SetOrderOfferInput;
|
||||
}>;
|
||||
|
||||
|
||||
export type ManagerSetOrderOfferMutation = { __typename?: 'Mutation', managerSetOrderOffer: { __typename?: 'Order', id: string, code: string, status: OrderStatus, deliveryTerms?: string | null, totalPrice?: number | null } };
|
||||
|
||||
export type StartOrderWorkMutationVariables = Exact<{
|
||||
orderId: Scalars['ID']['input'];
|
||||
}>;
|
||||
|
||||
|
||||
export type StartOrderWorkMutation = { __typename?: 'Mutation', startOrderWork: { __typename?: 'Order', id: string, status: OrderStatus } };
|
||||
|
||||
export type ManagerNotificationHistoryQueryVariables = Exact<{
|
||||
userId: Scalars['ID']['input'];
|
||||
channel: MessengerType;
|
||||
limit?: InputMaybe<Scalars['Int']['input']>;
|
||||
}>;
|
||||
|
||||
|
||||
export type ManagerNotificationHistoryQuery = { __typename?: 'Query', managerNotificationHistory: Array<{ __typename?: 'NotificationHistoryItem', id: string, channel: MessengerType, title: string, message: string, createdAt: any, orderId?: string | null }> };
|
||||
|
||||
export type MyMessengerConnectionsQueryVariables = Exact<{ [key: string]: never; }>;
|
||||
|
||||
|
||||
@@ -672,14 +766,6 @@ export type SendTestMessengerMessageMutationVariables = Exact<{
|
||||
|
||||
export type SendTestMessengerMessageMutation = { __typename?: 'Mutation', sendTestMessengerMessage: { __typename?: 'MessengerDispatchResult', type: MessengerType, channelId: string, success: boolean, detail: string, sentAt: any } };
|
||||
|
||||
export type ClientReviewOrderMutationVariables = Exact<{
|
||||
orderId: Scalars['ID']['input'];
|
||||
decision: Decision;
|
||||
}>;
|
||||
|
||||
|
||||
export type ClientReviewOrderMutation = { __typename?: 'Mutation', clientReviewOrder: { __typename?: 'Order', id: string, status: OrderStatus, clientApproved?: boolean | null, managerApproved?: boolean | null } };
|
||||
|
||||
export type MyCurrentOrdersQueryVariables = Exact<{ [key: string]: never; }>;
|
||||
|
||||
|
||||
@@ -795,6 +881,7 @@ export const MeDocument = gql`
|
||||
id
|
||||
email
|
||||
fullName
|
||||
role
|
||||
}
|
||||
}
|
||||
`;
|
||||
@@ -968,6 +1055,440 @@ export function useClientProductsLazyQuery(options: VueApolloComposable.UseQuery
|
||||
return VueApolloComposable.useLazyQuery<ClientProductsQuery, ClientProductsQueryVariables>(ClientProductsDocument, {}, options);
|
||||
}
|
||||
export type ClientProductsQueryCompositionFunctionResult = VueApolloComposable.UseQueryReturn<ClientProductsQuery, ClientProductsQueryVariables>;
|
||||
export const AddBonusTransactionDocument = gql`
|
||||
mutation AddBonusTransaction($input: AddBonusTransactionInput!) {
|
||||
addBonusTransaction(input: $input) {
|
||||
id
|
||||
userId
|
||||
amount
|
||||
reason
|
||||
createdAt
|
||||
}
|
||||
}
|
||||
`;
|
||||
|
||||
/**
|
||||
* __useAddBonusTransactionMutation__
|
||||
*
|
||||
* To run a mutation, you first call `useAddBonusTransactionMutation` within a Vue component and pass it any options that fit your needs.
|
||||
* When your component renders, `useAddBonusTransactionMutation` returns an object that includes:
|
||||
* - A mutate function that you can call at any time to execute the mutation
|
||||
* - Several other properties: https://v4.apollo.vuejs.org/api/use-mutation.html#return
|
||||
*
|
||||
* @param options that will be passed into the mutation, supported options are listed on: https://v4.apollo.vuejs.org/guide-composable/mutation.html#options;
|
||||
*
|
||||
* @example
|
||||
* const { mutate, loading, error, onDone } = useAddBonusTransactionMutation({
|
||||
* variables: {
|
||||
* input: // value for 'input'
|
||||
* },
|
||||
* });
|
||||
*/
|
||||
export function useAddBonusTransactionMutation(options: VueApolloComposable.UseMutationOptions<AddBonusTransactionMutation, AddBonusTransactionMutationVariables> | ReactiveFunction<VueApolloComposable.UseMutationOptions<AddBonusTransactionMutation, AddBonusTransactionMutationVariables>> = {}) {
|
||||
return VueApolloComposable.useMutation<AddBonusTransactionMutation, AddBonusTransactionMutationVariables>(AddBonusTransactionDocument, options);
|
||||
}
|
||||
export type AddBonusTransactionMutationCompositionFunctionResult = VueApolloComposable.UseMutationReturn<AddBonusTransactionMutation, AddBonusTransactionMutationVariables>;
|
||||
export const BlockOrderDocument = gql`
|
||||
mutation BlockOrder($input: BlockOrderInput!) {
|
||||
blockOrder(input: $input) {
|
||||
id
|
||||
status
|
||||
blockReason
|
||||
}
|
||||
}
|
||||
`;
|
||||
|
||||
/**
|
||||
* __useBlockOrderMutation__
|
||||
*
|
||||
* To run a mutation, you first call `useBlockOrderMutation` within a Vue component and pass it any options that fit your needs.
|
||||
* When your component renders, `useBlockOrderMutation` returns an object that includes:
|
||||
* - A mutate function that you can call at any time to execute the mutation
|
||||
* - Several other properties: https://v4.apollo.vuejs.org/api/use-mutation.html#return
|
||||
*
|
||||
* @param options that will be passed into the mutation, supported options are listed on: https://v4.apollo.vuejs.org/guide-composable/mutation.html#options;
|
||||
*
|
||||
* @example
|
||||
* const { mutate, loading, error, onDone } = useBlockOrderMutation({
|
||||
* variables: {
|
||||
* input: // value for 'input'
|
||||
* },
|
||||
* });
|
||||
*/
|
||||
export function useBlockOrderMutation(options: VueApolloComposable.UseMutationOptions<BlockOrderMutation, BlockOrderMutationVariables> | ReactiveFunction<VueApolloComposable.UseMutationOptions<BlockOrderMutation, BlockOrderMutationVariables>> = {}) {
|
||||
return VueApolloComposable.useMutation<BlockOrderMutation, BlockOrderMutationVariables>(BlockOrderDocument, options);
|
||||
}
|
||||
export type BlockOrderMutationCompositionFunctionResult = VueApolloComposable.UseMutationReturn<BlockOrderMutation, BlockOrderMutationVariables>;
|
||||
export const CompleteOrderDocument = gql`
|
||||
mutation CompleteOrder($orderId: ID!) {
|
||||
completeOrder(orderId: $orderId) {
|
||||
id
|
||||
status
|
||||
}
|
||||
}
|
||||
`;
|
||||
|
||||
/**
|
||||
* __useCompleteOrderMutation__
|
||||
*
|
||||
* To run a mutation, you first call `useCompleteOrderMutation` within a Vue component and pass it any options that fit your needs.
|
||||
* When your component renders, `useCompleteOrderMutation` returns an object that includes:
|
||||
* - A mutate function that you can call at any time to execute the mutation
|
||||
* - Several other properties: https://v4.apollo.vuejs.org/api/use-mutation.html#return
|
||||
*
|
||||
* @param options that will be passed into the mutation, supported options are listed on: https://v4.apollo.vuejs.org/guide-composable/mutation.html#options;
|
||||
*
|
||||
* @example
|
||||
* const { mutate, loading, error, onDone } = useCompleteOrderMutation({
|
||||
* variables: {
|
||||
* orderId: // value for 'orderId'
|
||||
* },
|
||||
* });
|
||||
*/
|
||||
export function useCompleteOrderMutation(options: VueApolloComposable.UseMutationOptions<CompleteOrderMutation, CompleteOrderMutationVariables> | ReactiveFunction<VueApolloComposable.UseMutationOptions<CompleteOrderMutation, CompleteOrderMutationVariables>> = {}) {
|
||||
return VueApolloComposable.useMutation<CompleteOrderMutation, CompleteOrderMutationVariables>(CompleteOrderDocument, options);
|
||||
}
|
||||
export type CompleteOrderMutationCompositionFunctionResult = VueApolloComposable.UseMutationReturn<CompleteOrderMutation, CompleteOrderMutationVariables>;
|
||||
export const CreateInvitationDocument = gql`
|
||||
mutation CreateInvitation($input: CreateInvitationInput!) {
|
||||
createInvitation(input: $input) {
|
||||
id
|
||||
token
|
||||
email
|
||||
companyName
|
||||
expiresAt
|
||||
}
|
||||
}
|
||||
`;
|
||||
|
||||
/**
|
||||
* __useCreateInvitationMutation__
|
||||
*
|
||||
* To run a mutation, you first call `useCreateInvitationMutation` within a Vue component and pass it any options that fit your needs.
|
||||
* When your component renders, `useCreateInvitationMutation` returns an object that includes:
|
||||
* - A mutate function that you can call at any time to execute the mutation
|
||||
* - Several other properties: https://v4.apollo.vuejs.org/api/use-mutation.html#return
|
||||
*
|
||||
* @param options that will be passed into the mutation, supported options are listed on: https://v4.apollo.vuejs.org/guide-composable/mutation.html#options;
|
||||
*
|
||||
* @example
|
||||
* const { mutate, loading, error, onDone } = useCreateInvitationMutation({
|
||||
* variables: {
|
||||
* input: // value for 'input'
|
||||
* },
|
||||
* });
|
||||
*/
|
||||
export function useCreateInvitationMutation(options: VueApolloComposable.UseMutationOptions<CreateInvitationMutation, CreateInvitationMutationVariables> | ReactiveFunction<VueApolloComposable.UseMutationOptions<CreateInvitationMutation, CreateInvitationMutationVariables>> = {}) {
|
||||
return VueApolloComposable.useMutation<CreateInvitationMutation, CreateInvitationMutationVariables>(CreateInvitationDocument, options);
|
||||
}
|
||||
export type CreateInvitationMutationCompositionFunctionResult = VueApolloComposable.UseMutationReturn<CreateInvitationMutation, CreateInvitationMutationVariables>;
|
||||
export const CreateReferralDocument = gql`
|
||||
mutation CreateReferral($input: CreateReferralInput!) {
|
||||
createReferral(input: $input) {
|
||||
id
|
||||
referrerId
|
||||
refereeId
|
||||
createdAt
|
||||
}
|
||||
}
|
||||
`;
|
||||
|
||||
/**
|
||||
* __useCreateReferralMutation__
|
||||
*
|
||||
* To run a mutation, you first call `useCreateReferralMutation` within a Vue component and pass it any options that fit your needs.
|
||||
* When your component renders, `useCreateReferralMutation` returns an object that includes:
|
||||
* - A mutate function that you can call at any time to execute the mutation
|
||||
* - Several other properties: https://v4.apollo.vuejs.org/api/use-mutation.html#return
|
||||
*
|
||||
* @param options that will be passed into the mutation, supported options are listed on: https://v4.apollo.vuejs.org/guide-composable/mutation.html#options;
|
||||
*
|
||||
* @example
|
||||
* const { mutate, loading, error, onDone } = useCreateReferralMutation({
|
||||
* variables: {
|
||||
* input: // value for 'input'
|
||||
* },
|
||||
* });
|
||||
*/
|
||||
export function useCreateReferralMutation(options: VueApolloComposable.UseMutationOptions<CreateReferralMutation, CreateReferralMutationVariables> | ReactiveFunction<VueApolloComposable.UseMutationOptions<CreateReferralMutation, CreateReferralMutationVariables>> = {}) {
|
||||
return VueApolloComposable.useMutation<CreateReferralMutation, CreateReferralMutationVariables>(CreateReferralDocument, options);
|
||||
}
|
||||
export type CreateReferralMutationCompositionFunctionResult = VueApolloComposable.UseMutationReturn<CreateReferralMutation, CreateReferralMutationVariables>;
|
||||
export const ManagerFinalizeOrderDocument = gql`
|
||||
mutation ManagerFinalizeOrder($orderId: ID!, $decision: Decision!) {
|
||||
managerFinalizeOrder(orderId: $orderId, decision: $decision) {
|
||||
id
|
||||
status
|
||||
managerApproved
|
||||
}
|
||||
}
|
||||
`;
|
||||
|
||||
/**
|
||||
* __useManagerFinalizeOrderMutation__
|
||||
*
|
||||
* To run a mutation, you first call `useManagerFinalizeOrderMutation` within a Vue component and pass it any options that fit your needs.
|
||||
* When your component renders, `useManagerFinalizeOrderMutation` returns an object that includes:
|
||||
* - A mutate function that you can call at any time to execute the mutation
|
||||
* - Several other properties: https://v4.apollo.vuejs.org/api/use-mutation.html#return
|
||||
*
|
||||
* @param options that will be passed into the mutation, supported options are listed on: https://v4.apollo.vuejs.org/guide-composable/mutation.html#options;
|
||||
*
|
||||
* @example
|
||||
* const { mutate, loading, error, onDone } = useManagerFinalizeOrderMutation({
|
||||
* variables: {
|
||||
* orderId: // value for 'orderId'
|
||||
* decision: // value for 'decision'
|
||||
* },
|
||||
* });
|
||||
*/
|
||||
export function useManagerFinalizeOrderMutation(options: VueApolloComposable.UseMutationOptions<ManagerFinalizeOrderMutation, ManagerFinalizeOrderMutationVariables> | ReactiveFunction<VueApolloComposable.UseMutationOptions<ManagerFinalizeOrderMutation, ManagerFinalizeOrderMutationVariables>> = {}) {
|
||||
return VueApolloComposable.useMutation<ManagerFinalizeOrderMutation, ManagerFinalizeOrderMutationVariables>(ManagerFinalizeOrderDocument, options);
|
||||
}
|
||||
export type ManagerFinalizeOrderMutationCompositionFunctionResult = VueApolloComposable.UseMutationReturn<ManagerFinalizeOrderMutation, ManagerFinalizeOrderMutationVariables>;
|
||||
export const ManagerOrdersDocument = gql`
|
||||
query ManagerOrders($status: OrderStatus) {
|
||||
managerOrders(status: $status) {
|
||||
id
|
||||
code
|
||||
status
|
||||
kind
|
||||
customerId
|
||||
deliveryAddress
|
||||
deliveryTerms
|
||||
deliveryFee
|
||||
totalPrice
|
||||
createdAt
|
||||
items {
|
||||
id
|
||||
productName
|
||||
quantity
|
||||
}
|
||||
}
|
||||
}
|
||||
`;
|
||||
|
||||
/**
|
||||
* __useManagerOrdersQuery__
|
||||
*
|
||||
* To run a query within a Vue component, call `useManagerOrdersQuery` and pass it any options that fit your needs.
|
||||
* When your component renders, `useManagerOrdersQuery` returns an object from Apollo Client that contains result, loading and error properties
|
||||
* you can use to render your UI.
|
||||
*
|
||||
* @param variables that will be passed into the query
|
||||
* @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 } = useManagerOrdersQuery({
|
||||
* status: // value for 'status'
|
||||
* });
|
||||
*/
|
||||
export function useManagerOrdersQuery(variables: ManagerOrdersQueryVariables | VueCompositionApi.Ref<ManagerOrdersQueryVariables> | ReactiveFunction<ManagerOrdersQueryVariables> = {}, options: VueApolloComposable.UseQueryOptions<ManagerOrdersQuery, ManagerOrdersQueryVariables> | VueCompositionApi.Ref<VueApolloComposable.UseQueryOptions<ManagerOrdersQuery, ManagerOrdersQueryVariables>> | ReactiveFunction<VueApolloComposable.UseQueryOptions<ManagerOrdersQuery, ManagerOrdersQueryVariables>> = {}) {
|
||||
return VueApolloComposable.useQuery<ManagerOrdersQuery, ManagerOrdersQueryVariables>(ManagerOrdersDocument, variables, options);
|
||||
}
|
||||
export function useManagerOrdersLazyQuery(variables: ManagerOrdersQueryVariables | VueCompositionApi.Ref<ManagerOrdersQueryVariables> | ReactiveFunction<ManagerOrdersQueryVariables> = {}, options: VueApolloComposable.UseQueryOptions<ManagerOrdersQuery, ManagerOrdersQueryVariables> | VueCompositionApi.Ref<VueApolloComposable.UseQueryOptions<ManagerOrdersQuery, ManagerOrdersQueryVariables>> | ReactiveFunction<VueApolloComposable.UseQueryOptions<ManagerOrdersQuery, ManagerOrdersQueryVariables>> = {}) {
|
||||
return VueApolloComposable.useLazyQuery<ManagerOrdersQuery, ManagerOrdersQueryVariables>(ManagerOrdersDocument, variables, options);
|
||||
}
|
||||
export type ManagerOrdersQueryCompositionFunctionResult = VueApolloComposable.UseQueryReturn<ManagerOrdersQuery, ManagerOrdersQueryVariables>;
|
||||
export const RegistrationRequestsDocument = gql`
|
||||
query RegistrationRequests($status: RegistrationStatus) {
|
||||
registrationRequests(status: $status) {
|
||||
id
|
||||
companyName
|
||||
contactName
|
||||
email
|
||||
status
|
||||
createdAt
|
||||
}
|
||||
}
|
||||
`;
|
||||
|
||||
/**
|
||||
* __useRegistrationRequestsQuery__
|
||||
*
|
||||
* To run a query within a Vue component, call `useRegistrationRequestsQuery` and pass it any options that fit your needs.
|
||||
* When your component renders, `useRegistrationRequestsQuery` returns an object from Apollo Client that contains result, loading and error properties
|
||||
* you can use to render your UI.
|
||||
*
|
||||
* @param variables that will be passed into the query
|
||||
* @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 } = useRegistrationRequestsQuery({
|
||||
* status: // value for 'status'
|
||||
* });
|
||||
*/
|
||||
export function useRegistrationRequestsQuery(variables: RegistrationRequestsQueryVariables | VueCompositionApi.Ref<RegistrationRequestsQueryVariables> | ReactiveFunction<RegistrationRequestsQueryVariables> = {}, options: VueApolloComposable.UseQueryOptions<RegistrationRequestsQuery, RegistrationRequestsQueryVariables> | VueCompositionApi.Ref<VueApolloComposable.UseQueryOptions<RegistrationRequestsQuery, RegistrationRequestsQueryVariables>> | ReactiveFunction<VueApolloComposable.UseQueryOptions<RegistrationRequestsQuery, RegistrationRequestsQueryVariables>> = {}) {
|
||||
return VueApolloComposable.useQuery<RegistrationRequestsQuery, RegistrationRequestsQueryVariables>(RegistrationRequestsDocument, variables, options);
|
||||
}
|
||||
export function useRegistrationRequestsLazyQuery(variables: RegistrationRequestsQueryVariables | VueCompositionApi.Ref<RegistrationRequestsQueryVariables> | ReactiveFunction<RegistrationRequestsQueryVariables> = {}, options: VueApolloComposable.UseQueryOptions<RegistrationRequestsQuery, RegistrationRequestsQueryVariables> | VueCompositionApi.Ref<VueApolloComposable.UseQueryOptions<RegistrationRequestsQuery, RegistrationRequestsQueryVariables>> | ReactiveFunction<VueApolloComposable.UseQueryOptions<RegistrationRequestsQuery, RegistrationRequestsQueryVariables>> = {}) {
|
||||
return VueApolloComposable.useLazyQuery<RegistrationRequestsQuery, RegistrationRequestsQueryVariables>(RegistrationRequestsDocument, variables, options);
|
||||
}
|
||||
export type RegistrationRequestsQueryCompositionFunctionResult = VueApolloComposable.UseQueryReturn<RegistrationRequestsQuery, RegistrationRequestsQueryVariables>;
|
||||
export const ReviewRegistrationRequestDocument = gql`
|
||||
mutation ReviewRegistrationRequest($input: ReviewRegistrationRequestInput!) {
|
||||
reviewRegistrationRequest(input: $input) {
|
||||
id
|
||||
status
|
||||
rejectionReason
|
||||
reviewedById
|
||||
}
|
||||
}
|
||||
`;
|
||||
|
||||
/**
|
||||
* __useReviewRegistrationRequestMutation__
|
||||
*
|
||||
* To run a mutation, you first call `useReviewRegistrationRequestMutation` within a Vue component and pass it any options that fit your needs.
|
||||
* When your component renders, `useReviewRegistrationRequestMutation` returns an object that includes:
|
||||
* - A mutate function that you can call at any time to execute the mutation
|
||||
* - Several other properties: https://v4.apollo.vuejs.org/api/use-mutation.html#return
|
||||
*
|
||||
* @param options that will be passed into the mutation, supported options are listed on: https://v4.apollo.vuejs.org/guide-composable/mutation.html#options;
|
||||
*
|
||||
* @example
|
||||
* const { mutate, loading, error, onDone } = useReviewRegistrationRequestMutation({
|
||||
* variables: {
|
||||
* input: // value for 'input'
|
||||
* },
|
||||
* });
|
||||
*/
|
||||
export function useReviewRegistrationRequestMutation(options: VueApolloComposable.UseMutationOptions<ReviewRegistrationRequestMutation, ReviewRegistrationRequestMutationVariables> | ReactiveFunction<VueApolloComposable.UseMutationOptions<ReviewRegistrationRequestMutation, ReviewRegistrationRequestMutationVariables>> = {}) {
|
||||
return VueApolloComposable.useMutation<ReviewRegistrationRequestMutation, ReviewRegistrationRequestMutationVariables>(ReviewRegistrationRequestDocument, options);
|
||||
}
|
||||
export type ReviewRegistrationRequestMutationCompositionFunctionResult = VueApolloComposable.UseMutationReturn<ReviewRegistrationRequestMutation, ReviewRegistrationRequestMutationVariables>;
|
||||
export const ReviewRewardWithdrawalDocument = gql`
|
||||
mutation ReviewRewardWithdrawal($input: ReviewRewardWithdrawalInput!) {
|
||||
reviewRewardWithdrawal(input: $input) {
|
||||
id
|
||||
status
|
||||
reviewComment
|
||||
reviewedById
|
||||
}
|
||||
}
|
||||
`;
|
||||
|
||||
/**
|
||||
* __useReviewRewardWithdrawalMutation__
|
||||
*
|
||||
* To run a mutation, you first call `useReviewRewardWithdrawalMutation` within a Vue component and pass it any options that fit your needs.
|
||||
* When your component renders, `useReviewRewardWithdrawalMutation` returns an object that includes:
|
||||
* - A mutate function that you can call at any time to execute the mutation
|
||||
* - Several other properties: https://v4.apollo.vuejs.org/api/use-mutation.html#return
|
||||
*
|
||||
* @param options that will be passed into the mutation, supported options are listed on: https://v4.apollo.vuejs.org/guide-composable/mutation.html#options;
|
||||
*
|
||||
* @example
|
||||
* const { mutate, loading, error, onDone } = useReviewRewardWithdrawalMutation({
|
||||
* variables: {
|
||||
* input: // value for 'input'
|
||||
* },
|
||||
* });
|
||||
*/
|
||||
export function useReviewRewardWithdrawalMutation(options: VueApolloComposable.UseMutationOptions<ReviewRewardWithdrawalMutation, ReviewRewardWithdrawalMutationVariables> | ReactiveFunction<VueApolloComposable.UseMutationOptions<ReviewRewardWithdrawalMutation, ReviewRewardWithdrawalMutationVariables>> = {}) {
|
||||
return VueApolloComposable.useMutation<ReviewRewardWithdrawalMutation, ReviewRewardWithdrawalMutationVariables>(ReviewRewardWithdrawalDocument, options);
|
||||
}
|
||||
export type ReviewRewardWithdrawalMutationCompositionFunctionResult = VueApolloComposable.UseMutationReturn<ReviewRewardWithdrawalMutation, ReviewRewardWithdrawalMutationVariables>;
|
||||
export const ManagerSetOrderOfferDocument = gql`
|
||||
mutation ManagerSetOrderOffer($input: SetOrderOfferInput!) {
|
||||
managerSetOrderOffer(input: $input) {
|
||||
id
|
||||
code
|
||||
status
|
||||
deliveryTerms
|
||||
totalPrice
|
||||
}
|
||||
}
|
||||
`;
|
||||
|
||||
/**
|
||||
* __useManagerSetOrderOfferMutation__
|
||||
*
|
||||
* To run a mutation, you first call `useManagerSetOrderOfferMutation` within a Vue component and pass it any options that fit your needs.
|
||||
* When your component renders, `useManagerSetOrderOfferMutation` returns an object that includes:
|
||||
* - A mutate function that you can call at any time to execute the mutation
|
||||
* - Several other properties: https://v4.apollo.vuejs.org/api/use-mutation.html#return
|
||||
*
|
||||
* @param options that will be passed into the mutation, supported options are listed on: https://v4.apollo.vuejs.org/guide-composable/mutation.html#options;
|
||||
*
|
||||
* @example
|
||||
* const { mutate, loading, error, onDone } = useManagerSetOrderOfferMutation({
|
||||
* variables: {
|
||||
* input: // value for 'input'
|
||||
* },
|
||||
* });
|
||||
*/
|
||||
export function useManagerSetOrderOfferMutation(options: VueApolloComposable.UseMutationOptions<ManagerSetOrderOfferMutation, ManagerSetOrderOfferMutationVariables> | ReactiveFunction<VueApolloComposable.UseMutationOptions<ManagerSetOrderOfferMutation, ManagerSetOrderOfferMutationVariables>> = {}) {
|
||||
return VueApolloComposable.useMutation<ManagerSetOrderOfferMutation, ManagerSetOrderOfferMutationVariables>(ManagerSetOrderOfferDocument, options);
|
||||
}
|
||||
export type ManagerSetOrderOfferMutationCompositionFunctionResult = VueApolloComposable.UseMutationReturn<ManagerSetOrderOfferMutation, ManagerSetOrderOfferMutationVariables>;
|
||||
export const StartOrderWorkDocument = gql`
|
||||
mutation StartOrderWork($orderId: ID!) {
|
||||
startOrderWork(orderId: $orderId) {
|
||||
id
|
||||
status
|
||||
}
|
||||
}
|
||||
`;
|
||||
|
||||
/**
|
||||
* __useStartOrderWorkMutation__
|
||||
*
|
||||
* To run a mutation, you first call `useStartOrderWorkMutation` within a Vue component and pass it any options that fit your needs.
|
||||
* When your component renders, `useStartOrderWorkMutation` returns an object that includes:
|
||||
* - A mutate function that you can call at any time to execute the mutation
|
||||
* - Several other properties: https://v4.apollo.vuejs.org/api/use-mutation.html#return
|
||||
*
|
||||
* @param options that will be passed into the mutation, supported options are listed on: https://v4.apollo.vuejs.org/guide-composable/mutation.html#options;
|
||||
*
|
||||
* @example
|
||||
* const { mutate, loading, error, onDone } = useStartOrderWorkMutation({
|
||||
* variables: {
|
||||
* orderId: // value for 'orderId'
|
||||
* },
|
||||
* });
|
||||
*/
|
||||
export function useStartOrderWorkMutation(options: VueApolloComposable.UseMutationOptions<StartOrderWorkMutation, StartOrderWorkMutationVariables> | ReactiveFunction<VueApolloComposable.UseMutationOptions<StartOrderWorkMutation, StartOrderWorkMutationVariables>> = {}) {
|
||||
return VueApolloComposable.useMutation<StartOrderWorkMutation, StartOrderWorkMutationVariables>(StartOrderWorkDocument, options);
|
||||
}
|
||||
export type StartOrderWorkMutationCompositionFunctionResult = VueApolloComposable.UseMutationReturn<StartOrderWorkMutation, StartOrderWorkMutationVariables>;
|
||||
export const ManagerNotificationHistoryDocument = gql`
|
||||
query ManagerNotificationHistory($userId: ID!, $channel: MessengerType!, $limit: Int) {
|
||||
managerNotificationHistory(userId: $userId, channel: $channel, limit: $limit) {
|
||||
id
|
||||
channel
|
||||
title
|
||||
message
|
||||
createdAt
|
||||
orderId
|
||||
}
|
||||
}
|
||||
`;
|
||||
|
||||
/**
|
||||
* __useManagerNotificationHistoryQuery__
|
||||
*
|
||||
* To run a query within a Vue component, call `useManagerNotificationHistoryQuery` and pass it any options that fit your needs.
|
||||
* When your component renders, `useManagerNotificationHistoryQuery` returns an object from Apollo Client that contains result, loading and error properties
|
||||
* you can use to render your UI.
|
||||
*
|
||||
* @param variables that will be passed into the query
|
||||
* @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 } = useManagerNotificationHistoryQuery({
|
||||
* userId: // value for 'userId'
|
||||
* channel: // value for 'channel'
|
||||
* limit: // value for 'limit'
|
||||
* });
|
||||
*/
|
||||
export function useManagerNotificationHistoryQuery(variables: ManagerNotificationHistoryQueryVariables | VueCompositionApi.Ref<ManagerNotificationHistoryQueryVariables> | ReactiveFunction<ManagerNotificationHistoryQueryVariables>, options: VueApolloComposable.UseQueryOptions<ManagerNotificationHistoryQuery, ManagerNotificationHistoryQueryVariables> | VueCompositionApi.Ref<VueApolloComposable.UseQueryOptions<ManagerNotificationHistoryQuery, ManagerNotificationHistoryQueryVariables>> | ReactiveFunction<VueApolloComposable.UseQueryOptions<ManagerNotificationHistoryQuery, ManagerNotificationHistoryQueryVariables>> = {}) {
|
||||
return VueApolloComposable.useQuery<ManagerNotificationHistoryQuery, ManagerNotificationHistoryQueryVariables>(ManagerNotificationHistoryDocument, variables, options);
|
||||
}
|
||||
export function useManagerNotificationHistoryLazyQuery(variables?: ManagerNotificationHistoryQueryVariables | VueCompositionApi.Ref<ManagerNotificationHistoryQueryVariables> | ReactiveFunction<ManagerNotificationHistoryQueryVariables>, options: VueApolloComposable.UseQueryOptions<ManagerNotificationHistoryQuery, ManagerNotificationHistoryQueryVariables> | VueCompositionApi.Ref<VueApolloComposable.UseQueryOptions<ManagerNotificationHistoryQuery, ManagerNotificationHistoryQueryVariables>> | ReactiveFunction<VueApolloComposable.UseQueryOptions<ManagerNotificationHistoryQuery, ManagerNotificationHistoryQueryVariables>> = {}) {
|
||||
return VueApolloComposable.useLazyQuery<ManagerNotificationHistoryQuery, ManagerNotificationHistoryQueryVariables>(ManagerNotificationHistoryDocument, variables, options);
|
||||
}
|
||||
export type ManagerNotificationHistoryQueryCompositionFunctionResult = VueApolloComposable.UseQueryReturn<ManagerNotificationHistoryQuery, ManagerNotificationHistoryQueryVariables>;
|
||||
export const MyMessengerConnectionsDocument = gql`
|
||||
query MyMessengerConnections {
|
||||
myMessengerConnections {
|
||||
@@ -1072,39 +1593,6 @@ export function useSendTestMessengerMessageMutation(options: VueApolloComposable
|
||||
return VueApolloComposable.useMutation<SendTestMessengerMessageMutation, SendTestMessengerMessageMutationVariables>(SendTestMessengerMessageDocument, options);
|
||||
}
|
||||
export type SendTestMessengerMessageMutationCompositionFunctionResult = VueApolloComposable.UseMutationReturn<SendTestMessengerMessageMutation, SendTestMessengerMessageMutationVariables>;
|
||||
export const ClientReviewOrderDocument = gql`
|
||||
mutation ClientReviewOrder($orderId: ID!, $decision: Decision!) {
|
||||
clientReviewOrder(orderId: $orderId, decision: $decision) {
|
||||
id
|
||||
status
|
||||
clientApproved
|
||||
managerApproved
|
||||
}
|
||||
}
|
||||
`;
|
||||
|
||||
/**
|
||||
* __useClientReviewOrderMutation__
|
||||
*
|
||||
* To run a mutation, you first call `useClientReviewOrderMutation` within a Vue component and pass it any options that fit your needs.
|
||||
* When your component renders, `useClientReviewOrderMutation` returns an object that includes:
|
||||
* - A mutate function that you can call at any time to execute the mutation
|
||||
* - Several other properties: https://v4.apollo.vuejs.org/api/use-mutation.html#return
|
||||
*
|
||||
* @param options that will be passed into the mutation, supported options are listed on: https://v4.apollo.vuejs.org/guide-composable/mutation.html#options;
|
||||
*
|
||||
* @example
|
||||
* const { mutate, loading, error, onDone } = useClientReviewOrderMutation({
|
||||
* variables: {
|
||||
* orderId: // value for 'orderId'
|
||||
* decision: // value for 'decision'
|
||||
* },
|
||||
* });
|
||||
*/
|
||||
export function useClientReviewOrderMutation(options: VueApolloComposable.UseMutationOptions<ClientReviewOrderMutation, ClientReviewOrderMutationVariables> | ReactiveFunction<VueApolloComposable.UseMutationOptions<ClientReviewOrderMutation, ClientReviewOrderMutationVariables>> = {}) {
|
||||
return VueApolloComposable.useMutation<ClientReviewOrderMutation, ClientReviewOrderMutationVariables>(ClientReviewOrderDocument, options);
|
||||
}
|
||||
export type ClientReviewOrderMutationCompositionFunctionResult = VueApolloComposable.UseMutationReturn<ClientReviewOrderMutation, ClientReviewOrderMutationVariables>;
|
||||
export const MyCurrentOrdersDocument = gql`
|
||||
query MyCurrentOrders {
|
||||
myCurrentOrders {
|
||||
|
||||
13
app/middleware/manager-only.ts
Normal file
13
app/middleware/manager-only.ts
Normal file
@@ -0,0 +1,13 @@
|
||||
import { MeDocument } from '~/composables/graphql/generated';
|
||||
|
||||
export default defineNuxtRouteMiddleware(async () => {
|
||||
const { client } = useApolloClient('default');
|
||||
const response = await client.query({
|
||||
query: MeDocument,
|
||||
fetchPolicy: 'cache-first',
|
||||
});
|
||||
|
||||
if (response.data.me?.role !== 'MANAGER') {
|
||||
return navigateTo('/');
|
||||
}
|
||||
});
|
||||
289
app/pages/client-orders.vue
Normal file
289
app/pages/client-orders.vue
Normal file
@@ -0,0 +1,289 @@
|
||||
<script setup lang="ts">
|
||||
import { useMutation, useQuery } from '@vue/apollo-composable';
|
||||
import OrderStatusBadge from '~/components/orders/OrderStatusBadge.vue';
|
||||
import {
|
||||
BlockOrderDocument,
|
||||
CompleteOrderDocument,
|
||||
ManagerFinalizeOrderDocument,
|
||||
ManagerOrdersDocument,
|
||||
ManagerSetOrderOfferDocument,
|
||||
StartOrderWorkDocument,
|
||||
type ManagerOrdersQuery,
|
||||
} from '~/composables/graphql/generated';
|
||||
|
||||
definePageMeta({
|
||||
middleware: ['manager-only'],
|
||||
});
|
||||
|
||||
type ManagerOrderItem = ManagerOrdersQuery['managerOrders'][number];
|
||||
|
||||
const ACTIVE_STATUSES = new Set(['NEW', 'MANAGER_PROCESSING', 'WAITING_DOUBLE_CONFIRM', 'CONFIRMED', 'IN_PROGRESS']);
|
||||
const CLOSED_STATUSES = new Set(['COMPLETED', 'CLIENT_REJECTED', 'MANAGER_REJECTED', 'MANAGER_BLOCKED']);
|
||||
|
||||
const ordersQuery = useQuery(ManagerOrdersDocument, { status: null });
|
||||
|
||||
const setOfferMutation = useMutation(ManagerSetOrderOfferDocument);
|
||||
const finalizeMutation = useMutation(ManagerFinalizeOrderDocument);
|
||||
const blockMutation = useMutation(BlockOrderDocument);
|
||||
const startWorkMutation = useMutation(StartOrderWorkDocument);
|
||||
const completeWorkMutation = useMutation(CompleteOrderDocument);
|
||||
|
||||
const search = ref('');
|
||||
const statusFilter = ref<'ALL' | 'WAITING' | 'ACTIVE' | 'CLOSED'>('ALL');
|
||||
|
||||
const offerForm = reactive<Record<string, { deliveryTerms: string; deliveryFee: number; totalPrice: number }>>({});
|
||||
|
||||
watchEffect(() => {
|
||||
for (const order of ordersQuery.result.value?.managerOrders ?? []) {
|
||||
if (!offerForm[order.id]) {
|
||||
offerForm[order.id] = {
|
||||
deliveryTerms: order.deliveryTerms || 'Доставка 3-5 дней',
|
||||
deliveryFee: Number(order.deliveryFee ?? 1000),
|
||||
totalPrice: Number(order.totalPrice ?? 12500),
|
||||
};
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
function matchesFilter(order: ManagerOrderItem) {
|
||||
if (statusFilter.value === 'ALL') {
|
||||
return true;
|
||||
}
|
||||
if (statusFilter.value === 'WAITING') {
|
||||
return order.status === 'WAITING_DOUBLE_CONFIRM';
|
||||
}
|
||||
if (statusFilter.value === 'ACTIVE') {
|
||||
return ACTIVE_STATUSES.has(order.status);
|
||||
}
|
||||
return CLOSED_STATUSES.has(order.status);
|
||||
}
|
||||
|
||||
function getOffer(orderId: string) {
|
||||
if (!offerForm[orderId]) {
|
||||
offerForm[orderId] = {
|
||||
deliveryTerms: 'Доставка 3-5 дней',
|
||||
deliveryFee: 1000,
|
||||
totalPrice: 12500,
|
||||
};
|
||||
}
|
||||
|
||||
return offerForm[orderId];
|
||||
}
|
||||
|
||||
function updateOfferField(orderId: string, field: 'deliveryTerms' | 'deliveryFee' | 'totalPrice', value: string) {
|
||||
const offer = getOffer(orderId);
|
||||
if (field === 'deliveryTerms') {
|
||||
offer.deliveryTerms = value;
|
||||
return;
|
||||
}
|
||||
|
||||
const numericValue = Number(value);
|
||||
offer[field] = Number.isFinite(numericValue) ? numericValue : 0;
|
||||
}
|
||||
|
||||
const filteredOrders = computed(() => {
|
||||
const orders = ordersQuery.result.value?.managerOrders ?? [];
|
||||
const query = search.value.trim().toLowerCase();
|
||||
|
||||
return orders.filter((order) => {
|
||||
const haystack = [
|
||||
order.code,
|
||||
order.customerId || '',
|
||||
order.deliveryAddress || '',
|
||||
...order.items.map((item) => item.productName),
|
||||
]
|
||||
.join(' ')
|
||||
.toLowerCase();
|
||||
|
||||
const matchSearch = !query || haystack.includes(query);
|
||||
return matchSearch && matchesFilter(order);
|
||||
});
|
||||
});
|
||||
|
||||
async function refetchOrders() {
|
||||
await ordersQuery.refetch({
|
||||
status: null,
|
||||
});
|
||||
}
|
||||
|
||||
async function publishOffer(orderId: string) {
|
||||
const form = getOffer(orderId);
|
||||
|
||||
await setOfferMutation.mutate({
|
||||
input: {
|
||||
orderId,
|
||||
deliveryTerms: form.deliveryTerms,
|
||||
deliveryFee: Number(form.deliveryFee),
|
||||
totalPrice: Number(form.totalPrice),
|
||||
},
|
||||
});
|
||||
|
||||
await refetchOrders();
|
||||
}
|
||||
|
||||
async function approve(orderId: string) {
|
||||
await finalizeMutation.mutate({
|
||||
orderId,
|
||||
decision: 'APPROVE',
|
||||
});
|
||||
await refetchOrders();
|
||||
}
|
||||
|
||||
async function reject(orderId: string) {
|
||||
await finalizeMutation.mutate({
|
||||
orderId,
|
||||
decision: 'REJECT',
|
||||
});
|
||||
await refetchOrders();
|
||||
}
|
||||
|
||||
async function blockOrder(orderId: string) {
|
||||
await blockMutation.mutate({
|
||||
input: {
|
||||
orderId,
|
||||
reason: 'Нужно уточнение параметров заказа.',
|
||||
},
|
||||
});
|
||||
await refetchOrders();
|
||||
}
|
||||
|
||||
async function start(orderId: string) {
|
||||
await startWorkMutation.mutate({
|
||||
orderId,
|
||||
});
|
||||
await refetchOrders();
|
||||
}
|
||||
|
||||
async function complete(orderId: string) {
|
||||
await completeWorkMutation.mutate({
|
||||
orderId,
|
||||
});
|
||||
await refetchOrders();
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<section class="space-y-6">
|
||||
<div class="manager-hero">
|
||||
<p class="manager-eyebrow">Заказы клиентов</p>
|
||||
<h1 class="manager-title">Разбор заявок, офферов и статусов без отдельной менеджерки</h1>
|
||||
<p class="manager-copy">
|
||||
Фильтруйте заявки, публикуйте условия доставки, подтверждайте работу и доводите заказ до завершения прямо в основном кабинете.
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<div class="surface-card rounded-3xl p-4 md:p-5">
|
||||
<div class="grid gap-3 md:grid-cols-[1fr_auto]">
|
||||
<label class="form-control">
|
||||
<span class="label-text">Поиск</span>
|
||||
<input
|
||||
v-model="search"
|
||||
type="text"
|
||||
class="input manager-field w-full"
|
||||
placeholder="Номер, пользователь, адрес или товар"
|
||||
>
|
||||
</label>
|
||||
|
||||
<label class="form-control md:min-w-60">
|
||||
<span class="label-text">Фильтр</span>
|
||||
<select v-model="statusFilter" class="select manager-field w-full">
|
||||
<option value="ALL">Все заказы</option>
|
||||
<option value="WAITING">Ожидают подтверждения</option>
|
||||
<option value="ACTIVE">Активные</option>
|
||||
<option value="CLOSED">Закрытые</option>
|
||||
</select>
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div v-if="ordersQuery.loading.value" class="manager-empty-state">
|
||||
Загружаем очередь заказов...
|
||||
</div>
|
||||
<div v-else-if="filteredOrders.length === 0" class="manager-empty-state">
|
||||
По текущим условиям заказов не найдено.
|
||||
</div>
|
||||
|
||||
<div v-else class="space-y-4">
|
||||
<article
|
||||
v-for="order in filteredOrders"
|
||||
:key="order.id"
|
||||
class="surface-card rounded-3xl p-5"
|
||||
>
|
||||
<div class="flex flex-wrap items-start justify-between gap-3">
|
||||
<div class="space-y-1">
|
||||
<h2 class="text-xl font-bold text-[#123824]">{{ order.code }}</h2>
|
||||
<div class="flex flex-wrap gap-3 text-sm text-[#5c7b69]">
|
||||
<span>Клиент: {{ order.customerId || 'не указан' }}</span>
|
||||
<span>{{ new Date(order.createdAt).toLocaleString() }}</span>
|
||||
</div>
|
||||
</div>
|
||||
<OrderStatusBadge :status="order.status" />
|
||||
</div>
|
||||
|
||||
<div class="mt-4 grid gap-3 lg:grid-cols-[1.1fr_0.9fr]">
|
||||
<div class="space-y-3">
|
||||
<div class="surface-subcard p-4">
|
||||
<p class="text-sm font-semibold text-[#123824]">Состав заказа</p>
|
||||
<ul class="mt-3 space-y-2 text-sm text-[#214735]">
|
||||
<li
|
||||
v-for="item in order.items"
|
||||
:key="item.id"
|
||||
class="manager-mini-card"
|
||||
>
|
||||
{{ item.productName }} × {{ item.quantity }}
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<div class="surface-subcard p-4">
|
||||
<p class="text-sm font-semibold text-[#123824]">Доставка</p>
|
||||
<div class="mt-3 grid gap-3 text-sm text-[#214735] md:grid-cols-2">
|
||||
<div class="manager-mini-card">
|
||||
Адрес: {{ order.deliveryAddress || 'клиент еще не выбрал адрес' }}
|
||||
</div>
|
||||
<div class="manager-mini-card">
|
||||
Условия: {{ order.deliveryTerms || 'ожидает оффера менеджера' }}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="surface-subcard p-4">
|
||||
<p class="text-sm font-semibold text-[#123824]">Оффер и действия</p>
|
||||
<div class="mt-3 space-y-3">
|
||||
<input
|
||||
:value="getOffer(order.id).deliveryTerms"
|
||||
class="input manager-field w-full"
|
||||
placeholder="Условия доставки"
|
||||
@input="updateOfferField(order.id, 'deliveryTerms', ($event.target as HTMLInputElement).value)"
|
||||
>
|
||||
<input
|
||||
:value="getOffer(order.id).deliveryFee"
|
||||
type="number"
|
||||
class="input manager-field w-full"
|
||||
placeholder="Стоимость доставки"
|
||||
@input="updateOfferField(order.id, 'deliveryFee', ($event.target as HTMLInputElement).value)"
|
||||
>
|
||||
<input
|
||||
:value="getOffer(order.id).totalPrice"
|
||||
type="number"
|
||||
class="input manager-field w-full"
|
||||
placeholder="Итоговая стоимость"
|
||||
@input="updateOfferField(order.id, 'totalPrice', ($event.target as HTMLInputElement).value)"
|
||||
>
|
||||
</div>
|
||||
|
||||
<div class="mt-4 flex flex-wrap gap-2">
|
||||
<button class="btn btn-primary btn-sm border-0" @click="publishOffer(order.id)">Публиковать оффер</button>
|
||||
<button class="btn btn-success btn-sm border-0" @click="approve(order.id)">Подтвердить</button>
|
||||
<button class="btn btn-error btn-sm border-0" @click="reject(order.id)">Отклонить</button>
|
||||
<button class="btn btn-warning btn-sm border-0" @click="blockOrder(order.id)">Заблокировать</button>
|
||||
<button class="btn btn-accent btn-sm border-0" :disabled="order.status !== 'CONFIRMED'" @click="start(order.id)">В работу</button>
|
||||
<button class="btn btn-neutral btn-sm border-0" :disabled="order.status !== 'IN_PROGRESS'" @click="complete(order.id)">Завершить</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</article>
|
||||
</div>
|
||||
</section>
|
||||
</template>
|
||||
391
app/pages/clients.vue
Normal file
391
app/pages/clients.vue
Normal file
@@ -0,0 +1,391 @@
|
||||
<script setup lang="ts">
|
||||
import { useMutation, useQuery } from '@vue/apollo-composable';
|
||||
import {
|
||||
AddBonusTransactionDocument,
|
||||
CreateInvitationDocument,
|
||||
CreateReferralDocument,
|
||||
ManagerNotificationHistoryDocument,
|
||||
MyMessengerConnectionsDocument,
|
||||
RegistrationRequestsDocument,
|
||||
ReviewRegistrationRequestDocument,
|
||||
ReviewRewardWithdrawalDocument,
|
||||
type ManagerNotificationHistoryQuery,
|
||||
} from '~/composables/graphql/generated';
|
||||
import {
|
||||
messengerConnectionAvatarSrc,
|
||||
messengerConnectionHandle,
|
||||
messengerConnectionInitials,
|
||||
messengerConnectionName,
|
||||
} from '~/composables/useMessengerConnectionPresentation';
|
||||
import { useGqlClient } from '~/composables/useGqlClient';
|
||||
|
||||
definePageMeta({
|
||||
middleware: ['manager-only'],
|
||||
});
|
||||
|
||||
type HistoryItem = ManagerNotificationHistoryQuery['managerNotificationHistory'][number];
|
||||
|
||||
const gql = useGqlClient();
|
||||
|
||||
const registrationQuery = useQuery(RegistrationRequestsDocument, {
|
||||
status: 'PENDING',
|
||||
});
|
||||
const connectionsQuery = useQuery(MyMessengerConnectionsDocument);
|
||||
|
||||
const reviewRequestMutation = useMutation(ReviewRegistrationRequestDocument);
|
||||
const createInvitationMutation = useMutation(CreateInvitationDocument);
|
||||
const createReferralMutation = useMutation(CreateReferralDocument);
|
||||
const addBonusMutation = useMutation(AddBonusTransactionDocument);
|
||||
const reviewWithdrawalMutation = useMutation(ReviewRewardWithdrawalDocument);
|
||||
|
||||
const selectedHistoryChannel = ref<'TELEGRAM' | 'MAX'>('TELEGRAM');
|
||||
const targetUserId = ref('');
|
||||
const historyItems = ref<HistoryItem[]>([]);
|
||||
const historyError = ref('');
|
||||
const historyLoading = ref(false);
|
||||
|
||||
const invitationEmail = ref('');
|
||||
const invitationCompanyName = ref('');
|
||||
const invitationToken = ref('');
|
||||
|
||||
const referralUserId = ref('');
|
||||
const referralCreatedId = ref('');
|
||||
|
||||
const bonusUserId = ref('');
|
||||
const bonusAmount = ref(100);
|
||||
const bonusReason = ref('Реферальный бонус');
|
||||
const bonusCreatedId = ref('');
|
||||
|
||||
const withdrawalId = ref('');
|
||||
const withdrawalDecision = ref<'APPROVE' | 'REJECT'>('APPROVE');
|
||||
const withdrawalComment = ref('');
|
||||
const withdrawalResult = ref('');
|
||||
|
||||
const pendingRequests = computed(() => registrationQuery.result.value?.registrationRequests ?? []);
|
||||
|
||||
const telegramConnection = computed(() =>
|
||||
connectionsQuery.result.value?.myMessengerConnections?.find(
|
||||
(item) => item.type === 'TELEGRAM' && item.isActive,
|
||||
),
|
||||
);
|
||||
|
||||
const maxConnection = computed(() =>
|
||||
connectionsQuery.result.value?.myMessengerConnections?.find(
|
||||
(item) => item.type === 'MAX' && item.isActive,
|
||||
),
|
||||
);
|
||||
|
||||
async function approveRequest(requestId: string) {
|
||||
await reviewRequestMutation.mutate({
|
||||
input: {
|
||||
requestId,
|
||||
decision: 'APPROVE',
|
||||
},
|
||||
});
|
||||
await registrationQuery.refetch({
|
||||
status: 'PENDING',
|
||||
});
|
||||
}
|
||||
|
||||
async function rejectRequest(requestId: string) {
|
||||
await reviewRequestMutation.mutate({
|
||||
input: {
|
||||
requestId,
|
||||
decision: 'REJECT',
|
||||
rejectionReason: 'Не хватает данных для регистрации.',
|
||||
},
|
||||
});
|
||||
await registrationQuery.refetch({
|
||||
status: 'PENDING',
|
||||
});
|
||||
}
|
||||
|
||||
async function createInvitation() {
|
||||
invitationToken.value = '';
|
||||
const response = await createInvitationMutation.mutate({
|
||||
input: {
|
||||
email: invitationEmail.value,
|
||||
companyName: invitationCompanyName.value,
|
||||
expiresInDays: 7,
|
||||
},
|
||||
});
|
||||
|
||||
invitationToken.value = response?.data?.createInvitation.token ?? '';
|
||||
}
|
||||
|
||||
async function createReferral() {
|
||||
referralCreatedId.value = '';
|
||||
const response = await createReferralMutation.mutate({
|
||||
input: {
|
||||
refereeUserId: referralUserId.value,
|
||||
},
|
||||
});
|
||||
|
||||
referralCreatedId.value = response?.data?.createReferral.id ?? '';
|
||||
}
|
||||
|
||||
async function addBonus() {
|
||||
bonusCreatedId.value = '';
|
||||
const response = await addBonusMutation.mutate({
|
||||
input: {
|
||||
userId: bonusUserId.value,
|
||||
amount: Number(bonusAmount.value),
|
||||
reason: bonusReason.value,
|
||||
},
|
||||
});
|
||||
|
||||
bonusCreatedId.value = response?.data?.addBonusTransaction.id ?? '';
|
||||
}
|
||||
|
||||
async function reviewWithdrawal() {
|
||||
withdrawalResult.value = '';
|
||||
const response = await reviewWithdrawalMutation.mutate({
|
||||
input: {
|
||||
withdrawalId: withdrawalId.value,
|
||||
decision: withdrawalDecision.value,
|
||||
reviewComment: withdrawalComment.value || undefined,
|
||||
},
|
||||
});
|
||||
|
||||
withdrawalResult.value = response?.data?.reviewRewardWithdrawal.status ?? '';
|
||||
}
|
||||
|
||||
async function loadHistory() {
|
||||
historyError.value = '';
|
||||
historyItems.value = [];
|
||||
|
||||
if (!targetUserId.value.trim()) {
|
||||
historyError.value = 'Укажите user ID клиента, чтобы загрузить историю уведомлений.';
|
||||
return;
|
||||
}
|
||||
|
||||
historyLoading.value = true;
|
||||
try {
|
||||
const response = await gql.query({
|
||||
query: ManagerNotificationHistoryDocument,
|
||||
variables: {
|
||||
userId: targetUserId.value.trim(),
|
||||
channel: selectedHistoryChannel.value,
|
||||
limit: 50,
|
||||
},
|
||||
fetchPolicy: 'no-cache',
|
||||
});
|
||||
|
||||
historyItems.value = response.data.managerNotificationHistory;
|
||||
} catch (error) {
|
||||
historyError.value = error instanceof Error ? error.message : 'Не удалось загрузить историю уведомлений.';
|
||||
} finally {
|
||||
historyLoading.value = false;
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<section class="space-y-6">
|
||||
<div class="manager-hero">
|
||||
<p class="manager-eyebrow">Клиенты</p>
|
||||
<h1 class="manager-title">Все менеджерские действия по клиентам в одном экране</h1>
|
||||
<p class="manager-copy">
|
||||
Здесь можно разбирать заявки на регистрацию, выдавать инвайты, смотреть историю уведомлений клиента и вести бонусные операции.
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<div class="grid gap-4 lg:grid-cols-3">
|
||||
<div class="manager-stat-card">
|
||||
<p class="manager-stat-label">Новые заявки</p>
|
||||
<p class="manager-stat-value">{{ pendingRequests.length }}</p>
|
||||
<p class="manager-helper">Очередь на проверку новых клиентов.</p>
|
||||
</div>
|
||||
<div class="manager-stat-card">
|
||||
<p class="manager-stat-label">Telegram менеджера</p>
|
||||
<p class="manager-stat-value text-lg">
|
||||
{{ telegramConnection ? messengerConnectionName(telegramConnection) : 'Не подключен' }}
|
||||
</p>
|
||||
<p class="manager-helper">Личные каналы менеджера настраиваются в профиле.</p>
|
||||
</div>
|
||||
<div class="manager-stat-card">
|
||||
<p class="manager-stat-label">Max менеджера</p>
|
||||
<p class="manager-stat-value text-lg">
|
||||
{{ maxConnection ? messengerConnectionName(maxConnection) : 'Не подключен' }}
|
||||
</p>
|
||||
<p class="manager-helper">Используется для тестов и рабочих уведомлений.</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="grid gap-4 xl:grid-cols-[1.2fr_0.8fr]">
|
||||
<div class="surface-card rounded-3xl p-5">
|
||||
<div class="flex flex-wrap items-start justify-between gap-3">
|
||||
<div>
|
||||
<h2 class="text-xl font-bold text-[#123824]">Заявки на регистрацию</h2>
|
||||
<p class="manager-helper">Проверьте компанию и примите решение без перехода в отдельный кабинет.</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div v-if="registrationQuery.loading.value" class="manager-empty-state mt-4">
|
||||
Загружаем очередь заявок...
|
||||
</div>
|
||||
<div v-else-if="pendingRequests.length === 0" class="manager-empty-state mt-4">
|
||||
Новых заявок сейчас нет.
|
||||
</div>
|
||||
<div v-else class="mt-4 space-y-3">
|
||||
<article
|
||||
v-for="request in pendingRequests"
|
||||
:key="request.id"
|
||||
class="surface-subcard p-4"
|
||||
>
|
||||
<div class="flex flex-wrap items-start justify-between gap-3">
|
||||
<div class="space-y-1">
|
||||
<h3 class="text-lg font-bold text-[#123824]">{{ request.companyName }}</h3>
|
||||
<p class="text-sm text-[#466653]">{{ request.contactName }} • {{ request.email }}</p>
|
||||
<p class="text-xs text-[#5c7b69]">{{ new Date(request.createdAt).toLocaleString() }}</p>
|
||||
</div>
|
||||
<div class="flex flex-wrap gap-2">
|
||||
<button class="btn btn-success btn-sm border-0" @click="approveRequest(request.id)">Одобрить</button>
|
||||
<button class="btn btn-error btn-sm border-0" @click="rejectRequest(request.id)">Отклонить</button>
|
||||
</div>
|
||||
</div>
|
||||
</article>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="space-y-4">
|
||||
<div class="surface-card rounded-3xl p-5">
|
||||
<h2 class="text-xl font-bold text-[#123824]">Инвайт клиенту</h2>
|
||||
<p class="manager-helper mt-1">Быстро выдайте ссылку на вход новой компании.</p>
|
||||
|
||||
<div class="mt-4 space-y-3">
|
||||
<input v-model="invitationEmail" type="email" class="input manager-field w-full" placeholder="Email клиента">
|
||||
<input v-model="invitationCompanyName" type="text" class="input manager-field w-full" placeholder="Компания">
|
||||
<button class="btn btn-primary border-0" @click="createInvitation">Создать инвайт</button>
|
||||
<div v-if="invitationToken" class="manager-mini-card text-sm text-[#123824]">
|
||||
Токен приглашения: <span class="font-semibold">{{ invitationToken }}</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="surface-card rounded-3xl p-5">
|
||||
<h2 class="text-xl font-bold text-[#123824]">Рабочие каналы менеджера</h2>
|
||||
<p class="manager-helper mt-1">
|
||||
Подключение Telegram и Max выполняется в <NuxtLink to="/profile/notifications" class="font-semibold text-[#0d854a]">профиле</NuxtLink>.
|
||||
</p>
|
||||
|
||||
<div class="mt-4 flex flex-wrap gap-2">
|
||||
<div class="manager-channel-chip">
|
||||
<div v-if="telegramConnection && messengerConnectionAvatarSrc(telegramConnection)" class="avatar">
|
||||
<div class="manager-channel-dot h-8 w-8 rounded-full bg-[#123824]">
|
||||
<img :src="messengerConnectionAvatarSrc(telegramConnection)" :alt="messengerConnectionName(telegramConnection)">
|
||||
</div>
|
||||
</div>
|
||||
<span v-else class="manager-channel-dot bg-[#123824]">
|
||||
{{ messengerConnectionInitials(telegramConnection, 'TG') }}
|
||||
</span>
|
||||
<span class="text-sm font-semibold text-[#123824]">
|
||||
{{ telegramConnection ? messengerConnectionHandle(telegramConnection) || messengerConnectionName(telegramConnection) : 'Telegram не подключен' }}
|
||||
</span>
|
||||
</div>
|
||||
|
||||
<div class="manager-channel-chip">
|
||||
<span class="manager-channel-dot bg-[#2b7fff]">
|
||||
{{ messengerConnectionInitials(maxConnection, 'MX') }}
|
||||
</span>
|
||||
<span class="text-sm font-semibold text-[#123824]">
|
||||
{{ maxConnection ? messengerConnectionHandle(maxConnection) || messengerConnectionName(maxConnection) : 'Max не подключен' }}
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="grid gap-4 xl:grid-cols-[1.15fr_0.85fr]">
|
||||
<div class="surface-card rounded-3xl p-5">
|
||||
<div class="flex flex-wrap items-start justify-between gap-3">
|
||||
<div>
|
||||
<h2 class="text-xl font-bold text-[#123824]">История уведомлений клиента</h2>
|
||||
<p class="manager-helper mt-1">Проверяйте, что именно ушло клиенту в Telegram или Max.</p>
|
||||
</div>
|
||||
|
||||
<div class="tabs tabs-boxed">
|
||||
<button class="tab" :class="{ 'tab-active': selectedHistoryChannel === 'TELEGRAM' }" @click="selectedHistoryChannel = 'TELEGRAM'">
|
||||
Telegram
|
||||
</button>
|
||||
<button class="tab" :class="{ 'tab-active': selectedHistoryChannel === 'MAX' }" @click="selectedHistoryChannel = 'MAX'">
|
||||
Max
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="mt-4 flex flex-col gap-3 md:flex-row">
|
||||
<input v-model="targetUserId" class="input manager-field w-full" placeholder="User ID клиента">
|
||||
<button class="btn btn-secondary border-0 md:w-auto" @click="loadHistory">Загрузить</button>
|
||||
</div>
|
||||
|
||||
<div v-if="historyLoading" class="manager-empty-state mt-4">
|
||||
Загружаем историю...
|
||||
</div>
|
||||
<div v-else-if="historyError" class="manager-empty-state mt-4 text-[#a34a34]">
|
||||
{{ historyError }}
|
||||
</div>
|
||||
<div v-else-if="historyItems.length === 0" class="manager-empty-state mt-4">
|
||||
История пока пустая.
|
||||
</div>
|
||||
<ul v-else class="mt-4 space-y-3">
|
||||
<li
|
||||
v-for="item in historyItems"
|
||||
:key="item.id"
|
||||
class="surface-subcard p-4"
|
||||
>
|
||||
<p class="font-semibold text-[#123824]">{{ item.title }}</p>
|
||||
<p class="mt-1 text-sm text-[#355947]">{{ item.message }}</p>
|
||||
<div class="mt-3 flex flex-wrap gap-3 text-xs text-[#5c7b69]">
|
||||
<span>{{ new Date(item.createdAt).toLocaleString() }}</span>
|
||||
<span v-if="item.orderId">Заказ: {{ item.orderId }}</span>
|
||||
</div>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<div class="space-y-4">
|
||||
<div class="surface-card rounded-3xl p-5">
|
||||
<h2 class="text-xl font-bold text-[#123824]">Реферальная связь</h2>
|
||||
<div class="mt-4 space-y-3">
|
||||
<input v-model="referralUserId" class="input manager-field w-full" placeholder="ID приглашенного пользователя">
|
||||
<button class="btn btn-primary border-0" @click="createReferral">Создать связь</button>
|
||||
<div v-if="referralCreatedId" class="manager-mini-card text-sm text-[#123824]">
|
||||
Создана связь: <span class="font-semibold">{{ referralCreatedId }}</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="surface-card rounded-3xl p-5">
|
||||
<h2 class="text-xl font-bold text-[#123824]">Начислить бонус</h2>
|
||||
<div class="mt-4 space-y-3">
|
||||
<input v-model="bonusUserId" class="input manager-field w-full" placeholder="ID пользователя">
|
||||
<input v-model="bonusAmount" type="number" class="input manager-field w-full" placeholder="Сумма">
|
||||
<input v-model="bonusReason" class="input manager-field w-full" placeholder="Причина">
|
||||
<button class="btn btn-secondary border-0" @click="addBonus">Начислить</button>
|
||||
<div v-if="bonusCreatedId" class="manager-mini-card text-sm text-[#123824]">
|
||||
Создана транзакция: <span class="font-semibold">{{ bonusCreatedId }}</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="surface-card rounded-3xl p-5">
|
||||
<h2 class="text-xl font-bold text-[#123824]">Заявка на вывод</h2>
|
||||
<div class="mt-4 space-y-3">
|
||||
<input v-model="withdrawalId" class="input manager-field w-full" placeholder="ID заявки на вывод">
|
||||
<select v-model="withdrawalDecision" class="select manager-field w-full">
|
||||
<option value="APPROVE">Одобрить</option>
|
||||
<option value="REJECT">Отклонить</option>
|
||||
</select>
|
||||
<textarea v-model="withdrawalComment" class="textarea manager-field min-h-28 w-full" placeholder="Комментарий для клиента" />
|
||||
<button class="btn btn-accent border-0" @click="reviewWithdrawal">Подтвердить решение</button>
|
||||
<div v-if="withdrawalResult" class="manager-mini-card text-sm text-[#123824]">
|
||||
Новый статус: <span class="font-semibold">{{ withdrawalResult }}</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
</template>
|
||||
@@ -1,8 +1,7 @@
|
||||
<script setup lang="ts">
|
||||
import { useMutation, useQuery } from '@vue/apollo-composable';
|
||||
import { useQuery } from '@vue/apollo-composable';
|
||||
import OrderStatusBadge from '~/components/orders/OrderStatusBadge.vue';
|
||||
import {
|
||||
ClientReviewOrderDocument,
|
||||
MyOrdersDocument,
|
||||
type MyOrdersQuery,
|
||||
} from '~/composables/graphql/generated';
|
||||
@@ -10,30 +9,12 @@ import {
|
||||
type OrderItem = MyOrdersQuery['myOrders'][number];
|
||||
|
||||
const allOrders = useQuery(MyOrdersDocument);
|
||||
const reviewOrder = useMutation(ClientReviewOrderDocument);
|
||||
const actionError = ref('');
|
||||
const search = ref('');
|
||||
const statusFilter = ref<'ALL' | 'WAITING' | 'ACTIVE' | 'CLOSED'>('ALL');
|
||||
|
||||
const ACTIVE_STATUSES = new Set(['NEW', 'MANAGER_PROCESSING', 'WAITING_DOUBLE_CONFIRM', 'CONFIRMED', 'IN_PROGRESS']);
|
||||
const CLOSED_STATUSES = new Set(['COMPLETED', 'CLIENT_REJECTED', 'MANAGER_REJECTED', 'MANAGER_BLOCKED']);
|
||||
|
||||
reviewOrder.onError((error) => {
|
||||
actionError.value = error.message;
|
||||
});
|
||||
|
||||
async function approve(orderId: string) {
|
||||
actionError.value = '';
|
||||
await reviewOrder.mutate({ orderId, decision: 'APPROVE' });
|
||||
await allOrders.refetch();
|
||||
}
|
||||
|
||||
async function reject(orderId: string) {
|
||||
actionError.value = '';
|
||||
await reviewOrder.mutate({ orderId, decision: 'REJECT' });
|
||||
await allOrders.refetch();
|
||||
}
|
||||
|
||||
function matchesFilter(order: OrderItem) {
|
||||
if (statusFilter.value === 'ALL') {
|
||||
return true;
|
||||
@@ -69,8 +50,6 @@ const filteredOrders = computed(() => {
|
||||
<section class="space-y-6">
|
||||
<h1 class="text-3xl font-extrabold text-[#0f2f20]">Заказы</h1>
|
||||
|
||||
<div v-if="actionError" class="alert alert-error">{{ actionError }}</div>
|
||||
|
||||
<div class="surface-card rounded-3xl p-4 md:p-5">
|
||||
<div class="grid gap-3 md:grid-cols-[1fr_auto]">
|
||||
<label class="form-control">
|
||||
@@ -136,15 +115,6 @@ const filteredOrders = computed(() => {
|
||||
<div class="mt-3 rounded-xl border border-[#d6ebde] bg-white/75 px-3 py-2 text-sm text-[#214735]">
|
||||
Адрес доставки: {{ order.deliveryAddress || 'адрес не был выбран' }}
|
||||
</div>
|
||||
|
||||
<div v-if="order.status === 'WAITING_DOUBLE_CONFIRM'" class="mt-4 flex flex-wrap gap-2">
|
||||
<button class="btn btn-sm border-0 bg-[#139957] text-white hover:bg-[#0d854a]" @click="approve(order.id)">
|
||||
Подтвердить
|
||||
</button>
|
||||
<button class="btn btn-sm border-0 bg-[#d32422] text-white hover:bg-[#b31f1d]" @click="reject(order.id)">
|
||||
Отклонить
|
||||
</button>
|
||||
</div>
|
||||
</article>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
@@ -3,5 +3,6 @@ query Me {
|
||||
id
|
||||
email
|
||||
fullName
|
||||
role
|
||||
}
|
||||
}
|
||||
|
||||
9
graphql/operations/manager/add-bonus-transaction.graphql
Normal file
9
graphql/operations/manager/add-bonus-transaction.graphql
Normal file
@@ -0,0 +1,9 @@
|
||||
mutation AddBonusTransaction($input: AddBonusTransactionInput!) {
|
||||
addBonusTransaction(input: $input) {
|
||||
id
|
||||
userId
|
||||
amount
|
||||
reason
|
||||
createdAt
|
||||
}
|
||||
}
|
||||
7
graphql/operations/manager/block-order.graphql
Normal file
7
graphql/operations/manager/block-order.graphql
Normal file
@@ -0,0 +1,7 @@
|
||||
mutation BlockOrder($input: BlockOrderInput!) {
|
||||
blockOrder(input: $input) {
|
||||
id
|
||||
status
|
||||
blockReason
|
||||
}
|
||||
}
|
||||
6
graphql/operations/manager/complete-order.graphql
Normal file
6
graphql/operations/manager/complete-order.graphql
Normal file
@@ -0,0 +1,6 @@
|
||||
mutation CompleteOrder($orderId: ID!) {
|
||||
completeOrder(orderId: $orderId) {
|
||||
id
|
||||
status
|
||||
}
|
||||
}
|
||||
9
graphql/operations/manager/create-invitation.graphql
Normal file
9
graphql/operations/manager/create-invitation.graphql
Normal file
@@ -0,0 +1,9 @@
|
||||
mutation CreateInvitation($input: CreateInvitationInput!) {
|
||||
createInvitation(input: $input) {
|
||||
id
|
||||
token
|
||||
email
|
||||
companyName
|
||||
expiresAt
|
||||
}
|
||||
}
|
||||
8
graphql/operations/manager/create-referral.graphql
Normal file
8
graphql/operations/manager/create-referral.graphql
Normal file
@@ -0,0 +1,8 @@
|
||||
mutation CreateReferral($input: CreateReferralInput!) {
|
||||
createReferral(input: $input) {
|
||||
id
|
||||
referrerId
|
||||
refereeId
|
||||
createdAt
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
mutation ManagerFinalizeOrder($orderId: ID!, $decision: Decision!) {
|
||||
managerFinalizeOrder(orderId: $orderId, decision: $decision) {
|
||||
id
|
||||
status
|
||||
managerApproved
|
||||
}
|
||||
}
|
||||
19
graphql/operations/manager/manager-orders.graphql
Normal file
19
graphql/operations/manager/manager-orders.graphql
Normal file
@@ -0,0 +1,19 @@
|
||||
query ManagerOrders($status: OrderStatus) {
|
||||
managerOrders(status: $status) {
|
||||
id
|
||||
code
|
||||
status
|
||||
kind
|
||||
customerId
|
||||
deliveryAddress
|
||||
deliveryTerms
|
||||
deliveryFee
|
||||
totalPrice
|
||||
createdAt
|
||||
items {
|
||||
id
|
||||
productName
|
||||
quantity
|
||||
}
|
||||
}
|
||||
}
|
||||
10
graphql/operations/manager/registration-requests.graphql
Normal file
10
graphql/operations/manager/registration-requests.graphql
Normal file
@@ -0,0 +1,10 @@
|
||||
query RegistrationRequests($status: RegistrationStatus) {
|
||||
registrationRequests(status: $status) {
|
||||
id
|
||||
companyName
|
||||
contactName
|
||||
email
|
||||
status
|
||||
createdAt
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
mutation ReviewRegistrationRequest($input: ReviewRegistrationRequestInput!) {
|
||||
reviewRegistrationRequest(input: $input) {
|
||||
id
|
||||
status
|
||||
rejectionReason
|
||||
reviewedById
|
||||
}
|
||||
}
|
||||
8
graphql/operations/manager/review-withdrawal.graphql
Normal file
8
graphql/operations/manager/review-withdrawal.graphql
Normal file
@@ -0,0 +1,8 @@
|
||||
mutation ReviewRewardWithdrawal($input: ReviewRewardWithdrawalInput!) {
|
||||
reviewRewardWithdrawal(input: $input) {
|
||||
id
|
||||
status
|
||||
reviewComment
|
||||
reviewedById
|
||||
}
|
||||
}
|
||||
9
graphql/operations/manager/set-order-offer.graphql
Normal file
9
graphql/operations/manager/set-order-offer.graphql
Normal file
@@ -0,0 +1,9 @@
|
||||
mutation ManagerSetOrderOffer($input: SetOrderOfferInput!) {
|
||||
managerSetOrderOffer(input: $input) {
|
||||
id
|
||||
code
|
||||
status
|
||||
deliveryTerms
|
||||
totalPrice
|
||||
}
|
||||
}
|
||||
6
graphql/operations/manager/start-order-work.graphql
Normal file
6
graphql/operations/manager/start-order-work.graphql
Normal file
@@ -0,0 +1,6 @@
|
||||
mutation StartOrderWork($orderId: ID!) {
|
||||
startOrderWork(orderId: $orderId) {
|
||||
id
|
||||
status
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
query ManagerNotificationHistory($userId: ID!, $channel: MessengerType!, $limit: Int) {
|
||||
managerNotificationHistory(userId: $userId, channel: $channel, limit: $limit) {
|
||||
id
|
||||
channel
|
||||
title
|
||||
message
|
||||
createdAt
|
||||
orderId
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user