// ============================================================================= // 📦 GraphQL ЗАПРОСЫ ДЛЯ СИСТЕМЫ ПОСТАВОК РАСХОДНИКОВ СЕЛЛЕРА V2 // ============================================================================= import { gql } from '@apollo/client' // ============================================================================= // 🔍 QUERY - ПОЛУЧЕНИЕ ДАННЫХ // ============================================================================= export const GET_MY_SELLER_CONSUMABLE_SUPPLIES = gql` query GetMySellerConsumableSupplies { mySellerConsumableSupplies { id status sellerId seller { id name inn } fulfillmentCenterId fulfillmentCenter { id name inn } requestedDeliveryDate notes # Данные поставщика supplierId supplier { id name inn } supplierApprovedAt packagesCount estimatedVolume supplierContractId supplierNotes # Данные логистики logisticsPartnerId logisticsPartner { id name inn } estimatedDeliveryDate routeId logisticsCost logisticsNotes # Данные отгрузки shippedAt trackingNumber # Данные приемки receivedAt receivedById receivedBy { id managerName phone } actualQuantity defectQuantity receiptNotes # Экономика totalCostWithDelivery estimatedStorageCost items { id productId product { id name article price quantity mainImage } requestedQuantity approvedQuantity shippedQuantity receivedQuantity defectQuantity unitPrice totalPrice } createdAt updatedAt } } ` export const GET_SELLER_CONSUMABLE_SUPPLY = gql` query GetSellerConsumableSupply($id: ID!) { sellerConsumableSupply(id: $id) { id status sellerId seller { id name inn } fulfillmentCenterId fulfillmentCenter { id name inn } requestedDeliveryDate notes # Данные поставщика supplierId supplier { id name inn } supplierApprovedAt packagesCount estimatedVolume supplierContractId supplierNotes # Данные логистики logisticsPartnerId logisticsPartner { id name inn } estimatedDeliveryDate routeId logisticsCost logisticsNotes # Данные отгрузки shippedAt trackingNumber # Данные приемки receivedAt receivedById receivedBy { id managerName phone } actualQuantity defectQuantity receiptNotes # Экономика totalCostWithDelivery estimatedStorageCost items { id productId product { id name article price quantity mainImage } requestedQuantity approvedQuantity shippedQuantity receivedQuantity defectQuantity unitPrice totalPrice } createdAt updatedAt } } ` // Для других типов организаций (фулфилмент, поставщики) export const GET_INCOMING_SELLER_SUPPLIES = gql` query GetIncomingSellerSupplies { incomingSellerSupplies { id status sellerId seller { id name inn } fulfillmentCenterId fulfillmentCenter { id name inn } requestedDeliveryDate notes supplierId supplier { id name inn } totalCostWithDelivery items { id product { id name article } requestedQuantity unitPrice totalPrice } createdAt } } ` export const GET_MY_SELLER_SUPPLY_REQUESTS = gql` query GetMySellerSupplyRequests { mySellerSupplyRequests { id status sellerId seller { id name inn } fulfillmentCenterId fulfillmentCenter { id name inn } requestedDeliveryDate notes totalCostWithDelivery items { id product { id name article } requestedQuantity unitPrice totalPrice } createdAt } } ` // ============================================================================= // ✏️ MUTATIONS - ИЗМЕНЕНИЕ ДАННЫХ // ============================================================================= export const CREATE_SELLER_CONSUMABLE_SUPPLY = gql` mutation CreateSellerConsumableSupply($input: CreateSellerConsumableSupplyInput!) { createSellerConsumableSupply(input: $input) { success message supplyOrder { id status createdAt } } } ` export const UPDATE_SELLER_SUPPLY_STATUS = gql` mutation UpdateSellerSupplyStatus($id: ID!, $status: SellerSupplyOrderStatus!, $notes: String) { updateSellerSupplyStatus(id: $id, status: $status, notes: $notes) { id status updatedAt supplierApprovedAt shippedAt receivedAt supplierNotes receiptNotes } } ` export const CANCEL_SELLER_SUPPLY = gql` mutation CancelSellerSupply($id: ID!) { cancelSellerSupply(id: $id) { id status updatedAt } } `