fix(client): compact order composition trigger
This commit is contained in:
parent
82d6f4f077
commit
44d3f0f16d
|
|
@ -1,8 +1,8 @@
|
||||||
const isLocalhost = self.location.hostname === "localhost" || self.location.hostname === "127.0.0.1";
|
const isLocalhost = self.location.hostname === "localhost" || self.location.hostname === "127.0.0.1";
|
||||||
|
|
||||||
if (!isLocalhost) {
|
if (!isLocalhost) {
|
||||||
const STATIC_CACHE = "construction-delivery-static-v96";
|
const STATIC_CACHE = "construction-delivery-static-v97";
|
||||||
const RUNTIME_CACHE = "construction-delivery-runtime-v96";
|
const RUNTIME_CACHE = "construction-delivery-runtime-v97";
|
||||||
const APP_SHELL_URLS = ["/", "/index.html", "/manifest.webmanifest", "/icons/icon-192.png", "/icons/icon-512.png"];
|
const APP_SHELL_URLS = ["/", "/index.html", "/manifest.webmanifest", "/icons/icon-192.png", "/icons/icon-512.png"];
|
||||||
|
|
||||||
self.addEventListener("install", (event) => {
|
self.addEventListener("install", (event) => {
|
||||||
|
|
|
||||||
|
|
@ -92,6 +92,13 @@ export const OrderCompositionPanel = ({ invitation = {} }) => {
|
||||||
|
|
||||||
const filteredCount = allProducts.length - products.length;
|
const filteredCount = allProducts.length - products.length;
|
||||||
const reference = getInvitationReferenceLabel(invitation);
|
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);
|
const [isExpanded, setIsExpanded] = React.useState(false);
|
||||||
|
|
||||||
|
|
@ -107,10 +114,9 @@ export const OrderCompositionPanel = ({ invitation = {} }) => {
|
||||||
onClick={() => setIsExpanded(!isExpanded)}
|
onClick={() => setIsExpanded(!isExpanded)}
|
||||||
>
|
>
|
||||||
<p className="text-sm font-semibold text-[var(--color-text)]">
|
<p className="text-sm font-semibold text-[var(--color-text)]">
|
||||||
Состав заказа{reference && reference !== "Счет —" ? ` ${reference}` : ""}
|
Состав заказа · {invoiceCount} {invoiceCount === 1 ? "счёт" : invoiceCount < 5 ? "счёта" : "счетов"}
|
||||||
</p>
|
</p>
|
||||||
<span className="flex items-center gap-2 text-sm text-[var(--color-text-muted)]">
|
<span className="flex items-center gap-2 text-sm text-[var(--color-text-muted)]">
|
||||||
{products.length} поз.
|
|
||||||
<svg
|
<svg
|
||||||
className="h-4 w-4 transition-transform"
|
className="h-4 w-4 transition-transform"
|
||||||
style={{ transform: isExpanded ? "rotate(180deg)" : "rotate(0deg)" }}
|
style={{ transform: isExpanded ? "rotate(180deg)" : "rotate(0deg)" }}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue