Упрощен интерфейс компонентов FulfillmentDetailedGoodsTab, FulfillmentDetailedSuppliesTab и FulfillmentGoodsTab: удалены кнопки для разворачивания строк, добавлены обработчики кликов на строки для улучшения взаимодействия с пользователем. Оптимизированы стили и структура кода для повышения удобства использования.

This commit is contained in:
Veronika Smirnova
2025-07-24 13:02:31 +03:00
parent b1f78a34e2
commit 3ab20c9514
3 changed files with 44 additions and 185 deletions

View File

@ -5,8 +5,6 @@ import { Card } from "@/components/ui/card";
import { Button } from "@/components/ui/button";
import { Badge } from "@/components/ui/badge";
import {
ChevronDown,
ChevronRight,
Calendar,
Package,
MapPin,
@ -439,21 +437,12 @@ export function FulfillmentDetailedGoodsTab() {
return (
<React.Fragment key={supply.id}>
{/* Уровень 1: Основная строка поставки ФФ */}
<tr className="border-b border-white/10 hover:bg-white/5 transition-colors bg-purple-500/10">
<tr
className="border-b border-white/10 hover:bg-white/5 transition-colors bg-purple-500/10 cursor-pointer"
onClick={() => toggleSupplyExpansion(supply.id)}
>
<td className="p-4">
<div className="flex items-center space-x-2">
<Button
variant="ghost"
size="sm"
onClick={() => toggleSupplyExpansion(supply.id)}
className="h-6 w-6 p-0 text-white/60 hover:text-white hover:bg-white/10"
>
{isSupplyExpanded ? (
<ChevronDown className="h-4 w-4" />
) : (
<ChevronRight className="h-4 w-4" />
)}
</Button>
<span className="text-white font-bold text-lg">
#{supply.number}
</span>
@ -525,23 +514,12 @@ export function FulfillmentDetailedGoodsTab() {
const isRouteExpanded = expandedRoutes.has(route.id);
return (
<React.Fragment key={route.id}>
<tr className="border-b border-white/10 hover:bg-white/5 transition-colors bg-blue-500/10">
<tr
className="border-b border-white/10 hover:bg-white/5 transition-colors bg-blue-500/10 cursor-pointer"
onClick={() => toggleRouteExpansion(route.id)}
>
<td className="p-4 pl-12">
<div className="flex items-center space-x-2">
<Button
variant="ghost"
size="sm"
onClick={() =>
toggleRouteExpansion(route.id)
}
className="h-6 w-6 p-0 text-white/60 hover:text-white hover:bg-white/10"
>
{isRouteExpanded ? (
<ChevronDown className="h-4 w-4" />
) : (
<ChevronRight className="h-4 w-4" />
)}
</Button>
<MapPin className="h-4 w-4 text-blue-400" />
<span className="text-white font-medium">
Маршрут ФФ
@ -636,23 +614,12 @@ export function FulfillmentDetailedGoodsTab() {
);
return (
<React.Fragment key={seller.id}>
<tr className="border-b border-white/10 hover:bg-white/5 transition-colors bg-green-500/10">
<tr
className="border-b border-white/10 hover:bg-white/5 transition-colors bg-green-500/10 cursor-pointer"
onClick={() => toggleSellerExpansion(seller.id)}
>
<td className="p-4 pl-20">
<div className="flex items-center space-x-2">
<Button
variant="ghost"
size="sm"
onClick={() =>
toggleSellerExpansion(seller.id)
}
className="h-6 w-6 p-0 text-white/60 hover:text-white hover:bg-white/10"
>
{isSellerExpanded ? (
<ChevronDown className="h-4 w-4" />
) : (
<ChevronRight className="h-4 w-4" />
)}
</Button>
<Building2 className="h-4 w-4 text-green-400" />
<span className="text-white font-medium">
Селлер ФФ
@ -726,25 +693,12 @@ export function FulfillmentDetailedGoodsTab() {
expandedProducts.has(product.id);
return (
<React.Fragment key={product.id}>
<tr className="border-b border-white/10 hover:bg-white/5 transition-colors bg-yellow-500/10">
<tr
className="border-b border-white/10 hover:bg-white/5 transition-colors bg-yellow-500/10 cursor-pointer"
onClick={() => toggleProductExpansion(product.id)}
>
<td className="p-4 pl-28">
<div className="flex items-center space-x-2">
<Button
variant="ghost"
size="sm"
onClick={() =>
toggleProductExpansion(
product.id
)
}
className="h-6 w-6 p-0 text-white/60 hover:text-white hover:bg-white/10"
>
{isProductExpanded ? (
<ChevronDown className="h-4 w-4" />
) : (
<ChevronRight className="h-4 w-4" />
)}
</Button>
<Package className="h-4 w-4 text-yellow-400" />
<span className="text-white font-medium">
Товар ФФ

View File

@ -7,8 +7,6 @@ import { Badge } from "@/components/ui/badge";
import { StatsCard } from "../../supplies/ui/stats-card";
import { StatsGrid } from "../../supplies/ui/stats-grid";
import {
ChevronDown,
ChevronRight,
Calendar,
MapPin,
Building2,
@ -429,21 +427,12 @@ export function FulfillmentDetailedSuppliesTab() {
return (
<React.Fragment key={supply.id}>
{/* Основная строка поставки расходников ФФ детально */}
<tr className="border-b border-white/10 hover:bg-white/5 transition-colors bg-orange-500/10">
<tr
className="border-b border-white/10 hover:bg-white/5 transition-colors bg-orange-500/10 cursor-pointer"
onClick={() => toggleSupplyExpansion(supply.id)}
>
<td className="p-4">
<div className="flex items-center space-x-2">
<Button
variant="ghost"
size="sm"
onClick={() => toggleSupplyExpansion(supply.id)}
className="h-6 w-6 p-0 text-white/60 hover:text-white hover:bg-white/10"
>
{isSupplyExpanded ? (
<ChevronDown className="h-4 w-4" />
) : (
<ChevronRight className="h-4 w-4" />
)}
</Button>
<span className="text-white font-bold text-lg">
#{supply.number}
</span>
@ -499,23 +488,12 @@ export function FulfillmentDetailedSuppliesTab() {
const isRouteExpanded = expandedRoutes.has(route.id);
return (
<React.Fragment key={route.id}>
<tr className="border-b border-white/10 hover:bg-white/5 transition-colors bg-blue-500/10">
<tr
className="border-b border-white/10 hover:bg-white/5 transition-colors bg-blue-500/10 cursor-pointer"
onClick={() => toggleRouteExpansion(route.id)}
>
<td className="p-4 pl-12">
<div className="flex items-center space-x-2">
<Button
variant="ghost"
size="sm"
onClick={() =>
toggleRouteExpansion(route.id)
}
className="h-6 w-6 p-0 text-white/60 hover:text-white hover:bg-white/10"
>
{isRouteExpanded ? (
<ChevronDown className="h-4 w-4" />
) : (
<ChevronRight className="h-4 w-4" />
)}
</Button>
<MapPin className="h-4 w-4 text-blue-400" />
<span className="text-white font-medium">
Маршрут ФФ
@ -602,25 +580,12 @@ export function FulfillmentDetailedSuppliesTab() {
expandedSuppliers.has(supplier.id);
return (
<React.Fragment key={supplier.id}>
<tr className="border-b border-white/10 hover:bg-white/5 transition-colors bg-green-500/10">
<tr
className="border-b border-white/10 hover:bg-white/5 transition-colors bg-green-500/10 cursor-pointer"
onClick={() => toggleSupplierExpansion(supplier.id)}
>
<td className="p-4 pl-20">
<div className="flex items-center space-x-2">
<Button
variant="ghost"
size="sm"
onClick={() =>
toggleSupplierExpansion(
supplier.id
)
}
className="h-6 w-6 p-0 text-white/60 hover:text-white hover:bg-white/10"
>
{isSupplierExpanded ? (
<ChevronDown className="h-4 w-4" />
) : (
<ChevronRight className="h-4 w-4" />
)}
</Button>
<Building2 className="h-4 w-4 text-green-400" />
<span className="text-white font-medium">
Поставщик ФФ
@ -697,25 +662,12 @@ export function FulfillmentDetailedSuppliesTab() {
);
return (
<React.Fragment key={consumable.id}>
<tr className="border-b border-white/10 hover:bg-white/5 transition-colors bg-yellow-500/10">
<tr
className="border-b border-white/10 hover:bg-white/5 transition-colors bg-yellow-500/10 cursor-pointer"
onClick={() => toggleConsumableExpansion(consumable.id)}
>
<td className="p-4 pl-28">
<div className="flex items-center space-x-2">
<Button
variant="ghost"
size="sm"
onClick={() =>
toggleConsumableExpansion(
consumable.id
)
}
className="h-6 w-6 p-0 text-white/60 hover:text-white hover:bg-white/10"
>
{isConsumableExpanded ? (
<ChevronDown className="h-4 w-4" />
) : (
<ChevronRight className="h-4 w-4" />
)}
</Button>
<Wrench className="h-4 w-4 text-yellow-400" />
<span className="text-white font-medium">
Расходник ФФ

View File

@ -26,8 +26,6 @@ import {
Hash,
Package2,
Boxes,
ChevronDown,
ChevronRight,
Store,
Building2,
Clock,
@ -816,7 +814,10 @@ export function FulfillmentGoodsTab() {
>
<div className="space-y-3">
{/* Компактный блок с названием магазина */}
<div className="flex items-center justify-between bg-white/5 rounded-lg p-2">
<div
className="flex items-center justify-between bg-white/5 rounded-lg p-2 cursor-pointer hover:bg-white/10 transition-colors"
onClick={() => toggleSellerExpansion(supply.seller.id)}
>
<div className="flex items-center gap-3">
<div className="p-1.5 bg-green-500/20 rounded">
<Store className="h-3 w-3 text-green-400" />
@ -844,6 +845,7 @@ export function FulfillmentGoodsTab() {
rel="noopener noreferrer"
className="p-1 bg-blue-500/20 rounded hover:bg-blue-500/30 transition-colors"
title="Написать в Telegram"
onClick={(e) => e.stopPropagation()}
>
<svg
className="h-3 w-3 text-blue-400"
@ -862,6 +864,7 @@ export function FulfillmentGoodsTab() {
rel="noopener noreferrer"
className="p-1 bg-green-500/20 rounded hover:bg-green-500/30 transition-colors"
title="Написать в WhatsApp"
onClick={(e) => e.stopPropagation()}
>
<svg
className="h-3 w-3 text-green-400"
@ -883,20 +886,6 @@ export function FulfillmentGoodsTab() {
{supply.supplyNumber}
</span>
</div>
<Button
variant="ghost"
size="sm"
onClick={() =>
toggleSellerExpansion(supply.seller.id)
}
className="h-6 w-6 p-0 text-white/60 hover:text-white hover:bg-white/10"
>
{isSellerExpanded ? (
<ChevronDown className="h-3 w-3" />
) : (
<ChevronRight className="h-3 w-3" />
)}
</Button>
</div>
</div>
@ -1099,26 +1088,9 @@ export function FulfillmentGoodsTab() {
<p className="text-white/60 text-xs mb-1">
Маршрут
</p>
<div className="flex items-center gap-2">
<p className="text-white font-medium text-sm">
{route.routeName}
</p>
<Button
variant="ghost"
size="sm"
className="h-4 w-4 p-0 text-white/60 hover:text-white hover:bg-white/10"
onClick={(e) => {
e.stopPropagation();
toggleRouteExpansion(route.id);
}}
>
{isRouteExpanded ? (
<ChevronDown className="h-3 w-3" />
) : (
<ChevronRight className="h-3 w-3" />
)}
</Button>
</div>
</div>
{/* Откуда */}
@ -1219,28 +1191,9 @@ export function FulfillmentGoodsTab() {
<p className="text-white/60 text-xs mb-1">
Поставщик
</p>
<div className="flex items-center gap-2">
<p className="text-white font-medium text-sm">
{supplier.name}
</p>
<Button
variant="ghost"
size="sm"
className="h-4 w-4 p-0 text-white/60 hover:text-white hover:bg-white/10"
onClick={(e) => {
e.stopPropagation();
toggleSupplierExpansion(
supplier.id
);
}}
>
{isSupplierExpanded ? (
<ChevronDown className="h-3 w-3" />
) : (
<ChevronRight className="h-3 w-3" />
)}
</Button>
</div>
</div>
{/* ИНН */}