@fayz-ai/plugin-inventory 0.15.2 → 0.15.5

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.
package/dist/index.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import React4, { useMemo, useState, useEffect, useCallback, useRef } from 'react';
2
- import { toast, defineKpiWidget, defineCustomWidget, PageTransition, ComingSoon, ModulePage, Button, FilterPanel, FilterPanelField, RequiredFilter, FilterMenuRow, SubpageHeader, SearchSelect, cn, DatePicker, InlineLink, ListView, Modal, ModalContent, Card, Input, DataTable, SegmentedControl, ConfirmDialog, Badge, DraftCommitBar, Switch, TooltipProvider, DashboardCanvas, Thumbnail, Skeleton, CurrencyInput, ModalHeader, ModalTitle, ModalBody, Checkbox, ModalFooter, AiActionButton, ModalDescription, Tooltip, TooltipTrigger, TooltipContent, CardContent, Select, SelectTrigger, SelectValue, SelectContent, SelectItem, StockEntryForm, useSaveBar, Dropdown, DropdownTrigger, DropdownContent, DropdownItem, DropdownSeparator, openPrintWindow, printDocument, createXlsxReport, KpiCard, CardHeader, CardTitle } from '@fayz-ai/ui';
3
- import { createPluginContext, UNIT_DETAIL_ZONES, PluginSettingsPanel, dedup, RelatedListTab, useTenantPluginSettings, useModuleNavigation, usePluginOnboardingGate, PluginOnboardingGateSkeleton, createViewRouter, RegistryCrudView, ModuleActionBar, SettingsGroup, ToggleRow, usePermissionOptional, CrudListView, useLimitGuard, invalidateRelationOptions, CrudFormSkeleton, CrudFormPage, CrudDetailPage, formatCurrency, resolveDocumentOpenerFor, useRememberedList, usePersistedState, useScrollMemory, useAgentSurface, PermissionGate, invalidateLimit, RecordPickerModal } from '@fayz-ai/admin';
2
+ import { toast, defineKpiWidget, defineCustomWidget, PageTransition, ComingSoon, ModulePage, Button, FilterPanel, FilterPanelField, RequiredFilter, FilterMenuRow, SubpageHeader, SearchSelect, cn, DatePicker, InlineLink, ListView, Modal, ModalContent, Card, Input, DataTable, SegmentedControl, ConfirmDialog, Badge, DraftCommitBar, Switch, TooltipProvider, PageHeaderActions, DashboardCanvas, Thumbnail, Skeleton, CurrencyInput, ModalHeader, ModalTitle, ModalBody, Checkbox, ModalFooter, AiActionButton, ModalDescription, Tooltip, TooltipTrigger, TooltipContent, CardContent, Select, SelectTrigger, SelectValue, SelectContent, SelectItem, StockEntryForm, useSaveBar, Dropdown, DropdownTrigger, DropdownContent, DropdownItem, DropdownSeparator, openPrintWindow, printDocument, createXlsxReport, KpiCard, CardHeader, CardTitle } from '@fayz-ai/ui';
3
+ import { createPluginContext, UNIT_DETAIL_ZONES, PluginSettingsPanel, dedup, RelatedListTab, useTenantPluginSettings, useModuleNavigation, usePluginOnboardingGate, PluginOnboardingGateSkeleton, createViewRouter, RegistryCrudView, ModuleActionBar, SettingsGroup, ToggleRow, usePermissionOptional, CrudListView, useLimitGuard, invalidateRelationOptions, CrudFormSkeleton, CrudFormPage, CrudDetailPage, formatCurrency, resolveDocumentOpenerFor, useRememberedList, usePersistedState, useScrollMemory, useAgentSurface, PageActions, invalidateLimit, RecordPickerModal } from '@fayz-ai/admin';
4
4
  import { recordRailFields, RECORD_GROUP, activeFacet, createSafeDataProvider, registerTranslations, tl, countByTenant, useTranslation, getActiveUnitId, createPendingCommand, emitDataChanged, getSupabaseClientOptional, getActiveTenantId, errorMessage } from '@fayz-ai/core';
