diff --git a/src/components/admin/ui-kit/buttons-demo.tsx b/src/components/admin/ui-kit/buttons-demo.tsx index f5e2828..6f81d8b 100644 --- a/src/components/admin/ui-kit/buttons-demo.tsx +++ b/src/components/admin/ui-kit/buttons-demo.tsx @@ -11,7 +11,12 @@ import { Plus, Search, Filter, - Loader2 + Loader2, + Package, + Wrench, + RotateCcw, + Building2, + ShoppingCart } from 'lucide-react' export function ButtonsDemo() { @@ -240,6 +245,166 @@ export function ButtonsDemo() { + {/* Кнопки из Fulfillment Supplies */} + + + Кнопки из страницы Поставки Фулфилмента + + + {/* Основные кнопки создания */} +
+

Кнопки создания

+
+ + + +
+
+ + {/* Кнопки заказа */} +
+

Кнопки заказа

+
+ + + +
+
+ + {/* Кнопки фильтров */} +
+

Кнопки фильтров (активные и неактивные)

+
+ + + + +
+
+ + {/* Кнопки маркетплейсов */} +
+

Кнопки маркетплейсов

+
+ + + +
+
+ + {/* Навигационная кнопка */} +
+

Навигация

+
+ +
+
+ + {/* Специализированные кнопки по маркетплейсам */} +
+

Специализированные кнопки

+
+ +
+
+
+
+ {/* Примеры использования */} diff --git a/src/components/fulfillment-supplies/fulfillment-supplies-dashboard.tsx b/src/components/fulfillment-supplies/fulfillment-supplies-dashboard.tsx index 9487f13..60dc166 100644 --- a/src/components/fulfillment-supplies/fulfillment-supplies-dashboard.tsx +++ b/src/components/fulfillment-supplies/fulfillment-supplies-dashboard.tsx @@ -35,7 +35,7 @@ export function FulfillmentSuppliesDashboard() { className="data-[state=active]:bg-white/20 data-[state=active]:text-white text-white/70 flex items-center gap-1 text-sm" > - Поставки на ФФ + Поставки на фулфилмент >( @@ -508,20 +580,45 @@ export function FulfillmentGoodsTab() { : "Не выбран"; }; - const filteredSupplies = mockFulfillmentSupplies.filter((supply) => { - const matchesSearch = - supply.supplyNumber.toLowerCase().includes(searchTerm.toLowerCase()) || - supply.seller.name.toLowerCase().includes(searchTerm.toLowerCase()) || - supply.seller.storeName - .toLowerCase() - .includes(searchTerm.toLowerCase()) || - supply.seller.inn.includes(searchTerm); + const getFilteredSuppliesByTab = (tabName: string) => { + let supplies = mockFulfillmentSupplies; - const matchesStatus = - statusFilter === "all" || supply.status === statusFilter; + // Фильтрация по вкладке + switch (tabName) { + case "new": + supplies = supplies.filter((supply) => supply.status === "planned"); + break; + case "receiving": + supplies = supplies.filter((supply) => supply.status === "in-transit"); + break; + case "received": + supplies = supplies.filter( + (supply) => + supply.status === "delivered" || supply.status === "in-processing" + ); + break; + default: + break; + } - return matchesSearch && matchesStatus; - }); + // Дополнительная фильтрация по поиску и статусу + return supplies.filter((supply) => { + const matchesSearch = + supply.supplyNumber.toLowerCase().includes(searchTerm.toLowerCase()) || + supply.seller.name.toLowerCase().includes(searchTerm.toLowerCase()) || + supply.seller.storeName + .toLowerCase() + .includes(searchTerm.toLowerCase()) || + supply.seller.inn.includes(searchTerm); + + const matchesStatus = + statusFilter === "all" || supply.status === statusFilter; + + return matchesSearch && matchesStatus; + }); + }; + + const filteredSupplies = getFilteredSuppliesByTab(activeTab); const getTotalValue = () => { return filteredSupplies.reduce((sum, supply) => sum + supply.totalValue, 0); @@ -539,697 +636,777 @@ export function FulfillmentGoodsTab() { }; return ( -
- {/* Статистика с кнопкой */} -
-
- -
-
- -
-
-

Поставок

-

- {filteredSupplies.length} -

-
-
-
+
+ + {/* Вкладки товаров */} + + + + Новые + + + + Приёмка + + + + Принято + + - -
-
- -
-
-

Стоимость

-

- {formatCurrency(getTotalValue())} -

-
-
-
+ + + - -
-
- -
-
-

Товаров

-

- {getTotalQuantity()} ед. -

-
-
-
+ + + - -
-
- -
-
-

Объём

-

- {getTotalVolume().toFixed(1)} м³ -

-
-
-
-
- - -
- - {/* Фильтры */} -
-
- - setSearchTerm(e.target.value)} - className="glass-input pl-10 text-white placeholder:text-white/40" - /> -
- - -
- - {/* Список поставок */} -
-
- {filteredSupplies.map((supply, index) => { - const isSellerExpanded = expandedSellers.has(supply.seller.id); - const isSupplyExpanded = expandedSupplies.has(supply.id); - - return ( - -
- {/* Компактный блок с названием магазина */} -
-
-
- -
-
- - {supply.seller.storeName} - - - - {supply.seller.managerName} - - - - {supply.seller.phone} - - - -
-
-
-
- - Номер поставки - - - {supply.supplyNumber} - -
- -
-
- - {/* Скрытая детальная информация о магазине */} - {isSellerExpanded && ( -
-
-
-

- Юридическое название -

-

- {supply.seller.name} -

-
-
-

ИНН

-

- {supply.seller.inn} -

-
-
-
-

Email

-

- {supply.seller.email} -

-
-
- )} - - {/* Единый блок со всеми параметрами в одной строке */} -
toggleSupplyExpansion(supply.id)} - > -
- {/* Порядковый номер */} -
-

-
-
- - {filteredSupplies.length - index} - -
-
-
- - {/* Дата поставки */} -
-

Дата

-

- {formatDate(supply.supplyDate)} -

-
- - {/* Количество товаров */} -
-

Товаров

-

- {supply.itemsQuantity} -

-
- - {/* Количество мест */} -
-

Мест

-

- {supply.cargoPlaces} -

-
- - {/* Объём */} -
-

Объём

-

- {supply.volume} м³ -

-
- - {/* Стоимость */} -
-

Стоимость

-

- {formatCurrency(supply.totalValue)} -

-
- - {/* Ответственный сотрудник */} -
e.stopPropagation()} - > -

- Ответственный -

- -
- - {/* Логистический партнер */} -
e.stopPropagation()} - > -

Логистика

- -
- - {/* Статус */} -
-

Статус

-
- {getStatusBadge(supply.status)} -
-
-
- - {/* Второй уровень - Маршруты */} - {isSupplyExpanded && - supply.routes && - supply.routes.length > 0 && ( -
-
-

- - Маршруты ({supply.routes.length}) -

-
-
- {supply.routes.map((route) => { - const isRouteExpanded = expandedRoutes.has( - route.id - ); - return ( -
-
- toggleRouteExpansion(route.id) - } - > - {/* Название маршрута */} -
-

- Маршрут -

-
-

- {route.routeName} -

- -
-
- - {/* Откуда */} -
-

- Откуда -

-

- {route.fromAddress} -

-
- - {/* Куда */} -
-

- Куда -

-

- {route.toAddress} -

-
- - {/* Расстояние */} -
-

- Расстояние -

-

- {route.distance} км -

-
- - {/* Время в пути */} -
-

- Время -

-

- {route.estimatedTime} -

-
- - {/* Транспорт */} -
-

- Транспорт -

-

- {route.transportType} -

-
- - {/* Стоимость и статус */} -
-

- Стоимость -

-

- {formatCurrency(route.cost)} -

- {getRouteStatusBadge(route.status)} -
-
- - {/* Третий уровень - Поставщики/Оптовики */} - {isRouteExpanded && - route.suppliers && - route.suppliers.length > 0 && ( -
-
-
- - Поставщики/Оптовики ( - {route.suppliers.length}) -
-
-
- {route.suppliers.map((supplier) => { - const isSupplierExpanded = - expandedSuppliers.has( - supplier.id - ); - return ( -
-
- toggleSupplierExpansion( - supplier.id - ) - } - > - {/* Название поставщика */} -
-

- Поставщик -

-
-

- {supplier.name} -

- -
-
- - {/* ИНН */} -
-

- ИНН -

-

- {supplier.inn} -

-
- - {/* Тип */} -
-

- Тип -

- - {supplier.type === - "WHOLESALE" - ? "Оптовик" - : "Поставщик"} - -
- - {/* Менеджер */} -
-

- Менеджер -

-

- {supplier.managerName} -

-
- - {/* Стоимость */} -
-

- Стоимость -

-

- {formatCurrency( - supplier.totalValue - )} -

-
- - {/* Статус */} -
-

- Статус -

- {getSupplierStatusBadge( - supplier.status - )} -
-
- - {/* Детальная информация о поставщике */} - {isSupplierExpanded && ( -
-
-
-

- Полное название -

-

- {supplier.fullName || - supplier.name} -

-
-
-

- Телефон -

-
-

- {supplier.phone} -

- -
-
-
-

- Email -

-

- {supplier.email} -

-
-
-
-

- Адрес -

-

- {supplier.address} -

-
-
- )} -
- ); - })} -
-
- )} -
- ); - })} -
-
- )} -
-
-
- ); - })} -
-
+ + + +
); + + function TabContent({ tabName }: { tabName: string }) { + const tabFilteredSupplies = getFilteredSuppliesByTab(tabName); + + const getTabTotalValue = () => { + return tabFilteredSupplies.reduce( + (sum, supply) => sum + supply.totalValue, + 0 + ); + }; + + const getTabTotalQuantity = () => { + return tabFilteredSupplies.reduce( + (sum, supply) => sum + supply.itemsQuantity, + 0 + ); + }; + + const getTabTotalVolume = () => { + return tabFilteredSupplies.reduce( + (sum, supply) => sum + supply.volume, + 0 + ); + }; + + return ( +
+ {/* Статистика с кнопкой */} +
+
+ +
+
+ +
+
+

Поставок

+

+ {tabFilteredSupplies.length} +

+
+
+
+ + +
+
+ +
+
+

Стоимость

+

+ {formatCurrency(getTabTotalValue())} +

+
+
+
+ + +
+
+ +
+
+

Товаров

+

+ {getTabTotalQuantity()} ед. +

+
+
+
+ + +
+
+ +
+
+

Объём

+

+ {getTabTotalVolume().toFixed(1)} м³ +

+
+
+
+
+ + +
+ + {/* Фильтры */} +
+
+ + setSearchTerm(e.target.value)} + className="glass-input pl-10 text-white placeholder:text-white/40" + /> +
+ + +
+ + {/* Список поставок */} +
+
+ {tabFilteredSupplies.map((supply, index) => { + const isSellerExpanded = expandedSellers.has(supply.seller.id); + const isSupplyExpanded = expandedSupplies.has(supply.id); + + return ( + +
+ {/* Компактный блок с названием магазина */} +
+
+
+ +
+
+ + {supply.seller.storeName} + + + + {supply.seller.managerName} + + + + {supply.seller.phone} + + + +
+
+
+
+ + Номер поставки + + + {supply.supplyNumber} + +
+ +
+
+ + {/* Скрытая детальная информация о магазине */} + {isSellerExpanded && ( +
+
+
+

+ Юридическое название +

+

+ {supply.seller.name} +

+
+
+

ИНН

+

+ {supply.seller.inn} +

+
+
+
+

Email

+

+ {supply.seller.email} +

+
+
+ )} + + {/* Единый блок со всеми параметрами в одной строке */} +
toggleSupplyExpansion(supply.id)} + > +
+ {/* Порядковый номер */} +
+

+
+
+ + {tabFilteredSupplies.length - index} + +
+
+
+ + {/* Дата поставки */} +
+

Дата

+

+ {formatDate(supply.supplyDate)} +

+
+ + {/* Количество товаров */} +
+

Товаров

+

+ {supply.itemsQuantity} +

+
+ + {/* Количество мест */} +
+

Мест

+

+ {supply.cargoPlaces} +

+
+ + {/* Объём */} +
+

Объём

+

+ {supply.volume} м³ +

+
+ + {/* Стоимость */} +
+

+ Стоимость +

+

+ {formatCurrency(supply.totalValue)} +

+
+ + {/* Ответственный сотрудник */} +
e.stopPropagation()} + > +

+ Ответственный +

+ +
+ + {/* Логистический партнер */} +
e.stopPropagation()} + > +

+ Логистика +

+ +
+ + {/* Статус */} +
+

Статус

+
+ {getStatusBadge(supply.status)} +
+
+
+ + {/* Второй уровень - Маршруты */} + {isSupplyExpanded && + supply.routes && + supply.routes.length > 0 && ( +
+
+

+ + Маршруты ({supply.routes.length}) +

+
+
+ {supply.routes.map((route) => { + const isRouteExpanded = expandedRoutes.has( + route.id + ); + return ( +
+
+ toggleRouteExpansion(route.id) + } + > + {/* Название маршрута */} +
+

+ Маршрут +

+
+

+ {route.routeName} +

+ +
+
+ + {/* Откуда */} +
+

+ Откуда +

+

+ {route.fromAddress} +

+
+ + {/* Куда */} +
+

+ Куда +

+

+ {route.toAddress} +

+
+ + {/* Расстояние */} +
+

+ Расстояние +

+

+ {route.distance} км +

+
+ + {/* Время в пути */} +
+

+ Время +

+

+ {route.estimatedTime} +

+
+ + {/* Транспорт */} +
+

+ Транспорт +

+

+ {route.transportType} +

+
+ + {/* Стоимость и статус */} +
+

+ Стоимость +

+

+ {formatCurrency(route.cost)} +

+ {getRouteStatusBadge(route.status)} +
+
+ + {/* Третий уровень - Поставщики/Оптовики */} + {isRouteExpanded && + route.suppliers && + route.suppliers.length > 0 && ( +
+
+
+ + Поставщики/Оптовики ( + {route.suppliers.length}) +
+
+
+ {route.suppliers.map((supplier) => { + const isSupplierExpanded = + expandedSuppliers.has( + supplier.id + ); + return ( +
+
+ toggleSupplierExpansion( + supplier.id + ) + } + > + {/* Название поставщика */} +
+

+ Поставщик +

+
+

+ {supplier.name} +

+ +
+
+ + {/* ИНН */} +
+

+ ИНН +

+

+ {supplier.inn} +

+
+ + {/* Тип */} +
+

+ Тип +

+ + {supplier.type === + "WHOLESALE" + ? "Оптовик" + : "Поставщик"} + +
+ + {/* Менеджер */} +
+

+ Менеджер +

+

+ {supplier.managerName} +

+
+ + {/* Стоимость */} +
+

+ Стоимость +

+

+ {formatCurrency( + supplier.totalValue + )} +

+
+ + {/* Статус */} +
+

+ Статус +

+ {getSupplierStatusBadge( + supplier.status + )} +
+
+ + {/* Детальная информация о поставщике */} + {isSupplierExpanded && ( +
+
+
+

+ Полное название +

+

+ {supplier.fullName || + supplier.name} +

+
+
+

+ Телефон +

+
+

+ {supplier.phone} +

+ +
+
+
+

+ Email +

+

+ {supplier.email} +

+
+
+
+

+ Адрес +

+

+ {supplier.address} +

+
+
+ )} +
+ ); + })} +
+
+ )} +
+ ); + })} +
+
+ )} +
+
+
+ ); + })} +
+
+
+ ); + } } diff --git a/src/components/fulfillment-supplies/fulfillment-supplies/fulfillment-supplies-tab.tsx b/src/components/fulfillment-supplies/fulfillment-supplies/fulfillment-supplies-tab.tsx index 14d8352..a1885fc 100644 --- a/src/components/fulfillment-supplies/fulfillment-supplies/fulfillment-supplies-tab.tsx +++ b/src/components/fulfillment-supplies/fulfillment-supplies/fulfillment-supplies-tab.tsx @@ -35,7 +35,7 @@ export function FulfillmentSuppliesTab() { className="data-[state=active]:bg-white/20 data-[state=active]:text-white text-white/70 flex items-center gap-1 text-xs" > - Расходники (название текущего кабинета) + Наши расходники