@fayz-ai/plugin-inventory 0.20.1 → 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(() => {
@@ -1621,7 +1623,6 @@ function ProductListView({ onNew, onOpen }) {
1621
1623
  }, [can, bulkBusy, runBulk, t]);
1622
1624
  const channelOptions = [
1623
1625
  { value: "site", label: t("inventory.filters.channelSite") },
1624
- { value: "delivery", label: t("inventory.filters.channelDelivery") },
1625
1626
  { value: "pos", label: t("inventory.filters.channelPos") }
1626
1627
  ];
1627
1628
  const filtros = /* @__PURE__ */ jsxs(
@@ -1641,7 +1642,10 @@ function ProductListView({ onNew, onOpen }) {
1641
1642
  RequiredFilter,
1642
1643
  {
1643
1644
  label: t("inventory.filters.kind"),
1644
- 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
+ })(),
1645
1649
  icon: Boxes,
1646
1650
  className: "h-9 w-full justify-start",
1647
1651
  align: "start",
@@ -1653,7 +1657,7 @@ function ProductListView({ onNew, onOpen }) {
1653
1657
  productTypes.map((p) => /* @__PURE__ */ jsx(FilterMenuRow, { active: typeFilter === p.value, onClick: () => {
1654
1658
  setTypeFilter(p.value);
1655
1659
  close();
1656
- }, children: /* @__PURE__ */ jsx("span", { className: "truncate", children: p.label }) }, p.value))
1660
+ }, children: /* @__PURE__ */ jsx("span", { className: "truncate", children: typeName(p) }) }, p.value))
1657
1661
  ] })
1658
1662
  }
1659
1663
  ) }),
@@ -1739,8 +1743,12 @@ function ProductListView({ onNew, onOpen }) {
1739
1743
  },
1740
1744
  searchPlaceholder: t("inventory.productList.searchPlaceholder"),
1741
1745
  page,
1742
- pageSize: PAGE_SIZE,
1746
+ pageSize,
1743
1747
  onPageChange: setPage,
1748
+ onPageSizeChange: (n) => {
1749
+ setPageSize(n);
1750
+ setPage(1);
1751
+ },
1744
1752
  bulkActions,
1745
1753
  onNew,
1746
1754
  aiCreate: {
@@ -6697,5 +6705,5 @@ function InventoryPage({ config: appConfig, provider, store, registries }) {
6697
6705
  }
6698
6706
 
6699
6707
  export { InventoryPage };
6700
- //# sourceMappingURL=InventoryPage-JLFAXKRO.js.map
6701
- //# sourceMappingURL=InventoryPage-JLFAXKRO.js.map
6708
+ //# sourceMappingURL=InventoryPage-IGUR2EOE.js.map
6709
+ //# sourceMappingURL=InventoryPage-IGUR2EOE.js.map