5
5
  import { jsxs, jsx, Fragment } from 'react/jsx-runtime';
6
6
  import { Trash2, ArrowRightLeft, RefreshCw, ArrowUpRight, ArrowDownRight, Package, Ruler, MapPin, Loader2, Check, ChevronRight, CircleSlash, CircleCheck, Boxes, Layers, CircleDashed, Search, ListFilter, CalendarRange, PackageCheck, ClipboardCheck, AlertTriangle, Plus, ArrowUp, ArrowDown, Sparkles, X, Upload, Building2, Utensils, Clock, Printer, Pencil, Star, Undo2, MoreVertical, PackageX } from 'lucide-react';
@@ -5422,7 +5422,7 @@ function buildEntity(t2, actions) {
5422
5422
  type: "text",
5423
5423
  renderCell: (_v, row) => /* @__PURE__ */ jsxs("div", { className: "flex justify-end gap-1", onClick: (e) => e.stopPropagation(), children: [
5424
5424
  /* @__PURE__ */ jsxs(Tooltip, { children: [
5425
- /* @__PURE__ */ jsx(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsx("span", { children: /* @__PURE__ */ jsx(Button, { variant: "ghost", size: "icon", className: "h-8 w-8", disabled: !row.recipeId, "aria-label": t2("inventory.recipes.print"), onClick: () => actions.onPrint(row), children: /* @__PURE__ */ jsx(Printer, { className: "h-4 w-4" }) }) }) }),
5425
+ /* @__PURE__ */ jsx(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsx("span", { className: "hidden md:inline-flex", children: /* @__PURE__ */ jsx(Button, { variant: "ghost", size: "icon", className: "h-8 w-8", disabled: !row.recipeId, "aria-label": t2("inventory.recipes.print"), onClick: () => actions.onPrint(row), children: /* @__PURE__ */ jsx(Printer, { className: "h-4 w-4" }) }) }) }),
5426
5426
  /* @__PURE__ */ jsx(TooltipContent, { children: row.recipeId ? t2("inventory.recipes.print") : t2("inventory.recipes.printNoSheet") })
5427
5427
  ] }),
5428
5428
  /* @__PURE__ */ jsxs(Tooltip, { children: [
@@ -5555,6 +5555,20 @@ function RecipesView({ onOpenProduct }) {
5555
5555
  }
5556
5556
  return /* @__PURE__ */ jsxs(TooltipProvider, { delayDuration: 300, children: [
5557
5557
  /* @__PURE__ */ jsx("div", { ref: scrollAnchor }),
5558
+ /* @__PURE__ */ jsx(PageHeaderActions, { children: /* @__PURE__ */ jsx(
5559
+ PageActions,
5560
+ {
5561
+ actions: [{
5562
+ id: "new-recipe",
5563
+ label: t2("inventory.recipes.newRecipe"),
5564
+ icon: Plus,
5565
+ intent: "primary",
5566
+ creates: true,
5567
+ permission: { feature: "inventory", action: "edit" },
5568
+ onSelect: () => setPicking(true)
5569
+ }]
5570
+ }
5571
+ ) }),
5558
5572
  /* @__PURE__ */ jsx(
5559
5573
  CrudListView,
5560
5574
  {
@@ -5567,10 +5581,6 @@ function RecipesView({ onOpenProduct }) {
5567
5581
  facets,
5568
5582
  activeFilters: filters,
5569
5583
  onFacetChange: (field, value) => setFilters((prev) => ({ ...prev, [field]: value })),
5570
- headerActions: /* @__PURE__ */ jsx(PermissionGate, { feature: "inventory", action: "edit", children: /* @__PURE__ */ jsxs(Button, { onClick: () => setPicking(true), children: [
5571
- /* @__PURE__ */ jsx(Plus, { className: "mr-1.5 h-4 w-4" }),
5572
- t2("inventory.recipes.newRecipe")
5573
- ] }) }),
5574
5584
  onRowClick: (row) => onOpenProduct(row.productId),
5575
5585
  emptyMessage: t2("inventory.recipes.noRecipes"),
5576
5586
  onRefresh: () => load(),