diff --git a/src/components/supplies/fulfillment-supplies/all-supplies-tab.tsx b/src/components/supplies/fulfillment-supplies/all-supplies-tab.tsx new file mode 100644 index 0000000..1b8dca1 --- /dev/null +++ b/src/components/supplies/fulfillment-supplies/all-supplies-tab.tsx @@ -0,0 +1,41 @@ +"use client"; + +import React from "react"; +import { Card } from "@/components/ui/card"; +import { FulfillmentGoodsTab } from "./fulfillment-goods-tab"; +import { RealSupplyOrdersTab } from "./real-supply-orders-tab"; +import { SellerSupplyOrdersTab } from "./seller-supply-orders-tab"; +import { useAuth } from "@/hooks/useAuth"; + +interface AllSuppliesTabProps { + pendingSupplyOrders?: number; +} + +export function AllSuppliesTab({ + pendingSupplyOrders = 0, +}: AllSuppliesTabProps) { + const { user } = useAuth(); + + // Определяем тип организации для выбора правильного компонента + const isWholesale = user?.organization?.type === "WHOLESALE"; + + return ( +
+ {/* Секция товаров */} + +

Товары

+
+ +
+
+ + {/* Секция расходников */} + +

Расходники

+
+ {isWholesale ? : } +
+
+
+ ); +} diff --git a/src/components/supplies/fulfillment-supplies/fulfillment-supplies-tab.tsx b/src/components/supplies/fulfillment-supplies/fulfillment-supplies-tab.tsx index 80b4b9d..9a1c9eb 100644 --- a/src/components/supplies/fulfillment-supplies/fulfillment-supplies-tab.tsx +++ b/src/components/supplies/fulfillment-supplies/fulfillment-supplies-tab.tsx @@ -5,7 +5,7 @@ import { Tabs, TabsContent, TabsList, TabsTrigger } from "@/components/ui/tabs"; import { FulfillmentGoodsTab } from "./fulfillment-goods-tab"; import { RealSupplyOrdersTab } from "./real-supply-orders-tab"; import { SellerSupplyOrdersTab } from "./seller-supply-orders-tab"; -import { PvzReturnsTab } from "./pvz-returns-tab"; +import { AllSuppliesTab } from "./all-supplies-tab"; import { useAuth } from "@/hooks/useAuth"; interface FulfillmentSuppliesTabProps { @@ -17,7 +17,7 @@ export function FulfillmentSuppliesTab({ defaultSubTab, pendingSupplyOrders = 0, }: FulfillmentSuppliesTabProps) { - const [activeSubTab, setActiveSubTab] = useState("goods"); + const [activeSubTab, setActiveSubTab] = useState("all"); const { user } = useAuth(); // Устанавливаем активную подвкладку при получении defaultSubTab @@ -39,6 +39,12 @@ export function FulfillmentSuppliesTab({ > {/* Подвкладки для ФФ */} + + Все + 0 ? 'animate-pulse' : ''}`} + className={`data-[state=active]:bg-white/20 data-[state=active]:text-white text-white/60 px-3 sm:px-4 relative ${ + pendingSupplyOrders > 0 ? "animate-pulse" : "" + }`} > Расходники {pendingSupplyOrders > 0 && ( @@ -56,15 +64,12 @@ export function FulfillmentSuppliesTab({ )} - - Возвраты с ПВЗ - Возвраты - + + + + @@ -72,10 +77,6 @@ export function FulfillmentSuppliesTab({ {isWholesale ? : } - - - - ); diff --git a/src/components/supplies/fulfillment-supplies/real-supply-orders-tab.tsx b/src/components/supplies/fulfillment-supplies/real-supply-orders-tab.tsx index 4ff8a86..920f06c 100644 --- a/src/components/supplies/fulfillment-supplies/real-supply-orders-tab.tsx +++ b/src/components/supplies/fulfillment-supplies/real-supply-orders-tab.tsx @@ -1,32 +1,36 @@ "use client"; import React, { useState } from "react"; -import { Card } from "@/components/ui/card"; -import { Badge } from "@/components/ui/badge"; -import { Button } from "@/components/ui/button"; -import { StatsCard } from "../ui/stats-card"; -import { StatsGrid } from "../ui/stats-grid"; import { useQuery, useMutation } from "@apollo/client"; +import { Card } from "@/components/ui/card"; +import { Button } from "@/components/ui/button"; +import { Badge } from "@/components/ui/badge"; +import { Input } from "@/components/ui/input"; +import { Avatar, AvatarImage, AvatarFallback } from "@/components/ui/avatar"; +import { toast } from "sonner"; import { GET_SUPPLY_ORDERS } from "@/graphql/queries"; import { UPDATE_SUPPLY_ORDER_STATUS } from "@/graphql/mutations"; import { useAuth } from "@/hooks/useAuth"; -import { toast } from "sonner"; import { + ChevronRight, + ChevronDown, + CheckCircle, + XCircle, + Truck, Calendar, - Building2, - TrendingUp, + User, DollarSign, Wrench, Package2, - ChevronDown, - ChevronRight, - User, - CheckCircle, - XCircle, Clock, - Truck, + TrendingUp, + TrendingDown, + Search, + Store, + ArrowUpDown, } from "lucide-react"; +// Типы для данных заказов interface SupplyOrderItem { id: string; quantity: number; @@ -36,7 +40,6 @@ interface SupplyOrderItem { id: string; name: string; article: string; - description?: string; category?: { id: string; name: string; @@ -46,20 +49,15 @@ interface SupplyOrderItem { interface SupplyOrder { id: string; - organizationId: string; - deliveryDate: string; - status: "PENDING" | "CONFIRMED" | "IN_TRANSIT" | "DELIVERED" | "CANCELLED"; + status: string; totalAmount: number; totalItems: number; - fulfillmentCenterId?: string; + deliveryDate: string; createdAt: string; - updatedAt: string; partner: { id: string; name?: string; fullName?: string; - inn: string; - address?: string; phones?: string[]; emails?: string[]; }; @@ -78,8 +76,96 @@ interface SupplyOrder { items: SupplyOrderItem[]; } +// Компонент для заголовка таблицы +const TableHeader = ({ + children, + field, + sortable = false, + sortField, + sortOrder, + onSort, +}: { + children: React.ReactNode; + field: string; + sortable?: boolean; + sortField?: string; + sortOrder?: "asc" | "desc"; + onSort?: (field: string) => void; +}) => ( +
sortable && onSort && onSort(field)} + > + {children} + {sortable && ( + + )} +
+); + +// Компонент для статистических карточек +const StatsCard = ({ + title, + value, + change = 0, + icon: Icon, + iconColor = "text-blue-400", + iconBg = "bg-blue-500/20", + subtitle, +}: { + title: string; + value: string | number; + change?: number; + icon: React.ComponentType; + iconColor?: string; + iconBg?: string; + subtitle?: string; +}) => ( + +
+
+
+ +
+
+

