diff --git a/apps/web/actions/profile.ts b/apps/web/actions/profile.ts index e92a3c2..021ec7a 100644 --- a/apps/web/actions/profile.ts +++ b/apps/web/actions/profile.ts @@ -14,6 +14,8 @@ export async function getProfile(input?: GetCustomerQueryVariables) { const { data } = await getCustomer({ telegramId }); const customer = data?.customers?.at(0); + if (!customer) throw new Error('Customer not found'); + return customer; } @@ -25,6 +27,7 @@ export async function updateProfile(input: CustomerInput) { const { data } = await getCustomer({ telegramId: user?.telegramId }); const customer = data.customers.at(0); + if (!customer) throw new Error('Customer not found'); await updateCustomerProfile({ diff --git a/apps/web/actions/service.ts b/apps/web/actions/service.ts new file mode 100644 index 0000000..8891a24 --- /dev/null +++ b/apps/web/actions/service.ts @@ -0,0 +1,19 @@ +'use server'; +// eslint-disable-next-line sonarjs/no-internal-api-use +import type * as ApolloTypes from '../../../packages/graphql/node_modules/@apollo/client/core'; +import { getProfile } from './profile'; +import * as api from '@repo/graphql/api/service'; +import { type GetServicesQueryVariables } from '@repo/graphql/types'; + +// eslint-disable-next-line @typescript-eslint/no-unused-vars +type FixTypescriptCringe = ApolloTypes.FetchResult; + +export async function getServices(input?: GetServicesQueryVariables) { + const customer = await getProfile(); + + const filters = input || { filters: { master: { documentId: { eq: customer.documentId } } } }; + + return api.getServices(filters); +} + +export const getService = api.getService; diff --git a/apps/web/actions/slots.ts b/apps/web/actions/slots.ts index b2b440b..420e89d 100644 --- a/apps/web/actions/slots.ts +++ b/apps/web/actions/slots.ts @@ -26,8 +26,6 @@ export async function addSlot(input: AddSlotInput) { export async function getSlots(input: GQL.GetSlotsQueryVariables) { const customer = await getProfile(); - if (!customer?.documentId) throw new Error('Customer not found'); - return api.getSlots({ filters: { ...input.filters, @@ -41,9 +39,7 @@ export async function getSlots(input: GQL.GetSlotsQueryVariables) { } export async function updateSlot(input: GQL.UpdateSlotMutationVariables) { - const customer = await getProfile(); - - if (!customer?.documentId) throw new Error('Customer not found'); + await getProfile(); return api.updateSlot({ ...input, diff --git a/apps/web/app/(main)/orders/add/page.tsx b/apps/web/app/(main)/orders/add/page.tsx index a917e2d..cd8888c 100644 --- a/apps/web/app/(main)/orders/add/page.tsx +++ b/apps/web/app/(main)/orders/add/page.tsx @@ -6,7 +6,7 @@ export default async function AddOrdersPage() { return ( <> - + diff --git a/apps/web/components/orders/components/contacts-grid.tsx b/apps/web/components/orders/components/contacts-grid.tsx new file mode 100644 index 0000000..c8b166d --- /dev/null +++ b/apps/web/components/orders/components/contacts-grid.tsx @@ -0,0 +1,63 @@ +'use client'; +import { LoadingSpinner } from '../../common/spinner'; +import { OrderContext } from '@/context/order'; +import { useCustomerContacts } from '@/hooks/contacts'; +// eslint-disable-next-line import/extensions +import AvatarPlaceholder from '@/public/avatar/avatar_placeholder.png'; +import { Label } from '@repo/ui/components/ui/label'; +import { cn } from '@repo/ui/lib/utils'; +import Image from 'next/image'; +import { use } from 'react'; + +export function ContactsGrid() { + const { customerId: selected, setCustomerId: setSelected, step } = use(OrderContext); + const { contacts, isLoading } = useCustomerContacts(); + + if (step !== 'customer-select') return null; + + if (isLoading) return ; + + return ( +
+ {contacts.map((contact) => { + if (!contact) return null; + + return ( + + ); + })} +
+ ); +} diff --git a/apps/web/components/orders/components/contacts-scroller.tsx b/apps/web/components/orders/components/contacts-scroller.tsx deleted file mode 100644 index cd21a4a..0000000 --- a/apps/web/components/orders/components/contacts-scroller.tsx +++ /dev/null @@ -1,64 +0,0 @@ -'use client'; -import { LoadingSpinner } from '../../common/spinner'; -import { useCustomerContacts } from '@/hooks/contacts'; -// eslint-disable-next-line import/extensions -import AvatarPlaceholder from '@/public/avatar/avatar_placeholder.png'; -import { Label } from '@repo/ui/components/ui/label'; -import { cn } from '@repo/ui/lib/utils'; -import Image from 'next/image'; -import { useState } from 'react'; - -export function ContactsScroller() { - const [selected, setSelected] = useState(null); - const { contacts, isLoading } = useCustomerContacts(); - - if (isLoading) return ; - - return ( -
-
-
- {contacts.map((contact) => { - if (!contact) return null; - - return ( - - ); - })} -
-
-
- ); -} diff --git a/apps/web/components/orders/components/index.ts b/apps/web/components/orders/components/index.ts index 50c9fb1..c2329ff 100644 --- a/apps/web/components/orders/components/index.ts +++ b/apps/web/components/orders/components/index.ts @@ -1 +1,3 @@ -export * from './contacts-scroller'; +export * from './contacts-grid'; +export * from './service-select'; +export * from './submit-button'; diff --git a/apps/web/components/orders/components/service-select.tsx b/apps/web/components/orders/components/service-select.tsx new file mode 100644 index 0000000..11ae274 --- /dev/null +++ b/apps/web/components/orders/components/service-select.tsx @@ -0,0 +1,28 @@ +'use client'; +import { OrderContext } from '@/context/order'; +import { useServicesQuery } from '@/hooks/service'; +import { type ServiceFieldsFragment } from '@repo/graphql/types'; +import { cn } from '@repo/ui/lib/utils'; +import { use } from 'react'; + +export function ServiceSelect() { + const { step } = use(OrderContext); + const { data } = useServicesQuery(); + + if (step !== 'service-select') return null; + + return data?.data.services.map( + (service) => service && , + ); +} + +function ServiceCard({ name }: Readonly) { + return ( +
+
+ {name} + ололо цена +
+
+ ); +} diff --git a/apps/web/components/orders/components/submit-button.tsx b/apps/web/components/orders/components/submit-button.tsx new file mode 100644 index 0000000..65326a5 --- /dev/null +++ b/apps/web/components/orders/components/submit-button.tsx @@ -0,0 +1,20 @@ +'use client'; +import { OrderContext } from '@/context/order'; +import { Button } from '@repo/ui/components/ui/button'; +import { use } from 'react'; + +export function SubmitButton() { + const { nextStep, step } = use(OrderContext); + + function handleOnclick() { + if (step !== 'success') { + nextStep(); + } + } + + return ( + + ); +} diff --git a/apps/web/components/orders/order-form.tsx b/apps/web/components/orders/order-form.tsx index 95656cb..5a5b53b 100644 --- a/apps/web/components/orders/order-form.tsx +++ b/apps/web/components/orders/order-form.tsx @@ -1,9 +1,14 @@ -import { ContactsScroller } from './components'; +import { ContactsGrid, ServiceSelect, SubmitButton } from './components'; +import { OrderContextProvider } from '@/context/order'; export function OrderForm() { return ( -
- +
+ + + + +
); } diff --git a/apps/web/context/order.tsx b/apps/web/context/order.tsx new file mode 100644 index 0000000..1f46177 --- /dev/null +++ b/apps/web/context/order.tsx @@ -0,0 +1,80 @@ +'use client'; +import { createContext, type PropsWithChildren, useMemo, useReducer, useState } from 'react'; + +type Action = { payload: Steps; type: 'SET_STEP' } | { type: 'NEXT_STEP' }; + +type ContextType = { + customerId: null | string; + nextStep: () => void; + orderId: null | string; + setCustomerId: (customerId: string) => void; + setOrderId: (orderId: string) => void; + setStep: (step: Steps) => void; + step: Steps; +}; + +type State = { step: Steps }; +type Steps = 'customer-select' | 'service-select' | 'success' | 'time-select'; + +const stepsSequence: Steps[] = ['customer-select', 'service-select', 'time-select', 'success']; + +function stepsReducer(state: State, action: Action): State { + switch (action.type) { + case 'NEXT_STEP': { + const currentIndex = stepsSequence.indexOf(state.step); + const nextIndex = currentIndex + 1; + const nextStep = stepsSequence[nextIndex]; + + return nextStep ? { ...state, step: nextStep } : state; + } + + case 'SET_STEP': { + return { ...state, step: action.payload }; + } + + default: + return state; + } +} + +function useCustomerState() { + const [customerId, setCustomerId] = useState(null); + return { customerId, setCustomerId }; +} + +function useOrderState() { + const [orderId, setOrderId] = useState(null); + return { orderId, setOrderId }; +} + +function useStep() { + const [state, dispatch] = useReducer(stepsReducer, { step: 'customer-select' }); + + const setStep = (payload: Steps) => dispatch({ payload, type: 'SET_STEP' }); + const nextStep = () => dispatch({ type: 'NEXT_STEP' }); + + return { nextStep, setStep, ...state }; +} + +export const OrderContext = createContext({} as ContextType); + +export function OrderContextProvider({ children }: Readonly) { + const { customerId, setCustomerId } = useCustomerState(); + const { orderId, setOrderId } = useOrderState(); + const { nextStep, setStep, step } = useStep(); + + const value = useMemo( + () => ({ + customerId, + nextStep, + orderId, + setCustomerId, + setOrderId, + setStep, + step, + }), + [customerId, nextStep, orderId, setCustomerId, setOrderId, setStep, step], + ); + + return {children}; +} diff --git a/apps/web/hooks/service/index.ts b/apps/web/hooks/service/index.ts new file mode 100644 index 0000000..b24bd7a --- /dev/null +++ b/apps/web/hooks/service/index.ts @@ -0,0 +1,15 @@ +'use client'; +import { getServices } from '@/actions/service'; +// eslint-disable-next-line sonarjs/no-internal-api-use +import type * as ApolloTypes from '@repo/graphql/node_modules/@apollo/client/core'; +import { type GetServicesQueryVariables } from '@repo/graphql/types'; +import { useQuery } from '@tanstack/react-query'; + +// eslint-disable-next-line @typescript-eslint/no-unused-vars +type FixTypescriptCringe = ApolloTypes.FetchResult; + +export const useServicesQuery = (input?: GetServicesQueryVariables) => + useQuery({ + queryFn: () => getServices(input), + queryKey: ['services', 'list'], + }); diff --git a/packages/graphql/api/index.ts b/packages/graphql/api/index.ts index 746f8f1..4f5a143 100644 --- a/packages/graphql/api/index.ts +++ b/packages/graphql/api/index.ts @@ -2,3 +2,4 @@ export * from './auth'; export * from './customer'; export * from './slot'; export * from './order'; +export * from './service'; diff --git a/packages/graphql/api/service.ts b/packages/graphql/api/service.ts new file mode 100644 index 0000000..fd4b00e --- /dev/null +++ b/packages/graphql/api/service.ts @@ -0,0 +1,21 @@ +'use server'; +import { getClientWithToken } from '../apollo/client'; +import * as GQL from '../types'; + +export async function getServices(input: GQL.GetServicesQueryVariables) { + const { query } = await getClientWithToken(); + + return query({ + query: GQL.GetServicesDocument, + variables: input, + }); +} + +export async function getService(input: GQL.GetServiceQueryVariables) { + const { query } = await getClientWithToken(); + + return query({ + query: GQL.GetServiceDocument, + variables: input, + }); +} diff --git a/packages/graphql/operations/service.graphql b/packages/graphql/operations/service.graphql new file mode 100644 index 0000000..1f91672 --- /dev/null +++ b/packages/graphql/operations/service.graphql @@ -0,0 +1,16 @@ +fragment ServiceFields on Service { + documentId + name +} + +query GetServices($filters: ServiceFiltersInput) { + services(filters: $filters) { + ...ServiceFields + } +} + +query GetService($documentId: ID!) { + service(documentId: $documentId) { + ...ServiceFields + } +} diff --git a/packages/graphql/types/operations.generated.ts b/packages/graphql/types/operations.generated.ts index 231335b..3be155f 100644 --- a/packages/graphql/types/operations.generated.ts +++ b/packages/graphql/types/operations.generated.ts @@ -91,6 +91,7 @@ export type CustomerFiltersInput = { photoUrl?: InputMaybe; publishedAt?: InputMaybe; role?: InputMaybe; + services?: InputMaybe; slots?: InputMaybe; telegramId?: InputMaybe; updatedAt?: InputMaybe; @@ -107,6 +108,7 @@ export type CustomerInput = { photoUrl?: InputMaybe; publishedAt?: InputMaybe; role?: InputMaybe; + services?: InputMaybe>>; slots?: InputMaybe>>; telegramId?: InputMaybe; }; @@ -421,6 +423,7 @@ export type ServiceFiltersInput = { and?: InputMaybe>>; createdAt?: InputMaybe; documentId?: InputMaybe; + master?: InputMaybe; name?: InputMaybe; not?: InputMaybe; or?: InputMaybe>>; @@ -430,6 +433,7 @@ export type ServiceFiltersInput = { }; export type ServiceInput = { + master?: InputMaybe; name?: InputMaybe; orders?: InputMaybe>>; publishedAt?: InputMaybe; @@ -695,6 +699,22 @@ export type GetOrderQueryVariables = Exact<{ export type GetOrderQuery = { __typename?: 'Query', order?: { __typename?: 'Order', documentId: string, time_start?: any | null | undefined, time_end?: any | null | undefined, state?: Enum_Order_State | null | undefined, order_number?: number | null | undefined, services: Array<{ __typename?: 'Service', documentId: string, name?: string | null | undefined } | null | undefined>, client?: { __typename?: 'Customer', name: string, documentId: string, photoUrl?: string | null | undefined } | null | undefined } | null | undefined }; +export type ServiceFieldsFragment = { __typename?: 'Service', documentId: string, name?: string | null | undefined }; + +export type GetServicesQueryVariables = Exact<{ + filters?: InputMaybe; +}>; + + +export type GetServicesQuery = { __typename?: 'Query', services: Array<{ __typename?: 'Service', documentId: string, name?: string | null | undefined } | null | undefined> }; + +export type GetServiceQueryVariables = Exact<{ + documentId: Scalars['ID']['input']; +}>; + + +export type GetServiceQuery = { __typename?: 'Query', service?: { __typename?: 'Service', documentId: string, name?: string | null | undefined } | null | undefined }; + export type SlotFieldsFragment = { __typename?: 'Slot', documentId: string, date?: any | null | undefined, time_start: any, time_end: any, state?: Enum_Slot_State | null | undefined }; export type CreateSlotMutationVariables = Exact<{ @@ -735,6 +755,7 @@ export type DeleteSlotMutation = { __typename?: 'Mutation', deleteSlot?: { __typ export const CustomerFieldsFragmentDoc = {"kind":"Document","definitions":[{"kind":"FragmentDefinition","name":{"kind":"Name","value":"CustomerFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"Customer"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"active"}},{"kind":"Field","name":{"kind":"Name","value":"documentId"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"phone"}},{"kind":"Field","name":{"kind":"Name","value":"photoUrl"}},{"kind":"Field","name":{"kind":"Name","value":"role"}},{"kind":"Field","name":{"kind":"Name","value":"telegramId"}}]}}]} as unknown as DocumentNode; export const OrderFieldsFragmentDoc = {"kind":"Document","definitions":[{"kind":"FragmentDefinition","name":{"kind":"Name","value":"OrderFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"Order"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"documentId"}},{"kind":"Field","name":{"kind":"Name","value":"time_start"}},{"kind":"Field","name":{"kind":"Name","value":"time_end"}},{"kind":"Field","name":{"kind":"Name","value":"state"}},{"kind":"Field","name":{"kind":"Name","value":"order_number"}},{"kind":"Field","name":{"kind":"Name","value":"services"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"documentId"}},{"kind":"Field","name":{"kind":"Name","value":"name"}}]}},{"kind":"Field","name":{"kind":"Name","value":"client"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"documentId"}},{"kind":"Field","name":{"kind":"Name","value":"photoUrl"}}]}}]}}]} as unknown as DocumentNode; +export const ServiceFieldsFragmentDoc = {"kind":"Document","definitions":[{"kind":"FragmentDefinition","name":{"kind":"Name","value":"ServiceFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"Service"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"documentId"}},{"kind":"Field","name":{"kind":"Name","value":"name"}}]}}]} as unknown as DocumentNode; export const SlotFieldsFragmentDoc = {"kind":"Document","definitions":[{"kind":"FragmentDefinition","name":{"kind":"Name","value":"SlotFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"Slot"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"documentId"}},{"kind":"Field","name":{"kind":"Name","value":"date"}},{"kind":"Field","name":{"kind":"Name","value":"time_start"}},{"kind":"Field","name":{"kind":"Name","value":"time_end"}},{"kind":"Field","name":{"kind":"Name","value":"state"}}]}}]} as unknown as DocumentNode; export const RegisterDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"mutation","name":{"kind":"Name","value":"Register"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"identifier"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"String"}}}},{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"password"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"String"}}}},{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"email"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"String"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"register"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"input"},"value":{"kind":"ObjectValue","fields":[{"kind":"ObjectField","name":{"kind":"Name","value":"username"},"value":{"kind":"Variable","name":{"kind":"Name","value":"identifier"}}},{"kind":"ObjectField","name":{"kind":"Name","value":"password"},"value":{"kind":"Variable","name":{"kind":"Name","value":"password"}}},{"kind":"ObjectField","name":{"kind":"Name","value":"email"},"value":{"kind":"Variable","name":{"kind":"Name","value":"email"}}}]}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"jwt"}},{"kind":"Field","name":{"kind":"Name","value":"user"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"username"}}]}}]}}]}}]} as unknown as DocumentNode; export const LoginDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"mutation","name":{"kind":"Name","value":"Login"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"identifier"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"String"}}}},{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"password"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"String"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"login"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"input"},"value":{"kind":"ObjectValue","fields":[{"kind":"ObjectField","name":{"kind":"Name","value":"identifier"},"value":{"kind":"Variable","name":{"kind":"Name","value":"identifier"}}},{"kind":"ObjectField","name":{"kind":"Name","value":"password"},"value":{"kind":"Variable","name":{"kind":"Name","value":"password"}}}]}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"jwt"}}]}}]}}]} as unknown as DocumentNode; @@ -744,6 +765,8 @@ export const GetCustomerMastersDocument = {"kind":"Document","definitions":[{"ki export const GetCustomerClientsDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"GetCustomerClients"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"phone"}},"type":{"kind":"NamedType","name":{"kind":"Name","value":"String"}}},{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"telegramId"}},"type":{"kind":"NamedType","name":{"kind":"Name","value":"Long"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"customers"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"filters"},"value":{"kind":"ObjectValue","fields":[{"kind":"ObjectField","name":{"kind":"Name","value":"or"},"value":{"kind":"ListValue","values":[{"kind":"ObjectValue","fields":[{"kind":"ObjectField","name":{"kind":"Name","value":"phone"},"value":{"kind":"ObjectValue","fields":[{"kind":"ObjectField","name":{"kind":"Name","value":"eq"},"value":{"kind":"Variable","name":{"kind":"Name","value":"phone"}}}]}}]},{"kind":"ObjectValue","fields":[{"kind":"ObjectField","name":{"kind":"Name","value":"telegramId"},"value":{"kind":"ObjectValue","fields":[{"kind":"ObjectField","name":{"kind":"Name","value":"eq"},"value":{"kind":"Variable","name":{"kind":"Name","value":"telegramId"}}}]}}]}]}},{"kind":"ObjectField","name":{"kind":"Name","value":"and"},"value":{"kind":"ListValue","values":[{"kind":"ObjectValue","fields":[{"kind":"ObjectField","name":{"kind":"Name","value":"active"},"value":{"kind":"ObjectValue","fields":[{"kind":"ObjectField","name":{"kind":"Name","value":"eq"},"value":{"kind":"BooleanValue","value":true}}]}}]}]}}]}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"documentId"}},{"kind":"Field","name":{"kind":"Name","value":"clients"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"CustomerFields"}}]}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"CustomerFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"Customer"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"active"}},{"kind":"Field","name":{"kind":"Name","value":"documentId"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"phone"}},{"kind":"Field","name":{"kind":"Name","value":"photoUrl"}},{"kind":"Field","name":{"kind":"Name","value":"role"}},{"kind":"Field","name":{"kind":"Name","value":"telegramId"}}]}}]} as unknown as DocumentNode; export const UpdateCustomerProfileDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"mutation","name":{"kind":"Name","value":"UpdateCustomerProfile"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"documentId"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"ID"}}}},{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"data"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"CustomerInput"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"updateCustomer"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"documentId"},"value":{"kind":"Variable","name":{"kind":"Name","value":"documentId"}}},{"kind":"Argument","name":{"kind":"Name","value":"data"},"value":{"kind":"Variable","name":{"kind":"Name","value":"data"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"CustomerFields"}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"CustomerFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"Customer"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"active"}},{"kind":"Field","name":{"kind":"Name","value":"documentId"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"phone"}},{"kind":"Field","name":{"kind":"Name","value":"photoUrl"}},{"kind":"Field","name":{"kind":"Name","value":"role"}},{"kind":"Field","name":{"kind":"Name","value":"telegramId"}}]}}]} as unknown as DocumentNode; export const GetOrderDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"GetOrder"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"documentId"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"ID"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"order"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"documentId"},"value":{"kind":"Variable","name":{"kind":"Name","value":"documentId"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"OrderFields"}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"OrderFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"Order"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"documentId"}},{"kind":"Field","name":{"kind":"Name","value":"time_start"}},{"kind":"Field","name":{"kind":"Name","value":"time_end"}},{"kind":"Field","name":{"kind":"Name","value":"state"}},{"kind":"Field","name":{"kind":"Name","value":"order_number"}},{"kind":"Field","name":{"kind":"Name","value":"services"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"documentId"}},{"kind":"Field","name":{"kind":"Name","value":"name"}}]}},{"kind":"Field","name":{"kind":"Name","value":"client"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"documentId"}},{"kind":"Field","name":{"kind":"Name","value":"photoUrl"}}]}}]}}]} as unknown as DocumentNode; +export const GetServicesDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"GetServices"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"filters"}},"type":{"kind":"NamedType","name":{"kind":"Name","value":"ServiceFiltersInput"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"services"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"filters"},"value":{"kind":"Variable","name":{"kind":"Name","value":"filters"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"ServiceFields"}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"ServiceFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"Service"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"documentId"}},{"kind":"Field","name":{"kind":"Name","value":"name"}}]}}]} as unknown as DocumentNode; +export const GetServiceDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"GetService"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"documentId"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"ID"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"service"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"documentId"},"value":{"kind":"Variable","name":{"kind":"Name","value":"documentId"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"ServiceFields"}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"ServiceFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"Service"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"documentId"}},{"kind":"Field","name":{"kind":"Name","value":"name"}}]}}]} as unknown as DocumentNode; export const CreateSlotDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"mutation","name":{"kind":"Name","value":"CreateSlot"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"input"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"SlotInput"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"createSlot"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"data"},"value":{"kind":"Variable","name":{"kind":"Name","value":"input"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"SlotFields"}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"SlotFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"Slot"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"documentId"}},{"kind":"Field","name":{"kind":"Name","value":"date"}},{"kind":"Field","name":{"kind":"Name","value":"time_start"}},{"kind":"Field","name":{"kind":"Name","value":"time_end"}},{"kind":"Field","name":{"kind":"Name","value":"state"}}]}}]} as unknown as DocumentNode; export const GetSlotsDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"GetSlots"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"filters"}},"type":{"kind":"NamedType","name":{"kind":"Name","value":"SlotFiltersInput"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"slots"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"filters"},"value":{"kind":"Variable","name":{"kind":"Name","value":"filters"}}},{"kind":"Argument","name":{"kind":"Name","value":"sort"},"value":{"kind":"StringValue","value":"time_start:asc","block":false}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"documentId"}}]}}]}}]} as unknown as DocumentNode; export const GetSlotDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"GetSlot"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"documentId"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"ID"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"slot"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"documentId"},"value":{"kind":"Variable","name":{"kind":"Name","value":"documentId"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"state"}},{"kind":"Field","name":{"kind":"Name","value":"orders"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"sort"},"value":{"kind":"StringValue","value":"time_start:asc","block":false}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"documentId"}}]}},{"kind":"FragmentSpread","name":{"kind":"Name","value":"SlotFields"}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"SlotFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"Slot"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"documentId"}},{"kind":"Field","name":{"kind":"Name","value":"date"}},{"kind":"Field","name":{"kind":"Name","value":"time_start"}},{"kind":"Field","name":{"kind":"Name","value":"time_end"}},{"kind":"Field","name":{"kind":"Name","value":"state"}}]}}]} as unknown as DocumentNode;