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">
Итого: