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

View File

@ -249,7 +249,8 @@ export function CreateFulfillmentConsumablesSupplyPage() {
if ( if (
!selectedSupplier || !selectedSupplier ||
selectedConsumables.length === 0 || selectedConsumables.length === 0 ||
!deliveryDate !deliveryDate ||
!selectedLogistics
) { ) {
toast.error("Заполните все обязательные поля"); toast.error("Заполните все обязательные поля");
return; return;
@ -796,7 +797,7 @@ export function CreateFulfillmentConsumablesSupplyPage() {
{/* Выбор логистики */} {/* Выбор логистики */}
<div className="mb-3"> <div className="mb-3">
<label className="text-white/60 text-xs mb-1 block"> <label className="text-white/60 text-xs mb-1 block">
Логистика (опционально): Логистика *:
</label> </label>
<div className="relative"> <div className="relative">
<select <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" 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 value="" className="bg-gray-800 text-white">
Без логистики Выберите логистику
</option> </option>
{logisticsPartners.map((partner) => ( {logisticsPartners.map((partner) => (
<option <option
@ -841,7 +842,8 @@ export function CreateFulfillmentConsumablesSupplyPage() {
disabled={ disabled={
isCreatingSupply || isCreatingSupply ||
!deliveryDate || !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" 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[]; phones?: string[];
emails?: string[]; emails?: string[];
}; };
logisticsPartner?: {
id: string;
name: string;
fullName: string;
type: string;
};
items: Array<{ items: Array<{
id: string; id: string;
quantity: number; quantity: number;

View File

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

View File

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

View File

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

View File

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