From 44d3f0f16d51e5be86a71ace32c711933f55ae43 Mon Sep 17 00:00:00 2001 From: root Date: Thu, 6 Aug 2026 12:10:21 +0000 Subject: [PATCH] fix(client): compact order composition trigger --- public/service-worker.js | 4 ++-- src/components/client/OrderCompositionPanel.jsx | 10 ++++++++-- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/public/service-worker.js b/public/service-worker.js index 8af5064..568f823 100644 --- a/public/service-worker.js +++ b/public/service-worker.js @@ -1,8 +1,8 @@ const isLocalhost = self.location.hostname === "localhost" || self.location.hostname === "127.0.0.1"; if (!isLocalhost) { - const STATIC_CACHE = "construction-delivery-static-v96"; - const RUNTIME_CACHE = "construction-delivery-runtime-v96"; + const STATIC_CACHE = "construction-delivery-static-v97"; + const RUNTIME_CACHE = "construction-delivery-runtime-v97"; const APP_SHELL_URLS = ["/", "/index.html", "/manifest.webmanifest", "/icons/icon-192.png", "/icons/icon-512.png"]; self.addEventListener("install", (event) => { diff --git a/src/components/client/OrderCompositionPanel.jsx b/src/components/client/OrderCompositionPanel.jsx index 73310dc..dcb61eb 100644 --- a/src/components/client/OrderCompositionPanel.jsx +++ b/src/components/client/OrderCompositionPanel.jsx @@ -92,6 +92,13 @@ export const OrderCompositionPanel = ({ invitation = {} }) => { const filteredCount = allProducts.length - products.length; const reference = getInvitationReferenceLabel(invitation); + const invoiceCount = (() => { + const items = Array.isArray(rawItems) ? rawItems : []; + const numbers = new Set(items.map((item) => String( + item?.order_number || item?.orderNumber || item?.invoice_number || item?.invoiceNumber || item?.nom || "", + ).trim()).filter(Boolean)); + return numbers.size || (invitation?.orderNumber ? 1 : 1); + })(); const [isExpanded, setIsExpanded] = React.useState(false); @@ -107,10 +114,9 @@ export const OrderCompositionPanel = ({ invitation = {} }) => { onClick={() => setIsExpanded(!isExpanded)} >

- Состав заказа{reference && reference !== "Счет —" ? ` ${reference}` : ""} + Состав заказа · {invoiceCount} {invoiceCount === 1 ? "счёт" : invoiceCount < 5 ? "счёта" : "счетов"}

- {products.length} поз.