@fayz-ai/plugin-inventory 0.20.2 → 0.20.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,7 +1,7 @@
1
1
  import { InventoryContextProvider, useInventoryProvider, useInventoryConfig, useInventoryStore, formatCurrency, RECIPE_SURFACE_INSTRUCTIONS } from './chunk-UZLEFDCX.js';
2
2
  import { useInventoryHouseModules, InventoryGeneralSettings } from './chunk-MJZZ4EZB.js';
3
3
  import React13, { useMemo, useState, useEffect, useCallback, useRef } from 'react';
4
- import { Input, PageTransition, ComingSoon, ModulePage, Button, toast, FilterPanel, FilterPanelField, RequiredFilter, FilterMenuRow, SubpageHeader, SearchSelect, cn, DatePicker, Textarea, InlineLink, ListView, Modal, ModalContent, Card, DataTable, SegmentedControl, ConfirmDialog, Badge, DraftCommitBar, Select, SelectTrigger, SelectValue, SelectContent, SelectItem, Switch, TooltipProvider, PageHeaderActions, DashboardCanvas, Thumbnail, ModalHeader, ModalTitle, ModalBody, Checkbox, ModalFooter, AiActionButton, ModalDescription, Tooltip, TooltipTrigger, TooltipContent, CardContent, StockEntryForm, Skeleton, CurrencyInput, openPrintWindow, printDocument, createXlsxReport, useSaveBar, Dropdown, DropdownTrigger, DropdownContent, DropdownItem, DropdownSeparator } from '@fayz-ai/ui';
4
+ import { Input, PageTransition, ComingSoon, ModulePage, Button, usePageSize, toast, FilterPanel, FilterPanelField, RequiredFilter, FilterMenuRow, SubpageHeader, SearchSelect, cn, DatePicker, Textarea, InlineLink, ListView, Modal, ModalContent, Card, DataTable, SegmentedControl, ConfirmDialog, Badge, DraftCommitBar, Select, SelectTrigger, SelectValue, SelectContent, SelectItem, Switch, TooltipProvider, PageHeaderActions, DashboardCanvas, Thumbnail, ModalHeader, ModalTitle, ModalBody, Checkbox, ModalFooter, AiActionButton, ModalDescription, Tooltip, TooltipTrigger, TooltipContent, CardContent, StockEntryForm, Skeleton, CurrencyInput, openPrintWindow, printDocument, createXlsxReport, useSaveBar, Dropdown, DropdownTrigger, DropdownContent, DropdownItem, DropdownSeparator } from '@fayz-ai/ui';
5
5
  import { useModuleNavigation, usePluginOnboardingGate, PluginOnboardingGateSkeleton, PluginSettingsPanel, createViewRouter, RegistryCrudView, ModuleActionBar, usePermissionOptional, CrudListView, useLimitGuard, invalidateRelationOptions, CrudFormSkeleton, CrudFormPage, CrudDetailPage, resolveDocumentOpenerFor, useRememberedList, usePersistedState, useScrollMemory, useAgentSurface, PageActions, useOfferedPlugins, invalidateLimit, RecordPickerModal } from '@fayz-ai/admin';
6
6
  import { useTranslation, createPendingCommand, recordRailFields, activeFacet, RECORD_GROUP, errorMessage, formatCurrency as formatCurrency$1 } from '@fayz-ai/core';
7
7
  import { jsxs, jsx, Fragment } from 'react/jsx-runtime';
@@ -1514,6 +1514,7 @@ function ProductListView({ onNew, onOpen }) {
1514
1514
  const can = usePermissionOptional();
1515
1515
  const provider = useInventoryProvider();
1516
1516
  const { currency, productTypes } = useInventoryConfig();
1517
+ const typeName = (p) => p.labelKey ? t(p.labelKey) : p.label;
1517
1518
  const products = useInventoryStore((s) => s.products);
1518
1519
  const productsTotal = useInventoryStore((s) => s.productsTotal);
1519
1520
  const productsLoading = useInventoryStore((s) => s.productsLoading);
@@ -1535,6 +1536,7 @@ function ProductListView({ onNew, onOpen }) {
1535
1536
  };
1536
1537
  }, [provider]);
1537
1538
  const [page, setPage] = useState(1);
1539
+ const [pageSize, setPageSize] = usePageSize("inventory.products", PAGE_SIZE);
1538
1540
  const [loadedOnce, setLoadedOnce] = useState(false);
1539
1541
  const [bulkBusy, setBulkBusy] = useState(false);
1540
1542
  const rascunho = useMemo(
@@ -1564,8 +1566,8 @@ function ProductListView({ onNew, onOpen }) {
1564
1566
  isActive: emVigor.isActive === void 0 ? void 0 : emVigor.isActive === "true",
1565
1567
  salesChannel: emVigor.salesChannel,
1566
1568
  page,
1567
- pageSize: PAGE_SIZE
1568
- }), [emVigor, search, page]);
1569
+ pageSize
1570
+ }), [emVigor, search, page, pageSize]);
1569
1571
  useEffect(() => {
1570
1572
  let active = true;
1571
1573
  Promise.resolve(fetchProducts(query)).finally(() => {
@@ -1640,7 +1642,10 @@ function ProductListView({ onNew, onOpen }) {
1640
1642
  RequiredFilter,
1641
1643
  {
1642
1644
  label: t("inventory.filters.kind"),
1643
- value: productTypes.find((p) => p.value === typeFilter)?.label ?? t("inventory.filters.allKinds"),
1645
+ value: (() => {
1646
+ const f = productTypes.find((p) => p.value === typeFilter);
1647
+ return f ? typeName(f) : t("inventory.filters.allKinds");
1648
+ })(),
1644
1649
  icon: Boxes,
1645
1650
  className: "h-9 w-full justify-start",
1646
1651
  align: "start",
@@ -1652,7 +1657,7 @@ function ProductListView({ onNew, onOpen }) {
1652
1657
  productTypes.map((p) => /* @__PURE__ */ jsx(FilterMenuRow, { active: typeFilter === p.value, onClick: () => {
1653
1658
  setTypeFilter(p.value);
1654
1659
  close();
1655
- }, children: /* @__PURE__ */ jsx("span", { className: "truncate", children: p.label }) }, p.value))
1660
+ }, children: /* @__PURE__ */ jsx("span", { className: "truncate", children: typeName(p) }) }, p.value))
1656
1661
  ] })
1657
1662
  }
1658
1663
  ) }),
@@ -1738,8 +1743,12 @@ function ProductListView({ onNew, onOpen }) {
1738
1743
  },
1739
1744
  searchPlaceholder: t("inventory.productList.searchPlaceholder"),
1740
1745
  page,
1741
- pageSize: PAGE_SIZE,
1746
+ pageSize,
1742
1747
  onPageChange: setPage,
1748
+ onPageSizeChange: (n) => {
1749
+ setPageSize(n);
1750
+ setPage(1);
1751
+ },
1743
1752
  bulkActions,
1744
1753
  onNew,
1745
1754
  aiCreate: {
@@ -6696,5 +6705,5 @@ function InventoryPage({ config: appConfig, provider, store, registries }) {
6696
6705
  }
6697
6706
 
6698
6707
  export { InventoryPage };
6699
- //# sourceMappingURL=InventoryPage-5LXGG6JF.js.map
6700
- //# sourceMappingURL=InventoryPage-5LXGG6JF.js.map
6708
+ //# sourceMappingURL=InventoryPage-IGUR2EOE.js.map
6709
+ //# sourceMappingURL=InventoryPage-IGUR2EOE.js.map