This commit is contained in:
Bivekich
2025-07-30 18:32:52 +03:00
parent 38dcfcef2b
commit 593ae16e1e
10 changed files with 192 additions and 48 deletions

View File

@ -83,6 +83,8 @@ export function CreateFulfillmentConsumablesSupplyPage() {
const { user } = useAuth();
const [selectedSupplier, setSelectedSupplier] =
useState<FulfillmentConsumableSupplier | null>(null);
const [selectedLogistics, setSelectedLogistics] =
useState<FulfillmentConsumableSupplier | null>(null);
const [selectedConsumables, setSelectedConsumables] = useState<
SelectedFulfillmentConsumable[]
>([]);
@ -113,6 +115,11 @@ export function CreateFulfillmentConsumablesSupplyPage() {
counterpartiesData?.myCounterparties || []
).filter((org: FulfillmentConsumableSupplier) => org.type === "WHOLESALE");
// Фильтруем только логистические компании
const logisticsPartners = (
counterpartiesData?.myCounterparties || []
).filter((org: FulfillmentConsumableSupplier) => org.type === "LOGIST");
// Фильтруем поставщиков по поисковому запросу
const filteredSuppliers = consumableSuppliers.filter(
(supplier: FulfillmentConsumableSupplier) =>
@ -258,6 +265,7 @@ export function CreateFulfillmentConsumablesSupplyPage() {
deliveryDate: deliveryDate,
// Для фулфилмента указываем себя как получателя (поставка на свой склад)
fulfillmentCenterId: user?.organization?.id,
logisticsPartnerId: selectedLogistics?.id,
items: selectedConsumables.map((consumable) => ({
productId: consumable.id,
quantity: consumable.selectedQuantity,
@ -784,6 +792,42 @@ export function CreateFulfillmentConsumablesSupplyPage() {
required
/>
</div>
{/* Выбор логистики */}
<div className="mb-3">
<label className="text-white/60 text-xs mb-1 block">
Логистика (опционально):
</label>
<div className="relative">
<select
value={selectedLogistics?.id || ""}
onChange={(e) => {
const logisticsId = e.target.value;
const logistics = logisticsPartners.find(p => p.id === logisticsId);
setSelectedLogistics(logistics || null);
}}
className="w-full bg-white/10 border border-white/20 rounded-md px-3 py-2 text-white text-sm focus:outline-none focus:ring-1 focus:ring-purple-500 focus:border-transparent appearance-none"
>
<option value="" className="bg-gray-800 text-white">
Без логистики
</option>
{logisticsPartners.map((partner) => (
<option
key={partner.id}
value={partner.id}
className="bg-gray-800 text-white"
>
{partner.name || partner.fullName || partner.inn}
</option>
))}
</select>
<div className="absolute inset-y-0 right-0 flex items-center px-2 pointer-events-none">
<svg className="w-4 h-4 text-white/60" fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path strokeLinecap="round" strokeLinejoin="round" strokeWidth={2} d="M19 9l-7 7-7-7" />
</svg>
</div>
</div>
</div>
<div className="flex items-center justify-between mb-3">
<span className="text-white font-semibold text-sm">
Итого:

View File

@ -16,8 +16,8 @@ import {
import { DeliveryDetailsProps } from "./types";
const DELIVERY_STATUS_CONFIG = {
delivered: {
label: "Доставлено",
"in-stock": {
label: "На складе",
color: "bg-green-500/20 text-green-300",
icon: CheckCircle,
},
@ -26,6 +26,22 @@ const DELIVERY_STATUS_CONFIG = {
color: "bg-blue-500/20 text-blue-300",
icon: Truck,
},
confirmed: {
label: "Подтверждено",
color: "bg-cyan-500/20 text-cyan-300",
icon: CheckCircle,
},
planned: {
label: "Запланировано",
color: "bg-yellow-500/20 text-yellow-300",
icon: Clock,
},
// Обратная совместимость
delivered: {
label: "Доставлено",
color: "bg-green-500/20 text-green-300",
icon: CheckCircle,
},
pending: {
label: "Ожидание",
color: "bg-yellow-500/20 text-yellow-300",

View File

@ -32,6 +32,27 @@ import {
// Статусы расходников с цветами
const STATUS_CONFIG = {
"in-stock": {
label: "Доступен",
color: "bg-green-500/20 text-green-300",
icon: CheckCircle,
},
"in-transit": {
label: "В пути",
color: "bg-blue-500/20 text-blue-300",
icon: Clock,
},
confirmed: {
label: "Подтверждено",
color: "bg-cyan-500/20 text-cyan-300",
icon: CheckCircle,
},
planned: {
label: "Запланировано",
color: "bg-yellow-500/20 text-yellow-300",
icon: Clock,
},
// Обратная совместимость и специальные статусы
available: {
label: "Доступен",
color: "bg-green-500/20 text-green-300",
@ -47,11 +68,6 @@ const STATUS_CONFIG = {
color: "bg-red-500/20 text-red-300",
icon: AlertTriangle,
},
"in-transit": {
label: "В пути",
color: "bg-blue-500/20 text-blue-300",
icon: Clock,
},
reserved: {
label: "Зарезервирован",
color: "bg-purple-500/20 text-purple-300",

View File

@ -477,6 +477,7 @@ export function FulfillmentWarehouseDashboard() {
supplyOrders,
allProducts,
mySupplies,
myFulfillmentSupplies,
suppliesReceivedToday,
suppliesUsedToday,
productsReceivedToday,

View File

@ -15,7 +15,6 @@ export function SuppliesGrid({
return (
<div className="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4 gap-4">
{supplies.map((supply) => {
const statusConfig = getStatusConfig(supply.status);
const isExpanded = expandedSupplies.has(supply.id);
const deliveries = getSupplyDeliveries(supply);
@ -26,7 +25,6 @@ export function SuppliesGrid({
supply={supply}
isExpanded={isExpanded}
onToggleExpansion={onToggleExpansion}
statusConfig={statusConfig}
getSupplyDeliveries={getSupplyDeliveries}
/>

View File

@ -18,7 +18,6 @@ export function SupplyCard({
supply,
isExpanded,
onToggleExpansion,
statusConfig,
getSupplyDeliveries,
}: SupplyCardProps) {
const formatCurrency = (amount: number) => {
@ -33,7 +32,6 @@ export function SupplyCard({
return new Intl.NumberFormat("ru-RU").format(num);
};
const StatusIcon = statusConfig.icon;
const isLowStock =
supply.currentStock <= supply.minStock && supply.currentStock > 0;
const stockPercentage =
@ -58,12 +56,6 @@ export function SupplyCard({
{supply.description}
</p>
</div>
<div className="flex items-center space-x-2 ml-2">
<Badge className={`${statusConfig.color} text-xs`}>
<StatusIcon className="h-3 w-3 mr-1" />
{statusConfig.label}
</Badge>
</div>
</div>
{/* Основная информация */}

View File

@ -54,7 +54,6 @@ export interface SupplyCardProps {
supply: Supply;
isExpanded: boolean;
onToggleExpansion: (id: string) => void;
statusConfig: StatusConfig;
getSupplyDeliveries: (supply: Supply) => Supply[];
}