This commit is contained in:
Bivekich
2025-07-30 20:24:41 +03:00
parent 593ae16e1e
commit 4147d85b36
7 changed files with 35 additions and 8 deletions

View File

@ -473,7 +473,7 @@ model SupplyOrder {
totalAmount Decimal @db.Decimal(12, 2)
totalItems Int
fulfillmentCenterId String?
logisticsPartnerId String?
logisticsPartnerId String
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
organizationId String
@ -481,7 +481,7 @@ model SupplyOrder {
organization Organization @relation(fields: [organizationId], references: [id], onDelete: Cascade)
partner Organization @relation("SupplyOrderPartner", fields: [partnerId], references: [id])
fulfillmentCenter Organization? @relation("SupplyOrderFulfillmentCenter", fields: [fulfillmentCenterId], references: [id])
logisticsPartner Organization? @relation("SupplyOrderLogistics", fields: [logisticsPartnerId], references: [id])
logisticsPartner Organization @relation("SupplyOrderLogistics", fields: [logisticsPartnerId], references: [id])
@@map("supply_orders")
}

View File

@ -249,7 +249,8 @@ export function CreateFulfillmentConsumablesSupplyPage() {
if (
!selectedSupplier ||
selectedConsumables.length === 0 ||
!deliveryDate
!deliveryDate ||
!selectedLogistics
) {
toast.error("Заполните все обязательные поля");
return;
@ -796,7 +797,7 @@ export function CreateFulfillmentConsumablesSupplyPage() {
{/* Выбор логистики */}
<div className="mb-3">
<label className="text-white/60 text-xs mb-1 block">
Логистика (опционально):
Логистика *:
</label>
<div className="relative">
<select
@ -809,7 +810,7 @@ export function CreateFulfillmentConsumablesSupplyPage() {
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
@ -841,7 +842,8 @@ export function CreateFulfillmentConsumablesSupplyPage() {
disabled={
isCreatingSupply ||
!deliveryDate ||
selectedConsumables.length === 0
selectedConsumables.length === 0 ||
!selectedLogistics
}
className="w-full bg-gradient-to-r from-purple-500 to-pink-500 hover:from-purple-600 hover:to-pink-600 text-white disabled:opacity-50 h-8 text-sm"
>

View File

@ -53,6 +53,12 @@ interface SupplyOrder {
phones?: string[];
emails?: string[];
};
logisticsPartner?: {
id: string;
name: string;
fullName: string;
type: string;
};
items: Array<{
id: string;
quantity: number;

View File

@ -57,6 +57,12 @@ interface SupplyOrder {
name?: string;
fullName?: string;
};
logisticsPartner?: {
id: string;
name?: string;
fullName?: string;
type: string;
};
items: {
id: string;
quantity: number;
@ -381,7 +387,11 @@ export function FulfillmentDetailedSuppliesTab() {
</td>
<td className="p-4">
<span className="text-purple-400 font-semibold">
-
{order.logisticsPartner
? order.logisticsPartner.name ||
order.logisticsPartner.fullName ||
"Логистическая компания"
: "-"}
</span>
</td>
<td className="p-4">

View File

@ -949,6 +949,12 @@ export const GET_SUPPLY_ORDERS = gql`
fullName
type
}
logisticsPartner {
id
name
fullName
type
}
items {
id
quantity

View File

@ -924,6 +924,7 @@ export const resolvers = {
users: true,
},
},
logisticsPartner: true,
items: {
include: {
product: {

View File

@ -576,6 +576,8 @@ export const typeDefs = gql`
totalItems: Int!
fulfillmentCenterId: ID
fulfillmentCenter: Organization
logisticsPartnerId: ID!
logisticsPartner: Organization!
items: [SupplyOrderItem!]!
createdAt: DateTime!
updatedAt: DateTime!
@ -603,7 +605,7 @@ export const typeDefs = gql`
partnerId: ID!
deliveryDate: DateTime!
fulfillmentCenterId: ID # ID фулфилмент-центра для доставки
logisticsPartnerId: ID # ID логистической компании
logisticsPartnerId: ID! # ID логистической компании (обязательно)
items: [SupplyOrderItemInput!]!
notes: String # Дополнительные заметки к заказу
}