fix(client): compact order composition trigger

This commit is contained in:
root 2026-08-06 12:10:21 +00:00
parent 82d6f4f077
commit 44d3f0f16d
2 changed files with 10 additions and 4 deletions

View File

@ -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) => {

View File

@ -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)}
>
<p className="text-sm font-semibold text-[var(--color-text)]">
Состав заказа{reference && reference !== "Счет —" ? ` ${reference}` : ""}
Состав заказа · {invoiceCount} {invoiceCount === 1 ? "счёт" : invoiceCount < 5 ? "счёта" : "счетов"}
</p>
<span className="flex items-center gap-2 text-sm text-[var(--color-text-muted)]">
{products.length} поз.
<svg
className="h-4 w-4 transition-transform"
style={{ transform: isExpanded ? "rotate(180deg)" : "rotate(0deg)" }}