diff --git a/src/components/supplies/wb-product-cards.tsx b/src/components/supplies/wb-product-cards.tsx index 874743e..b369c89 100644 --- a/src/components/supplies/wb-product-cards.tsx +++ b/src/components/supplies/wb-product-cards.tsx @@ -8,6 +8,8 @@ import { Badge } from '@/components/ui/badge' import { Label } from '@/components/ui/label' import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from '@/components/ui/select' import { Dialog, DialogContent, DialogHeader, DialogTitle } from '@/components/ui/dialog' +import { Sidebar } from '@/components/dashboard/sidebar' +import { useSidebar } from '@/hooks/useSidebar' import { Search, Plus, @@ -79,6 +81,7 @@ interface WBProductCardsProps { export function WBProductCards({ onBack, onComplete }: WBProductCardsProps) { const { user } = useAuth() + const { getSidebarMargin } = useSidebar() const [searchTerm, setSearchTerm] = useState('') const [loading, setLoading] = useState(false) const [wbCards, setWbCards] = useState([]) @@ -589,32 +592,35 @@ export function WBProductCards({ onBack, onComplete }: WBProductCardsProps) { if (showSummary) { return ( -
-
-
- -
-

Сводка заказа

-

Проверьте данные перед созданием поставки

+
+ +
+
+
+
+ +
+

Сводка заказа

+

Проверьте данные перед созданием поставки

+
+
+
-
- -
@@ -720,13 +726,18 @@ export function WBProductCards({ onBack, onComplete }: WBProductCardsProps) {
-
+
+
+
) } return ( -
+
+ +
+
+ /> + + {/* Количество в наличии */} +
+ 10 ? 'bg-green-500/80' : maxQuantity > 0 ? 'bg-yellow-500/80' : 'bg-red-500/80'} text-white border-0 backdrop-blur text-xs`}> + {maxQuantity} + +
+ + {/* Overlay с кнопкой */} +
+ +
-
-

handleCardClick(card)}>{card.title}

-

{card.vendorCode}

-
- {formatCurrency(price)} - 10 ? 'bg-green-500/20 text-green-300' : maxQuantity > 0 ? 'bg-yellow-500/20 text-yellow-300' : 'bg-red-500/20 text-red-300'}`}> - {maxQuantity} шт. - + +
+ {/* Заголовок и бренд */} +
+
+ + {card.brand} + +
+

handleCardClick(card)}> + {card.title} +

+

{card.vendorCode}

+
+ + {/* Цена */} +
+
+ {formatCurrency(price)} +
- {/* Количество */} + {/* Управление количеством */}
- -
+
- updateCardSelection(card, 'selectedQuantity', Math.min(maxQuantity, Math.max(0, parseInt(e.target.value) || 0)))} - className="bg-white/5 border-white/20 text-white text-center w-20 h-8" + onChange={(e) => { + const value = e.target.value.replace(/[^0-9]/g, '') + const numValue = Math.max(0, Math.min(maxQuantity, parseInt(value) || 0)) + updateCardSelection(card, 'selectedQuantity', numValue) + }} + onFocus={(e) => e.target.select()} + className="h-7 w-12 text-center bg-white/10 border border-white/20 text-white text-sm rounded focus:outline-none focus:ring-2 focus:ring-purple-500 focus:border-transparent [appearance:textfield] [&::-webkit-outer-spin-button]:appearance-none [&::-webkit-inner-spin-button]:appearance-none" /> -
-
- - {/* Детальные настройки для выбранных товаров */} - {isSelected && selectedCard && ( -
- {/* Рынок */} -
- - -
- - {/* Место на рынке */} -
- - updateCardSelection(card, 'selectedPlace', e.target.value)} - className="bg-white/5 border-white/20 text-white placeholder-white/50" - /> -
- - {/* Данные продавца */} -
-
- - updateCardSelection(card, 'sellerName', e.target.value)} - className="bg-white/5 border-white/20 text-white placeholder-white/50" - /> -
-
- - updateCardSelection(card, 'sellerPhone', e.target.value)} - className="bg-white/5 border-white/20 text-white placeholder-white/50" - /> -
-
- - {/* Дата поставки */} -
- - updateCardSelection(card, 'deliveryDate', e.target.value)} - className="bg-white/5 border-white/20 text-white" - /> -
- - {/* Услуги фулфилмента */} - {fulfillmentServices.length > 0 && ( -
- -
- {fulfillmentServices.map((service) => ( - - ))} -
- - {selectedCards.length > 1 && ( - - )} -
+ + {selectedQuantity > 0 && ( + + + {selectedQuantity} + )}
- )} + + {/* Сумма для выбранного товара */} + {selectedQuantity > 0 && ( +
+
+ {formatCurrency(price * selectedQuantity)} +
+
+ )} +
+ +
) @@ -1022,13 +952,13 @@ export function WBProductCards({ onBack, onComplete }: WBProductCardsProps) { )} {wbCards.length === 0 && !loading && ( - -
- -

Карточки товаров Wildberries

+ +
+ +

Карточки товаров Wildberries

{user?.organization?.apiKeys?.find(key => key.marketplace === 'WILDBERRIES')?.isActive ? ( <> -

+

Введите запрос в поле поиска, чтобы найти товары в вашем каталоге Wildberries, или загрузите все доступные карточки

) : ( <> -

- Для работы с реальными карточками товаров необходимо настроить API ключ Wildberries в настройках организации +

+ Для работы с реальными карточками необходимо настроить API ключ Wildberries

-

- Сейчас показаны демонстрационные товары. Для тестирования используйте поиск или загрузите все. +

+ Показаны демонстрационные товары для тестирования

- ) +
+
+
+ ) } \ No newline at end of file