@fayz-ai/plugin-inventory 0.19.1 → 0.20.1

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.
@@ -5,7 +5,7 @@ import { Input, PageTransition, ComingSoon, ModulePage, Button, toast, FilterPan
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';
8
- import { Trash2, ArrowRightLeft, RefreshCw, ArrowUpRight, ArrowDownRight, Package, Ruler, MapPin, Loader2, Check, ChevronRight, CircleSlash, CircleCheck, Boxes, Layers, CircleDashed, Search, ListFilter, CalendarRange, PackageCheck, ClipboardCheck, AlertTriangle, Plus, Sparkles, X, Upload, Building2, Utensils, Clock, Printer, Pencil, Star, Undo2, ArrowUp, ArrowDown, MoreVertical } from 'lucide-react';
8
+ import { Trash2, ArrowRightLeft, RefreshCw, ArrowUpRight, ArrowDownRight, Package, Ruler, MapPin, Loader2, Check, ChevronRight, CircleSlash, CircleCheck, Boxes, Layers, Store, CircleDashed, Search, ListFilter, CalendarRange, PackageCheck, ClipboardCheck, AlertTriangle, Plus, Sparkles, X, Upload, Building2, Utensils, Clock, Printer, Pencil, Star, Undo2, ArrowUp, ArrowDown, MoreVertical } from 'lucide-react';
9
9
  import { PRODUCT_CATEGORY_KIND, T } from '@fayz-ai/inventory/data/tables';
10
10
  import { isLowStock, isOutOfStock, hasMinimum } from '@fayz-ai/inventory/domain/stock';
11
11
  import { stockValue, marginPercent } from '@fayz-ai/inventory/domain/product';
@@ -1521,6 +1521,7 @@ function ProductListView({ onNew, onOpen }) {
1521
1521
  const [search, setSearch] = useState("");
1522
1522
  const [typeFilter, setTypeFilter] = useState();
1523
1523
  const [activeFilter, setActiveFilter] = useState();
1524
+ const [channelFilter, setChannelFilter] = useState();
1524
1525
  const [categoryId, setCategoryId] = useState("");
1525
1526
  const [categories, setCategories] = useState([]);
1526
1527
  useEffect(() => {
@@ -1537,8 +1538,8 @@ function ProductListView({ onNew, onOpen }) {
1537
1538
  const [loadedOnce, setLoadedOnce] = useState(false);
1538
1539
  const [bulkBusy, setBulkBusy] = useState(false);
1539
1540
  const rascunho = useMemo(
1540
- () => ({ productType: typeFilter, categoryId, isActive: activeFilter }),
1541
- [typeFilter, categoryId, activeFilter]
1541
+ () => ({ productType: typeFilter, categoryId, isActive: activeFilter, salesChannel: channelFilter }),
1542
+ [typeFilter, categoryId, activeFilter, channelFilter]
1542
1543
  );
1543
1544
  const [emVigor, setEmVigor] = useState(rascunho);
1544
1545
  const filtrosPendentes = useMemo(
@@ -1553,13 +1554,15 @@ function ProductListView({ onNew, onOpen }) {
1553
1554
  setTypeFilter(void 0);
1554
1555
  setCategoryId("");
1555
1556
  setActiveFilter(void 0);
1557
+ setChannelFilter(void 0);
1556
1558
  };
1557
- const filtrosAtivos = (typeFilter ? 1 : 0) + (categoryId ? 1 : 0) + (activeFilter !== void 0 ? 1 : 0);
1559
+ const filtrosAtivos = (typeFilter ? 1 : 0) + (categoryId ? 1 : 0) + (activeFilter !== void 0 ? 1 : 0) + (channelFilter ? 1 : 0);
1558
1560
  const query = useMemo(() => ({
1559
1561
  productType: emVigor.productType,
1560
1562
  categoryId: emVigor.categoryId || void 0,
1561
1563
  search: search || void 0,
1562
1564
  isActive: emVigor.isActive === void 0 ? void 0 : emVigor.isActive === "true",
1565
+ salesChannel: emVigor.salesChannel,
1563
1566
  page,
1564
1567
  pageSize: PAGE_SIZE
1565
1568
  }), [emVigor, search, page]);
@@ -1616,6 +1619,11 @@ function ProductListView({ onNew, onOpen }) {
1616
1619
  }
1617
1620
  ];
1618
1621
  }, [can, bulkBusy, runBulk, t]);
1622
+ const channelOptions = [
1623
+ { value: "site", label: t("inventory.filters.channelSite") },
1624
+ { value: "delivery", label: t("inventory.filters.channelDelivery") },
1625
+ { value: "pos", label: t("inventory.filters.channelPos") }
1626
+ ];
1619
1627
  const filtros = /* @__PURE__ */ jsxs(
1620
1628
  FilterPanel,
1621
1629
  {
@@ -1669,6 +1677,26 @@ function ProductListView({ onNew, onOpen }) {
1669
1677
  ] })
1670
1678
  }
1671
1679
  ) }),
1680
+ /* @__PURE__ */ jsx(FilterPanelField, { label: t("inventory.filters.channel"), children: /* @__PURE__ */ jsx(
1681
+ RequiredFilter,
1682
+ {
1683
+ label: t("inventory.filters.channel"),
1684
+ value: channelOptions.find((c) => c.value === channelFilter)?.label ?? t("inventory.filters.allChannels"),
1685
+ icon: Store,
1686
+ className: "h-9 w-full justify-start",
1687
+ align: "start",
1688
+ children: (close) => /* @__PURE__ */ jsxs("div", { className: "space-y-0.5", children: [
1689
+ /* @__PURE__ */ jsx(FilterMenuRow, { active: !channelFilter, onClick: () => {
1690
+ setChannelFilter(void 0);
1691
+ close();
1692
+ }, children: t("inventory.filters.allChannels") }),
1693
+ channelOptions.map((c) => /* @__PURE__ */ jsx(FilterMenuRow, { active: channelFilter === c.value, onClick: () => {
1694
+ setChannelFilter(c.value);
1695
+ close();
1696
+ }, children: c.label }, c.value))
1697
+ ] })
1698
+ }
1699
+ ) }),
1672
1700
  /* @__PURE__ */ jsx(FilterPanelField, { label: t("inventory.filters.status"), children: /* @__PURE__ */ jsx(
1673
1701
  RequiredFilter,
1674
1702
  {
@@ -6669,5 +6697,5 @@ function InventoryPage({ config: appConfig, provider, store, registries }) {
6669
6697
  }
6670
6698
 
6671
6699
  export { InventoryPage };
6672
- //# sourceMappingURL=InventoryPage-WHNVIP4B.js.map
6673
- //# sourceMappingURL=InventoryPage-WHNVIP4B.js.map
6700
+ //# sourceMappingURL=InventoryPage-JLFAXKRO.js.map
6701
+ //# sourceMappingURL=InventoryPage-JLFAXKRO.js.map