/* eslint-disable canonical/id-match */ 'use client'; import { OrderCard } from '@/components/shared/order-card'; import { useCustomerQuery } from '@/hooks/api/customers'; import { useOrdersQuery } from '@/hooks/api/orders'; import { Enum_Customer_Role } from '@repo/graphql/types'; export function ClientsOrdersList() { const { data: { customer } = {} } = useCustomerQuery(); const isMaster = customer?.role === Enum_Customer_Role.Master; const { data: { orders } = {}, isLoading } = useOrdersQuery({ filters: { slot: { master: { documentId: { eq: isMaster ? customer?.documentId : undefined, }, }, }, }, }); if (!orders?.length || isLoading) return null; return (

Записи клиентов

{orders?.map((order) => order && )}
); } export function OrdersList() { const { data: { customer } = {} } = useCustomerQuery(); const { data: { orders } = {}, isLoading } = useOrdersQuery({ filters: { client: { documentId: { eq: customer?.documentId, }, }, }, }); if (!orders?.length || isLoading) return null; return (

Ваши записи

{orders?.map((order) => order && )}
); }