feat: rename and clarify supplies sections for different cabinet types

- Seller cabinet: 'Мои поставки' (creating supplies for marketplaces)
- Fulfillment cabinet: 'Входящие поставки' (receiving goods and materials)
- Wholesale cabinet: 'Отгрузки' (shipping goods to sellers/fulfillment)
- Logistics cabinet: 'Перевозки' (managing transportation routes)

- Update sidebar navigation with specific names for each cabinet type
- Create logistics dashboard with route management functionality
- Add logistics page with transportation statistics and active routes
- Update routing logic to handle all cabinet types correctly
This commit is contained in:
Veronika Smirnova
2025-07-21 13:45:39 +03:00
parent 753ec7b2ec
commit 0e584749f3
3 changed files with 367 additions and 10 deletions

View File

@ -83,11 +83,22 @@ export function Sidebar() {
}
const handleSuppliesClick = () => {
// Для фулфилмент кабинетов используем новый роут
if (user?.organization?.type === 'FULFILLMENT') {
router.push('/fulfillment-supplies')
} else {
router.push('/supplies')
// Для каждого типа кабинета свой роут
switch (user?.organization?.type) {
case 'FULFILLMENT':
router.push('/fulfillment-supplies')
break
case 'SELLER':
router.push('/supplies')
break
case 'WHOLESALE':
router.push('/supplies')
break
case 'LOGIST':
router.push('/logistics')
break
default:
router.push('/supplies')
}
}
@ -103,7 +114,7 @@ export function Sidebar() {
const isServicesActive = pathname.startsWith('/services')
const isWarehouseActive = pathname.startsWith('/warehouse')
const isEmployeesActive = pathname.startsWith('/employees')
const isSuppliesActive = pathname.startsWith('/supplies') || pathname.startsWith('/fulfillment-supplies')
const isSuppliesActive = pathname.startsWith('/supplies') || pathname.startsWith('/fulfillment-supplies') || pathname.startsWith('/logistics')
const isPartnersActive = pathname.startsWith('/partners')
return (
@ -270,8 +281,8 @@ export function Sidebar() {
</Button>
)}
{/* Поставки - для селлеров и фулфилмент */}
{(user?.organization?.type === 'SELLER' || user?.organization?.type === 'FULFILLMENT') && (
{/* Мои поставки - для селлеров */}
{user?.organization?.type === 'SELLER' && (
<Button
variant={isSuppliesActive ? "secondary" : "ghost"}
className={`w-full ${isCollapsed ? 'justify-center px-2 h-9' : 'justify-start h-10'} text-left transition-all duration-200 text-xs ${
@ -280,10 +291,61 @@ export function Sidebar() {
: 'text-white/80 hover:bg-white/10 hover:text-white'
} cursor-pointer`}
onClick={handleSuppliesClick}
title={isCollapsed ? "Поставки" : ""}
title={isCollapsed ? "Мои поставки" : ""}
>
<Truck className="h-4 w-4 flex-shrink-0" />
{!isCollapsed && <span className="ml-3">Поставки</span>}
{!isCollapsed && <span className="ml-3">Мои поставки</span>}
</Button>
)}
{/* Входящие поставки - для фулфилмент */}
{user?.organization?.type === 'FULFILLMENT' && (
<Button
variant={isSuppliesActive ? "secondary" : "ghost"}
className={`w-full ${isCollapsed ? 'justify-center px-2 h-9' : 'justify-start h-10'} text-left transition-all duration-200 text-xs ${
isSuppliesActive
? 'bg-white/20 text-white hover:bg-white/30'
: 'text-white/80 hover:bg-white/10 hover:text-white'
} cursor-pointer`}
onClick={handleSuppliesClick}
title={isCollapsed ? "Входящие поставки" : ""}
>
<Truck className="h-4 w-4 flex-shrink-0" />
{!isCollapsed && <span className="ml-3">Входящие поставки</span>}
</Button>
)}
{/* Отгрузки - для оптовиков */}
{user?.organization?.type === 'WHOLESALE' && (
<Button
variant={isSuppliesActive ? "secondary" : "ghost"}
className={`w-full ${isCollapsed ? 'justify-center px-2 h-9' : 'justify-start h-10'} text-left transition-all duration-200 text-xs ${
isSuppliesActive
? 'bg-white/20 text-white hover:bg-white/30'
: 'text-white/80 hover:bg-white/10 hover:text-white'
} cursor-pointer`}
onClick={handleSuppliesClick}
title={isCollapsed ? "Отгрузки" : ""}
>
<Truck className="h-4 w-4 flex-shrink-0" />
{!isCollapsed && <span className="ml-3">Отгрузки</span>}
</Button>
)}
{/* Перевозки - для логистов */}
{user?.organization?.type === 'LOGIST' && (
<Button
variant={isSuppliesActive ? "secondary" : "ghost"}
className={`w-full ${isCollapsed ? 'justify-center px-2 h-9' : 'justify-start h-10'} text-left transition-all duration-200 text-xs ${
isSuppliesActive
? 'bg-white/20 text-white hover:bg-white/30'
: 'text-white/80 hover:bg-white/10 hover:text-white'
} cursor-pointer`}
onClick={handleSuppliesClick}
title={isCollapsed ? "Перевозки" : ""}
>
<Truck className="h-4 w-4 flex-shrink-0" />
{!isCollapsed && <span className="ml-3">Перевозки</span>}
</Button>
)}