{title}

+
+

{value}

+ {change !== 0 && ( +
+ {change > 0 ? ( + + ) : ( + + )} + 0 ? "text-green-400" : "text-red-400" + }`} + > + {Math.abs(change)}% + +
+ )} +
+ {subtitle &&

{subtitle}

} +
+
+
+
+); + export function RealSupplyOrdersTab() { const [expandedOrders, setExpandedOrders] = useState>(new Set()); + const [searchTerm, setSearchTerm] = useState(""); + const [sortField, setSortField] = useState("createdAt"); + const [sortOrder, setSortOrder] = useState<"asc" | "desc">("desc"); const { user } = useAuth(); const { data, loading, error, refetch } = useQuery(GET_SUPPLY_ORDERS, { @@ -94,7 +180,7 @@ export function RealSupplyOrdersTab() { onCompleted: (data) => { if (data.updateSupplyOrderStatus.success) { toast.success(data.updateSupplyOrderStatus.message); - refetch(); // Обновляем список заказов + refetch(); } else { toast.error(data.updateSupplyOrderStatus.message); } @@ -109,14 +195,14 @@ export function RealSupplyOrdersTab() { // Получаем ID текущей организации (поставщика) const currentOrganizationId = user?.organization?.id; - // Фильтруем заказы где текущая организация является поставщиком (заказы К поставщику) + // Фильтруем заказы где текущая организация является поставщиком const incomingSupplyOrders: SupplyOrder[] = (data?.supplyOrders || []).filter( (order: SupplyOrder) => { - // Показываем заказы где текущий поставщик указан как поставщик (partnerId) return order.partner.id === currentOrganizationId; } ); + // Функции для работы с таблицей const toggleOrderExpansion = (orderId: string) => { const newExpanded = new Set(expandedOrders); if (newExpanded.has(orderId)) { @@ -127,66 +213,85 @@ export function RealSupplyOrdersTab() { setExpandedOrders(newExpanded); }; - const handleStatusUpdate = async ( - orderId: string, - newStatus: SupplyOrder["status"] - ) => { + const handleSort = (field: string) => { + if (sortField === field) { + setSortOrder(sortOrder === "asc" ? "desc" : "asc"); + } else { + setSortField(field); + setSortOrder("asc"); + } + }; + + const handleStatusUpdate = async (orderId: string, status: string) => { try { await updateSupplyOrderStatus({ variables: { id: orderId, - status: newStatus, + status, }, }); } catch (error) { - console.error("Error updating status:", error); + console.error("Error updating order status:", error); } }; - const getStatusBadge = (status: SupplyOrder["status"]) => { - const statusMap = { - PENDING: { - label: "Ожидает одобрения", - color: "bg-blue-500/20 text-blue-300 border-blue-500/30", - icon: Clock, - }, - CONFIRMED: { - label: "Одобрена", - color: "bg-green-500/20 text-green-300 border-green-500/30", - icon: CheckCircle, - }, - IN_TRANSIT: { - label: "В пути", - color: "bg-yellow-500/20 text-yellow-300 border-yellow-500/30", - icon: Truck, - }, - DELIVERED: { - label: "Доставлена", - color: "bg-purple-500/20 text-purple-300 border-purple-500/30", - icon: Package2, - }, - CANCELLED: { - label: "Отклонена", - color: "bg-red-500/20 text-red-300 border-red-500/30", - icon: XCircle, - }, - }; + // Фильтрация и сортировка заказов + const filteredAndSortedOrders = incomingSupplyOrders + .filter((order) => { + const searchLower = searchTerm.toLowerCase(); + return ( + order.id.toLowerCase().includes(searchLower) || + (order.organization.name || order.organization.fullName || "") + .toLowerCase() + .includes(searchLower) || + order.items.some( + (item) => + item.product.name.toLowerCase().includes(searchLower) || + item.product.article.toLowerCase().includes(searchLower) + ) + ); + }) + .sort((a, b) => { + let aValue, bValue; - const { label, color, icon: Icon } = statusMap[status]; + switch (sortField) { + case "organization": + aValue = a.organization.name || a.organization.fullName || ""; + bValue = b.organization.name || b.organization.fullName || ""; + break; + case "totalAmount": + aValue = a.totalAmount; + bValue = b.totalAmount; + break; + case "totalItems": + aValue = a.totalItems; + bValue = b.totalItems; + break; + case "deliveryDate": + aValue = new Date(a.deliveryDate).getTime(); + bValue = new Date(b.deliveryDate).getTime(); + break; + case "status": + aValue = a.status; + bValue = b.status; + break; + default: + aValue = new Date(a.createdAt).getTime(); + bValue = new Date(b.createdAt).getTime(); + } - return ( - - - {label} - - ); - }; + if (aValue < bValue) return sortOrder === "asc" ? -1 : 1; + if (aValue > bValue) return sortOrder === "asc" ? 1 : -1; + return 0; + }); + // Функции форматирования const formatCurrency = (amount: number) => { return new Intl.NumberFormat("ru-RU", { style: "currency", currency: "RUB", minimumFractionDigits: 0, + maximumFractionDigits: 0, }).format(amount); }; @@ -208,7 +313,120 @@ export function RealSupplyOrdersTab() { }); }; - // Статистика для поставщика + const formatNumber = (num: number) => { + return new Intl.NumberFormat("ru-RU").format(num); + }; + + const getStatusBadge = (status: string) => { + const statusConfig = { + PENDING: { + label: "Ожидает", + className: "bg-yellow-500/20 text-yellow-300 border-yellow-500/30", + }, + CONFIRMED: { + label: "Одобрена", + className: "bg-green-500/20 text-green-300 border-green-500/30", + }, + IN_TRANSIT: { + label: "В пути", + className: "bg-blue-500/20 text-blue-300 border-blue-500/30", + }, + DELIVERED: { + label: "Доставлена", + className: "bg-emerald-500/20 text-emerald-300 border-emerald-500/30", + }, + CANCELLED: { + label: "Отменена", + className: "bg-red-500/20 text-red-300 border-red-500/30", + }, + }; + + const config = statusConfig[status as keyof typeof statusConfig] || { + label: status, + className: "bg-gray-500/20 text-gray-300 border-gray-500/30", + }; + + return ( + + {config.label} + + ); + }; + + const getInitials = (name: string): string => { + return name + .split(" ") + .map((word) => word.charAt(0)) + .join("") + .toUpperCase() + .slice(0, 2); + }; + + const getColorForOrder = (orderId: string): string => { + const colors = [ + "bg-blue-500", + "bg-green-500", + "bg-purple-500", + "bg-orange-500", + "bg-pink-500", + "bg-indigo-500", + "bg-teal-500", + "bg-red-500", + ]; + const hash = orderId + .split("") + .reduce((acc, char) => acc + char.charCodeAt(0), 0); + return colors[hash % colors.length]; + }; + + // Цветовые схемы для заказов + const getColorScheme = (orderId: string) => { + const colorSchemes = [ + { + bg: "bg-blue-500/5", + border: "border-blue-500/30", + borderLeft: "border-l-blue-400", + text: "text-blue-100", + indicator: "bg-blue-400 border-blue-300", + hover: "hover:bg-blue-500/10", + header: "bg-blue-500/20 border-blue-500/40", + }, + { + bg: "bg-pink-500/5", + border: "border-pink-500/30", + borderLeft: "border-l-pink-400", + text: "text-pink-100", + indicator: "bg-pink-400 border-pink-300", + hover: "hover:bg-pink-500/10", + header: "bg-pink-500/20 border-pink-500/40", + }, + { + bg: "bg-emerald-500/5", + border: "border-emerald-500/30", + borderLeft: "border-l-emerald-400", + text: "text-emerald-100", + indicator: "bg-emerald-400 border-emerald-300", + hover: "hover:bg-emerald-500/10", + header: "bg-emerald-500/20 border-emerald-500/40", + }, + { + bg: "bg-orange-500/5", + border: "border-orange-500/30", + borderLeft: "border-l-orange-400", + text: "text-orange-100", + indicator: "bg-orange-400 border-orange-300", + hover: "hover:bg-orange-500/10", + header: "bg-orange-500/20 border-orange-500/40", + }, + ]; + + const hash = orderId + .split("") + .reduce((acc, char) => acc + char.charCodeAt(0), 0); + return colorSchemes[hash % colorSchemes.length]; + }; + + // Подсчет статистики const totalOrders = incomingSupplyOrders.length; const totalAmount = incomingSupplyOrders.reduce( (sum, order) => sum + order.totalAmount, @@ -228,6 +446,22 @@ export function RealSupplyOrdersTab() { (order) => order.status === "IN_TRANSIT" ).length; + // Подсчет общих итогов для отображения в строке итогов + const totals = { + orders: filteredAndSortedOrders.length, + amount: filteredAndSortedOrders.reduce( + (sum, order) => sum + order.totalAmount, + 0 + ), + items: filteredAndSortedOrders.reduce( + (sum, order) => sum + order.totalItems, + 0 + ), + pending: filteredAndSortedOrders.filter( + (order) => order.status === "PENDING" + ).length, + }; + if (loading) { return (
@@ -250,295 +484,401 @@ export function RealSupplyOrdersTab() { } return ( -
- {/* Статистика входящих заявок */} - - +
+ {/* Статистические карточки - 30% экрана */} +
+
+ + + + + + +
+
- + {/* Основная таблица - 70% экрана */} +
+ + {/* Шапка таблицы с поиском */} +
+
+

+ + Заявки на расходники +

- + {/* Поиск */} +
+ + setSearchTerm(e.target.value)} + className="pl-8 h-8 text-sm glass-input text-white placeholder:text-white/40" + /> +
- - - - - - - - {/* Список входящих заявок */} - {incomingSupplyOrders.length === 0 ? ( - -
- -

- Пока нет заявок -

-

- Здесь будут отображаться заявки от селлеров на поставку товаров -

+ + {filteredAndSortedOrders.length} заявок + +
- - ) : ( - -
- - - - - - - - - - - - - - - {incomingSupplyOrders.map((order) => { - const isOrderExpanded = expandedOrders.has(order.id); - return ( - - {/* Основная строка заказа */} - - - - - - - - - - + + + )} + {order.status === "CONFIRMED" && ( + + )} + {order.status === "CANCELLED" && ( + + Отклонена + + )} + {order.status === "IN_TRANSIT" && ( + + В пути + + )} + {order.status === "DELIVERED" && ( + + Доставлена + + )} + + + - {/* Развернутая информация о заказе */} - {isOrderExpanded && ( - - - - )} - - ); - })} - -
ID - Заказчик - - Дата поставки - - Дата заявки - - Количество - - Сумма - - Статус - - Действия -
-
- - - {order.id.slice(-8)} - -
-
-
-
- - - {order.organization.name || - order.organization.fullName || - "Заказчик"} - -
-

- Тип: {order.organization.type} -

-
-
-
- - - {formatDate(order.deliveryDate)} - -
-
- - {formatDateTime(order.createdAt)} + {/* Заголовки таблицы */} +
+
+ + № / ID + + + Заказчик + + + Дата поставки + + + Количество + + + Сумма + + + Статус + + Действия +
+
+ + {/* Строка с итогами */} +
+
+
+ ИТОГО ({totals.orders}) +
+
+ {totals.orders} заказчиков +
+
-
+
+ {formatNumber(totals.items)} шт +
+
+ {formatCurrency(totals.amount)} +
+
+ {totals.pending} ожидают +
+
-
+
+
+ + {/* Скроллируемый контент таблицы */} +
+ {filteredAndSortedOrders.length === 0 ? ( +
+
+ +

+ {incomingSupplyOrders.length === 0 + ? "Нет заявок на расходники" + : "Заявки не найдены"} +

+

+ {incomingSupplyOrders.length === 0 + ? "Здесь будут отображаться заявки от селлеров" + : searchTerm + ? "Попробуйте изменить поисковый запрос" + : "Данные о заявках будут отображены здесь"} +

+
+
+ ) : ( + filteredAndSortedOrders.map((order, index) => { + const colorScheme = getColorScheme(order.id); + const isOrderExpanded = expandedOrders.has(order.id); + const organizationName = + order.organization.name || + order.organization.fullName || + "Заказчик"; + + return ( +
+ {/* Основная строка заказа */} +
+
+ + {filteredAndSortedOrders.length - index} + + + + {order.id.slice(-8)} + +
+ +
+ + + {getInitials(organizationName)} + + +
+ + {organizationName} -
- - {order.totalItems} шт - - -
- - - {formatCurrency(order.totalAmount)} - -
-
{getStatusBadge(order.status)} -
- {order.status === "PENDING" && ( - <> - - - - )} - {order.status === "CONFIRMED" && ( +

+ {order.organization.type} +

+
+ + +
+ + + {formatDate(order.deliveryDate)} + +
+ +
+ + {order.totalItems} шт + +
+ +
+ + + {formatCurrency(order.totalAmount)} + +
+ +
+ {getStatusBadge(order.status)} +
+ +
+
+ {order.status === "PENDING" && ( + <> - )} - {order.status === "CANCELLED" && ( - - Отклонена - - )} - {order.status === "IN_TRANSIT" && ( - - В пути - - )} - {order.status === "DELIVERED" && ( - - Доставлена - - )} -
-
-
-
-

- Состав заявки: -

-
- {order.items.map((item) => ( - -
-
-
- {item.product.name} -
-

- Артикул: {item.product.article} -

- {item.product.category && ( - - {item.product.category.name} - - )} -
-
-
-

- Количество: {item.quantity} шт -

-

- Цена: {formatCurrency(item.price)} -

-
-
-

- {formatCurrency(item.totalPrice)} -

-
-
-
-
- ))} -
-
+ {/* Развернутая информация о заказе */} + {isOrderExpanded && ( +
+
+
+

+ Состав заявки: +

+
+ + + Дата создания: {formatDateTime(order.createdAt)} +
-
+
+
+ {order.items.map((item) => ( + +
+
+
+ {item.product.name} +
+

+ Артикул: {item.product.article} +

+ {item.product.category && ( + + {item.product.category.name} + + )} +
+
+
+

+ Количество: {item.quantity} шт +

+

+ Цена: {formatCurrency(item.price)} +

+
+
+

+ {formatCurrency(item.totalPrice)} +

+
+
+
+
+ ))} +
+
+
+ )} +
+ ); + }) + )}
- )} +
); } diff --git a/src/components/supplies/supplies-dashboard.tsx b/src/components/supplies/supplies-dashboard.tsx index 9cc8068..0ffd622 100644 --- a/src/components/supplies/supplies-dashboard.tsx +++ b/src/components/supplies/supplies-dashboard.tsx @@ -8,10 +8,19 @@ import { Sidebar } from "@/components/dashboard/sidebar"; import { useSidebar } from "@/hooks/useSidebar"; import { useSearchParams } from "next/navigation"; import { useQuery } from "@apollo/client"; -import { Plus, Package, Wrench, ChevronDown, AlertTriangle } from "lucide-react"; +import { + Plus, + Package, + Wrench, + ChevronDown, + AlertTriangle, +} from "lucide-react"; import { GET_PENDING_SUPPLIES_COUNT } from "@/graphql/queries"; -import { FulfillmentSuppliesTab } from "./fulfillment-supplies/fulfillment-supplies-tab"; -import { MarketplaceSuppliesTab } from "./marketplace-supplies/marketplace-supplies-tab"; +import { FulfillmentGoodsTab } from "./fulfillment-supplies/fulfillment-goods-tab"; +import { RealSupplyOrdersTab } from "./fulfillment-supplies/real-supply-orders-tab"; +import { SellerSupplyOrdersTab } from "./fulfillment-supplies/seller-supply-orders-tab"; +import { AllSuppliesTab } from "./fulfillment-supplies/all-supplies-tab"; +import { useAuth } from "@/hooks/useAuth"; import { DropdownMenu, DropdownMenuContent, @@ -22,13 +31,14 @@ import { export function SuppliesDashboard() { const { getSidebarMargin } = useSidebar(); const searchParams = useSearchParams(); - const [activeTab, setActiveTab] = useState("fulfillment"); + const [activeTab, setActiveTab] = useState("all"); + const { user } = useAuth(); // Загружаем счетчик поставок, требующих одобрения const { data: pendingData } = useQuery(GET_PENDING_SUPPLIES_COUNT, { pollInterval: 30000, // Обновляем каждые 30 секунд - fetchPolicy: 'cache-first', - errorPolicy: 'ignore', + fetchPolicy: "cache-first", + errorPolicy: "ignore", }); const pendingCount = pendingData?.pendingSuppliesCount; @@ -38,10 +48,15 @@ export function SuppliesDashboard() { useEffect(() => { const tab = searchParams.get("tab"); if (tab === "consumables") { - setActiveTab("fulfillment"); // Устанавливаем основную вкладку "Поставки на ФФ" + setActiveTab("supplies"); + } else if (tab === "goods") { + setActiveTab("goods"); } }, [searchParams]); + // Определяем тип организации для выбора правильного компонента + const isWholesale = user?.organization?.type === "WHOLESALE"; + return (
@@ -54,41 +69,73 @@ export function SuppliesDashboard() { - У вас есть {pendingCount.total} элемент{pendingCount.total > 1 ? (pendingCount.total < 5 ? 'а' : 'ов') : ''}, требующ{pendingCount.total > 1 ? 'их' : 'ий'} одобрения: - {pendingCount.supplyOrders > 0 && ` ${pendingCount.supplyOrders} заказ${pendingCount.supplyOrders > 1 ? (pendingCount.supplyOrders < 5 ? 'а' : 'ов') : ''} поставок`} - {pendingCount.incomingRequests > 0 && pendingCount.supplyOrders > 0 && ', '} - {pendingCount.incomingRequests > 0 && ` ${pendingCount.incomingRequests} заявк${pendingCount.incomingRequests > 1 ? (pendingCount.incomingRequests < 5 ? 'и' : '') : 'а'} на партнерство`} + У вас есть {pendingCount.total} элемент + {pendingCount.total > 1 + ? pendingCount.total < 5 + ? "а" + : "ов" + : ""} + , требующ{pendingCount.total > 1 ? "их" : "ий"} одобрения: + {pendingCount.supplyOrders > 0 && + ` ${pendingCount.supplyOrders} заказ${ + pendingCount.supplyOrders > 1 + ? pendingCount.supplyOrders < 5 + ? "а" + : "ов" + : "" + } поставок`} + {pendingCount.incomingRequests > 0 && + pendingCount.supplyOrders > 0 && + ", "} + {pendingCount.incomingRequests > 0 && + ` ${pendingCount.incomingRequests} заявк${ + pendingCount.incomingRequests > 1 + ? pendingCount.incomingRequests < 5 + ? "и" + : "" + : "а" + } на партнерство`} )} - {/* Главные вкладки с кнопкой создания */} + {/* Основные вкладки с кнопкой создания */}
- + 0 ? 'animate-pulse' : ''}`} + value="all" + className="data-[state=active]:bg-gradient-to-r data-[state=active]:from-purple-500 data-[state=active]:to-pink-500 data-[state=active]:text-white text-white/60 px-3 sm:px-6" > - Поставки на ФФ - ФФ + Все + + + Товар + + 0 ? "animate-pulse" : "" + }`} + > + Расходники {pendingCount?.supplyOrders > 0 && (
{pendingCount.supplyOrders}
)}
- - Поставки на Маркетплейсы - МП -
@@ -129,25 +176,25 @@ export function SuppliesDashboard() {
- - + + + + + - + {isWholesale ? ( + + ) : ( + + )}