diff --git a/src/components/orders/OrderDetailPanel.jsx b/src/components/orders/OrderDetailPanel.jsx index 020bdfb..d159ce1 100644 --- a/src/components/orders/OrderDetailPanel.jsx +++ b/src/components/orders/OrderDetailPanel.jsx @@ -232,6 +232,64 @@ const normalizeDateForInput = (value) => { return ""; }; +const CollapsibleOrderComposition = ({ order }) => { + const [isExpanded, setIsExpanded] = React.useState(false); + const orders = parseOrderList(order); + const totalPositions = orders.reduce((sum, o) => sum + (o.items?.length || 0), 0); + + return ( +
+ + {isExpanded && ( +
+ {!orders.length ? ( +

Позиции не указаны

+ ) : ( + orders.map((orderItem, idx) => ( +
+

{orderItem.nom || orderItem.name || `Заказ ${idx + 1}`}

+ {orderItem.items && orderItem.items.length > 0 ? ( +
+ {orderItem.items.map((item, itemIdx) => ( +
+ {item.product_name || item.name || item.title || ''} + + {item.product_quantity || item.quantity || item.count || item.amount || ""} {item.product_ed || item.unit || ""} + +
+ ))} +
+ ) : ( +

Позиции не указаны

+ )} +
+ )) + )} +
+ )} +
+ ); +}; + export const OrderDetailPanel = ({ order, canManageDelivery = false, @@ -692,37 +750,9 @@ export const OrderDetailPanel = ({ {renderList(order.orderNumbers)} - - Состав заказа -
- {(() => { - const orders = parseOrderList(order); - if (!orders.length) { - return

Позиции не указаны

; - } - return orders.map((orderItem, idx) => ( -
-

{orderItem.nom || orderItem.name || `Заказ ${idx + 1}`}

- {orderItem.items && orderItem.items.length > 0 ? ( -
- {orderItem.items.map((item, itemIdx) => ( -
- {item.product_name || item.name || item.title || JSON.stringify(item)} - - {item.product_quantity || item.quantity || item.count || item.amount || ""} {item.product_ed || item.unit || ""} - -
- ))} -
- ) : ( -

Позиции не указаны

- )} -
- )); - })()} -
+ + - {userRole !== "driver" ? ( Дополнительные данные